Skip to content

Claude Code opened to any LLM — OpenAI, Gemini, DeepSeek, Ollama, and 200+ models via OpenAI-compatible API shim

TypeScript

fix: prevent interactive stream crash on node removal

Kevinc957d495ac49
diff --git a/package.json b/package.json
index fe735fe..15f9f34 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@gitlawb/openclaude",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "Claude Code opened to any LLM — OpenAI, Gemini, DeepSeek, Ollama, and 200+ models",
"type": "module",
"bin": {
diff --git a/src/ink/dom.ts b/src/ink/dom.ts
index 993dadd..f5b672b 100644
--- a/src/ink/dom.ts
+++ b/src/ink/dom.ts
@@ -227,19 +227,21 @@ function collectRemovedRects(
removed: DOMNode,
underAbsolute = false,
): void {
- if (removed.nodeName === '#text') return
- const elem = removed as DOMElement
+ if (!removed || removed.nodeName === '#text') return
+ const elem = removed as Partial<DOMElement>
// If this node or any ancestor in the removed subtree was absolute,
// its painted pixels may overlap non-siblings — flag for global blit
// disable. Normal-flow removals only affect direct siblings, which
// hasRemovedChild already handles.
- const isAbsolute = underAbsolute || elem.style.position === 'absolute'
- const cached = nodeCache.get(elem)
+ const isAbsolute = underAbsolute || elem.style?.position === 'absolute'
+ const cached = nodeCache.get(elem as DOMElement)
if (cached) {
addPendingClear(parent, cached, isAbsolute)
- nodeCache.delete(elem)
+ nodeCache.delete(elem as DOMElement)
}
- for (const child of elem.childNodes) {
+ const childNodes = Array.isArray(elem.childNodes) ? [...elem.childNodes] : []
+ for (const child of childNodes) {
+ if (!child) continue
collectRemovedRects(parent, child, isAbsolute)
}
}