|
43 | 43 | // ═════════════════════════════════════════════ |
44 | 44 |
|
45 | 45 |
|
46 | | -// ───────────────────────────────────────────── |
47 | | -// p-agent |
48 | | -// |
49 | | -// id: string (required) |
50 | | -// description: string (required) |
51 | | -// tools: array of string (optional, default ()) |
52 | | -// handoffs: array of string (optional, default ()) |
53 | | -// model: string (optional, default none) |
54 | | -// persona: string (required — the introductory paragraph) |
55 | | -// expertise: array of string (required) |
56 | | -// boundaries: dict with can, cannot, approval keys (required) |
57 | | -// extra-sections: array of (heading, body) dicts (optional, default ()) |
58 | | -// Rendered after Boundaries, before References. Body is raw Markdown. |
59 | | -// references: array of (label, path) dicts (optional, default ()) |
60 | | -// ───────────────────────────────────────────── |
61 | | - |
| 46 | +/// Construct an agent dictionary for PROSE agent primitives. |
| 47 | +/// |
| 48 | +/// Agents have a persona, domain expertise, and operational boundaries. |
| 49 | +/// Extra sections and references are optional. |
| 50 | +/// |
| 51 | +/// - id (str): Unique agent identifier. |
| 52 | +/// - description (str): Short description (used in frontmatter). |
| 53 | +/// - tools (array): Tool names the agent can use. Default: `()`. |
| 54 | +/// - handoffs (array): Agent IDs this agent can hand off to. Default: `()`. |
| 55 | +/// - model (str): Preferred model identifier. Default: `none`. |
| 56 | +/// - persona (str): Introductory paragraph defining the agent's voice. |
| 57 | +/// - expertise (array): Non-empty list of domain expertise strings. |
| 58 | +/// - boundaries (dictionary): Dict with `can`, `cannot`, and `approval` string keys. |
| 59 | +/// - extra-sections (array): List of `(heading: str, body: str)` dicts. Default: `()`. |
| 60 | +/// - references (array): List of `(label: str, path: str)` dicts. Default: `()`. |
| 61 | +/// -> dictionary |
62 | 62 | #let p-agent( |
63 | 63 | id: none, |
64 | 64 | description: none, |
|
97 | 97 | } |
98 | 98 |
|
99 | 99 |
|
100 | | -// ───────────────────────────────────────────── |
101 | | -// p-instruction |
102 | | -// |
103 | | -// id: string (required) |
104 | | -// apply-to: string glob (required) |
105 | | -// description: string (optional, default none) |
106 | | -// sections: array of (heading, items|body) dicts (required) |
107 | | -// each section has exactly one of: |
108 | | -// items: array of string → rendered as bullet list |
109 | | -// body: string → rendered as raw Markdown |
110 | | -// prohibited: array of string (optional, default ()) |
111 | | -// references: array of (label, path) dicts (optional, default ()) |
112 | | -// ───────────────────────────────────────────── |
113 | | - |
| 100 | +/// Construct an instruction dictionary for PROSE instruction primitives. |
| 101 | +/// |
| 102 | +/// Each section must have exactly one of `items` (bullet list) or `body` (raw Markdown). |
| 103 | +/// If a section is named "Prohibited", the auto-appended Prohibited section is skipped. |
| 104 | +/// |
| 105 | +/// - id (str): Unique instruction identifier. |
| 106 | +/// - apply-to (str): Glob pattern for files this instruction applies to. |
| 107 | +/// - description (str): Short description (used in frontmatter). Default: `none`. |
| 108 | +/// - sections (array): Non-empty list of `(heading: str, items?: array, body?: str)` dicts. |
| 109 | +/// - prohibited (array): List of prohibited-action strings. Default: `()`. |
| 110 | +/// - references (array): List of `(label: str, path: str)` dicts. Default: `()`. |
| 111 | +/// -> dictionary |
114 | 112 | #let p-instruction( |
115 | 113 | id: none, |
116 | 114 | apply-to: none, |
|
153 | 151 | } |
154 | 152 |
|
155 | 153 |
|
156 | | -// ───────────────────────────────────────────── |
157 | | -// p-skill |
158 | | -// |
159 | | -// name: string (required) |
160 | | -// description: string (required, can be multiline) |
161 | | -// trigger: string (required) |
162 | | -// rules: array of string (required) |
163 | | -// extra-sections: array of (heading, body) dicts (optional, default ()) |
164 | | -// Rendered after Quick Rules, before Detailed References. |
165 | | -// references-preamble: string (optional, default none) |
166 | | -// Prose paragraph before the reference links. |
167 | | -// references: array of (label, path) dicts (optional, default ()) |
168 | | -// ───────────────────────────────────────────── |
169 | | - |
| 154 | +/// Construct a skill dictionary for PROSE skill primitives. |
| 155 | +/// |
| 156 | +/// Skills define trigger conditions, quick rules, and optional detailed references. |
| 157 | +/// |
| 158 | +/// - name (str): Skill name (used in frontmatter). |
| 159 | +/// - description (str): Skill description (can be multiline, rendered as YAML block scalar). |
| 160 | +/// - trigger (str): Condition that activates this skill. |
| 161 | +/// - rules (array): Non-empty list of rule strings (rendered as numbered list). |
| 162 | +/// - extra-sections (array): List of `(heading: str, body: str)` dicts. Default: `()`. |
| 163 | +/// - references-preamble (str): Prose paragraph before reference links. Default: `none`. |
| 164 | +/// - references (array): List of `(label: str, path: str)` dicts. Default: `()`. |
| 165 | +/// -> dictionary |
170 | 166 | #let p-skill( |
171 | 167 | name: none, |
172 | 168 | description: none, |
|
194 | 190 | } |
195 | 191 |
|
196 | 192 |
|
197 | | -// ───────────────────────────────────────────── |
198 | | -// p-workflow |
199 | | -// |
200 | | -// id: string (required) |
201 | | -// description: string (required) |
202 | | -// mode: string (optional, default "agent") |
203 | | -// agent: string (optional, default none) |
204 | | -// phases: array of (name, steps) dicts (required) |
205 | | -// each phase may optionally include checkpoint: string |
206 | | -// ───────────────────────────────────────────── |
207 | | - |
| 193 | +/// Construct a workflow dictionary for PROSE workflow primitives. |
| 194 | +/// |
| 195 | +/// Workflows define phased execution plans. Each phase has a name, steps, |
| 196 | +/// and an optional checkpoint string. |
| 197 | +/// |
| 198 | +/// - id (str): Unique workflow identifier. |
| 199 | +/// - description (str): Workflow description (used in frontmatter). |
| 200 | +/// - mode (str): Execution mode. Default: `"agent"`. |
| 201 | +/// - agent (str): Agent identifier to execute this workflow. Default: `none`. |
| 202 | +/// - phases (array): Non-empty list of `(name: str, steps: array, checkpoint?: str)` dicts. |
| 203 | +/// -> dictionary |
208 | 204 | #let p-workflow( |
209 | 205 | id: none, |
210 | 206 | description: none, |
|
238 | 234 | // ═════════════════════════════════════════════ |
239 | 235 |
|
240 | 236 |
|
241 | | -// ───────────────────────────────────────────── |
242 | | -// render-agent |
243 | | -// ───────────────────────────────────────────── |
244 | | - |
| 237 | +/// Render an agent dictionary as Markdown with YAML frontmatter. |
| 238 | +/// |
| 239 | +/// Outputs frontmatter (description, tools, optional handoffs/model), |
| 240 | +/// persona, expertise list, boundaries, extra sections, and references. |
| 241 | +/// |
| 242 | +/// - a (dictionary): An agent dictionary (from `p-agent`). |
| 243 | +/// -> str |
245 | 244 | #let render-agent(a) = { |
246 | 245 | if a.at("_type", default: none) != "agent" { |
247 | 246 | panic("promptyst: render-agent requires an agent dictionary.") |
|
292 | 291 | } |
293 | 292 |
|
294 | 293 |
|
295 | | -// ───────────────────────────────────────────── |
296 | | -// render-instruction |
297 | | -// ───────────────────────────────────────────── |
298 | | - |
| 294 | +/// Render an instruction dictionary as Markdown with YAML frontmatter. |
| 295 | +/// |
| 296 | +/// Sections with `items` render as bullet lists; sections with `body` render as raw Markdown. |
| 297 | +/// If a section is named "Prohibited", the auto-appended Prohibited section is skipped. |
| 298 | +/// |
| 299 | +/// - instr (dictionary): An instruction dictionary (from `p-instruction`). |
| 300 | +/// -> str |
299 | 301 | #let render-instruction(instr) = { |
300 | 302 | if instr.at("_type", default: none) != "instruction" { |
301 | 303 | panic("promptyst: render-instruction requires an instruction dictionary.") |
|
340 | 342 | } |
341 | 343 |
|
342 | 344 |
|
343 | | -// ───────────────────────────────────────────── |
344 | | -// render-skill |
345 | | -// ───────────────────────────────────────────── |
346 | | - |
| 345 | +/// Render a skill dictionary as Markdown with YAML frontmatter. |
| 346 | +/// |
| 347 | +/// Outputs frontmatter (name, block-scalar description), trigger section, |
| 348 | +/// numbered rules, extra sections, and optional detailed references. |
| 349 | +/// |
| 350 | +/// - sk (dictionary): A skill dictionary (from `p-skill`). |
| 351 | +/// -> str |
347 | 352 | #let render-skill(sk) = { |
348 | 353 | if sk.at("_type", default: none) != "skill" { |
349 | 354 | panic("promptyst: render-skill requires a skill dictionary.") |
|
385 | 390 | } |
386 | 391 |
|
387 | 392 |
|
388 | | -// ───────────────────────────────────────────── |
389 | | -// render-workflow |
390 | | -// ───────────────────────────────────────────── |
391 | | - |
| 393 | +/// Render a workflow dictionary as Markdown with YAML frontmatter. |
| 394 | +/// |
| 395 | +/// Each phase renders as a numbered heading with its steps. |
| 396 | +/// Phases with a `checkpoint` key append a bold checkpoint line. |
| 397 | +/// |
| 398 | +/// - wf (dictionary): A workflow dictionary (from `p-workflow`). |
| 399 | +/// -> str |
392 | 400 | #let render-workflow(wf) = { |
393 | 401 | if wf.at("_type", default: none) != "workflow" { |
394 | 402 | panic("promptyst: render-workflow requires a workflow dictionary.") |
|
0 commit comments