cvc-tui 0.1.0 → 0.4.0
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/app/completion.js +4 -0
- package/dist/app/createGatewayEventHandler.js +508 -0
- package/dist/app/createSlashHandler.js +101 -0
- package/dist/app/delegationStore.js +51 -0
- package/dist/app/gatewayContext.js +17 -0
- package/dist/app/historyStore.js +4 -0
- package/dist/app/inputBuffer.js +4 -0
- package/dist/app/inputSelectionStore.js +8 -0
- package/dist/app/inputStore.js +4 -0
- package/dist/app/interfaces.js +6 -0
- package/dist/app/overlayStore.js +40 -0
- package/dist/app/promptStore.js +4 -0
- package/dist/app/queueStore.js +4 -0
- package/dist/app/scroll.js +44 -0
- package/dist/app/setupHandoff.js +28 -0
- package/dist/app/slash/commands/core.js +421 -234
- package/dist/app/slash/commands/debug.js +39 -6
- package/dist/app/slash/commands/ops.js +471 -136
- package/dist/app/slash/commands/session.js +405 -65
- package/dist/app/slash/commands/setup.js +16 -43
- package/dist/app/slash/commands/toggles.js +4 -0
- package/dist/app/slash/registry.js +7 -68
- package/dist/app/slash/types.js +1 -16
- package/dist/app/spawnHistoryStore.js +105 -0
- package/dist/app/turnController.js +650 -0
- package/dist/app/turnStore.js +47 -59
- package/dist/app/uiStore.js +34 -29
- package/dist/app/useComposerState.js +265 -0
- package/dist/app/useConfigSync.js +144 -0
- package/dist/app/useInputHandlers.js +403 -0
- package/dist/app/useLongRunToolCharms.js +50 -0
- package/dist/app/useMainApp.js +629 -0
- package/dist/app/useSessionLifecycle.js +175 -0
- package/dist/app/useSubmission.js +287 -0
- package/dist/app.js +13 -217
- package/dist/banner.js +40 -3
- package/dist/components/agentsOverlay.js +474 -0
- package/dist/components/appChrome.js +252 -0
- package/dist/components/appLayout.js +121 -22
- package/dist/components/appOverlays.js +65 -0
- package/dist/components/branding.js +97 -6
- package/dist/components/fpsOverlay.js +22 -0
- package/dist/components/helpHint.js +21 -0
- package/dist/components/markdown.js +501 -0
- package/dist/components/maskedPrompt.js +12 -0
- package/dist/components/messageLine.js +82 -0
- package/dist/components/modelPicker.js +254 -0
- package/dist/components/overlayControls.js +30 -0
- package/dist/components/overlays/helpOverlay.js +1 -0
- package/dist/components/overlays/historySearch.js +1 -0
- package/dist/components/overlays/modelPicker.js +2 -1
- package/dist/components/overlays/overlayUtils.js +2 -1
- package/dist/components/overlays/secretPrompt.js +1 -0
- package/dist/components/overlays/sessionPicker.js +1 -0
- package/dist/components/overlays/skillsHub.js +1 -0
- package/dist/components/prompts.js +95 -0
- package/dist/components/queuedMessages.js +24 -0
- package/dist/components/sessionPicker.js +130 -0
- package/dist/components/skillsHub.js +165 -0
- package/dist/components/streamingAssistant.js +35 -0
- package/dist/components/streamingMarkdown.js +110 -186
- package/dist/components/textInput.js +748 -218
- package/dist/components/themed.js +12 -0
- package/dist/components/thinking.js +493 -36
- package/dist/components/todoPanel.js +40 -0
- package/dist/config/env.js +18 -0
- package/dist/config/limits.js +22 -0
- package/dist/config/timing.js +4 -0
- package/dist/content/charms.js +5 -0
- package/dist/content/faces.js +21 -0
- package/dist/content/fortunes.js +29 -0
- package/dist/content/hotkeys.js +38 -0
- package/dist/content/placeholders.js +15 -0
- package/dist/content/setup.js +14 -0
- package/dist/content/verbs.js +41 -0
- package/dist/domain/details.js +53 -0
- package/dist/domain/messages.js +63 -0
- package/dist/domain/paths.js +16 -0
- package/dist/domain/providers.js +11 -0
- package/dist/domain/roles.js +6 -0
- package/dist/domain/slash.js +11 -0
- package/dist/domain/usage.js +1 -0
- package/dist/domain/viewport.js +33 -0
- package/dist/entry.js +65 -40
- package/dist/gatewayClient.js +574 -0
- package/dist/gatewayTypes.js +1 -0
- package/dist/hooks/useCompletion.js +86 -0
- package/dist/hooks/useGitBranch.js +58 -0
- package/dist/hooks/useInputHistory.js +12 -0
- package/dist/hooks/useQueue.js +57 -0
- package/dist/hooks/useVirtualHistory.js +401 -0
- package/dist/lib/circularBuffer.js +43 -0
- package/dist/lib/clipboard.js +126 -0
- package/dist/lib/editor.js +41 -0
- package/dist/lib/editor.test.js +58 -0
- package/dist/lib/emoji.js +49 -0
- package/dist/lib/externalCli.js +11 -0
- package/dist/lib/forceTruecolor.js +26 -0
- package/dist/lib/fpsStore.js +36 -0
- package/dist/lib/gracefulExit.js +29 -0
- package/dist/lib/history.js +69 -0
- package/dist/lib/inputMetrics.js +143 -0
- package/dist/lib/liveProgress.js +51 -0
- package/dist/lib/liveProgress.test.js +89 -0
- package/dist/lib/mathUnicode.js +685 -0
- package/dist/lib/memory.js +123 -0
- package/dist/lib/memoryMonitor.js +76 -0
- package/dist/lib/messages.js +3 -0
- package/dist/lib/messages.test.js +25 -0
- package/dist/lib/osc52.js +53 -0
- package/dist/lib/perfPane.js +94 -0
- package/dist/lib/platform.js +312 -0
- package/dist/lib/precisionWheel.js +25 -0
- package/dist/lib/reasoning.js +39 -0
- package/dist/lib/rpc.js +26 -0
- package/dist/lib/subagentTree.js +287 -0
- package/dist/lib/syntax.js +89 -0
- package/dist/lib/terminalModes.js +46 -0
- package/dist/lib/terminalParity.js +48 -0
- package/dist/lib/terminalSetup.js +321 -0
- package/dist/lib/text.js +203 -0
- package/dist/lib/text.test.js +18 -0
- package/dist/lib/todo.js +2 -0
- package/dist/lib/todo.test.js +22 -0
- package/dist/lib/viewportStore.js +82 -0
- package/dist/lib/virtualHeights.js +61 -0
- package/dist/lib/wheelAccel.js +143 -0
- package/dist/theme.js +398 -0
- package/dist/types.js +1 -7
- package/package.json +2 -1
package/dist/app/slash/types.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// Mirrors the Hermes ui-tui slash surface but with a much smaller ctx so
|
|
3
|
-
// commands stay easy to test and the TUI can grow the surface incrementally.
|
|
4
|
-
// Helper used by every toggle-style command.
|
|
5
|
-
export const flagFromArg = (arg, current) => {
|
|
6
|
-
if (!arg)
|
|
7
|
-
return !current;
|
|
8
|
-
const m = arg.trim().toLowerCase();
|
|
9
|
-
if (m === 'on' || m === 'true' || m === '1')
|
|
10
|
-
return true;
|
|
11
|
-
if (m === 'off' || m === 'false' || m === '0')
|
|
12
|
-
return false;
|
|
13
|
-
if (m === 'toggle' || m === 'cycle')
|
|
14
|
-
return !current;
|
|
15
|
-
return null;
|
|
16
|
-
};
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Ported from CVC Agent (https://github.com/NousResearch/cvc)
|
|
4
|
+
// Original Copyright (c) 2025 Nous Research. CVC adaptations (c) 2026 Jai Kumar Meena.
|
|
5
|
+
import { atom } from 'nanostores';
|
|
6
|
+
const HISTORY_LIMIT = 10;
|
|
7
|
+
export const $spawnHistory = atom([]);
|
|
8
|
+
export const $spawnDiff = atom(null);
|
|
9
|
+
export const getSpawnHistory = () => $spawnHistory.get();
|
|
10
|
+
export const getSpawnDiff = () => $spawnDiff.get();
|
|
11
|
+
export const clearSpawnHistory = () => $spawnHistory.set([]);
|
|
12
|
+
export const clearDiffPair = () => $spawnDiff.set(null);
|
|
13
|
+
export const setDiffPair = (pair) => $spawnDiff.set(pair);
|
|
14
|
+
/**
|
|
15
|
+
* Commit a finished turn's spawn tree to history. Keeps the last 10
|
|
16
|
+
* non-empty snapshots — empty turns (no subagents) are dropped.
|
|
17
|
+
*
|
|
18
|
+
* Why in-memory? The primary investigation loop is "I just ran a fan-out,
|
|
19
|
+
* it misbehaved, let me look at what happened" — same-session debugging.
|
|
20
|
+
* Disk persistence across process restarts is a natural extension but
|
|
21
|
+
* adds RPC surface for a less-common path.
|
|
22
|
+
*/
|
|
23
|
+
export const pushSnapshot = (subagents, meta) => {
|
|
24
|
+
if (!subagents.length) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
const started = meta.startedAt ?? Math.min(...subagents.map(s => s.startedAt ?? now));
|
|
29
|
+
const snap = {
|
|
30
|
+
finishedAt: now,
|
|
31
|
+
id: `snap-${now.toString(36)}`,
|
|
32
|
+
label: summarizeLabel(subagents),
|
|
33
|
+
sessionId: meta.sessionId ?? null,
|
|
34
|
+
startedAt: Number.isFinite(started) ? started : now,
|
|
35
|
+
subagents: subagents.map(item => ({ ...item }))
|
|
36
|
+
};
|
|
37
|
+
const next = [snap, ...$spawnHistory.get()].slice(0, HISTORY_LIMIT);
|
|
38
|
+
$spawnHistory.set(next);
|
|
39
|
+
};
|
|
40
|
+
function summarizeLabel(subagents) {
|
|
41
|
+
const top = subagents
|
|
42
|
+
.filter(s => s.parentId == null || subagents.every(o => o.id !== s.parentId))
|
|
43
|
+
.slice(0, 2)
|
|
44
|
+
.map(s => s.goal || 'subagent')
|
|
45
|
+
.join(' · ');
|
|
46
|
+
return top || `${subagents.length} agent${subagents.length === 1 ? '' : 's'}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Push a disk-loaded snapshot onto the front of the history stack so the
|
|
50
|
+
* overlay can pick it up at index 1 via /replay load. Normalises the
|
|
51
|
+
* server payload (arbitrary list) into the same SubagentProgress shape
|
|
52
|
+
* used for live data — defensive against cross-version reads.
|
|
53
|
+
*/
|
|
54
|
+
export const pushDiskSnapshot = (r, path) => {
|
|
55
|
+
const raw = Array.isArray(r.subagents) ? r.subagents : [];
|
|
56
|
+
const normalised = raw.map(normaliseSubagent);
|
|
57
|
+
if (!normalised.length) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const snap = {
|
|
61
|
+
finishedAt: (r.finished_at ?? Date.now() / 1000) * 1000,
|
|
62
|
+
fromDisk: true,
|
|
63
|
+
id: `disk-${path}`,
|
|
64
|
+
label: r.label || `${normalised.length} subagents`,
|
|
65
|
+
path,
|
|
66
|
+
sessionId: r.session_id ?? null,
|
|
67
|
+
startedAt: (r.started_at ?? r.finished_at ?? Date.now() / 1000) * 1000,
|
|
68
|
+
subagents: normalised
|
|
69
|
+
};
|
|
70
|
+
const next = [snap, ...$spawnHistory.get()].slice(0, HISTORY_LIMIT);
|
|
71
|
+
$spawnHistory.set(next);
|
|
72
|
+
};
|
|
73
|
+
function normaliseSubagent(raw) {
|
|
74
|
+
const o = raw;
|
|
75
|
+
const s = (v) => (typeof v === 'string' ? v : undefined);
|
|
76
|
+
const n = (v) => (typeof v === 'number' ? v : undefined);
|
|
77
|
+
const arr = (v) => (Array.isArray(v) ? v : undefined);
|
|
78
|
+
return {
|
|
79
|
+
apiCalls: n(o.apiCalls),
|
|
80
|
+
costUsd: n(o.costUsd),
|
|
81
|
+
depth: typeof o.depth === 'number' ? o.depth : 0,
|
|
82
|
+
durationSeconds: n(o.durationSeconds),
|
|
83
|
+
filesRead: arr(o.filesRead),
|
|
84
|
+
filesWritten: arr(o.filesWritten),
|
|
85
|
+
goal: s(o.goal) ?? 'subagent',
|
|
86
|
+
id: s(o.id) ?? `sa-${Math.random().toString(36).slice(2, 8)}`,
|
|
87
|
+
index: typeof o.index === 'number' ? o.index : 0,
|
|
88
|
+
inputTokens: n(o.inputTokens),
|
|
89
|
+
iteration: n(o.iteration),
|
|
90
|
+
model: s(o.model),
|
|
91
|
+
notes: (arr(o.notes) ?? []).filter(x => typeof x === 'string'),
|
|
92
|
+
outputTail: arr(o.outputTail),
|
|
93
|
+
outputTokens: n(o.outputTokens),
|
|
94
|
+
parentId: s(o.parentId) ?? null,
|
|
95
|
+
reasoningTokens: n(o.reasoningTokens),
|
|
96
|
+
startedAt: n(o.startedAt),
|
|
97
|
+
status: s(o.status) ?? 'completed',
|
|
98
|
+
summary: s(o.summary),
|
|
99
|
+
taskCount: typeof o.taskCount === 'number' ? o.taskCount : 1,
|
|
100
|
+
thinking: (arr(o.thinking) ?? []).filter(x => typeof x === 'string'),
|
|
101
|
+
toolCount: typeof o.toolCount === 'number' ? o.toolCount : 0,
|
|
102
|
+
tools: (arr(o.tools) ?? []).filter(x => typeof x === 'string'),
|
|
103
|
+
toolsets: arr(o.toolsets)
|
|
104
|
+
};
|
|
105
|
+
}
|