(ctx context.Context, args map[string]interface{})
| 307 | } |
| 308 | |
| 309 | func executeSandboxRuntimeReadFile(ctx context.Context, args map[string]interface{}) (*ToolResult, error) { |
| 310 | path, ok := args["path"].(string) |
| 311 | if !ok || strings.TrimSpace(path) == "" { |
| 312 | return nil, fmt.Errorf("missing path argument") |
| 313 | } |
| 314 | path, err := normalizeSandboxWorkspacePath(path) |
| 315 | if err != nil { |
| 316 | return nil, err |
| 317 | } |
| 318 | session, err := runtimeSessionForContext(ctx) |
| 319 | if err != nil { |
| 320 | return nil, err |
| 321 | } |
| 322 | rt, err := getSandboxRuntime() |
| 323 | if err != nil { |
| 324 | return nil, err |
| 325 | } |
| 326 | data, err := rt.ReadFile(ctx, session, path, int64(parseIntValue(args["max_bytes"], 0))) |
| 327 | if err != nil { |
| 328 | return nil, err |
| 329 | } |
| 330 | if len(data) == 0 { |
| 331 | return &ToolResult{Output: "(Empty file)", ExitCode: 0}, nil |
| 332 | } |
| 333 | return &ToolResult{Output: paginateReadFileContent(string(data), args), ExitCode: 0}, nil |
| 334 | } |
| 335 | |
| 336 | func executeSandboxRuntimeWriteFile(ctx context.Context, args map[string]interface{}) (*ToolResult, error) { |
| 337 | return executeSandboxRuntimeWriteFileWithPathNormalizer(ctx, args, normalizeSandboxRuntimePath) |
no test coverage detected