@promptbook/node 0.89.0-9 โ 0.92.0-3
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 +9 -7
- package/esm/index.es.js +146 -66
- 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 +10 -4
- package/esm/typings/src/_packages/types.index.d.ts +18 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +16 -3
- 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 +10 -19
- package/esm/typings/src/errors/0-index.d.ts +7 -4
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
- 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/formats/csv/utils/isValidCsvString.d.ts +9 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +3 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/filterModels.d.ts +15 -0
- package/esm/typings/src/llm-providers/_common/register/{$provideEnvFilepath.d.ts โ $provideEnvFilename.d.ts} +2 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +11 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/remote-server/openapi-types.d.ts +284 -0
- package/esm/typings/src/remote-server/openapi.d.ts +187 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/Identification.d.ts +7 -1
- 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/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -9
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
- package/esm/typings/src/types/typeAliases.d.ts +26 -0
- package/package.json +9 -5
- package/umd/index.umd.js +146 -66
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/cli/test/ptbk2.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.0-3",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,21 +43,25 @@
|
|
|
43
43
|
"url": "https://github.com/webgptorg/promptbook/issues"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://ptbk.io/",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=16.0.0",
|
|
48
|
+
"npm": ">=8.0.0"
|
|
49
|
+
},
|
|
46
50
|
"main": "./umd/index.umd.js",
|
|
47
51
|
"module": "./esm/index.es.js",
|
|
48
52
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
49
53
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
54
|
+
"@promptbook/core": "0.92.0-3"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
57
|
"colors": "1.4.0",
|
|
54
|
-
"crypto": "
|
|
58
|
+
"crypto": "1.0.1",
|
|
55
59
|
"crypto-js": "4.2.0",
|
|
56
60
|
"dotenv": "16.3.1",
|
|
57
|
-
"jszip": "
|
|
61
|
+
"jszip": "3.10.1",
|
|
58
62
|
"papaparse": "5.4.1",
|
|
59
63
|
"prettier": "2.8.1",
|
|
60
|
-
"rxjs": "
|
|
64
|
+
"rxjs": "7.8.1",
|
|
61
65
|
"spacetrim": "0.11.59",
|
|
62
66
|
"type-fest": "4.5.0",
|
|
63
67
|
"userhome": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* @generated
|
|
47
47
|
* @see https://github.com/webgptorg/promptbook
|
|
48
48
|
*/
|
|
49
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
49
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-3';
|
|
50
50
|
/**
|
|
51
51
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
52
52
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
* @public exported from `@promptbook/core`
|
|
93
93
|
*/
|
|
94
94
|
const ADMIN_GITHUB_NAME = 'hejny';
|
|
95
|
+
// <- TODO: [๐] Pick the best claim
|
|
95
96
|
/**
|
|
96
97
|
* When the title is not provided, the default title is used
|
|
97
98
|
*
|
|
@@ -136,6 +137,7 @@
|
|
|
136
137
|
infinity: '(infinity; โ)',
|
|
137
138
|
negativeInfinity: '(negative infinity; -โ)',
|
|
138
139
|
unserializable: '(unserializable value)',
|
|
140
|
+
circular: '(circular JSON)',
|
|
139
141
|
};
|
|
140
142
|
/**
|
|
141
143
|
* Small number limit
|
|
@@ -175,7 +177,7 @@
|
|
|
175
177
|
*/
|
|
176
178
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐คนโโ๏ธ]
|
|
177
179
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
178
|
-
// TODO:
|
|
180
|
+
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
179
181
|
/**
|
|
180
182
|
* Where to store the temporary downloads
|
|
181
183
|
*
|
|
@@ -355,6 +357,54 @@
|
|
|
355
357
|
* TODO: [๐ง ] Is there a way how to meaningfully test this utility
|
|
356
358
|
*/
|
|
357
359
|
|
|
360
|
+
/**
|
|
361
|
+
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
362
|
+
*
|
|
363
|
+
* @public exported from `@promptbook/core`
|
|
364
|
+
*/
|
|
365
|
+
class WrappedError extends Error {
|
|
366
|
+
constructor(whatWasThrown) {
|
|
367
|
+
const tag = `[๐คฎ]`;
|
|
368
|
+
console.error(tag, whatWasThrown);
|
|
369
|
+
super(spaceTrim.spaceTrim(`
|
|
370
|
+
Non-Error object was thrown
|
|
371
|
+
|
|
372
|
+
Note: Look for ${tag} in the console for more details
|
|
373
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
374
|
+
`));
|
|
375
|
+
this.name = 'WrappedError';
|
|
376
|
+
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
382
|
+
*
|
|
383
|
+
* @param whatWasThrown Any object that was thrown
|
|
384
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
385
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
386
|
+
*
|
|
387
|
+
* @private within the repository
|
|
388
|
+
*/
|
|
389
|
+
function assertsError(whatWasThrown) {
|
|
390
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
391
|
+
if (whatWasThrown instanceof WrappedError) {
|
|
392
|
+
const wrappedError = whatWasThrown;
|
|
393
|
+
throw wrappedError;
|
|
394
|
+
}
|
|
395
|
+
// Case 2: Handle unexpected errors
|
|
396
|
+
if (whatWasThrown instanceof UnexpectedError) {
|
|
397
|
+
const unexpectedError = whatWasThrown;
|
|
398
|
+
throw unexpectedError;
|
|
399
|
+
}
|
|
400
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
401
|
+
if (whatWasThrown instanceof Error) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
405
|
+
throw new WrappedError(whatWasThrown);
|
|
406
|
+
}
|
|
407
|
+
|
|
358
408
|
/**
|
|
359
409
|
* Checks if the value is [๐] serializable as JSON
|
|
360
410
|
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
@@ -446,9 +496,7 @@
|
|
|
446
496
|
JSON.stringify(value); // <- TODO: [0]
|
|
447
497
|
}
|
|
448
498
|
catch (error) {
|
|
449
|
-
|
|
450
|
-
throw error;
|
|
451
|
-
}
|
|
499
|
+
assertsError(error);
|
|
452
500
|
throw new UnexpectedError(spaceTrim__default["default"]((block) => `
|
|
453
501
|
\`${name}\` is not serializable
|
|
454
502
|
|
|
@@ -1135,6 +1183,9 @@
|
|
|
1135
1183
|
/**
|
|
1136
1184
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1137
1185
|
*
|
|
1186
|
+
* @param value The string to check
|
|
1187
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
1188
|
+
*
|
|
1138
1189
|
* @public exported from `@promptbook/utils`
|
|
1139
1190
|
*/
|
|
1140
1191
|
function isValidJsonString(value /* <- [๐จโโ๏ธ] */) {
|
|
@@ -1143,9 +1194,7 @@
|
|
|
1143
1194
|
return true;
|
|
1144
1195
|
}
|
|
1145
1196
|
catch (error) {
|
|
1146
|
-
|
|
1147
|
-
throw error;
|
|
1148
|
-
}
|
|
1197
|
+
assertsError(error);
|
|
1149
1198
|
if (error.message.includes('Unexpected token')) {
|
|
1150
1199
|
return false;
|
|
1151
1200
|
}
|
|
@@ -1677,7 +1726,7 @@
|
|
|
1677
1726
|
}
|
|
1678
1727
|
}
|
|
1679
1728
|
/**
|
|
1680
|
-
* TODO:
|
|
1729
|
+
* TODO: [๐ง ][๐] Add id to all errors
|
|
1681
1730
|
*/
|
|
1682
1731
|
|
|
1683
1732
|
/**
|
|
@@ -1847,7 +1896,10 @@
|
|
|
1847
1896
|
PipelineExecutionError,
|
|
1848
1897
|
PipelineLogicError,
|
|
1849
1898
|
PipelineUrlError,
|
|
1899
|
+
AuthenticationError,
|
|
1900
|
+
PromptbookFetchError,
|
|
1850
1901
|
UnexpectedError,
|
|
1902
|
+
WrappedError,
|
|
1851
1903
|
// TODO: [๐ช]> VersionMismatchError,
|
|
1852
1904
|
};
|
|
1853
1905
|
/**
|
|
@@ -1864,8 +1916,6 @@
|
|
|
1864
1916
|
TypeError,
|
|
1865
1917
|
URIError,
|
|
1866
1918
|
AggregateError,
|
|
1867
|
-
AuthenticationError,
|
|
1868
|
-
PromptbookFetchError,
|
|
1869
1919
|
/*
|
|
1870
1920
|
Note: Not widely supported
|
|
1871
1921
|
> InternalError,
|
|
@@ -1988,8 +2038,8 @@
|
|
|
1988
2038
|
updatedAt = new Date();
|
|
1989
2039
|
errors.push(...executionResult.errors);
|
|
1990
2040
|
warnings.push(...executionResult.warnings);
|
|
1991
|
-
// <- TODO:
|
|
1992
|
-
// TODO: [๐ง ]
|
|
2041
|
+
// <- TODO: [๐] Only unique errors and warnings should be added (or filtered)
|
|
2042
|
+
// TODO: [๐ง ] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
|
|
1993
2043
|
// Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
|
|
1994
2044
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
1995
2045
|
assertsTaskSuccessful(executionResult);
|
|
@@ -1999,6 +2049,7 @@
|
|
|
1999
2049
|
partialResultSubject.next(executionResult);
|
|
2000
2050
|
}
|
|
2001
2051
|
catch (error) {
|
|
2052
|
+
assertsError(error);
|
|
2002
2053
|
status = 'ERROR';
|
|
2003
2054
|
errors.push(error);
|
|
2004
2055
|
partialResultSubject.error(error);
|
|
@@ -2144,13 +2195,19 @@
|
|
|
2144
2195
|
return value.toISOString();
|
|
2145
2196
|
}
|
|
2146
2197
|
else {
|
|
2147
|
-
|
|
2198
|
+
try {
|
|
2199
|
+
return JSON.stringify(value);
|
|
2200
|
+
}
|
|
2201
|
+
catch (error) {
|
|
2202
|
+
if (error instanceof TypeError && error.message.includes('circular structure')) {
|
|
2203
|
+
return VALUE_STRINGS.circular;
|
|
2204
|
+
}
|
|
2205
|
+
throw error;
|
|
2206
|
+
}
|
|
2148
2207
|
}
|
|
2149
2208
|
}
|
|
2150
2209
|
catch (error) {
|
|
2151
|
-
|
|
2152
|
-
throw error;
|
|
2153
|
-
}
|
|
2210
|
+
assertsError(error);
|
|
2154
2211
|
console.error(error);
|
|
2155
2212
|
return VALUE_STRINGS.unserializable;
|
|
2156
2213
|
}
|
|
@@ -2322,9 +2379,7 @@
|
|
|
2322
2379
|
}
|
|
2323
2380
|
}
|
|
2324
2381
|
catch (error) {
|
|
2325
|
-
|
|
2326
|
-
throw error;
|
|
2327
|
-
}
|
|
2382
|
+
assertsError(error);
|
|
2328
2383
|
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2329
2384
|
Can not extract variables from the script
|
|
2330
2385
|
${block(error.stack || error.message)}
|
|
@@ -2443,6 +2498,28 @@
|
|
|
2443
2498
|
// encoding: 'utf-8',
|
|
2444
2499
|
});
|
|
2445
2500
|
|
|
2501
|
+
/**
|
|
2502
|
+
* Function to check if a string is valid CSV
|
|
2503
|
+
*
|
|
2504
|
+
* @param value The string to check
|
|
2505
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
2506
|
+
*
|
|
2507
|
+
* @public exported from `@promptbook/utils`
|
|
2508
|
+
*/
|
|
2509
|
+
function isValidCsvString(value) {
|
|
2510
|
+
try {
|
|
2511
|
+
// A simple check for CSV format: at least one comma and no invalid characters
|
|
2512
|
+
if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
|
|
2513
|
+
return true;
|
|
2514
|
+
}
|
|
2515
|
+
return false;
|
|
2516
|
+
}
|
|
2517
|
+
catch (error) {
|
|
2518
|
+
assertsError(error);
|
|
2519
|
+
return false;
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2446
2523
|
/**
|
|
2447
2524
|
* Definition for CSV spreadsheet
|
|
2448
2525
|
*
|
|
@@ -2453,7 +2530,7 @@
|
|
|
2453
2530
|
formatName: 'CSV',
|
|
2454
2531
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2455
2532
|
isValid(value, settings, schema) {
|
|
2456
|
-
return
|
|
2533
|
+
return isValidCsvString(value);
|
|
2457
2534
|
},
|
|
2458
2535
|
canBeValid(partialValue, settings, schema) {
|
|
2459
2536
|
return true;
|
|
@@ -2607,6 +2684,30 @@
|
|
|
2607
2684
|
* TODO: [๐ข] Allow to expect something inside each item of list and other formats
|
|
2608
2685
|
*/
|
|
2609
2686
|
|
|
2687
|
+
/**
|
|
2688
|
+
* Function to check if a string is valid XML
|
|
2689
|
+
*
|
|
2690
|
+
* @param value
|
|
2691
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
2692
|
+
*
|
|
2693
|
+
* @public exported from `@promptbook/utils`
|
|
2694
|
+
*/
|
|
2695
|
+
function isValidXmlString(value) {
|
|
2696
|
+
try {
|
|
2697
|
+
const parser = new DOMParser();
|
|
2698
|
+
const parsedDocument = parser.parseFromString(value, 'application/xml');
|
|
2699
|
+
const parserError = parsedDocument.getElementsByTagName('parsererror');
|
|
2700
|
+
if (parserError.length > 0) {
|
|
2701
|
+
return false;
|
|
2702
|
+
}
|
|
2703
|
+
return true;
|
|
2704
|
+
}
|
|
2705
|
+
catch (error) {
|
|
2706
|
+
assertsError(error);
|
|
2707
|
+
return false;
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2610
2711
|
/**
|
|
2611
2712
|
* Definition for XML format
|
|
2612
2713
|
*
|
|
@@ -2616,7 +2717,7 @@
|
|
|
2616
2717
|
formatName: 'XML',
|
|
2617
2718
|
mimeType: 'application/xml',
|
|
2618
2719
|
isValid(value, settings, schema) {
|
|
2619
|
-
return
|
|
2720
|
+
return isValidXmlString(value);
|
|
2620
2721
|
},
|
|
2621
2722
|
canBeValid(partialValue, settings, schema) {
|
|
2622
2723
|
return true;
|
|
@@ -2813,14 +2914,15 @@
|
|
|
2813
2914
|
}
|
|
2814
2915
|
}
|
|
2815
2916
|
catch (error) {
|
|
2816
|
-
|
|
2917
|
+
assertsError(error);
|
|
2918
|
+
if (error instanceof UnexpectedError) {
|
|
2817
2919
|
throw error;
|
|
2818
2920
|
}
|
|
2819
2921
|
errors.push({ llmExecutionTools, error });
|
|
2820
2922
|
}
|
|
2821
2923
|
}
|
|
2822
2924
|
if (errors.length === 1) {
|
|
2823
|
-
throw errors[0];
|
|
2925
|
+
throw errors[0].error;
|
|
2824
2926
|
}
|
|
2825
2927
|
else if (errors.length > 1) {
|
|
2826
2928
|
throw new PipelineExecutionError(
|
|
@@ -3677,9 +3779,7 @@
|
|
|
3677
3779
|
break scripts;
|
|
3678
3780
|
}
|
|
3679
3781
|
catch (error) {
|
|
3680
|
-
|
|
3681
|
-
throw error;
|
|
3682
|
-
}
|
|
3782
|
+
assertsError(error);
|
|
3683
3783
|
if (error instanceof UnexpectedError) {
|
|
3684
3784
|
throw error;
|
|
3685
3785
|
}
|
|
@@ -3749,9 +3849,7 @@
|
|
|
3749
3849
|
break scripts;
|
|
3750
3850
|
}
|
|
3751
3851
|
catch (error) {
|
|
3752
|
-
|
|
3753
|
-
throw error;
|
|
3754
|
-
}
|
|
3852
|
+
assertsError(error);
|
|
3755
3853
|
if (error instanceof UnexpectedError) {
|
|
3756
3854
|
throw error;
|
|
3757
3855
|
}
|
|
@@ -4372,9 +4470,7 @@
|
|
|
4372
4470
|
await Promise.all(resolving);
|
|
4373
4471
|
}
|
|
4374
4472
|
catch (error /* <- Note: [3] */) {
|
|
4375
|
-
|
|
4376
|
-
throw error;
|
|
4377
|
-
}
|
|
4473
|
+
assertsError(error);
|
|
4378
4474
|
// Note: No need to rethrow UnexpectedError
|
|
4379
4475
|
// if (error instanceof UnexpectedError) {
|
|
4380
4476
|
// Note: Count usage, [๐ง ] Maybe put to separate function executionReportJsonToUsage + DRY [๐คนโโ๏ธ]
|
|
@@ -5084,9 +5180,7 @@
|
|
|
5084
5180
|
return await fetch(urlOrRequest, init);
|
|
5085
5181
|
}
|
|
5086
5182
|
catch (error) {
|
|
5087
|
-
|
|
5088
|
-
throw error;
|
|
5089
|
-
}
|
|
5183
|
+
assertsError(error);
|
|
5090
5184
|
let url;
|
|
5091
5185
|
if (typeof urlOrRequest === 'string') {
|
|
5092
5186
|
url = urlOrRequest;
|
|
@@ -5317,9 +5411,7 @@
|
|
|
5317
5411
|
knowledgePreparedUnflatten[index] = pieces;
|
|
5318
5412
|
}
|
|
5319
5413
|
catch (error) {
|
|
5320
|
-
|
|
5321
|
-
throw error;
|
|
5322
|
-
}
|
|
5414
|
+
assertsError(error);
|
|
5323
5415
|
console.warn(error);
|
|
5324
5416
|
// <- TODO: [๐ฎ] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5325
5417
|
}
|
|
@@ -6117,6 +6209,8 @@
|
|
|
6117
6209
|
*/
|
|
6118
6210
|
|
|
6119
6211
|
/**
|
|
6212
|
+
import { WrappedError } from '../../errors/WrappedError';
|
|
6213
|
+
import { assertsError } from '../../errors/assertsError';
|
|
6120
6214
|
* Parses the expect command
|
|
6121
6215
|
*
|
|
6122
6216
|
* @see `documentationUrl` for more details
|
|
@@ -6208,9 +6302,7 @@
|
|
|
6208
6302
|
};
|
|
6209
6303
|
}
|
|
6210
6304
|
catch (error) {
|
|
6211
|
-
|
|
6212
|
-
throw error;
|
|
6213
|
-
}
|
|
6305
|
+
assertsError(error);
|
|
6214
6306
|
throw new ParseError(spaceTrim__default["default"]((block) => `
|
|
6215
6307
|
Invalid FORMAT command
|
|
6216
6308
|
${block(error.message)}:
|
|
@@ -9191,9 +9283,7 @@
|
|
|
9191
9283
|
return result.trim();
|
|
9192
9284
|
}
|
|
9193
9285
|
catch (error) {
|
|
9194
|
-
|
|
9195
|
-
throw error;
|
|
9196
|
-
}
|
|
9286
|
+
assertsError(error);
|
|
9197
9287
|
return null;
|
|
9198
9288
|
}
|
|
9199
9289
|
}
|
|
@@ -9271,9 +9361,7 @@
|
|
|
9271
9361
|
return result.trim() + toExec;
|
|
9272
9362
|
}
|
|
9273
9363
|
catch (error) {
|
|
9274
|
-
|
|
9275
|
-
throw error;
|
|
9276
|
-
}
|
|
9364
|
+
assertsError(error);
|
|
9277
9365
|
return null;
|
|
9278
9366
|
}
|
|
9279
9367
|
}
|
|
@@ -9304,9 +9392,7 @@
|
|
|
9304
9392
|
throw new Error(`Can not locate app ${appName} on Windows.`);
|
|
9305
9393
|
}
|
|
9306
9394
|
catch (error) {
|
|
9307
|
-
|
|
9308
|
-
throw error;
|
|
9309
|
-
}
|
|
9395
|
+
assertsError(error);
|
|
9310
9396
|
return null;
|
|
9311
9397
|
}
|
|
9312
9398
|
}
|
|
@@ -9597,13 +9683,13 @@
|
|
|
9597
9683
|
/**
|
|
9598
9684
|
* Provides the path to the `.env` file
|
|
9599
9685
|
*
|
|
9600
|
-
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access
|
|
9686
|
+
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
9601
9687
|
*
|
|
9602
9688
|
* @private within the repository - for CLI utils
|
|
9603
9689
|
*/
|
|
9604
|
-
async function $
|
|
9690
|
+
async function $provideEnvFilename() {
|
|
9605
9691
|
if (!$isRunningInNode()) {
|
|
9606
|
-
throw new EnvironmentMismatchError('Function `$
|
|
9692
|
+
throw new EnvironmentMismatchError('Function `$provideEnvFilename` works only in Node.js environment');
|
|
9607
9693
|
}
|
|
9608
9694
|
const envFilePatterns = [
|
|
9609
9695
|
'.env',
|
|
@@ -9642,7 +9728,7 @@
|
|
|
9642
9728
|
* @@@
|
|
9643
9729
|
*
|
|
9644
9730
|
* @@@ .env
|
|
9645
|
-
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access
|
|
9731
|
+
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
9646
9732
|
*
|
|
9647
9733
|
* It looks for environment variables:
|
|
9648
9734
|
* - `process.env.OPENAI_API_KEY`
|
|
@@ -9656,7 +9742,7 @@
|
|
|
9656
9742
|
if (!$isRunningInNode()) {
|
|
9657
9743
|
throw new EnvironmentMismatchError('Function `$provideLlmToolsFromEnv` works only in Node.js environment');
|
|
9658
9744
|
}
|
|
9659
|
-
const envFilepath = await $
|
|
9745
|
+
const envFilepath = await $provideEnvFilename();
|
|
9660
9746
|
if (envFilepath !== null) {
|
|
9661
9747
|
dotenv__namespace.config({ path: envFilepath });
|
|
9662
9748
|
}
|
|
@@ -9727,7 +9813,7 @@
|
|
|
9727
9813
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
9728
9814
|
*
|
|
9729
9815
|
* @@@ .env
|
|
9730
|
-
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access
|
|
9816
|
+
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
9731
9817
|
*
|
|
9732
9818
|
* It looks for environment variables:
|
|
9733
9819
|
* - `process.env.OPENAI_API_KEY`
|
|
@@ -10261,9 +10347,7 @@
|
|
|
10261
10347
|
}
|
|
10262
10348
|
}
|
|
10263
10349
|
catch (error) {
|
|
10264
|
-
|
|
10265
|
-
throw error;
|
|
10266
|
-
}
|
|
10350
|
+
assertsError(error);
|
|
10267
10351
|
if (error instanceof ReferenceError) {
|
|
10268
10352
|
const undefinedName = error.message.split(' ')[0];
|
|
10269
10353
|
/*
|
|
@@ -10538,9 +10622,7 @@
|
|
|
10538
10622
|
// ---
|
|
10539
10623
|
}
|
|
10540
10624
|
catch (error) {
|
|
10541
|
-
|
|
10542
|
-
throw error;
|
|
10543
|
-
}
|
|
10625
|
+
assertsError(error);
|
|
10544
10626
|
// TODO: [7] DRY
|
|
10545
10627
|
const wrappedErrorMessage = spaceTrim__default["default"]((block) => `
|
|
10546
10628
|
${error.name} in pipeline ${fileName.split('\\').join('/')}โ :
|
|
@@ -10631,9 +10713,7 @@
|
|
|
10631
10713
|
}
|
|
10632
10714
|
}
|
|
10633
10715
|
catch (error) {
|
|
10634
|
-
|
|
10635
|
-
throw error;
|
|
10636
|
-
}
|
|
10716
|
+
assertsError(error);
|
|
10637
10717
|
// TODO: [7] DRY
|
|
10638
10718
|
const wrappedErrorMessage = spaceTrim__default["default"]((block) => `
|
|
10639
10719
|
${error.name} in pipeline ${fileName.split('\\').join('/')}โ :
|