Copilot.Types.SessionFsProvider behaviour (Copilot SDK v2.3.0)

Copy Markdown

Behaviour for session filesystem providers.

Summary

Callbacks

append_file(session_id, path, content)

@callback append_file(session_id :: String.t(), path :: String.t(), content :: String.t()) ::
  :ok | {:error, term()}

exists?(session_id, path)

@callback exists?(session_id :: String.t(), path :: String.t()) ::
  {:ok, boolean()} | {:error, term()}

mkdir(session_id, path, recursive)

@callback mkdir(session_id :: String.t(), path :: String.t(), recursive :: boolean()) ::
  :ok | {:error, term()}

read_file(session_id, path)

@callback read_file(session_id :: String.t(), path :: String.t()) ::
  {:ok, String.t()} | {:error, term()}

readdir(session_id, path)

@callback readdir(session_id :: String.t(), path :: String.t()) ::
  {:ok, [String.t()]} | {:error, term()}

readdir_with_types(session_id, path)

@callback readdir_with_types(session_id :: String.t(), path :: String.t()) ::
  {:ok, [Copilot.Types.SessionFsFileInfo.t()]} | {:error, term()}

rename(session_id, old_path, new_path)

@callback rename(session_id :: String.t(), old_path :: String.t(), new_path :: String.t()) ::
  :ok | {:error, term()}

rm(session_id, path, recursive)

@callback rm(session_id :: String.t(), path :: String.t(), recursive :: boolean()) ::
  :ok | {:error, term()}

stat(session_id, path)

@callback stat(session_id :: String.t(), path :: String.t()) ::
  {:ok, Copilot.Types.SessionFsFileInfo.t()} | {:error, term()}

write_file(session_id, path, content)

@callback write_file(session_id :: String.t(), path :: String.t(), content :: String.t()) ::
  :ok | {:error, term()}