@promptbook/cli 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.
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-29';
49
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-30';
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
@@ -13108,15 +13108,15 @@ function $initializeRunCommand(program) {
13108
13108
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
13109
13109
  */
13110
13110
 
13111
- // TODO: !!! List running services from REMOTE_SERVER_URLS
13112
- // TODO: !!! Import directly from YML
13111
+ // TODO: !!!! List running services from REMOTE_SERVER_URLS
13112
+ // TODO: !!!! Import directly from YML
13113
13113
  /**
13114
13114
  * @private !!!! Decide how to expose this
13115
13115
  */
13116
13116
  const openapiJson = {
13117
13117
  openapi: '3.0.0',
13118
13118
  info: {
13119
- title: 'Promptbook Remote Server API (!!! From TS)',
13119
+ title: 'Promptbook Remote Server API (!!!! From TS)',
13120
13120
  version: '1.0.0',
13121
13121
  description: 'API documentation for the Promptbook Remote Server',
13122
13122
  },
@@ -13374,17 +13374,14 @@ function startRemoteServer(options) {
13374
13374
  response.setHeader('X-Powered-By', 'Promptbook engine');
13375
13375
  next();
13376
13376
  });
13377
- // TODO: !!! Expose openapiJson to consumer and also allow to add new routes
13377
+ // TODO: !!!! Expose openapiJson to consumer and also allow to add new routes
13378
13378
  app.use(OpenApiValidator.middleware({
13379
13379
  apiSpec: openapiJson,
13380
- // TODO: !!! Adjust
13381
- ignorePaths(...args) {
13382
- console.warn(`!!! Ignoring paths`, ...args);
13383
- return true;
13380
+ ignorePaths(path) {
13381
+ return path.startsWith('/api-docs') || path.startsWith('/swagger') || path.startsWith('/openapi');
13384
13382
  },
13385
- // TODO: !!! Validate both
13386
- validateRequests: false,
13387
- validateResponses: false, // false by default
13383
+ validateRequests: true,
13384
+ validateResponses: true,
13388
13385
  }));
13389
13386
  app.use([`/api-docs`, `/swagger`], swaggerUi.serve, swaggerUi.setup(openapiJson, {
13390
13387
  // customCss: '.swagger-ui .topbar { display: none }',
@@ -13394,10 +13391,6 @@ function startRemoteServer(options) {
13394
13391
  app.get(`/openapi`, (request, response) => {
13395
13392
  response.json(openapiJson);
13396
13393
  });
13397
- // TODO: !!! Remove:
13398
- app.get(`/xxx`, (request, response) => {
13399
- response.json(openapiJson);
13400
- });
13401
13394
  const runningExecutionTasks = [];
13402
13395
  // <- TODO: [🤬] Identify the users
13403
13396
  // TODO: [🧠] Do here some garbage collection of finished tasks
@@ -13561,7 +13554,7 @@ function startRemoteServer(options) {
13561
13554
  }
13562
13555
  }
13563
13556
  app.get(`/executions`, async (request, response) => {
13564
- response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
13557
+ response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)) /* <- TODO: satisfies paths['/executions']['get']['responses']['200']['content']['application/json'] */);
13565
13558
  });
13566
13559
  app.get(`/executions/last`, async (request, response) => {
13567
13560
  // TODO: [🤬] Filter only for user
@@ -13587,7 +13580,9 @@ function startRemoteServer(options) {
13587
13580
  app.post(`/executions/new`, async (request, response) => {
13588
13581
  try {
13589
13582
  const { inputParameters, identification /* <- [🤬] */ } = request.body;
13590
- const pipelineUrl = request.body.pipelineUrl || request.body.book;
13583
+ const pipelineUrl = request.body
13584
+ .pipelineUrl /* <- TODO: as paths['/executions/new']['post']['requestBody']['content']['application/json'] */ ||
13585
+ request.body.book;
13591
13586
  // TODO: [🧠] Check `pipelineUrl` and `inputParameters` here or it should be responsibility of `collection.getPipelineByUrl` and `pipelineExecutor`
13592
13587
  const pipeline = await (collection === null || collection === void 0 ? void 0 : collection.getPipelineByUrl(pipelineUrl));
13593
13588
  if (pipeline === undefined) {
@@ -13601,7 +13596,7 @@ function startRemoteServer(options) {
13601
13596
  await forTime(10);
13602
13597
  // <- Note: Wait for a while to wait for quick responses or sudden but asynchronous errors
13603
13598
  // <- TODO: Put this into configuration
13604
- response.send(executionTask);
13599
+ response.send(executionTask /* <- TODO: satisfies paths['/executions/new']['post']['responses']['200']['content']['application/json'] */);
13605
13600
  /*/
13606
13601
  executionTask.asObservable().subscribe({
13607
13602
  next(partialResult) {