@specverse/engines 4.1.5 → 4.1.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/dist/libs/instance-factories/applications/templates/generic/backend-env-generator.js +22 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +66 -0
- package/dist/libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.js +54 -0
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +290 -0
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +530 -0
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +437 -0
- package/dist/libs/instance-factories/applications/templates/react/api-types-generator.js +146 -0
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +73 -0
- package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +18 -0
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +99 -0
- package/dist/libs/instance-factories/applications/templates/react/gitignore-generator.js +35 -0
- package/dist/libs/instance-factories/applications/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/applications/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/applications/templates/react/main-tsx-generator.js +29 -0
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +49 -0
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +156 -0
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +935 -0
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.js +101 -0
- package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +50 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +646 -0
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +65 -0
- package/dist/libs/instance-factories/applications/templates/react/tsconfig-generator.js +28 -0
- package/dist/libs/instance-factories/applications/templates/react/use-api-hooks-generator.js +132 -0
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +143 -0
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +355 -0
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +91 -0
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +79 -0
- package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +42 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-bin-wrapper-generator.js +11 -0
- package/dist/libs/instance-factories/cli/templates/commander/cli-entry-generator.js +111 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +928 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/bus-generator.js +83 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/publisher-generator.js +91 -0
- package/dist/libs/instance-factories/communication/templates/eventemitter/subscriber-generator.js +86 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/meta-routes-generator.js +93 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +280 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +125 -0
- package/dist/libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.js +25 -0
- package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +371 -0
- package/dist/libs/instance-factories/orms/templates/prisma/services-generator.js +266 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-example-generator.js +51 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/env-generator.js +61 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/gitignore-generator.js +59 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/package-json-generator.js +126 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/readme-generator.js +159 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-generator.js +56 -0
- package/dist/libs/instance-factories/scaffolding/templates/generic/tsconfig-react-generator.js +37 -0
- package/dist/libs/instance-factories/sdks/templates/python/sdk-generator.js +29 -0
- package/dist/libs/instance-factories/sdks/templates/typescript/sdk-generator.js +28 -0
- package/dist/libs/instance-factories/services/templates/memory/generate-interpreter.js +14 -0
- package/dist/libs/instance-factories/services/templates/memory/step-conventions-memory.js +415 -0
- package/dist/libs/instance-factories/services/templates/prisma/behavior-generator.js +177 -0
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +413 -0
- package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +243 -0
- package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +264 -0
- package/dist/libs/instance-factories/services/templates/shared-patterns.js +24 -0
- package/dist/libs/instance-factories/shared/path-resolver.js +59 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/config-generator.js +13 -0
- package/dist/libs/instance-factories/storage/templates/mongodb/docker-generator.js +16 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/config-generator.js +45 -0
- package/dist/libs/instance-factories/storage/templates/postgresql/docker-generator.js +46 -0
- package/dist/libs/instance-factories/storage/templates/redis/config-generator.js +14 -0
- package/dist/libs/instance-factories/storage/templates/redis/docker-generator.js +16 -0
- package/dist/libs/instance-factories/test-generation.js +145 -0
- package/dist/libs/instance-factories/testing/templates/vitest/tests-generator.js +30 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +149 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/controllers/MCPServerController.js +232 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/events/EventEmitter.js +49 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/index.js +18 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/interfaces/ResourceProvider.js +0 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/LibrarySuggestion.js +97 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/models/SpecVerseResource.js +64 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/server/mcp-server.js +182 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/CLIProxyService.js +1210 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EmbeddedResourcesAdapter.js +172 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/EntityModuleService.js +240 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/HybridResourcesProvider.js +147 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/LibraryToolsService.js +281 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorBridge.js +409 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/OrchestratorToolsService.js +414 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/PromptToolsService.js +467 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/services/ResourcesProviderService.js +135 -0
- package/dist/libs/instance-factories/tools/templates/mcp/static/src/types/index.js +0 -0
- package/dist/libs/instance-factories/tools/templates/vscode/static/extension.js +965 -0
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js +238 -0
- package/dist/libs/instance-factories/validation/templates/zod/validation-generator.js +25 -0
- package/dist/libs/instance-factories/views/index.js +48 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +742 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +824 -0
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +719 -0
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +45 -0
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +779 -0
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +285 -0
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +46 -0
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +111 -0
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +9 -0
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +23 -0
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +21 -0
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +299 -0
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +136 -0
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +107 -0
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +179 -0
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +7 -0
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +56 -0
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +27 -0
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +29 -0
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +261 -0
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +34 -0
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +800 -0
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +305 -0
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +517 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +445 -0
- package/dist/libs/instance-factories/views/templates/shared/index.js +80 -0
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +210 -0
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +492 -0
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +321 -0
- package/package.json +3 -2
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
class OrchestratorToolsService {
|
|
2
|
+
orchestratorBridge;
|
|
3
|
+
eventEmitter;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.orchestratorBridge = config.orchestratorBridge;
|
|
6
|
+
this.eventEmitter = config.eventEmitter;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Analyze existing codebase and extract SpecVerse specifications
|
|
10
|
+
*/
|
|
11
|
+
async analyseCodebase(params) {
|
|
12
|
+
this.eventEmitter.emit("tool-called", {
|
|
13
|
+
toolName: "analyse_codebase",
|
|
14
|
+
arguments: params,
|
|
15
|
+
executionTime: 0
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
const context = {
|
|
19
|
+
operation: "analyse",
|
|
20
|
+
inputPath: params.codePath,
|
|
21
|
+
inputType: "code",
|
|
22
|
+
outputPath: params.outputPath,
|
|
23
|
+
framework: params.framework,
|
|
24
|
+
interactive: params.interactive || false
|
|
25
|
+
};
|
|
26
|
+
const result = await this.orchestratorBridge.execute(context);
|
|
27
|
+
if (result.success) {
|
|
28
|
+
const response = {
|
|
29
|
+
operation: "analyse",
|
|
30
|
+
success: true,
|
|
31
|
+
result: result.content,
|
|
32
|
+
metadata: {
|
|
33
|
+
codePath: params.codePath,
|
|
34
|
+
framework: params.framework || "auto-detected",
|
|
35
|
+
outputPath: params.outputPath,
|
|
36
|
+
executionTime: result.executionTime,
|
|
37
|
+
provider: result.provider,
|
|
38
|
+
sessionId: result.sessionId
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (result.sessionId) {
|
|
42
|
+
response.metadata.sessionId = result.sessionId;
|
|
43
|
+
}
|
|
44
|
+
return JSON.stringify(response, null, 2);
|
|
45
|
+
} else {
|
|
46
|
+
const errorResponse = {
|
|
47
|
+
operation: "analyse",
|
|
48
|
+
success: false,
|
|
49
|
+
error: result.error,
|
|
50
|
+
metadata: {
|
|
51
|
+
codePath: params.codePath,
|
|
52
|
+
executionTime: result.executionTime
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
59
|
+
this.eventEmitter.emit("error-occurred", {
|
|
60
|
+
operation: "analyse_codebase",
|
|
61
|
+
error: errorMessage,
|
|
62
|
+
context: params
|
|
63
|
+
});
|
|
64
|
+
const errorResponse = {
|
|
65
|
+
operation: "analyse",
|
|
66
|
+
success: false,
|
|
67
|
+
error: errorMessage,
|
|
68
|
+
metadata: {
|
|
69
|
+
codePath: params.codePath
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create SpecVerse specifications from natural language requirements
|
|
77
|
+
*/
|
|
78
|
+
async createSpecification(params) {
|
|
79
|
+
this.eventEmitter.emit("tool-called", {
|
|
80
|
+
toolName: "create_specification",
|
|
81
|
+
arguments: params,
|
|
82
|
+
executionTime: 0
|
|
83
|
+
});
|
|
84
|
+
try {
|
|
85
|
+
const context = {
|
|
86
|
+
operation: "create",
|
|
87
|
+
input: params.requirements,
|
|
88
|
+
inputType: "requirements",
|
|
89
|
+
outputPath: params.outputPath,
|
|
90
|
+
framework: params.framework,
|
|
91
|
+
scale: params.scale || "business",
|
|
92
|
+
interactive: params.interactive || false
|
|
93
|
+
};
|
|
94
|
+
const result = await this.orchestratorBridge.execute(context);
|
|
95
|
+
if (result.success) {
|
|
96
|
+
const response = {
|
|
97
|
+
operation: "create",
|
|
98
|
+
success: true,
|
|
99
|
+
result: result.content,
|
|
100
|
+
metadata: {
|
|
101
|
+
requirements: params.requirements,
|
|
102
|
+
scale: params.scale || "business",
|
|
103
|
+
framework: params.framework,
|
|
104
|
+
outputPath: params.outputPath,
|
|
105
|
+
executionTime: result.executionTime,
|
|
106
|
+
provider: result.provider,
|
|
107
|
+
sessionId: result.sessionId
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return JSON.stringify(response, null, 2);
|
|
111
|
+
} else {
|
|
112
|
+
const errorResponse = {
|
|
113
|
+
operation: "create",
|
|
114
|
+
success: false,
|
|
115
|
+
error: result.error,
|
|
116
|
+
metadata: {
|
|
117
|
+
requirements: params.requirements,
|
|
118
|
+
executionTime: result.executionTime
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
125
|
+
this.eventEmitter.emit("error-occurred", {
|
|
126
|
+
operation: "create_specification",
|
|
127
|
+
error: errorMessage,
|
|
128
|
+
context: params
|
|
129
|
+
});
|
|
130
|
+
const errorResponse = {
|
|
131
|
+
operation: "create",
|
|
132
|
+
success: false,
|
|
133
|
+
error: errorMessage,
|
|
134
|
+
metadata: {
|
|
135
|
+
requirements: params.requirements
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Infer expanded specifications using AI inference engine
|
|
143
|
+
*/
|
|
144
|
+
async inferSpecification(params) {
|
|
145
|
+
this.eventEmitter.emit("tool-called", {
|
|
146
|
+
toolName: "infer_specification",
|
|
147
|
+
arguments: params,
|
|
148
|
+
executionTime: 0
|
|
149
|
+
});
|
|
150
|
+
try {
|
|
151
|
+
const capabilities = this.orchestratorBridge.getCapabilities();
|
|
152
|
+
if (!capabilities.inferenceEngine) {
|
|
153
|
+
const fallbackResponse = {
|
|
154
|
+
operation: "infer",
|
|
155
|
+
success: false,
|
|
156
|
+
error: "Inference operation requires full SpecVerse orchestrator with inference engine",
|
|
157
|
+
suggestion: "Use get_creation_prompt or get_analysis_prompt tools for AI-assisted specification development",
|
|
158
|
+
metadata: {
|
|
159
|
+
specificationPath: params.specificationPath,
|
|
160
|
+
availableCapabilities: capabilities
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return JSON.stringify(fallbackResponse, null, 2);
|
|
164
|
+
}
|
|
165
|
+
const context = {
|
|
166
|
+
operation: "infer",
|
|
167
|
+
inputPath: params.specificationPath,
|
|
168
|
+
inputType: "specification",
|
|
169
|
+
outputPath: params.outputPath,
|
|
170
|
+
framework: params.framework
|
|
171
|
+
};
|
|
172
|
+
const result = await this.orchestratorBridge.execute(context);
|
|
173
|
+
if (result.success) {
|
|
174
|
+
const response = {
|
|
175
|
+
operation: "infer",
|
|
176
|
+
success: true,
|
|
177
|
+
result: result.content,
|
|
178
|
+
metadata: {
|
|
179
|
+
specificationPath: params.specificationPath,
|
|
180
|
+
outputPath: params.outputPath,
|
|
181
|
+
framework: params.framework,
|
|
182
|
+
executionTime: result.executionTime,
|
|
183
|
+
inferenceRules: result.metadata?.inferenceRules,
|
|
184
|
+
provider: result.provider
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
return JSON.stringify(response, null, 2);
|
|
188
|
+
} else {
|
|
189
|
+
const errorResponse = {
|
|
190
|
+
operation: "infer",
|
|
191
|
+
success: false,
|
|
192
|
+
error: result.error,
|
|
193
|
+
metadata: {
|
|
194
|
+
specificationPath: params.specificationPath,
|
|
195
|
+
executionTime: result.executionTime
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
199
|
+
}
|
|
200
|
+
} catch (error) {
|
|
201
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
202
|
+
this.eventEmitter.emit("error-occurred", {
|
|
203
|
+
operation: "infer_specification",
|
|
204
|
+
error: errorMessage,
|
|
205
|
+
context: params
|
|
206
|
+
});
|
|
207
|
+
const errorResponse = {
|
|
208
|
+
operation: "infer",
|
|
209
|
+
success: false,
|
|
210
|
+
error: errorMessage,
|
|
211
|
+
metadata: {
|
|
212
|
+
specificationPath: params.specificationPath
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Materialize clean implementation from specifications
|
|
220
|
+
*/
|
|
221
|
+
async materialiseImplementation(params) {
|
|
222
|
+
this.eventEmitter.emit("tool-called", {
|
|
223
|
+
toolName: "materialise_implementation",
|
|
224
|
+
arguments: params,
|
|
225
|
+
executionTime: 0
|
|
226
|
+
});
|
|
227
|
+
try {
|
|
228
|
+
const context = {
|
|
229
|
+
operation: "materialise",
|
|
230
|
+
inputPath: params.specificationPath,
|
|
231
|
+
inputType: "specification",
|
|
232
|
+
outputPath: params.outputPath,
|
|
233
|
+
framework: params.framework,
|
|
234
|
+
scale: params.scale || "business",
|
|
235
|
+
interactive: params.interactive || false
|
|
236
|
+
};
|
|
237
|
+
const result = await this.orchestratorBridge.execute(context);
|
|
238
|
+
if (result.success) {
|
|
239
|
+
const response = {
|
|
240
|
+
operation: "materialise",
|
|
241
|
+
success: true,
|
|
242
|
+
result: result.content,
|
|
243
|
+
metadata: {
|
|
244
|
+
specificationPath: params.specificationPath,
|
|
245
|
+
framework: params.framework,
|
|
246
|
+
scale: params.scale || "business",
|
|
247
|
+
outputPath: params.outputPath,
|
|
248
|
+
executionTime: result.executionTime,
|
|
249
|
+
provider: result.provider,
|
|
250
|
+
sessionId: result.sessionId
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
return JSON.stringify(response, null, 2);
|
|
254
|
+
} else {
|
|
255
|
+
const errorResponse = {
|
|
256
|
+
operation: "materialise",
|
|
257
|
+
success: false,
|
|
258
|
+
error: result.error,
|
|
259
|
+
metadata: {
|
|
260
|
+
specificationPath: params.specificationPath,
|
|
261
|
+
framework: params.framework,
|
|
262
|
+
executionTime: result.executionTime
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
266
|
+
}
|
|
267
|
+
} catch (error) {
|
|
268
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
269
|
+
this.eventEmitter.emit("error-occurred", {
|
|
270
|
+
operation: "materialise_implementation",
|
|
271
|
+
error: errorMessage,
|
|
272
|
+
context: params
|
|
273
|
+
});
|
|
274
|
+
const errorResponse = {
|
|
275
|
+
operation: "materialise",
|
|
276
|
+
success: false,
|
|
277
|
+
error: errorMessage,
|
|
278
|
+
metadata: {
|
|
279
|
+
specificationPath: params.specificationPath,
|
|
280
|
+
framework: params.framework
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Realize complete application from specifications
|
|
288
|
+
*/
|
|
289
|
+
async realizeApplication(params) {
|
|
290
|
+
this.eventEmitter.emit("tool-called", {
|
|
291
|
+
toolName: "realize_application",
|
|
292
|
+
arguments: params,
|
|
293
|
+
executionTime: 0
|
|
294
|
+
});
|
|
295
|
+
try {
|
|
296
|
+
const context = {
|
|
297
|
+
operation: "realize",
|
|
298
|
+
inputPath: params.specificationPath,
|
|
299
|
+
inputType: "specification",
|
|
300
|
+
outputPath: params.outputPath,
|
|
301
|
+
framework: params.framework,
|
|
302
|
+
scale: params.scale || "business",
|
|
303
|
+
interactive: params.interactive || false
|
|
304
|
+
};
|
|
305
|
+
const result = await this.orchestratorBridge.execute(context);
|
|
306
|
+
if (result.success) {
|
|
307
|
+
const response = {
|
|
308
|
+
operation: "realize",
|
|
309
|
+
success: true,
|
|
310
|
+
result: result.content,
|
|
311
|
+
metadata: {
|
|
312
|
+
specificationPath: params.specificationPath,
|
|
313
|
+
framework: params.framework,
|
|
314
|
+
scale: params.scale || "business",
|
|
315
|
+
outputPath: params.outputPath,
|
|
316
|
+
executionTime: result.executionTime,
|
|
317
|
+
provider: result.provider,
|
|
318
|
+
sessionId: result.sessionId
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
return JSON.stringify(response, null, 2);
|
|
322
|
+
} else {
|
|
323
|
+
const errorResponse = {
|
|
324
|
+
operation: "realize",
|
|
325
|
+
success: false,
|
|
326
|
+
error: result.error,
|
|
327
|
+
metadata: {
|
|
328
|
+
specificationPath: params.specificationPath,
|
|
329
|
+
framework: params.framework,
|
|
330
|
+
executionTime: result.executionTime
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
334
|
+
}
|
|
335
|
+
} catch (error) {
|
|
336
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
337
|
+
this.eventEmitter.emit("error-occurred", {
|
|
338
|
+
operation: "realize_application",
|
|
339
|
+
error: errorMessage,
|
|
340
|
+
context: params
|
|
341
|
+
});
|
|
342
|
+
const errorResponse = {
|
|
343
|
+
operation: "realize",
|
|
344
|
+
success: false,
|
|
345
|
+
error: errorMessage,
|
|
346
|
+
metadata: {
|
|
347
|
+
specificationPath: params.specificationPath,
|
|
348
|
+
framework: params.framework
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Get orchestrator workflow status and capabilities
|
|
356
|
+
*/
|
|
357
|
+
async getWorkflowStatus(params = {}) {
|
|
358
|
+
this.eventEmitter.emit("tool-called", {
|
|
359
|
+
toolName: "get_workflow_status",
|
|
360
|
+
arguments: params,
|
|
361
|
+
executionTime: 0
|
|
362
|
+
});
|
|
363
|
+
try {
|
|
364
|
+
const capabilities = this.orchestratorBridge.getCapabilities();
|
|
365
|
+
const isAvailable = this.orchestratorBridge.isAvailable();
|
|
366
|
+
const supportedOperations = this.orchestratorBridge.getSupportedOperations();
|
|
367
|
+
const status = {
|
|
368
|
+
orchestratorAvailable: isAvailable,
|
|
369
|
+
capabilities,
|
|
370
|
+
supportedOperations,
|
|
371
|
+
workflowInformation: {
|
|
372
|
+
fullWorkflowSupport: capabilities.hasFullOrchestrator,
|
|
373
|
+
sessionSupport: capabilities.sessionSupport,
|
|
374
|
+
inferenceEngine: capabilities.inferenceEngine,
|
|
375
|
+
workingDirectory: capabilities.workingDirectory,
|
|
376
|
+
...params.sessionId ? {
|
|
377
|
+
sessionId: params.sessionId,
|
|
378
|
+
sessionStatus: "Session support requires full orchestrator"
|
|
379
|
+
} : {}
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
const response = {
|
|
383
|
+
operation: "workflow_status",
|
|
384
|
+
success: true,
|
|
385
|
+
result: status,
|
|
386
|
+
metadata: {
|
|
387
|
+
queryTime: Date.now(),
|
|
388
|
+
hasFullOrchestrator: capabilities.hasFullOrchestrator,
|
|
389
|
+
availableOperations: supportedOperations.length
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
return JSON.stringify(response, null, 2);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
395
|
+
this.eventEmitter.emit("error-occurred", {
|
|
396
|
+
operation: "get_workflow_status",
|
|
397
|
+
error: errorMessage,
|
|
398
|
+
context: params
|
|
399
|
+
});
|
|
400
|
+
const errorResponse = {
|
|
401
|
+
operation: "workflow_status",
|
|
402
|
+
success: false,
|
|
403
|
+
error: errorMessage,
|
|
404
|
+
metadata: {
|
|
405
|
+
queryTime: Date.now()
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
return JSON.stringify(errorResponse, null, 2);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
export {
|
|
413
|
+
OrchestratorToolsService
|
|
414
|
+
};
|