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

Function loadRuntimeSeedFilesFromContext

api/service/tools/executor.go:755–777  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

753}
754
755func loadRuntimeSeedFilesFromContext(ctx context.Context) map[string]string {
756 raw := ctx.Value(RuntimeSeedFilesKey)
757 if raw == nil {
758 return nil
759 }
760 seedFiles, ok := raw.(map[string]string)
761 if !ok || len(seedFiles) == 0 {
762 return nil
763 }
764
765 sanitized := make(map[string]string, len(seedFiles))
766 for p, content := range seedFiles {
767 normalized := filepath.ToSlash(filepath.Clean(strings.TrimSpace(p)))
768 if normalized == "" || normalized == "." || strings.HasPrefix(normalized, "..") || strings.HasPrefix(normalized, "/") {
769 continue
770 }
771 sanitized[normalized] = content
772 }
773 if len(sanitized) == 0 {
774 return nil
775 }
776 return sanitized
777}
778
779func normalizeSandboxRelativePath(raw string) (string, error) {
780 trimmed := strings.TrimSpace(raw)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected