agents

package
v0.1.156 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 20 Imported by: 6

Documentation

Index

Constants

View Source
const ProtocolVersion = 1

ProtocolVersion is used for future-proofing the stdout handshake.

Variables

This section is empty.

Functions

func AddProcessor added in v0.0.55

func AddProcessor(processor wool.LogProcessorWithSource)

func NewAgentLogger

func NewAgentLogger(agent *resources.Agent) wool.LogProcessor

NewAgentLogger creates a log processor for an agent that writes to stderr.

func NewAgentProvider added in v0.0.55

func NewAgentProvider(ctx context.Context, agent *resources.Agent) *wool.Provider

NewAgentProvider creates a wool provider for an agent.

func NewAgentServiceLogger added in v0.1.83

func NewAgentServiceLogger(identity *resources.ServiceIdentity) wool.LogProcessor

NewAgentServiceLogger creates a log processor for a service agent.

func NewServiceAgentProvider added in v0.1.83

func NewServiceAgentProvider(ctx context.Context, identity *resources.ServiceIdentity) *wool.Provider

NewServiceAgentProvider creates a wool provider for a service agent.

func NewServiceLogger

func NewServiceLogger(identity *resources.ServiceIdentity) wool.LogProcessor

NewServiceLogger creates a log processor for a service.

func NewServiceProvider added in v0.0.55

func NewServiceProvider(ctx context.Context, identity *resources.ServiceIdentity) *wool.Provider

NewServiceProvider creates a wool provider for a service.

func ResetRPCStats added in v0.1.155

func ResetRPCStats()

ResetRPCStats clears all counters. Test-only — production agents should never call this (loses telemetry).

func Serve added in v0.1.155

func Serve(reg PluginRegistration)

Serve starts a gRPC server on a random local port, registers the plugin's services, signals the port to the CLI via stdout, and blocks until the process is terminated.

Plugin binaries call this from main():

agents.Serve(agents.PluginRegistration{
    Agent:   svc,
    Runtime: NewRuntime(),
    Builder: NewBuilder(),
    Code:    NewCode(),
})

func SnapshotRPCStats added in v0.1.155

func SnapshotRPCStats() map[string]rpcMethodStats

SnapshotRPCStats returns a deep copy of the current per-method stats. Safe to call concurrently with live RPCs.

Types

type AgentLogger

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

AgentLogger writes structured wool logs to stderr as JSON. The CLI reads these from the spawned process's stderr.

func (*AgentLogger) Process added in v0.0.55

func (w *AgentLogger) Process(log *wool.Log)

type ChannelLog added in v0.1.155

type ChannelLog struct {
	Source *wool.Identifier
	Log    *wool.Log
}

ChannelLog carries a structured log with its source through a channel.

type ChannelProcessor added in v0.1.155

type ChannelProcessor struct {
	Ch chan<- ChannelLog
}

ChannelProcessor sends logs to a channel for consumption by a TUI or other event-driven consumer.

func NewChannelProcessor added in v0.1.155

func NewChannelProcessor(ch chan<- ChannelLog) *ChannelProcessor

NewChannelProcessor creates a processor that sends logs on ch. The channel should be buffered to avoid blocking the log pipeline.

func (*ChannelProcessor) Process added in v0.1.155

func (p *ChannelProcessor) Process(log *wool.Log)

func (*ChannelProcessor) ProcessWithSource added in v0.1.155

func (p *ChannelProcessor) ProcessWithSource(source *wool.Identifier, log *wool.Log)

type LogHandler added in v0.0.55

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

LogHandler processes structured logs from agent processes.

func GetLogHandler added in v0.1.155

func GetLogHandler() *LogHandler

func (*LogHandler) ForwardLogs added in v0.1.155

func (h *LogHandler) ForwardLogs(r io.Reader)

ForwardLogs reads structured JSON log lines from a reader (typically the stderr of a spawned agent process) and dispatches them to registered log processors. Blocks until the reader is closed.

type LogMessage

type LogMessage struct {
	Log    *wool.Log        `json:"log"`
	Source *wool.Identifier `json:"identifier"`
}

LogMessage is the JSON envelope written to stderr.

type PluginRegistration added in v0.1.155

type PluginRegistration struct {
	Agent   agentv0.AgentServer
	Runtime runtimev0.RuntimeServer
	Builder builderv0.BuilderServer
	Code    codev0.CodeServer       // Deprecated: use Tooling for language-specific operations.
	Tooling toolingv0.ToolingServer // Language analysis: LSP, callgraph, fix, deps, build/test/lint.
}

PluginRegistration holds the gRPC servers a plugin wants to expose. All registration is handled by core -- plugins never import grpc directly.

Plugins implement the capabilities they need:

  • Infrastructure (redis, postgres): Agent + Runtime
  • Application (go-grpc, python-fastapi): Agent + Runtime + Builder + Tooling
  • Tooling-only (go-analyzer): Agent + Tooling

Separation of concerns:

  • Runtime: service lifecycle (Load/Init/Start/Stop/Destroy)
  • Builder: Docker build + k8s deploy + scaffolding
  • Code: file/git/LSP operations (deprecated — use Tooling for language-specific ops)
  • Tooling: language-specific analysis (LSP, callgraph, fix, deps, build/test/lint)

Directories

Path Synopsis
helpers
audit
Package audit runs language-specific dependency audits on behalf of codefly Builder agents.
Package audit runs language-specific dependency audits on behalf of codefly Builder agents.
upgrade
Package upgrade applies dependency bumps on behalf of codefly Builder agents.
Package upgrade applies dependency bumps on behalf of codefly Builder agents.
Package testing provides helpers for agent composition + lifecycle tests.
Package testing provides helpers for agent composition + lifecycle tests.

Jump to

Keyboard shortcuts

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