deepy-cli 0.1.11__tar.gz → 0.1.13__tar.gz

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.
Files changed (75) hide show
  1. deepy_cli-0.1.13/PKG-INFO +308 -0
  2. deepy_cli-0.1.13/README.md +280 -0
  3. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/pyproject.toml +1 -1
  4. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/__init__.py +1 -1
  5. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/cli.py +1 -1
  6. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/shell.md +3 -2
  7. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/compaction.py +26 -10
  8. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/replay.py +57 -1
  9. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/sessions/jsonl.py +36 -2
  10. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/builtin.py +74 -13
  11. deepy_cli-0.1.13/src/deepy/ui/file_mentions.py +346 -0
  12. deepy_cli-0.1.13/src/deepy/ui/local_command.py +582 -0
  13. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/message_view.py +1 -1
  14. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/prompt_input.py +25 -42
  15. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/session_list.py +1 -1
  16. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/session_picker.py +1 -1
  17. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/terminal.py +136 -49
  18. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/usage.py +37 -1
  19. deepy_cli-0.1.11/PKG-INFO +0 -242
  20. deepy_cli-0.1.11/README.md +0 -214
  21. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/__main__.py +0 -0
  22. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/config/__init__.py +0 -0
  23. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/config/settings.py +0 -0
  24. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/__init__.py +0 -0
  25. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/AskUserQuestion.md +0 -0
  26. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/WebFetch.md +0 -0
  27. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/WebSearch.md +0 -0
  28. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/__init__.py +0 -0
  29. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/edit.md +0 -0
  30. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/modify.md +0 -0
  31. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/read.md +0 -0
  32. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/data/tools/write.md +0 -0
  33. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/errors.py +0 -0
  34. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/__init__.py +0 -0
  35. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/agent.py +0 -0
  36. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/context.py +0 -0
  37. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/events.py +0 -0
  38. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/model_capabilities.py +0 -0
  39. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/provider.py +0 -0
  40. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/runner.py +0 -0
  41. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/llm/thinking.py +0 -0
  42. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/__init__.py +0 -0
  43. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/compact.py +0 -0
  44. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/rules.py +0 -0
  45. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/runtime_context.py +0 -0
  46. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/system.py +0 -0
  47. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/prompts/tool_docs.py +0 -0
  48. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/sessions/__init__.py +0 -0
  49. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/sessions/manager.py +0 -0
  50. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/skills.py +0 -0
  51. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/status.py +0 -0
  52. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/__init__.py +0 -0
  53. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/agents.py +0 -0
  54. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/file_state.py +0 -0
  55. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/result.py +0 -0
  56. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/tools/shell_utils.py +0 -0
  57. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/__init__.py +0 -0
  58. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/app.py +0 -0
  59. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/ask_user_question.py +0 -0
  60. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/exit_summary.py +0 -0
  61. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/loading_text.py +0 -0
  62. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/markdown.py +0 -0
  63. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/model_picker.py +0 -0
  64. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/prompt_buffer.py +0 -0
  65. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/slash_commands.py +0 -0
  66. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/styles.py +0 -0
  67. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/theme_picker.py +0 -0
  68. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/thinking_state.py +0 -0
  69. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/ui/welcome.py +0 -0
  70. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/update_check.py +0 -0
  71. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/utils/__init__.py +0 -0
  72. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/utils/debug_logger.py +0 -0
  73. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/utils/error_logger.py +0 -0
  74. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/utils/json.py +0 -0
  75. {deepy_cli-0.1.11 → deepy_cli-0.1.13}/src/deepy/utils/notify.py +0 -0
@@ -0,0 +1,308 @@
1
+ Metadata-Version: 2.3
2
+ Name: deepy-cli
3
+ Version: 0.1.13
4
+ Summary: Deepy - Vibe coding for DeepSeek models in your terminal
5
+ Keywords: deepseek,coding-agent,terminal,cli,agents
6
+ Author: kirineko
7
+ Author-email: kirineko <kirineko@qq.com>
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Software Development
14
+ Classifier: Topic :: Terminals
15
+ Requires-Dist: openai-agents>=0.17.0
16
+ Requires-Dist: openai>=2.26,<3
17
+ Requires-Dist: orjson>=3.10,<4
18
+ Requires-Dist: pydantic>=2.12,<3
19
+ Requires-Dist: prompt-toolkit>=3.0,<4
20
+ Requires-Dist: rich>=13.9,<15
21
+ Requires-Dist: tiktoken>=0.9,<1
22
+ Requires-Dist: tomli-w>=1
23
+ Requires-Python: >=3.12
24
+ Project-URL: Homepage, https://kirineko.github.io/deepy/
25
+ Project-URL: Repository, https://github.com/kirineko/deepy
26
+ Project-URL: Issues, https://github.com/kirineko/deepy/issues
27
+ Description-Content-Type: text/markdown
28
+
29
+ <p align="center">
30
+ <img src="https://raw.githubusercontent.com/kirineko/deepy/main/asset/deepy-logo.webp" alt="Deepy logo" width="144">
31
+ </p>
32
+
33
+ <h1 align="center">Deepy</h1>
34
+
35
+ <p align="center">
36
+ A terminal coding agent built for DeepSeek.
37
+ <br>
38
+ Read projects, edit files, run commands, search the web, and keep long project context in one recoverable terminal session.
39
+ </p>
40
+
41
+ <p align="center">
42
+ <a href="https://kirineko.github.io/deepy/">Website</a>
43
+ ·
44
+ <a href="README.zh-CN.md">中文文档</a>
45
+ ·
46
+ <a href="#quick-start">Quick Start</a>
47
+ ·
48
+ <a href="#daily-workflow">Daily Workflow</a>
49
+ </p>
50
+
51
+ ![Deepy terminal welcome screen](https://raw.githubusercontent.com/kirineko/deepy/main/asset/welcome.webp)
52
+
53
+ ## What Deepy Does
54
+
55
+ Deepy is a Python CLI coding agent for DeepSeek's OpenAI-compatible models. It
56
+ keeps the working loop inside your terminal: inspect a project, ask questions,
57
+ modify code, run validation commands, search or fetch web pages, and resume the
58
+ same project session later.
59
+
60
+ Deepy is optimized for DeepSeek V4 thinking mode, long context, cache-friendly
61
+ prompting, and a Rich terminal UI that makes the agent's actions visible instead
62
+ of hiding tool calls behind chat text.
63
+
64
+ ## Why Use It
65
+
66
+ - **DeepSeek-first defaults**: starts with `deepseek-v4-pro`, thinking enabled,
67
+ and `reasoning_effort=max`. Use `/model` to switch V4 Pro / V4 Flash and
68
+ choose `none`, `high`, or `max` thinking strength.
69
+ - **Project-aware coding tools**: read files, write new files, modify existing
70
+ files with stale-write protection, run shell commands, and review readable
71
+ diffs.
72
+ - **Visible terminal transcript**: thinking, tool calls, shell output, usage,
73
+ context status, and command results are shown in the terminal.
74
+ - **Research from the terminal**: use WebSearch for discovery and WebFetch when
75
+ you already have an exact URL.
76
+ - **Long-session continuity**: JSONL sessions, `/resume`, `/new`, context window
77
+ status, automatic compacting, and manual `/compact`.
78
+ - **Local command mode**: type `!cmd` to run a non-interactive local shell command
79
+ without sending it to the model; the result is still saved as context.
80
+ - **Cross-platform shell handling**: POSIX shell, PowerShell, cmd, Windows paths,
81
+ UTF-8 output, CRLF editing, and non-interactive Windows local command mode.
82
+
83
+ ## See It Work
84
+
85
+ ### Terminal-Centered Agent Loop
86
+
87
+ Deepy keeps model reasoning, WebFetch, shell output, and status lines visible in
88
+ one transcript.
89
+
90
+ ![Deepy thinking, WebFetch, and shell output](https://raw.githubusercontent.com/kirineko/deepy/main/asset/webfetch-shell-thinking.webp)
91
+
92
+ ### Code Editing With Reviewable Diff
93
+
94
+ File edits are shown with path information and readable diff output so you can
95
+ inspect what changed before continuing.
96
+
97
+ ![Deepy edit diff preview](https://raw.githubusercontent.com/kirineko/deepy/main/asset/edit-diff.webp)
98
+
99
+ ### Search, Fetch, And Local Commands
100
+
101
+ Use WebSearch / WebFetch for external context, `@` for file mentions, and `!`
102
+ for direct local commands.
103
+
104
+ ![Deepy web research workflow](https://raw.githubusercontent.com/kirineko/deepy/main/asset/websearch.webp)
105
+
106
+ ![Deepy local command mode](https://raw.githubusercontent.com/kirineko/deepy/main/asset/command_mode.webp)
107
+
108
+ ## Quick Start
109
+
110
+ 1. Install `uv`:
111
+
112
+ ```bash
113
+ # macOS / Linux
114
+ curl -LsSf https://astral.sh/uv/install.sh | sh
115
+
116
+ # Windows PowerShell
117
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
118
+ ```
119
+
120
+ 2. Configure a uv mirror.
121
+
122
+ Linux / macOS: `~/.config/uv/uv.toml`
123
+
124
+ ```toml
125
+ [[index]]
126
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
127
+ default = true
128
+ ```
129
+
130
+ Windows: `%AppData%\uv\uv.toml`
131
+
132
+ ```toml
133
+ [[index]]
134
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
135
+ default = true
136
+ ```
137
+
138
+ 3. Install Deepy:
139
+
140
+ ```bash
141
+ uv tool install deepy-cli
142
+ ```
143
+
144
+ The installed command is `deepy`.
145
+
146
+ 4. Configure your DeepSeek API key and start Deepy:
147
+
148
+ ```bash
149
+ deepy config setup
150
+
151
+ cd your-project
152
+ deepy
153
+ ```
154
+
155
+ ## Installation Notes
156
+
157
+ Use this order for a fresh machine:
158
+
159
+ ### 1. Install uv
160
+
161
+ ```bash
162
+ # macOS / Linux
163
+ curl -LsSf https://astral.sh/uv/install.sh | sh
164
+
165
+ # Windows PowerShell
166
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
167
+ ```
168
+
169
+ ### 2. Configure a uv mirror
170
+
171
+ Linux / macOS: `~/.config/uv/uv.toml`
172
+
173
+ ```toml
174
+ [[index]]
175
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
176
+ default = true
177
+ ```
178
+
179
+ Windows: `%AppData%\uv\uv.toml`
180
+
181
+ ```toml
182
+ [[index]]
183
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
184
+ default = true
185
+ ```
186
+
187
+ ### 3. Install Deepy
188
+
189
+ ```bash
190
+ uv tool install deepy-cli
191
+ ```
192
+
193
+ ### 4. Configure and start
194
+
195
+ ```bash
196
+ deepy config setup
197
+
198
+ cd your-project
199
+ deepy
200
+ ```
201
+
202
+ Upgrade or uninstall Deepy:
203
+
204
+ ```bash
205
+ uv tool upgrade deepy-cli
206
+ uv tool uninstall deepy-cli
207
+ ```
208
+
209
+ ## Daily Workflow
210
+
211
+ Inside an interactive Deepy session:
212
+
213
+ ```text
214
+ /model Select model and thinking strength
215
+ /resume Resume a previous project session
216
+ /new Start a fresh session
217
+ /compact Compact the active session context
218
+ /theme Show or change terminal UI theme
219
+ @src/app.py Mention a file in the current project
220
+ !pytest -q Run a local non-interactive command
221
+ Esc Interrupt the current model turn
222
+ Ctrl+D Press twice to quit
223
+ ```
224
+
225
+ Typical usage:
226
+
227
+ ```text
228
+ Ask Deepy to inspect a bug, edit files, run tests, and summarize what changed.
229
+ Use @ to reference files precisely.
230
+ Use ! for commands you want to run directly without model mediation.
231
+ Use /resume when returning to a project later.
232
+ Use /compact when a long session needs a durable summary.
233
+ ```
234
+
235
+ ## Configuration
236
+
237
+ Deepy uses TOML configuration at `~/.deepy/config.toml`.
238
+
239
+ ```toml
240
+ [model]
241
+ api_key = "sk-..."
242
+ name = "deepseek-v4-pro"
243
+ base_url = "https://api.deepseek.com"
244
+ thinking = true
245
+ reasoning_effort = "max"
246
+
247
+ [context]
248
+ window_tokens = 1048576
249
+ compact_trigger_ratio = 0.8
250
+ reserved_context_tokens = 50000
251
+ compact_preserve_recent_messages = 2
252
+
253
+ [ui]
254
+ theme = "auto" # auto, dark, or light
255
+ ```
256
+
257
+ Set config without the interactive wizard:
258
+
259
+ ```bash
260
+ deepy config init --api-key sk-... --model deepseek-v4-pro
261
+ deepy config theme light
262
+ ```
263
+
264
+ WebSearch uses Deepy's hosted SearXNG endpoint by default. You can override it:
265
+
266
+ ```toml
267
+ [tools.web_search]
268
+ searxng_url = "https://your-searxng.example/"
269
+ ```
270
+
271
+ ## Command Reference
272
+
273
+ ```bash
274
+ deepy --version
275
+ deepy config setup
276
+ deepy config reset
277
+ deepy config theme
278
+ deepy doctor
279
+ deepy doctor --live --json
280
+ deepy status
281
+ deepy skills list
282
+ deepy sessions list
283
+ deepy sessions show <session-id>
284
+ deepy run "summarize this project"
285
+ ```
286
+
287
+ ## Project Rules And Skills
288
+
289
+ Deepy automatically loads project instructions from:
290
+
291
+ - `AGENTS.md`
292
+ - `.deepy/skills/*/SKILL.md`
293
+
294
+ This lets each repository define local conventions, commands, review rules, and
295
+ domain-specific workflows without changing global config.
296
+
297
+ ## Development
298
+
299
+ ```bash
300
+ uv sync --group dev
301
+ uv run pytest
302
+ uv run ruff check
303
+ uv run pyright
304
+ uv build
305
+ ```
306
+
307
+ The Python package is built from `src/deepy`. GitHub Pages files and screenshot
308
+ assets live outside the package directory and are not included in the wheel.
@@ -0,0 +1,280 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/kirineko/deepy/main/asset/deepy-logo.webp" alt="Deepy logo" width="144">
3
+ </p>
4
+
5
+ <h1 align="center">Deepy</h1>
6
+
7
+ <p align="center">
8
+ A terminal coding agent built for DeepSeek.
9
+ <br>
10
+ Read projects, edit files, run commands, search the web, and keep long project context in one recoverable terminal session.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://kirineko.github.io/deepy/">Website</a>
15
+ ·
16
+ <a href="README.zh-CN.md">中文文档</a>
17
+ ·
18
+ <a href="#quick-start">Quick Start</a>
19
+ ·
20
+ <a href="#daily-workflow">Daily Workflow</a>
21
+ </p>
22
+
23
+ ![Deepy terminal welcome screen](https://raw.githubusercontent.com/kirineko/deepy/main/asset/welcome.webp)
24
+
25
+ ## What Deepy Does
26
+
27
+ Deepy is a Python CLI coding agent for DeepSeek's OpenAI-compatible models. It
28
+ keeps the working loop inside your terminal: inspect a project, ask questions,
29
+ modify code, run validation commands, search or fetch web pages, and resume the
30
+ same project session later.
31
+
32
+ Deepy is optimized for DeepSeek V4 thinking mode, long context, cache-friendly
33
+ prompting, and a Rich terminal UI that makes the agent's actions visible instead
34
+ of hiding tool calls behind chat text.
35
+
36
+ ## Why Use It
37
+
38
+ - **DeepSeek-first defaults**: starts with `deepseek-v4-pro`, thinking enabled,
39
+ and `reasoning_effort=max`. Use `/model` to switch V4 Pro / V4 Flash and
40
+ choose `none`, `high`, or `max` thinking strength.
41
+ - **Project-aware coding tools**: read files, write new files, modify existing
42
+ files with stale-write protection, run shell commands, and review readable
43
+ diffs.
44
+ - **Visible terminal transcript**: thinking, tool calls, shell output, usage,
45
+ context status, and command results are shown in the terminal.
46
+ - **Research from the terminal**: use WebSearch for discovery and WebFetch when
47
+ you already have an exact URL.
48
+ - **Long-session continuity**: JSONL sessions, `/resume`, `/new`, context window
49
+ status, automatic compacting, and manual `/compact`.
50
+ - **Local command mode**: type `!cmd` to run a non-interactive local shell command
51
+ without sending it to the model; the result is still saved as context.
52
+ - **Cross-platform shell handling**: POSIX shell, PowerShell, cmd, Windows paths,
53
+ UTF-8 output, CRLF editing, and non-interactive Windows local command mode.
54
+
55
+ ## See It Work
56
+
57
+ ### Terminal-Centered Agent Loop
58
+
59
+ Deepy keeps model reasoning, WebFetch, shell output, and status lines visible in
60
+ one transcript.
61
+
62
+ ![Deepy thinking, WebFetch, and shell output](https://raw.githubusercontent.com/kirineko/deepy/main/asset/webfetch-shell-thinking.webp)
63
+
64
+ ### Code Editing With Reviewable Diff
65
+
66
+ File edits are shown with path information and readable diff output so you can
67
+ inspect what changed before continuing.
68
+
69
+ ![Deepy edit diff preview](https://raw.githubusercontent.com/kirineko/deepy/main/asset/edit-diff.webp)
70
+
71
+ ### Search, Fetch, And Local Commands
72
+
73
+ Use WebSearch / WebFetch for external context, `@` for file mentions, and `!`
74
+ for direct local commands.
75
+
76
+ ![Deepy web research workflow](https://raw.githubusercontent.com/kirineko/deepy/main/asset/websearch.webp)
77
+
78
+ ![Deepy local command mode](https://raw.githubusercontent.com/kirineko/deepy/main/asset/command_mode.webp)
79
+
80
+ ## Quick Start
81
+
82
+ 1. Install `uv`:
83
+
84
+ ```bash
85
+ # macOS / Linux
86
+ curl -LsSf https://astral.sh/uv/install.sh | sh
87
+
88
+ # Windows PowerShell
89
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
90
+ ```
91
+
92
+ 2. Configure a uv mirror.
93
+
94
+ Linux / macOS: `~/.config/uv/uv.toml`
95
+
96
+ ```toml
97
+ [[index]]
98
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
99
+ default = true
100
+ ```
101
+
102
+ Windows: `%AppData%\uv\uv.toml`
103
+
104
+ ```toml
105
+ [[index]]
106
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
107
+ default = true
108
+ ```
109
+
110
+ 3. Install Deepy:
111
+
112
+ ```bash
113
+ uv tool install deepy-cli
114
+ ```
115
+
116
+ The installed command is `deepy`.
117
+
118
+ 4. Configure your DeepSeek API key and start Deepy:
119
+
120
+ ```bash
121
+ deepy config setup
122
+
123
+ cd your-project
124
+ deepy
125
+ ```
126
+
127
+ ## Installation Notes
128
+
129
+ Use this order for a fresh machine:
130
+
131
+ ### 1. Install uv
132
+
133
+ ```bash
134
+ # macOS / Linux
135
+ curl -LsSf https://astral.sh/uv/install.sh | sh
136
+
137
+ # Windows PowerShell
138
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
139
+ ```
140
+
141
+ ### 2. Configure a uv mirror
142
+
143
+ Linux / macOS: `~/.config/uv/uv.toml`
144
+
145
+ ```toml
146
+ [[index]]
147
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
148
+ default = true
149
+ ```
150
+
151
+ Windows: `%AppData%\uv\uv.toml`
152
+
153
+ ```toml
154
+ [[index]]
155
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
156
+ default = true
157
+ ```
158
+
159
+ ### 3. Install Deepy
160
+
161
+ ```bash
162
+ uv tool install deepy-cli
163
+ ```
164
+
165
+ ### 4. Configure and start
166
+
167
+ ```bash
168
+ deepy config setup
169
+
170
+ cd your-project
171
+ deepy
172
+ ```
173
+
174
+ Upgrade or uninstall Deepy:
175
+
176
+ ```bash
177
+ uv tool upgrade deepy-cli
178
+ uv tool uninstall deepy-cli
179
+ ```
180
+
181
+ ## Daily Workflow
182
+
183
+ Inside an interactive Deepy session:
184
+
185
+ ```text
186
+ /model Select model and thinking strength
187
+ /resume Resume a previous project session
188
+ /new Start a fresh session
189
+ /compact Compact the active session context
190
+ /theme Show or change terminal UI theme
191
+ @src/app.py Mention a file in the current project
192
+ !pytest -q Run a local non-interactive command
193
+ Esc Interrupt the current model turn
194
+ Ctrl+D Press twice to quit
195
+ ```
196
+
197
+ Typical usage:
198
+
199
+ ```text
200
+ Ask Deepy to inspect a bug, edit files, run tests, and summarize what changed.
201
+ Use @ to reference files precisely.
202
+ Use ! for commands you want to run directly without model mediation.
203
+ Use /resume when returning to a project later.
204
+ Use /compact when a long session needs a durable summary.
205
+ ```
206
+
207
+ ## Configuration
208
+
209
+ Deepy uses TOML configuration at `~/.deepy/config.toml`.
210
+
211
+ ```toml
212
+ [model]
213
+ api_key = "sk-..."
214
+ name = "deepseek-v4-pro"
215
+ base_url = "https://api.deepseek.com"
216
+ thinking = true
217
+ reasoning_effort = "max"
218
+
219
+ [context]
220
+ window_tokens = 1048576
221
+ compact_trigger_ratio = 0.8
222
+ reserved_context_tokens = 50000
223
+ compact_preserve_recent_messages = 2
224
+
225
+ [ui]
226
+ theme = "auto" # auto, dark, or light
227
+ ```
228
+
229
+ Set config without the interactive wizard:
230
+
231
+ ```bash
232
+ deepy config init --api-key sk-... --model deepseek-v4-pro
233
+ deepy config theme light
234
+ ```
235
+
236
+ WebSearch uses Deepy's hosted SearXNG endpoint by default. You can override it:
237
+
238
+ ```toml
239
+ [tools.web_search]
240
+ searxng_url = "https://your-searxng.example/"
241
+ ```
242
+
243
+ ## Command Reference
244
+
245
+ ```bash
246
+ deepy --version
247
+ deepy config setup
248
+ deepy config reset
249
+ deepy config theme
250
+ deepy doctor
251
+ deepy doctor --live --json
252
+ deepy status
253
+ deepy skills list
254
+ deepy sessions list
255
+ deepy sessions show <session-id>
256
+ deepy run "summarize this project"
257
+ ```
258
+
259
+ ## Project Rules And Skills
260
+
261
+ Deepy automatically loads project instructions from:
262
+
263
+ - `AGENTS.md`
264
+ - `.deepy/skills/*/SKILL.md`
265
+
266
+ This lets each repository define local conventions, commands, review rules, and
267
+ domain-specific workflows without changing global config.
268
+
269
+ ## Development
270
+
271
+ ```bash
272
+ uv sync --group dev
273
+ uv run pytest
274
+ uv run ruff check
275
+ uv run pyright
276
+ uv build
277
+ ```
278
+
279
+ The Python package is built from `src/deepy`. GitHub Pages files and screenshot
280
+ assets live outside the package directory and are not included in the wheel.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deepy-cli"
3
- version = "0.1.11"
3
+ version = "0.1.13"
4
4
  description = "Deepy - Vibe coding for DeepSeek models in your terminal"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.1.11"
3
+ __version__ = "0.1.13"
4
4
 
5
5
 
6
6
  def main() -> None:
@@ -362,7 +362,7 @@ def _cmd_sessions(args: argparse.Namespace) -> int:
362
362
  return 0
363
363
  for entry in entries:
364
364
  print(
365
- f"{entry.id}\tupdated={entry.updated_at}\thistory_tokens={entry.active_tokens}\t"
365
+ f"{entry.id}\tupdated={entry.updated_at}\thistory_estimate={entry.active_tokens}\t"
366
366
  f"{format_usage_line(entry.usage)}"
367
367
  )
368
368
  return 0
@@ -10,8 +10,9 @@ PowerShell commands and Windows paths, `cmd` uses cmd syntax, and `posix` uses
10
10
  POSIX shell syntax.
11
11
 
12
12
  On Windows PowerShell, Python child processes run with UTF-8 I/O defaults for
13
- the command invocation; do not ask users to run `chcp` or change their
14
- PowerShell profile for Unicode output.
13
+ the command invocation. Deepy also decodes captured output from Windows-native
14
+ commands with UTF-8, UTF-16, and GBK-compatible fallbacks. Do not ask users to
15
+ run `chcp` or change their PowerShell profile for Unicode output.
15
16
 
16
17
  Runs in the session cwd, preserves cwd between calls when supported, and returns
17
18
  stdout/stderr JSON with cwd, exit-code, and shell metadata.
@@ -10,7 +10,7 @@ from deepy.prompts.compact import build_compact_prompt, build_compact_summary_me
10
10
  from deepy.sessions.jsonl import DeepyJsonlSession
11
11
  from deepy.usage import TokenUsage, usage_from_run_result
12
12
 
13
- from .context import estimate_tokens_for_item, estimate_tokens_for_items, should_auto_compact
13
+ from .context import estimate_tokens_for_item, estimate_tokens_for_items
14
14
  from .provider import ProviderBundle, build_provider_bundle
15
15
  from .replay import sanitize_sdk_items_for_replay
16
16
 
@@ -52,7 +52,13 @@ async def compact_session(
52
52
  focus_instruction: str | None = None,
53
53
  ) -> CompactionResult:
54
54
  items = await session.get_items()
55
- before_tokens = session.context_token_state().active_tokens
55
+ before_estimated_tokens = session.context_token_state().active_tokens
56
+ before_context_usage = session.latest_context_window_usage()
57
+ before_tokens = (
58
+ before_context_usage.used_tokens
59
+ if before_context_usage is not None
60
+ else before_estimated_tokens
61
+ )
56
62
  prepared = prepare_compaction_items(
57
63
  items,
58
64
  preserve_recent_messages=settings.context.compact_preserve_recent_messages,
@@ -116,13 +122,14 @@ async def ensure_context_ready(
116
122
  additional_tokens = estimate_tokens_for_item(additional_input or "")
117
123
  state = session.context_token_state()
118
124
  before_tokens = state.active_tokens + additional_tokens
125
+ latest_context_usage = session.latest_context_window_usage()
126
+ trigger_tokens = (
127
+ latest_context_usage.used_tokens
128
+ if latest_context_usage is not None
129
+ else before_tokens
130
+ )
119
131
  compacted: CompactionResult | None = None
120
- if should_auto_compact(
121
- before_tokens,
122
- settings.context.window_tokens,
123
- trigger_ratio=settings.context.compact_trigger_ratio,
124
- reserved_context_size=settings.context.reserved_context_tokens,
125
- ):
132
+ if trigger_tokens >= settings.context.resolved_compact_threshold:
126
133
  compacted = await compact_session(
127
134
  session,
128
135
  settings,
@@ -132,10 +139,19 @@ async def ensure_context_ready(
132
139
 
133
140
  after_state = session.context_token_state()
134
141
  after_tokens = after_state.active_tokens + additional_tokens
135
- if after_tokens + settings.context.reserved_context_tokens >= settings.context.window_tokens:
142
+ if compacted and compacted.compacted:
143
+ fit_tokens = after_tokens
144
+ else:
145
+ after_context_usage = session.latest_context_window_usage()
146
+ fit_tokens = (
147
+ after_context_usage.used_tokens
148
+ if after_context_usage is not None
149
+ else after_tokens
150
+ )
151
+ if fit_tokens + settings.context.reserved_context_tokens >= settings.context.window_tokens:
136
152
  raise ContextCompactionError(
137
153
  "Context exceeds the configured window and could not be compacted enough "
138
- f"({after_tokens:,} tokens + {settings.context.reserved_context_tokens:,} reserved "
154
+ f"({fit_tokens:,} tokens + {settings.context.reserved_context_tokens:,} reserved "
139
155
  f">= {settings.context.window_tokens:,} window)."
140
156
  )
141
157
  return ContextReadiness(