mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
1cf0354f72
> This PR was authored by Mux on behalf of Mike. ## Summary - add persistent plan mode for chats and the chat-specific plan file flow - add structured planning tools such as `ask_user_question` and `propose_plan` - keep `write_file` and `edit_files` constrained to the chat-specific plan file during plan turns - allow shell exploration in plan mode, including subagents, via `execute` and `process_output` - block implementation-oriented, provider-native, MCP, dynamic, and computer-use tools during plan turns - update the chat UI, tests, and docs for the new planning flow
42 lines
930 B
Go
42 lines
930 B
Go
package agentfiles
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/spf13/afero"
|
|
|
|
"cdr.dev/slog/v3"
|
|
"github.com/coder/coder/v2/agent/agentgit"
|
|
)
|
|
|
|
// API exposes file-related operations performed through the agent.
|
|
type API struct {
|
|
logger slog.Logger
|
|
filesystem afero.Fs
|
|
pathStore *agentgit.PathStore
|
|
}
|
|
|
|
func NewAPI(logger slog.Logger, filesystem afero.Fs, pathStore *agentgit.PathStore) *API {
|
|
api := &API{
|
|
logger: logger,
|
|
filesystem: filesystem,
|
|
pathStore: pathStore,
|
|
}
|
|
return api
|
|
}
|
|
|
|
// Routes returns the HTTP handler for file-related routes.
|
|
func (api *API) Routes() http.Handler {
|
|
r := chi.NewRouter()
|
|
|
|
r.Post("/list-directory", api.HandleLS)
|
|
r.Get("/resolve-path", api.HandleResolvePath)
|
|
r.Get("/read-file", api.HandleReadFile)
|
|
r.Get("/read-file-lines", api.HandleReadFileLines)
|
|
r.Post("/write-file", api.HandleWriteFile)
|
|
r.Post("/edit-files", api.HandleEditFiles)
|
|
|
|
return r
|
|
}
|