MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / ReadFile

Method ReadFile

internal/computerapi/service.go:37–64  ·  view source on GitHub ↗
(sessionID, filePath, toolCallID string)

Source from the content-addressed store, hash-verified

35}
36
37func (s Service) ReadFile(sessionID, filePath, toolCallID string) (string, security.DecisionRecord, error) {
38 meta, err := s.sessionMeta(sessionID)
39 if err != nil {
40 return "", security.DecisionRecord{}, err
41 }
42 hostPath, err := s.workspacePath(meta.WorkspacePath, filePath)
43 if err != nil {
44 return "", security.DecisionRecord{}, err
45 }
46 body, err := os.ReadFile(hostPath)
47 if err != nil {
48 return "", security.DecisionRecord{}, err
49 }
50 payload := map[string]any{
51 "path": filePath,
52 "result_ref": hostPath,
53 "bytes": len(body),
54 }
55 record, err := s.recordEvent(security.Event{
56 Source: "computer_api",
57 EventType: "file_read",
58 RunID: meta.RunID,
59 SessionID: sessionID,
60 ToolCallID: ensureToolCallID(toolCallID),
61 Path: filePath,
62 }, payload)
63 return string(body), record, err
64}
65
66func (s Service) WriteFile(sessionID, filePath, content, toolCallID string) (security.DecisionRecord, error) {
67 meta, err := s.sessionMeta(sessionID)

Callers 15

objectifyArtifactMethod · 0.80
LoadTaskFunction · 0.80
LoadEngineFunction · 0.80
hasEffectiveCapFunction · 0.80
TestInjectClaudeCodeFunction · 0.80
readMessageBodyFunction · 0.80
collectFileStatesFunction · 0.80
readRelativeFileFunction · 0.80
llmMessageMetaFunction · 0.80
verifyObjectsFunction · 0.80

Calls 4

sessionMetaMethod · 0.95
workspacePathMethod · 0.95
recordEventMethod · 0.95
ensureToolCallIDFunction · 0.85