@steerable/agent-shell-web 0.14.5 → 0.14.7
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/package.json +4 -4
- package/src/components/AgentSidebar.tsx +6 -2
- package/src/components/ChatHeader.tsx +17 -2
- package/src/components/chat/AssistantMessage.tsx +60 -1
- package/src/components/chat/ChatInput.tsx +16 -4
- package/src/components/chat/LocalChatPanel.tsx +32 -1
- package/src/components/chat/MemorySaveNoticeBar.tsx +24 -3
- package/src/components/chat/MessageList.tsx +6 -0
- package/src/components/settings/AgentsSettingsPanel.tsx +3 -3
- package/src/components/settings/AppUpdateSettingsPanel.tsx +67 -43
- package/src/components/settings/AppearanceSettingsPanel.tsx +101 -134
- package/src/components/settings/CliInstallSettingsPanel.tsx +25 -23
- package/src/components/settings/DiagnoseSettingsPanel.tsx +3 -3
- package/src/components/settings/InsightsSettingsPanel.tsx +5 -7
- package/src/components/settings/LlmSettingsPanel.tsx +22 -2
- package/src/components/settings/McpSettingsPanel.tsx +4 -5
- package/src/components/settings/MemorySettingsPanel.tsx +302 -169
- package/src/components/settings/OrchestrationSettingsPanel.tsx +79 -121
- package/src/components/settings/PortableSettingsPanel.tsx +62 -49
- package/src/components/settings/PythonRunnerSettingsPanel.tsx +2 -4
- package/src/components/settings/SecuritySettingsPanel.tsx +91 -70
- package/src/components/settings/SettingsSidebar.tsx +238 -0
- package/src/components/settings/SkillsSettingsPanel.tsx +3 -4
- package/src/components/settings/TelemetrySettingsPanel.tsx +2 -7
- package/src/components/settings/UsagePanel.tsx +27 -35
- package/src/components/settings/WebSearchSettingsPanel.tsx +89 -88
- package/src/components/settings/primitives.tsx +302 -0
- package/src/components/settings/settings-registry.ts +371 -0
- package/src/layouts/AgentLayout.tsx +106 -6
- package/src/lib/chat-draft-store.ts +43 -0
- package/src/lib/chat-mode-store.ts +27 -0
- package/src/lib/chat-title.ts +13 -0
- package/src/lib/local-api.ts +35 -0
- package/src/packs/registry.ts +2 -0
- package/src/pages/AgentPage.tsx +333 -3
- package/src/pages/SettingsPage.tsx +337 -487
- package/src/styles/index.css +6 -0
package/src/pages/AgentPage.tsx
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
readStoredExecPolicy,
|
|
27
27
|
type ExecPolicy,
|
|
28
28
|
} from "@/lib/exec-policy";
|
|
29
|
+
import { clearChatDraft, getChatDraft, setChatDraft } from "@/lib/chat-draft-store";
|
|
29
30
|
import { clampWebChatMode, hostToolChrome, settingsChrome } from "@/lib/host-tools";
|
|
30
31
|
import type { ExecutedAction } from "@/components/chat/ExecutedActionsCard";
|
|
31
32
|
import { inspectTaskTitle, type InspectTaskInput } from "@/components/chat/executed-actions-model";
|
|
@@ -61,11 +62,15 @@ import {
|
|
|
61
62
|
compactChat,
|
|
62
63
|
getChatContextStatus,
|
|
63
64
|
getChatLiveStream,
|
|
65
|
+
proposeMemoryRefinement,
|
|
64
66
|
type ChatLiveStream,
|
|
65
67
|
type LocalChatMessage,
|
|
68
|
+
type SavedMemoryNotice,
|
|
66
69
|
} from "@/lib/local-api";
|
|
70
|
+
import { MemorySaveNoticeBar } from "@/components/chat/MemorySaveNoticeBar";
|
|
67
71
|
import {
|
|
68
72
|
dismissPlanMessage,
|
|
73
|
+
parseMemorySlashCommand,
|
|
69
74
|
parseModeSlashCommand,
|
|
70
75
|
PlanActionContext,
|
|
71
76
|
readChatModeForSession,
|
|
@@ -113,6 +118,59 @@ function chronological(messages: ChatMessage[] | undefined): ChatMessage[] {
|
|
|
113
118
|
return [...messages].reverse();
|
|
114
119
|
}
|
|
115
120
|
|
|
121
|
+
function buildMemorySettingsUrl(target?: {
|
|
122
|
+
scope?: "user" | "workspace" | "tenant";
|
|
123
|
+
scopeId?: string;
|
|
124
|
+
}): string {
|
|
125
|
+
const params = new URLSearchParams({ tab: "memory" });
|
|
126
|
+
if (target?.scope) {
|
|
127
|
+
params.set("scope", target.scope);
|
|
128
|
+
}
|
|
129
|
+
if (
|
|
130
|
+
target?.scope === "workspace" &&
|
|
131
|
+
target.scopeId &&
|
|
132
|
+
target.scopeId !== "default"
|
|
133
|
+
) {
|
|
134
|
+
params.set("workspaceId", target.scopeId);
|
|
135
|
+
}
|
|
136
|
+
return `/settings?${params.toString()}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function mergeSavedMemoriesJson(
|
|
140
|
+
rawJson: string | null | undefined,
|
|
141
|
+
incoming: SavedMemoryNotice[],
|
|
142
|
+
): string {
|
|
143
|
+
let base: Record<string, unknown> = {};
|
|
144
|
+
if (typeof rawJson === "string" && rawJson) {
|
|
145
|
+
try {
|
|
146
|
+
const parsed = JSON.parse(rawJson);
|
|
147
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
148
|
+
base = parsed as Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
} catch {
|
|
151
|
+
base = {};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const existing = Array.isArray(base.savedMemories)
|
|
155
|
+
? (base.savedMemories as SavedMemoryNotice[])
|
|
156
|
+
: [];
|
|
157
|
+
const byId = new Map<string, SavedMemoryNotice>();
|
|
158
|
+
for (const item of existing) {
|
|
159
|
+
if (item && typeof item.refinementId === "string" && item.refinementId) {
|
|
160
|
+
byId.set(item.refinementId, item);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const item of incoming) {
|
|
164
|
+
if (item && typeof item.refinementId === "string" && item.refinementId) {
|
|
165
|
+
byId.set(item.refinementId, { ...byId.get(item.refinementId), ...item });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return JSON.stringify({
|
|
169
|
+
...base,
|
|
170
|
+
savedMemories: Array.from(byId.values()),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
116
174
|
type ChatMessageWithMetadata = ChatMessage & LocalChatMessage;
|
|
117
175
|
|
|
118
176
|
interface ComposerTurnSettings {
|
|
@@ -686,6 +744,15 @@ function AgentChatView({
|
|
|
686
744
|
const [tailAssistantDbId, setTailAssistantDbId] = useState<string | null>(
|
|
687
745
|
initialSuggestedReplies?.messageId ?? null,
|
|
688
746
|
);
|
|
747
|
+
const tailAssistantDbIdRef = useRef<string | null>(tailAssistantDbId);
|
|
748
|
+
tailAssistantDbIdRef.current = tailAssistantDbId;
|
|
749
|
+
const [manualMemoryNotice, setManualMemoryNotice] = useState<SavedMemoryNotice | null>(null);
|
|
750
|
+
const handleOpenMemorySettings = useCallback(
|
|
751
|
+
(target: { scope: "user" | "workspace" | "tenant"; scopeId: string }) => {
|
|
752
|
+
navigate(buildMemorySettingsUrl(target));
|
|
753
|
+
},
|
|
754
|
+
[navigate],
|
|
755
|
+
);
|
|
689
756
|
|
|
690
757
|
const handleModeChange = useCallback(
|
|
691
758
|
(next: ChatMode) => {
|
|
@@ -926,9 +993,62 @@ function AgentChatView({
|
|
|
926
993
|
if (response.messages) setMessages(chronological(response.messages));
|
|
927
994
|
});
|
|
928
995
|
});
|
|
996
|
+
const offMemorySaved = bridge.onPackEvent("memory:saved", (value) => {
|
|
997
|
+
const payload = value as {
|
|
998
|
+
chatId?: string;
|
|
999
|
+
messageId?: string;
|
|
1000
|
+
savedMemories?: SavedMemoryNotice[];
|
|
1001
|
+
};
|
|
1002
|
+
if (payload.chatId !== chatId || !payload.messageId) return;
|
|
1003
|
+
if (!Array.isArray(payload.savedMemories) || payload.savedMemories.length === 0) return;
|
|
1004
|
+
const incoming = payload.savedMemories;
|
|
1005
|
+
const targetId = payload.messageId;
|
|
1006
|
+
const isTail = targetId === tailAssistantDbIdRef.current;
|
|
1007
|
+
if (isTail) {
|
|
1008
|
+
const mergedTail = mergeSavedMemoriesJson(tailLiveMetadataRef.current, incoming);
|
|
1009
|
+
tailLiveMetadataRef.current = mergedTail;
|
|
1010
|
+
setTailLiveMetadata(mergedTail);
|
|
1011
|
+
}
|
|
1012
|
+
setLiveMetadataByMessageId((prev) => {
|
|
1013
|
+
const next = {
|
|
1014
|
+
...prev,
|
|
1015
|
+
[targetId]: mergeSavedMemoriesJson(prev[targetId], incoming),
|
|
1016
|
+
};
|
|
1017
|
+
if (isTail) {
|
|
1018
|
+
const last = latestMessagesRef.current[latestMessagesRef.current.length - 1];
|
|
1019
|
+
if (last?.role === "assistant") {
|
|
1020
|
+
next[last.id] = mergeSavedMemoriesJson(
|
|
1021
|
+
next[last.id] ?? tailLiveMetadataRef.current,
|
|
1022
|
+
incoming,
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return next;
|
|
1027
|
+
});
|
|
1028
|
+
const currentList = latestMessagesRef.current;
|
|
1029
|
+
let changed = false;
|
|
1030
|
+
const nextMessages = currentList.map((m, idx) => {
|
|
1031
|
+
const matchesTail =
|
|
1032
|
+
isTail && idx === currentList.length - 1 && m.role === "assistant";
|
|
1033
|
+
if (m.id !== targetId && !matchesTail) return m;
|
|
1034
|
+
const currentMeta = (m as ChatMessageWithMetadata).messageMetadata;
|
|
1035
|
+
changed = true;
|
|
1036
|
+
return {
|
|
1037
|
+
...m,
|
|
1038
|
+
messageMetadata: mergeSavedMemoriesJson(
|
|
1039
|
+
typeof currentMeta === "string" ? currentMeta : null,
|
|
1040
|
+
incoming,
|
|
1041
|
+
),
|
|
1042
|
+
} as ChatMessage;
|
|
1043
|
+
});
|
|
1044
|
+
if (changed) {
|
|
1045
|
+
setMessages(nextMessages);
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
929
1048
|
return () => {
|
|
930
1049
|
offStarted();
|
|
931
1050
|
offFinished();
|
|
1051
|
+
offMemorySaved();
|
|
932
1052
|
};
|
|
933
1053
|
}, [chatId, setMessages]);
|
|
934
1054
|
|
|
@@ -1074,6 +1194,53 @@ function AgentChatView({
|
|
|
1074
1194
|
const handleSubmit = useCallback(
|
|
1075
1195
|
(input: { content: string; metadata?: Record<string, unknown> }) => {
|
|
1076
1196
|
const trimmedCmd = input.content.trim();
|
|
1197
|
+
const memoryCmd = parseMemorySlashCommand(trimmedCmd);
|
|
1198
|
+
if (memoryCmd) {
|
|
1199
|
+
if (memoryCmd.kind === "open-settings") {
|
|
1200
|
+
navigate(
|
|
1201
|
+
buildMemorySettingsUrl(
|
|
1202
|
+
chatProject
|
|
1203
|
+
? { scope: "workspace", scopeId: chatProject.folderPath }
|
|
1204
|
+
: { scope: "user", scopeId: "default" },
|
|
1205
|
+
),
|
|
1206
|
+
);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
if (memoryCmd.kind === "missing-content") {
|
|
1210
|
+
setNewChatError(t("Usage: /refine <preference or project rule to remember>"));
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
if (hasHostBridge()) {
|
|
1214
|
+
const scope = chatProject ? ("workspace" as const) : ("user" as const);
|
|
1215
|
+
const scopeId = chatProject?.folderPath ?? "default";
|
|
1216
|
+
void proposeMemoryRefinement({
|
|
1217
|
+
scope,
|
|
1218
|
+
...(chatProject ? { scopeId: chatProject.folderPath } : {}),
|
|
1219
|
+
chatId,
|
|
1220
|
+
turnId: `slash_${Date.now()}`,
|
|
1221
|
+
content: memoryCmd.content,
|
|
1222
|
+
})
|
|
1223
|
+
.then((res) => {
|
|
1224
|
+
if (res.accepted && res.meta) {
|
|
1225
|
+
setNewChatError(null);
|
|
1226
|
+
setManualMemoryNotice({
|
|
1227
|
+
refinementId: res.meta.id,
|
|
1228
|
+
scope: res.meta.scope,
|
|
1229
|
+
scopeId,
|
|
1230
|
+
summary: memoryCmd.content.slice(0, 72),
|
|
1231
|
+
});
|
|
1232
|
+
} else {
|
|
1233
|
+
setNewChatError(
|
|
1234
|
+
t("This memory rule was previously withdrawn or conflicts with manual edits."),
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
})
|
|
1238
|
+
.catch((err: unknown) =>
|
|
1239
|
+
setNewChatError(err instanceof Error ? err.message : String(err)),
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1077
1244
|
if (/^\/compact(?:\s+|$)/i.test(trimmedCmd) && hasHostBridge()) {
|
|
1078
1245
|
const focusArg = trimmedCmd.replace(/^\/compact\s*/i, "").trim();
|
|
1079
1246
|
void compactChat(chatId, focusArg ? { focus: focusArg } : {})
|
|
@@ -1140,7 +1307,16 @@ function AgentChatView({
|
|
|
1140
1307
|
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
1141
1308
|
});
|
|
1142
1309
|
},
|
|
1143
|
-
[
|
|
1310
|
+
[
|
|
1311
|
+
sendUserMessage,
|
|
1312
|
+
modelOverride,
|
|
1313
|
+
effortOverride,
|
|
1314
|
+
execPolicy,
|
|
1315
|
+
chatId,
|
|
1316
|
+
onBranchTick,
|
|
1317
|
+
chatProject,
|
|
1318
|
+
navigate,
|
|
1319
|
+
],
|
|
1144
1320
|
);
|
|
1145
1321
|
|
|
1146
1322
|
const handleEditUserMessage = useCallback(
|
|
@@ -1578,12 +1754,35 @@ function AgentChatView({
|
|
|
1578
1754
|
!hasMapped && !tailLiveMetadata
|
|
1579
1755
|
? messages
|
|
1580
1756
|
: messages.map((m, idx) => {
|
|
1581
|
-
|
|
1757
|
+
const existingMeta = (m as ChatMessageWithMetadata).messageMetadata;
|
|
1582
1758
|
const mapped =
|
|
1583
1759
|
liveMetadataByMessageId[m.id] ??
|
|
1584
1760
|
(idx === messages.length - 1 && m.role === "assistant"
|
|
1585
1761
|
? (tailLiveMetadata ?? undefined)
|
|
1586
1762
|
: undefined);
|
|
1763
|
+
if (typeof existingMeta === "string" && existingMeta) {
|
|
1764
|
+
if (!mapped || !mapped.includes('"savedMemories"')) return m;
|
|
1765
|
+
try {
|
|
1766
|
+
const parsedMapped = JSON.parse(mapped) as {
|
|
1767
|
+
savedMemories?: SavedMemoryNotice[];
|
|
1768
|
+
};
|
|
1769
|
+
if (
|
|
1770
|
+
Array.isArray(parsedMapped.savedMemories) &&
|
|
1771
|
+
parsedMapped.savedMemories.length > 0
|
|
1772
|
+
) {
|
|
1773
|
+
return {
|
|
1774
|
+
...m,
|
|
1775
|
+
messageMetadata: mergeSavedMemoriesJson(
|
|
1776
|
+
existingMeta,
|
|
1777
|
+
parsedMapped.savedMemories,
|
|
1778
|
+
),
|
|
1779
|
+
} as ChatMessage;
|
|
1780
|
+
}
|
|
1781
|
+
} catch {
|
|
1782
|
+
return m;
|
|
1783
|
+
}
|
|
1784
|
+
return m;
|
|
1785
|
+
}
|
|
1587
1786
|
if (!mapped) return m;
|
|
1588
1787
|
return { ...m, messageMetadata: mapped } as ChatMessage;
|
|
1589
1788
|
});
|
|
@@ -1740,6 +1939,7 @@ function AgentChatView({
|
|
|
1740
1939
|
)}
|
|
1741
1940
|
<LocalChatPanel
|
|
1742
1941
|
chatId={chatId}
|
|
1942
|
+
preserveDraft
|
|
1743
1943
|
messages={effectiveMessages}
|
|
1744
1944
|
isStreaming={effectiveIsStreaming}
|
|
1745
1945
|
onSubmit={handleSubmit}
|
|
@@ -1816,6 +2016,7 @@ function AgentChatView({
|
|
|
1816
2016
|
onShare={hasHostBridge() ? handleShare : undefined}
|
|
1817
2017
|
suggestedReplies={visibleSuggestedReplies}
|
|
1818
2018
|
onSelectSuggestion={handleSelectSuggestion}
|
|
2019
|
+
onOpenMemorySettings={handleOpenMemorySettings}
|
|
1819
2020
|
onOpenSettings={
|
|
1820
2021
|
hasHostBridge() && settingsChrome("llm")
|
|
1821
2022
|
? () => setLlmSettingsOpen(true)
|
|
@@ -1880,6 +2081,38 @@ function AgentChatView({
|
|
|
1880
2081
|
</button>
|
|
1881
2082
|
</div>
|
|
1882
2083
|
) : null}
|
|
2084
|
+
{manualMemoryNotice ? (
|
|
2085
|
+
<div
|
|
2086
|
+
data-testid="manual-memory-notice"
|
|
2087
|
+
className="mb-1 flex items-center justify-between gap-2 rounded-agent-md border border-agent-border/60 bg-agent-muted/40 px-2.5 py-1.5"
|
|
2088
|
+
>
|
|
2089
|
+
<MemorySaveNoticeBar
|
|
2090
|
+
refinementId={manualMemoryNotice.refinementId}
|
|
2091
|
+
scope={manualMemoryNotice.scope}
|
|
2092
|
+
summary={manualMemoryNotice.summary}
|
|
2093
|
+
chatId={chatId}
|
|
2094
|
+
workspaceId={
|
|
2095
|
+
manualMemoryNotice.scope === "workspace"
|
|
2096
|
+
? manualMemoryNotice.scopeId
|
|
2097
|
+
: undefined
|
|
2098
|
+
}
|
|
2099
|
+
onEdit={() =>
|
|
2100
|
+
handleOpenMemorySettings({
|
|
2101
|
+
scope: manualMemoryNotice.scope,
|
|
2102
|
+
scopeId: manualMemoryNotice.scopeId,
|
|
2103
|
+
})
|
|
2104
|
+
}
|
|
2105
|
+
/>
|
|
2106
|
+
<button
|
|
2107
|
+
type="button"
|
|
2108
|
+
onClick={() => setManualMemoryNotice(null)}
|
|
2109
|
+
className="rounded px-1 text-xs text-agent-muted-foreground hover:text-agent-foreground"
|
|
2110
|
+
aria-label={t("Dismiss")}
|
|
2111
|
+
>
|
|
2112
|
+
✕
|
|
2113
|
+
</button>
|
|
2114
|
+
</div>
|
|
2115
|
+
) : null}
|
|
1883
2116
|
<GoalLoopStatusBar
|
|
1884
2117
|
chatId={chatId}
|
|
1885
2118
|
goal={goal}
|
|
@@ -1929,7 +2162,14 @@ function EmptyChatGate() {
|
|
|
1929
2162
|
const navigate = useNavigate();
|
|
1930
2163
|
const [searchParams] = useSearchParams();
|
|
1931
2164
|
const projectIdFromUrl = searchParams.get("projectId");
|
|
1932
|
-
const [inputValue,
|
|
2165
|
+
const [inputValue, setInputValueState] = useState(() => getChatDraft(null));
|
|
2166
|
+
const setInputValue = useCallback((next: string | ((prev: string) => string)) => {
|
|
2167
|
+
setInputValueState((prev) => {
|
|
2168
|
+
const resolved = typeof next === "function" ? next(prev) : next;
|
|
2169
|
+
setChatDraft(null, resolved);
|
|
2170
|
+
return resolved;
|
|
2171
|
+
});
|
|
2172
|
+
}, []);
|
|
1933
2173
|
const [files, setFiles] = useState<AttachmentFile[]>([]);
|
|
1934
2174
|
const [mentionReferences, setMentionReferences] = useState<
|
|
1935
2175
|
MentionReference[]
|
|
@@ -1940,6 +2180,7 @@ function EmptyChatGate() {
|
|
|
1940
2180
|
const [effortOverride, setEffortOverride] = useState<string | null>(null);
|
|
1941
2181
|
const [isCreating, setIsCreating] = useState(false);
|
|
1942
2182
|
const [createError, setCreateError] = useState<string | null>(null);
|
|
2183
|
+
const [homeMemoryNotice, setHomeMemoryNotice] = useState<SavedMemoryNotice | null>(null);
|
|
1943
2184
|
const [llmSettingsOpen, setLlmSettingsOpen] = useState(false);
|
|
1944
2185
|
const inputRef = useRef<ChatInputHandle>(null);
|
|
1945
2186
|
|
|
@@ -1984,6 +2225,58 @@ function EmptyChatGate() {
|
|
|
1984
2225
|
async (rawText: string, overrideMode?: ChatMode) => {
|
|
1985
2226
|
if (isCreating) return;
|
|
1986
2227
|
let trimmed = rawText.trim();
|
|
2228
|
+
const memoryCmd = !overrideMode && trimmed ? parseMemorySlashCommand(trimmed) : null;
|
|
2229
|
+
if (memoryCmd) {
|
|
2230
|
+
const selectedProject =
|
|
2231
|
+
selectedProjectId && showProjectsChrome
|
|
2232
|
+
? projects.find((p) => p.id === selectedProjectId) ?? null
|
|
2233
|
+
: null;
|
|
2234
|
+
if (memoryCmd.kind === "open-settings") {
|
|
2235
|
+
setInputValue("");
|
|
2236
|
+
navigate(
|
|
2237
|
+
buildMemorySettingsUrl(
|
|
2238
|
+
selectedProject
|
|
2239
|
+
? { scope: "workspace", scopeId: selectedProject.folderPath }
|
|
2240
|
+
: { scope: "user", scopeId: "default" },
|
|
2241
|
+
),
|
|
2242
|
+
);
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
if (memoryCmd.kind === "missing-content") {
|
|
2246
|
+
setCreateError(t("Usage: /refine <preference or project rule to remember>"));
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
if (hasHostBridge()) {
|
|
2250
|
+
const scope = selectedProject ? ("workspace" as const) : ("user" as const);
|
|
2251
|
+
const scopeId = selectedProject?.folderPath ?? "default";
|
|
2252
|
+
try {
|
|
2253
|
+
const res = await proposeMemoryRefinement({
|
|
2254
|
+
scope,
|
|
2255
|
+
...(selectedProject ? { scopeId: selectedProject.folderPath } : {}),
|
|
2256
|
+
chatId: "home_slash",
|
|
2257
|
+
turnId: `slash_${Date.now()}`,
|
|
2258
|
+
content: memoryCmd.content,
|
|
2259
|
+
});
|
|
2260
|
+
if (res.accepted && res.meta) {
|
|
2261
|
+
setCreateError(null);
|
|
2262
|
+
setInputValue("");
|
|
2263
|
+
setHomeMemoryNotice({
|
|
2264
|
+
refinementId: res.meta.id,
|
|
2265
|
+
scope: res.meta.scope,
|
|
2266
|
+
scopeId,
|
|
2267
|
+
summary: memoryCmd.content.slice(0, 72),
|
|
2268
|
+
});
|
|
2269
|
+
} else {
|
|
2270
|
+
setCreateError(
|
|
2271
|
+
t("This memory rule was previously withdrawn or conflicts with manual edits."),
|
|
2272
|
+
);
|
|
2273
|
+
}
|
|
2274
|
+
} catch (err) {
|
|
2275
|
+
setCreateError(err instanceof Error ? err.message : String(err));
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
1987
2280
|
let effectiveMode = overrideMode ?? mode;
|
|
1988
2281
|
const slashCmd = !overrideMode && trimmed ? parseModeSlashCommand(trimmed) : null;
|
|
1989
2282
|
if (slashCmd) {
|
|
@@ -2052,6 +2345,7 @@ function EmptyChatGate() {
|
|
|
2052
2345
|
};
|
|
2053
2346
|
|
|
2054
2347
|
writeChatModeForSession(id, effectiveMode);
|
|
2348
|
+
clearChatDraft(null);
|
|
2055
2349
|
setPendingFirstMessage({
|
|
2056
2350
|
chatId: id,
|
|
2057
2351
|
content,
|
|
@@ -2075,6 +2369,8 @@ function EmptyChatGate() {
|
|
|
2075
2369
|
isCreating,
|
|
2076
2370
|
selectedProjectId,
|
|
2077
2371
|
showProjectsChrome,
|
|
2372
|
+
projects,
|
|
2373
|
+
setInputValue,
|
|
2078
2374
|
ctx,
|
|
2079
2375
|
navigate,
|
|
2080
2376
|
],
|
|
@@ -2100,6 +2396,40 @@ function EmptyChatGate() {
|
|
|
2100
2396
|
<div className="flex w-full max-w-3xl flex-col items-center gap-4">
|
|
2101
2397
|
<EmptyChatHero />
|
|
2102
2398
|
<div className="w-full">
|
|
2399
|
+
{homeMemoryNotice ? (
|
|
2400
|
+
<div
|
|
2401
|
+
data-testid="manual-memory-notice"
|
|
2402
|
+
className="mb-1.5 flex items-center justify-between gap-2 rounded-agent-md border border-agent-border/60 bg-agent-muted/40 px-2.5 py-1.5"
|
|
2403
|
+
>
|
|
2404
|
+
<MemorySaveNoticeBar
|
|
2405
|
+
refinementId={homeMemoryNotice.refinementId}
|
|
2406
|
+
scope={homeMemoryNotice.scope}
|
|
2407
|
+
summary={homeMemoryNotice.summary}
|
|
2408
|
+
chatId="home_slash"
|
|
2409
|
+
workspaceId={
|
|
2410
|
+
homeMemoryNotice.scope === "workspace"
|
|
2411
|
+
? homeMemoryNotice.scopeId
|
|
2412
|
+
: undefined
|
|
2413
|
+
}
|
|
2414
|
+
onEdit={() =>
|
|
2415
|
+
navigate(
|
|
2416
|
+
buildMemorySettingsUrl({
|
|
2417
|
+
scope: homeMemoryNotice.scope,
|
|
2418
|
+
scopeId: homeMemoryNotice.scopeId,
|
|
2419
|
+
}),
|
|
2420
|
+
)
|
|
2421
|
+
}
|
|
2422
|
+
/>
|
|
2423
|
+
<button
|
|
2424
|
+
type="button"
|
|
2425
|
+
onClick={() => setHomeMemoryNotice(null)}
|
|
2426
|
+
className="rounded px-1 text-xs text-agent-muted-foreground hover:text-agent-foreground"
|
|
2427
|
+
aria-label={t("Dismiss")}
|
|
2428
|
+
>
|
|
2429
|
+
✕
|
|
2430
|
+
</button>
|
|
2431
|
+
</div>
|
|
2432
|
+
) : null}
|
|
2103
2433
|
<ChatInput
|
|
2104
2434
|
ref={inputRef}
|
|
2105
2435
|
value={inputValue}
|