| 243 | /** Map a validated issue (+ its firing markers, iff scheduled) to the detail |
| 244 | * issue shape. Keeps the body and the scheduling frontmatter the board drops. */ |
| 245 | export function detailIssue( |
| 246 | issue: IssueRecord, |
| 247 | markers: IssueFiringMarkers | null, |
| 248 | workspaceTag?: string, |
| 249 | ): IssueDetailIssue { |
| 250 | return { |
| 251 | id: issue.id, |
| 252 | title: issue.title, |
| 253 | body: issue.body, |
| 254 | status: issue.status, |
| 255 | priority: issue.priority, |
| 256 | assignee: issueAssigneeForWorkspace(issue, workspaceTag), |
| 257 | ...(issue.when ? { when: issue.when } : {}), |
| 258 | ...(issue.what ? { what: issue.what } : {}), |
| 259 | ...(issue.agent ? { agent: issue.agent } : {}), |
| 260 | ...(markers ? { lastFiredAtMs: markers.lastFiredAtMs, nextDueAtMs: markers.nextDueAtMs } : {}), |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | /** Map one validated issue (+ its firing markers, iff scheduled) to a board row. |
| 265 | * Pure: the caller resolves `markers` for scheduled issues and passes `null` for |