@nex-ai/nex 0.1.22 → 0.1.23

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 (292) hide show
  1. package/README.md +9 -2
  2. package/dist/agent/adoption.d.ts +23 -0
  3. package/dist/agent/adoption.js +87 -0
  4. package/dist/agent/adoption.js.map +1 -0
  5. package/dist/agent/gossip.d.ts +17 -0
  6. package/dist/agent/gossip.js +48 -0
  7. package/dist/agent/gossip.js.map +1 -0
  8. package/dist/agent/loop.d.ts +59 -0
  9. package/dist/agent/loop.js +389 -0
  10. package/dist/agent/loop.js.map +1 -0
  11. package/dist/agent/queues.d.ts +16 -0
  12. package/dist/agent/queues.js +44 -0
  13. package/dist/agent/queues.js.map +1 -0
  14. package/dist/agent/session-store.d.ts +21 -0
  15. package/dist/agent/session-store.js +96 -0
  16. package/dist/agent/session-store.js.map +1 -0
  17. package/dist/agent/templates.d.ts +5 -0
  18. package/dist/agent/templates.js +48 -0
  19. package/dist/agent/templates.js.map +1 -0
  20. package/dist/agent/tools.d.ts +25 -0
  21. package/dist/agent/tools.js +238 -0
  22. package/dist/agent/tools.js.map +1 -0
  23. package/dist/agent/types.d.ts +59 -0
  24. package/dist/agent/types.js +5 -0
  25. package/dist/agent/types.js.map +1 -0
  26. package/dist/calendar/scheduler.d.ts +32 -0
  27. package/dist/calendar/scheduler.js +178 -0
  28. package/dist/calendar/scheduler.js.map +1 -0
  29. package/dist/calendar/store.d.ts +15 -0
  30. package/dist/calendar/store.js +50 -0
  31. package/dist/calendar/store.js.map +1 -0
  32. package/dist/calendar/types.d.ts +17 -0
  33. package/dist/calendar/types.js +5 -0
  34. package/dist/calendar/types.js.map +1 -0
  35. package/dist/chat/channel.d.ts +20 -0
  36. package/dist/chat/channel.js +84 -0
  37. package/dist/chat/channel.js.map +1 -0
  38. package/dist/chat/message-store.d.ts +18 -0
  39. package/dist/chat/message-store.js +82 -0
  40. package/dist/chat/message-store.js.map +1 -0
  41. package/dist/chat/router.d.ts +17 -0
  42. package/dist/chat/router.js +65 -0
  43. package/dist/chat/router.js.map +1 -0
  44. package/dist/chat/suggested-responses.d.ts +6 -0
  45. package/dist/chat/suggested-responses.js +99 -0
  46. package/dist/chat/suggested-responses.js.map +1 -0
  47. package/dist/chat/types.d.ts +28 -0
  48. package/dist/chat/types.js +5 -0
  49. package/dist/chat/types.js.map +1 -0
  50. package/dist/cli.js +3 -1
  51. package/dist/cli.js.map +1 -1
  52. package/dist/commands/dispatch.d.ts +39 -0
  53. package/dist/commands/dispatch.js +1293 -0
  54. package/dist/commands/dispatch.js.map +1 -0
  55. package/dist/commands/init.d.ts +49 -0
  56. package/dist/commands/init.js +315 -0
  57. package/dist/commands/init.js.map +1 -0
  58. package/dist/commands/parse-input.d.ts +5 -0
  59. package/dist/commands/parse-input.js +37 -0
  60. package/dist/commands/parse-input.js.map +1 -0
  61. package/dist/index.d.ts +6 -23
  62. package/dist/index.js +118 -50
  63. package/dist/index.js.map +1 -1
  64. package/dist/lib/client.js +1 -1
  65. package/dist/lib/client.js.map +1 -1
  66. package/dist/lib/errors.js +1 -1
  67. package/dist/lib/errors.js.map +1 -1
  68. package/dist/lib/integrations.d.ts +23 -0
  69. package/dist/lib/integrations.js +25 -0
  70. package/dist/lib/integrations.js.map +1 -0
  71. package/dist/lib/nex-mcp-config.d.ts +14 -0
  72. package/dist/lib/nex-mcp-config.js +26 -0
  73. package/dist/lib/nex-mcp-config.js.map +1 -0
  74. package/dist/orchestration/budget.d.ts +32 -0
  75. package/dist/orchestration/budget.js +72 -0
  76. package/dist/orchestration/budget.js.map +1 -0
  77. package/dist/orchestration/executor.d.ts +59 -0
  78. package/dist/orchestration/executor.js +197 -0
  79. package/dist/orchestration/executor.js.map +1 -0
  80. package/dist/orchestration/router.d.ts +30 -0
  81. package/dist/orchestration/router.js +98 -0
  82. package/dist/orchestration/router.js.map +1 -0
  83. package/dist/orchestration/templates.d.ts +11 -0
  84. package/dist/orchestration/templates.js +99 -0
  85. package/dist/orchestration/templates.js.map +1 -0
  86. package/dist/orchestration/types.d.ts +58 -0
  87. package/dist/orchestration/types.js +7 -0
  88. package/dist/orchestration/types.js.map +1 -0
  89. package/dist/plugin/shared.js +1 -1
  90. package/dist/plugin/shared.js.map +1 -1
  91. package/dist/tui/agent-colors.d.ts +19 -0
  92. package/dist/tui/agent-colors.js +34 -0
  93. package/dist/tui/agent-colors.js.map +1 -0
  94. package/dist/tui/app.d.ts +14 -0
  95. package/dist/tui/app.js +267 -0
  96. package/dist/tui/app.js.map +1 -0
  97. package/dist/tui/channel-colors.d.ts +16 -0
  98. package/dist/tui/channel-colors.js +43 -0
  99. package/dist/tui/channel-colors.js.map +1 -0
  100. package/dist/tui/components/agent-card.d.ts +11 -0
  101. package/dist/tui/components/agent-card.js +40 -0
  102. package/dist/tui/components/agent-card.js.map +1 -0
  103. package/dist/tui/components/banner.d.ts +44 -0
  104. package/dist/tui/components/banner.js +130 -0
  105. package/dist/tui/components/banner.js.map +1 -0
  106. package/dist/tui/components/channel-colors.d.ts +21 -0
  107. package/dist/tui/components/channel-colors.js +53 -0
  108. package/dist/tui/components/channel-colors.js.map +1 -0
  109. package/dist/tui/components/channel-message.d.ts +53 -0
  110. package/dist/tui/components/channel-message.js +66 -0
  111. package/dist/tui/components/channel-message.js.map +1 -0
  112. package/dist/tui/components/chat-input.d.ts +11 -0
  113. package/dist/tui/components/chat-input.js +19 -0
  114. package/dist/tui/components/chat-input.js.map +1 -0
  115. package/dist/tui/components/data-table.d.ts +11 -0
  116. package/dist/tui/components/data-table.js +47 -0
  117. package/dist/tui/components/data-table.js.map +1 -0
  118. package/dist/tui/components/error-box.d.ts +11 -0
  119. package/dist/tui/components/error-box.js +59 -0
  120. package/dist/tui/components/error-box.js.map +1 -0
  121. package/dist/tui/components/help-screen.d.ts +3 -0
  122. package/dist/tui/components/help-screen.js +63 -0
  123. package/dist/tui/components/help-screen.js.map +1 -0
  124. package/dist/tui/components/index.d.ts +17 -0
  125. package/dist/tui/components/index.js +10 -0
  126. package/dist/tui/components/index.js.map +1 -0
  127. package/dist/tui/components/inline-confirm.d.ts +14 -0
  128. package/dist/tui/components/inline-confirm.js +13 -0
  129. package/dist/tui/components/inline-confirm.js.map +1 -0
  130. package/dist/tui/components/inline-select.d.ts +21 -0
  131. package/dist/tui/components/inline-select.js +20 -0
  132. package/dist/tui/components/inline-select.js.map +1 -0
  133. package/dist/tui/components/markdown.d.ts +6 -0
  134. package/dist/tui/components/markdown.js +179 -0
  135. package/dist/tui/components/markdown.js.map +1 -0
  136. package/dist/tui/components/mention-autocomplete.d.ts +77 -0
  137. package/dist/tui/components/mention-autocomplete.js +235 -0
  138. package/dist/tui/components/mention-autocomplete.js.map +1 -0
  139. package/dist/tui/components/message-list.d.ts +18 -0
  140. package/dist/tui/components/message-list.js +29 -0
  141. package/dist/tui/components/message-list.js.map +1 -0
  142. package/dist/tui/components/picker.d.ts +16 -0
  143. package/dist/tui/components/picker.js +32 -0
  144. package/dist/tui/components/picker.js.map +1 -0
  145. package/dist/tui/components/progress-steps.d.ts +13 -0
  146. package/dist/tui/components/progress-steps.js +21 -0
  147. package/dist/tui/components/progress-steps.js.map +1 -0
  148. package/dist/tui/components/slack/compose.d.ts +27 -0
  149. package/dist/tui/components/slack/compose.js +123 -0
  150. package/dist/tui/components/slack/compose.js.map +1 -0
  151. package/dist/tui/components/slack/layout.d.ts +36 -0
  152. package/dist/tui/components/slack/layout.js +96 -0
  153. package/dist/tui/components/slack/layout.js.map +1 -0
  154. package/dist/tui/components/slack/messages.d.ts +72 -0
  155. package/dist/tui/components/slack/messages.js +177 -0
  156. package/dist/tui/components/slack/messages.js.map +1 -0
  157. package/dist/tui/components/slack/quick-switcher.d.ts +33 -0
  158. package/dist/tui/components/slack/quick-switcher.js +98 -0
  159. package/dist/tui/components/slack/quick-switcher.js.map +1 -0
  160. package/dist/tui/components/slack/sidebar-types.d.ts +65 -0
  161. package/dist/tui/components/slack/sidebar-types.js +7 -0
  162. package/dist/tui/components/slack/sidebar-types.js.map +1 -0
  163. package/dist/tui/components/slack/sidebar.d.ts +46 -0
  164. package/dist/tui/components/slack/sidebar.js +52 -0
  165. package/dist/tui/components/slack/sidebar.js.map +1 -0
  166. package/dist/tui/components/slack/thread-panel.d.ts +45 -0
  167. package/dist/tui/components/slack/thread-panel.js +47 -0
  168. package/dist/tui/components/slack/thread-panel.js.map +1 -0
  169. package/dist/tui/components/slash-autocomplete.d.ts +81 -0
  170. package/dist/tui/components/slash-autocomplete.js +218 -0
  171. package/dist/tui/components/slash-autocomplete.js.map +1 -0
  172. package/dist/tui/components/spinner.d.ts +17 -0
  173. package/dist/tui/components/spinner.js +30 -0
  174. package/dist/tui/components/spinner.js.map +1 -0
  175. package/dist/tui/components/status-bar.d.ts +23 -0
  176. package/dist/tui/components/status-bar.js +55 -0
  177. package/dist/tui/components/status-bar.js.map +1 -0
  178. package/dist/tui/components/success-box.d.ts +7 -0
  179. package/dist/tui/components/success-box.js +10 -0
  180. package/dist/tui/components/success-box.js.map +1 -0
  181. package/dist/tui/components/tool-indicator.d.ts +12 -0
  182. package/dist/tui/components/tool-indicator.js +18 -0
  183. package/dist/tui/components/tool-indicator.js.map +1 -0
  184. package/dist/tui/components/viewport.d.ts +9 -0
  185. package/dist/tui/components/viewport.js +24 -0
  186. package/dist/tui/components/viewport.js.map +1 -0
  187. package/dist/tui/generative/bindings.d.ts +27 -0
  188. package/dist/tui/generative/bindings.js +152 -0
  189. package/dist/tui/generative/bindings.js.map +1 -0
  190. package/dist/tui/generative/registry.d.ts +19 -0
  191. package/dist/tui/generative/registry.js +31 -0
  192. package/dist/tui/generative/registry.js.map +1 -0
  193. package/dist/tui/generative/renderer.d.ts +24 -0
  194. package/dist/tui/generative/renderer.js +160 -0
  195. package/dist/tui/generative/renderer.js.map +1 -0
  196. package/dist/tui/generative/types.d.ts +68 -0
  197. package/dist/tui/generative/types.js +7 -0
  198. package/dist/tui/generative/types.js.map +1 -0
  199. package/dist/tui/hooks/use-cancellable.d.ts +28 -0
  200. package/dist/tui/hooks/use-cancellable.js +51 -0
  201. package/dist/tui/hooks/use-cancellable.js.map +1 -0
  202. package/dist/tui/hooks/use-streaming.d.ts +44 -0
  203. package/dist/tui/hooks/use-streaming.js +105 -0
  204. package/dist/tui/hooks/use-streaming.js.map +1 -0
  205. package/dist/tui/index.d.ts +4 -0
  206. package/dist/tui/index.js +7 -0
  207. package/dist/tui/index.js.map +1 -0
  208. package/dist/tui/keybindings.d.ts +25 -0
  209. package/dist/tui/keybindings.js +277 -0
  210. package/dist/tui/keybindings.js.map +1 -0
  211. package/dist/tui/register-views.d.ts +8 -0
  212. package/dist/tui/register-views.js +116 -0
  213. package/dist/tui/register-views.js.map +1 -0
  214. package/dist/tui/router.d.ts +29 -0
  215. package/dist/tui/router.js +87 -0
  216. package/dist/tui/router.js.map +1 -0
  217. package/dist/tui/services/agent-service.d.ts +58 -0
  218. package/dist/tui/services/agent-service.js +197 -0
  219. package/dist/tui/services/agent-service.js.map +1 -0
  220. package/dist/tui/services/calendar-service.d.ts +31 -0
  221. package/dist/tui/services/calendar-service.js +133 -0
  222. package/dist/tui/services/calendar-service.js.map +1 -0
  223. package/dist/tui/services/chat-service.d.ts +28 -0
  224. package/dist/tui/services/chat-service.js +91 -0
  225. package/dist/tui/services/chat-service.js.map +1 -0
  226. package/dist/tui/services/orchestration-service.d.ts +42 -0
  227. package/dist/tui/services/orchestration-service.js +153 -0
  228. package/dist/tui/services/orchestration-service.js.map +1 -0
  229. package/dist/tui/slash-commands.d.ts +106 -0
  230. package/dist/tui/slash-commands.js +1421 -0
  231. package/dist/tui/slash-commands.js.map +1 -0
  232. package/dist/tui/store.d.ts +96 -0
  233. package/dist/tui/store.js +120 -0
  234. package/dist/tui/store.js.map +1 -0
  235. package/dist/tui/theme.d.ts +40 -0
  236. package/dist/tui/theme.js +39 -0
  237. package/dist/tui/theme.js.map +1 -0
  238. package/dist/tui/tui-context.d.ts +22 -0
  239. package/dist/tui/tui-context.js +17 -0
  240. package/dist/tui/tui-context.js.map +1 -0
  241. package/dist/tui/views/agent-list.d.ts +8 -0
  242. package/dist/tui/views/agent-list.js +11 -0
  243. package/dist/tui/views/agent-list.js.map +1 -0
  244. package/dist/tui/views/ask-chat.d.ts +9 -0
  245. package/dist/tui/views/ask-chat.js +40 -0
  246. package/dist/tui/views/ask-chat.js.map +1 -0
  247. package/dist/tui/views/calendar.d.ts +15 -0
  248. package/dist/tui/views/calendar.js +29 -0
  249. package/dist/tui/views/calendar.js.map +1 -0
  250. package/dist/tui/views/chat.d.ts +18 -0
  251. package/dist/tui/views/chat.js +28 -0
  252. package/dist/tui/views/chat.js.map +1 -0
  253. package/dist/tui/views/generative.d.ts +14 -0
  254. package/dist/tui/views/generative.js +37 -0
  255. package/dist/tui/views/generative.js.map +1 -0
  256. package/dist/tui/views/help.d.ts +6 -0
  257. package/dist/tui/views/help.js +9 -0
  258. package/dist/tui/views/help.js.map +1 -0
  259. package/dist/tui/views/home-screen.d.ts +67 -0
  260. package/dist/tui/views/home-screen.js +192 -0
  261. package/dist/tui/views/home-screen.js.map +1 -0
  262. package/dist/tui/views/home.d.ts +33 -0
  263. package/dist/tui/views/home.js +60 -0
  264. package/dist/tui/views/home.js.map +1 -0
  265. package/dist/tui/views/index.d.ts +20 -0
  266. package/dist/tui/views/index.js +11 -0
  267. package/dist/tui/views/index.js.map +1 -0
  268. package/dist/tui/views/insights.d.ts +19 -0
  269. package/dist/tui/views/insights.js +46 -0
  270. package/dist/tui/views/insights.js.map +1 -0
  271. package/dist/tui/views/orchestration.d.ts +18 -0
  272. package/dist/tui/views/orchestration.js +73 -0
  273. package/dist/tui/views/orchestration.js.map +1 -0
  274. package/dist/tui/views/record-detail.d.ts +10 -0
  275. package/dist/tui/views/record-detail.js +22 -0
  276. package/dist/tui/views/record-detail.js.map +1 -0
  277. package/dist/tui/views/record-list.d.ts +15 -0
  278. package/dist/tui/views/record-list.js +22 -0
  279. package/dist/tui/views/record-list.js.map +1 -0
  280. package/dist/tui/views/slack-channel-header.d.ts +15 -0
  281. package/dist/tui/views/slack-channel-header.js +16 -0
  282. package/dist/tui/views/slack-channel-header.js.map +1 -0
  283. package/dist/tui/views/slack-home.d.ts +21 -0
  284. package/dist/tui/views/slack-home.js +572 -0
  285. package/dist/tui/views/slack-home.js.map +1 -0
  286. package/dist/tui/views/task-board.d.ts +21 -0
  287. package/dist/tui/views/task-board.js +33 -0
  288. package/dist/tui/views/task-board.js.map +1 -0
  289. package/dist/tui/views/timeline.d.ts +17 -0
  290. package/dist/tui/views/timeline.js +24 -0
  291. package/dist/tui/views/timeline.js.map +1 -0
  292. package/package.json +8 -3
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box, Text } from "ink";
4
+ import { MessageList } from "../components/message-list.js";
5
+ import { ChatInput } from "../components/chat-input.js";
6
+ import { getChannelColor } from "../channel-colors.js";
7
+ // --- Component ---
8
+ export function ChatView({ channels, messages, activeChannel, mode = "normal", onSend, onChannelSelect: _onChannelSelect, }) {
9
+ const [inputValue, setInputValue] = useState("");
10
+ const selectedChannel = activeChannel ?? channels[0]?.id;
11
+ const selectedChannelName = channels.find((c) => c.id === selectedChannel)?.name ?? "";
12
+ const channelMessages = messages.filter((m) => !m.channel || m.channel === selectedChannel);
13
+ const handleSubmit = (value) => {
14
+ if (!value.trim() || !selectedChannel)
15
+ return;
16
+ onSend?.(value, selectedChannel);
17
+ setInputValue("");
18
+ };
19
+ // Resolve channel color for message list
20
+ const chColor = selectedChannelName ? getChannelColor(selectedChannelName) : undefined;
21
+ return (_jsxs(Box, { flexDirection: "row", width: "100%", children: [_jsxs(Box, { flexDirection: "column", width: 20, borderStyle: "single", borderRight: true, borderTop: false, borderBottom: false, borderLeft: false, paddingX: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Channels" }) }), channels.map((ch) => {
22
+ const isActive = ch.id === selectedChannel;
23
+ const color = getChannelColor(ch.name);
24
+ return (_jsxs(Box, { children: [_jsxs(Text, { bold: isActive, color: color, dimColor: !isActive, children: [isActive ? "> " : " ", "#", ch.name] }), ch.unread > 0 && (_jsx(Text, { color: "red", bold: true, children: ` (${ch.unread})` }))] }, ch.id));
25
+ }), channels.length === 0 && (_jsx(Text, { dimColor: true, children: "No channels" }))] }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [selectedChannelName && (_jsx(Box, { paddingX: 1, marginBottom: 1, children: _jsxs(Text, { bold: true, color: chColor, children: ["#", selectedChannelName] }) })), _jsx(Box, { flexGrow: 1, flexDirection: "column", children: _jsx(MessageList, { messages: channelMessages, channelColor: chColor, channelName: selectedChannelName }) }), _jsx(Box, { paddingX: 1, marginTop: 1, children: _jsx(ChatInput, { value: inputValue, onChange: setInputValue, onSubmit: handleSubmit, prefix: `#${selectedChannelName}> `, placeholder: "Type a message...", isActive: true }) })] })] }));
26
+ }
27
+ export default ChatView;
28
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/tui/views/chat.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmBvD,oBAAoB;AAEpB,MAAM,UAAU,QAAQ,CAAC,EACvB,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,IAAI,GAAG,QAAQ,EACf,MAAM,EACN,eAAe,EAAE,gBAAgB,GACnB;IACd,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEjD,MAAM,e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C,WAAW,EAAC,mBAAmB,EAC/B,QAAQ,EAAE,IAAI,GACd,GACE,IACF,IACF,CACP,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generative view wrapper.
3
+ * Wraps the GenerativeRenderer with a title bar, error boundary,
4
+ * and back-navigation hint for use as a routed TUI view.
5
+ */
6
+ import React from 'react';
7
+ import type { A2UIComponent, A2UIDataModel } from '../generative/types.js';
8
+ export interface GenerativeViewProps {
9
+ schema: A2UIComponent;
10
+ data: A2UIDataModel;
11
+ title?: string;
12
+ onAction?: (action: string, payload?: unknown) => void;
13
+ }
14
+ export declare function GenerativeView({ schema, data, title, onAction, }: GenerativeViewProps): React.JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Generative view wrapper.
4
+ * Wraps the GenerativeRenderer with a title bar, error boundary,
5
+ * and back-navigation hint for use as a routed TUI view.
6
+ */
7
+ import React from 'react';
8
+ import { Box, Text } from 'ink';
9
+ import { GenerativeRenderer, validateSchema } from '../generative/renderer.js';
10
+ class SchemaErrorBoundary extends React.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ this.state = { hasError: false };
14
+ }
15
+ static getDerivedStateFromError(error) {
16
+ return { hasError: true, error };
17
+ }
18
+ render() {
19
+ if (this.state.hasError) {
20
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { color: "red", bold: true, children: "Render Error" }), _jsx(Text, { color: "red", children: this.state.error?.message ?? 'An unexpected error occurred while rendering the schema.' }), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: "[Esc=back]" })] }));
21
+ }
22
+ return this.props.children;
23
+ }
24
+ }
25
+ // ── Main view ──
26
+ export function GenerativeView({ schema, data, title, onAction, }) {
27
+ // Pre-validate before rendering
28
+ if (!schema) {
29
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { color: "red", bold: true, children: "No Schema" }), _jsx(Text, { color: "gray", children: "No A2UI schema was provided to render." }), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: "[Esc=back]" })] }));
30
+ }
31
+ const validation = validateSchema(schema);
32
+ if (!validation.valid) {
33
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [title && (_jsx(Text, { bold: true, color: "cyan", children: title })), _jsx(Text, { color: "red", bold: true, children: "Invalid Schema" }), validation.errors?.map((err, i) => (_jsxs(Text, { color: "red", children: [' ', "- ", err] }, i))), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: "[Esc=back]" })] }));
34
+ }
35
+ return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [title && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: title }) })), _jsx(SchemaErrorBoundary, { children: _jsx(GenerativeRenderer, { schema: schema, data: data ?? {}, onAction: onAction }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "[Esc=back]" }) })] }));
36
+ }
37
+ //# sourceMappingURL=generative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative.js","sourceRoot":"","sources":["../../../src/tui/views/generative.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmB/E,MAAM,mBAAoB,SAAQ,KAAK,CAAC,SAGvC;IACC,YAAY,KAAoC;QAC9C,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC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ACpB,KAAK,GACD,CACR,EACD,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,EAAC,IAAI,qCAEf,EACN,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAClC,MAAC,IAAI,IAAS,KAAK,EAAC,KAAK,aACtB,IAAI,QAAI,GAAG,KADH,CAAC,CAEL,CACR,CAAC,EACF,KAAC,GAAG,IAAC,MAAM,EAAE,CAAC,GAAI,EAClB,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,2BAAkB,IAChC,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,aAEpC,KAAK,IAAI,CACR,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YAClB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,YACpB,KAAK,GACD,GACH,CACP,EAGD,KAAC,mBAAmB,cAClB,KAAC,kBAAkB,IACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,IAAI,EAAE,EAChB,QAAQ,EAAE,QAAQ,GAClB,GACkB,EAGtB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,2BAAkB,GAChC,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export interface HelpViewProps {
3
+ onBack?: () => void;
4
+ }
5
+ export declare function HelpView({ onBack: _onBack, }: HelpViewProps): React.JSX.Element;
6
+ export default HelpView;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from "ink";
3
+ import { HelpScreen } from "../components/help-screen.js";
4
+ // --- Component ---
5
+ export function HelpView({ onBack: _onBack, }) {
6
+ return (_jsxs(Box, { flexDirection: "column", width: "100%", children: [_jsx(Box, { paddingX: 2, marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Nex CLI Help" }) }), _jsx(HelpScreen, {})] }));
7
+ }
8
+ export default HelpView;
9
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/tui/views/help.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ1D,oBAAoB;AAEpB,MAAM,UAAU,QAAQ,CAAC,EACvB,MAAM,EAAE,OAAO,GACD;IACd,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,KAAK,EAAC,MAAM,aAEtC,KAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,YAC/B,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,YACpB,cAAc,GACV,GACH,EAGN,KAAC,UAAU,KAAG,IACV,CACP,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Unified home screen — channel chat + compact calendar strip.
3
+ *
4
+ * Layout (top → bottom):
5
+ * ┌─ ChannelBar ────────────────────────────────────────┐
6
+ * │ #general ◀ Tab ▶ #leads #seo │
7
+ * ├─ MessageArea ───────────────────────────────────────┤
8
+ * │ [SEO Analyst] Found 3 new keyword opportunities │
9
+ * │ > you: Great, focus on the keyword opportunities │
10
+ * ├─ CalendarStrip (collapsible) ───────────────────────┤
11
+ * │ Today Tomorrow Wed │
12
+ * │ ■ 09:00 SEO ■ 10:00 Lead ■ 09:00 Research │
13
+ * ├─ InputBar ──────────────────────────────────────────┤
14
+ * │ > Type a message... │
15
+ * └────────────────────────────────────────────────────-┘
16
+ */
17
+ import React from "react";
18
+ import type { SelectOption } from "../components/inline-select.js";
19
+ import type { SlashCommandEntry } from "../components/slash-autocomplete.js";
20
+ import type { AgentEntry } from "../components/mention-autocomplete.js";
21
+ export interface HomeChannel {
22
+ id: string;
23
+ name: string;
24
+ unread: number;
25
+ }
26
+ export interface HomeMessage {
27
+ id: string;
28
+ sender: string;
29
+ senderType: "agent" | "human" | "system";
30
+ content: string;
31
+ timestamp: number;
32
+ channelName?: string;
33
+ isError?: boolean;
34
+ }
35
+ export interface HomeCalendarEvent {
36
+ agentName: string;
37
+ agentColor: string;
38
+ time: string;
39
+ day: string;
40
+ }
41
+ export interface PickerState {
42
+ title: string;
43
+ options: SelectOption[];
44
+ onSelect: (value: string) => void;
45
+ }
46
+ export interface ConfirmState {
47
+ question: string;
48
+ onConfirm: (confirmed: boolean) => void;
49
+ }
50
+ export interface HomeScreenProps {
51
+ channels: HomeChannel[];
52
+ activeChannelId: string;
53
+ messages: HomeMessage[];
54
+ onSend: (content: string) => void;
55
+ onChannelChange: (channelId: string) => void;
56
+ calendarEvents: HomeCalendarEvent[];
57
+ showCalendar: boolean;
58
+ slashCommands?: SlashCommandEntry[];
59
+ agents?: AgentEntry[];
60
+ isLoading?: boolean;
61
+ loadingHint?: string;
62
+ isTmux?: boolean;
63
+ picker?: PickerState | null;
64
+ confirm?: ConfirmState | null;
65
+ }
66
+ export declare function HomeScreen({ channels, activeChannelId, messages, onSend, onChannelChange: _onChannelChange, calendarEvents, showCalendar, slashCommands, agents, isLoading, loadingHint, isTmux, picker, confirm, }: HomeScreenProps): React.JSX.Element;
67
+ export default HomeScreen;
@@ -0,0 +1,192 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Unified home screen — channel chat + compact calendar strip.
4
+ *
5
+ * Layout (top → bottom):
6
+ * ┌─ ChannelBar ────────────────────────────────────────┐
7
+ * │ #general ◀ Tab ▶ #leads #seo │
8
+ * ├─ MessageArea ───────────────────────────────────────┤
9
+ * │ [SEO Analyst] Found 3 new keyword opportunities │
10
+ * │ > you: Great, focus on the keyword opportunities │
11
+ * ├─ CalendarStrip (collapsible) ───────────────────────┤
12
+ * │ Today Tomorrow Wed │
13
+ * │ ■ 09:00 SEO ■ 10:00 Lead ■ 09:00 Research │
14
+ * ├─ InputBar ──────────────────────────────────────────┤
15
+ * │ > Type a message... │
16
+ * └────────────────────────────────────────────────────-┘
17
+ */
18
+ import React, { useState, useMemo, useEffect, useCallback } from "react";
19
+ import { Box, Text, useStdout } from "ink";
20
+ import { TextInput } from "@inkjs/ui";
21
+ import { getAgentColor } from "../agent-colors.js";
22
+ import { getChannelColor } from "../channel-colors.js";
23
+ import { InlineSelect } from "../components/inline-select.js";
24
+ import { InlineConfirm } from "../components/inline-confirm.js";
25
+ import { useSlashAutocomplete, SlashAutocomplete, } from "../components/slash-autocomplete.js";
26
+ import { useMentionAutocomplete, MentionAutocomplete, } from "../components/mention-autocomplete.js";
27
+ import { Markdown } from "../components/markdown.js";
28
+ import { Spinner } from "../components/spinner.js";
29
+ import { ErrorBox, categorizeError } from "../components/error-box.js";
30
+ import { Banner } from "../components/banner.js";
31
+ // ── Helpers ──────────────────────────────────────────────────────────
32
+ function formatTime(ts) {
33
+ const d = new Date(ts);
34
+ const h = String(d.getHours()).padStart(2, "0");
35
+ const m = String(d.getMinutes()).padStart(2, "0");
36
+ return `${h}:${m}`;
37
+ }
38
+ // ── Sub-components ───────────────────────────────────────────────────
39
+ /** Horizontal tab strip showing channel names. */
40
+ function ChannelBar({ channels, activeChannelId, }) {
41
+ return (_jsxs(Box, { paddingX: 1, children: [channels.map((ch, idx) => {
42
+ const isActive = ch.id === activeChannelId;
43
+ const chColor = getChannelColor(ch.name);
44
+ return (_jsxs(React.Fragment, { children: [idx > 0 && _jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { bold: isActive, color: chColor, dimColor: !isActive, children: ["#", ch.name] }), ch.unread > 0 && (_jsx(Text, { color: "red", bold: true, children: ` (${ch.unread})` }))] }, ch.id));
45
+ }), channels.length > 1 && (_jsx(Text, { dimColor: true, children: " [Tab=switch]" }))] }));
46
+ }
47
+ /** A single message row with channel-colored left border and agent-coloured prefix. */
48
+ function AgentMessage({ msg, channelColor }) {
49
+ const borderColor = channelColor ?? "gray";
50
+ if (msg.senderType === "system") {
51
+ return (_jsxs(Box, { paddingX: 1, children: [_jsx(Text, { color: borderColor, children: "\u2502 " }), _jsx(Text, { color: "yellow", dimColor: true, children: msg.content })] }));
52
+ }
53
+ if (msg.senderType === "human") {
54
+ // User messages: white text, subtle gray background (like Claude Code)
55
+ return (_jsxs(Box, { paddingX: 1, children: [_jsx(Text, { color: borderColor, children: "\u2502 " }), _jsx(Text, { dimColor: true, children: formatTime(msg.timestamp) }), _jsx(Text, { children: " " }), _jsx(Text, { bold: true, color: "white", backgroundColor: "gray", children: " > " }), _jsxs(Text, { color: "white", children: [" ", msg.content] })] }));
56
+ }
57
+ // Agent/nex response — render via Markdown or ErrorBox
58
+ const isError = msg.isError || msg.content.startsWith("Error:");
59
+ const agentColor = getAgentColor(msg.sender);
60
+ return (_jsxs(Box, { paddingX: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: borderColor, children: "\u2502 " }), _jsx(Text, { dimColor: true, children: formatTime(msg.timestamp) }), _jsx(Text, { children: " " }), _jsxs(Text, { bold: true, color: agentColor, children: ["[", msg.sender, "]"] })] }), _jsx(Box, { paddingLeft: 4, children: isError ? (_jsx(ErrorBox, { message: msg.content, category: categorizeError(new Error(msg.content)) })) : (_jsx(Markdown, { content: msg.content })) })] }));
61
+ }
62
+ /** Compact 3-day calendar strip. */
63
+ function CalendarStrip({ events }) {
64
+ // Group events by day column
65
+ const dayOrder = [...new Set(events.map((e) => e.day))].slice(0, 3);
66
+ if (dayOrder.length === 0) {
67
+ return (_jsx(Box, { paddingX: 2, children: _jsx(Text, { dimColor: true, children: "No upcoming events." }) }));
68
+ }
69
+ // Collect events per day
70
+ const byDay = new Map();
71
+ for (const day of dayOrder) {
72
+ byDay.set(day, events.filter((e) => e.day === day));
73
+ }
74
+ // Find max row count
75
+ const maxRows = Math.max(...Array.from(byDay.values()).map((v) => v.length), 0);
76
+ const colWidth = 18;
77
+ return (_jsxs(Box, { flexDirection: "column", paddingX: 2, children: [_jsx(Box, { children: dayOrder.map((day) => (_jsx(Box, { width: colWidth, children: _jsx(Text, { bold: true, dimColor: true, children: day }) }, day))) }), Array.from({ length: Math.min(maxRows, 4) }, (_, rowIdx) => (_jsx(Box, { children: dayOrder.map((day) => {
78
+ const dayEvents = byDay.get(day) ?? [];
79
+ const ev = dayEvents[rowIdx];
80
+ if (!ev) {
81
+ return (_jsx(Box, { width: colWidth, children: _jsx(Text, { children: " " }) }, day));
82
+ }
83
+ return (_jsxs(Box, { width: colWidth, children: [_jsx(Text, { color: ev.agentColor, children: "\u25A0 " }), _jsx(Text, { dimColor: true, children: ev.time }), _jsx(Text, { children: " " }), _jsx(Text, { color: ev.agentColor, children: ev.agentName.slice(0, 8) })] }, day));
84
+ }) }, rowIdx)))] }));
85
+ }
86
+ // ── Main component ───────────────────────────────────────────────────
87
+ export function HomeScreen({ channels, activeChannelId, messages, onSend, onChannelChange: _onChannelChange, calendarEvents, showCalendar, slashCommands = [], agents = [], isLoading = false, loadingHint = "thinking...", isTmux = false, picker = null, confirm = null, }) {
88
+ const [submitKey, setSubmitKey] = useState(0);
89
+ const [inputValue, setInputValue] = useState("");
90
+ const [showBanner, setShowBanner] = useState(true);
91
+ const { stdout } = useStdout();
92
+ const rows = stdout?.rows ?? 24;
93
+ const cols = stdout?.columns ?? 80;
94
+ // Auto-dismiss banner after 5 seconds
95
+ useEffect(() => {
96
+ if (!showBanner)
97
+ return;
98
+ const id = setTimeout(() => setShowBanner(false), 5000);
99
+ return () => clearTimeout(id);
100
+ }, [showBanner]);
101
+ // Reserve rows for UI chrome: channel bar (1) + dividers (2) + input (1) + calendar (~5) + padding
102
+ const calendarRows = showCalendar ? 6 : 0;
103
+ const chromeRows = 3 + calendarRows;
104
+ const visibleMessageRows = Math.max(rows - chromeRows - 5, 4);
105
+ // Tail the message list
106
+ const displayMessages = useMemo(() => messages.slice(-visibleMessageRows), [messages, visibleMessageRows]);
107
+ // ── Slash autocomplete ──
108
+ const { state: slashState, actions: slashActions } = useSlashAutocomplete(slashCommands);
109
+ // ── @mention autocomplete ──
110
+ const { state: mentionState, actions: mentionActions } = useMentionAutocomplete(agents, inputValue);
111
+ const handleInputChange = useCallback((value) => {
112
+ setInputValue(value);
113
+ // Only update slash autocomplete if "/" prefix
114
+ if (value.startsWith("/")) {
115
+ slashActions.update(value);
116
+ }
117
+ else if (slashState.visible) {
118
+ slashActions.onDismiss();
119
+ }
120
+ // Only update mention autocomplete if "@" is present AND we have agents
121
+ if (value.includes("@") && agents.length > 0) {
122
+ mentionActions.update(value);
123
+ }
124
+ else if (mentionState.visible) {
125
+ mentionActions.onDismiss();
126
+ }
127
+ }, [slashActions, mentionActions, slashState.visible, mentionState.visible, agents.length]);
128
+ const handleSubmit = useCallback((value) => {
129
+ if (!value.trim())
130
+ return;
131
+ if (showBanner)
132
+ setShowBanner(false);
133
+ // If slash autocomplete is visible, accept the selection instead
134
+ if (slashState.visible) {
135
+ const result = slashActions.onAccept();
136
+ if (result) {
137
+ setInputValue(result.text);
138
+ return;
139
+ }
140
+ }
141
+ // If mention autocomplete is visible, accept the selection instead
142
+ if (mentionState.visible) {
143
+ const result = mentionActions.onAccept();
144
+ if (result) {
145
+ setInputValue(result.text);
146
+ return;
147
+ }
148
+ }
149
+ onSend(value);
150
+ setInputValue("");
151
+ setSubmitKey((k) => k + 1);
152
+ }, [showBanner, slashState.visible, mentionState.visible, slashActions, mentionActions, onSend]);
153
+ // Expose Tab handler via globalThis so app.tsx can invoke it.
154
+ // app.tsx's useInput fires BEFORE TextInput, so Tab is intercepted there.
155
+ useEffect(() => {
156
+ const tabComplete = (direction) => {
157
+ if (slashState.visible) {
158
+ const result = direction < 0 ? slashActions.onShiftTab() : slashActions.onTab();
159
+ if (result)
160
+ setInputValue(result.text);
161
+ return true;
162
+ }
163
+ if (mentionState.visible) {
164
+ const result = direction < 0 ? mentionActions.onShiftTab() : mentionActions.onTab();
165
+ if (result)
166
+ setInputValue(result.text);
167
+ return true;
168
+ }
169
+ return false;
170
+ };
171
+ globalThis.__nexHomeTabComplete = tabComplete;
172
+ return () => {
173
+ delete globalThis.__nexHomeTabComplete;
174
+ };
175
+ }, [slashState, mentionState, slashActions, mentionActions]);
176
+ const divider = "\u2500".repeat(Math.min(cols, 120) - 2);
177
+ // Resolve active channel color for message borders
178
+ const activeChannelName = channels.find((c) => c.id === activeChannelId)?.name;
179
+ const activeChColor = activeChannelName ? getChannelColor(activeChannelName) : "gray";
180
+ return (_jsxs(Box, { flexDirection: "column", width: "100%", minHeight: visibleMessageRows + chromeRows, children: [showBanner && _jsx(Banner, {}), _jsx(ChannelBar, { channels: channels, activeChannelId: activeChannelId }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, children: divider }) }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [displayMessages.map((msg) => {
181
+ // Use per-message channel color if available, else active channel
182
+ const msgChColor = msg.channelName
183
+ ? getChannelColor(msg.channelName)
184
+ : activeChColor;
185
+ return (_jsx(Box, { marginBottom: 0, children: _jsx(AgentMessage, { msg: msg, channelColor: msgChColor }) }, msg.id));
186
+ }), isLoading && (_jsx(Box, { paddingX: 2, children: _jsx(Spinner, { label: loadingHint || "thinking..." }) })), displayMessages.length === 0 && !isLoading && (_jsx(Box, { paddingX: 2, children: _jsx(Text, { dimColor: true, children: "No messages yet. Type something to get started." }) }))] }), showCalendar && (_jsxs(_Fragment, { children: [_jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, children: divider }) }), _jsx(CalendarStrip, { events: calendarEvents })] })), _jsx(SlashAutocomplete, { state: slashState }), _jsx(MentionAutocomplete, { state: mentionState }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, children: divider }) }), picker != null ? (_jsx(InlineSelect, { title: picker.title, options: picker.options, onSelect: picker.onSelect })) : confirm != null ? (_jsx(InlineConfirm, { question: confirm.question, onConfirm: confirm.onConfirm })) : (_jsxs(Box, { paddingX: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "> " }), _jsx(TextInput, { placeholder: "Type a message or /help...", onChange: handleInputChange, onSubmit: handleSubmit }, submitKey)] })), isTmux && (_jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, children: "tmux detected: Ctrl+B % for split pane" }) }))] }));
187
+ }
188
+ // TODO: Wire DataTable component for tabular output (object lists, search results).
189
+ // Currently dispatch returns flat text — needs structured data format from dispatch layer
190
+ // before DataTable can be rendered in AgentMessage. See src/tui/components/data-table.tsx.
191
+ export default HomeScreen;
192
+ //# sourceMappingURL=home-screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home-screen.js","sourceRoot":"","sources":["../../../src/tui/views/home-screen.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAA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AAC,YACd,KAAC,IAAI,IAAC,QAAQ,kBAAE,wCAAwC,GAAQ,GAC5D,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,0FAA0F;AAC1F,2FAA2F;AAE3F,eAAe,UAAU,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Conversation-first home view.
3
+ *
4
+ * Chat REPL: full-width input always active at bottom,
5
+ * message history scrolling up, slash commands for navigation.
6
+ *
7
+ * When a picker or confirm prompt is active, the TextInput is hidden
8
+ * and the interactive widget is shown instead.
9
+ */
10
+ import React from "react";
11
+ import type { ConversationMessage } from "../slash-commands.js";
12
+ import type { SelectOption } from "../components/inline-select.js";
13
+ export interface PickerState {
14
+ title: string;
15
+ options: SelectOption[];
16
+ onSelect: (value: string) => void;
17
+ }
18
+ export interface ConfirmState {
19
+ question: string;
20
+ onConfirm: (confirmed: boolean) => void;
21
+ }
22
+ export interface ConversationViewProps {
23
+ messages: ConversationMessage[];
24
+ onSubmit: (input: string) => void | Promise<void>;
25
+ isLoading?: boolean;
26
+ loadingHint?: string;
27
+ /** When set, shows an arrow-key navigable picker instead of the text input. */
28
+ picker?: PickerState | null;
29
+ /** When set, shows a y/n confirm prompt instead of the text input. */
30
+ confirm?: ConfirmState | null;
31
+ }
32
+ export declare function ConversationView({ messages, onSubmit, isLoading, loadingHint, picker, confirm, }: ConversationViewProps): React.JSX.Element;
33
+ export default ConversationView;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Conversation-first home view.
4
+ *
5
+ * Chat REPL: full-width input always active at bottom,
6
+ * message history scrolling up, slash commands for navigation.
7
+ *
8
+ * When a picker or confirm prompt is active, the TextInput is hidden
9
+ * and the interactive widget is shown instead.
10
+ */
11
+ import { useState } from "react";
12
+ import { Box, Text, useStdout } from "ink";
13
+ import { TextInput } from "@inkjs/ui";
14
+ import { InlineSelect } from "../components/inline-select.js";
15
+ import { InlineConfirm } from "../components/inline-confirm.js";
16
+ // ── Message renderer ────────────────────────────────────────────────
17
+ function MessageBubble({ msg }) {
18
+ const streamingCursor = msg.isStreaming ? "▌" : "";
19
+ switch (msg.role) {
20
+ case "user":
21
+ return (_jsxs(Box, { paddingX: 2, children: [_jsx(Text, { bold: true, color: "white", children: "> " }), _jsx(Text, { children: msg.content })] }));
22
+ case "assistant":
23
+ return (_jsx(Box, { paddingX: 2, flexDirection: "column", children: _jsxs(Text, { color: msg.isError ? "red" : "cyan", children: [msg.content, streamingCursor] }) }));
24
+ case "system":
25
+ return (_jsx(Box, { paddingX: 2, justifyContent: "center", children: _jsx(Text, { color: "yellow", dimColor: true, children: msg.content }) }));
26
+ case "tool":
27
+ return (_jsxs(Box, { paddingX: 4, children: [msg.toolName && (_jsx(Text, { dimColor: true, bold: true, children: `[${msg.toolName}] ` })), _jsx(Text, { dimColor: true, children: msg.content })] }));
28
+ default:
29
+ return (_jsx(Box, { paddingX: 2, children: _jsx(Text, { children: msg.content }) }));
30
+ }
31
+ }
32
+ // ── Conversation view ───────────────────────────────────────────────
33
+ export function ConversationView({ messages, onSubmit, isLoading = false, loadingHint = "thinking...", picker = null, confirm = null, }) {
34
+ const [inputValue, setInputValue] = useState("");
35
+ // Counter to force TextInput remount after submit.
36
+ // @inkjs/ui TextInput only reads defaultValue on initial mount (useReducer
37
+ // initial state), so setting defaultValue="" after submit has no effect.
38
+ // Changing the key forces React to unmount + remount, giving a fresh input.
39
+ const [submitKey, setSubmitKey] = useState(0);
40
+ const { stdout } = useStdout();
41
+ const rows = stdout?.rows ?? 24;
42
+ // Calculate visible area: total rows - 4 (status bar, input, divider, padding)
43
+ const visibleRows = Math.max(rows - 5, 6);
44
+ // Determine which messages to show (tail of the list)
45
+ // Rough estimate: each message ~1-3 lines
46
+ const displayMessages = messages.slice(-visibleRows);
47
+ const handleSubmit = (value) => {
48
+ if (!value.trim())
49
+ return;
50
+ // onSubmit may be async — catch unhandled rejections
51
+ Promise.resolve(onSubmit(value)).catch(() => { });
52
+ setInputValue("");
53
+ setSubmitKey((k) => k + 1);
54
+ };
55
+ const hasWidget = picker != null || confirm != null;
56
+ return (_jsxs(Box, { flexDirection: "column", width: "100%", minHeight: visibleRows + 3, children: [_jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [displayMessages.map((msg) => (_jsx(Box, { marginBottom: 0, children: _jsx(MessageBubble, { msg: msg }) }, msg.id))), isLoading && (_jsx(Box, { paddingX: 2, children: _jsx(Text, { color: "cyan", dimColor: true, children: ` ${loadingHint}` }) }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, children: "─".repeat(Math.min(stdout?.columns ?? 60, 120) - 2) }) }), picker != null ? (_jsx(InlineSelect, { title: picker.title, options: picker.options, onSelect: picker.onSelect })) : confirm != null ? (_jsx(InlineConfirm, { question: confirm.question, onConfirm: confirm.onConfirm })) : (_jsxs(Box, { paddingX: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "> " }), _jsx(TextInput, { placeholder: "Type a message or /help...", onChange: setInputValue, onSubmit: handleSubmit }, submitKey)] }))] }));
57
+ }
58
+ // Keep the default export for backward compat
59
+ export default ConversationView;
60
+ //# sourceMappingURL=home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.js","sourceRoot":"","sources":["../../../src/tui/views/home.tsx"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AA0BhE,uEAAuE;AAEvE,SAAS,aAAa,CAAC,EAAE,GAAG,EAAgC;IAC1D,MAAM,eAAe,GAAG,GAAG,CAAC,WA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AC;AACJ,CAAC;AAED,8CAA8C;AAC9C,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export { ConversationView } from "./home.js";
2
+ export type { ConversationViewProps } from "./home.js";
3
+ export { RecordListView } from "./record-list.js";
4
+ export type { RecordListViewProps, RecordRow } from "./record-list.js";
5
+ export { RecordDetailView } from "./record-detail.js";
6
+ export type { RecordDetailViewProps } from "./record-detail.js";
7
+ export { AskChatView } from "./ask-chat.js";
8
+ export type { AskChatViewProps } from "./ask-chat.js";
9
+ export { HelpView } from "./help.js";
10
+ export type { HelpViewProps } from "./help.js";
11
+ export { AgentListView } from "./agent-list.js";
12
+ export type { AgentListViewProps } from "./agent-list.js";
13
+ export { ChatView } from "./chat.js";
14
+ export type { ChatViewProps, Channel } from "./chat.js";
15
+ export { CalendarView } from "./calendar.js";
16
+ export type { CalendarViewProps, CalendarEvent } from "./calendar.js";
17
+ export { OrchestrationView } from "./orchestration.js";
18
+ export type { OrchestrationViewProps } from "./orchestration.js";
19
+ export { GenerativeView } from "./generative.js";
20
+ export type { GenerativeViewProps } from "./generative.js";
@@ -0,0 +1,11 @@
1
+ export { ConversationView } from "./home.js";
2
+ export { RecordListView } from "./record-list.js";
3
+ export { RecordDetailView } from "./record-detail.js";
4
+ export { AskChatView } from "./ask-chat.js";
5
+ export { HelpView } from "./help.js";
6
+ export { AgentListView } from "./agent-list.js";
7
+ export { ChatView } from "./chat.js";
8
+ export { CalendarView } from "./calendar.js";
9
+ export { OrchestrationView } from "./orchestration.js";
10
+ export { GenerativeView } from "./generative.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tui/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Insights dashboard view.
3
+ * Displays insights from the context graph with priority badges,
4
+ * categories, and linked record IDs.
5
+ */
6
+ import React from 'react';
7
+ export interface Insight {
8
+ id: string;
9
+ title: string;
10
+ body: string;
11
+ priority: 'critical' | 'high' | 'medium' | 'low';
12
+ category: string;
13
+ recordIds?: string[];
14
+ timestamp: string;
15
+ }
16
+ export interface InsightsViewProps {
17
+ insights: Insight[];
18
+ }
19
+ export declare function InsightsView({ insights }: InsightsViewProps): React.JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ // ── Helpers ──
4
+ function priorityBadge(priority) {
5
+ switch (priority) {
6
+ case 'critical':
7
+ return _jsx(Text, { color: "red", bold: true, children: "[CRIT]" });
8
+ case 'high':
9
+ return _jsx(Text, { color: "red", children: "[HIGH]" });
10
+ case 'medium':
11
+ return _jsx(Text, { color: "yellow", children: "[MED]" });
12
+ case 'low':
13
+ return _jsx(Text, { dimColor: true, children: "[LOW]" });
14
+ }
15
+ }
16
+ function formatTimestamp(ts) {
17
+ try {
18
+ const d = new Date(ts);
19
+ if (isNaN(d.getTime()))
20
+ return ts;
21
+ const now = Date.now();
22
+ const diffMs = now - d.getTime();
23
+ const diffMin = Math.floor(diffMs / 60_000);
24
+ if (diffMin < 1)
25
+ return 'just now';
26
+ if (diffMin < 60)
27
+ return `${diffMin}m ago`;
28
+ const diffHrs = Math.floor(diffMin / 60);
29
+ if (diffHrs < 24)
30
+ return `${diffHrs}h ago`;
31
+ const diffDays = Math.floor(diffHrs / 24);
32
+ return `${diffDays}d ago`;
33
+ }
34
+ catch {
35
+ return ts;
36
+ }
37
+ }
38
+ // ── Sub-components ──
39
+ function InsightCard({ insight }) {
40
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { gap: 1, children: [priorityBadge(insight.priority), _jsxs(Text, { color: "magenta", children: ["[", insight.category, "]"] }), _jsx(Text, { bold: true, color: "blue", children: insight.title })] }), insight.body && (_jsx(Box, { paddingLeft: 2, children: _jsx(Text, { children: insight.body }) })), insight.recordIds && insight.recordIds.length > 0 && (_jsx(Box, { paddingLeft: 2, children: _jsxs(Text, { dimColor: true, children: ["Records: ", insight.recordIds.join(', ')] }) })), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: formatTimestamp(insight.timestamp) }) })] }));
41
+ }
42
+ // ── Main view ──
43
+ export function InsightsView({ insights }) {
44
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, paddingY: 0, children: [_jsx(Text, { bold: true, color: "cyan", children: "Insights" }), _jsx(Box, { height: 1 }), insights.length === 0 ? (_jsx(Text, { color: "gray", children: " No insights found. Try expanding the time window." })) : (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: [insights.length, " insight", insights.length !== 1 ? 's' : ''] }), _jsx(Box, { height: 1 }), insights.map((insight, i) => (_jsx(InsightCard, { insight: insight }, insight.id ?? i)))] })), _jsx(Text, { color: "gray", children: "[Esc=back /insights --last 24h]" })] }));
45
+ }
46
+ //# sourceMappingURL=insights.js.map