Skip to content

feat(daemon): expose list_files and expand @path over AG-UI - #1717

Merged
edenreich merged 1 commit into
mainfrom
feat/issue-1714
Nov 6, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/issue-1714

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Resolves #1714

Summary

A daemon client of the infer daemon AG-UI binding can now show the @ file autocomplete and send file references like the chat TUI: a new project-scoped list_files frame answers with the project's files, and the serve worker expands @<path> tokens in run_agent_input user messages before the run. The expansion moved into internal/agent/domain so the TUI and the worker share one implementation.

Changes

  • New list_files panel frame and files reply in internal/presentation/headless/panel.go, backed by agentdomain.FileService.ListProjectFiles. It answers with an empty list when the service is nil or the walk fails, and rides the existing frameWriter, so it carries the lowercase app-frame type.
  • internal/container/container.go wires the worker's file service into the panel. internal/sessions/registry.go adds list_files to the project-scoped request vocabulary and routes the files reply to the requester only.
  • @<path> expansion extracted to agent/domain.ExpandFileReferences and agent/domain.MarkdownSummary. The chat TUI's expandFileReferences and ExtractMarkdownSummary now delegate.
  • headlessControl takes a references value holding the file, image, model and issue services. Its expand applies the file expansion and then the existing #N expansion to each run input's text, in the TUI's order.
  • The worker follows the TUI's behavior: text files inlined as a fenced block, a Markdown file reduced to its ## Summary section when it has one, images replaced by a path note, invalid references left in place.
  • Docs: docs/browser-extension-protocol.md gains a Project files section and the run-input bullet, and docs/ag-ui-output.md documents the worker-side expansion.
  • Tests: panel cases for a served list plus the nil-service and failed-walk empty answers, a daemon relay case that the files reply reaches only its requester, and a worker test that a valid @ reference is inlined while an invalid one stays raw. The existing TUI suite now runs through the shared function.

Notes for review

  • One-shot infer headless keeps its own @ and --files handling (whole file inlined, --files fails on an invalid path). Moving it to the shared function would change what existing invocations send, so it is left out here.
  • Expansion accepts any path the file service validates, as the TUI does, including absolute and ~ paths. The sandbox path policy is not consulted. Restricting the worker to the paths list_files offers is a possible follow-up.

Downstream

A daemon client can now list the project's files for its @ menu and send
@<path> references like the chat TUI. The expansion moved into agent/domain so
the TUI and the serve worker share one implementation.
@edenreich
edenreich requested a review from a team as a code owner November 6, 2026 17:53
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 6, 2026
@edenreich
edenreich merged commit d82aed1 into main Nov 6, 2026
1 check passed
@edenreich
edenreich deleted the feat/issue-1714 branch November 6, 2026 17:53
edenreich added a commit that referenced this pull request Nov 6, 2026
…as (#1723)

## Summary

The `e2e` job has failed on `main` since #1717, and every PR opened
after it inherits the failure.
`TestChatDaemonTeleportsTheSessionAndBringsItBack` sends `say hello
@README.md` in a session teleported to workspace `b` and asserts the
README's text never shows, as its guard that a remote session does not
read this machine's file.

#1717 made the serve worker expand `@<path>` itself. The worker on `b`
now inlines the README of its own clone, which carries the same text as
the local one, so the guard fired on a file the remote session is
entitled to read.

## Changes

- The test now references `local.md`, a file written only into the local
checkout. The remote worker cannot resolve it, so the token stays raw
and the file's text must not show. That is the guard's original intent,
and it can now tell the two machines apart.
- The file is removed again before the session teleports back, since a
changed checkout refuses the return.

No product code changes. Worker-side expansion of a file the worker has
is the behavior #1714 asked for.

## Verification

- Reproduced the failure on `main` locally, then `task test:e2e`
equivalent with `-race` passes: `ok tests/e2e 166s`.

## Downstream

- no docs ticket: test-only fix
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.246.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Expose @ file autocomplete and @path expansion over the daemon binding

1 participant