Commit Graph

12 Commits

Author SHA1 Message Date
Mason Daugherty 9fdd498937 feat(code): move /goal criteria generation server-side (#4754)
`/goal` acceptance-criteria drafting now runs on the agent server and
can use conversation, repository, web, and explicitly read-only
configured MCP context while preserving resumable review state.

---

Previously, `/goal` proposals were drafted in the client process from
the explicit objective, so remote or sandbox repository context and
references to the current conversation were unavailable. This moves
proposal and amendment drafting into a nested agent in the main server
graph, where it can use recent conversation context, bounded read-only
repository search, `fetch_url`, optional web search, and configured MCP
tools explicitly annotated as read-only.

Repository context remains read-only and repository-rooted across
backends: local reads use a virtual project root, while sandbox reads
are constrained to the provider's declared working directory, including
canonical-path checks that reject symlink escapes.

Proposals are stored as pending checkpoint state rather than chat
messages, so review survives remote interrupts and resumes without
polluting the coding conversation. Each proposal is correlated with its
originating request, and criteria requests are cleared after success,
failure, or cancellation without clearing newer requests. Cancelling
criteria generation stops the server run without adding normal
chat-interruption messages. The client refreshes checkpoint state after
generation and reuses the existing accept, edit, and reject flow; model
profile overrides now cross the client/server boundary consistently.
2026-07-15 17:17:41 -04:00
Hunter Lovell b0beef1fd1 test(code): update sandbox overwrite expectation (#4737)
Updates the deepagents-code sandbox integration suite to match the
current `write()` contract: writing to an existing file replaces its
contents rather than returning an error. This keeps the Python test
expectation aligned with the overwrite behavior covered by the
corresponding deepagentsjs standard tests.

## Changes

- Rename the existing-file write test to describe overwrite behavior.
- Assert that the second write succeeds and that the replacement content
is persisted.
- Update the sandbox operations module overview to include overwriting
existing files.
2026-07-15 10:13:52 -04:00
Mason Daugherty 36051e2a6c fix(code): put local offloaded tool results on the real filesystem (#4740)
In dcode local mode, offloaded large tool results previously lived
behind a virtual `CompositeBackend` route backed by a hidden `mkdtemp`
`FilesystemBackend`. Because `execute` always runs on the default
backend (never path-routed), the agent could not open those results with
`jq`/`grep`/`python` by the path it was handed — the
`/large_tool_results/` prefix wasn't a real inode, and the temp root was
intentionally hidden.

This points `CompositeBackend.artifacts_root` at a stable, hardened
per-user temp dir and drops the `/large_tool_results/` route, so
offloaded results fall through to the default `LocalShellBackend` at a
real path. The agent can now inspect them with `execute` using the exact
path the offload message hands it — no virtual-path translation, no
copy-out/in. Conversation history keeps a dedicated route to persistent
`~/.deepagents` storage so `/offload` archives survive restarts, and its
address stays stable across restarts because the artifacts root is
deterministic per user.

This uses the existing `artifacts_root` support on `CompositeBackend`
(already consumed by both the filesystem and summarization middleware),
so it is a dcode-only change with no SDK edit. The artifacts dir is
created `0o700` with an ownership/`S_ISDIR` guard and falls back to a
private unique dir if the predictable path is squatted; consolidating on
one per-user dir also removes the old unbounded `mkdtemp`-per-session
leak.

The rubric grader's read allow-list now derives its permitted prefix
from `artifacts_root` rather than a hardcoded `/large_tool_results/`.

Made by [Open
SWE](https://openswe.vercel.app/agents/e815e778-3188-4f2e-1068-e52819c024a7)

## References
- Plan:
https://openswe.vercel.app/agents/e815e778-3188-4f2e-1068-e52819c024a7/plan

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-07-15 09:24:20 -04:00
Mason Daugherty 564e5a05bc fix(code): run /offload server-side (#4696)
`/offload` now stores archived conversation history through the agent's
backend.

---

`/offload` previously summarized and saved conversation history in the
client process. In server and sandbox modes, that process does not own
the backend used by the agent: persistence could fail against a
read-only filesystem, and even a successfully written archive would not
be available to the agent through `read_file`.

This changes Deep Agents Code to run the existing `compact_conversation`
tool through the active agent instead. The command seeds a tool call
into the thread, approves the expected human-in-the-loop interrupt
because the user explicitly requested `/offload`, resumes the graph, and
reads the persisted summarization event back from server state. The
archive is therefore written through the agent's composite backend and
remains readable by the agent in local, server, and sandbox runs.

The old client-side `perform_offload` helper (and its `OffloadResult` /
`OffloadThresholdNotMet` / `OffloadModelError` result types) is removed,
as summarization and persistence now run through the agent. In local
mode, the `conversation_history` backend now roots under `~/.deepagents`
(via `_offload_fallback_root`, with a hardened private-temp fallback
when the home directory is not writable) instead of a throwaway
`tempfile.mkdtemp` directory, so offloaded history persists across
sessions.

The SDK's `compact_conversation` API is unchanged; this PR is confined
to Deep Agents Code.

Made by [Open
SWE](https://openswe.vercel.app/agents/1cbc308e-b411-2a09-bd6b-541e606ca4c5)

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-07-14 15:03:45 -04:00
Mason Daugherty 8ee2d6affe refactor(code): move Textual adapter into tui package (#4532)
Continues the dcode package restructure by giving the Textual execution
adapter a canonical home under `deepagents_code.tui`. Shared session
stats formatting now lives outside the TUI layer so headless and client
paths do not need to import Textual-facing code.

## Changes
- Moves `TextualUIAdapter` and `execute_task_textual` under the TUI
package and updates app, integration, benchmark, and unit-test imports
to use the new canonical path.
- Keeps `client/non_interactive` and shared command logic independent of
`deepagents_code.tui` by moving `print_usage_table` alongside
`SessionStats` and `format_token_count`.
- Relocates adapter-specific tests under the matching
`tests/unit_tests/tui` layout and moves shared session-stat coverage to
the existing `_session_stats` test module.
- Refreshes threat-model and inline references that described the old
flat adapter location.
2026-07-06 17:05:58 -04:00
Mason Daugherty 5f4820d292 refactor(code): move Textual widgets into tui package (#4527)
Continues the dcode package restructure by giving Textual-only widgets a
canonical home under `deepagents_code.tui`. The move keeps the UI layer
grouped separately from the client runtime package without adding
old-path compatibility shims.

## Changes
- Moves the full Textual widget package under
`deepagents_code.tui.widgets`, including message rendering, modal
screens, selectors, status UI, and tool display widgets.
- Updates `DeepAgentsApp`, `TextualUIAdapter`, and widget internals to
import from the new canonical TUI package.
- Relocates widget-focused unit tests under the matching
`tests/unit_tests/tui/widgets` layout and updates remaining test
patch/import targets.
- Refreshes local package guidance so contributor docs point at the new
widget paths.
2026-07-06 16:29:36 -04:00
Mason Daugherty 49bffe2145 refactor(code): move client runtime modules into package (#4523)
Starts the dcode package restructure by giving client-facing runtime
code a canonical home under `deepagents_code.client`.

- Moves the local LangGraph server helpers under `client.launch` and
moves `RemoteAgent` plus headless `run_non_interactive` under `client`.
- Updates app, CLI, and tests to import the new canonical paths directly
without compatibility alias modules.
- Changes runtime workspace scaffolding to load
`deepagents_code.server_graph:make_graph` from the package instead of
copying `server_graph.py` into the temp workspace.
- Resolves the generated runtime package dependency from the top-level
package location so editable checkouts keep pointing at the working tree
after the module move.
- Refreshes the threat model references for the moved client/server
components.
2026-07-06 14:34:55 -04:00
Mason Daugherty 671c4f2617 test(code): cover remote auto-approve HITL (#4392)
Adds integration coverage for default TUI auto-approve behavior over the
remote server path.

The new tests start the real local server with a deterministic
tool-calling model, run through `execute_task_textual`, and verify
auto-approve suppresses HITL prompts for both a top-level gated
`write_file` call and the same gated call when delegated through the
general-purpose subagent. This locks in the healthy baseline while
investigating narrower workflow-specific interrupt behavior.
2026-06-30 15:58:26 -04:00
Mason Daugherty e5094037f9 docs(repo): add architecture and development onboarding guides (#3983)
New-contributor onboarding currently requires stitching knowledge
together from `AGENTS.md`, per-package `Makefile`s, and external docs,
and neither the cross-layer request flow nor the `libs/code` process
model is mapped anywhere in the repo.

This adds:
- Root `ARCHITECTURE.md` (the three-layer `deepagents` → `create_agent`
→ LangGraph stack and request flow) and `DEVELOPMENT.md` (a single
bootstrap + command reference), cross-linked from `README.md` and
`libs/README.md`.
- `libs/code/ARCHITECTURE.md` (process model, interactive/headless
request lifecycles, module map, and a "where do I change X" cheat
sheet), linked from `DEV.md` and `AGENTS.md`.

Made by [Open SWE](https://openswe.vercel.app)

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-06-20 03:04:04 -04:00
Mason Daugherty 969cbe8709 chore(deps): update lint and typing dependency floors (#3818)
Dependency floors are refreshed across the monorepo for newer
LangChain/LangSmith releases, provider integrations, pytest tooling,
`ruff`, and `ty`. The code changes are the compatibility work needed for
those newer lint and type checks, with small structural cleanups where
the tools needed clearer narrowing or less complex functions.

## Changes
- Raised runtime and test dependency minimums across SDK, CLI, Code,
ACP, evals, examples, and partner packages, including updated
LangChain/LangSmith/provider pins and current lint/test tooling
baselines.
- Reworked backend factory typing around `BACKEND_TYPES` with
`_resolve_backend`, widened file transfer error fields to support
backend-specific strings, and updated filesystem/summarization
middleware to use the shared resolver.
- Tightened `deepagents-code` typing for middleware stacks, MCP tool
filtering, update checks, and Textual compatibility patches, replacing
stale suppressions with `ty`-specific ignores where runtime behavior is
intentionally narrower than static types.
- Split large CLI command handlers into focused helpers such as
`_dispatch_command`, `_execute_agents_command`, and the MCP server
subcommand helpers while preserving existing command behavior.
- Updated Harbor LangSmith sandbox handling to rely on explicit
`NetworkPolicy` and `capabilities` instead of legacy property overrides,
with tests adjusted around the new capability checks.
- Applied lint/format/type-check cleanups across tests and examples so
the staged code passes the refreshed tooling expectations.
2026-06-09 13:25:21 -04:00
Mason Daugherty da43b7f9d9 fix(code): rename stale usage commands (#3460) 2026-05-19 00:00:58 -05:00
Mason Daugherty 2ac7d41533 feat(code): port from libs/cli (#3388)
Release-As: 0.1.0
2026-05-12 20:45:09 +00:00