| 1 | import type { Meta, TabMeta } from "./types"; |
| 2 | |
| 3 | export function runtimeReadyForSubmit(meta?: Meta): boolean { |
| 4 | if (!meta || meta.ready !== true || meta.startupErr) return false; |
| 5 | return !meta.runtime || meta.runtime.phase === "ready"; |
| 6 | } |
| 7 | |
| 8 | // A local durable identity remains readable when execution cannot acquire a |
| 9 | // lease or finish recovery. Remote tabs keep their negotiated reader route. |
| 10 | export function needsColdHistory(meta?: Meta | TabMeta): boolean { |
| 11 | return Boolean(meta && !meta.remote && (!meta.ready || meta.startupErr) |
| 12 | && (meta.sessionPath || meta.session?.sessionId)); |
| 13 | } |
| 14 | |
| 15 | export function metaWithoutCanonicalTodos(meta?: Meta): Meta | undefined { |
| 16 | if (!meta || meta.canonicalTodos === undefined) return meta; |
| 17 | return { ...meta, canonicalTodos: undefined }; |
| 18 | } |
| 19 |