@promptbook/pdf 0.89.0-8 → 0.89.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 (50) hide show
  1. package/README.md +9 -11
  2. package/esm/index.es.js +155 -42
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/servers.d.ts +40 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +12 -4
  6. package/esm/typings/src/_packages/remote-client.index.d.ts +6 -6
  7. package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
  8. package/esm/typings/src/_packages/types.index.d.ts +24 -14
  9. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  10. package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
  11. package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +16 -3
  12. package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
  13. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -0
  14. package/esm/typings/src/config.d.ts +10 -19
  15. package/esm/typings/src/errors/0-index.d.ts +8 -2
  16. package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
  17. package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
  18. package/esm/typings/src/errors/WrappedError.d.ts +10 -0
  19. package/esm/typings/src/errors/assertsError.d.ts +11 -0
  20. package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
  21. package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +9 -0
  22. package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
  23. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +3 -0
  24. package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
  25. package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
  26. package/esm/typings/src/llm-providers/_common/register/$provideEnvFilename.d.ts +12 -0
  27. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
  28. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
  29. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +15 -4
  30. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
  31. package/esm/typings/src/remote-server/openapi-types.d.ts +284 -0
  32. package/esm/typings/src/remote-server/openapi.d.ts +187 -0
  33. package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +9 -3
  34. package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
  35. package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
  36. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
  37. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
  38. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
  39. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
  40. package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +2 -2
  41. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +57 -38
  42. package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
  43. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
  44. package/esm/typings/src/types/typeAliases.d.ts +26 -0
  45. package/package.json +9 -5
  46. package/umd/index.umd.js +155 -42
  47. package/umd/index.umd.js.map +1 -1
  48. package/esm/typings/src/cli/test/ptbk2.d.ts +0 -5
  49. package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
  50. package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
package/README.md CHANGED
@@ -23,10 +23,6 @@
23
23
 
24
24
 
25
25
 
26
- <blockquote style="color: #ff8811">
27
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
28
- </blockquote>
29
-
30
26
  ## 📦 Package `@promptbook/pdf`
31
27
 
32
28
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -246,6 +242,10 @@ But unlike programming languages, it is designed to be understandable by non-pro
246
242
 
247
243
 
248
244
 
245
+ ## 🔒 Security
246
+
247
+ For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md).
248
+
249
249
  ## 📦 Packages _(for developers)_
250
250
 
251
251
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -302,7 +302,7 @@ The following glossary is used to clarify certain concepts:
302
302
  ### General LLM / AI terms
303
303
 
304
304
  - **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture.
305
- - **Pipeline, workflow or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.
305
+ - [**Pipeline, workflow scenario or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.](https://github.com/webgptorg/promptbook/discussions/88)
306
306
  - **Fine-tuning** is a process where a pre-trained AI model is further trained on a specific dataset to improve its performance on a specific task.
307
307
  - **Zero-shot learning** is a machine learning paradigm where a model is trained to perform a task without any labeled examples. Instead, the model is provided with a description of the task and is expected to generate the correct output.
308
308
  - **Few-shot learning** is a machine learning paradigm where a model is trained to perform a task with only a few labeled examples. This is in contrast to traditional machine learning, where models are trained on large datasets.
@@ -310,10 +310,6 @@ The following glossary is used to clarify certain concepts:
310
310
  - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
311
311
  - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
312
312
 
313
-
314
-
315
-
316
-
317
313
  _Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
318
314
 
319
315
 
@@ -427,6 +423,8 @@ See [TODO.md](./TODO.md)
427
423
 
428
424
  ## 🖋️ Contributing
429
425
 
430
- We are open to pull requests, feedback, and suggestions.
426
+ You can also ⭐ star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).We are open to [pull requests, feedback, and suggestions](./CONTRIBUTING.md).
427
+
428
+ ## 📞 Support
431
429
 
432
- You can also star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).
430
+ If you need help or have questions, please check our [Support Resources](./SUPPORT.md).
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-8';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -89,6 +89,7 @@ const ADMIN_EMAIL = 'pavol@ptbk.io';
89
89
  * @public exported from `@promptbook/core`
90
90
  */
91
91
  const ADMIN_GITHUB_NAME = 'hejny';
92
+ // <- TODO: [🐊] Pick the best claim
92
93
  /**
93
94
  * When the title is not provided, the default title is used
94
95
  *
@@ -121,6 +122,7 @@ const VALUE_STRINGS = {
121
122
  infinity: '(infinity; ∞)',
122
123
  negativeInfinity: '(negative infinity; -∞)',
123
124
  unserializable: '(unserializable value)',
125
+ circular: '(circular JSON)',
124
126
  };
125
127
  /**
126
128
  * Small number limit
@@ -160,7 +162,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
160
162
  */
161
163
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [🤹‍♂️]
162
164
  // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
163
- // TODO: !!!!!! Just .promptbook dir, hardocode others
165
+ // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
164
166
  /**
165
167
  * Where to store the temporary downloads
166
168
  *
@@ -891,9 +893,60 @@ class ParseError extends Error {
891
893
  * TODO: Maybe split `ParseError` and `ApplyError`
892
894
  */
893
895
 
896
+ /**
897
+ * This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
898
+ *
899
+ * @public exported from `@promptbook/core`
900
+ */
901
+ class WrappedError extends Error {
902
+ constructor(whatWasThrown) {
903
+ const tag = `[🤮]`;
904
+ console.error(tag, whatWasThrown);
905
+ super(spaceTrim$1(`
906
+ Non-Error object was thrown
907
+
908
+ Note: Look for ${tag} in the console for more details
909
+ Please report issue on ${ADMIN_EMAIL}
910
+ `));
911
+ this.name = 'WrappedError';
912
+ Object.setPrototypeOf(this, WrappedError.prototype);
913
+ }
914
+ }
915
+
916
+ /**
917
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
918
+ *
919
+ * @param whatWasThrown Any object that was thrown
920
+ * @returns Nothing if the error is an instance of `Error`
921
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
922
+ *
923
+ * @private within the repository
924
+ */
925
+ function assertsError(whatWasThrown) {
926
+ // Case 1: Handle error which was rethrown as `WrappedError`
927
+ if (whatWasThrown instanceof WrappedError) {
928
+ const wrappedError = whatWasThrown;
929
+ throw wrappedError;
930
+ }
931
+ // Case 2: Handle unexpected errors
932
+ if (whatWasThrown instanceof UnexpectedError) {
933
+ const unexpectedError = whatWasThrown;
934
+ throw unexpectedError;
935
+ }
936
+ // Case 3: Handle standard errors - keep them up to consumer
937
+ if (whatWasThrown instanceof Error) {
938
+ return;
939
+ }
940
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
941
+ throw new WrappedError(whatWasThrown);
942
+ }
943
+
894
944
  /**
895
945
  * Function isValidJsonString will tell you if the string is valid JSON or not
896
946
  *
947
+ * @param value The string to check
948
+ * @returns True if the string is a valid JSON string, false otherwise
949
+ *
897
950
  * @public exported from `@promptbook/utils`
898
951
  */
899
952
  function isValidJsonString(value /* <- [👨‍⚖️] */) {
@@ -902,9 +955,7 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
902
955
  return true;
903
956
  }
904
957
  catch (error) {
905
- if (!(error instanceof Error)) {
906
- throw error;
907
- }
958
+ assertsError(error);
908
959
  if (error.message.includes('Unexpected token')) {
909
960
  return false;
910
961
  }
@@ -1257,9 +1308,7 @@ function checkSerializableAsJson(options) {
1257
1308
  JSON.stringify(value); // <- TODO: [0]
1258
1309
  }
1259
1310
  catch (error) {
1260
- if (!(error instanceof Error)) {
1261
- throw error;
1262
- }
1311
+ assertsError(error);
1263
1312
  throw new UnexpectedError(spaceTrim((block) => `
1264
1313
  \`${name}\` is not serializable
1265
1314
 
@@ -2048,7 +2097,7 @@ class PipelineExecutionError extends Error {
2048
2097
  }
2049
2098
  }
2050
2099
  /**
2051
- * TODO: !!!!!! Add id to all errors
2100
+ * TODO: [🧠][🌂] Add id to all errors
2052
2101
  */
2053
2102
 
2054
2103
  /**
@@ -2226,6 +2275,19 @@ class NotYetImplementedError extends Error {
2226
2275
  }
2227
2276
  }
2228
2277
 
2278
+ /**
2279
+ * Error thrown when a fetch request fails
2280
+ *
2281
+ * @public exported from `@promptbook/core`
2282
+ */
2283
+ class PromptbookFetchError extends Error {
2284
+ constructor(message) {
2285
+ super(message);
2286
+ this.name = 'PromptbookFetchError';
2287
+ Object.setPrototypeOf(this, PromptbookFetchError.prototype);
2288
+ }
2289
+ }
2290
+
2229
2291
  /**
2230
2292
  * Index of all custom errors
2231
2293
  *
@@ -2246,7 +2308,10 @@ const PROMPTBOOK_ERRORS = {
2246
2308
  PipelineExecutionError,
2247
2309
  PipelineLogicError,
2248
2310
  PipelineUrlError,
2311
+ AuthenticationError,
2312
+ PromptbookFetchError,
2249
2313
  UnexpectedError,
2314
+ WrappedError,
2250
2315
  // TODO: [🪑]> VersionMismatchError,
2251
2316
  };
2252
2317
  /**
@@ -2263,7 +2328,6 @@ const COMMON_JAVASCRIPT_ERRORS = {
2263
2328
  TypeError,
2264
2329
  URIError,
2265
2330
  AggregateError,
2266
- AuthenticationError,
2267
2331
  /*
2268
2332
  Note: Not widely supported
2269
2333
  > InternalError,
@@ -2386,8 +2450,8 @@ function createTask(options) {
2386
2450
  updatedAt = new Date();
2387
2451
  errors.push(...executionResult.errors);
2388
2452
  warnings.push(...executionResult.warnings);
2389
- // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
2390
- // TODO: [🧠] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2453
+ // <- TODO: [🌂] Only unique errors and warnings should be added (or filtered)
2454
+ // TODO: [🧠] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
2391
2455
  // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
2392
2456
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2393
2457
  assertsTaskSuccessful(executionResult);
@@ -2397,6 +2461,7 @@ function createTask(options) {
2397
2461
  partialResultSubject.next(executionResult);
2398
2462
  }
2399
2463
  catch (error) {
2464
+ assertsError(error);
2400
2465
  status = 'ERROR';
2401
2466
  errors.push(error);
2402
2467
  partialResultSubject.error(error);
@@ -2788,14 +2853,15 @@ class MultipleLlmExecutionTools {
2788
2853
  }
2789
2854
  }
2790
2855
  catch (error) {
2791
- if (!(error instanceof Error) || error instanceof UnexpectedError) {
2856
+ assertsError(error);
2857
+ if (error instanceof UnexpectedError) {
2792
2858
  throw error;
2793
2859
  }
2794
2860
  errors.push({ llmExecutionTools, error });
2795
2861
  }
2796
2862
  }
2797
2863
  if (errors.length === 1) {
2798
- throw errors[0];
2864
+ throw errors[0].error;
2799
2865
  }
2800
2866
  else if (errors.length > 1) {
2801
2867
  throw new PipelineExecutionError(
@@ -3243,17 +3309,22 @@ function mimeTypeToExtension(value) {
3243
3309
  /**
3244
3310
  * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
3245
3311
  *
3246
- * @private as default `fetch` function used in Promptbook scrapers
3312
+ * @public exported from `@promptbook/core`
3247
3313
  */
3248
- const scraperFetch = async (url, init) => {
3314
+ const promptbookFetch = async (urlOrRequest, init) => {
3249
3315
  try {
3250
- return await fetch(url, init);
3316
+ return await fetch(urlOrRequest, init);
3251
3317
  }
3252
3318
  catch (error) {
3253
- if (!(error instanceof Error)) {
3254
- throw error;
3319
+ assertsError(error);
3320
+ let url;
3321
+ if (typeof urlOrRequest === 'string') {
3322
+ url = urlOrRequest;
3323
+ }
3324
+ else if (urlOrRequest instanceof Request) {
3325
+ url = urlOrRequest.url;
3255
3326
  }
3256
- throw new KnowledgeScrapeError(spaceTrim((block) => `
3327
+ throw new PromptbookFetchError(spaceTrim((block) => `
3257
3328
  Can not fetch "${url}"
3258
3329
 
3259
3330
  Fetch error:
@@ -3274,7 +3345,7 @@ const scraperFetch = async (url, init) => {
3274
3345
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3275
3346
  // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
3276
3347
  var _a;
3277
- const { fetch = scraperFetch } = tools;
3348
+ const { fetch = promptbookFetch } = tools;
3278
3349
  const { knowledgeSourceContent } = knowledgeSource;
3279
3350
  let { name } = knowledgeSource;
3280
3351
  const { rootDirname = null,
@@ -3476,9 +3547,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
3476
3547
  knowledgePreparedUnflatten[index] = pieces;
3477
3548
  }
3478
3549
  catch (error) {
3479
- if (!(error instanceof Error)) {
3480
- throw error;
3481
- }
3550
+ assertsError(error);
3482
3551
  console.warn(error);
3483
3552
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
3484
3553
  }
@@ -3770,13 +3839,19 @@ function valueToString(value) {
3770
3839
  return value.toISOString();
3771
3840
  }
3772
3841
  else {
3773
- return JSON.stringify(value);
3842
+ try {
3843
+ return JSON.stringify(value);
3844
+ }
3845
+ catch (error) {
3846
+ if (error instanceof TypeError && error.message.includes('circular structure')) {
3847
+ return VALUE_STRINGS.circular;
3848
+ }
3849
+ throw error;
3850
+ }
3774
3851
  }
3775
3852
  }
3776
3853
  catch (error) {
3777
- if (!(error instanceof Error)) {
3778
- throw error;
3779
- }
3854
+ assertsError(error);
3780
3855
  console.error(error);
3781
3856
  return VALUE_STRINGS.unserializable;
3782
3857
  }
@@ -3833,9 +3908,7 @@ function extractVariablesFromJavascript(script) {
3833
3908
  }
3834
3909
  }
3835
3910
  catch (error) {
3836
- if (!(error instanceof Error)) {
3837
- throw error;
3838
- }
3911
+ assertsError(error);
3839
3912
  throw new ParseError(spaceTrim$1((block) => `
3840
3913
  Can not extract variables from the script
3841
3914
  ${block(error.stack || error.message)}
@@ -3954,6 +4027,28 @@ const MANDATORY_CSV_SETTINGS = Object.freeze({
3954
4027
  // encoding: 'utf-8',
3955
4028
  });
3956
4029
 
4030
+ /**
4031
+ * Function to check if a string is valid CSV
4032
+ *
4033
+ * @param value The string to check
4034
+ * @returns True if the string is a valid CSV string, false otherwise
4035
+ *
4036
+ * @public exported from `@promptbook/utils`
4037
+ */
4038
+ function isValidCsvString(value) {
4039
+ try {
4040
+ // A simple check for CSV format: at least one comma and no invalid characters
4041
+ if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
4042
+ return true;
4043
+ }
4044
+ return false;
4045
+ }
4046
+ catch (error) {
4047
+ assertsError(error);
4048
+ return false;
4049
+ }
4050
+ }
4051
+
3957
4052
  /**
3958
4053
  * Definition for CSV spreadsheet
3959
4054
  *
@@ -3964,7 +4059,7 @@ const CsvFormatDefinition = {
3964
4059
  formatName: 'CSV',
3965
4060
  aliases: ['SPREADSHEET', 'TABLE'],
3966
4061
  isValid(value, settings, schema) {
3967
- return true;
4062
+ return isValidCsvString(value);
3968
4063
  },
3969
4064
  canBeValid(partialValue, settings, schema) {
3970
4065
  return true;
@@ -4118,6 +4213,30 @@ const TextFormatDefinition = {
4118
4213
  * TODO: [🏢] Allow to expect something inside each item of list and other formats
4119
4214
  */
4120
4215
 
4216
+ /**
4217
+ * Function to check if a string is valid XML
4218
+ *
4219
+ * @param value
4220
+ * @returns True if the string is a valid XML string, false otherwise
4221
+ *
4222
+ * @public exported from `@promptbook/utils`
4223
+ */
4224
+ function isValidXmlString(value) {
4225
+ try {
4226
+ const parser = new DOMParser();
4227
+ const parsedDocument = parser.parseFromString(value, 'application/xml');
4228
+ const parserError = parsedDocument.getElementsByTagName('parsererror');
4229
+ if (parserError.length > 0) {
4230
+ return false;
4231
+ }
4232
+ return true;
4233
+ }
4234
+ catch (error) {
4235
+ assertsError(error);
4236
+ return false;
4237
+ }
4238
+ }
4239
+
4121
4240
  /**
4122
4241
  * Definition for XML format
4123
4242
  *
@@ -4127,7 +4246,7 @@ const XmlFormatDefinition = {
4127
4246
  formatName: 'XML',
4128
4247
  mimeType: 'application/xml',
4129
4248
  isValid(value, settings, schema) {
4130
- return true;
4249
+ return isValidXmlString(value);
4131
4250
  },
4132
4251
  canBeValid(partialValue, settings, schema) {
4133
4252
  return true;
@@ -4700,9 +4819,7 @@ async function executeAttempts(options) {
4700
4819
  break scripts;
4701
4820
  }
4702
4821
  catch (error) {
4703
- if (!(error instanceof Error)) {
4704
- throw error;
4705
- }
4822
+ assertsError(error);
4706
4823
  if (error instanceof UnexpectedError) {
4707
4824
  throw error;
4708
4825
  }
@@ -4772,9 +4889,7 @@ async function executeAttempts(options) {
4772
4889
  break scripts;
4773
4890
  }
4774
4891
  catch (error) {
4775
- if (!(error instanceof Error)) {
4776
- throw error;
4777
- }
4892
+ assertsError(error);
4778
4893
  if (error instanceof UnexpectedError) {
4779
4894
  throw error;
4780
4895
  }
@@ -5395,9 +5510,7 @@ async function executePipeline(options) {
5395
5510
  await Promise.all(resolving);
5396
5511
  }
5397
5512
  catch (error /* <- Note: [3] */) {
5398
- if (!(error instanceof Error)) {
5399
- throw error;
5400
- }
5513
+ assertsError(error);
5401
5514
  // Note: No need to rethrow UnexpectedError
5402
5515
  // if (error instanceof UnexpectedError) {
5403
5516
  // Note: Count usage, [🧠] Maybe put to separate function executionReportJsonToUsage + DRY [🤹‍♂️]