@cryptiklemur/lattice 1.11.5 → 1.12.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.
@@ -25,6 +25,9 @@ function getModKey(): string {
25
25
  return "Ctrl";
26
26
  }
27
27
 
28
+ var inputHistory: string[] = [];
29
+ var MAX_HISTORY = 100;
30
+
28
31
  export function ChatInput(props: ChatInputProps) {
29
32
  var textareaRef = useRef<HTMLTextAreaElement>(null);
30
33
  var popupRef = useRef<HTMLDivElement>(null);
@@ -35,6 +38,8 @@ export function ChatInput(props: ChatInputProps) {
35
38
  var [selectedIndex, setSelectedIndex] = useState(0);
36
39
  var [showMobileSettings, setShowMobileSettings] = useState(false);
37
40
  var modKey = useMemo(getModKey, []);
41
+ var [historyIndex, setHistoryIndex] = useState(-1);
42
+ var savedCurrentRef = useRef("");
38
43
 
39
44
  var attachmentsHook = useAttachments();
40
45
  var voice = useVoiceRecorder();
@@ -161,6 +166,53 @@ export function ChatInput(props: ChatInputProps) {
161
166
  if (e.key === "Enter" && !e.shiftKey) {
162
167
  e.preventDefault();
163
168
  submit();
169
+ return;
170
+ }
171
+
172
+ if (e.key === "ArrowUp" && inputHistory.length > 0) {
173
+ var el = textareaRef.current;
174
+ if (!el) return;
175
+ var val = el.value;
176
+ var cursorPos = el.selectionStart;
177
+ var isAtTop = cursorPos === 0 || val.indexOf("\n") === -1 || cursorPos <= val.indexOf("\n");
178
+ if (isAtTop) {
179
+ e.preventDefault();
180
+ if (historyIndex === -1) {
181
+ savedCurrentRef.current = val;
182
+ }
183
+ var newIdx = historyIndex === -1 ? inputHistory.length - 1 : Math.max(0, historyIndex - 1);
184
+ setHistoryIndex(newIdx);
185
+ el.value = inputHistory[newIdx];
186
+ el.style.height = "auto";
187
+ el.style.height = Math.min(el.scrollHeight, 160) + "px";
188
+ el.setSelectionRange(0, 0);
189
+ }
190
+ return;
191
+ }
192
+
193
+ if (e.key === "ArrowDown" && historyIndex >= 0) {
194
+ var el = textareaRef.current;
195
+ if (!el) return;
196
+ var val = el.value;
197
+ var cursorPos = el.selectionStart;
198
+ var lastNewline = val.lastIndexOf("\n");
199
+ var isAtBottom = lastNewline === -1 || cursorPos > lastNewline;
200
+ if (isAtBottom) {
201
+ e.preventDefault();
202
+ if (historyIndex >= inputHistory.length - 1) {
203
+ setHistoryIndex(-1);
204
+ el.value = savedCurrentRef.current;
205
+ } else {
206
+ var newIdx = historyIndex + 1;
207
+ setHistoryIndex(newIdx);
208
+ el.value = inputHistory[newIdx];
209
+ }
210
+ el.style.height = "auto";
211
+ el.style.height = Math.min(el.scrollHeight, 160) + "px";
212
+ var len = el.value.length;
213
+ el.setSelectionRange(len, len);
214
+ }
215
+ return;
164
216
  }
165
217
  }
166
218
 
@@ -253,6 +305,14 @@ export function ChatInput(props: ChatInputProps) {
253
305
  if (!el) return;
254
306
  var text = el.value.trim();
255
307
  if ((!text && attachmentsHook.attachments.length === 0) || props.disabled || attachmentsHook.hasUploading) return;
308
+ if (text) {
309
+ if (inputHistory.length === 0 || inputHistory[inputHistory.length - 1] !== text) {
310
+ inputHistory.push(text);
311
+ if (inputHistory.length > MAX_HISTORY) inputHistory.shift();
312
+ }
313
+ }
314
+ setHistoryIndex(-1);
315
+ savedCurrentRef.current = "";
256
316
  props.onSend(text, attachmentsHook.readyIds);
257
317
  el.value = "";
258
318
  el.style.height = "auto";
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from "react";
1
+ import { useEffect, useRef, useState, useMemo } from "react";
2
2
  import type { SessionSummary, SessionListMessage, SessionCreatedMessage } from "@lattice/shared";
3
3
  import type { ServerMessage } from "@lattice/shared";
4
4
  import { useWebSocket } from "../../hooks/useWebSocket";
@@ -251,6 +251,15 @@ export function SessionList(props: SessionListProps) {
251
251
  }
252
252
  }
253
253
 
254
+ var grouped = useMemo(function () {
255
+ var displayed = props.filter
256
+ ? sessions.filter(function (s) {
257
+ return s.title.toLowerCase().includes(props.filter!.toLowerCase());
258
+ })
259
+ : sessions;
260
+ return groupByTime(displayed);
261
+ }, [sessions, props.filter]);
262
+
254
263
  if (!props.projectSlug) {
255
264
  return (
256
265
  <div className="flex-1 flex items-start px-3 py-1.5">
@@ -269,14 +278,6 @@ export function SessionList(props: SessionListProps) {
269
278
  );
270
279
  }
271
280
 
272
- var displayed = props.filter
273
- ? sessions.filter(function (s) {
274
- return s.title.toLowerCase().includes(props.filter!.toLowerCase());
275
- })
276
- : sessions;
277
-
278
- var grouped = groupByTime(displayed);
279
-
280
281
  return (
281
282
  <div className="flex flex-col flex-1 overflow-hidden min-h-0">
282
283
  <div className="flex-1 overflow-y-auto overflow-x-hidden scrollbar-hidden py-0.5 pb-16">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "1.11.5",
3
+ "version": "1.12.0",
4
4
  "description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
5
5
  "license": "MIT",
6
6
  "author": "Aaron Scherer <me@aaronscherer.me>",