stage turns: replace JSON results with file-based markdown turns

Each model visit now gets <run>/stages/<seq>-<stage>/ with input.md,
memory.md, output.md, private/ and a shared run-level public/. The model
reads the two input files, follows the stage's instructions verbatim and
returns complete markdown; only the # outcome section is parsed.

- add internal/turn layout, render and output parsing
- write input.md/memory.md before a visit and output.md from the final
  message; inventory all turn files as stage artifacts
- accumulate completed turns and system-written public file additions in
  memory, including across retries and resume
- remove the JSON envelope, strict field validation, line format and the
  repair ladder for model stages
- republish pipeline authoring prompts and docs in the new style

Checks: go build ./..., go vet ./..., go test -count=1 ./..., gofmt -l .
This commit is contained in:
2026-10-19 22:27:44 +01:00
parent b2fd614ba4
commit e37b864c40
66 changed files with 2199 additions and 3028 deletions
+11 -3
View File
@@ -8,10 +8,14 @@ import (
)
// ArtifactAccess is runtime-only, server-derived access to artifact visits.
// Empty fields deliberately grant nothing outside the workspace.
// Write is the current turn's private directory; WriteShared is the run-level
// public directory. Read is limited to the current turn and public/, so a later
// stage never receives an earlier turn's private/ files. Empty fields
// deliberately grant nothing outside the workspace.
type ArtifactAccess struct {
Write string
Read []string
Write string
WriteShared string
Read []string
}
// LandingAccess is the server-derived external capability for a verified
@@ -226,6 +230,10 @@ func (c *AgentClient) permissionRules() []map[string]string {
allow("external_directory", filepath.ToSlash(filepath.Join(c.ArtifactAccess.Write, "*")))
allow("edit", filepath.ToSlash(filepath.Join(c.ArtifactAccess.Write, "*")))
}
if writeArtifacts && artifactDirectory(c.ArtifactAccess.WriteShared) {
allow("external_directory", filepath.ToSlash(filepath.Join(c.ArtifactAccess.WriteShared, "*")))
allow("edit", filepath.ToSlash(filepath.Join(c.ArtifactAccess.WriteShared, "*")))
}
if c.LandingAccess.valid() {
allow("external_directory", filepath.ToSlash(filepath.Join(c.LandingAccess.MainWorktree, "*")))
allow("external_directory", filepath.ToSlash(filepath.Join(c.LandingAccess.GitMetadata, "*")))