@lowdefy/server-dev 0.0.0-experimental-20260420141318 → 0.0.0-experimental-20260422132846
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/package.json +29 -30
- package/package.original.json +29 -30
- package/pages/api/agent/[...path].js +1 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260422132846",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -36,35 +36,34 @@
|
|
|
36
36
|
".npmrc"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lowdefy/actions-core": "0.0.0-experimental-
|
|
40
|
-
"@lowdefy/
|
|
41
|
-
"@lowdefy/
|
|
42
|
-
"@lowdefy/
|
|
43
|
-
"@lowdefy/blocks-
|
|
44
|
-
"@lowdefy/blocks-antd": "0.0.0-experimental-
|
|
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/
|
|
67
|
-
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20260420141318",
|
|
39
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260422132846",
|
|
40
|
+
"@lowdefy/api": "0.0.0-experimental-20260422132846",
|
|
41
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260422132846",
|
|
42
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20260422132846",
|
|
43
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260422132846",
|
|
44
|
+
"@lowdefy/blocks-antd-x": "0.0.0-experimental-20260422132846",
|
|
45
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260422132846",
|
|
46
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20260422132846",
|
|
47
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260422132846",
|
|
48
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260422132846",
|
|
49
|
+
"@lowdefy/build": "0.0.0-experimental-20260422132846",
|
|
50
|
+
"@lowdefy/client": "0.0.0-experimental-20260422132846",
|
|
51
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260422132846",
|
|
52
|
+
"@lowdefy/engine": "0.0.0-experimental-20260422132846",
|
|
53
|
+
"@lowdefy/errors": "0.0.0-experimental-20260422132846",
|
|
54
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260422132846",
|
|
55
|
+
"@lowdefy/layout": "0.0.0-experimental-20260422132846",
|
|
56
|
+
"@lowdefy/logger": "0.0.0-experimental-20260422132846",
|
|
57
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260422132846",
|
|
58
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20260422132846",
|
|
59
|
+
"@lowdefy/operators-dayjs": "0.0.0-experimental-20260422132846",
|
|
60
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20260422132846",
|
|
61
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260422132846",
|
|
62
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20260422132846",
|
|
63
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260422132846",
|
|
64
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260422132846",
|
|
65
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20260422132846",
|
|
66
|
+
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20260422132846",
|
|
68
67
|
"@ant-design/cssinjs": "2.1.2",
|
|
69
68
|
"antd": "6.3.1",
|
|
70
69
|
"dayjs": "1.11.19",
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260422132846",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -44,35 +44,34 @@
|
|
|
44
44
|
"prepublishOnly": "pnpm build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@lowdefy/actions-core": "0.0.0-experimental-
|
|
48
|
-
"@lowdefy/
|
|
49
|
-
"@lowdefy/
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/blocks-
|
|
52
|
-
"@lowdefy/blocks-antd": "0.0.0-experimental-
|
|
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/
|
|
75
|
-
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20260420141318",
|
|
47
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260422132846",
|
|
48
|
+
"@lowdefy/api": "0.0.0-experimental-20260422132846",
|
|
49
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260422132846",
|
|
50
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20260422132846",
|
|
51
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260422132846",
|
|
52
|
+
"@lowdefy/blocks-antd-x": "0.0.0-experimental-20260422132846",
|
|
53
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260422132846",
|
|
54
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20260422132846",
|
|
55
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260422132846",
|
|
56
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260422132846",
|
|
57
|
+
"@lowdefy/build": "0.0.0-experimental-20260422132846",
|
|
58
|
+
"@lowdefy/client": "0.0.0-experimental-20260422132846",
|
|
59
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260422132846",
|
|
60
|
+
"@lowdefy/engine": "0.0.0-experimental-20260422132846",
|
|
61
|
+
"@lowdefy/errors": "0.0.0-experimental-20260422132846",
|
|
62
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260422132846",
|
|
63
|
+
"@lowdefy/layout": "0.0.0-experimental-20260422132846",
|
|
64
|
+
"@lowdefy/logger": "0.0.0-experimental-20260422132846",
|
|
65
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260422132846",
|
|
66
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20260422132846",
|
|
67
|
+
"@lowdefy/operators-dayjs": "0.0.0-experimental-20260422132846",
|
|
68
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20260422132846",
|
|
69
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260422132846",
|
|
70
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20260422132846",
|
|
71
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260422132846",
|
|
72
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260422132846",
|
|
73
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20260422132846",
|
|
74
|
+
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20260422132846",
|
|
76
75
|
"@ant-design/cssinjs": "2.1.2",
|
|
77
76
|
"antd": "6.3.1",
|
|
78
77
|
"dayjs": "1.11.19",
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import crypto from 'crypto';
|
|
18
|
-
|
|
19
17
|
import { callAgent } from '@lowdefy/api';
|
|
20
|
-
import { createPhaseLogger } from '@lowdefy/ai-utils';
|
|
21
18
|
import { type } from '@lowdefy/helpers';
|
|
22
19
|
|
|
23
20
|
import apiWrapper from '../../../lib/server/apiWrapper.js';
|
|
@@ -35,7 +32,7 @@ async function handler({ context, req, res }) {
|
|
|
35
32
|
const pageId = segments.slice(0, -1).join('/');
|
|
36
33
|
context.logger.info({ color: 'gray' }, `Agent: ${pageId} → ${agentId}`);
|
|
37
34
|
const { conversationId } = req.query;
|
|
38
|
-
const { messages, urlQuery, sharedState
|
|
35
|
+
const { messages, urlQuery, sharedState } = req.body;
|
|
39
36
|
if (!Array.isArray(messages)) {
|
|
40
37
|
res.status(400).json({ error: 'messages must be an array' });
|
|
41
38
|
return;
|
|
@@ -48,37 +45,6 @@ async function handler({ context, req, res }) {
|
|
|
48
45
|
res.status(400).json({ error: 'sharedState must be an object' });
|
|
49
46
|
return;
|
|
50
47
|
}
|
|
51
|
-
|
|
52
|
-
const turnId =
|
|
53
|
-
typeof clientTurnId === 'string' && clientTurnId ? clientTurnId : crypto.randomUUID();
|
|
54
|
-
const turnStart = Date.now();
|
|
55
|
-
const phaseLogger = createPhaseLogger({
|
|
56
|
-
logger: context.logger,
|
|
57
|
-
agentId,
|
|
58
|
-
pageId,
|
|
59
|
-
conversationId: conversationId ?? undefined,
|
|
60
|
-
turnId,
|
|
61
|
-
turnStart,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const bodySize = (() => {
|
|
65
|
-
try {
|
|
66
|
-
return Buffer.byteLength(JSON.stringify(req.body ?? ''));
|
|
67
|
-
} catch {
|
|
68
|
-
return -1;
|
|
69
|
-
}
|
|
70
|
-
})();
|
|
71
|
-
const hasFiles = Array.isArray(messages)
|
|
72
|
-
? messages.some((m) => (m?.parts ?? []).some((p) => p?.type === 'file'))
|
|
73
|
-
: false;
|
|
74
|
-
phaseLogger.phase('ingress.received', {
|
|
75
|
-
bodySize,
|
|
76
|
-
messageCount: messages.length,
|
|
77
|
-
hasFiles,
|
|
78
|
-
sharedStateKeys: sharedState ? Object.keys(sharedState).length : 0,
|
|
79
|
-
urlQueryKeys: urlQuery ? Object.keys(urlQuery).length : 0,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
48
|
const { response: webResponse } = await callAgent(context, {
|
|
83
49
|
agentId,
|
|
84
50
|
pageId,
|
|
@@ -86,8 +52,6 @@ async function handler({ context, req, res }) {
|
|
|
86
52
|
conversationId: conversationId ?? undefined,
|
|
87
53
|
sharedState: sharedState ?? undefined,
|
|
88
54
|
urlQuery: urlQuery ?? undefined,
|
|
89
|
-
phaseLogger,
|
|
90
|
-
turnId,
|
|
91
55
|
});
|
|
92
56
|
|
|
93
57
|
// Stream the Web Response body to the Next.js response
|
|
@@ -97,29 +61,17 @@ async function handler({ context, req, res }) {
|
|
|
97
61
|
res.setHeader('Content-Encoding', 'none');
|
|
98
62
|
res.setHeader('Transfer-Encoding', 'chunked');
|
|
99
63
|
|
|
100
|
-
phaseLogger.phase('ingress.stream.forward.start');
|
|
101
|
-
|
|
102
64
|
const reader = webResponse.body.getReader();
|
|
103
65
|
const decoder = new TextDecoder();
|
|
104
66
|
let done = false;
|
|
105
|
-
let firstByteLogged = false;
|
|
106
|
-
let chunkCount = 0;
|
|
107
|
-
let totalBytes = 0;
|
|
108
67
|
while (!done) {
|
|
109
68
|
const { value, done: readerDone } = await reader.read();
|
|
110
69
|
done = readerDone;
|
|
111
70
|
if (value) {
|
|
112
|
-
if (!firstByteLogged) {
|
|
113
|
-
firstByteLogged = true;
|
|
114
|
-
phaseLogger.phase('ingress.stream.first_byte', { bytes: value.byteLength });
|
|
115
|
-
}
|
|
116
|
-
chunkCount += 1;
|
|
117
|
-
totalBytes += value.byteLength;
|
|
118
71
|
res.write(decoder.decode(value, { stream: true }));
|
|
119
72
|
}
|
|
120
73
|
}
|
|
121
74
|
res.end();
|
|
122
|
-
phaseLogger.phase('ingress.stream.forward.done', { chunkCount, totalBytes });
|
|
123
75
|
}
|
|
124
76
|
|
|
125
77
|
export const config = {
|