klaude-code 1.2.19__py3-none-any.whl → 1.2.21__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/main.py +23 -0
- klaude_code/cli/runtime.py +17 -0
- klaude_code/command/__init__.py +1 -3
- klaude_code/command/clear_cmd.py +5 -4
- klaude_code/command/command_abc.py +5 -40
- klaude_code/command/debug_cmd.py +2 -2
- klaude_code/command/diff_cmd.py +2 -1
- klaude_code/command/export_cmd.py +14 -49
- klaude_code/command/export_online_cmd.py +2 -1
- klaude_code/command/help_cmd.py +2 -1
- klaude_code/command/model_cmd.py +7 -5
- klaude_code/command/prompt-jj-workspace.md +18 -0
- klaude_code/command/prompt_command.py +16 -9
- klaude_code/command/refresh_cmd.py +3 -2
- klaude_code/command/registry.py +31 -6
- klaude_code/command/release_notes_cmd.py +2 -1
- klaude_code/command/status_cmd.py +2 -1
- klaude_code/command/terminal_setup_cmd.py +2 -1
- klaude_code/command/thinking_cmd.py +12 -1
- klaude_code/core/executor.py +177 -190
- klaude_code/core/manager/sub_agent_manager.py +3 -0
- klaude_code/core/prompt.py +4 -1
- klaude_code/core/prompts/prompt-sub-agent-web.md +3 -3
- klaude_code/core/reminders.py +70 -26
- klaude_code/core/task.py +4 -5
- klaude_code/core/tool/__init__.py +2 -0
- klaude_code/core/tool/file/apply_patch_tool.py +3 -1
- klaude_code/core/tool/file/edit_tool.py +7 -5
- klaude_code/core/tool/file/multi_edit_tool.py +7 -5
- klaude_code/core/tool/file/read_tool.py +5 -2
- klaude_code/core/tool/file/write_tool.py +8 -6
- klaude_code/core/tool/shell/bash_tool.py +90 -17
- klaude_code/core/tool/sub_agent_tool.py +5 -1
- klaude_code/core/tool/tool_abc.py +18 -0
- klaude_code/core/tool/tool_context.py +6 -6
- klaude_code/core/tool/tool_runner.py +7 -7
- klaude_code/core/tool/web/mermaid_tool.md +26 -0
- klaude_code/core/tool/web/web_fetch_tool.py +77 -22
- klaude_code/core/tool/web/web_search_tool.py +5 -1
- klaude_code/protocol/model.py +8 -1
- klaude_code/protocol/op.py +47 -0
- klaude_code/protocol/op_handler.py +25 -1
- klaude_code/protocol/sub_agent/web.py +1 -1
- klaude_code/session/codec.py +71 -0
- klaude_code/session/export.py +21 -11
- klaude_code/session/session.py +182 -331
- klaude_code/session/store.py +215 -0
- klaude_code/session/templates/export_session.html +13 -14
- klaude_code/ui/modes/repl/completers.py +1 -2
- klaude_code/ui/modes/repl/event_handler.py +7 -23
- klaude_code/ui/modes/repl/input_prompt_toolkit.py +4 -6
- klaude_code/ui/rich/__init__.py +10 -1
- klaude_code/ui/rich/cjk_wrap.py +228 -0
- klaude_code/ui/rich/status.py +0 -1
- {klaude_code-1.2.19.dist-info → klaude_code-1.2.21.dist-info}/METADATA +2 -1
- {klaude_code-1.2.19.dist-info → klaude_code-1.2.21.dist-info}/RECORD +58 -55
- klaude_code/ui/utils/debouncer.py +0 -42
- {klaude_code-1.2.19.dist-info → klaude_code-1.2.21.dist-info}/WHEEL +0 -0
- {klaude_code-1.2.19.dist-info → klaude_code-1.2.21.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"""Monkey-patch Rich wrapping for better CJK line breaks."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import unicodedata
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _is_cjk_char(ch: str) -> bool:
|
|
10
|
+
return unicodedata.east_asian_width(ch) in ("W", "F")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _contains_cjk(text: str) -> bool:
|
|
14
|
+
return any(_is_cjk_char(ch) for ch in text)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _is_ascii_word_char(ch: str) -> bool:
|
|
18
|
+
o = ord(ch)
|
|
19
|
+
return (48 <= o <= 57) or (65 <= o <= 90) or (97 <= o <= 122) or ch in "_."
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _find_prefix_len_for_remaining(word: str, remaining_space: int) -> int:
|
|
23
|
+
"""Find a prefix length (in chars) that fits remaining_space.
|
|
24
|
+
|
|
25
|
+
This prefers breakpoints that don't split ASCII word-like runs.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
if remaining_space <= 0:
|
|
29
|
+
return 0
|
|
30
|
+
|
|
31
|
+
# Local import keeps import-time overhead low.
|
|
32
|
+
from rich.cells import get_character_cell_size
|
|
33
|
+
|
|
34
|
+
total = 0
|
|
35
|
+
best = 0
|
|
36
|
+
n = len(word)
|
|
37
|
+
|
|
38
|
+
for i, ch in enumerate(word):
|
|
39
|
+
total += get_character_cell_size(ch)
|
|
40
|
+
if total > remaining_space:
|
|
41
|
+
break
|
|
42
|
+
|
|
43
|
+
boundary = i + 1
|
|
44
|
+
if boundary >= n:
|
|
45
|
+
best = boundary
|
|
46
|
+
break
|
|
47
|
+
|
|
48
|
+
# Avoid leaving a path separator at the start of the next line.
|
|
49
|
+
if word[boundary] in "/":
|
|
50
|
+
continue
|
|
51
|
+
|
|
52
|
+
# Disallow breaks inside ASCII word runs: ...a|b...
|
|
53
|
+
if _is_ascii_word_char(word[boundary - 1]) and _is_ascii_word_char(word[boundary]):
|
|
54
|
+
continue
|
|
55
|
+
|
|
56
|
+
best = boundary
|
|
57
|
+
|
|
58
|
+
return best
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
_rich_cjk_wrap_patch_installed = False
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def install_rich_cjk_wrap_patch() -> bool:
|
|
65
|
+
"""Install a monkey-patch that improves CJK line wrapping in Rich.
|
|
66
|
+
|
|
67
|
+
Rich wraps text by tokenizing on whitespace, which causes long CJK runs to be
|
|
68
|
+
treated as a single "word" and moved to the next line wholesale.
|
|
69
|
+
|
|
70
|
+
This patch keeps ASCII word wrapping behaviour intact, but allows breaking
|
|
71
|
+
CJK-containing tokens at the end of a line to fill remaining space.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
True if the patch was installed in this process.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
global _rich_cjk_wrap_patch_installed
|
|
78
|
+
if _rich_cjk_wrap_patch_installed:
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
import rich._wrap as _wrap
|
|
82
|
+
import rich.text as _text
|
|
83
|
+
from rich._loop import loop_last
|
|
84
|
+
from rich.cells import cell_len, chop_cells
|
|
85
|
+
|
|
86
|
+
_OPEN_TO_CLOSE = {
|
|
87
|
+
"(": ")",
|
|
88
|
+
"(": ")",
|
|
89
|
+
"[": "]",
|
|
90
|
+
"{": "}",
|
|
91
|
+
"“": "”",
|
|
92
|
+
"‘": "’",
|
|
93
|
+
"《": "》",
|
|
94
|
+
"〈": "〉",
|
|
95
|
+
"「": "」",
|
|
96
|
+
"『": "』",
|
|
97
|
+
"【": "】",
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
def _leading_unclosed_delim(word: str) -> str | None:
|
|
101
|
+
stripped = word.lstrip()
|
|
102
|
+
if not stripped:
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
close_delim = _OPEN_TO_CLOSE.get(stripped[0])
|
|
106
|
+
if close_delim is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
if close_delim in stripped:
|
|
110
|
+
return None
|
|
111
|
+
|
|
112
|
+
return close_delim
|
|
113
|
+
|
|
114
|
+
def _close_delim_appears_soon(
|
|
115
|
+
word_tokens: list[str],
|
|
116
|
+
*,
|
|
117
|
+
start_index: int,
|
|
118
|
+
close_delim: str,
|
|
119
|
+
max_chars: int = 32,
|
|
120
|
+
max_tokens: int = 4,
|
|
121
|
+
) -> bool:
|
|
122
|
+
consumed = 0
|
|
123
|
+
for token in word_tokens[start_index + 1 : start_index + 1 + max_tokens]:
|
|
124
|
+
if not token:
|
|
125
|
+
continue
|
|
126
|
+
|
|
127
|
+
close_pos = token.find(close_delim)
|
|
128
|
+
if close_pos != -1 and (consumed + close_pos) < max_chars:
|
|
129
|
+
return True
|
|
130
|
+
|
|
131
|
+
consumed += len(token)
|
|
132
|
+
if consumed >= max_chars:
|
|
133
|
+
return False
|
|
134
|
+
|
|
135
|
+
return False
|
|
136
|
+
|
|
137
|
+
def divide_line_patched(text: str, width: int, fold: bool = True) -> list[int]:
|
|
138
|
+
break_positions: list[int] = []
|
|
139
|
+
|
|
140
|
+
def append(pos: int) -> None:
|
|
141
|
+
if pos and (not break_positions or break_positions[-1] != pos):
|
|
142
|
+
break_positions.append(pos)
|
|
143
|
+
|
|
144
|
+
cell_offset = 0
|
|
145
|
+
_cell_len: Callable[[str], int] = cell_len
|
|
146
|
+
|
|
147
|
+
words = list(_wrap.words(text))
|
|
148
|
+
word_tokens = [w for _s, _e, w in words]
|
|
149
|
+
|
|
150
|
+
for index, (start, _end, word) in enumerate(words):
|
|
151
|
+
next_word: str | None = None
|
|
152
|
+
if index + 1 < len(words):
|
|
153
|
+
next_word = words[index + 1][2]
|
|
154
|
+
|
|
155
|
+
# Heuristic: avoid leaving an unclosed opening delimiter fragment (e.g. "(Deep ")
|
|
156
|
+
# at the end of a line when the next token will wrap.
|
|
157
|
+
word_length = _cell_len(word.rstrip())
|
|
158
|
+
remaining_space = width - cell_offset
|
|
159
|
+
if remaining_space >= word_length and cell_offset and start and next_word is not None:
|
|
160
|
+
cell_offset_with_trailing = cell_offset + _cell_len(word)
|
|
161
|
+
next_length = _cell_len(next_word.rstrip())
|
|
162
|
+
next_will_wrap = next_length > width or (width - cell_offset_with_trailing) < next_length
|
|
163
|
+
|
|
164
|
+
close_delim = _leading_unclosed_delim(word)
|
|
165
|
+
if close_delim is not None and next_will_wrap:
|
|
166
|
+
stripped = word.strip()
|
|
167
|
+
if _cell_len(stripped) <= 16 and _close_delim_appears_soon(
|
|
168
|
+
word_tokens, start_index=index, close_delim=close_delim
|
|
169
|
+
):
|
|
170
|
+
append(start)
|
|
171
|
+
cell_offset = _cell_len(word)
|
|
172
|
+
continue
|
|
173
|
+
|
|
174
|
+
while True:
|
|
175
|
+
word_length = _cell_len(word.rstrip())
|
|
176
|
+
remaining_space = width - cell_offset
|
|
177
|
+
|
|
178
|
+
if remaining_space >= word_length:
|
|
179
|
+
cell_offset += _cell_len(word)
|
|
180
|
+
break
|
|
181
|
+
|
|
182
|
+
# Prefer splitting CJK-containing tokens to fill remaining space.
|
|
183
|
+
if fold and cell_offset and start and remaining_space > 0 and _contains_cjk(word):
|
|
184
|
+
prefix_len = _find_prefix_len_for_remaining(word, remaining_space)
|
|
185
|
+
if prefix_len:
|
|
186
|
+
break_at = start + prefix_len
|
|
187
|
+
append(break_at)
|
|
188
|
+
word = word[prefix_len:]
|
|
189
|
+
start = break_at
|
|
190
|
+
|
|
191
|
+
# If the remainder fits on the next (empty) line, keep Rich's
|
|
192
|
+
# existing behaviour and move on.
|
|
193
|
+
if _cell_len(word.rstrip()) <= width:
|
|
194
|
+
cell_offset = _cell_len(word)
|
|
195
|
+
break
|
|
196
|
+
|
|
197
|
+
# Otherwise, continue folding the remainder starting on a new line.
|
|
198
|
+
cell_offset = 0
|
|
199
|
+
continue
|
|
200
|
+
|
|
201
|
+
# Fall back to Rich's original logic.
|
|
202
|
+
if word_length > width:
|
|
203
|
+
if fold:
|
|
204
|
+
folded_word = chop_cells(word, width=width)
|
|
205
|
+
for last, line in loop_last(folded_word):
|
|
206
|
+
if start:
|
|
207
|
+
append(start)
|
|
208
|
+
if last:
|
|
209
|
+
cell_offset = _cell_len(line)
|
|
210
|
+
else:
|
|
211
|
+
start += len(line)
|
|
212
|
+
else:
|
|
213
|
+
if start:
|
|
214
|
+
append(start)
|
|
215
|
+
cell_offset = _cell_len(word)
|
|
216
|
+
break
|
|
217
|
+
|
|
218
|
+
if cell_offset and start:
|
|
219
|
+
append(start)
|
|
220
|
+
cell_offset = _cell_len(word)
|
|
221
|
+
break
|
|
222
|
+
|
|
223
|
+
return break_positions
|
|
224
|
+
|
|
225
|
+
_wrap.divide_line = divide_line_patched # pyright: ignore[reportPrivateImportUsage]
|
|
226
|
+
_text.divide_line = divide_line_patched # pyright: ignore[reportPrivateImportUsage]
|
|
227
|
+
_rich_cjk_wrap_patch_installed = True
|
|
228
|
+
return True
|
klaude_code/ui/rich/status.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: klaude-code
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.21
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Dist: anthropic>=0.66.0
|
|
6
|
+
Requires-Dist: chardet>=5.2.0
|
|
6
7
|
Requires-Dist: ddgs>=9.9.3
|
|
7
8
|
Requires-Dist: openai>=1.102.0
|
|
8
9
|
Requires-Dist: pillow>=12.0.0
|
|
@@ -10,43 +10,44 @@ klaude_code/cli/auth_cmd.py,sha256=UWMHjn9xZp2o8OZc-x8y9MnkZgRWOkFXk05iKJYcySE,2
|
|
|
10
10
|
klaude_code/cli/config_cmd.py,sha256=SBFmBnHvkf5IJtpsDDuHsHWQCmYd2i4PtIMBOKpxmOM,2894
|
|
11
11
|
klaude_code/cli/debug.py,sha256=vohQVqy6fB59p4NYoiQb8BiLcl5YiGvugDXc2hYGFTc,2417
|
|
12
12
|
klaude_code/cli/list_model.py,sha256=9YOxhWE0J59NaY-SrgPA9_jA1A8rlOGwWmzK0TRuos4,8011
|
|
13
|
-
klaude_code/cli/main.py,sha256=
|
|
14
|
-
klaude_code/cli/runtime.py,sha256=
|
|
13
|
+
klaude_code/cli/main.py,sha256=pyU2W2X3lg7Z-4adiOzA9_2l-5QSejYm68HrhAiu470,10469
|
|
14
|
+
klaude_code/cli/runtime.py,sha256=0qYbtTP41m0K8eA2de_VFuERTV1NHn265O1-BMcdrw0,14238
|
|
15
15
|
klaude_code/cli/self_update.py,sha256=fekLNRm3ivZ-Xbc-79rcgDBXbq-Zb-BkSQOGMRLeTAs,7986
|
|
16
16
|
klaude_code/cli/session_cmd.py,sha256=jAopkqq_DGgoDIcGxT-RSzn9R4yqBC8NCaNgK1GLqnQ,2634
|
|
17
|
-
klaude_code/command/__init__.py,sha256=
|
|
18
|
-
klaude_code/command/clear_cmd.py,sha256=
|
|
19
|
-
klaude_code/command/command_abc.py,sha256=
|
|
20
|
-
klaude_code/command/debug_cmd.py,sha256=
|
|
21
|
-
klaude_code/command/diff_cmd.py,sha256=
|
|
22
|
-
klaude_code/command/export_cmd.py,sha256=
|
|
23
|
-
klaude_code/command/export_online_cmd.py,sha256=
|
|
24
|
-
klaude_code/command/help_cmd.py,sha256=
|
|
25
|
-
klaude_code/command/model_cmd.py,sha256=
|
|
17
|
+
klaude_code/command/__init__.py,sha256=FBsAJAxQRR9zy-0GEfVsa52dk3CGmJh6-L4cjZ9sfag,3218
|
|
18
|
+
klaude_code/command/clear_cmd.py,sha256=DzCg6vQ5Eve7Rx4HdL-uta1pBDRQinOW6nwx5YlOA24,658
|
|
19
|
+
klaude_code/command/command_abc.py,sha256=wUGE8NkCWWKy8lZXcW-UcQyMGnVikxTrCIycLlPU5dY,2350
|
|
20
|
+
klaude_code/command/debug_cmd.py,sha256=9sBIAwHz28QoI-tHsU3ksQlDObF1ilIbtAAEAVMR0v0,2734
|
|
21
|
+
klaude_code/command/diff_cmd.py,sha256=T_Oyo7rHZM5_qKGA0DjSHNZlzAHOhUwJS3Oqvur3Hho,5218
|
|
22
|
+
klaude_code/command/export_cmd.py,sha256=Cs7YXWtos-ZfN9OEppIl8Xrb017kDG7R6hGiilqt2bM,1623
|
|
23
|
+
klaude_code/command/export_online_cmd.py,sha256=kOVmFEW7gEEFvaKnXL8suNenktLyTW-13bT64NBGwUQ,5861
|
|
24
|
+
klaude_code/command/help_cmd.py,sha256=yQJnVtj6sgXQdGsi4u9aS7EcjJLSrXccUA-v_bqmsRw,1633
|
|
25
|
+
klaude_code/command/model_cmd.py,sha256=GmDln1N6u7eWLK15tm_lcdDJBY8qI0ih48h6AhijafI,1665
|
|
26
26
|
klaude_code/command/prompt-deslop.md,sha256=YGaAXqem39zd0UWCFjWUj83Cf7cvUJq1768aJExFqeg,1346
|
|
27
27
|
klaude_code/command/prompt-dev-docs-update.md,sha256=g1IWIWIa-3qlNOw5mBA4N9H1_nvYcw8AKo7XoQw_AZQ,1855
|
|
28
28
|
klaude_code/command/prompt-dev-docs.md,sha256=PU9iT6XdUEH6grfSjHVma7xKOQcA__ZTKlEDkbbO0hA,1783
|
|
29
29
|
klaude_code/command/prompt-handoff.md,sha256=RXIeXNwOpSpkwAyNFSvQFoo077TVkbj11fqQ2r8aCh4,1638
|
|
30
30
|
klaude_code/command/prompt-init.md,sha256=a4_FQ3gKizqs2vl9oEY5jtG6HNhv3f-1b5RSCFq0A18,1873
|
|
31
|
-
klaude_code/command/
|
|
32
|
-
klaude_code/command/
|
|
33
|
-
klaude_code/command/
|
|
34
|
-
klaude_code/command/
|
|
35
|
-
klaude_code/command/
|
|
36
|
-
klaude_code/command/
|
|
37
|
-
klaude_code/command/
|
|
31
|
+
klaude_code/command/prompt-jj-workspace.md,sha256=BtSH3atgvE0j7n3j2EnSS6vuPUJDhEnUHDFZ5qq93QE,919
|
|
32
|
+
klaude_code/command/prompt_command.py,sha256=rMi-ZRLpUSt1t0IQVtwnzIYqcrXK-MwZrabbZ8dc8U4,2774
|
|
33
|
+
klaude_code/command/refresh_cmd.py,sha256=575eJ5IsOc1e_7CulMxvTu5GQ6BaXTG1k8IsAqzrwdQ,1244
|
|
34
|
+
klaude_code/command/registry.py,sha256=avTjsoyLv11SsLsY_qb3OpsRjsSyxIlu7uwJI0Nq6HE,6176
|
|
35
|
+
klaude_code/command/release_notes_cmd.py,sha256=FIrBRfKTlXEp8mBh15buNjgOrl_GMX7FeeMWxYYBn1o,2674
|
|
36
|
+
klaude_code/command/status_cmd.py,sha256=MnHtNdXTMqCJfB4_seHXDJEHYo99D-4ITZcGDCX2ilA,5359
|
|
37
|
+
klaude_code/command/terminal_setup_cmd.py,sha256=SivM1gX_anGY_8DCQNFZ5VblFqt4sVgCMEWPRlo6K5w,10911
|
|
38
|
+
klaude_code/command/thinking_cmd.py,sha256=XDyq0q8eb3Os4FyWjr-moiKjmzGIaNhOC9h89y1AZ84,8854
|
|
38
39
|
klaude_code/config/__init__.py,sha256=Qrqvi8nizkj6N77h2vDj0r4rbgCiqxvz2HLBPFuWulA,120
|
|
39
40
|
klaude_code/config/config.py,sha256=2jvM6a8zoC-TdRFaLIw3OW5paxxeXC6l-o05ds4RysA,7263
|
|
40
41
|
klaude_code/config/select_model.py,sha256=KCdFjaoHXyO9QidNna_OGdDrvlEXtRUXKfG-F8kdNLk,5188
|
|
41
42
|
klaude_code/const/__init__.py,sha256=MWm6fppZfAd8EGPdQgdEvRzrMRJ1Ei6Ma11eoNg4es0,4256
|
|
42
43
|
klaude_code/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
44
|
klaude_code/core/agent.py,sha256=bWm-UFX_0-KAy5j_YHH8X8o3MJT4-40Ni2EaDP2SL5k,5819
|
|
44
|
-
klaude_code/core/executor.py,sha256=
|
|
45
|
+
klaude_code/core/executor.py,sha256=HmKtj0ZremRcLCGHkPckR_k0FSZh6FZ52-LMRSMZK9c,24882
|
|
45
46
|
klaude_code/core/manager/__init__.py,sha256=hdIbpnYj6i18byiWjtJIm5l7NYYDQMvafw8fePVPydc,562
|
|
46
47
|
klaude_code/core/manager/llm_clients.py,sha256=X2oMFWgJcP0tK8GEtMMDYR3HyR6_H8FuyCqpzWF5x2k,871
|
|
47
48
|
klaude_code/core/manager/llm_clients_builder.py,sha256=pPZ_xBh-_ipV66L-9a1fnwNos4iik82Zkq0E0y3WrfI,1521
|
|
48
|
-
klaude_code/core/manager/sub_agent_manager.py,sha256=
|
|
49
|
-
klaude_code/core/prompt.py,sha256=
|
|
49
|
+
klaude_code/core/manager/sub_agent_manager.py,sha256=GC54N5xErSa-ATLNQphnfZfKlt089uwuvYY9rTeh8Uk,4866
|
|
50
|
+
klaude_code/core/prompt.py,sha256=c4tDx7WjESgMcPBEUso50BYz_4El5VDjWfw2v2sqst4,3728
|
|
50
51
|
klaude_code/core/prompts/prompt-claude-code.md,sha256=uuWBv6GrG63mdmBedAHT5U9yOpbHSKFYbbS2xBnUzOE,8290
|
|
51
52
|
klaude_code/core/prompts/prompt-codex-gpt-5-1-codex-max.md,sha256=SW-y8AmR99JL_9j26k9YVAOQuZ18vR12aT5CWHkZDc4,11741
|
|
52
53
|
klaude_code/core/prompts/prompt-codex-gpt-5-1.md,sha256=jNi593_4L3EoMvjS0TwltF2b684gtDBsYHa9npxO34A,24239
|
|
@@ -54,24 +55,24 @@ klaude_code/core/prompts/prompt-gemini.md,sha256=JjE1tHSByGKJzjn4Gpj1zekT7ry1Yqb
|
|
|
54
55
|
klaude_code/core/prompts/prompt-minimal.md,sha256=6-ZmQQkE3f92W_3V2wS7ocB13wLog1_UojCjZG0K4v8,1559
|
|
55
56
|
klaude_code/core/prompts/prompt-sub-agent-explore.md,sha256=21kFodjhvN0L-c_ZFo4yVhJOyzfgES-Dty9Vz_Ew9q8,2629
|
|
56
57
|
klaude_code/core/prompts/prompt-sub-agent-oracle.md,sha256=1PLI3snvxnenCOPVrL0IxZnBl5b2xxGhlufHAyLyf60,1376
|
|
57
|
-
klaude_code/core/prompts/prompt-sub-agent-web.md,sha256=
|
|
58
|
+
klaude_code/core/prompts/prompt-sub-agent-web.md,sha256=ewS7-h8_u4QZftFpqrZWpht9Ap08s7zF9D4k4md8oD8,2360
|
|
58
59
|
klaude_code/core/prompts/prompt-sub-agent.md,sha256=dmmdsOenbAOfqG6FmdR88spOLZkXmntDBs-cmZ9DN_g,897
|
|
59
|
-
klaude_code/core/reminders.py,sha256=
|
|
60
|
-
klaude_code/core/task.py,sha256=
|
|
61
|
-
klaude_code/core/tool/__init__.py,sha256=
|
|
60
|
+
klaude_code/core/reminders.py,sha256=d7q4tba_oso2QOJwIeDG_buueSUYotka4RJdjnQidCk,20407
|
|
61
|
+
klaude_code/core/task.py,sha256=_wvxo1YrfhhNI0BCsaA2JG-mAj3myd82vkn7ulENfgQ,10460
|
|
62
|
+
klaude_code/core/tool/__init__.py,sha256=NzAaNEk_kJgcARm0YWBkOkrNqeaDFPpqHEsw9MoyCaI,2194
|
|
62
63
|
klaude_code/core/tool/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
64
|
klaude_code/core/tool/file/_utils.py,sha256=LLmdEOJnC7MgdiAlWtBPZR0h23oM9wD_UsKqU1Nfkbs,774
|
|
64
65
|
klaude_code/core/tool/file/apply_patch.py,sha256=LZd3pYQ9ow_TxiFnqYuzD216HmvkLX6lW6BoMd9iQRs,17080
|
|
65
66
|
klaude_code/core/tool/file/apply_patch_tool.md,sha256=KVDsjUiLDa97gym0NrZNVG4jA1_zN-2i-B3upVQyOhU,59
|
|
66
|
-
klaude_code/core/tool/file/apply_patch_tool.py,sha256=
|
|
67
|
+
klaude_code/core/tool/file/apply_patch_tool.py,sha256=7NDFdTKBz1wpYURyjGDU_z38wboz5hsKgcZBgy1b4BE,8345
|
|
67
68
|
klaude_code/core/tool/file/edit_tool.md,sha256=rEcUjJuPC46t1nXWjTDxplDcxWDbzTWsr6_bYt5_aRI,1110
|
|
68
|
-
klaude_code/core/tool/file/edit_tool.py,sha256=
|
|
69
|
+
klaude_code/core/tool/file/edit_tool.py,sha256=afRA6ujeAFOdt8ub3iq1nkO71K_vyEyFkjzf8CKLMeI,10010
|
|
69
70
|
klaude_code/core/tool/file/multi_edit_tool.md,sha256=4G39b-jGdJdGGbBTj7R6tcUfcui9tXn6CLQ5uaX5y1M,2485
|
|
70
|
-
klaude_code/core/tool/file/multi_edit_tool.py,sha256=
|
|
71
|
+
klaude_code/core/tool/file/multi_edit_tool.py,sha256=OHLBzsPGj-7Kd0BWscbWmbCKpjkOeOAZ0iENieWT6L8,7090
|
|
71
72
|
klaude_code/core/tool/file/read_tool.md,sha256=74SLSl1tq3L0por73M0QV_ws41MRIvGXQpfLb8dmtp0,1351
|
|
72
|
-
klaude_code/core/tool/file/read_tool.py,sha256=
|
|
73
|
+
klaude_code/core/tool/file/read_tool.py,sha256=Hz0belgVrPPzo5L2DBEquEJ4U4kxtoPG_SyL-oQVboE,14348
|
|
73
74
|
klaude_code/core/tool/file/write_tool.md,sha256=CNnYgtieUasuHdpXLDpTEsqe492Pf7v75M4RQ3oIer8,613
|
|
74
|
-
klaude_code/core/tool/file/write_tool.py,sha256=
|
|
75
|
+
klaude_code/core/tool/file/write_tool.py,sha256=wSMx_cRwnPKq8wYq9dO_WsYBcEaN1s3B1bBZoY7fNJs,4531
|
|
75
76
|
klaude_code/core/tool/memory/__init__.py,sha256=oeBpjUXcAilCtYXhiXDzavw5-BE_pbB2ZxsFJKTTcdc,143
|
|
76
77
|
klaude_code/core/tool/memory/memory_tool.md,sha256=qWytU7k0kQQbne_8n4cei2-dDTNpHesmbI2PYza3XR0,1299
|
|
77
78
|
klaude_code/core/tool/memory/memory_tool.py,sha256=xasFf1IQp1LFaL4ctDIQt5jfrd_z62ZsBeE42QIKAKs,18949
|
|
@@ -81,27 +82,27 @@ klaude_code/core/tool/memory/skill_tool.py,sha256=8SC4asNZSKfExuhzbyGz4f2cr78PgC
|
|
|
81
82
|
klaude_code/core/tool/report_back_tool.py,sha256=KRZzQAIxniwXe58SDJcfK_DCf9TFFAx8XC75wPEjmpY,3246
|
|
82
83
|
klaude_code/core/tool/shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
84
|
klaude_code/core/tool/shell/bash_tool.md,sha256=ILKpnRCBTkU2uSDEdZQjNYo1l6hsM4TO-3RD5zWC61c,3935
|
|
84
|
-
klaude_code/core/tool/shell/bash_tool.py,sha256=
|
|
85
|
+
klaude_code/core/tool/shell/bash_tool.py,sha256=xgEEcZ5mV-Qyw2zwAdS7ULaJEKCNjJ_uAT0-uBQRvSE,8379
|
|
85
86
|
klaude_code/core/tool/shell/command_safety.py,sha256=bGsooLovuzq8WmLcZ2v24AVBDj3bZv2p4GSL0IlixvM,13192
|
|
86
|
-
klaude_code/core/tool/sub_agent_tool.py,sha256=
|
|
87
|
+
klaude_code/core/tool/sub_agent_tool.py,sha256=5n0HDxv4cUzuwBhYiAe3gIJ0s3QgV4GSV12CIIkD_g0,3190
|
|
87
88
|
klaude_code/core/tool/todo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
89
|
klaude_code/core/tool/todo/todo_write_tool.md,sha256=BFP9qIkzkakzskHwIOPVtDhehkh0F90A5oosyDuC_BE,1682
|
|
89
90
|
klaude_code/core/tool/todo/todo_write_tool.py,sha256=XgSo8F1aJn_0fkh9Gx-5DHNFNlbZys1bUjwhe6NwyLU,4506
|
|
90
91
|
klaude_code/core/tool/todo/todo_write_tool_raw.md,sha256=AJ2OkZGcccQYDXkydPAr5JI2SExBF8qJd0rXsHySLps,9711
|
|
91
92
|
klaude_code/core/tool/todo/update_plan_tool.md,sha256=OoEF4voHHd5J3VDv7tq3UCHdXApkBvxdHXUf5tVOkE8,157
|
|
92
93
|
klaude_code/core/tool/todo/update_plan_tool.py,sha256=5MmmApG0wObBgc-mLETjIMupxIv-SZ7Q0uJO2Krtl1k,3794
|
|
93
|
-
klaude_code/core/tool/tool_abc.py,sha256=
|
|
94
|
-
klaude_code/core/tool/tool_context.py,sha256=
|
|
94
|
+
klaude_code/core/tool/tool_abc.py,sha256=CROXR16__l-IumQsoa00O9-MlG7cpbl5JU4UrjouZhI,1179
|
|
95
|
+
klaude_code/core/tool/tool_context.py,sha256=k3toeAVtm8_-EVfD-2Kw0atx7EyN3c5AL1DIc8TlF6s,4149
|
|
95
96
|
klaude_code/core/tool/tool_registry.py,sha256=VFB0Z4BWtYKIWtpZVGhjSLcgfK244gow_UYZn1IcJQY,2642
|
|
96
|
-
klaude_code/core/tool/tool_runner.py,sha256=
|
|
97
|
+
klaude_code/core/tool/tool_runner.py,sha256=A_RviRFr8kF6TjdGOzdgCIingeyJLBxNbZpcTnzT64E,10695
|
|
97
98
|
klaude_code/core/tool/truncation.py,sha256=YPKzelOM45rHW_OkcfX5_Ojg_pPi8yDZu7lSnwl9b_k,7334
|
|
98
99
|
klaude_code/core/tool/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
99
|
-
klaude_code/core/tool/web/mermaid_tool.md,sha256=
|
|
100
|
+
klaude_code/core/tool/web/mermaid_tool.md,sha256=gyNkf1rSra-_4EyDFJOyoLBg8CoADVkEcWEuJFFz2VM,1564
|
|
100
101
|
klaude_code/core/tool/web/mermaid_tool.py,sha256=Ok0A27oHLnV1c__74bheUuy3wpqDJ1zaXUSxuuqsNPI,2630
|
|
101
102
|
klaude_code/core/tool/web/web_fetch_tool.md,sha256=jIrW-EAmfl50bBevcfioQ3Vrg8kWlHSut8ze_sRgRGw,486
|
|
102
|
-
klaude_code/core/tool/web/web_fetch_tool.py,sha256=
|
|
103
|
+
klaude_code/core/tool/web/web_fetch_tool.py,sha256=7WzOsAHdfijROOlk3JixtHUV1D2Cuwnf-AhoznrqATw,8551
|
|
103
104
|
klaude_code/core/tool/web/web_search_tool.md,sha256=l5gGPx-fXHFel1zLBljm8isy9pwEYXGrq5cFzzw1VBw,1135
|
|
104
|
-
klaude_code/core/tool/web/web_search_tool.py,sha256=
|
|
105
|
+
klaude_code/core/tool/web/web_search_tool.py,sha256=9-dzzMXOdTA_QsdnwHw251R0VelOltlneovV73E4mLE,4028
|
|
105
106
|
klaude_code/core/turn.py,sha256=PvtVV5GLAvYYAsl3RJNDnIvX1Yp4Va8whr0TR8x-9PI,12706
|
|
106
107
|
klaude_code/llm/__init__.py,sha256=b4AsqnrMIs0a5qR_ti6rZcHwFzAReTwOW96EqozEoSo,287
|
|
107
108
|
klaude_code/llm/anthropic/__init__.py,sha256=PWETvaeNAAX3ue0ww1uRUIxTJG0RpWiutkn7MlwKxBs,67
|
|
@@ -129,20 +130,22 @@ klaude_code/protocol/__init__.py,sha256=aGUgzhYqvhuT3Mk2vj7lrHGriH4h9TSbqV1RsRFA
|
|
|
129
130
|
klaude_code/protocol/commands.py,sha256=z9Ckp_YGC403axcqIkB-xTUM-gtlTtd-1lNx83AQriE,662
|
|
130
131
|
klaude_code/protocol/events.py,sha256=KUMf1rLNdHQO9cZiQ9Pa1VsKkP1PTMbUkp18bu_jGy8,3935
|
|
131
132
|
klaude_code/protocol/llm_param.py,sha256=cb4ubLq21PIsMOC8WJb0aid12z_sT1b7FsbNJMr-jLg,4255
|
|
132
|
-
klaude_code/protocol/model.py,sha256=
|
|
133
|
-
klaude_code/protocol/op.py,sha256=
|
|
134
|
-
klaude_code/protocol/op_handler.py,sha256=
|
|
133
|
+
klaude_code/protocol/model.py,sha256=rKgsj0ePPjL1Icdw0AeJ2h_EEeHpPhmUQvYx7gn0YI0,12800
|
|
134
|
+
klaude_code/protocol/op.py,sha256=X3UeXxBOLf_jkEaYXhQSTpjtUV2u1Ot5f4bbPWNdQp4,4241
|
|
135
|
+
klaude_code/protocol/op_handler.py,sha256=qaWrm2rlskSyF7ukPtxFAKf8brgLsUaVzg6035N-7w0,1565
|
|
135
136
|
klaude_code/protocol/sub_agent/__init__.py,sha256=Abap5lPLgnSCQsVD3axfeqnj2UtxOcDLGX8e9HugfSU,3964
|
|
136
137
|
klaude_code/protocol/sub_agent/explore.py,sha256=Z4M7i98XBLew38ClXiW-hJteSYjMUu2b548rkR7JW3A,2579
|
|
137
138
|
klaude_code/protocol/sub_agent/oracle.py,sha256=0cbuutKQcvwaM--Q15mbkCdbpZMF4YjxDN1jkuGVKp4,3344
|
|
138
139
|
klaude_code/protocol/sub_agent/task.py,sha256=fvj4i1vfWXivStQ-9urDS40wTWkmNRvl6D-A0exExJg,3608
|
|
139
|
-
klaude_code/protocol/sub_agent/web.py,sha256=
|
|
140
|
+
klaude_code/protocol/sub_agent/web.py,sha256=Z5vUM367kz8CIexN6UVPG4XxzVOaaRek-Ga64NvcZdk,3043
|
|
140
141
|
klaude_code/protocol/tools.py,sha256=QvFtVAGkA5elef3HWnSs7FcxcI0FOn4N_toCLT-S6Rw,401
|
|
141
142
|
klaude_code/session/__init__.py,sha256=oXcDA5w-gJCbzmlF8yuWy3ezIW9DgFBNUs-gJHUJ-Rc,121
|
|
142
|
-
klaude_code/session/
|
|
143
|
+
klaude_code/session/codec.py,sha256=ummbqT7t6uHHXtaS9lOkyhi1h0YpMk7SNSms8DyGAHU,2015
|
|
144
|
+
klaude_code/session/export.py,sha256=NmIG2SI1ec6HpXglb3zI2xeN8A80rMlPWP_zJGw4uFs,27147
|
|
143
145
|
klaude_code/session/selector.py,sha256=gijwWQkSV20XYP3Fxr27mFXuqP4ChY2DQm_YuBOTQKw,2888
|
|
144
|
-
klaude_code/session/session.py,sha256=
|
|
145
|
-
klaude_code/session/
|
|
146
|
+
klaude_code/session/session.py,sha256=LDrRlxv35_jJGwxv6Lv_WdBYNY2UZZAZ4vippq8pN_o,16016
|
|
147
|
+
klaude_code/session/store.py,sha256=MLNTE-HiwmE3foM7n3AUtPvsf_hdyMHYA66ludTR8KU,6872
|
|
148
|
+
klaude_code/session/templates/export_session.html,sha256=VM3uSEIEKU4ewBeaTS-iO3iBswbyiEGfC9KuikGpka4,119113
|
|
146
149
|
klaude_code/trace/__init__.py,sha256=q8uOYhWr2_Mia1aEK_vkqx91YAfFM25ItIB6J8n3_pM,352
|
|
147
150
|
klaude_code/trace/log.py,sha256=0H_RqkytSpt6AAIFDg-MV_8vA9zsR9BB1UqT6moTTTg,9134
|
|
148
151
|
klaude_code/ui/__init__.py,sha256=XuEQsFUkJet8HI04cRmNLwnHOUqaPCRy4hF7PJnIfCY,2737
|
|
@@ -157,10 +160,10 @@ klaude_code/ui/modes/exec/__init__.py,sha256=RsYa-DmDJj6g7iXb4H9mm2_Cu-KDQOD10RJ
|
|
|
157
160
|
klaude_code/ui/modes/exec/display.py,sha256=m2kkgaUoGD9rEVUmcm7Vs_PyAI2iruKCJYRhANjSsKo,1965
|
|
158
161
|
klaude_code/ui/modes/repl/__init__.py,sha256=35a6SUiL1SDi2i43X2VjHQw97rR7yhbLBzkGI5aC6Bc,1526
|
|
159
162
|
klaude_code/ui/modes/repl/clipboard.py,sha256=ZCpk7kRSXGhh0Q_BWtUUuSYT7ZOqRjAoRcg9T9n48Wo,5137
|
|
160
|
-
klaude_code/ui/modes/repl/completers.py,sha256=
|
|
163
|
+
klaude_code/ui/modes/repl/completers.py,sha256=z5hDKUZCxtRLKWHtirQqBjTibRFLHPqTCBo7O0YlLLs,24721
|
|
161
164
|
klaude_code/ui/modes/repl/display.py,sha256=0u4ISeOoYjynF7InYyV-PMOZqP44QBbjYOLOL18V0c0,2245
|
|
162
|
-
klaude_code/ui/modes/repl/event_handler.py,sha256=
|
|
163
|
-
klaude_code/ui/modes/repl/input_prompt_toolkit.py,sha256=
|
|
165
|
+
klaude_code/ui/modes/repl/event_handler.py,sha256=gsdSHD_53AnR5UXrwDrMrknVI9Bcrxaq9C8gNjTQpmY,23065
|
|
166
|
+
klaude_code/ui/modes/repl/input_prompt_toolkit.py,sha256=uF88c9OpJpf2KAxowX04ieOm58qIg5lQigc1GNnozX0,6298
|
|
164
167
|
klaude_code/ui/modes/repl/key_bindings.py,sha256=Fxz9Ey2SnOHvfleMeSYVduxuofY0Yo-97hMRs-OMe-o,7800
|
|
165
168
|
klaude_code/ui/modes/repl/renderer.py,sha256=YJAF3Cx2fmyrmGOHLVRvUlXvlRR8ptYZtngR50Vg7uY,11639
|
|
166
169
|
klaude_code/ui/renderers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -174,13 +177,14 @@ klaude_code/ui/renderers/sub_agent.py,sha256=grQ_9G_7iYHdCpxrM0qDAKEMQfXcxBv0bI0
|
|
|
174
177
|
klaude_code/ui/renderers/thinking.py,sha256=hUIJzgsjvpK2cM_C2103cG4gz785FUt1PtQsQtgji9s,1764
|
|
175
178
|
klaude_code/ui/renderers/tools.py,sha256=Ch-Ads0Bj4qI3enZ7-A6j7QTY8mp9-tHMO7Eev_82z4,23690
|
|
176
179
|
klaude_code/ui/renderers/user_input.py,sha256=rDdOYvbgJ6oePQAtyTCK-KhARfLKytpTZboZ-cFIuJQ,2603
|
|
177
|
-
klaude_code/ui/rich/__init__.py,sha256=
|
|
180
|
+
klaude_code/ui/rich/__init__.py,sha256=zEZjnHR3Fnv_sFMxwIMjoJfwDoC4GRGv3lHJzAGRq_o,236
|
|
181
|
+
klaude_code/ui/rich/cjk_wrap.py,sha256=ncmifgTwF6q95iayHQyazGbntt7BRQb_Ed7aXc8JU6Y,7551
|
|
178
182
|
klaude_code/ui/rich/code_panel.py,sha256=MdUP4QSaQJQxX0MQJT0pvrkhpGYZx3gWdIRbZT_Uj_I,3938
|
|
179
183
|
klaude_code/ui/rich/live.py,sha256=Uid0QAZG7mHb4KrCF8p9c9n1nHLHzW75xSqcLZ4bLWY,2098
|
|
180
184
|
klaude_code/ui/rich/markdown.py,sha256=cL1irwj4OuEdUvOSUjUopiuf_VMHKd52yXHIsl3JINA,10787
|
|
181
185
|
klaude_code/ui/rich/quote.py,sha256=tZcxN73SfDBHF_qk0Jkh9gWBqPBn8VLp9RF36YRdKEM,1123
|
|
182
186
|
klaude_code/ui/rich/searchable_text.py,sha256=DCVZgEFv7_ergAvT2v7XrfQAUXUzhmAwuVAchlIx8RY,2448
|
|
183
|
-
klaude_code/ui/rich/status.py,sha256=
|
|
187
|
+
klaude_code/ui/rich/status.py,sha256=1sp3ss0ftskIi7xfeGPayMiELTTWJ5CR-oWmaS9Td_U,9735
|
|
184
188
|
klaude_code/ui/rich/theme.py,sha256=5m4xDw436GLVecsnKo94lRo44pPuFPXHV-dcxrdHQAI,10723
|
|
185
189
|
klaude_code/ui/terminal/__init__.py,sha256=GIMnsEcIAGT_vBHvTlWEdyNmAEpruyscUA6M_j3GQZU,1412
|
|
186
190
|
klaude_code/ui/terminal/color.py,sha256=M-i09DVlLAhAyhQjfeAi7OipoGi1p_OVkaZxeRfykY0,7135
|
|
@@ -189,8 +193,7 @@ klaude_code/ui/terminal/notifier.py,sha256=wkRM66d98Oh6PujnN4bB7NiQxIYEHqQXverMK
|
|
|
189
193
|
klaude_code/ui/terminal/progress_bar.py,sha256=MDnhPbqCnN4GDgLOlxxOEVZPDwVC_XL2NM5sl1MFNcQ,2133
|
|
190
194
|
klaude_code/ui/utils/__init__.py,sha256=YEsCLjbCPaPza-UXTPUMTJTrc9BmNBUP5CbFWlshyOQ,15
|
|
191
195
|
klaude_code/ui/utils/common.py,sha256=tqHqwgLtAyP805kwRFyoAL4EgMutcNb3Y-GAXJ4IeuM,2263
|
|
192
|
-
klaude_code/
|
|
193
|
-
klaude_code-1.2.
|
|
194
|
-
klaude_code-1.2.
|
|
195
|
-
klaude_code-1.2.
|
|
196
|
-
klaude_code-1.2.19.dist-info/RECORD,,
|
|
196
|
+
klaude_code-1.2.21.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
197
|
+
klaude_code-1.2.21.dist-info/entry_points.txt,sha256=7CWKjolvs6dZiYHpelhA_FRJ-sVDh43eu3iWuOhKc_w,53
|
|
198
|
+
klaude_code-1.2.21.dist-info/METADATA,sha256=JE_mGv-hmffkbbF50FVxM_aroRwT2JM3Ht01Po8wXAs,7636
|
|
199
|
+
klaude_code-1.2.21.dist-info/RECORD,,
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
from collections.abc import Awaitable, Callable
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class Debouncer:
|
|
6
|
-
"""Debouncing mechanism"""
|
|
7
|
-
|
|
8
|
-
def __init__(self, interval: float, callback: Callable[[], Awaitable[None]]):
|
|
9
|
-
"""
|
|
10
|
-
Initialize debouncer
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
interval: Debounce interval in seconds
|
|
14
|
-
callback: Async callback function to execute after debouncing
|
|
15
|
-
"""
|
|
16
|
-
self.interval = interval
|
|
17
|
-
self.callback = callback
|
|
18
|
-
self._task: asyncio.Task[None] | None = None
|
|
19
|
-
|
|
20
|
-
def cancel(self) -> None:
|
|
21
|
-
"""Cancel current debounce task"""
|
|
22
|
-
if self._task is not None and not self._task.done():
|
|
23
|
-
self._task.cancel()
|
|
24
|
-
self._task = None
|
|
25
|
-
|
|
26
|
-
def schedule(self) -> None:
|
|
27
|
-
"""Schedule debounce task"""
|
|
28
|
-
self.cancel()
|
|
29
|
-
self._task = asyncio.create_task(self._debounced_execute())
|
|
30
|
-
|
|
31
|
-
async def _debounced_execute(self) -> None:
|
|
32
|
-
"""Execute debounced callback function"""
|
|
33
|
-
try:
|
|
34
|
-
await asyncio.sleep(self.interval)
|
|
35
|
-
await self.callback()
|
|
36
|
-
except asyncio.CancelledError:
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
async def flush(self) -> None:
|
|
40
|
-
"""Immediately execute debounce task (without waiting)"""
|
|
41
|
-
self.cancel()
|
|
42
|
-
await self.callback()
|
|
File without changes
|
|
File without changes
|