feat: agent session protocol — sessionId in result, continue support, frontmatter retry

Breaking changes:
- AgentRunResult now requires sessionId field
- AgentOptions now requires continue function
- Agent CLI outputs JSON {stepHash, sessionId} instead of plain CAS hash
- Engine parses JSON output (with legacy CAS hash fallback)

New features:
- Frontmatter validation retry: if agent output lacks valid frontmatter,
  engine calls agent.continue() up to 2 times with correction message
- Session tracking: sessionId flows from agent → engine → StepOutput
- Hermes agent: session parse failure is now a hard error (no raw text fallback)
- Hermes agent: supports --resume for continue sessions

Closes #384
This commit is contained in:
2026-05-22 09:13:05 +00:00
parent e62d51d845
commit 7ff90cef4f
6 changed files with 149 additions and 48 deletions
+1
View File
@@ -81,6 +81,7 @@ export type StepOutput = {
thread: ThreadId;
head: CasRef;
done: boolean;
sessionId?: string;
};
/** uwf thread steps — single step entry */