cc-continuity 0.3.28__tar.gz → 0.3.30__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.
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/PKG-INFO +1 -1
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/README.md +2 -3
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/__init__.py +1 -1
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/blink.py +53 -4
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/blink_watch.py +11 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/cli.py +15 -1
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/progress_pane.py +37 -2
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity.egg-info/PKG-INFO +1 -1
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/pyproject.toml +1 -1
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_blink.py +56 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_blink_watch.py +47 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_progress_pane.py +93 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/LICENSE +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/__main__.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/atomic.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/bootstrap.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/checkpoint.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/config.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/daemon_supervisor.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/doctor.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/gitsnap.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/__init__.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/common.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/pre_compact.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/pre_tool_use.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/session_end.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/session_start.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/stop.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/task.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/tool_use.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hooks/user_prompt.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/hosting.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/install.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/launch.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/ledger.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/lock.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/managed.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/naming.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/notify.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/paths.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/power_plug.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/project.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/redact.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/rotator.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/settings_merge.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/skills.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/state.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/statusline.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/thresholds.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/transcript.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/validate.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/watchdog.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/watchdog_digest.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity/watchdogd.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity.egg-info/SOURCES.txt +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity.egg-info/dependency_links.txt +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity.egg-info/entry_points.txt +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/cc_continuity.egg-info/top_level.txt +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/setup.cfg +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_atomic.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_bootstrap.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_checkpoint.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_cli.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_cli_ledger.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_config.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_daemon_supervisor.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_doctor.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_gitsnap.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_common.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_pre_compact.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_pre_tool_use.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_session_end.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_session_start.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_stop.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_task.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_tool_use.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hooks_user_prompt.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hosting.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_hygiene.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_install.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_integration_phase5.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_integration_phase6.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_integration_phase7.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_launch.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_ledger.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_lock.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_managed.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_naming.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_notify.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_notify_integration.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_paths.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_power_plug.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_project.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_redact.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_rotator.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_settings_merge.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_skills.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_state.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_status.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_statusline.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_thresholds.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_tmux_host.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_transcript.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_transcript_finalize.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_uninstall.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_validate.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_watchdog.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_watchdog_digest.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_watchdog_integration.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_watchdogd.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_wsl_doctor.py +0 -0
- {cc_continuity-0.3.28 → cc_continuity-0.3.30}/tests/test_wsl_install.py +0 -0
|
@@ -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**: A `cc-continuity signal needs-human` fired while the session idles now lights up the animated pane too: in progress mode 1 the animator owns the blink but only consulted the rendered status-line text, the reply flag and the pane capture, never `ledger.blocked_reason`, so the push reached the phone while the tab stayed dark. The animator's ~1 s blink poll now reads the ledger and paints the blocked chip with a reason-carrying gate key, mirroring the reply-flag pattern ([commit](https://github.com/pqant/claude-continuity/commit/055c824)).
|
|
30
|
+
- **2026-11-12**: The tab blink and the Dock bounce no longer die behind a backgrounded iTerm2: iTerm2 answers the frontmost-session query even while backgrounded, so the focus watcher kept believing the user was still on the tab and, worse, a selection prompt (AskUserQuestion) vanished from the pane region whenever the input box held a draft, so the wait never even armed. The frontmost-tty probe now checks which app is actually in the foreground first (any other app means "no reader present"), and a live selection footer anchors its own region regardless of the draft below it, so prompts gate again and the bounce survives until the wait is answered or read ([commit](https://github.com/pqant/claude-continuity/commit/97c5227)).
|
|
29
31
|
- **2026-11-12**: The Dock bounce can no longer be swallowed by macOS: a bounce written while the terminal app is frontmost (the system only bounces backgrounded apps) is re-fired the moment iTerm2 goes to the background: the poller and the animator watch the frontmost app on their ~1 s tick and re-write a still-armed bounce exactly once per foreground-to-background transition, never per tick ([commit](https://github.com/pqant/claude-continuity/commit/fe215b4)).
|
|
30
32
|
- **2026-11-12**: The Dock bounce now covers the reply-ready blink too: when a turn finishes and its tab is waiting to be read, the iTerm2 Dock icon bounces just like it does for needs-human waits, so a finished turn catches your eye while you work in another app. Set `"blink_reply_attention": false` in `~/.claude-continuity/config.json` to keep turn-ends tab-blink only ([commit](https://github.com/pqant/claude-continuity/commit/3dc9c0d)).
|
|
31
33
|
- **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 ([commit](https://github.com/pqant/claude-continuity/commit/89d55c2)).
|
|
32
|
-
- **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)).
|
|
33
|
-
- **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)).
|
|
34
|
-
|
|
35
34
|
## How it works
|
|
36
35
|
|
|
37
36
|
The whole flow in one picture: the automatic session loop, the optional
|
|
@@ -61,14 +61,63 @@ def ask_visible(text: str | None) -> bool:
|
|
|
61
61
|
or ASK_RE_SELECTION.search(text))
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
#: Maximum height of a selection prompt (option rows through the footer);
|
|
65
|
+
#: the footer anchor scan stops here (issue #62).
|
|
66
|
+
_SELECTION_MAX_HEIGHT = 40
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _selection_anchor(lines: list[str]) -> tuple[int, int] | None:
|
|
70
|
+
"""(start, footer_index) of a live selection prompt, None otherwise.
|
|
71
|
+
|
|
72
|
+
Issue #62 (reproduced live 2026-11-12): CC closes the option box with
|
|
73
|
+
a border line BEFORE the footer, and a draft in the input box adds a
|
|
74
|
+
lower indented ``❯`` line, so the old last-``❯`` anchor lands on the
|
|
75
|
+
draft and the prompt disappears from the region. The footer is the
|
|
76
|
+
reliable bottom edge: scan upward for the column-0 option cursor,
|
|
77
|
+
crossing at most the one closing border. A footer quoted in scrollback
|
|
78
|
+
has no such cursor directly above it, so the 014 stranding protection
|
|
79
|
+
survives the new anchor.
|
|
80
|
+
"""
|
|
81
|
+
for fi in range(len(lines) - 1, -1, -1):
|
|
82
|
+
if not ASK_RE_SELECTION.match(lines[fi]):
|
|
83
|
+
continue
|
|
84
|
+
borders = 0
|
|
85
|
+
for ci in range(fi - 1, max(-1, fi - _SELECTION_MAX_HEIGHT), -1):
|
|
86
|
+
line = lines[ci]
|
|
87
|
+
if line.startswith("❯"):
|
|
88
|
+
end = fi
|
|
89
|
+
if fi + 1 < len(lines):
|
|
90
|
+
nxt = lines[fi + 1].strip()
|
|
91
|
+
if nxt and set(nxt) == {INPUT_BORDER}:
|
|
92
|
+
# layout where the box closes BELOW the footer
|
|
93
|
+
# (pre-2026-11 CC and the pinned fixtures): keep
|
|
94
|
+
# the border inside the region, as the old rule
|
|
95
|
+
# did.
|
|
96
|
+
end = fi + 1
|
|
97
|
+
return ci, end
|
|
98
|
+
stripped = line.strip()
|
|
99
|
+
if stripped and set(stripped) == {INPUT_BORDER}:
|
|
100
|
+
borders += 1
|
|
101
|
+
if borders > 1:
|
|
102
|
+
break
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
|
|
64
106
|
def input_box_region_from_lines(lines: list[str]) -> list[str] | None:
|
|
65
|
-
"""The input-box/dialog region
|
|
66
|
-
|
|
107
|
+
"""The input-box/dialog region.
|
|
108
|
+
|
|
109
|
+
A live selection prompt anchors on its footer: option cursor through
|
|
110
|
+
the footer line (``_selection_anchor``). Otherwise the region is the
|
|
111
|
+
last ``❯``-prefixed line through the next line consisting solely of
|
|
112
|
+
the border glyph (None when no ``❯``).
|
|
67
113
|
|
|
68
114
|
Scrollback is never part of the region, so a quoted footer above the
|
|
69
|
-
box cannot strand ASK
|
|
70
|
-
cursor is the ``❯`` line and the footer sits inside the region.
|
|
115
|
+
box cannot strand ASK.
|
|
71
116
|
"""
|
|
117
|
+
anchor = _selection_anchor(lines)
|
|
118
|
+
if anchor is not None:
|
|
119
|
+
start, fi = anchor
|
|
120
|
+
return lines[start:fi + 1]
|
|
72
121
|
start = None
|
|
73
122
|
for i, line in enumerate(lines):
|
|
74
123
|
if line.lstrip().startswith("❯"):
|
|
@@ -90,7 +90,18 @@ def _default_frontmost_tty():
|
|
|
90
90
|
the only reliable "the user is looking at this tab" signal. A
|
|
91
91
|
non-iTerm2 context yields None, so the reply blink self-fades after
|
|
92
92
|
``_reply_fade`` seconds instead of hanging on never-arriving focus.
|
|
93
|
+
|
|
94
|
+
Issue #62: iTerm2 answers the tty query even while BACKGROUNDED (it
|
|
95
|
+
keeps a "current window"), so the raw query kept returning the last
|
|
96
|
+
session tty and ``FocusWatcher`` dwelled the user away into a false
|
|
97
|
+
"read" - killing the tab blink and cancelling the Dock bounce while
|
|
98
|
+
the user sat in another app. Gate on the frontmost app first (the
|
|
99
|
+
issue #61 probe): any other app means no tty. An unreadable app name
|
|
100
|
+
falls through to the raw query (no-info degrade, pre-#62 path).
|
|
93
101
|
"""
|
|
102
|
+
app = _default_frontmost_app()
|
|
103
|
+
if app is not None and app not in blink.AppBounce.TERMINAL_APPS:
|
|
104
|
+
return None
|
|
94
105
|
try:
|
|
95
106
|
r = subprocess.run(
|
|
96
107
|
["osascript", "-e",
|
|
@@ -509,11 +509,25 @@ def cmd_progress_pane(args: argparse.Namespace) -> int:
|
|
|
509
509
|
on the next render.
|
|
510
510
|
"""
|
|
511
511
|
win = args.window_id or progress_pane.resolve_window_id()
|
|
512
|
+
# issue #63: the animator polls this session's ledger for the
|
|
513
|
+
# unconsumed needs_human reason (the mode-0 blink_watch poller never
|
|
514
|
+
# spawns in mode 1). Resolve the live session exactly the way
|
|
515
|
+
# cmd_signal resolves it, so writer and reader can never diverge;
|
|
516
|
+
# unresolvable = no poll (pre-#63 behavior).
|
|
517
|
+
sdir = None
|
|
518
|
+
try:
|
|
519
|
+
root = project.resolve_root(Path.cwd())
|
|
520
|
+
key = project.project_key_for_root(root)
|
|
521
|
+
rec, _ = _resolve_session(root, key)
|
|
522
|
+
if rec is not None:
|
|
523
|
+
sdir = str(paths.session_dir(key, int(rec["nnn"])))
|
|
524
|
+
except Exception:
|
|
525
|
+
sdir = None
|
|
512
526
|
# focus dwell (user directive 2026-11-07): real iTerm2 frontmost tty
|
|
513
527
|
# probe; None off-iTerm2 (the watcher then disables dwell itself)
|
|
514
528
|
# app-background re-fire (issue #61): frontmost app name probe for
|
|
515
529
|
# the Dock bounce re-write
|
|
516
|
-
progress_pane.run_animator(window_id=win,
|
|
530
|
+
progress_pane.run_animator(window_id=win, session_dir=sdir,
|
|
517
531
|
_frontmost_tty=blink_watch._default_frontmost_tty,
|
|
518
532
|
_frontmost_app=blink_watch._default_frontmost_app)
|
|
519
533
|
return 0
|
|
@@ -496,7 +496,9 @@ def run_animator(window_id: str | None = None, *, _frames=None,
|
|
|
496
496
|
_dwell_ticks=3, _focus_log=blink._debug_line,
|
|
497
497
|
_build_stamp=None, _build_poll=20,
|
|
498
498
|
_restart=None, _reply_flag_read=None,
|
|
499
|
-
_reply_flag_clear=None, _reply_pending=None
|
|
499
|
+
_reply_flag_clear=None, _reply_pending=None,
|
|
500
|
+
session_dir: str | None = None,
|
|
501
|
+
_blocked_reason=None) -> None:
|
|
500
502
|
"""Animate the progress line at ~20 fps until any I/O fails.
|
|
501
503
|
|
|
502
504
|
Each frame is ``\\x1b[H\\x1b[2K`` + a full-width ``_frame``
|
|
@@ -668,6 +670,19 @@ def run_animator(window_id: str | None = None, *, _frames=None,
|
|
|
668
670
|
reply_read = (_reply_pending if _reply_pending is not None
|
|
669
671
|
else (lambda sd, settle, now_: ledger.reply_pending(
|
|
670
672
|
sd, settle=settle, now=now_)))
|
|
673
|
+
# needs_human self-poll (issue #63, live bug 2026-11-12): mode 1 never
|
|
674
|
+
# spawns the blink_watch poller (spawn skips mode 1 - "the animator
|
|
675
|
+
# owns the blink"), and CC never re-renders the status line while it
|
|
676
|
+
# waits, so an out-of-band ``cc-continuity signal needs-human`` landed
|
|
677
|
+
# in the ledger invisible: the chip only appears via a status-line
|
|
678
|
+
# render, and no render comes in the idle gap. The blink poll consults
|
|
679
|
+
# the ledger's unconsumed needs_human reason directly (same single
|
|
680
|
+
# truth the poller uses) and injects MARKER_BLOCKED into both the
|
|
681
|
+
# painted frame and the gate; dwell/read semantics ride the existing
|
|
682
|
+
# FocusWatcher path. No session_dir (or a raising read) = no source.
|
|
683
|
+
blocked_read = (_blocked_reason if _blocked_reason is not None
|
|
684
|
+
else (lambda sd: ledger.blocked_reason(sd)))
|
|
685
|
+
blocked_reason = ""
|
|
671
686
|
_KEEP_REPLY = object() # ledger unreadable this poll: change nothing
|
|
672
687
|
_HOLD_REPLY = object() # reply too young: keep the flag, stay dark
|
|
673
688
|
reply_live = False
|
|
@@ -764,9 +779,21 @@ def run_animator(window_id: str | None = None, *, _frames=None,
|
|
|
764
779
|
else:
|
|
765
780
|
reply_live = True
|
|
766
781
|
reply_id = repr(r)
|
|
782
|
+
if session_dir:
|
|
783
|
+
try:
|
|
784
|
+
rsn = blocked_read(session_dir)
|
|
785
|
+
except Exception:
|
|
786
|
+
rsn = None
|
|
787
|
+
blocked_reason = rsn or ""
|
|
788
|
+
else:
|
|
789
|
+
blocked_reason = ""
|
|
767
790
|
paint_text = cur_text
|
|
768
791
|
if reply_live and blink.MARKER_REPLY not in (paint_text or ""):
|
|
769
792
|
paint_text = (paint_text or "") + " " + blink.MARKER_REPLY
|
|
793
|
+
if (blocked_reason and blink.MARKER_BLOCKED
|
|
794
|
+
not in (paint_text or "")):
|
|
795
|
+
paint_text = ((paint_text or "") + " "
|
|
796
|
+
+ blink.MARKER_BLOCKED)
|
|
770
797
|
# gate-stable key over both gate sources: what re-arms
|
|
771
798
|
# the blink is WHICH markers are painted and whether a
|
|
772
799
|
# dialog is present, never the raw text. Raw text would
|
|
@@ -781,9 +808,13 @@ def run_animator(window_id: str | None = None, *, _frames=None,
|
|
|
781
808
|
# identical markers; the ts never churns for the same
|
|
782
809
|
# reply, so the dwell-stability intent of the
|
|
783
810
|
# gate-stable key survives.
|
|
811
|
+
# issue #63: the unconsumed needs_human reason ("" when
|
|
812
|
+
# none) rides the key exactly like reply_id - a new
|
|
813
|
+
# block under identical markers reads as fresh unread.
|
|
784
814
|
src = "|".join(repr(p) for p in (gate,
|
|
785
815
|
pane_text is not None,
|
|
786
|
-
reply_id
|
|
816
|
+
reply_id,
|
|
817
|
+
blocked_reason) if p)
|
|
787
818
|
try:
|
|
788
819
|
suppressed = watcher.tick(t, src)
|
|
789
820
|
except Exception:
|
|
@@ -799,6 +830,10 @@ def run_animator(window_id: str | None = None, *, _frames=None,
|
|
|
799
830
|
paint_text = cur_text
|
|
800
831
|
if reply_live and blink.MARKER_REPLY not in (paint_text or ""):
|
|
801
832
|
paint_text = (paint_text or "") + " " + blink.MARKER_REPLY
|
|
833
|
+
if (blocked_reason and blink.MARKER_BLOCKED
|
|
834
|
+
not in (paint_text or "")):
|
|
835
|
+
paint_text = ((paint_text or "") + " "
|
|
836
|
+
+ blink.MARKER_BLOCKED)
|
|
802
837
|
if suppressed:
|
|
803
838
|
# hold the suppression across the frames between polls:
|
|
804
839
|
# re-feeding the gated text every frame would re-start
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cc-continuity"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.30"
|
|
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)
|
|
@@ -590,6 +590,62 @@ def test_input_box_region_none_without_prompt_marker():
|
|
|
590
590
|
assert blink.input_box_region_from_lines(["plain text", _BORDER]) is None
|
|
591
591
|
|
|
592
592
|
|
|
593
|
+
# issue #62 live repro (2026-11-12, connector pane): a selection prompt is
|
|
594
|
+
# on screen while the input box holds a draft. CC closes the option box
|
|
595
|
+
# with a border line BEFORE the footer, and the draft line (an indented
|
|
596
|
+
# option cursor) sits below the footer, so the old last-❯ anchor lands on
|
|
597
|
+
# the input box and the prompt vanishes from the region (ask_visible goes
|
|
598
|
+
# blind and the blink never gates). Byte shape from the live capture.
|
|
599
|
+
_SELECTION_WITH_DRAFT_LINES = [
|
|
600
|
+
" Q-0 seed",
|
|
601
|
+
_BORDER,
|
|
602
|
+
"Shorter halves wall time but the measurement gets noisier.",
|
|
603
|
+
"❯ 1. keep 4 seeds (Recommended)",
|
|
604
|
+
" Locked protocol stays intact, stronger proof.",
|
|
605
|
+
" 2. drop to 2 seeds",
|
|
606
|
+
" 480 jobs total, needs a judge note.",
|
|
607
|
+
" 3. Stop, discuss tomorrow",
|
|
608
|
+
" 4. Type something.",
|
|
609
|
+
"",
|
|
610
|
+
" 5. Chat about this",
|
|
611
|
+
"",
|
|
612
|
+
_BORDER,
|
|
613
|
+
"Enter to select · ↑/↓ to navigate · Esc to cancel",
|
|
614
|
+
"",
|
|
615
|
+
" ❯ + where is the GPU here, walk me through v1 vs v2",
|
|
616
|
+
"",
|
|
617
|
+
_BORDER,
|
|
618
|
+
]
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def test_input_box_region_anchors_prompt_above_input_draft():
|
|
622
|
+
# issue #62: with a draft in the input box the whole option box and
|
|
623
|
+
# the footer sat outside the old last-❯ region; the prompt must still
|
|
624
|
+
# gate, the draft must stay out, scrollback must stay out.
|
|
625
|
+
lines = ["chat above the box"] + _SELECTION_WITH_DRAFT_LINES
|
|
626
|
+
region = blink.input_box_region_from_lines(lines)
|
|
627
|
+
assert region is not None
|
|
628
|
+
assert region[0] == "❯ 1. keep 4 seeds (Recommended)"
|
|
629
|
+
assert "Enter to select · ↑/↓ to navigate · Esc to cancel" in region
|
|
630
|
+
assert " ❯ + where is the GPU here, walk me through v1 vs v2" \
|
|
631
|
+
not in region
|
|
632
|
+
assert "chat above the box" not in region
|
|
633
|
+
assert blink.ask_visible("\n".join(region)) is True
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
def test_input_box_region_draft_only_quoted_footer_still_blind():
|
|
637
|
+
# the 014 protection survives: a footer quoted in chat above the input
|
|
638
|
+
# box (no live option cursor directly above it) must not strand ASK.
|
|
639
|
+
lines = ["agent: press Enter to select · Esc to cancel when ready",
|
|
640
|
+
"more chat above the box",
|
|
641
|
+
" ❯ ",
|
|
642
|
+
_BORDER,
|
|
643
|
+
"junk below"]
|
|
644
|
+
region = blink.input_box_region_from_lines(lines)
|
|
645
|
+
assert region == [" ❯ ", _BORDER]
|
|
646
|
+
assert blink.ask_visible("\n".join(region)) is False
|
|
647
|
+
|
|
648
|
+
|
|
593
649
|
def test_blinker_starts_on_pane_dialog_without_data_marker():
|
|
594
650
|
r = ScriptRunner(["conn-tab", "/dev/ttys001"])
|
|
595
651
|
tty = FakeTTY()
|
|
@@ -634,3 +634,50 @@ def test_watch_app_background_steady_never_refires(cc_home, monkeypatch):
|
|
|
634
634
|
# background): nothing is re-written - and holding in the background
|
|
635
635
|
# never spams either.
|
|
636
636
|
assert fake.made[0].rearms == 0
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
# --------------------------------------------------- frontmost-tty gating
|
|
640
|
+
#
|
|
641
|
+
# Issue #62: iTerm2 answers the "tty of current session of current
|
|
642
|
+
# window" query even while BACKGROUNDED, so the raw query kept returning
|
|
643
|
+
# a stale tty and FocusWatcher dwelled the user away into a false "read"
|
|
644
|
+
# (blink and bounce killed while the user was in another app). The probe
|
|
645
|
+
# must gate on the frontmost app first; an unreadable app name keeps the
|
|
646
|
+
# pre-#62 no-info degrade.
|
|
647
|
+
|
|
648
|
+
_REAL_FRONTMOST_TTY = blink_watch._default_frontmost_tty
|
|
649
|
+
# Captured at import, before the autouse _no_real_focus_probe fixture
|
|
650
|
+
# wraps the module attribute: these unit tests exercise the REAL probe
|
|
651
|
+
# against a faked subprocess.run (the poller-level seam pinning stays).
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def _fake_osascript(monkeypatch, *, app_out=None, app_fail=False,
|
|
655
|
+
tty_out=None):
|
|
656
|
+
def run(argv, **kw):
|
|
657
|
+
# the real probes run subprocess with text=True: stdout is str
|
|
658
|
+
joined = " ".join(argv)
|
|
659
|
+
if "frontmost is true" in joined:
|
|
660
|
+
if app_fail:
|
|
661
|
+
raise OSError("osascript unreadable")
|
|
662
|
+
return subprocess.CompletedProcess(argv, 0, app_out or "", "")
|
|
663
|
+
return subprocess.CompletedProcess(argv, 0, tty_out or "", "")
|
|
664
|
+
monkeypatch.setattr(blink_watch.subprocess, "run", run)
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
def test_frontmost_tty_none_when_another_app_is_frontmost(monkeypatch):
|
|
668
|
+
_fake_osascript(monkeypatch, app_out="Vivaldi\n",
|
|
669
|
+
tty_out="/dev/ttys002\n")
|
|
670
|
+
assert _REAL_FRONTMOST_TTY() is None
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
def test_frontmost_tty_returns_tty_when_iterm_frontmost(monkeypatch):
|
|
674
|
+
_fake_osascript(monkeypatch, app_out="iTerm2\n",
|
|
675
|
+
tty_out="/dev/ttys002\n")
|
|
676
|
+
assert _REAL_FRONTMOST_TTY() == "/dev/ttys002"
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
def test_frontmost_tty_falls_through_when_app_unreadable(monkeypatch):
|
|
680
|
+
# no-info about the frontmost app must NOT invent a suppression:
|
|
681
|
+
# the raw tty query still answers (pre-#62 degrade path).
|
|
682
|
+
_fake_osascript(monkeypatch, app_fail=True, tty_out="/dev/ttys001\n")
|
|
683
|
+
assert _REAL_FRONTMOST_TTY() == "/dev/ttys001"
|
|
@@ -652,6 +652,99 @@ def test_animator_reply_gate_key_carries_reply_ts(cc_home, monkeypatch):
|
|
|
652
652
|
assert any("200.0" in k for k in keys) # second reply: fresh key
|
|
653
653
|
|
|
654
654
|
|
|
655
|
+
def test_animator_injects_blocked_chip_from_ledger(cc_home, monkeypatch):
|
|
656
|
+
# Issue #63 (live 2026-11-12 scripted probe): mode 1 never spawns the
|
|
657
|
+
# blink-watch poller ("the animator owns the blink") and the animator
|
|
658
|
+
# never polled ``ledger.blocked_reason`` - an out-of-band
|
|
659
|
+
# ``signal needs-human`` arriving in the idle gap (CC does not invoke
|
|
660
|
+
# the status line while it waits) was recorded in the ledger yet
|
|
661
|
+
# stayed invisible: no chip, no tab blink, no Dock bounce. The blink
|
|
662
|
+
# poll must treat an unconsumed needs_human as a chip source the way
|
|
663
|
+
# the reply flag already does.
|
|
664
|
+
monkeypatch.delenv("TMUX_PANE", raising=False)
|
|
665
|
+
fake = _FakeBlinkMod()
|
|
666
|
+
written = []
|
|
667
|
+
seen = []
|
|
668
|
+
|
|
669
|
+
def blocked(sd):
|
|
670
|
+
seen.append(sd)
|
|
671
|
+
return "insan lazim"
|
|
672
|
+
|
|
673
|
+
progress_pane.run_animator(
|
|
674
|
+
"12", _frames=25, _write=written.append, _now=lambda: 0.0,
|
|
675
|
+
_size=lambda: _size_obj(40), _text=lambda: "◆ 9% ok",
|
|
676
|
+
_mtime=lambda: 1, _sleep=lambda s: None, _blink=fake,
|
|
677
|
+
session_dir="SD", _blocked_reason=blocked)
|
|
678
|
+
assert seen and seen[0] == "SD"
|
|
679
|
+
assert "⛔ BLOCKED" in _visible(written[-1].decode("utf-8"))
|
|
680
|
+
# the blinker gate saw the marker too (tab blink + Dock bounce source)
|
|
681
|
+
assert any("⛔ BLOCKED" in t for t, _ts, _p in fake.made[0].texts)
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
def test_animator_blocked_gate_key_carries_reason(cc_home, monkeypatch):
|
|
685
|
+
# A SECOND needs_human with identical markers must read as genuinely
|
|
686
|
+
# unread: the reason rides on the watcher key (mirroring reply_id).
|
|
687
|
+
# Without it the stored blink-<win>-read would swallow every later
|
|
688
|
+
# block - the same live-bug pattern that reply_id fixed on 2026-11-08.
|
|
689
|
+
monkeypatch.delenv("TMUX_PANE", raising=False)
|
|
690
|
+
monkeypatch.setattr(progress_pane.blink, "list_client_ttys",
|
|
691
|
+
lambda *a, **k: {"/dev/ttys001"})
|
|
692
|
+
fake = _FakeBlinkMod()
|
|
693
|
+
written = []
|
|
694
|
+
lines = []
|
|
695
|
+
box = ["A"]
|
|
696
|
+
state = {"n": 0}
|
|
697
|
+
|
|
698
|
+
def clock():
|
|
699
|
+
state["n"] += 1
|
|
700
|
+
if state["n"] == 41:
|
|
701
|
+
box[0] = "B"
|
|
702
|
+
return 116.0 if state["n"] <= 40 else 216.0
|
|
703
|
+
|
|
704
|
+
progress_pane.run_animator(
|
|
705
|
+
"12", _frames=50, _write=written.append, _now=clock,
|
|
706
|
+
_size=lambda: _size_obj(40), _text=lambda: "◆ 9% ok",
|
|
707
|
+
_mtime=lambda: 1, _sleep=lambda s: None, _blink=fake,
|
|
708
|
+
_frontmost_tty=lambda: "/dev/ttys001", _dwell_ticks=1,
|
|
709
|
+
_focus_log=lines.append,
|
|
710
|
+
session_dir="SD", _blocked_reason=lambda sd: box[0])
|
|
711
|
+
keys = [ln.split("key=", 1)[1] for ln in lines if "key=" in ln]
|
|
712
|
+
assert any("'A'" in k for k in keys)
|
|
713
|
+
assert any("'B'" in k for k in keys)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
def test_animator_blocked_absent_no_marker(cc_home, monkeypatch):
|
|
717
|
+
monkeypatch.delenv("TMUX_PANE", raising=False)
|
|
718
|
+
fake = _FakeBlinkMod()
|
|
719
|
+
written = []
|
|
720
|
+
called = []
|
|
721
|
+
progress_pane.run_animator(
|
|
722
|
+
"12", _frames=25, _write=written.append, _now=lambda: 0.0,
|
|
723
|
+
_size=lambda: _size_obj(40), _text=lambda: "◆ 9% ok",
|
|
724
|
+
_mtime=lambda: 1, _sleep=lambda s: None, _blink=fake,
|
|
725
|
+
session_dir="SD",
|
|
726
|
+
_blocked_reason=lambda sd: called.append(sd) or None)
|
|
727
|
+
assert called
|
|
728
|
+
assert "⛔ BLOCKED" not in _visible(written[-1].decode("utf-8"))
|
|
729
|
+
assert all("⛔ BLOCKED" not in t for t, _ts, _p in fake.made[0].texts)
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def test_animator_without_session_dir_skips_blocked(cc_home, monkeypatch):
|
|
733
|
+
# Off-project panes (or unresolvable sessions) read nothing: the
|
|
734
|
+
# seam is never invoked and the frame matches the pre-#63 behavior.
|
|
735
|
+
monkeypatch.delenv("TMUX_PANE", raising=False)
|
|
736
|
+
fake = _FakeBlinkMod()
|
|
737
|
+
written = []
|
|
738
|
+
called = []
|
|
739
|
+
progress_pane.run_animator(
|
|
740
|
+
"12", _frames=25, _write=written.append, _now=lambda: 0.0,
|
|
741
|
+
_size=lambda: _size_obj(40), _text=lambda: "◆ 9% ok",
|
|
742
|
+
_mtime=lambda: 1, _sleep=lambda s: None, _blink=fake,
|
|
743
|
+
_blocked_reason=lambda sd: called.append(sd) or "neden")
|
|
744
|
+
assert not called
|
|
745
|
+
assert "⛔ BLOCKED" not in _visible(written[-1].decode("utf-8"))
|
|
746
|
+
|
|
747
|
+
|
|
655
748
|
def test_animator_no_flag_no_marker(cc_home, monkeypatch):
|
|
656
749
|
# No flag armed (default reader finds nothing): behavior is exactly
|
|
657
750
|
# the pre-flag animator - zero clear calls, zero markers.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|