Documentation
¶
Overview ¶
Package shellcontext identifies user-requested shell executions that should be preserved as conversational context. It is a dependency-free leaf so the TUI, remote transports, and turn runner share one wire representation.
Index ¶
- Constants
- func ContextText(record Record) string
- func DisplayText(record Record) string
- func IsCommitAck(message protocol.ChatMessage) bool
- func IsContextOnly(message protocol.ChatMessage) bool
- func MarkCommitAck(message *protocol.ChatMessage)
- func Put(message *protocol.ChatMessage, record Record) error
- type Record
Constants ¶
const ( // MetaKey carries the structured shell execution alongside its text form. MetaKey = "sahara.shell_context" // CommitAckMetaKey marks the empty final emitted after a context-only save. CommitAckMetaKey = "sahara.shell_context_committed" )
Variables ¶
This section is empty.
Functions ¶
func ContextText ¶
ContextText is the exact user-role text exposed to the model. The explicit envelope prevents command output from masquerading as user instructions.
func DisplayText ¶
DisplayText is the compact transcript form shown by the TUI.
func IsCommitAck ¶
func IsCommitAck(message protocol.ChatMessage) bool
IsCommitAck reports whether a final only acknowledges a context save.
func IsContextOnly ¶
func IsContextOnly(message protocol.ChatMessage) bool
IsContextOnly reports whether the message should be persisted without an LLM call. This is intentionally based on structured metadata, never prompt text.
func MarkCommitAck ¶
func MarkCommitAck(message *protocol.ChatMessage)
MarkCommitAck marks a transport final as acknowledgement-only.
Types ¶
type Record ¶
type Record struct {
Command string `json:"command"`
CWD string `json:"cwd"`
Output string `json:"output,omitempty"`
ExitCode int `json:"exit_code"`
Error string `json:"error,omitempty"`
OutputBytes int `json:"output_bytes,omitempty"`
OutputTruncated bool `json:"output_truncated,omitempty"`
TriggerAgent bool `json:"trigger_agent"`
}
Record is the durable, provider-neutral description of one explicit shell execution. TriggerAgent is meaningful for idle sends; steering always enters an already-running turn.
func FromMessage ¶
func FromMessage(message protocol.ChatMessage) (Record, bool)
FromMessage returns the structured shell record when present and valid.