refactor api server around rpc services

This commit is contained in:
lpf
2026-03-15 01:00:41 +08:00
parent 341e578c9f
commit 231529e907
32 changed files with 5956 additions and 3614 deletions

50
pkg/rpc/workspace.go Normal file
View File

@@ -0,0 +1,50 @@
package rpc
import "context"
type WorkspaceService interface {
ListFiles(context.Context, ListWorkspaceFilesRequest) (*ListWorkspaceFilesResponse, *Error)
ReadFile(context.Context, ReadWorkspaceFileRequest) (*ReadWorkspaceFileResponse, *Error)
WriteFile(context.Context, WriteWorkspaceFileRequest) (*WriteWorkspaceFileResponse, *Error)
DeleteFile(context.Context, DeleteWorkspaceFileRequest) (*DeleteWorkspaceFileResponse, *Error)
}
type ListWorkspaceFilesRequest struct {
Scope string `json:"scope,omitempty"`
}
type ListWorkspaceFilesResponse struct {
Files []string `json:"files"`
}
type ReadWorkspaceFileRequest struct {
Scope string `json:"scope,omitempty"`
Path string `json:"path"`
}
type ReadWorkspaceFileResponse struct {
Path string `json:"path,omitempty"`
Found bool `json:"found,omitempty"`
Content string `json:"content,omitempty"`
}
type WriteWorkspaceFileRequest struct {
Scope string `json:"scope,omitempty"`
Path string `json:"path"`
Content string `json:"content"`
}
type WriteWorkspaceFileResponse struct {
Path string `json:"path,omitempty"`
Saved bool `json:"saved,omitempty"`
}
type DeleteWorkspaceFileRequest struct {
Scope string `json:"scope,omitempty"`
Path string `json:"path"`
}
type DeleteWorkspaceFileResponse struct {
Path string `json:"path,omitempty"`
Deleted bool `json:"deleted"`
}