Skip to content

Commit 9dd83d9

Browse files
author
deeleeramone
committed
merge branch develop
2 parents 5f5ac2e + b9e1dff commit 9dd83d9

110 files changed

Lines changed: 39998 additions & 8647 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

claude/scripts/build_distributions.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def _build_cowork_plugin() -> Path:
121121
plugin = json.loads(plugin_json_path.read_text(encoding="utf-8"))
122122
if not plugin["description"].endswith(COWORK_DESCRIPTION_SUFFIX):
123123
plugin["description"] += COWORK_DESCRIPTION_SUFFIX
124-
plugin_json_path.write_text(
125-
json.dumps(plugin, indent=2) + "\n", encoding="utf-8"
126-
)
124+
plugin_json_path.write_text(json.dumps(plugin, indent=2) + "\n", encoding="utf-8")
127125

128126
out = DIST / "pywry-cowork.plugin"
129127
_zip_directory(workdir, out)
@@ -140,9 +138,7 @@ def _build_desktop_extension() -> Path:
140138
def _summarize(path: Path) -> None:
141139
size = path.stat().st_size
142140
if size > SIZE_LIMIT_BYTES:
143-
raise RuntimeError(
144-
f"{path.name} is {size:,} bytes — exceeds the 50 MB limit"
145-
)
141+
raise RuntimeError(f"{path.name} is {size:,} bytes — exceeds the 50 MB limit")
146142
with zipfile.ZipFile(path) as zf:
147143
files = zf.namelist()
148144
rel = path.relative_to(REPO_ROOT)

pywry/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pywry"
3-
version = "2.0.2"
3+
version = "2.0.4"
44
description = "A lightweight and blazingly fast, cross-platform, WebView rendering engine and desktop UI toolkit for Python. Batteries included."
55
authors = [{ name = "PyWry", email = "pywry2@gmail.com" }]
66
license = { text = "Apache 2.0" }

pywry/pywry/chat/providers/deepagent.py

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -161,65 +161,53 @@ def _step_in_call(self, ch: str) -> None:
161161
self._in_string = False
162162
self._escape = False
163163

164-
def _step_in_special(self, ch: str, out: list[str]) -> None:
165-
"""Advance the ``<|...|>`` state machine; recurse on tail after ``|>``."""
164+
def _step_in_special(self, ch: str, _out: list[str]) -> None:
165+
"""Advance the ``<|...|>`` state machine; close when ``|>`` arrives.
166+
167+
Because ``feed()`` drives one character at a time and ``_in_special``
168+
is entered with an empty buffer, the close marker is always at the
169+
tail of the buffer — there is no trailing text to recurse on.
170+
"""
166171
self._buffer += ch
167-
close_idx = self._buffer.find(self._SPECIAL_CLOSE)
168-
if close_idx < 0:
172+
if self._SPECIAL_CLOSE not in self._buffer:
169173
return
170-
rest = self._buffer[close_idx + len(self._SPECIAL_CLOSE) :]
171174
self._buffer = ""
172175
self._in_special = False
173-
if rest:
174-
out.append(self.feed(rest))
175176

176-
def _try_open_call(self, out: list[str]) -> bool:
177+
def _try_open_call(self, _out: list[str]) -> bool:
177178
"""If a complete ``functions.<name>...{`` opener sits in buffer, enter call mode.
178179
179180
Returns True if the buffer was consumed (caller skips other checks);
180-
False if the marker isn't fully present yet — caller must NOT keep
181-
scanning the buffer for ``<|`` (the ``functions.`` prefix already
182-
committed us to wait).
181+
False if the marker isn't fully present yet. ``_flush_safe_prefix``
182+
guarantees ``functions.`` always sits at the buffer head when it's
183+
present, and char-by-char feeding means ``{`` is always the tail —
184+
no leading prefix to emit and no trailing text to recurse on.
183185
"""
184-
call_idx = self._buffer.find(self._CALL_START)
185-
if call_idx < 0:
186+
if self._CALL_START not in self._buffer:
186187
return False
187-
brace_idx = self._buffer.find("{", call_idx + len(self._CALL_START))
188+
brace_idx = self._buffer.find("{", len(self._CALL_START))
188189
if brace_idx < 0:
189190
# Marker present but no ``{`` yet — keep buffering, do not
190191
# fall through to the ``<|`` check (it would never match
191192
# ``functions.`` and we'd over-emit).
192193
return True
193-
if call_idx > 0:
194-
out.append(self._buffer[:call_idx])
195-
rest = self._buffer[brace_idx + 1 :]
196194
self._buffer = ""
197195
self._in_call = True
198196
self._depth = 1
199197
self._in_string = False
200198
self._escape = False
201-
if rest:
202-
out.append(self.feed(rest))
203199
return True
204200

205-
def _try_open_special(self, out: list[str]) -> bool:
206-
"""If a ``<|...|>`` token (or its open) is in buffer, drop it; return True."""
207-
special_idx = self._buffer.find(self._SPECIAL_OPEN)
208-
if special_idx < 0:
201+
def _try_open_special(self, _out: list[str]) -> bool:
202+
"""If a ``<|`` opener sits in buffer, drop it and enter skip mode.
203+
204+
``_flush_safe_prefix`` guarantees only ``<|`` itself (no trailing
205+
text) ever reaches us, and the closing ``|>`` is consumed later
206+
by ``_step_in_special`` — so we only need to handle the "open
207+
seen, no close yet" case.
208+
"""
209+
if self._SPECIAL_OPEN not in self._buffer:
209210
return False
210-
close_idx = self._buffer.find(self._SPECIAL_CLOSE, special_idx + len(self._SPECIAL_OPEN))
211-
if close_idx >= 0:
212-
if special_idx > 0:
213-
out.append(self._buffer[:special_idx])
214-
rest = self._buffer[close_idx + len(self._SPECIAL_CLOSE) :]
215-
self._buffer = ""
216-
if rest:
217-
out.append(self.feed(rest))
218-
return True
219-
# Open seen but no close yet — drop everything from ``<|`` on,
220-
# emit the prefix, enter token-skip mode.
221-
if special_idx > 0:
222-
out.append(self._buffer[:special_idx])
223211
self._buffer = ""
224212
self._in_special = True
225213
return True

pywry/pywry/cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,6 @@ def show_config_sources() -> int:
447447
if forced_status is True:
448448
status = "✓ Active"
449449
path_display = ""
450-
elif forced_status is False:
451-
status = "✗ Not found"
452-
path_display = path_str
453450
# Check if file exists
454451
elif name == "Environment variables":
455452
import os

pywry/pywry/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
if sys.version_info >= (3, 11):
2929
import tomllib
30-
else:
30+
else: # pragma: no cover - python 3.10 fallback; cannot be exercised on 3.11+
3131
try:
3232
import tomli as tomllib
3333
except ImportError:

0 commit comments

Comments
 (0)