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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// Ported from CVC Agent (https://github.com/NousResearch/cvc)
|
|
5
|
+
// Original Copyright (c) 2025 Nous Research. CVC adaptations (c) 2026 Jai Kumar Meena.
|
|
6
|
+
import { createContext, useContext } from 'react';
|
|
7
|
+
const GatewayContext = createContext(null);
|
|
8
|
+
export function GatewayProvider({ children, value }) {
|
|
9
|
+
return _jsx(GatewayContext.Provider, { value: value, children: children });
|
|
10
|
+
}
|
|
11
|
+
export function useGateway() {
|
|
12
|
+
const value = useContext(GatewayContext);
|
|
13
|
+
if (!value) {
|
|
14
|
+
throw new Error('GatewayContext missing');
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
package/dist/app/historyStore.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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.
|
|
1
5
|
// History store — persists user input to ~/.cvc/agent_history.
|
|
2
6
|
// One entry per line, dedup against immediate previous, max 10000.
|
|
3
7
|
import { atom } from 'nanostores';
|
package/dist/app/inputBuffer.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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.
|
|
1
5
|
// Pure text-buffer helpers for the multi-line composer.
|
|
2
6
|
// Kept side-effect-free so they can be unit-tested without Ink/React.
|
|
3
7
|
export function emptyBuffer() {
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export const $inputSelection = atom(null);
|
|
7
|
+
export const setInputSelection = (next) => $inputSelection.set(next);
|
|
8
|
+
export const getInputSelection = () => $inputSelection.get();
|
package/dist/app/inputStore.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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.
|
|
1
5
|
// Composer state — kept in a nanostore so any subsystem can read/write
|
|
2
6
|
// without prop-drilling. Holds the active text buffer + completion state.
|
|
3
7
|
import { atom } from 'nanostores';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Single source of truth for indicator style names. Union type is
|
|
2
|
+
// derived from this tuple so adding/removing a style only touches one
|
|
3
|
+
// line — `useConfigSync` (validation) and `session.ts` (slash arg
|
|
4
|
+
// validation + usage hint) both import it.
|
|
5
|
+
export const INDICATOR_STYLES = ['ascii', 'emoji', 'kaomoji', 'unicode'];
|
|
6
|
+
export const DEFAULT_INDICATOR_STYLE = 'kaomoji';
|
|
@@ -0,0 +1,40 @@
|
|
|
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, computed } from 'nanostores';
|
|
6
|
+
const buildOverlayState = () => ({
|
|
7
|
+
agents: false,
|
|
8
|
+
agentsInitialHistoryIndex: 0,
|
|
9
|
+
approval: null,
|
|
10
|
+
clarify: null,
|
|
11
|
+
confirm: null,
|
|
12
|
+
modelPicker: false,
|
|
13
|
+
pager: null,
|
|
14
|
+
picker: false,
|
|
15
|
+
secret: null,
|
|
16
|
+
skillsHub: false,
|
|
17
|
+
sudo: null
|
|
18
|
+
});
|
|
19
|
+
export const $overlayState = atom(buildOverlayState());
|
|
20
|
+
export const $isBlocked = computed($overlayState, ({ agents, approval, clarify, confirm, modelPicker, pager, picker, secret, skillsHub, sudo }) => Boolean(agents || approval || clarify || confirm || modelPicker || pager || picker || secret || skillsHub || sudo));
|
|
21
|
+
export const getOverlayState = () => $overlayState.get();
|
|
22
|
+
export const patchOverlayState = (next) => $overlayState.set(typeof next === 'function' ? next($overlayState.get()) : { ...$overlayState.get(), ...next });
|
|
23
|
+
/** Full reset — used by session/turn teardown and tests. */
|
|
24
|
+
export const resetOverlayState = () => $overlayState.set(buildOverlayState());
|
|
25
|
+
/**
|
|
26
|
+
* Soft reset: drop FLOW-scoped overlays (approval / clarify / confirm / sudo
|
|
27
|
+
* / secret / pager) but PRESERVE user-toggled ones — agents dashboard, model
|
|
28
|
+
* picker, skills hub, session picker. Those are opened deliberately and
|
|
29
|
+
* shouldn't vanish when a turn ends. Called from turnController.idle() on
|
|
30
|
+
* every turn completion / interrupt; the old "reset everything" behaviour
|
|
31
|
+
* silently closed /agents the moment delegation finished.
|
|
32
|
+
*/
|
|
33
|
+
export const resetFlowOverlays = () => $overlayState.set({
|
|
34
|
+
...buildOverlayState(),
|
|
35
|
+
agents: $overlayState.get().agents,
|
|
36
|
+
agentsInitialHistoryIndex: $overlayState.get().agentsInitialHistoryIndex,
|
|
37
|
+
modelPicker: $overlayState.get().modelPicker,
|
|
38
|
+
picker: $overlayState.get().picker,
|
|
39
|
+
skillsHub: $overlayState.get().skillsHub
|
|
40
|
+
});
|
package/dist/app/promptStore.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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.
|
|
1
5
|
// Prompt store — confirmation + secret prompts requested by any subsystem.
|
|
2
6
|
// The composer hides while a prompt is active; the prompt overlay owns input.
|
|
3
7
|
import { atom } from 'nanostores';
|
package/dist/app/queueStore.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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.
|
|
1
5
|
// Queue store — submissions made while a turn is streaming are queued
|
|
2
6
|
// and flushed when the active turn ends. Composer shows `[queued: N]`.
|
|
3
7
|
import { atom } from 'nanostores';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function scrollBoundsForDelta(s, cur, delta) {
|
|
2
|
+
const viewport = Math.max(0, s.getViewportHeight());
|
|
3
|
+
const cachedHeight = Math.max(viewport, s.getScrollHeight());
|
|
4
|
+
let max = Math.max(0, cachedHeight - viewport);
|
|
5
|
+
// getScrollHeight() is render-time cached. After the streaming tail is
|
|
6
|
+
// committed into virtual history, the Yoga height can be fresher than the
|
|
7
|
+
// cached value; if we clamp only against the cached fake bottom, wheel-down
|
|
8
|
+
// becomes a no-op and no render is scheduled to reveal the real tail.
|
|
9
|
+
if (delta > 0 && cur + delta >= max - 1) {
|
|
10
|
+
const freshHeight = Math.max(viewport, s.getFreshScrollHeight());
|
|
11
|
+
max = Math.max(0, freshHeight - viewport);
|
|
12
|
+
}
|
|
13
|
+
return { max, viewport };
|
|
14
|
+
}
|
|
15
|
+
export function scrollWithSelectionBy(delta, { scrollRef, selection }) {
|
|
16
|
+
const s = scrollRef.current;
|
|
17
|
+
if (!s) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const cur = s.getScrollTop() + s.getPendingDelta();
|
|
21
|
+
const { max, viewport } = scrollBoundsForDelta(s, cur, delta);
|
|
22
|
+
const actual = Math.max(0, Math.min(max, cur + delta)) - cur;
|
|
23
|
+
if (actual === 0) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const sel = selection.getState();
|
|
27
|
+
const top = s.getViewportTop();
|
|
28
|
+
const bottom = top + viewport - 1;
|
|
29
|
+
if (sel?.anchor &&
|
|
30
|
+
sel.focus &&
|
|
31
|
+
sel.anchor.row >= top &&
|
|
32
|
+
sel.anchor.row <= bottom &&
|
|
33
|
+
(sel.isDragging || (sel.focus.row >= top && sel.focus.row <= bottom))) {
|
|
34
|
+
const shift = sel.isDragging ? selection.shiftAnchor : selection.shiftSelection;
|
|
35
|
+
if (actual > 0) {
|
|
36
|
+
selection.captureScrolledRows(top, top + actual - 1, 'above');
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
selection.captureScrolledRows(bottom + actual + 1, bottom, 'below');
|
|
40
|
+
}
|
|
41
|
+
shift(-actual, top, bottom);
|
|
42
|
+
}
|
|
43
|
+
s.scrollBy(actual);
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { patchUiState } from './uiStore.js';
|
|
2
|
+
export async function runExternalSetup({ args, ctx, done, launcher, suspend }) {
|
|
3
|
+
const { gateway, session, transcript } = ctx;
|
|
4
|
+
transcript.sys(`launching \`hermes ${args.join(' ')}\`…`);
|
|
5
|
+
patchUiState({ status: 'setup running…' });
|
|
6
|
+
let result = { code: null };
|
|
7
|
+
await suspend(async () => {
|
|
8
|
+
result = await launcher(args);
|
|
9
|
+
});
|
|
10
|
+
if (result.error) {
|
|
11
|
+
transcript.sys(`error launching hermes: ${result.error}`);
|
|
12
|
+
patchUiState({ status: 'setup required' });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (result.code !== 0) {
|
|
16
|
+
transcript.sys(`hermes ${args[0]} exited with code ${result.code}`);
|
|
17
|
+
patchUiState({ status: 'setup required' });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const setup = await gateway.rpc('setup.status', {});
|
|
21
|
+
if (setup?.provider_configured === false) {
|
|
22
|
+
transcript.sys('still no provider configured');
|
|
23
|
+
patchUiState({ status: 'setup required' });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
transcript.sys(done);
|
|
27
|
+
session.newSession();
|
|
28
|
+
}
|