@promptbook/remote-server 0.89.0-15 โ†’ 0.89.0-16

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/esm/index.es.js CHANGED
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
33
33
  * @generated
34
34
  * @see https://github.com/webgptorg/promptbook
35
35
  */
36
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-15';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
37
37
  /**
38
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
39
39
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -100,6 +100,7 @@ const ADMIN_GITHUB_NAME = 'hejny';
100
100
  * @public exported from `@promptbook/core`
101
101
  */
102
102
  const CLAIM = `It's time for a paradigm shift. The future of software in plain English, French or Latin`;
103
+ // <- TODO: [๐ŸŠ] Pick the best claim
103
104
  /**
104
105
  * When the title is not provided, the default title is used
105
106
  *
@@ -172,7 +173,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
172
173
  */
173
174
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
174
175
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
175
- // TODO: !!!!!! Just .promptbook dir, hardocode others
176
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
176
177
  /**
177
178
  * Where to store the temporary downloads
178
179
  *
@@ -304,44 +305,42 @@ class WrappedError extends Error {
304
305
  constructor(whatWasThrown) {
305
306
  const tag = `[๐Ÿคฎ]`;
306
307
  console.error(tag, whatWasThrown);
307
- super(spaceTrim$1((block) => `
308
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
309
-
310
- Note: Look for ${tag} in the console for more details
311
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
308
+ super(spaceTrim$1(`
309
+ Non-Error object was thrown
312
310
 
313
- Please report issue on ${ADMIN_EMAIL}
314
-
315
- `));
311
+ Note: Look for ${tag} in the console for more details
312
+ Please report issue on ${ADMIN_EMAIL}
313
+ `));
316
314
  this.name = 'WrappedError';
317
315
  Object.setPrototypeOf(this, WrappedError.prototype);
318
316
  }
319
317
  }
320
318
 
321
319
  /**
322
- * !!!@@@
320
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
323
321
  *
324
- * @param whatWasThrown !!!@@@
325
- * @returns !!!@@@
322
+ * @param whatWasThrown Any object that was thrown
323
+ * @returns Nothing if the error is an instance of `Error`
324
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
326
325
  *
327
326
  * @private within the repository
328
327
  */
329
328
  function assertsError(whatWasThrown) {
330
- // Case 1: !!!@@@
329
+ // Case 1: Handle error which was rethrown as `WrappedError`
331
330
  if (whatWasThrown instanceof WrappedError) {
332
331
  const wrappedError = whatWasThrown;
333
332
  throw wrappedError;
334
333
  }
335
- // Case 2: !!!@@@
334
+ // Case 2: Handle unexpected errors
336
335
  if (whatWasThrown instanceof UnexpectedError) {
337
336
  const unexpectedError = whatWasThrown;
338
337
  throw unexpectedError;
339
338
  }
340
- // Case 3: !!!@@@
339
+ // Case 3: Handle standard errors - keep them up to consumer
341
340
  if (whatWasThrown instanceof Error) {
342
341
  return;
343
342
  }
344
- // Case 4: !!!@@@
343
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
345
344
  throw new WrappedError(whatWasThrown);
346
345
  }
347
346
 
@@ -420,7 +419,7 @@ class PipelineExecutionError extends Error {
420
419
  }
421
420
  }
422
421
  /**
423
- * TODO: !!!!!! Add id to all errors
422
+ * TODO: [๐Ÿง ][๐ŸŒ‚] Add id to all errors
424
423
  */
425
424
 
426
425
  /**
@@ -1992,8 +1991,8 @@ function createTask(options) {
1992
1991
  updatedAt = new Date();
1993
1992
  errors.push(...executionResult.errors);
1994
1993
  warnings.push(...executionResult.warnings);
1995
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
1996
- // TODO: [๐Ÿง ] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
1994
+ // <- TODO: [๐ŸŒ‚] Only unique errors and warnings should be added (or filtered)
1995
+ // TODO: [๐Ÿง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
1997
1996
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
1998
1997
  // And delete `ExecutionTask.currentValue.preparedPipeline`
1999
1998
  assertsTaskSuccessful(executionResult);