feat(app): chat turns show reasoning above the answer and tool calls as one chip with a formatted call sheet, as the web

This commit is contained in:
2026-10-23 15:52:51 +01:00
parent c2f1a4cb94
commit 522729ad57
7 changed files with 516 additions and 48 deletions
+25 -11
View File
@@ -191,6 +191,17 @@ try {
}
return node;
};
// A real pointer tap at the node's centre, for controls inside a modal sheet.
const tap = async (name) => {
const node = await findNode(name);
if (!node) throw new Error(`Could not tap ${JSON.stringify(name)}`);
const x = node.x + node.w / 2;
const y = node.y + node.h / 2;
for (const type of ['mousePressed', 'mouseReleased']) {
await send('Input.dispatchMouseEvent', { type, x, y, button: 'left', clickCount: 1 }, session);
}
await delay(450);
};
const click = async (name) => {
const clicked = await evaluate(`(() => {
const wanted = ${JSON.stringify(name)};
@@ -302,7 +313,7 @@ try {
'User message',
'Assistant message',
'Reasoning',
'shell',
'1 tool call, expand for details',
'Unrecognised part: future_part',
'Ada phone',
]) {
@@ -352,21 +363,24 @@ try {
`Cupertino reasoning did not announce aria-expanded=true: ${JSON.stringify(openReasoningNode)}`,
);
}
await assertBodyEdge(openReasoning, 'Reasoning', 'shell');
await click('shell');
const openTool = await capture(`${style}-tool-expanded`);
for (const text of ['command', '-la', 'completed']) {
await assertOcr(openTool, text);
}
await assertBodyEdge(openTool, 'shell', 'Second');
await click('Unrecognised part: future_part');
const openUnknown = await capture(`${style}-unknown-expanded`);
for (const text of ['future_part', 'payload', 'kept', 'count']) {
await assertOcr(openUnknown, text);
}
await assertBodyEdge(openUnknown, 'Unrecognised', null);
// As the web: the turn's tool calls are one chip below the answer that
// opens a sheet; a call there opens to its formatted input.
await click('1 tool call, expand for details');
await waitFor(async () => Boolean(await findNode('shell · ls -la')), 'tool sheet');
// Let the sheet finish its entrance before the row is activated.
await delay(800);
await tap('shell · ls -la');
await delay(600);
const openTool = await capture(`${style}-tool-expanded`);
for (const text of ['INPUT', 'command', '-la']) {
await assertOcr(openTool, text);
}
const report = JSON.stringify(evidence, null, 2);
await writeFile(join(out, `${style}-evidence.json`), report);