Extract session lifecycle, polling, grid planning, and event handling: - polling.ts: session polling controller with stability detection - event-handlers.ts: session created/deleted handlers - grid-planning.ts, spawn-action-decider.ts, spawn-target-finder.ts - session-status-parser.ts, session-message-count.ts - cleanup.ts, polling-constants.ts, tmux-grid-constants.ts
18 lines
601 B
TypeScript
18 lines
601 B
TypeScript
type SessionStatus = { type: string }
|
|
|
|
export function parseSessionStatusMap(data: unknown): Record<string, SessionStatus> {
|
|
if (typeof data !== "object" || data === null) return {}
|
|
const record = data as Record<string, unknown>
|
|
|
|
const result: Record<string, SessionStatus> = {}
|
|
for (const [sessionId, value] of Object.entries(record)) {
|
|
if (typeof value !== "object" || value === null) continue
|
|
const valueRecord = value as Record<string, unknown>
|
|
const type = valueRecord["type"]
|
|
if (typeof type !== "string") continue
|
|
result[sessionId] = { type }
|
|
}
|
|
|
|
return result
|
|
}
|