@promptbook/cli 0.84.0-21 → 0.84.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.
- package/README.md +0 -4
- package/esm/index.es.js +185 -134
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +185 -134
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
<blockquote style="color: #ff8811">
|
|
28
|
-
<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>.
|
|
29
|
-
</blockquote>
|
|
30
|
-
|
|
31
27
|
## 📦 Package `@promptbook/cli`
|
|
32
28
|
|
|
33
29
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
38
38
|
* @generated
|
|
39
39
|
* @see https://github.com/webgptorg/promptbook
|
|
40
40
|
*/
|
|
41
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
41
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
|
|
42
42
|
/**
|
|
43
43
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
44
44
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -445,6 +445,45 @@ var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
|
445
445
|
* @public exported from `@promptbook/utils`
|
|
446
446
|
*/
|
|
447
447
|
var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
448
|
+
/**
|
|
449
|
+
* TODO: [☑]
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
454
|
+
*
|
|
455
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
456
|
+
*
|
|
457
|
+
* @public exported from `@promptbook/utils`
|
|
458
|
+
*/
|
|
459
|
+
var $isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
460
|
+
/**
|
|
461
|
+
* TODO: [☑]
|
|
462
|
+
*/
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Detects if the code is running in jest environment
|
|
466
|
+
*
|
|
467
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
468
|
+
*
|
|
469
|
+
* @public exported from `@promptbook/utils`
|
|
470
|
+
*/
|
|
471
|
+
var $isRunningInJest = new Function("\n try {\n return process.env.JEST_WORKER_ID !== undefined;\n } catch (e) {\n return false;\n }\n");
|
|
472
|
+
/**
|
|
473
|
+
* TODO: [☑]
|
|
474
|
+
*/
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Detects if the code is running in a web worker
|
|
478
|
+
*
|
|
479
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
480
|
+
*
|
|
481
|
+
* @public exported from `@promptbook/utils`
|
|
482
|
+
*/
|
|
483
|
+
var $isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
484
|
+
/**
|
|
485
|
+
* TODO: [☑]
|
|
486
|
+
*/
|
|
448
487
|
|
|
449
488
|
/**
|
|
450
489
|
* Initializes `about` command for Promptbook CLI utilities
|
|
@@ -459,16 +498,37 @@ function $initializeAboutCommand(program) {
|
|
|
459
498
|
makeCommand.description(spaceTrim("\n Tells about Promptbook CLI and its abilities\n "));
|
|
460
499
|
makeCommand.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
461
500
|
return __generator(this, function (_a) {
|
|
462
|
-
console.info(colors.bold(colors.
|
|
501
|
+
console.info(colors.bold(colors.blue("Promptbook: ".concat(CLAIM))));
|
|
463
502
|
console.info(colors.cyan("Book language version: ".concat(BOOK_LANGUAGE_VERSION)));
|
|
464
503
|
console.info(colors.cyan("Promptbook engine version: ".concat(PROMPTBOOK_ENGINE_VERSION)));
|
|
465
|
-
|
|
466
|
-
|
|
504
|
+
if ($isRunningInNode()) {
|
|
505
|
+
console.info(colors.cyan("Environment: Node.js"));
|
|
506
|
+
console.info(colors.cyan("Node.js version: ".concat(process.version)));
|
|
507
|
+
// <- TODO: [🧠][☑] Make robust system to check platform requirements like browser/node environment, version of node, available memory, disk space, ...
|
|
508
|
+
console.info(colors.cyan("Platform type: ".concat(process.platform)));
|
|
509
|
+
console.info(colors.cyan("Platform architecture: ".concat(process.arch)));
|
|
510
|
+
// console.info(colors.cyan(`Available memory: ${process.availableMemory()}`));
|
|
511
|
+
// <- TODO: [🧠] Should we show available memory / disk / ...
|
|
512
|
+
}
|
|
513
|
+
else if ($isRunningInJest()) {
|
|
514
|
+
console.info(colors.cyan("Environment: Jest (testing)"));
|
|
515
|
+
}
|
|
516
|
+
else if ($isRunningInBrowser()) {
|
|
517
|
+
// <- Note: This is unreliable because CLI itself is not running in browser but for future use
|
|
518
|
+
console.info(colors.cyan("Environment: Browser"));
|
|
519
|
+
}
|
|
520
|
+
else if ($isRunningInWebWorker()) {
|
|
521
|
+
// <- Note: This is unreliable because CLI itself is not running in browser but for future use
|
|
522
|
+
console.info(colors.cyan("Environment: Web Worker"));
|
|
523
|
+
}
|
|
524
|
+
console.info(colors.gray("https://github.com/webgptorg/promptbook"));
|
|
525
|
+
console.info(colors.gray("https://ptbk.io"));
|
|
467
526
|
return [2 /*return*/, process.exit(0)];
|
|
468
527
|
});
|
|
469
528
|
}); });
|
|
470
529
|
}
|
|
471
530
|
/**
|
|
531
|
+
* TODO: !!! Test this in `deno`
|
|
472
532
|
* TODO: [🗽] Unite branding and make single place for it
|
|
473
533
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
474
534
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
@@ -2118,107 +2178,6 @@ function isRootPath(value) {
|
|
|
2118
2178
|
* TODO: [🍏] Make for MacOS paths
|
|
2119
2179
|
*/
|
|
2120
2180
|
|
|
2121
|
-
/**
|
|
2122
|
-
* @@@
|
|
2123
|
-
*
|
|
2124
|
-
* @@@ .env
|
|
2125
|
-
*
|
|
2126
|
-
* It looks for environment variables:
|
|
2127
|
-
* - `process.env.OPENAI_API_KEY`
|
|
2128
|
-
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
2129
|
-
* - ...
|
|
2130
|
-
*
|
|
2131
|
-
* @returns @@@
|
|
2132
|
-
* @public exported from `@promptbook/node`
|
|
2133
|
-
*/
|
|
2134
|
-
function $provideLlmToolsConfigurationFromEnv() {
|
|
2135
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2136
|
-
var envFilePatterns, rootDirname, i, envFilePatterns_1, envFilePatterns_1_1, pattern, envFilename, e_1_1, llmToolsConfiguration;
|
|
2137
|
-
var e_1, _a;
|
|
2138
|
-
return __generator(this, function (_b) {
|
|
2139
|
-
switch (_b.label) {
|
|
2140
|
-
case 0:
|
|
2141
|
-
if (!$isRunningInNode()) {
|
|
2142
|
-
throw new EnvironmentMismatchError('Function `$provideLlmToolsFromEnv` works only in Node.js environment');
|
|
2143
|
-
}
|
|
2144
|
-
envFilePatterns = [
|
|
2145
|
-
'.env',
|
|
2146
|
-
'.env.test',
|
|
2147
|
-
'.env.local',
|
|
2148
|
-
'.env.development.local',
|
|
2149
|
-
'.env.development',
|
|
2150
|
-
'.env.production.local',
|
|
2151
|
-
'.env.production',
|
|
2152
|
-
'.env.prod.local',
|
|
2153
|
-
'.env.prod',
|
|
2154
|
-
// <- TODO: Maybe add more patterns
|
|
2155
|
-
];
|
|
2156
|
-
rootDirname = process.cwd();
|
|
2157
|
-
i = 0;
|
|
2158
|
-
_b.label = 1;
|
|
2159
|
-
case 1:
|
|
2160
|
-
if (!(i < LOOP_LIMIT)) return [3 /*break*/, 11];
|
|
2161
|
-
_b.label = 2;
|
|
2162
|
-
case 2:
|
|
2163
|
-
_b.trys.push([2, 7, 8, 9]);
|
|
2164
|
-
envFilePatterns_1 = (e_1 = void 0, __values(envFilePatterns)), envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
2165
|
-
_b.label = 3;
|
|
2166
|
-
case 3:
|
|
2167
|
-
if (!!envFilePatterns_1_1.done) return [3 /*break*/, 6];
|
|
2168
|
-
pattern = envFilePatterns_1_1.value;
|
|
2169
|
-
envFilename = join(rootDirname, pattern);
|
|
2170
|
-
return [4 /*yield*/, isFileExisting(envFilename, $provideFilesystemForNode())];
|
|
2171
|
-
case 4:
|
|
2172
|
-
if (_b.sent()) {
|
|
2173
|
-
dotenv.config({ path: envFilename });
|
|
2174
|
-
return [3 /*break*/, 11];
|
|
2175
|
-
}
|
|
2176
|
-
_b.label = 5;
|
|
2177
|
-
case 5:
|
|
2178
|
-
envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
2179
|
-
return [3 /*break*/, 3];
|
|
2180
|
-
case 6: return [3 /*break*/, 9];
|
|
2181
|
-
case 7:
|
|
2182
|
-
e_1_1 = _b.sent();
|
|
2183
|
-
e_1 = { error: e_1_1 };
|
|
2184
|
-
return [3 /*break*/, 9];
|
|
2185
|
-
case 8:
|
|
2186
|
-
try {
|
|
2187
|
-
if (envFilePatterns_1_1 && !envFilePatterns_1_1.done && (_a = envFilePatterns_1.return)) _a.call(envFilePatterns_1);
|
|
2188
|
-
}
|
|
2189
|
-
finally { if (e_1) throw e_1.error; }
|
|
2190
|
-
return [7 /*endfinally*/];
|
|
2191
|
-
case 9:
|
|
2192
|
-
if (isRootPath(rootDirname)) {
|
|
2193
|
-
return [3 /*break*/, 11];
|
|
2194
|
-
}
|
|
2195
|
-
// Note: If the directory does not exist, try the parent directory
|
|
2196
|
-
rootDirname = join(rootDirname, '..');
|
|
2197
|
-
_b.label = 10;
|
|
2198
|
-
case 10:
|
|
2199
|
-
i++;
|
|
2200
|
-
return [3 /*break*/, 1];
|
|
2201
|
-
case 11:
|
|
2202
|
-
llmToolsConfiguration = $llmToolsMetadataRegister
|
|
2203
|
-
.list()
|
|
2204
|
-
.map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
|
|
2205
|
-
.filter(function (configuration) { return configuration !== null; });
|
|
2206
|
-
return [2 /*return*/, llmToolsConfiguration];
|
|
2207
|
-
}
|
|
2208
|
-
});
|
|
2209
|
-
});
|
|
2210
|
-
}
|
|
2211
|
-
/**
|
|
2212
|
-
* TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
|
|
2213
|
-
* TODO: Add Azure OpenAI
|
|
2214
|
-
* TODO: [🧠][🍛]
|
|
2215
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
2216
|
-
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
2217
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2218
|
-
* TODO: This should be maybe not under `_common` but under `utils`
|
|
2219
|
-
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
2220
|
-
* TODO: [®] DRY Register logic */
|
|
2221
|
-
|
|
2222
2181
|
/**
|
|
2223
2182
|
* @@@
|
|
2224
2183
|
*
|
|
@@ -2231,6 +2190,22 @@ var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
|
2231
2190
|
* TODO: [®] DRY Register logic
|
|
2232
2191
|
*/
|
|
2233
2192
|
|
|
2193
|
+
/**
|
|
2194
|
+
* Path to the `.env` file which was used to configure LLM tools
|
|
2195
|
+
*
|
|
2196
|
+
* Note: `$` is used to indicate that this variable is changed by side effect in `$provideLlmToolsConfigurationFromEnv` through `$setUsedEnvFilename`
|
|
2197
|
+
*/
|
|
2198
|
+
var $usedEnvFilename = null;
|
|
2199
|
+
/**
|
|
2200
|
+
* Pass the `.env` file which was used to configure LLM tools
|
|
2201
|
+
*
|
|
2202
|
+
* Note: `$` is used to indicate that this variable is making side effect
|
|
2203
|
+
*
|
|
2204
|
+
* @private internal log of `$provideLlmToolsConfigurationFromEnv` and `$registeredLlmToolsMessage`
|
|
2205
|
+
*/
|
|
2206
|
+
function $setUsedEnvFilename(filepath) {
|
|
2207
|
+
$usedEnvFilename = filepath;
|
|
2208
|
+
}
|
|
2234
2209
|
/**
|
|
2235
2210
|
* Creates a message with all registered LLM tools
|
|
2236
2211
|
*
|
|
@@ -2309,10 +2284,11 @@ function $registeredLlmToolsMessage() {
|
|
|
2309
2284
|
// <- Note: [🗨]
|
|
2310
2285
|
return __assign(__assign({}, metadata), { isMetadataAviailable: isMetadataAviailable, isInstalled: isInstalled, isFullyConfigured: isFullyConfigured, isPartiallyConfigured: isPartiallyConfigured });
|
|
2311
2286
|
});
|
|
2287
|
+
var usedEnvMessage = $usedEnvFilename === null ? "Unknown `.env` file" : "Used `.env` file:\n".concat($usedEnvFilename);
|
|
2312
2288
|
if (metadata.length === 0) {
|
|
2313
|
-
return "No LLM providers are available.";
|
|
2289
|
+
return spaceTrim(function (block) { return "\n No LLM providers are available.\n\n ".concat(block(usedEnvMessage), "\n "); });
|
|
2314
2290
|
}
|
|
2315
|
-
return spaceTrim(function (block) { return "\n Relevant environment variables:\n ".concat(block(Object.keys(env)
|
|
2291
|
+
return spaceTrim(function (block) { return "\n\n ".concat(block(usedEnvMessage), "\n\n Relevant environment variables:\n ").concat(block(Object.keys(env)
|
|
2316
2292
|
.filter(function (envVariableName) {
|
|
2317
2293
|
return metadata.some(function (_a) {
|
|
2318
2294
|
var envVariables = _a.envVariables;
|
|
@@ -2377,6 +2353,108 @@ function $registeredLlmToolsMessage() {
|
|
|
2377
2353
|
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
2378
2354
|
*/
|
|
2379
2355
|
|
|
2356
|
+
/**
|
|
2357
|
+
* @@@
|
|
2358
|
+
*
|
|
2359
|
+
* @@@ .env
|
|
2360
|
+
*
|
|
2361
|
+
* It looks for environment variables:
|
|
2362
|
+
* - `process.env.OPENAI_API_KEY`
|
|
2363
|
+
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
2364
|
+
* - ...
|
|
2365
|
+
*
|
|
2366
|
+
* @returns @@@
|
|
2367
|
+
* @public exported from `@promptbook/node`
|
|
2368
|
+
*/
|
|
2369
|
+
function $provideLlmToolsConfigurationFromEnv() {
|
|
2370
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2371
|
+
var envFilePatterns, rootDirname, i, envFilePatterns_1, envFilePatterns_1_1, pattern, envFilename, e_1_1, llmToolsConfiguration;
|
|
2372
|
+
var e_1, _a;
|
|
2373
|
+
return __generator(this, function (_b) {
|
|
2374
|
+
switch (_b.label) {
|
|
2375
|
+
case 0:
|
|
2376
|
+
if (!$isRunningInNode()) {
|
|
2377
|
+
throw new EnvironmentMismatchError('Function `$provideLlmToolsFromEnv` works only in Node.js environment');
|
|
2378
|
+
}
|
|
2379
|
+
envFilePatterns = [
|
|
2380
|
+
'.env',
|
|
2381
|
+
'.env.test',
|
|
2382
|
+
'.env.local',
|
|
2383
|
+
'.env.development.local',
|
|
2384
|
+
'.env.development',
|
|
2385
|
+
'.env.production.local',
|
|
2386
|
+
'.env.production',
|
|
2387
|
+
'.env.prod.local',
|
|
2388
|
+
'.env.prod',
|
|
2389
|
+
// <- TODO: Maybe add more patterns
|
|
2390
|
+
];
|
|
2391
|
+
rootDirname = process.cwd();
|
|
2392
|
+
i = 0;
|
|
2393
|
+
_b.label = 1;
|
|
2394
|
+
case 1:
|
|
2395
|
+
if (!(i < LOOP_LIMIT)) return [3 /*break*/, 11];
|
|
2396
|
+
_b.label = 2;
|
|
2397
|
+
case 2:
|
|
2398
|
+
_b.trys.push([2, 7, 8, 9]);
|
|
2399
|
+
envFilePatterns_1 = (e_1 = void 0, __values(envFilePatterns)), envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
2400
|
+
_b.label = 3;
|
|
2401
|
+
case 3:
|
|
2402
|
+
if (!!envFilePatterns_1_1.done) return [3 /*break*/, 6];
|
|
2403
|
+
pattern = envFilePatterns_1_1.value;
|
|
2404
|
+
envFilename = join(rootDirname, pattern);
|
|
2405
|
+
return [4 /*yield*/, isFileExisting(envFilename, $provideFilesystemForNode())];
|
|
2406
|
+
case 4:
|
|
2407
|
+
if (_b.sent()) {
|
|
2408
|
+
$setUsedEnvFilename(envFilename);
|
|
2409
|
+
dotenv.config({ path: envFilename });
|
|
2410
|
+
return [3 /*break*/, 11];
|
|
2411
|
+
}
|
|
2412
|
+
_b.label = 5;
|
|
2413
|
+
case 5:
|
|
2414
|
+
envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
2415
|
+
return [3 /*break*/, 3];
|
|
2416
|
+
case 6: return [3 /*break*/, 9];
|
|
2417
|
+
case 7:
|
|
2418
|
+
e_1_1 = _b.sent();
|
|
2419
|
+
e_1 = { error: e_1_1 };
|
|
2420
|
+
return [3 /*break*/, 9];
|
|
2421
|
+
case 8:
|
|
2422
|
+
try {
|
|
2423
|
+
if (envFilePatterns_1_1 && !envFilePatterns_1_1.done && (_a = envFilePatterns_1.return)) _a.call(envFilePatterns_1);
|
|
2424
|
+
}
|
|
2425
|
+
finally { if (e_1) throw e_1.error; }
|
|
2426
|
+
return [7 /*endfinally*/];
|
|
2427
|
+
case 9:
|
|
2428
|
+
if (isRootPath(rootDirname)) {
|
|
2429
|
+
return [3 /*break*/, 11];
|
|
2430
|
+
}
|
|
2431
|
+
// Note: If the directory does not exist, try the parent directory
|
|
2432
|
+
rootDirname = join(rootDirname, '..');
|
|
2433
|
+
_b.label = 10;
|
|
2434
|
+
case 10:
|
|
2435
|
+
i++;
|
|
2436
|
+
return [3 /*break*/, 1];
|
|
2437
|
+
case 11:
|
|
2438
|
+
llmToolsConfiguration = $llmToolsMetadataRegister
|
|
2439
|
+
.list()
|
|
2440
|
+
.map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
|
|
2441
|
+
.filter(function (configuration) { return configuration !== null; });
|
|
2442
|
+
return [2 /*return*/, llmToolsConfiguration];
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
});
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
|
|
2449
|
+
* TODO: Add Azure OpenAI
|
|
2450
|
+
* TODO: [🧠][🍛]
|
|
2451
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
2452
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
2453
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2454
|
+
* TODO: This should be maybe not under `_common` but under `utils`
|
|
2455
|
+
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
2456
|
+
* TODO: [®] DRY Register logic */
|
|
2457
|
+
|
|
2380
2458
|
/**
|
|
2381
2459
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
2382
2460
|
*
|
|
@@ -11204,33 +11282,6 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
11204
11282
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
11205
11283
|
*/
|
|
11206
11284
|
|
|
11207
|
-
/**
|
|
11208
|
-
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
11209
|
-
*
|
|
11210
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
11211
|
-
*
|
|
11212
|
-
* @public exported from `@promptbook/utils`
|
|
11213
|
-
*/
|
|
11214
|
-
var $isRunningInBrowser = new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
11215
|
-
|
|
11216
|
-
/**
|
|
11217
|
-
* Detects if the code is running in jest environment
|
|
11218
|
-
*
|
|
11219
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
11220
|
-
*
|
|
11221
|
-
* @public exported from `@promptbook/utils`
|
|
11222
|
-
*/
|
|
11223
|
-
var $isRunningInJest = new Function("\n try {\n return process.env.JEST_WORKER_ID !== undefined;\n } catch (e) {\n return false;\n }\n");
|
|
11224
|
-
|
|
11225
|
-
/**
|
|
11226
|
-
* Detects if the code is running in a web worker
|
|
11227
|
-
*
|
|
11228
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
11229
|
-
*
|
|
11230
|
-
* @public exported from `@promptbook/utils`
|
|
11231
|
-
*/
|
|
11232
|
-
var $isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
11233
|
-
|
|
11234
11285
|
/**
|
|
11235
11286
|
* Makes first letter of a string uppercase
|
|
11236
11287
|
*
|