acptools

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package acptools contains tools built in to ACP like file IO and terminals

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesystemTools

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

FilesystemTools implements the ACP ReadTextFile and WriteTextFile endpoints. It is separate from TerminalTools to allow toggling local/remote execution separately.

func NewFilesystemTools

func NewFilesystemTools(logger zerolog.Logger) *FilesystemTools

NewFilesystemTools returns a FilesystemTools instance that executes filesystem operations locally.

func (*FilesystemTools) ReadTextFile

ReadTextFile implements ReadTextFile by actually reading the file and returning results. This is opposed to the non-default behavior of passing the request to the ACP client to execute on the host.

func (*FilesystemTools) WriteTextFile

WriteTextFile implements WriteTextFile by actually writing the file and returning results. This is opposed to the non-default behavior of passing the request to the ACP client to execute on the host.

type TermACPClient added in v0.0.3

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

TermACPClient implements acp.Client against a local terminal: it prints session updates, prompts the user for permission decisions, and delegates file and terminal operations to acptools.

func NewTermACPClient added in v0.0.3

func NewTermACPClient() *TermACPClient

NewTermACPClient creates a terminal-backed ACP client. Session updates and permission prompts are rendered to os.Stdout, and permission selections are read from os.Stdin. File and terminal operations are backed by the built-in acptools implementations.

func (*TermACPClient) CreateTerminal added in v0.0.3

CreateTerminal delegates to the local terminal implementation.

func (*TermACPClient) KillTerminal added in v0.0.3

KillTerminal implements acp.Client.

func (*TermACPClient) ReadTextFile added in v0.0.3

ReadTextFile delegates to the local filesystem implementation.

func (*TermACPClient) ReleaseTerminal added in v0.0.3

ReleaseTerminal delegates to the local terminal implementation.

func (*TermACPClient) RequestPermission added in v0.0.3

RequestPermission prompts the user on the terminal to choose one of the provided permission options for a tool call. An invalid or empty selection (or a cancelled context) is reported as cancelled rather than erroring, so the agent can wind down the turn cleanly.

func (*TermACPClient) SessionUpdate added in v0.0.3

func (e *TermACPClient) SessionUpdate(ctx context.Context, params acp.SessionNotification) error

SessionUpdate renders a session update to the terminal. Only the update kinds relevant to a terminal client are rendered; the rest are ignored.

func (*TermACPClient) TerminalOutput added in v0.0.3

TerminalOutput delegates to the local terminal implementation.

func (*TermACPClient) WaitForTerminalExit added in v0.0.3

WaitForTerminalExit delegates to the local terminal implementation.

func (*TermACPClient) WriteTextFile added in v0.0.3

WriteTextFile delegates to the local filesystem implementation.

type TerminalTools

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

TerminalTools implements the terminal-related methods of acp.Client. It runs commands as real OS processes and tracks their output and exit status, keyed by a generated terminal ID.

func NewTerminalTools

func NewTerminalTools(logger zerolog.Logger) *TerminalTools

NewTerminalTools constructs a TerminalTools with the given logger.

func (*TerminalTools) CreateTerminal

CreateTerminal starts a new command process and returns a terminal ID that can be used to inspect its output and status.

func (*TerminalTools) KillTerminal

KillTerminal terminates the terminal's process without releasing the terminal; its output and exit status remain available afterwards.

func (*TerminalTools) ReleaseTerminal

ReleaseTerminal frees the resources associated with a terminal, killing the underlying process if it is still running.

func (*TerminalTools) TerminalOutput

TerminalOutput returns the output captured so far for a terminal along with its exit status, if the command has completed.

func (*TerminalTools) WaitForTerminalExit

WaitForTerminalExit blocks until the terminal's command exits (or the context is cancelled) and returns its exit status.

Jump to

Keyboard shortcuts

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