@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/esm/index.es.js CHANGED
@@ -7,7 +7,7 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
7
7
  /**
8
8
  * The version of the Promptbook library
9
9
  */
10
- var PROMPTBOOK_VERSION = '0.66.0-8';
10
+ var PROMPTBOOK_VERSION = '0.66.0';
11
11
  // TODO: !!!! List here all the versions and annotate + put into script
12
12
 
13
13
  /*! *****************************************************************************
@@ -129,6 +129,245 @@ function __spreadArray(to, from, pack) {
129
129
  return to.concat(ar || Array.prototype.slice.call(from));
130
130
  }
131
131
 
132
+ /**
133
+ * Returns the same value that is passed as argument.
134
+ * No side effects.
135
+ *
136
+ * Note: It can be usefull for:
137
+ *
138
+ * 1) Leveling indentation
139
+ * 2) Putting always-true or always-false conditions without getting eslint errors
140
+ *
141
+ * @param value any values
142
+ * @returns the same values
143
+ * @private within the repository
144
+ */
145
+ function just(value) {
146
+ if (value === undefined) {
147
+ return undefined;
148
+ }
149
+ return value;
150
+ }
151
+
152
+ /**
153
+ * @@@
154
+ *
155
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
156
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
157
+ *
158
+ * @returns The same object as the input, but deeply frozen
159
+ * @public exported from `@promptbook/utils`
160
+ */
161
+ function $deepFreeze(objectValue) {
162
+ var e_1, _a;
163
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
164
+ try {
165
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
166
+ var propertyName = propertyNames_1_1.value;
167
+ var value = objectValue[propertyName];
168
+ if (value && typeof value === 'object') {
169
+ $deepFreeze(value);
170
+ }
171
+ }
172
+ }
173
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
174
+ finally {
175
+ try {
176
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
177
+ }
178
+ finally { if (e_1) throw e_1.error; }
179
+ }
180
+ return Object.freeze(objectValue);
181
+ }
182
+ /**
183
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
184
+ */
185
+
186
+ /**
187
+ * This error type indicates that the error should not happen and its last check before crashing with some other error
188
+ *
189
+ * @public exported from `@promptbook/core`
190
+ */
191
+ var UnexpectedError = /** @class */ (function (_super) {
192
+ __extends(UnexpectedError, _super);
193
+ function UnexpectedError(message) {
194
+ var _this = _super.call(this, 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;
195
+ _this.name = 'UnexpectedError';
196
+ Object.setPrototypeOf(_this, UnexpectedError.prototype);
197
+ return _this;
198
+ }
199
+ return UnexpectedError;
200
+ }(Error));
201
+
202
+ /**
203
+ * Checks if the value is [🚉] serializable as JSON
204
+ * If not, throws an UnexpectedError with a rich error message and tracking
205
+ *
206
+ * - Almost all primitives are serializable BUT:
207
+ * - `undefined` is not serializable
208
+ * - `NaN` is not serializable
209
+ * - Objects and arrays are serializable if all their properties are serializable
210
+ * - Functions are not serializable
211
+ * - Circular references are not serializable
212
+ * - `Date` objects are not serializable
213
+ * - `Map` and `Set` objects are not serializable
214
+ * - `RegExp` objects are not serializable
215
+ * - `Error` objects are not serializable
216
+ * - `Symbol` objects are not serializable
217
+ * - And much more...
218
+ *
219
+ * @throws UnexpectedError if the value is not serializable as JSON
220
+ * @public exported from `@promptbook/utils`
221
+ */
222
+ function checkSerializableAsJson(name, value) {
223
+ var e_1, _a;
224
+ if (value === undefined) {
225
+ throw new UnexpectedError("".concat(name, " is undefined"));
226
+ }
227
+ else if (value === null) {
228
+ return;
229
+ }
230
+ else if (typeof value === 'boolean') {
231
+ return;
232
+ }
233
+ else if (typeof value === 'number' && !isNaN(value)) {
234
+ return;
235
+ }
236
+ else if (typeof value === 'string') {
237
+ return;
238
+ }
239
+ else if (typeof value === 'symbol') {
240
+ throw new UnexpectedError("".concat(name, " is symbol"));
241
+ }
242
+ else if (typeof value === 'function') {
243
+ throw new UnexpectedError("".concat(name, " is function"));
244
+ }
245
+ else if (typeof value === 'object' && Array.isArray(value)) {
246
+ for (var i = 0; i < value.length; i++) {
247
+ checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
248
+ }
249
+ }
250
+ else if (typeof value === 'object') {
251
+ if (value instanceof Date) {
252
+ throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
253
+ }
254
+ else if (value instanceof Map) {
255
+ throw new UnexpectedError("".concat(name, " is Map"));
256
+ }
257
+ else if (value instanceof Set) {
258
+ throw new UnexpectedError("".concat(name, " is Set"));
259
+ }
260
+ else if (value instanceof RegExp) {
261
+ throw new UnexpectedError("".concat(name, " is RegExp"));
262
+ }
263
+ else if (value instanceof Error) {
264
+ throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
265
+ }
266
+ else {
267
+ try {
268
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
269
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
270
+ if (subValue === undefined) {
271
+ // Note: undefined in object is serializable - it is just omited
272
+ continue;
273
+ }
274
+ checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
275
+ }
276
+ }
277
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
278
+ finally {
279
+ try {
280
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
281
+ }
282
+ finally { if (e_1) throw e_1.error; }
283
+ }
284
+ try {
285
+ JSON.stringify(value); // <- TODO: [0]
286
+ }
287
+ catch (error) {
288
+ if (!(error instanceof Error)) {
289
+ throw error;
290
+ }
291
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
292
+ }
293
+ /*
294
+ TODO: [0] Is there some more elegant way to check circular references?
295
+ const seen = new Set();
296
+ const stack = [{ value }];
297
+ while (stack.length > 0) {
298
+ const { value } = stack.pop()!;
299
+ if (typeof value === 'object' && value !== null) {
300
+ if (seen.has(value)) {
301
+ throw new UnexpectedError(`${name} has circular reference`);
302
+ }
303
+ seen.add(value);
304
+ if (Array.isArray(value)) {
305
+ stack.push(...value.map((value) => ({ value })));
306
+ } else {
307
+ stack.push(...Object.values(value).map((value) => ({ value })));
308
+ }
309
+ }
310
+ }
311
+ */
312
+ return;
313
+ }
314
+ }
315
+ else {
316
+ throw new UnexpectedError("".concat(name, " is unknown"));
317
+ }
318
+ }
319
+ /**
320
+ * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
321
+ * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
322
+ * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
323
+ */
324
+
325
+ /**
326
+ * @@@
327
+ * @@@
328
+ *
329
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
330
+ *
331
+ * @param name - Name of the object for debugging purposes
332
+ * @param objectValue - Object to be deeply frozen
333
+ * @returns The same object as the input, but deeply frozen
334
+ * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
335
+ */
336
+ function $asDeeplyFrozenSerializableJson(name, objectValue) {
337
+ checkSerializableAsJson(name, objectValue);
338
+ return $deepFreeze(objectValue);
339
+ }
340
+ /**
341
+ * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
342
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
343
+ */
344
+
345
+ /**
346
+ * The names of the parameters that are reserved for special purposes
347
+ *
348
+ * @public exported from `@promptbook/core`
349
+ */
350
+ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
351
+ 'content',
352
+ 'context',
353
+ 'knowledge',
354
+ 'samples',
355
+ 'modelName',
356
+ 'currentDate',
357
+ // <- TODO: Add more like 'date', 'modelName',...
358
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
359
+ ]);
360
+ // <- TODO: [🧜‍♂️]
361
+ /**
362
+ * @@@
363
+ *
364
+ * @public exported from `@promptbook/core`
365
+ */
366
+ var IS_VERBOSE = false;
367
+ /**
368
+ * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
369
+ */
370
+
132
371
  /**
133
372
  * This error indicates errors during the execution of the pipeline
134
373
  *
@@ -146,21 +385,169 @@ var PipelineExecutionError = /** @class */ (function (_super) {
146
385
  }(Error));
147
386
 
148
387
  /**
149
- * This error type indicates that the error should not happen and its last check before crashing with some other error
388
+ * This error indicates that the pipeline collection cannot be propperly loaded
150
389
  *
151
390
  * @public exported from `@promptbook/core`
152
391
  */
153
- var UnexpectedError = /** @class */ (function (_super) {
154
- __extends(UnexpectedError, _super);
155
- function UnexpectedError(message) {
156
- var _this = _super.call(this, 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;
157
- _this.name = 'UnexpectedError';
158
- Object.setPrototypeOf(_this, UnexpectedError.prototype);
392
+ var CollectionError = /** @class */ (function (_super) {
393
+ __extends(CollectionError, _super);
394
+ function CollectionError(message) {
395
+ var _this = _super.call(this, message) || this;
396
+ _this.name = 'CollectionError';
397
+ Object.setPrototypeOf(_this, CollectionError.prototype);
159
398
  return _this;
160
399
  }
161
- return UnexpectedError;
400
+ return CollectionError;
401
+ }(Error));
402
+
403
+ /**
404
+ * This error type indicates that you try to use a feature that is not available in the current environment
405
+ *
406
+ * @public exported from `@promptbook/core`
407
+ */
408
+ var EnvironmentMismatchError = /** @class */ (function (_super) {
409
+ __extends(EnvironmentMismatchError, _super);
410
+ function EnvironmentMismatchError(message) {
411
+ var _this = _super.call(this, message) || this;
412
+ _this.name = 'EnvironmentMismatchError';
413
+ Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
414
+ return _this;
415
+ }
416
+ return EnvironmentMismatchError;
417
+ }(Error));
418
+
419
+ /**
420
+ * This error type indicates that some limit was reached
421
+ *
422
+ * @public exported from `@promptbook/core`
423
+ */
424
+ var LimitReachedError = /** @class */ (function (_super) {
425
+ __extends(LimitReachedError, _super);
426
+ function LimitReachedError(message) {
427
+ var _this = _super.call(this, message) || this;
428
+ _this.name = 'LimitReachedError';
429
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
430
+ return _this;
431
+ }
432
+ return LimitReachedError;
433
+ }(Error));
434
+
435
+ /**
436
+ * This error indicates that promptbook not found in the collection
437
+ *
438
+ * @public exported from `@promptbook/core`
439
+ */
440
+ var NotFoundError = /** @class */ (function (_super) {
441
+ __extends(NotFoundError, _super);
442
+ function NotFoundError(message) {
443
+ var _this = _super.call(this, message) || this;
444
+ _this.name = 'NotFoundError';
445
+ Object.setPrototypeOf(_this, NotFoundError.prototype);
446
+ return _this;
447
+ }
448
+ return NotFoundError;
449
+ }(Error));
450
+
451
+ /**
452
+ * This error type indicates that some part of the code is not implemented yet
453
+ *
454
+ * @public exported from `@promptbook/core`
455
+ */
456
+ var NotYetImplementedError = /** @class */ (function (_super) {
457
+ __extends(NotYetImplementedError, _super);
458
+ function NotYetImplementedError(message) {
459
+ var _this = _super.call(this, 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;
460
+ _this.name = 'NotYetImplementedError';
461
+ Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
462
+ return _this;
463
+ }
464
+ return NotYetImplementedError;
465
+ }(Error));
466
+
467
+ /**
468
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
469
+ *
470
+ * @public exported from `@promptbook/core`
471
+ */
472
+ var ParsingError = /** @class */ (function (_super) {
473
+ __extends(ParsingError, _super);
474
+ function ParsingError(message) {
475
+ var _this = _super.call(this, message) || this;
476
+ _this.name = 'ParsingError';
477
+ Object.setPrototypeOf(_this, ParsingError.prototype);
478
+ return _this;
479
+ }
480
+ return ParsingError;
481
+ }(Error));
482
+
483
+ /**
484
+ * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
485
+ *
486
+ * @public exported from `@promptbook/core`
487
+ */
488
+ var PipelineLogicError = /** @class */ (function (_super) {
489
+ __extends(PipelineLogicError, _super);
490
+ function PipelineLogicError(message) {
491
+ var _this = _super.call(this, message) || this;
492
+ _this.name = 'PipelineLogicError';
493
+ Object.setPrototypeOf(_this, PipelineLogicError.prototype);
494
+ return _this;
495
+ }
496
+ return PipelineLogicError;
497
+ }(Error));
498
+
499
+ /**
500
+ * This error indicates errors in referencing promptbooks between each other
501
+ *
502
+ * @public exported from `@promptbook/core`
503
+ */
504
+ var PipelineUrlError = /** @class */ (function (_super) {
505
+ __extends(PipelineUrlError, _super);
506
+ function PipelineUrlError(message) {
507
+ var _this = _super.call(this, message) || this;
508
+ _this.name = 'PipelineUrlError';
509
+ Object.setPrototypeOf(_this, PipelineUrlError.prototype);
510
+ return _this;
511
+ }
512
+ return PipelineUrlError;
162
513
  }(Error));
163
514
 
515
+ /**
516
+ * Index of all custom errors
517
+ *
518
+ * @public exported from `@promptbook/core`
519
+ */
520
+ var ERRORS = {
521
+ CollectionError: CollectionError,
522
+ EnvironmentMismatchError: EnvironmentMismatchError,
523
+ LimitReachedError: LimitReachedError,
524
+ NotFoundError: NotFoundError,
525
+ NotYetImplementedError: NotYetImplementedError,
526
+ ParsingError: ParsingError,
527
+ PipelineExecutionError: PipelineExecutionError,
528
+ PipelineLogicError: PipelineLogicError,
529
+ PipelineUrlError: PipelineUrlError,
530
+ UnexpectedError: UnexpectedError,
531
+ // TODO: [🪑]> VersionMismatchError,
532
+ };
533
+
534
+ /**
535
+ * Serializes an error into a [🚉] JSON-serializable object
536
+ *
537
+ * @public exported from `@promptbook/utils`
538
+ */
539
+ function serializeError(error) {
540
+ var name = error.name, message = error.message, stack = error.stack;
541
+ if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
542
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
543
+ }
544
+ return {
545
+ name: name,
546
+ message: message,
547
+ stack: stack,
548
+ };
549
+ }
550
+
164
551
  /**
165
552
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
166
553
  *
@@ -459,14 +846,11 @@ function joinLlmExecutionTools() {
459
846
  *
460
847
  * Note: `$` is used to indicate that this function is not a pure function - it access global scope
461
848
  *
462
- * @public exported from `@promptbook/utils`
849
+ * @private internal function of `$Register`
463
850
  */
464
851
  function $getGlobalScope() {
465
852
  return Function('return this')();
466
853
  }
467
- /***
468
- * TODO: !!!!! Make private and promptbook registry from this
469
- */
470
854
 
471
855
  /**
472
856
  * Register is @@@
@@ -497,13 +881,10 @@ var $Register = /** @class */ (function () {
497
881
  var packageName = registered.packageName, className = registered.className;
498
882
  var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
499
883
  var existingRegistration = this.storage[existingRegistrationIndex];
500
- // TODO: !!!!!! Global IS_VERBOSE mode
501
884
  if (!existingRegistration) {
502
- console.warn("[\uD83D\uDCE6] Registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
503
885
  this.storage.push(registered);
504
886
  }
505
887
  else {
506
- console.warn("[\uD83D\uDCE6] Re-registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
507
888
  this.storage[existingRegistrationIndex] = registered;
508
889
  }
509
890
  };
@@ -519,26 +900,6 @@ var $Register = /** @class */ (function () {
519
900
  */
520
901
  var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
521
902
 
522
- /**
523
- * Returns the same value that is passed as argument.
524
- * No side effects.
525
- *
526
- * Note: It can be usefull for:
527
- *
528
- * 1) Leveling indentation
529
- * 2) Putting always-true or always-false conditions without getting eslint errors
530
- *
531
- * @param value any values
532
- * @returns the same values
533
- * @private within the repository
534
- */
535
- function just(value) {
536
- if (value === undefined) {
537
- return undefined;
538
- }
539
- return value;
540
- }
541
-
542
903
  /**
543
904
  * @@@
544
905
  *
@@ -653,7 +1014,7 @@ function $registeredLlmToolsMessage() {
653
1014
  */
654
1015
  function createLlmToolsFromConfiguration(configuration, options) {
655
1016
  if (options === void 0) { options = {}; }
656
- var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
1017
+ var _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
657
1018
  var llmTools = configuration.map(function (llmConfiguration) {
658
1019
  var registeredItem = $llmToolsRegister
659
1020
  .list()
@@ -690,7 +1051,7 @@ function startRemoteServer(options) {
690
1051
  var _this = this;
691
1052
  var _a = __assign({ isAnonymousModeAllowed: false, isCollectionModeAllowed: false, collection: null, createLlmExecutionTools: null }, options), port = _a.port, path = _a.path, collection = _a.collection, createLlmExecutionTools = _a.createLlmExecutionTools,
692
1053
  // <- TODO: [🧠][🤺] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
693
- isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? false : _b;
1054
+ isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
694
1055
  // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
695
1056
  var httpServer = http.createServer({}, function (request, response) { return __awaiter(_this, void 0, void 0, function () {
696
1057
  var _a, _b;
@@ -829,7 +1190,7 @@ function startRemoteServer(options) {
829
1190
  if (!(error_1 instanceof Error)) {
830
1191
  throw error_1;
831
1192
  }
832
- socket.emit('error', { errorMessage: error_1.message });
1193
+ socket.emit('error', serializeError(error_1));
833
1194
  return [3 /*break*/, 16];
834
1195
  case 15:
835
1196
  socket.disconnect();
@@ -878,7 +1239,7 @@ function startRemoteServer(options) {
878
1239
  if (!(error_2 instanceof Error)) {
879
1240
  throw error_2;
880
1241
  }
881
- socket.emit('error', { errorMessage: error_2.message });
1242
+ socket.emit('error', serializeError(error_2));
882
1243
  return [3 /*break*/, 5];
883
1244
  case 4:
884
1245
  socket.disconnect();
@@ -916,6 +1277,7 @@ function startRemoteServer(options) {
916
1277
  };
917
1278
  }
918
1279
  /**
1280
+ * TODO: Maybe use `$asDeeplyFrozenSerializableJson`
919
1281
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
920
1282
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
921
1283
  * TODO: Handle progress - support streaming