@promptbook/remote-server 0.102.0-1 → 0.102.0-2
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 +42 -45
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.delete.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +11 -0
- package/esm/typings/src/book-components/icons/CloseIcon.d.ts +11 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +13 -0
- package/esm/typings/src/remote-server/ui/renderServerIndexHtml.d.ts +7 -0
- package/esm/typings/src/remote-server/ui/types.d.ts +16 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -2
- package/umd/index.umd.js +44 -49
- package/umd/index.umd.js.map +1 -1
|
@@ -41,6 +41,8 @@ import { parseMessageButtons } from '../book-components/Chat/utils/parseMessageB
|
|
|
41
41
|
import { renderMarkdown } from '../book-components/Chat/utils/renderMarkdown';
|
|
42
42
|
import { isMarkdownContent } from '../book-components/Chat/utils/renderMarkdown';
|
|
43
43
|
import { ArrowIcon } from '../book-components/icons/ArrowIcon';
|
|
44
|
+
import { AttachmentIcon } from '../book-components/icons/AttachmentIcon';
|
|
45
|
+
import { CloseIcon } from '../book-components/icons/CloseIcon';
|
|
44
46
|
import { PauseIcon } from '../book-components/icons/PauseIcon';
|
|
45
47
|
import { PlayIcon } from '../book-components/icons/PlayIcon';
|
|
46
48
|
import { ResetIcon } from '../book-components/icons/ResetIcon';
|
|
@@ -89,6 +91,8 @@ export { parseMessageButtons };
|
|
|
89
91
|
export { renderMarkdown };
|
|
90
92
|
export { isMarkdownContent };
|
|
91
93
|
export { ArrowIcon };
|
|
94
|
+
export { AttachmentIcon };
|
|
95
|
+
export { CloseIcon };
|
|
92
96
|
export { PauseIcon };
|
|
93
97
|
export { PlayIcon };
|
|
94
98
|
export { ResetIcon };
|
|
@@ -154,6 +154,7 @@ import type { ApplicationRemoteServerOptions } from '../remote-server/types/Remo
|
|
|
154
154
|
import type { ApplicationRemoteServerClientOptions } from '../remote-server/types/RemoteServerOptions';
|
|
155
155
|
import type { LoginRequest } from '../remote-server/types/RemoteServerOptions';
|
|
156
156
|
import type { LoginResponse } from '../remote-server/types/RemoteServerOptions';
|
|
157
|
+
import type { ServerInfo } from '../remote-server/ui/types';
|
|
157
158
|
import type { Converter } from '../scrapers/_common/Converter';
|
|
158
159
|
import type { ScraperAndConverterMetadata } from '../scrapers/_common/register/ScraperAndConverterMetadata';
|
|
159
160
|
import type { ScraperConstructor } from '../scrapers/_common/register/ScraperConstructor';
|
|
@@ -485,6 +486,7 @@ export type { ApplicationRemoteServerOptions };
|
|
|
485
486
|
export type { ApplicationRemoteServerClientOptions };
|
|
486
487
|
export type { LoginRequest };
|
|
487
488
|
export type { LoginResponse };
|
|
489
|
+
export type { ServerInfo };
|
|
488
490
|
export type { Converter };
|
|
489
491
|
export type { ScraperAndConverterMetadata };
|
|
490
492
|
export type { ScraperConstructor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -145,7 +145,16 @@ export type ChatProps = {
|
|
|
145
145
|
expectedAnswer: string | null;
|
|
146
146
|
url: string;
|
|
147
147
|
}): Promisable<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Optional callback for handling file uploads
|
|
150
|
+
* When provided, enables file upload functionality via drag-and-drop and file button
|
|
151
|
+
* The callback should process the file and return text content to be inserted into the message
|
|
152
|
+
*
|
|
153
|
+
* @param file - The uploaded file
|
|
154
|
+
* @returns Promise or string with the text content to insert into the chat message
|
|
155
|
+
*/
|
|
156
|
+
onFileUpload?(file: File): Promisable<string>;
|
|
148
157
|
};
|
|
149
158
|
/**
|
|
150
159
|
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
|
151
|
-
*/
|
|
160
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type AttachmentIconProps = {
|
|
2
|
+
size?: number;
|
|
3
|
+
color?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @@@
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/components`
|
|
9
|
+
*/
|
|
10
|
+
export declare function AttachmentIcon({ size, color }: AttachmentIconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type CloseIconProps = {
|
|
2
|
+
size?: number;
|
|
3
|
+
color?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @@@
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/components`
|
|
9
|
+
*/
|
|
10
|
+
export declare function CloseIcon({ size, color }: CloseIconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServerInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of Remote Server
|
|
6
|
+
*/
|
|
7
|
+
export declare function HtmlDoc({ info }: {
|
|
8
|
+
info: ServerInfo;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Add Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12
|
+
* <- TODO: !!! Maybe split into multiple files
|
|
13
|
+
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ServerInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Render full HTML for the server index using React SSR without requiring TSX/JSX compiler flags.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of Remote Server
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderServerIndexHtml(info: ServerInfo): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ServerInfo = {
|
|
2
|
+
bookLanguageVersion: string;
|
|
3
|
+
promptbookEngineVersion: string;
|
|
4
|
+
nodeVersion: string;
|
|
5
|
+
port: number | string | undefined;
|
|
6
|
+
startupDate: string;
|
|
7
|
+
isAnonymousModeAllowed: boolean;
|
|
8
|
+
isApplicationModeAllowed: boolean;
|
|
9
|
+
pipelines: ReadonlyArray<string>;
|
|
10
|
+
runningExecutions: number;
|
|
11
|
+
paths: ReadonlyArray<string>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Add Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15
|
+
* <- TODO: !!! Maybe split into multiple files
|
|
16
|
+
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.102.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.102.0-1`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.102.0-
|
|
3
|
+
"version": "0.102.0-2",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.102.0-
|
|
98
|
+
"@promptbook/core": "0.102.0-2"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"colors": "1.4.0",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"express": "4.21.2",
|
|
105
105
|
"express-openapi-validator": "^5.4.9",
|
|
106
106
|
"papaparse": "5.4.1",
|
|
107
|
+
"react": "18.2.0",
|
|
107
108
|
"rxjs": "7.8.1",
|
|
108
109
|
"socket.io": "4.8.1",
|
|
109
110
|
"spacetrim": "0.11.59",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('spacetrim'), require('swagger-ui-express'), require('waitasecond'), require('crypto'), require('child_process'), require('fs/promises'), require('path'), require('rxjs'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'express', 'express-openapi-validator', 'http', 'socket.io', 'spacetrim', 'swagger-ui-express', 'waitasecond', 'crypto', 'child_process', 'fs/promises', 'path', 'rxjs', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.colors, global.express, global.OpenApiValidator, global.http, global.socket_io, global.spaceTrim, global.swaggerUi, global.waitasecond, global.crypto, global.child_process, global.promises, global.path, global.rxjs, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, colors, express, OpenApiValidator, http, socket_io, spaceTrim, swaggerUi, waitasecond, crypto, child_process, promises, path, rxjs, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('spacetrim'), require('swagger-ui-express'), require('waitasecond'), require('crypto'), require('child_process'), require('fs/promises'), require('path'), require('rxjs'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse'), require('react'), require('react-dom/server')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'express', 'express-openapi-validator', 'http', 'socket.io', 'spacetrim', 'swagger-ui-express', 'waitasecond', 'crypto', 'child_process', 'fs/promises', 'path', 'rxjs', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse', 'react', 'react-dom/server'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.colors, global.express, global.OpenApiValidator, global.http, global.socket_io, global.spaceTrim, global.swaggerUi, global.waitasecond, global.crypto, global.child_process, global.promises, global.path, global.rxjs, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse, global.react, global.server));
|
|
5
|
+
})(this, (function (exports, colors, express, OpenApiValidator, http, socket_io, spaceTrim, swaggerUi, waitasecond, crypto, child_process, promises, path, rxjs, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse, react, server) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.102.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.102.0-2';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -8106,6 +8106,44 @@
|
|
|
8106
8106
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8107
8107
|
*/
|
|
8108
8108
|
|
|
8109
|
+
const h = react.createElement;
|
|
8110
|
+
function KeyVal(props) {
|
|
8111
|
+
return h('div', { className: 'flex items-start gap-2' }, h('div', { className: 'font-semibold min-w-[14rem]' }, props.label), h('div', { className: 'text-gray-800' }, props.value));
|
|
8112
|
+
}
|
|
8113
|
+
function List(props) {
|
|
8114
|
+
var _a;
|
|
8115
|
+
if (!((_a = props.items) === null || _a === void 0 ? void 0 : _a.length))
|
|
8116
|
+
return h('span', { className: 'text-gray-500' }, 'none');
|
|
8117
|
+
return h('ul', { className: 'list-disc ml-6' }, ...props.items.map((item, i) => h('li', { key: String(i), className: 'break-all' }, item)));
|
|
8118
|
+
}
|
|
8119
|
+
function Section(props) {
|
|
8120
|
+
return h('section', { className: 'mt-8' }, h('h2', { className: 'text-xl font-semibold mb-2' }, props.title), props.children);
|
|
8121
|
+
}
|
|
8122
|
+
function ServerBody({ info }) {
|
|
8123
|
+
var _a;
|
|
8124
|
+
return h('div', { className: 'max-w-4xl mx-auto p-6' }, h('h1', { className: 'text-3xl font-bold mb-4' }, 'Promptbook Server'), h('div', { className: 'space-y-2' }, h(KeyVal, { label: 'Book language version:', value: info.bookLanguageVersion }), h(KeyVal, { label: 'Promptbook engine version:', value: info.promptbookEngineVersion }), h(KeyVal, { label: 'Node.js version:', value: info.nodeVersion }), h(KeyVal, { label: 'Server port:', value: String((_a = info.port) !== null && _a !== void 0 ? _a : '') }), h(KeyVal, { label: 'Startup date:', value: info.startupDate }), h(KeyVal, {
|
|
8125
|
+
label: 'Anonymous mode:',
|
|
8126
|
+
value: info.isAnonymousModeAllowed ? 'enabled' : 'disabled',
|
|
8127
|
+
}), h(KeyVal, {
|
|
8128
|
+
label: 'Application mode:',
|
|
8129
|
+
value: info.isApplicationModeAllowed ? 'enabled' : 'disabled',
|
|
8130
|
+
}), h(KeyVal, { label: 'Running executions:', value: String(info.runningExecutions) })), h(Section, { title: 'Pipelines in collection' }, h(List, { items: info.pipelines })), h(Section, { title: 'Paths' }, h(List, { items: info.paths })), h(Section, { title: 'Instructions' }, h('ol', { className: 'list-decimal ml-6 space-y-1' }, h('li', null, 'The client ', h('a', { href: 'https://www.npmjs.com/package/@promptbook/remote-client', className: 'text-blue-600 underline' }, 'https://www.npmjs.com/package/@promptbook/remote-client')), h('li', null, 'OpenAI compatible client ', h('span', { className: 'text-gray-500' }, '(Not working yet)')), h('li', null, 'REST API')), h('p', { className: 'mt-2' }, 'For more information look at: ', h('a', { href: 'https://github.com/webgptorg/promptbook', className: 'text-blue-600 underline' }, 'https://github.com/webgptorg/promptbook'))));
|
|
8131
|
+
}
|
|
8132
|
+
function HtmlDoc({ info }) {
|
|
8133
|
+
return h('html', { lang: 'en' }, h('head', null, h('meta', { charSet: 'UTF-8' }), h('meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }), h('title', null, 'Promptbook Server'), h('link', {
|
|
8134
|
+
href: 'https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css',
|
|
8135
|
+
rel: 'stylesheet',
|
|
8136
|
+
})), h('body', { className: 'bg-gray-50 text-gray-900' }, h('div', { id: 'root' }, h(ServerBody, { info }))));
|
|
8137
|
+
}
|
|
8138
|
+
/**
|
|
8139
|
+
* Render full HTML for the server index using React SSR without requiring TSX/JSX compiler flags.
|
|
8140
|
+
*
|
|
8141
|
+
* @private internal utility of Remote Server
|
|
8142
|
+
*/
|
|
8143
|
+
function renderServerIndexHtml(info) {
|
|
8144
|
+
return '<!DOCTYPE html>' + server.renderToStaticMarkup(h(HtmlDoc, { info }));
|
|
8145
|
+
}
|
|
8146
|
+
|
|
8109
8147
|
/**
|
|
8110
8148
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
8111
8149
|
*
|
|
@@ -8283,50 +8321,7 @@
|
|
|
8283
8321
|
'/api-docs',
|
|
8284
8322
|
],
|
|
8285
8323
|
};
|
|
8286
|
-
response.type('text/html').send(
|
|
8287
|
-
<!DOCTYPE html>
|
|
8288
|
-
<html lang="en">
|
|
8289
|
-
<head>
|
|
8290
|
-
<meta charset="UTF-8" />
|
|
8291
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8292
|
-
<title>Promptbook Server</title>
|
|
8293
|
-
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
8294
|
-
</head>
|
|
8295
|
-
<body class="bg-gray-50 text-gray-900">
|
|
8296
|
-
<div id="root"></div>
|
|
8297
|
-
<script>
|
|
8298
|
-
window.__PROMPTBOOK_SERVER_INFO__ = ${JSON.stringify(serverInfo)};
|
|
8299
|
-
// TODO: Hydrate React app here
|
|
8300
|
-
// You will need to bundle and serve a React app for full functionality
|
|
8301
|
-
const info = window.__PROMPTBOOK_SERVER_INFO__;
|
|
8302
|
-
document.getElementById('root').innerHTML = \`
|
|
8303
|
-
<h1 class="text-3xl font-bold mb-4">Promptbook Server Rich UI</h1>
|
|
8304
|
-
<div class="mb-4">
|
|
8305
|
-
<strong>Book language version:</strong> \${info.bookLanguageVersion}<br>
|
|
8306
|
-
<strong>Promptbook engine version:</strong> \${info.promptbookEngineVersion}<br>
|
|
8307
|
-
<strong>Node.js version:</strong> \${info.nodeVersion}<br>
|
|
8308
|
-
<strong>Server port:</strong> \${info.port}<br>
|
|
8309
|
-
<strong>Startup date:</strong> \${info.startupDate}<br>
|
|
8310
|
-
<strong>Anonymous mode:</strong> \${info.isAnonymousModeAllowed ? 'enabled' : 'disabled'}<br>
|
|
8311
|
-
<strong>Application mode:</strong> \${info.isApplicationModeAllowed ? 'enabled' : 'disabled'}<br>
|
|
8312
|
-
<strong>Pipelines in collection:</strong> \${info.pipelines.length ? '<ul>' + info.pipelines.map(p => '<li>' + p + '</li>').join('') + '</ul>' : 'none'}<br>
|
|
8313
|
-
<strong>Running executions:</strong> \${info.runningExecutions}<br>
|
|
8314
|
-
<strong>Paths:</strong> <ul>\${info.paths.map(p => '<li>' + p + '</li>').join('')}</ul>
|
|
8315
|
-
</div>
|
|
8316
|
-
<div class="mt-8">
|
|
8317
|
-
<h2 class="text-xl font-semibold mb-2">Instructions</h2>
|
|
8318
|
-
<ol class="list-decimal ml-6">
|
|
8319
|
-
<li>The client <a href="https://www.npmjs.com/package/@promptbook/remote-client" class="text-blue-600 underline">https://www.npmjs.com/package/@promptbook/remote-client</a></li>
|
|
8320
|
-
<li>OpenAI compatible client <span class="text-gray-500">(Not working yet)</span></li>
|
|
8321
|
-
<li>REST API</li>
|
|
8322
|
-
</ol>
|
|
8323
|
-
<p class="mt-2">For more information look at: <a href="https://github.com/webgptorg/promptbook" class="text-blue-600 underline">https://github.com/webgptorg/promptbook</a></p>
|
|
8324
|
-
</div>
|
|
8325
|
-
\`;
|
|
8326
|
-
</script>
|
|
8327
|
-
</body>
|
|
8328
|
-
</html>
|
|
8329
|
-
`);
|
|
8324
|
+
response.type('text/html').send(renderServerIndexHtml(serverInfo));
|
|
8330
8325
|
}
|
|
8331
8326
|
else {
|
|
8332
8327
|
response.type('text/markdown').send(await spaceTrim.spaceTrim(async (block) => `
|