zettcode-engine 0.4.6__tar.gz → 0.4.7__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 (89) hide show
  1. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/.gitignore +1 -3
  2. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/PKG-INFO +2 -2
  3. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/pyproject.toml +1 -1
  4. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/store.py +131 -21
  5. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/version.py +1 -1
  6. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/_compat.py +0 -0
  7. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/budget.py +0 -0
  8. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/config.py +0 -0
  9. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/config_edit.py +0 -0
  10. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/__init__.py +0 -0
  11. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/__init__.py +0 -0
  12. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/base.py +0 -0
  13. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/context.py +0 -0
  14. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/exports.py +0 -0
  15. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/interaction.py +0 -0
  16. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/sessions.py +0 -0
  17. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/settings.py +0 -0
  18. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/agent/turns.py +0 -0
  19. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/core.py +0 -0
  20. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/delivery.py +0 -0
  21. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/delivery_runtime.py +0 -0
  22. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/dialogue/__init__.py +0 -0
  23. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/dialogue/ask.py +0 -0
  24. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/dialogue/side.py +0 -0
  25. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/dialogue/title.py +0 -0
  26. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/export/__init__.py +0 -0
  27. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/export/trace/script.js +0 -0
  28. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/export/trace/style.css +0 -0
  29. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/export/trace/template.html +0 -0
  30. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/__init__.py +0 -0
  31. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/capabilities.py +0 -0
  32. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/compaction.py +0 -0
  33. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/context.py +0 -0
  34. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/files.py +0 -0
  35. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/guidance.py +0 -0
  36. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/harness_switch.py +0 -0
  37. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/mcp_notice.py +0 -0
  38. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/relay.py +0 -0
  39. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/subagents.py +0 -0
  40. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/extensions/usage.py +0 -0
  41. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/harness_paths.py +0 -0
  42. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/inbox.py +0 -0
  43. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/permission/__init__.py +0 -0
  44. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/permission/approval.py +0 -0
  45. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/permission/readonly.py +0 -0
  46. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/permission/sandbox.py +0 -0
  47. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/pipeline.py +0 -0
  48. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/__init__.py +0 -0
  49. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/cli.py +0 -0
  50. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/commands.py +0 -0
  51. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/context.py +0 -0
  52. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/extension.py +0 -0
  53. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/graph.py +0 -0
  54. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/groups.py +0 -0
  55. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/llm.py +0 -0
  56. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/loader.py +0 -0
  57. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/mixins.py +0 -0
  58. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/plugin.py +0 -0
  59. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/services.py +0 -0
  60. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/settings.py +0 -0
  61. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/state.py +0 -0
  62. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/switches.py +0 -0
  63. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/plugins/triggers.py +0 -0
  64. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/provided.py +0 -0
  65. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/py.typed +0 -0
  66. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/server_tools.py +0 -0
  67. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/service_contracts.py +0 -0
  68. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/__init__.py +0 -0
  69. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/layout.py +0 -0
  70. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/ledger.py +0 -0
  71. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/locks.py +0 -0
  72. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/metadata.py +0 -0
  73. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/engine/storage/records.py +0 -0
  74. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/error_text.py +0 -0
  75. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/filelock.py +0 -0
  76. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/logging_setup.py +0 -0
  77. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/mention.py +0 -0
  78. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/modes.py +0 -0
  79. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/paths.py +0 -0
  80. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/plugin_tui.py +0 -0
  81. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/processes.py +0 -0
  82. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/prompt.py +0 -0
  83. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/providers.py +0 -0
  84. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/py.typed +0 -0
  85. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/registry.py +0 -0
  86. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/relay.py +0 -0
  87. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/statusline_parts.py +0 -0
  88. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/wire.py +0 -0
  89. {zettcode_engine-0.4.6 → zettcode_engine-0.4.7}/src/zettcode/wording.py +0 -0
@@ -36,7 +36,5 @@ docs/internal/palettes.html
36
36
  # The release order is generated from the pyproject.toml files (`make order`); it is not kept in git.
37
37
  packages/order.txt
38
38
 
39
- # The desktop and phone apps build the gateway's page into their own folders, and electron-builder writes its
40
- # installers under release/.
41
- clients/desktop/renderer/
39
+ # electron-builder writes the desktop installers under release/.
42
40
  clients/desktop/release/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: zettcode-engine
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: The agent core of ZettCode: the runtime over zett-agent, and the leaf types it is written on
5
5
  Project-URL: Repository, https://github.com/Chang-LeHung/zettcode
6
6
  Author: Chang-LeHung
@@ -19,6 +19,6 @@ Requires-Dist: exceptiongroup<2,>=1.2; python_version < '3.11'
19
19
  Requires-Dist: pydantic<3,>=2
20
20
  Requires-Dist: tomli<3,>=2; python_version < '3.11'
21
21
  Requires-Dist: zett-agent<0.3,>=0.2.10
22
- Requires-Dist: zettcode-tools<0.5,>=0.4.6
22
+ Requires-Dist: zettcode-tools<0.5,>=0.4.7
23
23
  Provides-Extra: tiktoken
24
24
  Requires-Dist: tiktoken<1,>=0.12; extra == 'tiktoken'
@@ -18,7 +18,7 @@ classifiers = [
18
18
  ]
19
19
  dependencies = [
20
20
  # The coding tools the runtime hands the model, a leaf of its own beneath the engine.
21
- "zettcode-tools>=0.4.6,<0.5",
21
+ "zettcode-tools>=0.4.7,<0.5",
22
22
  # The runtime this is a core over. Imported directly: the agent, the message types, the approval mode.
23
23
  "zett-agent>=0.2.10,<0.3",
24
24
  # The session store's records are pydantic models.
@@ -29,13 +29,14 @@ from __future__ import annotations
29
29
 
30
30
  import asyncio
31
31
  import json
32
+ import os
32
33
  import threading
33
34
  from collections import Counter
34
35
  from collections.abc import Iterator, Mapping, Sequence
35
36
  from dataclasses import dataclass, field, replace
36
37
  from datetime import datetime
37
38
  from pathlib import Path
38
- from typing import cast
39
+ from typing import BinaryIO, cast
39
40
  from weakref import WeakKeyDictionary
40
41
 
41
42
  from pydantic import ValidationError
@@ -92,6 +93,26 @@ from .records import (
92
93
  #: reach it through :meth:`SessionPersistenceMixin.session_dir`, so the name is stated here, once.
93
94
  KEPT_OUTPUT = "tool-output"
94
95
 
96
+ #: How many bytes before the end of a read are remembered, to tell an appended file from a replaced one.
97
+ _ANCHOR = 64
98
+
99
+
100
+ @dataclass(frozen=True, slots=True)
101
+ class _Reading:
102
+ """Where the last read of a session file stopped, so the next one can start there.
103
+
104
+ Attributes:
105
+ session: What that read produced.
106
+ offset: The byte after the last line it took in.
107
+ anchor: The bytes just before ``offset``. A file that no longer has them there was replaced, not appended to.
108
+ lines: How many lines the read took in, so an error further on can name its line number.
109
+ """
110
+
111
+ session: Session
112
+ offset: int
113
+ anchor: bytes
114
+ lines: int = 0
115
+
95
116
 
96
117
  def message_context(
97
118
  value: Mapping[str, object] | None, *, field: str, nonempty_keys: bool = False
@@ -174,6 +195,8 @@ class SessionPersistenceMixin:
174
195
  # is the hot path — one call per message — so it must not re-parse the
175
196
  # whole log; the cache makes a read O(1) and a write a tuple copy.
176
197
  self._sessions: dict[str, tuple[tuple[int, int] | None, Session]] = {}
198
+ #: Where the last full or partial read of each session stopped, so a log that only grew is read from there.
199
+ self._readings: dict[str, _Reading] = {}
177
200
  #: A read now runs on a worker thread for the framework's restore hook,
178
201
  #: while appends still fold into the same cache on the loop. The lock
179
202
  #: orders only the cache lookups and the publish; the parse itself runs
@@ -253,36 +276,91 @@ class SessionPersistenceMixin:
253
276
  return cached[1]
254
277
  if stamp is None:
255
278
  session = Session(header=None, messages=(), compactions=(), head_id=None)
279
+ reading: _Reading | None = None
256
280
  else:
257
- session = self._parse(path)
281
+ with self._cache_lock:
282
+ known = self._readings.get(session_id)
283
+ session, reading = self._read_from(path, known)
258
284
  with self._cache_lock:
259
285
  cached = self._sessions.get(session_id)
260
286
  if stamp is not None and cached is not None and cached[0] is not None and cached[0] >= stamp:
261
287
  return cached[1]
262
288
  self._sessions[session_id] = (stamp, session)
289
+ if reading is None:
290
+ self._forget(session_id, keep_session=True)
291
+ else:
292
+ self._readings[session_id] = reading
263
293
  return session
264
294
 
265
- def _parse(self, path: Path) -> Session:
266
- """Parse one session file without touching the cache."""
267
- # Bytes, not text: the parser takes them as they are, so the file is not
268
- # decoded to a string only to be encoded again, and a line is only ever split
269
- # where the file's own newline is. ``str.splitlines`` also breaks at U+2028,
270
- # U+2029, and U+0085, which JSON writes into a string as they are — a
271
- # message that held one was cut in half and the file called corrupt.
272
- lines = path.read_bytes().splitlines()
273
- header: SessionLine | None = None
274
- messages: list[MessageLine] = []
275
- compactions: list[CompactionLine] = []
276
- head_id: str | None = None
295
+ def _forget(self, session_id: str, *, keep_session: bool = False) -> None:
296
+ """Drop what is remembered of a session's file: the parse, and where the last read of it stopped.
297
+
298
+ They go together, because a reading kept without its entry would be continued from by the next read, and
299
+ "dropped" has always meant "read again from the first byte".
300
+ """
301
+ with self._cache_lock:
302
+ if not keep_session:
303
+ self._sessions.pop(session_id, None)
304
+ self._readings.pop(session_id, None)
305
+
306
+ def _read_from(self, path: Path, known: _Reading | None) -> tuple[Session, _Reading]:
307
+ """Parse a session file, taking only what was appended since ``known`` when that is safe.
308
+
309
+ The log is append-only, so a file that is longer than it was, with the same bytes where the earlier read
310
+ stopped, is the earlier file plus new lines: only those are parsed. Anything else (shorter, a different
311
+ file, other bytes before the offset) is parsed whole, so a replaced file can never be read as an extension.
312
+ """
313
+ with path.open("rb") as handle:
314
+ size = os.fstat(handle.fileno()).st_size
315
+ if known is not None and self._extends(handle, known, size):
316
+ handle.seek(known.offset)
317
+ tail = handle.read(size - known.offset)
318
+ return self._parse_tail(path, known, tail)
319
+ handle.seek(0)
320
+ return self._parse_tail(path, None, handle.read(size))
321
+
322
+ @staticmethod
323
+ def _extends(handle: BinaryIO, known: _Reading, size: int) -> bool:
324
+ """Return whether the file still has the bytes the earlier read ended on, in the same place.
325
+
326
+ An equal-size file with those bytes is an extension of nothing: the parse of its empty tail is the cached one.
327
+ """
328
+ if size < known.offset or known.offset == 0:
329
+ return False
330
+ anchor = min(known.offset, _ANCHOR)
331
+ handle.seek(known.offset - anchor)
332
+ return handle.read(anchor) == known.anchor
333
+
334
+ def _parse_tail(self, path: Path, known: _Reading | None, data: bytes) -> tuple[Session, _Reading]:
335
+ """Parse ``data`` (the whole file, or what follows ``known``) and return the session and where it ended.
336
+
337
+ Only whole lines are consumed: a final line with no newline is parsed when it is complete JSON (the writer
338
+ is between its two writes) and left for the next read when it is not, so a torn line is never skipped.
339
+ """
340
+ base = known.offset if known is not None else 0
341
+ first_line = known.lines + 1 if known is not None else 1
342
+ # Bytes, split on b"\n" only: ``str.splitlines`` also breaks at U+2028, U+2029 and U+0085, which JSON writes
343
+ # into a string as they are, and a message that held one was once cut in half and the file called corrupt.
344
+ lines = data.split(b"\n")
345
+ trailing = lines.pop() # what follows the last newline: usually empty
346
+ header = known.session.header if known is not None else None
347
+ messages = list(known.session.messages) if known is not None else []
348
+ compactions = list(known.session.compactions) if known is not None else []
349
+ head_id = known.session.head_id if known is not None else None
350
+ consumed = 0
277
351
  for index, line in enumerate(lines):
352
+ consumed += len(line) + 1
278
353
  if not line.strip():
279
354
  continue
280
355
  try:
281
356
  parsed = LINES.validate_json(line)
282
357
  except ValidationError as error:
283
- if index == len(lines) - 1:
284
- break # A crash can tear the line being appended; the rest is intact.
285
- raise ValueError(f"Corrupt session file {path.name} at line {index + 1}") from error
358
+ if index == len(lines) - 1 and not trailing.strip():
359
+ consumed -= len(line) + 1 # a torn last line: leave it for the next read
360
+ break
361
+ raise ValueError(
362
+ f"Corrupt session file {path.name} at line {first_line + index} (byte {base + consumed - len(line) - 1})"
363
+ ) from error
286
364
  match parsed:
287
365
  case SessionLine():
288
366
  header = parsed
@@ -293,8 +371,33 @@ class SessionPersistenceMixin:
293
371
  compactions.append(parsed)
294
372
  case other:
295
373
  raise ValueError(f"Unknown session record: {type(other).__name__}")
374
+ if trailing.strip():
375
+ try:
376
+ parsed = LINES.validate_json(trailing)
377
+ except ValidationError:
378
+ pass # half a record: the next read starts at its first byte
379
+ else:
380
+ consumed += len(trailing)
381
+ match parsed:
382
+ case SessionLine():
383
+ header = parsed
384
+ case MessageLine():
385
+ messages.append(parsed)
386
+ head_id = parsed.id
387
+ case CompactionLine():
388
+ compactions.append(parsed)
389
+ case other:
390
+ raise ValueError(f"Unknown session record: {type(other).__name__}")
391
+ elif trailing:
392
+ consumed += len(trailing) # blanks only
296
393
  self._check_links(path, messages, compactions)
297
- return Session(header=header, messages=tuple(messages), compactions=tuple(compactions), head_id=head_id)
394
+ session = Session(header=header, messages=tuple(messages), compactions=tuple(compactions), head_id=head_id)
395
+ end = base + consumed
396
+ # The anchor comes from the bytes just parsed, never from a second look at the file: a writer could have
397
+ # appended in between, and the anchor would then describe bytes this read never took in.
398
+ before = (known.anchor if known is not None else b"") + data[:consumed]
399
+ taken = data[:consumed].count(b"\n") + (1 if consumed and not data[:consumed].endswith(b"\n") else 0)
400
+ return session, _Reading(session, end, before[-_ANCHOR:], (known.lines if known is not None else 0) + taken)
298
401
 
299
402
  @staticmethod
300
403
  def _stamp(path: Path) -> tuple[int, int]:
@@ -348,7 +451,14 @@ class SessionPersistenceMixin:
348
451
  A cache entry that does not know the line's parent is dropped rather
349
452
  than extended: a worker may have published an empty session between the
350
453
  append's leading read and this call, and a one-line cache would then
351
- claim to be the whole history.
454
+ claim to be the whole history. Its reading is dropped with it, so a
455
+ dropped entry means the next read parses the file whole, as it always did.
456
+
457
+ The reading of a kept entry is deliberately *not* advanced to the spliced
458
+ session. It stays where the last read of the file stopped, so the first
459
+ read after another writer appends parses this process's recent lines once
460
+ more, and that is what keeps them from being counted twice: moving the
461
+ reading forward here would add each of them to the session a second time.
352
462
  """
353
463
  with self._cache_lock:
354
464
  cached = self._sessions.get(session_id)
@@ -364,7 +474,7 @@ class SessionPersistenceMixin:
364
474
  and line.parent != session.head_id
365
475
  and session.message(line.parent) is None
366
476
  ):
367
- self._sessions.pop(session_id, None)
477
+ self._forget(session_id)
368
478
  return
369
479
  # A read on a worker may have parsed the file after this
370
480
  # append wrote it but before it reached this cache update.
@@ -375,7 +485,7 @@ class SessionPersistenceMixin:
375
485
  session = replace(session, messages=(*session.messages, line), head_id=line.id)
376
486
  case CompactionLine():
377
487
  if session.message(line.parent) is None:
378
- self._sessions.pop(session_id, None)
488
+ self._forget(session_id)
379
489
  return
380
490
  if not any(item.id == line.id for item in session.compactions):
381
491
  session = replace(session, compactions=(*session.compactions, line))
@@ -8,4 +8,4 @@ of the dependency graph: everything else may import `zettcode.version`, nothing
8
8
  from __future__ import annotations
9
9
 
10
10
  #: The version of the program and of every distribution built beside it.
11
- __version__ = "0.4.6"
11
+ __version__ = "0.4.7"