Repository navigation
feat(desktop): show each agent's latest tool call in the sidebar agents card #7143
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
Open
Kitenite
wants to merge
2
commits into
main
Choose a base branch
from
grok-bot-design-patterns
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions
21
...s/DashboardSidebarAgentHoverRow/utils/describeAgentActivity/describeAgentActivity.test.ts
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,21 @@ | ||
| import { describe, expect, it } from "bun:test"; | ||
| import { describeAgentActivity } from "./describeAgentActivity"; | ||
|
|
||
| describe("describeAgentActivity", () => { | ||
| it("maps known tools to a verb regardless of case", () => { | ||
| expect(describeAgentActivity({ tool: "Edit", detail: "a.ts" })).toEqual({ | ||
| verb: "edit", | ||
| tool: "Edit", | ||
| detail: "a.ts", | ||
| }); | ||
| expect(describeAgentActivity({ tool: "bash" }).verb).toBe("run"); | ||
| expect(describeAgentActivity({ tool: "WebFetch" }).verb).toBe("fetch"); | ||
| }); | ||
|
|
||
| it("falls through to the raw tool name for unknown tools", () => { | ||
| expect(describeAgentActivity({ tool: "mcp__linear__get_issue" })).toEqual({ | ||
| verb: null, | ||
| tool: "mcp__linear__get_issue", | ||
| }); | ||
| }); | ||
| }); |
49 changes: 49 additions & 0 deletions
49
...onents/DashboardSidebarAgentHoverRow/utils/describeAgentActivity/describeAgentActivity.ts
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,49 @@ | ||
| /** | ||
| * Coarse verb for an agent tool name. Tool names are the agent's own | ||
| * (Claude's `Edit`, Grok's `bash`, …); matching is case-insensitive and | ||
| * anything unrecognized falls through as the raw tool name. | ||
| */ | ||
| export type AgentActivityVerb = | ||
| | "edit" | ||
| | "read" | ||
| | "run" | ||
| | "search" | ||
| | "fetch" | ||
| | "delegate"; | ||
|
|
||
| const VERB_BY_TOOL: Record<string, AgentActivityVerb> = { | ||
| edit: "edit", | ||
| multiedit: "edit", | ||
| write: "edit", | ||
| notebookedit: "edit", | ||
| apply_patch: "edit", | ||
| read: "read", | ||
| bash: "run", | ||
| shell: "run", | ||
| grep: "search", | ||
| glob: "search", | ||
| ls: "search", | ||
| webfetch: "fetch", | ||
| websearch: "fetch", | ||
| task: "delegate", | ||
| agent: "delegate", | ||
| }; | ||
|
|
||
| export interface AgentActivityDescription { | ||
| /** Recognized verb, or null when the tool name should show as-is. */ | ||
| verb: AgentActivityVerb | null; | ||
| tool: string; | ||
| detail?: string; | ||
| } | ||
|
|
||
| export function describeAgentActivity(activity: { | ||
| tool: string; | ||
| detail?: string; | ||
| }): AgentActivityDescription { | ||
| const verb = VERB_BY_TOOL[activity.tool.toLowerCase()] ?? null; | ||
| return { | ||
| verb, | ||
| tool: activity.tool, | ||
| ...(activity.detail ? { detail: activity.detail } : {}), | ||
| }; | ||
| } |
1 change: 1 addition & 0 deletions
1
...rAgentsChip/components/DashboardSidebarAgentHoverRow/utils/describeAgentActivity/index.ts
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 @@ | ||
| export * from "./describeAgentActivity"; |
1 change: 1 addition & 0 deletions
1
...s/DashboardSidebarWorkspaceChips/hooks/useDashboardSidebarWorkspaceRunningAgents/index.ts
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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export { | ||
| type DashboardSidebarRunningAgent, | ||
| type RunningAgentActivity, | ||
| type RunningAgentStatus, | ||
| useDashboardSidebarWorkspaceRunningAgents, | ||
| } from "./useDashboardSidebarWorkspaceRunningAgents"; |
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 |
|---|---|---|
|
|
@@ -78,6 +78,25 @@ fi | |
| # a false completion notification. | ||
| [ -z "$EVENT_TYPE" ] && exit 0 | ||
|
|
||
| # Tool activity for the sidebar's "what is it doing" line. Claude-schema | ||
| # agents put tool_name at the top level and the tool's arguments under | ||
| # tool_input; the first of these keys is the one worth showing. Values are | ||
| # JSON string literals: unescape, drop control characters, and cap the | ||
| # length so a heredoc command can't bloat the payload. Absent for agents | ||
| # without tool hooks — the host keeps the line blank for them. | ||
| json_string_field() { | ||
| printf '%s' "$INPUT" | grep -oE "\"$1\"[[:space:]]*:[[:space:]]*\"([^\"\\\\]|\\\\.)*\"" | head -1 | sed -e 's/^"[^"]*"[[:space:]]*:[[:space:]]*"//' -e 's/"$//' | ||
| } | ||
| TOOL_NAME=$(json_string_field tool_name) | ||
| TOOL_DETAIL="" | ||
| if [ -n "$TOOL_NAME" ]; then | ||
| for DETAIL_KEY in file_path command pattern url description; do | ||
| TOOL_DETAIL=$(json_string_field "$DETAIL_KEY") | ||
| [ -n "$TOOL_DETAIL" ] && break | ||
| done | ||
| TOOL_DETAIL=$(printf '%s' "$TOOL_DETAIL" | sed -e 's/\\[nrt]/ /g' -e 's/\\"/"/g' -e 's/\\\\/\\/g' | tr -d '\000-\037' | cut -c1-400) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When a command contains a literal backslash sequence such as Prompt for AI agents |
||
| fi | ||
|
|
||
| DEBUG_HOOKS_ENABLED="0" | ||
| if [ -n "$SUPERSET_DEBUG_HOOKS" ]; then | ||
| case "$SUPERSET_DEBUG_HOOKS" in | ||
|
|
@@ -121,7 +140,11 @@ json_escape() { | |
| # then every org manifest's endpoint. Only the host that owns this terminal | ||
| # answers "ignored":false; probing the other orgs' hosts is a harmless no-op. | ||
| if [ -n "$SUPERSET_TERMINAL_ID" ]; then | ||
| PAYLOAD="{\"json\":{\"terminalId\":\"$(json_escape "$SUPERSET_TERMINAL_ID")\",\"eventType\":\"$(json_escape "$EVENT_TYPE")\",\"agent\":{\"agentId\":\"$(json_escape "$SUPERSET_AGENT_ID")\",\"sessionId\":\"$(json_escape "$SESSION_ID")\"}}}" | ||
| ACTIVITY_JSON="" | ||
| if [ -n "$TOOL_NAME" ]; then | ||
| ACTIVITY_JSON=",\"activity\":{\"tool\":\"$(json_escape "$TOOL_NAME")\",\"detail\":\"$(json_escape "$TOOL_DETAIL")\"}" | ||
| fi | ||
| PAYLOAD="{\"json\":{\"terminalId\":\"$(json_escape "$SUPERSET_TERMINAL_ID")\",\"eventType\":\"$(json_escape "$EVENT_TYPE")\",\"agent\":{\"agentId\":\"$(json_escape "$SUPERSET_AGENT_ID")\",\"sessionId\":\"$(json_escape "$SESSION_ID")\"}$ACTIVITY_JSON}}" | ||
|
|
||
| HOOK_CANDIDATE_URLS="$SUPERSET_HOST_AGENT_HOOK_URL" | ||
| for MANIFEST_FILE in "${SUPERSET_HOME_DIR:-$HOME/.superset}"/host/*/manifest.json; do | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: When a Claude tool response contains a matching
file_path,command,pattern,url, ordescription, the hook can display that response metadata instead of the tool call detail.json_string_fieldscans all of$INPUT; scope extraction totool_inputbefore selecting the detail key.Prompt for AI agents