-
Notifications
You must be signed in to change notification settings - Fork 38
Add task detail view with navigation, messaging, and log history #774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2e5d175
Add task detail view with navigation and log streaming
EhabY 8075a13
Rebase fallout and Self-review
EhabY 269db31
Add support to sending messages for created tasks
EhabY c0bbaa1
Improve task detail view scroll, layout, and chat styling
EhabY a58143c
Refactoring
EhabY 60598e7
Add tests
EhabY b60effb
Address review comments
EhabY 1b3f642
Remove unused notification
EhabY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { VscodeScrollable } from "@vscode-elements/react-elements"; | ||
|
|
||
| import { useFollowScroll } from "../hooks/useFollowScroll"; | ||
|
|
||
| import type { LogsStatus, TaskLogEntry } from "@repo/shared"; | ||
|
|
||
| interface AgentChatHistoryProps { | ||
| logs: TaskLogEntry[]; | ||
| logsStatus: LogsStatus; | ||
| isThinking: boolean; | ||
| } | ||
|
|
||
| function LogEntry({ | ||
| log, | ||
| isGroupStart, | ||
| }: { | ||
| log: TaskLogEntry; | ||
| isGroupStart: boolean; | ||
| }) { | ||
| return ( | ||
| <div className={`log-entry log-entry-${log.type}`}> | ||
| {isGroupStart && ( | ||
| <div className="log-entry-role"> | ||
| {log.type === "input" ? "You" : "Agent"} | ||
| </div> | ||
| )} | ||
| {log.content} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export function AgentChatHistory({ | ||
| logs, | ||
| logsStatus, | ||
| isThinking, | ||
| }: AgentChatHistoryProps) { | ||
| const bottomRef = useFollowScroll(); | ||
|
|
||
| return ( | ||
| <div className="agent-chat-history"> | ||
| <div className="chat-history-header">Agent chat history</div> | ||
| <VscodeScrollable className="chat-history-content"> | ||
| {logs.length === 0 ? ( | ||
| <div | ||
| className={ | ||
| logsStatus === "error" | ||
| ? "chat-history-empty chat-history-error" | ||
| : "chat-history-empty" | ||
| } | ||
| > | ||
| {getEmptyMessage(logsStatus)} | ||
| </div> | ||
| ) : ( | ||
| logs.map((log, index) => ( | ||
| <LogEntry | ||
| key={log.id} | ||
| log={log} | ||
| isGroupStart={index === 0 || log.type !== logs[index - 1].type} | ||
| /> | ||
| )) | ||
| )} | ||
| {isThinking && ( | ||
| <div className="log-entry log-entry-thinking">Thinking...</div> | ||
| )} | ||
| <div ref={bottomRef} /> | ||
EhabY marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </VscodeScrollable> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function getEmptyMessage(logsStatus: LogsStatus): string { | ||
| switch (logsStatus) { | ||
EhabY marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| case "not_available": | ||
| return "Logs not available in current task state"; | ||
| case "error": | ||
| return "Failed to load logs"; | ||
| case "ok": | ||
EhabY marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return "No messages yet"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { VscodeIcon } from "@vscode-elements/react-elements"; | ||
|
|
||
| import { useTasksApi } from "../hooks/useTasksApi"; | ||
|
|
||
| import type { Task } from "@repo/shared"; | ||
|
|
||
| interface ErrorBannerProps { | ||
| task: Task; | ||
| } | ||
|
|
||
| export function ErrorBanner({ task }: ErrorBannerProps) { | ||
| const api = useTasksApi(); | ||
| const message = task.current_state?.message || "Task failed"; | ||
|
|
||
| return ( | ||
| <div className="error-banner"> | ||
| <VscodeIcon name="warning" /> | ||
| <span>{message}</span> | ||
| <button | ||
| type="button" | ||
| className="text-link" | ||
| onClick={() => api.viewLogs(task.id)} | ||
EhabY marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| View logs <VscodeIcon name="link-external" /> | ||
| </button> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.