feat: Extend AgentInfo with exitCode + add getAgentInputFiles/getAgentPrompt tRPC procedures
Adds exitCode to AgentInfo type and propagates it through all toAgentInfo() implementations. Enhances getAgent to also return taskName and initiativeName from their respective repositories. Adds two new filesystem-reading tRPC procedures for the Agent Details tab: getAgentInputFiles (reads .cw/input/ files with binary detection, 500 KB cap, sorted) and getAgentPrompt (reads .cw/agent-logs/<name>/PROMPT.md with 1 MB cap and structured ENOENT handling). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ export interface AgentInfo {
|
||||
status: string;
|
||||
initiativeId?: string | null;
|
||||
worktreeId: string;
|
||||
exitCode?: number | null;
|
||||
}
|
||||
|
||||
export interface CleanupStrategy {
|
||||
|
||||
@@ -353,6 +353,7 @@ export class AgentLifecycleController {
|
||||
status: agent.status,
|
||||
initiativeId: agent.initiativeId,
|
||||
worktreeId: agent.worktreeId,
|
||||
exitCode: agent.exitCode ?? null,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1085,6 +1085,7 @@ export class MultiProviderAgentManager implements AgentManager {
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
userDismissedAt?: Date | null;
|
||||
exitCode?: number | null;
|
||||
}): AgentInfo {
|
||||
return {
|
||||
id: agent.id,
|
||||
@@ -1100,6 +1101,7 @@ export class MultiProviderAgentManager implements AgentManager {
|
||||
createdAt: agent.createdAt,
|
||||
updatedAt: agent.updatedAt,
|
||||
userDismissedAt: agent.userDismissedAt,
|
||||
exitCode: agent.exitCode ?? null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ export class MockAgentManager implements AgentManager {
|
||||
accountId: null,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
exitCode: null,
|
||||
};
|
||||
|
||||
const record: MockAgentRecord = {
|
||||
|
||||
@@ -93,6 +93,8 @@ export interface AgentInfo {
|
||||
updatedAt: Date;
|
||||
/** When the user dismissed this agent (null if not dismissed) */
|
||||
userDismissedAt?: Date | null;
|
||||
/** Process exit code — null while running or if not yet exited */
|
||||
exitCode: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user