generated from nhcarrigan/template
feat: add agent_type field and support Agent tool rename from CLI v2.1.69
- Parse agent_type from SubagentStart hook events and forward via claude:agent-update - Support renamed Agent/Agent(type) tool alongside existing Task/Task(type) syntax - Fall back to prompt field when description is absent in Agent tool input - Display agentType (with subagentType fallback) in agent monitor badge - Show agentId as tooltip on the type badge when available
This commit is contained in:
@@ -282,8 +282,9 @@
|
||||
class="px-1.5 py-0.5 text-[10px] rounded border {getStatusBadgeClass(
|
||||
agent.status
|
||||
)}"
|
||||
title={agent.agentId ? `ID: ${agent.agentId}` : undefined}
|
||||
>
|
||||
{getSubagentTypeLabel(agent.subagentType)}
|
||||
{getSubagentTypeLabel(agent.agentType ?? agent.subagentType)}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
|
||||
@@ -121,6 +121,28 @@ describe("agents store", () => {
|
||||
const agents = get(getAgentsForConversation(conversationId));
|
||||
expect(agents[0].agentId).toBeUndefined();
|
||||
});
|
||||
|
||||
it("updates agentType when provided alongside agentId", () => {
|
||||
const agent = createMockAgent({ agentId: undefined });
|
||||
agentStore.addAgent(conversationId, agent);
|
||||
|
||||
agentStore.updateAgentId(conversationId, agent.toolUseId, "agent-abc123", "general-purpose");
|
||||
|
||||
const agents = get(getAgentsForConversation(conversationId));
|
||||
expect(agents[0].agentId).toBe("agent-abc123");
|
||||
expect(agents[0].agentType).toBe("general-purpose");
|
||||
});
|
||||
|
||||
it("does not set agentType when not provided", () => {
|
||||
const agent = createMockAgent({ agentId: undefined });
|
||||
agentStore.addAgent(conversationId, agent);
|
||||
|
||||
agentStore.updateAgentId(conversationId, agent.toolUseId, "agent-abc123");
|
||||
|
||||
const agents = get(getAgentsForConversation(conversationId));
|
||||
expect(agents[0].agentId).toBe("agent-abc123");
|
||||
expect(agents[0].agentType).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("endAgent", () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ function createAgentStore() {
|
||||
});
|
||||
},
|
||||
|
||||
updateAgentId(conversationId: string, toolUseId: string, agentId: string) {
|
||||
updateAgentId(conversationId: string, toolUseId: string, agentId: string, agentType?: string) {
|
||||
agentsByConversation.update((state) => {
|
||||
const agents = state[conversationId];
|
||||
if (!agents) return state;
|
||||
@@ -36,6 +36,7 @@ function createAgentStore() {
|
||||
updated[agentIndex] = {
|
||||
...updated[agentIndex],
|
||||
agentId,
|
||||
...(agentType !== undefined ? { agentType } : {}),
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
+3
-2
@@ -538,9 +538,10 @@ export async function initializeTauriListeners() {
|
||||
conversationId: string;
|
||||
toolUseId: string;
|
||||
agentId: string;
|
||||
agentType?: string;
|
||||
}>("claude:agent-update", (event) => {
|
||||
const { conversationId, toolUseId, agentId } = event.payload;
|
||||
agentStore.updateAgentId(conversationId, toolUseId, agentId);
|
||||
const { conversationId, toolUseId, agentId, agentType } = event.payload;
|
||||
agentStore.updateAgentId(conversationId, toolUseId, agentId, agentType);
|
||||
});
|
||||
unlisteners.push(agentUpdateUnlisten);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ export type AgentStatus = "running" | "completed" | "errored";
|
||||
export interface AgentInfo {
|
||||
toolUseId: string;
|
||||
agentId?: string;
|
||||
agentType?: string;
|
||||
description: string;
|
||||
subagentType: string;
|
||||
startedAt: number;
|
||||
|
||||
Reference in New Issue
Block a user