klaude-code 1.2.16__py3-none-any.whl → 1.2.18__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.
- klaude_code/cli/config_cmd.py +1 -1
- klaude_code/cli/debug.py +1 -1
- klaude_code/cli/main.py +3 -9
- klaude_code/cli/runtime.py +20 -13
- klaude_code/command/__init__.py +7 -1
- klaude_code/command/clear_cmd.py +2 -7
- klaude_code/command/command_abc.py +33 -5
- klaude_code/command/debug_cmd.py +79 -0
- klaude_code/command/diff_cmd.py +2 -6
- klaude_code/command/export_cmd.py +7 -7
- klaude_code/command/export_online_cmd.py +145 -0
- klaude_code/command/help_cmd.py +4 -9
- klaude_code/command/model_cmd.py +10 -6
- klaude_code/command/prompt_command.py +2 -6
- klaude_code/command/refresh_cmd.py +2 -7
- klaude_code/command/registry.py +2 -4
- klaude_code/command/release_notes_cmd.py +2 -6
- klaude_code/command/status_cmd.py +2 -7
- klaude_code/command/terminal_setup_cmd.py +2 -6
- klaude_code/command/thinking_cmd.py +13 -8
- klaude_code/config/config.py +16 -17
- klaude_code/config/select_model.py +81 -5
- klaude_code/const/__init__.py +1 -1
- klaude_code/core/executor.py +236 -109
- klaude_code/core/manager/__init__.py +2 -4
- klaude_code/core/manager/sub_agent_manager.py +1 -1
- klaude_code/core/prompts/prompt-claude-code.md +1 -1
- klaude_code/core/prompts/prompt-sub-agent-oracle.md +0 -1
- klaude_code/core/prompts/prompt-sub-agent-web.md +51 -0
- klaude_code/core/reminders.py +9 -35
- klaude_code/core/task.py +8 -0
- klaude_code/core/tool/__init__.py +2 -0
- klaude_code/core/tool/file/read_tool.py +38 -10
- klaude_code/core/tool/report_back_tool.py +28 -2
- klaude_code/core/tool/shell/bash_tool.py +22 -2
- klaude_code/core/tool/tool_runner.py +26 -23
- klaude_code/core/tool/truncation.py +23 -9
- klaude_code/core/tool/web/web_fetch_tool.md +1 -1
- klaude_code/core/tool/web/web_fetch_tool.py +36 -1
- klaude_code/core/tool/web/web_search_tool.md +23 -0
- klaude_code/core/tool/web/web_search_tool.py +126 -0
- klaude_code/core/turn.py +28 -0
- klaude_code/protocol/commands.py +2 -0
- klaude_code/protocol/events.py +8 -0
- klaude_code/protocol/sub_agent/__init__.py +1 -1
- klaude_code/protocol/sub_agent/explore.py +1 -1
- klaude_code/protocol/sub_agent/web.py +79 -0
- klaude_code/protocol/tools.py +1 -0
- klaude_code/session/session.py +2 -2
- klaude_code/session/templates/export_session.html +123 -37
- klaude_code/trace/__init__.py +20 -2
- klaude_code/ui/modes/repl/completers.py +19 -2
- klaude_code/ui/modes/repl/event_handler.py +44 -15
- klaude_code/ui/modes/repl/renderer.py +3 -3
- klaude_code/ui/renderers/metadata.py +2 -4
- klaude_code/ui/renderers/sub_agent.py +14 -10
- klaude_code/ui/renderers/thinking.py +24 -8
- klaude_code/ui/renderers/tools.py +83 -20
- klaude_code/ui/rich/code_panel.py +112 -0
- klaude_code/ui/rich/markdown.py +3 -4
- klaude_code/ui/rich/status.py +30 -6
- klaude_code/ui/rich/theme.py +10 -1
- {klaude_code-1.2.16.dist-info → klaude_code-1.2.18.dist-info}/METADATA +126 -25
- {klaude_code-1.2.16.dist-info → klaude_code-1.2.18.dist-info}/RECORD +67 -63
- klaude_code/core/manager/agent_manager.py +0 -132
- klaude_code/core/prompts/prompt-sub-agent-webfetch.md +0 -46
- klaude_code/protocol/sub_agent/web_fetch.py +0 -74
- /klaude_code/{config → cli}/list_model.py +0 -0
- {klaude_code-1.2.16.dist-info → klaude_code-1.2.18.dist-info}/WHEEL +0 -0
- {klaude_code-1.2.16.dist-info → klaude_code-1.2.18.dist-info}/entry_points.txt +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: klaude-code
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.18
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Dist: anthropic>=0.66.0
|
|
6
|
+
Requires-Dist: ddgs>=9.9.3
|
|
6
7
|
Requires-Dist: openai>=1.102.0
|
|
7
8
|
Requires-Dist: pillow>=12.0.0
|
|
8
9
|
Requires-Dist: prompt-toolkit>=3.0.52
|
|
@@ -50,12 +51,17 @@ klaude [--model <name>] [--select-model]
|
|
|
50
51
|
|
|
51
52
|
**Options:**
|
|
52
53
|
- `--version`/`-V`: Show version and exit.
|
|
53
|
-
- `--model`/`-m`:
|
|
54
|
-
- `--select-model`/`-s`:
|
|
54
|
+
- `--model`/`-m`: Preferred model name (exact match picks immediately; otherwise opens the interactive selector filtered by this value).
|
|
55
|
+
- `--select-model`/`-s`: Open the interactive model selector at startup (shows all models unless `--model` is also provided).
|
|
55
56
|
- `--continue`/`-c`: Resume the most recent session.
|
|
56
57
|
- `--resume`/`-r`: Select a session to resume for this project.
|
|
57
58
|
- `--vanilla`: Minimal mode with only basic tools (Bash, Read, Edit) and no system prompts.
|
|
58
59
|
|
|
60
|
+
**Model selection behavior:**
|
|
61
|
+
- Default: uses `main_model` from config.
|
|
62
|
+
- `--select-model`: always prompts you to pick.
|
|
63
|
+
- `--model <value>`: tries to resolve `<value>` to a single model; if it can't, it prompts with a filtered list (and falls back to showing all models if there are no matches).
|
|
64
|
+
|
|
59
65
|
**Debug Options:**
|
|
60
66
|
- `--debug`/`-d`: Enable debug mode with verbose logging and LLM trace.
|
|
61
67
|
- `--debug-filter`: Filter debug output by type (comma-separated).
|
|
@@ -63,7 +69,7 @@ klaude [--model <name>] [--select-model]
|
|
|
63
69
|
|
|
64
70
|
### Configuration
|
|
65
71
|
|
|
66
|
-
An example config will be created in `~/.klaude/config.yaml` when first run.
|
|
72
|
+
An example config will be created in `~/.klaude/klaude-config.yaml` when first run.
|
|
67
73
|
|
|
68
74
|
Open the configuration file in editor:
|
|
69
75
|
|
|
@@ -71,47 +77,137 @@ Open the configuration file in editor:
|
|
|
71
77
|
klaude config
|
|
72
78
|
```
|
|
73
79
|
|
|
74
|
-
An
|
|
80
|
+
An example config yaml:
|
|
75
81
|
|
|
76
82
|
```yaml
|
|
77
83
|
provider_list:
|
|
78
|
-
- provider_name: openrouter
|
|
84
|
+
- provider_name: openrouter
|
|
79
85
|
protocol: openrouter # support <responses|openrouter|anthropic|openai>
|
|
80
86
|
api_key: <your-openrouter-api-key>
|
|
87
|
+
|
|
88
|
+
- provider_name: openai-responses
|
|
89
|
+
protocol: responses
|
|
90
|
+
api_key: <your-openai-api-key>
|
|
91
|
+
|
|
92
|
+
- provider_name: anthropic
|
|
93
|
+
protocol: anthropic
|
|
94
|
+
api_key: <your-anthropic-api-key>
|
|
95
|
+
|
|
96
|
+
- provider_name: moonshot
|
|
97
|
+
protocol: anthropic
|
|
98
|
+
base_url: https://api.moonshot.cn/anthropic
|
|
99
|
+
api_key: <your-api-key>
|
|
100
|
+
|
|
101
|
+
- provider_name: deepseek
|
|
102
|
+
protocol: anthropic
|
|
103
|
+
base_url: https://api.deepseek.com/anthropic
|
|
104
|
+
api_key: <your-api-key>
|
|
105
|
+
|
|
81
106
|
model_list:
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
|
|
108
|
+
- model_name: deepseek
|
|
109
|
+
provider: deepseek
|
|
110
|
+
model_params:
|
|
111
|
+
model: deepseek-reasoner
|
|
112
|
+
context_limit: 128000
|
|
113
|
+
thinking:
|
|
114
|
+
type: enabled
|
|
115
|
+
budget_tokens: 8192
|
|
116
|
+
cost:
|
|
117
|
+
currency: CNY
|
|
118
|
+
input: 2
|
|
119
|
+
output: 3
|
|
120
|
+
cache_read: 0.2
|
|
121
|
+
|
|
122
|
+
- model_name: codex-max
|
|
123
|
+
provider: openai-responses
|
|
84
124
|
model_params:
|
|
85
|
-
model:
|
|
86
|
-
context_limit: 368000
|
|
125
|
+
model: gpt-5.1-codex-max
|
|
87
126
|
thinking:
|
|
88
127
|
reasoning_effort: medium
|
|
89
|
-
|
|
128
|
+
context_limit: 400000
|
|
129
|
+
max_tokens: 128000
|
|
130
|
+
cost:
|
|
131
|
+
input: 1.25
|
|
132
|
+
output: 10
|
|
133
|
+
cache_read: 0.13
|
|
134
|
+
|
|
135
|
+
- model_name: gpt-5.1
|
|
90
136
|
provider: openrouter
|
|
91
137
|
model_params:
|
|
92
138
|
model: openai/gpt-5.1
|
|
93
|
-
context_limit:
|
|
139
|
+
context_limit: 400000
|
|
140
|
+
max_tokens: 128000
|
|
141
|
+
verbosity: high
|
|
94
142
|
thinking:
|
|
95
143
|
reasoning_effort: high
|
|
96
|
-
|
|
144
|
+
cost:
|
|
145
|
+
input: 1.25
|
|
146
|
+
output: 10
|
|
147
|
+
cache_read: 0.13
|
|
148
|
+
|
|
149
|
+
- model_name: kimi@moonshot
|
|
150
|
+
provider: moonshot
|
|
151
|
+
model_params:
|
|
152
|
+
model: kimi-k2-thinking
|
|
153
|
+
context_limit: 262144
|
|
154
|
+
thinking:
|
|
155
|
+
type: enabled
|
|
156
|
+
budget_tokens: 8192
|
|
157
|
+
cost:
|
|
158
|
+
currency: CNY
|
|
159
|
+
input: 4
|
|
160
|
+
output: 16
|
|
161
|
+
cache_read: 1
|
|
162
|
+
|
|
163
|
+
- model_name: opus
|
|
97
164
|
provider: openrouter
|
|
98
165
|
model_params:
|
|
99
|
-
model: anthropic/claude-4.5-
|
|
100
|
-
context_limit:
|
|
166
|
+
model: anthropic/claude-4.5-opus
|
|
167
|
+
context_limit: 200000
|
|
101
168
|
provider_routing:
|
|
102
|
-
|
|
103
|
-
|
|
169
|
+
only: [ google-vertex ]
|
|
170
|
+
verbosity: high
|
|
171
|
+
thinking:
|
|
172
|
+
type: enabled
|
|
173
|
+
budget_tokens: 31999
|
|
174
|
+
cost:
|
|
175
|
+
input: 5
|
|
176
|
+
output: 25
|
|
177
|
+
cache_read: 0.5
|
|
178
|
+
cache_write: 6.25
|
|
179
|
+
|
|
180
|
+
- model_name: gemini
|
|
104
181
|
provider: openrouter
|
|
105
182
|
model_params:
|
|
106
|
-
model:
|
|
107
|
-
context_limit:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
183
|
+
model: google/gemini-3-pro-preview
|
|
184
|
+
context_limit: 1048576
|
|
185
|
+
thinking:
|
|
186
|
+
reasoning_effort: medium
|
|
187
|
+
cost:
|
|
188
|
+
input: 2
|
|
189
|
+
output: 12
|
|
190
|
+
cache_read: 0.2
|
|
191
|
+
|
|
192
|
+
- model_name: haiku
|
|
193
|
+
provider: anthropic
|
|
194
|
+
model_params:
|
|
195
|
+
model: claude-haiku-4-5-20251001
|
|
196
|
+
context_limit: 200000
|
|
197
|
+
cost:
|
|
198
|
+
input: 1
|
|
199
|
+
output: 5
|
|
200
|
+
cache_read: 0.1
|
|
201
|
+
cache_write: 1.25
|
|
202
|
+
|
|
203
|
+
main_model: opus
|
|
204
|
+
|
|
111
205
|
sub_agent_models:
|
|
112
|
-
oracle: gpt-5.1
|
|
206
|
+
oracle: gpt-5.1
|
|
113
207
|
explore: haiku
|
|
114
|
-
task:
|
|
208
|
+
task: opus
|
|
209
|
+
webagent: haiku
|
|
210
|
+
|
|
115
211
|
```
|
|
116
212
|
|
|
117
213
|
List configured providers and models:
|
|
@@ -172,5 +268,10 @@ klaude exec "what is 2+2?"
|
|
|
172
268
|
echo "hello world" | klaude exec
|
|
173
269
|
|
|
174
270
|
# With model selection
|
|
271
|
+
|
|
272
|
+
# Exact model name (non-interactive)
|
|
175
273
|
echo "generate quicksort in python" | klaude exec --model gpt-5.1
|
|
176
|
-
|
|
274
|
+
|
|
275
|
+
# Partial/ambiguous name opens the interactive selector (filtered)
|
|
276
|
+
echo "generate quicksort in python" | klaude exec --model gpt
|
|
277
|
+
```
|
|
@@ -7,56 +7,57 @@ klaude_code/auth/codex/oauth.py,sha256=4hAGZ2Dv87NC3loEws7U5yNyPyIrryGm5YXY2FkHe
|
|
|
7
7
|
klaude_code/auth/codex/token_manager.py,sha256=F4xH5PhE9cksqTiWsU_YAboNe284VgUFWF2VY1sZV9U,2720
|
|
8
8
|
klaude_code/cli/__init__.py,sha256=YzlAoWAr5rx5oe6B_4zPxRFS4QaZauuy1AFwampP5fg,45
|
|
9
9
|
klaude_code/cli/auth_cmd.py,sha256=UWMHjn9xZp2o8OZc-x8y9MnkZgRWOkFXk05iKJYcySE,2561
|
|
10
|
-
klaude_code/cli/config_cmd.py,sha256=
|
|
11
|
-
klaude_code/cli/debug.py,sha256=
|
|
12
|
-
klaude_code/cli/
|
|
13
|
-
klaude_code/cli/
|
|
10
|
+
klaude_code/cli/config_cmd.py,sha256=SBFmBnHvkf5IJtpsDDuHsHWQCmYd2i4PtIMBOKpxmOM,2894
|
|
11
|
+
klaude_code/cli/debug.py,sha256=vohQVqy6fB59p4NYoiQb8BiLcl5YiGvugDXc2hYGFTc,2417
|
|
12
|
+
klaude_code/cli/list_model.py,sha256=9YOxhWE0J59NaY-SrgPA9_jA1A8rlOGwWmzK0TRuos4,8011
|
|
13
|
+
klaude_code/cli/main.py,sha256=XjeCnvQ2pYtQJVeWwkSxa_Nhu3Fx8uWnmRmDCnPvwd4,8427
|
|
14
|
+
klaude_code/cli/runtime.py,sha256=QwTqPy-2y4rOTOT6KFPPtRLBEBhu0ZhBx0fkCd3xv00,11973
|
|
14
15
|
klaude_code/cli/session_cmd.py,sha256=jAopkqq_DGgoDIcGxT-RSzn9R4yqBC8NCaNgK1GLqnQ,2634
|
|
15
|
-
klaude_code/command/__init__.py,sha256=
|
|
16
|
-
klaude_code/command/clear_cmd.py,sha256=
|
|
17
|
-
klaude_code/command/command_abc.py,sha256=
|
|
18
|
-
klaude_code/command/
|
|
19
|
-
klaude_code/command/
|
|
20
|
-
klaude_code/command/
|
|
21
|
-
klaude_code/command/
|
|
16
|
+
klaude_code/command/__init__.py,sha256=6IhjtxjTz6sum4as4sp8N4_sSNlX0DDUEaXIqgJ5C8c,3290
|
|
17
|
+
klaude_code/command/clear_cmd.py,sha256=963rYDVwZLlGLzdn11GD9HbYsd71KJP7WeT5e3pbQcA,564
|
|
18
|
+
klaude_code/command/command_abc.py,sha256=R6Ji0LxiPBN4gtlaWkmbzzJQc2JXE1EiMkrEOq_bvas,3300
|
|
19
|
+
klaude_code/command/debug_cmd.py,sha256=hRwIgB5aWdYS5DFfCuJjAaP6M38bP05ob0_6kb-J47M,2696
|
|
20
|
+
klaude_code/command/diff_cmd.py,sha256=6XhnnPxytT_IcNdHZUcrpFkKEv_g_eyb5b7S-OZ6x-E,5159
|
|
21
|
+
klaude_code/command/export_cmd.py,sha256=_NW5FV3qHDeh5yDP1VXdNOI5J0AmPJu9ODnQaegsnAY,3466
|
|
22
|
+
klaude_code/command/export_online_cmd.py,sha256=sak3-C9LaiuL5BAByPFzySdIbpSx2lcUo83GNRj-yOo,5596
|
|
23
|
+
klaude_code/command/help_cmd.py,sha256=gJQRLEOyT0Cqr-RvVdTpmmd8lbj2FzyOsADyJecGPPY,1574
|
|
24
|
+
klaude_code/command/model_cmd.py,sha256=wCFdc8Hg1V01odEtQSKIF8Q8u8R-_pELTXBolU9DAeQ,1572
|
|
22
25
|
klaude_code/command/prompt-deslop.md,sha256=YGaAXqem39zd0UWCFjWUj83Cf7cvUJq1768aJExFqeg,1346
|
|
23
26
|
klaude_code/command/prompt-dev-docs-update.md,sha256=g1IWIWIa-3qlNOw5mBA4N9H1_nvYcw8AKo7XoQw_AZQ,1855
|
|
24
27
|
klaude_code/command/prompt-dev-docs.md,sha256=PU9iT6XdUEH6grfSjHVma7xKOQcA__ZTKlEDkbbO0hA,1783
|
|
25
28
|
klaude_code/command/prompt-handoff.md,sha256=RXIeXNwOpSpkwAyNFSvQFoo077TVkbj11fqQ2r8aCh4,1638
|
|
26
29
|
klaude_code/command/prompt-init.md,sha256=a4_FQ3gKizqs2vl9oEY5jtG6HNhv3f-1b5RSCFq0A18,1873
|
|
27
|
-
klaude_code/command/prompt_command.py,sha256=
|
|
28
|
-
klaude_code/command/refresh_cmd.py,sha256=
|
|
29
|
-
klaude_code/command/registry.py,sha256=
|
|
30
|
-
klaude_code/command/release_notes_cmd.py,sha256=
|
|
31
|
-
klaude_code/command/status_cmd.py,sha256=
|
|
32
|
-
klaude_code/command/terminal_setup_cmd.py,sha256=
|
|
33
|
-
klaude_code/command/thinking_cmd.py,sha256=
|
|
30
|
+
klaude_code/command/prompt_command.py,sha256=ml4YZAoJV7ARS6-vfkSxndujGKWoqg559Oei75AaH40,2515
|
|
31
|
+
klaude_code/command/refresh_cmd.py,sha256=SbyAK9ovHdvb0gYyMFefVTbPTv6TzvR3aRp8Li9e5v4,1178
|
|
32
|
+
klaude_code/command/registry.py,sha256=vhIvTvTxklZBSPtUraL7YkLxdnIhCTaKfLPS_p6iSBM,3786
|
|
33
|
+
klaude_code/command/release_notes_cmd.py,sha256=dKouhH7EUqLO2tQtvqqmLgGDP_F-oh8elsDMHL865Vg,2615
|
|
34
|
+
klaude_code/command/status_cmd.py,sha256=bySD1WGT9UB8cc7vrGvifL24knhY4cXkoa_UbUTm8xE,5300
|
|
35
|
+
klaude_code/command/terminal_setup_cmd.py,sha256=TZTdgo1Xsx6-QFXdZPF3dlT4JyzvmA389Uoz0ATyS9M,10852
|
|
36
|
+
klaude_code/command/thinking_cmd.py,sha256=4eQgrQMlwrRFeaMb3M_zznkvoQxgxBWOANNqy3tN92U,8415
|
|
34
37
|
klaude_code/config/__init__.py,sha256=Qrqvi8nizkj6N77h2vDj0r4rbgCiqxvz2HLBPFuWulA,120
|
|
35
|
-
klaude_code/config/config.py,sha256=
|
|
36
|
-
klaude_code/config/
|
|
37
|
-
klaude_code/
|
|
38
|
-
klaude_code/const/__init__.py,sha256=uNLYBV7avW00NQDJ_ZB6n0xEeF-CYlyswKOBAHk2MmI,4256
|
|
38
|
+
klaude_code/config/config.py,sha256=2jvM6a8zoC-TdRFaLIw3OW5paxxeXC6l-o05ds4RysA,7263
|
|
39
|
+
klaude_code/config/select_model.py,sha256=KCdFjaoHXyO9QidNna_OGdDrvlEXtRUXKfG-F8kdNLk,5188
|
|
40
|
+
klaude_code/const/__init__.py,sha256=MWm6fppZfAd8EGPdQgdEvRzrMRJ1Ei6Ma11eoNg4es0,4256
|
|
39
41
|
klaude_code/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
42
|
klaude_code/core/agent.py,sha256=bWm-UFX_0-KAy5j_YHH8X8o3MJT4-40Ni2EaDP2SL5k,5819
|
|
41
|
-
klaude_code/core/executor.py,sha256=
|
|
42
|
-
klaude_code/core/manager/__init__.py,sha256=
|
|
43
|
-
klaude_code/core/manager/agent_manager.py,sha256=Z_LEV9WP-4h6tLAy4_WJnnJElY8MfH1OTRHk_LRw0VI,5202
|
|
43
|
+
klaude_code/core/executor.py,sha256=AWMVuYjx1qk2_v75Ps3GXEV7d8fIBdvJ_HEuWbaoPg8,23095
|
|
44
|
+
klaude_code/core/manager/__init__.py,sha256=hdIbpnYj6i18byiWjtJIm5l7NYYDQMvafw8fePVPydc,562
|
|
44
45
|
klaude_code/core/manager/llm_clients.py,sha256=X2oMFWgJcP0tK8GEtMMDYR3HyR6_H8FuyCqpzWF5x2k,871
|
|
45
46
|
klaude_code/core/manager/llm_clients_builder.py,sha256=pPZ_xBh-_ipV66L-9a1fnwNos4iik82Zkq0E0y3WrfI,1521
|
|
46
|
-
klaude_code/core/manager/sub_agent_manager.py,sha256=
|
|
47
|
+
klaude_code/core/manager/sub_agent_manager.py,sha256=G4se7JvDBYtEJ2t-dzOAoBYZcQcyjlAoIaAZwsnSn0s,4709
|
|
47
48
|
klaude_code/core/prompt.py,sha256=o0BHYPdr8Jcv7xGWGgNRKvWsrw9D51MJGNWq8JYH4o0,3552
|
|
48
|
-
klaude_code/core/prompts/prompt-claude-code.md,sha256=
|
|
49
|
+
klaude_code/core/prompts/prompt-claude-code.md,sha256=uuWBv6GrG63mdmBedAHT5U9yOpbHSKFYbbS2xBnUzOE,8290
|
|
49
50
|
klaude_code/core/prompts/prompt-codex-gpt-5-1-codex-max.md,sha256=SW-y8AmR99JL_9j26k9YVAOQuZ18vR12aT5CWHkZDc4,11741
|
|
50
51
|
klaude_code/core/prompts/prompt-codex-gpt-5-1.md,sha256=jNi593_4L3EoMvjS0TwltF2b684gtDBsYHa9npxO34A,24239
|
|
51
52
|
klaude_code/core/prompts/prompt-gemini.md,sha256=JjE1tHSByGKJzjn4Gpj1zekT7ry1Yqbwx5qx3fZy2gE,3901
|
|
52
53
|
klaude_code/core/prompts/prompt-minimal.md,sha256=6-ZmQQkE3f92W_3V2wS7ocB13wLog1_UojCjZG0K4v8,1559
|
|
53
54
|
klaude_code/core/prompts/prompt-sub-agent-explore.md,sha256=i0I9LFB3X8VZIQtxK87CXwcRKowSO_HJxSIKopkFy_Q,2123
|
|
54
|
-
klaude_code/core/prompts/prompt-sub-agent-oracle.md,sha256
|
|
55
|
-
klaude_code/core/prompts/prompt-sub-agent-
|
|
55
|
+
klaude_code/core/prompts/prompt-sub-agent-oracle.md,sha256=1PLI3snvxnenCOPVrL0IxZnBl5b2xxGhlufHAyLyf60,1376
|
|
56
|
+
klaude_code/core/prompts/prompt-sub-agent-web.md,sha256=RMJJVXmPKWTI2lOad85ichTaKKJL_PPpznOwg1j7z6U,2312
|
|
56
57
|
klaude_code/core/prompts/prompt-sub-agent.md,sha256=dmmdsOenbAOfqG6FmdR88spOLZkXmntDBs-cmZ9DN_g,897
|
|
57
|
-
klaude_code/core/reminders.py,sha256=
|
|
58
|
-
klaude_code/core/task.py,sha256=
|
|
59
|
-
klaude_code/core/tool/__init__.py,sha256=
|
|
58
|
+
klaude_code/core/reminders.py,sha256=LA8sWzYQNlwRaAeXFtso5a0HOc5ECxpDaxGgDJAmDLw,18601
|
|
59
|
+
klaude_code/core/task.py,sha256=MK40Tx2WOvfscM1Tqyoqq2XteR66YHcYlAlq0Yw2-LM,10388
|
|
60
|
+
klaude_code/core/tool/__init__.py,sha256=qNdrji0JlmDp6nW9wFngT_38FpsSgCMkaKhRLpTZERk,2158
|
|
60
61
|
klaude_code/core/tool/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
62
|
klaude_code/core/tool/file/_utils.py,sha256=LLmdEOJnC7MgdiAlWtBPZR0h23oM9wD_UsKqU1Nfkbs,774
|
|
62
63
|
klaude_code/core/tool/file/apply_patch.py,sha256=LZd3pYQ9ow_TxiFnqYuzD216HmvkLX6lW6BoMd9iQRs,17080
|
|
@@ -67,7 +68,7 @@ klaude_code/core/tool/file/edit_tool.py,sha256=0fDe9QSDW33t9Ujsj-L6xMqo4FuaEwVLc
|
|
|
67
68
|
klaude_code/core/tool/file/multi_edit_tool.md,sha256=4G39b-jGdJdGGbBTj7R6tcUfcui9tXn6CLQ5uaX5y1M,2485
|
|
68
69
|
klaude_code/core/tool/file/multi_edit_tool.py,sha256=TI8Z8qlXUlrJ4ThVyPSUcocNC-B7NHyixoCqV-mi9G0,6886
|
|
69
70
|
klaude_code/core/tool/file/read_tool.md,sha256=FeRW9WMUNCtgbezjohvSJjFLZhQd1EaHVcjCI4eQHf4,1472
|
|
70
|
-
klaude_code/core/tool/file/read_tool.py,sha256=
|
|
71
|
+
klaude_code/core/tool/file/read_tool.py,sha256=ZdCus6oFed3ZU2eYSQOX7iBexzynB7XWi68Hk4IrRGo,14040
|
|
71
72
|
klaude_code/core/tool/file/write_tool.md,sha256=CNnYgtieUasuHdpXLDpTEsqe492Pf7v75M4RQ3oIer8,613
|
|
72
73
|
klaude_code/core/tool/file/write_tool.py,sha256=TdGZlxFec4hQNmWgD5Rlos5bCI9Z1RJtjhPvg15v5hk,4339
|
|
73
74
|
klaude_code/core/tool/memory/__init__.py,sha256=oeBpjUXcAilCtYXhiXDzavw5-BE_pbB2ZxsFJKTTcdc,143
|
|
@@ -76,10 +77,10 @@ klaude_code/core/tool/memory/memory_tool.py,sha256=xasFf1IQp1LFaL4ctDIQt5jfrd_z6
|
|
|
76
77
|
klaude_code/core/tool/memory/skill_loader.py,sha256=DOlfALn4GwSPHDubNhYtzxM5di29uE7_tOdRi3yxfDc,8726
|
|
77
78
|
klaude_code/core/tool/memory/skill_tool.md,sha256=UfjJK5EGAd3mf7ym5rIrRdPyV3kBTxNnwzOjNnHOBrE,973
|
|
78
79
|
klaude_code/core/tool/memory/skill_tool.py,sha256=8SC4asNZSKfExuhzbyGz4f2cr78PgCpNkut_31IHePw,3602
|
|
79
|
-
klaude_code/core/tool/report_back_tool.py,sha256=
|
|
80
|
+
klaude_code/core/tool/report_back_tool.py,sha256=KRZzQAIxniwXe58SDJcfK_DCf9TFFAx8XC75wPEjmpY,3246
|
|
80
81
|
klaude_code/core/tool/shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
81
82
|
klaude_code/core/tool/shell/bash_tool.md,sha256=ILKpnRCBTkU2uSDEdZQjNYo1l6hsM4TO-3RD5zWC61c,3935
|
|
82
|
-
klaude_code/core/tool/shell/bash_tool.py,sha256=
|
|
83
|
+
klaude_code/core/tool/shell/bash_tool.py,sha256=xW6-F_SnSVZwAel9UB1jaCKz26ogusHIQU9ZlyV-QhE,5263
|
|
83
84
|
klaude_code/core/tool/shell/command_safety.py,sha256=bGsooLovuzq8WmLcZ2v24AVBDj3bZv2p4GSL0IlixvM,13192
|
|
84
85
|
klaude_code/core/tool/sub_agent_tool.py,sha256=vFRmULiOERqK0V9OoHww80e3yA_Q5Wxu3iv8Dpxi8d0,2992
|
|
85
86
|
klaude_code/core/tool/todo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -91,14 +92,16 @@ klaude_code/core/tool/todo/update_plan_tool.py,sha256=5MmmApG0wObBgc-mLETjIMupxI
|
|
|
91
92
|
klaude_code/core/tool/tool_abc.py,sha256=3FlVZ8a6hC-_Ci23_cpLaap9nHinHgxSB1TsZL5ylUQ,731
|
|
92
93
|
klaude_code/core/tool/tool_context.py,sha256=M6KpU2xtgKeQmvAZwqeLnzbzWvjxTt_M0p2ohC1tsb4,4157
|
|
93
94
|
klaude_code/core/tool/tool_registry.py,sha256=vp7xmXvPW-vpX0fXi41RiQMZtQFwgyA0GP7K_wHRR9I,2630
|
|
94
|
-
klaude_code/core/tool/tool_runner.py,sha256=
|
|
95
|
-
klaude_code/core/tool/truncation.py,sha256=
|
|
95
|
+
klaude_code/core/tool/tool_runner.py,sha256=1MQUzqd4pWCVN1UJan4xROj6PkI2FrLBYCi_V3fyFN0,10710
|
|
96
|
+
klaude_code/core/tool/truncation.py,sha256=YPKzelOM45rHW_OkcfX5_Ojg_pPi8yDZu7lSnwl9b_k,7334
|
|
96
97
|
klaude_code/core/tool/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
98
|
klaude_code/core/tool/web/mermaid_tool.md,sha256=Ketpxpr7lz8238p5Q7ZzcyWchWd4dU68u708-dxaZds,978
|
|
98
99
|
klaude_code/core/tool/web/mermaid_tool.py,sha256=Ok0A27oHLnV1c__74bheUuy3wpqDJ1zaXUSxuuqsNPI,2630
|
|
99
|
-
klaude_code/core/tool/web/web_fetch_tool.md,sha256=
|
|
100
|
-
klaude_code/core/tool/web/web_fetch_tool.py,sha256=
|
|
101
|
-
klaude_code/core/
|
|
100
|
+
klaude_code/core/tool/web/web_fetch_tool.md,sha256=jIrW-EAmfl50bBevcfioQ3Vrg8kWlHSut8ze_sRgRGw,486
|
|
101
|
+
klaude_code/core/tool/web/web_fetch_tool.py,sha256=otqg2RXnRZLnDKeG1c1zVOH5amPhsdj8czft4pmx_mM,6260
|
|
102
|
+
klaude_code/core/tool/web/web_search_tool.md,sha256=l5gGPx-fXHFel1zLBljm8isy9pwEYXGrq5cFzzw1VBw,1135
|
|
103
|
+
klaude_code/core/tool/web/web_search_tool.py,sha256=riI5ugsrkg1kOaaQ-Q2CYyGYx6r8WRo1db0eoitSEH0,3829
|
|
104
|
+
klaude_code/core/turn.py,sha256=PvtVV5GLAvYYAsl3RJNDnIvX1Yp4Va8whr0TR8x-9PI,12706
|
|
102
105
|
klaude_code/llm/__init__.py,sha256=b4AsqnrMIs0a5qR_ti6rZcHwFzAReTwOW96EqozEoSo,287
|
|
103
106
|
klaude_code/llm/anthropic/__init__.py,sha256=PWETvaeNAAX3ue0ww1uRUIxTJG0RpWiutkn7MlwKxBs,67
|
|
104
107
|
klaude_code/llm/anthropic/client.py,sha256=J0uv_tGHq2V5A_LuaJOVHXW6vARdZxsWOvzO6PdW4JQ,9742
|
|
@@ -122,24 +125,24 @@ klaude_code/llm/responses/client.py,sha256=OdvnFeEOUp5aYX5hEVVZzJ8aSB5t2sfBCVNOE
|
|
|
122
125
|
klaude_code/llm/responses/input.py,sha256=qr61LmQJdcb_f-ofrAz06WpK_k4PEcI36XsyuZAXbKk,6805
|
|
123
126
|
klaude_code/llm/usage.py,sha256=cq6yZNSKBhRVVjFqBYJQrK3mw9ZSLXaTpbDeal-BjBQ,4205
|
|
124
127
|
klaude_code/protocol/__init__.py,sha256=aGUgzhYqvhuT3Mk2vj7lrHGriH4h9TSbqV1RsRFAZjQ,194
|
|
125
|
-
klaude_code/protocol/commands.py,sha256=
|
|
126
|
-
klaude_code/protocol/events.py,sha256=
|
|
128
|
+
klaude_code/protocol/commands.py,sha256=z9Ckp_YGC403axcqIkB-xTUM-gtlTtd-1lNx83AQriE,662
|
|
129
|
+
klaude_code/protocol/events.py,sha256=KUMf1rLNdHQO9cZiQ9Pa1VsKkP1PTMbUkp18bu_jGy8,3935
|
|
127
130
|
klaude_code/protocol/llm_param.py,sha256=cb4ubLq21PIsMOC8WJb0aid12z_sT1b7FsbNJMr-jLg,4255
|
|
128
131
|
klaude_code/protocol/model.py,sha256=JDWjN_GiUwJQxVA2HFXo2cryR_UOEjDBeVB3SwmrbE8,12584
|
|
129
132
|
klaude_code/protocol/op.py,sha256=hdQTzD6zAsRMJJFaLOPvDX9gokhtIBSYNQuZ20TusI4,2824
|
|
130
133
|
klaude_code/protocol/op_handler.py,sha256=_lnv3-RxKkrTfGTNBlQ23gbHJBEtMLC8O48SYWDtPjE,843
|
|
131
|
-
klaude_code/protocol/sub_agent/__init__.py,sha256=
|
|
132
|
-
klaude_code/protocol/sub_agent/explore.py,sha256=
|
|
134
|
+
klaude_code/protocol/sub_agent/__init__.py,sha256=Abap5lPLgnSCQsVD3axfeqnj2UtxOcDLGX8e9HugfSU,3964
|
|
135
|
+
klaude_code/protocol/sub_agent/explore.py,sha256=Z4M7i98XBLew38ClXiW-hJteSYjMUu2b548rkR7JW3A,2579
|
|
133
136
|
klaude_code/protocol/sub_agent/oracle.py,sha256=0cbuutKQcvwaM--Q15mbkCdbpZMF4YjxDN1jkuGVKp4,3344
|
|
134
137
|
klaude_code/protocol/sub_agent/task.py,sha256=fvj4i1vfWXivStQ-9urDS40wTWkmNRvl6D-A0exExJg,3608
|
|
135
|
-
klaude_code/protocol/sub_agent/
|
|
136
|
-
klaude_code/protocol/tools.py,sha256=
|
|
138
|
+
klaude_code/protocol/sub_agent/web.py,sha256=XEQsKn4X2CMyyzMxNUWVbiSna8P5p0FYBk4kFYuTEB0,3030
|
|
139
|
+
klaude_code/protocol/tools.py,sha256=QvFtVAGkA5elef3HWnSs7FcxcI0FOn4N_toCLT-S6Rw,401
|
|
137
140
|
klaude_code/session/__init__.py,sha256=oXcDA5w-gJCbzmlF8yuWy3ezIW9DgFBNUs-gJHUJ-Rc,121
|
|
138
141
|
klaude_code/session/export.py,sha256=bgljE-3vGH2fKl6d8UptGmG4sPoy8gdVgSstMBsMy9M,26783
|
|
139
142
|
klaude_code/session/selector.py,sha256=gijwWQkSV20XYP3Fxr27mFXuqP4ChY2DQm_YuBOTQKw,2888
|
|
140
|
-
klaude_code/session/session.py,sha256=
|
|
141
|
-
klaude_code/session/templates/export_session.html,sha256=
|
|
142
|
-
klaude_code/trace/__init__.py,sha256=
|
|
143
|
+
klaude_code/session/session.py,sha256=k4neSIAeI08judDed_YnhQtx8I0R0ibMpsk7Ak_lKF0,21822
|
|
144
|
+
klaude_code/session/templates/export_session.html,sha256=uO0oB9RZjr2lygjT1R0pr00y-CtbZ7f4M1aphNMdoNc,50012
|
|
145
|
+
klaude_code/trace/__init__.py,sha256=q8uOYhWr2_Mia1aEK_vkqx91YAfFM25ItIB6J8n3_pM,352
|
|
143
146
|
klaude_code/trace/log.py,sha256=0H_RqkytSpt6AAIFDg-MV_8vA9zsR9BB1UqT6moTTTg,9134
|
|
144
147
|
klaude_code/ui/__init__.py,sha256=XuEQsFUkJet8HI04cRmNLwnHOUqaPCRy4hF7PJnIfCY,2737
|
|
145
148
|
klaude_code/ui/core/__init__.py,sha256=2NakrTDcxem5D0atyEY_Rxv1BbKCeZweF63L6AAq6r8,23
|
|
@@ -153,30 +156,31 @@ klaude_code/ui/modes/exec/__init__.py,sha256=RsYa-DmDJj6g7iXb4H9mm2_Cu-KDQOD10RJ
|
|
|
153
156
|
klaude_code/ui/modes/exec/display.py,sha256=m2kkgaUoGD9rEVUmcm7Vs_PyAI2iruKCJYRhANjSsKo,1965
|
|
154
157
|
klaude_code/ui/modes/repl/__init__.py,sha256=35a6SUiL1SDi2i43X2VjHQw97rR7yhbLBzkGI5aC6Bc,1526
|
|
155
158
|
klaude_code/ui/modes/repl/clipboard.py,sha256=ZCpk7kRSXGhh0Q_BWtUUuSYT7ZOqRjAoRcg9T9n48Wo,5137
|
|
156
|
-
klaude_code/ui/modes/repl/completers.py,sha256=
|
|
159
|
+
klaude_code/ui/modes/repl/completers.py,sha256=KG_wMlVGTKpvkGhAGIBydXe2Jk4-nVWDuChGniW412A,19034
|
|
157
160
|
klaude_code/ui/modes/repl/display.py,sha256=0u4ISeOoYjynF7InYyV-PMOZqP44QBbjYOLOL18V0c0,2245
|
|
158
|
-
klaude_code/ui/modes/repl/event_handler.py,sha256=
|
|
161
|
+
klaude_code/ui/modes/repl/event_handler.py,sha256=tQuJ8nzXRKZ8aXxIe_iqv_klno_m7tgGuC0mCogvX6E,23859
|
|
159
162
|
klaude_code/ui/modes/repl/input_prompt_toolkit.py,sha256=EAIAtcL9EHVPmVK6oOHg0xCeZ0IOnG5S5KsaL85OHOk,6368
|
|
160
163
|
klaude_code/ui/modes/repl/key_bindings.py,sha256=Fxz9Ey2SnOHvfleMeSYVduxuofY0Yo-97hMRs-OMe-o,7800
|
|
161
|
-
klaude_code/ui/modes/repl/renderer.py,sha256=
|
|
164
|
+
klaude_code/ui/modes/repl/renderer.py,sha256=qiB6wuk-bBroN1OCDDC-h09Mduo4Utj6xAZx6YmHu-Y,11660
|
|
162
165
|
klaude_code/ui/renderers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
163
166
|
klaude_code/ui/renderers/assistant.py,sha256=Dxy6v4pX28RyWhnrjBteY8_NvDIi_jQa-j0mWt-eqWY,569
|
|
164
167
|
klaude_code/ui/renderers/common.py,sha256=TPH7LCbeJGqB8ArTsVitqJHEyOxHU6nwnRtvF04nLJ4,184
|
|
165
168
|
klaude_code/ui/renderers/developer.py,sha256=dlap4Cdcx4cCtbixUEQLd4UoLDaT8VXGOQtbvCIbweo,6916
|
|
166
169
|
klaude_code/ui/renderers/diffs.py,sha256=iPQxxZW1JGPwtTdCKMEkDlNb5trLm9tdWjfMRmtj6yQ,7616
|
|
167
170
|
klaude_code/ui/renderers/errors.py,sha256=c_fbnoNOnvuI3Bb24IujwV8Mpes-qWS_xCWfAcBvg6A,517
|
|
168
|
-
klaude_code/ui/renderers/metadata.py,sha256=
|
|
169
|
-
klaude_code/ui/renderers/sub_agent.py,sha256=
|
|
170
|
-
klaude_code/ui/renderers/thinking.py,sha256=
|
|
171
|
-
klaude_code/ui/renderers/tools.py,sha256=
|
|
171
|
+
klaude_code/ui/renderers/metadata.py,sha256=Qh5JIs0ZJeuzS0ocAaSklWFaxmCDLSkxK4idjLexYxY,7956
|
|
172
|
+
klaude_code/ui/renderers/sub_agent.py,sha256=grQ_9G_7iYHdCpxrM0qDAKEMQfXcxBv0bI0GPe3s0lE,4961
|
|
173
|
+
klaude_code/ui/renderers/thinking.py,sha256=hUIJzgsjvpK2cM_C2103cG4gz785FUt1PtQsQtgji9s,1764
|
|
174
|
+
klaude_code/ui/renderers/tools.py,sha256=U5NI1B3ItQVTOXEMpoAkWS9mPKinO-uh8k_Vm6UZ4Ts,23736
|
|
172
175
|
klaude_code/ui/renderers/user_input.py,sha256=rDdOYvbgJ6oePQAtyTCK-KhARfLKytpTZboZ-cFIuJQ,2603
|
|
173
176
|
klaude_code/ui/rich/__init__.py,sha256=olvMm2SteyKioOqUJbEoav2TsDr_mtKqkSaifNumjwc,27
|
|
177
|
+
klaude_code/ui/rich/code_panel.py,sha256=MdUP4QSaQJQxX0MQJT0pvrkhpGYZx3gWdIRbZT_Uj_I,3938
|
|
174
178
|
klaude_code/ui/rich/live.py,sha256=Uid0QAZG7mHb4KrCF8p9c9n1nHLHzW75xSqcLZ4bLWY,2098
|
|
175
|
-
klaude_code/ui/rich/markdown.py,sha256=
|
|
179
|
+
klaude_code/ui/rich/markdown.py,sha256=cL1irwj4OuEdUvOSUjUopiuf_VMHKd52yXHIsl3JINA,10787
|
|
176
180
|
klaude_code/ui/rich/quote.py,sha256=tZcxN73SfDBHF_qk0Jkh9gWBqPBn8VLp9RF36YRdKEM,1123
|
|
177
181
|
klaude_code/ui/rich/searchable_text.py,sha256=DCVZgEFv7_ergAvT2v7XrfQAUXUzhmAwuVAchlIx8RY,2448
|
|
178
|
-
klaude_code/ui/rich/status.py,sha256=
|
|
179
|
-
klaude_code/ui/rich/theme.py,sha256=
|
|
182
|
+
klaude_code/ui/rich/status.py,sha256=QKwH-QhkpcX-6Zg7TuX6TUcuu-wY1PdBK-JEr8HQ8u0,9746
|
|
183
|
+
klaude_code/ui/rich/theme.py,sha256=5m4xDw436GLVecsnKo94lRo44pPuFPXHV-dcxrdHQAI,10723
|
|
180
184
|
klaude_code/ui/terminal/__init__.py,sha256=GIMnsEcIAGT_vBHvTlWEdyNmAEpruyscUA6M_j3GQZU,1412
|
|
181
185
|
klaude_code/ui/terminal/color.py,sha256=M-i09DVlLAhAyhQjfeAi7OipoGi1p_OVkaZxeRfykY0,7135
|
|
182
186
|
klaude_code/ui/terminal/control.py,sha256=6SGNwxorP3jMW9xqnZy2BC0OsJd4DSrS13O3t6YlZzs,4916
|
|
@@ -186,7 +190,7 @@ klaude_code/ui/utils/__init__.py,sha256=YEsCLjbCPaPza-UXTPUMTJTrc9BmNBUP5CbFWlsh
|
|
|
186
190
|
klaude_code/ui/utils/common.py,sha256=UCQMun23l-EREr3xkl-Bjx67yfi9ctRTw2gcGPsOM2c,2881
|
|
187
191
|
klaude_code/ui/utils/debouncer.py,sha256=x8AYxf48Xd6tabBvH8cVl1bIV8FzyeDo3HswDjtNfwU,1266
|
|
188
192
|
klaude_code/version.py,sha256=x2OeiACPdzS87EWtaSi_UP13htm81Uq7mlV3kFy5jko,4815
|
|
189
|
-
klaude_code-1.2.
|
|
190
|
-
klaude_code-1.2.
|
|
191
|
-
klaude_code-1.2.
|
|
192
|
-
klaude_code-1.2.
|
|
193
|
+
klaude_code-1.2.18.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
194
|
+
klaude_code-1.2.18.dist-info/entry_points.txt,sha256=7CWKjolvs6dZiYHpelhA_FRJ-sVDh43eu3iWuOhKc_w,53
|
|
195
|
+
klaude_code-1.2.18.dist-info/METADATA,sha256=To2azZ7yKg5IdXJlusNEl7CrqQ4rSYsejnathQ5UflU,7450
|
|
196
|
+
klaude_code-1.2.18.dist-info/RECORD,,
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"""Agent and session manager.
|
|
2
|
-
|
|
3
|
-
This module contains :class:`AgentManager`, a helper responsible for
|
|
4
|
-
creating and tracking agents per session, applying model changes, and
|
|
5
|
-
clearing conversations. It is used by the executor context to keep
|
|
6
|
-
agent-related responsibilities separate from operation dispatch.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from __future__ import annotations
|
|
10
|
-
|
|
11
|
-
import asyncio
|
|
12
|
-
|
|
13
|
-
from klaude_code.config import load_config
|
|
14
|
-
from klaude_code.core.agent import Agent, DefaultModelProfileProvider, ModelProfileProvider
|
|
15
|
-
from klaude_code.core.manager.llm_clients import LLMClients
|
|
16
|
-
from klaude_code.llm.registry import create_llm_client
|
|
17
|
-
from klaude_code.protocol import commands, events, model
|
|
18
|
-
from klaude_code.session.session import Session
|
|
19
|
-
from klaude_code.trace import DebugType, log_debug
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class AgentManager:
|
|
23
|
-
"""Manager component that tracks agents and their sessions."""
|
|
24
|
-
|
|
25
|
-
def __init__(
|
|
26
|
-
self,
|
|
27
|
-
event_queue: asyncio.Queue[events.Event],
|
|
28
|
-
llm_clients: LLMClients,
|
|
29
|
-
model_profile_provider: ModelProfileProvider | None = None,
|
|
30
|
-
) -> None:
|
|
31
|
-
self._event_queue: asyncio.Queue[events.Event] = event_queue
|
|
32
|
-
self._llm_clients: LLMClients = llm_clients
|
|
33
|
-
self._model_profile_provider: ModelProfileProvider = model_profile_provider or DefaultModelProfileProvider()
|
|
34
|
-
self._active_agents: dict[str, Agent] = {}
|
|
35
|
-
|
|
36
|
-
async def emit_event(self, event: events.Event) -> None:
|
|
37
|
-
"""Emit an event to the shared event queue."""
|
|
38
|
-
|
|
39
|
-
await self._event_queue.put(event)
|
|
40
|
-
|
|
41
|
-
async def ensure_agent(self, session_id: str | None = None) -> Agent:
|
|
42
|
-
"""Return an existing agent for the session or create a new one.
|
|
43
|
-
|
|
44
|
-
If session_id is None, a new session is created with an auto-generated ID.
|
|
45
|
-
If session_id is provided, attempts to load existing session or creates new one.
|
|
46
|
-
"""
|
|
47
|
-
if session_id is None:
|
|
48
|
-
session = Session.create()
|
|
49
|
-
else:
|
|
50
|
-
agent = self._active_agents.get(session_id)
|
|
51
|
-
if agent is not None:
|
|
52
|
-
return agent
|
|
53
|
-
session = Session.load(session_id)
|
|
54
|
-
profile = self._model_profile_provider.build_profile(self._llm_clients.main)
|
|
55
|
-
agent = Agent(session=session, profile=profile)
|
|
56
|
-
|
|
57
|
-
async for evt in agent.replay_history():
|
|
58
|
-
await self.emit_event(evt)
|
|
59
|
-
|
|
60
|
-
await self.emit_event(
|
|
61
|
-
events.WelcomeEvent(
|
|
62
|
-
work_dir=str(session.work_dir),
|
|
63
|
-
llm_config=self._llm_clients.main.get_llm_config(),
|
|
64
|
-
)
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
self._active_agents[session.id] = agent
|
|
68
|
-
log_debug(
|
|
69
|
-
f"Initialized agent for session: {session.id}",
|
|
70
|
-
style="cyan",
|
|
71
|
-
debug_type=DebugType.EXECUTION,
|
|
72
|
-
)
|
|
73
|
-
return agent
|
|
74
|
-
|
|
75
|
-
async def apply_model_change(self, agent: Agent, model_name: str) -> None:
|
|
76
|
-
"""Change the model used by an agent and notify the UI."""
|
|
77
|
-
|
|
78
|
-
config = load_config()
|
|
79
|
-
if config is None:
|
|
80
|
-
raise ValueError("Configuration must be initialized before changing model")
|
|
81
|
-
|
|
82
|
-
llm_config = config.get_model_config(model_name)
|
|
83
|
-
llm_client = create_llm_client(llm_config)
|
|
84
|
-
agent.set_model_profile(self._model_profile_provider.build_profile(llm_client))
|
|
85
|
-
|
|
86
|
-
developer_item = model.DeveloperMessageItem(
|
|
87
|
-
content=f"switched to model: {model_name}",
|
|
88
|
-
command_output=model.CommandOutput(command_name=commands.CommandName.MODEL),
|
|
89
|
-
)
|
|
90
|
-
agent.session.append_history([developer_item])
|
|
91
|
-
|
|
92
|
-
await self.emit_event(events.DeveloperMessageEvent(session_id=agent.session.id, item=developer_item))
|
|
93
|
-
await self.emit_event(events.WelcomeEvent(llm_config=llm_config, work_dir=str(agent.session.work_dir)))
|
|
94
|
-
|
|
95
|
-
async def apply_clear(self, agent: Agent) -> None:
|
|
96
|
-
"""Start a new conversation for an agent and notify the UI."""
|
|
97
|
-
|
|
98
|
-
old_session_id = agent.session.id
|
|
99
|
-
|
|
100
|
-
# Create a new session instance to replace the current one
|
|
101
|
-
new_session = Session(work_dir=agent.session.work_dir)
|
|
102
|
-
new_session.model_name = agent.session.model_name
|
|
103
|
-
|
|
104
|
-
# Replace the agent's session with the new one
|
|
105
|
-
agent.session = new_session
|
|
106
|
-
agent.session.save()
|
|
107
|
-
|
|
108
|
-
# Update the active_agents mapping
|
|
109
|
-
self._active_agents.pop(old_session_id, None)
|
|
110
|
-
self._active_agents[new_session.id] = agent
|
|
111
|
-
|
|
112
|
-
developer_item = model.DeveloperMessageItem(
|
|
113
|
-
content="started new conversation",
|
|
114
|
-
command_output=model.CommandOutput(command_name=commands.CommandName.CLEAR),
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
await self.emit_event(events.DeveloperMessageEvent(session_id=agent.session.id, item=developer_item))
|
|
118
|
-
|
|
119
|
-
def get_active_agent(self, session_id: str) -> Agent | None:
|
|
120
|
-
"""Return the active agent for a session id if present."""
|
|
121
|
-
|
|
122
|
-
return self._active_agents.get(session_id)
|
|
123
|
-
|
|
124
|
-
def active_session_ids(self) -> list[str]:
|
|
125
|
-
"""Return a snapshot list of session ids that currently have agents."""
|
|
126
|
-
|
|
127
|
-
return list(self._active_agents.keys())
|
|
128
|
-
|
|
129
|
-
def all_active_agents(self) -> dict[str, Agent]:
|
|
130
|
-
"""Return a snapshot of all active agents keyed by session id."""
|
|
131
|
-
|
|
132
|
-
return dict(self._active_agents)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
You are a web content fetching and analysis specialist. Your job is to retrieve content from URLs and extract or analyze information according to the user's instructions.
|
|
2
|
-
|
|
3
|
-
Your available tools:
|
|
4
|
-
- WebFetch: Fetch content from a URL. HTML pages are automatically converted to Markdown.
|
|
5
|
-
- Read: Read files from the filesystem (useful when WebFetch output is truncated and saved to a file)
|
|
6
|
-
- Bash: Run shell commands (use `rg` to search through large saved files)
|
|
7
|
-
|
|
8
|
-
Workflow:
|
|
9
|
-
1. Use WebFetch to retrieve the URL content
|
|
10
|
-
2. Analyze the content according to the user's prompt
|
|
11
|
-
3. If the output was truncated and saved to a file, use Read or `rg` to search through the full content
|
|
12
|
-
4. If you need information from a linked page, use WebFetch to follow that link
|
|
13
|
-
5. Return a clear, structured summary of your findings
|
|
14
|
-
|
|
15
|
-
Guidelines:
|
|
16
|
-
- Focus on extracting the specific information requested
|
|
17
|
-
- For large pages, prioritize the most relevant sections
|
|
18
|
-
- If content is truncated, look for the saved file path in the system reminder and use rg to search it
|
|
19
|
-
- Return structured data when appropriate (lists, tables, key-value pairs)
|
|
20
|
-
- Be concise but comprehensive in your final response
|
|
21
|
-
- Use absolute file paths when referencing saved files
|
|
22
|
-
- Avoid using emojis
|
|
23
|
-
|
|
24
|
-
Following links:
|
|
25
|
-
- If a link on the page seems relevant to answering the question, use WebFetch to follow it
|
|
26
|
-
- You can fetch multiple pages in sequence to gather all needed information
|
|
27
|
-
- After fetching a link, analyze the content yourself to extract what's needed
|
|
28
|
-
- Remember to include any fetched URLs in your Sources section if they were helpful
|
|
29
|
-
|
|
30
|
-
Handling truncated content:
|
|
31
|
-
When WebFetch output is too large, it will be truncated and the full content saved to a temporary file.
|
|
32
|
-
The file path will be shown in a system-reminder tag. Use these approaches to access the full content:
|
|
33
|
-
- `rg "pattern" /path/to/file` to search for specific content
|
|
34
|
-
- Read tool with offset/limit to read specific sections
|
|
35
|
-
|
|
36
|
-
Response format:
|
|
37
|
-
Your response should be structured as follows:
|
|
38
|
-
|
|
39
|
-
[Your answer to the user's question]
|
|
40
|
-
|
|
41
|
-
## Sources
|
|
42
|
-
- [URL 1] (saved to local: /path/to/file if saved)
|
|
43
|
-
- [URL 2]
|
|
44
|
-
...
|
|
45
|
-
|
|
46
|
-
Only include URLs that actually contributed information to your answer. The main URL is always included. Add any additional URLs you fetched that provided relevant information.
|