klyro 0.1.10 → 0.1.11
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/cli/repl.js +20 -9
- package/dist/tui/app.js +1 -1
- package/package.json +1 -1
package/dist/cli/repl.js
CHANGED
|
@@ -150,16 +150,20 @@ export async function startRepl(opts = {}) {
|
|
|
150
150
|
// 2.3 image handling: extract @img refs
|
|
151
151
|
const { text: cleanText, images } = parseImageInput(text);
|
|
152
152
|
const taskText = images.length > 0 ? `${cleanText}\n\n[images: ${images.join(', ')}]` : cleanText;
|
|
153
|
-
//
|
|
153
|
+
// Only create session for non-trivial tasks (with tools/verify) — plain chat like "hello" is not a persisted session
|
|
154
|
+
const isSimpleChat = taskText.trim().split(/\s+/).length <= 5 && !taskText.toLowerCase().includes('fix') && !taskText.toLowerCase().includes('add') && !taskText.toLowerCase().includes('create');
|
|
154
155
|
let sessionId;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
if (!isSimpleChat) {
|
|
157
|
+
try {
|
|
158
|
+
const rec = await tuiStore.create({ cwd, task: taskText, config: { model, maxSteps: opts.maxSteps ?? 30 } });
|
|
159
|
+
sessionId = rec.id;
|
|
160
|
+
tuiSessionId = rec.id;
|
|
161
|
+
// Session info goes to status bar, not transcript (clean like Claude Code)
|
|
162
|
+
queuedStatus({ status: 'running', step: 0, model });
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// best-effort
|
|
166
|
+
}
|
|
163
167
|
}
|
|
164
168
|
queuedStatus({ status: 'running', step: 0, model });
|
|
165
169
|
let textBuf = '';
|
|
@@ -303,12 +307,19 @@ export async function startRepl(opts = {}) {
|
|
|
303
307
|
queuedAppend({ id: `verr-${Date.now()}`, kind: 'error', message: `Verification failed after ${result.verification?.attempts ?? 3} attempts. Check output above.` });
|
|
304
308
|
queuedStatus({ status: 'error', errorMessage: 'verification failed' });
|
|
305
309
|
}
|
|
310
|
+
else if (result.status === 'no_final' && result.finalText) {
|
|
311
|
+
// Simple chat with text but no tool calls — treat as done (provider finished)
|
|
312
|
+
queuedStatus({ status: 'done', repairs: result.repairs ?? 0 });
|
|
313
|
+
}
|
|
306
314
|
else {
|
|
307
315
|
queuedStatus({ status: 'complete' === result.status ? 'done' : 'error', repairs: result.repairs ?? 0 });
|
|
308
316
|
}
|
|
309
317
|
if (sessionId) {
|
|
310
318
|
queuedAppend({ id: `sess-end-${Date.now()}`, kind: 'text', text: `session ${sessionId.slice(0, 8)} ${result.status} — ${result.steps} steps, ${result.toolCalls} tool calls`, role: 'assistant' });
|
|
311
319
|
}
|
|
320
|
+
else if (result.status === 'no_final' && !result.finalText) {
|
|
321
|
+
queuedAppend({ id: `no_final-${Date.now()}`, kind: 'error', message: 'Provider returned no final text — check model/provider' });
|
|
322
|
+
}
|
|
312
323
|
}
|
|
313
324
|
catch (err) {
|
|
314
325
|
const message = err instanceof Error ? err.message : String(err);
|
package/dist/tui/app.js
CHANGED
|
@@ -129,5 +129,5 @@ export function App(props) {
|
|
|
129
129
|
const width = stdout?.columns ?? 100;
|
|
130
130
|
const height = stdout?.rows ?? 30;
|
|
131
131
|
const isSmall = width < 80;
|
|
132
|
-
return (_jsxs(Box, { flexDirection: "column", width: width, height: height - 1, children: [_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: tokens.ansi.border, paddingX: 1, children: [_jsx(Text, { bold: true, children: "KLYRO v0.1.
|
|
132
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, height: height - 1, children: [_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: tokens.ansi.border, paddingX: 1, children: [_jsx(Text, { bold: true, children: "KLYRO v0.1.11" }), _jsxs(Text, { color: tokens.ansi.muted, children: [status.model, " \u00B7 API Usage Billing \u00B7 step ", status.step, "/", status.maxSteps, " \u00B7 ", status.status, " \u00B7 repairs ", status.repairs] }), _jsx(Text, { color: tokens.ansi.muted, children: props.cwd })] }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, overflow: "hidden", paddingX: 1, paddingY: 1, children: [transcript.length === 0 ? (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: tokens.ansi.muted, children: "No conversation yet. Try \"fix the failing login test\"" }) })) : (transcript.map((item) => (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: item.kind === 'text' && item.role === 'user' ? (_jsxs(Text, { children: ["\u203A ", item.text] })) : item.kind === 'text' ? (_jsxs(Text, { children: [" ", item.text] })) : item.kind === 'tool' ? (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: tokens.ansi.border, paddingX: 1, children: [_jsxs(Text, { children: [item.name, " ", item.isError ? '✗' : '✓', " ", item.latencyMs ?? 0, "ms"] }), item.result ? _jsx(Text, { color: tokens.ansi.muted, children: String(item.result).slice(0, 200) }) : null] })) : item.kind === 'diff' ? (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: tokens.ansi.border, paddingX: 1, children: [_jsx(Text, { bold: true, children: item.summary ?? 'Diff' }), item.hunks.map((h, i) => (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: tokens.ansi.info, children: h.path }), h.lines.map((l, j) => (_jsxs(Text, { color: l.kind === 'add' ? tokens.ansi.success : l.kind === 'remove' ? tokens.ansi.error : tokens.ansi.muted, children: [l.kind === 'add' ? '+ ' : l.kind === 'remove' ? '- ' : ' ', l.text] }, j)))] }, i)))] })) : (_jsx(Transcript, { items: [item] })) }, item.id)))), status.status === 'running' ? (_jsxs(Box, { children: [_jsx(Text, { color: tokens.ansi.info, children: "\u2726 Thinking..." }), _jsxs(Text, { color: tokens.ansi.muted, children: [" \u00B7 ", Math.round(elapsed / 1000), "s"] })] })) : null, plan.length > 0 ? _jsx(PlanView, { steps: plan, expanded: false, onToggle: () => { } }) : null] }), _jsxs(Box, { borderStyle: "single", borderColor: tokens.ansi.accent, paddingX: 1, children: [_jsx(Text, { children: "\u203A " }), _jsxs(Text, { children: [input, "\u258F"] })] }), _jsxs(Box, { justifyContent: "space-between", paddingX: 1, borderStyle: "single", borderColor: tokens.ansi.border, children: [_jsxs(Text, { color: tokens.ansi.muted, children: [status.model, " \u00B7 ", status.usageInput + status.usageOutput, " tokens \u00B7 $", (status.usageInput / 1000 * 0.003 + status.usageOutput / 1000 * 0.015).toFixed(2), " \u00B7 ", Math.round(elapsed / 1000), "s"] }), _jsx(Text, { color: tokens.ansi.muted, children: isSmall ? 'Ctrl+C interrupt' : 'Ctrl+C interrupt · Ctrl+O expand · ↑↓ scroll' })] })] }));
|
|
133
133
|
}
|