klyro 0.1.51 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tui/app.js +7 -3
- package/dist/tui/snapshot.test.js +11 -0
- package/package.json +1 -1
package/dist/tui/app.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Klyro TUI - opencode-clean - no clumsy words, correct wrap, markdown, scroll
|
|
4
4
|
* Header 3 rows, guide │ at col2, ● Klyro accent, prose wrapped at word boundaries
|
|
5
5
|
*/
|
|
6
|
-
import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
6
|
+
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
7
7
|
import { Box, Text, useInput, useStdout } from 'ink';
|
|
8
8
|
import { execFileSync } from 'node:child_process';
|
|
9
9
|
import { TuiApprovalBridge } from './approval.js';
|
|
@@ -83,13 +83,17 @@ function groupTools(items) {
|
|
|
83
83
|
return out;
|
|
84
84
|
}
|
|
85
85
|
// design.md §23/§24 — terminal Markdown via tui/markdown.ts: headings,
|
|
86
|
-
// **bold**, *italic*, `code`, fences, links, lists. Ink wraps
|
|
86
|
+
// **bold**, *italic*, `code`, fences, links, lists. Ink wraps the text.
|
|
87
|
+
//
|
|
88
|
+
// CRITICAL: this must return a SINGLE <Text> with inline nested parts.
|
|
89
|
+
// A fragment of sibling <Text>s inside the row-direction parent Box lays
|
|
90
|
+
// out as side-by-side COLUMNS (garbled transcript) instead of lines.
|
|
87
91
|
function MarkdownText({ text, dim, width }) {
|
|
88
92
|
void width;
|
|
89
93
|
const lines = useMemo(() => renderMarkdownLines(text), [text]);
|
|
90
94
|
const dimColor = tokens.colors.dim;
|
|
91
95
|
const softColor = tokens.colors.soft;
|
|
92
|
-
return (_jsx(
|
|
96
|
+
return (_jsx(Text, { wrap: "wrap", color: dim ? dimColor : undefined, children: lines.map((l, i) => (_jsxs(React.Fragment, { children: [i > 0 ? '\n' : null, l.parts.map((p, j) => (_jsx(Text, { bold: p.bold || undefined, color: p.bold ? (dim ? undefined : softColor) : p.dim ? dimColor : p.code ? softColor : undefined, children: p.text }, j)))] }, i))) }));
|
|
93
97
|
}
|
|
94
98
|
// Chat scroll — scroll.md §5 anchor model adapted to Ink.
|
|
95
99
|
//
|
|
@@ -82,6 +82,17 @@ describe('App visual snapshot', () => {
|
|
|
82
82
|
expect(frame).not.toContain('## Done');
|
|
83
83
|
expect(frame).not.toContain('`npm test`');
|
|
84
84
|
});
|
|
85
|
+
it('multiline assistant text renders as stacked lines, not columns', () => {
|
|
86
|
+
const { lastFrame } = render(_jsx(App, { ...DEFAULT_PROPS, initialModel: "gpt-4o-mini", maxSteps: 30, initialStatus: { status: 'idle', model: 'gpt-4o-mini', step: 0, maxSteps: 30, usageInput: 0, usageOutput: 0, repairs: 0 }, initialTranscript: [
|
|
87
|
+
{ id: 'm1', kind: 'text', text: 'ZZZTOPLINE\nZZZBOTTOMLINE', role: 'assistant' },
|
|
88
|
+
] }));
|
|
89
|
+
const rows = (lastFrame() ?? '').split('\n');
|
|
90
|
+
const top = rows.findIndex((r) => r.includes('ZZZTOPLINE'));
|
|
91
|
+
const bottom = rows.findIndex((r) => r.includes('ZZZBOTTOMLINE'));
|
|
92
|
+
// Columns bug put both markers on the SAME row; correct render stacks them.
|
|
93
|
+
expect(top).toBeGreaterThanOrEqual(0);
|
|
94
|
+
expect(bottom).toBeGreaterThan(top);
|
|
95
|
+
});
|
|
85
96
|
it('diff transcript item renders the diff box', () => {
|
|
86
97
|
const { lastFrame } = render(_jsx(App, { ...DEFAULT_PROPS, initialModel: "gpt-4o-mini", maxSteps: 30, initialStatus: { status: 'idle', model: 'gpt-4o-mini', step: 0, maxSteps: 30, usageInput: 0, usageOutput: 0, repairs: 0 }, initialTranscript: [
|
|
87
98
|
{
|
package/package.json
CHANGED