gameforge-cli 0.1.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/LICENSE +21 -0
- package/README.md +366 -0
- package/dist/agents/base/BaseAgent.d.ts +45 -0
- package/dist/agents/base/BaseAgent.d.ts.map +1 -0
- package/dist/agents/base/BaseAgent.js +179 -0
- package/dist/agents/base/BaseAgent.js.map +1 -0
- package/dist/agents/core/Architect.d.ts +16 -0
- package/dist/agents/core/Architect.d.ts.map +1 -0
- package/dist/agents/core/Architect.js +487 -0
- package/dist/agents/core/Architect.js.map +1 -0
- package/dist/agents/core/Chaos.d.ts +14 -0
- package/dist/agents/core/Chaos.d.ts.map +1 -0
- package/dist/agents/core/Chaos.js +67 -0
- package/dist/agents/core/Chaos.js.map +1 -0
- package/dist/agents/core/Consistency.d.ts +16 -0
- package/dist/agents/core/Consistency.d.ts.map +1 -0
- package/dist/agents/core/Consistency.js +132 -0
- package/dist/agents/core/Consistency.js.map +1 -0
- package/dist/agents/core/Inquisitor.d.ts +20 -0
- package/dist/agents/core/Inquisitor.d.ts.map +1 -0
- package/dist/agents/core/Inquisitor.js +159 -0
- package/dist/agents/core/Inquisitor.js.map +1 -0
- package/dist/agents/core/Remediation.d.ts +16 -0
- package/dist/agents/core/Remediation.d.ts.map +1 -0
- package/dist/agents/core/Remediation.js +151 -0
- package/dist/agents/core/Remediation.js.map +1 -0
- package/dist/agents/specialists/CreativeSpecialist.d.ts +7 -0
- package/dist/agents/specialists/CreativeSpecialist.d.ts.map +1 -0
- package/dist/agents/specialists/CreativeSpecialist.js +70 -0
- package/dist/agents/specialists/CreativeSpecialist.js.map +1 -0
- package/dist/agents/specialists/EntitySpecialist.d.ts +8 -0
- package/dist/agents/specialists/EntitySpecialist.d.ts.map +1 -0
- package/dist/agents/specialists/EntitySpecialist.js +74 -0
- package/dist/agents/specialists/EntitySpecialist.js.map +1 -0
- package/dist/agents/specialists/FeatureSpecialist.d.ts +8 -0
- package/dist/agents/specialists/FeatureSpecialist.d.ts.map +1 -0
- package/dist/agents/specialists/FeatureSpecialist.js +83 -0
- package/dist/agents/specialists/FeatureSpecialist.js.map +1 -0
- package/dist/agents/specialists/TechSpecialist.d.ts +7 -0
- package/dist/agents/specialists/TechSpecialist.d.ts.map +1 -0
- package/dist/agents/specialists/TechSpecialist.js +62 -0
- package/dist/agents/specialists/TechSpecialist.js.map +1 -0
- package/dist/config/budget.d.ts +36 -0
- package/dist/config/budget.d.ts.map +1 -0
- package/dist/config/budget.js +37 -0
- package/dist/config/budget.js.map +1 -0
- package/dist/config/schema.d.ts +1336 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +134 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/templates.d.ts +10 -0
- package/dist/config/templates.d.ts.map +1 -0
- package/dist/config/templates.js +202 -0
- package/dist/config/templates.js.map +1 -0
- package/dist/core/CheckpointManager.d.ts +16 -0
- package/dist/core/CheckpointManager.d.ts.map +1 -0
- package/dist/core/CheckpointManager.js +52 -0
- package/dist/core/CheckpointManager.js.map +1 -0
- package/dist/core/Orchestrator.d.ts +11 -0
- package/dist/core/Orchestrator.d.ts.map +1 -0
- package/dist/core/Orchestrator.js +46 -0
- package/dist/core/Orchestrator.js.map +1 -0
- package/dist/core/SessionManager.d.ts +68 -0
- package/dist/core/SessionManager.d.ts.map +1 -0
- package/dist/core/SessionManager.js +162 -0
- package/dist/core/SessionManager.js.map +1 -0
- package/dist/core/StateMachine.d.ts +46 -0
- package/dist/core/StateMachine.d.ts.map +1 -0
- package/dist/core/StateMachine.js +82 -0
- package/dist/core/StateMachine.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +830 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/costTracker.d.ts +30 -0
- package/dist/utils/costTracker.d.ts.map +1 -0
- package/dist/utils/costTracker.js +64 -0
- package/dist/utils/costTracker.js.map +1 -0
- package/dist/utils/debugLogger.d.ts +48 -0
- package/dist/utils/debugLogger.d.ts.map +1 -0
- package/dist/utils/debugLogger.js +179 -0
- package/dist/utils/debugLogger.js.map +1 -0
- package/dist/utils/fileManager.d.ts +14 -0
- package/dist/utils/fileManager.d.ts.map +1 -0
- package/dist/utils/fileManager.js +135 -0
- package/dist/utils/fileManager.js.map +1 -0
- package/dist/utils/modelSelector.d.ts +11 -0
- package/dist/utils/modelSelector.d.ts.map +1 -0
- package/dist/utils/modelSelector.js +38 -0
- package/dist/utils/modelSelector.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Architect = void 0;
|
|
4
|
+
const BaseAgent_1 = require("../base/BaseAgent");
|
|
5
|
+
const modelSelector_1 = require("../../utils/modelSelector");
|
|
6
|
+
const schema_1 = require("../../config/schema");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const debugLogger_1 = require("../../utils/debugLogger");
|
|
9
|
+
class Architect extends BaseAgent_1.BaseAgent {
|
|
10
|
+
constructor(apiKey, costTracker, modelSelector) {
|
|
11
|
+
const config = {
|
|
12
|
+
systemPrompt: `You are the Architect, responsible for generating structured Game Design Documents.
|
|
13
|
+
Transform interview transcripts into valid JSON conforming to the GameBible schema.
|
|
14
|
+
|
|
15
|
+
Rules:
|
|
16
|
+
1. Generate IDs in format: FEAT-001, ENTITY-001, etc.
|
|
17
|
+
2. All auto-generated content must be marked with [Auto-Generated] tag
|
|
18
|
+
3. Infer dependencies between features logically
|
|
19
|
+
4. Provide realistic technical specifications (data structures, formulas)
|
|
20
|
+
5. Ensure all required fields are populated
|
|
21
|
+
|
|
22
|
+
Output ONLY raw JSON, no markdown code blocks, no commentary.
|
|
23
|
+
Do NOT wrap the JSON in \`\`\`json or \`\`\` tags.`,
|
|
24
|
+
temperature: 0.3 // Lower temperature for structured output
|
|
25
|
+
};
|
|
26
|
+
super(apiKey, config, costTracker, modelSelector);
|
|
27
|
+
}
|
|
28
|
+
async execute(transcript, onProgress) {
|
|
29
|
+
const transcriptStr = transcript
|
|
30
|
+
.map(t => {
|
|
31
|
+
const marker = t.autoGenerated ? ' [Auto-Generated]' : '';
|
|
32
|
+
return `Q: ${t.question}\nA: ${t.answer}${marker}`;
|
|
33
|
+
})
|
|
34
|
+
.join('\n\n');
|
|
35
|
+
// Multi-pass generation with constrained prompts
|
|
36
|
+
onProgress?.('Pass 1/3: Generating meta and core features...');
|
|
37
|
+
const metaAndFeatures = await this.generateMetaAndFeatures(transcriptStr, onProgress);
|
|
38
|
+
onProgress?.('Pass 2/3: Generating key game objects...');
|
|
39
|
+
const gameObjects = await this.generateGameObjects(transcriptStr, metaAndFeatures, onProgress);
|
|
40
|
+
onProgress?.('Pass 3/3: Generating creative and technical specs...');
|
|
41
|
+
const creativeAndTech = await this.generateCreativeAndTech(transcriptStr, metaAndFeatures, onProgress);
|
|
42
|
+
// Merge all parts into final GameBible
|
|
43
|
+
onProgress?.('Merging and validating...');
|
|
44
|
+
const gameBible = {
|
|
45
|
+
meta: metaAndFeatures.meta,
|
|
46
|
+
features: metaAndFeatures.features,
|
|
47
|
+
gameObjects: gameObjects,
|
|
48
|
+
creative: creativeAndTech.creative,
|
|
49
|
+
technical: creativeAndTech.technical
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const validated = schema_1.GameBibleSchema.parse(gameBible);
|
|
53
|
+
// Debug logging: Successful validation
|
|
54
|
+
if (debugLogger_1.debugLogger.isEnabled()) {
|
|
55
|
+
debugLogger_1.debugLogger.logValidation({
|
|
56
|
+
success: true,
|
|
57
|
+
sample: {
|
|
58
|
+
meta: gameBible.meta,
|
|
59
|
+
featuresCount: gameBible.features.length,
|
|
60
|
+
gameObjectsCount: gameBible.gameObjects.length
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return validated;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (error instanceof zod_1.ZodError) {
|
|
68
|
+
console.error('Schema validation failed:');
|
|
69
|
+
console.error('First 10 errors:', error.errors.slice(0, 10));
|
|
70
|
+
// Log the actual generated JSON for debugging
|
|
71
|
+
console.error('\nGenerated JSON sample (first feature):');
|
|
72
|
+
if (gameBible.features?.[0]) {
|
|
73
|
+
console.error(JSON.stringify(gameBible.features[0], null, 2));
|
|
74
|
+
}
|
|
75
|
+
// Debug logging: Validation failure
|
|
76
|
+
if (debugLogger_1.debugLogger.isEnabled()) {
|
|
77
|
+
debugLogger_1.debugLogger.logValidation({
|
|
78
|
+
success: false,
|
|
79
|
+
errorCount: error.errors.length,
|
|
80
|
+
errors: error.errors,
|
|
81
|
+
sample: gameBible.features?.[0]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`Schema validation failed with ${error.errors.length} errors. Check console for details.`);
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async generateMetaAndFeatures(transcriptStr, onProgress) {
|
|
90
|
+
const prompt = `Generate the meta section and core features for a Game Design Document.
|
|
91
|
+
|
|
92
|
+
INTERVIEW:
|
|
93
|
+
${transcriptStr}
|
|
94
|
+
|
|
95
|
+
CONSTRAINTS - Keep it focused:
|
|
96
|
+
- Generate 3-8 core features maximum (prioritize the most important systems)
|
|
97
|
+
- Keep technical specs concise
|
|
98
|
+
- Limit to essential dependencies only
|
|
99
|
+
|
|
100
|
+
OUTPUT STRUCTURE (use this EXACT format):
|
|
101
|
+
{
|
|
102
|
+
"meta": {
|
|
103
|
+
"id": "GDD-XXX-001",
|
|
104
|
+
"title": "Your Game Title",
|
|
105
|
+
"conceptStatement": "Your elevator pitch here",
|
|
106
|
+
"genre": ["Genre1", "Genre2"],
|
|
107
|
+
"targetPlatform": ["Platform1"],
|
|
108
|
+
"targetAudience": "target audience description",
|
|
109
|
+
"estimatedScope": "Prototype",
|
|
110
|
+
"createdAt": "${new Date().toISOString()}",
|
|
111
|
+
"version": "1.0.0"
|
|
112
|
+
},
|
|
113
|
+
"features": [
|
|
114
|
+
{
|
|
115
|
+
"id": "FEAT-001",
|
|
116
|
+
"name": "Feature Name",
|
|
117
|
+
"intent": "Why this feature exists",
|
|
118
|
+
"dependencies": ["FEAT-002"],
|
|
119
|
+
"gameplayLoop": ["step1", "step2", "step3"],
|
|
120
|
+
"uiRequirements": ["UI element description"],
|
|
121
|
+
"technical": {
|
|
122
|
+
"dataStructure": "struct FeatureName { field: type; }",
|
|
123
|
+
"mathFormulas": [
|
|
124
|
+
{
|
|
125
|
+
"expression": "damage = baseDamage * (1 + critChance)",
|
|
126
|
+
"variables": {
|
|
127
|
+
"baseDamage": { "type": "float", "range": "1.0-100.0" },
|
|
128
|
+
"critChance": { "type": "float", "range": "0.0-1.0" }
|
|
129
|
+
},
|
|
130
|
+
"validated": false,
|
|
131
|
+
"balanceNotes": "Adjust critChance if damage spikes too high"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"fileLocation": "src/features/FeatureName/",
|
|
135
|
+
"estimatedComplexity": "Medium"
|
|
136
|
+
},
|
|
137
|
+
"agile": {
|
|
138
|
+
"epic": "EPIC-001: Epic Name",
|
|
139
|
+
"userStories": [
|
|
140
|
+
"As a player, I want to... so that..."
|
|
141
|
+
],
|
|
142
|
+
"acceptanceCriteria": [
|
|
143
|
+
"Given... when... then..."
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
CRITICAL - For mathFormulas field:
|
|
151
|
+
- If the feature has NO formulas, use: "mathFormulas": []
|
|
152
|
+
- If it HAS formulas, each must be an OBJECT with structure shown above
|
|
153
|
+
- NEVER use strings for mathFormulas elements
|
|
154
|
+
- Variable types MUST be exactly "int", "float", or "bool" - NOT "array<int>", "number", "integer", or any other variation
|
|
155
|
+
|
|
156
|
+
Output ONLY the JSON, no markdown blocks.`;
|
|
157
|
+
const response = await this.callLLMWithAutoRetry(prompt, modelSelector_1.TaskComplexity.COMPLEX, {
|
|
158
|
+
initialMaxTokens: 16000,
|
|
159
|
+
maxRetries: 2,
|
|
160
|
+
onProgress: onProgress
|
|
161
|
+
});
|
|
162
|
+
return this.parseJSON(response.content);
|
|
163
|
+
}
|
|
164
|
+
async generateGameObjects(transcriptStr, metaAndFeatures, onProgress) {
|
|
165
|
+
const prompt = `Generate key game objects for this game.
|
|
166
|
+
|
|
167
|
+
INTERVIEW:
|
|
168
|
+
${transcriptStr}
|
|
169
|
+
|
|
170
|
+
FEATURES:
|
|
171
|
+
${JSON.stringify(metaAndFeatures.features.map(f => ({ id: f.id, name: f.name })), null, 2)}
|
|
172
|
+
|
|
173
|
+
CONSTRAINTS - Focus on essentials:
|
|
174
|
+
- Generate 5-15 game objects maximum (most important entities only)
|
|
175
|
+
- For card games: include a few representative cards, not every single card
|
|
176
|
+
- Keep backstories and dialogues brief (1-2 sentences max)
|
|
177
|
+
- Minimal attributes per object
|
|
178
|
+
|
|
179
|
+
OUTPUT STRUCTURE (use this EXACT format):
|
|
180
|
+
[
|
|
181
|
+
{
|
|
182
|
+
"id": "NPC-001",
|
|
183
|
+
"name": "Character Name",
|
|
184
|
+
"category": "NPC", // MUST be one of: "NPC", "Monster", "Item", "Interactable"
|
|
185
|
+
"narrative": {
|
|
186
|
+
"backstory": "Brief 1-2 sentence backstory",
|
|
187
|
+
"dialogues": ["Dialogue line 1", "Dialogue line 2"],
|
|
188
|
+
"externalData": {
|
|
189
|
+
"type": "Spreadsheet",
|
|
190
|
+
"schema": "columns: name (string), dialogueKey (string), emotion (string)",
|
|
191
|
+
"sampleRows": 5,
|
|
192
|
+
"fileReference": "npcs/character_name_dialogues.csv"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"stats": {
|
|
196
|
+
"attributes": {
|
|
197
|
+
"HP": 100,
|
|
198
|
+
"Speed": "Fast",
|
|
199
|
+
"AttackPower": 25
|
|
200
|
+
},
|
|
201
|
+
"behaviors": ["patrol", "attack on sight"],
|
|
202
|
+
"balanceFormulas": [
|
|
203
|
+
{
|
|
204
|
+
"expression": "effectiveHP = HP * (1 + armor * 0.01)",
|
|
205
|
+
"variables": {
|
|
206
|
+
"HP": { "type": "int", "range": "1-1000" },
|
|
207
|
+
"armor": { "type": "int", "range": "0-100" }
|
|
208
|
+
},
|
|
209
|
+
"validated": false,
|
|
210
|
+
"balanceNotes": "Ensure armor doesn't make character invincible"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
"references": {
|
|
215
|
+
"features": ["FEAT-001"],
|
|
216
|
+
"relatedEntities": ["ITEM-005"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"id": "ITEM-002",
|
|
221
|
+
"name": "Item Name",
|
|
222
|
+
"category": "Item",
|
|
223
|
+
"stats": {
|
|
224
|
+
"attributes": {
|
|
225
|
+
"value": 100,
|
|
226
|
+
"weight": 5
|
|
227
|
+
},
|
|
228
|
+
"behaviors": ["consumable", "tradeable"]
|
|
229
|
+
},
|
|
230
|
+
"references": {
|
|
231
|
+
"features": ["FEAT-003"],
|
|
232
|
+
"relatedEntities": []
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
CRITICAL - For optional complex fields:
|
|
238
|
+
- category MUST be exactly one of: "NPC", "Monster", "Item", "Interactable"
|
|
239
|
+
- NOT "Environment", "System", "Card", or any other value
|
|
240
|
+
- For environments, use category "Interactable"
|
|
241
|
+
- For game systems, use category "Item" or omit the object entirely
|
|
242
|
+
- narrative is OPTIONAL - omit entirely if not needed, don't use empty strings
|
|
243
|
+
- narrative.externalData is OPTIONAL - omit if not needed
|
|
244
|
+
- If present, MUST be an object: { type: "Spreadsheet"|"Database"|"JSON", schema: string, sampleRows: number }
|
|
245
|
+
- NEVER use a string for externalData
|
|
246
|
+
- stats.balanceFormulas is OPTIONAL - use [] if no formulas
|
|
247
|
+
- If formulas exist, each MUST be an object (see example above)
|
|
248
|
+
- NEVER use strings for formula array elements
|
|
249
|
+
- Variable types MUST be exactly "int", "float", or "bool" - NOT "array<int>", "number", "integer", or any other variation
|
|
250
|
+
- stats.attributes values MUST be numbers or strings - NOT booleans
|
|
251
|
+
- Use strings for descriptive values: "Fast", "Slow", "Marked", "Unmarked"
|
|
252
|
+
- Use numbers for numeric values: 100, 5.5, 0
|
|
253
|
+
- NEVER use true/false for attributes
|
|
254
|
+
|
|
255
|
+
Output ONLY the JSON array.`;
|
|
256
|
+
const response = await this.callLLMWithAutoRetry(prompt, modelSelector_1.TaskComplexity.COMPLEX, {
|
|
257
|
+
initialMaxTokens: 16000,
|
|
258
|
+
maxRetries: 2,
|
|
259
|
+
onProgress: onProgress
|
|
260
|
+
});
|
|
261
|
+
return this.parseJSON(response.content);
|
|
262
|
+
}
|
|
263
|
+
async generateCreativeAndTech(transcriptStr, metaAndFeatures, onProgress) {
|
|
264
|
+
const prompt = `Generate creative and technical sections.
|
|
265
|
+
|
|
266
|
+
GAME: ${metaAndFeatures.meta.title}
|
|
267
|
+
GENRE: ${metaAndFeatures.meta.genre.join(', ')}
|
|
268
|
+
|
|
269
|
+
CONSTRAINTS - Be concise:
|
|
270
|
+
- Art style: 2-3 sentences max
|
|
271
|
+
- Audio mood: 2-3 sentences max
|
|
272
|
+
- Keep asset counts realistic
|
|
273
|
+
|
|
274
|
+
OUTPUT STRUCTURE (use this EXACT format):
|
|
275
|
+
{
|
|
276
|
+
"creative": {
|
|
277
|
+
"artStyle": "2-3 sentence description of visual style",
|
|
278
|
+
"audioMood": "2-3 sentence description of audio direction",
|
|
279
|
+
"referenceLinks": ["https://example.com/reference1"],
|
|
280
|
+
"assetRequirements": {
|
|
281
|
+
"characters": 10,
|
|
282
|
+
"environments": 5,
|
|
283
|
+
"props": 20,
|
|
284
|
+
"ui": 15,
|
|
285
|
+
"sfx": 30,
|
|
286
|
+
"music": 8
|
|
287
|
+
},
|
|
288
|
+
"pipeline": {
|
|
289
|
+
"toolsRequired": ["Blender", "Photoshop", "Audacity"],
|
|
290
|
+
"workflowNotes": "Brief workflow description"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"technical": {
|
|
294
|
+
"engine": {
|
|
295
|
+
"primary": "Unreal Engine 5",
|
|
296
|
+
"version": "5.4",
|
|
297
|
+
"plugins": ["Niagara", "Chaos Physics"],
|
|
298
|
+
"reasoning": "Why this engine was chosen"
|
|
299
|
+
},
|
|
300
|
+
"toolsRequired": [
|
|
301
|
+
{
|
|
302
|
+
"name": "Visual Studio",
|
|
303
|
+
"purpose": "C++ development",
|
|
304
|
+
"required": true
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "Git",
|
|
308
|
+
"purpose": "Version control",
|
|
309
|
+
"required": true
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"localization": {
|
|
313
|
+
"strategy": "English Only",
|
|
314
|
+
"languages": ["en"],
|
|
315
|
+
"stringCount": 500
|
|
316
|
+
},
|
|
317
|
+
"directoryStructure": "Assets/\n Characters/\n Environments/\nSource/\n Core/\n Features/",
|
|
318
|
+
"buildTargets": ["Windows", "Mac"]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
CRITICAL - Field requirements:
|
|
323
|
+
- engine.primary MUST be one of: "Unreal Engine 5", "Unity", "Godot", "Custom"
|
|
324
|
+
- engine.plugins is OPTIONAL - use [] if none, or omit field entirely
|
|
325
|
+
- localization.strategy MUST be: "None", "English Only", "EFIGS", or "Global"
|
|
326
|
+
- localization.languages is OPTIONAL but recommended (use ["en"] for English Only)
|
|
327
|
+
- buildTargets MUST use exact values: "Windows", "Mac", "Linux", "iOS", "Android", "Console"
|
|
328
|
+
|
|
329
|
+
Output ONLY the JSON.`;
|
|
330
|
+
const response = await this.callLLMWithAutoRetry(prompt, modelSelector_1.TaskComplexity.COMPLEX, {
|
|
331
|
+
initialMaxTokens: 16000,
|
|
332
|
+
maxRetries: 2,
|
|
333
|
+
onProgress: onProgress
|
|
334
|
+
});
|
|
335
|
+
return this.parseJSON(response.content);
|
|
336
|
+
}
|
|
337
|
+
parseJSON(content) {
|
|
338
|
+
const originalContent = content;
|
|
339
|
+
let jsonStr = content.trim();
|
|
340
|
+
// Extract JSON from markdown code blocks
|
|
341
|
+
const codeBlockStart = content.indexOf('```');
|
|
342
|
+
if (codeBlockStart !== -1) {
|
|
343
|
+
const firstNewline = content.indexOf('\n', codeBlockStart);
|
|
344
|
+
const codeBlockEnd = content.lastIndexOf('```');
|
|
345
|
+
if (firstNewline !== -1 && codeBlockEnd > firstNewline) {
|
|
346
|
+
jsonStr = content.substring(firstNewline + 1, codeBlockEnd).trim();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Remove any remaining backticks
|
|
350
|
+
if (jsonStr.includes('```')) {
|
|
351
|
+
jsonStr = jsonStr.replace(/```[a-z]*\n?/g, '').replace(/\n?```/g, '').trim();
|
|
352
|
+
}
|
|
353
|
+
// Find JSON object/array boundaries
|
|
354
|
+
if (!jsonStr.startsWith('{') && !jsonStr.startsWith('[')) {
|
|
355
|
+
const firstBrace = jsonStr.indexOf('{');
|
|
356
|
+
const firstBracket = jsonStr.indexOf('[');
|
|
357
|
+
const startIdx = firstBrace === -1 ? firstBracket :
|
|
358
|
+
firstBracket === -1 ? firstBrace :
|
|
359
|
+
Math.min(firstBrace, firstBracket);
|
|
360
|
+
if (startIdx !== -1) {
|
|
361
|
+
const isObject = jsonStr[startIdx] === '{';
|
|
362
|
+
const lastIdx = isObject ? jsonStr.lastIndexOf('}') : jsonStr.lastIndexOf(']');
|
|
363
|
+
if (lastIdx > startIdx) {
|
|
364
|
+
jsonStr = jsonStr.substring(startIdx, lastIdx + 1);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// Check for truncated JSON before parsing
|
|
369
|
+
const trimmed = jsonStr.trim();
|
|
370
|
+
const startsWithBrace = trimmed.startsWith('{');
|
|
371
|
+
const startsWithBracket = trimmed.startsWith('[');
|
|
372
|
+
const endsWithBrace = trimmed.endsWith('}');
|
|
373
|
+
const endsWithBracket = trimmed.endsWith(']');
|
|
374
|
+
if ((startsWithBrace && !endsWithBrace) || (startsWithBracket && !endsWithBracket)) {
|
|
375
|
+
console.error('JSON appears truncated:');
|
|
376
|
+
console.error(` Length: ${trimmed.length} chars`);
|
|
377
|
+
console.error(` Starts with: ${trimmed.substring(0, 50)}`);
|
|
378
|
+
console.error(` Ends with: ${trimmed.substring(Math.max(0, trimmed.length - 100))}`);
|
|
379
|
+
// Debug logging: Truncation error
|
|
380
|
+
if (debugLogger_1.debugLogger.isEnabled()) {
|
|
381
|
+
debugLogger_1.debugLogger.logJSONParsing({
|
|
382
|
+
agent: this.getAgentName(),
|
|
383
|
+
success: false,
|
|
384
|
+
rawContent: originalContent,
|
|
385
|
+
extractedJSON: jsonStr,
|
|
386
|
+
error: 'JSON response was truncated - likely hit token limit'
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
throw new Error('JSON response was truncated - likely hit token limit. Consider reducing complexity or splitting into smaller passes.');
|
|
390
|
+
}
|
|
391
|
+
try {
|
|
392
|
+
const parsed = JSON.parse(jsonStr);
|
|
393
|
+
// Debug logging: Successful parse
|
|
394
|
+
if (debugLogger_1.debugLogger.isEnabled()) {
|
|
395
|
+
debugLogger_1.debugLogger.logJSONParsing({
|
|
396
|
+
agent: this.getAgentName(),
|
|
397
|
+
success: true,
|
|
398
|
+
rawContent: originalContent,
|
|
399
|
+
extractedJSON: jsonStr,
|
|
400
|
+
parsedObject: parsed
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return parsed;
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
console.error('Failed to parse JSON:');
|
|
407
|
+
console.error(` Length: ${jsonStr.length} chars`);
|
|
408
|
+
console.error(` First 200 chars: ${jsonStr.substring(0, 200)}`);
|
|
409
|
+
console.error(` Last 200 chars: ${jsonStr.substring(Math.max(0, jsonStr.length - 200))}`);
|
|
410
|
+
// Debug logging: Parse error
|
|
411
|
+
if (debugLogger_1.debugLogger.isEnabled()) {
|
|
412
|
+
debugLogger_1.debugLogger.logJSONParsing({
|
|
413
|
+
agent: this.getAgentName(),
|
|
414
|
+
success: false,
|
|
415
|
+
rawContent: originalContent,
|
|
416
|
+
extractedJSON: jsonStr,
|
|
417
|
+
error: error instanceof Error ? error.message : String(error)
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
getSchemaDescription() {
|
|
424
|
+
// Simplified schema description for the LLM
|
|
425
|
+
return `{
|
|
426
|
+
"meta": {
|
|
427
|
+
"id": "string",
|
|
428
|
+
"title": "string",
|
|
429
|
+
"conceptStatement": "string",
|
|
430
|
+
"genre": ["string"],
|
|
431
|
+
"targetPlatform": ["string"],
|
|
432
|
+
"targetAudience": "string",
|
|
433
|
+
"estimatedScope": "Prototype|Vertical Slice|MVP|Full Game",
|
|
434
|
+
"createdAt": "ISO date string",
|
|
435
|
+
"version": "1.0.0"
|
|
436
|
+
},
|
|
437
|
+
"features": [{
|
|
438
|
+
"id": "FEAT-XXX",
|
|
439
|
+
"name": "string",
|
|
440
|
+
"intent": "string",
|
|
441
|
+
"dependencies": ["FEAT-XXX"],
|
|
442
|
+
"monetization": { "strategy": "None|IAP|Premium|Ads|Hybrid", "implementation": "string" },
|
|
443
|
+
"gameplayLoop": ["step1", "step2"],
|
|
444
|
+
"uiRequirements": ["string"],
|
|
445
|
+
"technical": {
|
|
446
|
+
"dataStructure": "pseudo-code string",
|
|
447
|
+
"mathFormulas": [{ "expression": "string", "variables": {"name": {"type": "int|float|bool", "range": "string"}}, "validated": false, "balanceNotes": "string" }],
|
|
448
|
+
"fileLocation": "path/to/files",
|
|
449
|
+
"estimatedComplexity": "Low|Medium|High|Very High"
|
|
450
|
+
},
|
|
451
|
+
"agile": {
|
|
452
|
+
"epic": "EPIC-XXX: Name",
|
|
453
|
+
"userStories": ["As a player, I want..."],
|
|
454
|
+
"acceptanceCriteria": ["Criteria"]
|
|
455
|
+
}
|
|
456
|
+
}],
|
|
457
|
+
"gameObjects": [{
|
|
458
|
+
"id": "NPC-XXX|ITEM-XXX|MON-XXX",
|
|
459
|
+
"name": "string",
|
|
460
|
+
"category": "NPC|Monster|Item|Interactable",
|
|
461
|
+
"narrative": { "backstory": "string", "dialogues": ["string"], "externalData": {...} },
|
|
462
|
+
"stats": {
|
|
463
|
+
"attributes": {"HP": 100, "Speed": "Fast"},
|
|
464
|
+
"behaviors": ["string"],
|
|
465
|
+
"balanceFormulas": [...]
|
|
466
|
+
},
|
|
467
|
+
"references": { "features": ["FEAT-XXX"], "relatedEntities": ["ENTITY-XXX"] }
|
|
468
|
+
}],
|
|
469
|
+
"creative": {
|
|
470
|
+
"artStyle": "string",
|
|
471
|
+
"audioMood": "string",
|
|
472
|
+
"referenceLinks": ["url"],
|
|
473
|
+
"assetRequirements": { "characters": 0, "environments": 0, "props": 0, "ui": 0, "sfx": 0, "music": 0 },
|
|
474
|
+
"pipeline": { "toolsRequired": ["Tool"], "workflowNotes": "string" }
|
|
475
|
+
},
|
|
476
|
+
"technical": {
|
|
477
|
+
"engine": { "primary": "Unreal Engine 5|Unity|Godot|Custom", "version": "string", "plugins": ["string"], "reasoning": "string" },
|
|
478
|
+
"toolsRequired": [{ "name": "Tool", "purpose": "string", "required": true }],
|
|
479
|
+
"localization": { "strategy": "None|English Only|EFIGS|Global", "languages": ["en"], "stringCount": 0 },
|
|
480
|
+
"directoryStructure": "path structure",
|
|
481
|
+
"buildTargets": ["Windows", "Mac", "Linux", "iOS", "Android", "Console"]
|
|
482
|
+
}
|
|
483
|
+
}`;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
exports.Architect = Architect;
|
|
487
|
+
//# sourceMappingURL=Architect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC,CAAC;YACL,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC1B,4CAA4C;QAC5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DT,CAAC;IACD,CAAC;CACF;AA5gBD,8BA4gBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseAgent } from '../base/BaseAgent';
|
|
2
|
+
import { GameBible } from '../../config/schema';
|
|
3
|
+
export interface ChaosIssue {
|
|
4
|
+
category: 'Gameplay' | 'Technical' | 'Scope' | 'Consistency';
|
|
5
|
+
severity: 'Critical' | 'Major' | 'Minor';
|
|
6
|
+
description: string;
|
|
7
|
+
location: string;
|
|
8
|
+
recommendation: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class Chaos extends BaseAgent {
|
|
11
|
+
constructor(apiKey: string, costTracker: any, modelSelector: any);
|
|
12
|
+
execute(bible: GameBible, onProgress?: (message: string) => void): Promise<ChaosIssue[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Chaos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chaos.d.ts","sourceRoot":"","sources":["../../../src/agents/core/Chaos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAAC;IAC7D,QAAQ,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,KAAM,SAAQ,SAAS;gBACtB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG;IAkB1D,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CA2C/F"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chaos = void 0;
|
|
4
|
+
const BaseAgent_1 = require("../base/BaseAgent");
|
|
5
|
+
const modelSelector_1 = require("../../utils/modelSelector");
|
|
6
|
+
class Chaos extends BaseAgent_1.BaseAgent {
|
|
7
|
+
constructor(apiKey, costTracker, modelSelector) {
|
|
8
|
+
const config = {
|
|
9
|
+
systemPrompt: `You are Chaos, the adversarial design critic.
|
|
10
|
+
Your role is to identify gaps, inconsistencies, and potential issues in game designs.
|
|
11
|
+
|
|
12
|
+
Focus on:
|
|
13
|
+
1. Gameplay loops that don't close (missing mechanics)
|
|
14
|
+
2. Technical impossibilities or over-scoping
|
|
15
|
+
3. Features that contradict each other
|
|
16
|
+
4. Monetization that breaks game balance
|
|
17
|
+
5. Unrealistic asset/scope expectations
|
|
18
|
+
|
|
19
|
+
Be critical but constructive. Every issue must have a recommendation.`,
|
|
20
|
+
temperature: 0.8
|
|
21
|
+
};
|
|
22
|
+
super(apiKey, config, costTracker, modelSelector);
|
|
23
|
+
}
|
|
24
|
+
async execute(bible, onProgress) {
|
|
25
|
+
const bibleStr = JSON.stringify(bible, null, 2);
|
|
26
|
+
const prompt = `Analyze this Game Design Document for critical issues:
|
|
27
|
+
|
|
28
|
+
${bibleStr}
|
|
29
|
+
|
|
30
|
+
Identify ALL significant problems in these categories:
|
|
31
|
+
1. **Gameplay**: Broken loops, missing mechanics, unfun systems
|
|
32
|
+
2. **Technical**: Over-scoping, engine limitations, impossible requirements
|
|
33
|
+
3. **Scope**: Unrealistic for team size/timeline, asset bloat
|
|
34
|
+
4. **Consistency**: Contradictory features, narrative mismatches
|
|
35
|
+
|
|
36
|
+
For each issue, provide:
|
|
37
|
+
- category: Gameplay | Technical | Scope | Consistency
|
|
38
|
+
- severity: Critical | Major | Minor
|
|
39
|
+
- description: What's wrong (1-2 sentences)
|
|
40
|
+
- location: Where in the document (e.g., "features[2]")
|
|
41
|
+
- recommendation: How to fix it
|
|
42
|
+
|
|
43
|
+
Output as JSON array of issues. Be thorough - find 5-10 real problems.`;
|
|
44
|
+
const result = await this.callLLMWithAutoRetry(prompt, modelSelector_1.TaskComplexity.COMPLEX, {
|
|
45
|
+
initialMaxTokens: 16000,
|
|
46
|
+
maxRetries: 2,
|
|
47
|
+
onProgress: onProgress
|
|
48
|
+
});
|
|
49
|
+
try {
|
|
50
|
+
const jsonMatch = result.content.match(/```json\n([\s\S]*?)\n```/) || result.content.match(/\[([\s\S]*?)\]/);
|
|
51
|
+
const jsonStr = jsonMatch ? (jsonMatch[1] || jsonMatch[0]) : result.content;
|
|
52
|
+
const issues = JSON.parse(jsonStr);
|
|
53
|
+
return issues;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return [{
|
|
57
|
+
category: 'Consistency',
|
|
58
|
+
severity: 'Minor',
|
|
59
|
+
description: 'Chaos Agent failed to parse issues',
|
|
60
|
+
location: 'N/A',
|
|
61
|
+
recommendation: 'Manual review recommended'
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.Chaos = Chaos;
|
|
67
|
+
//# sourceMappingURL=Chaos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chaos.js","sourceRoot":"","sources":["../../../src/agents/core/Chaos.ts"],"names":[],"mappings":";;;AAAA,iDAA2D;AAC3D,6DAA2D;AA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AE,2BAA2B;iBAC5C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA9DD,sBA8DC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GameBible } from '../../config/schema';
|
|
2
|
+
export interface ConsistencyIssue {
|
|
3
|
+
severity: 'Error' | 'Warning' | 'Info';
|
|
4
|
+
message: string;
|
|
5
|
+
location: string;
|
|
6
|
+
suggestion?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConsistencyAgent {
|
|
9
|
+
validate(bible: GameBible): ConsistencyIssue[];
|
|
10
|
+
private checkFeatureDependencies;
|
|
11
|
+
private detectCircularReferences;
|
|
12
|
+
private validateNamingConventions;
|
|
13
|
+
private checkAssetBalance;
|
|
14
|
+
private detectMissingFeatures;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Consistency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Consistency.d.ts","sourceRoot":"","sources":["../../../src/agents/core/Consistency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,EAAE;IAY9C,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,wBAAwB;IAqChC,OAAO,CAAC,yBAAyB;IA0BjC,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,qBAAqB;CAyB9B"}
|