cvc-tui 0.4.0 → 0.4.2

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.
Files changed (133) hide show
  1. package/dist/entry.js +71148 -61
  2. package/package.json +2 -2
  3. package/dist/app/completion.js +0 -102
  4. package/dist/app/createGatewayEventHandler.js +0 -508
  5. package/dist/app/createSlashHandler.js +0 -101
  6. package/dist/app/delegationStore.js +0 -51
  7. package/dist/app/gatewayContext.js +0 -17
  8. package/dist/app/historyStore.js +0 -123
  9. package/dist/app/inputBuffer.js +0 -120
  10. package/dist/app/inputSelectionStore.js +0 -8
  11. package/dist/app/inputStore.js +0 -28
  12. package/dist/app/interfaces.js +0 -6
  13. package/dist/app/overlayStore.js +0 -40
  14. package/dist/app/promptStore.js +0 -44
  15. package/dist/app/queueStore.js +0 -25
  16. package/dist/app/scroll.js +0 -44
  17. package/dist/app/setupHandoff.js +0 -28
  18. package/dist/app/slash/commands/core.js +0 -479
  19. package/dist/app/slash/commands/debug.js +0 -44
  20. package/dist/app/slash/commands/ops.js +0 -498
  21. package/dist/app/slash/commands/session.js +0 -431
  22. package/dist/app/slash/commands/setup.js +0 -20
  23. package/dist/app/slash/commands/toggles.js +0 -40
  24. package/dist/app/slash/registry.js +0 -18
  25. package/dist/app/slash/types.js +0 -1
  26. package/dist/app/spawnHistoryStore.js +0 -105
  27. package/dist/app/turnController.js +0 -650
  28. package/dist/app/turnStore.js +0 -48
  29. package/dist/app/uiStore.js +0 -36
  30. package/dist/app/useComposerState.js +0 -265
  31. package/dist/app/useConfigSync.js +0 -144
  32. package/dist/app/useInputHandlers.js +0 -403
  33. package/dist/app/useLongRunToolCharms.js +0 -50
  34. package/dist/app/useMainApp.js +0 -629
  35. package/dist/app/useSessionLifecycle.js +0 -175
  36. package/dist/app/useSubmission.js +0 -287
  37. package/dist/app.js +0 -15
  38. package/dist/banner.js +0 -57
  39. package/dist/components/agentsOverlay.js +0 -474
  40. package/dist/components/appChrome.js +0 -252
  41. package/dist/components/appLayout.js +0 -121
  42. package/dist/components/appOverlays.js +0 -65
  43. package/dist/components/branding.js +0 -97
  44. package/dist/components/fpsOverlay.js +0 -22
  45. package/dist/components/helpHint.js +0 -21
  46. package/dist/components/markdown.js +0 -501
  47. package/dist/components/maskedPrompt.js +0 -12
  48. package/dist/components/messageLine.js +0 -82
  49. package/dist/components/modelPicker.js +0 -254
  50. package/dist/components/overlayControls.js +0 -30
  51. package/dist/components/overlays/confirmPrompt.js +0 -25
  52. package/dist/components/overlays/helpOverlay.js +0 -76
  53. package/dist/components/overlays/historySearch.js +0 -49
  54. package/dist/components/overlays/modelPicker.js +0 -60
  55. package/dist/components/overlays/overlayUtils.js +0 -19
  56. package/dist/components/overlays/secretPrompt.js +0 -36
  57. package/dist/components/overlays/sessionPicker.js +0 -93
  58. package/dist/components/overlays/skillsHub.js +0 -71
  59. package/dist/components/prompts.js +0 -95
  60. package/dist/components/queuedMessages.js +0 -24
  61. package/dist/components/sessionPicker.js +0 -130
  62. package/dist/components/skillsHub.js +0 -165
  63. package/dist/components/streamingAssistant.js +0 -35
  64. package/dist/components/streamingMarkdown.js +0 -144
  65. package/dist/components/textInput.js +0 -794
  66. package/dist/components/themed.js +0 -12
  67. package/dist/components/thinking.js +0 -496
  68. package/dist/components/todoPanel.js +0 -40
  69. package/dist/components/transcript.js +0 -22
  70. package/dist/config/env.js +0 -18
  71. package/dist/config/limits.js +0 -22
  72. package/dist/config/timing.js +0 -18
  73. package/dist/content/charms.js +0 -5
  74. package/dist/content/faces.js +0 -21
  75. package/dist/content/fortunes.js +0 -29
  76. package/dist/content/hotkeys.js +0 -38
  77. package/dist/content/placeholders.js +0 -15
  78. package/dist/content/setup.js +0 -14
  79. package/dist/content/verbs.js +0 -41
  80. package/dist/domain/details.js +0 -53
  81. package/dist/domain/messages.js +0 -63
  82. package/dist/domain/paths.js +0 -16
  83. package/dist/domain/providers.js +0 -11
  84. package/dist/domain/roles.js +0 -6
  85. package/dist/domain/slash.js +0 -11
  86. package/dist/domain/usage.js +0 -1
  87. package/dist/domain/viewport.js +0 -33
  88. package/dist/gateway/client.js +0 -312
  89. package/dist/gatewayClient.js +0 -574
  90. package/dist/gatewayTypes.js +0 -1
  91. package/dist/hooks/useCompletion.js +0 -86
  92. package/dist/hooks/useGitBranch.js +0 -58
  93. package/dist/hooks/useInputHistory.js +0 -12
  94. package/dist/hooks/useQueue.js +0 -57
  95. package/dist/hooks/useVirtualHistory.js +0 -401
  96. package/dist/lib/circularBuffer.js +0 -43
  97. package/dist/lib/clipboard.js +0 -126
  98. package/dist/lib/editor.js +0 -41
  99. package/dist/lib/editor.test.js +0 -58
  100. package/dist/lib/emoji.js +0 -49
  101. package/dist/lib/externalCli.js +0 -11
  102. package/dist/lib/forceTruecolor.js +0 -26
  103. package/dist/lib/fpsStore.js +0 -36
  104. package/dist/lib/gracefulExit.js +0 -29
  105. package/dist/lib/history.js +0 -69
  106. package/dist/lib/inputMetrics.js +0 -143
  107. package/dist/lib/liveProgress.js +0 -51
  108. package/dist/lib/liveProgress.test.js +0 -89
  109. package/dist/lib/mathUnicode.js +0 -685
  110. package/dist/lib/memory.js +0 -123
  111. package/dist/lib/memoryMonitor.js +0 -76
  112. package/dist/lib/messages.js +0 -3
  113. package/dist/lib/messages.test.js +0 -25
  114. package/dist/lib/osc52.js +0 -53
  115. package/dist/lib/perfPane.js +0 -94
  116. package/dist/lib/platform.js +0 -312
  117. package/dist/lib/precisionWheel.js +0 -25
  118. package/dist/lib/reasoning.js +0 -39
  119. package/dist/lib/rpc.js +0 -26
  120. package/dist/lib/subagentTree.js +0 -287
  121. package/dist/lib/syntax.js +0 -89
  122. package/dist/lib/terminalModes.js +0 -46
  123. package/dist/lib/terminalParity.js +0 -48
  124. package/dist/lib/terminalSetup.js +0 -321
  125. package/dist/lib/text.js +0 -203
  126. package/dist/lib/text.test.js +0 -18
  127. package/dist/lib/todo.js +0 -2
  128. package/dist/lib/todo.test.js +0 -22
  129. package/dist/lib/viewportStore.js +0 -82
  130. package/dist/lib/virtualHeights.js +0 -61
  131. package/dist/lib/wheelAccel.js +0 -143
  132. package/dist/theme.js +0 -398
  133. package/dist/types.js +0 -1
@@ -1,144 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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
- // StreamingMd — incremental markdown renderer for in-flight assistant text.
7
- //
8
- // Naive approach (render <Md text={full}/>) re-tokenizes the entire message
9
- // on every stream delta. At 20-char batches over a 3 KB response that's 150
10
- // full re-parses.
11
- //
12
- // This splits `text` at the last stable top-level block boundary (blank
13
- // line outside a fenced code span) into:
14
- // stablePrefix — passed to an inner <Md>, memoized on its exact text
15
- // value. During the turn, the prefix only grows monotonically,
16
- // so its memo key matches the previous render and React
17
- // reuses the cached subtree — zero re-tokenization.
18
- // unstableSuffix — the in-flight block(s). A separate <Md> re-parses just
19
- // this tail on every delta (O(unstable length) vs.
20
- // O(total length)).
21
- //
22
- // The boundary is stored in a ref so it only advances — idempotent under
23
- // StrictMode double-render. Component unmounts between turns (isStreaming
24
- // flips off → message moves to history and renders via <Md> directly), so
25
- // the ref resets naturally.
26
- //
27
- // Layout: the two <Md> subtrees MUST render stacked (column). The parent
28
- // container in messageLine.tsx is a default `flexDirection: 'row'` Box
29
- // (Ink's default), so returning a bare Fragment of two <Md> siblings
30
- // laid them out side-by-side — producing the "two jumbled columns while
31
- // streaming" rendering bug. Wrapping in a flexDirection="column" Box
32
- // here localizes the fix to the streaming path; the non-streaming <Md>
33
- // already returns its own column Box, so its single-child case was never
34
- // affected.
35
- import { Box } from '@cvc/ink';
36
- import { memo, useRef } from 'react';
37
- import { Md } from './markdown.js';
38
- // Count ``` / ~~~ AND `$$` / `\[…\]` fence toggles in `s` up to `end`. Odd
39
- // = currently inside a fenced block; splitting the prefix there would
40
- // orphan the fence and let the unstable suffix re-render as broken
41
- // markdown. Math fences only toggle when the code fence is closed so
42
- // snippets like ` ```\n$$x$$\n``` ` (math example inside a code block)
43
- // don't double-count. A `$$x$$` line that opens AND closes on its own
44
- // produces zero net toggles; that's `len >= 4` plus `endsDollar`.
45
- //
46
- // NB: this is INTENTIONALLY more conservative than `markdown.tsx`'s
47
- // parser, which falls back to paragraph rendering when an `$$` opener
48
- // has no matching closer. The renderer can do that safely because it
49
- // always sees the full text on every call. The streaming chunker
50
- // cannot — once a chunk is committed to the monotonic stable prefix it
51
- // is frozen, so prematurely deciding "this `$$` is just prose" would
52
- // permanently commit a paragraph rendering that becomes wrong the
53
- // instant the closer streams in. Treating any unmatched `$$` opener
54
- // as still-open keeps the boundary parked behind it until the closer
55
- // arrives (or the stream ends and the non-streaming `<Md>` takes over,
56
- // at which point the renderer's fallback kicks in correctly).
57
- const fenceOpenAt = (s, end) => {
58
- let codeOpen = false;
59
- let mathOpen = false;
60
- let mathOpener = null;
61
- let i = 0;
62
- while (i < end) {
63
- const nl = s.indexOf('\n', i);
64
- const lineEnd = nl < 0 || nl > end ? end : nl;
65
- const line = s.slice(i, lineEnd).trim();
66
- if (/^(?:`{3,}|~{3,})/.test(line)) {
67
- codeOpen = !codeOpen;
68
- }
69
- else if (!codeOpen) {
70
- if (!mathOpen && /^\$\$/.test(line)) {
71
- const isSingleLine = line.length >= 4 && /\$\$$/.test(line);
72
- if (!isSingleLine) {
73
- mathOpen = true;
74
- mathOpener = '$$';
75
- }
76
- }
77
- else if (!mathOpen && /^\\\[/.test(line)) {
78
- const isSingleLine = /\\\]$/.test(line);
79
- if (!isSingleLine) {
80
- mathOpen = true;
81
- mathOpener = '\\[';
82
- }
83
- }
84
- else if (mathOpen && mathOpener === '$$' && /\$\$$/.test(line)) {
85
- mathOpen = false;
86
- mathOpener = null;
87
- }
88
- else if (mathOpen && mathOpener === '\\[' && /\\\]$/.test(line)) {
89
- mathOpen = false;
90
- mathOpener = null;
91
- }
92
- }
93
- if (nl < 0 || nl >= end) {
94
- break;
95
- }
96
- i = nl + 1;
97
- }
98
- return codeOpen || mathOpen;
99
- };
100
- // Find the last "\n\n" boundary before `end` that is OUTSIDE a fenced code
101
- // block. Returns the index AFTER the second newline (start of the next
102
- // block), or -1 if no safe boundary exists yet.
103
- export const findStableBoundary = (text) => {
104
- let idx = text.length;
105
- while (idx > 0) {
106
- const boundary = text.lastIndexOf('\n\n', idx - 1);
107
- if (boundary < 0) {
108
- return -1;
109
- }
110
- // Boundary candidate: end of stable prefix is boundary + 2 (start of
111
- // next block). Check fence balance up to that point.
112
- const splitAt = boundary + 2;
113
- if (!fenceOpenAt(text, splitAt)) {
114
- return splitAt;
115
- }
116
- idx = boundary;
117
- }
118
- return -1;
119
- };
120
- export const StreamingMd = memo(function StreamingMd({ compact, t, text }) {
121
- const stablePrefixRef = useRef('');
122
- // Reset if the text no longer starts with our recorded prefix (defensive;
123
- // normally the component unmounts between turns so this shouldn't trigger).
124
- if (!text.startsWith(stablePrefixRef.current)) {
125
- stablePrefixRef.current = '';
126
- }
127
- const boundary = findStableBoundary(text);
128
- // Only advance the prefix — never retreat. The boundary math looks at the
129
- // FULL text each call; if it returns a larger index than before, we grow
130
- // the cached prefix. Monotonic growth makes the memo key stable across
131
- // deltas (identical string → same <Md> subtree → no re-render).
132
- if (boundary > stablePrefixRef.current.length) {
133
- stablePrefixRef.current = text.slice(0, boundary);
134
- }
135
- const stablePrefix = stablePrefixRef.current;
136
- const unstableSuffix = text.slice(stablePrefix.length);
137
- if (!stablePrefix) {
138
- return _jsx(Md, { compact: compact, t: t, text: unstableSuffix });
139
- }
140
- if (!unstableSuffix) {
141
- return _jsx(Md, { compact: compact, t: t, text: stablePrefix });
142
- }
143
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Md, { compact: compact, t: t, text: stablePrefix }), _jsx(Md, { compact: compact, t: t, text: unstableSuffix })] }));
144
- });