Skip to content

dagger agent: session UX and conversation TUI - #13780

Merged
vito merged 34 commits into
mainfrom
llm-workspace-agent-tui
Aug 6, 2026
Merged

vito merged 34 commits into
mainfrom
llm-workspace-agent-tui

Conversation

@vito

@vito vito commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

dagger agent as something you'd want to use: the interactive session and how a conversation renders. No schema changes in here — this is CLI and TUI only.

Session UX. The prompt loop, save/load, and status reporting all work against the bound workspace. Interactive controls: ctrl+s exports the workspace and saves, ctrl+u resets it, .clear returns to the initial agent group, --resume/-r picks up a saved session and replays its conversation at the top level. Shell builtins are reachable as slash commands in prompt mode, and the model can be selected interactively rather than only through config.

Both flows rebind the live workspace afterwards: ctrl+s chains withWorkspace(currentWorkspace) after the export, so the accumulated overlay — now redundant with the files on disk — stops re-diffing as pending changes, and ctrl+u binds currentWorkspace.reloaded so cached host reads are invalidated and the agent re-reads what is actually on disk. portableID emits only the current binding (#13778), so the next save carries neither.

Conversation rendering. An agent conversation was only visible by drilling into the span tree, so the interesting part of a run was buried. LLM conversations are now surfaced at the top level the way checks are, and rendered as a transcript — messages in order, tool calls inline — rather than as a span tree. Prompt and shell mode flow into scrollback so earlier turns stay readable, user prompts are visually distinct from model output, and transcript content is cropped after the focused item so a long conversation stays navigable.

Status line and context meter carry token and cost totals and show how full the context window is, retained across a resume so they populate immediately instead of after the next turn.

Model metadata unified on catwalk. Pricing and context windows came from two places — an OpenRouter catalog fetched by the CLI and the engine's own knowledge. Both now read the embedded catwalk catalog, so the CLI and engine agree, and the CLI asks the engine for the context window instead of looking it up itself. core/openrouter is deleted.

vito added 16 commits August 6, 2026 12:17
Point the tui-qa module at the agent flow rather than the shell, and add a
self-call returning the module's own type so the module can drive itself.

Signed-off-by: Alex Suraci <[email protected]>
User prompts were visually indistinguishable from model output once the
transcript rendering landed. Give them their own treatment, fix the missing
color on the first indent, and adjust the surrounding spacing.

Signed-off-by: Alex Suraci <[email protected]>
In `dagger agent` (and `dagger shell`'s prompt mode) the session commands
lived behind shell mode: to `.resume`, `.clear`, or `.compact` you had to
switch out of the prompt with `!`, run the command, then switch back with
`>`. That mode round-trip is friction in what's otherwise a chat.

Let a leading "/" in prompt mode invoke the matching builtin without
leaving the prompt. Every `.command` is exposed as `/command`: the first
token is mapped back to its builtin and the line is run through the same
shell path (so arguments, telemetry, and the .resume conversation replay
all behave identically), while the mode stays put. Lines that don't name a
builtin -- ordinary prose, a bare "/", or a slash mid-sentence -- are left
alone and sent to the LLM as before. The per-command span is tagged as
shellscript so it renders as a command rather than markdown.

Wire the same builtins into prompt-mode completion: a leading "/" at the
start of the line offers them via the existing tuist completion path,
shown as "/resume" etc. with their descriptions, sorted, and filtered as
you type. Hidden builtins stay runnable but out of the suggestions, matching
`.help`.

Adds TestPromptSlashCommandMapping and TestPromptSlashCommandCompletion
covering the /command -> .command mapping (args carried through, hidden
builtins runnable, non-commands ignored) and the completion menu.

(cherry picked from commit f8773b0)
Signed-off-by: Alex Suraci <[email protected]>
Crop transcript content after the focused item so a long conversation stays
navigable, drop the duplicate focus indicator, sanitize tabs in tool-call
argument summaries, and keep the notification top border inside the box width.

Signed-off-by: Alex Suraci <[email protected]>
Model pricing and context windows came from two places: an OpenRouter catalog
fetched by the CLI and the engine's own knowledge. Unify both on the embedded
catwalk catalog so the CLI and the engine agree, and drop the OpenRouter
catalog entirely — the CLI now asks the engine for the context window instead
of looking it up itself.

Signed-off-by: Alex Suraci <[email protected]>
Give the agent session a status line carrying token and cost totals, a context
meter showing how full the window is, and a flag on tool-call results whose
size is worth noticing. The status line data is retained so resuming a session
populates it immediately rather than after the next turn, and it is updated
from one central path instead of several call sites.

Signed-off-by: Alex Suraci <[email protected]>
Let the session pick a model interactively instead of only through config, and
tidy the remaining tui-qa module fixes and right-hand margin.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
* editor: basic file editing
* engine-lab: for running + testing the engine
* tui-qa: for testing the TUI, possibly with nesting so it can inherit
  LLM auth

Signed-off-by: Alex Suraci <[email protected]>
Binding two objects that each contribute a tool of the same name silently
shadowed one of them: last withTools won, and the losing object's tool
simply disappeared from the model's view.

When a tool name is contributed by more than one binding, every tool of
every binding involved is now served under a namespaced name instead, so
each toolset stays uniform - all bare or all prefixed - and nothing is
dropped. The prefix is the bound type rendered as its GraphQL field name,
so TuiQa's start becomes tuiQa_start, matching how the module is spelled
elsewhere in the API.

Signed-off-by: Alex Suraci <[email protected]>
Trying this out as a more scalable solution vs. throwing things into the
system prompt.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
The test built its prompt, sub-prompt and sub-response spans with no logs
and then looked for them in the report by span name, so it could never
pass. A message span's name is an implementation label -- its logs are the
content -- so renderStep omits the row entirely until logs arrive, leaving
only the tool call, which is exempt from that early return. Give each turn
some log content and match the messages on that instead of on their names.
The assertions on ordering and on the sub-agent's one-level indent under
the tool call are unchanged, and now actually exercise the report.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the llm-workspace-agent-tui branch from 7776b4f to a3e7e00 Compare August 6, 2026 16:18
vito added 10 commits August 6, 2026 13:04
A function marked @up or @generate with the wrong shape previously loaded
fine: it showed up in -l listings and only failed mid-run, binding the
result to Service/Changeset with a raw dagql assignment error, while a
pragma'd function with a required argument silently vanished from the mod
tree. Validate both contracts at module load instead, the same treatment
@agent already gets: @up must return the core Service! and @generate the
core Changeset!, and neither may declare required arguments (auto-injected
Workspace! args and contextual defaults still pass). The three validators
share a returnsCoreObject helper so the guard against module-local types
shadowing core names lives in one place. dagger up and dagger agent load
strictly, so a violation fails the command outright; dagger generate keeps
its best-effort loading and now names the offending function in the
skipped-modules report, with --require-load turning it fatal.

Signed-off-by: Alex Suraci <[email protected]>
The badagent fixture only exercised the extra-required-arg half of the
@agent contract, so nothing pinned the return-type rule. Add a
badagent-return fixture whose @agent returns String! and assert that
dagger agent -l rejects it at module load with the does-not-return-LLM!
error, covering the other half.

Signed-off-by: Alex Suraci <[email protected]>
An @agent function with no LLM! argument at all (foo: LLM! @agent) passed
validation, since the arg loop only rejected extra required arguments. It
then broke at compose time: RunAgent always threads the accumulator into
the base argument, falling back to the name "base" when no LLM-typed arg
exists, so the fold died on an unknown argument instead of pointing at the
malformed declaration. Reject the missing base at module load like the
rest of the contract, with a badagent-noarg fixture pinning the error
through dagger agent -l.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
The @up and @generate wrong-return-type messages ended with the literal
type names Service! and Changeset!, whose trailing bang staticcheck reads
as sentence punctuation. Reword both to end with "the core X! type" so
the type name is no longer the final token, and update the integration
test assertions to match.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
A module that failed load-time validation surfaced as a six-deep wrap
chain — loading module X: resolving module source X: failed to initialize
module: init module: failed to select module: failed to validate type
def: <the actual message> — repeating the module path twice and adding
five phase labels that say nothing the validation message doesn't. Drop
the wraps that only restate their neighbors: the asModule select (the
path is already on moduleLoadErr, and the toolchain/blueprint call sites
label their own context), the initialize/init/select plumbing in
modulesource and both dang SDK versions, and the validate-type-def label
in WithObject/WithInterface/WithEnum, whose inner errors always name the
object and member. The chain is now just loading module X: <message>.

Signed-off-by: Alex Suraci <[email protected]>
A failed dagger agent -l printed the same load error four times — trace
header, root span, Workspace.agents, Module.withObject — plus the final
Error: line. The dedup machinery for this already exists: EndWithCause
stamps the failing span into the error as a [traceparent:...] marker,
ancestors parse it into error-origin links, and renderStepError skips
any span whose error originated elsewhere. But ObjectResult.call had
unnamed return values, so the stamp — written through the done
callback's error pointer after the return value was already copied —
never reached the caller. Telemetry capture confirmed no span in the
chain carried a marker or an origin link. Name the returns so the
mutation is visible, and strip the now-propagating markers at the two
places errors become display strings: workspace loadFailures and the
CLI's trailing Error: print. Each failed span now renders a bare ERROR
row linking to the origin, and the message itself appears once at the
span that produced it (plus the one-glance trace header).

Signed-off-by: Alex Suraci <[email protected]>
Propagating origin stamps broke error reporting wherever the origin span
never renders. Two renderer paths suppressed a failed span's message on
the strength of its tracked origins alone: renderStepError skipped the
message outright, and the inline-cause branch rendered a "cause" block
per origin instead — which, for an origin whose span data never arrived
(e.g. linked across a nested session, where the workspace path-safety
test caught it), produced a bare nameless stub while the only copy of
the message vanished. Make both visibility-aware: the inline-cause
branch drops unreceived origins, and renderStepError only stays quiet
when an origin is received and actually surfaces this pass — as a row in
the current view, an already-claimed section block, or a root cause the
render policy appends after the tree. When a row does print, it claims
its origins, since the wrapped message embeds theirs — keeping the
root-cause section and the trailing Error: line from repeating it.

The markers themselves also leaked into two prints that compose raw
error text: the SDK loader's "Could not load SDK" log and dagger call's
ErrPrefix line. Strip them there via a shared core.StripErrorOrigins
(reused by loadFailureMessage) and the same regex in FuncCommand.

Signed-off-by: Alex Suraci <[email protected]>
The unreceived-origin guard pushed renderRowContentRest's cyclomatic
complexity past the linter's threshold of 30. Lift the inline-cause
origin filtering into renderableErrorOrigins, which also gives the
self/unreceived/claimed filtering rules a documented home.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito merged commit a63ad39 into main Aug 6, 2026
87 checks passed
@vito
vito deleted the llm-workspace-agent-tui branch August 6, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants