claude-sdk-tutor 0.1.1__py3-none-any.whl → 0.1.3__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.
app.py CHANGED
@@ -18,7 +18,10 @@ class MyApp(App):
18
18
  def __init__(self):
19
19
  super().__init__()
20
20
  self.tutor_mode = True
21
- self.client = create_claude_client(tutor_mode=self.tutor_mode)
21
+ self.web_search_enabled = False
22
+ self.client = create_claude_client(
23
+ tutor_mode=self.tutor_mode, web_search=self.web_search_enabled
24
+ )
22
25
 
23
26
  CSS = """
24
27
  #main {
@@ -53,7 +56,7 @@ class MyApp(App):
53
56
 
54
57
  def compose(self) -> ComposeResult:
55
58
  with Vertical(id="main"):
56
- yield Static("Welcome to claude tutor!", id="header")
59
+ yield Static("Welcome to claude SDK tutor!", id="header")
57
60
  yield RichLog(markup=True, highlight=True)
58
61
  yield LoadingIndicator(id="spinner")
59
62
  yield Input()
@@ -90,24 +93,53 @@ class MyApp(App):
90
93
  if command == "/tutor":
91
94
  self.run_worker(self.toggle_tutor_mode())
92
95
  return
96
+ if command == "/togglewebsearch":
97
+ self.run_worker(self.toggle_web_search())
98
+ return
99
+ if command == "/help":
100
+ self.show_help()
101
+ return
93
102
  self.write_user_message(event.value)
94
103
  self.query_one("#spinner", LoadingIndicator).display = True
95
104
  self.run_worker(self.get_response(event.value))
96
105
 
97
106
  async def clear_conversation(self) -> None:
98
107
  self.query_one(RichLog).clear()
99
- self.client = create_claude_client(tutor_mode=self.tutor_mode)
108
+ self.client = create_claude_client(
109
+ tutor_mode=self.tutor_mode, web_search=self.web_search_enabled
110
+ )
100
111
  await connect_client(self.client)
101
112
  self.write_slash_message("Context cleared")
102
113
 
103
114
  async def toggle_tutor_mode(self) -> None:
104
115
  self.tutor_mode = not self.tutor_mode
105
116
  self.query_one(RichLog).clear()
106
- self.client = create_claude_client(tutor_mode=self.tutor_mode)
117
+ self.client = create_claude_client(
118
+ tutor_mode=self.tutor_mode, web_search=self.web_search_enabled
119
+ )
107
120
  await connect_client(self.client)
108
121
  status = "on" if self.tutor_mode else "off"
109
122
  self.write_slash_message(f"Tutor mode {status}")
110
123
 
124
+ async def toggle_web_search(self) -> None:
125
+ self.web_search_enabled = not self.web_search_enabled
126
+ self.query_one(RichLog).clear()
127
+ self.client = create_claude_client(
128
+ tutor_mode=self.tutor_mode, web_search=self.web_search_enabled
129
+ )
130
+ await connect_client(self.client)
131
+ status = "on" if self.web_search_enabled else "off"
132
+ self.write_slash_message(f"Web search {status}")
133
+
134
+ def show_help(self) -> None:
135
+ help_text = """**Available Commands**
136
+
137
+ - `/help` - Show this help message
138
+ - `/clear` - Clear conversation history and start fresh
139
+ - `/tutor` - Toggle tutor mode on/off (guides learning vs gives code)
140
+ - `/togglewebsearch` - Toggle web search on/off (allows online lookups)"""
141
+ self.write_slash_message(help_text)
142
+
111
143
  async def get_response(self, text: str) -> None:
112
144
  try:
113
145
  async for message in stream_helpful_claude(self.client, text):
claude/claude_agent.py CHANGED
@@ -12,8 +12,13 @@ When a user asks a question:
12
12
  Never write complete solutions for them. Instead, help them develop the skills to solve problems independently."""
13
13
 
14
14
 
15
- def create_claude_client(tutor_mode: bool = True) -> ClaudeSDKClient:
16
- options = ClaudeAgentOptions(allowed_tools=["Read", "Glob", "Grep"])
15
+ def create_claude_client(
16
+ tutor_mode: bool = True, web_search: bool = False
17
+ ) -> ClaudeSDKClient:
18
+ tools = ["Read", "Glob", "Grep"]
19
+ if web_search:
20
+ tools.extend(["WebSearch", "WebFetch"])
21
+ options = ClaudeAgentOptions(allowed_tools=tools)
17
22
  if tutor_mode:
18
23
  options.system_prompt = TUTOR_SYSTEM_PROMPT
19
24
  return ClaudeSDKClient(options=options)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: claude-sdk-tutor
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Add your description here
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.13
@@ -61,8 +61,10 @@ Type your programming questions in the input field and press Enter to send. Clau
61
61
 
62
62
  | Command | Description |
63
63
  |---------|-------------|
64
- | `/clear` | Clears the conversation history and starts fresh. Your tutor mode setting is preserved. |
64
+ | `/help` | Shows a list of available commands. |
65
+ | `/clear` | Clears the conversation history and starts fresh. Your settings are preserved. |
65
66
  | `/tutor` | Toggles tutor mode on/off. When on (default), Claude acts as a teacher. When off, Claude responds normally without the tutoring constraints. |
67
+ | `/togglewebsearch` | Toggles web search on/off. When on, Claude can use WebSearch and WebFetch tools to look up information online. Disabled by default. |
66
68
 
67
69
  ## Tech Stack
68
70
 
@@ -0,0 +1,8 @@
1
+ app.py,sha256=y7zwZmWRZwKtccIuNhmFpiCpuVARuEWcEECn0zKkI38,5668
2
+ claude/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ claude/claude_agent.py,sha256=-xs3CNr5p2AosKy6UJvf6nTQLdJd8GG7qtS4jd6K_ts,1304
4
+ claude_sdk_tutor-0.1.3.dist-info/METADATA,sha256=1zMn56c_TVb92jxvF--qB_c6Cq1sB7l_JhJRc43oRZA,2445
5
+ claude_sdk_tutor-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
+ claude_sdk_tutor-0.1.3.dist-info/entry_points.txt,sha256=vI78kiiqb59KzHEa8UsnkvCbmCs0IMLXOuO2qiho4U4,46
7
+ claude_sdk_tutor-0.1.3.dist-info/licenses/LICENSE,sha256=KzxybQVVAEGBifrjNj5OGwQ_rsbzCIGPm0xrTL6-VZs,1067
8
+ claude_sdk_tutor-0.1.3.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- app.py,sha256=rAnlcXNQmZiRiqixJISAkzSBWuBrPssjKbGuRngAOY8,4457
2
- claude/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- claude/claude_agent.py,sha256=8stg0rHC7g3b5CqS3EdvwkBMQqqZ0McHzlthMdIWlgE,1187
4
- claude_sdk_tutor-0.1.1.dist-info/METADATA,sha256=GmDlf9d8tXocmFZRBj_QdjsOT0HQV1fZQaws8ZOfPLQ,2247
5
- claude_sdk_tutor-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
- claude_sdk_tutor-0.1.1.dist-info/entry_points.txt,sha256=vI78kiiqb59KzHEa8UsnkvCbmCs0IMLXOuO2qiho4U4,46
7
- claude_sdk_tutor-0.1.1.dist-info/licenses/LICENSE,sha256=KzxybQVVAEGBifrjNj5OGwQ_rsbzCIGPm0xrTL6-VZs,1067
8
- claude_sdk_tutor-0.1.1.dist-info/RECORD,,