kiro

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package kiro provides an adapter for Kiro CLI (kiro-cli from AWS) that queries its SQLite database for conversation history filtered by working directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWatcher

func NewWatcher(dbPath string) (<-chan adapter.Event, io.Closer, error)

NewWatcher creates a watcher for Kiro SQLite changes. Watches the WAL file for modifications since Kiro uses WAL mode.

Types

type Adapter

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

Adapter implements the adapter.Adapter interface for Kiro CLI sessions.

func New

func New() *Adapter

New creates a new Kiro adapter.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() adapter.CapabilitySet

Capabilities returns the supported features.

func (*Adapter) Close

func (a *Adapter) Close() error

Close closes the persistent database connection.

func (*Adapter) Detect

func (a *Adapter) Detect(projectRoot string) (bool, error)

Detect checks if Kiro CLI sessions exist for the given project.

func (*Adapter) ID

func (a *Adapter) ID() string

ID returns the adapter identifier.

func (*Adapter) Icon

func (a *Adapter) Icon() string

Icon returns the adapter icon for badge display.

func (*Adapter) Messages

func (a *Adapter) Messages(sessionID string) ([]adapter.Message, error)

Messages returns all messages for the given session.

func (*Adapter) Name

func (a *Adapter) Name() string

Name returns the human-readable adapter name.

func (*Adapter) SearchMessages

func (a *Adapter) SearchMessages(sessionID, query string, opts adapter.SearchOptions) ([]adapter.MessageMatch, error)

SearchMessages searches message content within a session. Implements adapter.MessageSearcher interface.

func (*Adapter) Sessions

func (a *Adapter) Sessions(projectRoot string) ([]adapter.Session, error)

Sessions returns all sessions for the given project, sorted by update time.

func (*Adapter) Usage

func (a *Adapter) Usage(sessionID string) (*adapter.UsageStats, error)

Usage returns aggregate usage stats for the given session.

func (*Adapter) Watch

func (a *Adapter) Watch(projectRoot string) (<-chan adapter.Event, io.Closer, error)

Watch returns a channel that emits events when session data changes.

func (*Adapter) WatchScope

func (a *Adapter) WatchScope() adapter.WatchScope

WatchScope returns Global because kiro watches a global database file.

type AssistantResponse

type AssistantResponse struct {
	Response *ResponseData `json:"Response"`
}

AssistantResponse is the assistant content when it's a Response.

type AssistantToolUse

type AssistantToolUse struct {
	ToolUse *ToolUseData `json:"ToolUse"`
}

AssistantToolUse is the assistant content when it's a ToolUse.

type ContextManager

type ContextManager struct {
	Paths []string `json:"paths"`
}

ContextManager holds context paths.

type ConversationRow

type ConversationRow struct {
	Key            string // project path (e.g., /Users/foo/code/project)
	ConversationID string
	Value          string // JSON blob
	CreatedAt      int64  // Unix timestamp in milliseconds
	UpdatedAt      int64  // Unix timestamp in milliseconds
}

ConversationRow represents a row from the conversations_v2 table.

type ConversationValue

type ConversationValue struct {
	ConversationID string          `json:"conversation_id"`
	History        []HistoryEntry  `json:"history"`
	ModelInfo      *ModelInfo      `json:"model_info"`
	Tools          json.RawMessage `json:"tools"`
	ContextManager *ContextManager `json:"context_manager"`
}

ConversationValue is the parsed JSON value from conversations_v2.

type EnvContext

type EnvContext struct {
	EnvState *EnvState `json:"env_state"`
}

EnvContext holds environment info from the user message.

type EnvState

type EnvState struct {
	OperatingSystem         string `json:"operating_system"`
	CurrentWorkingDirectory string `json:"current_working_directory"`
}

EnvState holds OS and directory info.

type HistoryEntry

type HistoryEntry struct {
	User            *UserMessage     `json:"user"`
	Assistant       json.RawMessage  `json:"assistant"` // Response or ToolUse, discriminated
	RequestMetadata *RequestMetadata `json:"request_metadata"`
}

HistoryEntry is a single turn in the conversation history.

type ModelInfo

type ModelInfo struct {
	ModelName string `json:"model_name"`
	ModelID   string `json:"model_id"`
}

ModelInfo holds model configuration.

type PromptContent

type PromptContent struct {
	Prompt *PromptData `json:"Prompt"`
}

PromptContent is the user content when it's a Prompt.

type PromptData

type PromptData struct {
	Prompt string `json:"prompt"`
}

PromptData contains the actual prompt text.

type RequestMetadata

type RequestMetadata struct {
	ContextUsagePercentage  float64 `json:"context_usage_percentage"`
	RequestStartTimestampMs int64   `json:"request_start_timestamp_ms"`
	StreamEndTimestampMs    int64   `json:"stream_end_timestamp_ms"`
}

RequestMetadata holds timing and context info for a request.

type ResponseData

type ResponseData struct {
	MessageID string `json:"message_id"`
	Content   string `json:"content"`
}

ResponseData contains the response text.

type ToolResultContent

type ToolResultContent struct {
	Json *ToolResultJSON `json:"Json"`
}

ToolResultContent is a content block in a tool result.

type ToolResultJSON

type ToolResultJSON struct {
	ExitStatus string `json:"exit_status"`
	Stdout     string `json:"stdout"`
	Stderr     string `json:"stderr"`
}

ToolResultJSON contains structured tool output.

type ToolUseData

type ToolUseData struct {
	MessageID string         `json:"message_id"`
	Content   string         `json:"content"`
	ToolUses  []ToolUseEntry `json:"tool_uses"`
}

ToolUseData contains the tool use info.

type ToolUseEntry

type ToolUseEntry struct {
	ID   string          `json:"id"`
	Name string          `json:"name"`
	Args json.RawMessage `json:"args"`
}

ToolUseEntry is a single tool invocation.

type ToolUseResult

type ToolUseResult struct {
	ToolUseID string              `json:"tool_use_id"`
	Content   []ToolResultContent `json:"content"`
	Status    string              `json:"status"`
}

ToolUseResult is a single tool result.

type ToolUseResultsContent

type ToolUseResultsContent struct {
	ToolUseResults *ToolUseResultsData `json:"ToolUseResults"`
}

ToolUseResultsContent is the user content when it's ToolUseResults.

type ToolUseResultsData

type ToolUseResultsData struct {
	ToolUseResults []ToolUseResult `json:"tool_use_results"`
}

ToolUseResultsData contains the tool use results.

type UserMessage

type UserMessage struct {
	Content    json.RawMessage `json:"content"`   // Prompt or ToolUseResults, discriminated
	Timestamp  string          `json:"timestamp"` // RFC3339 format
	EnvContext *EnvContext     `json:"env_context"`
}

UserMessage is the user side of a history entry.

Jump to

Keyboard shortcuts

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