34b8b94223
- Runner-owned findings ledger per run: stages report a # findings section (new items and F<n> status changes); stable IDs, persisted (run_loop_state), in RunDetail.findings, findings.md, memory.md, inspect. - type=findings gate stage routes open/clear on the ledger mechanically. - retry --extra-visits N [--stage KEY] continues an exhausted loop; limits on_exhausted=decide parks the run on accept/continue/abort. - Essential memory cap 20 KB, task never truncated, handoff and open findings ahead of the outcome ledger. - Lint rejects limits.on outcomes on forward edges; warns on ineffective limits and resume_session. - A resumed retry carries the failed visit's output.md and private/ under previous-attempt/. - resume_session=true resumes a Claude stage's previous session on loop visits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
2.2 KiB
Go
63 lines
2.2 KiB
Go
package protocol
|
|
|
|
import "strings"
|
|
|
|
// Artifact presentation groups. A deliverable is a file the stage published to
|
|
// the run's public/ directory (or, for a visit recorded before the turn layout,
|
|
// any file it left). A debug file is one of the runner's own turn files or the
|
|
// visit's private/ scratch: evidence for debugging a stage, not its output.
|
|
const (
|
|
ArtifactGroupDeliverable = "deliverable"
|
|
ArtifactGroupDebug = "debug"
|
|
)
|
|
|
|
// TurnArtifactNames are the files the server itself writes into a model visit's
|
|
// turn directory. They are always debugging files.
|
|
var TurnArtifactNames = []string{"input.md", "memory.md", "history.md", "findings.md", "output.md", "session.html"}
|
|
|
|
// IsDebug reports whether the artifact is a runner-internal debugging file.
|
|
func (a StageArtifact) IsDebug() bool { return a.Group == ArtifactGroupDebug }
|
|
|
|
func isTurnArtifactName(name string) bool {
|
|
for _, turn := range TurnArtifactNames {
|
|
if name == turn {
|
|
return true
|
|
}
|
|
}
|
|
return name == LegacySessionMarkdownArtifact || strings.HasPrefix(name, "session-repair-")
|
|
}
|
|
|
|
// ClassifyArtifacts returns one visit's artifacts with Group set. public/ files
|
|
// are deliverables. Turn files, session exports and their repairs, and private/
|
|
// scratch are debug files; so is every other unprefixed file of a turn-layout
|
|
// visit (one that recorded any turn file), because a stage publishes only
|
|
// through public/. A visit recorded before the turn layout keeps its other
|
|
// files as deliverables. The rule uses only the recorded names, so runs stored
|
|
// before the field existed classify identically on read. It never mutates the
|
|
// input. Pure, O(artifacts).
|
|
func ClassifyArtifacts(files []StageArtifact) []StageArtifact {
|
|
if len(files) == 0 {
|
|
return files
|
|
}
|
|
turnVisit := false
|
|
for _, file := range files {
|
|
if isTurnArtifactName(file.Name) {
|
|
turnVisit = true
|
|
break
|
|
}
|
|
}
|
|
classified := make([]StageArtifact, len(files))
|
|
for i, file := range files {
|
|
switch {
|
|
case strings.HasPrefix(file.Name, "public/"):
|
|
file.Group = ArtifactGroupDeliverable
|
|
case turnVisit, isTurnArtifactName(file.Name), strings.HasPrefix(file.Name, "private/"):
|
|
file.Group = ArtifactGroupDebug
|
|
default:
|
|
file.Group = ArtifactGroupDeliverable
|
|
}
|
|
classified[i] = file
|
|
}
|
|
return classified
|
|
}
|