bridge

package
v0.3.34-beta Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bridge provides the bridge between kodelet's message handler system and the ACP session update protocol.

Package bridge provides the bridge between kodelet's message handler system and the ACP session update protocol.

Index

Constants

View Source
const (
	ToolCallContentTypeContent = "content"
	ToolCallContentTypeDiff    = "diff"
)

ToolCallContentType constants for tool call content

Variables

This section is empty.

Functions

func ContentBlocksToMessage

func ContentBlocksToMessage(blocks []acptypes.ContentBlock) (string, []string)

ContentBlocksToMessage converts ACP content blocks to a message string and image paths

func ToACPToolKind

func ToACPToolKind(toolName string) acptypes.ToolKind

ToACPToolKind maps kodelet tool names to ACP tool kinds

Types

type ACPMessageHandler

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

ACPMessageHandler bridges kodelet's MessageHandler to ACP session updates

func NewACPMessageHandler

func NewACPMessageHandler(sender UpdateSender, sessionID acptypes.SessionID, opts ...HandlerOption) *ACPMessageHandler

NewACPMessageHandler creates a new ACP message handler

func (*ACPMessageHandler) HandleContentBlockEnd

func (h *ACPMessageHandler) HandleContentBlockEnd()

HandleContentBlockEnd is called when a content block ends

func (*ACPMessageHandler) HandleDone

func (h *ACPMessageHandler) HandleDone()

HandleDone is called when message processing is complete

func (*ACPMessageHandler) HandleText

func (h *ACPMessageHandler) HandleText(text string)

HandleText sends complete text as agent_message_chunk

func (*ACPMessageHandler) HandleTextDelta

func (h *ACPMessageHandler) HandleTextDelta(delta string)

HandleTextDelta sends streaming text deltas

func (*ACPMessageHandler) HandleThinking

func (h *ACPMessageHandler) HandleThinking(thinking string)

HandleThinking sends agent_thought_chunk

func (*ACPMessageHandler) HandleThinkingBlockEnd

func (h *ACPMessageHandler) HandleThinkingBlockEnd()

HandleThinkingBlockEnd is called when a thinking block ends

func (*ACPMessageHandler) HandleThinkingDelta

func (h *ACPMessageHandler) HandleThinkingDelta(delta string)

HandleThinkingDelta sends streaming thinking chunks

func (*ACPMessageHandler) HandleThinkingStart

func (h *ACPMessageHandler) HandleThinkingStart()

HandleThinkingStart is called when thinking starts

func (*ACPMessageHandler) HandleToolResult

func (h *ACPMessageHandler) HandleToolResult(toolCallID string, _ string, result tooltypes.ToolResult)

HandleToolResult sends tool_call_update with rich, tool-specific content This method generates tailored ACP content based on the tool type: - bash: Command and output as text content - file_read: Resource content with file URI and mime type - file_write: Diff with null oldText (new file) - file_edit: Diff with oldText and newText - subagent: Question and response as text content - todo_read/todo_write: Also sends plan update via session/update

func (*ACPMessageHandler) HandleToolUse

func (h *ACPMessageHandler) HandleToolUse(toolCallID string, toolName string, input string)

HandleToolUse creates a new tool_call update

type DefaultTitleGenerator

type DefaultTitleGenerator struct{}

DefaultTitleGenerator generates titles using deterministic string formatting

func (*DefaultTitleGenerator) GenerateTitle

func (g *DefaultTitleGenerator) GenerateTitle(toolName string, input string) string

GenerateTitle generates a human-readable title for a tool call

type HandlerOption

type HandlerOption func(*ACPMessageHandler)

HandlerOption is a functional option for configuring ACPMessageHandler

func WithTitleGenerator

func WithTitleGenerator(tg TitleGenerator) HandlerOption

WithTitleGenerator sets a custom title generator

type TitleGenerator

type TitleGenerator interface {
	GenerateTitle(toolName string, input string) string
}

TitleGenerator generates human-readable titles for tool calls

type ToolCallLocation

type ToolCallLocation struct {
	Path string `json:"path"`
	Line int    `json:"line,omitempty"`
}

ToolCallLocation represents a file location for the "follow the agent" feature

type ToolContentGenerator

type ToolContentGenerator struct{}

ToolContentGenerator generates ACP-specific content for tool results

func (*ToolContentGenerator) GenerateToolContent

func (g *ToolContentGenerator) GenerateToolContent(result tooltypes.ToolResult) []map[string]any

GenerateToolContent converts a ToolResult into ACP-formatted content array

type UpdateSender

type UpdateSender interface {
	SendUpdate(sessionID acptypes.SessionID, update any) error
}

UpdateSender interface for sending session updates

Jump to

Keyboard shortcuts

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