@vfarcic/dot-ai 0.12.0 → 0.13.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,6EAA6E,CAAC;AAG1H,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;
|
|
1
|
+
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,6EAA6E,CAAC;AAG1H,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;AA6eF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAC7G,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAmTxD"}
|
|
@@ -227,21 +227,50 @@ function getCurrentStage(solution) {
|
|
|
227
227
|
/**
|
|
228
228
|
* Validate stage transition is allowed
|
|
229
229
|
*/
|
|
230
|
-
function validateStageTransition(currentStage, requestedStage) {
|
|
231
|
-
|
|
232
|
-
'required': ['basic', 'open'],
|
|
233
|
-
'basic': ['advanced', 'open'],
|
|
234
|
-
'advanced': ['open'],
|
|
235
|
-
'open': []
|
|
236
|
-
};
|
|
230
|
+
function validateStageTransition(currentStage, requestedStage, solution) {
|
|
231
|
+
// Allow processing the same stage (for answering or skipping)
|
|
237
232
|
if (currentStage === requestedStage) {
|
|
238
|
-
return { valid: true };
|
|
233
|
+
return { valid: true };
|
|
234
|
+
}
|
|
235
|
+
// Determine the next stage based on what questions exist
|
|
236
|
+
let expectedNext = null;
|
|
237
|
+
if (currentStage === 'required') {
|
|
238
|
+
if (solution.questions.basic && solution.questions.basic.length > 0) {
|
|
239
|
+
expectedNext = 'basic';
|
|
240
|
+
}
|
|
241
|
+
else if (solution.questions.advanced && solution.questions.advanced.length > 0) {
|
|
242
|
+
expectedNext = 'advanced';
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
expectedNext = 'open';
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (currentStage === 'basic') {
|
|
249
|
+
if (solution.questions.advanced && solution.questions.advanced.length > 0) {
|
|
250
|
+
expectedNext = 'advanced';
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
expectedNext = 'open';
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else if (currentStage === 'advanced') {
|
|
257
|
+
expectedNext = 'open';
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
expectedNext = null; // open stage is final
|
|
261
|
+
}
|
|
262
|
+
// If we're at the final stage, no transitions allowed
|
|
263
|
+
if (expectedNext === null) {
|
|
264
|
+
return {
|
|
265
|
+
valid: false,
|
|
266
|
+
error: `Cannot transition from '${currentStage}' stage. All stages completed.`
|
|
267
|
+
};
|
|
239
268
|
}
|
|
240
|
-
|
|
241
|
-
if (
|
|
269
|
+
// Only allow transition to the immediate next stage
|
|
270
|
+
if (requestedStage !== expectedNext) {
|
|
242
271
|
return {
|
|
243
272
|
valid: false,
|
|
244
|
-
error: `Cannot
|
|
273
|
+
error: `Cannot skip to '${requestedStage}' stage. Must process '${expectedNext}' stage next. Use empty answers to skip the current stage.`
|
|
245
274
|
};
|
|
246
275
|
}
|
|
247
276
|
return { valid: true };
|
|
@@ -483,7 +512,7 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
483
512
|
// Stage-based validation and workflow
|
|
484
513
|
const stageState = getCurrentStage(solution);
|
|
485
514
|
// Validate stage transition
|
|
486
|
-
const transitionResult = validateStageTransition(stageState.currentStage, args.stage);
|
|
515
|
+
const transitionResult = validateStageTransition(stageState.currentStage, args.stage, solution);
|
|
487
516
|
if (!transitionResult.valid) {
|
|
488
517
|
const response = {
|
|
489
518
|
status: 'stage_error',
|