Documentation
¶
Overview ¶
Package channelwrap provides helpers for channel-wrapped prompt injection used by non-Claude backends. The claude-channel sidecar delivers via MCP notifications natively; this helper is for backends that must inject channel messages as text prompts.
Index ¶
- func AgentName(role string) string
- func BuildMeta(fromRunID, fromRole string) map[string]string
- func ChannelWrap(content, source string, meta map[string]string) string
- func FormatSource(source string) string
- func MustChannelWrap(content, source string, meta map[string]string) string
- func UntrustedInstruction() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentName ¶
AgentName formats a role string for use as the channel source attribute. It prefixes the role with "agent-" to produce values like "agent-reviewer".
func ChannelWrap ¶
ChannelWrap wraps content in a <channel> XML tag with source metadata and appends the untrusted-content instruction. This tells the model that the message came from an external agent, not its user.
source: e.g. "agent-reviewer" meta: key-value attributes for the channel tag (from_run_id, from_role, etc.)
func FormatSource ¶
FormatSource returns the source string that ChannelWrap uses in the XML tag. It is exported so tests can assert on the exact source value.
func MustChannelWrap ¶
MustChannelWrap is like ChannelWrap but panics on invalid input. Useful in tests and initialisation.
func UntrustedInstruction ¶
func UntrustedInstruction() string
UntrustedInstruction returns the canonical untrusted-content instruction text. Exported for tests that verify its presence.
Types ¶
This section is empty.