@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.
@@ -11,7 +11,7 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): RemoteServer;
13
13
  /**
14
- * TODO: !! Add CORS and security - probbably via `helmet`
14
+ * TODO: [🌡] Add CORS and security - probbably via `helmet`
15
15
  * TODO: Split this file into multiple functions - handler for each request
16
16
  * TODO: Maybe use `$exportJson`
17
17
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
@@ -8,7 +8,6 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
8
8
  import type { string_app_id } from '../../types/typeAliases';
9
9
  import type { string_email } from '../../types/typeAliases';
10
10
  import type { string_password } from '../../types/typeAliases';
11
- import type { string_uri } from '../../types/typeAliases';
12
11
  import type { string_user_id } from '../../types/typeAliases';
13
12
  import type { ApplicationModeIdentification } from '../socket-types/_subtypes/Identification';
14
13
  import type { Identification } from '../socket-types/_subtypes/Identification';
@@ -30,15 +29,6 @@ export type RemoteServerOptions<TCustomOptions> = CommonToolsOptions & {
30
29
  * Port on which the server will listen
31
30
  */
32
31
  readonly port: number;
33
- /**
34
- * Root path of the server
35
- *
36
- * Note: This is useful when you reverse proxy the server without changing the path
37
- *
38
- * @default '/'
39
- * @example '/api/promptbook/'
40
- */
41
- readonly rootPath?: string_uri;
42
32
  /**
43
33
  * Creates execution tools the client
44
34
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.89.0-20",
3
+ "version": "0.89.0-21",
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-20"
54
+ "@promptbook/core": "0.89.0-21"
55
55
  },
56
56
  "dependencies": {
57
57
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -30,7 +30,7 @@
30
30
  * @generated
31
31
  * @see https://github.com/webgptorg/promptbook
32
32
  */
33
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-20';
33
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-21';
34
34
  /**
35
35
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
36
36
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6793,22 +6793,6 @@
6793
6793
  login: null,
6794
6794
  ...options,
6795
6795
  };
6796
- // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
6797
- let { rootPath = '/' } = options;
6798
- if (!rootPath.startsWith('/')) {
6799
- rootPath = `/${rootPath}`;
6800
- } /* not else */
6801
- if (rootPath.endsWith('/')) {
6802
- rootPath = rootPath.slice(0, -1);
6803
- } /* not else */
6804
- if (rootPath === '/') {
6805
- rootPath = '';
6806
- }
6807
- const socketioPath = '/' +
6808
- `${rootPath}/socket.io`
6809
- .split('/')
6810
- .filter((part) => part !== '')
6811
- .join('/');
6812
6796
  const startupDate = new Date();
6813
6797
  async function getExecutionToolsFromIdentification(identification) {
6814
6798
  if (identification === null || identification === undefined) {
@@ -6873,16 +6857,20 @@
6873
6857
  version: '1.0.0',
6874
6858
  description: 'API documentation for the Promptbook Remote Server',
6875
6859
  },
6860
+ /*
6861
+ TODO:
6876
6862
  servers: [
6877
6863
  {
6878
6864
  url: `http://localhost:${port}${rootPath}`,
6879
- // <- TODO: !!!!! Probbably: Pass `remoteServerUrl` instead of `port` and `rootPath`
6865
+ // <- TODO: Pass some public URLs here
6880
6866
  },
6881
6867
  ],
6868
+ */
6882
6869
  },
6883
6870
  apis: ['./src/remote-server/**/*.ts'], // Adjust path as needed
6884
6871
  };
6885
6872
  const swaggerSpec = swaggerJsdoc__default["default"](swaggerOptions);
6873
+ const rootPath = ''; // <- TODO: !!!! Remove after merging into feature/elysia+openai+swagger-2
6886
6874
  app.use([`/api-docs`, `${rootPath}/api-docs`], swaggerUi__default["default"].serve, swaggerUi__default["default"].setup(swaggerSpec));
6887
6875
  const runningExecutionTasks = [];
6888
6876
  // <- TODO: [🤬] Identify the users
@@ -6917,7 +6905,6 @@
6917
6905
 
6918
6906
  **Server port:** ${port}
6919
6907
  **Server root path:** ${rootPath}
6920
- **Socket.io path:** ${socketioPath}
6921
6908
  **Startup date:** ${startupDate.toISOString()}
6922
6909
  **Anonymouse mode:** ${isAnonymousModeAllowed ? 'enabled' : 'disabled'}
6923
6910
  **Application mode:** ${isApplicationModeAllowed ? 'enabled' : 'disabled'}
@@ -7246,11 +7233,12 @@
7246
7233
  });
7247
7234
  const httpServer = http__default["default"].createServer(app);
7248
7235
  const server = new socket_io.Server(httpServer, {
7249
- path: socketioPath,
7250
- transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
7236
+ path: '/socket.io',
7237
+ transports: ['polling', 'websocket' /*, <- TODO: [🌬] Allow to pass `transports`, add 'webtransport' */],
7251
7238
  cors: {
7252
7239
  origin: '*',
7253
7240
  methods: ['GET', 'POST'],
7241
+ // <- TODO: [🌡] Allow to pass
7254
7242
  },
7255
7243
  });
7256
7244
  server.on('connection', (socket) => {
@@ -7395,7 +7383,7 @@
7395
7383
  };
7396
7384
  }
7397
7385
  /**
7398
- * TODO: !! Add CORS and security - probbably via `helmet`
7386
+ * TODO: [🌡] Add CORS and security - probbably via `helmet`
7399
7387
  * TODO: Split this file into multiple functions - handler for each request
7400
7388
  * TODO: Maybe use `$exportJson`
7401
7389
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`