MCPcopy Index your code
hub / github.com/github/copilot-sdk / SessionFSProvider

Interface SessionFSProvider

go/session_fs_provider.go:20–49  ·  view source on GitHub ↗

SessionFSProvider is the interface that SDK users implement to provide a session filesystem. Methods use idiomatic Go error handling: return an error for failures (the adapter maps os.ErrNotExist → ENOENT automatically). To add SQLite support, also implement [SessionFSSqliteProvider] on the same ty

Source from the content-addressed store, hash-verified

18//
19// To add SQLite support, also implement [SessionFSSqliteProvider] on the same type.
20type SessionFSProvider interface {
21 // ReadFile reads the full content of a file. Return os.ErrNotExist (or wrap it)
22 // if the file does not exist.
23 ReadFile(path string) (string, error)
24 // WriteFile writes content to a file, creating it and parent directories if needed.
25 // mode is an optional POSIX-style permission mode. Pass nil to use the OS default.
26 WriteFile(path string, content string, mode *int) error
27 // AppendFile appends content to a file, creating it and parent directories if needed.
28 // mode is an optional POSIX-style permission mode. Pass nil to use the OS default.
29 AppendFile(path string, content string, mode *int) error
30 // Exists checks whether the given path exists.
31 Exists(path string) (bool, error)
32 // Stat returns metadata about a file or directory.
33 // Return os.ErrNotExist if the path does not exist.
34 Stat(path string) (*SessionFSFileInfo, error)
35 // Mkdir creates a directory. If recursive is true, create parent directories as needed.
36 // mode is an optional POSIX-style permission mode (e.g., 0o755). Pass nil to use the OS default.
37 MakeDirectory(path string, recursive bool, mode *int) error
38 // Readdir lists the names of entries in a directory.
39 // Return os.ErrNotExist if the directory does not exist.
40 ReadDirectory(path string) ([]string, error)
41 // ReaddirWithTypes lists entries with type information.
42 // Return os.ErrNotExist if the directory does not exist.
43 ReadDirectoryWithTypes(path string) ([]rpc.SessionFSReaddirWithTypesEntry, error)
44 // Rm removes a file or directory. If recursive is true, remove contents too.
45 // If force is true, do not return an error when the path does not exist.
46 Remove(path string, recursive bool, force bool) error
47 // Rename moves/renames a file or directory.
48 Rename(src string, dest string) error
49}
50
51// SessionFSSqliteProvider is an optional interface that a [SessionFSProvider]
52// may also implement to support per-session SQLite databases. The adapter

Callers 15

ReadFileMethod · 0.65
WriteFileMethod · 0.65
AppendFileMethod · 0.65
ExistsMethod · 0.65
StatMethod · 0.65
MkdirMethod · 0.65
ReaddirMethod · 0.65
ReaddirWithTypesMethod · 0.65
RmMethod · 0.65
RemoveMethod · 0.65
TestRpcServerPluginsFunction · 0.65
TestRPCMCPConfigE2EFunction · 0.65

Implementers 2

testSessionFSHandlergo/internal/e2e/session_fs_e2e_test.go
inMemorySqliteProvidergo/internal/e2e/session_fs_sqlite_e2e_

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…