clarity-ai 6.2.2 → 6.2.3
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/bin/clarity.js +20 -18
- package/package.json +1 -1
package/bin/clarity.js
CHANGED
|
@@ -10,10 +10,10 @@ import { createInterface } from 'readline';
|
|
|
10
10
|
process.stdin.resume();
|
|
11
11
|
process.stdin.setEncoding('utf8');
|
|
12
12
|
|
|
13
|
-
// Do NOT clear the screen here. Ink's { fullscreen: true }
|
|
14
|
-
// the alternate screen buffer on mount, which implicitly clears
|
|
15
|
-
// visible area.
|
|
16
|
-
// main buffer —
|
|
13
|
+
// Do NOT clear the screen here. Ink's { fullscreen: true } switches
|
|
14
|
+
// to the alternate screen buffer on mount, which implicitly clears
|
|
15
|
+
// the visible area. Any manual \x1b[2J before render() would clear
|
|
16
|
+
// the main buffer — destructive, shows as a flash on Termux.
|
|
17
17
|
|
|
18
18
|
async function main() {
|
|
19
19
|
const provider = process.env.CLARITY_PROVIDER || 'groq';
|
|
@@ -34,30 +34,32 @@ async function main() {
|
|
|
34
34
|
|
|
35
35
|
const config = { provider, model: process.env.CLARITY_MODEL || 'groq/llama-3.3-70b-versatile' };
|
|
36
36
|
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
|
|
37
|
+
// Mount Ink. fullscreen:true enters the alternate screen buffer.
|
|
38
|
+
// We DO NOT await waitUntilExit; on some Termux/Node combos it
|
|
39
|
+
// resolves before the first frame renders. Instead we keep the
|
|
40
|
+
// process alive with a never-resolving promise and exit only via
|
|
41
|
+
// signal handlers or process.exit from inside the app.
|
|
42
|
+
const { clear } = render(React.createElement(App, { config }), {
|
|
40
43
|
fullscreen: true,
|
|
41
44
|
patchConsole: false,
|
|
42
45
|
});
|
|
43
46
|
|
|
44
|
-
//
|
|
45
|
-
// when no async updates are queued.
|
|
46
|
-
|
|
47
|
-
const keepAlive = setInterval(() => {}, 2 ** 31 - 1);
|
|
47
|
+
// Keep the event loop alive — Ink's reconciler settles
|
|
48
|
+
// synchronously when no async state updates are queued.
|
|
49
|
+
setInterval(() => {}, 2 ** 31 - 1);
|
|
48
50
|
|
|
51
|
+
// Signal handlers are the ONLY way to exit.
|
|
49
52
|
function cleanup() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
process.stdout.write('\x1b[?25h\x1b[0m'); // show cursor, reset attrs
|
|
53
|
+
try { clear(); } catch {} // Ink unmount — exit alt buffer, restore TTY
|
|
54
|
+
process.stdout.write('\x1b[?25h\x1b[0m'); // show cursor, reset attrs
|
|
53
55
|
process.exit(0);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
process.on('SIGINT', cleanup);
|
|
57
|
-
process.on('SIGTERM', cleanup);
|
|
58
|
+
process.on('SIGINT', () => cleanup());
|
|
59
|
+
process.on('SIGTERM', () => cleanup());
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
// Never-resolving promise — we stay alive until a signal fires cleanup.
|
|
62
|
+
await new Promise(() => {});
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
main().catch(err => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clarity-ai",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.3",
|
|
4
4
|
"description": "Premium OpenCode-style terminal AI agent — 24-bit TrueColor theme, 8s timeout recovery, virtual scroll, inline tool trees, collapsible thought cards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|