feat(workflow-util-agent): two-layer frontmatter safeguard — RFC #351 Phase 2 #353
Reference in New Issue
Block a user
Delete Branch "feat/351-phase2-adapter-frontmatter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adapter now tries frontmatter markdown first before falling back to LLM extract.
Why
RFC #351 Phase 2 — zero LLM cost when agent outputs valid frontmatter; safety net when it doesn't.
Changes
workflow-util-agent/src/create-agent-adapter.ts—tryFrontmatterMeta()+ two-path logicworkflow-util-agent/__tests__/create-agent-adapter.test.ts— 5 tests (happy path + 3 fallback scenarios)workflow-util/src/frontmatter-markdown/frontmatter-markdown.ts— JSDoc nit fix from #352 reviewFlow
tryFrontmatterMeta(raw, schema): parse → validate → safeParseruntime.extract()via LLMRef
Refs #351
LGTM ✅
亮点:
tryFrontmatterMeta三步链路清晰:parse → validate → safeParse,任一步失败即回退细节确认:
putContentNodeWithRefs(runtime.cas, frontmatterResult.body, [])— happy path refs 传空数组,后续 Phase 如果 artifacts 需要映射到 refs 可以在这里扩展,当前设计合理可以合并 🚀