@promptbook/remote-client 0.89.0-6 → 0.89.0-8
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 +25 -7
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +8 -4
- package/esm/typings/src/_packages/remote-client.index.d.ts +0 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +15 -0
- package/esm/typings/src/config.d.ts +15 -8
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +34 -1
- 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/types/RemoteClientOptions.d.ts +2 -10
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +60 -3
- package/package.json +2 -2
- package/umd/index.umd.js +25 -7
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
* @generated
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
23
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-8';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -56,6 +56,19 @@ class CsvFormatError extends AbstractFormatError {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* AuthenticationError is thrown from login function which is dependency of remote server
|
|
61
|
+
*
|
|
62
|
+
* @public exported from `@promptbook/core`
|
|
63
|
+
*/
|
|
64
|
+
class AuthenticationError extends Error {
|
|
65
|
+
constructor(message) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.name = 'AuthenticationError';
|
|
68
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
/**
|
|
60
73
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
61
74
|
*
|
|
@@ -346,7 +359,7 @@ Object.freeze({
|
|
|
346
359
|
});
|
|
347
360
|
/**
|
|
348
361
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
349
|
-
* TODO: [🧠][🧜♂️] Maybe join
|
|
362
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteServerUrl and path into single value
|
|
350
363
|
*/
|
|
351
364
|
|
|
352
365
|
/**
|
|
@@ -454,6 +467,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
|
|
|
454
467
|
TypeError,
|
|
455
468
|
URIError,
|
|
456
469
|
AggregateError,
|
|
470
|
+
AuthenticationError,
|
|
457
471
|
/*
|
|
458
472
|
Note: Not widely supported
|
|
459
473
|
> InternalError,
|
|
@@ -510,22 +524,26 @@ function deserializeError(error) {
|
|
|
510
524
|
* @private internal utility function
|
|
511
525
|
*/
|
|
512
526
|
async function createRemoteClient(options) {
|
|
513
|
-
const {
|
|
527
|
+
const { remoteServerUrl } = options;
|
|
528
|
+
let path = new URL(remoteServerUrl).pathname;
|
|
529
|
+
if (path.endsWith('/')) {
|
|
530
|
+
path = path.slice(0, -1);
|
|
531
|
+
}
|
|
532
|
+
path = `${path}/socket.io`;
|
|
514
533
|
return new Promise((resolve, reject) => {
|
|
515
|
-
const socket = io(
|
|
534
|
+
const socket = io(remoteServerUrl, {
|
|
516
535
|
retries: CONNECTION_RETRIES_LIMIT,
|
|
517
536
|
timeout: CONNECTION_TIMEOUT_MS,
|
|
518
537
|
path,
|
|
519
|
-
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
520
538
|
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
521
539
|
});
|
|
522
|
-
// console.log('Connecting to', this.options.
|
|
540
|
+
// console.log('Connecting to', this.options.remoteServerUrl.href, { socket });
|
|
523
541
|
socket.on('connect', () => {
|
|
524
542
|
resolve(socket);
|
|
525
543
|
});
|
|
526
544
|
// TODO: [💩] Better timeout handling
|
|
527
545
|
setTimeout(() => {
|
|
528
|
-
reject(new Error(`Timeout while connecting to ${
|
|
546
|
+
reject(new Error(`Timeout while connecting to ${remoteServerUrl}`));
|
|
529
547
|
}, CONNECTION_TIMEOUT_MS);
|
|
530
548
|
});
|
|
531
549
|
}
|