Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix(chat): typeset formulas in process commentary
CloudTianTianccf782f99efd
diff --git a/src/renderer/modules/conversation.js b/src/renderer/modules/conversation.jsindex 0e9ca4e2..adee9c10 100644--- a/src/renderer/modules/conversation.js+++ b/src/renderer/modules/conversation.js@@ -8479,6 +8479,7 @@ function _commitStreamingMarkdown(finalEl, prepared, suffixHtml = '') {finalEl.replaceChildren(body);}}+ if (prepared.bodyClass) body.className = prepared.bodyClass;const reused = new Set(blocks.filter(block => block.nodes));const changed = [];blocks.forEach((block, i) => {@@ -8521,8 +8522,9 @@ function _releaseStreamingMarkdown(finalEl) {delete finalEl._streamMarkdown;}-function _paintStreamingMarkdownBlocks(msg, finalEl, display, { stickBottom, suffixHtml }) {+function _paintStreamingMarkdownBlocks(msg, finalEl, display, { stickBottom, suffixHtml, bodyClass }) {const prepared = _prepareStreamingMarkdown(finalEl, display);+ if (bodyClass) prepared.bodyClass = bodyClass;const dirtyMath = prepared.blocks.filter(block => !block.nodes && _streamMathSignatureForText(block.html));if (!dirtyMath.length || typeof typesetMathHtml !== 'function') {_invalidateStreamingMathPaint(msg);@@ -12137,8 +12139,9 @@ function _setProcessCommentaryLineContent(line, text) {line.dataset.processText = body;if (typeof renderMarkdownFull === 'function') {if (typeof renderMarkdownBlocks === 'function' && typeof line.insertBefore === 'function') {- _commitStreamingMarkdown(line, _prepareStreamingMarkdown(line, body));- line.firstElementChild.className = 'stream-process-commentary-text markdown-body';+ _paintStreamingMarkdownBlocks(line, line, body, {+ stickBottom: false, suffixHtml: '', bodyClass: 'stream-process-commentary-text markdown-body',+ });} else {line.innerHTML = `<div class="stream-process-commentary-text markdown-body">${_renderMessageMarkdown(body)}</div>`;}diff --git a/test/e2e/chat_e2e_streaming_markdown.spec.ts b/test/e2e/chat_e2e_streaming_markdown.spec.tsindex 2b13a58a..5149d286 100644--- a/test/e2e/chat_e2e_streaming_markdown.spec.ts+++ b/test/e2e/chat_e2e_streaming_markdown.spec.ts@@ -10,6 +10,32 @@ const index = fs.readFileSync(path.join(renderer, 'index.html'), 'utf8');const mathConfig = index.slice(index.indexOf('window.MathJax = {'), index.indexOf('</script>', index.indexOf('window.MathJax = {')));const capturedLogs = new WeakMap<Page, Array<{ level: string; message: string }>>();+test('renders process commentary formulas and retains completed formulas as the prose grows', async ({ page }, testInfo) => {+ await setup(page);+ await page.evaluate(() => {+ const w = window as any;+ w.commentary = document.createElement('div');+ w.msg.querySelector('.stream-process-body').appendChild(w.commentary);+ w._setProcessCommentaryLineContent(w.commentary, 'First result: \\(x^2\\).');+ });+ const commentary = page.locator('.stream-process-commentary');+ await expect(commentary.locator('mjx-container')).toHaveCount(1);+ await expect(commentary.locator('.stream-process-commentary-text')).toContainText('First result:');+ await page.evaluate(() => {+ const w = window as any;+ w.commentaryMath = w.commentary.querySelector('mjx-container');+ w._setProcessCommentaryLineContent(w.commentary, 'First result: \\(x^2\\).\n\nSecond result: \\(y^3\\).');+ });+ await expect(commentary.locator('mjx-container')).toHaveCount(2);+ expect(await page.evaluate(() => {+ const w = window as any;+ return w.commentaryMath.isConnected && w.commentary.querySelector('mjx-container') === w.commentaryMath;+ })).toBe(true);+ await expect(commentary).toContainText('Second result:');+ await page.locator('.stream-process').evaluate((element) => { (element as HTMLDetailsElement).open = true; });+ await commentary.screenshot({ path: testInfo.outputPath('process-formulas.png') });+});+test.afterEach(async ({ page }, testInfo) => {const logs = capturedLogs.get(page) || [];const fontWarnings = logs.filter(isFontFallbackNotice);