feat(FN-3037): add focus-visible styling to AgentLogViewer log action butto

Adds `focus-visible` styling to action buttons in the AgentLogViewer component, improving keyboard accessibility for interactive button elements.

Fusion-Task-Id: FN-3037
This commit is contained in:
Fusion
2026-04-30 19:16:41 -07:00
committed by gsxdsm
parent d3c6859819
commit dac2597beb
13 changed files with 593 additions and 432 deletions

View File

@@ -327,7 +327,23 @@ describe("AgentLogger", () => {
expect(store.appendAgentLog).toHaveBeenCalledWith("FN-016", "Read", "tool_error", "file not found", "executor");
});
it("truncates long tool results to 500 chars", async () => {
it("preserves long tool errors without truncation", async () => {
const store = createMockStore();
const logger = new AgentLogger({
store,
taskId: "FN-016B",
agent: "executor",
});
const longError = "error:" + "y".repeat(1200);
logger.onToolEnd("Read", true, longError);
await vi.advanceTimersByTimeAsync(0);
const call = (store.appendAgentLog as ReturnType<typeof vi.fn>).mock.calls[0];
expect(call[3]).toBe(longError);
});
it("preserves long tool results without truncation", async () => {
const store = createMockStore();
const logger = new AgentLogger({
store,
@@ -340,7 +356,7 @@ describe("AgentLogger", () => {
await vi.advanceTimersByTimeAsync(0);
const call = (store.appendAgentLog as ReturnType<typeof vi.fn>).mock.calls[0];
expect(call[3]).toBe("x".repeat(500) + "…");
expect(call[3]).toBe(longResult);
});
it("handles undefined result in onToolEnd", async () => {

View File

@@ -160,14 +160,13 @@ export class AgentLogger {
*
* @param name - The tool name
* @param isError - Whether the tool execution resulted in an error
* @param result - Optional result value (truncated for persistence)
* @param result - Optional result value (persisted in full)
*/
onToolEnd(name: string, isError: boolean, result?: unknown): void {
const type = isError ? "tool_error" : "tool_result";
let detail: string | undefined;
if (result !== undefined && result !== null) {
const str = typeof result === "string" ? result : JSON.stringify(result);
detail = str.length > 500 ? str.slice(0, 500) + "…" : str;
detail = typeof result === "string" ? result : JSON.stringify(result);
}
this.store.appendAgentLog(this.taskId, name, type, detail, this.agent).catch((err) => {
this.log.warn(`Failed to log tool end "${name}" (${type}) for ${this.taskId}: ${err instanceof Error ? err.message : String(err)}`);