@promptbook/node 0.86.31 → 0.88.0-1
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 +5 -3
- package/esm/index.es.js +23 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +11 -0
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +23 -5
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/_packages/{execute-javascript.index.d.ts → javascript.index.d.ts} +0 -0
|
@@ -6,6 +6,7 @@ import { $provideLlmToolsConfigurationFromEnv } from '../llm-providers/_common/r
|
|
|
6
6
|
import { $provideLlmToolsFromEnv } from '../llm-providers/_common/register/$provideLlmToolsFromEnv';
|
|
7
7
|
import { $provideFilesystemForNode } from '../scrapers/_common/register/$provideFilesystemForNode';
|
|
8
8
|
import { $provideScrapersForNode } from '../scrapers/_common/register/$provideScrapersForNode';
|
|
9
|
+
import { $provideScriptingForNode } from '../scrapers/_common/register/$provideScriptingForNode';
|
|
9
10
|
import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage';
|
|
10
11
|
import { $execCommand } from '../utils/execCommand/$execCommand';
|
|
11
12
|
import { $execCommands } from '../utils/execCommand/$execCommands';
|
|
@@ -17,6 +18,7 @@ export { $provideLlmToolsConfigurationFromEnv };
|
|
|
17
18
|
export { $provideLlmToolsFromEnv };
|
|
18
19
|
export { $provideFilesystemForNode };
|
|
19
20
|
export { $provideScrapersForNode };
|
|
21
|
+
export { $provideScriptingForNode };
|
|
20
22
|
export { FileCacheStorage };
|
|
21
23
|
export { $execCommand };
|
|
22
24
|
export { $execCommands };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ScriptExecutionTools } from '../../../execution/ScriptExecutionTools';
|
|
2
|
+
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Provides script execution tools
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/node`
|
|
7
|
+
*/
|
|
8
|
+
export declare function $provideScriptingForNode(options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<ScriptExecutionTools>>;
|
|
9
|
+
/**
|
|
10
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
11
|
+
*/
|
|
@@ -6,7 +6,7 @@ import type { JavascriptExecutionToolsOptions } from './JavascriptExecutionTools
|
|
|
6
6
|
* Warning: It is used for testing and mocking
|
|
7
7
|
* **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
|
|
8
8
|
*
|
|
9
|
-
* @public exported from `@promptbook/
|
|
9
|
+
* @public exported from `@promptbook/javascript`
|
|
10
10
|
*/
|
|
11
11
|
export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
|
|
12
12
|
protected readonly options: JavascriptExecutionToolsOptions;
|
|
@@ -3,6 +3,6 @@ import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
|
3
3
|
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
4
4
|
*
|
|
5
5
|
* @alias JavascriptExecutionTools
|
|
6
|
-
* @public exported from `@promptbook/
|
|
6
|
+
* @public exported from `@promptbook/javascript`
|
|
7
7
|
*/
|
|
8
8
|
export declare const JavascriptExecutionTools: typeof JavascriptEvalExecutionTools;
|
|
@@ -20,7 +20,7 @@ import { unwrapResult } from '../../utils/unwrapResult';
|
|
|
20
20
|
/**
|
|
21
21
|
* @@@
|
|
22
22
|
*
|
|
23
|
-
* @public exported from `@promptbook/
|
|
23
|
+
* @public exported from `@promptbook/javascript`
|
|
24
24
|
*/
|
|
25
25
|
export declare const POSTPROCESSING_FUNCTIONS: {
|
|
26
26
|
spaceTrim: typeof spaceTrim;
|
|
@@ -6,7 +6,7 @@ import type { string_javascript_name } from '../../../types/typeAliases';
|
|
|
6
6
|
* @param script from which to extract the variables
|
|
7
7
|
* @returns the list of variable names
|
|
8
8
|
* @throws {ParseError} if the script is invalid
|
|
9
|
-
* @public exported from `@promptbook/
|
|
9
|
+
* @public exported from `@promptbook/javascript`
|
|
10
10
|
*/
|
|
11
11
|
export declare function extractVariablesFromJavascript(script: string_javascript): Set<string_javascript_name>;
|
|
12
12
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0-1",
|
|
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,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
50
|
+
"@promptbook/core": "0.88.0-1"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
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.88.0-1';
|
|
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
|
|
@@ -2138,7 +2138,7 @@
|
|
|
2138
2138
|
* @param script from which to extract the variables
|
|
2139
2139
|
* @returns the list of variable names
|
|
2140
2140
|
* @throws {ParseError} if the script is invalid
|
|
2141
|
-
* @public exported from `@promptbook/
|
|
2141
|
+
* @public exported from `@promptbook/javascript`
|
|
2142
2142
|
*/
|
|
2143
2143
|
function extractVariablesFromJavascript(script) {
|
|
2144
2144
|
const variables = new Set();
|
|
@@ -9921,7 +9921,7 @@
|
|
|
9921
9921
|
* Warning: It is used for testing and mocking
|
|
9922
9922
|
* **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
|
|
9923
9923
|
*
|
|
9924
|
-
* @public exported from `@promptbook/
|
|
9924
|
+
* @public exported from `@promptbook/javascript`
|
|
9925
9925
|
*/
|
|
9926
9926
|
class JavascriptEvalExecutionTools {
|
|
9927
9927
|
constructor(options) {
|
|
@@ -10027,7 +10027,8 @@
|
|
|
10027
10027
|
// Note: Custom functions are exposed to the current scope as variables
|
|
10028
10028
|
`const ${functionName} = customFunctions.${functionName};`)
|
|
10029
10029
|
.join('\n');
|
|
10030
|
-
script = templateParameters(script, parameters);
|
|
10030
|
+
// script = templateParameters(script, parameters);
|
|
10031
|
+
// <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
|
|
10031
10032
|
const statementToEvaluate = spaceTrim__default["default"]((block) => `
|
|
10032
10033
|
|
|
10033
10034
|
// Build-in functions:
|
|
@@ -10118,7 +10119,7 @@
|
|
|
10118
10119
|
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
10119
10120
|
*
|
|
10120
10121
|
* @alias JavascriptExecutionTools
|
|
10121
|
-
* @public exported from `@promptbook/
|
|
10122
|
+
* @public exported from `@promptbook/javascript`
|
|
10122
10123
|
*/
|
|
10123
10124
|
const JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
10124
10125
|
|
|
@@ -10461,6 +10462,22 @@
|
|
|
10461
10462
|
* TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
10462
10463
|
*/
|
|
10463
10464
|
|
|
10465
|
+
/**
|
|
10466
|
+
* Provides script execution tools
|
|
10467
|
+
*
|
|
10468
|
+
* @public exported from `@promptbook/node`
|
|
10469
|
+
*/
|
|
10470
|
+
async function $provideScriptingForNode(options) {
|
|
10471
|
+
if (!$isRunningInNode()) {
|
|
10472
|
+
throw new EnvironmentMismatchError('Function `$provideScriptingForNode` works only in Node.js environment');
|
|
10473
|
+
}
|
|
10474
|
+
// TODO: [🔱] Do here auto-installation
|
|
10475
|
+
return [new JavascriptExecutionTools(options)];
|
|
10476
|
+
}
|
|
10477
|
+
/**
|
|
10478
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10479
|
+
*/
|
|
10480
|
+
|
|
10464
10481
|
/**
|
|
10465
10482
|
* Stringify the PipelineJson with proper formatting
|
|
10466
10483
|
*
|
|
@@ -10587,6 +10604,7 @@
|
|
|
10587
10604
|
exports.$provideLlmToolsConfigurationFromEnv = $provideLlmToolsConfigurationFromEnv;
|
|
10588
10605
|
exports.$provideLlmToolsFromEnv = $provideLlmToolsFromEnv;
|
|
10589
10606
|
exports.$provideScrapersForNode = $provideScrapersForNode;
|
|
10607
|
+
exports.$provideScriptingForNode = $provideScriptingForNode;
|
|
10590
10608
|
exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
|
|
10591
10609
|
exports.FileCacheStorage = FileCacheStorage;
|
|
10592
10610
|
exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;
|