@kapeta/local-cluster-service 0.70.12 → 0.71.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/CHANGELOG.md +7 -0
- package/dist/cjs/src/storm/events.d.ts +2 -0
- package/dist/cjs/src/storm/events.js +2 -0
- package/dist/cjs/src/storm/routes.js +14 -3
- package/dist/esm/src/storm/events.d.ts +2 -0
- package/dist/esm/src/storm/events.js +2 -0
- package/dist/esm/src/storm/routes.js +14 -3
- package/package.json +1 -1
- package/src/storm/events.ts +2 -0
- package/src/storm/routes.ts +19 -3
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.71.0](https://github.com/kapetacom/local-cluster-service/compare/v0.70.12...v0.71.0) (2024-09-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Add two new phases ([d2805a8](https://github.com/kapetacom/local-cluster-service/commit/d2805a89d7e21b6f30674ae852ddc356954e7d79))
|
7
|
+
|
1
8
|
## [0.70.12](https://github.com/kapetacom/local-cluster-service/compare/v0.70.11...v0.70.12) (2024-09-13)
|
2
9
|
|
3
10
|
|
@@ -271,6 +271,8 @@ export interface StormEventDefinitionChange {
|
|
271
271
|
payload: StormDefinitions;
|
272
272
|
}
|
273
273
|
export declare enum StormEventPhaseType {
|
274
|
+
IMPLEMENT_APIS = "IMPLEMENT_APIS",// Implement APIs in the html pages
|
275
|
+
COMPOSE_SYSTEM_PROMPT = "COMPOSE_SYSTEM_PROMPT",// Compose system prompt for bottom-up approach
|
274
276
|
META = "META",
|
275
277
|
DEFINITIONS = "DEFINITIONS",
|
276
278
|
IMPLEMENTATION = "IMPLEMENTATION",
|
@@ -11,6 +11,8 @@ var StormEventBlockStatusType;
|
|
11
11
|
})(StormEventBlockStatusType || (exports.StormEventBlockStatusType = StormEventBlockStatusType = {}));
|
12
12
|
var StormEventPhaseType;
|
13
13
|
(function (StormEventPhaseType) {
|
14
|
+
StormEventPhaseType["IMPLEMENT_APIS"] = "IMPLEMENT_APIS";
|
15
|
+
StormEventPhaseType["COMPOSE_SYSTEM_PROMPT"] = "COMPOSE_SYSTEM_PROMPT";
|
14
16
|
StormEventPhaseType["META"] = "META";
|
15
17
|
StormEventPhaseType["DEFINITIONS"] = "DEFINITIONS";
|
16
18
|
StormEventPhaseType["IMPLEMENTATION"] = "IMPLEMENTATION";
|
@@ -72,6 +72,10 @@ router.post('/ui/create-system/:handle/:systemId', async (req, res) => {
|
|
72
72
|
const systemId = req.params.systemId;
|
73
73
|
const srcDir = (0, page_utils_1.getSystemBaseDir)(systemId);
|
74
74
|
const destDir = (0, page_utils_1.getSystemBaseImplDir)(systemId);
|
75
|
+
res.set('Content-Type', 'application/x-ndjson');
|
76
|
+
res.set('Access-Control-Expose-Headers', stormClient_1.ConversationIdHeader);
|
77
|
+
res.set(stormClient_1.ConversationIdHeader, systemId);
|
78
|
+
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.IMPLEMENT_APIS));
|
75
79
|
await (0, utils_1.copyDirectory)(srcDir, destDir, async (fileName, content) => {
|
76
80
|
const result = await stormClient_1.stormClient.implementAPIClients({
|
77
81
|
content: content,
|
@@ -79,8 +83,11 @@ router.post('/ui/create-system/:handle/:systemId', async (req, res) => {
|
|
79
83
|
});
|
80
84
|
return result;
|
81
85
|
});
|
86
|
+
sendEvent(res, (0, event_parser_1.createPhaseEndEvent)(events_1.StormEventPhaseType.IMPLEMENT_APIS));
|
87
|
+
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
82
88
|
const pages = (0, utils_1.readPages)(destDir);
|
83
89
|
const prompt = await stormClient_1.stormClient.generatePrompt(pages);
|
90
|
+
sendEvent(res, (0, event_parser_1.createPhaseEndEvent)(events_1.StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
84
91
|
req.query.systemId = systemId;
|
85
92
|
const promptRequest = {
|
86
93
|
prompt: prompt,
|
@@ -490,9 +497,13 @@ async function handleAll(req, res) {
|
|
490
497
|
onRequestAborted(req, res, () => {
|
491
498
|
metaStream.abort();
|
492
499
|
});
|
493
|
-
|
494
|
-
|
495
|
-
res.
|
500
|
+
// We check if the headers have been sent, because we might have already sent some data
|
501
|
+
// before this function is called
|
502
|
+
if (!res.headersSent) {
|
503
|
+
res.set('Content-Type', 'application/x-ndjson');
|
504
|
+
res.set('Access-Control-Expose-Headers', stormClient_1.ConversationIdHeader);
|
505
|
+
res.set(stormClient_1.ConversationIdHeader, metaStream.getConversationId());
|
506
|
+
}
|
496
507
|
let currentPhase = events_1.StormEventPhaseType.META;
|
497
508
|
// Helper to avoid sending the plan multiple times in a row
|
498
509
|
const sendUpdatedPlan = lodash_1.default.debounce(sendDefinitions, 50, { maxWait: 200 });
|
@@ -271,6 +271,8 @@ export interface StormEventDefinitionChange {
|
|
271
271
|
payload: StormDefinitions;
|
272
272
|
}
|
273
273
|
export declare enum StormEventPhaseType {
|
274
|
+
IMPLEMENT_APIS = "IMPLEMENT_APIS",// Implement APIs in the html pages
|
275
|
+
COMPOSE_SYSTEM_PROMPT = "COMPOSE_SYSTEM_PROMPT",// Compose system prompt for bottom-up approach
|
274
276
|
META = "META",
|
275
277
|
DEFINITIONS = "DEFINITIONS",
|
276
278
|
IMPLEMENTATION = "IMPLEMENTATION",
|
@@ -11,6 +11,8 @@ var StormEventBlockStatusType;
|
|
11
11
|
})(StormEventBlockStatusType || (exports.StormEventBlockStatusType = StormEventBlockStatusType = {}));
|
12
12
|
var StormEventPhaseType;
|
13
13
|
(function (StormEventPhaseType) {
|
14
|
+
StormEventPhaseType["IMPLEMENT_APIS"] = "IMPLEMENT_APIS";
|
15
|
+
StormEventPhaseType["COMPOSE_SYSTEM_PROMPT"] = "COMPOSE_SYSTEM_PROMPT";
|
14
16
|
StormEventPhaseType["META"] = "META";
|
15
17
|
StormEventPhaseType["DEFINITIONS"] = "DEFINITIONS";
|
16
18
|
StormEventPhaseType["IMPLEMENTATION"] = "IMPLEMENTATION";
|
@@ -72,6 +72,10 @@ router.post('/ui/create-system/:handle/:systemId', async (req, res) => {
|
|
72
72
|
const systemId = req.params.systemId;
|
73
73
|
const srcDir = (0, page_utils_1.getSystemBaseDir)(systemId);
|
74
74
|
const destDir = (0, page_utils_1.getSystemBaseImplDir)(systemId);
|
75
|
+
res.set('Content-Type', 'application/x-ndjson');
|
76
|
+
res.set('Access-Control-Expose-Headers', stormClient_1.ConversationIdHeader);
|
77
|
+
res.set(stormClient_1.ConversationIdHeader, systemId);
|
78
|
+
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.IMPLEMENT_APIS));
|
75
79
|
await (0, utils_1.copyDirectory)(srcDir, destDir, async (fileName, content) => {
|
76
80
|
const result = await stormClient_1.stormClient.implementAPIClients({
|
77
81
|
content: content,
|
@@ -79,8 +83,11 @@ router.post('/ui/create-system/:handle/:systemId', async (req, res) => {
|
|
79
83
|
});
|
80
84
|
return result;
|
81
85
|
});
|
86
|
+
sendEvent(res, (0, event_parser_1.createPhaseEndEvent)(events_1.StormEventPhaseType.IMPLEMENT_APIS));
|
87
|
+
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
82
88
|
const pages = (0, utils_1.readPages)(destDir);
|
83
89
|
const prompt = await stormClient_1.stormClient.generatePrompt(pages);
|
90
|
+
sendEvent(res, (0, event_parser_1.createPhaseEndEvent)(events_1.StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
84
91
|
req.query.systemId = systemId;
|
85
92
|
const promptRequest = {
|
86
93
|
prompt: prompt,
|
@@ -490,9 +497,13 @@ async function handleAll(req, res) {
|
|
490
497
|
onRequestAborted(req, res, () => {
|
491
498
|
metaStream.abort();
|
492
499
|
});
|
493
|
-
|
494
|
-
|
495
|
-
res.
|
500
|
+
// We check if the headers have been sent, because we might have already sent some data
|
501
|
+
// before this function is called
|
502
|
+
if (!res.headersSent) {
|
503
|
+
res.set('Content-Type', 'application/x-ndjson');
|
504
|
+
res.set('Access-Control-Expose-Headers', stormClient_1.ConversationIdHeader);
|
505
|
+
res.set(stormClient_1.ConversationIdHeader, metaStream.getConversationId());
|
506
|
+
}
|
496
507
|
let currentPhase = events_1.StormEventPhaseType.META;
|
497
508
|
// Helper to avoid sending the plan multiple times in a row
|
498
509
|
const sendUpdatedPlan = lodash_1.default.debounce(sendDefinitions, 50, { maxWait: 200 });
|
package/package.json
CHANGED
package/src/storm/events.ts
CHANGED
@@ -329,6 +329,8 @@ export interface StormEventDefinitionChange {
|
|
329
329
|
}
|
330
330
|
|
331
331
|
export enum StormEventPhaseType {
|
332
|
+
IMPLEMENT_APIS = 'IMPLEMENT_APIS', // Implement APIs in the html pages
|
333
|
+
COMPOSE_SYSTEM_PROMPT = 'COMPOSE_SYSTEM_PROMPT', // Compose system prompt for bottom-up approach
|
332
334
|
META = 'META',
|
333
335
|
DEFINITIONS = 'DEFINITIONS',
|
334
336
|
IMPLEMENTATION = 'IMPLEMENTATION',
|
package/src/storm/routes.ts
CHANGED
@@ -105,6 +105,12 @@ router.post('/ui/create-system/:handle/:systemId', async (req: KapetaBodyRequest
|
|
105
105
|
const srcDir = getSystemBaseDir(systemId);
|
106
106
|
const destDir = getSystemBaseImplDir(systemId);
|
107
107
|
|
108
|
+
res.set('Content-Type', 'application/x-ndjson');
|
109
|
+
res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
110
|
+
res.set(ConversationIdHeader, systemId);
|
111
|
+
|
112
|
+
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
113
|
+
|
108
114
|
await copyDirectory(srcDir, destDir, async (fileName, content) => {
|
109
115
|
const result = await stormClient.implementAPIClients({
|
110
116
|
content: content,
|
@@ -113,9 +119,15 @@ router.post('/ui/create-system/:handle/:systemId', async (req: KapetaBodyRequest
|
|
113
119
|
return result;
|
114
120
|
});
|
115
121
|
|
122
|
+
sendEvent(res, createPhaseEndEvent(StormEventPhaseType.IMPLEMENT_APIS));
|
123
|
+
|
124
|
+
sendEvent(res, createPhaseStartEvent(StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
125
|
+
|
116
126
|
const pages = readPages(destDir);
|
117
127
|
const prompt = await stormClient.generatePrompt(pages);
|
118
128
|
|
129
|
+
sendEvent(res, createPhaseEndEvent(StormEventPhaseType.COMPOSE_SYSTEM_PROMPT));
|
130
|
+
|
119
131
|
req.query.systemId = systemId;
|
120
132
|
const promptRequest: BasePromptRequest = {
|
121
133
|
prompt: prompt,
|
@@ -612,9 +624,13 @@ async function handleAll(req: KapetaBodyRequest, res: Response) {
|
|
612
624
|
metaStream.abort();
|
613
625
|
});
|
614
626
|
|
615
|
-
|
616
|
-
|
617
|
-
res.
|
627
|
+
// We check if the headers have been sent, because we might have already sent some data
|
628
|
+
// before this function is called
|
629
|
+
if (!res.headersSent) {
|
630
|
+
res.set('Content-Type', 'application/x-ndjson');
|
631
|
+
res.set('Access-Control-Expose-Headers', ConversationIdHeader);
|
632
|
+
res.set(ConversationIdHeader, metaStream.getConversationId());
|
633
|
+
}
|
618
634
|
|
619
635
|
let currentPhase = StormEventPhaseType.META;
|
620
636
|
|