@kapeta/local-cluster-service 0.70.7 → 0.70.8
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/codegen.d.ts +2 -1
- package/dist/cjs/src/storm/codegen.js +7 -1
- package/dist/cjs/src/storm/event-parser.d.ts +3 -1
- package/dist/cjs/src/storm/event-parser.js +5 -2
- package/dist/cjs/src/storm/routes.js +3 -2
- package/dist/cjs/test/storm/event-parser.test.d.ts +1 -0
- package/dist/cjs/test/storm/event-parser.test.js +1 -0
- package/dist/esm/src/storm/codegen.d.ts +2 -1
- package/dist/esm/src/storm/codegen.js +7 -1
- package/dist/esm/src/storm/event-parser.d.ts +3 -1
- package/dist/esm/src/storm/event-parser.js +5 -2
- package/dist/esm/src/storm/routes.js +3 -2
- package/dist/esm/test/storm/event-parser.test.d.ts +1 -0
- package/dist/esm/test/storm/event-parser.test.js +1 -0
- package/package.json +1 -1
- package/src/storm/codegen.ts +16 -3
- package/src/storm/event-parser.ts +10 -3
- package/src/storm/routes.ts +4 -2
- package/test/storm/event-parser.test.ts +1 -0
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.70.8](https://github.com/kapetacom/local-cluster-service/compare/v0.70.7...v0.70.8) (2024-09-12)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* use language-target-html if pre-existing systemId is specified ([0a38e0c](https://github.com/kapetacom/local-cluster-service/commit/0a38e0cb384a0954269c1b00ee1ef6660f979e42))
|
7
|
+
|
1
8
|
## [0.70.7](https://github.com/kapetacom/local-cluster-service/compare/v0.70.6...v0.70.7) (2024-09-12)
|
2
9
|
|
3
10
|
|
@@ -12,7 +12,8 @@ export declare class StormCodegen {
|
|
12
12
|
private readonly events;
|
13
13
|
private tmpDir;
|
14
14
|
private readonly conversationId;
|
15
|
-
|
15
|
+
private readonly uiSystemId?;
|
16
|
+
constructor(conversationId: string, userPrompt: string, blocks: BlockDefinitionInfo[], events: StormEvent[], uiSystemId?: string);
|
16
17
|
setTmpDir(tmpDir: string): void;
|
17
18
|
process(): Promise<void>;
|
18
19
|
isAborted(): boolean;
|
@@ -47,6 +47,7 @@ const yaml_1 = __importDefault(require("yaml"));
|
|
47
47
|
const predefined_1 = require("./predefined");
|
48
48
|
const archetype_1 = require("./archetype");
|
49
49
|
const lodash_1 = __importDefault(require("lodash"));
|
50
|
+
const page_utils_1 = require("./page-utils");
|
50
51
|
const SIMULATED_DELAY = 1000;
|
51
52
|
const ENABLE_SIMULATED_DELAY = false;
|
52
53
|
class SimulatedFileDelay {
|
@@ -100,12 +101,14 @@ class StormCodegen {
|
|
100
101
|
events;
|
101
102
|
tmpDir;
|
102
103
|
conversationId;
|
103
|
-
|
104
|
+
uiSystemId;
|
105
|
+
constructor(conversationId, userPrompt, blocks, events, uiSystemId) {
|
104
106
|
this.userPrompt = userPrompt;
|
105
107
|
this.blocks = blocks;
|
106
108
|
this.events = events;
|
107
109
|
this.tmpDir = path_2.default.join(node_os_1.default.tmpdir(), conversationId);
|
108
110
|
this.conversationId = conversationId;
|
111
|
+
this.uiSystemId = uiSystemId;
|
109
112
|
}
|
110
113
|
setTmpDir(tmpDir) {
|
111
114
|
this.tmpDir = tmpDir;
|
@@ -794,6 +797,9 @@ class StormCodegen {
|
|
794
797
|
const basePath = this.getBasePath(yamlContent.metadata.name);
|
795
798
|
const codeGenerator = new codegen_1.BlockCodeGenerator(yamlContent);
|
796
799
|
codeGenerator.withOption('AIContext', stormClient_1.STORM_ID);
|
800
|
+
if (this.uiSystemId) {
|
801
|
+
codeGenerator.withOption('AIStaticFiles', (0, page_utils_1.getSystemBaseDir)(this.uiSystemId));
|
802
|
+
}
|
797
803
|
const generatedResult = await codeGenerator.generate();
|
798
804
|
new codegen_1.CodeWriter(basePath).write(generatedResult);
|
799
805
|
return generatedResult;
|
@@ -26,6 +26,7 @@ export interface StormOptions {
|
|
26
26
|
serviceLanguage: string;
|
27
27
|
frontendKind: string;
|
28
28
|
frontendLanguage: string;
|
29
|
+
htmlLanguage: string;
|
29
30
|
exchangeKind: string;
|
30
31
|
queueKind: string;
|
31
32
|
publisherKind: string;
|
@@ -39,7 +40,8 @@ export interface StormOptions {
|
|
39
40
|
desktopKind: string;
|
40
41
|
desktopLanguage: string;
|
41
42
|
gatewayKind: string;
|
42
|
-
|
43
|
+
systemId?: string;
|
44
|
+
[key: string]: string | undefined;
|
43
45
|
}
|
44
46
|
export declare function createPhaseStartEvent(type: StormEventPhaseType): StormEventPhases;
|
45
47
|
export declare function createPhaseEndEvent(type: StormEventPhaseType): StormEventPhases;
|
@@ -67,6 +67,7 @@ async function resolveOptions() {
|
|
67
67
|
const javaLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-java-spring-boot');
|
68
68
|
const reactLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-react-ts');
|
69
69
|
const nodejsLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-nodejs');
|
70
|
+
const htmlLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-html');
|
70
71
|
const blockTypePubsub = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/block-type-pubsub');
|
71
72
|
const resourceTypePubsubSubscriber = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/resource-type-pubsub-subscriber');
|
72
73
|
const resourceTypePubsubSubscription = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/resource-type-pubsub-subscription');
|
@@ -83,6 +84,7 @@ async function resolveOptions() {
|
|
83
84
|
!postgresResource ||
|
84
85
|
!javaLanguage ||
|
85
86
|
!reactLanguage ||
|
87
|
+
!htmlLanguage ||
|
86
88
|
!webPageResource ||
|
87
89
|
!restApiResource ||
|
88
90
|
!restClientResource ||
|
@@ -105,6 +107,7 @@ async function resolveOptions() {
|
|
105
107
|
serviceLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${javaLanguage.definition.metadata.name}:${javaLanguage.version}`),
|
106
108
|
frontendKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeFrontend.definition.metadata.name}:${blockTypeFrontend.version}`),
|
107
109
|
frontendLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${reactLanguage.definition.metadata.name}:${reactLanguage.version}`),
|
110
|
+
htmlLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${htmlLanguage.definition.metadata.name}:${htmlLanguage.version}`),
|
108
111
|
cliKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeCli.definition.metadata.name}:${blockTypeCli.version}`),
|
109
112
|
cliLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${nodejsLanguage.definition.metadata.name}:${nodejsLanguage.version}`),
|
110
113
|
desktopKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeDesktop.definition.metadata.name}:${blockTypeDesktop.version}`),
|
@@ -770,7 +773,7 @@ class StormEventParser {
|
|
770
773
|
case 'CLI':
|
771
774
|
return this.options.cliLanguage;
|
772
775
|
case 'FRONTEND':
|
773
|
-
return this.options.frontendLanguage;
|
776
|
+
return this.options.systemId ? this.options.htmlLanguage : this.options.frontendLanguage;
|
774
777
|
case 'DESKTOP':
|
775
778
|
return this.options.desktopLanguage;
|
776
779
|
}
|
@@ -791,7 +794,7 @@ class StormEventParser {
|
|
791
794
|
for (const prop in options) {
|
792
795
|
if (options.hasOwnProperty(prop)) {
|
793
796
|
const value = options[prop];
|
794
|
-
if (value.indexOf(kind) > 0) {
|
797
|
+
if (typeof value === 'string' && value.indexOf(kind) > 0) {
|
795
798
|
return value;
|
796
799
|
}
|
797
800
|
}
|
@@ -501,8 +501,9 @@ router.post('/ui/get-vote', async (req, res) => {
|
|
501
501
|
});
|
502
502
|
router.post('/:handle/all', async (req, res) => {
|
503
503
|
const handle = req.params.handle;
|
504
|
+
const systemId = req.query.systemId ?? undefined;
|
504
505
|
try {
|
505
|
-
const stormOptions = await (0, event_parser_1.resolveOptions)();
|
506
|
+
const stormOptions = { ...(await (0, event_parser_1.resolveOptions)()), systemId: systemId };
|
506
507
|
const eventParser = new event_parser_1.StormEventParser(stormOptions);
|
507
508
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
508
509
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
@@ -571,7 +572,7 @@ router.post('/:handle/all', async (req, res) => {
|
|
571
572
|
if (!req.query.skipCodegen) {
|
572
573
|
try {
|
573
574
|
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.IMPLEMENTATION));
|
574
|
-
const stormCodegen = new codegen_1.StormCodegen(metaStream.getConversationId(), aiRequest.prompt, result.blocks, eventParser.getEvents());
|
575
|
+
const stormCodegen = new codegen_1.StormCodegen(metaStream.getConversationId(), aiRequest.prompt, result.blocks, eventParser.getEvents(), systemId);
|
575
576
|
onRequestAborted(req, res, () => {
|
576
577
|
stormCodegen.abort();
|
577
578
|
});
|
@@ -19,6 +19,7 @@ exports.parserOptions = {
|
|
19
19
|
serviceLanguage: 'kapeta/language-target-java-spring-boot:local',
|
20
20
|
frontendKind: 'kapeta/block-type-frontend:local',
|
21
21
|
frontendLanguage: 'kapeta/language-target-react-ts:local',
|
22
|
+
htmlLanguage: 'kapeta/language-target-html:local',
|
22
23
|
cliKind: 'kapeta/block-type-cli:local',
|
23
24
|
cliLanguage: 'kapeta/language-target-nodejs-ts:local',
|
24
25
|
desktopKind: 'kapeta/block-type-desktop:local',
|
@@ -12,7 +12,8 @@ export declare class StormCodegen {
|
|
12
12
|
private readonly events;
|
13
13
|
private tmpDir;
|
14
14
|
private readonly conversationId;
|
15
|
-
|
15
|
+
private readonly uiSystemId?;
|
16
|
+
constructor(conversationId: string, userPrompt: string, blocks: BlockDefinitionInfo[], events: StormEvent[], uiSystemId?: string);
|
16
17
|
setTmpDir(tmpDir: string): void;
|
17
18
|
process(): Promise<void>;
|
18
19
|
isAborted(): boolean;
|
@@ -47,6 +47,7 @@ const yaml_1 = __importDefault(require("yaml"));
|
|
47
47
|
const predefined_1 = require("./predefined");
|
48
48
|
const archetype_1 = require("./archetype");
|
49
49
|
const lodash_1 = __importDefault(require("lodash"));
|
50
|
+
const page_utils_1 = require("./page-utils");
|
50
51
|
const SIMULATED_DELAY = 1000;
|
51
52
|
const ENABLE_SIMULATED_DELAY = false;
|
52
53
|
class SimulatedFileDelay {
|
@@ -100,12 +101,14 @@ class StormCodegen {
|
|
100
101
|
events;
|
101
102
|
tmpDir;
|
102
103
|
conversationId;
|
103
|
-
|
104
|
+
uiSystemId;
|
105
|
+
constructor(conversationId, userPrompt, blocks, events, uiSystemId) {
|
104
106
|
this.userPrompt = userPrompt;
|
105
107
|
this.blocks = blocks;
|
106
108
|
this.events = events;
|
107
109
|
this.tmpDir = path_2.default.join(node_os_1.default.tmpdir(), conversationId);
|
108
110
|
this.conversationId = conversationId;
|
111
|
+
this.uiSystemId = uiSystemId;
|
109
112
|
}
|
110
113
|
setTmpDir(tmpDir) {
|
111
114
|
this.tmpDir = tmpDir;
|
@@ -794,6 +797,9 @@ class StormCodegen {
|
|
794
797
|
const basePath = this.getBasePath(yamlContent.metadata.name);
|
795
798
|
const codeGenerator = new codegen_1.BlockCodeGenerator(yamlContent);
|
796
799
|
codeGenerator.withOption('AIContext', stormClient_1.STORM_ID);
|
800
|
+
if (this.uiSystemId) {
|
801
|
+
codeGenerator.withOption('AIStaticFiles', (0, page_utils_1.getSystemBaseDir)(this.uiSystemId));
|
802
|
+
}
|
797
803
|
const generatedResult = await codeGenerator.generate();
|
798
804
|
new codegen_1.CodeWriter(basePath).write(generatedResult);
|
799
805
|
return generatedResult;
|
@@ -26,6 +26,7 @@ export interface StormOptions {
|
|
26
26
|
serviceLanguage: string;
|
27
27
|
frontendKind: string;
|
28
28
|
frontendLanguage: string;
|
29
|
+
htmlLanguage: string;
|
29
30
|
exchangeKind: string;
|
30
31
|
queueKind: string;
|
31
32
|
publisherKind: string;
|
@@ -39,7 +40,8 @@ export interface StormOptions {
|
|
39
40
|
desktopKind: string;
|
40
41
|
desktopLanguage: string;
|
41
42
|
gatewayKind: string;
|
42
|
-
|
43
|
+
systemId?: string;
|
44
|
+
[key: string]: string | undefined;
|
43
45
|
}
|
44
46
|
export declare function createPhaseStartEvent(type: StormEventPhaseType): StormEventPhases;
|
45
47
|
export declare function createPhaseEndEvent(type: StormEventPhaseType): StormEventPhases;
|
@@ -67,6 +67,7 @@ async function resolveOptions() {
|
|
67
67
|
const javaLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-java-spring-boot');
|
68
68
|
const reactLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-react-ts');
|
69
69
|
const nodejsLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-nodejs');
|
70
|
+
const htmlLanguage = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/language-target-html');
|
70
71
|
const blockTypePubsub = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/block-type-pubsub');
|
71
72
|
const resourceTypePubsubSubscriber = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/resource-type-pubsub-subscriber');
|
72
73
|
const resourceTypePubsubSubscription = await definitionsManager_1.definitionsManager.getLatestDefinition('kapeta/resource-type-pubsub-subscription');
|
@@ -83,6 +84,7 @@ async function resolveOptions() {
|
|
83
84
|
!postgresResource ||
|
84
85
|
!javaLanguage ||
|
85
86
|
!reactLanguage ||
|
87
|
+
!htmlLanguage ||
|
86
88
|
!webPageResource ||
|
87
89
|
!restApiResource ||
|
88
90
|
!restClientResource ||
|
@@ -105,6 +107,7 @@ async function resolveOptions() {
|
|
105
107
|
serviceLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${javaLanguage.definition.metadata.name}:${javaLanguage.version}`),
|
106
108
|
frontendKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeFrontend.definition.metadata.name}:${blockTypeFrontend.version}`),
|
107
109
|
frontendLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${reactLanguage.definition.metadata.name}:${reactLanguage.version}`),
|
110
|
+
htmlLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${htmlLanguage.definition.metadata.name}:${htmlLanguage.version}`),
|
108
111
|
cliKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeCli.definition.metadata.name}:${blockTypeCli.version}`),
|
109
112
|
cliLanguage: (0, nodejs_utils_1.normalizeKapetaUri)(`${nodejsLanguage.definition.metadata.name}:${nodejsLanguage.version}`),
|
110
113
|
desktopKind: (0, nodejs_utils_1.normalizeKapetaUri)(`${blockTypeDesktop.definition.metadata.name}:${blockTypeDesktop.version}`),
|
@@ -770,7 +773,7 @@ class StormEventParser {
|
|
770
773
|
case 'CLI':
|
771
774
|
return this.options.cliLanguage;
|
772
775
|
case 'FRONTEND':
|
773
|
-
return this.options.frontendLanguage;
|
776
|
+
return this.options.systemId ? this.options.htmlLanguage : this.options.frontendLanguage;
|
774
777
|
case 'DESKTOP':
|
775
778
|
return this.options.desktopLanguage;
|
776
779
|
}
|
@@ -791,7 +794,7 @@ class StormEventParser {
|
|
791
794
|
for (const prop in options) {
|
792
795
|
if (options.hasOwnProperty(prop)) {
|
793
796
|
const value = options[prop];
|
794
|
-
if (value.indexOf(kind) > 0) {
|
797
|
+
if (typeof value === 'string' && value.indexOf(kind) > 0) {
|
795
798
|
return value;
|
796
799
|
}
|
797
800
|
}
|
@@ -501,8 +501,9 @@ router.post('/ui/get-vote', async (req, res) => {
|
|
501
501
|
});
|
502
502
|
router.post('/:handle/all', async (req, res) => {
|
503
503
|
const handle = req.params.handle;
|
504
|
+
const systemId = req.query.systemId ?? undefined;
|
504
505
|
try {
|
505
|
-
const stormOptions = await (0, event_parser_1.resolveOptions)();
|
506
|
+
const stormOptions = { ...(await (0, event_parser_1.resolveOptions)()), systemId: systemId };
|
506
507
|
const eventParser = new event_parser_1.StormEventParser(stormOptions);
|
507
508
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
508
509
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
@@ -571,7 +572,7 @@ router.post('/:handle/all', async (req, res) => {
|
|
571
572
|
if (!req.query.skipCodegen) {
|
572
573
|
try {
|
573
574
|
sendEvent(res, (0, event_parser_1.createPhaseStartEvent)(events_1.StormEventPhaseType.IMPLEMENTATION));
|
574
|
-
const stormCodegen = new codegen_1.StormCodegen(metaStream.getConversationId(), aiRequest.prompt, result.blocks, eventParser.getEvents());
|
575
|
+
const stormCodegen = new codegen_1.StormCodegen(metaStream.getConversationId(), aiRequest.prompt, result.blocks, eventParser.getEvents(), systemId);
|
575
576
|
onRequestAborted(req, res, () => {
|
576
577
|
stormCodegen.abort();
|
577
578
|
});
|
@@ -19,6 +19,7 @@ exports.parserOptions = {
|
|
19
19
|
serviceLanguage: 'kapeta/language-target-java-spring-boot:local',
|
20
20
|
frontendKind: 'kapeta/block-type-frontend:local',
|
21
21
|
frontendLanguage: 'kapeta/language-target-react-ts:local',
|
22
|
+
htmlLanguage: 'kapeta/language-target-html:local',
|
22
23
|
cliKind: 'kapeta/block-type-cli:local',
|
23
24
|
cliLanguage: 'kapeta/language-target-nodejs-ts:local',
|
24
25
|
desktopKind: 'kapeta/block-type-desktop:local',
|
package/package.json
CHANGED
package/src/storm/codegen.ts
CHANGED
@@ -39,6 +39,7 @@ import YAML from 'yaml';
|
|
39
39
|
import { PREDEFINED_BLOCKS } from './predefined';
|
40
40
|
import { Archetype } from './archetype';
|
41
41
|
import _ from 'lodash';
|
42
|
+
import { getSystemBaseDir } from './page-utils';
|
42
43
|
|
43
44
|
type ImplementationGenerator<T = StormFileImplementationPrompt> = (
|
44
45
|
prompt: T,
|
@@ -108,13 +109,21 @@ export class StormCodegen {
|
|
108
109
|
private readonly events: StormEvent[];
|
109
110
|
private tmpDir: string;
|
110
111
|
private readonly conversationId: string;
|
111
|
-
|
112
|
-
|
112
|
+
private readonly uiSystemId?: string;
|
113
|
+
|
114
|
+
constructor(
|
115
|
+
conversationId: string,
|
116
|
+
userPrompt: string,
|
117
|
+
blocks: BlockDefinitionInfo[],
|
118
|
+
events: StormEvent[],
|
119
|
+
uiSystemId?: string
|
120
|
+
) {
|
113
121
|
this.userPrompt = userPrompt;
|
114
122
|
this.blocks = blocks;
|
115
123
|
this.events = events;
|
116
124
|
this.tmpDir = Path.join(os.tmpdir(), conversationId);
|
117
125
|
this.conversationId = conversationId;
|
126
|
+
this.uiSystemId = uiSystemId;
|
118
127
|
}
|
119
128
|
|
120
129
|
public setTmpDir(tmpDir: string) {
|
@@ -488,7 +497,6 @@ export class StormCodegen {
|
|
488
497
|
await writeFile(filePath, webRouterFile.content);
|
489
498
|
}
|
490
499
|
|
491
|
-
|
492
500
|
const blockRef = block.uri;
|
493
501
|
|
494
502
|
this.emitBlockStatus(blockUri, block.aiName, StormEventBlockStatusType.QA);
|
@@ -1009,6 +1017,11 @@ export class StormCodegen {
|
|
1009
1017
|
|
1010
1018
|
const codeGenerator = new BlockCodeGenerator(yamlContent as BlockDefinition);
|
1011
1019
|
codeGenerator.withOption('AIContext', STORM_ID);
|
1020
|
+
|
1021
|
+
if (this.uiSystemId) {
|
1022
|
+
codeGenerator.withOption('AIStaticFiles', getSystemBaseDir(this.uiSystemId));
|
1023
|
+
}
|
1024
|
+
|
1012
1025
|
const generatedResult = await codeGenerator.generate();
|
1013
1026
|
new CodeWriter(basePath).write(generatedResult);
|
1014
1027
|
return generatedResult;
|
@@ -67,6 +67,7 @@ export interface StormOptions {
|
|
67
67
|
serviceLanguage: string;
|
68
68
|
frontendKind: string;
|
69
69
|
frontendLanguage: string;
|
70
|
+
htmlLanguage: string;
|
70
71
|
exchangeKind: string;
|
71
72
|
queueKind: string;
|
72
73
|
publisherKind: string;
|
@@ -80,7 +81,10 @@ export interface StormOptions {
|
|
80
81
|
desktopKind: string;
|
81
82
|
desktopLanguage: string;
|
82
83
|
gatewayKind: string;
|
83
|
-
|
84
|
+
|
85
|
+
systemId?: string;
|
86
|
+
|
87
|
+
[key: string]: string | undefined;
|
84
88
|
}
|
85
89
|
|
86
90
|
function prettifyKaplang(source: string) {
|
@@ -143,6 +147,7 @@ export async function resolveOptions(): Promise<StormOptions> {
|
|
143
147
|
const javaLanguage = await definitionsManager.getLatestDefinition('kapeta/language-target-java-spring-boot');
|
144
148
|
const reactLanguage = await definitionsManager.getLatestDefinition('kapeta/language-target-react-ts');
|
145
149
|
const nodejsLanguage = await definitionsManager.getLatestDefinition('kapeta/language-target-nodejs');
|
150
|
+
const htmlLanguage = await definitionsManager.getLatestDefinition('kapeta/language-target-html');
|
146
151
|
|
147
152
|
const blockTypePubsub = await definitionsManager.getLatestDefinition('kapeta/block-type-pubsub');
|
148
153
|
const resourceTypePubsubSubscriber = await definitionsManager.getLatestDefinition(
|
@@ -170,6 +175,7 @@ export async function resolveOptions(): Promise<StormOptions> {
|
|
170
175
|
!postgresResource ||
|
171
176
|
!javaLanguage ||
|
172
177
|
!reactLanguage ||
|
178
|
+
!htmlLanguage ||
|
173
179
|
!webPageResource ||
|
174
180
|
!restApiResource ||
|
175
181
|
!restClientResource ||
|
@@ -195,6 +201,7 @@ export async function resolveOptions(): Promise<StormOptions> {
|
|
195
201
|
|
196
202
|
frontendKind: normalizeKapetaUri(`${blockTypeFrontend.definition.metadata.name}:${blockTypeFrontend.version}`),
|
197
203
|
frontendLanguage: normalizeKapetaUri(`${reactLanguage.definition.metadata.name}:${reactLanguage.version}`),
|
204
|
+
htmlLanguage: normalizeKapetaUri(`${htmlLanguage.definition.metadata.name}:${htmlLanguage.version}`),
|
198
205
|
|
199
206
|
cliKind: normalizeKapetaUri(`${blockTypeCli.definition.metadata.name}:${blockTypeCli.version}`),
|
200
207
|
cliLanguage: normalizeKapetaUri(`${nodejsLanguage.definition.metadata.name}:${nodejsLanguage.version}`),
|
@@ -997,7 +1004,7 @@ export class StormEventParser {
|
|
997
1004
|
case 'CLI':
|
998
1005
|
return this.options.cliLanguage;
|
999
1006
|
case 'FRONTEND':
|
1000
|
-
return this.options.frontendLanguage;
|
1007
|
+
return this.options.systemId ? this.options.htmlLanguage : this.options.frontendLanguage;
|
1001
1008
|
case 'DESKTOP':
|
1002
1009
|
return this.options.desktopLanguage;
|
1003
1010
|
}
|
@@ -1027,7 +1034,7 @@ export class StormEventParser {
|
|
1027
1034
|
for (const prop in options) {
|
1028
1035
|
if (options.hasOwnProperty(prop)) {
|
1029
1036
|
const value = options[prop];
|
1030
|
-
if (value.indexOf(kind) > 0) {
|
1037
|
+
if (typeof value === 'string' && value.indexOf(kind) > 0) {
|
1031
1038
|
return value;
|
1032
1039
|
}
|
1033
1040
|
}
|
package/src/storm/routes.ts
CHANGED
@@ -614,9 +614,10 @@ router.post('/ui/get-vote', async (req: KapetaBodyRequest, res: Response) => {
|
|
614
614
|
|
615
615
|
router.post('/:handle/all', async (req: KapetaBodyRequest, res: Response) => {
|
616
616
|
const handle = req.params.handle as string;
|
617
|
+
const systemId = (req.query.systemId as string) ?? undefined;
|
617
618
|
|
618
619
|
try {
|
619
|
-
const stormOptions = await resolveOptions();
|
620
|
+
const stormOptions = { ...(await resolveOptions()), systemId: systemId };
|
620
621
|
|
621
622
|
const eventParser = new StormEventParser(stormOptions);
|
622
623
|
|
@@ -703,7 +704,8 @@ router.post('/:handle/all', async (req: KapetaBodyRequest, res: Response) => {
|
|
703
704
|
metaStream.getConversationId(),
|
704
705
|
aiRequest.prompt,
|
705
706
|
result.blocks,
|
706
|
-
eventParser.getEvents()
|
707
|
+
eventParser.getEvents(),
|
708
|
+
systemId
|
707
709
|
);
|
708
710
|
|
709
711
|
onRequestAborted(req, res, () => {
|
@@ -17,6 +17,7 @@ export const parserOptions = {
|
|
17
17
|
|
18
18
|
frontendKind: 'kapeta/block-type-frontend:local',
|
19
19
|
frontendLanguage: 'kapeta/language-target-react-ts:local',
|
20
|
+
htmlLanguage: 'kapeta/language-target-html:local',
|
20
21
|
|
21
22
|
cliKind: 'kapeta/block-type-cli:local',
|
22
23
|
cliLanguage: 'kapeta/language-target-nodejs-ts:local',
|