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