@steerable/agent-shell-web 0.14.5 → 0.14.6

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 (28) hide show
  1. package/package.json +4 -4
  2. package/src/components/chat/LocalChatPanel.tsx +26 -1
  3. package/src/components/settings/AgentsSettingsPanel.tsx +3 -3
  4. package/src/components/settings/AppUpdateSettingsPanel.tsx +67 -43
  5. package/src/components/settings/AppearanceSettingsPanel.tsx +101 -134
  6. package/src/components/settings/CliInstallSettingsPanel.tsx +25 -23
  7. package/src/components/settings/DiagnoseSettingsPanel.tsx +3 -3
  8. package/src/components/settings/InsightsSettingsPanel.tsx +5 -7
  9. package/src/components/settings/LlmSettingsPanel.tsx +22 -2
  10. package/src/components/settings/McpSettingsPanel.tsx +4 -5
  11. package/src/components/settings/MemorySettingsPanel.tsx +210 -159
  12. package/src/components/settings/OrchestrationSettingsPanel.tsx +79 -121
  13. package/src/components/settings/PortableSettingsPanel.tsx +62 -49
  14. package/src/components/settings/PythonRunnerSettingsPanel.tsx +2 -4
  15. package/src/components/settings/SecuritySettingsPanel.tsx +91 -70
  16. package/src/components/settings/SettingsSidebar.tsx +238 -0
  17. package/src/components/settings/SkillsSettingsPanel.tsx +3 -4
  18. package/src/components/settings/TelemetrySettingsPanel.tsx +2 -7
  19. package/src/components/settings/UsagePanel.tsx +27 -35
  20. package/src/components/settings/WebSearchSettingsPanel.tsx +89 -88
  21. package/src/components/settings/primitives.tsx +302 -0
  22. package/src/components/settings/settings-registry.ts +371 -0
  23. package/src/layouts/AgentLayout.tsx +106 -6
  24. package/src/lib/chat-draft-store.ts +43 -0
  25. package/src/packs/registry.ts +2 -0
  26. package/src/pages/AgentPage.tsx +11 -1
  27. package/src/pages/SettingsPage.tsx +327 -489
  28. package/src/styles/index.css +6 -0
@@ -32,6 +32,7 @@ import { ModelCapabilityChips } from '@/components/settings/ModelCapabilityChips
32
32
  import { modelCapabilityChips } from '@/components/settings/model-capabilities';
33
33
  import { ModelIdCombobox } from '@/components/settings/ModelIdCombobox';
34
34
  import { SettingsSaveButton } from '@/components/settings/SettingsSaveButton';
35
+ import { SettingDisclosure } from '@/components/settings/primitives';
35
36
  import { t } from '@/i18n';
36
37
  import { hasHostBridge } from '@/lib/host-bridge';
37
38
  import {
@@ -69,6 +70,8 @@ interface LlmSettingsPanelProps {
69
70
  onSaved?: (settings: LlmSettings) => void;
70
71
  onSaveUiChange?: (ui: LlmSaveUi) => void;
71
72
  showFooterSave?: boolean;
73
+ /** 在设置页子页面内默认将预制/兼容旗标/预算/超时折叠进高级区,保持首屏清爽。 */
74
+ collapseAdvanced?: boolean;
72
75
  }
73
76
 
74
77
  // ─── 厂商参数预制(框架 llm.presets)────────────────────────────────────────
@@ -78,12 +81,12 @@ interface LlmSettingsPanelProps {
78
81
  /**
79
82
  * LlmSettingsPanel — 本地模型设置表单(服务商 / URL / Key / 模型 / 预制 / 超时)。
80
83
  *
81
- * 两处复用:设置页「设置」分区,以及输入区齿轮打开的 LocalLlmSettingsModal。
84
+ * 两处复用:设置页「模型服务」子页,以及输入区齿轮打开的 LocalLlmSettingsModal。
82
85
  * 挂载时自取当前配置;保存走 local-api `setLlmSettings`。
83
86
  */
84
87
  export const LlmSettingsPanel = forwardRef<LlmSettingsPanelHandle, LlmSettingsPanelProps>(
85
88
  function LlmSettingsPanel(
86
- { onSaved, onSaveUiChange, showFooterSave = true },
89
+ { onSaved, onSaveUiChange, showFooterSave = true, collapseAdvanced = false },
87
90
  ref,
88
91
  ) {
89
92
  const [settings, setSettings] = useState<LlmSettings>({
@@ -613,6 +616,9 @@ export const LlmSettingsPanel = forwardRef<LlmSettingsPanelHandle, LlmSettingsPa
613
616
  </p>
614
617
  </div>
615
618
 
619
+ {(() => {
620
+ const advancedBody = (
621
+ <div className="space-y-4">
616
622
  {usesOpenAiCompatExtras(settings.provider) && (
617
623
  <div className="rounded-agent-md border border-agent-border/60 p-3 space-y-3">
618
624
  <div>
@@ -889,6 +895,20 @@ export const LlmSettingsPanel = forwardRef<LlmSettingsPanelHandle, LlmSettingsPa
889
895
  </div>
890
896
 
891
897
  </div>
898
+ </div>
899
+ );
900
+ if (!collapseAdvanced) return advancedBody;
901
+ return (
902
+ <SettingDisclosure
903
+ title={t('Advanced parameters & compatibility')}
904
+ summary={`${t('Token budget limit')}: ${(settings.maxTotalTokens ?? 60000).toLocaleString()}`}
905
+ defaultOpen={false}
906
+ testId="llm-advanced-disclosure"
907
+ >
908
+ {advancedBody}
909
+ </SettingDisclosure>
910
+ );
911
+ })()}
892
912
  </>
893
913
  )}
894
914
 
@@ -281,11 +281,10 @@ export function McpSettingsPanel() {
281
281
  };
282
282
 
283
283
  return (
284
- <div className="space-y-3">
284
+ <div className="space-y-5">
285
285
  {/* JSON 导入 */}
286
- <div className="bg-agent-muted/30 border border-agent-border/60 rounded-agent-md p-2.5 space-y-2">
287
- <h4 className="text-xs font-semibold text-agent-foreground flex items-center gap-1.5">
288
- <LuPlug className="h-3.5 w-3.5 text-agent-muted-foreground" />
286
+ <div className="space-y-2.5 border-t border-b border-agent-border/60 py-4">
287
+ <h4 className="text-xs font-medium text-agent-foreground">
289
288
  {t('Paste JSON to import (Claude Desktop format)')}
290
289
  </h4>
291
290
  <textarea
@@ -322,7 +321,7 @@ export function McpSettingsPanel() {
322
321
 
323
322
  {/* 手动添加 / 编辑表单 */}
324
323
  {mcpFormOpen ? (
325
- <div className="bg-agent-muted/30 border border-agent-border/60 rounded-agent-md p-2.5 space-y-2.5">
324
+ <div className="space-y-3 rounded-agent-md border border-agent-border bg-agent-canvas p-4">
326
325
  <h4 className="text-xs font-semibold text-agent-foreground">
327
326
  {mcpEditingId ? t('Edit MCP server') : t('Add MCP server manually')}
328
327
  </h4>
@@ -1,6 +1,12 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
+ import { LuCheck, LuLoaderCircle } from 'react-icons/lu';
2
3
  import { t } from '@/i18n';
3
4
  import { getHostBridge, hasHostBridge } from '@/lib/host-bridge';
5
+ import {
6
+ SettingRow,
7
+ SettingSection,
8
+ SettingSegmented,
9
+ } from './primitives';
4
10
 
5
11
  export type MemoryScopeTab = 'user' | 'workspace' | 'tenant';
6
12
  export type MemoryPermissionMode = 'off' | 'ask' | 'auto';
@@ -97,6 +103,7 @@ export function MemorySettingsPanel({
97
103
  const [scope, setScope] = useState<MemoryScopeTab>('user');
98
104
  const [permissionMode, setPermissionMode] = useState<MemoryPermissionMode>('ask');
99
105
  const [markdown, setMarkdown] = useState('');
106
+ const [savedMarkdown, setSavedMarkdown] = useState('');
100
107
  const [baseHash, setBaseHash] = useState('');
101
108
  const [bytesUsed, setBytesUsed] = useState(0);
102
109
  const [maxBytes, setMaxBytes] = useState(16384);
@@ -104,6 +111,7 @@ export function MemorySettingsPanel({
104
111
  const [revokedHashes, setRevokedHashes] = useState<string[]>([]);
105
112
  const [conflictBanner, setConflictBanner] = useState(false);
106
113
  const [saving, setSaving] = useState(false);
114
+ const [savedOk, setSavedOk] = useState(false);
107
115
 
108
116
  const loadScope = useCallback(
109
117
  async (targetScope: MemoryScopeTab) => {
@@ -115,8 +123,10 @@ export function MemorySettingsPanel({
115
123
  );
116
124
  if (res.status === 200) {
117
125
  const d = res.data as unknown as MemoryApiResponse;
126
+ const content = d.contentMarkdown ?? '';
118
127
  setPermissionMode(d.permissionMode ?? 'ask');
119
- setMarkdown(d.contentMarkdown ?? '');
128
+ setMarkdown(content);
129
+ setSavedMarkdown(content);
120
130
  setBaseHash(d.contentSha256 ?? '');
121
131
  setBytesUsed(d.bytesUsed ?? 0);
122
132
  setMaxBytes(d.maxBytes || 16384);
@@ -138,10 +148,12 @@ export function MemorySettingsPanel({
138
148
  };
139
149
 
140
150
  const readOnly = scope === 'tenant' && !isAdmin;
151
+ const isDirty = markdown !== savedMarkdown;
141
152
 
142
153
  const handleSave = async () => {
143
154
  if (readOnly) return;
144
155
  setSaving(true);
156
+ setSavedOk(false);
145
157
  try {
146
158
  const res = await requestMemoryApi('PUT', '/api/v2/memory', {
147
159
  scope,
@@ -155,6 +167,7 @@ export function MemorySettingsPanel({
155
167
  }
156
168
  if (res.status === 200) {
157
169
  await loadScope(scope);
170
+ setSavedOk(true);
158
171
  }
159
172
  } finally {
160
173
  setSaving(false);
@@ -174,184 +187,222 @@ export function MemorySettingsPanel({
174
187
  const activeRefinements = refinements.filter((r) => r.status === 'active');
175
188
  const ratio = Math.min(100, Math.round((bytesUsed / Math.max(1, maxBytes)) * 100));
176
189
 
190
+ const modeDescription =
191
+ permissionMode === 'off'
192
+ ? t('Do not extract or save memories from conversations automatically.')
193
+ : permissionMode === 'ask'
194
+ ? t('Ask for your confirmation before saving newly detected preferences.')
195
+ : t('Automatically remember stable preferences and workspace conventions.');
196
+
197
+ const scopeDescription =
198
+ scope === 'user'
199
+ ? t('Personal preferences and habits applied across all projects and chats.')
200
+ : scope === 'workspace'
201
+ ? t('Conventions and context scoped to the current project workspace.')
202
+ : t('Shared rules enforced across all members in your department.');
203
+
204
+ const scopeTabs: Array<{ id: MemoryScopeTab; label: string; testId: string }> = [
205
+ { id: 'user', label: t('Personal memory'), testId: 'memory-tab-user' },
206
+ { id: 'workspace', label: t('Project memory'), testId: 'memory-tab-workspace' },
207
+ ...(showTenantTab
208
+ ? [{ id: 'tenant' as const, label: t('Department shared rules'), testId: 'memory-tab-tenant' }]
209
+ : []),
210
+ ];
211
+
177
212
  return (
178
- <div
179
- data-testid="memory-settings-panel"
180
- className="space-y-4 rounded-xl border border-agent-border bg-agent-card p-4 text-xs"
181
- >
182
- {/* Top bar: permission mode + quota meter */}
183
- <div className="flex flex-wrap items-center justify-between gap-3">
184
- <div className="flex items-center gap-1.5" role="radiogroup" aria-label={t('Memory mode')}>
185
- {(
186
- [
187
- ['off', t('Off')],
188
- ['ask', t('Ask before saving')],
189
- ['auto', t('Remember automatically')],
190
- ] as const
191
- ).map(([val, label]) => (
192
- <button
193
- key={val}
194
- type="button"
195
- data-testid={`memory-mode-${val}`}
196
- onClick={() => void handleModeChange(val)}
197
- className={`rounded-md px-2.5 py-1 text-xs transition ${
198
- permissionMode === val
199
- ? 'bg-agent-foreground font-semibold text-agent-background'
200
- : 'border border-agent-border text-agent-muted-foreground hover:text-agent-foreground'
201
- }`}
202
- >
203
- {label}
204
- </button>
205
- ))}
206
- </div>
207
- <div className="flex items-center gap-2 text-[11px] text-agent-muted-foreground">
208
- <span data-testid="memory-quota-label">
209
- {(bytesUsed / 1024).toFixed(1)} / {(maxBytes / 1024).toFixed(1)} KB
210
- </span>
211
- <div className="h-1.5 w-24 overflow-hidden rounded-full bg-agent-border">
212
- <div className="h-full bg-agent-foreground" style={{ width: `${ratio}%` }} />
213
+ <div data-testid="memory-settings-panel" className="space-y-6 text-xs">
214
+ {/* ───── 记忆模式(极简细分割线行 + 标准紧凑分段胶囊)───── */}
215
+ <SettingSection>
216
+ <SettingRow
217
+ title={t('Memory mode')}
218
+ description={modeDescription}
219
+ control={
220
+ <SettingSegmented
221
+ value={permissionMode}
222
+ onChange={(val) => void handleModeChange(val)}
223
+ ariaLabel={t('Memory mode')}
224
+ options={[
225
+ { value: 'off', label: t('Off'), testId: 'memory-mode-off' },
226
+ { value: 'ask', label: t('Ask before saving'), testId: 'memory-mode-ask' },
227
+ { value: 'auto', label: t('Remember automatically'), testId: 'memory-mode-auto' },
228
+ ]}
229
+ />
230
+ }
231
+ />
232
+ </SettingSection>
233
+
234
+ {/* ───── MEMORY.md 作用域切换与编辑工作台 ───── */}
235
+ <div className="space-y-3">
236
+ <div className="flex flex-wrap items-center justify-between gap-3">
237
+ <div className="inline-flex items-center rounded-lg bg-agent-muted/70 p-0.5 ring-1 ring-inset ring-agent-border/60">
238
+ {scopeTabs.map((tab) => {
239
+ const active = scope === tab.id;
240
+ return (
241
+ <button
242
+ key={tab.id}
243
+ type="button"
244
+ data-testid={tab.testId}
245
+ onClick={() => {
246
+ setSavedOk(false);
247
+ setScope(tab.id);
248
+ }}
249
+ className={[
250
+ 'h-7 rounded-md px-3 text-xs transition-all',
251
+ active
252
+ ? 'bg-agent-canvas font-medium text-agent-foreground shadow-2xs ring-1 ring-inset ring-agent-border/60'
253
+ : 'text-agent-muted-foreground hover:text-agent-foreground',
254
+ ].join(' ')}
255
+ >
256
+ {tab.label}
257
+ </button>
258
+ );
259
+ })}
260
+ </div>
261
+
262
+ <div className="flex items-center gap-2.5 text-[11px] text-agent-muted-foreground">
263
+ <span data-testid="memory-quota-label" className="tabular-nums">
264
+ {(bytesUsed / 1024).toFixed(1)} / {(maxBytes / 1024).toFixed(1)} KB
265
+ </span>
266
+ <div className="h-1.5 w-24 overflow-hidden rounded-full bg-agent-border/80">
267
+ <div
268
+ className="h-full rounded-full bg-agent-foreground transition-all"
269
+ style={{ width: `${ratio}%` }}
270
+ />
271
+ </div>
213
272
  </div>
214
273
  </div>
215
- </div>
216
274
 
217
- {/* Scope tabs */}
218
- <div className="flex items-center gap-2 border-b border-agent-border pb-2">
219
- <button
220
- type="button"
221
- data-testid="memory-tab-user"
222
- onClick={() => setScope('user')}
223
- className={`rounded px-2.5 py-1 ${
224
- scope === 'user' ? 'bg-agent-foreground/10 font-semibold' : 'text-agent-muted-foreground'
225
- }`}
226
- >
227
- {t('Personal memory')}
228
- </button>
229
- <button
230
- type="button"
231
- data-testid="memory-tab-workspace"
232
- onClick={() => setScope('workspace')}
233
- className={`rounded px-2.5 py-1 ${
234
- scope === 'workspace'
235
- ? 'bg-agent-foreground/10 font-semibold'
236
- : 'text-agent-muted-foreground'
237
- }`}
238
- >
239
- {t('Project memory')}
240
- </button>
241
- {showTenantTab ? (
242
- <button
243
- type="button"
244
- data-testid="memory-tab-tenant"
245
- onClick={() => setScope('tenant')}
246
- className={`rounded px-2.5 py-1 ${
247
- scope === 'tenant'
248
- ? 'bg-agent-foreground/10 font-semibold'
249
- : 'text-agent-muted-foreground'
250
- }`}
251
- >
252
- {t('Department shared rules')}
253
- </button>
254
- ) : null}
255
- </div>
275
+ <p className="text-xs leading-relaxed text-agent-muted-foreground">{scopeDescription}</p>
256
276
 
257
- {/* Optimistic lock conflict banner */}
258
- {conflictBanner ? (
259
- <div
260
- role="alert"
261
- data-testid="memory-conflict-banner"
262
- className="flex items-center justify-between gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-amber-900 dark:text-amber-200"
263
- >
264
- <span>{t('Memory changed in another session. Reload before saving.')}</span>
265
- <button
266
- type="button"
267
- data-testid="memory-conflict-reload"
268
- onClick={() => void loadScope(scope)}
269
- className="rounded bg-amber-600 px-2 py-1 text-white"
277
+ {/* Optimistic lock conflict banner */}
278
+ {conflictBanner ? (
279
+ <div
280
+ role="alert"
281
+ data-testid="memory-conflict-banner"
282
+ className="flex items-center justify-between gap-2 rounded-agent-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-amber-900 dark:text-amber-200"
270
283
  >
271
- {t('Reload')}
272
- </button>
273
- </div>
274
- ) : null}
275
-
276
- {/* MEMORY.md editor */}
277
- <div className="space-y-2">
278
- <textarea
279
- rows={6}
280
- readOnly={readOnly}
281
- value={markdown}
282
- onChange={(e) => setMarkdown(e.target.value)}
283
- aria-label={t('Memory markdown editor')}
284
- data-testid="memory-markdown-editor"
285
- className="w-full rounded-lg border border-agent-border bg-agent-background p-2.5 font-mono text-xs"
286
- />
287
- {!readOnly ? (
288
- <div className="flex justify-end">
284
+ <span>{t('Memory changed in another session. Reload before saving.')}</span>
289
285
  <button
290
286
  type="button"
291
- disabled={saving}
292
- onClick={() => void handleSave()}
293
- data-testid="memory-save-btn"
294
- className="rounded-md bg-agent-foreground px-3 py-1.5 text-xs font-medium text-agent-background disabled:opacity-50"
287
+ data-testid="memory-conflict-reload"
288
+ onClick={() => void loadScope(scope)}
289
+ className="h-6 shrink-0 rounded-full bg-amber-600 px-2.5 text-xs font-medium text-white hover:bg-amber-700"
295
290
  >
296
- {t('Save memory')}
291
+ {t('Reload')}
297
292
  </button>
298
293
  </div>
299
- ) : (
300
- <p className="text-[11px] text-agent-muted-foreground">
301
- {t('Read-only: only administrators can edit department shared rules.')}
302
- </p>
303
- )}
294
+ ) : null}
295
+
296
+ {/* MEMORY.md editor */}
297
+ <div className="space-y-2.5">
298
+ <textarea
299
+ rows={10}
300
+ readOnly={readOnly}
301
+ value={markdown}
302
+ onChange={(e) => {
303
+ setMarkdown(e.target.value);
304
+ if (savedOk) setSavedOk(false);
305
+ }}
306
+ onKeyDown={(e) => {
307
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 's') {
308
+ e.preventDefault();
309
+ void handleSave();
310
+ }
311
+ }}
312
+ placeholder={t(
313
+ '- Reply in Chinese with conclusions first\n- Use strict TypeScript and concise comments',
314
+ )}
315
+ aria-label={t('Memory markdown editor')}
316
+ data-testid="memory-markdown-editor"
317
+ className="w-full rounded-agent-md border border-agent-border bg-agent-canvas p-3 font-mono text-xs leading-relaxed text-agent-foreground placeholder:text-agent-muted-foreground/60 focus:border-agent-foreground/40 focus:outline-none focus:ring-2 focus:ring-agent-foreground/15"
318
+ />
319
+ {!readOnly ? (
320
+ <div className="flex items-center justify-between gap-3">
321
+ <div className="text-[11px] text-agent-muted-foreground">
322
+ {isDirty ? (
323
+ <span>{t('Unsaved changes · press ⌘S / Ctrl+S to save')}</span>
324
+ ) : savedOk ? (
325
+ <span className="inline-flex items-center gap-1 text-emerald-700 dark:text-emerald-400">
326
+ <LuCheck className="h-3.5 w-3.5" />
327
+ {t('Saved')}
328
+ </span>
329
+ ) : null}
330
+ </div>
331
+ <button
332
+ type="button"
333
+ disabled={saving}
334
+ onClick={() => void handleSave()}
335
+ data-testid="memory-save-btn"
336
+ className={[
337
+ 'inline-flex h-8 items-center gap-1.5 rounded-full px-4 text-xs font-medium transition-all disabled:opacity-50',
338
+ isDirty
339
+ ? 'bg-agent-foreground text-agent-canvas hover:opacity-90'
340
+ : 'border border-agent-border bg-agent-canvas text-agent-foreground hover:bg-agent-muted/60',
341
+ ].join(' ')}
342
+ >
343
+ {saving ? <LuLoaderCircle className="h-3.5 w-3.5 animate-spin" /> : null}
344
+ <span>{t('Save memory')}</span>
345
+ </button>
346
+ </div>
347
+ ) : (
348
+ <p className="text-[11px] text-agent-muted-foreground">
349
+ {t('Read-only: only administrators can edit department shared rules.')}
350
+ </p>
351
+ )}
352
+ </div>
304
353
  </div>
305
354
 
306
355
  {/* Active RSI refinement review queue */}
307
356
  {activeRefinements.length > 0 ? (
308
- <div className="space-y-2 border-t border-agent-border pt-3">
357
+ <div className="space-y-2 border-t border-agent-border/60 pt-4">
309
358
  <div className="font-semibold text-agent-foreground">
310
359
  {t('Refinement notes pending review (30-day expiry)')}
311
360
  </div>
312
- {activeRefinements.map((item) => (
313
- <div
314
- key={item.id}
315
- data-testid={`memory-refinement-${item.id}`}
316
- className="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-agent-border p-2.5"
317
- >
318
- <div className="space-y-0.5">
319
- <div className="text-agent-foreground">{item.content}</div>
320
- <div className="font-mono text-[11px] text-agent-muted-foreground">
321
- {item.id}
322
- {item.expiresAt ? ` · ${t('Expires')} ${item.expiresAt.slice(0, 10)}` : ''}
361
+ <div className="divide-y divide-agent-border/60 border-t border-b border-agent-border/60">
362
+ {activeRefinements.map((item) => (
363
+ <div
364
+ key={item.id}
365
+ data-testid={`memory-refinement-${item.id}`}
366
+ className="flex flex-wrap items-center justify-between gap-3 py-3"
367
+ >
368
+ <div className="space-y-0.5">
369
+ <div className="text-agent-foreground">{item.content}</div>
370
+ <div className="font-mono text-[11px] text-agent-muted-foreground">
371
+ {item.id}
372
+ {item.expiresAt ? ` · ${t('Expires')} ${item.expiresAt.slice(0, 10)}` : ''}
373
+ </div>
323
374
  </div>
375
+ {!readOnly ? (
376
+ <div className="flex items-center gap-1.5">
377
+ <button
378
+ type="button"
379
+ data-testid={`memory-renew-${item.id}`}
380
+ onClick={() => void handleRefinementAction(item.id, 'renew')}
381
+ className="h-7 rounded-full border border-agent-border bg-agent-canvas px-2.5 text-agent-foreground hover:bg-agent-muted/60"
382
+ >
383
+ {t('Renew 30d')}
384
+ </button>
385
+ <button
386
+ type="button"
387
+ data-testid={`memory-convert-${item.id}`}
388
+ onClick={() => void handleRefinementAction(item.id, 'convert')}
389
+ className="h-7 rounded-full border border-agent-border bg-agent-canvas px-2.5 text-agent-foreground hover:bg-agent-muted/60"
390
+ >
391
+ {t('Make ordinary')}
392
+ </button>
393
+ <button
394
+ type="button"
395
+ data-testid={`memory-withdraw-${item.id}`}
396
+ onClick={() => void handleRefinementAction(item.id, 'withdraw')}
397
+ className="h-7 rounded-full border border-agent-destructive/30 px-2.5 text-agent-destructive hover:bg-agent-destructive/10"
398
+ >
399
+ {t('Withdraw')}
400
+ </button>
401
+ </div>
402
+ ) : null}
324
403
  </div>
325
- {!readOnly ? (
326
- <div className="flex items-center gap-1.5">
327
- <button
328
- type="button"
329
- data-testid={`memory-renew-${item.id}`}
330
- onClick={() => void handleRefinementAction(item.id, 'renew')}
331
- className="rounded border border-agent-border px-2 py-1 hover:bg-agent-foreground/5"
332
- >
333
- {t('Renew 30d')}
334
- </button>
335
- <button
336
- type="button"
337
- data-testid={`memory-convert-${item.id}`}
338
- onClick={() => void handleRefinementAction(item.id, 'convert')}
339
- className="rounded border border-agent-border px-2 py-1 hover:bg-agent-foreground/5"
340
- >
341
- {t('Make ordinary')}
342
- </button>
343
- <button
344
- type="button"
345
- data-testid={`memory-withdraw-${item.id}`}
346
- onClick={() => void handleRefinementAction(item.id, 'withdraw')}
347
- className="rounded border border-rose-500/40 px-2 py-1 text-rose-600 hover:bg-rose-500/10"
348
- >
349
- {t('Withdraw')}
350
- </button>
351
- </div>
352
- ) : null}
353
- </div>
354
- ))}
404
+ ))}
405
+ </div>
355
406
  </div>
356
407
  ) : null}
357
408