@promptbook/documents 0.89.0-2 → 0.89.0-21
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/README.md +10 -6
- package/esm/index.es.js +122 -39
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +40 -0
- package/esm/typings/src/_packages/core.index.d.ts +20 -8
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -8
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +18 -16
- package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +28 -0
- package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -0
- package/esm/typings/src/config.d.ts +24 -26
- package/esm/typings/src/errors/0-index.d.ts +9 -0
- package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
- package/esm/typings/src/errors/WrappedError.d.ts +10 -0
- package/esm/typings/src/errors/assertsError.d.ts +11 -0
- package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideEnvFilename.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +45 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- package/esm/typings/src/remote-server/RemoteServer.d.ts +23 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
- package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -4
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +4 -12
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +84 -9
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
- package/esm/typings/src/types/typeAliases.d.ts +19 -0
- package/esm/typings/src/utils/organization/TODO_narrow.d.ts +6 -0
- package/package.json +8 -4
- package/umd/index.umd.js +122 -39
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/cli/test/ptbk2.d.ts +0 -5
- package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
package/README.md
CHANGED
|
@@ -203,7 +203,7 @@ Each part of the book defines one of 3 circles:
|
|
|
203
203
|
|
|
204
204
|
### **What:** Workflows, Tasks and Parameters
|
|
205
205
|
|
|
206
|
-
What work needs to be done. Each book defines a workflow, which is one or more tasks. Each workflow has a fixed input and output. For example, you have a book that generates an article from a topic. Once it generates an article about AI, once about marketing, once about cooking. The workflow (= your AI program) is the same, only the input and output change.
|
|
206
|
+
What work needs to be done. Each book defines a [workflow *(scenario or pipeline)*](https://github.com/webgptorg/promptbook/discussions/88), which is one or more tasks. Each workflow has a fixed input and output. For example, you have a book that generates an article from a topic. Once it generates an article about AI, once about marketing, once about cooking. The workflow (= your AI program) is the same, only the input and output change.
|
|
207
207
|
|
|
208
208
|
**Related commands:**
|
|
209
209
|
|
|
@@ -247,6 +247,10 @@ But unlike programming languages, it is designed to be understandable by non-pro
|
|
|
247
247
|
|
|
248
248
|
|
|
249
249
|
|
|
250
|
+
## 🔒 Security
|
|
251
|
+
|
|
252
|
+
For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md).
|
|
253
|
+
|
|
250
254
|
## 📦 Packages _(for developers)_
|
|
251
255
|
|
|
252
256
|
This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -303,7 +307,7 @@ The following glossary is used to clarify certain concepts:
|
|
|
303
307
|
### General LLM / AI terms
|
|
304
308
|
|
|
305
309
|
- **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.
|
|
306
|
-
- **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.
|
|
310
|
+
- [**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)
|
|
307
311
|
- **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.
|
|
308
312
|
- **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.
|
|
309
313
|
- **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.
|
|
@@ -311,8 +315,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
311
315
|
- **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.
|
|
312
316
|
- **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.
|
|
313
317
|
|
|
314
|
-
|
|
315
|
-
|
|
316
318
|
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
317
319
|
|
|
318
320
|
|
|
@@ -426,6 +428,8 @@ See [TODO.md](./TODO.md)
|
|
|
426
428
|
|
|
427
429
|
## 🖋️ Contributing
|
|
428
430
|
|
|
429
|
-
We are open to pull requests, feedback, and suggestions.
|
|
431
|
+
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).
|
|
432
|
+
|
|
433
|
+
## 📞 Support
|
|
430
434
|
|
|
431
|
-
|
|
435
|
+
If you need help or have questions, please check our [Support Resources](./SUPPORT.md).
|
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-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-21';
|
|
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
|
*
|
|
@@ -123,6 +124,7 @@ const VALUE_STRINGS = {
|
|
|
123
124
|
infinity: '(infinity; ∞)',
|
|
124
125
|
negativeInfinity: '(negative infinity; -∞)',
|
|
125
126
|
unserializable: '(unserializable value)',
|
|
127
|
+
circular: '(circular JSON)',
|
|
126
128
|
};
|
|
127
129
|
/**
|
|
128
130
|
* Small number limit
|
|
@@ -162,6 +164,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
|
162
164
|
*/
|
|
163
165
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [🤹♂️]
|
|
164
166
|
// <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
167
|
+
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
165
168
|
/**
|
|
166
169
|
* Where to store the temporary downloads
|
|
167
170
|
*
|
|
@@ -213,7 +216,7 @@ const IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
213
216
|
true);
|
|
214
217
|
/**
|
|
215
218
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
216
|
-
* TODO: [🧠][🧜♂️] Maybe join
|
|
219
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteServerUrl and path into single value
|
|
217
220
|
*/
|
|
218
221
|
|
|
219
222
|
/**
|
|
@@ -1069,6 +1072,54 @@ class ParseError extends Error {
|
|
|
1069
1072
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
1070
1073
|
*/
|
|
1071
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
1077
|
+
*
|
|
1078
|
+
* @public exported from `@promptbook/core`
|
|
1079
|
+
*/
|
|
1080
|
+
class WrappedError extends Error {
|
|
1081
|
+
constructor(whatWasThrown) {
|
|
1082
|
+
const tag = `[🤮]`;
|
|
1083
|
+
console.error(tag, whatWasThrown);
|
|
1084
|
+
super(spaceTrim(`
|
|
1085
|
+
Non-Error object was thrown
|
|
1086
|
+
|
|
1087
|
+
Note: Look for ${tag} in the console for more details
|
|
1088
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
1089
|
+
`));
|
|
1090
|
+
this.name = 'WrappedError';
|
|
1091
|
+
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
1097
|
+
*
|
|
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
|
|
1101
|
+
*
|
|
1102
|
+
* @private within the repository
|
|
1103
|
+
*/
|
|
1104
|
+
function assertsError(whatWasThrown) {
|
|
1105
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
1106
|
+
if (whatWasThrown instanceof WrappedError) {
|
|
1107
|
+
const wrappedError = whatWasThrown;
|
|
1108
|
+
throw wrappedError;
|
|
1109
|
+
}
|
|
1110
|
+
// Case 2: Handle unexpected errors
|
|
1111
|
+
if (whatWasThrown instanceof UnexpectedError) {
|
|
1112
|
+
const unexpectedError = whatWasThrown;
|
|
1113
|
+
throw unexpectedError;
|
|
1114
|
+
}
|
|
1115
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
1116
|
+
if (whatWasThrown instanceof Error) {
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
1120
|
+
throw new WrappedError(whatWasThrown);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1072
1123
|
/**
|
|
1073
1124
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1074
1125
|
*
|
|
@@ -1080,9 +1131,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
1080
1131
|
return true;
|
|
1081
1132
|
}
|
|
1082
1133
|
catch (error) {
|
|
1083
|
-
|
|
1084
|
-
throw error;
|
|
1085
|
-
}
|
|
1134
|
+
assertsError(error);
|
|
1086
1135
|
if (error.message.includes('Unexpected token')) {
|
|
1087
1136
|
return false;
|
|
1088
1137
|
}
|
|
@@ -1435,9 +1484,7 @@ function checkSerializableAsJson(options) {
|
|
|
1435
1484
|
JSON.stringify(value); // <- TODO: [0]
|
|
1436
1485
|
}
|
|
1437
1486
|
catch (error) {
|
|
1438
|
-
|
|
1439
|
-
throw error;
|
|
1440
|
-
}
|
|
1487
|
+
assertsError(error);
|
|
1441
1488
|
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
1442
1489
|
\`${name}\` is not serializable
|
|
1443
1490
|
|
|
@@ -2208,7 +2255,7 @@ class PipelineExecutionError extends Error {
|
|
|
2208
2255
|
}
|
|
2209
2256
|
}
|
|
2210
2257
|
/**
|
|
2211
|
-
* TODO:
|
|
2258
|
+
* TODO: [🧠][🌂] Add id to all errors
|
|
2212
2259
|
*/
|
|
2213
2260
|
|
|
2214
2261
|
/**
|
|
@@ -2308,6 +2355,19 @@ class CsvFormatError extends AbstractFormatError {
|
|
|
2308
2355
|
}
|
|
2309
2356
|
}
|
|
2310
2357
|
|
|
2358
|
+
/**
|
|
2359
|
+
* AuthenticationError is thrown from login function which is dependency of remote server
|
|
2360
|
+
*
|
|
2361
|
+
* @public exported from `@promptbook/core`
|
|
2362
|
+
*/
|
|
2363
|
+
class AuthenticationError extends Error {
|
|
2364
|
+
constructor(message) {
|
|
2365
|
+
super(message);
|
|
2366
|
+
this.name = 'AuthenticationError';
|
|
2367
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2311
2371
|
/**
|
|
2312
2372
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2313
2373
|
*
|
|
@@ -2373,6 +2433,19 @@ class NotYetImplementedError extends Error {
|
|
|
2373
2433
|
}
|
|
2374
2434
|
}
|
|
2375
2435
|
|
|
2436
|
+
/**
|
|
2437
|
+
* Error thrown when a fetch request fails
|
|
2438
|
+
*
|
|
2439
|
+
* @public exported from `@promptbook/core`
|
|
2440
|
+
*/
|
|
2441
|
+
class PromptbookFetchError extends Error {
|
|
2442
|
+
constructor(message) {
|
|
2443
|
+
super(message);
|
|
2444
|
+
this.name = 'PromptbookFetchError';
|
|
2445
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2376
2449
|
/**
|
|
2377
2450
|
* Index of all custom errors
|
|
2378
2451
|
*
|
|
@@ -2393,7 +2466,10 @@ const PROMPTBOOK_ERRORS = {
|
|
|
2393
2466
|
PipelineExecutionError,
|
|
2394
2467
|
PipelineLogicError,
|
|
2395
2468
|
PipelineUrlError,
|
|
2469
|
+
AuthenticationError,
|
|
2470
|
+
PromptbookFetchError,
|
|
2396
2471
|
UnexpectedError,
|
|
2472
|
+
WrappedError,
|
|
2397
2473
|
// TODO: [🪑]> VersionMismatchError,
|
|
2398
2474
|
};
|
|
2399
2475
|
/**
|
|
@@ -2532,8 +2608,8 @@ function createTask(options) {
|
|
|
2532
2608
|
updatedAt = new Date();
|
|
2533
2609
|
errors.push(...executionResult.errors);
|
|
2534
2610
|
warnings.push(...executionResult.warnings);
|
|
2535
|
-
// <- TODO:
|
|
2536
|
-
// TODO: [🧠]
|
|
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`
|
|
2537
2613
|
// Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
|
|
2538
2614
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
2539
2615
|
assertsTaskSuccessful(executionResult);
|
|
@@ -2543,6 +2619,7 @@ function createTask(options) {
|
|
|
2543
2619
|
partialResultSubject.next(executionResult);
|
|
2544
2620
|
}
|
|
2545
2621
|
catch (error) {
|
|
2622
|
+
assertsError(error);
|
|
2546
2623
|
status = 'ERROR';
|
|
2547
2624
|
errors.push(error);
|
|
2548
2625
|
partialResultSubject.error(error);
|
|
@@ -2609,6 +2686,10 @@ function serializeError(error) {
|
|
|
2609
2686
|
|
|
2610
2687
|
Cannot serialize error with name "${name}"
|
|
2611
2688
|
|
|
2689
|
+
Authors of Promptbook probably forgot to add this error into the list of errors:
|
|
2690
|
+
https://github.com/webgptorg/promptbook/blob/main/src/errors/0-index.ts
|
|
2691
|
+
|
|
2692
|
+
|
|
2612
2693
|
${block(stack || message)}
|
|
2613
2694
|
|
|
2614
2695
|
`));
|
|
@@ -2930,14 +3011,15 @@ class MultipleLlmExecutionTools {
|
|
|
2930
3011
|
}
|
|
2931
3012
|
}
|
|
2932
3013
|
catch (error) {
|
|
2933
|
-
|
|
3014
|
+
assertsError(error);
|
|
3015
|
+
if (error instanceof UnexpectedError) {
|
|
2934
3016
|
throw error;
|
|
2935
3017
|
}
|
|
2936
3018
|
errors.push({ llmExecutionTools, error });
|
|
2937
3019
|
}
|
|
2938
3020
|
}
|
|
2939
3021
|
if (errors.length === 1) {
|
|
2940
|
-
throw errors[0];
|
|
3022
|
+
throw errors[0].error;
|
|
2941
3023
|
}
|
|
2942
3024
|
else if (errors.length > 1) {
|
|
2943
3025
|
throw new PipelineExecutionError(
|
|
@@ -3375,17 +3457,22 @@ function mimeTypeToExtension(value) {
|
|
|
3375
3457
|
/**
|
|
3376
3458
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3377
3459
|
*
|
|
3378
|
-
* @
|
|
3460
|
+
* @public exported from `@promptbook/core`
|
|
3379
3461
|
*/
|
|
3380
|
-
const
|
|
3462
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3381
3463
|
try {
|
|
3382
|
-
return await fetch(
|
|
3464
|
+
return await fetch(urlOrRequest, init);
|
|
3383
3465
|
}
|
|
3384
3466
|
catch (error) {
|
|
3385
|
-
|
|
3386
|
-
|
|
3467
|
+
assertsError(error);
|
|
3468
|
+
let url;
|
|
3469
|
+
if (typeof urlOrRequest === 'string') {
|
|
3470
|
+
url = urlOrRequest;
|
|
3471
|
+
}
|
|
3472
|
+
else if (urlOrRequest instanceof Request) {
|
|
3473
|
+
url = urlOrRequest.url;
|
|
3387
3474
|
}
|
|
3388
|
-
throw new
|
|
3475
|
+
throw new PromptbookFetchError(spaceTrim$1((block) => `
|
|
3389
3476
|
Can not fetch "${url}"
|
|
3390
3477
|
|
|
3391
3478
|
Fetch error:
|
|
@@ -3406,7 +3493,7 @@ const scraperFetch = async (url, init) => {
|
|
|
3406
3493
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3407
3494
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3408
3495
|
var _a;
|
|
3409
|
-
const { fetch =
|
|
3496
|
+
const { fetch = promptbookFetch } = tools;
|
|
3410
3497
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3411
3498
|
let { name } = knowledgeSource;
|
|
3412
3499
|
const { rootDirname = null,
|
|
@@ -3608,9 +3695,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
3608
3695
|
knowledgePreparedUnflatten[index] = pieces;
|
|
3609
3696
|
}
|
|
3610
3697
|
catch (error) {
|
|
3611
|
-
|
|
3612
|
-
throw error;
|
|
3613
|
-
}
|
|
3698
|
+
assertsError(error);
|
|
3614
3699
|
console.warn(error);
|
|
3615
3700
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3616
3701
|
}
|
|
@@ -3902,13 +3987,19 @@ function valueToString(value) {
|
|
|
3902
3987
|
return value.toISOString();
|
|
3903
3988
|
}
|
|
3904
3989
|
else {
|
|
3905
|
-
|
|
3990
|
+
try {
|
|
3991
|
+
return JSON.stringify(value);
|
|
3992
|
+
}
|
|
3993
|
+
catch (error) {
|
|
3994
|
+
if (error instanceof TypeError && error.message.includes('circular structure')) {
|
|
3995
|
+
return VALUE_STRINGS.circular;
|
|
3996
|
+
}
|
|
3997
|
+
throw error;
|
|
3998
|
+
}
|
|
3906
3999
|
}
|
|
3907
4000
|
}
|
|
3908
4001
|
catch (error) {
|
|
3909
|
-
|
|
3910
|
-
throw error;
|
|
3911
|
-
}
|
|
4002
|
+
assertsError(error);
|
|
3912
4003
|
console.error(error);
|
|
3913
4004
|
return VALUE_STRINGS.unserializable;
|
|
3914
4005
|
}
|
|
@@ -3965,9 +4056,7 @@ function extractVariablesFromJavascript(script) {
|
|
|
3965
4056
|
}
|
|
3966
4057
|
}
|
|
3967
4058
|
catch (error) {
|
|
3968
|
-
|
|
3969
|
-
throw error;
|
|
3970
|
-
}
|
|
4059
|
+
assertsError(error);
|
|
3971
4060
|
throw new ParseError(spaceTrim((block) => `
|
|
3972
4061
|
Can not extract variables from the script
|
|
3973
4062
|
${block(error.stack || error.message)}
|
|
@@ -4832,9 +4921,7 @@ async function executeAttempts(options) {
|
|
|
4832
4921
|
break scripts;
|
|
4833
4922
|
}
|
|
4834
4923
|
catch (error) {
|
|
4835
|
-
|
|
4836
|
-
throw error;
|
|
4837
|
-
}
|
|
4924
|
+
assertsError(error);
|
|
4838
4925
|
if (error instanceof UnexpectedError) {
|
|
4839
4926
|
throw error;
|
|
4840
4927
|
}
|
|
@@ -4904,9 +4991,7 @@ async function executeAttempts(options) {
|
|
|
4904
4991
|
break scripts;
|
|
4905
4992
|
}
|
|
4906
4993
|
catch (error) {
|
|
4907
|
-
|
|
4908
|
-
throw error;
|
|
4909
|
-
}
|
|
4994
|
+
assertsError(error);
|
|
4910
4995
|
if (error instanceof UnexpectedError) {
|
|
4911
4996
|
throw error;
|
|
4912
4997
|
}
|
|
@@ -5527,9 +5612,7 @@ async function executePipeline(options) {
|
|
|
5527
5612
|
await Promise.all(resolving);
|
|
5528
5613
|
}
|
|
5529
5614
|
catch (error /* <- Note: [3] */) {
|
|
5530
|
-
|
|
5531
|
-
throw error;
|
|
5532
|
-
}
|
|
5615
|
+
assertsError(error);
|
|
5533
5616
|
// Note: No need to rethrow UnexpectedError
|
|
5534
5617
|
// if (error instanceof UnexpectedError) {
|
|
5535
5618
|
// Note: Count usage, [🧠] Maybe put to separate function executionReportJsonToUsage + DRY [🤹♂️]
|