cc-continuity 0.3.24__tar.gz → 0.3.26__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 (112) hide show
  1. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/PKG-INFO +1 -1
  2. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/README.md +3 -4
  3. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/__init__.py +1 -1
  4. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/blink.py +47 -3
  5. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/transcript.py +10 -1
  6. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity.egg-info/PKG-INFO +1 -1
  7. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/pyproject.toml +1 -1
  8. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_blink.py +82 -7
  9. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_transcript.py +36 -0
  10. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/LICENSE +0 -0
  11. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/__main__.py +0 -0
  12. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/atomic.py +0 -0
  13. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/blink_watch.py +0 -0
  14. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/bootstrap.py +0 -0
  15. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/checkpoint.py +0 -0
  16. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/cli.py +0 -0
  17. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/config.py +0 -0
  18. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/daemon_supervisor.py +0 -0
  19. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/doctor.py +0 -0
  20. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/gitsnap.py +0 -0
  21. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/__init__.py +0 -0
  22. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/common.py +0 -0
  23. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/pre_compact.py +0 -0
  24. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/pre_tool_use.py +0 -0
  25. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/session_end.py +0 -0
  26. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/session_start.py +0 -0
  27. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/stop.py +0 -0
  28. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/task.py +0 -0
  29. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/tool_use.py +0 -0
  30. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hooks/user_prompt.py +0 -0
  31. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/hosting.py +0 -0
  32. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/install.py +0 -0
  33. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/launch.py +0 -0
  34. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/ledger.py +0 -0
  35. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/lock.py +0 -0
  36. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/managed.py +0 -0
  37. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/naming.py +0 -0
  38. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/notify.py +0 -0
  39. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/paths.py +0 -0
  40. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/power_plug.py +0 -0
  41. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/progress_pane.py +0 -0
  42. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/project.py +0 -0
  43. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/redact.py +0 -0
  44. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/rotator.py +0 -0
  45. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/settings_merge.py +0 -0
  46. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/skills.py +0 -0
  47. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/state.py +0 -0
  48. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/statusline.py +0 -0
  49. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/thresholds.py +0 -0
  50. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/validate.py +0 -0
  51. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/watchdog.py +0 -0
  52. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/watchdog_digest.py +0 -0
  53. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity/watchdogd.py +0 -0
  54. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity.egg-info/SOURCES.txt +0 -0
  55. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity.egg-info/dependency_links.txt +0 -0
  56. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity.egg-info/entry_points.txt +0 -0
  57. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/cc_continuity.egg-info/top_level.txt +0 -0
  58. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/setup.cfg +0 -0
  59. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_atomic.py +0 -0
  60. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_blink_watch.py +0 -0
  61. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_bootstrap.py +0 -0
  62. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_checkpoint.py +0 -0
  63. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_cli.py +0 -0
  64. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_cli_ledger.py +0 -0
  65. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_config.py +0 -0
  66. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_daemon_supervisor.py +0 -0
  67. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_doctor.py +0 -0
  68. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_gitsnap.py +0 -0
  69. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_common.py +0 -0
  70. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_pre_compact.py +0 -0
  71. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_pre_tool_use.py +0 -0
  72. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_session_end.py +0 -0
  73. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_session_start.py +0 -0
  74. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_stop.py +0 -0
  75. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_task.py +0 -0
  76. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_tool_use.py +0 -0
  77. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hooks_user_prompt.py +0 -0
  78. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hosting.py +0 -0
  79. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_hygiene.py +0 -0
  80. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_install.py +0 -0
  81. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_integration_phase5.py +0 -0
  82. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_integration_phase6.py +0 -0
  83. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_integration_phase7.py +0 -0
  84. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_launch.py +0 -0
  85. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_ledger.py +0 -0
  86. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_lock.py +0 -0
  87. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_managed.py +0 -0
  88. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_naming.py +0 -0
  89. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_notify.py +0 -0
  90. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_notify_integration.py +0 -0
  91. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_paths.py +0 -0
  92. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_power_plug.py +0 -0
  93. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_progress_pane.py +0 -0
  94. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_project.py +0 -0
  95. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_redact.py +0 -0
  96. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_rotator.py +0 -0
  97. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_settings_merge.py +0 -0
  98. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_skills.py +0 -0
  99. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_state.py +0 -0
  100. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_status.py +0 -0
  101. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_statusline.py +0 -0
  102. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_thresholds.py +0 -0
  103. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_tmux_host.py +0 -0
  104. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_transcript_finalize.py +0 -0
  105. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_uninstall.py +0 -0
  106. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_validate.py +0 -0
  107. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_watchdog.py +0 -0
  108. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_watchdog_digest.py +0 -0
  109. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_watchdog_integration.py +0 -0
  110. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_watchdogd.py +0 -0
  111. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_wsl_doctor.py +0 -0
  112. {cc_continuity-0.3.24 → cc_continuity-0.3.26}/tests/test_wsl_install.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.24
3
+ Version: 0.3.26
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Requires-Python: >=3.11
6
6
  License-File: LICENSE
@@ -26,12 +26,11 @@ The five most recent updates, newest first. Each line links to its
26
26
  commit, so you can see what changed lately without digging through the
27
27
  log:
28
28
 
29
+ - **2026-11-12**: Needs-human and blocked waits now bounce the iTerm2 Dock icon too, not just the tab: an unconsumed `needs_human` reason (a `signal needs-human` or a watchdog stall), a permission or selection prompt, or the blocked marker arm `RequestAttention=yes` on the client ttys, and the bounce is cancelled with `no` once the wait is answered or the tab has been read (focus dwell); a crashed poller's stranded bounce is healed by the startup sweep. The reply-ready blink deliberately stays tab-only ([commit](https://github.com/pqant/claude-continuity/commit/89d55c2)).
30
+ - **2026-11-12**: Dead image chips no longer sit next to the live one: one paste is written as two records, and when the image cache is pruned before the export the record carrying only the `[Image: source: <path>]` line embedded nothing yet still opened its own non-clickable chip. Such an empty chip-only record now folds into the gallery of the block right in front of it; with no adjacent gallery it survives as a plain chip so the trace of the unrecoverable paste remains ([commit](https://github.com/pqant/claude-continuity/commit/fc86a4f)).
29
31
  - **2026-11-12**: Auto-rotation no longer stalls after a verified handoff: the rotator counted its own gate ledger entry (written a few milliseconds after the Stop timestamp) as session activity, so the rotation deferred and waited for a "next Stop" that never comes once the handoff ended the turn. Gate entries are now excluded exactly like state bookkeeping, and the pane rotates instead of sitting idle ([commit](https://github.com/pqant/claude-continuity/commit/e799446)).
30
32
  - **2026-11-12**: The `🖼 image` chip gained a second source: records that keep only the `[Image: source: <path>]` line (no base64 block) now have their file read from disk at export time and embedded, so those chips open in the lightbox too. The read is best-effort (whitelisted extensions, per-image cap), and missing, pruned or oversized files keep the plain chip ([commit](https://github.com/pqant/claude-continuity/commit/26d0144)).
31
- - **2026-11-11**: The `🖼 image` chip became a window: clicking it opens the real pasted image in a lightbox modal right on the transcript page (prev/next + `i / n` counter, Escape or backdrop click closes). Images are embedded as data URIs, so the export stays a single self-contained HTML file; a folded run of chips shares one merged gallery, and over-cap or non-whitelisted images keep the plain chip ([commit](https://github.com/pqant/claude-continuity/commit/369f9a4)).
32
- - **2026-11-11**: The transcript page now stays out of the conversation's way: protocol plumbing is filtered out (slash-command XML from `/clear` and `/rename`, task notifications, Continuity Stop-hook feedback, skill base-directory lines, `No response requested.`), the CONTINUITY RESUME blob and CC's resume prompt collapse to one-line anchors (`↻ CONTINUITY RESUME cp-NNN · handoff.md`, `↻ CC resume`), and pasted images fold into a single `🖼 image` chip instead of raw metadata lines ([commit](https://github.com/pqant/claude-continuity/commit/6366583)).
33
- - **2026-11-11**: Deferred rotations now wake themselves up: when the rotator defers because the agent was still active after the Stop, it arms a bounded self-retry tick that re-checks a short delay later and drives the rotation itself once the session is quiet. The Stop hook stays the primary route, the tick is idempotent (rotation_id guard) and capped in attempts, and `"retry_deferred": false` in the config turns the path off ([commit](https://github.com/pqant/claude-continuity/commit/dacaab0)).
34
- ## How it works
33
+ - **2026-11-11**: The `🖼 image` chip became a window: clicking it opens the real pasted image in a lightbox modal right on the transcript page (prev/next + `i / n` counter, Escape or backdrop click closes). Images are embedded as data URIs, so the export stays a single self-contained HTML file; a folded run of chips shares one merged gallery, and over-cap or non-whitelisted images keep the plain chip ([commit](https://github.com/pqant/claude-continuity/commit/369f9a4)).## How it works
35
34
 
36
35
  The whole flow in one picture: the automatic session loop, the optional
37
36
  watchdog, and the opt-in notifications:
@@ -4,4 +4,4 @@ Spec: docs/PRD.md (v1.0). Platform facts verified in docs/VERIFICATION.md.
4
4
  Standard library only at runtime; pytest is dev-only.
5
5
  """
6
6
 
7
- __version__ = "0.3.24"
7
+ __version__ = "0.3.26"
@@ -20,6 +20,14 @@ from . import config, paths
20
20
 
21
21
  OSC6_RESET = b"\x1b]6;1;bg;*;default\x07"
22
22
 
23
+ # iTerm2 Dock bounce (issue #59): needs-human, blocked and selection
24
+ # waits also bounce the Dock icon, so the user notices while looking at
25
+ # another app's window. RequestAttention=yes bounces until the user
26
+ # clicks the Dock icon or we send "no" (official iTerm2 escape docs);
27
+ # other terminal emulators ignore the unknown OSC harmlessly.
28
+ OSC1337_ATTENTION_ON = b"\x1b]1337;RequestAttention=yes\x07"
29
+ OSC1337_ATTENTION_OFF = b"\x1b]1337;RequestAttention=no\x07"
30
+
23
31
  RED_FILL = (235, 20, 20)
24
32
  BLACK_FILL = (0, 0, 0)
25
33
 
@@ -298,6 +306,7 @@ class Blinker:
298
306
  self._original = None
299
307
  self._ttys: list[str] = []
300
308
  self._restored_logged = False
309
+ self._attention_armed = False
301
310
  # the sweep is deliberately NOT gated on enabled: a blink stranded
302
311
  # by a crash must heal even if blink was turned off since. With an
303
312
  # empty store it is a zero-call no-op, so "disabled restores
@@ -318,6 +327,11 @@ class Blinker:
318
327
  self.window_id, stored)
319
328
  for tty in list_client_ttys(self._runner, self._bin_,
320
329
  self.window_id):
330
+ # a crashed poller may also strand a Dock bounce:
331
+ # the cancel is unconditional, a no-op when nothing
332
+ # was ever armed
333
+ write_tty(tty, OSC1337_ATTENTION_OFF,
334
+ _open=self._tty_open)
321
335
  write_tty(tty, OSC6_RESET, _open=self._tty_open)
322
336
  if restored:
323
337
  # keep the stored name on failure: the next animator
@@ -328,7 +342,7 @@ class Blinker:
328
342
  except Exception:
329
343
  pass
330
344
 
331
- def _start(self, now: float) -> None:
345
+ def _start(self, now: float, waiting: bool = False) -> None:
332
346
  name = get_window_name(self._runner, self._bin_, self.window_id)
333
347
  if name is None:
334
348
  self._log(f"blink skip window={self.window_id} "
@@ -344,6 +358,8 @@ class Blinker:
344
358
  self._phase_own = True
345
359
  self._last_toggle = now
346
360
  self._restored_logged = False
361
+ self._attention_armed = False
362
+ self._attention(waiting)
347
363
  if self._ttys:
348
364
  self._log(f"blink start window={self.window_id} "
349
365
  f"ttys={len(self._ttys)}")
@@ -351,6 +367,24 @@ class Blinker:
351
367
  self._log(f"blink skip window={self.window_id} "
352
368
  f"reason=no attached clients")
353
369
 
370
+ def _attention(self, waiting: bool) -> None:
371
+ """Dock bounce for the CURRENT tick (issue #59).
372
+
373
+ Edge-triggered: bytes only cross when the state flips. Only
374
+ needs-human/blocked/selection sources arm it; a reply-only wait
375
+ must never bounce the Dock (user ruling 2026-11-12). Cancelling
376
+ is harmless when iTerm2 already stopped on its own (the user
377
+ clicked the Dock icon): a second "no" is a no-op.
378
+ """
379
+ if waiting == self._attention_armed:
380
+ return
381
+ data = OSC1337_ATTENTION_ON if waiting else OSC1337_ATTENTION_OFF
382
+ for tty in self._ttys:
383
+ write_tty(tty, data, _open=self._tty_open)
384
+ self._attention_armed = waiting
385
+ self._log(f"attention {'on' if waiting else 'off'} "
386
+ f"window={self.window_id}")
387
+
354
388
  def _wait_name(self, count: int) -> str:
355
389
  return "WAIT" if count <= 1 else f"WAIT[{count}]"
356
390
 
@@ -367,6 +401,9 @@ class Blinker:
367
401
  write_tty(tty, self._fill, _open=self._tty_open)
368
402
 
369
403
  def _restore(self) -> None:
404
+ # cancel the Dock bounce BEFORE the tab reset: a wait that ended
405
+ # (answered, or read via focus dwell) must leave no bounce behind
406
+ self._attention(False)
370
407
  if self._original is not None:
371
408
  restored = rename_window(self._runner, self._bin_,
372
409
  self.window_id, self._original)
@@ -402,17 +439,24 @@ class Blinker:
402
439
  return
403
440
  try:
404
441
  count = sum((text or "").count(m) for m in GATE_MARKERS)
405
- if pane_text is not None and ask_visible(pane_text):
442
+ pane_ask = pane_text is not None and ask_visible(pane_text)
443
+ if pane_ask:
406
444
  count += 1
407
445
  gated = count > 0
446
+ # Dock bounce sources (issue #59): the blocked and ask
447
+ # families; a reply-only wait stays tab-blink only.
448
+ waiting = bool(pane_ask
449
+ or (text or "").count(MARKER_BLOCKED)
450
+ or (text or "").count(MARKER_ASK))
408
451
  if gated and not self._blinking:
409
- self._start(now)
452
+ self._start(now, waiting)
410
453
  return
411
454
  if not self._blinking:
412
455
  return
413
456
  if not gated:
414
457
  self._restore()
415
458
  return
459
+ self._attention(waiting)
416
460
  if now - self._last_toggle >= self._interval:
417
461
  self._last_toggle = now
418
462
  self._phase_own = not self._phase_own
@@ -192,7 +192,9 @@ def parse_conversation(lines: list[str]) -> list[Block]:
192
192
  never reach the output (issue #54). The CONTINUITY RESUME blob and
193
193
  CC's "Continue from where you left off." prompt collapse to one-line
194
194
  anchors; image metadata lines fold into a ``🖼 image`` chip (runs of
195
- chips collapse to one, their galleries merge). Embeddable base64
195
+ chips collapse to one, their galleries merge; a chip-only record that
196
+ embeds nothing right behind a block with a gallery folds into it
197
+ instead of opening a dead chip, issue #59). Embeddable base64
196
198
  image blocks attach to the block as ``data:`` URIs for the lightbox
197
199
  (issue #55); records that only carry the ``[Image: source: <path>]``
198
200
  line read the file from disk when it is still present (issue #56).
@@ -263,6 +265,13 @@ def parse_conversation(lines: list[str]) -> list[Block]:
263
265
  if not text:
264
266
  if not had_image and not imgs:
265
267
  continue
268
+ if not imgs and out and out[-1].images:
269
+ # CC writes one paste as two records (base64 + a path-only
270
+ # sibling). If the cache was pruned before the export the
271
+ # sibling can embed nothing; opening a dead chip right
272
+ # next to the live gallery is worse than folding it in
273
+ # (issue #59).
274
+ continue
266
275
  text = _IMAGE_CHIP
267
276
  if out and out[-1].text == _IMAGE_CHIP:
268
277
  # Fold the run: merge the galleries into one chip.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.24
3
+ Version: 0.3.26
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Requires-Python: >=3.11
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cc-continuity"
7
- version = "0.3.24"
7
+ version = "0.3.26"
8
8
  description = "Zero-touch session rotation for Claude Code (local large-context model)"
9
9
  requires-python = ">=3.11"
10
10
  dependencies = [] # stdlib only at runtime (PRD §0.5)
@@ -170,6 +170,9 @@ def _store_dict():
170
170
 
171
171
 
172
172
  GATE = "◆ 61% ok ⛔ BLOCKED"
173
+ ASK_TEXT = "◆ 61% ok ⚠ ASK"
174
+ REPLY_TEXT = "◆ 61% ok 🕐 REPLY"
175
+ _SEL_PANE = "❯ > 1. allow once\nEnter to select · Esc to cancel"
173
176
  NO_LOG = lambda msg: None # noqa: E731 (tests never touch the real log)
174
177
 
175
178
 
@@ -211,7 +214,8 @@ def test_phase_flip_cadence():
211
214
  # t=1.5 dark again: exactly the 0.5 s per-phase cadence.
212
215
  assert r.renames() == ["WAIT", "orig", "WAIT"]
213
216
  fill = blink.osc6_fill(blink.BLACK_FILL)
214
- assert tty.bytes_for("/dev/ttys001") == fill + blink.OSC6_RESET + fill
217
+ assert tty.bytes_for("/dev/ttys001") == (
218
+ blink.OSC1337_ATTENTION_ON + fill + blink.OSC6_RESET + fill)
215
219
 
216
220
 
217
221
  def test_no_color_uses_red_fill():
@@ -219,7 +223,8 @@ def test_no_color_uses_red_fill():
219
223
  b = _blinker(r, tty, cfg={"blink_no_color": True})
220
224
  b.on_text(GATE, 0.0)
221
225
  b.on_text(GATE, 0.5)
222
- assert tty.bytes_for("/dev/ttys001") == blink.osc6_fill(blink.RED_FILL)
226
+ assert tty.bytes_for("/dev/ttys001") == (
227
+ blink.OSC1337_ATTENTION_ON + blink.osc6_fill(blink.RED_FILL))
223
228
 
224
229
 
225
230
  def test_multi_waiting_panes_count_in_name():
@@ -240,7 +245,9 @@ def test_falling_edge_restores_once_to_seen_ttys():
240
245
  b.on_text("◆ 61% ok", 0.55) # user answered: gate gone
241
246
  assert r.renames() == ["WAIT", "orig"]
242
247
  for path in ("/dev/ttys001", "/dev/ttys002"):
243
- assert tty.bytes_for(path) == (blink.osc6_fill(blink.BLACK_FILL)
248
+ assert tty.bytes_for(path) == (blink.OSC1337_ATTENTION_ON
249
+ + blink.osc6_fill(blink.BLACK_FILL)
250
+ + blink.OSC1337_ATTENTION_OFF
244
251
  + blink.OSC6_RESET)
245
252
  assert store("blink_name") is None
246
253
 
@@ -262,7 +269,9 @@ def test_startup_sweep_restores_stranded_wait_once():
262
269
  r, tty = ScriptRunner(["WAIT[2]", "", "/dev/ttys001"]), FakeTTY()
263
270
  b = _blinker(r, tty, store=store)
264
271
  assert ["tmux", "rename-window", "-t", "@3", "orig"] in r.calls
265
- assert tty.bytes_for("/dev/ttys001") == blink.OSC6_RESET # unconditional
272
+ # the stranded bounce (if any) is cancelled first, unconditionally
273
+ assert tty.bytes_for("/dev/ttys001") == (
274
+ blink.OSC1337_ATTENTION_OFF + blink.OSC6_RESET)
266
275
  assert store("blink_name") is None
267
276
  n = len(r.calls)
268
277
  b.on_text("◆ ok", 1.0)
@@ -307,6 +316,69 @@ def test_blinker_never_raises_on_broken_plumbing():
307
316
  b.on_exit()
308
317
 
309
318
 
319
+ # ------------------------------------------------- iTerm2 Dock attention
320
+ # (issue #59): while a needs-human/BLOCKED wait is on screen the Dock icon
321
+ # bounces via OSC 1337 RequestAttention; reply-only waits must stay silent
322
+ # (user ruling 2026-11-12).
323
+
324
+
325
+ def test_attention_yes_on_blocked_start_and_no_on_restore():
326
+ r, tty = ScriptRunner(["orig", "/dev/ttys001"]), FakeTTY()
327
+ b = _blinker(r, tty)
328
+ b.on_text(GATE, 0.0) # waiting: bounce
329
+ assert tty.bytes_for("/dev/ttys001") == blink.OSC1337_ATTENTION_ON
330
+ b.on_text("◆ 61% ok", 0.1) # answered: cancel
331
+ assert tty.bytes_for("/dev/ttys001") == (
332
+ blink.OSC1337_ATTENTION_ON + blink.OSC1337_ATTENTION_OFF
333
+ + blink.OSC6_RESET)
334
+ assert r.renames() == ["orig"]
335
+
336
+
337
+ def test_attention_never_fires_for_reply_only_wait():
338
+ # A finished turn waiting for the next prompt is NOT a blocked wait.
339
+ r, tty = ScriptRunner(["orig", "/dev/ttys001"]), FakeTTY()
340
+ b = _blinker(r, tty)
341
+ b.on_text(REPLY_TEXT, 0.0)
342
+ b.on_text(REPLY_TEXT, 0.5)
343
+ b.on_exit()
344
+ assert b"RequestAttention" not in tty.bytes_for("/dev/ttys001")
345
+
346
+
347
+ def test_attention_yes_on_ask_marker():
348
+ r, tty = ScriptRunner(["orig", "/dev/ttys001"]), FakeTTY()
349
+ b = _blinker(r, tty)
350
+ b.on_text(ASK_TEXT, 0.0)
351
+ assert tty.bytes_for("/dev/ttys001") == blink.OSC1337_ATTENTION_ON
352
+
353
+
354
+ def test_attention_yes_on_selection_pane():
355
+ r, tty = ScriptRunner(["orig", "/dev/ttys001"]), FakeTTY()
356
+ b = _blinker(r, tty)
357
+ b.on_text("◆ 29% Active Usage", 0.0, pane_text=_SEL_PANE)
358
+ assert tty.bytes_for("/dev/ttys001") == blink.OSC1337_ATTENTION_ON
359
+
360
+
361
+ def test_attention_arms_once_mid_blink_and_disarms_when_source_clears():
362
+ r, tty = ScriptRunner(["orig", "/dev/ttys001"]), FakeTTY()
363
+ b = _blinker(r, tty, cfg={"blink_interval": 0.5})
364
+ b.on_text(REPLY_TEXT, 0.0) # reply only: stays silent
365
+ b.on_text(REPLY_TEXT + " ⛔ BLOCKED", 0.1) # blocked joins: arm once
366
+ b.on_text(REPLY_TEXT + " ⛔ BLOCKED", 0.2) # no re-write per tick
367
+ assert tty.bytes_for("/dev/ttys001") == blink.OSC1337_ATTENTION_ON
368
+ b.on_text(REPLY_TEXT, 0.3) # blocked gone: cancel
369
+ assert tty.bytes_for("/dev/ttys001") == (
370
+ blink.OSC1337_ATTENTION_ON + blink.OSC1337_ATTENTION_OFF)
371
+
372
+
373
+ def test_startup_sweep_cancels_a_stranded_bounce():
374
+ store = _store_dict()
375
+ store("blink_name", "orig")
376
+ r, tty = ScriptRunner(["WAIT[2]", "", "/dev/ttys001"]), FakeTTY()
377
+ _blinker(r, tty, store=store)
378
+ assert tty.bytes_for("/dev/ttys001") == (
379
+ blink.OSC1337_ATTENTION_OFF + blink.OSC6_RESET)
380
+
381
+
310
382
  def test_startup_sweep_runs_even_when_disabled():
311
383
  # spec: the stale self-heal is NOT conditioned on the blink config - a
312
384
  # stranded WAIT must heal even if the user turned blink off after the
@@ -317,7 +389,8 @@ def test_startup_sweep_runs_even_when_disabled():
317
389
  r, tty = ScriptRunner(["WAIT[2]", "", "/dev/ttys001"]), FakeTTY()
318
390
  b = _blinker(r, tty, store=store, cfg={"blink": False})
319
391
  assert ["tmux", "rename-window", "-t", "@3", "orig"] in r.calls
320
- assert tty.bytes_for("/dev/ttys001") == blink.OSC6_RESET
392
+ assert tty.bytes_for("/dev/ttys001") == (
393
+ blink.OSC1337_ATTENTION_OFF + blink.OSC6_RESET)
321
394
  assert store("blink_name") is None
322
395
  n = len(r.calls)
323
396
  b.on_text(GATE, 1.0) # disabled: the state machine stays inert
@@ -453,7 +526,8 @@ def test_blinker_starts_on_pane_dialog_without_data_marker():
453
526
  b.on_text("◆ 29% Active Usage", 0.0, pane_text=_DIALOG)
454
527
  b.on_text("◆ 29% Active Usage", 0.5, pane_text=_DIALOG)
455
528
  assert r.renames() == ["WAIT"]
456
- assert tty.bytes_for("/dev/ttys001") == blink.osc6_fill(blink.BLACK_FILL)
529
+ assert tty.bytes_for("/dev/ttys001") == (
530
+ blink.OSC1337_ATTENTION_ON + blink.osc6_fill(blink.BLACK_FILL))
457
531
 
458
532
 
459
533
  def test_blinker_pane_falling_edge_restores():
@@ -465,7 +539,8 @@ def test_blinker_pane_falling_edge_restores():
465
539
  b.on_text("◆ 29% Active Usage", 0.6, pane_text="") # answered
466
540
  assert r.renames() == ["WAIT", "conn-tab"]
467
541
  assert tty.bytes_for("/dev/ttys001") == (
468
- blink.osc6_fill(blink.BLACK_FILL) + blink.OSC6_RESET)
542
+ blink.OSC1337_ATTENTION_ON + blink.osc6_fill(blink.BLACK_FILL)
543
+ + blink.OSC1337_ATTENTION_OFF + blink.OSC6_RESET)
469
544
  assert store("blink_name") is None
470
545
 
471
546
 
@@ -222,6 +222,42 @@ def test_multiple_source_lines_embed_in_order(tmp_path):
222
222
  f"data:image/jpeg;base64,{PNG1x1}"]
223
223
 
224
224
 
225
+ # --- issue #59: no dead chip next to a live gallery -----------------------
226
+
227
+
228
+ def test_empty_image_record_folds_into_preceding_gallery(tmp_path):
229
+ # CC writes one paste as two records: one carrying the base64 block,
230
+ # a sibling carrying only the [Image: source: <path>] line. When the
231
+ # cache is pruned before the export, the sibling would open a dead
232
+ # chip right next to the live one; it must fold in instead.
233
+ gone = tmp_path / "gone.png" # never created (pruned)
234
+ blocks = transcript.parse_conversation([
235
+ _rec("user", [{"type": "text", "text": "[Image #4] patch it now please"},
236
+ _img()]),
237
+ _rec("user", f"[Image: source: {gone}]")])
238
+ assert [(r, t) for r, t, _, _ in blocks] == [("user", "[Image #4] patch it now please")]
239
+ assert list(blocks[0][3]) == ["data:image/png;base64,QUJD"]
240
+
241
+
242
+ def test_recoverable_sibling_keeps_its_own_chip(tmp_path):
243
+ png = _png(tmp_path)
244
+ blocks = transcript.parse_conversation([
245
+ _rec("user", [{"type": "text", "text": "metin oncesi"}, _img(data="QQ==")]),
246
+ _rec("user", f"[Image: source: {png}]")])
247
+ assert [t for _, t, _, _ in blocks] == ["metin oncesi", "🖼 image"]
248
+ assert list(blocks[0][3]) == ["data:image/png;base64,QQ=="]
249
+ assert list(blocks[1][3]) == [f"data:image/png;base64,{PNG1x1}"]
250
+
251
+
252
+ def test_dead_chip_survives_when_no_gallery_to_fold_into():
253
+ # Without an adjacent gallery the plain chip is the only trace of the
254
+ # unrecoverable paste; it must not disappear.
255
+ blocks = transcript.parse_conversation([
256
+ _rec("user", "duz metin"),
257
+ _rec("user", "[Image: source: /nowhere/x.png]")])
258
+ assert [t for _, t, _, _ in blocks] == ["duz metin", "🖼 image"]
259
+
260
+
225
261
  def test_table_fenced_and_escaping():
226
262
  md = "|a|b|\n|--|--|\n|1|b|\n\n<script>x</script>\n\n```\nprint(1)\n```\n\nplain **b** `c`"
227
263
  out = transcript.md_to_html(md)
File without changes
File without changes