MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / normalizeAutomationState

Function normalizeAutomationState

src/utils/sessionState.ts:116–134  ·  view source on GitHub ↗
(
  state: AutomationStateMetadata | null | undefined,
)

Source from the content-addressed store, hash-verified

114let currentMetadata: SessionExternalMetadata = {}
115
116function normalizeAutomationState(
117 state: AutomationStateMetadata | null | undefined,
118): AutomationStateMetadata | null {
119 if (!state || state.enabled !== true) {
120 return null
121 }
122
123 return {
124 enabled: true,
125 phase:
126 state.phase === 'standby' || state.phase === 'sleeping'
127 ? state.phase
128 : null,
129 next_tick_at:
130 typeof state.next_tick_at === 'number' ? state.next_tick_at : null,
131 sleep_until:
132 typeof state.sleep_until === 'number' ? state.sleep_until : null,
133 }
134}
135
136function automationStateKey(state: AutomationStateMetadata | null): string {
137 return JSON.stringify(state)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected