@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/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-27';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -74,10 +74,12 @@
|
|
|
74
74
|
owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
|
|
75
75
|
isAnonymousModeAllowed: true,
|
|
76
76
|
urls: [
|
|
77
|
-
'https://s5.ptbk.io/
|
|
77
|
+
'https://promptbook.s5.ptbk.io/',
|
|
78
78
|
// Note: Servers 1-4 are not running
|
|
79
79
|
],
|
|
80
80
|
},
|
|
81
|
+
/*
|
|
82
|
+
Note: Working on older version of Promptbook and not supported anymore
|
|
81
83
|
{
|
|
82
84
|
title: 'Pavol Promptbook Server',
|
|
83
85
|
description: `Personal server of Pavol HejnΓ½ with simple testing server, DO NOT USE IT FOR PRODUCTION`,
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
isAnonymousModeAllowed: true,
|
|
86
88
|
urls: ['https://api.pavolhejny.com/promptbook'],
|
|
87
89
|
},
|
|
90
|
+
*/
|
|
88
91
|
];
|
|
89
92
|
/**
|
|
90
93
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2439,11 +2442,25 @@
|
|
|
2439
2442
|
*/
|
|
2440
2443
|
async function createRemoteClient(options) {
|
|
2441
2444
|
const { remoteServerUrl } = options;
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2445
|
+
if (!isValidUrl(remoteServerUrl)) {
|
|
2446
|
+
throw new Error(`Invalid \`remoteServerUrl\`: "${remoteServerUrl}"`);
|
|
2447
|
+
}
|
|
2448
|
+
const remoteServerUrlParsed = new URL(remoteServerUrl);
|
|
2449
|
+
if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
|
|
2450
|
+
remoteServerUrlParsed.pathname = '/';
|
|
2451
|
+
throw new Error(spaceTrim__default["default"]((block) => `
|
|
2452
|
+
Remote server requires root url \`/\`
|
|
2453
|
+
|
|
2454
|
+
You have provided \`remoteServerUrl\`:
|
|
2455
|
+
${block(remoteServerUrl)}
|
|
2456
|
+
|
|
2457
|
+
But something like this is expected:
|
|
2458
|
+
${block(remoteServerUrlParsed.href)}
|
|
2459
|
+
|
|
2460
|
+
Note: If you need to run multiple services on the same server, use 3rd or 4th degree subdomain
|
|
2461
|
+
|
|
2462
|
+
`));
|
|
2463
|
+
}
|
|
2447
2464
|
return new Promise((resolve, reject) => {
|
|
2448
2465
|
const socket = socket_ioClient.io(remoteServerUrl, {
|
|
2449
2466
|
retries: CONNECTION_RETRIES_LIMIT,
|
|
@@ -13196,8 +13213,7 @@
|
|
|
13196
13213
|
apis: ['./src/remote-server/**/*.ts'], // Adjust path as needed
|
|
13197
13214
|
};
|
|
13198
13215
|
const swaggerSpec = swaggerJsdoc__default["default"](swaggerOptions);
|
|
13199
|
-
|
|
13200
|
-
app.use([`/api-docs`, `${rootPath}/api-docs`], swaggerUi__default["default"].serve, swaggerUi__default["default"].setup(swaggerSpec));
|
|
13216
|
+
app.use(`/api-docs`, swaggerUi__default["default"].serve, swaggerUi__default["default"].setup(swaggerSpec));
|
|
13201
13217
|
const runningExecutionTasks = [];
|
|
13202
13218
|
// <- TODO: [π€¬] Identify the users
|
|
13203
13219
|
// TODO: [π§ ] Do here some garbage collection of finished tasks
|
|
@@ -13211,7 +13227,7 @@
|
|
|
13211
13227
|
* 200:
|
|
13212
13228
|
* description: Server details in markdown format.
|
|
13213
13229
|
*/
|
|
13214
|
-
app.get(
|
|
13230
|
+
app.get('/', async (request, response) => {
|
|
13215
13231
|
var _a;
|
|
13216
13232
|
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.includes('socket.io')) {
|
|
13217
13233
|
return;
|
|
@@ -13230,7 +13246,6 @@
|
|
|
13230
13246
|
## Details
|
|
13231
13247
|
|
|
13232
13248
|
**Server port:** ${port}
|
|
13233
|
-
**Server root path:** ${rootPath}
|
|
13234
13249
|
**Startup date:** ${startupDate.toISOString()}
|
|
13235
13250
|
**Anonymouse mode:** ${isAnonymousModeAllowed ? 'enabled' : 'disabled'}
|
|
13236
13251
|
**Application mode:** ${isApplicationModeAllowed ? 'enabled' : 'disabled'}
|
|
@@ -13300,7 +13315,7 @@
|
|
|
13300
13315
|
* identification:
|
|
13301
13316
|
* type: object
|
|
13302
13317
|
*/
|
|
13303
|
-
app.post(
|
|
13318
|
+
app.post(`/login`, async (request, response) => {
|
|
13304
13319
|
if (!isApplicationModeAllowed || login === null) {
|
|
13305
13320
|
response.status(400).send('Application mode is not allowed');
|
|
13306
13321
|
return;
|
|
@@ -13356,7 +13371,7 @@
|
|
|
13356
13371
|
* items:
|
|
13357
13372
|
* type: string
|
|
13358
13373
|
*/
|
|
13359
|
-
app.get(
|
|
13374
|
+
app.get(`/books`, async (request, response) => {
|
|
13360
13375
|
if (collection === null) {
|
|
13361
13376
|
response.status(500).send('No collection available');
|
|
13362
13377
|
return;
|
|
@@ -13389,7 +13404,7 @@
|
|
|
13389
13404
|
* 404:
|
|
13390
13405
|
* description: Book not found.
|
|
13391
13406
|
*/
|
|
13392
|
-
app.get(
|
|
13407
|
+
app.get(`/books/*`, async (request, response) => {
|
|
13393
13408
|
try {
|
|
13394
13409
|
if (collection === null) {
|
|
13395
13410
|
response.status(500).send('No collection nor books available');
|
|
@@ -13457,10 +13472,10 @@
|
|
|
13457
13472
|
* items:
|
|
13458
13473
|
* type: object
|
|
13459
13474
|
*/
|
|
13460
|
-
app.get(
|
|
13475
|
+
app.get(`/executions`, async (request, response) => {
|
|
13461
13476
|
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
|
|
13462
13477
|
});
|
|
13463
|
-
app.get(
|
|
13478
|
+
app.get(`/executions/last`, async (request, response) => {
|
|
13464
13479
|
// TODO: [π€¬] Filter only for user
|
|
13465
13480
|
if (runningExecutionTasks.length === 0) {
|
|
13466
13481
|
response.status(404).send('No execution tasks found');
|
|
@@ -13469,7 +13484,7 @@
|
|
|
13469
13484
|
const lastExecutionTask = runningExecutionTasks[runningExecutionTasks.length - 1];
|
|
13470
13485
|
response.send(exportExecutionTask(lastExecutionTask, true));
|
|
13471
13486
|
});
|
|
13472
|
-
app.get(
|
|
13487
|
+
app.get(`/executions/:taskId`, async (request, response) => {
|
|
13473
13488
|
const { taskId } = request.params;
|
|
13474
13489
|
// TODO: [π€¬] Filter only for user
|
|
13475
13490
|
const executionTask = runningExecutionTasks.find((executionTask) => executionTask.taskId === taskId);
|
|
@@ -13510,7 +13525,7 @@
|
|
|
13510
13525
|
* 400:
|
|
13511
13526
|
* description: Invalid input.
|
|
13512
13527
|
*/
|
|
13513
|
-
app.post(
|
|
13528
|
+
app.post(`/executions/new`, async (request, response) => {
|
|
13514
13529
|
try {
|
|
13515
13530
|
const { inputParameters, identification /* <- [π€¬] */ } = request.body;
|
|
13516
13531
|
const pipelineUrl = request.body.pipelineUrl || request.body.book;
|