piagent

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package piagent implements an adapter for standalone Pi Agent sessions.

Pi Agent stores sessions in ~/.pi/agent/sessions/<encoded-path>/ where encoded-path is the project path with slashes replaced by dashes, wrapped in double dashes (e.g., /home/user/project → --home-user-project--).

This differs from the openclaw-embedded Pi which uses a flat global directory. The JSONL format is identical to the pi package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWatcher

func NewWatcher(projectDir string) (<-chan adapter.Event, io.Closer, error)

NewWatcher creates a watcher for Pi Agent session changes in a project directory.

Types

type Adapter

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

Adapter implements the adapter.Adapter interface for standalone Pi Agent sessions.

func New

func New() *Adapter

New creates a new Pi Agent adapter.

func NewCustom added in v0.86.0

func NewCustom(sessionsDir, id, name, icon string) *Adapter

NewCustom creates a Pi Agent-compatible adapter with a custom sessions directory and identity. Use this for forks of Pi Agent that share the same JSONL format but store sessions elsewhere.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() adapter.CapabilitySet

Capabilities returns the supported features.

func (*Adapter) Detect

func (a *Adapter) Detect(projectRoot string) (bool, error)

Detect checks if Pi Agent sessions exist for the given project.

func (*Adapter) ID

func (a *Adapter) ID() string

ID returns the adapter identifier.

func (*Adapter) Icon

func (a *Adapter) Icon() string

Icon returns the adapter icon for badge display.

func (*Adapter) Messages

func (a *Adapter) Messages(sessionID string) ([]adapter.Message, error)

Messages returns all messages for the given session.

func (*Adapter) Name

func (a *Adapter) Name() string

Name returns the human-readable adapter name.

func (*Adapter) SessionByID

func (a *Adapter) SessionByID(sessionID string) (*adapter.Session, error)

SessionByID returns a single session by ID without scanning the directory. Implements adapter.TargetedRefresher for efficient targeted refresh.

func (*Adapter) Sessions

func (a *Adapter) Sessions(projectRoot string) ([]adapter.Session, error)

Sessions returns all sessions for the given project, sorted by update time.

func (*Adapter) Usage

func (a *Adapter) Usage(sessionID string) (*adapter.UsageStats, error)

Usage returns aggregate usage stats for the given session.

func (*Adapter) Watch

func (a *Adapter) Watch(projectRoot string) (<-chan adapter.Event, io.Closer, error)

Watch returns a channel that emits events when session data changes.

func (*Adapter) WithProjectDirFunc added in v0.86.0

func (a *Adapter) WithProjectDirFunc(fn func(sessionsDir, projectRoot string) string) *Adapter

WithProjectDirFunc overrides the function used to map a project root to its sessions directory. Use this for Pi forks that encode paths differently.

Jump to

Keyboard shortcuts

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