fix: preserve toolArguments through normalization and activity state

- Add toolArguments to normalizeRunTimelineEvent output so persisted
  sessions retain tool argument data across app restarts
- Add toolArguments field to AgentActivityState and propagate it in
  applySessionEventActivity for real-time activity labels
- Add tests for normalization round-trip with and without toolArguments
- Add test for activity state including toolArguments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-04-08 12:55:03 +02:00
co-authored by Copilot
parent b9e73831e8
commit fa8f6ef4b3
4 changed files with 95 additions and 0 deletions
+2
View File
@@ -7,6 +7,7 @@ export interface AgentActivityState {
agentName: string;
activityType?: SessionEventRecord['activityType'];
toolName?: string;
toolArguments?: Record<string, unknown>;
}
export interface SessionUsageState {
@@ -45,6 +46,7 @@ export function applySessionEventActivity(
agentName: event.agentName?.trim() || event.agentId?.trim() || agentKey,
activityType: event.activityType,
toolName: event.toolName,
toolArguments: event.toolArguments,
},
},
};
+1
View File
@@ -494,6 +494,7 @@ function normalizeRunTimelineEvent(
targetAgentName: normalizeOptionalString(event.targetAgentName),
toolName: normalizeOptionalString(event.toolName),
toolCallId: normalizeOptionalString(event.toolCallId),
toolArguments: event.toolArguments,
fileChanges: normalizeToolCallFileChanges(event.fileChanges),
approvalId: normalizeOptionalString(event.approvalId),
approvalKind: event.approvalKind,