(data: SessionData, patch: FooterPatch | undefined)
| 62 | } |
| 63 | |
| 64 | function replayPatch(data: SessionData, patch: FooterPatch | undefined) { |
| 65 | if (active(data)) { |
| 66 | if (!patch) { |
| 67 | return { |
| 68 | phase: "running", |
| 69 | } satisfies FooterPatch |
| 70 | } |
| 71 | |
| 72 | return { |
| 73 | ...patch, |
| 74 | phase: "running", |
| 75 | } satisfies FooterPatch |
| 76 | } |
| 77 | |
| 78 | if (data.permissions.length > 0 || data.questions.length > 0) { |
| 79 | if (!patch) { |
| 80 | return { |
| 81 | phase: "idle", |
| 82 | } satisfies FooterPatch |
| 83 | } |
| 84 | |
| 85 | return { |
| 86 | ...patch, |
| 87 | phase: "idle", |
| 88 | } satisfies FooterPatch |
| 89 | } |
| 90 | |
| 91 | if (!patch) { |
| 92 | return undefined |
| 93 | } |
| 94 | |
| 95 | return { |
| 96 | ...patch, |
| 97 | phase: "idle", |
| 98 | status: "", |
| 99 | } satisfies FooterPatch |
| 100 | } |
| 101 | |
| 102 | function isShellSyntheticUser(message: SessionMessages[number]) { |
| 103 | if (message.info.role !== "user") { |
no test coverage detected