@promptbook/node 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
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
30
30
  * @generated
31
31
  * @see https://github.com/webgptorg/promptbook
32
32
  */
33
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-15';
33
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
34
34
  /**
35
35
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
36
36
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -76,6 +76,7 @@ const ADMIN_EMAIL = 'pavol@ptbk.io';
76
76
  * @public exported from `@promptbook/core`
77
77
  */
78
78
  const ADMIN_GITHUB_NAME = 'hejny';
79
+ // <- TODO: [๐ŸŠ] Pick the best claim
79
80
  /**
80
81
  * When the title is not provided, the default title is used
81
82
  *
@@ -160,7 +161,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
160
161
  */
161
162
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
162
163
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
163
- // TODO: !!!!!! Just .promptbook dir, hardocode others
164
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
164
165
  /**
165
166
  * Where to store the temporary downloads
166
167
  *
@@ -349,44 +350,42 @@ class WrappedError extends Error {
349
350
  constructor(whatWasThrown) {
350
351
  const tag = `[๐Ÿคฎ]`;
351
352
  console.error(tag, whatWasThrown);
352
- super(spaceTrim$1((block) => `
353
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
354
-
355
- Note: Look for ${tag} in the console for more details
356
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
357
-
358
- Please report issue on ${ADMIN_EMAIL}
353
+ super(spaceTrim$1(`
354
+ Non-Error object was thrown
359
355
 
360
- `));
356
+ Note: Look for ${tag} in the console for more details
357
+ Please report issue on ${ADMIN_EMAIL}
358
+ `));
361
359
  this.name = 'WrappedError';
362
360
  Object.setPrototypeOf(this, WrappedError.prototype);
363
361
  }
364
362
  }
365
363
 
366
364
  /**
367
- * !!!@@@
365
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
368
366
  *
369
- * @param whatWasThrown !!!@@@
370
- * @returns !!!@@@
367
+ * @param whatWasThrown Any object that was thrown
368
+ * @returns Nothing if the error is an instance of `Error`
369
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
371
370
  *
372
371
  * @private within the repository
373
372
  */
374
373
  function assertsError(whatWasThrown) {
375
- // Case 1: !!!@@@
374
+ // Case 1: Handle error which was rethrown as `WrappedError`
376
375
  if (whatWasThrown instanceof WrappedError) {
377
376
  const wrappedError = whatWasThrown;
378
377
  throw wrappedError;
379
378
  }
380
- // Case 2: !!!@@@
379
+ // Case 2: Handle unexpected errors
381
380
  if (whatWasThrown instanceof UnexpectedError) {
382
381
  const unexpectedError = whatWasThrown;
383
382
  throw unexpectedError;
384
383
  }
385
- // Case 3: !!!@@@
384
+ // Case 3: Handle standard errors - keep them up to consumer
386
385
  if (whatWasThrown instanceof Error) {
387
386
  return;
388
387
  }
389
- // Case 4: !!!@@@
388
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
390
389
  throw new WrappedError(whatWasThrown);
391
390
  }
392
391
 
@@ -1708,7 +1707,7 @@ class PipelineExecutionError extends Error {
1708
1707
  }
1709
1708
  }
1710
1709
  /**
1711
- * TODO: !!!!!! Add id to all errors
1710
+ * TODO: [๐Ÿง ][๐ŸŒ‚] Add id to all errors
1712
1711
  */
1713
1712
 
1714
1713
  /**
@@ -2020,8 +2019,8 @@ function createTask(options) {
2020
2019
  updatedAt = new Date();
2021
2020
  errors.push(...executionResult.errors);
2022
2021
  warnings.push(...executionResult.warnings);
2023
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
2024
- // TODO: [๐Ÿง ] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2022
+ // <- TODO: [๐ŸŒ‚] Only unique errors and warnings should be added (or filtered)
2023
+ // TODO: [๐Ÿง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2025
2024
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
2026
2025
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2027
2026
  assertsTaskSuccessful(executionResult);