Documentation
¶
Index ¶
- func AddSessionCapabilities(line []byte) []byte
- func InitializeRequest() sdkacp.InitializeRequest
- func NewClientConnection(client sdkacp.Client, peerInput io.Writer, peerOutput io.Reader) *sdkacp.ClientSideConnection
- func ReadWorkspaceFile(root string, extra []string, path string, line, limit *int) (string, error)
- func ResolveWorkspacePath(root string, extra []string, path string) (string, error)
- func StripControls(s string) string
- func WriteWorkspaceFile(root string, extra []string, path, content string) error
- type Broker
- func (b *Broker) Answer(requestID, optionID string) bool
- func (b *Broker) AnswerPermission(ctx context.Context, requestID, optionID string) error
- func (b *Broker) Begin(requestID string) error
- func (b *Broker) Cancel(ctx context.Context) error
- func (b *Broker) End(requestID string)
- func (b *Broker) Prompt(ctx context.Context, input PromptInput) error
- func (b *Broker) SetConfig(ctx context.Context, key, value string) error
- func (b *Broker) Wait(ctx context.Context, requestID string) (string, error)
- type EventLog
- func (log *EventLog) Append(kind string, ts int64, payload json.RawMessage) LogEntry
- func (log *EventLog) Close() error
- func (log *EventLog) EnablePersistence(path string) error
- func (log *EventLog) MarkTruncated()
- func (log *EventLog) ReadSince(since int64) (out []LogEntry, truncated bool)
- func (log *EventLog) SetOnAppend(onAppend func(LogEntry)) []LogEntry
- func (log *EventLog) Snapshot() []LogEntry
- func (log *EventLog) Truncated() bool
- type HarnessClient
- func (c *HarnessClient) CreateTerminal(ctx context.Context, p sdkacp.CreateTerminalRequest) (sdkacp.CreateTerminalResponse, error)
- func (c *HarnessClient) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
- func (c *HarnessClient) KillTerminal(ctx context.Context, p sdkacp.KillTerminalRequest) (sdkacp.KillTerminalResponse, error)
- func (c *HarnessClient) NewClientSideConnection(peerInput io.Writer, peerOutput io.Reader) *sdkacp.ClientSideConnection
- func (c *HarnessClient) ReadTextFile(ctx context.Context, p sdkacp.ReadTextFileRequest) (sdkacp.ReadTextFileResponse, error)
- func (c *HarnessClient) ReleaseTerminal(ctx context.Context, p sdkacp.ReleaseTerminalRequest) (sdkacp.ReleaseTerminalResponse, error)
- func (c *HarnessClient) RequestPermission(ctx context.Context, p sdkacp.RequestPermissionRequest) (sdkacp.RequestPermissionResponse, error)
- func (c *HarnessClient) SessionUpdate(ctx context.Context, n sdkacp.SessionNotification) error
- func (c *HarnessClient) TerminalOutput(ctx context.Context, p sdkacp.TerminalOutputRequest) (sdkacp.TerminalOutputResponse, error)
- func (c *HarnessClient) UnstableCompleteElicitation(_ context.Context, _ sdkacp.UnstableCompleteElicitationNotification) error
- func (c *HarnessClient) UnstableCreateElicitation(ctx context.Context, params sdkacp.UnstableCreateElicitationRequest) (sdkacp.UnstableCreateElicitationResponse, error)
- func (c *HarnessClient) WaitForTerminalExit(ctx context.Context, p sdkacp.WaitForTerminalExitRequest) (sdkacp.WaitForTerminalExitResponse, error)
- func (c *HarnessClient) WriteTextFile(ctx context.Context, p sdkacp.WriteTextFileRequest) (sdkacp.WriteTextFileResponse, error)
- type LogEntry
- type PromptImage
- type PromptInput
- type PromptResourceLink
- type TerminalPool
- type ThreadItem
- type ThreadReducer
- type ThreadState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSessionCapabilities ¶
AddSessionCapabilities adds standard fields missing from SDK v0.13.5's client capability type.
func InitializeRequest ¶
func InitializeRequest() sdkacp.InitializeRequest
InitializeRequest advertises the client capabilities agentpack implements on the worker.
func NewClientConnection ¶
func NewClientConnection(client sdkacp.Client, peerInput io.Writer, peerOutput io.Reader) *sdkacp.ClientSideConnection
NewClientConnection connects client to an agent with backpressure on notification floods. Pass the outermost client so its overrides are the handlers that release the gate.
func ReadWorkspaceFile ¶
ReadWorkspaceFile reads a text file confined to the workspace roots.
func ResolveWorkspacePath ¶
ResolveWorkspacePath follows symlinks and ensures path stays under root or extra dirs.
func StripControls ¶
StripControls removes terminal controls from agent text while retaining newlines.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker forwards conversation control and coordinates per-request answers.
func (*Broker) AnswerPermission ¶
AnswerPermission forwards and records the first answer for an active request.
type EventLog ¶
type EventLog struct {
// contains filtered or unexported fields
}
EventLog stores bounded session events for replay and coalesced retention.
func NewEventLog ¶
func (*EventLog) EnablePersistence ¶
func (*EventLog) MarkTruncated ¶
func (log *EventLog) MarkTruncated()
MarkTruncated records that an event could not be retained, such as an oversized wire frame.
func (*EventLog) SetOnAppend ¶
type HarnessClient ¶
type HarnessClient struct {
Root string
Extra []string
Log *EventLog
Broker *Broker
Terminals *TerminalPool
// contains filtered or unexported fields
}
HarnessClient is the agentpack ACP client: permissions via Broker, updates to EventLog, fs confined to workspace.
func NewHarnessClient ¶
func NewHarnessClient(root string, extra []string, log *EventLog, broker *Broker) *HarnessClient
NewHarnessClient wires a client implementation for ClientSideConnection.
func (*HarnessClient) CreateTerminal ¶
func (c *HarnessClient) CreateTerminal(ctx context.Context, p sdkacp.CreateTerminalRequest) (sdkacp.CreateTerminalResponse, error)
func (*HarnessClient) HandleExtensionMethod ¶
func (c *HarnessClient) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
func (*HarnessClient) KillTerminal ¶
func (c *HarnessClient) KillTerminal(ctx context.Context, p sdkacp.KillTerminalRequest) (sdkacp.KillTerminalResponse, error)
func (*HarnessClient) NewClientSideConnection ¶
func (c *HarnessClient) NewClientSideConnection(peerInput io.Writer, peerOutput io.Reader) *sdkacp.ClientSideConnection
NewClientSideConnection returns an SDK client connection over the given transport.
func (*HarnessClient) ReadTextFile ¶
func (c *HarnessClient) ReadTextFile(ctx context.Context, p sdkacp.ReadTextFileRequest) (sdkacp.ReadTextFileResponse, error)
func (*HarnessClient) ReleaseTerminal ¶
func (c *HarnessClient) ReleaseTerminal(ctx context.Context, p sdkacp.ReleaseTerminalRequest) (sdkacp.ReleaseTerminalResponse, error)
func (*HarnessClient) RequestPermission ¶
func (c *HarnessClient) RequestPermission(ctx context.Context, p sdkacp.RequestPermissionRequest) (sdkacp.RequestPermissionResponse, error)
func (*HarnessClient) SessionUpdate ¶
func (c *HarnessClient) SessionUpdate(ctx context.Context, n sdkacp.SessionNotification) error
func (*HarnessClient) TerminalOutput ¶
func (c *HarnessClient) TerminalOutput(ctx context.Context, p sdkacp.TerminalOutputRequest) (sdkacp.TerminalOutputResponse, error)
func (*HarnessClient) UnstableCompleteElicitation ¶
func (c *HarnessClient) UnstableCompleteElicitation(_ context.Context, _ sdkacp.UnstableCompleteElicitationNotification) error
func (*HarnessClient) UnstableCreateElicitation ¶
func (c *HarnessClient) UnstableCreateElicitation(ctx context.Context, params sdkacp.UnstableCreateElicitationRequest) (sdkacp.UnstableCreateElicitationResponse, error)
func (*HarnessClient) WaitForTerminalExit ¶
func (c *HarnessClient) WaitForTerminalExit(ctx context.Context, p sdkacp.WaitForTerminalExitRequest) (sdkacp.WaitForTerminalExitResponse, error)
func (*HarnessClient) WriteTextFile ¶
func (c *HarnessClient) WriteTextFile(ctx context.Context, p sdkacp.WriteTextFileRequest) (sdkacp.WriteTextFileResponse, error)
type LogEntry ¶
type LogEntry struct {
Seq int64 `json:"seq"`
TS int64 `json:"ts"`
Kind string `json:"kind"`
Payload json.RawMessage `json:"payload"`
}
LogEntry is one append-only row in a session event log. Payload is the ACP sessionUpdate body or a synthetic envelope for prompt, permission, and turn events.
type PromptImage ¶
PromptImage references an image blob stored under the worker session directory.
type PromptInput ¶
type PromptInput struct {
Text string
Image *PromptImage
Images []PromptImage
ResourceLink *PromptResourceLink
}
PromptInput is a user message sent to the agent.
type PromptResourceLink ¶
PromptResourceLink references a stored file that an agent can read by URI.
type TerminalPool ¶
type TerminalPool struct {
// contains filtered or unexported fields
}
TerminalPool runs ACP terminal/create commands with a bounded output buffer.
func NewTerminalPool ¶
func NewTerminalPool() *TerminalPool
NewTerminalPool returns an empty terminal pool.
func (*TerminalPool) Close ¶
func (p *TerminalPool) Close() error
Close prevents new terminals and terminates every managed process group.
type ThreadItem ¶
type ThreadItem struct {
Kind string `json:"kind"`
Data json.RawMessage `json:"data,omitempty"`
}
ThreadItem is the reduced view shared by the gateway UI and ap hub TUI.
type ThreadReducer ¶
type ThreadReducer struct {
// contains filtered or unexported fields
}
ThreadReducer applies conversation entries without rescanning the full log.
func (*ThreadReducer) Apply ¶
func (reducer *ThreadReducer) Apply(entry LogEntry) ThreadState
type ThreadState ¶
type ThreadState struct {
Items []ThreadItem `json:"items"`
NeedsYou bool `json:"needs_you"`
Working bool `json:"working"`
PlanKind string `json:"plan_kind,omitempty"`
ContextTokens int `json:"context_tokens,omitempty"`
ContextLimit int `json:"context_limit,omitempty"`
CostUSD float64 `json:"cost_usd,omitempty"`
}
ThreadState tracks composer-adjacent session UI state.
func ReduceLog ¶
func ReduceLog(entries []LogEntry) ThreadState
ReduceLog folds append-only log entries into a thread view.