@promptbook/cli 0.89.0-21 β 0.89.0-27
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 +33 -18
- package/esm/index.es.js.map +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +33 -18
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -46,7 +46,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
46
46
|
* @generated
|
|
47
47
|
* @see https://github.com/webgptorg/promptbook
|
|
48
48
|
*/
|
|
49
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
49
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-27';
|
|
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
|
|
@@ -64,10 +64,12 @@ const REMOTE_SERVER_URLS = [
|
|
|
64
64
|
owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
|
|
65
65
|
isAnonymousModeAllowed: true,
|
|
66
66
|
urls: [
|
|
67
|
-
'https://s5.ptbk.io/
|
|
67
|
+
'https://promptbook.s5.ptbk.io/',
|
|
68
68
|
// Note: Servers 1-4 are not running
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
|
+
/*
|
|
72
|
+
Note: Working on older version of Promptbook and not supported anymore
|
|
71
73
|
{
|
|
72
74
|
title: 'Pavol Promptbook Server',
|
|
73
75
|
description: `Personal server of Pavol HejnΓ½ with simple testing server, DO NOT USE IT FOR PRODUCTION`,
|
|
@@ -75,6 +77,7 @@ const REMOTE_SERVER_URLS = [
|
|
|
75
77
|
isAnonymousModeAllowed: true,
|
|
76
78
|
urls: ['https://api.pavolhejny.com/promptbook'],
|
|
77
79
|
},
|
|
80
|
+
*/
|
|
78
81
|
];
|
|
79
82
|
/**
|
|
80
83
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2429,11 +2432,25 @@ function deserializeError(error) {
|
|
|
2429
2432
|
*/
|
|
2430
2433
|
async function createRemoteClient(options) {
|
|
2431
2434
|
const { remoteServerUrl } = options;
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2435
|
+
if (!isValidUrl(remoteServerUrl)) {
|
|
2436
|
+
throw new Error(`Invalid \`remoteServerUrl\`: "${remoteServerUrl}"`);
|
|
2437
|
+
}
|
|
2438
|
+
const remoteServerUrlParsed = new URL(remoteServerUrl);
|
|
2439
|
+
if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
|
|
2440
|
+
remoteServerUrlParsed.pathname = '/';
|
|
2441
|
+
throw new Error(spaceTrim((block) => `
|
|
2442
|
+
Remote server requires root url \`/\`
|
|
2443
|
+
|
|
2444
|
+
You have provided \`remoteServerUrl\`:
|
|
2445
|
+
${block(remoteServerUrl)}
|
|
2446
|
+
|
|
2447
|
+
But something like this is expected:
|
|
2448
|
+
${block(remoteServerUrlParsed.href)}
|
|
2449
|
+
|
|
2450
|
+
Note: If you need to run multiple services on the same server, use 3rd or 4th degree subdomain
|
|
2451
|
+
|
|
2452
|
+
`));
|
|
2453
|
+
}
|
|
2437
2454
|
return new Promise((resolve, reject) => {
|
|
2438
2455
|
const socket = io(remoteServerUrl, {
|
|
2439
2456
|
retries: CONNECTION_RETRIES_LIMIT,
|
|
@@ -13186,8 +13203,7 @@ function startRemoteServer(options) {
|
|
|
13186
13203
|
apis: ['./src/remote-server/**/*.ts'], // Adjust path as needed
|
|
13187
13204
|
};
|
|
13188
13205
|
const swaggerSpec = swaggerJsdoc(swaggerOptions);
|
|
13189
|
-
|
|
13190
|
-
app.use([`/api-docs`, `${rootPath}/api-docs`], swaggerUi.serve, swaggerUi.setup(swaggerSpec));
|
|
13206
|
+
app.use(`/api-docs`, swaggerUi.serve, swaggerUi.setup(swaggerSpec));
|
|
13191
13207
|
const runningExecutionTasks = [];
|
|
13192
13208
|
// <- TODO: [π€¬] Identify the users
|
|
13193
13209
|
// TODO: [π§ ] Do here some garbage collection of finished tasks
|
|
@@ -13201,7 +13217,7 @@ function startRemoteServer(options) {
|
|
|
13201
13217
|
* 200:
|
|
13202
13218
|
* description: Server details in markdown format.
|
|
13203
13219
|
*/
|
|
13204
|
-
app.get(
|
|
13220
|
+
app.get('/', async (request, response) => {
|
|
13205
13221
|
var _a;
|
|
13206
13222
|
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.includes('socket.io')) {
|
|
13207
13223
|
return;
|
|
@@ -13220,7 +13236,6 @@ function startRemoteServer(options) {
|
|
|
13220
13236
|
## Details
|
|
13221
13237
|
|
|
13222
13238
|
**Server port:** ${port}
|
|
13223
|
-
**Server root path:** ${rootPath}
|
|
13224
13239
|
**Startup date:** ${startupDate.toISOString()}
|
|
13225
13240
|
**Anonymouse mode:** ${isAnonymousModeAllowed ? 'enabled' : 'disabled'}
|
|
13226
13241
|
**Application mode:** ${isApplicationModeAllowed ? 'enabled' : 'disabled'}
|
|
@@ -13290,7 +13305,7 @@ function startRemoteServer(options) {
|
|
|
13290
13305
|
* identification:
|
|
13291
13306
|
* type: object
|
|
13292
13307
|
*/
|
|
13293
|
-
app.post(
|
|
13308
|
+
app.post(`/login`, async (request, response) => {
|
|
13294
13309
|
if (!isApplicationModeAllowed || login === null) {
|
|
13295
13310
|
response.status(400).send('Application mode is not allowed');
|
|
13296
13311
|
return;
|
|
@@ -13346,7 +13361,7 @@ function startRemoteServer(options) {
|
|
|
13346
13361
|
* items:
|
|
13347
13362
|
* type: string
|
|
13348
13363
|
*/
|
|
13349
|
-
app.get(
|
|
13364
|
+
app.get(`/books`, async (request, response) => {
|
|
13350
13365
|
if (collection === null) {
|
|
13351
13366
|
response.status(500).send('No collection available');
|
|
13352
13367
|
return;
|
|
@@ -13379,7 +13394,7 @@ function startRemoteServer(options) {
|
|
|
13379
13394
|
* 404:
|
|
13380
13395
|
* description: Book not found.
|
|
13381
13396
|
*/
|
|
13382
|
-
app.get(
|
|
13397
|
+
app.get(`/books/*`, async (request, response) => {
|
|
13383
13398
|
try {
|
|
13384
13399
|
if (collection === null) {
|
|
13385
13400
|
response.status(500).send('No collection nor books available');
|
|
@@ -13447,10 +13462,10 @@ function startRemoteServer(options) {
|
|
|
13447
13462
|
* items:
|
|
13448
13463
|
* type: object
|
|
13449
13464
|
*/
|
|
13450
|
-
app.get(
|
|
13465
|
+
app.get(`/executions`, async (request, response) => {
|
|
13451
13466
|
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
|
|
13452
13467
|
});
|
|
13453
|
-
app.get(
|
|
13468
|
+
app.get(`/executions/last`, async (request, response) => {
|
|
13454
13469
|
// TODO: [π€¬] Filter only for user
|
|
13455
13470
|
if (runningExecutionTasks.length === 0) {
|
|
13456
13471
|
response.status(404).send('No execution tasks found');
|
|
@@ -13459,7 +13474,7 @@ function startRemoteServer(options) {
|
|
|
13459
13474
|
const lastExecutionTask = runningExecutionTasks[runningExecutionTasks.length - 1];
|
|
13460
13475
|
response.send(exportExecutionTask(lastExecutionTask, true));
|
|
13461
13476
|
});
|
|
13462
|
-
app.get(
|
|
13477
|
+
app.get(`/executions/:taskId`, async (request, response) => {
|
|
13463
13478
|
const { taskId } = request.params;
|
|
13464
13479
|
// TODO: [π€¬] Filter only for user
|
|
13465
13480
|
const executionTask = runningExecutionTasks.find((executionTask) => executionTask.taskId === taskId);
|
|
@@ -13500,7 +13515,7 @@ function startRemoteServer(options) {
|
|
|
13500
13515
|
* 400:
|
|
13501
13516
|
* description: Invalid input.
|
|
13502
13517
|
*/
|
|
13503
|
-
app.post(
|
|
13518
|
+
app.post(`/executions/new`, async (request, response) => {
|
|
13504
13519
|
try {
|
|
13505
13520
|
const { inputParameters, identification /* <- [π€¬] */ } = request.body;
|
|
13506
13521
|
const pipelineUrl = request.body.pipelineUrl || request.body.book;
|