attachments

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package attachments implements the v1 attachment manifest contract (Epic 68, design decisions D7/D8/D15): prompt text carrying file references the agent reads with its own tools.

Manifest format v1 — one line per file, appended after the user text separated by exactly one blank line, each line:

[llmsafespaces:attachment path="<path>" name="<name>"]

The format is a stable API contract locked by the golden fixtures in testdata/ (authoritative). Changes are additive-only; any format change requires a new version marker while this parser keeps supporting v1. Attribute values backslash-escape quotes (") and backslashes (\), and control characters are stripped from names, so a value can never break line structure. Compose is idempotent (D15): any pre-existing trailing v1 block is stripped before the new block is appended, so compose(compose(t, f), f) == compose(t, f). Parse consumes only the trailing block and treats unknown-version or unknown-attribute lines as plain text (forward compatibility). v1 carries path and name only: send-time validation is shape-only (D8 — the server cannot stat workspace files), so the bytes field sketched in the epic design doc is superseded and intentionally absent.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyFiles  = errors.New("too many files")
	ErrDuplicatePath = errors.New("duplicate file path")
	ErrInvalidPath   = errors.New("invalid attachment path")
)

Functions

func Compose

func Compose(text string, files []string) (string, error)

func ValidatePaths

func ValidatePaths(files []string) error

Types

type Attachment

type Attachment struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

func Parse

func Parse(text string) ([]Attachment, string)

Jump to

Keyboard shortcuts

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