acp

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package acp is the Agent Client Protocol frontend: an editor runs codebot as a child process and drives it over JSON-RPC on stdio. Stdout is the protocol channel, so nothing else may write to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EditorFS

type EditorFS struct {
	agentcoretools.OSFS
	// contains filtered or unexported fields
}

EditorFS routes text file reads and writes to the editor, so the agent sees unsaved buffers and its writes land in them. Everything else, including files the editor can't serve as text, uses the local filesystem.

It is built before Boot, while the connection only exists once Serve starts; until bound it behaves like the local filesystem.

func NewEditorFS

func NewEditorFS() *EditorFS

NewEditorFS logs to stderr because stdout is the protocol channel.

func (*EditorFS) Open

func (w *EditorFS) Open(ctx context.Context, path string) (io.ReadCloser, error)

Open falls back to disk on purpose: images and binaries are read that way, since the editor's text endpoint rejects them. A read is harmless; a write is not (see WriteFile).

func (*EditorFS) ReadFile

func (w *EditorFS) ReadFile(ctx context.Context, path string) ([]byte, error)

func (*EditorFS) Stat

func (w *EditorFS) Stat(ctx context.Context, path string) (agentcoretools.FileInfo, error)

Stat sets Version to a hash of the editor buffer, so the read-before-write check sees unsaved edits that don't change the disk mtime, and a buffer with no file on disk can still be stat'ed.

func (*EditorFS) WriteFile

func (w *EditorFS) WriteFile(ctx context.Context, path string, data []byte, perm fs.FileMode) error

WriteFile does not retry a failed editor write on disk: the editor owns the file, and writing behind its back would desync the buffer from the file.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves only the conversation opened at boot; session/load and multiple sessions are not supported.

func NewServer

func NewServer(version string) *Server

func (*Server) Approve

func (s *Server) Approve(ctx context.Context, p interact.Approval) (interact.Verdict, error)

Approve offers a persistent allow only when there is a rule to remember.

func (*Server) Ask

ACP can't pose questions, so the App runs without ask_user.

func (*Server) Cancel

func (*Server) FS

func (s *Server) FS() agentcoretools.FS

func (*Server) Initialize

func (*Server) Logout

func (*Server) NewSession

func (*Server) Prompt

func (s *Server) Prompt(ctx context.Context, req acp.PromptRequest) (acp.PromptResponse, error)

Prompt answers only after every update of the turn has been sent.

func (*Server) Serve

func (s *Server) Serve(a *app.App) error

func (*Server) SetSessionMode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL