@promptbook/documents 0.89.0-15 โ†’ 0.89.0-17

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
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-15';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-17';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -91,6 +91,7 @@ const ADMIN_EMAIL = 'pavol@ptbk.io';
91
91
  * @public exported from `@promptbook/core`
92
92
  */
93
93
  const ADMIN_GITHUB_NAME = 'hejny';
94
+ // <- TODO: [๐ŸŠ] Pick the best claim
94
95
  /**
95
96
  * When the title is not provided, the default title is used
96
97
  *
@@ -163,7 +164,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
163
164
  */
164
165
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
165
166
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
166
- // TODO: !!!!!! Just .promptbook dir, hardocode others
167
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
167
168
  /**
168
169
  * Where to store the temporary downloads
169
170
  *
@@ -1080,44 +1081,42 @@ class WrappedError extends Error {
1080
1081
  constructor(whatWasThrown) {
1081
1082
  const tag = `[๐Ÿคฎ]`;
1082
1083
  console.error(tag, whatWasThrown);
1083
- super(spaceTrim((block) => `
1084
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
1085
-
1086
- Note: Look for ${tag} in the console for more details
1087
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
1084
+ super(spaceTrim(`
1085
+ Non-Error object was thrown
1088
1086
 
1089
- Please report issue on ${ADMIN_EMAIL}
1090
-
1091
- `));
1087
+ Note: Look for ${tag} in the console for more details
1088
+ Please report issue on ${ADMIN_EMAIL}
1089
+ `));
1092
1090
  this.name = 'WrappedError';
1093
1091
  Object.setPrototypeOf(this, WrappedError.prototype);
1094
1092
  }
1095
1093
  }
1096
1094
 
1097
1095
  /**
1098
- * !!!@@@
1096
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
1099
1097
  *
1100
- * @param whatWasThrown !!!@@@
1101
- * @returns !!!@@@
1098
+ * @param whatWasThrown Any object that was thrown
1099
+ * @returns Nothing if the error is an instance of `Error`
1100
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
1102
1101
  *
1103
1102
  * @private within the repository
1104
1103
  */
1105
1104
  function assertsError(whatWasThrown) {
1106
- // Case 1: !!!@@@
1105
+ // Case 1: Handle error which was rethrown as `WrappedError`
1107
1106
  if (whatWasThrown instanceof WrappedError) {
1108
1107
  const wrappedError = whatWasThrown;
1109
1108
  throw wrappedError;
1110
1109
  }
1111
- // Case 2: !!!@@@
1110
+ // Case 2: Handle unexpected errors
1112
1111
  if (whatWasThrown instanceof UnexpectedError) {
1113
1112
  const unexpectedError = whatWasThrown;
1114
1113
  throw unexpectedError;
1115
1114
  }
1116
- // Case 3: !!!@@@
1115
+ // Case 3: Handle standard errors - keep them up to consumer
1117
1116
  if (whatWasThrown instanceof Error) {
1118
1117
  return;
1119
1118
  }
1120
- // Case 4: !!!@@@
1119
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
1121
1120
  throw new WrappedError(whatWasThrown);
1122
1121
  }
1123
1122
 
@@ -2256,7 +2255,7 @@ class PipelineExecutionError extends Error {
2256
2255
  }
2257
2256
  }
2258
2257
  /**
2259
- * TODO: !!!!!! Add id to all errors
2258
+ * TODO: [๐Ÿง ][๐ŸŒ‚] Add id to all errors
2260
2259
  */
2261
2260
 
2262
2261
  /**
@@ -2609,8 +2608,8 @@ function createTask(options) {
2609
2608
  updatedAt = new Date();
2610
2609
  errors.push(...executionResult.errors);
2611
2610
  warnings.push(...executionResult.warnings);
2612
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
2613
- // TODO: [๐Ÿง ] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2611
+ // <- TODO: [๐ŸŒ‚] Only unique errors and warnings should be added (or filtered)
2612
+ // TODO: [๐Ÿง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2614
2613
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
2615
2614
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2616
2615
  assertsTaskSuccessful(executionResult);