mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add minimalist conversation turn rail and prompt preview in steps table
This commit is contained in:
@@ -542,3 +542,69 @@ test('supports Gemini 4 Carbon pricing/pool and resolves all newly added languag
|
||||
assert.equal(p.quotas.activePool.poolKey, 'Carbon');
|
||||
assert.equal(p.quotas.activePool.weeklyRemainingIntPct, 65);
|
||||
});
|
||||
|
||||
test('assigns unified rootTurnIndex across interleaved main and subagent steps so All view turn rail never fragments', async () => {
|
||||
const mkPlanner = (stepIndex, createdAt, finishedGeneratingAt) => ({
|
||||
status: 'CORTEX_STEP_STATUS_DONE',
|
||||
type: 'CORTEX_STEP_TYPE_PLANNER_RESPONSE',
|
||||
metadata: {
|
||||
sourceTrajectoryStepInfo: { stepIndex },
|
||||
createdAt,
|
||||
finishedGeneratingAt,
|
||||
modelUsage: { model: 'MODEL_PLACEHOLDER_M429', inputTokens: '100', cacheReadTokens: '0', outputTokens: '80' },
|
||||
},
|
||||
plannerResponse: { response: 'ok' },
|
||||
});
|
||||
|
||||
const h = backendHarness({
|
||||
trajectories: {
|
||||
'root-turn': {
|
||||
trajectory: {
|
||||
steps: [
|
||||
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: '第一轮设计' } },
|
||||
mkPlanner(1, '2026-11-13T20:00:01Z', '2026-11-13T20:00:03Z'),
|
||||
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: '确认。设计是满意的。执行' } },
|
||||
mkPlanner(3, '2026-11-13T20:33:10Z', '2026-11-13T20:33:12Z'),
|
||||
mkPlanner(5, '2026-11-13T20:33:30Z', '2026-11-13T20:33:35Z'),
|
||||
],
|
||||
},
|
||||
},
|
||||
'sub-turn': {
|
||||
trajectory: {
|
||||
metadata: { parentConversationId: 'root-turn', rootConversationId: 'root-turn' },
|
||||
steps: [
|
||||
{ type: 'CORTEX_STEP_TYPE_USER_INPUT', userInput: { userResponse: 'Subagent internal brief' } },
|
||||
mkPlanner(1, '2026-11-13T20:33:20Z', '2026-11-13T20:33:25Z'),
|
||||
mkPlanner(2, '2026-11-13T20:33:40Z', '2026-11-13T20:33:45Z'),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
summaries: {
|
||||
'root-turn': { stepCount: 5, lastModifiedTime: '2026-11-13T20:33:35Z', status: 'IDLE' },
|
||||
'sub-turn': {
|
||||
stepCount: 3,
|
||||
lastModifiedTime: '2026-11-13T20:33:45Z',
|
||||
status: 'IDLE',
|
||||
trajectoryMetadata: { parentConversationId: 'root-turn', rootConversationId: 'root-turn' },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const p = await h.buildTelemetryPayloadInternal('root-turn');
|
||||
const mainSteps = p.activeConversation.recentSteps; // desc: #5 (20:33:30), #3 (20:33:10), #1 (20:00:01)
|
||||
const subSteps = p.activeConversation.agents[1].recentSteps; // desc: #2 (20:33:40), #1 (20:33:20)
|
||||
|
||||
// All 4 Turn-2 steps (main #3, sub #1, main #5, sub #2) share rootTurnIndex=2 and rootTurnPrompt='确认。设计是满意的。执行'
|
||||
for (const s of [mainSteps[0], mainSteps[1], subSteps[0], subSteps[1]]) {
|
||||
assert.equal(s.rootTurnIndex, 2);
|
||||
assert.equal(s.isRootLatestTurn, true);
|
||||
assert.equal(s.rootTurnPrompt, '确认。设计是满意的。执行');
|
||||
}
|
||||
// Only main #3 (earliest step of Turn 2) is marked isRootTurnStart; subagent #1 keeps its own isTurnStart for subagent-only filter
|
||||
assert.equal(mainSteps[1].isRootTurnStart, true);
|
||||
assert.equal(mainSteps[0].isRootTurnStart, false);
|
||||
assert.equal(subSteps[1].isRootTurnStart, false);
|
||||
assert.equal(subSteps[1].isTurnStart, true);
|
||||
assert.equal(subSteps[1].turnPrompt, 'Subagent internal brief');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user