curl -LsSf https://langch.in/dcode | bash
# With model provider extras
# OpenAI, Anthropic, and Gemini are included by default
curl -LsSf https://langch.in/dcode | DEEPAGENTS_CODE_EXTRAS="nvidia,ollama" bash
Run:
dcode
The fastest way to start using Deep Agents. deepagents-code is a pre-built coding agent in your terminal โ similar to Claude Code or Cursor โ powered by any LLM that supports tool calling. One install command and you're up and running, no code required.
What deepagents-code adds on top of the SDK:
By default, dcode trusts the directory you run it in. Human-in-the-loop approval gates model-requested tool calls, but project artifacts are read before any approval prompt.
Do not run dcode in a directory you do not trust without a sandbox backend. For untrusted repositories, use a remote sandbox so execution is isolated from your machine. Running dcode in a directory lets that directory's files shape execution. See THREAT_MODEL.md for details.
See our Releases and Versioning policies.
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For local setup, see the Development Guide. For contribution policy, see the Contributing Guide.
This project was primarily inspired by Claude Code, and initially was largely an attempt to see what made Claude Code general purpose, and make it even more so.
Rubric state carrying dcode's private runtime model selections.
These three channels are declared a second time here, because this
middleware's state_schema must list every channel it reads. Each
a
Nested-grader state used to scope verification-tool budgets.
Run a context-aware nested grader with CLI verification middleware.
The nested grader receives Deep Agents Code's verification middleware and runtime context without requiring those application-speci
Classification that controls whether a command can skip the message queue.
A single slash-command definition.
A single autocomplete entry for the slash-command controller.
Represents a pasted image with its base64 encoding.
Represents a pasted video with its base64 encoding.
A persisted API key credential.
The type field is the discriminator that lets OAuthCredential (added
later) coexist in the same file without migration.
A persisted OAuth subscription credential.
Stub kept here so the StoredCredential discriminated union narrows
correctly today and the OAuth implementation lands as a pure addition.
No code path pro
Result of a credential write that may have warnings to surface.
Result of a credential delete that may have warnings to surface.
A delete rewrites the whole store, so it can hit the same chmod failures as
a write. warnings carries them symmetrically with `Write
Full configuration payload passed from the app to the server subprocess.
Serialized to/from DEEPAGENTS_CODE_SERVER_* environment variables so
that the server graph (which runs in a separate Python
Metadata for a custom subagent loaded from filesystem.
Why a provider stopped a reply early.
The model stopped before it gave any reply.
Subclasses ValueError so that the LangGraph server keeps the message when
it serializes the error for the client. Other exception types are redacted
to "
Fail the main run when the provider cut off a reply before any output.
Without this, a reply with no text, no tool calls, and a truncation stop reason ends the run as a success. The empty message is
Keep partial subagent answers and fail empty ones for the parent to handle.
Deterministic chat model for integration tests.
This subclasses _ToolBindingFakeModel (itself a GenericFakeChatModel) so
the implementation stays aligned with the core fake-chat-model test surfac
Deterministic tool-calling model for auto-approve integration tests.
Generation is driven entirely by prompt markers (the module-level DCA_*
constants), so output is restart-safe and independent of
Exercise nested criteria generation with a repository read.
Goal/rubric state channels shared by every schema that touches them.
Declared once here so each schema that carries these channels โ
ResumeState and goal_tools.GoalToolState โ inherits the same
Extends agent state with per-checkpoint facts restored on resume.
Inherits the shared goal/rubric channels from GoalRubricChannels and adds
the channels unique to resume: the after-model token/spec
Persists per-checkpoint resume facts after each model call.
See the module docstring for why this rides the model node's checkpoint
instead of a separate aupdate_state (avoids a standalone `UpdateS
Recover failed connections and preserve actionable login errors.
Structured log record retained by the in-memory debug buffer.
Logging handler retaining the most recent structured records in memory.
Retention is partitioned by level: each recognized level name (see
LOG_LEVELS) keeps its own bounded deque of capacity re
Capture effective main-call context and answer tool-free side questions.
Register after middleware that modifies the model, prompt, or settings,
including extensions. ConfigurableModelMiddleware re
Stored content for a collapsed paste.
The paste's numeric identifier is the key under which this record is stored in the input's paste map, so it is not duplicated on the record.
Canonical goal/rubric fields used for notices and fingerprints.
The three user-controlled text sections a goal-state notice can embed.
Named rather than a bare tuple[str | None, str | None, str | None]: all five
call sites unpack positionally and immediately re
Metadata extracted from a canonical goal-state notice.
Versioned, allowlisted policy snapshot persisted beside a binding.
One drifted policy field, reported within the snapshot allowlist.
Structured, secret-free detail attached to a workspace refusal.
Defer only currently exposed MCP tools on verified native endpoints.
JSON-safe workspace descriptor carried in LangGraph runtime context.
Server-authoritative workspace and resource policy for one thread.
A workspace claim or runtime conflicts with server resource policy.
Raised when the launch-time profile location cannot be resolved.
Covers an unsupported DEEPAGENTS_HOME value and a launch home that
cannot be determined or is itself unusable. It is a ValueError
Discriminator for ConfigResolutionError reasons.
Only NO_CONFIG_FOUND maps to exit code 2 in the mcp login CLI
handlers (run_mcp_login, run_mcp_login_list); all other kinds map to
exit code
Structured error returned when a login target cannot be resolved.
Successful resolution of a merged MCP config for login.
Resolved server config plus enough context for error messages.
ACP server that supplies trusted classifier context in Auto mode.
The one-per-process result with named slots to prevent transposition.
Suppress native stderr writes while the TUI owns the terminal.
Displayable model capabilities with override provenance.
Provider presentation and readiness, without credential values.
Validated catalog from the environment that constructs models.
A dangerous Unicode character found in text.
Safety analysis output for a URL string.
A result may have safe=True with non-empty warnings when
informational warnings (e.g. punycode decoding) are present without
suspicious patterns.
Stable identifiers for notification actions dispatched by the app.
One button/action row in the notification modal.
Typed payload for a missing-dependency notification.
Typed payload for an update-available notification.
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 indi
In-memory store of pending notifications.
Instance-scoped (one per app) so test apps don't pollute each other. Owns the bidirectional key-to-toast-identity binding so callers cannot accidentally desy
Resolved model properties needed by the interactive client.
Line counts for a change, named so the pair cannot be swapped silently.
Keyword-only and frozen so that claim holds at construction as well as in transit: a positional pair is exactly the transpositi
Declared context_schema for the agent graph.
Registered via context_schema= when the graph is built, so LangGraph
coerces each run's context= payload into this dataclass โ in-process,
`runtime.
Client-facing builder for the per-run graph context payload.
Callers populate this and pass it via context= to astream/ainvoke.
ConfigurableModelMiddleware and the interrupt_on when predi
Explicit user/project path context for project-sensitive behavior.
Middleware that provides an ask_user tool for interactive questioning.
This middleware adds an ask_user tool that allows agents to ask the user
questions during execution. Questions can be free-for
A known reason to skip a cache prompt, distinct from missing pricing.
A cache-using request's start time and effective cache identity.
Prompt-cache behavior needed to decide and price a warning.
Keyword-only because window_seconds and minimum_tokens are adjacent
bare ints: positionally, transposing them builds a plausible-lookin
Estimated input cost for a cold prefix and its warm-cache delta.
Both figures are USD, non-negative, and finite; incremental_cost_usd is
the part of cold_cost_usd that a cache hit would have avoi
Validated data needed to render one advisory warning.
Constructed only after every gate has passed -- a policy resolved, the prefix cleared the provider's cache minimum, and the priced delta reached
Validate shell commands against an allow-list without HITL interrupts.
When the agent invokes the execute shell tool, this middleware checks
the command against the configured allow-list **before e
Stock HITL routing with an async live-mode read after model completion.
The transient routing marker is added only to a shallow state copy passed directly into stock HITL routing. It is neither check
Apply secret rules per string and remember the result in a bounded LRU.
The output for a string is the same whether it comes from the cache or from the rules, so the cache cannot let a secret through
Raised when an external editor cannot be opened or read.
Paths whose contents belong to one user profile and trust root.
Paths owned by the installed tool rather than a selected profile.
Project-controlled paths derived from an explicit repository root.
Frozen launch-time profile and installation paths.
Whether a probed path exists, is absent, or could not be read.
A StrEnum so the value serializes directly to JSON without a custom
encoder.
Observe backend work and backfill only the initiating user turn.
Goal/rubric text exceeds a model-visible context budget.
Keep sibling invocation roots alive until the thread starts another turn.
State for local context middleware.
Inject local context (git state, project structure, etc.) into the system prompt.
Runs a bash detection script via backend.execute() on first interaction
and stores that snapshot for stable system-
Repository identity and opaque non-content evidence of checkout work.
One component in the context audit.
Structured context audit ready for presentation.
Local directory or JSON file used as a marketplace source.
GitHub or Git repository used as a marketplace source.
ref selects an optional branch or tag. Commit SHA checkout is not part of
the shallow-clone flow.
Marketplace manifest downloaded from an HTTP URL.
Parsed plugin manifest.
Inventory of supported plugin components.
unsupported lists plugin component directories that deepagents-code does
not load (e.g. agents/, commands/).
A discovered plugin ready to feed dcode adapters.
A plugin stored relative to its marketplace.
A plugin sourced from a GitHub repository.
A plugin sourced from a subdirectory in a Git repository.
A plugin sourced from a Git repository URL.
A catalog entry from a marketplace manifest.
A parsed marketplace manifest.
Persisted marketplace source record.
Install record for a plugin.
version is the value declared by the plugin manifest, if any.
An enabled, registered plugin whose installed files are missing.
Result from plugin discovery.
broken lists enabled plugins whose installed files are missing. They are
reported separately from warnings so callers can present them once with
repair guidance inst
A marketplace plugin version that differs from the installed one.
Outcome of checking installed plugins against their marketplaces.
Raised when a marketplace cannot be loaded.
Configuration for a single config-declared sandbox provider.
Setting class_path executes arbitrary Python code imported from the
user's config file. This has the same trust mod
Parsed [sandboxes] configuration from config.toml.
Instances are immutable once constructed; providers is wrapped in a
MappingProxyType to prevent accidental mutation.
How to install the package that provides a sandbox backend.
Built-in providers ship as deepagents-code extras (kind="extra");
third-party providers install as arbitrary packages (kind="package"
Static description of a sandbox provider used by the registry.
Lets the CLI and registry describe built-in and config providers without instantiating them (which may require credentials or optional d
Base error for sandbox provider operations.
Raised when the requested sandbox cannot be found.
Interface for creating and deleting sandbox backends.
Snapshot of the ChatGPT OAuth login state.
Raised when the user cancels a sign-in flow mid-callback wait.
Raised when a stored ChatGPT token cannot be refreshed.
Distinct from a missing token (FileNotFoundError): a token exists on
disk but its refresh token was revoked or expired, so an automatic
refre
UI hooks for the browser loopback sign-in flow.
Implementations decide how to surface the authorize URL and whether to auto-open a browser. The Textual screen subclasses this; CLI / headless callers
Merged view of built-in, entry-point, and config sandbox providers.
Live client identity projected into every hook invocation.
Result of a lifecycle hook that may halt the caller.
Result of UserPromptSubmit, including its prompt rewrites.
Owns the Hooks v2 runtime, presenter, hook service, and transcripts.
The presenter is the manager's, not the runtime's: one instance is created once and handed to every runtime the manager loads, so
Adapt hook invocations and handler output across the wire boundary.
Raised when a client-owned hook stops lifecycle processing.
Client state required to create a domain hook invocation.
Execute client-owned events and apply their common side effects.
User-facing output goes through the runtime's presenter, which the owning
HooksManager also holds. The service never wraps or replac
Client approval decision compatible with HITL resume payloads.
Normalized result shared by TUI and headless permission handling.
How one batch of gated tool calls was resolved by hooks.
Indices refer to positions in the originating action_requests list, so a
caller can line outcomes back up with its own UI rows.
Client-only materialization needed to build one hook wire envelope.
Client-owned session runtime around an immutable Hooks snapshot.
Owns configuration snapshot identity, transcript materialization, and the
HookEngine. Server-owned lifecycle events reach this runti
One ordered command handler in a configuration snapshot.
Matched handlers for one invocation.
Immutable, declaration-ordered Hooks v2 runtime configuration.
Execute Hooks v2 invocations against one immutable snapshot.
Origin of the matcher groups contributed by one hooks document.
A project or user hooks file, which defines no variables.
Origin and environment for groups one enabled plugin contributed.
Validated configuration plus load diagnostics and source paths.
Deduplicate hook fulfillment for one client session.
Request sent for a server-owned hook invocation.
Response returned for a server-owned hook invocation.
Configuration for a synchronous command hook.
Currently only type: "command" is supported. Additional handler types
remain a discriminated-union extension point and are rejected until
implemented.
A matcher and its ordered hook handlers.
Top-level configuration grouped by hook event.
An explicit -r <id> resume request from the command line.
A thread that exists and passes the resume-age policy.
A user-facing reason the requested thread cannot be resumed.
Presentation total derived from the latest independent subtotals.
Retain each source independently so delayed updates cannot erase spend.
An option paired with its resolved effective value, for display.
Bundles the four values that always travel together through the render helpers as one named record, so they can't be reordered or misa
A start_server_and_get_agent call that spawns before the app loads.
The subprocess boots while the caller imports and paints the app. The
start then pauses until adopt releases it, so the health
GitHub-hosted MCP: RFC 8628 Device Authorization Grant.
Outcome of a provider's pre-handshake run_login step.
Base class for provider-specific OAuth dispatch.
Subclasses override matches plus whichever of client_metadata
and run_login they customize. The default implementations cover
the spec-compliant
Fallback provider for spec-compliant MCP servers with no quirks.
Slack-hosted MCP: loopback authorization using the selected app.
Structured prompt and checkpoint metadata for a skill invocation.
Where managed policy is read from, and whether that location is certain.
fallback holds why the path is a guess, or None when the path is
authoritative. A failed registry query leaves the lookup
Configuration consumed by CodeInterpreterMiddleware.
Managed and user TOML snapshots from one resolution generation.
Raised when an enforced managed source cannot be read safely.
Raised when managed policy declares a value that cannot be enforced.
The file parses, so provider health is OK; the policy it states is what
cannot be applied. A subclass of ManagedConfigError so
Provider health and policy enforceability from one managed snapshot.
Outcome of one user config transaction.
Expose tools registered after the agent graph was built.
Default decision for project-authored extension code.
Effective extension configuration for one process.
Runtime mode exposed to extensions.
Factory-scoped registrar and read-only session context.
Each extension receives a dedicated instance, which attributes every registration to the extension's source without exposing mutable dcode appl
Ask before changing agents to resume a thread.
Raised by MCPLoginScreen.action_cancel when the user cancels the flow.
Modal that renders the OAuth login flow and collects user input.
Implements the OAuthInteraction Protocol structurally so a
mcp_auth.login(..., ui=screen) call drives the same modal. Each
interac
Posted when an _ActionOption is clicked with the mouse.
Modal displaying a single notification's title, body, and actions.
Activation returns the chosen ActionId via dismiss(); Esc
returns None so the caller can keep the underlying notification
cent
One-time choice for how Auto mode handles generated goal criteria.
Onboarding screen that asks for the user's name.
Dismissal values:
"" when the user submits an empty input (continue, but skip naOnboarding screen that summarizes installed optional integrations.
Modal visualization of the current model context window.
Modal asking whether to switch cwd when resuming or switching to a thread.
Ask how project hooks in a newly entered workspace should be trusted.
Strategy for building a tool's HITL approval widget.
Each renderer maps a tool name to a (widget_class, data) pair that
controls what the user sees in the approval box. Tools not registered
in `_RE
Renderer for write_file tool - shows full file content.
Renderer for task tool โ interrupt description provides full context.
Renderer for delete tool - shows removed file content when available.
Renderer for edit_file tool - shows unified diff.
One startup tip displayed above the chat input.
The closed set of LangSmith region selections in the /auth prompt.
Outcome of resolving the region selector to an endpoint to persist.
endpoint is the canonical URL to store (empty for the US SaaS default);
error is a user-facing message when a Custom URL is mis
Outcome of an AuthPromptScreen interaction.
The three outcomes need to stay distinguishable because callers in the
recovery path retry the original failing operation only on SAVED โ
retrying afte
Confirm before launching an authentication flow for a model.
A provider-agnostic gate shown when a selected model needs credentials that aren't detected, and starting the auth flow is disruptive enou
Confirmation overlay shown before clearing a stored credential.
Patterned on DeleteThreadConfirmScreen so the destructive prompt feels
consistent across the app. Always dismisses with True on con
Modal that captures and persists an API key for one provider.
Dismissal values are members of AuthResult so callers in the recovery
path can distinguish "user just saved a key โ retry the failed
op
Modal that lists configured providers and lets the user manage keys.
Reachable via the /auth slash command. Always dismisses with None;
state changes are persisted by AuthPromptScreen and refle
Posted when a key prompt successfully persists credentials.
Carries the /auth config key that was saved so the app can react to
credentials that gate spawn-time behavior โ e.g. a Tavily key that
en
Posted when a key prompt deletes stored credentials.
Carries the /auth config key that was deleted so the app can clear
any in-memory state derived from the now-removed credential.
Confirmation overlay for installing an arbitrary --package.
Dismisses with True when the user confirms and False when the user
cancels. Esc is treated as cancel so the user is never forced into
Confirmation overlay for installing a model provider's extra.
Shown from the model selector when the user picks a model whose provider
integration package is not installed. Dismisses with True to i
Modal that shows self-update progress and a bounded log tail.
Modal dialog for switching between available agents.
Displays agent profiles from ~/.deepagents/ (directories that contain an
AGENTS.md marker) in an OptionList. Returns the selected agent name
Widget result when the generated criteria are accepted unchanged.
Widget result when the user submits revised criteria.
Widget result when the user rejects criteria with feedback.
Widget result when the user cancels the proposal.
Text input that keeps goal-review edit keystrokes inside the editor.
Posted when the user presses Enter to submit goal-review text.
Posted when Escape should leave goal criteria edit mode.
Inline review widget for generated goal acceptance criteria.
Message sent when the user accepts, edits, or cancels.
TextArea that detects paste-like keystroke bursts.
Subclasses drive the state machine from their own _on_key by calling the
helper methods here, and override the policy hooks
(`in_slash_command
Paste-aware text area that collapses large pastes into placeholders.
The full pasted text is stored off-screen in _pasted_contents and a
compact [Pasted text #N] placeholder is shown in its place
Types of messages in the chat.
Status of a tool call.
In-memory message data for virtualization.
This dataclass holds all information needed to recreate a message widget. It is designed to be lightweight so that thousands of messages can be stored witho
Manages message data and widget window for virtualization.
This class stores all messages as data and manages a sliding window of widgets that are actually mounted in the DOM.
Dismissal payload identifying which action the user picked.
The screen returns this via dismiss() when the user drills into
a notification and selects an action; it returns None when the
user can
Posted when a notification row is clicked with the mouse.
Posted when the user picks SUPPRESS from a notification's detail modal.
The center does not dismiss on SUPPRESS because the remaining notifications should still be reachable in place. The app handles
Posted when the user toggles the settings disclosure row.
The app responds by refreshing the open center's settings state from config; the center also handles the message itself so toggles stay respo
Posted for an action that opens a follow-up modal in place.
Some actions (those in IN_PLACE_ACTIONS, currently ENTER_API_KEY)
push another modal, such as the API-key prompt, on top of the
still-o
Shared hub for pending notifications and warning preferences.
Each PendingNotification is a single row followed by a settings
disclosure row. Up/Down (or j/k) moves the cursor; Enter or click drill
Modal asking whether to restart the server after an MCP login.
Dismisses with "reconnect" when the user accepts the restart and
"later" when the user defers. Esc is treated as "later" so the
user
Modal asking whether to reconnect after /mcp disable/enable toggles.
Shown when the user closes the /mcp viewer with pending F2
disable-state changes but without pressing Ctrl+R, so the toggl
Confirmation overlay for /mcp reconnect --force with no pending login.
Guards a fat-fingered force-restart when nothing is actually queued.
Prompt filter with standard modified-Backspace word deletion.
Query field for the inline prompt search panel.
Plain Input apart from the class name, which lets ChatInput filter
Input.Changed / Input.Submitted messages down to this field, plus
bindings f
Posted on Escape or empty-query Backspace, to close the search.
One clickable prompt row in the inline search panel.
Message sent when a prompt row is clicked.
Inline prompt history search rendered above the input row.
Display-only: ChatInput owns the query, filtered snapshot, and
selection, drives key handling, and re-opens the modal tier. The panel
mirr
Message sent when the panel's rendered row count changes.
Message sent when a prompt row is clicked in the panel.
A selectable tool item in the MCP viewer.
Read-only modal for a failed MCP server's error details.
A selectable server-header row in the MCP viewer.
Cursor-selectable so users can navigate to every server โ even those
in unauthenticated or error states which have no tool rows by the
`MCPServer
Modal viewer for active MCP servers and their tools.
Displays servers grouped by name with transport type and tool count. Navigate with arrow keys, Enter to expand/collapse tool descriptions, start i
Modal dialog for theme selection with live preview.
Displays available themes in an OptionList. Navigating the option list
applies a live preview by swapping the app theme. Returns the selected
the
Approval menu using standard Textual patterns.
Key design decisions (following mistral-vibe reference):
Message sent when user makes a decision.
Approval overlay for a skill resolving outside trusted directories.
Dismisses with True when the user allows the resolved target and False
when the user declines. Esc is treated as deny so the us
Free-form answer input for ask-user questions.
Adds two behaviors over the shared base:
Posted when the user presses Enter to submit an ask-user answer.
Interactive widget for asking the user questions.
Supports text input, multiple choice (pick exactly one), and multi-select (toggle one or more) questions. Choice questions always include an "Other"
Message sent when user submits all answers.
Message sent when user cancels the ask_user prompt.
Posted when the changelog row is clicked with the mouse.
Modal dedicated to the update-available notification.
Renders the entry's title and body, a "View changelog" row, and
one row per configured action. Dismisses with the selected
ActionId, or None
Animated spinner using charset-appropriate frames.
Animated loading indicator with status text and elapsed time.
Displays: Thinking... (3s, esc to interrupt)Keep the current goal and lifecycle state visible above the input.
In-TUI first-run notice describing what Auto mode does.
Dismisses with True on Enter (confirm switch to Auto) and False on
Esc (cancel, stay in current mode). Programmatic dismiss may yield `None
Modal dialog for selecting a reasoning effort level.
Outcome of the YOLO first-enable notice.
ACKNOWLEDGE enables YOLO (and records the acknowledgement); MANUAL
switches to Manual instead; CANCEL keeps the previous mode. A
programmatic dismiss ma
In-TUI acknowledgement shown before unrestricted YOLO becomes active.
Dismisses with YoloModeNoticeResult.ACKNOWLEDGE on Enter (acknowledge and
enable), YoloModeNoticeResult.MANUAL on m (switch
Captured stdout printed during a js_eval evaluation.
A successful js_eval evaluation result.
An error raised during a js_eval evaluation.
Run the ChatGPT OAuth Authorization Code Flow with PKCE inline.
Dismissal value:
True: a token was saved (caller should refresh provider lists /
retry the operation that needed the credentiaOutcome of the CodexSignedInScreen quick-action overlay.
Encoded as an enum (mirroring AuthResult) rather than bare strings so a
typo in either the producing action_* method or the consuming di
Quick-action overlay shown when openai_codex is already signed in.
Dismissal values:
CodexSignedInAction.SIGN_OUT: delete the stored token.CodexSignedInAction.REAUTH: open the OAuth flowModal asking whether to restart the server for a spawn-time change.
Serves both the post-install offer and the post-/auth web-search offer;
the caller supplies the title verb and body copy.
Di
A clickable completion option in the autocomplete popup.
Message sent when a completion option is clicked.
Small clickable button shown at the right edge of the chat input row.
Provides discoverable mouse alternatives to keyboard shortcuts for
clearing ([ X ]) and copying ([ COPY ]) the current draft.
Message sent when an input action button is clicked.
Popup widget that displays completion suggestions as clickable options.
Message sent when the popup's visible row count changes.
Deduplicated by the sender, so receiving this always means the rendered row count actually moved.
Message sent when a completion option is clicked.
TextArea subclass with custom key handling for chat input.
Modifier-Enter / Ctrl+J newline bindings and the VSCode backslash+enter
fallback are inherited from PasteBurstTextArea.
Message sent when text is submitted.
Request previous history entry.
Request next history entry.
Posted when the user presses a printable key or backspace.
Relayed by ChatInput as ChatInput.Typing for the app to track
typing activity.
Bordered box that owns the chat composer size.
Sizing is either automatic (content-driven, the default) or manual, and
_requested_height is the discriminator: None means automatic.
A manual size
Drag target docked over the chat input's top border.
Only the background is transparent: the handle sits on the layer above the
box's border and would blank the line it covers, so render repaints t
Message sent when a resize drag begins.
Message sent with the current drag delta.
Message sent when a resize drag stops, however it stopped.
Message sent when resize hover feedback changes.
Message sent when expanded sizing should be toggled.
Chat input widget with prompt, multi-line text, autocomplete, and history.
Features:
config.newline_shortcut)Message sent when input is submitted.
Message sent when input mode changes.
Posted when the user presses a printable key or backspace in the input.
The app uses this to delay approval widgets while the user is actively
typing, preventing accidental key presses (e.g. y, n
Floating "Ask about this" button for the current selection.
It snapshots the selected text because clicking it clears the screen
selection before the Click arrives.
Request insertion of the captured selection into the chat input.
Confirmation overlay before /update --deps upgrades dcode itself.
Dismisses with True when the user chooses the app update first and False
when they prefer to refresh dependencies for the curre
Confirmation overlay for a dependency refresh.
Dismisses with True when the user confirms and False when the user
cancels. Esc is treated as cancel so the user is never forced into a refresh
they
Theme facts that change block geometry, colors, or fence highlighting.
Block backgrounds and borders with alpha are inline styles rather than component classes: a partial component style pre-blends i
Lay out parsed blocks at a width, following Textual's block CSS.
A parsed markdown block.
A finished markdown reply drawn as one widget.
Looks like Textual's Markdown (validated against Textual 8.2.8) but
holds no child widgets. Long fence lines fold instead of scrolling.
One rendered line of the reply.
parts holds (content, selectable) pairs. Selectable parts carry the
selection offset meta, so they take the text pointer, mouse selection,
and copy; the others (
Rows of a laid-out block plus the margins Textual's CSS gives it.
Lay out a table like MarkdownTableContent's keylined grid.
One prompt summary row.
Public so its Clicked message resolves to the idiomatic
on_prompt_row_clicked handler; nothing outside this module builds one.
Message sent when a prompt row is clicked.
Filter, preview, copy, or select a previously submitted prompt.
Show a live, scrollable, copyable list of MCP server statuses.
Ask whether to start a new session or exit after a blocked resume.
Confirm a model switch that preserves a large conversation context.
Side-question editor with the shared multiline and paste conventions.
Posted when Enter submits the complete side question.
Chat independently of the main run with restorable side exchanges.
Modal showing the copyable entire-thread token and cost breakdown.
How to resolve a cold prompt-cache warning.
Offer actions for a turn whose prompt cache may be cold.
Dismisses with the chosen ColdCacheChoice, or None on a
programmatic pop. Esc is mapped to CANCEL so the user is never
forced into a spe
Confirm or edit a suggested name without changing the thread yet.
Ask whether to compact a just-resumed thread before the next turn.
Keep the session cost warning visible until acknowledged.
Arrow-key navigable plugin manager for /plugins.
Closing runs the optional check_reload_required callback while this screen
stays mounted. Changed plugin state transitions in place to a reload pr
Posted when a plugin manager tab label is clicked.
Mouse-clickable tab label in the plugin manager header.
Return autocomplete entries for slash commands.
Extract skill name and args from a /skill:<name> command.
Build autocomplete entries for discovered skills.
Each skill becomes a /skill:<name> entry with its description
and the skill name as a hidden keyword for fuzzy matching. Plugin skills
keep their n
Remove display-only media placeholders from user text.
Placeholders like [image 1] are inserted into the terminal input purely for
display; the actual media travels as structured content blocks. Th
Attempt to read an image from the system clipboard.
Supports macOS via pngpaste or osascript.
Read and encode an image file from disk.
Read and encode a video file from disk.
Return whether a path's extension is a known image or video extension.
This is a cheap, extension-only check (no file read or decode). Use it to classify a dropped file path as media without loading
Try to load a file as an image first, then as a video.
Encode raw bytes to a base64 string.
Create multimodal message content with text, images, and videos.
Return the server names disabled by the user or by managed config.
Return True when server_name is in the disabled set.
Add or remove server_name from the persistent disabled set.
Refuses to write when the existing config cannot be parsed so a corrupt or permission-denied file is not silently overwritten โ that woul
Return the resolved path to the credential store (auth.json).
Resolved at call time (not import time) so tests can redirect storage by monkeypatching `deepagents_code.model_config.DEFAULT_STATE_DIR
Return all stored credentials keyed by provider name.
Return the stored API key for provider, or None if unset.
Returns None for stored OAuth credentials too โ callers that need
OAuth tokens should read load_credentials() directly and narrow on
Return the base URL paired with provider's stored key, or None.
Returns None both when no key is stored and when a key is stored without
an accompanying base URL (the user left the field blank,
Return the LangSmith project paired with provider's stored key, or None.
Returns None when no key is stored and when a key is stored without a
custom project (the user left the field blank, mea
Persist an API key for provider.
Empty / whitespace-only keys are rejected so callers don't accidentally
write a sentinel that masks a working environment variable (see
apply_stored_credentials i
Remove a stored credential for provider.
Return providers that currently have a stored credential, sorted.
Generate a safe name using the selected model without conversation callbacks.
Cancellation waits for model initialization, which can update process-wide provider settings, even if the generation time
Classify every ServerConfig field for the policy/runtime split.
Every dataclass field must land in exactly one bucket so the fingerprint split cannot silently drop a setting. A field missing from a
List subagents from user and/or project directories.
Scans for subagent definitions in the provided directories. Project subagents override user subagents with the same name.
Normalize line breaks and escape markdown syntax in external text.
Resolve ${VAR} references in one MCP server's supported fields.
Interpolates the command, url, args, env, headers, and oauth
fields (see _interpolate_env for the reference syntax); ev
Classify whether the provider stopped this message early.
Reads the raw provider metadata on response_metadata, so it also works on
the streamed chunk that carries the stop reason.
Return whether a message has reply text or a tool call to act on.
Reasoning alone does not count: the user still gets no answer.
Return a short, user-facing explanation of a truncation.
Return whether the attached terminal should be treated as kitty-aware.
Detection is side-effect free: it never writes escape sequences or reads queued input bytes. That means it may under-detect some
Return the first-run onboarding marker path.
Return whether the user has completed onboarding.
Persist that onboarding has completed.
Return the goal criteria preference prompt marker path.
Return whether the goal criteria preference prompt was answered.
Persist that the goal criteria preference prompt was answered.
Persist the optional onboarding name into user agent memory.
Empty or whitespace-only names are skipped (no file is written).
Return the managed onboarding name block (markers included) if present.
Remove every onboarding-name marker occurrence from text.
A partial edit can leave a lone start or end marker behind. Stripping all marker strings before re-inserting the managed block keeps re-ins
Return whether onboarding should open at interactive startup.
DEEPAGENTS_CODE_ONBOARDING overrides the marker in both directions: a
truthy value forces the flow open on every startup, and a falsy v
Narrow a persisted model-spec channel to a usable value.
Shared by _rubric_model_spec and _model_spec. INHERIT_RUBRIC_MODEL
passes through unchanged; callers compare the result against it thems
Narrow a persisted proposal kind to a known value.
Narrow a persisted goal-status value to a known GoalStatus.
A corrupt or forward-version checkpoint can carry an unexpected status
string (or a non-string). Coercing to None rather than passing t
Format an auth manager badge for a provider.
Used by the /auth manager, where each provider renders a bracketed,
styled badge (e.g. [stored], [env set: ANTHROPIC_API_KEY], [missing]).
Format a model selector provider-header indicator.
Used by /model, where the indicator is plain text shown next to the
provider name. Returns an empty string for CONFIGURED providers, which
need
Install the override for this process.
The override is process-global. Call it only in the server process, which owns its event loop and pins one tracing configuration for its lifetime.
Mark a graph invocation as an interrupt-resume round when it is one.
A turn's initial run stays untagged, so the tag identifies continuations rather than the turn itself. Keep that asymmetry: tagging
Return the bounded retention bucket key for a log level name.
Attach the in-memory buffer handler to target (idempotent).
Lowers target's level to at most INFO so the console shows a useful tail
even when DEEPAGENTS_CODE_DEBUG is off; never raises the l
Return the installed buffer handler.
Return the ordered reasoning effort levels supported by model_spec.
Return profile efforts compatible with the effective thinking mode.
Return the profile's reasoning effort default independently of its levels.
Return whether effort is a supported level for model_spec.
Return whether canonical or native effort parameters are present.
Read canonical or native effort settings using integration precedence.
This compatibility reader does not modify the supplied parameters. It only
reports settings that may come from --model-params,
Remove canonical and native effort settings without changing siblings.
Replace existing effort settings with the standard flat parameter.
Patch the in-memory run queue to start new runs without the poll delay.
Return the number of newline characters in text.
Return whether text should be collapsed into a placeholder.
Collapses when the text exceeds the character threshold or the line threshold.
Format a paste placeholder reference string.
Replace all paste placeholders in text with their full content.
Placeholders whose IDs are not in pasted_contents are left unchanged.
Bind web search to one workspace credential.
The schema is taken from web_search via functools.wraps so the built-in
and workspace-bound variants can never present different arguments. The two
al
Return whether candidate is a built-in or workspace-bound search tool.
Get the current Deep Agents thread ID for LangSmith or MCP tooling.
Search the web for current information.
Fetch a URL and return the page content as markdown.
Extract renderable reasoning text from a content block.
Return ordinary text from a local or serialized message.
Return message metadata from a local or serialized message.
Return a message's lc_source value when present.
Return whether a local or serialized message has the human role.
Return whether a message is a goal-state notice or continuation.
Return whether a message claims to be a goal-state notice.
Return whether the latest human turn carries an unsaved goal fallback.
Return whether a message should be omitted from derived transcripts.
Return whether a message is hidden from user-facing session history.
Return whether a message carries SDK-pinned skill instructions.
The SDK appends this message after the user prompt that requested the pin, so lookups for the latest user turn must skip it.
Build a one-time goal continuation.
Return a valid absolute cutoff index from a summarization event.
This is the canonical explanation of the cutoff rule; the notice predicates
and the /offload accounting point here rather than resta
Return the absolute cutoff index of a _summarization_event.
The degrading variant of validated_summarization_cutoff, which documents the
rule and why an out-of-bounds cutoff is rejected rather th
Record that a restored summarization event was discarded.
Dropping the event also drops its summary_message, so the next request
re-sends the whole untrimmed history. That is a large, silent token
Project authoritative channels into deterministic notice state.
Serialize authoritative notice state with canonical JSON formatting.
Return a stable digest for authoritative goal/rubric state.
Return whether state contains a goal or an active rubric.
Select the user-controlled text a notice built from projected embeds.
The objective and status note are withheld unless the goal is actionable, while criteria are embedded whenever a rubric is acti
Return why state cannot render as a safe notice, or None when it can.
Collapses the project-then-validate sequence its callers each performed separately. Their correctness depended on all of them
Build one canonical append-only goal/rubric state notice.
Return validated canonical notice metadata from a message.
Return the newest valid notice and its raw-history index.
Return the newest goal-state source index, including invalid messages.
Return whether embedded goal-state text violates current size limits.
Build a bounded same-index stand-in for an oversized prior notice.
An oversized notice must stop being model-visible, but it cannot be removed from a model request. The summarizer picks its cutoff fr
Extract the allowlisted, reportable policy snapshot from a payload.
Build the snapshot persisted with a workspace binding.
Compare a persisted snapshot against the current one.
Fields present in the snapshots are compared with values; fields named in
changed_names (e.g. fingerprint-only or path-valued fields detected b
Join Content lines with newlines (Content.join is instance-level).
Render workspace refusal diagnostics as markup-safe TUI content.
Every dynamic value (field names, allowlisted values) flows through
Content.from_markup $var substitution, so square brackets in a
Return non-agent directory names reserved by the app under the profile root.
These directories are created by the app for its own use and must never appear in the agent picker โ even if they contain
Report whether name resolves onto an app-owned profile directory.
Use this instead of name in reserved_agent_dir_names() wherever the
input is a user-supplied agent name: the membership test is e
Return bounded canonical JSON and its SHA-256 fingerprint.
Fingerprint value with the canonical workspace serialization.
Resolve a client-supplied cwd into a canonical workspace binding.
cwd is untrusted and is validated here. workspace_config is not: every
caller passes server-resolved policy. A client claim is ve
Read the persisted comparison snapshot recorded for a binding.
Name the project-scoped fields that drifted from their binding.
The refusal these feed is safe either way, but it is not diagnosable without the field names: the resolution reads the extension trust
Atomically create or verify a thread workspace binding.
Read a thread's durable workspace binding.
Validate run context against the durable workspace binding.
Add a --json flag to an argparse parser.
Write a JSON envelope to stdout and flush.
The envelope is a single-line JSON object with a stable schema:
{"schema_version": 1, "command": "...", "data": ...}Drop empty-string values for optional MCP tool params.
Some MCP servers (e.g. Slack's slack_search_public_and_private) validate
optional ID-typed params with value is not a channel ID when the mo
Build the middleware wrapping every MCP tool call.
Explain why the active resume cutoff exists and who set it.
Resolve the strictest configured thread-resume cutoff.
Return why policy blocks resuming a thread, if it does.
Classify a stored thread cwd against the current cwd.
Resolve an MCP config dict for login without printing anything.
Pull server out of a resolved config and validate its shape.
Build the CLI-style hint for an unreadable user trust policy.
Surfaced by dcode mcp login so a config.toml read failure is never
swallowed just because a user-level config or an env-enabled serve
Build the CLI-style hint string for skipped project server entries.
Build the CLI-style hint for servers dropped by the legacy-key removal.
Mirrors the resolve_and_load_mcp_tools migration message so
non-interactive dcode mcp login explains why a previously allow
Build the CLI-style hint for the renamed, now-ignored env var.
Mirrors format_legacy_ignored_notice for the env surface so a user who
still exports DEEPAGENTS_CODE_ENABLED_PROJECT_MCP_SERVERS lea
Build the CLI-style hint for dropped malformed saved approvals.
Mirrors format_legacy_ignored_notice so non-interactive dcode mcp login
explains why a previously-approved server stopped loading (
Build the CLI-style hint for discovered configs that failed to load.
Surfaced by dcode mcp login on a partially successful resolution so a
broken .mcp.json is reported instead of silently dropped
Return resources shared by the graph and dcode operation routes.
Builds once and caches. A construction failure is converted into a startup-error marker (scraped by the parent app process) before `sy
Return the graph after validating execution workspace context.
Restore a typed recovery error, falling back to the ordinary log summary.
Report a server graph startup failure to the parent app process.
Emits the full traceback for logs/debugging, then a
single-line {STARTUP_ERROR_MARKER}{type}: {summary} line that
`server._extract_s
Return a Textual Unix driver class that renders through stdout.
Textual's LinuxDriver writes every frame to sys.__stderr__, while
TerminalStderrGuard points fd 2 at /dev/null โ so under an ac
Erase spend in the caller's thread-deletion transaction.
Retain only an ID tombstone to discard pending retries and late provider completions, including answers that have not written their first char
Retry pending settlements and read the durable subtotal.
Save completed usage before delivering an answer or finishing cancellation.
Return the command name this process was launched with.
Cached: sys.argv[0] and the launch environment are fixed for the life of
the process. Tests that vary either must call `invoked_name.cache_cl
Note a non-standard launch name in the Debug Console, once per process.
Cached so repeated calls cannot repeat the note; tests that vary the launch environment must call `log_nonstandard_invoked_name
Discover models in the caller's active environment without constructing them.
Detect deceptive or hidden Unicode code points in text.
Remove known dangerous/invisible Unicode characters from text.
Neutralize control characters and deceptive Unicode in untrusted text.
Untrusted strings (MCP server errors, config-file contents, tool output) can carry ANSI escape sequences, other control characte
Reject deceptive controls and line separators without rewriting file paths.
Render hidden Unicode characters as explicit markers.
Example output: abc<U+202E RIGHT-TO-LEFT OVERRIDE>def.
Summarize Unicode issues for warning messages.
Deduplicates by code point. When more than max_items unique entries exist,
the summary is truncated with a +N more entries suffix.
Join safety warnings into a display string with overflow indicator.
Check a URL for suspicious Unicode and domain spoofing patterns.
Flatten nested dict/list structures into key-path/string pairs.
Return whether a key path suggests URL-like content.
Argparse type for integer arguments that must be >= 1.
Argparse type for integer arguments that must be >= 0.
Argparse type that validates a shell allow-list without normalizing it.
Show top-level help information.
Show help information for the list subcommand.
Invoked via the -h argparse action or directly from cli_main.
Show help information for the agents subcommand.
Show help information for the reset subcommand.
Show help information for the skills subcommand.
Invoked via the -h argparse action or directly from
execute_skills_command when no subcommand is given.
Show help information for the plugin / plugins subcommand.
Show help information for the skills list subcommand.
Show help information for the skills create subcommand.
Show help information for the skills info subcommand.
Show help information for the skills delete subcommand.
Show help information for the skills trust subcommand.
Show help information for the update subcommand.
Show help information for the doctor subcommand.
Show help information for the tools subcommand.
Show help information for the tools list subcommand.
Show help information for the tools install subcommand.
Show help information for the install subcommand.
Show help information for the uninstall subcommand.
Show help information for the mcp subcommand.
Show help information for the mcp login subcommand.
Show help information for the mcp config subcommand.
Show help information for the config command.
Invoked via the -h argparse action. Kept import-light so help remains on
the startup fast path.
Show help information for the auth subcommand.
Invoked via the -h argparse action, the startup fast-path, or
run_auth_command when no auth subcommand is given. Kept import-light so
it stays on
Show help information for the threads subcommand.
Invoked via the -h argparse action or directly from cli_main
when no threads subcommand is given.
Show help information for the threads delete subcommand.
Show help information for the threads list subcommand.
Make langgraph-api's checkpointer adapter use the inner saver's fast path.
Call this in the server process before the adapter serves requests. It is idempotent and a no-op when the adapter is missing
Return whether a diff line is the truncation marker.
One predicate for both readers, which previously disagreed: the renderer stripped, the recount compared exactly.
Exact, deliberately. `compute_un
Split a unified diff back into the lines it was assembled from.
Deliberately not splitlines(). Every diff reaching this function is
"\n"-joined from lines that themselves came from splitlines()
Locate paired file headers immediately preceding a hunk.
A ---/+++ pair is only a file header when it appears outside a hunk
body โ a diff of a file that itself contains such lines would otherw
Count added and removed lines in unified-diff lines.
Read the server project context from environment transport data.
Find the project root by looking for git metadata.
Find project-specific AGENTS.md file(s).
Checks two locations and returns ALL that exist:
Both files will be loaded and combined if bo
Validate a checkpointed cache activity record.
Build the placeholder policy used by DEEPAGENTS_CODE_DEBUG_COLD_CACHE.
Keeps the modal reachable on providers with no documented cache policy. Lives here rather than in the caller so the Anthropic
Return a stable identity for the endpoint that owns a prompt cache.
A missing endpoint means the provider's default API. Only scheme, host, port, path and a digest of the query are significant; every
Read [warnings].trusted_cache_endpoints as a set of hostnames.
Entries declare that an alternate endpoint forwards cache-affecting request
fields (cache_control, prompt_cache_key, `prompt_cache
Resolve a documented cache policy for one effective model invocation.
Policies apply only when the endpoint is the provider's official API or a user-declared trusted endpoint (see `load_trusted_cache
Project the params that participate in prompt-cache identity.
Estimate cold input spend and the incremental cost over a cache hit.
Prices are derived by running two synthetic usage payloads through the
ordinary estimate_cost path -- one billed as a full cache
Parse a persisted UTC timestamp, rejecting malformed or naive values.
Format elapsed cache age for compact modal copy.
Format a provider cache window for compact modal copy.
Load async subagent definitions from config.toml.
Reads the [async_subagents] section where each sub-table defines a remote
LangGraph deployment:
[async_subagents.researcher]
description
Return a sorted list of available agent names from ~/.deepagents/.
Scans the user's .deepagents directory and returns each real
subdirectory that contains the AGENTS.md agent marker and is not
List all available agents.
Reset an agent to default or copy from another agent.
Build the ### Model Identity section for the system prompt.
Get the base system prompt for the agent.
Loads the base system prompt template from system_prompt.md and
interpolates dynamic sections (model identity, working directory,
skills path, and executio
Return ordered skill sources for PluginSkillsMiddleware and audit tooling.
Lowest to highest precedence: built-in -> plugins -> user .deepagents -> user .agents -> project .deepagents -> project .age
Create a CLI-configured agent with flexible options.
This is the main entry point for creating a Deep Agents Code agent, usable both internally and from external code (e.g., benchmarking frameworks).
Build a secret anonymizer that matches create_secret_anonymizer.
It uses the same default rules and depth, and adds a per-string cache so unchanged history strings are not scanned again on each tra
Resolve editor command from environment.
Checks $VISUAL, then $EDITOR, then falls back to platform default.
Return a safe configured editor name for user-facing hints.
Open current_text in an external editor.
Creates a temp .md file, launches the editor, and reads back the result.
Copy text to the system clipboard.
Copy text to the clipboard and surface the outcome as a toast.
Centralizes the copy-then-notify pattern shared by the Ctrl+C and
[ COPY ] paths so the success/failure messaging stays consistent.
Copy selected text from one screen's widgets to the clipboard.
Selections live on the screen that owns them (Screen.selections) and
survive a modal being pushed on top, so a scan has to target exac
Return project-controlled paths for an explicit repository root.
Return the immutable launch-time user profile root.
Return the validated profile directory for an agent name.
Create the validated profile directory for an agent.
Return the user-level AGENTS.md path for an agent profile.
Return existing project-level AGENTS.md paths.
Return the user-level skills directory for an agent profile.
Create the user-level skills directory for an agent.
Return the project-level dcode skills directory, when in a project.
Create the project-level dcode skills directory.
Return the custom-subagent directory for an agent profile.
Return the project-level custom-subagent directory, when available.
Return the launch user's tool-agnostic ~/.agents directory.
Return the launch user's tool-agnostic ~/.agents/skills directory.
Return the project-level tool-agnostic .agents/skills directory.
Return the launch user's experimental ~/.claude/skills directory.
Return the project's experimental .claude/skills directory.
Return the directory containing skills bundled with dcode.
Classify a path as existing, missing, or unreadable.
Create directory and prove the process can write files inside it.
mkdir(exist_ok=True) only proves the directory exists; it succeeds on a
pre-existing root-owned directory. Creating a file is the
Return the first candidate directory that accepts a file.
Shared by the managed-bin and update-lock resolvers, which both walk a preferred-then-fallback pair. Callers keep their own "fell back" warni
Create a state directory and restrict it to its owner.
The state directory holds sessions.db and history.jsonl, which hold
full conversation content and are written with the default file mode. Th
Pin the resolved profile selection into a child environment.
Writes the resolved root, then sets or clears the defaulted/configured marker, so a child reconstructs the same snapshot the parent captur
Return the immutable launch-time user profile root.
Classify a raw env-var string as a truthy, falsy, or unrecognized token.
The single source of truth for which strings count as boolean on/off
values; is_env_truthy and the config resolver both buil
Return whether env var name is set to a recognizably truthy value.
Unlike bool(os.environ.get(name)), this does not treat "0" or
"false" as enabled. Use this for on/off flags where the user w
Reject a goal objective that cannot fit its persistent context budget.
This checks raw length only. HTML escaping can still expand the text fivefold, so a caller about to run criteria generation shou
Reject criteria that cannot fit their persistent context budget.
Validate an objective and its generated criteria as one application.
Validate only the combined budget, not either field's own limit.
Split out because the two kinds of overshoot need opposite handling in the criteria agent's structured-output loop: a per-field oversh
Validate the escaped size an accepted pair will occupy in the notice.
Split from validate_goal_application_total because the two budgets answer
different questions. The raw combined check shares it
Reject an objective whose escaped text alone cannot fit a notice.
Reject a goal status note that cannot fit its persistent context budget.
Validate every user-controlled section of a goal-state notice.
Return current-turn roots, or None when no scoped trace is active.
Concatenate all section functions into the full detection script.
Independent sections run as parallel background jobs writing to temp files, then results are concatenated in the original display ord
Register this process as a running session for its lifetime.
Idempotent and fail-soft: when the lock cannot be taken, the process runs
unregistered and is_sole_session reports False. The descript
Return descriptors a spawned server must inherit to count as this session.
flock locks belong to the open file description, so a child given the
descriptor holds the same lock: the server keeps the
Return whether this POSIX process failed to register as a session.
Lets callers tell "other sessions are running" apart from "presence cannot be known", which quitting other sessions would never fix.
Return whether no other dcode session holds this installation.
Converting a flock is not atomic: the shared lock is released before the
exclusive one is tried, so two processes checking at once cou
Resolve the configured runtime logging level.
Configure runtime logging and register target for per-thread files.
Route configured debug loggers to the active thread's log file.
Return the path of the active debug log file, or None if not logging.
Reflects the file handler actually attached by configure_debug_logging,
not the current DEEPAGENTS_CODE_DEBUG env value. Th
Move legacy state entries from config_dir into state_dir.
Idempotent: each entry is skipped when the destination already exists (the migration ran on a prior invocation) or when the source does n
Inspect candidate checkouts on the backend; optional failures may propagate.
Inspect backend checkouts without blocking the event loop.
Compare successful observations, including newly created checkouts.
Estimate tokens using the same four-characters-per-token rule as whip.
Approximate the memory fragment after middleware strips HTML comments.
Format skills locations matching SkillsMiddleware display.
Approximate the progressive-disclosure skill index sent to the model.
Build a fresh-session audit and reconcile it with live usage when available.
Render a plain-text report.
Build environment variables exposed to plugin subprocesses.
Substitute plugin path variables in a string.
Substitute plugin variables throughout a JSON-compatible value.
Split a plugin id in {plugin}@{marketplace} form.
Set up the plugin CLI parser.
Execute a plugin management command.
Normalize a decoded value to the supported JSON type.
Normalize a decoded value to a JSON object.
Return a marketplace source safe for display.
Redact credentials from every HTTP URL embedded in text.
Parse a user-provided marketplace source.
Load a marketplace source and return its local install location.
Load a marketplace from either a cached directory or JSON file.
Return a marketplace manifest path under root, if present.
Resolve or materialize a marketplace plugin entry to a plugin root.
Explain why materialize_plugin_source produced no plugin root.
A rejected path and an unsupported source type both yield None, and
saying "unsupported source" for the first sends readers looking
Load a marketplace manifest from a root directory.
Add a local marketplace to dcode state.
Add a marketplace from a pasted source string.
Remove a marketplace and every plugin installed from it.
Local marketplace source directories are never deleted. Managed marketplace clones and installed plugin caches are removed.
Set the enabled state of an installed plugin.
Uninstall a plugin (disable, clear records, delete orphaned cache).
Load a cached catalog, fetching the default on first browse.
Install a marketplace plugin into the versioned cache and enable it.
Copies the plugin source into plugins/cache/{marketplace}/{plugin}/{version}/,
writes installed_plugins.json, and enables the
Restore an installed plugin's files from its marketplace source.
Unlike install_plugin, this always replaces the cached copy, even when the
registry already lists the same version, so it repairs mi
Resolve whether plugin auto-updates are enabled and from which source.
Build the notification announcing plugin updates that were not installed.
Refresh remote marketplaces and update enabled, opted-in plugins.
Plugins whose manifest opts into autoUpdate are installed; other plugins
with a different marketplace version are reported as avail
Update installed plugins to their marketplace versions.
Discover enabled marketplace plugins from their install cache paths.
Return broken installs that have not yet been shown in this process.
Several consumers (skills, hooks, MCP, the plugin manager) run discovery independently. Routing user-facing notices through this c
List plugins from configured marketplaces.
Return plugin ids that have install records.
Build hook sources from enabled or already-discovered plugins.
List the hook events a plugin declares, for display before it loads.
Only events Hooks v2 recognizes are returned, so the plugin manager never advertises a hook that the loader will later reject.
Return the ChatGPT OAuth token store path.
Stored under Deep Agents' own state dir
(~/.deepagents/.state/chatgpt-auth.json) so the credential lives
alongside the rest of the app's state rather than
Return the current ChatGPT OAuth sign-in state.
Reads the on-disk token without triggering a refresh (a passive
inspect, suitable for switcher labels and the /auth manager). If a
refresh is neede
Return whether a ChatGPT OAuth token is stored on disk.
Delete the stored ChatGPT OAuth token.
Run the ChatGPT OAuth Authorization Code Flow with PKCE.
Reimplements the upstream langchain_openai.chatgpt_oauth browser
sign-in flow over its lower-level helpers, but routes the authorize-URL
dis
Construct a _ChatOpenAICodex model wired to the on-disk token store.
Build an inherited environment safe to pass to hook subprocesses.
Strips values whose names look like secrets. Hooks are user-authored trusted code, but secret values should not be ambiently availabl
Format a compatible MCP wire tool name.
Map a native tool name to the compatible wire tool name.
Map native tool arguments to the compatible wire input object.
Project a native tool call into compatible wire name and input.
Return value when it is composed only of allowlisted sequences.
Allowed tokens are OSC 0/1/2/9/99/777 (BEL or ST terminated)
and bare BEL. Any other escape or control content rejects th
Project a native hook invocation into the compatible wire contract.
Serialize a hook invocation as validated compatible JSON.
Return the compatible notification matcher and wire value.
Fire matching hook commands with payload serialized as JSON on stdin.
The event name is automatically injected into the payload under the
"event" key so callers don't need to duplicate it.
The
Schedule dispatch_hook as a background task with a strong reference.
Use this instead of bare create_task(dispatch_hook(...)) to prevent the
task from being garbage collected before completion.
Return whether fire-and-forget hook tasks are still in flight.
Await all in-flight fire-and-forget hook tasks.
Call this before the event loop tears down (e.g. at the end of a headless
run driven by asyncio.run) so background dispatches โ most importantly the
Translate a hook permission decision into a client review outcome.
Interleave hook decisions with human decisions in request order.
Attach Hooks v2 snapshot identity and server event gates to context.
Return the project-scoped hooks configuration path.
Return the user-scoped hooks configuration path.
Load, validate, merge, and hash Hooks v2 configuration.
Return the canonical SHA-256 snapshot id for config.
Serialize configuration into a stable byte representation.
Decode one hooks document and fingerprint the exact bytes read.
Execute a server-owned hook request and return a resume payload.
Fulfill a raw interrupt value when it is a hook invocation.
Fulfill pending hook interrupts into a resume map keyed by interrupt id.
Reduce ordered handler results into an event-specific decision.
Look up a thread to resume and enforce the resume-age policy.
Explain why target cannot be resumed from current_cwd.
The server refuses a directory change through the thread's workspace binding; checking first turns that generic refusal into a specific mess
Return the thread's model, or its saved-preference fallback.
Read the model a thread last ran with from its checkpoint values.
Register the dcode mcp command group.
List configured OAuth servers without stored tokens.
Servers are drawn from the same trust-gated resolution as run_mcp_login,
so untrusted project-level entries are excluded from the scan.
A serve
Handle dcode mcp login <server>.
When config_path is omitted, auto-discovered MCP configs are merged in
the same precedence order as the runtime loader, with matching trust
gating: user-level con
Handle dcode mcp config.
Prints the MCP config discovery paths in precedence order with a marker showing which exist on disk. Stat-only; never opens config files, so config-trust prompts are not tr
Dispatch a dcode tools subcommand.
Register the dcode auth command group.
Dispatch a parsed dcode auth invocation.
Register the dcode config command group.
Dispatch a parsed config invocation.
Dispatch dcode uninstall <name>.
Remove one selected optional extra from the dcode tool environment.
Shared by dcode uninstall NAME and the dcode --uninstall NAME alias.
Dispatch dcode install <name>.
Install an optional extra or an arbitrary package via uv --with.
Shared by dcode install and the legacy dcode --install flag.
Start a LangGraph server and return a connected remote agent client.
Async context manager that starts a server and guarantees cleanup.
Wraps start_server_and_get_agent so callers don't need to duplicate the
try/finally pattern for stopping the server.
Return the provider policy that owns server_url.
Return the custom stream payload for errors.
Return the errors of a skills load-error event.
Return the user notice for unreadable skill sources.
Discover skills and build pre-resolved containment roots.
Return configured extra and user-approved skill roots.
Return the instructions the SDK pins for skill.
The SDK skips a skill it cannot pin. The agent server raises instead, so a skill the user invoked never runs silently without its instructions.
Build the user request and persisted metadata for SDK skill pinning.
The agent server resolves, trust-checks, and reads the skill, so only the name the user typed is sent.
Return the skill a pinned-skill message carries.
Return the fixed managed-config path and whether it is authoritative.
What the snapshot loader reads. Callers that report health need this rather
than managed_config_path, so a guessed path is neve
Return the fixed managed-config path for the current operating system.
For display and error messages. Anything that decides whether policy is
enforceable wants resolve_managed_path.
Return UNION_PATHS rebased onto a subtree rooted at prefix.
merge_toml_tables matches paths relative to where it starts. A merge of
one option's own subtree therefore never matches an absolute
Return whether managed policy decided a value with this source label.
A structured option merges both layers and reports a combined label, so
source == MANAGED_SOURCE is the wrong test and silently
Merge managed policy over user config with this project's precedence.
The single statement of managed-over-user precedence. It was assembled by hand at three call sites, two carrying "must match" com
Return whether a managed scalar has the declared type for its path.
Unknown and structured paths retain the deep-merger's existing behavior; their dedicated readers own validation. Manifest-backed sc
Classify what managed policy says at one manifest path.
Return managed settings whose declaration cannot be safely applied.
A key is a violation when an enforced managed policy declaration cannot be applied, when a known managed section has a non-table va
Resolve one manifest option and retain its rank-keyed managed result.
Return manifest keys managed policy declares whose value was dropped.
Not a launch failure: only ENFORCED_MANAGED_KEYS stops a launch, and every
other rejected managed value deliberately falls thro
Return known managed sections declared as non-table values.
Unknown leaf keys remain forward compatible. Every parent path of a manifest-backed option is known to be a table, however, as are the stru
Return the process snapshot, or an isolated snapshot for an explicit path.
A reload that cannot parse the file never evicts policy that parsed cleanly earlier. An unusable snapshot carries `data == {
Return the status of the last refresh that produced no policy.
A failed refresh does not change what the process enforces: the last enforceable generation keeps resolving, which is what fail-closed r
Load one user snapshot and the current managed snapshot.
Managed policy is included exactly when user_path is None, which is
what every production caller passes. Reading an explicit path is a
tes
Drop the cached managed snapshot and the shared process resolver.
Test-only. Production reloads pass refresh=True instead, which keeps the
last snapshot that parsed cleanly if the new one fails; cl
Return managed policy only when it can be enforced.
A file that parses is not necessarily enforceable: a privilege-affecting key can carry a value the manifest rejects, or a known section can be a sc
Fail startup when present managed policy cannot be parsed or enforced.
Propagates from get_healthy_managed_snapshot: ManagedConfigError when
a managed file is present but unreadable, and `Managed
Return managed provider health for diagnostics and config inspection.
Return both halves of exit 78 for one managed snapshot.
Reading health and violations as two calls is a live bug, not a style
choice. get_managed_snapshot declines to cache a candidate it cannot
en
Evaluate provider health and policy diagnostics for one snapshot.
Resolve a user-supplied theme name to a canonical registry key.
Accepts the registry key or the human-readable label, case-insensitive on both, with surrounding whitespace stripped - config values (e
Return value as a TOML table when it has the expected runtime shape.
tomllib parses TOML tables as string-keyed dicts, which ty cannot infer
from a runtime dict check. Keep the cast at this b
Resolve [ui.terminal_themes][TERM_PROGRAM] to a registered theme.
Centralizes both the lookup and the misconfiguration warnings, which are logged exactly once per call. Three callers now share that
Serialize a read-modify-write of the user config and replace it atomically.
Writes the user tier only. The managed path is refused rather than trusted to be unreachable.
A committed write to the def
Make a committed write visible to the shared process resolver.
Only the default path is refreshed. get_config_resolver is keyed on
DEFAULT_CONFIG_PATH, so reloading it after a write to an overrid
Reject a backend route that violates host storage boundaries.
The sandbox check is deliberately shallow. Wrapping a filesystem backend
in another BackendProtocol implementation changes who owns tha
Validate late routes and flag graph-bound registrations for restart.
Return whether extension execution is trusted for a project.
Persist extension execution trust for a project.
Parse a project extension trust policy.
Resolve extension settings through the shared config generation.
Build the navigation hint for modals whose Tab keys move the cursor.
Only for screens where Tab and Shift+Tab step the selection. A modal that binds Tab to something else writes its own line rather t
Get the renderer for a tool by name.
Build the style that marks a span as click-to-copy.
Return the copy text and field label from a span style, if any.
Return whether startup tips should be shown.
Return a human-readable provider label.
Shared by the auth UI and the model selector so a provider is labeled
identically in both. (The install prompt reuses the underlying
PROVIDER_DISPLAY_NAMES m
Return a compact brand label for a provider.
For space-constrained UI (e.g. the /model Recent tag). Resolution order:
a configured short_name, then the built-in PROVIDER_SHORT_NAMES map,
then t
Condense path so it renders within width terminal cells.
Directory components are replaced by a single ellipsis, growing outward from the middle of the component list, because the tail of a path
Build the footer line for the current charset mode.
The Ctrl+R mention is what makes the modal tier discoverable. The line is
kept short enough to wrap within PROMPT_SEARCH_MAX_HINT_ROWS at the
nar
Return a prompt's first non-empty line for a one-row summary.
Return prompts containing the query, case-insensitively.
Update a Static, and relayout only when the content width changes.
Static.update relayouts the whole screen by default. That reflows every
mounted transcript widget, so a 10 Hz spinner gets slowe
Return selection shifted past a diff row's gutter, if one is set.
Every form a selection can take over a single-line row covers the gutter unless its start is moved past it:
Yield syntax-highlighted widgets for a unified diff.
Format addition/deletion counts as styled +N -M content.
Takes the pair as a DiffStats rather than two ints so the counts cannot be
transposed on the way to the places the user reads them โ the `
Keep the bounded source prefixes needed to highlight a diff.
Idempotent, and rehydration depends on it: DiffMessage.__init__ calls this
on whatever it is handed, which is the full file from the liv
Describe the reviewing model in the Auto notice body.
Reverse the XML escaping applied by the js_eval wire format.
The REPL escapes &, <, and > inside result/error blocks; order matters
so & is restored last to avoid double-unescaping.
Parse js_eval output into structured display blocks.
Parses the wire format structurally rather than scanning for any tag-like
substring: the trailing <result>/<error> block is anchored to the
Open the ChatGPT account page in the user's browser.
Used by /auth to let signed-in users jump to chatgpt.com (e.g., to
change account, manage billing).
Return whether a non-empty selection shows only transcript text.
Headers, toggles, hints, status lines, notices, and inline prompts in the conversation are UI chrome, so a selection that touches one
Return text as a Markdown blockquote to append after draft.
A non-empty draft gets at least one blank line before the quote, and the quote ends with a blank line so the user can type below it.
Lay out a whole reply.
Only top-level paragraphs get a bottom margin (Markdown > MarkdownParagraph). AssistantMessage sets margin-bottom: 0 on the
last block so a reply has no trailing blank ro
Parse markdown into the block tree Textual's Markdown would mount.
Return an empty row: block spacing, or a decorative blank row.
Wrap inline content and record how copied text rejoins the lines.
A soft wrap rejoins with the space it replaced, a fold inside a long word with nothing, and a hard break with a newline.
Layer style beneath every part and the fill of rows.
Return the row's parts with its fill drawn out to width cells.
Stack blocks vertically, collapsing adjacent margins like Textual.
The first block's top margin and the last block's bottom margin stay, as they do inside an auto-height Textual container.
Build the copyable entire-thread estimated token/cost table.
Open the live breakdown without stacking duplicate modals.
Deep Agents Code - Interactive AI coding assistant.
CLI-specific rubric middleware customizations.
Unified slash-command registry.
Every slash command is declared once as a SlashCommand entry in COMMANDS.
Bypass-tier frozensets and autocomplete entries are derived automatically โ no
other file
Utilities for handling image and video media from clipboard and files.
Persistent store of MCP server names the user has disabled.
Disabled servers are skipped at config merge time so their tools never reach the agent and no connection is attempted. State lives under `[
User-level credential storage for model providers.
Persists API keys (and, in the future, OAuth tokens) under
~/.deepagents/.state/auth.json (file mode 0600, parent 0700) so users can
enter credent
Bounded, isolated conversation title generation.
Subagent loader for app.
Loads custom subagent definitions from the filesystem. Subagents are defined as markdown files with YAML frontmatter in the agents/ directory.
Validation and environment-variable expansion for MCP server config.
Resolves ${VAR} and ${VAR:-default} references in the supported
configuration fields (command, url, args, env, `header
Detect model replies that a provider cut off before they were complete.
LangChain has no normalized stop reason, so each provider's raw metadata is
read here. output_truncation classifies one messa
Terminal capability detection.
Detect optional terminal features without reading from stdin.
The app only uses kitty-keyboard-protocol support to choose a user-facing newline shortcut label. To ke
First-run onboarding state for the interactive TUI.
Schema and middleware for per-checkpoint state restored when resuming.
ResumeState declares several checkpointed, schema-private channels. They fall
into two groups with different write paths:
W
Shared provider auth status formatting.
Backend recovery at the proxy boundary, before errors reach the wire.
Reasoning effort support for /effort.
Supported levels and defaults come from LangChain model profiles. Provider
integrations translate the standard reasoning_effort constructor parameter
into th
Tool-free side answers from a snapshot of the main conversation.
Large paste collapsing for the chat input.
When the user pastes text exceeding a size or line threshold, the full text
is stored off-screen and a compact [Pasted text #N +M lines] placeholder
is in
Custom tools for the agent.
Canonical internal model-context messages for goal state and continuation.
Goal context is represented as a HumanMessage so it participates in the
provider's normal turn ordering. Its lc_source m
Safe, structured diagnostics for workspace binding and runtime rejections.
When the server refuses to bind or run a thread's workspace, the user sees only a one-line refusal. This module defines the
Provider-native discovery for MCP tools on supported models.
Durable, server-authoritative thread workspace bindings.
Machine-readable JSON output helpers for CLI subcommands.
This module deliberately stays stdlib-only so it can be imported from CLI startup paths without pulling in unnecessary dependency trees.
Agent middleware covering what MCP tools need around every call.
The tools themselves come out of langchain.mcp unmodified. Everything this
app wants on top โ an argument quirk, and translating a d
Thread-resume policy shared by the TUI and non-interactive mode.
Kept free of Textual imports so the headless path can enforce the same resume-age cutoff and working-directory comparison without load
UI-agnostic helpers for resolving an MCP login target.
The MCP login flow historically inlined config discovery, trust gating,
shape validation, and print()-based error reporting. The TUI cannot
co
Dcode-specific ACP approval-mode adapter.
Server-side graph entry point for langgraph dev.
This module is referenced by the generated langgraph.json and exposes a graph
factory that the LangGraph server can load and serve.
The graph is
Persist side-question and naming spend outside the graph's checkpoints.
The sessions database owns this subtotal. Readers add it to the graph's total; it is never fed back into the graph's cost recor
Model discovery data shared by the inference host and model pickers.
Unicode security helpers for deceptive text and URL checks.
This module is intentionally lightweight so it can be imported in display and approval paths without affecting startup performance.
Help screens and argparse utilities for the app.
This module is imported at app startup to wire -h actions into the
argparse tree. It must stay lightweight โ no SDK or langchain imports.
Registry of pending actionable notifications.
Stores plain data for notices the user can act on from a dedicated modal screen. The registry is deliberately UI-agnostic: UI routing (toast click, keybi
Provider-independent model metadata exchanged with the server.
Shared unified-diff helpers.
Every diff passing through this module is "\n"-joined from lines that came
from splitlines() or split("\n"), so no element can contain a line boundary.
That is what
Utilities for project root detection and project-specific configuration.
Ask user middleware for interactive question-answering during agent execution.
Provider policy and pricing helpers for cold prompt-cache warnings.
Agent management and creation.
External editor support for composing prompts.
Clipboard utilities.
Reconcile observed checkout work onto the current turn's traces.
Shared size limits and status vocabulary for model-visible goal state.
Retrospective metadata updates for the current turn's traced runs.
Middleware for injecting local context into system prompt.
Detects git state, project structure, package managers, runtimes, and directory layout by running a bash script via the backend. Because the
One-time migration of legacy state files into ~/.deepagents/.state/.
Earlier versions wrote internal state directly under ~/.deepagents/,
mixing it with user-facing agent directories (so e.g. `mc
Bounded, read-only Git evidence collected in the tool execution environment.
Estimated context audit for the /context-doctor command.
Plugin support for dcode.
Variable substitution for plugin-provided configuration.
Data models for plugins.
CLI helpers for plugin management.
Marketplace parsing for plugins.
Plugin discovery, install, and enablement helpers.
Plugin subsystem adapters.
Adapter from plugin hook declarations to Hooks v2 configuration sources.
Integrations for external systems used by the Deep Agents Code.
Parsing for the [sandboxes] section of ~/.deepagents/config.toml.
Parallels the [models] provider configuration in model_config.py. Config
providers declare a class_path (same trust model a
Sandbox provider interface used by Deep Agents Code.
ChatGPT OAuth integration for the openai_codex model provider.
Thin orchestration layer over langchain_openai.chatgpt_oauth. Reuses the
upstream PKCE/token primitives directly (`_generate_pkce_pa
Discovery and instantiation of sandbox providers.
Merges three provider sources into one registry:
deepagents-code
extras).Hook contracts and compatibility dispatch.
This package contains two hook systems: Hooks v2 (current) and legacy hooks (deprecated, removal September 1, 2026).
To write a new hook integration, use t
Single-owner coordinator for client-side Hooks v2 state.
HooksManager is the only place in the client that builds or holds a
HooksRuntime. The Textual app, the Textual stream adapter, and the hea
Canonical boundary between hook domain and wire models.
Sanitized subprocess environments for Hooks v2 command handlers.
Native dcode tool vocabulary mapped to compatible wire names.
Client-owned Hooks v2 lifecycle facade.
Terminal escape-sequence validation for hook output.
Projection from Hooks v2 domain invocations to compatible wire input.
Lightweight hook dispatch for external tool integration.
DEPRECATED: This is the legacy hook system, kept for backward compatibility until September 1, 2026. New integrations should use Hooks v2 โ se
Translation between PermissionRequest decisions and HITL review payloads.
Shared by the Textual and headless approval paths so both surfaces resolve hook-driven permission decisions identically.
Session-scoped client facade for the Hooks v2 runtime.
Immutable runtime snapshots for Hooks v2 configuration.
Standalone orchestration for the Hooks v2 execution engine.
Helpers for attaching Hooks v2 session identity to graph context.
Validated Hooks v2 configuration loading, merging, and hashing.
Precedence (highest first, earlier in reduction order):
{project_root}/.deepagents/hooks.jsonClient-side fulfillment for server-owned Hooks v2 interrupts.
Event-aware reduction for Hooks v2 command output.
Typed contracts for the hooks system.
Cached runtime validators for hook model boundaries.
Versioned hook invocation transport models.
Validated hook configuration models.
Client-side transport and headless execution for Deep Agents Code.
Resolve dcode -r <id> -n ... into a thread the headless run may continue.
Headless resume never falls back to a new thread. Threads stay bound to the workspace policy they were created with, so onl
Combine independently reported main-task and side-question usage for display.
Client-facing CLI command implementations.
CLI commands of the MCP module.
The dcode tools command group: provision managed external tools.
dcode tools install fetches the pinned, SHA-256-verified ripgrep binary into
the dcode installation (the same managed path used on
CLI commands for the auth group: manage stored provider credentials.
These subcommands mirror the in-TUI /auth modal verbs so credentials can be
managed non-interactively (dotfile bootstrap, CI,
CLI commands for inspecting the configuration surface.
Bare config resolves each option against the app credential store (for
credentials), the live environment, and config.toml, reporting the ef
CLI install path for optional deepagents-code extras.
dcode install <name> installs a curated optional extra (for example a sandbox
or model-provider dependency) into the current dcode environmen
Local LangGraph server launch helpers for Deep Agents Code clients.
Server lifecycle orchestration for the app.
Provides start_server_and_get_agent which handles the full flow of:
ServerConfig from application argumentsProvider-specific MCP OAuth dispatch.
resolve_provider(url) returns the registered policy whose matches
predicate fires for url, with GenericProvider as the fallback.
GitHub-hosted MCP OAuth provider.
GitHub's remote MCP at api.githubcopilot.com authenticates via RFC
8628 Device Authorization Grant โ the app runs the device flow,
persists the resulting token plu
Policy interface for provider-specific MCP OAuth quirks.
Each concrete provider module (e.g. slack, github) subclasses
OAuthProvider to encode its own URL match rule, client metadata, and
any p
Slack-hosted MCP OAuth provider.
Slack's hosted MCP endpoint uses the Authorization Code flow with a default public app or configured app credentials and a fixed loopback redirect URI (`http://localh
Skills module for Deep Agents Code.
Public API:
Stream event that tells the user about unreadable skill sources.
The SDK shows skill load errors only to the model. PluginSkillsMiddleware
also streams the errors for skill directories that exist b
Helpers for loading and formatting skill invocations.
Managed and user configuration: paths, providers, and merge.
Writes live in deepagents_code.configuration.writer and are imported from
there directly, so no writer symbol is re-exported here.
Fixed operating-system paths for managed configuration.
Resolver-backed interpreter configuration snapshots.
Process-local snapshots for managed and user TOML configuration.
Lightweight theme preference coercion shared by config providers and the UI.
User-config-only atomic TOML writes.
Built-in skills that ship with the Deep Agents Code.
These skills are always available at the lowest precedence level. User and project skills with the same name will override them.
Public contract for dcode Python extensions.
Host startup and runtime extension registrations.
Persist project-extension trust decisions.
Resolve extension configuration from user config and environment.
Public registrar passed to Python extension factories.
Textual user interface package for deepagents-code.
Shared keyboard hints for terminal UI components.
Modal footers advertise the same navigation keys in a dozen screens. Keeping the wording here means a binding change is edited once instead of being
Screen UI components.
Textual widgets for deepagents-code.
Import directly from submodules, e.g.:
from deepagents_code.tui.widgets.chat_input import ChatInput
from deepagents_code.tui.widgets.mess
Confirmation prompt for resuming a thread owned by another agent.
In-TUI MCP OAuth login modal.
MCPLoginScreen is both a Textual ModalScreen and an implementation of
OAuthInteraction. The login worker awaits its interaction methods while
the user sees and act
Generic detail modal for a single pending notification.
Used by NotificationCenterScreen when the user drills into an entry
whose payload does not have a dedicated modal (e.g. missing-dependency
no
Onboarding screens for the interactive TUI.
Color-coded context-window visualization for /context.
Prompt for switching cwd when resuming or switching threads.
Tool renderers for approval widgets - registry pattern.
Startup tip widget shown above the chat input.
TUI screens for managing stored model-provider credentials.
AuthPromptScreen accepts an API key for a single provider, persists it via
auth_store, and is the sole place that deletes existing cred
Confirmation modal for /install <package> --package in the TUI.
Arbitrary packages have no curated allowlist to vet against, so installing one pulls in third-party code. Rather than forcing the use
Progress modal for app self-update installs.
Interactive agent selector screen for /agents command.
Goal acceptance-criteria review widget.
Message store for virtualized chat history.
This module provides data structures and management for message virtualization, allowing the TUI to handle large message histories efficiently by keeping o
Notification hub for pending notices and warning preferences.
Surfaces PendingNotification entries as single-line rows plus an expandable
settings section, including when no notices are pending. Se
Confirmation modals for MCP changes that need a server restart.
Restarting the LangGraph server is required for newly minted MCP tokens
and for /mcp disable/enable toggles to take effect, but auto-
Inline prompt history search panel for the chat composer.
Opened by a first Ctrl+R; a second Ctrl+R escalates to the full
PromptClipboardScreen modal. Key handling lives on ChatInput
(`_prompt_se
Read-only MCP server and tool viewer modal.
Interactive theme selector screen for /theme command.
Approval widget for HITL - using standard Textual patterns.
Trust prompt for skills that resolve outside trusted skill directories.
When a /skill:<name> invocation reads a SKILL.md whose resolved path (via
symlink) falls outside every trusted skill root,
Ask user widget for interactive questions during agent execution.
Dedicated modal for the update-available notification.
Shown automatically at startup when a newer version of
deepagents-code is available on PyPI. Surfaces the same actions the
notification center
Loading widget with animated spinner for agent activity.
Persistent inline display for the current goal.
Renderers turning a unified diff into one Static per row.
Rows carry a line-number gutter, a +/- marker, syntax highlighting lifted
from whole-file lexer state, and word-level emphasis on the s
First-enable confirmation modal for Auto mode.
Shown at most once per install (per notice version) before Auto activates. Enter confirms the switch and records the notice; Esc cancels and leaves the
Warning-toggle definitions for the notification hub's settings section.
Interactive reasoning effort selector for /effort.
First-enable confirmation modal before Shift+Tab enters YOLO.
Shown when the user cycles into unrestricted YOLO without a persisted acknowledgement. Enter acknowledges YOLO and records the policy ver
ChatGPT OAuth sign-in screen, reachable via /auth -> openai_codex.
Mirrors the MCP loopback flow in mcp_auth from the user's POV: a modal
shows progress, surfaces the authorize URL inline (so h
Confirmation modal offered when a change needs an owned-server respawn.
Some changes take effect only when the app-owned LangGraph server subprocess
spawns: provider/sandbox extras and --package in
Chat input widget for deepagents-code with autocomplete and history support.
Floating action for asking about selected conversation text.
Confirmation modals for /update dependency-refresh flows in the TUI.
When deepagents-code itself is already on the latest release, /update can
still re-resolve its dependencies to the newest ve
Render a finished assistant reply as one widget.
Textual's Markdown mounts one child widget per block, list item, bullet,
table cell, and fence label. A long transcript therefore holds thousands of
Modal UI components.
Searchable local prompt history modal.
Read-only MCP server details for the debug console.
Action modal shown when policy blocks a launch-time thread resume.
Confirmation modal for switching models with a large context.
Side conversation with follow-ups and app-owned history.
Detailed token and estimated-cost breakdown modal.
Modal for a cold prompt cache: send-time confirmation or expiry handoff.
Editable confirmation for a generated thread name.
Prompt for compacting a large resumed thread.
Persistent warning when a session exceeds its configured cost threshold.
Interactive plugin manager screen.
Clickable tab labels for the plugin manager header.
Plugin manager view models.
Pure plugin manager content builders.
Tagged union of every persisted credential shape, narrowed by type.
Element type of HITLResponse["decisions"].
Value the plugin manager dismisses with.
None means no action is needed: the close check found no pending changes, or
no checker was wired. Textual also produces None for a bare dismiss(), so
h