@kapeta/local-cluster-service 0.71.5 → 0.71.6
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/CHANGELOG.md +7 -0
- package/dist/cjs/src/storm/routes.js +11 -10
- package/dist/esm/src/storm/routes.js +11 -10
- package/package.json +1 -1
- package/src/storm/routes.ts +29 -23
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.71.6](https://github.com/kapetacom/local-cluster-service/compare/v0.71.5...v0.71.6) (2024-09-19)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Change to simple json response for now ([#256](https://github.com/kapetacom/local-cluster-service/issues/256)) ([7d8ae48](https://github.com/kapetacom/local-cluster-service/commit/7d8ae4813b78f478a0f719195ea33dc2890f1d2a))
|
7
|
+
|
1
8
|
## [0.71.5](https://github.com/kapetacom/local-cluster-service/compare/v0.71.4...v0.71.5) (2024-09-19)
|
2
9
|
|
3
10
|
|
@@ -106,17 +106,17 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req, res) => {
|
|
106
106
|
const handle = req.params.handle;
|
107
107
|
const systemId = req.params.systemId;
|
108
108
|
const srcDir = (0, page_utils_1.getSystemBaseDir)(systemId);
|
109
|
-
res.set('Content-Type', 'application/x-ndjson');
|
110
|
-
res.set('Access-Control-Expose-Headers',
|
111
|
-
res.set(
|
112
|
-
sendEvent(res,
|
109
|
+
//res.set('Content-Type', 'application/x-ndjson');
|
110
|
+
//res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
111
|
+
//res.set(ConversationIdHeader, systemId);
|
112
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
113
113
|
try {
|
114
114
|
const pagesFromDisk = (0, utils_1.readFilesAndContent)(srcDir);
|
115
115
|
const pagesWithImplementation = await stormClient_1.stormClient.replaceMockWithAPICall({
|
116
116
|
pages: pagesFromDisk,
|
117
117
|
});
|
118
|
-
sendEvent(res,
|
119
|
-
sendEvent(res,
|
118
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
119
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
120
120
|
const allFiles = (0, utils_1.readFilesAndContent)(srcDir, false).map((page) => {
|
121
121
|
if (page.encoding == stream_1.HTMLPageEncoding.TEXT) {
|
122
122
|
const matchingFile = pagesWithImplementation.find((pageWithImpl) => pageWithImpl.fileName === page.fileName);
|
@@ -127,12 +127,13 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req, res) => {
|
|
127
127
|
return page;
|
128
128
|
});
|
129
129
|
const systemUrl = await stormClient_1.stormClient.createSimpleBackend(handle, systemId, { pages: allFiles });
|
130
|
-
sendEvent(res, {
|
131
|
-
sendEvent(res,
|
132
|
-
sendDone(res);
|
130
|
+
//sendEvent(res, {type: 'SYSTEM_READY', created: Math.floor(Date.now() / 1000), reason: 'System Ready', payload: { systemUrl: systemUrl }});
|
131
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
132
|
+
//sendDone(res);
|
133
|
+
res.json({ url: systemUrl });
|
133
134
|
}
|
134
135
|
catch (err) {
|
135
|
-
|
136
|
+
res.status(500).json({ error: err.message });
|
136
137
|
}
|
137
138
|
finally {
|
138
139
|
if (!res.closed) {
|
@@ -106,17 +106,17 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req, res) => {
|
|
106
106
|
const handle = req.params.handle;
|
107
107
|
const systemId = req.params.systemId;
|
108
108
|
const srcDir = (0, page_utils_1.getSystemBaseDir)(systemId);
|
109
|
-
res.set('Content-Type', 'application/x-ndjson');
|
110
|
-
res.set('Access-Control-Expose-Headers',
|
111
|
-
res.set(
|
112
|
-
sendEvent(res,
|
109
|
+
//res.set('Content-Type', 'application/x-ndjson');
|
110
|
+
//res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
111
|
+
//res.set(ConversationIdHeader, systemId);
|
112
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
113
113
|
try {
|
114
114
|
const pagesFromDisk = (0, utils_1.readFilesAndContent)(srcDir);
|
115
115
|
const pagesWithImplementation = await stormClient_1.stormClient.replaceMockWithAPICall({
|
116
116
|
pages: pagesFromDisk,
|
117
117
|
});
|
118
|
-
sendEvent(res,
|
119
|
-
sendEvent(res,
|
118
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
119
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
120
120
|
const allFiles = (0, utils_1.readFilesAndContent)(srcDir, false).map((page) => {
|
121
121
|
if (page.encoding == stream_1.HTMLPageEncoding.TEXT) {
|
122
122
|
const matchingFile = pagesWithImplementation.find((pageWithImpl) => pageWithImpl.fileName === page.fileName);
|
@@ -127,12 +127,13 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req, res) => {
|
|
127
127
|
return page;
|
128
128
|
});
|
129
129
|
const systemUrl = await stormClient_1.stormClient.createSimpleBackend(handle, systemId, { pages: allFiles });
|
130
|
-
sendEvent(res, {
|
131
|
-
sendEvent(res,
|
132
|
-
sendDone(res);
|
130
|
+
//sendEvent(res, {type: 'SYSTEM_READY', created: Math.floor(Date.now() / 1000), reason: 'System Ready', payload: { systemUrl: systemUrl }});
|
131
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
132
|
+
//sendDone(res);
|
133
|
+
res.json({ url: systemUrl });
|
133
134
|
}
|
134
135
|
catch (err) {
|
135
|
-
|
136
|
+
res.status(500).json({ error: err.message });
|
136
137
|
}
|
137
138
|
finally {
|
138
139
|
if (!res.closed) {
|
package/package.json
CHANGED
package/src/storm/routes.ts
CHANGED
@@ -11,7 +11,13 @@ import _ from 'lodash';
|
|
11
11
|
import { corsHandler } from '../middleware/cors';
|
12
12
|
import { stringBody } from '../middleware/stringBody';
|
13
13
|
import { KapetaBodyRequest } from '../types';
|
14
|
-
import {
|
14
|
+
import {
|
15
|
+
HTMLPageEncoding,
|
16
|
+
StormCodegenRequest,
|
17
|
+
StormContextRequest,
|
18
|
+
StormCreateBlockRequest,
|
19
|
+
StormStream,
|
20
|
+
} from './stream';
|
15
21
|
|
16
22
|
import {
|
17
23
|
ConversationIdHeader,
|
@@ -109,26 +115,24 @@ router.post('/ui/create-system/:handle/:systemId', async (req: KapetaBodyRequest
|
|
109
115
|
|
110
116
|
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
111
117
|
|
112
|
-
const pagesFromDisk =
|
118
|
+
const pagesFromDisk = readFilesAndContent(srcDir);
|
113
119
|
const pagesWithImplementation = await stormClient.replaceMockWithAPICall({
|
114
|
-
|
115
|
-
|
116
|
-
);
|
120
|
+
pages: pagesFromDisk,
|
121
|
+
});
|
117
122
|
await copyDirectory(srcDir, destDir, (fileName, content) => {
|
118
123
|
// find the page from result1 and write the content to the file
|
119
124
|
const page = pagesWithImplementation.find((p) => p.fileName === fileName);
|
120
125
|
return page ? page.content : content;
|
121
126
|
});
|
122
127
|
|
123
|
-
|
124
128
|
sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
125
129
|
|
126
130
|
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
127
131
|
|
128
132
|
// get the content of the pages
|
129
133
|
const pageContents = pagesWithImplementation.map((page) => {
|
130
|
-
return page.content
|
131
|
-
})
|
134
|
+
return page.content;
|
135
|
+
});
|
132
136
|
|
133
137
|
const prompt = await stormClient.generatePrompt(pageContents);
|
134
138
|
|
@@ -148,26 +152,27 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req: KapetaBody
|
|
148
152
|
const systemId = req.params.systemId as string;
|
149
153
|
const srcDir = getSystemBaseDir(systemId);
|
150
154
|
|
151
|
-
res.set('Content-Type', 'application/x-ndjson');
|
152
|
-
res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
153
|
-
res.set(ConversationIdHeader, systemId);
|
155
|
+
//res.set('Content-Type', 'application/x-ndjson');
|
156
|
+
//res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
157
|
+
//res.set(ConversationIdHeader, systemId);
|
154
158
|
|
155
|
-
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
159
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
156
160
|
|
157
161
|
try {
|
158
162
|
const pagesFromDisk = readFilesAndContent(srcDir);
|
159
163
|
const pagesWithImplementation = await stormClient.replaceMockWithAPICall({
|
160
|
-
|
161
|
-
|
162
|
-
);
|
164
|
+
pages: pagesFromDisk,
|
165
|
+
});
|
163
166
|
|
164
|
-
sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
167
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
165
168
|
|
166
|
-
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
169
|
+
//sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
167
170
|
|
168
171
|
const allFiles = readFilesAndContent(srcDir, false).map((page) => {
|
169
172
|
if (page.encoding == HTMLPageEncoding.TEXT) {
|
170
|
-
const matchingFile = pagesWithImplementation.find(
|
173
|
+
const matchingFile = pagesWithImplementation.find(
|
174
|
+
(pageWithImpl) => pageWithImpl.fileName === page.fileName
|
175
|
+
);
|
171
176
|
if (matchingFile) {
|
172
177
|
return matchingFile;
|
173
178
|
}
|
@@ -175,14 +180,15 @@ router.post('/ui/create-system-simple/:handle/:systemId', async (req: KapetaBody
|
|
175
180
|
return page;
|
176
181
|
});
|
177
182
|
|
178
|
-
const systemUrl = await stormClient.createSimpleBackend(handle, systemId, {pages: allFiles});
|
179
|
-
sendEvent(res, {type: 'SYSTEM_READY', created: Math.floor(Date.now() / 1000), reason: 'System Ready', payload: { systemUrl: systemUrl }});
|
183
|
+
const systemUrl = await stormClient.createSimpleBackend(handle, systemId, { pages: allFiles });
|
184
|
+
//sendEvent(res, {type: 'SYSTEM_READY', created: Math.floor(Date.now() / 1000), reason: 'System Ready', payload: { systemUrl: systemUrl }});
|
180
185
|
|
181
|
-
sendEvent(res, createPhaseEndEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
186
|
+
//sendEvent(res, createPhaseEndEvent(StormEventPhaseType.COMPOSE_SYSTEM));
|
182
187
|
|
183
|
-
sendDone(res);
|
188
|
+
//sendDone(res);
|
189
|
+
res.json({ url: systemUrl });
|
184
190
|
} catch (err: any) {
|
185
|
-
|
191
|
+
res.status(500).json({ error: err.message });
|
186
192
|
} finally {
|
187
193
|
if (!res.closed) {
|
188
194
|
res.end();
|