Documentation
¶
Index ¶
- Constants
- func AppendSkillLoad(ctx context.Context, s agentkit.Session, agentID agentkit.AgentID, ...) (string, error)
- func DeriveMessages(ctx context.Context, events []agentkit.SessionEvent, maxToolBytes int) []agentkit.ModelMessage
- func HydrateLocalAttachments(ctx context.Context, msgs []agentkit.ModelMessage, ws workspace.Service, ...) ([]agentkit.ModelMessage, error)
- func InterruptedToolResult(call agentkit.ToolCall) agentkit.ToolResult
- func LatestSeq(ctx context.Context, s agentkit.Session) (agentkit.EventSeq, error)
- func PrepareMessagesForLLM(ctx context.Context, msgs []agentkit.ModelMessage, ws workspace.Service, ...) ([]agentkit.ModelMessage, error)
- func PrepareToolResultForStorage(ctx context.Context, sessionID agentkit.SessionID, result agentkit.ToolResult, ...) (agentkit.ToolResult, error)
- func PruneToolResults(messages []agentkit.ModelMessage, maxBytes int) []agentkit.ModelMessage
- func ReadAllEvents(ctx context.Context, s agentkit.Session) ([]agentkit.SessionEvent, error)
- func RenderSkillLoaded(content skill.Content) string
- func SanitizeModelMessageForStorage(msg agentkit.ModelMessage, maxTextBytes int) agentkit.ModelMessage
- func SanitizeModelMessageForStorageWS(msg agentkit.ModelMessage, maxTextBytes int, ws workspace.Service) agentkit.ModelMessage
- func SanitizeToolCall(call agentkit.ToolCall) agentkit.ToolCall
- func SpillPathAbs(ctx context.Context, ws cw.Service, rel string) (string, error)
- func ToolResultMessage(result agentkit.ToolResult) agentkit.ModelMessage
- func TruncateToolResult(result agentkit.ToolResult, maxBytes int) agentkit.ToolResult
- type IndexedMessage
Constants ¶
const AuditSpillPath = "spill_path"
AuditSpillPath records the workspace-relative spill file for a truncated tool result.
const DefaultMaxStoredTextBytes = 8192
DefaultMaxStoredTextBytes caps embedded tool-result text and spill preview views (pi-style truncation applies at tool execution / PrepareToolResultForStorage, not chat message bodies).
const InterruptedToolResultText = "tool execution was interrupted before it produced a result (process exited); re-run it if the result is still needed"
InterruptedToolResultText is the tool result synthesized for a call the process never got to answer. It is model-visible on purpose: the agent needs to know the call was cut off rather than silently succeeded.
Variables ¶
This section is empty.
Functions ¶
func AppendSkillLoad ¶
func DeriveMessages ¶
func DeriveMessages(ctx context.Context, events []agentkit.SessionEvent, maxToolBytes int) []agentkit.ModelMessage
func HydrateLocalAttachments ¶
func HydrateLocalAttachments(ctx context.Context, msgs []agentkit.ModelMessage, ws workspace.Service, maxImageBytes int) ([]agentkit.ModelMessage, error)
HydrateLocalAttachments reloads workspace images for LLM vision (text + image modalities).
func InterruptedToolResult ¶
func InterruptedToolResult(call agentkit.ToolCall) agentkit.ToolResult
InterruptedToolResult is the stand-in result for a call that never ran to completion.
func PrepareMessagesForLLM ¶
func PrepareMessagesForLLM(ctx context.Context, msgs []agentkit.ModelMessage, ws workspace.Service, maxImageBytes int, modalities []string) ([]agentkit.ModelMessage, error)
PrepareMessagesForLLM applies modality policy and optional vision hydration before an LLM call.
func PrepareToolResultForStorage ¶
func PrepareToolResultForStorage(ctx context.Context, sessionID agentkit.SessionID, result agentkit.ToolResult, maxViewBytes int) (agentkit.ToolResult, error)
PrepareToolResultForStorage keeps the model-visible body bounded while persisting the full output to workspace (pi-style spill). When workspace is unavailable, falls back to in-event truncation only.
func PruneToolResults ¶
func PruneToolResults(messages []agentkit.ModelMessage, maxBytes int) []agentkit.ModelMessage
PruneToolResults truncates oversized tool result text deterministically.
func ReadAllEvents ¶
func RenderSkillLoaded ¶ added in v0.3.33
RenderSkillLoaded formats a loaded skill for the model, including resource-base guidance.
func SanitizeModelMessageForStorage ¶
func SanitizeModelMessageForStorage(msg agentkit.ModelMessage, maxTextBytes int) agentkit.ModelMessage
SanitizeModelMessageForStorage strips bulky inline media before durable session history. User and assistant message text is persisted in full (aligned with pi session JSONL). When maxTextBytes > 0, only tests or explicit callers may cap message body text.
func SanitizeModelMessageForStorageWS ¶
func SanitizeModelMessageForStorageWS(msg agentkit.ModelMessage, maxTextBytes int, ws workspace.Service) agentkit.ModelMessage
SanitizeModelMessageForStorageWS is like SanitizeModelMessageForStorage but normalizes attachment Source paths relative to work dir (no local:/global:/work/ prefixes) when ws implements layout.
func SanitizeToolCall ¶
SanitizeToolCall prepares a tool call for durable session storage.
func SpillPathAbs ¶
SpillPathAbs resolves a stored spill_path audit entry to an absolute path.
func ToolResultMessage ¶
func ToolResultMessage(result agentkit.ToolResult) agentkit.ModelMessage
ToolResultMessage wraps a tool result as a tool-role model message.
func TruncateToolResult ¶
func TruncateToolResult(result agentkit.ToolResult, maxBytes int) agentkit.ToolResult
TruncateToolResult truncates oversized tool result content after execution.
Types ¶
type IndexedMessage ¶
type IndexedMessage = compaction.IndexedMessage
IndexedMessage is a model-visible message with its primary source event seq.
func IndexMessagesForCompaction ¶
func IndexMessagesForCompaction(events []agentkit.SessionEvent, agentID agentkit.AgentID) []IndexedMessage
IndexMessagesForCompaction rebuilds the model-visible list used for compaction, including the latest compaction summary and retained tail when present.