@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
package/esm/index.es.js
CHANGED
|
@@ -16,6 +16,8 @@ import sha256 from 'crypto-js/sha256';
|
|
|
16
16
|
import { SHA256 } from 'crypto-js';
|
|
17
17
|
import { lookup, extension } from 'mime-types';
|
|
18
18
|
import { parse, unparse } from 'papaparse';
|
|
19
|
+
import { createElement } from 'react';
|
|
20
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
19
21
|
|
|
20
22
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
21
23
|
/**
|
|
@@ -31,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
31
33
|
* @generated
|
|
32
34
|
* @see https://github.com/webgptorg/promptbook
|
|
33
35
|
*/
|
|
34
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.102.0-
|
|
36
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.102.0-2';
|
|
35
37
|
/**
|
|
36
38
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
37
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -8090,6 +8092,44 @@ const openapiJson = {
|
|
|
8090
8092
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8091
8093
|
*/
|
|
8092
8094
|
|
|
8095
|
+
const h = createElement;
|
|
8096
|
+
function KeyVal(props) {
|
|
8097
|
+
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));
|
|
8098
|
+
}
|
|
8099
|
+
function List(props) {
|
|
8100
|
+
var _a;
|
|
8101
|
+
if (!((_a = props.items) === null || _a === void 0 ? void 0 : _a.length))
|
|
8102
|
+
return h('span', { className: 'text-gray-500' }, 'none');
|
|
8103
|
+
return h('ul', { className: 'list-disc ml-6' }, ...props.items.map((item, i) => h('li', { key: String(i), className: 'break-all' }, item)));
|
|
8104
|
+
}
|
|
8105
|
+
function Section(props) {
|
|
8106
|
+
return h('section', { className: 'mt-8' }, h('h2', { className: 'text-xl font-semibold mb-2' }, props.title), props.children);
|
|
8107
|
+
}
|
|
8108
|
+
function ServerBody({ info }) {
|
|
8109
|
+
var _a;
|
|
8110
|
+
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, {
|
|
8111
|
+
label: 'Anonymous mode:',
|
|
8112
|
+
value: info.isAnonymousModeAllowed ? 'enabled' : 'disabled',
|
|
8113
|
+
}), h(KeyVal, {
|
|
8114
|
+
label: 'Application mode:',
|
|
8115
|
+
value: info.isApplicationModeAllowed ? 'enabled' : 'disabled',
|
|
8116
|
+
}), 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'))));
|
|
8117
|
+
}
|
|
8118
|
+
function HtmlDoc({ info }) {
|
|
8119
|
+
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', {
|
|
8120
|
+
href: 'https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css',
|
|
8121
|
+
rel: 'stylesheet',
|
|
8122
|
+
})), h('body', { className: 'bg-gray-50 text-gray-900' }, h('div', { id: 'root' }, h(ServerBody, { info }))));
|
|
8123
|
+
}
|
|
8124
|
+
/**
|
|
8125
|
+
* Render full HTML for the server index using React SSR without requiring TSX/JSX compiler flags.
|
|
8126
|
+
*
|
|
8127
|
+
* @private internal utility of Remote Server
|
|
8128
|
+
*/
|
|
8129
|
+
function renderServerIndexHtml(info) {
|
|
8130
|
+
return '<!DOCTYPE html>' + renderToStaticMarkup(h(HtmlDoc, { info }));
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8093
8133
|
/**
|
|
8094
8134
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
8095
8135
|
*
|
|
@@ -8267,50 +8307,7 @@ function startRemoteServer(options) {
|
|
|
8267
8307
|
'/api-docs',
|
|
8268
8308
|
],
|
|
8269
8309
|
};
|
|
8270
|
-
response.type('text/html').send(
|
|
8271
|
-
<!DOCTYPE html>
|
|
8272
|
-
<html lang="en">
|
|
8273
|
-
<head>
|
|
8274
|
-
<meta charset="UTF-8" />
|
|
8275
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8276
|
-
<title>Promptbook Server</title>
|
|
8277
|
-
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
8278
|
-
</head>
|
|
8279
|
-
<body class="bg-gray-50 text-gray-900">
|
|
8280
|
-
<div id="root"></div>
|
|
8281
|
-
<script>
|
|
8282
|
-
window.__PROMPTBOOK_SERVER_INFO__ = ${JSON.stringify(serverInfo)};
|
|
8283
|
-
// TODO: Hydrate React app here
|
|
8284
|
-
// You will need to bundle and serve a React app for full functionality
|
|
8285
|
-
const info = window.__PROMPTBOOK_SERVER_INFO__;
|
|
8286
|
-
document.getElementById('root').innerHTML = \`
|
|
8287
|
-
<h1 class="text-3xl font-bold mb-4">Promptbook Server Rich UI</h1>
|
|
8288
|
-
<div class="mb-4">
|
|
8289
|
-
<strong>Book language version:</strong> \${info.bookLanguageVersion}<br>
|
|
8290
|
-
<strong>Promptbook engine version:</strong> \${info.promptbookEngineVersion}<br>
|
|
8291
|
-
<strong>Node.js version:</strong> \${info.nodeVersion}<br>
|
|
8292
|
-
<strong>Server port:</strong> \${info.port}<br>
|
|
8293
|
-
<strong>Startup date:</strong> \${info.startupDate}<br>
|
|
8294
|
-
<strong>Anonymous mode:</strong> \${info.isAnonymousModeAllowed ? 'enabled' : 'disabled'}<br>
|
|
8295
|
-
<strong>Application mode:</strong> \${info.isApplicationModeAllowed ? 'enabled' : 'disabled'}<br>
|
|
8296
|
-
<strong>Pipelines in collection:</strong> \${info.pipelines.length ? '<ul>' + info.pipelines.map(p => '<li>' + p + '</li>').join('') + '</ul>' : 'none'}<br>
|
|
8297
|
-
<strong>Running executions:</strong> \${info.runningExecutions}<br>
|
|
8298
|
-
<strong>Paths:</strong> <ul>\${info.paths.map(p => '<li>' + p + '</li>').join('')}</ul>
|
|
8299
|
-
</div>
|
|
8300
|
-
<div class="mt-8">
|
|
8301
|
-
<h2 class="text-xl font-semibold mb-2">Instructions</h2>
|
|
8302
|
-
<ol class="list-decimal ml-6">
|
|
8303
|
-
<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>
|
|
8304
|
-
<li>OpenAI compatible client <span class="text-gray-500">(Not working yet)</span></li>
|
|
8305
|
-
<li>REST API</li>
|
|
8306
|
-
</ol>
|
|
8307
|
-
<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>
|
|
8308
|
-
</div>
|
|
8309
|
-
\`;
|
|
8310
|
-
</script>
|
|
8311
|
-
</body>
|
|
8312
|
-
</html>
|
|
8313
|
-
`);
|
|
8310
|
+
response.type('text/html').send(renderServerIndexHtml(serverInfo));
|
|
8314
8311
|
}
|
|
8315
8312
|
else {
|
|
8316
8313
|
response.type('text/markdown').send(await spaceTrim$1(async (block) => `
|