Documentation
¶
Index ¶
- Constants
- Variables
- func BuildACPEditToolCall(proposal *tools.EditProposal) *acputil.ToolCallProgress
- func BuildAuthMethods(ctx context.Context) []acputil.AuthMethod
- func BuildClarifyElicitation(sessionID string, prompt *jsonutil.Object) (*jsonutil.Object, error)
- func BuildClarifyPermission(prompt *jsonutil.Object) (*acputil.ToolCallProgress, []acputil.PermissionOption, map[string]string, ...)
- func BuildModelState(ctx context.Context, model, prov, baseURL string) (*acputil.SessionModelState, error)
- func BuildSessionProvenance(ctx context.Context, db SessionGetter, ...) *jsonutil.Object
- func BuildToolAbandoned(toolCallID, toolName string) *acputil.ToolCallProgress
- func BuildToolComplete(toolCallID, toolName string, result *string, functionArgs *jsonutil.Object, ...) *acputil.ToolCallProgress
- func BuildToolStart(toolCallID, toolName string, arguments *jsonutil.Object, ...) *acputil.ToolCallStart
- func BuildToolTitle(toolName string, args *jsonutil.Object) string
- func CatalogSessions(ctx context.Context, path, cwd string) ([]*jsonutil.Object, error)
- func ClientSupportsFormElicitation(initializeParams any) bool
- func CmdACP(ctx context.Context, ns map[string]any, w io.Writer) (int, error)
- func CoerceToolArgs(raw any) *jsonutil.Object
- func ContentBlocksToOpenAIUserContent(prompt []acputil.ContentBlock) (any, error)
- func DetectProvider(ctx context.Context) string
- func DispatchModuleEntry(ctx context.Context, exit func(int))
- func ElicitedAnswer(response any) (string, bool)
- func EncodeModelChoice(prov, model string) string
- func ExtractLocations(arguments *jsonutil.Object) ([]acputil.ToolCallLocation, error)
- func ExtractText(prompt []acputil.ContentBlock) string
- func GetToolKind(toolName string) string
- func LogicalSessionID(ctx context.Context, path, sessionID string) (string, error)
- func Main(ctx context.Context, argv []string, stdout, stderr io.Writer) int
- func NewAgent() any
- func ReadCatalogRows(ctx context.Context, path string) (map[string]*jsonutil.Object, []string, error)
- func ReadLocalOwners(ctx context.Context, path string) (map[string]string, error)
- func SessionProvenanceMeta(ctx context.Context, db SessionGetter, ...) *jsonutil.Object
- type AssistantMessageIDAllocator
- type Client
- type CommandRefused
- type GatewayACPAgent
- func (a *GatewayACPAgent) Authenticate(ctx context.Context, req *acputil.AuthenticateRequest) (*acputil.AuthenticateResponse, error)
- func (a *GatewayACPAgent) Cancel(ctx context.Context, req *acputil.CancelNotification) error
- func (a *GatewayACPAgent) Close()
- func (a *GatewayACPAgent) ForkSession(ctx context.Context, req *acputil.ForkSessionRequest) (*acputil.ForkSessionResponse, error)
- func (a *GatewayACPAgent) Initialize(ctx context.Context, req *acputil.InitializeRequest) (*acputil.InitializeResponse, error)
- func (a *GatewayACPAgent) ListSessions(ctx context.Context, req *acputil.ListSessionsRequest) (*acputil.ListSessionsResponse, error)
- func (a *GatewayACPAgent) LoadSession(ctx context.Context, req *acputil.LoadSessionRequest) (*acputil.LoadSessionResponse, error)
- func (a *GatewayACPAgent) NewSession(ctx context.Context, req *acputil.NewSessionRequest) (*acputil.NewSessionResponse, error)
- func (a *GatewayACPAgent) OnConnect(conn *acputil.AgentSideConnection)
- func (a *GatewayACPAgent) Prompt(ctx context.Context, req *acputil.PromptRequest) (*acputil.PromptResponse, error)
- func (a *GatewayACPAgent) ResumeSession(ctx context.Context, req *acputil.ResumeSessionRequest) (*acputil.ResumeSessionResponse, error)
- func (a *GatewayACPAgent) SetConfigOption(ctx context.Context, req *acputil.SetConfigOptionParams) (*acputil.SetSessionConfigOptionResponse, error)
- func (a *GatewayACPAgent) SetSessionMode(ctx context.Context, req *acputil.SetSessionModeRequest) (*acputil.SetSessionModeResponse, error)
- func (a *GatewayACPAgent) SetSessionModel(ctx context.Context, req *acputil.SetSessionModelRequest) (*acputil.SetSessionModelResponse, error)
- type ModeSpec
- type MutationConfirm
- type MutationDerive
- type MutationRPC
- type PreparedMutations
- type ReasoningCallbackSetter
- type RequestPermissionFunc
- type RichSessionLister
- type SessionGetter
- type SessionUpdater
- type StagedAttachment
Constants ¶
const ( ElicitationMethod = "elicitation/create" SkipOption = "skip" )
const ( DefaultMode = "default" DefaultEditApprovalPolicy = "ask" EditApprovalPolicyConfigID = "edit_approval_policy" )
const ACPAdapterModuleEntry = "__icebath_acp_adapter__"
Entry word the binary runs the ACP adapter module under
const ReasoningConfigID = "reasoning_effort"
Config option id of the reasoning effort picker
const TerminalSetupAuthMethodID = "icebath-setup"
Variables ¶
var ( NewPreparedMutations func() PreparedMutations SlashMutation func(command, arg string) (string, *jsonutil.Object, error) ModelRefusalText func(refusal map[string]any, confirmed bool) string ConfirmationTitle func(refusal map[string]any) string CommandRefusal func(command string) string RewindTo func(turnsBack int64, retry bool) MutationDerive ReplayGapOwedReply func(shown, final string) string ReplayGapPendingStatus func(pending []any, admission any) any ReplayGapSettled func(receipt map[string]any) *bool EnvLaunchFlags func() *jsonutil.Object ResolveCommand func(name string) (string, bool) RunModelSetup func(ctx context.Context) int )
Wiring of the core gateway client modules, bound by wiring.go init, RunModelSetup by cmd/icebath where the CLI runs
var EditApprovalPolicyToMode = map[string]string{
"ask": "default",
"workspace_session": "accept_edits",
"session": "dont_ask",
}
Edit approval policy to mode id
var ModeOrder = []string{"default", "accept_edits", "dont_ask"}
Mode ids in table order
var ModeToEditApprovalPolicy = map[string]string{
"default": "ask",
"accept_edits": "workspace_session",
"dont_ask": "session",
}
Mode id to edit approval policy
var Modes = map[string]ModeSpec{
"default": {"ask", "Default", "Ask before edits."},
"accept_edits": {"workspace_session", "Accept Edits", "Auto-allow workspace and temp-dir edits; still asks for sensitive paths."},
"dont_ask": {"session", "Don't Ask", "Auto-allow file edits for this session except sensitive paths."},
}
Mode id to its edit approval policy, display name and description
var NewSurfaceLabelReader func(db *state.SessionDB) RichSessionLister
Gateway session store reader over a state database, assigned in cmd/icebath/wiring.go
var ToolKindMap = func() map[string]string { m := map[string]string{} for kind, names := range map[string][]string{ "read": {"read_file", "skill_view", "skills_list", "browser_snapshot", "browser_vision", "browser_get_images", "vision_analyze"}, "edit": {"write_file", "patch", "skill_manage"}, "search": {"search_files"}, "execute": {"terminal", "process", "execute_code", "browser_click", "browser_type", "browser_scroll", "browser_press", "browser_back", "delegate_task", "image_generate", "text_to_speech"}, "fetch": {"web_search", "web_extract", "browser_navigate"}, "other": {"todo"}, "think": {"_thinking"}, } { for _, n := range names { m[n] = kind } } return m }()
Tool name to ACP tool kind, unlisted tools are other
Functions ¶
func BuildACPEditToolCall ¶
func BuildACPEditToolCall(proposal *tools.EditProposal) *acputil.ToolCallProgress
Pending edit tool call update shown with the proposal's diff in a permission request
func BuildAuthMethods ¶
func BuildAuthMethods(ctx context.Context) []acputil.AuthMethod
Registry compatible auth methods, the detected provider first and terminal setup always
func BuildClarifyElicitation ¶
Elicitation form params asking the clarify question, an enum or multi select array when choices exist
func BuildClarifyPermission ¶
func BuildClarifyPermission(prompt *jsonutil.Object) (*acputil.ToolCallProgress, []acputil.PermissionOption, map[string]string, error)
Permission card for a clarify prompt, one option per choice plus Skip and each option's answer
func BuildModelState ¶
func BuildModelState(ctx context.Context, model, prov, baseURL string) (*acputil.SessionModelState, error)
Picker state from the inventory and named endpoints, nil when nothing is listable, an error when the inventory fails
func BuildSessionProvenance ¶
func BuildSessionProvenance(ctx context.Context, db SessionGetter, acpSessionID, currentID, previousID string) *jsonutil.Object
Session provenance of an ACP session walked from the compression chain, nil when unreadable
func BuildToolAbandoned ¶
func BuildToolAbandoned(toolCallID, toolName string) *acputil.ToolCallProgress
Failed tool call progress for a call that ended without a result
func BuildToolComplete ¶
func BuildToolComplete(toolCallID, toolName string, result *string, functionArgs *jsonutil.Object, snapshot *tools.LocalEditSnapshot, isError bool) *acputil.ToolCallProgress
Tool call progress closing a completed call with its formatted result and status
func BuildToolStart ¶
func BuildToolStart(toolCallID, toolName string, arguments *jsonutil.Object, editDiff *tools.EditProposal) *acputil.ToolCallStart
Tool call start for a tool, a minimal start when rendering the arguments fails
func BuildToolTitle ¶
Tool name and its shared preview, the bare name when the arguments give none
func CatalogSessions ¶
Historical ACP sessions with messages, optionally under one cwd, one row per logical owner newest first
func ClientSupportsFormElicitation ¶
Reports whether raw initialize params advertise form elicitation under either capability key
func CmdACP ¶
Launches Icebath Agent as an ACP server, the launch flags exported as their env equivalents first
func CoerceToolArgs ¶
Tool call arguments as a dict, JSON text decoded or wrapped under raw, other values empty
func ContentBlocksToOpenAIUserContent ¶
func ContentBlocksToOpenAIUserContent(prompt []acputil.ContentBlock) (any, error)
User content of ACP prompt blocks, a string for pure text and parts when media is present
func DetectProvider ¶
Lowercased active runtime provider when it has a key or token source, empty otherwise
func DispatchModuleEntry ¶
Runs the adapter module entry and exits when argv carries its entry word
func ElicitedAnswer ¶
Answer of an elicitation response, empty for decline or cancel, false when not answered
func EncodeModelChoice ¶
Provider and model joined by a colon so clients keep the provider, the bare model without one
func ExtractLocations ¶
func ExtractLocations(arguments *jsonutil.Object) ([]acputil.ToolCallLocation, error)
File system locations of tool arguments, a path with its offset or line
func ExtractText ¶
func ExtractText(prompt []acputil.ContentBlock) string
Plain text of the prompt blocks that carry text, newline joined
func GetToolKind ¶
ACP tool kind of a tool, other when unlisted
func LogicalSessionID ¶
Logical session id of an id an editor holds, the compression root mapped through its local owner
func NewAgent ¶
func NewAgent() any
Agent serving ACP, the projection of the profile gateway that never owns a session itself
func ReadCatalogRows ¶
func ReadCatalogRows(ctx context.Context, path string) (map[string]*jsonutil.Object, []string, error)
ACP session rows of a state database keyed by id, empty when the database is absent
func ReadLocalOwners ¶
Local creation receipt owners of a state database, empty when it is absent
func SessionProvenanceMeta ¶
func SessionProvenanceMeta(ctx context.Context, db SessionGetter, acpSessionID, currentID, previousID string) *jsonutil.Object
Meta payload wrapping the provenance under icebath.sessionProvenance, nil when unreadable
Types ¶
type AssistantMessageIDAllocator ¶
type AssistantMessageIDAllocator struct {
// contains filtered or unexported fields
}
Stable uuid per streamed assistant message, a new id after each close
func (*AssistantMessageIDAllocator) Close ¶
func (a *AssistantMessageIDAllocator) Close()
Ends the active message so the next chunk starts a new id
func (*AssistantMessageIDAllocator) Current ¶
func (a *AssistantMessageIDAllocator) Current() string
Active message id, allocating one when none is open
func (*AssistantMessageIDAllocator) Last ¶
func (a *AssistantMessageIDAllocator) Last() string
Most recently allocated id, empty before the first
type Client ¶
type Client interface {
SessionUpdater
RequestPermission(ctx context.Context, options []acputil.PermissionOption, sessionID string, toolCall *acputil.ToolCallUpdate, meta *jsonutil.Object) (*acputil.RequestPermissionResponse, error)
}
Client side calls the agent makes over its connection
type CommandRefused ¶
type CommandRefused struct{ Msg string }
Refusal the editor shows as the command's reply while the prompt itself ends normally
func (*CommandRefused) As ¶
func (e *CommandRefused) As(target any) bool
Lets a refusal match a gateway client error target like the Python subclass
func (*CommandRefused) Error ¶
func (e *CommandRefused) Error() string
type GatewayACPAgent ¶
type GatewayACPAgent struct {
// contains filtered or unexported fields
}
ACP projection of the profile gateway, it never constructs an execution owner
func NewGatewayACPAgent ¶
func NewGatewayACPAgent() *GatewayACPAgent
Gateway projection attached to the profile the launch home's gateway serves
func (*GatewayACPAgent) Authenticate ¶
func (a *GatewayACPAgent) Authenticate(ctx context.Context, req *acputil.AuthenticateRequest) (*acputil.AuthenticateResponse, error)
Answers authenticate for the detected provider or the terminal setup method
func (*GatewayACPAgent) Cancel ¶
func (a *GatewayACPAgent) Cancel(ctx context.Context, req *acputil.CancelNotification) error
Cancels the editor's prompt on a session, a submit still in flight cancelled once it is acked
func (*GatewayACPAgent) Close ¶
func (a *GatewayACPAgent) Close()
Cancels the background notices and open cards, then drops the owner connection
func (*GatewayACPAgent) ForkSession ¶
func (a *GatewayACPAgent) ForkSession(ctx context.Context, req *acputil.ForkSessionRequest) (*acputil.ForkSessionResponse, error)
Forks a session through the owner's branch mutation and attaches the child
func (*GatewayACPAgent) Initialize ¶
func (a *GatewayACPAgent) Initialize(ctx context.Context, req *acputil.InitializeRequest) (*acputil.InitializeResponse, error)
Answers initialize with the protocol version, agent info, capabilities and auth methods
func (*GatewayACPAgent) ListSessions ¶
func (a *GatewayACPAgent) ListSessions(ctx context.Context, req *acputil.ListSessionsRequest) (*acputil.ListSessionsResponse, error)
Lists the profile's ACP sessions after the cursor, fifty per page
func (*GatewayACPAgent) LoadSession ¶
func (a *GatewayACPAgent) LoadSession(ctx context.Context, req *acputil.LoadSessionRequest) (*acputil.LoadSessionResponse, error)
Loads a session, replaying its transcript
func (*GatewayACPAgent) NewSession ¶
func (a *GatewayACPAgent) NewSession(ctx context.Context, req *acputil.NewSessionRequest) (*acputil.NewSessionResponse, error)
Creates an owner session for the editor with its MCP servers and launch flags frozen into its policy
func (*GatewayACPAgent) OnConnect ¶
func (a *GatewayACPAgent) OnConnect(conn *acputil.AgentSideConnection)
Stores the editor connection and observes its raw initialize message
func (*GatewayACPAgent) Prompt ¶
func (a *GatewayACPAgent) Prompt(ctx context.Context, req *acputil.PromptRequest) (*acputil.PromptResponse, error)
Submits the editor's prompt to the owner and waits for its turn to settle
func (*GatewayACPAgent) ResumeSession ¶
func (a *GatewayACPAgent) ResumeSession(ctx context.Context, req *acputil.ResumeSessionRequest) (*acputil.ResumeSessionResponse, error)
Resumes a session, replaying its transcript
func (*GatewayACPAgent) SetConfigOption ¶
func (a *GatewayACPAgent) SetConfigOption(ctx context.Context, req *acputil.SetConfigOptionParams) (*acputil.SetSessionConfigOptionResponse, error)
Applies one of the advertised pickers and answers the full option list read back from the owner
func (*GatewayACPAgent) SetSessionMode ¶
func (a *GatewayACPAgent) SetSessionMode(ctx context.Context, req *acputil.SetSessionModeRequest) (*acputil.SetSessionModeResponse, error)
Sets the session's edit approval policy on the owner from the editor's mode
func (*GatewayACPAgent) SetSessionModel ¶
func (a *GatewayACPAgent) SetSessionModel(ctx context.Context, req *acputil.SetSessionModelRequest) (*acputil.SetSessionModelResponse, error)
Picks the session's model through the owner's model mutation
type MutationConfirm ¶
Asks the editor to confirm a guarded mutation the owner refused
type MutationDerive ¶
Payload of a mutation derived from the snapshot its fence is read from, nil for nothing to do
type MutationRPC ¶
type MutationRPC = func(ctx context.Context, method string, params map[string]any, timeout time.Duration) (map[string]any, error)
One owner request answered as a plain map within a budget, zero the default
type PreparedMutations ¶
type PreparedMutations interface {
Apply(ctx context.Context, rpc MutationRPC, sessionID, operation string, payload any, confirm MutationConfirm) (map[string]any, error)
Acknowledge(sessionID, operation string, payload any)
Retire(sessionID string)
}
Prepared owner mutations retaining their identity across ambiguous replies
type ReasoningCallbackSetter ¶
type ReasoningCallbackSetter interface {
SetReasoningCallback(cb any)
}
Agent seam that takes the callback fed with reasoning text during a prompt
type RequestPermissionFunc ¶
type RequestPermissionFunc func(ctx context.Context, sessionID string, toolCall *acputil.ToolCallProgress, options []acputil.PermissionOption) (*acputil.RequestPermissionResponse, error)
Client permission request the ACP connection sends
type RichSessionLister ¶
type RichSessionLister interface {
ListSessionsRich(ctx context.Context, o state.ListSessionsRichOptions) ([]*jsonutil.Object, error)
}
Rich session rows the gateway session store reader lists
type SessionGetter ¶
type SessionGetter interface {
GetSession(ctx context.Context, sessionID string) (*jsonutil.Object, error)
}
Session row reader the provenance walk needs
type SessionUpdater ¶
type SessionUpdater interface {
SessionUpdate(ctx context.Context, sessionID string, update acputil.SessionUpdate, meta *jsonutil.Object) error
}
Client side of the connection that receives session updates
type StagedAttachment ¶
Staged image attachment of a prompt, its cache path and sniffed type
Source Files
¶
- auth.go
- catalog.go
- cmd_acp.go
- commands.go
- content.go
- edit_approval.go
- elicitation.go
- entry.go
- entry_args.go
- events.go
- gateway_commands.go
- gateway_loop.go
- gateway_media.go
- gateway_reply.go
- gateway_server.go
- gateway_session_meta.go
- hooks.go
- log.go
- model_catalog.go
- modes.go
- permissions.go
- provenance.go
- server.go
- session_helpers.go
- tools.go
- wiring.go