Skip to content

Commit abfff79

Browse files
authored
refactor: Refactor A2A task display and configuration handling (#338)
Improves how A2A tasks are shown in the UI by removing redundant Task field from results and adding proper formatting. Adds config directory support for artifact downloads and includes a new browser agent configuration. Also fixes autocomplete shortcut detection and updates all documentation to reflect the new subcommand-based shortcut structure. ## Changes: ### Code Changes 1. **Added new `browser-agent` configuration** in `.infer/agents.yaml` 2. **Refactored config directory handling** with `configDir` field and getter/setter methods 3. **Changed default download artifacts directory** from `/tmp/downloads` to config-relative path 4. **Removed `Task` field** from `A2ASubmitTaskResult` in multiple places 5. **Added new `formatA2ATaskData` method** for cleaner task display 6. **Updated UI preview formatting** for A2A tasks and tool calls 7. **Fixed autocomplete shortcut detection logic** ### Shortcut Structure Changes 8. **Migrated shortcuts to subcommand structure**: - Git shortcuts: `/git-status` → `/git status`, `/git-commit` → `/git commit`, etc. - SCM shortcuts: `/scm-issues` → `/scm issues`, `/scm-pr-create` → `/scm pr-create`, etc. - A2A shortcuts: `/agents-add` → `/agents add`, `/agents-remove` → `/agents remove`, etc. - MCP shortcuts: `/mcp-add` → `/mcp add`, `/mcp-enable` → `/mcp enable`, etc. ### Documentation Updates 9. **Updated README.md**: - Added subcommand explanation with examples - Updated all shortcut references to new format - Added example YAML for shortcuts with subcommands 10. **Updated CLAUDE.md**: - Updated shortcuts list to reflect subcommand structure 11. **Updated docs/shortcuts-guide.md**: - Updated all shortcut names throughout the guide - Updated YAML configuration examples - Updated all example commands and usage instructions 12. **Updated docs/a2a-connections.md**: - Updated `/agents` shortcut commands - Rewrote artifact download section to document WebFetch-based approach - Removed references to removed `A2A_DownloadArtifacts` tool 13. **Updated docs/tools-reference.md**: - Removed `download_artifacts` from A2A configuration - Added note about WebFetch handling artifact downloads ## Benefits - Cleaner UI display for A2A tasks - Better configuration management with config directory support - More consistent artifact download paths - Improved autocomplete behavior - Organized shortcut structure with subcommands for better UX - Consistent documentation across all files - Clearer artifact download workflow using WebFetch --------- Signed-off-by: Eden Reich <[email protected]>
1 parent b459f79 commit abfff79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1491
-2262
lines changed

.infer/agents.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ agents:
55
run: true
66
model: deepseek/deepseek-chat
77
enabled: true
8+
- name: browser-agent
9+
url: http://localhost:8083
10+
artifacts_url: http://localhost:8084
11+
oci: ghcr.io/inference-gateway/browser-agent:latest
12+
run: true
13+
model: deepseek/deepseek-chat
14+
environment:
15+
A2A_AGENT_CLIENT_TOOLS_CREATE_ARTIFACT: "true"
16+
enabled: true

.infer/config.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ tools:
9797
enabled: true
9898
whitelisted_domains:
9999
- golang.org
100+
- localhost
100101
safety:
101-
max_size: 8192
102+
max_size: 10485760
102103
timeout: 30
103104
allow_redirect: true
104105
cache:
@@ -173,6 +174,15 @@ agent:
173174
6. Commit changes (only if explicitly asked)
174175
7. Create a pull request (only if explicitly asked)
175176
177+
A2A ARTIFACT DOWNLOADS:
178+
When a delegated A2A task completes with artifacts:
179+
1. Wait for the automatic completion notification
180+
2. The completion message will show artifact details including Download URLs
181+
3. Use WebFetch with download=true to automatically save artifacts to disk
182+
Example: WebFetch(url="http://agent/artifacts/123/file.png", download=true)
183+
4. The file will be saved to <configDir>/tmp with filename extracted from URL
184+
5. Check the tool result for the saved file path
185+
176186
EXAMPLE:
177187
<user>Can you create a pull request with the changes?</user>
178188
<assistant>I will checkout to a new branch</assistant>
@@ -565,11 +575,6 @@ a2a:
565575
submit_task:
566576
enabled: true
567577
require_approval: true
568-
download_artifacts:
569-
enabled: true
570-
download_dir: /tmp/downloads
571-
timeout_seconds: 30
572-
require_approval: true
573578
mcp:
574579
enabled: false
575580
connection_timeout: 30

.infer/shortcuts/a2a.yaml

Lines changed: 17 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -3,84 +3,26 @@
33
# Manage A2A agent configuration from within chat
44
#
55
# Usage:
6-
# - /agents - List all configured A2A agents
7-
# - /agents-add <name> [url] [options] - Add a new A2A agent
8-
# - /agents-remove <name> - Remove an A2A agent
9-
# - /agents-enable <name> - Enable an A2A agent
10-
# - /agents-disable <name> - Disable an A2A agent
6+
# - /agents list - List all configured A2A agents
7+
# - /agents add - Add a new A2A agent
8+
# - /agents remove - Remove an A2A agent
9+
# - /agents enable - Enable an A2A agent
10+
# - /agents disable - Disable an A2A agent
1111

1212
shortcuts:
1313
- name: agents
14-
description: "List all configured A2A agents"
14+
description: "Manage A2A agents"
1515
command: infer
1616
args:
1717
- agents
18-
- list
19-
20-
- name: agents-add
21-
description: "Add a new A2A agent (usage: /agents-add <name> [url] [--oci IMAGE] [--run] [--model MODEL] [--artifacts-url URL] [--environment KEY=VALUE]...)"
22-
command: bash
23-
args:
24-
- -c
25-
- |
26-
if [ $# -lt 1 ]; then
27-
echo "Usage: /agents-add <name> [url] [options]"
28-
echo "Options:"
29-
echo " --oci IMAGE OCI image for auto-start"
30-
echo " --run Enable auto-start"
31-
echo " --model MODEL Model specification (required with --run)"
32-
echo " --artifacts-url URL Artifacts download URL"
33-
echo " --environment KEY=VALUE Environment variable (repeatable)"
34-
echo ""
35-
echo "Examples:"
36-
echo " /agents-add researcher https://api.example.com/a2a --model anthropic/claude-4-5-sonnet"
37-
echo " /agents-add coder --run --oci my-agent:latest --model openai/gpt-4"
38-
exit 1
39-
fi
40-
41-
# Build command dynamically to handle all flags
42-
CMD="infer agents add"
43-
for arg in "$@"; do
44-
CMD="$CMD \"$arg\""
45-
done
46-
47-
eval "$CMD"
48-
49-
- name: agents-remove
50-
description: "Remove an A2A agent (usage: /agents-remove <name>)"
51-
command: bash
52-
args:
53-
- -c
54-
- |
55-
if [ $# -lt 1 ]; then
56-
echo "Usage: /agents-remove <name>"
57-
echo "Example: /agents-remove researcher"
58-
exit 1
59-
fi
60-
infer agents remove "$1"
61-
62-
- name: agents-enable
63-
description: "Enable an A2A agent (usage: /agents-enable <name>)"
64-
command: bash
65-
args:
66-
- -c
67-
- |
68-
if [ $# -lt 1 ]; then
69-
echo "Usage: /agents-enable <name>"
70-
echo "Example: /agents-enable researcher"
71-
exit 1
72-
fi
73-
infer agents enable "$1"
74-
75-
- name: agents-disable
76-
description: "Disable an A2A agent (usage: /agents-disable <name>)"
77-
command: bash
78-
args:
79-
- -c
80-
- |
81-
if [ $# -lt 1 ]; then
82-
echo "Usage: /agents-disable <name>"
83-
echo "Example: /agents-disable researcher"
84-
exit 1
85-
fi
86-
infer agents disable "$1"
18+
subcommands:
19+
- name: list
20+
description: "List all configured A2A agents"
21+
- name: add
22+
description: "Add a new A2A agent (usage: <name> [url] [options])"
23+
- name: remove
24+
description: "Remove an A2A agent (usage: <name>)"
25+
- name: enable
26+
description: "Enable an A2A agent (usage: <name>)"
27+
- name: disable
28+
description: "Disable an A2A agent (usage: <name>)"

.infer/shortcuts/config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Config Shortcuts
2+
# Manage CLI configuration settings
3+
#
4+
# This provides autocomplete for common config subcommands while passing through
5+
# all additional arguments to the underlying `infer config` command.
6+
#
7+
# Usage Examples:
8+
# - /config tools list - List all tools and their status
9+
# - /config tools bash enable - Enable bash tool
10+
# - /config tools bash disable - Disable bash tool
11+
# - /config tools grep enable - Enable grep tool
12+
# - /config tools grep set-backend auto - Set grep backend
13+
# - /config tools web-search enable - Enable web search tool
14+
# - /config tools web-fetch enable - Enable web fetch tool
15+
# - /config tools safety enable - Enable safety approval
16+
# - /config agent set-model <model> - Set default agent model
17+
# - /config agent set-max-turns <number> - Set max turns
18+
# - /config agent verbose-tools enable - Enable verbose tool output
19+
# - /config init - Initialize config file
20+
# - /config export - Export configuration
21+
22+
shortcuts:
23+
- name: config
24+
description: "Manage CLI configuration"
25+
command: infer
26+
args:
27+
- config
28+
subcommands:
29+
- name: tools
30+
description: "Manage tool execution settings (supports: list, enable, disable, bash, grep, web-search, web-fetch, github, safety, sandbox, exec)"
31+
- name: agent
32+
description: "Configure agent command settings (supports: set-model, set-system, set-max-turns, set-max-concurrent-tools, verbose-tools)"
33+
- name: init
34+
description: "Initialize a new configuration file"
35+
- name: export
36+
description: "Export configuration to stdout"

.infer/shortcuts/git.yaml

Lines changed: 58 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,70 @@
22
# Common git operations with AI-powered commit messages
33
#
44
# Usage:
5-
# - /git-status - Show working tree status
6-
# - /git-pull - Pull changes from remote
7-
# - /git-push - Push commits to remote
8-
# - /git-log - Show commit logs
9-
# - /git-commit - Generate AI commit message from staged changes
5+
# - /git status - Show working tree status
6+
# - /git pull - Pull changes from remote
7+
# - /git push - Push commits to remote
8+
# - /git log - Show commit logs
9+
# - /git commit - Generate AI commit message from staged changes
1010

1111
shortcuts:
12-
- name: git-status
13-
description: "Show working tree status"
12+
- name: git
13+
description: "Common git operations"
1414
command: git
15-
args:
16-
- status
15+
subcommands:
16+
- name: status
17+
description: "Show working tree status"
18+
- name: pull
19+
description: "Pull changes from remote repository"
20+
- name: push
21+
description: "Push commits to remote repository"
22+
- name: log
23+
description: "Show commit logs (last 5)"
24+
args:
25+
- --oneline
26+
- -n
27+
- "5"
28+
- name: commit
29+
description: "Generate AI commit message from staged changes"
30+
command: bash
31+
args:
32+
- -c
33+
- |
34+
if ! git diff --cached --quiet 2>/dev/null; then
35+
diff=$(git diff --cached)
36+
jq -n --arg diff "$diff" '{diff: $diff}'
37+
else
38+
echo '{"error": "No staged changes found. Use git add to stage changes first."}'
39+
exit 1
40+
fi
41+
snippet:
42+
prompt: |
43+
Generate a concise git commit message following conventional commit format.
1744
18-
- name: git-pull
19-
description: "Pull changes from remote repository"
20-
command: git
21-
args:
22-
- pull
23-
24-
- name: git-push
25-
description: "Push commits to remote repository"
26-
command: git
27-
args:
28-
- push
29-
30-
- name: git-log
31-
description: "Show commit logs (last 10)"
32-
command: git
33-
args:
34-
- log
35-
- --oneline
36-
- --graph
37-
- --decorate
38-
- "-10"
39-
40-
- name: git-commit
41-
description: "Generate AI commit message from staged changes"
42-
command: bash
43-
args:
44-
- -c
45-
- |
46-
if ! git diff --cached --quiet 2>/dev/null; then
47-
diff=$(git diff --cached)
48-
jq -n --arg diff "$diff" '{diff: $diff}'
49-
else
50-
echo '{"error": "No staged changes found. Use git add to stage changes first."}'
51-
exit 1
52-
fi
53-
snippet:
54-
prompt: |
55-
Generate a concise git commit message following conventional commit format.
56-
57-
REQUIREMENTS:
58-
- MUST use format: "type: Brief description"
59-
- Type MUST be one of: feat, fix, docs, style, refactor, test, chore
60-
- Description MUST start with a capital letter
61-
- Description MUST be under 50 characters
62-
- DO NOT include any explanation, body, or additional text
63-
- Output ONLY the commit message, nothing else
45+
REQUIREMENTS:
46+
- MUST use format: "type: Brief description"
47+
- Type MUST be one of: feat, fix, docs, style, refactor, test, chore
48+
- Description MUST start with a capital letter
49+
- Description MUST be under 50 characters
50+
- DO NOT include any explanation, body, or additional text
51+
- Output ONLY the commit message, nothing else
6452
65-
Examples of GOOD commit messages:
66-
- feat: Add user authentication
67-
- fix: Resolve memory leak in parser
68-
- docs: Update API documentation
69-
- refactor: Simplify error handling
53+
Examples of GOOD commit messages:
54+
- feat: Add user authentication
55+
- fix: Resolve memory leak in parser
56+
- docs: Update API documentation
57+
- refactor: Simplify error handling
7058
71-
Examples of BAD commit messages (DO NOT DO THIS):
72-
- Add user authentication (missing type)
73-
- feat: add user authentication (lowercase description)
74-
- feat: added a comprehensive user authentication system with OAuth2 support (too long, too detailed)
59+
Examples of BAD commit messages (DO NOT DO THIS):
60+
- Add user authentication (missing type)
61+
- feat: add user authentication (lowercase description)
62+
- feat: added a comprehensive user authentication system with OAuth2 support (too long, too detailed)
7563
76-
Analyze this diff and generate ONE commit message:
64+
Analyze this diff and generate ONE commit message:
7765
78-
```diff
79-
{diff}
80-
```
66+
```diff
67+
{diff}
68+
```
8169
82-
Output ONLY the commit message in the format "type: Description"
83-
template: "!git commit -m \"{llm}\""
70+
Output ONLY the commit message in the format "type: Description"
71+
template: "!git commit -m \"{llm}\""

0 commit comments

Comments
 (0)