channelwrap

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentName

func AgentName(role string) string

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 BuildMeta

func BuildMeta(fromRunID, fromRole string) map[string]string

BuildMeta constructs the metadata map from common agent-message fields.

func ChannelWrap

func ChannelWrap(content, source string, meta map[string]string) string

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

func FormatSource(source string) string

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

func MustChannelWrap(content, source string, meta map[string]string) string

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.

Jump to

Keyboard shortcuts

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