@promptbook/remote-server 0.89.0-20 → 0.89.0-21

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
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
33
33
  * @generated
34
34
  * @see https://github.com/webgptorg/promptbook
35
35
  */
36
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-20';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-21';
37
37
  /**
38
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
39
39
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6796,22 +6796,6 @@ function startRemoteServer(options) {
6796
6796
  login: null,
6797
6797
  ...options,
6798
6798
  };
6799
- // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
6800
- let { rootPath = '/' } = options;
6801
- if (!rootPath.startsWith('/')) {
6802
- rootPath = `/${rootPath}`;
6803
- } /* not else */
6804
- if (rootPath.endsWith('/')) {
6805
- rootPath = rootPath.slice(0, -1);
6806
- } /* not else */
6807
- if (rootPath === '/') {
6808
- rootPath = '';
6809
- }
6810
- const socketioPath = '/' +
6811
- `${rootPath}/socket.io`
6812
- .split('/')
6813
- .filter((part) => part !== '')
6814
- .join('/');
6815
6799
  const startupDate = new Date();
6816
6800
  async function getExecutionToolsFromIdentification(identification) {
6817
6801
  if (identification === null || identification === undefined) {
@@ -6876,16 +6860,20 @@ function startRemoteServer(options) {
6876
6860
  version: '1.0.0',
6877
6861
  description: 'API documentation for the Promptbook Remote Server',
6878
6862
  },
6863
+ /*
6864
+ TODO:
6879
6865
  servers: [
6880
6866
  {
6881
6867
  url: `http://localhost:${port}${rootPath}`,
6882
- // <- TODO: !!!!! Probbably: Pass `remoteServerUrl` instead of `port` and `rootPath`
6868
+ // <- TODO: Pass some public URLs here
6883
6869
  },
6884
6870
  ],
6871
+ */
6885
6872
  },
6886
6873
  apis: ['./src/remote-server/**/*.ts'], // Adjust path as needed
6887
6874
  };
6888
6875
  const swaggerSpec = swaggerJsdoc(swaggerOptions);
6876
+ const rootPath = ''; // <- TODO: !!!! Remove after merging into feature/elysia+openai+swagger-2
6889
6877
  app.use([`/api-docs`, `${rootPath}/api-docs`], swaggerUi.serve, swaggerUi.setup(swaggerSpec));
6890
6878
  const runningExecutionTasks = [];
6891
6879
  // <- TODO: [🤬] Identify the users
@@ -6920,7 +6908,6 @@ function startRemoteServer(options) {
6920
6908
 
6921
6909
  **Server port:** ${port}
6922
6910
  **Server root path:** ${rootPath}
6923
- **Socket.io path:** ${socketioPath}
6924
6911
  **Startup date:** ${startupDate.toISOString()}
6925
6912
  **Anonymouse mode:** ${isAnonymousModeAllowed ? 'enabled' : 'disabled'}
6926
6913
  **Application mode:** ${isApplicationModeAllowed ? 'enabled' : 'disabled'}
@@ -7249,11 +7236,12 @@ function startRemoteServer(options) {
7249
7236
  });
7250
7237
  const httpServer = http.createServer(app);
7251
7238
  const server = new Server(httpServer, {
7252
- path: socketioPath,
7253
- transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
7239
+ path: '/socket.io',
7240
+ transports: ['polling', 'websocket' /*, <- TODO: [🌬] Allow to pass `transports`, add 'webtransport' */],
7254
7241
  cors: {
7255
7242
  origin: '*',
7256
7243
  methods: ['GET', 'POST'],
7244
+ // <- TODO: [🌡] Allow to pass
7257
7245
  },
7258
7246
  });
7259
7247
  server.on('connection', (socket) => {
@@ -7398,7 +7386,7 @@ function startRemoteServer(options) {
7398
7386
  };
7399
7387
  }
7400
7388
  /**
7401
- * TODO: !! Add CORS and security - probbably via `helmet`
7389
+ * TODO: [🌡] Add CORS and security - probbably via `helmet`
7402
7390
  * TODO: Split this file into multiple functions - handler for each request
7403
7391
  * TODO: Maybe use `$exportJson`
7404
7392
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`