@promptbook/node 0.98.0-9 → 0.99.0-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/esm/index.es.js +43 -42
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/config.d.ts +10 -0
- package/esm/typings/src/remote-server/connection-improvements.test.d.ts +1 -0
- package/esm/typings/src/remote-server/utils/connectionProgress.d.ts +72 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +59 -40
- package/umd/index.umd.js +43 -42
- package/umd/index.umd.js.map +1 -1
|
@@ -138,6 +138,9 @@ export declare const SMALL_NUMBER = 0.001;
|
|
|
138
138
|
/**
|
|
139
139
|
* Timeout for the connections in milliseconds
|
|
140
140
|
*
|
|
141
|
+
* Note: Increased from 7 seconds to 30 seconds to accommodate OAuth flows
|
|
142
|
+
* like Facebook login which may require user interaction and redirects
|
|
143
|
+
*
|
|
141
144
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
142
145
|
*/
|
|
143
146
|
export declare const CONNECTION_TIMEOUT_MS: number;
|
|
@@ -147,6 +150,13 @@ export declare const CONNECTION_TIMEOUT_MS: number;
|
|
|
147
150
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
148
151
|
*/
|
|
149
152
|
export declare const CONNECTION_RETRIES_LIMIT = 5;
|
|
153
|
+
/**
|
|
154
|
+
* Timeout specifically for OAuth authentication flows in milliseconds
|
|
155
|
+
* OAuth flows typically require more time due to user interaction and redirects
|
|
156
|
+
*
|
|
157
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
158
|
+
*/
|
|
159
|
+
export declare const OAUTH_TIMEOUT_MS: number;
|
|
150
160
|
/**
|
|
151
161
|
* Short time interval to prevent race conditions in milliseconds
|
|
152
162
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection progress utilities for better user experience during authentication
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Connection status types for better progress indication
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export type ConnectionStatus = 'connecting' | 'authenticating' | 'connected' | 'disconnected' | 'error' | 'timeout';
|
|
10
|
+
/**
|
|
11
|
+
* Progress callback function type for connection status updates
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export type ConnectionProgressCallback = (status: ConnectionStatus, message?: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Enhanced connection options with progress reporting
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export interface ConnectionProgressOptions {
|
|
22
|
+
onProgress?: ConnectionProgressCallback;
|
|
23
|
+
enableProgressReporting?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Default progress messages for different connection states
|
|
27
|
+
*
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_PROGRESS_MESSAGES: {
|
|
31
|
+
readonly connecting: "Connecting to Promptbook server...";
|
|
32
|
+
readonly authenticating: "Authenticating with social provider (Facebook, Google, etc.)...";
|
|
33
|
+
readonly connected: "Successfully connected to Promptbook server";
|
|
34
|
+
readonly disconnected: "Disconnected from Promptbook server";
|
|
35
|
+
readonly error: "Connection failed";
|
|
36
|
+
readonly timeout: "Connection timed out - this may happen during social login flows";
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Creates a progress reporter for connection status
|
|
40
|
+
* This can be used by frontend applications to show connection progress
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export declare function createConnectionProgressReporter(callback?: ConnectionProgressCallback): ConnectionProgressCallback;
|
|
45
|
+
/**
|
|
46
|
+
* Timeout constants with descriptions for different connection types
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
export declare const CONNECTION_TIMEOUTS: {
|
|
51
|
+
/** Standard timeout for regular connections */
|
|
52
|
+
readonly STANDARD: number;
|
|
53
|
+
/** Extended timeout for OAuth flows that require user interaction */
|
|
54
|
+
readonly OAUTH: number;
|
|
55
|
+
/** Short timeout for quick health checks */
|
|
56
|
+
readonly HEALTH_CHECK: number;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Helper function to get appropriate timeout based on connection type
|
|
60
|
+
*
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
export declare function getConnectionTimeout(type: 'standard' | 'oauth' | 'health_check'): number;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a timeout wrapper with progress reporting
|
|
66
|
+
*
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
export declare function createTimeoutWithProgress(timeoutMs: number, onProgress?: ConnectionProgressCallback): Promise<never>;
|
|
70
|
+
/**
|
|
71
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
72
|
+
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.98.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.98.0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.0-0",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,51 +15,70 @@
|
|
|
15
15
|
],
|
|
16
16
|
"keywords": [
|
|
17
17
|
"ai",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"ai-agents",
|
|
19
|
+
"ai-application-framework",
|
|
20
|
+
"ai-assistant",
|
|
21
|
+
"ai-automation",
|
|
22
|
+
"ai-development",
|
|
23
|
+
"ai-framework",
|
|
24
|
+
"ai-ops",
|
|
25
|
+
"ai-orchestration",
|
|
26
|
+
"ai-pipeline",
|
|
27
|
+
"ai-platform",
|
|
28
|
+
"ai-scripting",
|
|
29
|
+
"ai-sdk",
|
|
30
|
+
"ai-workflow",
|
|
31
|
+
"api-integration",
|
|
32
|
+
"automation-framework",
|
|
33
|
+
"backend",
|
|
34
|
+
"book-language",
|
|
35
|
+
"browser",
|
|
36
|
+
"chatbot",
|
|
37
|
+
"content-generation",
|
|
38
|
+
"conversational-ai",
|
|
39
|
+
"cross-platform",
|
|
40
|
+
"cross-provider",
|
|
41
|
+
"developer-tools",
|
|
42
|
+
"embeddings",
|
|
43
|
+
"function-calling",
|
|
44
|
+
"generative-ai",
|
|
45
|
+
"human-readable",
|
|
46
|
+
"javascript",
|
|
47
|
+
"knowledge-base",
|
|
21
48
|
"language-model",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
49
|
+
"large-language-models",
|
|
50
|
+
"llm",
|
|
51
|
+
"llmops",
|
|
24
52
|
"machine-learning",
|
|
53
|
+
"markdown-dsl",
|
|
54
|
+
"mlops",
|
|
55
|
+
"model-agnostic",
|
|
56
|
+
"multi-model",
|
|
57
|
+
"multimodal",
|
|
58
|
+
"natural-language",
|
|
25
59
|
"natural-language-processing",
|
|
26
60
|
"nlp",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"gpt-4o",
|
|
34
|
-
"gpt-4o-mini",
|
|
35
|
-
"o1",
|
|
36
|
-
"o1-mini",
|
|
37
|
-
"o1-preview",
|
|
38
|
-
"anthropic",
|
|
39
|
-
"claude",
|
|
40
|
-
"claude-3",
|
|
41
|
-
"claude-3-opus",
|
|
42
|
-
"claude-3-sonnet",
|
|
43
|
-
"claude-3-haiku",
|
|
44
|
-
"gemini",
|
|
45
|
-
"gemini-pro",
|
|
46
|
-
"gemini-flash",
|
|
47
|
-
"mixtral",
|
|
48
|
-
"mistral",
|
|
49
|
-
"ollama",
|
|
50
|
-
"ai-orchestration",
|
|
61
|
+
"nodejs",
|
|
62
|
+
"orchestration",
|
|
63
|
+
"pipeline",
|
|
64
|
+
"plain-english",
|
|
65
|
+
"prompt",
|
|
66
|
+
"prompt-chaining",
|
|
51
67
|
"prompt-engineering",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"reasoning",
|
|
68
|
+
"prompt-management",
|
|
69
|
+
"prompt-template",
|
|
55
70
|
"rag",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
71
|
+
"reasoning",
|
|
72
|
+
"server-side",
|
|
73
|
+
"task-automation",
|
|
74
|
+
"template",
|
|
60
75
|
"text-generation",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
76
|
+
"text-processing",
|
|
77
|
+
"typescript",
|
|
78
|
+
"unified-interface",
|
|
79
|
+
"vendor-agnostic",
|
|
80
|
+
"workflow",
|
|
81
|
+
"workflow-engine"
|
|
63
82
|
],
|
|
64
83
|
"license": "BUSL-1.1",
|
|
65
84
|
"bugs": {
|
|
@@ -74,7 +93,7 @@
|
|
|
74
93
|
"module": "./esm/index.es.js",
|
|
75
94
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
76
95
|
"peerDependencies": {
|
|
77
|
-
"@promptbook/core": "0.
|
|
96
|
+
"@promptbook/core": "0.99.0-0"
|
|
78
97
|
},
|
|
79
98
|
"dependencies": {
|
|
80
99
|
"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.99.0-0';
|
|
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
|
|
@@ -10194,6 +10194,46 @@
|
|
|
10194
10194
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10195
10195
|
*/
|
|
10196
10196
|
|
|
10197
|
+
/**
|
|
10198
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
10199
|
+
*
|
|
10200
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
10201
|
+
*
|
|
10202
|
+
* @public exported from `@promptbook/utils`
|
|
10203
|
+
*/
|
|
10204
|
+
const $isRunningInBrowser = new Function(`
|
|
10205
|
+
try {
|
|
10206
|
+
return this === window;
|
|
10207
|
+
} catch (e) {
|
|
10208
|
+
return false;
|
|
10209
|
+
}
|
|
10210
|
+
`);
|
|
10211
|
+
/**
|
|
10212
|
+
* TODO: [🎺]
|
|
10213
|
+
*/
|
|
10214
|
+
|
|
10215
|
+
/**
|
|
10216
|
+
* Detects if the code is running in a web worker
|
|
10217
|
+
*
|
|
10218
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
10219
|
+
*
|
|
10220
|
+
* @public exported from `@promptbook/utils`
|
|
10221
|
+
*/
|
|
10222
|
+
const $isRunningInWebWorker = new Function(`
|
|
10223
|
+
try {
|
|
10224
|
+
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
|
|
10225
|
+
return true;
|
|
10226
|
+
} else {
|
|
10227
|
+
return false;
|
|
10228
|
+
}
|
|
10229
|
+
} catch (e) {
|
|
10230
|
+
return false;
|
|
10231
|
+
}
|
|
10232
|
+
`);
|
|
10233
|
+
/**
|
|
10234
|
+
* TODO: [🎺]
|
|
10235
|
+
*/
|
|
10236
|
+
|
|
10197
10237
|
/**
|
|
10198
10238
|
* Creates LLM execution tools from provided configuration objects
|
|
10199
10239
|
*
|
|
@@ -10214,9 +10254,10 @@
|
|
|
10214
10254
|
.list()
|
|
10215
10255
|
.find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
|
|
10216
10256
|
if (registeredItem === undefined) {
|
|
10217
|
-
console.log('
|
|
10257
|
+
// console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
|
|
10218
10258
|
throw new Error(spaceTrim__default["default"]((block) => `
|
|
10219
10259
|
There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
|
|
10260
|
+
Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
|
|
10220
10261
|
|
|
10221
10262
|
You have probably forgotten install and import the provider package.
|
|
10222
10263
|
To fix this issue, you can:
|
|
@@ -10343,24 +10384,6 @@
|
|
|
10343
10384
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10344
10385
|
*/
|
|
10345
10386
|
|
|
10346
|
-
/**
|
|
10347
|
-
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
10348
|
-
*
|
|
10349
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
10350
|
-
*
|
|
10351
|
-
* @public exported from `@promptbook/utils`
|
|
10352
|
-
*/
|
|
10353
|
-
new Function(`
|
|
10354
|
-
try {
|
|
10355
|
-
return this === window;
|
|
10356
|
-
} catch (e) {
|
|
10357
|
-
return false;
|
|
10358
|
-
}
|
|
10359
|
-
`);
|
|
10360
|
-
/**
|
|
10361
|
-
* TODO: [🎺]
|
|
10362
|
-
*/
|
|
10363
|
-
|
|
10364
10387
|
/**
|
|
10365
10388
|
* Detects if the code is running in jest environment
|
|
10366
10389
|
*
|
|
@@ -10379,28 +10402,6 @@
|
|
|
10379
10402
|
* TODO: [🎺]
|
|
10380
10403
|
*/
|
|
10381
10404
|
|
|
10382
|
-
/**
|
|
10383
|
-
* Detects if the code is running in a web worker
|
|
10384
|
-
*
|
|
10385
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
10386
|
-
*
|
|
10387
|
-
* @public exported from `@promptbook/utils`
|
|
10388
|
-
*/
|
|
10389
|
-
new Function(`
|
|
10390
|
-
try {
|
|
10391
|
-
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
|
|
10392
|
-
return true;
|
|
10393
|
-
} else {
|
|
10394
|
-
return false;
|
|
10395
|
-
}
|
|
10396
|
-
} catch (e) {
|
|
10397
|
-
return false;
|
|
10398
|
-
}
|
|
10399
|
-
`);
|
|
10400
|
-
/**
|
|
10401
|
-
* TODO: [🎺]
|
|
10402
|
-
*/
|
|
10403
|
-
|
|
10404
10405
|
/**
|
|
10405
10406
|
* Makes first letter of a string uppercase
|
|
10406
10407
|
*
|