(ctx context.Context, args map[string]interface{})
| 1199 | } |
| 1200 | |
| 1201 | func executeListFiles(ctx context.Context, args map[string]interface{}) (*ToolResult, error) { |
| 1202 | path := "." |
| 1203 | if v, exists := args["path"]; exists { |
| 1204 | if p, ok := v.(string); ok && strings.TrimSpace(p) != "" { |
| 1205 | path = p |
| 1206 | } |
| 1207 | } |
| 1208 | if normalized, err := normalizeSandboxRelativePath(path); err == nil { |
| 1209 | path = normalized |
| 1210 | } else { |
| 1211 | return nil, err |
| 1212 | } |
| 1213 | req := sandboxclient.FileListRequest{ |
| 1214 | Path: path, |
| 1215 | SessionID: resolveSandboxSessionID(ctx, args), |
| 1216 | Cwd: resolveSandboxCWD(ctx, args), |
| 1217 | Recursive: parseBoolValue(args["recursive"]), |
| 1218 | MaxEntries: parseIntValue(args["max_entries"], 200), |
| 1219 | } |
| 1220 | if files, err := buildSkillFilesForSandbox(ctx); err != nil { |
| 1221 | logger.Warnf(ctx, "Failed to build skill files for list_files: %v", err) |
| 1222 | } else if len(files) > 0 { |
| 1223 | req.Files = files |
| 1224 | } |
| 1225 | if err := ensureSandboxSessionSeeded(ctx, req.SessionID, req.Cwd); err != nil { |
| 1226 | return nil, err |
| 1227 | } |
| 1228 | resp, err := getSandboxClient().ListFiles(ctx, req) |
| 1229 | if err != nil { |
| 1230 | return nil, wrapSandboxServiceError(err) |
| 1231 | } |
| 1232 | |
| 1233 | if len(resp.Entries) == 0 { |
| 1234 | return &ToolResult{Output: "(No files found)", ExitCode: 0}, nil |
| 1235 | } |
| 1236 | return &ToolResult{Output: strings.Join(resp.Entries, "\n"), ExitCode: 0}, nil |
| 1237 | } |
| 1238 | |
| 1239 | func ParseToolArguments(argStr string) (map[string]interface{}, error) { |
| 1240 | var args map[string]interface{} |
no test coverage detected