@cryptiklemur/lattice 0.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +4 -4
- package/.releaserc.json +2 -1
- package/client/src/components/auth/PassphrasePrompt.tsx +70 -70
- package/client/src/components/mesh/NodeBadge.tsx +24 -24
- package/client/src/components/mesh/PairingDialog.tsx +281 -281
- package/client/src/components/panels/FileBrowser.tsx +241 -241
- package/client/src/components/panels/StickyNotes.tsx +187 -187
- package/client/src/components/project-settings/ProjectMemory.tsx +471 -0
- package/client/src/components/project-settings/ProjectSettingsView.tsx +6 -0
- package/client/src/components/settings/Appearance.tsx +151 -151
- package/client/src/components/settings/MeshStatus.tsx +145 -145
- package/client/src/components/settings/SettingsView.tsx +57 -57
- package/client/src/components/setup/SetupWizard.tsx +750 -750
- package/client/src/components/sidebar/AddProjectModal.tsx +432 -0
- package/client/src/components/sidebar/ProjectRail.tsx +8 -4
- package/client/src/components/sidebar/SettingsSidebar.tsx +2 -1
- package/client/src/components/ui/ErrorBoundary.tsx +56 -56
- package/client/src/hooks/useSidebar.ts +16 -0
- package/client/src/router.tsx +453 -391
- package/client/src/stores/sidebar.ts +28 -0
- package/client/vite.config.ts +20 -20
- package/package.json +1 -1
- package/server/src/daemon.ts +1 -0
- package/server/src/handlers/chat.ts +194 -194
- package/server/src/handlers/fs.ts +159 -0
- package/server/src/handlers/memory.ts +179 -0
- package/server/src/handlers/settings.ts +114 -109
- package/shared/src/messages.ts +97 -2
- package/shared/src/project-settings.ts +1 -1
- package/themes/amoled.json +20 -20
- package/themes/ayu-light.json +9 -9
- package/themes/catppuccin-latte.json +9 -9
- package/themes/catppuccin-mocha.json +9 -9
- package/themes/clay-light.json +10 -10
- package/themes/clay.json +10 -10
- package/themes/dracula.json +9 -9
- package/themes/everforest-light.json +9 -9
- package/themes/everforest.json +9 -9
- package/themes/github-light.json +9 -9
- package/themes/gruvbox-dark.json +9 -9
- package/themes/gruvbox-light.json +9 -9
- package/themes/monokai.json +9 -9
- package/themes/nord-light.json +9 -9
- package/themes/nord.json +9 -9
- package/themes/one-dark.json +9 -9
- package/themes/one-light.json +9 -9
- package/themes/rose-pine-dawn.json +9 -9
- package/themes/rose-pine.json +9 -9
- package/themes/solarized-dark.json +9 -9
- package/themes/solarized-light.json +9 -9
- package/themes/tokyo-night-light.json +9 -9
- package/themes/tokyo-night.json +9 -9
- package/.serena/project.yml +0 -138
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import type { StickyNote, ServerMessage } from "@lattice/shared";
|
|
3
|
-
import { useWebSocket } from "../../hooks/useWebSocket";
|
|
4
|
-
|
|
5
|
-
interface NoteCardProps {
|
|
6
|
-
note: StickyNote;
|
|
7
|
-
onEdit: (id: string) => void;
|
|
8
|
-
onDelete: (id: string) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function NoteCard(props: NoteCardProps) {
|
|
12
|
-
var { note, onEdit, onDelete } = props;
|
|
13
|
-
return (
|
|
14
|
-
<div className="card bg-base-200 border border-base-300">
|
|
15
|
-
<div className="card-body p-3">
|
|
16
|
-
<div className="text-[13px] text-base-content whitespace-pre-wrap break-words leading-relaxed min-h-12">
|
|
17
|
-
{note.content}
|
|
18
|
-
</div>
|
|
19
|
-
<div className="flex gap-1.5 justify-end mt-2">
|
|
20
|
-
<button
|
|
21
|
-
onClick={function () { onEdit(note.id); }}
|
|
22
|
-
className="btn btn-ghost btn-xs border border-base-300"
|
|
23
|
-
>
|
|
24
|
-
Edit
|
|
25
|
-
</button>
|
|
26
|
-
<button
|
|
27
|
-
onClick={function () { onDelete(note.id); }}
|
|
28
|
-
className="btn btn-ghost btn-xs border border-base-300 text-base-content/60"
|
|
29
|
-
>
|
|
30
|
-
Delete
|
|
31
|
-
</button>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface EditModalProps {
|
|
39
|
-
initial: string;
|
|
40
|
-
onSave: (content: string) => void;
|
|
41
|
-
onCancel: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function EditModal(props: EditModalProps) {
|
|
45
|
-
var { initial, onSave, onCancel } = props;
|
|
46
|
-
var [content, setContent] = useState(initial);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div className="fixed inset-0 bg-black/50 z-[1000] flex items-center justify-center" role="dialog" aria-modal="true" aria-label="Edit note">
|
|
50
|
-
<div className="card bg-base-200 border border-base-300 w-[400px] max-w-[90vw] shadow-2xl">
|
|
51
|
-
<div className="card-body p-5">
|
|
52
|
-
<div className="text-[13px] font-semibold text-base-content mb-3">Edit Note</div>
|
|
53
|
-
<textarea
|
|
54
|
-
autoFocus
|
|
55
|
-
value={content}
|
|
56
|
-
onChange={function (e) { setContent(e.target.value); }}
|
|
57
|
-
className="textarea textarea-bordered w-full min-h-[120px] bg-base-300 text-base-content text-[13px] resize-y"
|
|
58
|
-
/>
|
|
59
|
-
<div className="flex gap-2 justify-end mt-3">
|
|
60
|
-
<button
|
|
61
|
-
onClick={onCancel}
|
|
62
|
-
className="btn btn-ghost btn-sm"
|
|
63
|
-
>
|
|
64
|
-
Cancel
|
|
65
|
-
</button>
|
|
66
|
-
<button
|
|
67
|
-
onClick={function () { onSave(content); }}
|
|
68
|
-
className="btn btn-primary btn-sm"
|
|
69
|
-
>
|
|
70
|
-
Save
|
|
71
|
-
</button>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function StickyNotes() {
|
|
80
|
-
var { send, subscribe, unsubscribe } = useWebSocket();
|
|
81
|
-
var [notes, setNotes] = useState<StickyNote[]>([]);
|
|
82
|
-
var [editingId, setEditingId] = useState<string | null>(null);
|
|
83
|
-
var [creating, setCreating] = useState(false);
|
|
84
|
-
|
|
85
|
-
var editingNote = editingId ? notes.find(function (n) { return n.id === editingId; }) : null;
|
|
86
|
-
|
|
87
|
-
var handleMessage = useCallback(function (msg: ServerMessage) {
|
|
88
|
-
if (msg.type === "notes:list_result") {
|
|
89
|
-
setNotes(msg.notes);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (msg.type === "notes:created") {
|
|
93
|
-
setNotes(function (prev) { return [...prev, msg.note]; });
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (msg.type === "notes:updated") {
|
|
97
|
-
setNotes(function (prev) {
|
|
98
|
-
return prev.map(function (n) { return n.id === msg.note.id ? msg.note : n; });
|
|
99
|
-
});
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (msg.type === "notes:deleted") {
|
|
103
|
-
setNotes(function (prev) { return prev.filter(function (n) { return n.id !== msg.id; }); });
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
}, []);
|
|
107
|
-
|
|
108
|
-
useEffect(function () {
|
|
109
|
-
subscribe("notes:list_result", handleMessage);
|
|
110
|
-
subscribe("notes:created", handleMessage);
|
|
111
|
-
subscribe("notes:updated", handleMessage);
|
|
112
|
-
subscribe("notes:deleted", handleMessage);
|
|
113
|
-
send({ type: "notes:list" });
|
|
114
|
-
return function () {
|
|
115
|
-
unsubscribe("notes:list_result", handleMessage);
|
|
116
|
-
unsubscribe("notes:created", handleMessage);
|
|
117
|
-
unsubscribe("notes:updated", handleMessage);
|
|
118
|
-
unsubscribe("notes:deleted", handleMessage);
|
|
119
|
-
};
|
|
120
|
-
}, [send, subscribe, unsubscribe, handleMessage]);
|
|
121
|
-
|
|
122
|
-
function handleCreate(content: string) {
|
|
123
|
-
if (content.trim()) {
|
|
124
|
-
send({ type: "notes:create", content: content.trim() });
|
|
125
|
-
}
|
|
126
|
-
setCreating(false);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function handleEdit(content: string) {
|
|
130
|
-
if (editingId && content.trim()) {
|
|
131
|
-
send({ type: "notes:update", id: editingId, content: content.trim() });
|
|
132
|
-
}
|
|
133
|
-
setEditingId(null);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function handleDelete(id: string) {
|
|
137
|
-
send({ type: "notes:delete", id });
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<div className="flex flex-col h-full bg-base-100">
|
|
142
|
-
<div className="flex items-center justify-between px-4 py-3 border-b border-base-300">
|
|
143
|
-
<span className="text-[13px] font-semibold text-base-content">Sticky Notes</span>
|
|
144
|
-
<button
|
|
145
|
-
onClick={function () { setCreating(true); }}
|
|
146
|
-
className="btn btn-primary btn-xs"
|
|
147
|
-
>
|
|
148
|
-
New Note
|
|
149
|
-
</button>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<div className="flex-1 overflow-auto p-3 flex flex-col gap-2.5">
|
|
153
|
-
{notes.length === 0 && (
|
|
154
|
-
<div className="text-base-content/50 text-[13px] text-center mt-10">
|
|
155
|
-
No notes yet. Create one to get started.
|
|
156
|
-
</div>
|
|
157
|
-
)}
|
|
158
|
-
{notes.map(function (note) {
|
|
159
|
-
return (
|
|
160
|
-
<NoteCard
|
|
161
|
-
key={note.id}
|
|
162
|
-
note={note}
|
|
163
|
-
onEdit={setEditingId}
|
|
164
|
-
onDelete={handleDelete}
|
|
165
|
-
/>
|
|
166
|
-
);
|
|
167
|
-
})}
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
{creating && (
|
|
171
|
-
<EditModal
|
|
172
|
-
initial=""
|
|
173
|
-
onSave={handleCreate}
|
|
174
|
-
onCancel={function () { setCreating(false); }}
|
|
175
|
-
/>
|
|
176
|
-
)}
|
|
177
|
-
|
|
178
|
-
{editingNote && (
|
|
179
|
-
<EditModal
|
|
180
|
-
initial={editingNote.content}
|
|
181
|
-
onSave={handleEdit}
|
|
182
|
-
onCancel={function () { setEditingId(null); }}
|
|
183
|
-
/>
|
|
184
|
-
)}
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import type { StickyNote, ServerMessage } from "@lattice/shared";
|
|
3
|
+
import { useWebSocket } from "../../hooks/useWebSocket";
|
|
4
|
+
|
|
5
|
+
interface NoteCardProps {
|
|
6
|
+
note: StickyNote;
|
|
7
|
+
onEdit: (id: string) => void;
|
|
8
|
+
onDelete: (id: string) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function NoteCard(props: NoteCardProps) {
|
|
12
|
+
var { note, onEdit, onDelete } = props;
|
|
13
|
+
return (
|
|
14
|
+
<div className="card bg-base-200 border border-base-300">
|
|
15
|
+
<div className="card-body p-3">
|
|
16
|
+
<div className="text-[13px] text-base-content whitespace-pre-wrap break-words leading-relaxed min-h-12">
|
|
17
|
+
{note.content}
|
|
18
|
+
</div>
|
|
19
|
+
<div className="flex gap-1.5 justify-end mt-2">
|
|
20
|
+
<button
|
|
21
|
+
onClick={function () { onEdit(note.id); }}
|
|
22
|
+
className="btn btn-ghost btn-xs border border-base-300"
|
|
23
|
+
>
|
|
24
|
+
Edit
|
|
25
|
+
</button>
|
|
26
|
+
<button
|
|
27
|
+
onClick={function () { onDelete(note.id); }}
|
|
28
|
+
className="btn btn-ghost btn-xs border border-base-300 text-base-content/60"
|
|
29
|
+
>
|
|
30
|
+
Delete
|
|
31
|
+
</button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface EditModalProps {
|
|
39
|
+
initial: string;
|
|
40
|
+
onSave: (content: string) => void;
|
|
41
|
+
onCancel: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function EditModal(props: EditModalProps) {
|
|
45
|
+
var { initial, onSave, onCancel } = props;
|
|
46
|
+
var [content, setContent] = useState(initial);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className="fixed inset-0 bg-black/50 z-[1000] flex items-center justify-center" role="dialog" aria-modal="true" aria-label="Edit note">
|
|
50
|
+
<div className="card bg-base-200 border border-base-300 w-[400px] max-w-[90vw] shadow-2xl">
|
|
51
|
+
<div className="card-body p-5">
|
|
52
|
+
<div className="text-[13px] font-semibold text-base-content mb-3">Edit Note</div>
|
|
53
|
+
<textarea
|
|
54
|
+
autoFocus
|
|
55
|
+
value={content}
|
|
56
|
+
onChange={function (e) { setContent(e.target.value); }}
|
|
57
|
+
className="textarea textarea-bordered w-full min-h-[120px] bg-base-300 text-base-content text-[13px] resize-y"
|
|
58
|
+
/>
|
|
59
|
+
<div className="flex gap-2 justify-end mt-3">
|
|
60
|
+
<button
|
|
61
|
+
onClick={onCancel}
|
|
62
|
+
className="btn btn-ghost btn-sm"
|
|
63
|
+
>
|
|
64
|
+
Cancel
|
|
65
|
+
</button>
|
|
66
|
+
<button
|
|
67
|
+
onClick={function () { onSave(content); }}
|
|
68
|
+
className="btn btn-primary btn-sm"
|
|
69
|
+
>
|
|
70
|
+
Save
|
|
71
|
+
</button>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function StickyNotes() {
|
|
80
|
+
var { send, subscribe, unsubscribe } = useWebSocket();
|
|
81
|
+
var [notes, setNotes] = useState<StickyNote[]>([]);
|
|
82
|
+
var [editingId, setEditingId] = useState<string | null>(null);
|
|
83
|
+
var [creating, setCreating] = useState(false);
|
|
84
|
+
|
|
85
|
+
var editingNote = editingId ? notes.find(function (n) { return n.id === editingId; }) : null;
|
|
86
|
+
|
|
87
|
+
var handleMessage = useCallback(function (msg: ServerMessage) {
|
|
88
|
+
if (msg.type === "notes:list_result") {
|
|
89
|
+
setNotes(msg.notes);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (msg.type === "notes:created") {
|
|
93
|
+
setNotes(function (prev) { return [...prev, msg.note]; });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (msg.type === "notes:updated") {
|
|
97
|
+
setNotes(function (prev) {
|
|
98
|
+
return prev.map(function (n) { return n.id === msg.note.id ? msg.note : n; });
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (msg.type === "notes:deleted") {
|
|
103
|
+
setNotes(function (prev) { return prev.filter(function (n) { return n.id !== msg.id; }); });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
useEffect(function () {
|
|
109
|
+
subscribe("notes:list_result", handleMessage);
|
|
110
|
+
subscribe("notes:created", handleMessage);
|
|
111
|
+
subscribe("notes:updated", handleMessage);
|
|
112
|
+
subscribe("notes:deleted", handleMessage);
|
|
113
|
+
send({ type: "notes:list" });
|
|
114
|
+
return function () {
|
|
115
|
+
unsubscribe("notes:list_result", handleMessage);
|
|
116
|
+
unsubscribe("notes:created", handleMessage);
|
|
117
|
+
unsubscribe("notes:updated", handleMessage);
|
|
118
|
+
unsubscribe("notes:deleted", handleMessage);
|
|
119
|
+
};
|
|
120
|
+
}, [send, subscribe, unsubscribe, handleMessage]);
|
|
121
|
+
|
|
122
|
+
function handleCreate(content: string) {
|
|
123
|
+
if (content.trim()) {
|
|
124
|
+
send({ type: "notes:create", content: content.trim() });
|
|
125
|
+
}
|
|
126
|
+
setCreating(false);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function handleEdit(content: string) {
|
|
130
|
+
if (editingId && content.trim()) {
|
|
131
|
+
send({ type: "notes:update", id: editingId, content: content.trim() });
|
|
132
|
+
}
|
|
133
|
+
setEditingId(null);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function handleDelete(id: string) {
|
|
137
|
+
send({ type: "notes:delete", id });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div className="flex flex-col h-full bg-base-100">
|
|
142
|
+
<div className="flex items-center justify-between px-4 py-3 border-b border-base-300">
|
|
143
|
+
<span className="text-[13px] font-semibold text-base-content">Sticky Notes</span>
|
|
144
|
+
<button
|
|
145
|
+
onClick={function () { setCreating(true); }}
|
|
146
|
+
className="btn btn-primary btn-xs"
|
|
147
|
+
>
|
|
148
|
+
New Note
|
|
149
|
+
</button>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<div className="flex-1 overflow-auto p-3 flex flex-col gap-2.5">
|
|
153
|
+
{notes.length === 0 && (
|
|
154
|
+
<div className="text-base-content/50 text-[13px] text-center mt-10">
|
|
155
|
+
No notes yet. Create one to get started.
|
|
156
|
+
</div>
|
|
157
|
+
)}
|
|
158
|
+
{notes.map(function (note) {
|
|
159
|
+
return (
|
|
160
|
+
<NoteCard
|
|
161
|
+
key={note.id}
|
|
162
|
+
note={note}
|
|
163
|
+
onEdit={setEditingId}
|
|
164
|
+
onDelete={handleDelete}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
})}
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
{creating && (
|
|
171
|
+
<EditModal
|
|
172
|
+
initial=""
|
|
173
|
+
onSave={handleCreate}
|
|
174
|
+
onCancel={function () { setCreating(false); }}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
|
|
178
|
+
{editingNote && (
|
|
179
|
+
<EditModal
|
|
180
|
+
initial={editingNote.content}
|
|
181
|
+
onSave={handleEdit}
|
|
182
|
+
onCancel={function () { setEditingId(null); }}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
}
|