# internal/app/packetrepair

Package packetrepair writes operator-facing provider packet repair artifacts.

## ErrIdentityMismatch

```go
var (
	ErrIdentityMismatch      = errors.New("provider packet repair artifact identity mismatch")
	ErrMissingRepairedPacket = errors.New("provider packet repair artifact is missing repaired_packet")
)
```

## ErrMissingRepairedPacket

```go
var (
	ErrIdentityMismatch      = errors.New("provider packet repair artifact identity mismatch")
	ErrMissingRepairedPacket = errors.New("provider packet repair artifact is missing repaired_packet")
)
```

## Blockers

```go
func Blockers(action gate.RepairAction) []string
```

## Decode

```go
func Decode(data []byte) (Artifact, error)
```

## Encode

```go
func Encode(artifact Artifact) ([]byte, error)
```

## FollowUp

```go
func FollowUp(action gate.RepairAction) string
```

## HardenAction

```go
func HardenAction(taskID string, artifactPath string) gate.RepairAction
```

## Load

```go
func Load(path string, identity Identity) ([]byte, error)
```

## LooksLikeArtifactPath

```go
func LooksLikeArtifactPath(gateName string, path string) bool
```

## ReviewAction

```go
func ReviewAction(taskID string, artifactPath string) gate.RepairAction
```

## RootFromSpecPath

```go
func RootFromSpecPath(path string) string
```

## SourceFromError

```go
func SourceFromError(err error) (providerpacket.Source, bool)
```

## WriteArtifact

```go
func WriteArtifact(input ArtifactInput) (string, bool)
```

## Artifact

```go
type Artifact struct {
	TaskID         string          `json:"task_id"`
	Gate           string          `json:"gate"`
	AttemptID      string          `json:"attempt_id,omitempty"`
	RoundID        string          `json:"round_id,omitempty"`
	Error          string          `json:"error,omitempty"`
	RejectedText   string          `json:"rejected_text,omitempty"`
	DiagnosticPath string          `json:"diagnostic_path,omitempty"`
	AcceptCommand  string          `json:"accept_command"`
	RepairedPacket json.RawMessage `json:"repaired_packet"`
}
```

- `TaskID: string` (json:"task_id"): 
- `Gate: string` (json:"gate"): 
- `AttemptID: string` (json:"attempt_id,omitempty"): 
- `RoundID: string` (json:"round_id,omitempty"): 
- `Error: string` (json:"error,omitempty"): 
- `RejectedText: string` (json:"rejected_text,omitempty"): 
- `DiagnosticPath: string` (json:"diagnostic_path,omitempty"): 
- `AcceptCommand: string` (json:"accept_command"): 
- `RepairedPacket: json.RawMessage` (json:"repaired_packet"): 

## ArtifactInput

```go
type ArtifactInput struct {
	Root, TaskID, Name, Gate, AttemptID, RoundID string
	Source                                       providerpacket.Source
	Err                                          error
	AcceptCommand                                func(path string) string
}
```

- `Root: string`: 
- `TaskID: string`: 
- `Name: string`: 
- `Gate: string`: 
- `AttemptID: string`: 
- `RoundID: string`: 
- `Source: providerpacket.Source`: 
- `Err: error`: 
- `AcceptCommand: func(path string) string`: 

## Identity

```go
type Identity struct {
	TaskID, Gate, AttemptID, RoundID string
}
```

- `TaskID: string`: 
- `Gate: string`: 
- `AttemptID: string`: 
- `RoundID: string`:
