mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
feat(panel): add conversation turn rail, prompt preview, and decoupled step toggles
- Track user input turn boundaries and prompt previews in extractModelSteps while stripping compaction summary headers - Align interleaved main and subagent steps onto unified rootTurnIndex in telemetry-builder and scope lazy cache refresh to the active session family - Render dynamic left-edge turn rail and viewport-clamped prompt tooltip in StepsDetailView across arbitrary custom column orders - Decouple [主]/[子] agent badges from step index and add independent switches for Turn Rail and Agent Badge under Preferences -> Structure Co-authored-by: Swei <sweilo@qq.com>
This commit is contained in:
@@ -295,3 +295,59 @@ test('extractLiveActivity covers thinking, partial streaming tool args, multi-to
|
||||
assert.equal(actTranscript2.stepProgress, '2/2');
|
||||
assert.equal(actTranscript2.detail, '列出插件项目全部源文件 (Get-ChildItem -Path "f:\\ppt")');
|
||||
});
|
||||
|
||||
test('extractModelSteps tracks sequential user turns, merges consecutive prompts, marks media, and strips compaction context summaries', () => {
|
||||
const mkModelStep = (stepIndex) => ({
|
||||
status: 'CORTEX_STEP_STATUS_DONE',
|
||||
type: 'CORTEX_STEP_TYPE_PLANNER_RESPONSE',
|
||||
metadata: {
|
||||
sourceTrajectoryStepInfo: { stepIndex },
|
||||
createdAt: '2026-01-01T00:00:00Z',
|
||||
finishedGeneratingAt: '2026-01-01T00:00:02Z',
|
||||
modelUsage: { inputTokens: '100', cacheReadTokens: '200', outputTokens: '80' },
|
||||
},
|
||||
plannerResponse: { response: 'ok' },
|
||||
});
|
||||
|
||||
const steps = extractModelSteps([
|
||||
{
|
||||
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||
userInput: { userResponse: '第一轮提问' },
|
||||
},
|
||||
mkModelStep(1),
|
||||
{ type: 'CORTEX_STEP_TYPE_VIEW_FILE' },
|
||||
mkModelStep(3),
|
||||
{
|
||||
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||
userInput: { userResponse: '取消前一句' },
|
||||
},
|
||||
{
|
||||
type: 'CORTEX_STEP_TYPE_USER_INPUT',
|
||||
userInput: { userResponse: '第二轮补充提问', media: [{}] },
|
||||
},
|
||||
mkModelStep(7),
|
||||
{
|
||||
type: 'USER_INPUT',
|
||||
content:
|
||||
'<CONTEXT_SUMMARY><USER_REQUEST>旧摘要文本</USER_REQUEST></CONTEXT_SUMMARY>\n<USER_REQUEST>\n 第三轮真实提问 \n</USER_REQUEST>\n<ADDITIONAL_METADATA>ignored</ADDITIONAL_METADATA>',
|
||||
},
|
||||
mkModelStep(9),
|
||||
]);
|
||||
|
||||
assert.equal(steps.length, 4);
|
||||
assert.equal(steps[0].turnIndex, 1);
|
||||
assert.equal(steps[0].isTurnStart, true);
|
||||
assert.equal(steps[0].turnPrompt, '第一轮提问');
|
||||
|
||||
assert.equal(steps[1].turnIndex, 1);
|
||||
assert.equal(steps[1].isTurnStart, false);
|
||||
assert.equal(steps[1].turnPrompt, undefined);
|
||||
|
||||
assert.equal(steps[2].turnIndex, 2);
|
||||
assert.equal(steps[2].isTurnStart, true);
|
||||
assert.equal(steps[2].turnPrompt, '取消前一句\n第二轮补充提问 [附图]');
|
||||
|
||||
assert.equal(steps[3].turnIndex, 3);
|
||||
assert.equal(steps[3].isTurnStart, true);
|
||||
assert.equal(steps[3].turnPrompt, '第三轮真实提问');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user