@getanima/core 0.2.1 → 0.2.3

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.
Files changed (49) hide show
  1. package/dist/esm/index.js +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/package.json +8 -6
  5. package/SPEC.md +0 -475
  6. package/dist/alme/core/KnowledgeGraph.d.ts +0 -58
  7. package/dist/alme/core/KnowledgeGraph.d.ts.map +0 -1
  8. package/dist/alme/core/KnowledgeGraph.js +0 -114
  9. package/dist/alme/core/KnowledgeGraph.js.map +0 -1
  10. package/dist/alme/core/MetacognitionEngine.d.ts +0 -35
  11. package/dist/alme/core/MetacognitionEngine.d.ts.map +0 -1
  12. package/dist/alme/core/MetacognitionEngine.js +0 -90
  13. package/dist/alme/core/MetacognitionEngine.js.map +0 -1
  14. package/dist/alme/core/PerformanceAnalyzer.d.ts +0 -68
  15. package/dist/alme/core/PerformanceAnalyzer.d.ts.map +0 -1
  16. package/dist/alme/core/PerformanceAnalyzer.js +0 -142
  17. package/dist/alme/core/PerformanceAnalyzer.js.map +0 -1
  18. package/dist/alme/core/SelfReflectionModule.d.ts +0 -41
  19. package/dist/alme/core/SelfReflectionModule.d.ts.map +0 -1
  20. package/dist/alme/core/SelfReflectionModule.js +0 -101
  21. package/dist/alme/core/SelfReflectionModule.js.map +0 -1
  22. package/dist/alme/core/SkillProfile.d.ts +0 -52
  23. package/dist/alme/core/SkillProfile.d.ts.map +0 -1
  24. package/dist/alme/core/SkillProfile.js +0 -97
  25. package/dist/alme/core/SkillProfile.js.map +0 -1
  26. package/dist/codegen/ArchitecturalDesignGenerator.d.ts +0 -77
  27. package/dist/codegen/ArchitecturalDesignGenerator.d.ts.map +0 -1
  28. package/dist/codegen/ArchitecturalDesignGenerator.js +0 -194
  29. package/dist/codegen/ArchitecturalDesignGenerator.js.map +0 -1
  30. package/dist/codegen/ContextAwareGenerator.d.ts +0 -67
  31. package/dist/codegen/ContextAwareGenerator.d.ts.map +0 -1
  32. package/dist/codegen/ContextAwareGenerator.js +0 -158
  33. package/dist/codegen/ContextAwareGenerator.js.map +0 -1
  34. package/dist/codegen/SystemInteractionSimulator.d.ts +0 -87
  35. package/dist/codegen/SystemInteractionSimulator.d.ts.map +0 -1
  36. package/dist/codegen/SystemInteractionSimulator.js +0 -203
  37. package/dist/codegen/SystemInteractionSimulator.js.map +0 -1
  38. package/dist/codegen/multiStageCodegen.d.ts +0 -30
  39. package/dist/codegen/multiStageCodegen.d.ts.map +0 -1
  40. package/dist/codegen/multiStageCodegen.js +0 -60
  41. package/dist/codegen/multiStageCodegen.js.map +0 -1
  42. package/dist/ideation/InnovationEngine.d.ts +0 -47
  43. package/dist/ideation/InnovationEngine.d.ts.map +0 -1
  44. package/dist/ideation/InnovationEngine.js +0 -127
  45. package/dist/ideation/InnovationEngine.js.map +0 -1
  46. package/dist/learning-tracker/LearningVisualizer.d.ts +0 -26
  47. package/dist/learning-tracker/LearningVisualizer.d.ts.map +0 -1
  48. package/dist/learning-tracker/LearningVisualizer.js +0 -61
  49. package/dist/learning-tracker/LearningVisualizer.js.map +0 -1
@@ -1,52 +0,0 @@
1
- import { SkillCategory, SkillLevel, SkillMetrics } from './types';
2
- /**
3
- * Represents a comprehensive skill profile for adaptive learning
4
- */
5
- export declare class SkillProfile {
6
- private skills;
7
- private static CORE_CATEGORIES;
8
- constructor();
9
- /**
10
- * Update skill level and metrics based on performance
11
- * @param category Skill category to update
12
- * @param newLevel New skill level
13
- * @param performanceContext Context of skill improvement
14
- */
15
- update(category: SkillCategory, newLevel: SkillLevel, performanceContext?: {
16
- interaction?: string;
17
- challenges?: string[];
18
- insights?: string[];
19
- }): void;
20
- /**
21
- * Get current skill level for a specific category
22
- * @param category Skill category to check
23
- * @returns Current skill level
24
- */
25
- getLevel(category: SkillCategory): SkillLevel;
26
- /**
27
- * Retrieve detailed skill profile
28
- * @returns Comprehensive skill profile snapshot
29
- */
30
- getProfile(): Record<SkillCategory, {
31
- level: SkillLevel;
32
- metrics: SkillMetrics;
33
- evolutionHistory: Array<{
34
- timestamp: number;
35
- previousLevel: SkillLevel;
36
- changeReason: string;
37
- }>;
38
- }>;
39
- /**
40
- * Identify skill categories needing improvement
41
- * @returns Array of skill categories that need focus
42
- */
43
- getImprovementAreas(): SkillCategory[];
44
- /**
45
- * Generate a learning focus based on current profile
46
- * @returns Recommended skill to improve
47
- */
48
- recommendLearningFocus(): SkillCategory | null;
49
- }
50
- type SkillLevel = 'novice' | 'beginner' | 'intermediate' | 'advanced' | 'expert';
51
- export { SkillLevel };
52
- //# sourceMappingURL=SkillProfile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SkillProfile.d.ts","sourceRoot":"","sources":["../../../src/alme/core/SkillProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAElE;;GAEG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAQC;IAGf,OAAO,CAAC,MAAM,CAAC,eAAe,CAO5B;;IAiBF;;;;;OAKG;IACH,MAAM,CACJ,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,UAAU,EACpB,kBAAkB,CAAC,EAAE;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,GACA,IAAI;IAsBP;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU;IAI7C;;;OAGG;IACH,UAAU,IAAI,MAAM,CAAC,aAAa,EAAE;QAClC,KAAK,EAAE,UAAU,CAAC;QAClB,OAAO,EAAE,YAAY,CAAC;QACtB,gBAAgB,EAAE,KAAK,CAAC;YACtB,SAAS,EAAE,MAAM,CAAC;YAClB,aAAa,EAAE,UAAU,CAAC;YAC1B,YAAY,EAAE,MAAM,CAAC;SACtB,CAAC,CAAC;KACJ,CAAC;IAIF;;;OAGG;IACH,mBAAmB,IAAI,aAAa,EAAE;IAStC;;;OAGG;IACH,sBAAsB,IAAI,aAAa,GAAG,IAAI;CAM/C;AAGD,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SkillLevel = exports.SkillProfile = void 0;
4
- const types_1 = require("./types");
5
- Object.defineProperty(exports, "SkillLevel", { enumerable: true, get: function () { return types_1.SkillLevel; } });
6
- /**
7
- * Represents a comprehensive skill profile for adaptive learning
8
- */
9
- class SkillProfile {
10
- // Core skill categories with their current levels and metrics
11
- skills = new Map();
12
- // Skill categories to track
13
- static CORE_CATEGORIES = [
14
- 'communication',
15
- 'technical_reasoning',
16
- 'emotional_intelligence',
17
- 'problem_solving',
18
- 'creative_thinking',
19
- 'system_interaction'
20
- ];
21
- constructor() {
22
- // Initialize skill profile with baseline levels
23
- SkillProfile.CORE_CATEGORIES.forEach(category => {
24
- this.skills.set(category, {
25
- level: 'novice',
26
- metrics: {
27
- confidence: 0.1,
28
- adaptability: 0.1,
29
- complexity_handled: 0
30
- },
31
- evolutionHistory: []
32
- });
33
- });
34
- }
35
- /**
36
- * Update skill level and metrics based on performance
37
- * @param category Skill category to update
38
- * @param newLevel New skill level
39
- * @param performanceContext Context of skill improvement
40
- */
41
- update(category, newLevel, performanceContext) {
42
- const currentSkill = this.skills.get(category);
43
- if (!currentSkill)
44
- return;
45
- // Record skill evolution
46
- currentSkill.evolutionHistory.push({
47
- timestamp: Date.now(),
48
- previousLevel: currentSkill.level,
49
- changeReason: performanceContext?.interaction || 'Automatic assessment'
50
- });
51
- // Update skill level and metrics
52
- currentSkill.level = newLevel;
53
- // Dynamically adjust metrics based on performance context
54
- if (performanceContext) {
55
- currentSkill.metrics.confidence += 0.1;
56
- currentSkill.metrics.adaptability += performanceContext.challenges ? 0.05 : 0;
57
- currentSkill.metrics.complexity_handled += performanceContext.challenges?.length || 0;
58
- }
59
- }
60
- /**
61
- * Get current skill level for a specific category
62
- * @param category Skill category to check
63
- * @returns Current skill level
64
- */
65
- getLevel(category) {
66
- return this.skills.get(category)?.level || 'novice';
67
- }
68
- /**
69
- * Retrieve detailed skill profile
70
- * @returns Comprehensive skill profile snapshot
71
- */
72
- getProfile() {
73
- return Object.fromEntries(this.skills);
74
- }
75
- /**
76
- * Identify skill categories needing improvement
77
- * @returns Array of skill categories that need focus
78
- */
79
- getImprovementAreas() {
80
- return Array.from(this.skills.entries())
81
- .filter(([_, skillData]) => skillData.level === 'novice' ||
82
- skillData.metrics.confidence < 0.5)
83
- .map(([category]) => category);
84
- }
85
- /**
86
- * Generate a learning focus based on current profile
87
- * @returns Recommended skill to improve
88
- */
89
- recommendLearningFocus() {
90
- const improvementAreas = this.getImprovementAreas();
91
- return improvementAreas.length > 0
92
- ? improvementAreas[0]
93
- : null;
94
- }
95
- }
96
- exports.SkillProfile = SkillProfile;
97
- //# sourceMappingURL=SkillProfile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SkillProfile.js","sourceRoot":"","sources":["../../../src/alme/core/SkillProfile.ts"],"names":[],"mappings":";;;AAAA,mCAAkE;AAoIzD,2FApIe,kBAAU,OAoIf;AAlInB;;GAEG;AACH,MAAa,YAAY;IACvB,8DAA8D;IACtD,MAAM,GAQT,IAAI,GAAG,EAAE,CAAC;IAEf,4BAA4B;IACpB,MAAM,CAAC,eAAe,GAAoB;QAChD,eAAe;QACf,qBAAqB;QACrB,wBAAwB;QACxB,iBAAiB;QACjB,mBAAmB;QACnB,oBAAoB;KACrB,CAAC;IAEF;QACE,gDAAgD;QAChD,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CA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,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,mBAAmB;QACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aACrC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CACzB,SAAS,CAAC,KAAK,KAAK,QAAQ;YAC5B,SAAS,CAAC,OAAO,CAAC,UAAU,GAAG,GAAG,CACnC;aACA,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,sBAAsB;QACpB,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpD,OAAO,gBAAgB,CAAC,MAAM,GAAG,CAAC;YAChC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;YACrB,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;;AAxHH,oCAyHC"}
@@ -1,77 +0,0 @@
1
- import { KnowledgeGraph } from '../alme/core/KnowledgeGraph';
2
- declare enum ArchitecturalPattern {
3
- Microservices = 0,
4
- EventDriven = 1,
5
- Monolithic = 2,
6
- Serverless = 3,
7
- Hexagonal = 4,
8
- CleanArchitecture = 5
9
- }
10
- interface TechnologyStack {
11
- backend: string[];
12
- frontend: string[];
13
- database: string[];
14
- deployment: string[];
15
- }
16
- interface ProjectRequirements {
17
- domain: string;
18
- scalabilityNeeds: 'low' | 'medium' | 'high';
19
- performanceConstraints: {
20
- responseTime: number;
21
- concurrentUsers: number;
22
- };
23
- complexityLevel: 'simple' | 'moderate' | 'complex';
24
- }
25
- export declare class ArchitecturalDesignGenerator {
26
- private knowledgeGraph;
27
- private architecturalTemplates;
28
- private technologyStacks;
29
- constructor(knowledgeGraph: KnowledgeGraph);
30
- /**
31
- * Generate architectural design
32
- * @param requirements Project requirements
33
- * @returns Comprehensive architectural design
34
- */
35
- generateArchitecture(requirements: ProjectRequirements): {
36
- selectedPattern: ArchitecturalPattern;
37
- technologyStack: TechnologyStack;
38
- architecturalBlueprint: string;
39
- designRecommendations: string[];
40
- };
41
- /**
42
- * Select optimal architectural pattern
43
- * @param requirements Project requirements
44
- * @returns Best matching architectural pattern
45
- */
46
- private selectArchitecturalPattern;
47
- /**
48
- * Retrieve technology stack for pattern
49
- * @param pattern Selected architectural pattern
50
- * @returns Recommended technology stack
51
- */
52
- private getTechnologyStack;
53
- /**
54
- * Create architectural blueprint
55
- * @param pattern Selected architectural pattern
56
- * @param requirements Project requirements
57
- * @returns Architectural blueprint
58
- */
59
- private createArchitecturalBlueprint;
60
- /**
61
- * Enrich blueprint with knowledge graph insights
62
- * @param blueprint Base architectural blueprint
63
- * @param requirements Project requirements
64
- * @returns Enriched blueprint
65
- */
66
- private enrichBlueprintWithKnowledgeInsights;
67
- /**
68
- * Generate design recommendations
69
- * @param pattern Selected architectural pattern
70
- * @param requirements Project requirements
71
- * @returns Design recommendations
72
- */
73
- private generateDesignRecommendations;
74
- }
75
- export declare const architecturalDesignGenerator: ArchitecturalDesignGenerator;
76
- export {};
77
- //# sourceMappingURL=ArchitecturalDesignGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArchitecturalDesignGenerator.d.ts","sourceRoot":"","sources":["../../src/codegen/ArchitecturalDesignGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,aAAK,oBAAoB;IACvB,aAAa,IAAA;IACb,WAAW,IAAA;IACX,UAAU,IAAA;IACV,UAAU,IAAA;IACV,SAAS,IAAA;IACT,iBAAiB,IAAA;CAClB;AAGD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAGD,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,sBAAsB,EAAE;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,eAAe,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;CACpD;AAED,qBAAa,4BAA4B;IACvC,OAAO,CAAC,cAAc,CAAiB;IAGvC,OAAO,CAAC,sBAAsB,CAsC3B;IAGH,OAAO,CAAC,gBAAgB,CAarB;gBAES,cAAc,EAAE,cAAc;IAI1C;;;;OAIG;IACH,oBAAoB,CAClB,YAAY,EAAE,mBAAmB,GAChC;QACD,eAAe,EAAE,oBAAoB,CAAC;QACtC,eAAe,EAAE,eAAe,CAAC;QACjC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;KACjC;IAiCD;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAelC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;;;;OAKG;IACH,OAAO,CAAC,4BAA4B;IAqBpC;;;;;OAKG;IACH,OAAO,CAAC,oCAAoC;IAkB5C;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;CA8BtC;AAGD,eAAO,MAAM,4BAA4B,8BAExC,CAAC"}
@@ -1,194 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.architecturalDesignGenerator = exports.ArchitecturalDesignGenerator = void 0;
4
- const KnowledgeGraph_1 = require("../alme/core/KnowledgeGraph");
5
- // Architectural patterns and styles
6
- var ArchitecturalPattern;
7
- (function (ArchitecturalPattern) {
8
- ArchitecturalPattern[ArchitecturalPattern["Microservices"] = 0] = "Microservices";
9
- ArchitecturalPattern[ArchitecturalPattern["EventDriven"] = 1] = "EventDriven";
10
- ArchitecturalPattern[ArchitecturalPattern["Monolithic"] = 2] = "Monolithic";
11
- ArchitecturalPattern[ArchitecturalPattern["Serverless"] = 3] = "Serverless";
12
- ArchitecturalPattern[ArchitecturalPattern["Hexagonal"] = 4] = "Hexagonal";
13
- ArchitecturalPattern[ArchitecturalPattern["CleanArchitecture"] = 5] = "CleanArchitecture";
14
- })(ArchitecturalPattern || (ArchitecturalPattern = {}));
15
- class ArchitecturalDesignGenerator {
16
- knowledgeGraph;
17
- // Predefined architectural templates
18
- architecturalTemplates = new Map([
19
- [ArchitecturalPattern.Microservices, {
20
- description: 'Distributed system with independently deployable services',
21
- bestPractices: [
22
- 'Use lightweight communication protocols',
23
- 'Implement service discovery',
24
- 'Design for fault tolerance'
25
- ],
26
- componentStructure: `
27
- microservices/
28
- ├── service-discovery/
29
- ├── api-gateway/
30
- ├── auth-service/
31
- ├── core-service/
32
- └── monitoring/
33
- `
34
- }],
35
- [ArchitecturalPattern.Serverless, {
36
- description: 'Event-driven, cloud-native architecture',
37
- bestPractices: [
38
- 'Minimize cold start times',
39
- 'Design stateless functions',
40
- 'Implement robust error handling'
41
- ],
42
- componentStructure: `
43
- serverless/
44
- ├── functions/
45
- │ ├── authentication/
46
- │ ├── data-processing/
47
- │ └── notification/
48
- ├── event-sources/
49
- └── infrastructure/
50
- `
51
- }]
52
- ]);
53
- // Recommended technology stacks
54
- technologyStacks = new Map([
55
- [ArchitecturalPattern.Microservices, {
56
- backend: ['Node.js', 'Kotlin', 'Go'],
57
- frontend: ['React', 'Vue.js'],
58
- database: ['MongoDB', 'Cassandra'],
59
- deployment: ['Kubernetes', 'Docker']
60
- }],
61
- [ArchitecturalPattern.Serverless, {
62
- backend: ['AWS Lambda', 'Azure Functions'],
63
- frontend: ['Next.js', 'Svelte'],
64
- database: ['DynamoDB', 'Firestore'],
65
- deployment: ['Terraform', 'Serverless Framework']
66
- }]
67
- ]);
68
- constructor(knowledgeGraph) {
69
- this.knowledgeGraph = knowledgeGraph;
70
- }
71
- /**
72
- * Generate architectural design
73
- * @param requirements Project requirements
74
- * @returns Comprehensive architectural design
75
- */
76
- generateArchitecture(requirements) {
77
- // 1. Select appropriate architectural pattern
78
- const selectedPattern = this.selectArchitecturalPattern(requirements);
79
- // 2. Retrieve technology stack
80
- const technologyStack = this.getTechnologyStack(selectedPattern);
81
- // 3. Generate architectural blueprint
82
- const architecturalBlueprint = this.createArchitecturalBlueprint(selectedPattern, requirements);
83
- // 4. Generate design recommendations
84
- const designRecommendations = this.generateDesignRecommendations(selectedPattern, requirements);
85
- // 5. Enrich with knowledge graph insights
86
- const enrichedBlueprint = this.enrichBlueprintWithKnowledgeInsights(architecturalBlueprint, requirements);
87
- return {
88
- selectedPattern,
89
- technologyStack,
90
- architecturalBlueprint: enrichedBlueprint,
91
- designRecommendations
92
- };
93
- }
94
- /**
95
- * Select optimal architectural pattern
96
- * @param requirements Project requirements
97
- * @returns Best matching architectural pattern
98
- */
99
- selectArchitecturalPattern(requirements) {
100
- // Intelligent pattern selection logic
101
- if (requirements.scalabilityNeeds === 'high') {
102
- return ArchitecturalPattern.Microservices;
103
- }
104
- if (requirements.performanceConstraints.concurrentUsers > 10000) {
105
- return ArchitecturalPattern.Serverless;
106
- }
107
- return ArchitecturalPattern.Microservices; // Default fallback
108
- }
109
- /**
110
- * Retrieve technology stack for pattern
111
- * @param pattern Selected architectural pattern
112
- * @returns Recommended technology stack
113
- */
114
- getTechnologyStack(pattern) {
115
- const stack = this.technologyStacks.get(pattern);
116
- if (!stack) {
117
- throw new Error(`No technology stack found for pattern: ${pattern}`);
118
- }
119
- return stack;
120
- }
121
- /**
122
- * Create architectural blueprint
123
- * @param pattern Selected architectural pattern
124
- * @param requirements Project requirements
125
- * @returns Architectural blueprint
126
- */
127
- createArchitecturalBlueprint(pattern, requirements) {
128
- const template = this.architecturalTemplates.get(pattern);
129
- if (!template) {
130
- throw new Error(`No template found for pattern: ${pattern}`);
131
- }
132
- return `
133
- # Architectural Design: ${requirements.domain}
134
- ## Pattern: ${ArchitecturalPattern[pattern]}
135
- ## Complexity: ${requirements.complexityLevel}
136
-
137
- ${template.componentStructure}
138
-
139
- ## Best Practices:
140
- ${template.bestPractices.map(practice => `- ${practice}`).join('\n')}
141
- `;
142
- }
143
- /**
144
- * Enrich blueprint with knowledge graph insights
145
- * @param blueprint Base architectural blueprint
146
- * @param requirements Project requirements
147
- * @returns Enriched blueprint
148
- */
149
- enrichBlueprintWithKnowledgeInsights(blueprint, requirements) {
150
- // Find related concepts in knowledge graph
151
- const relatedConcepts = this.knowledgeGraph.findRelatedConcepts(requirements.domain, 2 // Depth of exploration
152
- );
153
- // Extract and integrate insights
154
- const conceptInsights = relatedConcepts
155
- .map(concept => `## Domain Insight: ${concept.content}`)
156
- .join('\n');
157
- return `${blueprint}\n\n${conceptInsights}`;
158
- }
159
- /**
160
- * Generate design recommendations
161
- * @param pattern Selected architectural pattern
162
- * @param requirements Project requirements
163
- * @returns Design recommendations
164
- */
165
- generateDesignRecommendations(pattern, requirements) {
166
- const baseRecommendations = [
167
- `Optimize for ${requirements.scalabilityNeeds} scalability`,
168
- `Design to support ${requirements.performanceConstraints.concurrentUsers} concurrent users`,
169
- `Implement ${requirements.complexityLevel} complexity architecture`
170
- ];
171
- const patternSpecificRecommendations = {
172
- [ArchitecturalPattern.Microservices]: [
173
- 'Implement robust service discovery',
174
- 'Design for independent service deployment'
175
- ],
176
- [ArchitecturalPattern.Serverless]: [
177
- 'Minimize cold start times',
178
- 'Design stateless, event-driven functions'
179
- ],
180
- [ArchitecturalPattern.EventDriven]: [],
181
- [ArchitecturalPattern.Monolithic]: [],
182
- [ArchitecturalPattern.Hexagonal]: [],
183
- [ArchitecturalPattern.CleanArchitecture]: []
184
- };
185
- return [
186
- ...baseRecommendations,
187
- ...(patternSpecificRecommendations[pattern] || [])
188
- ];
189
- }
190
- }
191
- exports.ArchitecturalDesignGenerator = ArchitecturalDesignGenerator;
192
- // Singleton instance for global use
193
- exports.architecturalDesignGenerator = new ArchitecturalDesignGenerator(new KnowledgeGraph_1.KnowledgeGraph());
194
- //# sourceMappingURL=ArchitecturalDesignGenerator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArchitecturalDesignGenerator.js","sourceRoot":"","sources":["../../src/codegen/ArchitecturalDesignGenerator.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAE7D,oCAAoC;AACpC,IAAK,oBAOJ;AAPD,WAAK,oBAAoB;IACvB,iFAAa,CAAA;IACb,6EAAW,CAAA;IACX,2EAAU,CAAA;IACV,2EAAU,CAAA;IACV,yEAAS,CAAA;IACT,yFAAiB,CAAA;AACnB,CAAC,EAPI,oBAAoB,KAApB,oBAAoB,QAOxB;AAqBD,MAAa,4BAA4B;IAC/B,cAAc,CAAiB;IAEvC,qCAAqC;IAC7B,sBAAsB,GAIzB,IAAI,GAAG,CAAC;QACX,CAAC,oBAAoB,CAAC,aAAa,EAAE;gBACnC,WAAW,EAAE,2DAA2D;gBACxE,aAAa,EAAE;oBACb,yCAAyC;oBACzC,6BAA6B;oBAC7B,4BAA4B;iBAC7B;gBACD,kBAAkB,EAAE;;;;;;;OAOnB;aACF,CAAC;QACF,CAAC,oBAAoB,CAAC,UAAU,EAAE;gBAChC,WAAW,EAAE,yCAAyC;gBACtD,aAAa,EAAE;oBACb,2BAA2B;oBAC3B,4BAA4B;oBAC5B,iCAAiC;iBAClC;gBACD,kBAAkB,EAAE;;;;;;;;OAQnB;aACF,CAAC;KACH,CAAC,CAAC;IAEH,gCAAgC;IACxB,gBAAgB,GAA+C,IAAI,GAAG,CAAC;QAC7E,CAAC,oBAAoB,CAAC,aAAa,EAAE;gBACnC,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC;gBACpC,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;gBAC7B,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;gBAClC,UAAU,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC;aACrC,CAAC;QACF,CAAC,oBAAoB,CAAC,UAAU,EAAE;gBAChC,OAAO,EAAE,CAAC,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;IACK,6BAA6B,CACnC,OAA6B,EAC7B,YAAiC;QAEjC,MAAM,mBAAmB,GAAG;YAC1B,gBAAgB,YAAY,CAAC,gBAAgB,cAAc;YAC3D,qBAAqB,YAAY,CAAC,sBAAsB,CAAC,eAAe,mBAAmB;YAC3F,aAAa,YAAY,CAAC,eAAe,0BAA0B;SACpE,CAAC;QAEF,MAAM,8BAA8B,GAA2C;YAC7E,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE;gBACpC,oCAAoC;gBACpC,2CAA2C;aAC5C;YACD,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;gBACjC,2BAA2B;gBAC3B,0CAA0C;aAC3C;YACD,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,EAAE;YACtC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE;YACrC,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,EAAE;YACpC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,EAAE;SAC7C,CAAC;QAEF,OAAO;YACL,GAAG,mBAAmB;YACtB,GAAG,CAAC,8BAA8B,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SACnD,CAAC;IACJ,CAAC;CACF;AAvOD,oEAuOC;AAED,oCAAoC;AACvB,QAAA,4BAA4B,GAAG,IAAI,4BAA4B,CAC1E,IAAI,+BAAc,EAAE,CACrB,CAAC"}
@@ -1,67 +0,0 @@
1
- import { KnowledgeGraph } from '../../alme/core/KnowledgeGraph';
2
- declare enum CodeGenerationContext {
3
- MobileApp = 0,
4
- WebService = 1,
5
- SystemIntegration = 2,
6
- MachineLearning = 3,
7
- ServerlessArchitecture = 4
8
- }
9
- interface CodeGenerationRequest {
10
- context: CodeGenerationContext;
11
- domain: string;
12
- specificRequirements: string[];
13
- constraints: {
14
- performanceTarget?: number;
15
- memoryLimit?: number;
16
- scalabilityRequirements?: string;
17
- };
18
- }
19
- export declare class ContextAwareCodeGenerator {
20
- private knowledgeGraph;
21
- private codeTemplates;
22
- constructor(knowledgeGraph: KnowledgeGraph);
23
- /**
24
- * Generate context-aware code
25
- * @param request Code generation requirements
26
- * @returns Generated code snippet
27
- */
28
- generateCode(request: CodeGenerationRequest): Promise<string>;
29
- /**
30
- * Retrieve appropriate code template
31
- * @param context Generation context
32
- * @returns Matching code template
33
- */
34
- private getCodeTemplate;
35
- /**
36
- * Enrich template with contextual insights
37
- * @param template Base code template
38
- * @param contextNodes Related knowledge graph nodes
39
- * @param request Generation request
40
- * @returns Enhanced template
41
- */
42
- private enrichTemplateWithContextualInsights;
43
- /**
44
- * Fill template with specific implementation details
45
- * @param template Enhanced code template
46
- * @param request Generation request
47
- * @returns Specific code implementation
48
- */
49
- private fillTemplateWithSpecifics;
50
- /**
51
- * Validate generated code
52
- * @param code Generated code snippet
53
- * @param request Original generation request
54
- * @returns Validation result
55
- */
56
- private validateGeneratedCode;
57
- /**
58
- * Refine generated code based on feedback
59
- * @param code Original generated code
60
- * @param feedback Validation feedback
61
- * @returns Improved code
62
- */
63
- private refineCode;
64
- }
65
- export declare const contextAwareCodeGenerator: ContextAwareCodeGenerator;
66
- export {};
67
- //# sourceMappingURL=ContextAwareGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextAwareGenerator.d.ts","sourceRoot":"","sources":["../../src/codegen/ContextAwareGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE,aAAK,qBAAqB;IACxB,SAAS,IAAA;IACT,UAAU,IAAA;IACV,iBAAiB,IAAA;IACjB,eAAe,IAAA;IACf,sBAAsB,IAAA;CACvB;AAGD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,WAAW,EAAE;QACX,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC,CAAC;CACH;AASD,qBAAa,yBAAyB;IACpC,OAAO,CAAC,cAAc,CAAiB;IAGvC,OAAO,CAAC,aAAa,CA2ClB;gBAES,cAAc,EAAE,cAAc;IAI1C;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IA+BnE;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAQvB;;;;;;OAMG;IACH,OAAO,CAAC,oCAAoC;IAmB5C;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAUjC;;;;;OAKG;YACW,qBAAqB;IAoBnC;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CAMnB;AAGD,eAAO,MAAM,yBAAyB,2BAErC,CAAC"}
@@ -1,158 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.contextAwareCodeGenerator = exports.ContextAwareCodeGenerator = void 0;
4
- const KnowledgeGraph_1 = require("../../alme/core/KnowledgeGraph");
5
- // Enum for different code generation contexts
6
- var CodeGenerationContext;
7
- (function (CodeGenerationContext) {
8
- CodeGenerationContext[CodeGenerationContext["MobileApp"] = 0] = "MobileApp";
9
- CodeGenerationContext[CodeGenerationContext["WebService"] = 1] = "WebService";
10
- CodeGenerationContext[CodeGenerationContext["SystemIntegration"] = 2] = "SystemIntegration";
11
- CodeGenerationContext[CodeGenerationContext["MachineLearning"] = 3] = "MachineLearning";
12
- CodeGenerationContext[CodeGenerationContext["ServerlessArchitecture"] = 4] = "ServerlessArchitecture";
13
- })(CodeGenerationContext || (CodeGenerationContext = {}));
14
- class ContextAwareCodeGenerator {
15
- knowledgeGraph;
16
- // Predefined code templates for different contexts
17
- codeTemplates = new Map([
18
- [CodeGenerationContext.MobileApp, {
19
- language: 'Swift',
20
- structure: `
21
- import UIKit
22
- import DeviceActivity
23
-
24
- class {ClassName}: {BaseClass} {
25
- // Context-aware app blocking implementation
26
- func implementAppBlocking() {
27
- // Dynamic implementation based on context
28
- }
29
- }`,
30
- bestPractices: [
31
- 'Use DeviceActivity framework',
32
- 'Implement granular permission handling',
33
- 'Ensure privacy compliance'
34
- ]
35
- }],
36
- [CodeGenerationContext.WebService, {
37
- language: 'TypeScript',
38
- structure: `
39
- import express from 'express';
40
- import { AuthMiddleware } from './middleware/auth';
41
-
42
- class {ClassName} {
43
- private app: express.Application;
44
-
45
- constructor() {
46
- this.app = express();
47
- this.configureMiddlewares();
48
- }
49
-
50
- private configureMiddlewares() {
51
- // Intelligent middleware configuration
52
- }
53
- }`,
54
- bestPractices: [
55
- 'Implement robust error handling',
56
- 'Use dependency injection',
57
- 'Create modular architecture'
58
- ]
59
- }]
60
- ]);
61
- constructor(knowledgeGraph) {
62
- this.knowledgeGraph = knowledgeGraph;
63
- }
64
- /**
65
- * Generate context-aware code
66
- * @param request Code generation requirements
67
- * @returns Generated code snippet
68
- */
69
- async generateCode(request) {
70
- // 1. Retrieve appropriate code template
71
- const template = this.getCodeTemplate(request.context);
72
- // 2. Analyze related knowledge graph nodes
73
- const contextNodes = this.knowledgeGraph.findRelatedConcepts(request.domain, 2 // Depth of knowledge exploration
74
- );
75
- // 3. Enhance template with contextual insights
76
- const enhancedTemplate = this.enrichTemplateWithContextualInsights(template, contextNodes, request);
77
- // 4. Generate specific implementation
78
- const generatedCode = this.fillTemplateWithSpecifics(enhancedTemplate, request);
79
- // 5. Validate generated code
80
- const validationResult = await this.validateGeneratedCode(generatedCode, request);
81
- return validationResult.isValid
82
- ? generatedCode
83
- : this.refineCode(generatedCode, validationResult.feedback);
84
- }
85
- /**
86
- * Retrieve appropriate code template
87
- * @param context Generation context
88
- * @returns Matching code template
89
- */
90
- getCodeTemplate(context) {
91
- const template = this.codeTemplates.get(context);
92
- if (!template) {
93
- throw new Error(`No template found for context: ${context}`);
94
- }
95
- return template;
96
- }
97
- /**
98
- * Enrich template with contextual insights
99
- * @param template Base code template
100
- * @param contextNodes Related knowledge graph nodes
101
- * @param request Generation request
102
- * @returns Enhanced template
103
- */
104
- enrichTemplateWithContextualInsights(template, contextNodes, request) {
105
- // Extract insights from knowledge graph
106
- const contextualInsights = contextNodes.map(node => node.content).join('\n');
107
- return {
108
- ...template,
109
- structure: template.structure.replace('// Dynamic implementation based on context', `// Contextual insights: ${contextualInsights}\n // Dynamic implementation`)
110
- };
111
- }
112
- /**
113
- * Fill template with specific implementation details
114
- * @param template Enhanced code template
115
- * @param request Generation request
116
- * @returns Specific code implementation
117
- */
118
- fillTemplateWithSpecifics(template, request) {
119
- // Replace placeholders with specific implementation
120
- return template.structure
121
- .replace('{ClassName}', `${request.domain}Generator`)
122
- .replace('{BaseClass}', 'NSObject');
123
- }
124
- /**
125
- * Validate generated code
126
- * @param code Generated code snippet
127
- * @param request Original generation request
128
- * @returns Validation result
129
- */
130
- async validateGeneratedCode(code, request) {
131
- // Simulate code validation
132
- // In a real implementation, this would use more sophisticated
133
- // static analysis and potential compilation checking
134
- const hasRequiredImplementation = code.includes('implementAppBlocking');
135
- return {
136
- isValid: hasRequiredImplementation,
137
- feedback: !hasRequiredImplementation
138
- ? 'Missing required method implementation'
139
- : undefined
140
- };
141
- }
142
- /**
143
- * Refine generated code based on feedback
144
- * @param code Original generated code
145
- * @param feedback Validation feedback
146
- * @returns Improved code
147
- */
148
- refineCode(code, feedback) {
149
- if (!feedback)
150
- return code;
151
- // Simple refinement strategy
152
- return code + `\n // Refined based on: ${feedback}`;
153
- }
154
- }
155
- exports.ContextAwareCodeGenerator = ContextAwareCodeGenerator;
156
- // Singleton instance for global use
157
- exports.contextAwareCodeGenerator = new ContextAwareCodeGenerator(new KnowledgeGraph_1.KnowledgeGraph());
158
- //# sourceMappingURL=ContextAwareGenerator.js.map