@denizokcu/haze 0.9.0 → 0.11.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.
Files changed (241) hide show
  1. package/CHANGELOG.md +133 -17
  2. package/README.md +164 -68
  3. package/SECURITY.md +22 -0
  4. package/bin/haze.js +102 -1
  5. package/dist/buildInfo.json +7 -0
  6. package/dist/cli/chat/TaskBar.d.ts +2 -1
  7. package/dist/cli/chat/TaskBar.js +7 -4
  8. package/dist/cli/chat/chatMetrics.d.ts +17 -1
  9. package/dist/cli/chat/chatMetrics.js +22 -5
  10. package/dist/cli/chat/contextReport.d.ts +11 -0
  11. package/dist/cli/chat/contextReport.js +46 -0
  12. package/dist/cli/chat/fileMentionSuggestions.d.ts +29 -0
  13. package/dist/cli/chat/fileMentionSuggestions.js +92 -0
  14. package/dist/cli/chat/inputSuggestions.d.ts +5 -0
  15. package/dist/cli/chat/inputSuggestions.js +17 -3
  16. package/dist/cli/chat/liveRegion.d.ts +25 -0
  17. package/dist/cli/chat/liveRegion.js +48 -0
  18. package/dist/cli/chat/messages.d.ts +33 -2
  19. package/dist/cli/chat/messages.js +216 -33
  20. package/dist/cli/chat/sessionLifecycle.d.ts +67 -0
  21. package/dist/cli/chat/sessionLifecycle.js +205 -0
  22. package/dist/cli/chat/sessionRecorder.js +80 -14
  23. package/dist/cli/chat/startupInfo.js +11 -4
  24. package/dist/cli/chat/tips.d.ts +21 -0
  25. package/dist/cli/chat/tips.js +43 -0
  26. package/dist/cli/chat/wizardDispatch.d.ts +64 -0
  27. package/dist/cli/chat/wizardDispatch.js +744 -0
  28. package/dist/cli/commands/chat.d.ts +6 -0
  29. package/dist/cli/commands/chat.js +373 -790
  30. package/dist/cli/commands/chatModes.d.ts +1 -1
  31. package/dist/cli/commands/chatModes.js +7 -2
  32. package/dist/cli/commands/commandHelp.js +5 -3
  33. package/dist/cli/commands/commands.d.ts +5 -2
  34. package/dist/cli/commands/commands.js +22 -18
  35. package/dist/cli/commands/doctor.d.ts +19 -0
  36. package/dist/cli/commands/doctor.js +76 -0
  37. package/dist/cli/commands/fleetCommand.d.ts +14 -0
  38. package/dist/cli/commands/fleetCommand.js +46 -0
  39. package/dist/cli/commands/formatters.d.ts +5 -0
  40. package/dist/cli/commands/formatters.js +35 -6
  41. package/dist/cli/commands/logsCommand.js +1 -7
  42. package/dist/cli/commands/modelCommand.js +1 -1
  43. package/dist/cli/commands/ndjsonSink.d.ts +23 -0
  44. package/dist/cli/commands/ndjsonSink.js +38 -0
  45. package/dist/cli/commands/providerWizard.d.ts +10 -2
  46. package/dist/cli/commands/providerWizard.js +50 -4
  47. package/dist/cli/commands/runCommand.d.ts +4 -0
  48. package/dist/cli/commands/runCommand.js +142 -16
  49. package/dist/cli/commands/sessionPicker.d.ts +9 -0
  50. package/dist/cli/commands/sessionPicker.js +29 -0
  51. package/dist/cli/commands/settingsSummary.js +6 -4
  52. package/dist/cli/commands/skillConfirmRemove.js +4 -3
  53. package/dist/cli/commands/skillWizard.d.ts +2 -0
  54. package/dist/cli/commands/skillWizard.js +16 -6
  55. package/dist/cli/commands/streaming/abortCause.d.ts +24 -0
  56. package/dist/cli/commands/streaming/abortCause.js +16 -0
  57. package/dist/cli/commands/streaming/assistantText.js +9 -2
  58. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +65 -0
  59. package/dist/cli/commands/streaming/goalCheckpoint.js +23 -0
  60. package/dist/cli/commands/streaming/goalSupervisor.d.ts +64 -0
  61. package/dist/cli/commands/streaming/goalSupervisor.js +127 -0
  62. package/dist/cli/commands/streaming/idleTimer.d.ts +26 -0
  63. package/dist/cli/commands/streaming/idleTimer.js +24 -0
  64. package/dist/cli/commands/streaming/toolCallRecovery.d.ts +2 -0
  65. package/dist/cli/commands/streaming/toolCallRecovery.js +24 -0
  66. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +31 -0
  67. package/dist/cli/commands/streaming/toolGroupRenderer.js +50 -2
  68. package/dist/cli/commands/streaming/toolResultState.d.ts +6 -1
  69. package/dist/cli/commands/streaming/toolResultState.js +29 -7
  70. package/dist/cli/commands/streaming/turnOutcome.d.ts +17 -0
  71. package/dist/cli/commands/streaming/turnOutcome.js +27 -11
  72. package/dist/cli/commands/streaming/turnRuntime.js +6 -4
  73. package/dist/cli/commands/streaming.d.ts +82 -3
  74. package/dist/cli/commands/streaming.js +528 -91
  75. package/dist/cli/commands/wizardActions.d.ts +7 -0
  76. package/dist/cli/commands/wizardActions.js +7 -0
  77. package/dist/cli/commands/wizardPrompts.js +7 -1
  78. package/dist/cli/commands/wizardSuggestions.d.ts +8 -0
  79. package/dist/cli/commands/wizardSuggestions.js +64 -14
  80. package/dist/cli/commands/wizardTransition.d.ts +4 -0
  81. package/dist/cli/commands/wizardTransition.js +1 -2
  82. package/dist/cli/index.js +82 -22
  83. package/dist/cli/terminalTitle.d.ts +6 -0
  84. package/dist/cli/terminalTitle.js +36 -0
  85. package/dist/config/inputHistory.d.ts +3 -3
  86. package/dist/config/inputHistory.js +12 -18
  87. package/dist/config/modelDiscovery.d.ts +71 -0
  88. package/dist/config/modelDiscovery.js +214 -0
  89. package/dist/config/privateStorage.js +28 -2
  90. package/dist/config/providerAuth.d.ts +14 -0
  91. package/dist/config/providerAuth.js +49 -0
  92. package/dist/config/providerPresets.d.ts +49 -5
  93. package/dist/config/providerPresets.js +573 -73
  94. package/dist/config/providers.d.ts +2 -0
  95. package/dist/config/providers.js +9 -0
  96. package/dist/config/settings.d.ts +58 -0
  97. package/dist/config/settings.js +38 -1
  98. package/dist/config/skillSettings.d.ts +6 -13
  99. package/dist/config/skillSettings.js +20 -19
  100. package/dist/core/agent/budgets.d.ts +36 -0
  101. package/dist/core/agent/budgets.js +44 -0
  102. package/dist/core/agent/compaction.d.ts +38 -0
  103. package/dist/core/agent/compaction.js +108 -19
  104. package/dist/core/agent/completionController.d.ts +230 -0
  105. package/dist/core/agent/completionController.js +287 -0
  106. package/dist/core/agent/contextBudget.d.ts +46 -0
  107. package/dist/core/agent/contextBudget.js +89 -7
  108. package/dist/core/agent/errors.js +6 -2
  109. package/dist/core/agent/events.d.ts +86 -0
  110. package/dist/core/agent/reasoningPolicy.d.ts +31 -0
  111. package/dist/core/agent/reasoningPolicy.js +27 -0
  112. package/dist/core/agent/toolCapabilities.d.ts +27 -0
  113. package/dist/core/agent/toolCapabilities.js +58 -0
  114. package/dist/core/agent/toolExecutionBudget.d.ts +35 -0
  115. package/dist/core/agent/toolExecutionBudget.js +49 -0
  116. package/dist/core/agent/toolOutputStore.d.ts +13 -0
  117. package/dist/core/agent/toolOutputStore.js +27 -10
  118. package/dist/core/agent/toolResults.d.ts +12 -0
  119. package/dist/core/agent/toolResults.js +38 -0
  120. package/dist/core/agent/turnBudget.d.ts +35 -0
  121. package/dist/core/agent/turnBudget.js +27 -0
  122. package/dist/core/agent/turnPolicy.d.ts +11 -0
  123. package/dist/core/agent/turnPolicy.js +19 -0
  124. package/dist/core/agent/workState.d.ts +76 -1
  125. package/dist/core/agent/workState.js +120 -13
  126. package/dist/core/attachments/imageAttachments.d.ts +90 -0
  127. package/dist/core/attachments/imageAttachments.js +245 -0
  128. package/dist/core/attachments/readBlessings.d.ts +37 -0
  129. package/dist/core/attachments/readBlessings.js +79 -0
  130. package/dist/core/deadline.d.ts +33 -0
  131. package/dist/core/deadline.js +74 -0
  132. package/dist/core/goal/completionPolicy.d.ts +27 -0
  133. package/dist/core/goal/completionPolicy.js +37 -1
  134. package/dist/core/goal/requestClassifier.d.ts +0 -3
  135. package/dist/core/goal/requestClassifier.js +0 -13
  136. package/dist/core/io/boundedRead.js +76 -29
  137. package/dist/core/limits/byteBudgets.d.ts +7 -0
  138. package/dist/core/limits/byteBudgets.js +7 -0
  139. package/dist/core/limits/textBudgets.d.ts +25 -0
  140. package/dist/core/limits/textBudgets.js +25 -0
  141. package/dist/core/log/llmLog.js +7 -0
  142. package/dist/core/persistence/orderedFileWriter.d.ts +10 -0
  143. package/dist/core/persistence/orderedFileWriter.js +16 -2
  144. package/dist/core/process/backgroundRegistry.d.ts +35 -0
  145. package/dist/core/process/backgroundRegistry.js +195 -0
  146. package/dist/core/process/runBoundedProcess.d.ts +9 -0
  147. package/dist/core/process/runBoundedProcess.js +74 -29
  148. package/dist/core/safety/missingExecutable.d.ts +42 -0
  149. package/dist/core/safety/missingExecutable.js +77 -0
  150. package/dist/core/safety/urlGuard.d.ts +2 -1
  151. package/dist/core/safety/urlGuard.js +3 -2
  152. package/dist/core/session/sessionSlimming.js +47 -4
  153. package/dist/core/session/sessionStore.d.ts +74 -0
  154. package/dist/core/session/sessionStore.js +268 -18
  155. package/dist/core/subagent/contracts.d.ts +120 -0
  156. package/dist/core/subagent/contracts.js +55 -0
  157. package/dist/core/subagent/executionProfiles.d.ts +28 -0
  158. package/dist/core/subagent/executionProfiles.js +45 -0
  159. package/dist/core/subagent/subagentCoordinator.d.ts +78 -0
  160. package/dist/core/subagent/subagentCoordinator.js +164 -0
  161. package/dist/core/subagent/subagentRunner.d.ts +211 -145
  162. package/dist/core/subagent/subagentRunner.js +208 -98
  163. package/dist/core/subagent/workspaceMutationPolicy.d.ts +11 -0
  164. package/dist/core/subagent/workspaceMutationPolicy.js +52 -0
  165. package/dist/core/tasks/taskStorage.js +12 -1
  166. package/dist/llm/client.d.ts +36 -29
  167. package/dist/llm/client.js +102 -33
  168. package/dist/llm/hazeTools.d.ts +2559 -150
  169. package/dist/llm/hazeTools.js +119 -31
  170. package/dist/llm/lsp.d.ts +26 -4
  171. package/dist/llm/lsp.js +90 -14
  172. package/dist/llm/lspTools.d.ts +2366 -0
  173. package/dist/llm/lspTools.js +87 -79
  174. package/dist/llm/openaiCodex.d.ts +3 -0
  175. package/dist/llm/openaiCodex.js +47 -0
  176. package/dist/llm/openaiCodexOAuth.d.ts +54 -0
  177. package/dist/llm/openaiCodexOAuth.js +214 -0
  178. package/dist/llm/requestContext.d.ts +25 -1
  179. package/dist/llm/requestContext.js +51 -8
  180. package/dist/llm/systemPrompt.d.ts +15 -1
  181. package/dist/llm/systemPrompt.js +24 -8
  182. package/dist/llm/toolResultTypes.d.ts +8 -1
  183. package/dist/llm/tools/bashTool.d.ts +906 -32
  184. package/dist/llm/tools/bashTool.js +30 -4
  185. package/dist/llm/tools/editMatch.d.ts +14 -0
  186. package/dist/llm/tools/editMatch.js +72 -0
  187. package/dist/llm/tools/failures.d.ts +2 -0
  188. package/dist/llm/tools/failures.js +1 -0
  189. package/dist/llm/tools/fetchTool.d.ts +42 -26
  190. package/dist/llm/tools/fetchTool.js +1 -1
  191. package/dist/llm/tools/fileToolShared.d.ts +6 -4
  192. package/dist/llm/tools/fileToolShared.js +18 -23
  193. package/dist/llm/tools/gitIgnore.d.ts +49 -0
  194. package/dist/llm/tools/gitIgnore.js +129 -0
  195. package/dist/llm/tools/grepRunner.d.ts +5 -0
  196. package/dist/llm/tools/grepRunner.js +52 -71
  197. package/dist/llm/tools/outputCap.d.ts +2 -6
  198. package/dist/llm/tools/outputCap.js +2 -6
  199. package/dist/llm/tools/processTool.d.ts +1077 -0
  200. package/dist/llm/tools/processTool.js +41 -0
  201. package/dist/llm/tools/readRecovery.d.ts +10 -0
  202. package/dist/llm/tools/readRecovery.js +135 -0
  203. package/dist/llm/tools/toolContext.d.ts +9 -1
  204. package/dist/llm/tools/toolContext.js +83 -43
  205. package/dist/llm/tools/workspaceFile.d.ts +9 -1
  206. package/dist/llm/tools/workspaceFile.js +33 -4
  207. package/dist/llm/webFetch.d.ts +17 -0
  208. package/dist/llm/webFetch.js +66 -86
  209. package/dist/llm/workerContext.d.ts +18 -0
  210. package/dist/llm/workerContext.js +55 -0
  211. package/dist/skills/SkillLoader.d.ts +2 -2
  212. package/dist/skills/SkillRegistry.d.ts +3 -2
  213. package/dist/skills/SkillRegistry.js +43 -13
  214. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  215. package/dist/skills/builder/SkillBuilder.js +23 -5
  216. package/dist/skills/skillTools.js +11 -4
  217. package/dist/skills/types.d.ts +6 -1
  218. package/dist/ui/codeHighlight.d.ts +4 -0
  219. package/dist/ui/codeHighlight.js +31 -0
  220. package/dist/ui/components/Header.d.ts +1 -1
  221. package/dist/ui/components/MarkdownText.d.ts +16 -2
  222. package/dist/ui/components/MarkdownText.js +244 -34
  223. package/dist/ui/components/TextInput.d.ts +12 -2
  224. package/dist/ui/components/TextInput.js +80 -8
  225. package/dist/ui/theme.d.ts +4 -3
  226. package/dist/ui/theme.js +5 -4
  227. package/dist/utils/buildInfo.d.ts +104 -0
  228. package/dist/utils/buildInfo.js +253 -0
  229. package/dist/utils/format.d.ts +2 -0
  230. package/dist/utils/format.js +8 -0
  231. package/dist/utils/fs.d.ts +9 -1
  232. package/dist/utils/fs.js +87 -29
  233. package/dist/utils/openPath.d.ts +2 -0
  234. package/dist/utils/openPath.js +22 -0
  235. package/dist/utils/path.d.ts +2 -0
  236. package/dist/utils/path.js +5 -1
  237. package/dist/utils/utf8.d.ts +22 -0
  238. package/dist/utils/utf8.js +54 -0
  239. package/dist/utils/version.d.ts +9 -3
  240. package/dist/utils/version.js +28 -2
  241. package/package.json +24 -19
@@ -1,16 +1,91 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useStdout } from 'ink';
2
+ import React from 'react';
3
+ import { Box, Text } from 'ink';
3
4
  import { marked } from 'marked';
4
- import { highlight } from 'cli-highlight';
5
5
  import stripAnsi from 'strip-ansi';
6
6
  import { theme } from '../theme.js';
7
- export function MarkdownText({ content }) {
8
- const tokens = marked.lexer(content, { gfm: true, breaks: true });
9
- const { stdout } = useStdout();
10
- const width = Math.max(20, (stdout.columns ?? process.stdout.columns ?? 100) - 2);
11
- return _jsx(Box, { flexDirection: "column", children: tokens.map((token, index) => _jsx(MarkdownBlock, { token: token, width: width }, index)) });
7
+ import { highlightedCodeLine } from '../codeHighlight.js';
8
+ const MARKED_OPTIONS = { gfm: true, breaks: true };
9
+ export const MarkdownText = React.memo(function MarkdownText({ content, width }) {
10
+ const tokens = marked.lexer(content, MARKED_OPTIONS);
11
+ const contentWidth = Math.max(20, width - 2);
12
+ return _jsx(Box, { flexDirection: "column", children: tokens.map((token, index) => {
13
+ const codeLead = token.type === 'paragraph' || token.type === 'text' ? codeLeadForFollowingFence(tokens, index) : undefined;
14
+ if (token.type === 'space' && bridgesCodeLeadToFence(tokens, index))
15
+ return null;
16
+ return _jsx(MarkdownBlock, { token: token, width: contentWidth, source: token.type === 'code' ? precedingCodeSource(tokens, index) : undefined, textOverride: codeLead?.text, compactAfter: codeLead != null }, index);
17
+ }) });
18
+ });
19
+ /**
20
+ * Bounded LRU cache for Markdown root chunking (RH-007). Settled assistant
21
+ * messages never change, but `partitionDisplayMessages` runs on every render
22
+ * and would otherwise re-lex the entire historical transcript each time. The
23
+ * chunking is a pure function of the source text, so identical content reuses a
24
+ * cached result; the LRU bound keeps memory predictable for long sessions.
25
+ */
26
+ const ROOT_CHUNKS_CACHE_MAX = 500;
27
+ const rootChunksCache = new Map();
28
+ /** Test-only: clear the chunk cache to assert lexer call counts deterministically. */
29
+ export function clearMarkdownRootChunksCacheForTests() {
30
+ rootChunksCache.clear();
31
+ }
32
+ function computeMarkdownRootChunks(content) {
33
+ const tokens = marked.lexer(content, MARKED_OPTIONS);
34
+ if (tokens.length === 0)
35
+ return content ? [content] : [];
36
+ const chunks = [];
37
+ let chunkStart = 0;
38
+ for (let index = 0; index < tokens.length; index++) {
39
+ const token = tokens[index];
40
+ if (!token || token.type === 'space')
41
+ continue;
42
+ let nextIndex = index + 1;
43
+ while (tokens[nextIndex]?.type === 'space')
44
+ nextIndex++;
45
+ if (nextIndex >= tokens.length)
46
+ continue;
47
+ const linkedCodeBlock = (token.type === 'paragraph' || token.type === 'text')
48
+ && tokens[nextIndex]?.type === 'code'
49
+ && codeLeadForFollowingFence(tokens, index) != null;
50
+ if (linkedCodeBlock)
51
+ continue;
52
+ const chunk = tokens.slice(chunkStart, nextIndex).map(item => item.raw).join('');
53
+ if (chunk)
54
+ chunks.push(chunk);
55
+ chunkStart = nextIndex;
56
+ }
57
+ const activeChunk = tokens.slice(chunkStart).map(token => token.raw).join('');
58
+ if (activeChunk)
59
+ chunks.push(activeChunk);
60
+ return chunks;
61
+ }
62
+ /**
63
+ * Split Markdown into stable root-level chunks. The final chunk is deliberately
64
+ * considered active: Marked may still reclassify it as more text arrives (for
65
+ * example, a paragraph can become a setext heading or a GFM table). Once a
66
+ * following root block exists, the preceding chunk is safe to render once in
67
+ * Ink's <Static> transcript.
68
+ *
69
+ * A source-path lead and its following fenced code block stay in one chunk so
70
+ * MarkdownText can preserve their shared filename and starting line metadata.
71
+ */
72
+ export function markdownRootChunks(content) {
73
+ const cached = rootChunksCache.get(content);
74
+ if (cached) {
75
+ rootChunksCache.delete(content);
76
+ rootChunksCache.set(content, cached);
77
+ return cached;
78
+ }
79
+ const chunks = computeMarkdownRootChunks(content);
80
+ if (rootChunksCache.size >= ROOT_CHUNKS_CACHE_MAX) {
81
+ const oldest = rootChunksCache.keys().next().value;
82
+ if (oldest !== undefined)
83
+ rootChunksCache.delete(oldest);
84
+ }
85
+ rootChunksCache.set(content, chunks);
86
+ return chunks;
12
87
  }
13
- function MarkdownBlock({ token, width }) {
88
+ function MarkdownBlock({ token, width, source, textOverride, compactAfter }) {
14
89
  switch (token.type) {
15
90
  case 'heading': {
16
91
  const heading = token;
@@ -18,11 +93,11 @@ function MarkdownBlock({ token, width }) {
18
93
  }
19
94
  case 'paragraph': {
20
95
  const paragraph = token;
21
- return _jsx(Box, { marginBottom: 1, children: _jsx(InlineMarkdown, { text: paragraph.text }) });
96
+ return _jsx(Box, { marginBottom: compactAfter ? 0 : 1, children: _jsx(InlineMarkdown, { text: textOverride ?? paragraph.text }) });
22
97
  }
23
98
  case 'text': {
24
99
  const text = token;
25
- return _jsx(InlineMarkdown, { text: text.text });
100
+ return _jsx(InlineMarkdown, { text: textOverride ?? text.text });
26
101
  }
27
102
  case 'space':
28
103
  return _jsx(Text, { children: " " });
@@ -30,15 +105,16 @@ function MarkdownBlock({ token, width }) {
30
105
  return _jsx(Text, { color: theme.deepPurple, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" });
31
106
  case 'blockquote': {
32
107
  const quote = token;
33
- return _jsx(Box, { flexDirection: "column", marginY: 1, children: quote.text.split('\n').map((line, index) => _jsx(Text, { backgroundColor: theme.quoteBg, children: padAnsi(line || ' ', width) }, index)) });
108
+ return _jsx(Box, { flexDirection: "column", marginY: 1, children: quote.text.split('\n').map((line, index) => _jsx(Text, { backgroundColor: theme.surfaceBg, children: padAnsi(line || ' ', width) }, index)) });
34
109
  }
35
110
  case 'list': {
36
111
  const list = token;
37
- return _jsx(Box, { flexDirection: "column", marginBottom: 1, children: list.items.map((item, index) => _jsxs(Box, { children: [_jsx(Text, { color: theme.purple, children: list.ordered ? `${index + 1}. ` : '• ' }), _jsx(InlineMarkdown, { text: item.text.replace(/\n/g, ' ') })] }, index)) });
112
+ return _jsx(Box, { flexDirection: "column", marginBottom: 1, children: list.items.map((item, index) => (_jsx(ListItemView, { item: item, ordered: list.ordered, index: index, width: width }, index))) });
38
113
  }
39
114
  case 'code': {
40
115
  const code = token;
41
- return _jsx(CodeBlock, { code: code.text, language: code.lang, width: width });
116
+ const fence = parseCodeFenceInfo(code.lang);
117
+ return _jsx(CodeBlock, { code: code.text, language: fence.language, source: fence.source ?? source, width: width });
42
118
  }
43
119
  case 'table': {
44
120
  const table = token;
@@ -49,13 +125,40 @@ function MarkdownBlock({ token, width }) {
49
125
  return _jsx(Text, { children: 'raw' in token ? String(token.raw) : '' });
50
126
  }
51
127
  }
128
+ function ListItemView({ item, ordered, index, width }) {
129
+ const marker = ordered ? `${index + 1}. ` : '• ';
130
+ const markerWidth = visibleLength(marker);
131
+ const blocks = (item.tokens ?? []).filter(child => child.type !== 'space');
132
+ if (blocks.length === 0) {
133
+ return _jsx(Box, { children: _jsx(Text, { color: theme.purple, children: marker }) });
134
+ }
135
+ return _jsx(Box, { flexDirection: "column", children: blocks.map((block, blockIndex) => (_jsx(ListItemBlock, { token: block, marker: blockIndex === 0 ? marker : null, markerWidth: markerWidth, width: width }, blockIndex))) });
136
+ }
137
+ function ListItemBlock({ token, marker, markerWidth, width }) {
138
+ if (token.type === 'paragraph' || token.type === 'text') {
139
+ const text = token.text;
140
+ // Pre-wrap manually. Ink's auto-wrap algorithm injects a stray leading
141
+ // space on wrapped lines at certain widths (the wrap-point whitespace gets
142
+ // preserved on top of the marker indent), so we hand-pack atoms into lines
143
+ // and render each line as its own row. Whitespace is preserved as separate
144
+ // "space" atoms so the original spacing (e.g. "code, code") survives.
145
+ const contentWidth = Math.max(1, width - markerWidth);
146
+ const lines = wrapInlineAtoms(splitInlineIntoAtoms(tokenizeInline(text)), contentWidth);
147
+ const prefix = (lineIndex) => lineIndex === 0 ? (marker ?? ' '.repeat(markerWidth)) : ' '.repeat(markerWidth);
148
+ return _jsx(Box, { flexDirection: "column", children: lines.map((line, lineIndex) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: theme.purple, children: prefix(lineIndex) }) }), _jsx(Text, { children: line.map((atom, atomIndex) => atom.type === 'space' ? _jsx(Text, { children: ' ' }, atomIndex) : renderInlinePart(atom, atomIndex)) })] }, lineIndex))) });
149
+ }
150
+ // Block-level content (code, nested list, blockquote, table). The marker
151
+ // sits on its own line when this is the first block; the block then renders
152
+ // indented to align with the marker.
153
+ return _jsxs(Box, { flexDirection: "column", children: [marker ? _jsx(Text, { color: theme.purple, children: marker }) : null, _jsx(Box, { flexDirection: "column", marginLeft: markerWidth, children: _jsx(MarkdownBlock, { token: token, width: Math.max(20, width - markerWidth) }) })] });
154
+ }
52
155
  function HeadingBlock({ heading, width }) {
53
156
  const title = stripInline(heading.text).trim();
54
157
  if (heading.depth === 1)
55
158
  return _jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [_jsx(Text, { color: theme.purple, bold: true, children: title.toUpperCase() }), _jsx(Text, { color: theme.deepPurple, children: '─'.repeat(Math.min(width, Math.max(12, visibleLength(title)))) })] });
56
159
  if (heading.depth === 2)
57
160
  return _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(Text, { color: theme.purple, bold: true, children: title }) });
58
- return _jsx(Box, { marginTop: heading.depth <= 3 ? 1 : 0, children: _jsx(Text, { color: theme.violet, bold: true, children: title }) });
161
+ return _jsx(Box, { marginTop: heading.depth <= 3 ? 1 : 0, children: _jsx(Text, { color: theme.purple, bold: true, children: title }) });
59
162
  }
60
163
  function TableLine({ line }) {
61
164
  if (isTableBorder(line))
@@ -64,30 +167,137 @@ function TableLine({ line }) {
64
167
  ? _jsx(Text, { color: theme.deepPurple, children: char }, index)
65
168
  : _jsx(Text, { children: char }, index)) });
66
169
  }
67
- function CodeBlock({ code, language, width }) {
68
- let rendered;
69
- try {
70
- rendered = highlight(code, { language: language || undefined, ignoreIllegals: true });
71
- }
72
- catch {
73
- rendered = code;
170
+ function CodeBlock({ code, language, source, width }) {
171
+ const lines = code.replace(/\n$/, '').split('\n');
172
+ const firstLine = source?.startLine ?? 1;
173
+ const showLineNumbers = source != null || lines.length > 1;
174
+ const lineNumberWidth = String(firstLine + lines.length - 1).length;
175
+ const header = source ? `${source.path}:${source.startLine}${language ? ` · ${language}` : ''}` : language;
176
+ return _jsxs(Box, { flexDirection: "column", marginTop: source ? 0 : 1, marginBottom: 1, children: [header ? _jsx(Text, { color: source ? theme.command : theme.muted, backgroundColor: theme.codeBg, children: padAnsi(header, width) }) : null, lines.map((line, index) => {
177
+ const lineNumber = firstLine + index;
178
+ const prefix = showLineNumbers ? `${String(lineNumber).padStart(lineNumberWidth)} │ ` : '';
179
+ const rendered = highlightedCodeLine(line, Math.max(1, width - prefix.length), language);
180
+ return _jsxs(Text, { backgroundColor: theme.codeBg, children: [prefix ? _jsx(Text, { color: theme.muted, backgroundColor: theme.codeBg, children: prefix }) : null, rendered] }, index);
181
+ })] });
182
+ }
183
+ function parseCodeSource(value) {
184
+ const match = /((?:[A-Za-z]:)?[^\s`()]+?\.[A-Za-z0-9]+):([1-9]\d*)(?:-[1-9]\d*)?[).,;:]?$/.exec(stripInline(value).trim());
185
+ if (!match)
186
+ return undefined;
187
+ return { path: match[1], startLine: Number(match[2]) };
188
+ }
189
+ function precedingCodeSource(tokens, codeIndex) {
190
+ for (let index = codeIndex - 1; index >= 0; index--) {
191
+ const token = tokens[index];
192
+ if (!token || token.type === 'space')
193
+ continue;
194
+ if (token.type !== 'paragraph' && token.type !== 'text')
195
+ return undefined;
196
+ return parseCodeSource(token.text);
74
197
  }
75
- const lines = rendered.replace(/\n$/, '').split('\n');
76
- return _jsxs(Box, { flexDirection: "column", marginY: 1, children: [language ? _jsx(Text, { color: theme.muted, backgroundColor: theme.codeBg, children: padAnsi(language, width) }) : null, lines.map((line, index) => _jsx(Text, { backgroundColor: theme.codeBg, children: padAnsi(line || ' ', width) }, index))] });
198
+ return undefined;
199
+ }
200
+ function codeLeadForFollowingFence(tokens, leadIndex) {
201
+ const token = tokens[leadIndex];
202
+ if (!token || (token.type !== 'paragraph' && token.type !== 'text'))
203
+ return undefined;
204
+ const value = token.text;
205
+ const source = parseCodeSource(value);
206
+ if (!source)
207
+ return undefined;
208
+ let nextIndex = leadIndex + 1;
209
+ while (tokens[nextIndex]?.type === 'space')
210
+ nextIndex++;
211
+ if (tokens[nextIndex]?.type !== 'code')
212
+ return undefined;
213
+ const pathIndex = value.lastIndexOf(source.path);
214
+ const text = value.slice(0, pathIndex).replace(/\s*(?:—|–|-)\s*`?\s*$/, '').trimEnd();
215
+ return { source, text };
216
+ }
217
+ function bridgesCodeLeadToFence(tokens, spaceIndex) {
218
+ let previousIndex = spaceIndex - 1;
219
+ while (tokens[previousIndex]?.type === 'space')
220
+ previousIndex--;
221
+ let nextIndex = spaceIndex + 1;
222
+ while (tokens[nextIndex]?.type === 'space')
223
+ nextIndex++;
224
+ return codeLeadForFollowingFence(tokens, previousIndex) != null && tokens[nextIndex]?.type === 'code';
225
+ }
226
+ function parseCodeFenceInfo(info) {
227
+ const parts = info?.trim().split(/\s+/).filter(Boolean) ?? [];
228
+ const firstSource = parts.findIndex(part => parseCodeSource(part) != null);
229
+ if (firstSource === -1)
230
+ return { language: parts[0] };
231
+ return {
232
+ language: firstSource === 0 ? undefined : parts[0],
233
+ source: parseCodeSource(parts[firstSource]),
234
+ };
77
235
  }
78
236
  function InlineMarkdown({ text }) {
79
237
  const parts = tokenizeInline(text);
80
- return _jsx(Text, { children: parts.map((part, index) => {
81
- if (part.kind === 'code')
82
- return _jsx(Text, { color: theme.warning, children: part.text }, index);
83
- if (part.kind === 'strong')
84
- return _jsx(Text, { bold: true, children: part.text }, index);
85
- if (part.kind === 'em')
86
- return _jsx(Text, { italic: true, children: part.text }, index);
87
- if (part.kind === 'link')
88
- return _jsx(Text, { color: theme.violet, children: part.text }, index);
89
- return _jsx(Text, { children: part.text }, index);
90
- }) });
238
+ return _jsx(Text, { children: parts.map((part, index) => renderInlinePart(part, index)) });
239
+ }
240
+ function renderInlinePart(part, index) {
241
+ if (part.kind === 'code')
242
+ return _jsx(Text, { color: theme.warning, backgroundColor: theme.codeBg, children: part.text }, index);
243
+ if (part.kind === 'strong')
244
+ return _jsx(Text, { bold: true, children: part.text }, index);
245
+ if (part.kind === 'em')
246
+ return _jsx(Text, { italic: true, children: part.text }, index);
247
+ if (part.kind === 'link')
248
+ return _jsx(Text, { color: theme.purple, children: part.text }, index);
249
+ return _jsx(Text, { children: part.text }, index);
250
+ }
251
+ function splitInlineIntoAtoms(parts) {
252
+ const atoms = [];
253
+ for (const part of parts) {
254
+ for (const piece of part.text.split(/(\s+)/)) {
255
+ if (piece === '')
256
+ continue;
257
+ if (/^\s+$/.test(piece))
258
+ atoms.push({ type: 'space' });
259
+ else
260
+ atoms.push({ type: 'word', kind: part.kind, text: piece });
261
+ }
262
+ }
263
+ return atoms;
264
+ }
265
+ function wrapInlineAtoms(atoms, maxWidth) {
266
+ const lines = [];
267
+ let line = [];
268
+ let width = 0;
269
+ const flushLine = () => {
270
+ while (line.length > 0 && line[line.length - 1].type === 'space')
271
+ line.pop();
272
+ if (line.length > 0)
273
+ lines.push(line);
274
+ line = [];
275
+ width = 0;
276
+ };
277
+ for (const atom of atoms) {
278
+ if (atom.type === 'space') {
279
+ if (width > 0) {
280
+ line.push(atom);
281
+ width += 1;
282
+ }
283
+ continue;
284
+ }
285
+ const wordWidth = visibleLength(atom.text);
286
+ if (wordWidth > maxWidth && width === 0) {
287
+ // Overlong word on its own line: keep it whole so we don't pretend to
288
+ // have wrap behavior we can't actually render.
289
+ lines.push([atom]);
290
+ line = [];
291
+ width = 0;
292
+ continue;
293
+ }
294
+ if (width > 0 && width + wordWidth > maxWidth)
295
+ flushLine();
296
+ line.push(atom);
297
+ width += wordWidth;
298
+ }
299
+ flushLine();
300
+ return lines.length > 0 ? lines : [[]];
91
301
  }
92
302
  function tokenizeInline(text) {
93
303
  const out = [];
@@ -8,9 +8,11 @@ export declare function shouldInsertNewline(input: string, key: TextInputKey): b
8
8
  export type TextInputSuggestion = {
9
9
  value: string;
10
10
  description?: string;
11
- kind?: 'command' | 'skill' | 'provider' | 'model' | 'lsp' | 'mcp';
11
+ kind?: 'command' | 'skill' | 'provider' | 'model' | 'lsp' | 'mcp' | 'session' | 'file';
12
12
  };
13
- export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }: {
13
+ /** Cursor-aware path completer for `@token` mentions; receives the token verbatim. */
14
+ export type MentionSuggestionsProvider = (token: string) => Promise<TextInputSuggestion[]> | TextInputSuggestion[];
15
+ export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onResumeKey, onSubmit }: {
14
16
  placeholder?: string;
15
17
  disabled?: boolean;
16
18
  mask?: boolean;
@@ -20,10 +22,18 @@ export declare function TextInput({ placeholder, disabled, mask, historyItems, r
20
22
  suggestionMode?: 'slash' | 'always';
21
23
  submitOnEmpty?: boolean;
22
24
  width?: number;
25
+ getMentionSuggestions?: MentionSuggestionsProvider;
23
26
  onHistoryAdd?: (value: string) => void;
24
27
  onCancel?: () => void;
25
28
  onEscape?: () => void;
26
29
  onToggleTasks?: () => void;
30
+ /**
31
+ * One-key resume affordance: when provided and the input is empty, a bare
32
+ * R/R resumes the paused task instead of typing the character. The caller
33
+ * (chat) only provides it while a paused turn is pending and renders the
34
+ * matching hint line, so ordinary typing is unaffected.
35
+ */
36
+ onResumeKey?: () => void;
27
37
  onSubmit: (value: string) => void;
28
38
  }): React.JSX.Element;
29
39
  export {};
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from 'react';
3
3
  import { Box, Text, useInput } from 'ink';
4
4
  import { theme } from '../theme.js';
5
5
  import { compactPasteBlocksForDisplay, cursorPosition, displayCursorForValueCursor, lineCount, normalizeLineEndings, updatePasteBlocksForReplacement, valueCursorForDisplayCursor, wrapDisplayValue, } from '../inputBuffer.js';
6
+ import { detectMentionAtCursor } from '../../cli/chat/fileMentionSuggestions.js';
6
7
  const COMPACT_PASTE_MIN_LINES = 4;
7
8
  const CTRL_ENTER_ESCAPE_INPUTS = new Set(['\u001B[13;5u', '\u001B[13;5~']);
8
9
  export function shouldInsertNewline(input, key) {
@@ -10,11 +11,14 @@ export function shouldInsertNewline(input, key) {
10
11
  || input === '\n'
11
12
  || CTRL_ENTER_ESCAPE_INPUTS.has(input);
12
13
  }
13
- export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }) {
14
+ export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onResumeKey, onSubmit }) {
14
15
  const [value, setValue] = useState('');
15
16
  const [cursor, setCursor] = useState(0);
16
17
  const [pasteBlocks, setPasteBlocks] = useState([]);
17
18
  const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(0);
19
+ const [mentionContext, setMentionContext] = useState();
20
+ const [mentionSuggestions, setMentionSuggestions] = useState([]);
21
+ const [mentionSelectedIndex, setMentionSelectedIndex] = useState(0);
18
22
  const history = useRef(historyItems);
19
23
  const historyIndex = useRef(null);
20
24
  const draft = useRef('');
@@ -40,6 +44,7 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
40
44
  setCursor(Math.max(0, Math.min(nextCursor, next.length)));
41
45
  setPasteBlocks(nextPasteBlocks);
42
46
  setSelectedSuggestionIndex(0);
47
+ setMentionSelectedIndex(0);
43
48
  }
44
49
  function replaceInput(start, end, inserted) {
45
50
  const normalizedInserted = normalizeLineEndings(inserted);
@@ -65,8 +70,36 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
65
70
  return suggestionValue.toLowerCase().includes(suggestionQuery) || suggestion.description?.toLowerCase().includes(suggestionQuery);
66
71
  })
67
72
  .slice(0, 20);
73
+ // `@token` mention detection — only in chat mode (slash) so wizard pickers
74
+ // never grab `@`-prefixed tokens. Detection is sync; suggestion fetch is
75
+ // async with cancellation so fast typing does not race stale results.
76
+ const detectedMention = !mask && suggestionMode === 'slash' && !value.startsWith('/') && getMentionSuggestions
77
+ ? detectMentionAtCursor(value, cursor)
78
+ : undefined;
79
+ useEffect(() => {
80
+ setMentionContext(detectedMention);
81
+ }, [detectedMention?.token, detectedMention?.start, detectedMention?.end]);
82
+ useEffect(() => {
83
+ if (!mentionContext || !getMentionSuggestions) {
84
+ if (mentionSuggestions.length > 0)
85
+ setMentionSuggestions([]);
86
+ return;
87
+ }
88
+ let cancelled = false;
89
+ Promise.resolve(getMentionSuggestions(mentionContext.token))
90
+ .then(results => { if (!cancelled) {
91
+ setMentionSuggestions(results);
92
+ setMentionSelectedIndex(0);
93
+ } })
94
+ .catch(() => { if (!cancelled)
95
+ setMentionSuggestions([]); });
96
+ return () => { cancelled = true; };
97
+ }, [mentionContext?.token, mentionContext?.start, mentionContext?.end]);
98
+ const inMentionMode = !!detectedMention;
99
+ const mentionList = inMentionMode ? mentionSuggestions : [];
100
+ const activeMentionIndex = Math.min(mentionSelectedIndex, Math.max(0, mentionList.length - 1));
68
101
  const activeSuggestionIndex = Math.min(selectedSuggestionIndex, Math.max(0, filteredSuggestions.length - 1));
69
- const activeSuggestion = filteredSuggestions[activeSuggestionIndex];
102
+ const activeSuggestion = inMentionMode ? mentionList[activeMentionIndex] : filteredSuggestions[activeSuggestionIndex];
70
103
  const displayValue = mask ? '•'.repeat(value.length) : compactPasteBlocksForDisplay(value, pasteBlocks);
71
104
  const displayCursor = mask ? cursor : displayCursorForValueCursor(pasteBlocks, cursor);
72
105
  const inputWidth = Math.max(1, width - 2);
@@ -107,7 +140,18 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
107
140
  onEscape?.();
108
141
  return;
109
142
  }
143
+ if (onResumeKey && value.length === 0 && !key.ctrl && !key.meta && (input === 'r' || input === 'R')) {
144
+ onResumeKey();
145
+ return;
146
+ }
110
147
  if (key.tab && activeSuggestion) {
148
+ if (inMentionMode && detectedMention) {
149
+ // Partial replacement of the `@token` range, not the whole input —
150
+ // mention completion fires mid-prompt.
151
+ replaceInput(detectedMention.start, detectedMention.end, activeSuggestion.value);
152
+ historyIndex.current = null;
153
+ return;
154
+ }
111
155
  setInput(activeSuggestion.value);
112
156
  historyIndex.current = null;
113
157
  return;
@@ -117,9 +161,21 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
117
161
  return;
118
162
  }
119
163
  if (key.return) {
120
- const shouldUseSuggestion = activeSuggestion && activeSuggestion.value !== value.trim() && (suggestionMode === 'always' || value.startsWith('/'));
121
- const submitted = shouldUseSuggestion ? activeSuggestion.value : value.trim();
122
- const submittedSuggestion = activeSuggestion?.value === submitted ? activeSuggestion : undefined;
164
+ // Mention mode: complete the `@token` range before submitting, so
165
+ // pressing Enter on `read @packa` with `@package.json` highlighted
166
+ // submits `read @package.json` (matches slash-command behavior).
167
+ let submittedValue;
168
+ let submittedSuggestion;
169
+ if (inMentionMode && detectedMention && activeSuggestion && activeSuggestion.value !== detectedMention.token) {
170
+ submittedValue = value.slice(0, detectedMention.start) + activeSuggestion.value + value.slice(detectedMention.end);
171
+ submittedSuggestion = activeSuggestion;
172
+ }
173
+ else {
174
+ const shouldUseSuggestion = !!activeSuggestion && activeSuggestion.value !== value.trim() && (suggestionMode === 'always' || value.startsWith('/'));
175
+ submittedValue = shouldUseSuggestion && activeSuggestion ? activeSuggestion.value : value;
176
+ submittedSuggestion = shouldUseSuggestion ? activeSuggestion : undefined;
177
+ }
178
+ const submitted = submittedValue.trim();
123
179
  const historyValue = submittedSuggestion && submittedSuggestion.kind !== 'command' ? '' : submitted;
124
180
  setInput('');
125
181
  historyIndex.current = null;
@@ -140,12 +196,19 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
140
196
  return;
141
197
  }
142
198
  if (key.upArrow) {
199
+ if (inMentionMode && mentionList.length > 0) {
200
+ if (activeMentionIndex > 0)
201
+ setMentionSelectedIndex(current => Math.max(0, current - 1));
202
+ return;
203
+ }
143
204
  if (filteredSuggestions.length > 0 && activeSuggestionIndex > 0) {
144
205
  setSelectedSuggestionIndex(current => Math.max(0, current - 1));
145
206
  return;
146
207
  }
147
- if (filteredSuggestions.length === 0 && moveCursorVertically(-1))
208
+ if (filteredSuggestions.length === 0 && !inMentionMode && moveCursorVertically(-1))
148
209
  return;
210
+ if (inMentionMode)
211
+ return; // no history navigation while completing
149
212
  preferredColumn.current = null;
150
213
  if (history.current.length === 0)
151
214
  return;
@@ -159,11 +222,18 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
159
222
  return;
160
223
  }
161
224
  if (key.downArrow) {
225
+ if (inMentionMode && mentionList.length > 0) {
226
+ if (activeMentionIndex < mentionList.length - 1)
227
+ setMentionSelectedIndex(current => Math.min(mentionList.length - 1, current + 1));
228
+ return;
229
+ }
162
230
  if (filteredSuggestions.length > 0 && activeSuggestionIndex < filteredSuggestions.length - 1) {
163
231
  setSelectedSuggestionIndex(current => Math.min(filteredSuggestions.length - 1, current + 1));
164
232
  return;
165
233
  }
166
- if (filteredSuggestions.length === 0 && moveCursorVertically(1))
234
+ if (filteredSuggestions.length === 0 && !inMentionMode && moveCursorVertically(1))
235
+ return;
236
+ if (inMentionMode)
167
237
  return;
168
238
  preferredColumn.current = null;
169
239
  if (historyIndex.current === null)
@@ -212,7 +282,9 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
212
282
  const maxVisibleLines = 4;
213
283
  const firstVisibleLine = Math.max(0, Math.min(currentCursorPosition.lineIndex - maxVisibleLines + 1, wrappedLines.length - maxVisibleLines));
214
284
  const visibleLines = wrappedLines.slice(firstVisibleLine, firstVisibleLine + maxVisibleLines);
215
- return _jsxs(Box, { flexDirection: "column", width: "100%", children: [filteredSuggestions.length > 0 && _jsx(Box, { flexDirection: "column", marginBottom: 1, children: filteredSuggestions.map((suggestion, index) => _jsxs(Text, { color: index === activeSuggestionIndex ? theme.success : theme.muted, wrap: "truncate-end", children: [index === activeSuggestionIndex ? '› ' : ' ', suggestion.value, _jsxs(Text, { color: theme.muted, children: [" ", suggestion.kind ?? 'command', suggestion.description ? ` — ${suggestion.description}` : ''] })] }, suggestion.value)) }), value.length === 0 ? _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: theme.purple, children: "\u203A " }), _jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { color: theme.muted, dimColor: true, children: [" ", placeholder ?? 'Type a message...'] })] }) : visibleLines.map((line, index) => {
285
+ const displayList = inMentionMode ? mentionList : filteredSuggestions;
286
+ const displayActiveIndex = inMentionMode ? activeMentionIndex : activeSuggestionIndex;
287
+ return _jsxs(Box, { flexDirection: "column", width: "100%", children: [displayList.length > 0 && _jsx(Box, { flexDirection: "column", marginBottom: 1, children: displayList.map((suggestion, index) => _jsxs(Text, { color: index === displayActiveIndex ? theme.success : theme.muted, wrap: "truncate-end", children: [index === displayActiveIndex ? '› ' : ' ', suggestion.value, _jsxs(Text, { color: theme.muted, children: [" ", suggestion.kind ?? 'command', suggestion.description ? ` — ${suggestion.description}` : ''] })] }, suggestion.value)) }), value.length === 0 ? _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: theme.purple, children: "\u203A " }), _jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { color: theme.muted, children: [" ", placeholder ?? 'Type a message...'] })] }) : visibleLines.map((line, index) => {
216
288
  const absoluteLineIndex = firstVisibleLine + index;
217
289
  const isCursorLine = absoluteLineIndex === currentCursorPosition.lineIndex;
218
290
  const lineCursor = isCursorLine ? Math.max(0, Math.min(displayCursor - line.start, line.text.length)) : -1;
@@ -1,7 +1,7 @@
1
1
  export declare const theme: {
2
+ foreground: string;
2
3
  purple: string;
3
4
  deepPurple: string;
4
- violet: string;
5
5
  blue: string;
6
6
  muted: string;
7
7
  danger: string;
@@ -9,7 +9,8 @@ export declare const theme: {
9
9
  success: string;
10
10
  successBg: string;
11
11
  warning: string;
12
- orange: string;
12
+ /** Slash commands, paths, and active terminal work; matches --command in docs/index.html. */
13
+ command: string;
14
+ surfaceBg: string;
13
15
  codeBg: string;
14
- quoteBg: string;
15
16
  };
package/dist/ui/theme.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const theme = {
2
+ foreground: 'white',
2
3
  purple: '#a78bfa',
3
4
  deepPurple: '#6d28d9',
4
- violet: '#8b5cf6',
5
5
  blue: '#60a5fa',
6
6
  muted: '#9ca3af',
7
7
  danger: '#fb7185',
@@ -9,7 +9,8 @@ export const theme = {
9
9
  success: '#39ff14',
10
10
  successBg: '#14331f',
11
11
  warning: '#fbbf24',
12
- orange: '#f59e0b',
13
- codeBg: '#1f1633',
14
- quoteBg: '#171127'
12
+ /** Slash commands, paths, and active terminal work; matches --command in docs/index.html. */
13
+ command: '#ffb86c',
14
+ surfaceBg: '#1f1633',
15
+ codeBg: '#202124',
15
16
  };