Documentation
¶
Index ¶
- Constants
- func AllowOptionID(params json.RawMessage) string
- type Handlers
- type Message
- type PermissionMode
- type PermissionResponse
- type ProcessConfig
- type StdioTransport
- func (t *StdioTransport) Alive() bool
- func (t *StdioTransport) Close() error
- func (t *StdioTransport) Notify(method string, params any) error
- func (t *StdioTransport) Request(ctx context.Context, method string, params any) (json.RawMessage, error)
- func (t *StdioTransport) Updates(buffer int) (<-chan Message, func())
- type Transport
Constants ¶
View Source
const ( // PermissionOutcomeSelected and PermissionOutcomeCancelled are the only two // ACP RequestPermissionOutcome discriminators. PermissionOutcomeSelected = "selected" PermissionOutcomeCancelled = "cancelled" )
Variables ¶
This section is empty.
Functions ¶
func AllowOptionID ¶
func AllowOptionID(params json.RawMessage) string
AllowOptionID returns the id of the permission option that grants access, or "" when none of the offered options is an allow/approve option. It never falls back to an arbitrary option, so callers fail closed when no allow option exists. The ACP v1 PermissionOption id field is "optionId"; the legacy "id" spelling is accepted as a fallback.
Types ¶
type Handlers ¶
type Handlers struct {
Permission func(ctx context.Context, params json.RawMessage) PermissionResponse
}
type Message ¶
type Message struct {
Method string
Params json.RawMessage
}
type PermissionMode ¶
type PermissionMode string
const ( PermissionModeDeny PermissionMode = "deny" PermissionModeAutoApprove PermissionMode = "auto_approve" )
type PermissionResponse ¶
PermissionResponse is the host's decision for a session/request_permission. Outcome is the ACP outcome discriminator ("selected" or "cancelled"); SelectedOptionID is required when Outcome == "selected".
type ProcessConfig ¶
type ProcessConfig struct {
Command string
Args []string
Dir string
Env []string
PermissionMode PermissionMode
}
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
func (*StdioTransport) Alive ¶
func (t *StdioTransport) Alive() bool
func (*StdioTransport) Close ¶
func (t *StdioTransport) Close() error
func (*StdioTransport) Request ¶
func (t *StdioTransport) Request(ctx context.Context, method string, params any) (json.RawMessage, error)
func (*StdioTransport) Updates ¶
func (t *StdioTransport) Updates(buffer int) (<-chan Message, func())
type Transport ¶
type Transport interface {
Request(ctx context.Context, method string, params any) (json.RawMessage, error)
Notify(method string, params any) error
Updates(buffer int) (<-chan Message, func())
// Alive reports whether the underlying connection is still usable. A pooled
// transport whose process has exited must not be reused.
Alive() bool
Close() error
}
Click to show internal directories.
Click to hide internal directories.