{"modulePath":"github.com/pencode-labs/pencode","version":"v0.1.0-rc.15","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\nPackage client exposes typed Pencode services over any owned byte stream.\n\n## Variables\n\n```go\nvar ErrBusy = errors.New(\"pencode: request queue is full\")\n```\n\n```go\nvar ErrClosed = errors.New(\"pencode: server connection closed\")\n```\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(ctx context.Context, conn io.ReadWriteCloser) (*Client, error)\n```\n\n```go\nfunc (c *Client) BeginExtension(ctx context.Context, replace string) (*ExtensionUpload, error)\n```\nBeginExtension stages a package. A nonempty replace ID updates that package.\n\n```go\nfunc (c *Client) BrowseDirectory(ctx context.Context, directory string) (string, string, []string, error)\n```\nBrowseDirectory enumerates project choices without opening a workspace.\n\n```go\nfunc (c *Client) CheckGitIgnore(ctx context.Context, root string, paths []string, dst []bool) ([]bool, error)\n```\nCheckGitIgnore uses Git's index and exclusion rules, including negation and global excludes. Paths are sent on stdin to avoid platform argv size limits.\n\n```go\nfunc (c *Client) Close() error\n```\n\n```go\nfunc (c *Client) CloseIndex(ctx context.Context, id uint64) error\n```\n\n```go\nfunc (c *Client) CloseWorkspace(ctx context.Context, id uint64) error\n```\n\n```go\nfunc (c *Client) Create(ctx context.Context, workspace uint64, path string, directory bool) error\n```\n\n```go\nfunc (c *Client) Diff(ctx context.Context, left, right string) ([]byte, error)\n```\nDiff encodes immutable editor text directly into the request buffer.\n\n```go\nfunc (c *Client) DisableExtension(ctx context.Context, id string) (protocol.ExtensionInfo, error)\n```\n\n```go\nfunc (c *Client) Done() \u003c-chan struct{}\n```\nDone closes as soon as transport failure makes every handle unusable.\n\n```go\nfunc (c *Client) Err() error\n```\n\n```go\nfunc (c *Client) ForwardPort(parent context.Context, remote protocol.Port, options ForwardOptions) (*Forward, error)\n```\n\n```go\nfunc (c *Client) Git(ctx context.Context, root string, args ...string) ([]byte, error)\n```\n\n```go\nfunc (c *Client) GitRebasing(ctx context.Context, root string) (bool, error)\n```\n\n```go\nfunc (c *Client) GitRepositories(ctx context.Context, root string) ([]string, error)\n```\n\n```go\nfunc (c *Client) Import(ctx context.Context, target uint64, source, directory string, overwrite bool) (string, error)\n```\nImport copies a native file on the server host into a workspace.\n\n```go\nfunc (c *Client) IndexPage(ctx context.Context, id uint64, offset int, dst []protocol.IndexEntry) ([]protocol.IndexEntry, bool, string, error)\n```\n\n```go\nfunc (c *Client) LanguageTools(ctx context.Context, action, id string, paths map[string]string) (map[string]languagetool.Installation, error)\n```\nLanguageTools detects tools on this host after applying the optional action. Paths are user-selected executable overrides, keyed by catalog tool ID.\n\n```go\nfunc (c *Client) ListExtensions(ctx context.Context) (ExtensionCatalog, error)\n```\n\n```go\nfunc (c *Client) ListeningPorts(ctx context.Context) ([]protocol.Port, error)\n```\n\n```go\nfunc (c *Client) LoadExtension(ctx context.Context, id string) (*Extension, error)\n```\n\n```go\nfunc (c *Client) NewSyntax(ctx context.Context) *Syntax\n```\n\n```go\nfunc (c *Client) OpenDebugAdapter(ctx context.Context, root, adapter, command, address string, args []string) (*Process, error)\n```\nOpenDebugAdapter returns the same owned, flow-controlled stream for local and SSH workspaces. Delve selects an ephemeral loopback port on the server.\n\n```go\nfunc (c *Client) OpenDebugTerminal(ctx context.Context, root string, command protocol.TerminalCommand) (*Process, int, error)\n```\n\n```go\nfunc (c *Client) OpenDocument(ctx context.Context, workspace uint64, path string, mode protocol.DocumentMode) (*Document, string, error)\n```\n\n```go\nfunc (c *Client) OpenIndex(ctx context.Context, root string) (uint64, error)\n```\n\n```go\nfunc (c *Client) OpenProcess(ctx context.Context, root, name string, args ...string) (*Process, error)\n```\n\n```go\nfunc (c *Client) OpenTerminal(ctx context.Context, root, cwd string, cols, rows int) (*Process, error)\n```\nOpenTerminal resolves cwd on the workspace machine. An empty cwd uses root.\n\n```go\nfunc (c *Client) OpenWorkspace(ctx context.Context, path string) (protocol.Workspace, error)\n```\n\n```go\nfunc (c *Client) PrepareEnableExtension(ctx context.Context, id string) (*Extension, error)\n```\n\n```go\nfunc (c *Client) ReadConfiguration(ctx context.Context) (configuration.Snapshot, error)\n```\n\n```go\nfunc (c *Client) ReadFile(ctx context.Context, root, name string) ([]byte, error)\n```\n\n```go\nfunc (c *Client) RefreshIndex(ctx context.Context, root string, previous uint64) (uint64, error)\n```\nRefreshIndex reuses the previous snapshot and rereads directories reported by the native watcher. A missing or invalid snapshot is rebuilt in full.\n\n```go\nfunc (c *Client) Remove(ctx context.Context, workspace uint64, path string) error\n```\n\n```go\nfunc (c *Client) RemoveExtension(ctx context.Context, id string) error\n```\n\n```go\nfunc (c *Client) Rename(ctx context.Context, workspace uint64, from, to string) error\n```\n\n```go\nfunc (c *Client) SaveFile(ctx context.Context, root, name, before, after string) error\n```\n\n```go\nfunc (c *Client) SaveSettings(ctx context.Context, data []byte) error\n```\n\n```go\nfunc (c *Client) SearchPaths(ctx context.Context, id uint64, query string, preferred []string) ([]string, error)\n```\n\n```go\nfunc (c *Client) SearchText(ctx context.Context, root, directory, query string, options textsearch.Options, documents []protocol.SearchDocument) (protocol.SearchResult, error)\n```\n\n```go\nfunc (c *Client) Transfer(ctx context.Context, source, target uint64, from, directory string, cut, duplicate bool) (string, error)\n```\n\n```go\nfunc (c *Client) WatchFiles(root string) *FileWatch\n```\n\n```go\nfunc (c *Client) WorkFile(ctx context.Context, root, name string) ([]byte, error)\n```\n\n```go\ntype Directories struct {\n\tContext   context.Context\n\tClient    *Client\n\tWorkspace uint64\n}\n```\nDirectories supplies only directory enumeration to the existing scanner. File content is accessed through versioned Document APIs.\n\n```go\nfunc (f Directories) ReadDir(name string) ([]fs.DirEntry, error)\n```\n\n```go\ntype Document struct {\n\t// contains filtered or unexported fields\n}\n```\nDocument keeps one latest immutable edit snapshot. Submitting an edit never waits for I/O and does not allocate. A worker coalesces intermediate snapshots and sends ordered, versioned deltas; saves explicitly wait for that barrier.\n\n```go\nfunc (d *Document) Close()\n```\n\n```go\nfunc (d *Document) Move(ctx context.Context, workspace uint64, path string) error\n```\n\n```go\nfunc (d *Document) Page() protocol.DocumentPage\n```\nPage describes only the currently loaded window; Content and snapshots for a paged document never represent the unloaded remainder of the file.\n\n```go\nfunc (d *Document) ReadPage(ctx context.Context, offset uint64) (string, protocol.DocumentPage, error)\n```\nReadPage flushes edits to the server's disk-backed document, without saving. The caller must stop submitting edits until this operation has returned.\n\n```go\nfunc (d *Document) Release()\n```\nRelease retires a handle without waiting on the transport. Close additionally waits for cleanup and is intended for workers and connection shutdown.\n\n```go\nfunc (d *Document) Save(ctx context.Context, content string) error\n```\n\n```go\nfunc (d *Document) SaveSnapshot[V piecetree.Value](ctx context.Context, value V) error\n```\nSaveSnapshot persists exactly content while Update may continue accepting newer GUI edits. The document worker owns both the version and save barrier; newer text is restored in memory afterwards and is never saved implicitly.\n\n```go\nfunc (d *Document) Update[V piecetree.Value](baseValue, contentValue V, start, oldEnd, newEnd int)\n```\n\n```go\ntype Extension struct {\n\tInfo          protocol.ExtensionInfo\n\tDiagnostics   string\n\tContributions peb.Contributions\n\tHandle        uint64\n\t// contains filtered or unexported fields\n}\n```\nExtension is a connection-scoped server registration. No executable or asset path is interpreted on the GUI host.\n\n```go\nfunc (x *Extension) Abort(ctx context.Context) error\n```\n\n```go\nfunc (x *Extension) Commit(ctx context.Context) (protocol.ExtensionInfo, error)\n```\nCommit publishes a prepared package or persists a validated enable operation.\n\n```go\nfunc (x *Extension) FS(ctx context.Context, cache map[string][]byte) fs.FS\n```\nFS lets appearance loaders consume remote resources through the standard Go filesystem interface. Each open returns bounded, memory-owned bytes.\n\n```go\nfunc (x *Extension) OpenLanguageServer(ctx context.Context, root, id string, values peb.SettingValues) (*Process, error)\n```\n\n```go\nfunc (x *Extension) OpenProcess(ctx context.Context, root string) (*Process, error)\n```\n\n```go\nfunc (x *Extension) ReadResource(ctx context.Context, name string, limit int64) ([]byte, error)\n```\n\n```go\nfunc (x *Extension) ReadResources(ctx context.Context, names []string, limit int64) (map[string][]byte, error)\n```\nReadResources batches names and pages the response at the server's byte budget. Large resources can never exceed a protocol message.\n\n```go\nfunc (x *Extension) ReadWorkspaceFile(ctx context.Context, root, name string, limit int) ([]byte, error)\n```\nReadWorkspaceFile reads a document asset through the workspace connection. Paths are resolved and confined to root by the workspace server.\n\n```go\ntype ExtensionCatalog struct {\n\tDirectory string\n\tOS, Arch  string\n\tItems     []protocol.ExtensionInfo\n}\n```\n\n```go\ntype ExtensionUpload struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (u *ExtensionUpload) Abort(ctx context.Context) error\n```\n\n```go\nfunc (u *ExtensionUpload) Prepare(ctx context.Context) (*Extension, error)\n```\n\n```go\nfunc (u *ExtensionUpload) Write(ctx context.Context, name string, offset uint64, mode uint32, final bool, data []byte) error\n```\n\n```go\ntype FileWatch struct {\n\t// contains filtered or unexported fields\n}\n```\nFileWatch is an independent cursor over the file service's bounded event journal. Cancellation leaves the cursor intact so retry never loses a batch.\n\n```go\nfunc (w *FileWatch) Next(ctx context.Context, dst []protocol.FileEvent) (protocol.FileChanges, error)\n```\n\n```go\ntype Forward struct {\n\t// contains filtered or unexported fields\n}\n```\nForward owns a local TCP listener and every connection accepted on it. Both the caller context and the backend connection bound its lifetime.\n\n```go\nfunc (f *Forward) Address() string\n```\n\n```go\nfunc (f *Forward) Close() error\n```\n\n```go\nfunc (f *Forward) Err() error\n```\n\n```go\ntype ForwardOptions struct {\n\tPort          uint16\n\tAllInterfaces bool\n}\n```\n\n```go\ntype Process struct {\n\t// contains filtered or unexported fields\n}\n```\nProcess is a flow-controlled stdio/PTY stream. Each reader has at most one outstanding receive of up to StreamWindow bytes; an idle stream cannot block the connection reader. Writes are serialized so concurrent callers cannot interleave the fragments of a logical Write.\n\n```go\nfunc (p *Process) Close() error\n```\n\n```go\nfunc (p *Process) Done() \u003c-chan struct{}\n```\n\n```go\nfunc (p *Process) Read(dst []byte) (int, error)\n```\n\n```go\nfunc (p *Process) Resize(cols, rows int) error\n```\n\n```go\nfunc (p *Process) Stderr() io.Reader\n```\n\n```go\nfunc (p *Process) Wait() error\n```\n\n```go\nfunc (p *Process) Write(data []byte) (int, error)\n```\n\n```go\ntype Syntax struct {\n\t// contains filtered or unexported fields\n}\n```\nSyntax owns a server lexical session. Updates transmit only the changed range. Like syntax.Document it belongs to one worker, never the render thread.\n\n```go\nfunc (s *Syntax) Close()\n```\n\n```go\nfunc (s *Syntax) Language() string\n```\n\n```go\nfunc (s *Syntax) Tokens(theme *syntax.Theme, definitions *syntax.Definitions) []syntax.Token\n```\n\n```go\nfunc (s *Syntax) Update[V piecetree.Value](path string, value V) error\n```\n\n```go\nfunc (s *Syntax) UpdateSnapshot(path string, source piecetree.Snapshot) error\n```\n\n","path":"github.com/pencode-labs/pencode/client","name":"client","synopsis":"Package client exposes typed Pencode services over any owned byte stream.","isRedistributable":true}
