@lowdefy/server-dev 5.2.0 → 5.3.0
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/lib/server/apiWrapper.js
CHANGED
|
@@ -20,6 +20,7 @@ import { getSecretsFromEnv } from '@lowdefy/node-utils';
|
|
|
20
20
|
import { serializer } from '@lowdefy/helpers';
|
|
21
21
|
import { v4 as uuid } from 'uuid';
|
|
22
22
|
|
|
23
|
+
import agents from '../../build/plugins/agents.js';
|
|
23
24
|
import config from '../build/config.js';
|
|
24
25
|
import connections from '../../build/plugins/connections.js';
|
|
25
26
|
import createLogger from './log/createLogger.js';
|
|
@@ -65,6 +66,7 @@ function apiWrapper(handler) {
|
|
|
65
66
|
const context = {
|
|
66
67
|
// Important to give absolute path so Next can trace build files
|
|
67
68
|
rid: uuid(),
|
|
69
|
+
agents,
|
|
68
70
|
buildDirectory,
|
|
69
71
|
configDirectory: process.env.LOWDEFY_DIRECTORY_CONFIG || process.cwd(),
|
|
70
72
|
config,
|
package/next.config.js
CHANGED
|
@@ -4,7 +4,12 @@ const blockPackages = require('./build/blockPackages.json');
|
|
|
4
4
|
// Transpile @lowdefy/client plus all block plugin packages that may
|
|
5
5
|
// contain CSS imports (e.g., AG Grid themes, loaders, markdown).
|
|
6
6
|
// Built dynamically so custom user plugins are included automatically.
|
|
7
|
-
const transpilePackages = [
|
|
7
|
+
const transpilePackages = [
|
|
8
|
+
'@lowdefy/client',
|
|
9
|
+
'@ant-design/x',
|
|
10
|
+
'@ant-design/x-markdown',
|
|
11
|
+
...blockPackages,
|
|
12
|
+
];
|
|
8
13
|
|
|
9
14
|
const nextConfig = {
|
|
10
15
|
basePath: lowdefyConfig.basePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -36,34 +36,35 @@
|
|
|
36
36
|
".npmrc"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lowdefy/actions-core": "5.
|
|
40
|
-
"@lowdefy/api": "5.
|
|
41
|
-
"@lowdefy/block-utils": "5.
|
|
42
|
-
"@lowdefy/blocks-aggrid": "5.
|
|
43
|
-
"@lowdefy/blocks-antd": "5.
|
|
44
|
-
"@lowdefy/blocks-
|
|
45
|
-
"@lowdefy/blocks-
|
|
46
|
-
"@lowdefy/blocks-
|
|
47
|
-
"@lowdefy/blocks-
|
|
48
|
-
"@lowdefy/blocks-
|
|
49
|
-
"@lowdefy/
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/
|
|
52
|
-
"@lowdefy/
|
|
53
|
-
"@lowdefy/
|
|
54
|
-
"@lowdefy/
|
|
55
|
-
"@lowdefy/
|
|
56
|
-
"@lowdefy/
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/
|
|
59
|
-
"@lowdefy/operators-
|
|
60
|
-
"@lowdefy/operators-
|
|
61
|
-
"@lowdefy/operators-
|
|
62
|
-
"@lowdefy/operators-
|
|
63
|
-
"@lowdefy/operators-
|
|
64
|
-
"@lowdefy/operators-
|
|
65
|
-
"@lowdefy/operators-
|
|
66
|
-
"@lowdefy/
|
|
39
|
+
"@lowdefy/actions-core": "5.3.0",
|
|
40
|
+
"@lowdefy/api": "5.3.0",
|
|
41
|
+
"@lowdefy/block-utils": "5.3.0",
|
|
42
|
+
"@lowdefy/blocks-aggrid": "5.3.0",
|
|
43
|
+
"@lowdefy/blocks-antd": "5.3.0",
|
|
44
|
+
"@lowdefy/blocks-antd-x": "5.3.0",
|
|
45
|
+
"@lowdefy/blocks-basic": "5.3.0",
|
|
46
|
+
"@lowdefy/blocks-echarts": "5.3.0",
|
|
47
|
+
"@lowdefy/blocks-loaders": "5.3.0",
|
|
48
|
+
"@lowdefy/blocks-markdown": "5.3.0",
|
|
49
|
+
"@lowdefy/blocks-tiptap": "5.3.0",
|
|
50
|
+
"@lowdefy/build": "5.3.0",
|
|
51
|
+
"@lowdefy/client": "5.3.0",
|
|
52
|
+
"@lowdefy/connection-axios-http": "5.3.0",
|
|
53
|
+
"@lowdefy/engine": "5.3.0",
|
|
54
|
+
"@lowdefy/errors": "5.3.0",
|
|
55
|
+
"@lowdefy/helpers": "5.3.0",
|
|
56
|
+
"@lowdefy/layout": "5.3.0",
|
|
57
|
+
"@lowdefy/logger": "5.3.0",
|
|
58
|
+
"@lowdefy/node-utils": "5.3.0",
|
|
59
|
+
"@lowdefy/operators-change-case": "5.3.0",
|
|
60
|
+
"@lowdefy/operators-dayjs": "5.3.0",
|
|
61
|
+
"@lowdefy/operators-diff": "5.3.0",
|
|
62
|
+
"@lowdefy/operators-js": "5.3.0",
|
|
63
|
+
"@lowdefy/operators-mql": "5.3.0",
|
|
64
|
+
"@lowdefy/operators-nunjucks": "5.3.0",
|
|
65
|
+
"@lowdefy/operators-uuid": "5.3.0",
|
|
66
|
+
"@lowdefy/operators-yaml": "5.3.0",
|
|
67
|
+
"@lowdefy/plugin-next-auth": "5.3.0",
|
|
67
68
|
"@ant-design/cssinjs": "2.1.2",
|
|
68
69
|
"antd": "6.3.1",
|
|
69
70
|
"dayjs": "1.11.19",
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -44,34 +44,35 @@
|
|
|
44
44
|
"prepublishOnly": "pnpm build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@lowdefy/actions-core": "5.
|
|
48
|
-
"@lowdefy/api": "5.
|
|
49
|
-
"@lowdefy/block-utils": "5.
|
|
50
|
-
"@lowdefy/blocks-aggrid": "5.
|
|
51
|
-
"@lowdefy/blocks-antd": "5.
|
|
52
|
-
"@lowdefy/blocks-
|
|
53
|
-
"@lowdefy/blocks-
|
|
54
|
-
"@lowdefy/blocks-
|
|
55
|
-
"@lowdefy/blocks-
|
|
56
|
-
"@lowdefy/blocks-
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/
|
|
59
|
-
"@lowdefy/
|
|
60
|
-
"@lowdefy/
|
|
61
|
-
"@lowdefy/
|
|
62
|
-
"@lowdefy/
|
|
63
|
-
"@lowdefy/
|
|
64
|
-
"@lowdefy/
|
|
65
|
-
"@lowdefy/
|
|
66
|
-
"@lowdefy/
|
|
67
|
-
"@lowdefy/operators-
|
|
68
|
-
"@lowdefy/operators-
|
|
69
|
-
"@lowdefy/operators-
|
|
70
|
-
"@lowdefy/operators-
|
|
71
|
-
"@lowdefy/operators-
|
|
72
|
-
"@lowdefy/operators-
|
|
73
|
-
"@lowdefy/operators-
|
|
74
|
-
"@lowdefy/
|
|
47
|
+
"@lowdefy/actions-core": "5.3.0",
|
|
48
|
+
"@lowdefy/api": "5.3.0",
|
|
49
|
+
"@lowdefy/block-utils": "5.3.0",
|
|
50
|
+
"@lowdefy/blocks-aggrid": "5.3.0",
|
|
51
|
+
"@lowdefy/blocks-antd": "5.3.0",
|
|
52
|
+
"@lowdefy/blocks-antd-x": "5.3.0",
|
|
53
|
+
"@lowdefy/blocks-basic": "5.3.0",
|
|
54
|
+
"@lowdefy/blocks-echarts": "5.3.0",
|
|
55
|
+
"@lowdefy/blocks-loaders": "5.3.0",
|
|
56
|
+
"@lowdefy/blocks-markdown": "5.3.0",
|
|
57
|
+
"@lowdefy/blocks-tiptap": "5.3.0",
|
|
58
|
+
"@lowdefy/build": "5.3.0",
|
|
59
|
+
"@lowdefy/client": "5.3.0",
|
|
60
|
+
"@lowdefy/connection-axios-http": "5.3.0",
|
|
61
|
+
"@lowdefy/engine": "5.3.0",
|
|
62
|
+
"@lowdefy/errors": "5.3.0",
|
|
63
|
+
"@lowdefy/helpers": "5.3.0",
|
|
64
|
+
"@lowdefy/layout": "5.3.0",
|
|
65
|
+
"@lowdefy/logger": "5.3.0",
|
|
66
|
+
"@lowdefy/node-utils": "5.3.0",
|
|
67
|
+
"@lowdefy/operators-change-case": "5.3.0",
|
|
68
|
+
"@lowdefy/operators-dayjs": "5.3.0",
|
|
69
|
+
"@lowdefy/operators-diff": "5.3.0",
|
|
70
|
+
"@lowdefy/operators-js": "5.3.0",
|
|
71
|
+
"@lowdefy/operators-mql": "5.3.0",
|
|
72
|
+
"@lowdefy/operators-nunjucks": "5.3.0",
|
|
73
|
+
"@lowdefy/operators-uuid": "5.3.0",
|
|
74
|
+
"@lowdefy/operators-yaml": "5.3.0",
|
|
75
|
+
"@lowdefy/plugin-next-auth": "5.3.0",
|
|
75
76
|
"@ant-design/cssinjs": "2.1.2",
|
|
76
77
|
"antd": "6.3.1",
|
|
77
78
|
"dayjs": "1.11.19",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { callAgent } from '@lowdefy/api';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
|
|
20
|
+
import apiWrapper from '../../../lib/server/apiWrapper.js';
|
|
21
|
+
|
|
22
|
+
async function handler({ context, req, res }) {
|
|
23
|
+
if (req.method !== 'POST') {
|
|
24
|
+
throw new Error('Only POST requests are supported.');
|
|
25
|
+
}
|
|
26
|
+
const segments = req.query.path;
|
|
27
|
+
if (!Array.isArray(segments) || segments.length < 2) {
|
|
28
|
+
res.status(400).json({ error: 'Invalid agent path' });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const agentId = segments[segments.length - 1];
|
|
32
|
+
const pageId = segments.slice(0, -1).join('/');
|
|
33
|
+
context.logger.info({ color: 'gray' }, `Agent: ${pageId} → ${agentId}`);
|
|
34
|
+
const { conversationId } = req.query;
|
|
35
|
+
const { messages, urlQuery, sharedState } = req.body;
|
|
36
|
+
if (!Array.isArray(messages)) {
|
|
37
|
+
res.status(400).json({ error: 'messages must be an array' });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (urlQuery != null && (typeof urlQuery !== 'object' || Array.isArray(urlQuery))) {
|
|
41
|
+
res.status(400).json({ error: 'urlQuery must be an object' });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (sharedState != null && !type.isObject(sharedState)) {
|
|
45
|
+
res.status(400).json({ error: 'sharedState must be an object' });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { response: webResponse } = await callAgent(context, {
|
|
49
|
+
agentId,
|
|
50
|
+
pageId,
|
|
51
|
+
messages,
|
|
52
|
+
conversationId: conversationId ?? undefined,
|
|
53
|
+
sharedState: sharedState ?? undefined,
|
|
54
|
+
urlQuery: urlQuery ?? undefined,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Stream the Web Response body to the Next.js response
|
|
58
|
+
res.setHeader('Content-Type', 'text/event-stream');
|
|
59
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
60
|
+
res.setHeader('Connection', 'keep-alive');
|
|
61
|
+
res.setHeader('Content-Encoding', 'none');
|
|
62
|
+
res.setHeader('Transfer-Encoding', 'chunked');
|
|
63
|
+
|
|
64
|
+
const reader = webResponse.body.getReader();
|
|
65
|
+
const decoder = new TextDecoder();
|
|
66
|
+
let done = false;
|
|
67
|
+
while (!done) {
|
|
68
|
+
const { value, done: readerDone } = await reader.read();
|
|
69
|
+
done = readerDone;
|
|
70
|
+
if (value) {
|
|
71
|
+
res.write(decoder.decode(value, { stream: true }));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
res.end();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const config = {
|
|
78
|
+
api: {
|
|
79
|
+
bodyParser: {
|
|
80
|
+
sizeLimit: '10mb',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default apiWrapper(handler);
|