{"modulePath":"github.com/pencode-labs/pencode","version":"v0.1.0-rc.15","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package protocol\n\nPackage protocol defines the headless Pencode client/server wire format. Payloads are borrowed until the reader's next Read. Readers and writers each have one owner; callers transfer owned data across goroutines.\n\n## Constants\n\n```go\nconst (\n\tVersion    = 20\n\tHeaderSize = 24\n\tMaxPayload = 64 \u003c\u003c 10\n\tMaxMessage = 64 \u003c\u003c 20\n\tChunkSize  = 32 \u003c\u003c 10\n\t// StreamWindow bounds both buffered process output and each stream RPC.\n\tStreamWindow = 256 \u003c\u003c 10\n)\n```\n\n```go\nconst (\n\tIndexPageSize   = 256\n\tIndexEntryLimit = 262144\n\tIndexDepthLimit = 256\n)\n```\n\n```go\nconst TextPageSize = 64 \u003c\u003c 10\n```\nTextPageSize bounds text sent to and laid out by the editor. Larger files retain a disk-backed document and expose one page at a time.\n\n```go\nconst TextPagingThreshold = 4 \u003c\u003c 20\n```\n\n```go\nconst TextSearchFileLimit = 2 \u003c\u003c 20\n```\n\n```go\nconst TextSearchFilesLimit = 65536\n```\n\n```go\nconst TextSearchLimit = 2000\n```\n\n## Variables\n\n```go\nvar ErrProtocol = errors.New(\"pencode: invalid client/server message\")\n```\n\n## Functions\n\n```go\nfunc EncodeExtension(e *Encoder, i ExtensionInfo)\n```\n\n```go\nfunc IsBinaryFile(name string) bool\n```\nIsBinaryFile is a cheap search prefilter. Unknown types still undergo content checks during search, even though opening them requires an editor choice.\n\n```go\nfunc IsTextFile(name string) bool\n```\nIsTextFile recognizes built-in text associations. Unknown types need an extension or an explicit choice; content is checked again by the file service.\n\n```go\nfunc SearchFlags(options textsearch.Options) uint32\n```\n\n```go\nfunc SearchOptions(flags uint32) textsearch.Options\n```\n\n```go\nfunc ValidPortHost(host string) bool\n```\nHosts are passed directly to the remote TCP dialer, never to a shell.\n\n## Types\n\n```go\ntype Code uint32\n```\n\n```go\nconst (\n\tInvalid Code = iota + 1\n\tNotFound\n\tConflict\n\tVersionMismatch\n\tBusy\n\tIO\n)\n```\n\n```go\ntype Decoder struct {\n\tErr    error\n\tBuffer []byte\n}\n```\n\n```go\nfunc (d *Decoder) Bytes() []byte\n```\n\n```go\nfunc (d *Decoder) DocumentPage() DocumentPage\n```\n\n```go\nfunc (d *Decoder) Done() error\n```\n\n```go\nfunc (d *Decoder) String() string\n```\n\n```go\nfunc (d *Decoder) U32() uint32\n```\n\n```go\nfunc (d *Decoder) U64() uint64\n```\n\n```go\ntype Document struct {\n\tContent     string\n\tPage        DocumentPage\n\tID, Version uint64\n}\n```\n\n```go\ntype DocumentMode uint32\n```\nDocumentMode distinguishes path-only viewers, checked text, and an explicit user request to decode a resource in the code editor.\n\n```go\nconst (\n\tDocumentFile DocumentMode = iota\n\tDocumentText\n\tDocumentTextForced\n)\n```\n\n```go\nfunc FileMode(name string) DocumentMode\n```\n\n```go\ntype DocumentPage struct {\n\tOffset, Size uint64\n\tPaged        bool\n}\n```\n\n```go\ntype Encoder struct{ Buffer []byte }\n```\nEncoder appends into caller-owned storage and can be reset without allocating.\n\n```go\nfunc (e *Encoder) Bytes(v []byte)\n```\n\n```go\nfunc (e *Encoder) DocumentPage(p DocumentPage)\n```\n\n```go\nfunc (e *Encoder) Reset()\n```\n\n```go\nfunc (e *Encoder) String(v string)\n```\n\n```go\nfunc (e *Encoder) U32(v uint32)\n```\n\n```go\nfunc (e *Encoder) U64(v uint64)\n```\n\n```go\ntype Entry struct {\n\tName string\n\tMode uint32\n}\n```\n\n```go\ntype Error struct {\n\tMessage string\n\tCode    Code\n}\n```\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\ntype ExtensionInfo struct {\n\tPath, Problem string\n\tExtensionManifest\n}\n```\n\n```go\nfunc DecodeExtension(d *Decoder) ExtensionInfo\n```\n\n```go\nfunc (i *ExtensionInfo) Label() string\n```\n\n```go\ntype ExtensionManifest struct {\n\tID          string   `json:\"id\"`\n\tName        string   `json:\"name,omitempty\"`\n\tVersion     string   `json:\"version,omitempty\"`\n\tPublisher   string   `json:\"publisher,omitempty\"`\n\tDescription string   `json:\"description,omitempty\"`\n\tEntry       string   `json:\"entry\"`\n\tArgs        []string `json:\"args,omitempty\"`\n\tDisabled    bool     `json:\"disabled,omitempty\"`\n}\n```\nExtensionManifest is installed on the server at resources/extension.json.\n\n```go\nfunc (m ExtensionManifest) JavaScript() bool\n```\nJavaScript distinguishes bundled TypeScript/JavaScript entries from native executables. Runtime lookup belongs to the workspace host, never the GUI.\n\n```go\ntype FileChanges struct {\n\tFiles   []FileEvent\n\tVersion uint64\n\tChanges WorkspaceChange\n\tReset   bool // Reconcile when history or native events overflowed.\n}\n```\n\n```go\ntype FileEvent struct {\n\tPath      string // Workspace-relative, slash-separated; never an external Git path.\n\tOp        FileOperation\n\tDirectory bool\n}\n```\n\n```go\ntype FileOperation uint8\n```\nFileOperation is shared by every native watcher and file-service consumer.\n\n```go\nconst (\n\tFileCreated FileOperation = 1 \u003c\u003c iota\n\tFileWritten\n\tFileRemoved\n\tFileRenamed\n\tFileMetadataChanged\n)\n```\n\n```go\ntype Frame struct {\n\tPayload []byte\n\tID      uint64\n\tStream  uint32\n\tKind    Kind\n}\n```\n\n```go\ntype IndexEntry struct {\n\tPath      string\n\tDepth     uint16\n\tDirectory bool\n}\n```\n\n```go\nfunc (e IndexEntry) Name() string\n```\n\n```go\ntype Kind uint16\n```\n\n```go\nconst (\n\tHello Kind = iota + 1\n\tWorkspaceOpen\n\tWorkspaceClose\n\tDocumentOpen\n\tDocumentChange\n\tDocumentSave\n\tDocumentClose\n\tDocumentMove\n\tDocumentRead\n\tDirectoryRead\n\tResourceCreate\n\tResourceRemove\n\tResourceRename\n\tResourceTransfer\n\tResourceImport\n\tService\n\tCancel\n\tReply\n\tData\n\tFailure\n)\n```\n\n```go\ntype Operation uint32\n```\nService operations share the connection's cancellation and chunking rules.\n\n```go\nconst (\n\tGitCommand Operation = iota + 1\n\tFileRead\n\tFileSave\n\tDiffPatch\n\tProcessOpen\n\tTerminalOpen\n\tStreamRead\n\tStreamWrite\n\tStreamResize\n\tStreamClose\n\tStreamWait\n\tIndexOpen\n\tIndexNext\n\tIndexClose\n\tPathSearch\n\tSyntaxAnalyze\n\tSyntaxRelease\n\tExtensionList\n\tExtensionLoad\n\tExtensionResource\n\tExtensionProcess\n\tExtensionLanguageProcess\n\tExtensionBegin\n\tExtensionWrite\n\tExtensionPrepare\n\tExtensionCommit\n\tExtensionAbort\n\tExtensionEnable\n\tExtensionRemove\n\tExtensionResources\n\tDirectoryBrowse\n\tConfigurationRead\n\tSettingsSave\n\tPortList\n\tPortConnect\n\tStreamCloseWrite\n\tGitRepositories\n\tTextSearch\n\tDebugAdapterOpen\n\tDebugTerminalOpen\n\tWorkspaceWatch\n\tGitCheckIgnore\n\tGitRebasing\n\tLanguageTools\n)\n```\n\n```go\ntype Port struct {\n\tHost    string\n\tProcess string\n\tPID     uint32\n\tNumber  uint16\n}\n```\n\n```go\ntype Reader struct {\n\tSource io.Reader\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r *Reader) Read() (Frame, error)\n```\n\n```go\ntype SearchDocument struct{ Path, Content string }\n```\n\n```go\ntype SearchFile struct {\n\tPath, Digest string\n\tMatches      []TextMatch\n\tCount        int\n}\n```\n\n```go\ntype SearchResult struct {\n\tFiles     []SearchFile\n\tTruncated bool\n\tSkipped   int\n}\n```\n\n```go\ntype TerminalCommand struct {\n\tEnv       map[string]*string\n\tDirectory string\n\tArgs      []string\n}\n```\n\n```go\ntype TextMatch struct {\n\tPreview                  string\n\tStart, End, Line, Column int\n\tPreviewStart             int\n}\n```\n\n```go\ntype Workspace struct {\n\tPath, Name string\n\tID         uint64\n}\n```\n\n```go\ntype WorkspaceChange uint32\n```\n\n```go\nconst (\n\tWorkspaceTreeChanged WorkspaceChange = 1 \u003c\u003c iota\n\tWorkspaceGitChanged\n\tWorkspaceRepositoriesChanged\n\tWorkspaceIgnoreChanged\n)\n```\n\n```go\ntype Writer struct {\n\tTarget io.Writer\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (w *Writer) Write(kind Kind, id uint64, payload []byte) error\n```\n\n","path":"github.com/pencode-labs/pencode/protocol","name":"protocol","synopsis":"Package protocol defines the headless Pencode client/server wire format.","isRedistributable":true}
