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
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
//nolint:testpackage // This test exercises the internal query builder directly because agent requests need a live tailnet connection.
|
|
package workspacesdk
|
|
|
|
import (
|
|
neturl "net/url"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAgentAPIPath(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
t.Run("encodes reserved query characters", func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
path := "/tmp/a&b ?#%c.md"
|
|
got := agentAPIPath("/api/v0/resolve-path", neturl.Values{
|
|
"path": []string{path},
|
|
})
|
|
|
|
parsed, err := neturl.Parse(got)
|
|
require.NoError(t, err)
|
|
require.Equal(t, "/api/v0/resolve-path", parsed.Path)
|
|
require.Equal(t, path, parsed.Query().Get("path"))
|
|
})
|
|
|
|
t.Run("preserves all query values", func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
got := agentAPIPath("/api/v0/read-file-lines", neturl.Values{
|
|
"path": []string{"/tmp/plan v1#.md"},
|
|
"offset": []string{"10"},
|
|
"limit": []string{"20"},
|
|
"max_file_size": []string{"30"},
|
|
"max_line_bytes": []string{"40"},
|
|
"max_response_lines": []string{"50"},
|
|
"max_response_bytes": []string{"60"},
|
|
})
|
|
|
|
parsed, err := neturl.Parse(got)
|
|
require.NoError(t, err)
|
|
require.Equal(t, "/api/v0/read-file-lines", parsed.Path)
|
|
require.Equal(t, "/tmp/plan v1#.md", parsed.Query().Get("path"))
|
|
require.Equal(t, "10", parsed.Query().Get("offset"))
|
|
require.Equal(t, "20", parsed.Query().Get("limit"))
|
|
require.Equal(t, "30", parsed.Query().Get("max_file_size"))
|
|
require.Equal(t, "40", parsed.Query().Get("max_line_bytes"))
|
|
require.Equal(t, "50", parsed.Query().Get("max_response_lines"))
|
|
require.Equal(t, "60", parsed.Query().Get("max_response_bytes"))
|
|
})
|
|
}
|