@promptbook/remote-server 0.82.0-0 → 0.82.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/esm/index.es.js +6142 -807
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/remote-client.index.d.ts +9 -3
- package/esm/typings/src/_packages/remote-server.index.d.ts +8 -2
- package/esm/typings/src/_packages/types.index.d.ts +16 -26
- package/esm/typings/src/collection/PipelineCollection.d.ts +2 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +6 -3
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -7
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +5 -3
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +5 -2
- package/esm/typings/src/remote-server/createRemoteClient.d.ts +10 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/_common}/PromptbookServer_Error.d.ts +3 -3
- package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +10 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +49 -0
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/listModels}/PromptbookServer_ListModels_Response.d.ts +4 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Response.d.ts +12 -0
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/prompt}/PromptbookServer_Prompt_Response.d.ts +3 -3
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +32 -0
- package/esm/typings/src/types/Arrayable.d.ts +1 -0
- package/esm/typings/src/types/NonEmptyArray.d.ts +8 -0
- package/package.json +8 -3
- package/umd/index.umd.js +6137 -811
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_ListModels_Request.d.ts +0 -38
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Progress.d.ts +0 -12
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Request.d.ts +0 -45
- package/esm/typings/src/remote-server/interfaces/RemoteLlmExecutionToolsOptions.d.ts +0 -54
- /package/esm/typings/src/remote-server/{interfaces → types}/RemoteServerOptions.d.ts +0 -0
|
@@ -11,6 +11,7 @@ import { CLAIM } from '../config';
|
|
|
11
11
|
import { LOGO_LIGHT_SRC } from '../config';
|
|
12
12
|
import { LOGO_DARK_SRC } from '../config';
|
|
13
13
|
import { DEFAULT_BOOK_TITLE } from '../config';
|
|
14
|
+
import { DEFAULT_TASK_TITLE } from '../config';
|
|
14
15
|
import { MAX_FILENAME_LENGTH } from '../config';
|
|
15
16
|
import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
|
|
16
17
|
import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
|
|
@@ -134,6 +135,7 @@ export { CLAIM };
|
|
|
134
135
|
export { LOGO_LIGHT_SRC };
|
|
135
136
|
export { LOGO_DARK_SRC };
|
|
136
137
|
export { DEFAULT_BOOK_TITLE };
|
|
138
|
+
export { DEFAULT_TASK_TITLE };
|
|
137
139
|
export { MAX_FILENAME_LENGTH };
|
|
138
140
|
export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
|
|
139
141
|
export { DEFAULT_MAX_PARALLEL_COUNT };
|
|
@@ -2,11 +2,17 @@ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
|
2
2
|
import { compilePipelineOnRemoteServer } from '../conversion/compilePipelineOnRemoteServer';
|
|
3
3
|
import { RemoteLlmExecutionTools } from '../llm-providers/remote/RemoteLlmExecutionTools';
|
|
4
4
|
import { preparePipelineOnRemoteServer } from '../prepare/preparePipelineOnRemoteServer';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
5
|
+
import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
6
|
+
import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
7
|
+
import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
8
|
+
import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
|
|
9
|
+
import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
|
|
7
10
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
8
11
|
export { compilePipelineOnRemoteServer };
|
|
9
12
|
export { RemoteLlmExecutionTools };
|
|
10
13
|
export { preparePipelineOnRemoteServer };
|
|
11
|
-
export type {
|
|
14
|
+
export type { PromptbookServer_Identification };
|
|
15
|
+
export type { PromptbookServer_ApplicationIdentification };
|
|
16
|
+
export type { PromptbookServer_AnonymousIdentification };
|
|
17
|
+
export type { RemoteClientOptions };
|
|
12
18
|
export type { RemoteServerOptions };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
3
|
+
import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
4
|
+
import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
3
5
|
import { startRemoteServer } from '../remote-server/startRemoteServer';
|
|
6
|
+
import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
|
|
4
7
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
5
|
-
export type {
|
|
8
|
+
export type { PromptbookServer_Identification };
|
|
9
|
+
export type { PromptbookServer_ApplicationIdentification };
|
|
10
|
+
export type { PromptbookServer_AnonymousIdentification };
|
|
6
11
|
export { startRemoteServer };
|
|
12
|
+
export type { RemoteServerOptions };
|
|
@@ -87,21 +87,14 @@ import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
|
|
|
87
87
|
import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
|
|
88
88
|
import type { PipelineString } from '../pipeline/PipelineString';
|
|
89
89
|
import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
|
|
90
|
-
import type {
|
|
91
|
-
import type {
|
|
92
|
-
import type {
|
|
93
|
-
import type {
|
|
94
|
-
import type {
|
|
95
|
-
import type {
|
|
96
|
-
import type {
|
|
97
|
-
import type {
|
|
98
|
-
import type { PromptbookServer_Prompt_AnonymousRequest } from '../remote-server/interfaces/PromptbookServer_Prompt_Request';
|
|
99
|
-
import type { PromptbookServer_Prompt_Response } from '../remote-server/interfaces/PromptbookServer_Prompt_Response';
|
|
100
|
-
import type { RemoteLlmExecutionToolsOptions } from '../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
|
|
101
|
-
import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
102
|
-
import type { AnonymousRemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
103
|
-
import type { ApplicationRemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
104
|
-
import type { ApplicationRemoteServerClientOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
90
|
+
import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
91
|
+
import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
92
|
+
import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
93
|
+
import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
|
|
94
|
+
import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
|
|
95
|
+
import type { AnonymousRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
|
|
96
|
+
import type { ApplicationRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
|
|
97
|
+
import type { ApplicationRemoteServerClientOptions } from '../remote-server/types/RemoteServerOptions';
|
|
105
98
|
import type { Converter } from '../scrapers/_common/Converter';
|
|
106
99
|
import type { ScraperAndConverterMetadata } from '../scrapers/_common/register/ScraperAndConverterMetadata';
|
|
107
100
|
import type { ScraperConstructor } from '../scrapers/_common/register/ScraperConstructor';
|
|
@@ -118,6 +111,8 @@ import type { CompletionModelRequirements } from '../types/ModelRequirements';
|
|
|
118
111
|
import type { ChatModelRequirements } from '../types/ModelRequirements';
|
|
119
112
|
import type { EmbeddingModelRequirements } from '../types/ModelRequirements';
|
|
120
113
|
import type { ModelVariant } from '../types/ModelVariant';
|
|
114
|
+
import type { NonEmptyArray } from '../types/NonEmptyArray';
|
|
115
|
+
import type { NonEmptyReadonlyArray } from '../types/NonEmptyArray';
|
|
121
116
|
import type { Prompt } from '../types/Prompt';
|
|
122
117
|
import type { CompletionPrompt } from '../types/Prompt';
|
|
123
118
|
import type { ChatPrompt } from '../types/Prompt';
|
|
@@ -353,17 +348,10 @@ export type { SimpleTaskJson };
|
|
|
353
348
|
export type { TaskJson };
|
|
354
349
|
export type { PipelineString };
|
|
355
350
|
export type { PrepareAndScrapeOptions };
|
|
356
|
-
export type {
|
|
357
|
-
export type {
|
|
358
|
-
export type {
|
|
359
|
-
export type {
|
|
360
|
-
export type { PromptbookServer_ListModels_Response };
|
|
361
|
-
export type { PromptbookServer_Prompt_Progress };
|
|
362
|
-
export type { PromptbookServer_Prompt_Request };
|
|
363
|
-
export type { PromptbookServer_Prompt_CollectionRequest };
|
|
364
|
-
export type { PromptbookServer_Prompt_AnonymousRequest };
|
|
365
|
-
export type { PromptbookServer_Prompt_Response };
|
|
366
|
-
export type { RemoteLlmExecutionToolsOptions };
|
|
351
|
+
export type { PromptbookServer_Identification };
|
|
352
|
+
export type { PromptbookServer_ApplicationIdentification };
|
|
353
|
+
export type { PromptbookServer_AnonymousIdentification };
|
|
354
|
+
export type { RemoteClientOptions };
|
|
367
355
|
export type { RemoteServerOptions };
|
|
368
356
|
export type { AnonymousRemoteServerOptions };
|
|
369
357
|
export type { ApplicationRemoteServerOptions };
|
|
@@ -384,6 +372,8 @@ export type { CompletionModelRequirements };
|
|
|
384
372
|
export type { ChatModelRequirements };
|
|
385
373
|
export type { EmbeddingModelRequirements };
|
|
386
374
|
export type { ModelVariant };
|
|
375
|
+
export type { NonEmptyArray };
|
|
376
|
+
export type { NonEmptyReadonlyArray };
|
|
387
377
|
export type { Prompt };
|
|
388
378
|
export type { CompletionPrompt };
|
|
389
379
|
export type { ChatPrompt };
|
|
@@ -20,6 +20,8 @@ export type PipelineCollection = {
|
|
|
20
20
|
getPipelineByUrl(url: string_pipeline_url): Promisable<PipelineJson>;
|
|
21
21
|
/**
|
|
22
22
|
* Checks whether given prompt was defined in any pipeline in the collection
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Make better mechanism for skimming the remote server
|
|
23
25
|
*/
|
|
24
26
|
isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
|
|
25
27
|
};
|
|
@@ -59,6 +59,12 @@ export declare const LOGO_DARK_SRC: string_url_image;
|
|
|
59
59
|
* @public exported from `@promptbook/core`
|
|
60
60
|
*/
|
|
61
61
|
export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
62
|
+
/**
|
|
63
|
+
* When the title of task is not provided, the default title is used
|
|
64
|
+
*
|
|
65
|
+
* @public exported from `@promptbook/core`
|
|
66
|
+
*/
|
|
67
|
+
export declare const DEFAULT_TASK_TITLE = "Task";
|
|
62
68
|
/**
|
|
63
69
|
* Warning message for the generated sections and files files
|
|
64
70
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
2
1
|
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
3
2
|
import type { PipelineString } from '../pipeline/PipelineString';
|
|
3
|
+
import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
|
|
4
4
|
/**
|
|
5
5
|
* Compile pipeline from string (markdown) format to JSON format
|
|
6
6
|
*
|
|
@@ -10,9 +10,12 @@ import type { PipelineString } from '../pipeline/PipelineString';
|
|
|
10
10
|
* Note: This function acts as compilation process
|
|
11
11
|
*
|
|
12
12
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
13
|
-
* @param options -
|
|
13
|
+
* @param options - Configuration of the remote server
|
|
14
14
|
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
15
15
|
* @throws {ParseError} if the promptbook string is not valid
|
|
16
16
|
* @public exported from `@promptbook/remote-client`
|
|
17
17
|
*/
|
|
18
|
-
export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options:
|
|
18
|
+
export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
|
|
19
|
+
/**
|
|
20
|
+
* TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
|
|
21
|
+
*/
|
package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientOptions } from '@anthropic-ai/sdk';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
|
|
4
4
|
/**
|
|
5
5
|
* Options for `AnthropicClaudeExecutionTools`
|
|
6
6
|
*
|
|
@@ -25,7 +25,7 @@ export type AnthropicClaudeExecutionToolsDirectOptions = CommonToolsOptions & Cl
|
|
|
25
25
|
*/
|
|
26
26
|
export type AnthropicClaudeExecutionToolsProxiedOptions = CommonToolsOptions & ClientOptions & {
|
|
27
27
|
isProxied: true;
|
|
28
|
-
} & Pick<
|
|
28
|
+
} & Pick<RemoteClientOptions<undefined>, 'remoteUrl' | 'path'>;
|
|
29
29
|
/**
|
|
30
30
|
* TODO: [🧠][🤺] Pass `userId`
|
|
31
31
|
*/
|
|
@@ -3,13 +3,13 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
3
3
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
4
4
|
import type { CompletionPromptResult } from '../../execution/PromptResult';
|
|
5
5
|
import type { EmbeddingPromptResult } from '../../execution/PromptResult';
|
|
6
|
+
import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
|
|
6
7
|
import type { ChatPrompt } from '../../types/Prompt';
|
|
7
8
|
import type { CompletionPrompt } from '../../types/Prompt';
|
|
8
9
|
import type { EmbeddingPrompt } from '../../types/Prompt';
|
|
9
10
|
import type { string_markdown } from '../../types/typeAliases';
|
|
10
11
|
import type { string_markdown_text } from '../../types/typeAliases';
|
|
11
12
|
import type { string_title } from '../../types/typeAliases';
|
|
12
|
-
import type { RemoteLlmExecutionToolsOptions } from '../../remote-server/interfaces/RemoteLlmExecutionToolsOptions';
|
|
13
13
|
/**
|
|
14
14
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
15
15
|
*
|
|
@@ -20,8 +20,8 @@ import type { RemoteLlmExecutionToolsOptions } from '../../remote-server/interfa
|
|
|
20
20
|
* @public exported from `@promptbook/remote-client`
|
|
21
21
|
*/
|
|
22
22
|
export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> implements LlmExecutionTools {
|
|
23
|
-
protected readonly options:
|
|
24
|
-
constructor(options:
|
|
23
|
+
protected readonly options: RemoteClientOptions<TCustomOptions>;
|
|
24
|
+
constructor(options: RemoteClientOptions<TCustomOptions>);
|
|
25
25
|
get title(): string_title & string_markdown_text;
|
|
26
26
|
get description(): string_markdown;
|
|
27
27
|
/**
|
|
@@ -32,10 +32,6 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
|
|
|
32
32
|
* List all available models that can be used
|
|
33
33
|
*/
|
|
34
34
|
listModels(): Promise<ReadonlyArray<AvailableModel>>;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a connection to the remote proxy server.
|
|
37
|
-
*/
|
|
38
|
-
private makeConnection;
|
|
39
35
|
/**
|
|
40
36
|
* Calls remote proxy server to use a chat model
|
|
41
37
|
*/
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { SetRequired } from 'type-fest';
|
|
1
2
|
import type { string_formfactor_name } from '../../formfactors/_common/string_formfactor_name';
|
|
2
3
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
4
|
+
import type { NonEmptyReadonlyArray } from '../../types/NonEmptyArray';
|
|
3
5
|
/**
|
|
4
6
|
* @@@
|
|
5
7
|
*
|
|
6
8
|
* @singleton
|
|
7
9
|
* @private internal cache of `getBookTemplate`
|
|
8
10
|
*/
|
|
9
|
-
export declare let pipelines: Array<PipelineJson
|
|
11
|
+
export declare let pipelines: Array<SetRequired<PipelineJson, 'pipelineUrl'>> | null;
|
|
10
12
|
/**
|
|
11
13
|
* Get template for new book
|
|
12
14
|
*
|
|
@@ -14,9 +16,9 @@ export declare let pipelines: Array<PipelineJson> | null;
|
|
|
14
16
|
* @returns list of pipelines
|
|
15
17
|
* @public exported from `@promptbook/templates`
|
|
16
18
|
*/
|
|
17
|
-
export declare function getBookTemplates(formfactorName?: string_formfactor_name):
|
|
19
|
+
export declare function getBookTemplates(formfactorName?: string_formfactor_name): NonEmptyReadonlyArray<SetRequired<PipelineJson, 'pipelineUrl'>>;
|
|
18
20
|
/**
|
|
19
|
-
* TODO: Unit test
|
|
21
|
+
* TODO: Unit test + test that what we guarantee - always return non-empty array is true for e
|
|
20
22
|
* TODO: [🧠] Which is the best place for this function
|
|
21
23
|
* TODO: !!6 For GENERIC template ensure at least one pipeline is present for typescript in `getBookTemplates`
|
|
22
24
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RemoteServerOptions } from '../remote-server/interfaces/RemoteServerOptions';
|
|
2
1
|
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
|
|
3
3
|
/**
|
|
4
4
|
* Prepare pipeline on remote server
|
|
5
5
|
*
|
|
@@ -11,4 +11,7 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
|
11
11
|
*
|
|
12
12
|
* @public exported from `@promptbook/remote-client`
|
|
13
13
|
*/
|
|
14
|
-
export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options:
|
|
14
|
+
export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
|
|
15
|
+
/**
|
|
16
|
+
* TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
|
|
17
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Socket } from 'socket.io-client';
|
|
2
|
+
import type { RemoteClientOptions } from './types/RemoteClientOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a connection to the remote proxy server.
|
|
5
|
+
*
|
|
6
|
+
* Note: This function creates a connection to the remote server and returns a socket but responsibility of closing the connection is on the caller
|
|
7
|
+
*
|
|
8
|
+
* @private internal utility function
|
|
9
|
+
*/
|
|
10
|
+
export declare function createRemoteClient<TCustomOptions = undefined>(options: RemoteClientOptions<TCustomOptions>): Promise<Socket>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ErrorJson } from '
|
|
1
|
+
import type { ErrorJson } from '../../../errors/utils/ErrorJson';
|
|
2
2
|
/**
|
|
3
|
-
* Socket.io error for remote text generation
|
|
4
|
-
*
|
|
5
3
|
* This is sent from server to client when error occurs and stops the process
|
|
4
|
+
*
|
|
5
|
+
* @private internal type of remote server
|
|
6
6
|
*/
|
|
7
7
|
export type PromptbookServer_Error = ErrorJson;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TaskProgress } from '../../../types/TaskProgress';
|
|
2
|
+
/**
|
|
3
|
+
* This is sent from server to client as indication of prograss arbitrarily and may be sent multiple times
|
|
4
|
+
*
|
|
5
|
+
* @private internal type of remote server
|
|
6
|
+
*/
|
|
7
|
+
export type PromptbookServer_Progress = TaskProgress;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: `PromptbookServer_Progress` is unused for now, but it will be used in the future
|
|
10
|
+
*/
|
package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { LlmToolsConfiguration } from '../../../llm-providers/_common/register/LlmToolsConfiguration';
|
|
2
|
+
import type { string_user_id } from '../../../types/typeAliases';
|
|
3
|
+
import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteServerOptions';
|
|
4
|
+
/**
|
|
5
|
+
* Identification of client for Socket.io remote server
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/remote-server`
|
|
8
|
+
* @public exported from `@promptbook/remote-client`
|
|
9
|
+
*/
|
|
10
|
+
export type PromptbookServer_Identification<TCustomOptions> = PromptbookServer_ApplicationIdentification<TCustomOptions> | PromptbookServer_AnonymousIdentification;
|
|
11
|
+
/**
|
|
12
|
+
* Application mode is @@@!!!
|
|
13
|
+
*
|
|
14
|
+
* @public exported from `@promptbook/remote-server`
|
|
15
|
+
* @public exported from `@promptbook/remote-client`
|
|
16
|
+
*/
|
|
17
|
+
export type PromptbookServer_ApplicationIdentification<TCustomOptions> = ApplicationRemoteServerClientOptions<TCustomOptions> & {
|
|
18
|
+
/**
|
|
19
|
+
* Application mode
|
|
20
|
+
*/
|
|
21
|
+
readonly isAnonymous: false;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Anonymous mode is @@@!!!
|
|
25
|
+
*
|
|
26
|
+
* @public exported from `@promptbook/remote-server`
|
|
27
|
+
* @public exported from `@promptbook/remote-client`
|
|
28
|
+
*/
|
|
29
|
+
export type PromptbookServer_AnonymousIdentification = {
|
|
30
|
+
/**
|
|
31
|
+
* Anonymous mode
|
|
32
|
+
*/
|
|
33
|
+
readonly isAnonymous: true;
|
|
34
|
+
/**
|
|
35
|
+
* Identifier of the end user
|
|
36
|
+
*
|
|
37
|
+
* Note: this is passed to the certain model providers to identify misuse
|
|
38
|
+
* Note: In anonymous mode, there is no need to identify yourself, nor does it change the actual configuration of LLM Tools (unlike in application mode)
|
|
39
|
+
*/
|
|
40
|
+
readonly userId?: string_user_id;
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for the LLM tools
|
|
43
|
+
*/
|
|
44
|
+
readonly llmToolsConfiguration: LlmToolsConfiguration;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
48
|
+
* TODO: [🧠][🤺] Maybe allow overriding of `userId` for each prompt - Pass `userId` in `PromptbookServer_ListModels_Request`
|
|
49
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
|
|
2
|
+
/**
|
|
3
|
+
* List models available in the server
|
|
4
|
+
*
|
|
5
|
+
* This is a request from client to server
|
|
6
|
+
*
|
|
7
|
+
* @private internal type of remote server
|
|
8
|
+
*/
|
|
9
|
+
export type PromptbookServer_ListModels_Request<TCustomOptions> = {
|
|
10
|
+
/**
|
|
11
|
+
* Identifier of the end user or application
|
|
12
|
+
*/
|
|
13
|
+
readonly identification: PromptbookServer_Identification<TCustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* TODO: [🧠] Listing models inanonymous mode does not make sence - keeping only to preserve consistency
|
|
17
|
+
*/
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { AvailableModel } from '
|
|
1
|
+
import type { AvailableModel } from '../../../execution/AvailableModel';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Models available for use in the server
|
|
4
4
|
*
|
|
5
5
|
* This is sent from server to client when models are listed
|
|
6
|
+
*
|
|
7
|
+
* @private internal type of remote server
|
|
6
8
|
*/
|
|
7
9
|
export type PromptbookServer_ListModels_Response = {
|
|
8
10
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
|
|
3
|
+
/**
|
|
4
|
+
* This is a request from client to server to prepare a pipeline
|
|
5
|
+
*
|
|
6
|
+
* @private internal type of remote server
|
|
7
|
+
*/
|
|
8
|
+
export type PromptbookServer_PreparePipeline_Request<TCustomOptions> = {
|
|
9
|
+
/**
|
|
10
|
+
* Identifier of the end user or application
|
|
11
|
+
*/
|
|
12
|
+
readonly identification: PromptbookServer_Identification<TCustomOptions>;
|
|
13
|
+
/**
|
|
14
|
+
* The Pipeline to prepare
|
|
15
|
+
*/
|
|
16
|
+
readonly pipeline: PipelineJson;
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* This is sent from server to client when the pipeline is prepared
|
|
4
|
+
*
|
|
5
|
+
* @private internal type of remote server
|
|
6
|
+
*/
|
|
7
|
+
export type PromptbookServer_PreparePipeline_Response = {
|
|
8
|
+
/**
|
|
9
|
+
* Prepared pipeline
|
|
10
|
+
*/
|
|
11
|
+
readonly preparedPipeline: PipelineJson;
|
|
12
|
+
};
|
package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Prompt } from '../../../types/Prompt';
|
|
2
|
+
import type { PromptbookServer_Identification } from '../_subtypes/PromptbookServer_Identification';
|
|
3
|
+
/**
|
|
4
|
+
* This is a request from client to server to execute a prompt
|
|
5
|
+
*
|
|
6
|
+
* @private internal type of remote server
|
|
7
|
+
*/
|
|
8
|
+
export type PromptbookServer_Prompt_Request<TCustomOptions> = {
|
|
9
|
+
/**
|
|
10
|
+
* Identifier of the end user or application
|
|
11
|
+
*/
|
|
12
|
+
readonly identification: PromptbookServer_Identification<TCustomOptions>;
|
|
13
|
+
/**
|
|
14
|
+
* The Prompt to execute
|
|
15
|
+
*/
|
|
16
|
+
readonly prompt: Prompt;
|
|
17
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PromptResult } from '
|
|
1
|
+
import type { PromptResult } from '../../../execution/PromptResult';
|
|
2
2
|
/**
|
|
3
|
-
* Socket.io error for remote text generation
|
|
4
|
-
*
|
|
5
3
|
* This is sent from server to client when the generated text is completed
|
|
4
|
+
*
|
|
5
|
+
* @private internal type of remote server
|
|
6
6
|
*/
|
|
7
7
|
export type PromptbookServer_Prompt_Response = {
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IDestroyable } from 'destroyable';
|
|
2
|
-
import type { RemoteServerOptions } from './
|
|
2
|
+
import type { RemoteServerOptions } from './types/RemoteServerOptions';
|
|
3
3
|
/**
|
|
4
4
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
5
5
|
*
|
|
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
|
|
13
13
|
/**
|
|
14
|
+
* TODO: Split this file into multiple functions - handler for each request
|
|
14
15
|
* TODO: Maybe use `$exportJson`
|
|
15
16
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
16
17
|
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
@@ -19,5 +20,5 @@ export declare function startRemoteServer<TCustomOptions = undefined>(options: R
|
|
|
19
20
|
* TODO: [🗯] Timeout on chat to free up resources
|
|
20
21
|
* TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
|
|
21
22
|
* TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
|
|
22
|
-
* TODO:
|
|
23
|
+
* TODO: Allow to constrain anonymous mode for specific models / providers
|
|
23
24
|
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
2
|
+
import type { string_base_url } from '../../types/typeAliases';
|
|
3
|
+
import type { string_uri } from '../../types/typeAliases';
|
|
4
|
+
import type { PromptbookServer_Identification } from '../socket-types/_subtypes/PromptbookServer_Identification';
|
|
5
|
+
/**
|
|
6
|
+
* Options for `RemoteLlmExecutionTools`
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/remote-client`
|
|
9
|
+
*/
|
|
10
|
+
export type RemoteClientOptions<TCustomOptions> = CommonToolsOptions & {
|
|
11
|
+
/**
|
|
12
|
+
* URL of the remote server
|
|
13
|
+
* On this server will be connected to the socket.io server
|
|
14
|
+
*/
|
|
15
|
+
readonly remoteUrl: string_base_url;
|
|
16
|
+
/**
|
|
17
|
+
* Path for the Socket.io server to listen
|
|
18
|
+
*
|
|
19
|
+
* @default '/socket.io'
|
|
20
|
+
* @example '/promptbook/socket.io'
|
|
21
|
+
*/
|
|
22
|
+
readonly path: string_uri;
|
|
23
|
+
/**
|
|
24
|
+
* Identification of client for Socket.io remote server
|
|
25
|
+
*/
|
|
26
|
+
readonly identification: PromptbookServer_Identification<TCustomOptions>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* TODO: Pass more options from Socket.io to `RemoteClientOptions` (like `transports`)
|
|
30
|
+
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
31
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
32
|
+
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an array that is guaranteed to have at least one element
|
|
3
|
+
*/
|
|
4
|
+
export type NonEmptyArray<TItem> = [TItem, ...TItem[]];
|
|
5
|
+
/**
|
|
6
|
+
* Represents an array that is guaranteed to have at least one element and is readonly
|
|
7
|
+
*/
|
|
8
|
+
export type NonEmptyReadonlyArray<TItem> = ReadonlyArray<TItem> & NonEmptyArray<TItem>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.82.0-
|
|
3
|
+
"version": "0.82.0-3",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,11 +54,16 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.82.0-
|
|
57
|
+
"@promptbook/core": "0.82.0-3"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"colors": "1.4.0",
|
|
61
|
+
"crypto-js": "4.2.0",
|
|
62
|
+
"papaparse": "5.4.1",
|
|
63
|
+
"prettier": "2.8.1",
|
|
61
64
|
"socket.io": "4.8.1",
|
|
62
|
-
"spacetrim": "0.11.59"
|
|
65
|
+
"spacetrim": "0.11.59",
|
|
66
|
+
"userhome": "1.0.1",
|
|
67
|
+
"waitasecond": "1.11.83"
|
|
63
68
|
}
|
|
64
69
|
}
|