Main entry point and loop.
Build the plain-text output for the --version CLI flag.
Includes the CLI and SDK versions and any installed optional dependencies. For editable installs it also reports the source path and the resolved versions of the core LangChain-ecosystem dependencies.
Reports the same version facts as the /version slash command, in the
same section order (versions, editable path, core dependencies, optional
dependencies), but omits its network-dependent release-age suffixes and
update-available hint so --version stays offline.
Check if optional dependencies are installed.
Check for recommended external tools and return missing tool names.
Skips tools that the user has suppressed via
[warnings].suppress in config.toml.
Build a PendingNotification for a missing optional tool.
The returned entry carries the install hint (or URL) in a typed payload so the notification center action handler can copy it / open it without re-running platform detection.
Format a missing-tool warning for non-interactive console output.
Parse command line arguments.
Run the Textual TUI interface (async version).
Starts a LangGraph server in a subprocess and connects the TUI to it via the
langgraph-sdk client.
Read piped stdin and merge it into the parsed CLI arguments.
When stdin is not a TTY (i.e. input is piped), reads all available text
and applies it to the argument namespace. If stdin is a TTY or the piped
input is empty/whitespace-only, the function returns without modifying
args. Leading and trailing whitespace is stripped from piped input.
non_interactive_message is already set (-n), prepends the
piped text to it (the CLI still runs non-interactively):cat context.txt | dcode -n "summarize this"
# non_interactive_message = "{contents of context.txt}\n\nsummarize this"
initial_prompt is already set (-m, but not -n), prepends
the piped text to it (the CLI still runs interactively):cat error.log | dcode -m "explain this"
# initial_prompt = "{contents of error.log}\n\nexplain this"
initial_skill is already set (--skill, but not -n/-m) and the
pipe was auto-detected (no explicit --stdin), stores the piped text in
initial_prompt so the skill receives it as the seed for the
interactive TUI:cat diff.txt | dcode --skill code-review
# initial_prompt = "{contents of diff.txt}"
When --stdin is passed explicitly, this convenience is skipped: the
piped text falls through to non_interactive_message so the skill runs
headless (see below):
cat diff.txt | dcode --skill code-review --stdin
# non_interactive_message = "{contents of diff.txt}"
non_interactive_message to the piped text, causing
the CLI to run non-interactively with it as the prompt:echo "fix the typo in README.md" | dcode
# non_interactive_message = "fix the typo in README.md"Entry point for console script.
Result from running the Textual application.
Tool-approval policy selected for an interactive thread.
Character glyphs for TUI display.
Decides whether project-scoped hooks may run in a given directory.
Trust is a property of the workspace, not of the session, so it must be re-resolved every time the working directory moves. A session that starts in a trusted project and later moves into an untrusted one must not carry the original grant forward.
Callers hand this policy to HooksManager, which resolves it on load and on
every reload; nothing upstream needs to hold or reinterpret the decision.
Metadata for a configured MCP server and its tools.
A project MCP server row shown to the user and gated for trust.
A NamedTuple (not a bare 3-tuple) so the three same-typed str slots get
field names — a name/kind swap can't type-check silently — while staying
tuple-compatible with existing unpacking and indexing.
A single notice waiting for user action.
Immutable value object: the registry owns the
key-to-toast-identity binding (see NotificationRegistry) so
external callers cannot corrupt click-routing indices by mutating
notifications after construction.