Documentation
¶
Overview ¶
Package kiro contains shared identifiers and helpers used by the Kiro providers.
Index ¶
- Constants
- func BuildToolUsesJSON(filePath, fileOp string) sql.NullString
- func CountExecutionEntries(h *SessionHistory) int
- func DecodeProjectPathFromSessionDir(dirName string) string
- func EncodeWorkspacePath(absPath string) string
- func KiroGlobalStorageDir() (string, error)
- func NewExecutionIDs(h *SessionHistory, offset int) []string
- func ResolveLatestSession(workspacePath string) (sessionID, historyPath string, err error)
- func ResolveLatestSessionIn(sessDir string) (sessionID, historyPath string, err error)
- func WorkspaceKey(prefix, absPath string) string
- func WorkspaceSessionDir(absWorkspacePath string) (string, error)
- type AppendInput
- type CreateInput
- type ExecutionAction
- type ExecutionIndex
- type ExecutionMeta
- type ExecutionTrace
- type FileOperation
- type HistoryEntry
- type HistoryMessage
- type PromptLog
- type RelocateInput
- type SessionHistory
- type SessionIndex
Constants ¶
const ( // ProviderNameIDE is the provider identifier for the Kiro IDE hook provider. ProviderNameIDE = "kiro-ide" // ProviderNameCLI is the provider identifier for the Kiro CLI hook provider. ProviderNameCLI = "kiro-cli" // ToolNameFileEdit marks file-modifying Kiro actions for attribution. ToolNameFileEdit = "kiro_file_edit" )
Variables ¶
This section is empty.
Functions ¶
func BuildToolUsesJSON ¶
func BuildToolUsesJSON(filePath, fileOp string) sql.NullString
BuildToolUsesJSON returns a serialized tool_uses payload for a file operation.
func CountExecutionEntries ¶
func CountExecutionEntries(h *SessionHistory) int
CountExecutionEntries returns the number of history entries with an execution ID.
func DecodeProjectPathFromSessionDir ¶
DecodeProjectPathFromSessionDir reverses the workspace directory encoding used under Kiro's session store.
func EncodeWorkspacePath ¶
EncodeWorkspacePath encodes an absolute workspace path to match the workspace session directory naming used by Kiro.
func KiroGlobalStorageDir ¶
KiroGlobalStorageDir returns the Kiro agent globalStorage directory for the current OS.
func NewExecutionIDs ¶
func NewExecutionIDs(h *SessionHistory, offset int) []string
NewExecutionIDs returns execution IDs beyond the given execution-entry offset.
func ResolveLatestSession ¶
ResolveLatestSession finds the most recent session for a workspace. Returns the session ID and path to the session history JSON file.
func ResolveLatestSessionIn ¶
ResolveLatestSessionIn finds the most recent session within a workspace session directory.
func WorkspaceKey ¶
WorkspaceKey derives a deterministic capture-state key from a workspace path and provider prefix.
func WorkspaceSessionDir ¶
WorkspaceSessionDir returns the path to the Kiro workspace session directory for the given workspace path.
Types ¶
type AppendInput ¶
type AppendInput struct {
File string `json:"file"`
ModifiedContent string `json:"modifiedContent"`
OriginalContent string `json:"originalContent"`
}
AppendInput is the parsed input for an "append" action.
type CreateInput ¶
type CreateInput struct {
File string `json:"file"`
ModifiedContent string `json:"modifiedContent"`
OriginalContent string `json:"originalContent"`
}
CreateInput is the parsed input for a "create" action.
type ExecutionAction ¶
type ExecutionAction struct {
Type string `json:"type"`
ExecutionID string `json:"executionId"`
ActionID string `json:"actionId"`
ActionType string `json:"actionType"`
ActionState string `json:"actionState"`
Input json.RawMessage `json:"input,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
ChatSessionID string `json:"chatSessionId"`
EmittedAt int64 `json:"emittedAt"`
}
ExecutionAction is a single action within an execution trace.
type ExecutionIndex ¶
type ExecutionIndex struct {
Executions []ExecutionMeta `json:"executions"`
Version string `json:"version"`
}
ExecutionIndex is the top-level execution metadata file.
type ExecutionMeta ¶
type ExecutionMeta struct {
ExecutionID string `json:"executionId"`
Type string `json:"type"`
Status string `json:"status"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
}
ExecutionMeta is a single execution entry in the index.
type ExecutionTrace ¶
type ExecutionTrace struct {
ExecutionID string `json:"executionId"`
WorkflowType string `json:"workflowType"`
Status string `json:"status"`
StartTime int64 `json:"startTime"`
ChatSessionID string `json:"chatSessionId"`
Actions []ExecutionAction `json:"actions"`
}
ExecutionTrace is a full execution trace file.
func ParseExecutionTrace ¶
func ParseExecutionTrace(path string) (*ExecutionTrace, error)
ParseExecutionTrace reads and parses an execution trace JSON file.
type FileOperation ¶
type FileOperation struct {
ActionType string // "create", "append", "smartRelocate"
FilePath string // relative path within the workspace
Content string // the content the agent wrote (empty for relocate)
SourcePath string // for relocate: original path
DestPath string // for relocate: new path
EmittedAt int64 // unix ms timestamp of the action
}
FileOperation represents a single file change extracted from an execution trace.
func ExtractFileOps ¶
func ExtractFileOps(trace *ExecutionTrace) []FileOperation
ExtractFileOps parses an execution trace and returns all file operations.
type HistoryEntry ¶
type HistoryEntry struct {
Message HistoryMessage `json:"message"`
ExecutionID string `json:"executionId,omitempty"`
PromptLogs []PromptLog `json:"promptLogs,omitempty"`
}
HistoryEntry is a single message in the session history.
type HistoryMessage ¶
type HistoryMessage struct {
Role string `json:"role"`
Content json.RawMessage `json:"content"` // string or []ContentBlock
ID string `json:"id"`
}
HistoryMessage is the role+content of a single message.
type RelocateInput ¶
type RelocateInput struct {
SourcePath string `json:"sourcePath"`
DestinationPath string `json:"destinationPath"`
}
RelocateInput is the parsed input for a "smartRelocate" action.
type SessionHistory ¶
type SessionHistory struct {
History []HistoryEntry `json:"history"`
SessionID string `json:"sessionId"`
WorkspaceDirectory string `json:"workspaceDirectory"`
}
SessionHistory is the full session JSON file (<sessionId>.json).
func ParseSessionHistory ¶
func ParseSessionHistory(path string) (*SessionHistory, error)
ParseSessionHistory reads a session history file (<sessionId>.json).
type SessionIndex ¶
type SessionIndex struct {
SessionID string `json:"sessionId"`
Title string `json:"title"`
DateCreated string `json:"dateCreated"`
WorkspaceDirectory string `json:"workspaceDirectory"`
}
SessionIndex is the top-level sessions.json structure.
func ParseSessionIndex ¶
func ParseSessionIndex(path string) ([]SessionIndex, error)
ParseSessionIndex reads sessions.json and returns all session entries.