| 1 | package provider |
| 2 | |
| 3 | // PresentedFile identifies a user-facing file deliverable. It deliberately |
| 4 | // stores no file bytes or authorization token; hosts revalidate it on access. |
| 5 | type PresentedFile struct { |
| 6 | Path string `json:"path"` |
| 7 | Description string `json:"description,omitempty"` |
| 8 | } |
| 9 | |
| 10 | const PresentedFilesMetadataVersion = 1 |
| 11 | |
| 12 | // PresentedFilesMetadata is the durable, host-only envelope for explicit file |
| 13 | // deliverables. Versioning the optional record lets future readers fail closed |
| 14 | // or migrate without changing the provider-visible tool result text. |
| 15 | type PresentedFilesMetadata struct { |
| 16 | Version int `json:"version"` |
| 17 | Files []PresentedFile `json:"files"` |
| 18 | } |
| 19 | |
| 20 | func NewPresentedFilesMetadata(files []PresentedFile) *PresentedFilesMetadata { |
| 21 | if len(files) == 0 { |
| 22 | return nil |
| 23 | } |
| 24 | return &PresentedFilesMetadata{ |
| 25 | Version: PresentedFilesMetadataVersion, |
| 26 | Files: append([]PresentedFile(nil), files...), |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func PresentedFileList(metadata *PresentedFilesMetadata) []PresentedFile { |
| 31 | if metadata == nil || metadata.Version != PresentedFilesMetadataVersion { |
| 32 | return nil |
| 33 | } |
| 34 | return append([]PresentedFile(nil), metadata.Files...) |
| 35 | } |
| 36 |