MCPcopy Create free account
hub / github.com/53AI/53AIHub / formatSandboxClientWrittenFile

Function formatSandboxClientWrittenFile

api/service/tools/executor.go:1357–1379  ·  view source on GitHub ↗
(ctx context.Context, sessionID string, cwd string, path string)

Source from the content-addressed store, hash-verified

1355}
1356
1357func formatSandboxClientWrittenFile(ctx context.Context, sessionID string, cwd string, path string) error {
1358 if strings.TrimSpace(sessionID) == "" {
1359 return nil
1360 }
1361 spec, ok := sandboxRuntimeFormatSpecForPath(path)
1362 if !ok {
1363 return nil
1364 }
1365 resp, err := getSandboxClient().ExecuteShell(ctx, sandboxclient.ShellRequest{
1366 Command: spec.command,
1367 Timeout: 20,
1368 SessionID: sessionID,
1369 Cwd: cwd,
1370 EnvVars: map[string]string{"SANDBOX_PREVIEW_PATH": path},
1371 })
1372 if err != nil {
1373 return wrapSandboxServiceError(err)
1374 }
1375 if resp.ExitCode != 0 {
1376 return fmt.Errorf("%s format failed: %s", path, formatCommandResult(resp.Stdout, resp.Stderr, resp.ExitCode))
1377 }
1378 return nil
1379}
1380
1381func preflightSandboxClientCode(ctx context.Context, sessionID string, cwd string, language string, code string) error {
1382 if strings.TrimSpace(sessionID) == "" || strings.TrimSpace(code) == "" {

Callers 3

executeEditFileFunction · 0.85

Calls 6

getSandboxClientFunction · 0.85
wrapSandboxServiceErrorFunction · 0.85
formatCommandResultFunction · 0.85
ExecuteShellMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected