Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions internal/mcpserver/widget/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,31 @@
}).catch(() => { /* not an MCP Apps postMessage host */ });
resizeObserver.observe(document.body);
})();

// ChatGPT can set window.openai.toolOutput a tick after mount without firing
// "openai:set_globals" — poll briefly so we don't miss a late delivery. If nothing
// has rendered after a few seconds, surface what the host actually exposes instead
// of sitting on the loading note. (Diagnostic string removed once ChatGPT render
// is confirmed.)
(function watchOpenAI() {
let n = 0;
const timer = setInterval(() => {
n++;
const oa = openAIHost();
if (oa && oa.toolOutput) { clearInterval(timer); applyOpenAIGlobals(oa); return; }
if (n >= 24) {
clearInterval(timer);
if (root.textContent.indexOf("Warming up") !== -1) {
const o = openAIHost();
const info = o
? "openai present; keys: " + Object.keys(o).slice(0, 14).join(", ") + "; toolOutput " + (o.toolOutput ? "set" : "absent")
: "window.openai ABSENT in this iframe";
clearRoot();
root.appendChild(el("div", "note", "SaltyBytes debug — " + info));
}
}
}, 250);
})();
</script>
</body>
</html>
Loading