Documentation
¶
Index ¶
- func MaxMaxReadFileSizeMBForConfig() int
- func MaxReadFileSizeBytesForConfig(cfg *bootstrap.AppConfig) int64
- func MinMaxReadFileSizeMBForConfig() int
- type AssetFinder
- type AutoSaveStatus
- type CompareResult
- type Conflict
- type Editor
- type ErrorSnapshot
- type Event
- type Launcher
- type MergeApplyRequest
- type MergePrepareResult
- type OpenRequest
- type Options
- type RemoteFileService
- type SaveResult
- type Service
- func (s *Service) ApplyMerge(ctx context.Context, req MergeApplyRequest) (*SaveResult, error)
- func (s *Service) Close() error
- func (s *Service) Compare(sessionID string) (*CompareResult, error)
- func (s *Service) Continue(sessionID string) (*Session, error)
- func (s *Service) GetSettings() (*Settings, error)
- func (s *Service) ListSessions() []*Session
- func (s *Service) Open(ctx context.Context, req OpenRequest) (*Session, error)
- func (s *Service) PrepareMerge(sessionID string) (*MergePrepareResult, error)
- func (s *Service) Recover(sessionID string) (*Session, error)
- func (s *Service) Refresh(sessionID string) (*Session, error)
- func (s *Service) Resolve(ctx context.Context, sessionID, resolution string) (*SaveResult, error)
- func (s *Service) Save(ctx context.Context, sessionID string) (*SaveResult, error)
- func (s *Service) SaveSettings(input SettingsInput) (*Settings, error)
- func (s *Service) Start(context.Context) error
- type Session
- type Settings
- type SettingsInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxMaxReadFileSizeMBForConfig ¶
func MaxMaxReadFileSizeMBForConfig() int
func MinMaxReadFileSizeMBForConfig ¶
func MinMaxReadFileSizeMBForConfig() int
Types ¶
type AssetFinder ¶
type AutoSaveStatus ¶
type AutoSaveStatus struct {
DocumentKey string `json:"documentKey"`
SessionID string `json:"sessionId,omitempty"`
Phase string `json:"phase"`
}
AutoSaveStatus 只描述运行期的自动保存瞬时阶段。 它通过 runtime event 给前端做反馈,不会落到 manifest / Session 持久状态中。
type CompareResult ¶
type CompareResult struct {
DocumentKey string `json:"documentKey"`
PrimaryDraftSessionID string `json:"primaryDraftSessionId"`
LatestSnapshotSessionID string `json:"latestSnapshotSessionId,omitempty"`
FileName string `json:"fileName"`
RemotePath string `json:"remotePath"`
LocalContent string `json:"localContent"`
RemoteContent string `json:"remoteContent"`
ReadOnly bool `json:"readOnly"`
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Session *Session `json:"session,omitempty"`
Conflict *Conflict `json:"conflict,omitempty"`
}
type Conflict ¶
type Conflict struct {
DocumentKey string `json:"documentKey"`
PrimaryDraftSessionID string `json:"primaryDraftSessionId"`
LatestSnapshotSessionID string `json:"latestSnapshotSessionId,omitempty"`
}
Conflict 描述 document 级冲突关系: primaryDraftSessionId 永远指向用户正在保留的原始草稿; latestSnapshotSessionId 只在执行 reread 后出现,用来标记最新远端快照副本。
type ErrorSnapshot ¶
type ErrorSnapshot struct {
Step string `json:"step"`
Summary string `json:"summary"`
Suggestion string `json:"suggestion"`
At int64 `json:"at"`
}
ErrorSnapshot 只保留用户能理解、且不泄露 transport / 本地路径细节的失败摘要。 记录层会把最近一次失败沉淀到这里,前端再按文件态展示失败步骤和恢复建议。
type Event ¶
type Event struct {
Type string `json:"type"`
Session *Session `json:"session,omitempty"`
SaveResult *SaveResult `json:"saveResult,omitempty"`
AutoSave *AutoSaveStatus `json:"autoSave,omitempty"`
}
type MergeApplyRequest ¶
type MergePrepareResult ¶
type MergePrepareResult struct {
DocumentKey string `json:"documentKey"`
PrimaryDraftSessionID string `json:"primaryDraftSessionId"`
FileName string `json:"fileName"`
RemotePath string `json:"remotePath"`
LocalContent string `json:"localContent"`
RemoteContent string `json:"remoteContent"`
FinalContent string `json:"finalContent"`
RemoteHash string `json:"remoteHash"`
Session *Session `json:"session,omitempty"`
}
type OpenRequest ¶
type RemoteFileService ¶
type SaveResult ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ApplyMerge ¶
func (s *Service) ApplyMerge(ctx context.Context, req MergeApplyRequest) (*SaveResult, error)
func (*Service) GetSettings ¶
func (*Service) ListSessions ¶
func (*Service) PrepareMerge ¶
func (s *Service) PrepareMerge(sessionID string) (*MergePrepareResult, error)
func (*Service) SaveSettings ¶
func (s *Service) SaveSettings(input SettingsInput) (*Settings, error)
type Session ¶
type Session struct {
ID string `json:"id"`
AssetID int64 `json:"assetId"`
AssetName string `json:"assetName"`
DocumentKey string `json:"documentKey"`
SessionID string `json:"sessionId"`
RemotePath string `json:"remotePath"`
RemoteRealPath string `json:"remoteRealPath"`
LocalPath string `json:"localPath"`
WorkspaceRoot string `json:"workspaceRoot"`
WorkspaceDir string `json:"workspaceDir"`
EditorID string `json:"editorId"`
EditorName string `json:"editorName"`
EditorPath string `json:"editorPath"`
EditorArgs []string `json:"editorArgs,omitempty"`
// OriginalSHA256 保留旧字段名以兼容现有 manifest / IPC,语义上等同于当前 document 的 baseHash。
OriginalSHA256 string `json:"originalSha256"`
OriginalSize int64 `json:"originalSize"`
OriginalModTime int64 `json:"originalModTime"`
OriginalEncoding string `json:"originalEncoding"`
OriginalBOM string `json:"originalBom,omitempty"`
OriginalByteSample string `json:"originalByteSample,omitempty"`
// LastLocalSHA256 同样保留兼容字段名,语义上等同于最近一次落盘的 localHash。
LastLocalSHA256 string `json:"lastLocalSha256"`
Dirty bool `json:"dirty"`
State string `json:"state"`
RecordState string `json:"recordState,omitempty"`
SaveMode string `json:"saveMode,omitempty"`
PendingReview bool `json:"pendingReview,omitempty"`
Hidden bool `json:"hidden"`
Expired bool `json:"expired"`
LastError *ErrorSnapshot `json:"lastError,omitempty"`
ResumeRequired bool `json:"resumeRequired,omitempty"`
MergeRemoteSHA256 string `json:"mergeRemoteSha256,omitempty"`
SourceSessionID string `json:"sourceSessionId,omitempty"`
SupersededBySessionID string `json:"supersededBySessionId,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
LastLaunchedAt int64 `json:"lastLaunchedAt"`
LastSyncedAt int64 `json:"lastSyncedAt"`
}
Session 是桌面端外部编辑的单一事实记录: 它同时串起远端基线、本地副本、编辑器选择、冲突状态和恢复信息,前后端都围绕这份记录推进状态。
type Settings ¶
type Settings struct {
DefaultEditorID string `json:"defaultEditorId"`
WorkspaceRoot string `json:"workspaceRoot"`
CleanupRetentionDays int `json:"cleanupRetentionDays"`
MaxReadFileSizeMB int `json:"maxReadFileSizeMB"`
Editors []Editor `json:"editors"`
CustomEditors []bootstrap.ExternalEditorConfig `json:"customEditors"`
}
type SettingsInput ¶
Click to show internal directories.
Click to hide internal directories.