Parser
Parses rendered prompt text into an array of structured messages with role markers.
Class Diagram
Section titled “Class Diagram”---
title: Parser
config:
look: handDrawn
theme: colorful
class:
hideEmptyMembersBox: true
---
classDiagram
class Parser {
<<protocol>>
+parse(agent: Agent, rendered: string, context: Record<unknown>?) Message[] [async-capable]
+preRender(template: string) unknown? [sync, optional default]
}
Helper Methods
Section titled “Helper Methods”The following helper methods are declared via @method and must be implemented by every runtime. The schema declares the logical protocol contract; each runtime maps async-capable methods to idiomatic sync/async shapes for that language.
| Name | Signature | Runtime shape | Description |
|---|---|---|---|
parse |
parse(agent: Agent, rendered: string, context: Record<unknown>?) -> Message[] |
async-capable | Parse rendered text into a structured message array |
preRender |
preRender(template: string) -> unknown? |
sync, optional default | Pre-process a template before rendering, returning modified template and context |