(mode: string)
| 71 | return stack.at(-1)?.mode ?? OPENCODE_BASE_MODE |
| 72 | }, |
| 73 | push(mode: string) { |
| 74 | if (disposed) return () => {} |
| 75 | const id = Symbol(mode) |
| 76 | let active = true |
| 77 | stack.push({ id, mode }) |
| 78 | update() |
| 79 | |
| 80 | return () => { |
| 81 | if (!active) return |
| 82 | active = false |
| 83 | const index = stack.findIndex((item) => item.id === id) |
| 84 | if (index !== -1) stack.splice(index, 1) |
| 85 | update() |
| 86 | } |
| 87 | }, |
| 88 | dispose() { |
| 89 | if (disposed) return |
| 90 | disposed = true |