ccdialog

package
v0.104.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ccdialog reads a Claude Code pane's screen for a dialog that keys typed into the pane would ANSWER rather than reach the model: a permission prompt, the AskUserQuestion picker, any numbered select menu.

It is the one copy of that reading. ccd checks it before each of its own keys (cmd/ccd/dialog.go), and muster-mirror checks it before it pastes a message into a mirrored Claude Code pane (internal/mirrorhost, the Claude prompt guard). It was ccd's (#163) and moved here unchanged when the mirror host needed the same check.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InputBox

func InputBox(capture string) (text string, found bool)

InputBox is what Claude Code's input box holds on capture, and whether the box was found at all. The CLI draws the box between the screen's LAST TWO horizontal rules, its first row starting with the prompt mark `❯`; the status line is under the second rule. text is the box's rows with the mark and the padding trimmed, joined by newlines: "" for an empty box.

found is false when the bottom of the screen is not that shape — fewer than two rules, nothing between them, or a first row that is not the prompt — and a caller that needs the box empty refuses on it: an unreadable box is not presumed empty. Call OnScreen first: a dialog replaces the box.

🔴 A GHOST SUGGESTION IS AN EMPTY BOX. At an empty prompt Claude Code may draw a suggestion in the box (`Try "…"` in a fresh session, a suggested next prompt after a turn), DIM: `❯\u00a0` then the suggestion in SGR 2 (`\e[2m…\e[0m`, one run, or a run per word with plain spaces between). Typing replaces it; nothing of it is submitted unless accepted with Tab or →, which muster never sends (a bracketed paste over it, muster's paste, replaced it and Enter submitted only the paste, on the real 2.1.289). So with capture-pane -e a box whose every non-blank character is dim reads "". Only then: a box holding ANY character not drawn dim is read whole, dim characters included, as text — a draft is never taken for a suggestion because part of it is dim. Without -e no style can be seen, and a suggestion reads as text (the box is refused as held).

Read against the real CLI (cmd/ccd/testdata/pane_*_2.1.296.txt): the empty prompt `❯ ` at idle, and `❯ ❯ 1. Yes` / `❯ [Pasted text #1 +4 lines]` with text in the box; the ghost suggestion as 2.1.289's panes draw it (testdata/pane_*_ghost*.ansi, synthetic text in that escape form).

func IsRule

func IsRule(line string) bool

IsRule reports whether line is one of the CLI's horizontal rules (a run of U+2500 box-drawing characters, as above and below its input box).

func OnScreen

func OnScreen(capture string) (what string, shown bool)

OnScreen reports whether capture (tmux capture-pane -p -J of the CLI's pane, with or without -e) shows a dialog that keys typed into the pane would answer, and which.

🔴 A FALSE "YES" WEDGES THE SENDER, SO ONLY THE BOTTOM OF THE SCREEN COUNTS. Every paste is refused while this answers true, and an idle screen does not change by itself: text that merely LOOKS like a dialog — model output quoting a picker's "Review your answers" / "Submit answers" or a permission prompt's "❯ 1. Yes" and "Esc to cancel", or such text sitting in the input box — would refuse every send for as long as it is on screen. (ccd's first version ran askdrive.Parse and kept its Unknown kind, a guess from those words ANYWHERE on the screen; a transcript quoting them wedged an idle prompt.) At its prompt the CLI draws the input box between two rules with its status line under the second, so the transcript and the box are never at the bottom, nor below the last rule. What is recognised:

  • the AskUserQuestion picker, by askdrive.Parse's STRUCTURAL kinds only (Question, Review, Clipped), each anchored to the bottom of the screen: its footer among the last three lines, or its review screen's Submit/Cancel rows as the last two. Not Unknown. (Not "below the last rule" either: the picker draws a rule of its own between its options and "Chat about this".)
  • below the screen's LAST horizontal rule: a numbered select menu's cursor on an option ("❯ 1. Yes"), or the permission prompt's footer ("Esc to cancel · Tab to amend …") as one of the last three lines. The permission prompt replaces the input box and draws a rule as its top border, so it is below the last one.

Read against captures of the real CLI: 2.1.296 at its prompt, at a Bash permission prompt, and at its prompt with those words in the transcript and in the input box (cmd/ccd/testdata/pane_*_2.1.296.txt); and 2.1.289's permission prompt, pickers and finished turns (internal/askdrive/testdata).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL