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

Function validateSandboxClientWrittenFile

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

Source from the content-addressed store, hash-verified

1422}
1423
1424func validateSandboxClientWrittenFile(ctx context.Context, sessionID string, cwd string, path string) error {
1425 if strings.TrimSpace(sessionID) == "" {
1426 return nil
1427 }
1428 spec, ok := sandboxRuntimeSyntaxCheckSpecForPath(path)
1429 if !ok {
1430 return nil
1431 }
1432 resp, err := getSandboxClient().ExecuteShell(ctx, sandboxclient.ShellRequest{
1433 Command: spec.command,
1434 Timeout: 20,
1435 SessionID: sessionID,
1436 Cwd: cwd,
1437 EnvVars: map[string]string{"SANDBOX_PREVIEW_PATH": path},
1438 })
1439 if err != nil {
1440 return wrapSandboxServiceError(err)
1441 }
1442 if resp.ExitCode != 0 {
1443 return fmt.Errorf("%s syntax validation failed: %s", path, formatCommandResult(resp.Stdout, resp.Stderr, resp.ExitCode))
1444 }
1445 return nil
1446}
1447
1448func parseIntValue(value interface{}, defaultValue int) int {
1449 switch v := value.(type) {

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