feat(KB-123): add agent role tracking and expanded logging to agent system

- Extend AgentLogEntry with agent field and new event types (thinking, tool_end)
- Expand AgentLogger with thinking, tool_end callbacks and agent role support
- Wire new logging callbacks in createKbAgent and all agent call-sites (executor, merger, reviewer, triage, pi)
- Update AgentLogViewer with agent role badges and rendering for new entry types
- Export AgentRole and AgentLogType from core package and add tests for new functionality
This commit is contained in:
Dustin Byrne
2026-03-27 01:19:42 -04:00
parent c8d6d29794
commit 82be575fc0
14 changed files with 474 additions and 66 deletions

View File

@@ -528,7 +528,7 @@ describe("TriageProcessor agent log persistence", () => {
});
// Text buffer is flushed in finally block
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "Hello world", "text");
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "Hello world", "text", undefined, "triage");
});
it("logs tool invocations to store.appendAgentLog", async () => {
@@ -561,7 +561,7 @@ describe("TriageProcessor agent log persistence", () => {
updatedAt: new Date().toISOString(),
});
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "Read", "tool", "foo.ts");
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "Read", "tool", "foo.ts", "triage");
});
it("still fires onAgentText callback alongside logging", async () => {
@@ -596,6 +596,6 @@ describe("TriageProcessor agent log persistence", () => {
});
expect(onAgentText).toHaveBeenCalledWith("KB-001", "hi");
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "hi", "text");
expect(store.appendAgentLog).toHaveBeenCalledWith("KB-001", "hi", "text", undefined, "triage");
});
});