a4e 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- a4e/__init__.py +0 -0
- a4e/cli.py +47 -0
- a4e/cli_commands/__init__.py +5 -0
- a4e/cli_commands/add.py +376 -0
- a4e/cli_commands/deploy.py +149 -0
- a4e/cli_commands/dev.py +162 -0
- a4e/cli_commands/info.py +206 -0
- a4e/cli_commands/init.py +211 -0
- a4e/cli_commands/list.py +227 -0
- a4e/cli_commands/mcp.py +504 -0
- a4e/cli_commands/remove.py +197 -0
- a4e/cli_commands/update.py +285 -0
- a4e/cli_commands/validate.py +117 -0
- a4e/core.py +109 -0
- a4e/dev_runner.py +425 -0
- a4e/server.py +86 -0
- a4e/templates/agent.md.j2 +168 -0
- a4e/templates/agent.py.j2 +15 -0
- a4e/templates/agents.md.j2 +99 -0
- a4e/templates/metadata.json.j2 +20 -0
- a4e/templates/prompt.md.j2 +20 -0
- a4e/templates/prompts/agent.md.j2 +206 -0
- a4e/templates/skills/agents.md.j2 +110 -0
- a4e/templates/skills/skill.md.j2 +120 -0
- a4e/templates/support_module.py.j2 +84 -0
- a4e/templates/tool.py.j2 +60 -0
- a4e/templates/tools/agent.md.j2 +192 -0
- a4e/templates/view.tsx.j2 +21 -0
- a4e/templates/views/agent.md.j2 +219 -0
- a4e/tools/__init__.py +70 -0
- a4e/tools/agent_tools/__init__.py +12 -0
- a4e/tools/agent_tools/add_support_module.py +95 -0
- a4e/tools/agent_tools/add_tool.py +115 -0
- a4e/tools/agent_tools/list_tools.py +28 -0
- a4e/tools/agent_tools/remove_tool.py +69 -0
- a4e/tools/agent_tools/update_tool.py +123 -0
- a4e/tools/deploy/__init__.py +8 -0
- a4e/tools/deploy/deploy.py +59 -0
- a4e/tools/dev/__init__.py +10 -0
- a4e/tools/dev/check_environment.py +79 -0
- a4e/tools/dev/dev_start.py +30 -0
- a4e/tools/dev/dev_stop.py +26 -0
- a4e/tools/project/__init__.py +10 -0
- a4e/tools/project/get_agent_info.py +66 -0
- a4e/tools/project/get_instructions.py +216 -0
- a4e/tools/project/initialize_project.py +231 -0
- a4e/tools/schemas/__init__.py +8 -0
- a4e/tools/schemas/generate_schemas.py +278 -0
- a4e/tools/skills/__init__.py +12 -0
- a4e/tools/skills/add_skill.py +105 -0
- a4e/tools/skills/helpers.py +137 -0
- a4e/tools/skills/list_skills.py +54 -0
- a4e/tools/skills/remove_skill.py +74 -0
- a4e/tools/skills/update_skill.py +150 -0
- a4e/tools/validation/__init__.py +8 -0
- a4e/tools/validation/validate.py +389 -0
- a4e/tools/views/__init__.py +12 -0
- a4e/tools/views/add_view.py +40 -0
- a4e/tools/views/helpers.py +91 -0
- a4e/tools/views/list_views.py +27 -0
- a4e/tools/views/remove_view.py +73 -0
- a4e/tools/views/update_view.py +124 -0
- a4e/utils/dev_manager.py +253 -0
- a4e/utils/schema_generator.py +255 -0
- a4e-0.1.5.dist-info/METADATA +427 -0
- a4e-0.1.5.dist-info/RECORD +70 -0
- a4e-0.1.5.dist-info/WHEEL +5 -0
- a4e-0.1.5.dist-info/entry_points.txt +2 -0
- a4e-0.1.5.dist-info/licenses/LICENSE +21 -0
- a4e-0.1.5.dist-info/top_level.txt +1 -0
a4e/cli_commands/list.py
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# a4e/cli_commands/list.py
|
|
2
|
+
"""
|
|
3
|
+
Commands for listing tools, views, and skills in an agent.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
from rich.table import Table
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
15
|
+
# Create a 'Typer' app for the 'list' command group
|
|
16
|
+
app = typer.Typer(
|
|
17
|
+
no_args_is_help=True,
|
|
18
|
+
help="List tools, views, or skills in your agent.",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def find_agent_dir(agent_name: Optional[str] = None) -> Optional[Path]:
|
|
23
|
+
"""Find the agent directory from name or current working directory."""
|
|
24
|
+
cwd = Path.cwd()
|
|
25
|
+
|
|
26
|
+
if agent_name:
|
|
27
|
+
if Path(agent_name).is_absolute() and Path(agent_name).exists():
|
|
28
|
+
return Path(agent_name)
|
|
29
|
+
if (cwd / agent_name).exists():
|
|
30
|
+
return cwd / agent_name
|
|
31
|
+
agent_store = cwd / "file-store" / "agent-store" / agent_name
|
|
32
|
+
if agent_store.exists():
|
|
33
|
+
return agent_store
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
if (cwd / "agent.py").exists() and (cwd / "metadata.json").exists():
|
|
37
|
+
return cwd
|
|
38
|
+
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@app.command("tools")
|
|
43
|
+
def list_tools(
|
|
44
|
+
agent_name: Optional[str] = typer.Option(
|
|
45
|
+
None, "--agent", "-a", help="Agent name/path (defaults to current directory)"
|
|
46
|
+
),
|
|
47
|
+
verbose: bool = typer.Option(
|
|
48
|
+
False, "--verbose", "-v", help="Show detailed information"
|
|
49
|
+
),
|
|
50
|
+
) -> None:
|
|
51
|
+
"""
|
|
52
|
+
List all tools in the agent.
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
a4e list tools
|
|
56
|
+
a4e list tools --agent my-agent -v
|
|
57
|
+
"""
|
|
58
|
+
agent_dir = find_agent_dir(agent_name)
|
|
59
|
+
if not agent_dir:
|
|
60
|
+
console.print("[red]Error: Not in an agent directory. Use --agent to specify the agent.[/red]")
|
|
61
|
+
raise typer.Exit(code=1)
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
from ..tools.agent_tools.list_tools import list_tools as mcp_list_tools
|
|
65
|
+
|
|
66
|
+
result = mcp_list_tools(agent_name=str(agent_dir))
|
|
67
|
+
|
|
68
|
+
# Handle response (list_tools returns {"tools": [...], "count": N})
|
|
69
|
+
if "error" not in result:
|
|
70
|
+
tools = result.get("tools", [])
|
|
71
|
+
|
|
72
|
+
if not tools:
|
|
73
|
+
console.print("[yellow]No tools found.[/yellow]")
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
table = Table(title=f"Tools ({len(tools)})")
|
|
77
|
+
table.add_column("Name", style="cyan")
|
|
78
|
+
table.add_column("File", style="dim")
|
|
79
|
+
|
|
80
|
+
for tool in tools:
|
|
81
|
+
# tools is a list of strings (tool names)
|
|
82
|
+
table.add_row(tool, f"tools/{tool}.py")
|
|
83
|
+
|
|
84
|
+
console.print(table)
|
|
85
|
+
else:
|
|
86
|
+
console.print(f"[red]Error: {result.get('error')}[/red]")
|
|
87
|
+
raise typer.Exit(code=1)
|
|
88
|
+
|
|
89
|
+
except ImportError as e:
|
|
90
|
+
console.print(f"[red]Error importing tools: {e}[/red]")
|
|
91
|
+
raise typer.Exit(code=1)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@app.command("views")
|
|
95
|
+
def list_views(
|
|
96
|
+
agent_name: Optional[str] = typer.Option(
|
|
97
|
+
None, "--agent", "-a", help="Agent name/path (defaults to current directory)"
|
|
98
|
+
),
|
|
99
|
+
verbose: bool = typer.Option(
|
|
100
|
+
False, "--verbose", "-v", help="Show detailed information"
|
|
101
|
+
),
|
|
102
|
+
) -> None:
|
|
103
|
+
"""
|
|
104
|
+
List all views in the agent.
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
a4e list views
|
|
108
|
+
a4e list views --agent my-agent -v
|
|
109
|
+
"""
|
|
110
|
+
agent_dir = find_agent_dir(agent_name)
|
|
111
|
+
if not agent_dir:
|
|
112
|
+
console.print("[red]Error: Not in an agent directory. Use --agent to specify the agent.[/red]")
|
|
113
|
+
raise typer.Exit(code=1)
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
from ..tools.views.list_views import list_views as mcp_list_views
|
|
117
|
+
|
|
118
|
+
result = mcp_list_views(agent_name=str(agent_dir))
|
|
119
|
+
|
|
120
|
+
# Handle response (list_views returns {"views": [...], "count": N})
|
|
121
|
+
if "error" not in result:
|
|
122
|
+
views = result.get("views", [])
|
|
123
|
+
|
|
124
|
+
if not views:
|
|
125
|
+
console.print("[yellow]No views found.[/yellow]")
|
|
126
|
+
return
|
|
127
|
+
|
|
128
|
+
table = Table(title=f"Views ({len(views)})")
|
|
129
|
+
table.add_column("ID", style="cyan")
|
|
130
|
+
table.add_column("Path", style="dim")
|
|
131
|
+
|
|
132
|
+
for view in views:
|
|
133
|
+
# views is a list of strings (view names)
|
|
134
|
+
table.add_row(view, f"views/{view}/view.tsx")
|
|
135
|
+
|
|
136
|
+
console.print(table)
|
|
137
|
+
else:
|
|
138
|
+
console.print(f"[red]Error: {result.get('error')}[/red]")
|
|
139
|
+
raise typer.Exit(code=1)
|
|
140
|
+
|
|
141
|
+
except ImportError as e:
|
|
142
|
+
console.print(f"[red]Error importing tools: {e}[/red]")
|
|
143
|
+
raise typer.Exit(code=1)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@app.command("skills")
|
|
147
|
+
def list_skills(
|
|
148
|
+
agent_name: Optional[str] = typer.Option(
|
|
149
|
+
None, "--agent", "-a", help="Agent name/path (defaults to current directory)"
|
|
150
|
+
),
|
|
151
|
+
verbose: bool = typer.Option(
|
|
152
|
+
False, "--verbose", "-v", help="Show detailed information"
|
|
153
|
+
),
|
|
154
|
+
) -> None:
|
|
155
|
+
"""
|
|
156
|
+
List all skills in the agent.
|
|
157
|
+
|
|
158
|
+
Example:
|
|
159
|
+
a4e list skills
|
|
160
|
+
a4e list skills --agent my-agent -v
|
|
161
|
+
"""
|
|
162
|
+
agent_dir = find_agent_dir(agent_name)
|
|
163
|
+
if not agent_dir:
|
|
164
|
+
console.print("[red]Error: Not in an agent directory. Use --agent to specify the agent.[/red]")
|
|
165
|
+
raise typer.Exit(code=1)
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
from ..tools.skills.list_skills import list_skills as mcp_list_skills
|
|
169
|
+
|
|
170
|
+
result = mcp_list_skills(agent_name=str(agent_dir))
|
|
171
|
+
|
|
172
|
+
# Handle response (list_skills returns {"skills": [...], "count": N})
|
|
173
|
+
if "error" not in result:
|
|
174
|
+
skills = result.get("skills", [])
|
|
175
|
+
|
|
176
|
+
if not skills:
|
|
177
|
+
console.print("[yellow]No skills found.[/yellow]")
|
|
178
|
+
return
|
|
179
|
+
|
|
180
|
+
table = Table(title=f"Skills ({len(skills)})")
|
|
181
|
+
table.add_column("ID", style="cyan")
|
|
182
|
+
table.add_column("Name", style="green")
|
|
183
|
+
if verbose:
|
|
184
|
+
table.add_column("Output View")
|
|
185
|
+
table.add_column("Triggers")
|
|
186
|
+
|
|
187
|
+
for skill in skills:
|
|
188
|
+
if verbose:
|
|
189
|
+
triggers = ", ".join(skill.get("intent_triggers", [])[:3])
|
|
190
|
+
if len(skill.get("intent_triggers", [])) > 3:
|
|
191
|
+
triggers += "..."
|
|
192
|
+
table.add_row(
|
|
193
|
+
skill.get("id", ""),
|
|
194
|
+
skill.get("name", ""),
|
|
195
|
+
skill.get("output_view", ""),
|
|
196
|
+
triggers
|
|
197
|
+
)
|
|
198
|
+
else:
|
|
199
|
+
table.add_row(skill.get("id", ""), skill.get("name", ""))
|
|
200
|
+
|
|
201
|
+
console.print(table)
|
|
202
|
+
else:
|
|
203
|
+
console.print(f"[red]Error: {result.get('error')}[/red]")
|
|
204
|
+
raise typer.Exit(code=1)
|
|
205
|
+
|
|
206
|
+
except ImportError as e:
|
|
207
|
+
console.print(f"[red]Error importing tools: {e}[/red]")
|
|
208
|
+
raise typer.Exit(code=1)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
@app.command("all")
|
|
212
|
+
def list_all(
|
|
213
|
+
agent_name: Optional[str] = typer.Option(
|
|
214
|
+
None, "--agent", "-a", help="Agent name/path (defaults to current directory)"
|
|
215
|
+
),
|
|
216
|
+
) -> None:
|
|
217
|
+
"""
|
|
218
|
+
List all tools, views, and skills in the agent.
|
|
219
|
+
"""
|
|
220
|
+
console.print("[bold]Tools:[/bold]")
|
|
221
|
+
list_tools(agent_name=agent_name, verbose=False)
|
|
222
|
+
|
|
223
|
+
console.print("\n[bold]Views:[/bold]")
|
|
224
|
+
list_views(agent_name=agent_name, verbose=False)
|
|
225
|
+
|
|
226
|
+
console.print("\n[bold]Skills:[/bold]")
|
|
227
|
+
list_skills(agent_name=agent_name, verbose=False)
|