Documentation
¶
Overview ¶
Text edits derive from the reviewed confined file service (Apache-2.0).
Codex patch parsing and exact matching derive from openai/codex 451787127c0e70247034c33e358536ffd2b89cf8 (Apache-2.0).
Default file types adapted from ripgrep ignore 0.4.33 (MIT or Unlicense).
Package files owns workspace effects outside the Node database writer.
Index ¶
- Constants
- func Apply(ctx context.Context, root string, p *Prepared) (protocol.Output, error)
- func ApplyHunkText(current, from, to string) (string, error)
- func ApplyPatchChunks(before string, chunks []PatchChunk) (string, error)
- func Browse(ctx context.Context, directory *string, after *protocol.DirectoryCursor) (protocol.FileBrowserListing, error)
- func ChangedExcerpt(before, after string) *protocol.FileExcerpt
- func CheckpointReceipt(file protocol.ConversationCheckpointFile) protocol.ConversationCheckpointReceipt
- func Inspect(ctx context.Context, root string, command protocol.Command, ...) (protocol.Output, error)
- func IsVolume(goos string, mount disk.PartitionStat) bool
- func Manage(ctx context.Context, action protocol.FileBrowserAction) ([]protocol.FileBrowserOutcome, error)
- func MutateEntries(ctx context.Context, source, root string, command protocol.Command, ...) (protocol.Output, error)
- func PrepareArtifactHTML(kind protocol.ArtifactKind, source string, allowedClasses []string) (string, []string, error)
- func PrepareCapture(data []byte) (protocol.ImageFacts, *protocol.ImageFacts, []byte, error)
- func PrepareCreation(path, text string) (string, error)
- func PrepareEdits(before string, edits []protocol.FileEdit) (string, error)
- func PrepareImage(data []byte) (protocol.ImageFacts, *protocol.ImageFacts, []byte, error)
- func PrepareNotebook(before string, input protocol.NotebookEdit) (string, error)
- func ReadArtifactHTML(ctx context.Context, profile string, artifact protocol.ArtifactSummary, ...) (string, error)
- func ReadImage(ctx context.Context, f *core.Files, path string) (protocol.FileImage, error)
- func ReadNotebook(ctx context.Context, f *core.Files, input protocol.NotebookRead) (protocol.NotebookPage, error)
- func RejectHunk(ctx context.Context, root string, ...) (protocol.ConversationCheckpointHunkApplied, error)
- func RemoveArtifacts(profile string, sessions []protocol.SessionID) error
- func ResolvePatchWithRevisions(ctx context.Context, root, input string, observed map[string]string, ...) ([]protocol.FileChange, error)
- func RestoreCheckpoint(ctx context.Context, root string, ...) (protocol.ConversationCheckpointRestored, error)
- func Search(ctx context.Context, files *core.Files, input protocol.FileSearch) (protocol.SearchResults, error)
- func SupportsMutation(kind string) bool
- func SupportsRead(kind string) bool
- func TextDiff(path, before, after string) (string, uint64, uint64)
- func ValidateAttachment(spec protocol.AttachmentSpec) error
- func WriteArtifactHTML(ctx context.Context, profile string, artifact protocol.ArtifactSummary, ...) (string, error)
- type BrowserTarget
- type Document
- type HunkChange
- type PatchChunk
- type PatchHunk
- type Prepared
- type PreparedChange
- type StreamScope
- type Transfers
- func (t *Transfers) AttachmentBytes(ctx context.Context, attachment protocol.Attachment) ([]byte, error)
- func (t *Transfers) BeginThumbnail(ctx context.Context, edge uint32) (context.Context, func(), error)
- func (t *Transfers) Cancel(caller protocol.NodeID, user protocol.UserID, id protocol.StreamID) error
- func (transfers *Transfers) ClaimBackup(caller protocol.NodeID, id protocol.StreamID) (file *os.File, size uint64, release func(), err error)
- func (t *Transfers) Close() error
- func (t *Transfers) CollectAttachments(retained map[protocol.AttachmentID]bool) error
- func (t *Transfers) DownloadAttachment(ctx context.Context, caller protocol.NodeID, user protocol.UserID, root string, ...) (protocol.AttachmentDownload, error)
- func (t *Transfers) DownloadAttachmentThumbnail(ctx context.Context, caller protocol.NodeID, user protocol.UserID, root string, ...) (protocol.AttachmentDownload, error)
- func (transfers *Transfers) DownloadBackup(ctx context.Context, caller protocol.NodeID, archive string, ...) (protocol.BackupDownload, error)
- func (t *Transfers) DownloadBytes(ctx context.Context, caller protocol.NodeID, root string, ...) (protocol.AttachmentDownload, error)
- func (t *Transfers) DownloadFile(ctx context.Context, caller protocol.NodeID, root string, ...) (protocol.FileDownload, error)
- func (t *Transfers) DownloadFileThumbnail(ctx context.Context, caller protocol.NodeID, root string, ...) (protocol.FileDownload, error)
- func (transfers *Transfers) DownloadSSH(ctx context.Context, caller protocol.NodeID, client *sftp.Client, path string) (protocol.SshDownload, error)
- func (t *Transfers) Finish(ctx context.Context, caller protocol.NodeID, user protocol.UserID, root string, ...) (protocol.Output, error)
- func (transfers *Transfers) FinishSSHUpload(caller protocol.NodeID, client *sftp.Client, profile protocol.SshProfile, ...) (uint64, error)
- func (t *Transfers) Open(ctx context.Context, caller protocol.NodeID, user protocol.UserID, ...) (link.Stream, error)
- func (t *Transfers) OpenAttachment(attachment protocol.Attachment) (*os.File, error)
- func (transfers *Transfers) PluginFormat(caller protocol.NodeID, id protocol.StreamID) (protocol.PluginSkillsArchiveFormat, error)
- func (t *Transfers) Remove(root string)
- func (t *Transfers) Scope(caller protocol.NodeID, user protocol.UserID, id protocol.StreamID) (StreamScope, bool, error)
- func (transfers *Transfers) SetPluginFormat(caller protocol.NodeID, id protocol.StreamID, ...) error
- func (t *Transfers) StageInputs(ctx context.Context, attachments []protocol.Attachment) (string, func(), error)
- func (transfers *Transfers) StagePluginUpload(ctx context.Context, caller protocol.NodeID, data []byte) (protocol.PluginUpload, error)
- func (transfers *Transfers) StageSSHUpload(ctx context.Context, caller protocol.NodeID, spec protocol.SshUploadSpec) (protocol.SshUpload, error)
- func (transfers *Transfers) TransferSSH(ctx context.Context, connection *cryptossh.Client, root string, ...) (uint64, error)
- func (t *Transfers) UploadAttachment(ctx context.Context, caller protocol.NodeID, user protocol.UserID, root string, ...) (protocol.AttachmentUpload, error)
- func (transfers *Transfers) UploadBackup(ctx context.Context, caller protocol.NodeID, size uint64, revision string) (protocol.BackupUpload, error)
- func (t *Transfers) UploadFile(ctx context.Context, caller protocol.NodeID, root string, ...) (protocol.FileUpload, error)
- func (transfers *Transfers) UploadPlugin(ctx context.Context, caller protocol.NodeID, spec protocol.PluginUploadSpec) (protocol.PluginUpload, error)
- func (transfers *Transfers) UsePluginUpload(ctx context.Context, caller protocol.NodeID, id protocol.StreamID, ...) error
Constants ¶
const MaxCaptureBytes = 20 * 1024 * 1024
MaxCaptureBytes is the largest screenshot a tool may hand to PrepareCapture.
Variables ¶
This section is empty.
Functions ¶
func ApplyHunkText ¶
func ApplyPatchChunks ¶
func ApplyPatchChunks(before string, chunks []PatchChunk) (string, error)
func Browse ¶
func Browse(ctx context.Context, directory *string, after *protocol.DirectoryCursor) (protocol.FileBrowserListing, error)
func ChangedExcerpt ¶
func ChangedExcerpt(before, after string) *protocol.FileExcerpt
ChangedExcerpt reports bounded numbered regions from the exact prepared text.
func CheckpointReceipt ¶
func CheckpointReceipt(file protocol.ConversationCheckpointFile) protocol.ConversationCheckpointReceipt
func IsVolume ¶
func IsVolume(goos string, mount disk.PartitionStat) bool
IsVolume reports whether a mount of goos is a volume the user stores files on, the one rule of the file browser's devices and of the host metrics' disks: not a pseudo file system, not one of the system's own mounts (removable media under /run/media stay), and on macOS not one the system hides from its file browser (nobrowse: /dev, /System/Volumes/*, Recovery).
func Manage ¶
func Manage(ctx context.Context, action protocol.FileBrowserAction) ([]protocol.FileBrowserOutcome, error)
func MutateEntries ¶
func MutateEntries(ctx context.Context, source, root string, command protocol.Command, access core.FileAccess) (protocol.Output, error)
MutateEntries receives independently captured source and destination roots.
func PrepareArtifactHTML ¶
func PrepareCapture ¶
func PrepareCapture(data []byte) (protocol.ImageFacts, *protocol.ImageFacts, []byte, error)
PrepareCapture bounds a screenshot a tool produced. A capture is taken at the size of its subject, so it is accepted up to MaxCaptureBytes and reduced like any other image instead of being refused.
func PrepareCreation ¶
PrepareCreation assigns stable IDs to generated v4.5 notebook cells before approval.
func PrepareImage ¶
func PrepareImage(data []byte) (protocol.ImageFacts, *protocol.ImageFacts, []byte, error)
PrepareImage bounds an image a user or a file supplies. It returns the source facts, the facts of the reduced image when one was made, and the bytes to send.
func PrepareNotebook ¶
func PrepareNotebook(before string, input protocol.NotebookEdit) (string, error)
func ReadArtifactHTML ¶
func ReadArtifactHTML(ctx context.Context, profile string, artifact protocol.ArtifactSummary, digest string) (string, error)
ReadArtifactHTML verifies immutable content after its metadata read lease ends.
func ReadNotebook ¶
func ReadNotebook(ctx context.Context, f *core.Files, input protocol.NotebookRead) (protocol.NotebookPage, error)
func RejectHunk ¶
func RejectHunk(ctx context.Context, root string, selection protocol.ConversationCheckpointHunkSelection, change HunkChange) (protocol.ConversationCheckpointHunkApplied, error)
func RemoveArtifacts ¶
RemoveArtifacts deletes the artifact directories of the given sessions. The caller names only sessions that keep no artifact row.
func ResolvePatchWithRevisions ¶
func ResolvePatchWithRevisions(ctx context.Context, root, input string, observed map[string]string, access core.FileAccess) ([]protocol.FileChange, error)
func RestoreCheckpoint ¶
func RestoreCheckpoint(ctx context.Context, root string, content protocol.ConversationCheckpointContent, settled []*protocol.ConversationCheckpointVersion) (protocol.ConversationCheckpointRestored, error)
RestoreCheckpoint puts back the content a file had before the checkpoint's change. settled lists the versions the file had before this change or an earlier change of the same turn (nil is an absent file): a file that already holds one of them is restored and is left as it is, so repeating an Undo succeeds. Any other content is another change and is not overwritten.
func Search ¶
func Search(ctx context.Context, files *core.Files, input protocol.FileSearch) (protocol.SearchResults, error)
func SupportsMutation ¶
func SupportsRead ¶
func ValidateAttachment ¶
func ValidateAttachment(spec protocol.AttachmentSpec) error
func WriteArtifactHTML ¶
func WriteArtifactHTML(ctx context.Context, profile string, artifact protocol.ArtifactSummary, html string) (string, error)
WriteArtifactHTML publishes a captured unreferenced revision. SQL metadata is committed by the caller only after this physical receipt is returned.
Types ¶
type BrowserTarget ¶
type BrowserTarget struct{ Root, Name string }
func BrowserTargets ¶
func BrowserTargets(action protocol.FileBrowserAction) ([]BrowserTarget, error)
type Document ¶
type Document func(ctx context.Context, name string, data []byte, offset uint64) (protocol.OfficeInspection, error)
Document inspects the bytes of a document or image file. The Node supplies it so that images and scanned pages are read with its OCR model.
type HunkChange ¶
type HunkChange struct {
Hunk protocol.ConversationCheckpointHunk
Before, After string
}
func SplitHunks ¶
func SplitHunks(path, before, after string, segment int) ([]HunkChange, error)
type PatchChunk ¶
type PatchHunk ¶
type PatchHunk struct {
Kind, Path, Contents string
Destination *string
Chunks []PatchChunk
}
func ParsePatch ¶
type Prepared ¶
type Prepared struct {
Command protocol.Command
Access core.FileAccess
Changes []PreparedChange
Preview protocol.ChangePreview
Rejected *protocol.FileChanges
}
type PreparedChange ¶
type StreamScope ¶
type StreamScope struct {
Worktree protocol.WorktreeID
Draft bool
}
type Transfers ¶
type Transfers struct {
// contains filtered or unexported fields
}
Transfers is the one resource owner for authenticated, single-use file streams. Prepared uploads retain confined publication targets until the durable finish.
func NewTransfers ¶
NewTransfers also removes the staging files an earlier process left: a process that is killed cannot run its cleanup, and one process owns a profile, so every staging file found at start is an orphan.
func (*Transfers) AttachmentBytes ¶
func (*Transfers) BeginThumbnail ¶ added in v0.2.6
func (t *Transfers) BeginThumbnail(ctx context.Context, edge uint32) (context.Context, func(), error)
BeginThumbnail bounds preparation before even opening a source or reading its canonical bytes. The caller holds the slot through its scope recheck.
func (*Transfers) ClaimBackup ¶
func (transfers *Transfers) ClaimBackup(caller protocol.NodeID, id protocol.StreamID) (file *os.File, size uint64, release func(), err error)
ClaimBackup takes a completed archive upload out of the transfer table. The caller reads the file and then calls release, which removes the staging.
func (*Transfers) CollectAttachments ¶
func (t *Transfers) CollectAttachments(retained map[protocol.AttachmentID]bool) error
CollectAttachments removes every stored attachment file whose identifier is not retained. A finished upload publishes its file before its row commits, so the caller must exclude that window: it runs while no upload can finish or under a lock that every finishing upload holds from its file to its row.
func (*Transfers) DownloadAttachment ¶
func (*Transfers) DownloadAttachmentThumbnail ¶ added in v0.2.6
func (*Transfers) DownloadBackup ¶
func (transfers *Transfers) DownloadBackup(ctx context.Context, caller protocol.NodeID, archive string, record protocol.BackupRecord, revision string) (protocol.BackupDownload, error)
DownloadBackup takes ownership of a sealed archive inside the profile's temporary directory and serves it once. Only the controller-facing backup service registers private archive files.
func (*Transfers) DownloadBytes ¶
func (t *Transfers) DownloadBytes(ctx context.Context, caller protocol.NodeID, root string, attachment protocol.Attachment, data []byte, thumbnailEdge uint32) (protocol.AttachmentDownload, error)
DownloadBytes serves a captured canonical image without exposing blob storage.
func (*Transfers) DownloadFile ¶
func (t *Transfers) DownloadFile(ctx context.Context, caller protocol.NodeID, root string, worktree protocol.WorktreeID, path string, access core.FileAccess) (protocol.FileDownload, error)
func (*Transfers) DownloadFileThumbnail ¶ added in v0.2.6
func (t *Transfers) DownloadFileThumbnail(ctx context.Context, caller protocol.NodeID, root string, worktree protocol.WorktreeID, path string, access core.FileAccess, edge uint32) (protocol.FileDownload, error)
func (*Transfers) DownloadSSH ¶
func (transfers *Transfers) DownloadSSH(ctx context.Context, caller protocol.NodeID, client *sftp.Client, path string) (protocol.SshDownload, error)
DownloadSSH stages a remote file on this Node and serves it through a caller-owned, single-use download stream.
func (*Transfers) FinishSSHUpload ¶
func (transfers *Transfers) FinishSSHUpload(caller protocol.NodeID, client *sftp.Client, profile protocol.SshProfile, path string, stream protocol.StreamID) (uint64, error)
FinishSSHUpload consumes a completely staged upload exactly once. A request naming another caller, profile revision or path leaves the stage untouched; once publication starts the stage is gone whatever the remote result.
func (*Transfers) OpenAttachment ¶
func (*Transfers) PluginFormat ¶
func (*Transfers) Scope ¶
func (t *Transfers) Scope(caller protocol.NodeID, user protocol.UserID, id protocol.StreamID) (StreamScope, bool, error)
Scope reads the captured resource before Open consumes the single-use transfer. Ownership is checked here and again when the resource stream is opened.
func (*Transfers) SetPluginFormat ¶
func (*Transfers) StageInputs ¶
func (t *Transfers) StageInputs(ctx context.Context, attachments []protocol.Attachment) (string, func(), error)
StageInputs creates verified command-local copies. Attachment IDs, never display names, identify the files in SAILRY_ATTACHMENTS.
func (*Transfers) StagePluginUpload ¶
func (*Transfers) StageSSHUpload ¶
func (transfers *Transfers) StageSSHUpload(ctx context.Context, caller protocol.NodeID, spec protocol.SshUploadSpec) (protocol.SshUpload, error)
StageSSHUpload reserves a caller-owned stream that stages bytes on this Node. The remote host is not contacted until FinishSSHUpload publishes them.
func (*Transfers) TransferSSH ¶
func (transfers *Transfers) TransferSSH(ctx context.Context, connection *cryptossh.Client, root string, access core.FileAccess, transfer protocol.SshTransfer) (uint64, error)
TransferSSH copies one file between a confined worktree path and an explicit remote path. Bytes never leave this Node's side of the connection. A download is staged in Node storage and published without following links; once publication starts it runs to completion regardless of ctx.
func (*Transfers) UploadAttachment ¶
func (*Transfers) UploadBackup ¶
func (transfers *Transfers) UploadBackup(ctx context.Context, caller protocol.NodeID, size uint64, revision string) (protocol.BackupUpload, error)
UploadBackup reserves private staging for one sealed archive.
func (*Transfers) UploadFile ¶
func (t *Transfers) UploadFile(ctx context.Context, caller protocol.NodeID, root string, spec protocol.FileUploadSpec, access core.FileAccess) (protocol.FileUpload, error)
func (*Transfers) UploadPlugin ¶
func (transfers *Transfers) UploadPlugin(ctx context.Context, caller protocol.NodeID, spec protocol.PluginUploadSpec) (protocol.PluginUpload, error)
Source Files
¶
- artifact_html.go
- artifacts.go
- attachment_inputs.go
- attachments.go
- backup_transfers.go
- browser.go
- browser_access_unix.go
- browser_places.go
- browser_places_other.go
- browser_volumes.go
- browser_volumes_other.go
- changes.go
- checkpoints.go
- diff.go
- edit.go
- excerpt.go
- image_animation.go
- images.go
- io.go
- mutations.go
- notebook.go
- patch.go
- plugin_uploads.go
- search.go
- search_types.go
- service.go
- ssh.go
- thumbnail_transfers.go
- thumbnails.go
- transfers.go