Documentation
¶
Index ¶
- Constants
- Variables
- type API
- type CreateFileOptions
- type CreateFileResult
- type DeleteFileOptions
- type DeleteFileResult
- type DiffFile
- type DiffSkip
- type EditFileOptions
- type EditResult
- type ExactEdit
- type GitCreateWorktreeOptions
- type GitCreateWorktreeResult
- type GitDiff
- type GitDiffOptions
- type GitRunner
- type GitStatus
- type GitStatusOptions
- type Options
- type ReadFileOptions
- type RunnerWorktreeCreateResponse
- type Service
- func (svc *Service) CreateFile(ctx context.Context, projectID string, options CreateFileOptions) (CreateFileResult, error)
- func (svc *Service) DeleteFile(ctx context.Context, projectID string, options DeleteFileOptions) (DeleteFileResult, error)
- func (svc *Service) EditFile(ctx context.Context, projectID string, options EditFileOptions) (EditResult, error)
- func (svc *Service) GitAvailable(ctx context.Context, projectID string) (bool, error)
- func (svc *Service) GitCreateWorktree(ctx context.Context, projectID string, options GitCreateWorktreeOptions) (GitCreateWorktreeResult, error)
- func (svc *Service) GitDiff(ctx context.Context, projectID string, options GitDiffOptions) (GitDiff, error)
- func (svc *Service) GitStatus(ctx context.Context, projectID string, options GitStatusOptions) (GitStatus, error)
- func (svc *Service) ReadFile(ctx context.Context, projectID string, options ReadFileOptions) (WorkspaceFile, error)
- func (svc *Service) SetGitRunner(runner GitRunner)
- func (svc *Service) SetPolicyRecorder(recorder *agentactivity.Recorder)
- type StatusEntry
- type WorkspaceFile
Constants ¶
const ( ModeDisabled = "disabled" ModeReadOnly = "read_only" ModeEdit = "edit" DiffScopeWorkingTree = "working_tree" DiffScopeStaged = "staged" DiffScopeHead = "head" )
const ( DefaultMaxDiffBytes = 64 << 10 MaxDiffBytes = 256 << 10 DefaultMaxReadBytes = 64 << 10 MaxReadBytes = 256 << 10 MaxPageSize = 100 )
Variables ¶
var ( ErrProjectNotFound = errors.New("workspace project not found") ErrInvalidInput = errors.New("invalid workspace input") ErrWorkspaceDisabled = errors.New("workspace disabled") ErrWorkspaceReadOnly = errors.New("workspace read only") ErrUnsafeContent = errors.New("unsafe workspace content") ErrEditTokenInvalid = errors.New("edit token invalid") ErrEditConflict = errors.New("edit conflict") ErrIngestionUnsupported = errors.New("workspace ingestion unsupported") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
GitAvailable(ctx context.Context, projectID string) (bool, error)
GitStatus(ctx context.Context, projectID string, options GitStatusOptions) (GitStatus, error)
GitDiff(ctx context.Context, projectID string, options GitDiffOptions) (GitDiff, error)
GitCreateWorktree(ctx context.Context, projectID string, options GitCreateWorktreeOptions) (GitCreateWorktreeResult, error)
ReadFile(ctx context.Context, projectID string, options ReadFileOptions) (WorkspaceFile, error)
EditFile(ctx context.Context, projectID string, options EditFileOptions) (EditResult, error)
CreateFile(ctx context.Context, projectID string, options CreateFileOptions) (CreateFileResult, error)
DeleteFile(ctx context.Context, projectID string, options DeleteFileOptions) (DeleteFileResult, error)
}
type CreateFileOptions ¶ added in v0.1.13
type CreateFileResult ¶ added in v0.1.13
type CreateFileResult struct {
Applied bool `json:"applied"`
File WorkspaceFile `json:"file"`
IngestionRunID string `json:"ingestion_run_id,omitempty"`
NewEditToken string `json:"new_edit_token,omitempty"`
}
type DeleteFileOptions ¶ added in v0.1.13
type DeleteFileResult ¶ added in v0.1.13
type EditFileOptions ¶
type EditResult ¶
type GitCreateWorktreeOptions ¶ added in v0.1.19
type GitCreateWorktreeResult ¶ added in v0.1.19
type GitCreateWorktreeResult struct {
Applied bool `json:"applied"`
ProjectID string `json:"project_id"`
WorktreeRef string `json:"worktree_ref"`
BranchRef string `json:"branch_ref"`
BaseRef string `json:"base_ref"`
IsolationRef string `json:"isolation_ref"`
// WorktreePath is the absolute, server-verified on-disk worktree directory.
// It is internal transport metadata: it MUST NOT be serialized to agents or
// appear in any MCP tool result. The json:"-" tag guarantees the shared result
// struct never leaks it; only the runner-only REST handler copies it into
// RunnerWorktreeCreateResponse for the automation runner. See
// httpapi.workspaceGitCreateWorktreeHandler.
WorktreePath string `json:"-"`
}
type GitDiffOptions ¶
type GitStatusOptions ¶
type ReadFileOptions ¶
type RunnerWorktreeCreateResponse ¶ added in v0.3.0
type RunnerWorktreeCreateResponse struct {
Applied bool `json:"applied"`
ProjectID string `json:"project_id"`
WorktreeRef string `json:"worktree_ref"`
BranchRef string `json:"branch_ref"`
BaseRef string `json:"base_ref"`
IsolationRef string `json:"isolation_ref"`
WorktreePath string `json:"worktree_path,omitempty"`
}
RunnerWorktreeCreateResponse is returned ONLY by the internal runner-facing REST route (POST /api/v1/projects/{id}/workspace/git/worktrees) that the automation runner calls directly. It carries the absolute WorktreePath so the runner can pass the correct per-project worktree directory to codex --cd and to worktree cleanup, instead of recomputing it from a single global --codex-cd flag (which mismatches any project whose root_path differs from that flag).
It MUST NOT be used by the MCP adapter or any agent-facing surface. The agent-facing git_worktree_create tool result stays ref-only via the shared GitCreateWorktreeResult whose WorktreePath field is json:"-".
func RunnerWorktreeCreateResponseFromResult ¶ added in v0.3.0
func RunnerWorktreeCreateResponseFromResult(result GitCreateWorktreeResult) RunnerWorktreeCreateResponse
RunnerWorktreeCreateResponseFromResult maps an internal GitCreateWorktreeResult into the runner-only REST response, preserving the absolute worktree path.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(registry *projectregistry.Registry, ingest workspaceIngestion, options Options) *Service
func (*Service) CreateFile ¶ added in v0.1.13
func (svc *Service) CreateFile(ctx context.Context, projectID string, options CreateFileOptions) (CreateFileResult, error)
func (*Service) DeleteFile ¶ added in v0.1.13
func (svc *Service) DeleteFile(ctx context.Context, projectID string, options DeleteFileOptions) (DeleteFileResult, error)
func (*Service) EditFile ¶
func (svc *Service) EditFile(ctx context.Context, projectID string, options EditFileOptions) (EditResult, error)
func (*Service) GitAvailable ¶ added in v0.1.6
func (*Service) GitCreateWorktree ¶ added in v0.1.19
func (svc *Service) GitCreateWorktree(ctx context.Context, projectID string, options GitCreateWorktreeOptions) (GitCreateWorktreeResult, error)
func (*Service) ReadFile ¶
func (svc *Service) ReadFile(ctx context.Context, projectID string, options ReadFileOptions) (WorkspaceFile, error)
func (*Service) SetGitRunner ¶
func (*Service) SetPolicyRecorder ¶ added in v0.1.12
func (svc *Service) SetPolicyRecorder(recorder *agentactivity.Recorder)
type StatusEntry ¶
type WorkspaceFile ¶
type WorkspaceFile struct {
FileID string `json:"file_id,omitempty"`
ProjectID string `json:"project_id"`
RelativePath string `json:"relative_path"`
Extension string `json:"extension,omitempty"`
SizeBytes int64 `json:"size_bytes"`
ModifiedAt time.Time `json:"modified_at"`
Text string `json:"text"`
TextTruncated bool `json:"text_truncated"`
LineCount int `json:"line_count"`
EditToken string `json:"edit_token,omitempty"`
}