Skip to content

Commit a475d91

Browse files
committed
chore: cleanup
1 parent 2ba9d6b commit a475d91

File tree

12 files changed

+34
-35
lines changed

12 files changed

+34
-35
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: dev console install start
1+
.PHONY: dev console lint install start type-check
22

33
install:
44
uv sync && uv run pre-commit install && cp .env.example .env && echo "Please edit the .env file with your API keys."
@@ -9,5 +9,11 @@ console:
99
dev:
1010
uv run textual run --dev -c chat
1111

12+
lint:
13+
uv run ruff check --fix src
14+
1215
start:
1316
uv run chat
17+
18+
type-check:
19+
uv run mypy src

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Optionally, MCP servers can be lazy-loaded via chat inference, which is useful i
4141
- Install pre-commit hooks via [pre-commit](https://pre-commit.com/)
4242
- `uv run pre-commit install`
4343
- Type-checking is via [MyPy](https://github.com/python/mypy):
44-
- `uv run mypy src`
44+
- `make type-check`
4545
- Linting and formatting is via [Ruff](https://docs.astral.sh/ruff/)
46-
- `uv run ruff check src`
46+
- `make lint`
4747

4848
Textual has an integrated logging console that one can boot separately from the app to receive logs.
4949

agent-chat-cli.config.yaml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
# Agent Chat CLI Configuration
2+
# See: https://platform.claude.com/docs/en/agent-sdk/python#claude-agent-options
23

3-
# System prompt loaded from /prompts folder
44
system_prompt: system.md
55

6-
# Model to use (e.g., sonnet, haiku)
76
model: haiku
87

98
# Enable streaming
109
include_partial_messages: true
1110

12-
# Enable dynamic/lazy MCP server inference
11+
# Enable dynamic/lazy MCP server inference. Useful if one has many MCP servers or
12+
# many tools, or is cost conscious about loading everything up front.
1313
mcp_server_inference: false
1414

15+
# Global tool restrictions
16+
disallowed_tools: ["Bash"]
17+
18+
# Eg, 'default', 'bypassPermissions'
19+
permission_mode: "default"
20+
1521
# MCP server configurations
1622
mcp_servers:
1723
chrome:
@@ -42,16 +48,3 @@ mcp_servers:
4248
- "https://mcp.notion.com/mcp"
4349
disallowed_tools: []
4450
enabled: false
45-
46-
# Global tool restrictions
47-
disallowed_tools: []
48-
49-
# Permission mode for tool execution
50-
permission_mode: "default"
51-
# TODO: Need to implement
52-
53-
# Named agents with custom configurations
54-
# agents:
55-
# sample_agent:
56-
# description: "Example agent for demonstration"
57-
# prompt: "You are a helpful assistant named Foo."

src/agent_chat_cli/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from agent_chat_cli.components.thinking_indicator import ThinkingIndicator
1010
from agent_chat_cli.components.tool_permission_prompt import ToolPermissionPrompt
1111
from agent_chat_cli.components.user_input import UserInput
12-
from agent_chat_cli.system.agent_loop import AgentLoop
13-
from agent_chat_cli.system.message_bus import MessageBus
14-
from agent_chat_cli.system.actions import Actions
12+
from agent_chat_cli.core.agent_loop import AgentLoop
13+
from agent_chat_cli.core.message_bus import MessageBus
14+
from agent_chat_cli.core.actions import Actions
1515
from agent_chat_cli.utils.logger import setup_logging
1616

1717
from dotenv import load_dotenv
@@ -21,7 +21,7 @@
2121

2222

2323
class AgentChatCLIApp(App):
24-
CSS_PATH = "system/styles.tcss"
24+
CSS_PATH = "core/styles.tcss"
2525

2626
BINDINGS = [
2727
Binding("ctrl+c", "quit", "Quit", show=False, priority=True),

src/agent_chat_cli/components/tool_permission_prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from agent_chat_cli.utils.logger import log_json
1313

1414
if TYPE_CHECKING:
15-
from agent_chat_cli.system.actions import Actions
15+
from agent_chat_cli.core.actions import Actions
1616

1717

1818
class ToolPermissionPrompt(Widget):

src/agent_chat_cli/components/user_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from agent_chat_cli.components.caret import Caret
66
from agent_chat_cli.components.flex import Flex
7-
from agent_chat_cli.system.actions import Actions
7+
from agent_chat_cli.core.actions import Actions
88
from agent_chat_cli.utils.enums import ControlCommand
99

1010

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
get_sdk_config,
2424
)
2525
from agent_chat_cli.utils.enums import AgentMessageType, ContentType, ControlCommand
26-
from agent_chat_cli.system.mcp_inference import infer_mcp_servers
26+
from agent_chat_cli.core.mcp_inference import infer_mcp_servers
2727
from agent_chat_cli.utils.logger import log_json
2828

2929
if TYPE_CHECKING:
@@ -219,7 +219,7 @@ async def _can_use_tool(
219219
) -> PermissionResult:
220220
"""Agent SDK handler for tool use permissions"""
221221

222-
# Handle permission request queue
222+
# Handle permission request queue sequentially
223223
async with self.permission_lock:
224224
await self.app.actions.handle_agent_message(
225225
AgentMessage(
@@ -235,25 +235,25 @@ async def _can_use_tool(
235235
user_response = await self.permission_response_queue.get()
236236
response = user_response.lower().strip()
237237

238-
CONFIRM = response in ["y", "yes", "allow", ""]
239-
DENY = response in ["n", "no", "deny"]
238+
accepted_tool = response in ["y", "yes", "allow", ""]
239+
rejected_tool = response in ["n", "no", "deny"]
240240

241241
log_json(
242242
{
243243
"event": "tool_permission_decision",
244244
"response": response,
245-
"CONFIRM": CONFIRM,
246-
"DENY": DENY,
245+
"accepted_tool": accepted_tool,
246+
"rejected_tool": rejected_tool,
247247
}
248248
)
249249

250-
if CONFIRM:
250+
if accepted_tool:
251251
return PermissionResultAllow(
252252
behavior="allow",
253253
updated_input=tool_input,
254254
)
255255

256-
if DENY:
256+
if rejected_tool:
257257
self.app.actions.post_system_message(
258258
f"Permission denied for {tool_name}"
259259
)
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Message,
1414
ToolMessage,
1515
)
16-
from agent_chat_cli.system.agent_loop import AgentMessage
16+
from agent_chat_cli.core.agent_loop import AgentMessage
1717
from agent_chat_cli.utils.enums import AgentMessageType, ContentType
1818
from agent_chat_cli.utils.logger import log_json
1919

0 commit comments

Comments
 (0)