@promptbook/remote-server 0.89.0-29 → 0.89.0-30
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.
|
@@ -107,6 +107,11 @@ import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
|
|
|
107
107
|
import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
|
|
108
108
|
import type { PipelineString } from '../pipeline/PipelineString';
|
|
109
109
|
import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
|
|
110
|
+
import type { paths } from '../remote-server/openapi-types';
|
|
111
|
+
import type { webhooks } from '../remote-server/openapi-types';
|
|
112
|
+
import type { components } from '../remote-server/openapi-types';
|
|
113
|
+
import type { $defs } from '../remote-server/openapi-types';
|
|
114
|
+
import type { operations } from '../remote-server/openapi-types';
|
|
110
115
|
import type { RemoteServer } from '../remote-server/RemoteServer';
|
|
111
116
|
import type { Identification } from '../remote-server/socket-types/_subtypes/Identification';
|
|
112
117
|
import type { ApplicationModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
|
|
@@ -397,6 +402,11 @@ export type { SimpleTaskJson };
|
|
|
397
402
|
export type { TaskJson };
|
|
398
403
|
export type { PipelineString };
|
|
399
404
|
export type { PrepareAndScrapeOptions };
|
|
405
|
+
export type { paths };
|
|
406
|
+
export type { webhooks };
|
|
407
|
+
export type { components };
|
|
408
|
+
export type { $defs };
|
|
409
|
+
export type { operations };
|
|
400
410
|
export type { RemoteServer };
|
|
401
411
|
export type { Identification };
|
|
402
412
|
export type { ApplicationModeIdentification };
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
export type paths = {
|
|
6
|
+
readonly "/": {
|
|
7
|
+
readonly parameters: {
|
|
8
|
+
readonly query?: never;
|
|
9
|
+
readonly header?: never;
|
|
10
|
+
readonly path?: never;
|
|
11
|
+
readonly cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Get server details
|
|
15
|
+
* @description Returns details about the Promptbook server.
|
|
16
|
+
*/
|
|
17
|
+
readonly get: {
|
|
18
|
+
readonly parameters: {
|
|
19
|
+
readonly query?: never;
|
|
20
|
+
readonly header?: never;
|
|
21
|
+
readonly path?: never;
|
|
22
|
+
readonly cookie?: never;
|
|
23
|
+
};
|
|
24
|
+
readonly requestBody?: never;
|
|
25
|
+
readonly responses: {
|
|
26
|
+
/** @description Server details in markdown format. */
|
|
27
|
+
readonly 200: {
|
|
28
|
+
headers: {
|
|
29
|
+
readonly [name: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
content?: never;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
readonly put?: never;
|
|
36
|
+
readonly post?: never;
|
|
37
|
+
readonly delete?: never;
|
|
38
|
+
readonly options?: never;
|
|
39
|
+
readonly head?: never;
|
|
40
|
+
readonly patch?: never;
|
|
41
|
+
readonly trace?: never;
|
|
42
|
+
};
|
|
43
|
+
readonly "/login": {
|
|
44
|
+
readonly parameters: {
|
|
45
|
+
readonly query?: never;
|
|
46
|
+
readonly header?: never;
|
|
47
|
+
readonly path?: never;
|
|
48
|
+
readonly cookie?: never;
|
|
49
|
+
};
|
|
50
|
+
readonly get?: never;
|
|
51
|
+
readonly put?: never;
|
|
52
|
+
/**
|
|
53
|
+
* Login to the server
|
|
54
|
+
* @description Login to the server and get identification.
|
|
55
|
+
*/
|
|
56
|
+
readonly post: {
|
|
57
|
+
readonly parameters: {
|
|
58
|
+
readonly query?: never;
|
|
59
|
+
readonly header?: never;
|
|
60
|
+
readonly path?: never;
|
|
61
|
+
readonly cookie?: never;
|
|
62
|
+
};
|
|
63
|
+
readonly requestBody: {
|
|
64
|
+
readonly content: {
|
|
65
|
+
readonly "application/json": {
|
|
66
|
+
readonly username?: string;
|
|
67
|
+
readonly password?: string;
|
|
68
|
+
readonly appId?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
readonly responses: {
|
|
73
|
+
/** @description Successful login */
|
|
74
|
+
readonly 200: {
|
|
75
|
+
headers: {
|
|
76
|
+
readonly [name: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
content: {
|
|
79
|
+
readonly "application/json": {
|
|
80
|
+
readonly identification?: Record<string, never>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
readonly delete?: never;
|
|
87
|
+
readonly options?: never;
|
|
88
|
+
readonly head?: never;
|
|
89
|
+
readonly patch?: never;
|
|
90
|
+
readonly trace?: never;
|
|
91
|
+
};
|
|
92
|
+
readonly "/books": {
|
|
93
|
+
readonly parameters: {
|
|
94
|
+
readonly query?: never;
|
|
95
|
+
readonly header?: never;
|
|
96
|
+
readonly path?: never;
|
|
97
|
+
readonly cookie?: never;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* List all books
|
|
101
|
+
* @description Returns a list of all available books in the collection.
|
|
102
|
+
*/
|
|
103
|
+
readonly get: {
|
|
104
|
+
readonly parameters: {
|
|
105
|
+
readonly query?: never;
|
|
106
|
+
readonly header?: never;
|
|
107
|
+
readonly path?: never;
|
|
108
|
+
readonly cookie?: never;
|
|
109
|
+
};
|
|
110
|
+
readonly requestBody?: never;
|
|
111
|
+
readonly responses: {
|
|
112
|
+
/** @description A list of books. */
|
|
113
|
+
readonly 200: {
|
|
114
|
+
headers: {
|
|
115
|
+
readonly [name: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
content: {
|
|
118
|
+
readonly "application/json": readonly string[];
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
readonly put?: never;
|
|
124
|
+
readonly post?: never;
|
|
125
|
+
readonly delete?: never;
|
|
126
|
+
readonly options?: never;
|
|
127
|
+
readonly head?: never;
|
|
128
|
+
readonly patch?: never;
|
|
129
|
+
readonly trace?: never;
|
|
130
|
+
};
|
|
131
|
+
readonly [path: `/books/${string}`]: {
|
|
132
|
+
readonly parameters: {
|
|
133
|
+
readonly query?: never;
|
|
134
|
+
readonly header?: never;
|
|
135
|
+
readonly path?: never;
|
|
136
|
+
readonly cookie?: never;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Get book content
|
|
140
|
+
* @description Returns the content of a specific book.
|
|
141
|
+
*/
|
|
142
|
+
readonly get: {
|
|
143
|
+
readonly parameters: {
|
|
144
|
+
readonly query?: never;
|
|
145
|
+
readonly header?: never;
|
|
146
|
+
readonly path: {
|
|
147
|
+
/** @description The ID of the book to retrieve. */
|
|
148
|
+
readonly bookId: string;
|
|
149
|
+
};
|
|
150
|
+
readonly cookie?: never;
|
|
151
|
+
};
|
|
152
|
+
readonly requestBody?: never;
|
|
153
|
+
readonly responses: {
|
|
154
|
+
/** @description The content of the book. */
|
|
155
|
+
readonly 200: {
|
|
156
|
+
headers: {
|
|
157
|
+
readonly [name: string]: unknown;
|
|
158
|
+
};
|
|
159
|
+
content: {
|
|
160
|
+
readonly "text/markdown": string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/** @description Book not found. */
|
|
164
|
+
readonly 404: {
|
|
165
|
+
headers: {
|
|
166
|
+
readonly [name: string]: unknown;
|
|
167
|
+
};
|
|
168
|
+
content?: never;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
readonly put?: never;
|
|
173
|
+
readonly post?: never;
|
|
174
|
+
readonly delete?: never;
|
|
175
|
+
readonly options?: never;
|
|
176
|
+
readonly head?: never;
|
|
177
|
+
readonly patch?: never;
|
|
178
|
+
readonly trace?: never;
|
|
179
|
+
};
|
|
180
|
+
readonly "/executions": {
|
|
181
|
+
readonly parameters: {
|
|
182
|
+
readonly query?: never;
|
|
183
|
+
readonly header?: never;
|
|
184
|
+
readonly path?: never;
|
|
185
|
+
readonly cookie?: never;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* List all executions
|
|
189
|
+
* @description Returns a list of all running execution tasks.
|
|
190
|
+
*/
|
|
191
|
+
readonly get: {
|
|
192
|
+
readonly parameters: {
|
|
193
|
+
readonly query?: never;
|
|
194
|
+
readonly header?: never;
|
|
195
|
+
readonly path?: never;
|
|
196
|
+
readonly cookie?: never;
|
|
197
|
+
};
|
|
198
|
+
readonly requestBody?: never;
|
|
199
|
+
readonly responses: {
|
|
200
|
+
/** @description A list of execution tasks. */
|
|
201
|
+
readonly 200: {
|
|
202
|
+
headers: {
|
|
203
|
+
readonly [name: string]: unknown;
|
|
204
|
+
};
|
|
205
|
+
content: {
|
|
206
|
+
readonly "application/json": readonly Record<string, never>[];
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
readonly put?: never;
|
|
212
|
+
readonly post?: never;
|
|
213
|
+
readonly delete?: never;
|
|
214
|
+
readonly options?: never;
|
|
215
|
+
readonly head?: never;
|
|
216
|
+
readonly patch?: never;
|
|
217
|
+
readonly trace?: never;
|
|
218
|
+
};
|
|
219
|
+
readonly "/executions/new": {
|
|
220
|
+
readonly parameters: {
|
|
221
|
+
readonly query?: never;
|
|
222
|
+
readonly header?: never;
|
|
223
|
+
readonly path?: never;
|
|
224
|
+
readonly cookie?: never;
|
|
225
|
+
};
|
|
226
|
+
readonly get?: never;
|
|
227
|
+
readonly put?: never;
|
|
228
|
+
/**
|
|
229
|
+
* Start a new execution
|
|
230
|
+
* @description Starts a new execution task for a given pipeline.
|
|
231
|
+
*/
|
|
232
|
+
readonly post: {
|
|
233
|
+
readonly parameters: {
|
|
234
|
+
readonly query?: never;
|
|
235
|
+
readonly header?: never;
|
|
236
|
+
readonly path?: never;
|
|
237
|
+
readonly cookie?: never;
|
|
238
|
+
};
|
|
239
|
+
readonly requestBody: {
|
|
240
|
+
readonly content: {
|
|
241
|
+
readonly "application/json": {
|
|
242
|
+
readonly pipelineUrl?: string;
|
|
243
|
+
readonly inputParameters?: Record<string, never>;
|
|
244
|
+
readonly identification?: Record<string, never>;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
readonly responses: {
|
|
249
|
+
/** @description The newly created execution task. */
|
|
250
|
+
readonly 200: {
|
|
251
|
+
headers: {
|
|
252
|
+
readonly [name: string]: unknown;
|
|
253
|
+
};
|
|
254
|
+
content: {
|
|
255
|
+
readonly "application/json": Record<string, never>;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
/** @description Invalid input. */
|
|
259
|
+
readonly 400: {
|
|
260
|
+
headers: {
|
|
261
|
+
readonly [name: string]: unknown;
|
|
262
|
+
};
|
|
263
|
+
content?: never;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly delete?: never;
|
|
268
|
+
readonly options?: never;
|
|
269
|
+
readonly head?: never;
|
|
270
|
+
readonly patch?: never;
|
|
271
|
+
readonly trace?: never;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
export type webhooks = Record<string, never>;
|
|
275
|
+
export type components = {
|
|
276
|
+
schemas: never;
|
|
277
|
+
responses: never;
|
|
278
|
+
parameters: never;
|
|
279
|
+
requestBodies: never;
|
|
280
|
+
headers: never;
|
|
281
|
+
pathItems: never;
|
|
282
|
+
};
|
|
283
|
+
export type $defs = Record<string, never>;
|
|
284
|
+
export type operations = Record<string, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.89.0-
|
|
3
|
+
"version": "0.89.0-30",
|
|
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,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.89.0-
|
|
54
|
+
"@promptbook/core": "0.89.0-30"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @generated
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-30';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6793,15 +6793,15 @@
|
|
|
6793
6793
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
6794
6794
|
*/
|
|
6795
6795
|
|
|
6796
|
-
// TODO:
|
|
6797
|
-
// TODO:
|
|
6796
|
+
// TODO: !!!! List running services from REMOTE_SERVER_URLS
|
|
6797
|
+
// TODO: !!!! Import directly from YML
|
|
6798
6798
|
/**
|
|
6799
6799
|
* @private !!!! Decide how to expose this
|
|
6800
6800
|
*/
|
|
6801
6801
|
const openapiJson = {
|
|
6802
6802
|
openapi: '3.0.0',
|
|
6803
6803
|
info: {
|
|
6804
|
-
title: 'Promptbook Remote Server API (
|
|
6804
|
+
title: 'Promptbook Remote Server API (!!!! From TS)',
|
|
6805
6805
|
version: '1.0.0',
|
|
6806
6806
|
description: 'API documentation for the Promptbook Remote Server',
|
|
6807
6807
|
},
|
|
@@ -7059,17 +7059,14 @@
|
|
|
7059
7059
|
response.setHeader('X-Powered-By', 'Promptbook engine');
|
|
7060
7060
|
next();
|
|
7061
7061
|
});
|
|
7062
|
-
// TODO:
|
|
7062
|
+
// TODO: !!!! Expose openapiJson to consumer and also allow to add new routes
|
|
7063
7063
|
app.use(OpenApiValidator__namespace.middleware({
|
|
7064
7064
|
apiSpec: openapiJson,
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
console.warn(`!!! Ignoring paths`, ...args);
|
|
7068
|
-
return true;
|
|
7065
|
+
ignorePaths(path) {
|
|
7066
|
+
return path.startsWith('/api-docs') || path.startsWith('/swagger') || path.startsWith('/openapi');
|
|
7069
7067
|
},
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
validateResponses: false, // false by default
|
|
7068
|
+
validateRequests: true,
|
|
7069
|
+
validateResponses: true,
|
|
7073
7070
|
}));
|
|
7074
7071
|
app.use([`/api-docs`, `/swagger`], swaggerUi__default["default"].serve, swaggerUi__default["default"].setup(openapiJson, {
|
|
7075
7072
|
// customCss: '.swagger-ui .topbar { display: none }',
|
|
@@ -7079,10 +7076,6 @@
|
|
|
7079
7076
|
app.get(`/openapi`, (request, response) => {
|
|
7080
7077
|
response.json(openapiJson);
|
|
7081
7078
|
});
|
|
7082
|
-
// TODO: !!! Remove:
|
|
7083
|
-
app.get(`/xxx`, (request, response) => {
|
|
7084
|
-
response.json(openapiJson);
|
|
7085
|
-
});
|
|
7086
7079
|
const runningExecutionTasks = [];
|
|
7087
7080
|
// <- TODO: [🤬] Identify the users
|
|
7088
7081
|
// TODO: [🧠] Do here some garbage collection of finished tasks
|
|
@@ -7246,7 +7239,7 @@
|
|
|
7246
7239
|
}
|
|
7247
7240
|
}
|
|
7248
7241
|
app.get(`/executions`, async (request, response) => {
|
|
7249
|
-
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
|
|
7242
|
+
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)) /* <- TODO: satisfies paths['/executions']['get']['responses']['200']['content']['application/json'] */);
|
|
7250
7243
|
});
|
|
7251
7244
|
app.get(`/executions/last`, async (request, response) => {
|
|
7252
7245
|
// TODO: [🤬] Filter only for user
|
|
@@ -7272,7 +7265,9 @@
|
|
|
7272
7265
|
app.post(`/executions/new`, async (request, response) => {
|
|
7273
7266
|
try {
|
|
7274
7267
|
const { inputParameters, identification /* <- [🤬] */ } = request.body;
|
|
7275
|
-
const pipelineUrl = request.body
|
|
7268
|
+
const pipelineUrl = request.body
|
|
7269
|
+
.pipelineUrl /* <- TODO: as paths['/executions/new']['post']['requestBody']['content']['application/json'] */ ||
|
|
7270
|
+
request.body.book;
|
|
7276
7271
|
// TODO: [🧠] Check `pipelineUrl` and `inputParameters` here or it should be responsibility of `collection.getPipelineByUrl` and `pipelineExecutor`
|
|
7277
7272
|
const pipeline = await (collection === null || collection === void 0 ? void 0 : collection.getPipelineByUrl(pipelineUrl));
|
|
7278
7273
|
if (pipeline === undefined) {
|
|
@@ -7286,7 +7281,7 @@
|
|
|
7286
7281
|
await waitasecond.forTime(10);
|
|
7287
7282
|
// <- Note: Wait for a while to wait for quick responses or sudden but asynchronous errors
|
|
7288
7283
|
// <- TODO: Put this into configuration
|
|
7289
|
-
response.send(executionTask);
|
|
7284
|
+
response.send(executionTask /* <- TODO: satisfies paths['/executions/new']['post']['responses']['200']['content']['application/json'] */);
|
|
7290
7285
|
/*/
|
|
7291
7286
|
executionTask.asObservable().subscribe({
|
|
7292
7287
|
next(partialResult) {
|