@nextclaw/ui 0.14.1-beta.1 → 0.14.1

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 (69) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/assets/{api-dQ6uQSZG.js → api-DPcvCLfa.js} +3 -3
  3. package/dist/assets/{channels-list-page-DfpjB8XB.js → channels-list-page-D6jtziu4.js} +2 -2
  4. package/dist/assets/chat-page-BBnNJoKG.js +105 -0
  5. package/dist/assets/{config-split-page-CeFfbaqc.js → config-split-page-BCJhqdK9.js} +1 -1
  6. package/dist/assets/{confirm-dialog-C95Y4QPC.js → confirm-dialog-CWh5FfK2.js} +1 -1
  7. package/dist/assets/{desktop-update-config-CcK6jiEb.js → desktop-update-config-DsRhBizi.js} +1 -1
  8. package/dist/assets/{dist-DTGzeil6.js → dist-DPrgcEC0.js} +1 -1
  9. package/dist/assets/{dist-fGogBmPA.js → dist-DsE4OsSS.js} +1 -1
  10. package/dist/assets/doc-browser-C8xOF_9F.js +1 -0
  11. package/dist/assets/{doc-browser-DVHhEb96.js → doc-browser-DgQedeAn.js} +1 -1
  12. package/dist/assets/{doc-browser-context-BfMXwnrz.js → doc-browser-context-B46tQGmO.js} +1 -1
  13. package/dist/assets/{ellipsis-D2F4KMiU.js → ellipsis-B81FStLm.js} +1 -1
  14. package/dist/assets/{external-link-CcgtBK26.js → external-link-C_dmG-WJ.js} +1 -1
  15. package/dist/assets/index-7o1WdUbU.js +103 -0
  16. package/dist/assets/index-DQWmEWzk.css +1 -0
  17. package/dist/assets/mcp-marketplace-page-CWZN7ohK.js +1 -0
  18. package/dist/assets/mcp-marketplace-page-Dzull_4-.js +40 -0
  19. package/dist/assets/{model-config-page-aAUkZkSX.js → model-config-page-Cv0O3BIj.js} +1 -1
  20. package/dist/assets/plus-Bnt56oqG.js +1 -0
  21. package/dist/assets/{provider-scoped-model-input-we4_Z4gP.js → provider-scoped-model-input-Duuh7i3h.js} +1 -1
  22. package/dist/assets/{providers-config-page-CtMkPSyu.js → providers-config-page-CPDz0Lxc.js} +1 -1
  23. package/dist/assets/{react-CTqdhFMk.js → react-sZz5HSCm.js} +1 -1
  24. package/dist/assets/remote-B0LMs8u7.js +1 -0
  25. package/dist/assets/rotate-cw-BfyG_KEF.js +1 -0
  26. package/dist/assets/{runtime-config-page-TD1UrTbG.js → runtime-config-page-q0fvv8ME.js} +1 -1
  27. package/dist/assets/{save-C9fKWfVB.js → save-MzjoiHri.js} +1 -1
  28. package/dist/assets/{search-D5FQ5q0X.js → search-B29dE4GN.js} +1 -1
  29. package/dist/assets/{search-config-page-AMEJJNIS.js → search-config-page-Dl5sZzob.js} +1 -1
  30. package/dist/assets/{secrets-config-page-CcgJnvBO.js → secrets-config-page-C_l-IFCK.js} +2 -2
  31. package/dist/assets/{select-Cu5n0E-3.js → select-BKmh05hd.js} +1 -1
  32. package/dist/assets/{tag-chip-C5aOtjxu.js → tag-chip-BS_7Ueom.js} +1 -1
  33. package/dist/assets/use-config-DZkBWIdL.js +1 -0
  34. package/dist/assets/x-CW2KO-Hz.js +1 -0
  35. package/dist/index.html +14 -14
  36. package/package.json +9 -9
  37. package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +70 -7
  38. package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +104 -16
  39. package/src/features/chat/components/layout/chat-sidebar.tsx +21 -2
  40. package/src/features/chat/features/input/hooks/use-chat-model-favorites.ts +2 -1
  41. package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +3 -2
  42. package/src/features/chat/features/session-type/components/__tests__/{chat-sidebar-create-menu.test.tsx → chat-session-type-menu.test.tsx} +3 -3
  43. package/src/features/chat/features/session-type/components/__tests__/chat-session-type-option-item.test.tsx +27 -1
  44. package/src/features/chat/features/session-type/components/{chat-sidebar-create-menu.tsx → chat-session-type-menu.tsx} +11 -7
  45. package/src/features/chat/features/session-type/components/chat-session-type-option-item.tsx +15 -3
  46. package/src/features/chat/features/session-type/hooks/__tests__/use-chat-new-session-type-preference.test.tsx +152 -0
  47. package/src/features/chat/features/session-type/hooks/use-chat-new-session-type-preference.ts +159 -0
  48. package/src/features/marketplace/components/__tests__/marketplace-page.test.tsx +24 -0
  49. package/src/features/marketplace/components/curated-shelves/marketplace-shelf-card.tsx +8 -3
  50. package/src/features/marketplace/components/marketplace-item-list-view.tsx +2 -2
  51. package/src/features/marketplace/components/marketplace-list-card.tsx +124 -98
  52. package/src/features/marketplace/components/marketplace-page-parts.tsx +11 -6
  53. package/src/shared/components/common/__tests__/agent-avatar.test.tsx +3 -1
  54. package/src/shared/components/common/agent-avatar.tsx +5 -2
  55. package/src/shared/lib/api/index.ts +1 -0
  56. package/src/shared/lib/api/preferences/preference-keys.config.ts +9 -0
  57. package/src/shared/lib/i18n/locales/en-US/marketplace.json +2 -0
  58. package/src/shared/lib/i18n/locales/zh-CN/marketplace.json +2 -0
  59. package/dist/assets/chat-page-D3QaEqjs.js +0 -105
  60. package/dist/assets/doc-browser-CuBTcBEZ.js +0 -1
  61. package/dist/assets/index-ByJCbQqr.css +0 -1
  62. package/dist/assets/index-DjXqiloY.js +0 -103
  63. package/dist/assets/mcp-marketplace-page-98-V__3u.js +0 -1
  64. package/dist/assets/mcp-marketplace-page-BNq_PNmO.js +0 -40
  65. package/dist/assets/plus-1Rxl5FlV.js +0 -1
  66. package/dist/assets/remote-fQ7N_r8u.js +0 -1
  67. package/dist/assets/rotate-cw-CzfIeAJj.js +0 -1
  68. package/dist/assets/use-config-D8TESeo6.js +0 -1
  69. package/dist/assets/x-1qETdQ70.js +0 -1
@@ -0,0 +1,159 @@
1
+ import { useCallback, useMemo } from "react";
2
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import {
4
+ fetchPreference,
5
+ PREFERENCE_KEYS,
6
+ updatePreference,
7
+ type PreferenceEntryView,
8
+ } from "@/shared/lib/api";
9
+ import {
10
+ normalizeSessionType,
11
+ type ChatSessionTypeOption,
12
+ } from "@/features/chat/features/session-type/utils/chat-session-type.utils";
13
+
14
+ const CHAT_NEW_SESSION_TYPE_PREFERENCE_KEY =
15
+ PREFERENCE_KEYS.chat.newSessionType;
16
+ const chatNewSessionTypePreferenceQueryKey = [
17
+ "preference",
18
+ CHAT_NEW_SESSION_TYPE_PREFERENCE_KEY,
19
+ ] as const;
20
+
21
+ type UseChatNewSessionTypePreferenceParams = {
22
+ defaultSessionType: string;
23
+ sessionTypeOptions: readonly ChatSessionTypeOption[];
24
+ };
25
+
26
+ function findSelectableSessionTypeOption(
27
+ sessionType: string,
28
+ sessionTypeOptions: readonly ChatSessionTypeOption[],
29
+ ): ChatSessionTypeOption | null {
30
+ const normalizedSessionType = normalizeSessionType(sessionType);
31
+ return (
32
+ sessionTypeOptions.find(
33
+ (option) =>
34
+ option.value === normalizedSessionType && option.ready !== false,
35
+ ) ?? null
36
+ );
37
+ }
38
+
39
+ function resolveNewSessionTypeOption(params: {
40
+ preferredSessionType: string | null;
41
+ defaultSessionType: string;
42
+ sessionTypeOptions: readonly ChatSessionTypeOption[];
43
+ }): ChatSessionTypeOption {
44
+ const { defaultSessionType, preferredSessionType, sessionTypeOptions } =
45
+ params;
46
+ const preferredOption = preferredSessionType
47
+ ? findSelectableSessionTypeOption(preferredSessionType, sessionTypeOptions)
48
+ : null;
49
+ const defaultOption = findSelectableSessionTypeOption(
50
+ defaultSessionType,
51
+ sessionTypeOptions,
52
+ );
53
+ return (
54
+ preferredOption ??
55
+ defaultOption ??
56
+ sessionTypeOptions.find((option) => option.ready !== false) ??
57
+ sessionTypeOptions[0] ?? {
58
+ value: normalizeSessionType(defaultSessionType),
59
+ label: normalizeSessionType(defaultSessionType),
60
+ icon: null,
61
+ ready: true,
62
+ reason: null,
63
+ reasonMessage: null,
64
+ supportedModels: undefined,
65
+ recommendedModel: null,
66
+ modelSelectionMode: "nextclaw",
67
+ runtimeDefaultThinking: null,
68
+ cta: null,
69
+ }
70
+ );
71
+ }
72
+
73
+ function readPreferredSessionType(entry: PreferenceEntryView | undefined) {
74
+ return typeof entry?.value === "string"
75
+ ? normalizeSessionType(entry.value)
76
+ : null;
77
+ }
78
+
79
+ export function useChatNewSessionTypePreference({
80
+ defaultSessionType,
81
+ sessionTypeOptions,
82
+ }: UseChatNewSessionTypePreferenceParams) {
83
+ const queryClient = useQueryClient();
84
+ const preferenceQuery = useQuery({
85
+ queryKey: chatNewSessionTypePreferenceQueryKey,
86
+ queryFn: () => fetchPreference(CHAT_NEW_SESSION_TYPE_PREFERENCE_KEY),
87
+ staleTime: 30_000,
88
+ retry: false,
89
+ });
90
+ const preferredSessionType = useMemo(
91
+ () => readPreferredSessionType(preferenceQuery.data),
92
+ [preferenceQuery.data],
93
+ );
94
+ const selectedSessionTypeOption = useMemo(
95
+ () =>
96
+ resolveNewSessionTypeOption({
97
+ preferredSessionType,
98
+ defaultSessionType,
99
+ sessionTypeOptions,
100
+ }),
101
+ [defaultSessionType, preferredSessionType, sessionTypeOptions],
102
+ );
103
+ const updateNewSessionType = useMutation({
104
+ mutationFn: async (sessionType: string) =>
105
+ await updatePreference(
106
+ CHAT_NEW_SESSION_TYPE_PREFERENCE_KEY,
107
+ normalizeSessionType(sessionType),
108
+ ),
109
+ onMutate: async (sessionType) => {
110
+ const normalizedSessionType = normalizeSessionType(sessionType);
111
+ await queryClient.cancelQueries({
112
+ queryKey: chatNewSessionTypePreferenceQueryKey,
113
+ });
114
+ const previous = queryClient.getQueryData<PreferenceEntryView>(
115
+ chatNewSessionTypePreferenceQueryKey,
116
+ );
117
+ queryClient.setQueryData<PreferenceEntryView>(
118
+ chatNewSessionTypePreferenceQueryKey,
119
+ {
120
+ key: CHAT_NEW_SESSION_TYPE_PREFERENCE_KEY,
121
+ value: normalizedSessionType,
122
+ updatedAt: new Date().toISOString(),
123
+ },
124
+ );
125
+ return { previous };
126
+ },
127
+ onError: (_error, _sessionType, context) => {
128
+ if (context?.previous) {
129
+ queryClient.setQueryData(
130
+ chatNewSessionTypePreferenceQueryKey,
131
+ context.previous,
132
+ );
133
+ }
134
+ },
135
+ onSuccess: (entry) => {
136
+ queryClient.setQueryData(chatNewSessionTypePreferenceQueryKey, entry);
137
+ },
138
+ });
139
+ const setSelectedSessionType = useCallback(
140
+ (sessionType: string) => {
141
+ const nextOption = findSelectableSessionTypeOption(
142
+ sessionType,
143
+ sessionTypeOptions,
144
+ );
145
+ if (!nextOption) {
146
+ return;
147
+ }
148
+ updateNewSessionType.mutate(nextOption.value);
149
+ },
150
+ [sessionTypeOptions, updateNewSessionType],
151
+ );
152
+
153
+ return {
154
+ selectedSessionType: selectedSessionTypeOption.value,
155
+ selectedSessionTypeOption,
156
+ isLoading: preferenceQuery.isLoading,
157
+ setSelectedSessionType,
158
+ };
159
+ }
@@ -236,6 +236,30 @@ describe("MarketplacePage", () => {
236
236
  expect(card?.textContent).not.toContain("Skill");
237
237
  });
238
238
 
239
+ it("hides redundant skill tags while keeping useful tags", () => {
240
+ mocks.itemsQuery = createItemsQuery({
241
+ data: {
242
+ total: 1,
243
+ page: 1,
244
+ pageSize: 20,
245
+ totalPages: 1,
246
+ sort: "relevance",
247
+ items: [
248
+ createMarketplaceItem({
249
+ tags: ["skill", "automation", "Skill", "ops"],
250
+ }),
251
+ ],
252
+ } satisfies MarketplaceListView,
253
+ });
254
+
255
+ render(<MarketplacePage forcedType="skills" />);
256
+
257
+ expect(screen.queryByText("skill")).toBeNull();
258
+ expect(screen.queryByText("Skill")).toBeNull();
259
+ expect(screen.getAllByText("automation").length).toBeGreaterThan(0);
260
+ expect(screen.getAllByText("ops").length).toBeGreaterThan(0);
261
+ });
262
+
239
263
  it("does not dim the loaded list during background refresh", () => {
240
264
  mocks.itemsQuery = createItemsQuery({
241
265
  data: {
@@ -46,7 +46,7 @@ export function SkillShelfCard(props: {
46
46
  layout === "rail" ? "w-[260px] shrink-0" : "w-full min-w-0",
47
47
  )}
48
48
  >
49
- <div>
49
+ <div className="flex min-h-0 flex-1 flex-col">
50
50
  <div className="mb-2.5 flex min-w-0 items-start gap-2.5">
51
51
  <MarketplaceItemIcon name={item.name} fallback={item.install.spec} />
52
52
  <div className="min-w-0 flex-1 pt-0.5">
@@ -97,17 +97,22 @@ function formatShelfMeta(item: MarketplaceItemSummary) {
97
97
  }
98
98
 
99
99
  function TagLine({ tags }: { tags: string[] }) {
100
- const visibleTags = tags.slice(0, 2);
100
+ const visibleTags = tags.filter(isVisibleShelfTag).slice(0, 2);
101
101
  if (visibleTags.length === 0) {
102
102
  return null;
103
103
  }
104
104
  return (
105
- <div className="mt-2 truncate text-[11px] font-medium text-gray-400">
105
+ <div className="mt-auto truncate pt-2 text-[11px] font-medium text-gray-400">
106
106
  {visibleTags.join(" / ")}
107
107
  </div>
108
108
  );
109
109
  }
110
110
 
111
+ function isVisibleShelfTag(tag: string) {
112
+ const normalized = tag.trim().toLowerCase();
113
+ return normalized.length > 0 && normalized !== "skill";
114
+ }
115
+
111
116
  function formatUpdatedAt(value: string) {
112
117
  const date = value.slice(0, 10);
113
118
  return date || value;
@@ -127,8 +127,8 @@ export function MarketplaceItemListView({
127
127
  <div
128
128
  data-testid={showSkeleton ? "marketplace-list-skeleton" : undefined}
129
129
  className={cn(
130
- "grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3",
131
- showSkeleton && "min-h-0 flex-1 auto-rows-[104px] content-start",
130
+ "grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3",
131
+ showSkeleton && "min-h-0 flex-1 auto-rows-[156px] content-start",
132
132
  )}
133
133
  >
134
134
  {showSkeleton && <MarketplaceListSkeleton count={36} />}
@@ -37,7 +37,6 @@ type MarketplaceListCardActionProps = {
37
37
  record?: MarketplaceInstalledRecord;
38
38
  state: {
39
39
  isInstalling: boolean;
40
- isDisabled: boolean;
41
40
  canUpdate: boolean;
42
41
  canUninstall: boolean;
43
42
  busyAction?: MarketplaceManageAction;
@@ -52,17 +51,15 @@ type MarketplaceListCardActionProps = {
52
51
  function MarketplaceListCardMeta({
53
52
  title,
54
53
  spec,
55
- summary,
56
54
  }: {
57
55
  title: string;
58
56
  spec: string;
59
- summary: string;
60
57
  }) {
61
58
  return (
62
59
  <TooltipProvider delayDuration={400}>
63
60
  <Tooltip>
64
61
  <TooltipTrigger asChild>
65
- <div className="truncate text-[14px] font-semibold leading-tight text-gray-900">
62
+ <div className="truncate text-[14px] font-semibold leading-tight text-gray-950">
66
63
  {title}
67
64
  </div>
68
65
  </TooltipTrigger>
@@ -71,11 +68,11 @@ function MarketplaceListCardMeta({
71
68
  </TooltipContent>
72
69
  </Tooltip>
73
70
 
74
- <div className="mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5">
71
+ <div className="mb-2 mt-1 flex min-w-0 items-center gap-1.5">
75
72
  {spec ? (
76
73
  <Tooltip>
77
74
  <TooltipTrigger asChild>
78
- <span className="max-w-full truncate text-[11px] font-mono text-gray-400">
75
+ <span className="max-w-full truncate text-[11px] font-mono leading-tight text-gray-400">
79
76
  {spec}
80
77
  </span>
81
78
  </TooltipTrigger>
@@ -85,15 +82,11 @@ function MarketplaceListCardMeta({
85
82
  </Tooltip>
86
83
  ) : null}
87
84
  </div>
88
-
89
- <p className="line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90">
90
- {summary}
91
- </p>
92
85
  </TooltipProvider>
93
86
  );
94
87
  }
95
88
 
96
- function MarketplaceListCardActions(props: MarketplaceListCardActionProps) {
89
+ function MarketplaceListCardActionButtons(props: MarketplaceListCardActionProps) {
97
90
  const {
98
91
  item,
99
92
  record,
@@ -103,96 +96,94 @@ function MarketplaceListCardActions(props: MarketplaceListCardActionProps) {
103
96
  } = props;
104
97
  const {
105
98
  isInstalling,
106
- isDisabled,
107
99
  canUpdate,
108
100
  canUninstall,
109
101
  busyAction,
110
102
  } = state;
111
103
  const busyForRecord = Boolean(busyAction);
112
104
  const hasActions = Boolean((item && !record) || (record && (canUpdate || canUninstall)));
105
+ if (!hasActions) {
106
+ return null;
107
+ }
113
108
 
114
109
  return (
115
110
  <div
116
111
  className={cn(
117
- "relative flex h-8 shrink-0 items-center justify-end",
118
- record ? "md:w-5" : "md:w-0",
112
+ "flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150",
113
+ "md:pointer-events-none md:opacity-0",
114
+ "md:group-hover:pointer-events-auto md:group-hover:opacity-100",
115
+ "md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100",
119
116
  )}
120
117
  >
121
- <div
122
- className={cn(
123
- "hidden items-center justify-end transition-opacity duration-150 md:flex",
124
- hasActions && "group-hover:opacity-0 group-focus-within:opacity-0",
125
- )}
126
- >
127
- {record ? (
128
- <MarketplaceInstalledStatusIcon disabled={isDisabled} />
129
- ) : null}
130
- </div>
118
+ {item && !record && (
119
+ <button
120
+ onClick={(event) => {
121
+ event.stopPropagation();
122
+ onInstall(item);
123
+ }}
124
+ disabled={isInstalling}
125
+ className="inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50"
126
+ >
127
+ <Download className="h-3 w-3" />
128
+ {isInstalling ? t("marketplaceInstalling") : t("marketplaceInstall")}
129
+ </button>
130
+ )}
131
131
 
132
- <div
133
- className={cn(
134
- "flex w-max items-center justify-end gap-2 transition-opacity duration-150",
135
- "opacity-100 md:pointer-events-none md:absolute md:right-0 md:opacity-0",
136
- "md:group-hover:pointer-events-auto md:group-hover:opacity-100",
137
- "md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100",
138
- )}
139
- >
140
- {item && !record && (
141
- <button
142
- onClick={(event) => {
143
- event.stopPropagation();
144
- onInstall(item);
145
- }}
146
- disabled={isInstalling}
147
- className="inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl bg-primary px-3 text-xs font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50"
148
- >
149
- <Download className="h-3.5 w-3.5" />
150
- {isInstalling ? t("marketplaceInstalling") : t("marketplaceInstall")}
151
- </button>
152
- )}
132
+ {record && canUpdate && (
133
+ <button
134
+ disabled={busyForRecord}
135
+ onClick={(event) => {
136
+ event.stopPropagation();
137
+ onManage("update", record);
138
+ }}
139
+ className="inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50"
140
+ >
141
+ <RefreshCw className="h-3 w-3" />
142
+ {busyAction === "update"
143
+ ? t("marketplaceUpdating")
144
+ : t("marketplaceUpdate")}
145
+ </button>
146
+ )}
153
147
 
154
- {record && canUpdate && (
155
- <button
156
- disabled={busyForRecord}
157
- onClick={(event) => {
158
- event.stopPropagation();
159
- onManage("update", record);
160
- }}
161
- className="inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-blue-200/80 bg-white px-3 text-xs font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50"
162
- >
163
- <RefreshCw className="h-3.5 w-3.5" />
164
- {busyAction === "update"
165
- ? t("marketplaceUpdating")
166
- : t("marketplaceUpdate")}
167
- </button>
168
- )}
148
+ {record && canUninstall && (
149
+ <button
150
+ disabled={busyForRecord}
151
+ onClick={(event) => {
152
+ event.stopPropagation();
153
+ onManage("uninstall", record);
154
+ }}
155
+ className="inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50"
156
+ >
157
+ <Trash2 className="h-3 w-3" />
158
+ {busyAction === "uninstall"
159
+ ? t("marketplaceRemoving")
160
+ : t("marketplaceUninstall")}
161
+ </button>
162
+ )}
163
+ </div>
164
+ );
165
+ }
169
166
 
170
- {record && canUninstall && (
171
- <button
172
- disabled={busyForRecord}
173
- onClick={(event) => {
174
- event.stopPropagation();
175
- onManage("uninstall", record);
176
- }}
177
- className="inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 text-xs font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50"
178
- >
179
- <Trash2 className="h-3.5 w-3.5" />
180
- {busyAction === "uninstall"
181
- ? t("marketplaceRemoving")
182
- : t("marketplaceUninstall")}
183
- </button>
184
- )}
185
- </div>
167
+ function MarketplaceListCardStatus(props: {
168
+ record?: MarketplaceInstalledRecord;
169
+ disabled: boolean;
170
+ }) {
171
+ const { record, disabled } = props;
172
+ if (!record) {
173
+ return null;
174
+ }
175
+ return (
176
+ <div className="flex h-5 w-5 shrink-0 items-center justify-end">
177
+ <MarketplaceInstalledStatusIcon disabled={disabled} />
186
178
  </div>
187
179
  );
188
180
  }
189
181
 
190
182
  function MarketplaceInstalledStatusIcon(props: { disabled: boolean }) {
191
183
  const { disabled } = props;
192
- const { language } = useI18n();
193
184
  const label = disabled
194
- ? readLocalized({ zh: "已禁用", en: "Disabled" }, language)
195
- : readLocalized({ zh: "已安装", en: "Installed" }, language);
185
+ ? t("marketplaceDisabledStatus")
186
+ : t("marketplaceInstalledStatus");
196
187
 
197
188
  return (
198
189
  <TooltipProvider delayDuration={300}>
@@ -251,6 +242,7 @@ export function MarketplaceListCard(props: {
251
242
  pickLocalizedText(item?.summaryI18n, item?.summary, localeFallbacks) ||
252
243
  (record ? t("marketplaceInstalledLocalSummary") : "");
253
244
  const spec = item?.install.spec ?? record?.spec ?? "";
245
+ const tags = item?.tags ?? [];
254
246
  const targetId = record?.id || record?.spec;
255
247
  const busyAction = targetId
256
248
  ? manageState.actionsByTarget.get(targetId)
@@ -268,35 +260,69 @@ export function MarketplaceListCard(props: {
268
260
  return (
269
261
  <article
270
262
  onClick={onOpen}
271
- className="group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md"
263
+ className="group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60"
272
264
  >
273
- <div className="flex min-w-0 flex-1 gap-3">
265
+ <div className="flex min-w-0 items-start gap-2.5">
274
266
  <MarketplaceItemIcon
275
267
  name={title}
276
268
  fallback={spec || t("marketplaceTypeSkill")}
269
+ className="h-9 w-9 rounded-lg text-xs"
277
270
  />
278
- <div className="flex min-w-0 flex-1 flex-col justify-center">
279
- <MarketplaceListCardMeta title={title} spec={spec} summary={summary} />
271
+ <div className="flex min-w-0 flex-1 flex-col">
272
+ <MarketplaceListCardMeta title={title} spec={spec} />
280
273
  </div>
274
+
275
+ <MarketplaceListCardStatus record={record} disabled={isDisabled} />
281
276
  </div>
282
277
 
283
- <MarketplaceListCardActions
284
- item={item}
285
- record={record}
286
- state={{
287
- isInstalling,
288
- isDisabled,
289
- canUpdate,
290
- canUninstall,
291
- busyAction,
292
- }}
293
- onInstall={onInstall}
294
- onManage={onManage}
295
- />
278
+ <div className="mt-2 flex min-w-0 flex-1 flex-col">
279
+ <p className="line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500">
280
+ {summary}
281
+ </p>
282
+
283
+ <div className="mt-auto flex min-w-0 items-end justify-between gap-2 pt-2">
284
+ <div className="min-w-0 flex-1">
285
+ <MarketplaceListCardTags tags={tags} />
286
+ </div>
287
+ <MarketplaceListCardActionButtons
288
+ item={item}
289
+ record={record}
290
+ state={{
291
+ isInstalling,
292
+ canUpdate,
293
+ canUninstall,
294
+ busyAction,
295
+ }}
296
+ onInstall={onInstall}
297
+ onManage={onManage}
298
+ />
299
+ </div>
300
+ </div>
296
301
  </article>
297
302
  );
298
303
  }
299
304
 
300
- function readLocalized(text: { zh: string; en: string }, language: string) {
301
- return language.startsWith("zh") ? text.zh : text.en;
305
+ function MarketplaceListCardTags({ tags }: { tags: string[] }) {
306
+ const visibleTags = tags.filter(isVisibleMarketplaceTag).slice(0, 3);
307
+ if (visibleTags.length === 0) {
308
+ return null;
309
+ }
310
+
311
+ return (
312
+ <div className="flex min-w-0 flex-wrap gap-1.5 overflow-hidden">
313
+ {visibleTags.map((tag) => (
314
+ <span
315
+ key={tag}
316
+ className="max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500"
317
+ >
318
+ {tag}
319
+ </span>
320
+ ))}
321
+ </div>
322
+ );
323
+ }
324
+
325
+ function isVisibleMarketplaceTag(tag: string) {
326
+ const normalized = tag.trim().toLowerCase();
327
+ return normalized.length > 0 && normalized !== "skill";
302
328
  }
@@ -78,21 +78,26 @@ export function MarketplaceListSkeleton({ count }: {
78
78
  {Array.from({ length: count }, (_, index) => (
79
79
  <article
80
80
  key={`marketplace-skeleton-${index}`}
81
- className="h-full rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm"
81
+ className="h-full rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm"
82
82
  >
83
- <div className="flex items-start justify-between gap-3.5">
84
- <div className="flex min-w-0 flex-1 gap-3">
85
- <Skeleton className="h-10 w-10 shrink-0 rounded-xl" />
86
- <div className="min-w-0 flex-1 space-y-2 pt-0.5">
83
+ <div className="flex items-start justify-between gap-2.5">
84
+ <div className="flex min-w-0 flex-1 gap-2.5">
85
+ <Skeleton className="h-9 w-9 shrink-0 rounded-lg" />
86
+ <div className="min-w-0 flex-1 space-y-2">
87
87
  <Skeleton className="h-4 w-32 max-w-[70%]" />
88
88
  <div className="flex items-center gap-2">
89
89
  <Skeleton className="h-3 w-12" />
90
90
  <Skeleton className="h-3 w-24" />
91
91
  </div>
92
92
  <Skeleton className="h-3 w-full" />
93
+ <div className="flex gap-1.5 pt-0.5">
94
+ <Skeleton className="h-5 w-14 rounded-md" />
95
+ <Skeleton className="h-5 w-16 rounded-md" />
96
+ <Skeleton className="h-5 w-12 rounded-md" />
97
+ </div>
93
98
  </div>
94
99
  </div>
95
- <Skeleton className="h-8 w-20 shrink-0 rounded-xl" />
100
+ <Skeleton className="h-7 w-16 shrink-0 rounded-md" />
96
101
  </div>
97
102
  </article>
98
103
  ))}
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from '@testing-library/react';
2
2
  import { describe, expect, it } from 'vitest';
3
- import { AgentAvatar } from '../agent-avatar';
3
+ import { AgentAvatar } from '@/shared/components/common/agent-avatar';
4
4
 
5
5
  describe('AgentAvatar', () => {
6
6
  it('uses the configured image for the main agent before fallback', () => {
@@ -23,6 +23,8 @@ describe('AgentAvatar', () => {
23
23
  const avatar = screen.getByLabelText('Main');
24
24
  expect(avatar.querySelector('svg')).toBeTruthy();
25
25
  expect(avatar.textContent).not.toContain('M');
26
+ expect(avatar.className).toContain('bg-primary');
27
+ expect(avatar.className).toContain('text-primary-foreground');
26
28
  });
27
29
 
28
30
  it('keeps letter fallback avatars for specialist agents', () => {
@@ -28,7 +28,10 @@ function hashText(value: string): number {
28
28
 
29
29
  export function AgentAvatar({ agentId, displayName, avatarUrl, className }: AgentAvatarProps) {
30
30
  const seed = displayName?.trim() || agentId;
31
- const [bgClass, textClass] = PALETTE[hashText(agentId) % PALETTE.length] ?? PALETTE[0];
31
+ const isMainAgent = agentId.trim().toLowerCase() === 'main';
32
+ const [paletteBgClass, paletteTextClass] = PALETTE[hashText(agentId) % PALETTE.length] ?? PALETTE[0];
33
+ const bgClass = isMainAgent ? 'bg-primary' : paletteBgClass;
34
+ const textClass = isMainAgent ? 'text-primary-foreground' : paletteTextClass;
32
35
 
33
36
  if (avatarUrl?.trim()) {
34
37
  return (
@@ -50,7 +53,7 @@ export function AgentAvatar({ agentId, displayName, avatarUrl, className }: Agen
50
53
  )}
51
54
  aria-label={displayName?.trim() || agentId}
52
55
  >
53
- {agentId.trim().toLowerCase() === 'main' ? (
56
+ {isMainAgent ? (
54
57
  <Bot className="h-[55%] w-[55%]" strokeWidth={2.4} />
55
58
  ) : (
56
59
  (seed.trim() || 'A').slice(0, 1).toUpperCase()
@@ -12,6 +12,7 @@ export * from './utils/ncp-attachments.utils';
12
12
  export * from './utils/ncp-session.utils';
13
13
  export * from './preferences/preference.utils';
14
14
  export * from './preferences/preference.types';
15
+ export * from './preferences/preference-keys.config';
15
16
  export * from './ncp-session.types';
16
17
  export * from './ncp-session-query-cache.utils';
17
18
  export * from './raw-client.utils';
@@ -0,0 +1,9 @@
1
+ export const PREFERENCE_KEYS = {
2
+ chat: {
3
+ modelFavorites: "chat.modelFavorites",
4
+ newSessionType: "chat.newSession.sessionType",
5
+ },
6
+ } as const;
7
+
8
+ export type PreferenceKey =
9
+ (typeof PREFERENCE_KEYS.chat)[keyof typeof PREFERENCE_KEYS.chat];
@@ -20,6 +20,8 @@
20
20
  "marketplaceTypeMcp": "MCP",
21
21
  "marketplaceInstall": "Install",
22
22
  "marketplaceInstalling": "Installing...",
23
+ "marketplaceInstalledStatus": "Installed",
24
+ "marketplaceDisabledStatus": "Disabled",
23
25
  "marketplaceEnable": "Enable",
24
26
  "marketplaceDisable": "Disable",
25
27
  "marketplaceEnabling": "Enabling...",
@@ -20,6 +20,8 @@
20
20
  "marketplaceTypeMcp": "MCP",
21
21
  "marketplaceInstall": "安装",
22
22
  "marketplaceInstalling": "安装中...",
23
+ "marketplaceInstalledStatus": "已安装",
24
+ "marketplaceDisabledStatus": "已禁用",
23
25
  "marketplaceEnable": "启用",
24
26
  "marketplaceDisable": "禁用",
25
27
  "marketplaceEnabling": "启用中...",