1package proto
  2
  3type ToolResponseType string
  4
  5const (
  6	ToolResponseTypeText  ToolResponseType = "text"
  7	ToolResponseTypeImage ToolResponseType = "image"
  8)
  9
 10type ToolResponse struct {
 11	Type     ToolResponseType `json:"type"`
 12	Content  string           `json:"content"`
 13	Metadata string           `json:"metadata,omitempty"`
 14	IsError  bool             `json:"is_error"`
 15}
 16
 17const (
 18	BashToolName = "bash"
 19)
 20
 21type BashParams struct {
 22	Command string `json:"command"`
 23	Timeout int    `json:"timeout"`
 24}
 25
 26type BashPermissionsParams struct {
 27	Command string `json:"command"`
 28	Timeout int    `json:"timeout"`
 29}
 30
 31type BashResponseMetadata struct {
 32	StartTime        int64  `json:"start_time"`
 33	EndTime          int64  `json:"end_time"`
 34	Output           string `json:"output"`
 35	WorkingDirectory string `json:"working_directory"`
 36}
 37
 38type DiagnosticsParams struct {
 39	FilePath string `json:"file_path"`
 40}
 41
 42const DownloadToolName = "download"
 43
 44type DownloadParams struct {
 45	URL      string `json:"url"`
 46	FilePath string `json:"file_path"`
 47	Timeout  int    `json:"timeout,omitempty"`
 48}
 49
 50type DownloadPermissionsParams struct {
 51	URL      string `json:"url"`
 52	FilePath string `json:"file_path"`
 53	Timeout  int    `json:"timeout,omitempty"`
 54}
 55
 56const EditToolName = "edit"
 57
 58type EditParams struct {
 59	FilePath   string `json:"file_path"`
 60	OldString  string `json:"old_string"`
 61	NewString  string `json:"new_string"`
 62	ReplaceAll bool   `json:"replace_all,omitempty"`
 63}
 64
 65type EditPermissionsParams struct {
 66	FilePath   string `json:"file_path"`
 67	OldContent string `json:"old_content,omitempty"`
 68	NewContent string `json:"new_content,omitempty"`
 69}
 70
 71type EditResponseMetadata struct {
 72	Additions  int    `json:"additions"`
 73	Removals   int    `json:"removals"`
 74	OldContent string `json:"old_content,omitempty"`
 75	NewContent string `json:"new_content,omitempty"`
 76}
 77
 78const FetchToolName = "fetch"
 79
 80type FetchParams struct {
 81	URL     string `json:"url"`
 82	Format  string `json:"format"`
 83	Timeout int    `json:"timeout,omitempty"`
 84}
 85
 86type FetchPermissionsParams struct {
 87	URL     string `json:"url"`
 88	Format  string `json:"format"`
 89	Timeout int    `json:"timeout,omitempty"`
 90}
 91
 92const GlobToolName = "glob"
 93
 94type GlobParams struct {
 95	Pattern string `json:"pattern"`
 96	Path    string `json:"path"`
 97}
 98
 99type GlobResponseMetadata struct {
100	NumberOfFiles int  `json:"number_of_files"`
101	Truncated     bool `json:"truncated"`
102}
103
104const GrepToolName = "grep"
105
106type GrepParams struct {
107	Pattern     string `json:"pattern"`
108	Path        string `json:"path"`
109	Include     string `json:"include"`
110	LiteralText bool   `json:"literal_text"`
111}
112type GrepResponseMetadata struct {
113	NumberOfMatches int  `json:"number_of_matches"`
114	Truncated       bool `json:"truncated"`
115}
116
117const LSToolName = "ls"
118
119type LSParams struct {
120	Path   string   `json:"path"`
121	Ignore []string `json:"ignore"`
122}
123
124type LSPermissionsParams struct {
125	Path   string   `json:"path"`
126	Ignore []string `json:"ignore"`
127}
128
129type TreeNode struct {
130	Name     string      `json:"name"`
131	Path     string      `json:"path"`
132	Type     string      `json:"type"` // "file" or "directory"
133	Children []*TreeNode `json:"children,omitempty"`
134}
135
136type LSResponseMetadata struct {
137	NumberOfFiles int  `json:"number_of_files"`
138	Truncated     bool `json:"truncated"`
139}
140
141const MultiEditToolName = "multiedit"
142
143type MultiEditOperation struct {
144	OldString  string `json:"old_string"`
145	NewString  string `json:"new_string"`
146	ReplaceAll bool   `json:"replace_all,omitempty"`
147}
148
149type MultiEditParams struct {
150	FilePath string               `json:"file_path"`
151	Edits    []MultiEditOperation `json:"edits"`
152}
153
154type MultiEditPermissionsParams struct {
155	FilePath   string `json:"file_path"`
156	OldContent string `json:"old_content,omitempty"`
157	NewContent string `json:"new_content,omitempty"`
158}
159
160type MultiEditResponseMetadata struct {
161	Additions    int    `json:"additions"`
162	Removals     int    `json:"removals"`
163	OldContent   string `json:"old_content,omitempty"`
164	NewContent   string `json:"new_content,omitempty"`
165	EditsApplied int    `json:"edits_applied"`
166}
167
168const SourcegraphToolName = "sourcegraph"
169
170type SourcegraphParams struct {
171	Query         string `json:"query"`
172	Count         int    `json:"count,omitempty"`
173	ContextWindow int    `json:"context_window,omitempty"`
174	Timeout       int    `json:"timeout,omitempty"`
175}
176
177type SourcegraphResponseMetadata struct {
178	NumberOfMatches int  `json:"number_of_matches"`
179	Truncated       bool `json:"truncated"`
180}
181
182const ViewToolName = "view"
183
184type ViewParams struct {
185	FilePath string `json:"file_path"`
186	Offset   int    `json:"offset"`
187	Limit    int    `json:"limit"`
188}
189
190type ViewPermissionsParams struct {
191	FilePath string `json:"file_path"`
192	Offset   int    `json:"offset"`
193	Limit    int    `json:"limit"`
194}
195type ViewResponseMetadata struct {
196	FilePath string `json:"file_path"`
197	Content  string `json:"content"`
198}
199
200const WriteToolName = "write"
201
202type WriteParams struct {
203	FilePath string `json:"file_path"`
204	Content  string `json:"content"`
205}
206
207type WritePermissionsParams struct {
208	FilePath   string `json:"file_path"`
209	OldContent string `json:"old_content,omitempty"`
210	NewContent string `json:"new_content,omitempty"`
211}
212type WriteResponseMetadata struct {
213	Diff      string `json:"diff"`
214	Additions int    `json:"additions"`
215	Removals  int    `json:"removals"`
216}