/** * Custom session messages for dashboard / bridge consumers. */ export const GOAL_EVENT_TYPE = "pi-goal-expander:event"; export interface GoalEventDetails { kind: string; goalId?: string; status?: string; phase?: string; objective?: string; [key: string]: unknown; } /** * Build a CustomMessage-compatible payload for pi.sendMessage. */ export function buildGoalEvent(details: GoalEventDetails): { customType: string; content: string; display: boolean; details: GoalEventDetails; } { const kind = details.kind ?? "event"; const goalBit = details.goalId ? ` goal=${details.goalId}` : ""; const statusBit = details.status ? ` status=${details.status}` : ""; return { customType: GOAL_EVENT_TYPE, content: `[pi-goal-expander] ${kind}${goalBit}${statusBit}`, display: false, details, }; }