Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192package acp
import sdk "github.com/coder/acp-go-sdk"
type updateKind string
const ( updateUserChunk updateKind = "user_message_chunk" updateAgentChunk updateKind = "agent_message_chunk" updateThoughtChunk updateKind = "agent_thought_chunk" updateToolCall updateKind = "tool_call" updateToolStatus updateKind = "tool_call_update" updateConfigChange updateKind = "config_option_update" updateCommands updateKind = "available_commands_update" updatePlan updateKind = "plan" updateSessionInfo updateKind = "session_info_update" updateUsage updateKind = "usage_update" updateCompaction updateKind = "compaction_update")
func (k updateKind) coalesces() bool { return k == updateAgentChunk || k == updateThoughtChunk}
func textContent(text string) sdk.ContentBlockText { return sdk.ContentBlockText{Type: "text", Text: text}}
type contentChunk struct { Kind updateKind `json:"sessionUpdate"` MessageID string `json:"messageId,omitempty"` Content sdk.ContentBlockText `json:"content"`}
func chunkOf(kind updateKind, messageID, text string) contentChunk { return contentChunk{Kind: kind, MessageID: messageID, Content: textContent(text)}}
type configOptionsUpdate struct { Kind updateKind `json:"sessionUpdate"` Options []option `json:"configOptions"`}
func configChanged(options []option) configOptionsUpdate { return configOptionsUpdate{Kind: updateConfigChange, Options: options}}
const ( currencyUSD = "USD" currencyCredits = "credits")
var evidenceKinds = map[string]sdk.ToolKind{ "edit": sdk.ToolKindEdit, "read": sdk.ToolKindRead, "search": sdk.ToolKindSearch, "run": sdk.ToolKindExecute, "web": sdk.ToolKindFetch,}
func wrappedText(text string) sdk.ToolCallContent { return sdk.ToolContent(sdk.TextBlock(text))}
type diffBlock struct { Type string `json:"type"` Path string `json:"path"` OldText *string `json:"oldText"` NewText string `json:"newText"`}
type toolCall struct { Kind updateKind `json:"sessionUpdate"` ID string `json:"toolCallId"` Title string `json:"title,omitempty"` Name string `json:"name,omitempty"` ToolKind sdk.ToolKind `json:"kind,omitempty"` Status sdk.ToolCallStatus `json:"status,omitempty"` RawInput any `json:"rawInput,omitempty"` RawOutput any `json:"rawOutput,omitempty"` Content []any `json:"content,omitempty"` Locations []sdk.ToolCallLocation `json:"locations,omitempty"`}
func announcedTool(id, title, name string) toolCall { return toolCall{Kind: updateToolCall, ID: id, Title: title, Name: name, ToolKind: sdk.ToolKindOther, Status: sdk.ToolCallStatusInProgress}}
func progressedTool(id string) toolCall { return toolCall{Kind: updateToolStatus, ID: id, Status: sdk.ToolCallStatusInProgress}}