sessionBead function

Bead sessionBead({
  1. required String id,
  2. required String workBeadId,
  3. bool closed = false,
  4. bool outcomeComplete = false,
  5. bool escalated = false,
  6. Map<String, String> metadata = const {},
})

A type=session state bead linking workBeadId — the row the join bridge projects + keys by work_bead, carrying the OWNED substation marker (the persisted metadata.rig key — codec law; so the chokepoint's ownership re-check passes) + the I-10 closed-session shapes (the engine's own DONE evidence via outcomeComplete, a HUMAN marker via escalated).

The flat per-node cursor params retired with the flat grid.cursor.* model (tg-eli phase 2): per-node circuit state is a type=step bead's — stage it in a molecule fixture instead (metadata still takes arbitrary keys for legacy-bead shapes).

Implementation

Bead sessionBead({
  required String id,
  required String workBeadId,
  bool closed = false,
  bool outcomeComplete = false,
  bool escalated = false,
  Map<String, String> metadata = const {},
}) => Bead(
  id: id,
  issueType: GridIssueTypes.session,
  status: closed ? BeadStatus.closed : BeadStatus.open,
  metadata: {
    'rig': stateSubstation,
    SessionBeadKeys.workBead: workBeadId,
    if (outcomeComplete) ...sessionCompleteMetadata(),
    if (escalated) SessionBeadKeys.escalation: 'breaker-exhausted',
    ...metadata,
  },
);