repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
deepagents | libs/code/deepagents_code/tui/widgets/messages.py | .py | """Message widgets."""
from __future__ import annotations
import ast
import json
import logging
import re
import textwrap
from dataclasses import dataclass
from pathlib import Path
from time import time
from typing import TYPE_CHECKING, Any, ClassVar, Literal, NamedTuple, TypeAlias
from textual import on
from textua... | 5,453 | 223,679 |
deepagents | libs/code/deepagents_code/tui/widgets/theme_selector.py | .py | """Interactive theme selector screen for `/theme` command."""
from __future__ import annotations
import asyncio
import logging
import os
from typing import TYPE_CHECKING, ClassVar, Protocol, runtime_checkable
from textual.binding import Binding, BindingType
from textual.containers import Vertical
from textual.screen... | 402 | 15,857 |
deepagents | libs/code/deepagents_code/tui/widgets/install_confirm.py | .py | """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 user to re-run with
`--force`, this non-blocking modal asks for explicit confirmation before the
install runs. `--force`... | 389 | 13,545 |
deepagents | libs/code/deepagents_code/tui/widgets/mcp_reconnect.py | .py | """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-restarting
interrupts users who want to make several MCP changes back-to-back. The
two `_ReconnectPromptScreen` subcl... | 298 | 9,613 |
deepagents | libs/code/deepagents_code/tui/widgets/status.py | .py | """Status bar widget."""
from __future__ import annotations
import logging
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, get_args
from textual.containers import Horizontal, Vertical
from textual.content import Content
from textual.css.query import NoMatches
... | 1,002 | 35,978 |
deepagents | libs/code/deepagents_code/tui/widgets/skill_trust.py | .py | """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, `load_skill_content` refuses
the read. Rather than forcing the user to quit, edit env/config, and relaunch,
this non-... | 132 | 4,338 |
deepagents | libs/code/deepagents_code/tui/widgets/thread_agent_switch.py | .py | """Confirmation prompt for resuming a thread owned by another agent."""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar, Literal
from textual.binding import Binding, BindingType
from textual.containers import Vertical
from textual.screen import ModalScreen
from textual.widgets import St... | 144 | 4,304 |
deepagents | libs/code/deepagents_code/tui/widgets/history.py | .py | """Command history manager for input persistence."""
from __future__ import annotations
import json
import logging
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pathlib import Path
logger = logging.getLogger(__name__)
class HistoryManager:
"""Manages command history with file persistence.
U... | 195 | 6,825 |
deepagents | libs/code/deepagents_code/tui/widgets/message_store.py | .py | """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 only
a sliding window of widgets in the DOM while storing all message data as
lightweight dataclasses.
The approach i... | 1,129 | 40,832 |
deepagents | libs/code/deepagents_code/tui/widgets/notification_detail.py | .py | """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
notices). Update-available notifications continue to use
`UpdateAvailableScreen`, which adds a changelog row on top of ... | 258 | 8,319 |
deepagents | libs/code/deepagents_code/tui/widgets/model_selector.py | .py | """Interactive model selector screen for `/model` command."""
from __future__ import annotations
import asyncio
import logging
import os
from typing import TYPE_CHECKING, Any, ClassVar, NamedTuple
from textual.binding import Binding, BindingType
from textual.containers import Container, Vertical, VerticalScroll
from... | 2,310 | 97,332 |
deepagents | libs/code/deepagents_code/tui/widgets/tool_widgets.py | .py | """Tool-specific approval widgets for HITL display."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any
from textual.containers import Vertical
from textual.content import Content
from textual.widgets import Markdown, Static
from deepagents_code import theme
from deepagents_code.... | 258 | 9,916 |
deepagents | libs/code/deepagents_code/tui/widgets/mcp_viewer.py | .py | """Read-only MCP server and tool viewer modal."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any, ClassVar, assert_never
from textual.binding import Binding, BindingType
from textual.containers import Vertical, VerticalScroll
from textual.content import Content
from textual.e... | 1,643 | 62,836 |
deepagents | libs/code/deepagents_code/tui/widgets/yolo_mode_notice.py | .py | """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 version; `m`
switches to Manual instead; Esc keeps the previous approval mode. Only Enter
persists the acknowledgement.
... | 183 | 6,371 |
deepagents | libs/code/deepagents_code/tui/widgets/_links.py | .py | """Shared link-click handling for Textual widgets."""
from __future__ import annotations
import ast
import asyncio
import logging
import webbrowser
from typing import TYPE_CHECKING
from deepagents_code.unicode_security import check_url_safety, strip_dangerous_unicode
if TYPE_CHECKING:
from textual.app import Ap... | 262 | 8,983 |
deepagents | libs/code/deepagents_code/tui/widgets/context_usage.py | .py | """Color-coded context-window visualization for `/context`."""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
from textual.binding import Binding, BindingType
from textual.containers import VerticalScroll
from textual.content import Content
from textual.screen import ModalScreen
from t... | 170 | 6,404 |
deepagents | libs/code/deepagents_code/tui/widgets/codex_auth.py | .py | """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 headless / SSH users
can copy it when the browser launch fails), and dismisses once the OAuth
callback completes. The ... | 453 | 16,041 |
deepagents | libs/code/deepagents_code/tui/widgets/autocomplete.py | .py | """Autocomplete system for @ mentions and / commands.
This is a custom implementation that handles trigger-based completion
for slash commands (/) and file mentions (@).
"""
from __future__ import annotations
import asyncio
import logging
import os
import shutil
# S404: subprocess is required for git ls-files to ge... | 901 | 32,527 |
deepagents | libs/code/deepagents_code/tui/widgets/mcp_login.py | .py | """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 acts on the modal's widgets β authorize URLs become
clickable links, paste-back callback URLs go through an inline input... | 540 | 19,933 |
deepagents | libs/code/deepagents_code/tui/modals/resume_compact.py | .py | """Prompt for compacting a large resumed thread."""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
from textual.binding import Binding, BindingType
from textual.containers import Vertical
from textual.screen import ModalScreen
from textual.widgets import Static
from deepagents_code._s... | 122 | 3,579 |
deepagents | libs/code/deepagents_code/tui/modals/plugin_manager/state.py | .py | """Plugin manager state loading."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Sequence, Set as AbstractSet
from deepagents_code.mcp_tools import MCPServerInfo
from deepagents_code.plugins.mode... | 347 | 11,892 |
deepagents | libs/code/deepagents_code/tui/modals/plugin_manager/models.py | .py | """Plugin manager view models."""
from dataclasses import dataclass
from typing import Literal
from deepagents_code.plugins.models import UnsupportedComponent
PluginTab = Literal["discover", "installed", "marketplaces", "errors", "settings"]
PluginManagerView = Literal[
"list",
"add_marketplace",
"plugin... | 87 | 2,634 |
deepagents | libs/code/deepagents_code/tui/modals/plugin_manager/tabs.py | .py | """Clickable tab labels for the plugin manager header."""
from __future__ import annotations
from typing import TYPE_CHECKING, Final
from textual.message import Message
from textual.widgets import Static
if TYPE_CHECKING:
from textual.events import Click
from deepagents_code.tui.modals.plugin_manager.model... | 73 | 1,887 |
deepagents | libs/code/deepagents_code/tui/modals/plugin_manager/__init__.py | .py | """Interactive plugin manager screen."""
from __future__ import annotations
import asyncio
import logging
from typing import TYPE_CHECKING, ClassVar
from textual import work
from textual.binding import Binding, BindingType
from textual.containers import Horizontal, Vertical
from textual.content import Content
from t... | 1,068 | 42,072 |
deepagents | libs/code/deepagents_code/tui/modals/plugin_manager/content.py | .py | """Pure plugin manager content builders."""
from typing import Literal
from textual.content import Content
from textual.widgets.option_list import Option
from deepagents_code.config import get_glyphs
from deepagents_code.tui.modals.plugin_manager.models import _MarketplaceRow, _PluginRow
def _plugin_options(
r... | 306 | 10,653 |
deepagents | libs/code/deepagents_code/mcp_providers/slack.py | .py | """Slack-hosted MCP OAuth provider.
Slack's hosted MCP endpoint uses the Authorization Code flow with a
hardcoded public client ID and a fixed pre-registered loopback redirect
URI (`http://localhost:3118/callback`). The local callback server listens
on that port so the browser redirect completes automatically. An opti... | 176 | 6,563 |
deepagents | libs/code/deepagents_code/mcp_providers/__init__.py | .py | """Provider-specific MCP OAuth dispatch.
`resolve_provider(url)` returns the registered policy whose `matches`
predicate fires for `url`, with `GenericProvider` as the fallback.
"""
from deepagents_code.mcp_providers._registry import resolve_provider
from deepagents_code.mcp_providers.base import (
GenericProvide... | 24 | 632 |
deepagents | libs/code/deepagents_code/mcp_providers/base.py | .py | """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 pre-handshake login steps (preseeding client info, running a
device flow, prompting for workspace IDs). `mcp_auth` dis... | 134 | 4,810 |
deepagents | libs/code/deepagents_code/mcp_providers/github.py | .py | """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 plus a stub client-info record, and skips
the standard Authorization Code handshake entirely.
"""
from __future__ impor... | 103 | 3,586 |
deepagents | libs/code/deepagents_code/mcp_providers/_registry.py | .py | """Ordered provider registry for MCP OAuth dispatch.
`resolve_provider` walks `_REGISTRY` in order and returns the first
provider whose `matches(url)` is `True`. `GenericProvider` sits last so
spec-compliant servers always resolve to a usable policy.
"""
from __future__ import annotations
from deepagents_code.mcp_pr... | 40 | 1,294 |
deepagents | libs/code/deepagents_code/skills/trust.py | .py | """Trust store for skill directories that resolve outside trusted roots.
`load_skill_content` refuses to read a `SKILL.md` whose resolved path falls
outside every trusted skill root β this stops a symlink inside a skill
directory from reading arbitrary files. The static escape hatch is the
`DEEPAGENTS_CODE_EXTRA_SKILL... | 547 | 22,088 |
deepagents | libs/code/deepagents_code/skills/load.py | .py | """Skill loader for CLI commands.
This module provides filesystem-based skill discovery for CLI operations
(list, create, info, delete). It wraps the prebuilt middleware functionality from
deepagents.middleware.skills and adapts it for direct filesystem access
needed by CLI commands.
For middleware usage within agent... | 223 | 8,611 |
deepagents | libs/code/deepagents_code/skills/__init__.py | .py | """Skills module for Deep Agents Code.
Public API:
- execute_skills_command: Execute skills subcommands (list/create/info/delete)
- setup_skills_parser: Setup argparse configuration for skills commands
All other components are internal implementation details.
"""
from deepagents_code.skills.commands import (
exe... | 19 | 440 |
deepagents | libs/code/deepagents_code/skills/merge.py | .py | """Shared skill-merge helper with override (name-collision) debug logging.
Both skill discovery paths β the CLI `skills list` loader
(`deepagents_code.skills.load`) and the runtime agent loader
(`deepagents_code.plugins.adapters.skills_middleware.PluginSkillsMiddleware`) β
merge skills from multiple sources by precede... | 67 | 2,594 |
deepagents | libs/code/deepagents_code/skills/commands.py | .py | """CLI commands for skill management."""
from __future__ import annotations
import argparse
import shutil
from pathlib import Path
from typing import TYPE_CHECKING, Any, assert_never
if TYPE_CHECKING:
from collections.abc import Callable
from deepagents.middleware.skills import SkillMetadata
from deepa... | 1,253 | 43,492 |
deepagents | libs/code/deepagents_code/skills/invocation.py | .py | """Helpers for loading and formatting skill invocations."""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from pathlib import Path
from deepagents_code.skills.load import ExtendedSkillMetadata
@dataclass(frozen=True)
class Skil... | 121 | 4,446 |
deepagents | libs/code/deepagents_code/built_in_skills/__init__.py | .py | """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.
"""
| 6 | 190 |
deepagents | libs/code/deepagents_code/built_in_skills/deepagents-thread-inspector/scripts/inspect_sessions.py | .py | #!/usr/bin/env python3
"""Inspect conversations in the local Deep Agents Code session store."""
from __future__ import annotations
import argparse
import importlib
import json
import os
import shutil
import sqlite3
import subprocess # noqa: S404 # Used only to probe resolved dcode Python launchers.
import sys
impor... | 639 | 23,028 |
deepagents | libs/code/deepagents_code/built_in_skills/skill-creator/scripts/quick_validate.py | .py | #!/usr/bin/env python3
"""Quick validation script for skills - minimal version.
For deepagents CLI, skills are located at:
~/.deepagents/<agent>/skills/<skill-name>/
Example:
```python
python quick_validate.py ~/.deepagents/agent/skills/my-skill
```
"""
import re
import sys
from pathlib import Path
import yaml
de... | 159 | 5,048 |
deepagents | libs/code/deepagents_code/built_in_skills/skill-creator/scripts/init_skill.py | .py | #!/usr/bin/env python3
"""Skill Initializer - Creates a new skill from template.
Usage:
init_skill.py <skill-name> --path <path>
Examples:
init_skill.py my-new-skill --path skills/public
init_skill.py my-api-helper --path skills/private
init_skill.py custom-skill --path /custom/location
For deepagents CLI:
init... | 367 | 13,104 |
deepagents | libs/code/deepagents_code/plugins/commands_cli.py | .py | """CLI helpers for plugin management."""
from __future__ import annotations
import argparse
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from collections.abc import Callable
from deepagents_code.plugins import (
add_marketplace_source,
install_plugin,
list_available_plugins,
remove_ma... | 226 | 8,189 |
deepagents | libs/code/deepagents_code/plugins/manifest.py | .py | """Plugin manifest parsing for plugins."""
from __future__ import annotations
import json
import logging
import re
from pathlib import Path, PureWindowsPath
from deepagents_code.plugins._json import json_object
from deepagents_code.plugins.models import (
ComponentInventory,
JsonObject,
PluginManifest,
... | 350 | 11,131 |
deepagents | libs/code/deepagents_code/plugins/models.py | .py | """Data models for plugins."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Literal
from deepagents_code.json_types import JsonObject, JsonValue # noqa: TC001, F401
if TYPE_CHECKING:
from pathlib import Path
MarketplaceSourceType = Literal["dire... | 245 | 6,856 |
deepagents | libs/code/deepagents_code/plugins/substitution.py | .py | """Variable substitution for plugin-provided configuration."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pathlib import Path
from deepagents_code.plugins.models import JsonValue
def plugin_environment(
*, plugin_root: Path, plugin_data: Path, project_di... | 108 | 2,947 |
deepagents | libs/code/deepagents_code/plugins/store.py | .py | """State storage for dcode plugin marketplaces, installs, and enablement."""
from __future__ import annotations
import json
import logging
import os
import shutil
import tempfile
from contextlib import contextmanager, suppress
from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING, Any, ... | 586 | 18,073 |
deepagents | libs/code/deepagents_code/plugins/__init__.py | .py | """Plugin support for dcode."""
from deepagents_code.plugins.discovery import (
add_local_marketplace,
add_marketplace_source,
discover_plugins,
install_plugin,
list_available_plugins,
list_installed_plugin_ids,
remove_marketplace,
set_installed_plugin_enabled,
uninstall_plugin,
)
f... | 29 | 720 |
deepagents | libs/code/deepagents_code/plugins/discovery.py | .py | """Plugin discovery, install, and enablement helpers."""
from __future__ import annotations
import logging
import shutil
from functools import partial
from pathlib import Path
from deepagents_code.plugins.manifest import (
PluginManifestError,
build_inventory,
load_manifest,
)
from deepagents_code.plugin... | 541 | 18,347 |
deepagents | libs/code/deepagents_code/plugins/marketplace.py | .py | """Marketplace parsing for plugins."""
from __future__ import annotations
import json
import logging
import os
import re
import shutil
import subprocess # noqa: S404 # Git is invoked with fixed argv and no shell.
import tempfile
import urllib.error
import urllib.request
from pathlib import Path
from typing import T... | 810 | 27,472 |
deepagents | libs/code/deepagents_code/plugins/_json.py | .py | """Internal JSON normalization helpers."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from deepagents_code.plugins.models import JsonObject, JsonValue
def json_value(value: object) -> JsonValue | None:
"""Normalize a decoded value to the supported JSON type.
... | 46 | 1,423 |
deepagents | libs/code/deepagents_code/plugins/adapters/mcp.py | .py | """Adapter from plugin MCP declarations to dcode MCP config dictionaries."""
from __future__ import annotations
import json
import logging
import re
from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING
from deepagents_code.plugins._json import json_object, json_value
from deepagents_c... | 261 | 8,887 |
deepagents | libs/code/deepagents_code/plugins/adapters/hooks.py | .py | """Adapter from plugin hook declarations to Hooks v2 configuration sources."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from deepagents_code.hooks.loading import PluginHooksSource, read_hooks_json
from deepagents_code.hooks.models.domain import HookDiagnostic, HookEvent
from... | 158 | 5,617 |
deepagents | libs/code/deepagents_code/plugins/adapters/skills.py | .py | """Adapter from discovered plugins to `SkillsMiddleware` sources."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, TypeAlias
if TYPE_CHECKING:
from deepagents_code.plugins.models import PluginInstance
logger = logging.getLogger(__name__)
SkillPath:... | 134 | 4,173 |
deepagents | libs/code/deepagents_code/plugins/adapters/skills_middleware.py | .py | """Code-local skills middleware adapter for plugin namespaces."""
from __future__ import annotations
import asyncio
import logging
from pathlib import Path, PurePosixPath
from typing import TYPE_CHECKING, cast
from deepagents.backends.protocol import FileInfo, LsResult
from deepagents.backends.utils import to_posix_... | 373 | 13,875 |
deepagents | libs/code/deepagents_code/integrations/sandbox_factory.py | .py | """Sandbox lifecycle management with provider abstraction."""
from __future__ import annotations
import contextlib
import importlib
import importlib.util
import logging
import os
import shlex
import string
import time
from contextlib import contextmanager
from datetime import timedelta
from pathlib import Path
from t... | 1,125 | 40,162 |
deepagents | libs/code/deepagents_code/integrations/sandbox_provider.py | .py | """Sandbox provider interface used by Deep Agents Code."""
from __future__ import annotations
import asyncio
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal
if TYPE_CHECKING:
from deepagents.backends.protocol import SandboxBackendProtocol
@da... | 138 | 4,274 |
deepagents | libs/code/deepagents_code/integrations/sandbox_registry.py | .py | """Discovery and instantiation of sandbox providers.
Merges three provider sources into one registry:
1. Built-in providers curated in this repo (installed as `deepagents-code`
extras).
2. Entry-point providers published by third-party packages under the
`deepagents_code.sandbox_providers` group.
3. Config-decl... | 351 | 12,591 |
deepagents | libs/code/deepagents_code/integrations/openai_codex.py | .py | """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_pair`,
`_build_authorize_url`, `_CallbackHandler`, `_post_form`,
`_token_from_response`, `_FileChatGPTOAuthTokenProvide... | 552 | 22,908 |
deepagents | libs/code/deepagents_code/integrations/sandbox_config.py | .py | """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 as model `class_path`),
a `working_dir`, an optional install `package`, and `params` forwarded to
`provider.get_or_cre... | 199 | 6,982 |
deepagents | libs/code/tests/unit_tests/test_imports.py | .py | """Test importing files."""
import pytest
def test_imports() -> None:
"""Test importing deepagents modules."""
from deepagents_code import (
agent,
integrations,
)
from deepagents_code.main import cli_main
class TestLazyPackageGetattr:
"""Tests for __init__.py lazy __getattr__ r... | 30 | 819 |
deepagents | libs/code/tests/unit_tests/test_session_stats.py | .py | """Tests for _session_stats module."""
from __future__ import annotations
from io import StringIO
from types import SimpleNamespace
import pytest
from langchain_core.messages import AIMessage, AIMessageChunk
from rich.console import Console
from deepagents_code._session_stats import (
ModelStats,
RecordedRe... | 937 | 34,334 |
deepagents | libs/code/tests/unit_tests/test_main_args.py | .py | """Tests for command-line argument parsing."""
import argparse
import asyncio
import io
import os
import sys
from collections.abc import Callable
from contextlib import AbstractContextManager
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code.config impo... | 3,426 | 136,835 |
deepagents | libs/code/tests/unit_tests/test_extras_info.py | .py | """Tests for optional-dependency status inspection."""
import tomllib
from collections.abc import Iterator
from importlib.metadata import PackageNotFoundError
from pathlib import Path
from unittest.mock import MagicMock, PropertyMock, patch
import pytest
from packaging.requirements import Requirement
from deepagents... | 1,757 | 73,053 |
deepagents | libs/code/tests/unit_tests/test_hatch_build.py | .py | """Unit tests for the `hatch_build.py` release-commit stamping hook.
`hatch_build.py` lives at the package root (not inside `deepagents_code`) and is
only on `sys.path` during a build, so it is loaded here directly from its file
path. The hook subclasses hatchling's `BuildHookInterface`, so these tests
require `hatchl... | 160 | 5,779 |
deepagents | libs/code/tests/unit_tests/test_command_registry.py | .py | """Unit tests for the unified slash-command registry."""
from __future__ import annotations
import importlib.util
import re
from pathlib import Path
from deepagents_code.command_registry import (
ALL_CLASSIFIED,
ALWAYS_IMMEDIATE,
BYPASS_WHEN_CONNECTING,
COMMANDS,
HIDDEN_COMMANDS,
IMMEDIATE_UI... | 388 | 14,768 |
deepagents | libs/code/tests/unit_tests/test_notifications.py | .py | """Unit tests for `NotificationRegistry` and payload types."""
from __future__ import annotations
import logging
import pytest
from deepagents_code.notifications import (
ActionId,
MissingDepPayload,
NotificationAction,
NotificationRegistry,
PendingNotification,
UpdateAvailablePayload,
)
d... | 207 | 7,106 |
deepagents | libs/code/tests/unit_tests/test_startup_fast_paths.py | .py | """Tests for lightweight CLI help-only paths.
Each test runs `cli_main` in a subprocess so `sys.modules` reflects only
what that invocation loaded, guarding the startup-perf contract documented
in `CLAUDE.md`.
"""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
import text... | 337 | 11,420 |
deepagents | libs/code/tests/unit_tests/test_git.py | .py | """Unit tests for the deepagents_code._git module."""
import subprocess
from collections.abc import Iterator
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from deepagents_code._git import (
RepositoryMetadata,
_abbreviate_git_ref,
_git_dir_cache,
_normalize_lookup_... | 801 | 30,702 |
deepagents | libs/code/tests/unit_tests/test_offload.py | .py | """Unit tests for /offload slash command."""
from __future__ import annotations
import os
import stat
import tempfile
from contextlib import nullcontext
from pathlib import Path, PureWindowsPath
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents.backends.utils ... | 2,606 | 100,933 |
deepagents | libs/code/tests/unit_tests/test_debug_buffer.py | .py | """Tests for the in-memory log ring buffer backing the Debug Console."""
from __future__ import annotations
import logging
import os
import sys
import threading
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
import deepagents_code._debug_buffer as debug_buffer
from deepagents_code._d... | 379 | 15,089 |
deepagents | libs/code/tests/unit_tests/test_end_to_end.py | .py | """End-to-end unit tests for deepagents-code with fake LLM models."""
import uuid
from collections.abc import Callable, Generator, Sequence
from contextlib import contextmanager
from pathlib import Path
from typing import Any
from unittest.mock import patch
from deepagents.backends import CompositeBackend
from deepag... | 447 | 17,501 |
deepagents | libs/code/tests/unit_tests/test_media_utils.py | .py | """Tests for media utilities.
Covers clipboard detection, base64 encoding, and multimodal content.
"""
import base64
import io
from pathlib import Path
from unittest.mock import MagicMock, patch
from PIL import Image
from deepagents_code.input import MediaTracker
from deepagents_code.media_utils import (
ImageD... | 1,122 | 44,496 |
deepagents | libs/code/tests/unit_tests/test_server.py | .py | """Tests for server lifecycle helpers."""
from __future__ import annotations
import asyncio
import contextlib
import logging
import os
import signal
import socket
import subprocess
import threading
from types import SimpleNamespace
from typing import TYPE_CHECKING, Self
from unittest.mock import AsyncMock, MagicMock,... | 2,054 | 77,319 |
deepagents | libs/code/tests/unit_tests/test_cursor_blink.py | .py | """Tests for cursor-blink preference loading."""
from __future__ import annotations
from typing import TYPE_CHECKING
from deepagents_code.app import (
_load_cursor_blink_preference,
)
if TYPE_CHECKING:
from pathlib import Path
import pytest
class TestLoadCursorBlinkPreference:
"""_load_cursor_bli... | 60 | 2,203 |
deepagents | libs/code/tests/unit_tests/test_env_vars.py | .py | """Drift-detection tests for the CLI environment variable registry.
These tests ensure that:
1. Every `DEEPAGENTS_CODE_*` constant in `_env_vars.py` has a matching
value used somewhere in source code (no stale entries).
2. No source file outside `_env_vars.py` uses a bare string literal like
`"DEEPAGENTS_CODE_F... | 136 | 5,416 |
deepagents | libs/code/tests/unit_tests/test_json_types.py | .py | """Tests for shared JSON type aliases and validators."""
import pytest
from pydantic import ValidationError
from deepagents_code.json_types import (
JSON_OBJECT_ADAPTER,
JSON_VALUE_ADAPTER,
JsonObject,
JsonValue,
)
from deepagents_code.plugins.models import (
JsonObject as PluginJsonObject,
Js... | 36 | 1,121 |
deepagents | libs/code/tests/unit_tests/test_sandbox_provider.py | .py | """Tests for sandbox provider metadata value types."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
import pytest
from deepagents_code.integrations.sandbox_provider import (
SandboxInstallHint,
SandboxProvider,
)
if TYPE_CHECKING:
from deepagents.backends.protocol i... | 51 | 1,481 |
deepagents | libs/code/tests/unit_tests/test_mcp_config.py | .py | """Tests for MCP configuration environment-variable expansion."""
from __future__ import annotations
from typing import Any
import pytest
from deepagents_code.mcp_config import resolve_mcp_server_env
class TestResolveMcpServerEnv:
"""Tests for supported `.mcp.json` interpolation fields."""
def test_resol... | 215 | 7,948 |
deepagents | libs/code/tests/unit_tests/test_glm_5p2_profile.py | .py | """Tests for the GLM-5.2 Deep Agents Code harness profile."""
from __future__ import annotations
import asyncio
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, cast
from unittest.mock import MagicMock
import pytest
from langchain.agents.middleware.types import ModelRequest, ModelResponse
fro... | 364 | 10,852 |
deepagents | libs/code/tests/unit_tests/test_input_parsing.py | .py | """Unit tests for input parsing utilities."""
from pathlib import Path
import pytest
from deepagents_code.input import (
ParsedPastedPathPayload,
dropped_payload_paths,
extract_leading_pasted_file_path,
normalize_pasted_path,
parse_file_mentions,
parse_pasted_file_paths,
parse_pasted_path... | 673 | 22,696 |
deepagents | libs/code/tests/unit_tests/test_debug_console.py | .py | r"""Tests for the Debug Console modal and its `Ctrl+\` / `/debug` toggle."""
from __future__ import annotations
import logging
from types import SimpleNamespace
from typing import TYPE_CHECKING, cast
from unittest.mock import MagicMock
from textual.app import App, ComposeResult
from textual.screen import ModalScreen... | 2,003 | 79,531 |
deepagents | libs/code/tests/unit_tests/test_config_recursion_limit.py | .py | """Regression tests for the main-agent recursion limit default.
Guards that the runnable-config default the agent applies via `.with_config`
stays at the intended value and remains single-sourced from the manifest, so a
stray edit to either constant is caught immediately.
"""
from __future__ import annotations
from ... | 22 | 802 |
deepagents | libs/code/tests/unit_tests/test_dep_floor_check.py | .py | """Unit tests for the editable-install dependency floor check."""
from __future__ import annotations
import builtins
import json
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Mapping, Sequence
from types import ModuleType
import pytest
import deepag... | 726 | 28,300 |
deepagents | libs/code/tests/unit_tests/test_tool_display.py | .py | """Unit tests for deepagents_code/tool_display.py.
All functions under test are pure (no I/O, no async, no TUI). A single
module-level autouse fixture pins `get_glyphs()` to `ASCII_GLYPHS` so
assertions are deterministic regardless of terminal configuration.
"""
from __future__ import annotations
from pathlib import... | 574 | 22,184 |
deepagents | libs/code/tests/unit_tests/test_compact_tool.py | .py | """CLI-specific tests for compact_conversation tool (HITL gating, display).
Core compact tool logic tests live in the SDK at
`libs/deepagents/tests/unit_tests/middleware/test_compact_tool.py`.
"""
from __future__ import annotations
import warnings
from types import MethodType, SimpleNamespace
from typing import TYPE... | 729 | 30,215 |
deepagents | libs/code/tests/unit_tests/test_approval_mode.py | .py | """Tests for live approval-mode store helpers."""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, cast
import pytest
if TYPE_CHECKING:
from pathlib import Path
from deepagents_code.approval_mode import (
APPROVAL_MODE_NAMESPACE,
AUTO_NOTICE_VE... | 430 | 13,714 |
deepagents | libs/code/tests/unit_tests/test_model_switch.py | .py | """Tests for model switching functionality."""
from collections.abc import Iterator
from pathlib import Path
from typing import Any
from unittest.mock import AsyncMock, Mock, patch
import pytest
from textual.app import App, ComposeResult
from deepagents_code import model_config
from deepagents_code.app import (
... | 1,536 | 60,543 |
deepagents | libs/code/tests/unit_tests/test_model_config.py | .py | """Tests for model_config module."""
import io
import logging
import sys
import threading
import tomllib
from collections.abc import Iterator
from contextlib import AbstractContextManager, suppress
from pathlib import Path
from typing import Any, ClassVar, cast
from unittest.mock import MagicMock, patch
import pytest... | 8,515 | 327,615 |
deepagents | libs/code/tests/unit_tests/test_reload.py | .py | """Tests for runtime config reload behavior."""
from __future__ import annotations
import logging
import os
import threading
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock
import dotenv as _dotenv_module
import pytest
from deepagents_code import _env_vars
from deepagents_code.comman... | 2,172 | 83,023 |
deepagents | libs/code/tests/unit_tests/test_onboarding.py | .py | """Tests for first-run onboarding state."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from deepagents_code._env_vars import ONBOARDING
from deepagents_code.onboarding import (
GOAL_AUTO_ACCEPT_PROMPT_MARKER_FILENAME,
ONBOARDING_MARKER_FILENAME,
ONBOARDING_NAME_MEM... | 358 | 13,436 |
deepagents | libs/code/tests/unit_tests/test_repository_bounds.py | .py | """Unit tests for the shared repository-inspection bounds."""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
import pytest
from deepagents.backends.protocol import LsResult
from deepagents_code._repository_bounds import (
REPOSITORY_DIRECTORY_ENTRY_LIMIT,... | 241 | 9,199 |
deepagents | libs/code/tests/unit_tests/test_terminal_capabilities.py | .py | """Tests for terminal capability detection."""
from __future__ import annotations
import contextlib
import os
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
from deepagents_code import terminal_capabilities
from deepagents_code._env_vars import KITTY_KEYBOARD
from deepagents_code.termina... | 204 | 7,518 |
deepagents | libs/code/tests/unit_tests/test_cursor_style.py | .py | """Tests for chat input cursor-style preference loading."""
from __future__ import annotations
from typing import TYPE_CHECKING
from deepagents_code._env_vars import CURSOR_STYLE
from deepagents_code.app import DeepAgentsApp, _load_cursor_style_preference
if TYPE_CHECKING:
from pathlib import Path
import p... | 57 | 1,911 |
deepagents | libs/code/tests/unit_tests/test_ask_user_middleware.py | .py | """Unit tests for ask_user middleware helpers and prompt injection."""
from __future__ import annotations
import logging
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, cast
from unittest.mock import AsyncMock, Mock, patch
import pytest
from langchain_core.messages import HumanMessage, Syste... | 559 | 20,679 |
deepagents | libs/code/tests/unit_tests/test_debug.py | .py | """Tests for _debug.configure_debug_logging."""
from __future__ import annotations
import importlib
import logging
import os
from unittest.mock import patch
import deepagents_code
from deepagents_code._debug import (
configure_debug_logging,
installed_debug_log_path,
resolve_log_level,
)
class TestReso... | 399 | 15,870 |
deepagents | libs/code/tests/unit_tests/test_ask_user_types.py | .py | """Tests for the shared `ask_user` wire format helpers.
`_parse_answers` covers these indirectly, but it validates its payload first, so
the defensive fallbacks below are unreachable through it β coverage reports the
module fully executed because both live in ternaries inside a comprehension,
which is not counted as a... | 119 | 4,400 |
deepagents | libs/code/tests/unit_tests/test_main_acp_mode.py | .py | """Unit tests for ACP mode behavior in `cli_main`."""
from __future__ import annotations
import argparse
import asyncio
import sys
from contextlib import asynccontextmanager
from inspect import signature
from types import SimpleNamespace
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock,... | 466 | 18,041 |
deepagents | libs/code/tests/unit_tests/test_config.py | .py | """Tests for config module including project discovery utilities."""
import logging
import time
import warnings
from collections.abc import Iterator
from pathlib import Path
from typing import Any, ClassVar
from unittest.mock import Mock, patch
import pytest
from deepagents_code import _git as git_module, model_conf... | 7,267 | 295,451 |
deepagents | libs/code/tests/unit_tests/test_mcp_disabled.py | .py | """Tests for the MCP disabled-servers persistence store."""
from pathlib import Path
from deepagents_code.mcp_disabled import (
get_disabled_servers,
is_server_disabled,
set_server_disabled,
)
class TestGetDisabledServers:
"""Tests for `get_disabled_servers`."""
def test_empty_when_no_file(self... | 183 | 7,787 |
deepagents | libs/code/tests/unit_tests/test_theme.py | .py | """Tests for deepagents_code.theme module."""
from __future__ import annotations
import logging
from dataclasses import fields
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, cast
import pytest
from deepagents_code._env_vars import THEME
if TYPE_CHECKING:
from pathlib import Path
... | 3,107 | 114,188 |
deepagents | libs/code/tests/unit_tests/test_mcp_auth.py | .py | """Tests for MCP OAuth helpers."""
from __future__ import annotations
import asyncio
import contextlib
import json
import logging
import re
import threading
import time
from pathlib import Path
from typing import Any, Literal, cast
from unittest.mock import patch
import anyio
import httpx
import pytest
from mcp.clie... | 4,084 | 159,890 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.