@nextclaw/ui 0.14.1-beta.0 → 0.14.1-beta.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.
- package/CHANGELOG.md +18 -0
- package/dist/assets/{api-C6EDHBDR.js → api-dQ6uQSZG.js} +3 -3
- package/dist/assets/{channels-list-page-DKj6m1Hc.js → channels-list-page-DfpjB8XB.js} +2 -2
- package/dist/assets/chat-page-D3QaEqjs.js +105 -0
- package/dist/assets/{config-split-page-CjlmJy8X.js → config-split-page-CeFfbaqc.js} +1 -1
- package/dist/assets/{confirm-dialog-B39X0pYp.js → confirm-dialog-C95Y4QPC.js} +1 -1
- package/dist/assets/{desktop-update-config-DfUQ8nly.js → desktop-update-config-CcK6jiEb.js} +1 -1
- package/dist/assets/{dist-CmMro3nV.js → dist-DTGzeil6.js} +1 -1
- package/dist/assets/{dist-BIYV2-Ia.js → dist-fGogBmPA.js} +1 -1
- package/dist/assets/doc-browser-CuBTcBEZ.js +1 -0
- package/dist/assets/{doc-browser-CDtUtcim.js → doc-browser-DVHhEb96.js} +1 -1
- package/dist/assets/{doc-browser-context-DZbC9zVB.js → doc-browser-context-BfMXwnrz.js} +1 -1
- package/dist/assets/{ellipsis-DDpgTzgx.js → ellipsis-D2F4KMiU.js} +1 -1
- package/dist/assets/{external-link-D2cBOCqn.js → external-link-CcgtBK26.js} +1 -1
- package/dist/assets/index-ByJCbQqr.css +1 -0
- package/dist/assets/index-DjXqiloY.js +103 -0
- package/dist/assets/mcp-marketplace-page-98-V__3u.js +1 -0
- package/dist/assets/mcp-marketplace-page-BNq_PNmO.js +40 -0
- package/dist/assets/model-config-page-aAUkZkSX.js +1 -0
- package/dist/assets/plus-1Rxl5FlV.js +1 -0
- package/dist/assets/provider-scoped-model-input-we4_Z4gP.js +1 -0
- package/dist/assets/providers-config-page-CtMkPSyu.js +1 -0
- package/dist/assets/{react-DYQXXGbH.js → react-CTqdhFMk.js} +1 -1
- package/dist/assets/remote-fQ7N_r8u.js +1 -0
- package/dist/assets/rotate-cw-CzfIeAJj.js +1 -0
- package/dist/assets/runtime-config-page-TD1UrTbG.js +1 -0
- package/dist/assets/{save-BNVTgBVn.js → save-C9fKWfVB.js} +1 -1
- package/dist/assets/{search-CKCzwLId.js → search-D5FQ5q0X.js} +1 -1
- package/dist/assets/{search-config-page-DG5Q2hF1.js → search-config-page-AMEJJNIS.js} +1 -1
- package/dist/assets/secrets-config-page-CcgJnvBO.js +3 -0
- package/dist/assets/{select-CIRwTNP4.js → select-Cu5n0E-3.js} +2 -2
- package/dist/assets/{tag-chip-DKhVFtTE.js → tag-chip-C5aOtjxu.js} +1 -1
- package/dist/assets/use-config-D8TESeo6.js +1 -0
- package/dist/assets/x-1qETdQ70.js +1 -0
- package/dist/index.html +14 -14
- package/package.json +9 -9
- package/src/features/chat/components/conversation/__tests__/chat-conversation-panel.test.tsx +12 -63
- package/src/features/chat/components/conversation/chat-conversation-content.tsx +11 -50
- package/src/features/chat/components/conversation/chat-conversation-panel.tsx +15 -2
- package/src/features/chat/features/input/components/chat-input-bar.container.tsx +84 -6
- package/src/features/chat/features/input/hooks/use-chat-input-bar-query-state.ts +2 -0
- package/src/features/chat/features/input/hooks/use-chat-model-favorites.ts +87 -0
- package/src/features/chat/features/input/utils/__tests__/chat-input-bar.utils.test.ts +64 -24
- package/src/features/chat/features/input/utils/__tests__/ncp-chat-input-availability.utils.test.ts +1 -0
- package/src/features/chat/features/input/utils/chat-input-bar.utils.ts +21 -12
- package/src/features/chat/features/input/utils/chat-input-toolbar.utils.ts +80 -25
- package/src/features/chat/features/message/utils/__tests__/chat-message-file-operation.utils.test.ts +310 -0
- package/src/features/chat/features/message/utils/__tests__/chat-message-test.utils.ts +43 -0
- package/src/features/chat/features/message/utils/__tests__/chat-message.utils.test.ts +1 -346
- package/src/features/chat/features/message/utils/chat-message-tool-card.utils.ts +10 -9
- package/src/features/chat/features/message/utils/file-operation/diff.utils.ts +39 -36
- package/src/features/chat/features/message/utils/file-operation/line-builder.utils.ts +46 -38
- package/src/features/chat/features/message/utils/file-operation/parsed-block.utils.ts +18 -15
- package/src/features/chat/features/session/components/session-header/__tests__/chat-session-project-badge.test.tsx +25 -25
- package/src/features/chat/features/session/components/session-header/chat-session-project-badge.tsx +15 -2
- package/src/features/chat/features/session-type/components/__tests__/chat-sidebar-create-menu.test.tsx +24 -0
- package/src/features/chat/features/session-type/components/chat-sidebar-create-menu.tsx +10 -1
- package/src/features/chat/features/welcome/components/__tests__/chat-conversation-welcome.test.tsx +193 -0
- package/src/features/chat/features/welcome/components/__tests__/chat-welcome.test.tsx +123 -0
- package/src/features/chat/features/welcome/components/chat-conversation-welcome.tsx +104 -0
- package/src/features/chat/features/welcome/components/chat-welcome-agent-picker.tsx +72 -0
- package/src/features/chat/features/welcome/components/chat-welcome-capability-grid.tsx +54 -0
- package/src/features/chat/features/welcome/components/chat-welcome-project-picker.tsx +132 -0
- package/src/features/chat/features/welcome/components/chat-welcome-session-type-picker.tsx +82 -0
- package/src/features/chat/features/welcome/components/chat-welcome.tsx +121 -0
- package/src/features/chat/features/welcome/utils/__tests__/chat-welcome-project-options.utils.test.ts +53 -0
- package/src/features/chat/features/welcome/utils/__tests__/chat-welcome-selection.utils.test.ts +63 -0
- package/src/features/chat/features/welcome/utils/__tests__/chat-welcome-visibility.utils.test.ts +34 -0
- package/src/features/chat/features/welcome/utils/chat-welcome-project-options.utils.ts +71 -0
- package/src/features/chat/features/welcome/utils/chat-welcome-selection.utils.ts +79 -0
- package/src/features/chat/features/welcome/utils/chat-welcome-visibility.utils.ts +17 -0
- package/src/features/chat/managers/__tests__/chat-input.manager.test.ts +65 -0
- package/src/features/chat/managers/chat-input.manager.ts +24 -2
- package/src/features/chat/stores/chat-input.store.ts +2 -0
- package/src/features/chat/types/chat-input-bar.types.ts +5 -0
- package/src/features/marketplace/utils/marketplace-installed-cache.utils.ts +27 -23
- package/src/features/settings/components/config/provider-form.tsx +284 -387
- package/src/features/settings/components/config/provider-status-badge.tsx +4 -4
- package/src/features/settings/components/config/secrets-config-form.tsx +11 -135
- package/src/features/settings/hooks/use-provider-auth-flow.ts +140 -0
- package/src/features/settings/pages/__tests__/model-config-page.test.tsx +16 -0
- package/src/features/settings/pages/secrets-config-page.tsx +2 -1
- package/src/features/settings/utils/__tests__/provider-form-support.utils.test.ts +60 -1
- package/src/features/settings/utils/__tests__/secrets-config-form.utils.test.ts +66 -0
- package/src/features/settings/utils/provider-form-context.utils.ts +131 -0
- package/src/features/settings/utils/provider-form-model.utils.ts +101 -0
- package/src/features/settings/utils/provider-form-support.utils.ts +102 -1
- package/src/features/settings/utils/secrets-config-form.utils.ts +139 -0
- package/src/features/system-status/components/config/runtime-agent-list-card.tsx +17 -11
- package/src/features/system-status/components/config/runtime-binding-list-card.tsx +14 -9
- package/src/features/system-status/components/config/runtime-config-editor.tsx +8 -5
- package/src/features/system-status/components/config/runtime-entry-list-card.tsx +14 -9
- package/src/features/system-status/components/config/runtime-settings-card.tsx +16 -7
- package/src/features/system-status/components/runtime-security-card.tsx +79 -25
- package/src/shared/components/common/__tests__/searchable-model-input.test.tsx +34 -0
- package/src/shared/components/common/provider-scoped-model-input.tsx +1 -0
- package/src/shared/components/common/searchable-model-input.tsx +102 -87
- package/src/shared/components/ui/README.md +7 -0
- package/src/shared/components/ui/popover.tsx +19 -3
- package/src/shared/components/ui/select.tsx +14 -4
- package/src/shared/hooks/use-infinite-scroll-loader.ts +14 -10
- package/src/shared/lib/api/index.ts +2 -0
- package/src/shared/lib/api/preferences/preference.types.ts +22 -0
- package/src/shared/lib/api/preferences/preference.utils.ts +40 -0
- package/src/shared/lib/i18n/locales/en-US/chat.json +16 -1
- package/src/shared/lib/i18n/locales/en-US/core.json +1 -0
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +16 -1
- package/src/shared/lib/i18n/locales/zh-CN/core.json +1 -0
- package/dist/assets/chat-page-BXngLJY6.js +0 -105
- package/dist/assets/doc-browser-B6Wc_TIY.js +0 -1
- package/dist/assets/index-DTb_XVIH.js +0 -103
- package/dist/assets/index-ayiPYhf1.css +0 -1
- package/dist/assets/mcp-marketplace-page-DZ9H0v05.js +0 -1
- package/dist/assets/mcp-marketplace-page-cnVWf7QQ.js +0 -40
- package/dist/assets/model-config-page-Bcb35AVv.js +0 -1
- package/dist/assets/plus-CYE1onU2.js +0 -1
- package/dist/assets/provider-scoped-model-input-kdoNp4HG.js +0 -1
- package/dist/assets/providers-config-page-CQSibSwO.js +0 -1
- package/dist/assets/remote-BlJDbXOI.js +0 -1
- package/dist/assets/rotate-cw-BWbvFDAX.js +0 -1
- package/dist/assets/runtime-config-page-Tn2yLQ0c.js +0 -1
- package/dist/assets/secrets-config-page-BXn5Uuwp.js +0 -3
- package/dist/assets/use-config-DgKM9VIU.js +0 -1
- package/dist/assets/x-Cm3JjYut.js +0 -1
- package/src/features/chat/components/__tests__/chat-welcome.test.tsx +0 -45
- package/src/features/chat/components/chat-welcome.tsx +0 -102
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { api } from '@/shared/lib/api/managers/client.manager';
|
|
2
|
+
import type {
|
|
3
|
+
PreferenceDeleteResult,
|
|
4
|
+
PreferenceEntryView,
|
|
5
|
+
PreferenceJsonValue,
|
|
6
|
+
} from '@/shared/lib/api/preferences/preference.types';
|
|
7
|
+
|
|
8
|
+
function encodePreferenceKey(key: string): string {
|
|
9
|
+
return encodeURIComponent(key);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function fetchPreference(key: string): Promise<PreferenceEntryView> {
|
|
13
|
+
const response = await api.get<PreferenceEntryView>(`/api/preferences/${encodePreferenceKey(key)}`);
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
throw new Error(response.error.message);
|
|
16
|
+
}
|
|
17
|
+
return response.data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function updatePreference(
|
|
21
|
+
key: string,
|
|
22
|
+
value: PreferenceJsonValue,
|
|
23
|
+
): Promise<PreferenceEntryView> {
|
|
24
|
+
const response = await api.put<PreferenceEntryView>(
|
|
25
|
+
`/api/preferences/${encodePreferenceKey(key)}`,
|
|
26
|
+
{ value },
|
|
27
|
+
);
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error(response.error.message);
|
|
30
|
+
}
|
|
31
|
+
return response.data;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function deletePreference(key: string): Promise<PreferenceDeleteResult> {
|
|
35
|
+
const response = await api.delete<PreferenceDeleteResult>(`/api/preferences/${encodePreferenceKey(key)}`);
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
throw new Error(response.error.message);
|
|
38
|
+
}
|
|
39
|
+
return response.data;
|
|
40
|
+
}
|
|
@@ -73,8 +73,13 @@
|
|
|
73
73
|
"chatSkillScopeProject": "Project",
|
|
74
74
|
"chatSkillScopeWorkspace": "Workspace",
|
|
75
75
|
"chatPickerRecent": "Recent",
|
|
76
|
+
"chatPickerFavoriteModels": "Favorites",
|
|
76
77
|
"chatPickerRecentModels": "Recent",
|
|
77
78
|
"chatPickerAllModels": "All models",
|
|
79
|
+
"chatModelSearchPlaceholder": "Search models",
|
|
80
|
+
"chatModelSearchEmpty": "No matching models",
|
|
81
|
+
"chatFavoriteModel": "Add to favorites",
|
|
82
|
+
"chatUnfavoriteModel": "Remove from favorites",
|
|
78
83
|
"chatPickerAllSkills": "All skills",
|
|
79
84
|
"chatSend": "Send",
|
|
80
85
|
"chatStop": "Stop",
|
|
@@ -166,13 +171,23 @@
|
|
|
166
171
|
"chatSidebarOlder": "Older",
|
|
167
172
|
"chatSidebarProjectViewEmpty": "No project conversations yet",
|
|
168
173
|
"chatWelcomeTitle": "Hello, how can I help you?",
|
|
169
|
-
"chatWelcomeSubtitle": "
|
|
174
|
+
"chatWelcomeSubtitle": "Describe the goal, choose the project context, and let NextClaw take it from there.",
|
|
175
|
+
"chatWelcomeProjectPickerLabel": "Choose working directory",
|
|
176
|
+
"chatWelcomeProjectPickerPlaceholder": "Choose working directory",
|
|
177
|
+
"chatWelcomeProjectDefaultBadge": "Default",
|
|
178
|
+
"chatWelcomeProjectRecentTitle": "Recent projects",
|
|
179
|
+
"chatWelcomeProjectNoRecent": "No recent projects yet",
|
|
180
|
+
"chatWelcomeProjectOpenFolder": "Open folder",
|
|
181
|
+
"chatWelcomeSessionTypePickerLabel": "Choose session type",
|
|
170
182
|
"chatWelcomeCapability1Title": "Smart Conversations",
|
|
171
183
|
"chatWelcomeCapability1Desc": "Multi-turn context conversations with multiple AI models",
|
|
184
|
+
"chatWelcomeCapability1Prompt": "Help me understand this project and propose the next three concrete things we should build.",
|
|
172
185
|
"chatWelcomeCapability2Title": "Skill Extensions",
|
|
173
186
|
"chatWelcomeCapability2Desc": "Extend Agent capabilities by installing skills",
|
|
187
|
+
"chatWelcomeCapability2Prompt": "Review the skills that would be useful for this project and recommend which ones I should enable first.",
|
|
174
188
|
"chatWelcomeCapability3Title": "Scheduled Tasks",
|
|
175
189
|
"chatWelcomeCapability3Desc": "Set up scheduled automated tasks",
|
|
190
|
+
"chatWelcomeCapability3Prompt": "Help me design a scheduled automation for this project, including the trigger, message, and safety checks.",
|
|
176
191
|
"chatSkillsPickerTitle": "Skills",
|
|
177
192
|
"chatSkillsPickerEmpty": "No skills installed",
|
|
178
193
|
"chatSkillsPickerSearchPlaceholder": "Search skills",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"modelName": "Model",
|
|
50
50
|
"modelPickerNoOptions": "No model options available",
|
|
51
51
|
"modelPickerUseCustom": "Use custom model: {value}",
|
|
52
|
+
"modelPickerToggleOptions": "Toggle model options",
|
|
52
53
|
"modelInputCustomHint": "If the model is not listed, type a custom model ID directly.",
|
|
53
54
|
"modelIdentifierHelp": "Default model identifier used by the agent. Use provider-prefixed format. Examples: openai/gpt-5.1 · anthropic/claude-opus-4-1 · deepseek/deepseek-chat · minimax/MiniMax-M2.5 · openrouter/openai/gpt-5.3-codex.",
|
|
54
55
|
"maxToolIterations": "Max Tool Iterations",
|
|
@@ -73,8 +73,13 @@
|
|
|
73
73
|
"chatSkillScopeProject": "项目",
|
|
74
74
|
"chatSkillScopeWorkspace": "工作区",
|
|
75
75
|
"chatPickerRecent": "最近使用",
|
|
76
|
+
"chatPickerFavoriteModels": "收藏模型",
|
|
76
77
|
"chatPickerRecentModels": "最近选择",
|
|
77
78
|
"chatPickerAllModels": "全部模型",
|
|
79
|
+
"chatModelSearchPlaceholder": "搜索模型",
|
|
80
|
+
"chatModelSearchEmpty": "没有匹配的模型",
|
|
81
|
+
"chatFavoriteModel": "收藏模型",
|
|
82
|
+
"chatUnfavoriteModel": "取消收藏",
|
|
78
83
|
"chatPickerAllSkills": "全部技能",
|
|
79
84
|
"chatSend": "发送",
|
|
80
85
|
"chatStop": "停止",
|
|
@@ -166,13 +171,23 @@
|
|
|
166
171
|
"chatSidebarOlder": "更早",
|
|
167
172
|
"chatSidebarProjectViewEmpty": "还没有绑定项目的会话",
|
|
168
173
|
"chatWelcomeTitle": "你好,有什么可以帮你的吗?",
|
|
169
|
-
"chatWelcomeSubtitle": "
|
|
174
|
+
"chatWelcomeSubtitle": "描述目标,选择项目上下文,让 NextClaw 接住这次任务。",
|
|
175
|
+
"chatWelcomeProjectPickerLabel": "选择工作目录",
|
|
176
|
+
"chatWelcomeProjectPickerPlaceholder": "选择工作目录",
|
|
177
|
+
"chatWelcomeProjectDefaultBadge": "默认",
|
|
178
|
+
"chatWelcomeProjectRecentTitle": "最近项目",
|
|
179
|
+
"chatWelcomeProjectNoRecent": "暂无最近项目",
|
|
180
|
+
"chatWelcomeProjectOpenFolder": "打开文件夹",
|
|
181
|
+
"chatWelcomeSessionTypePickerLabel": "选择会话类型",
|
|
170
182
|
"chatWelcomeCapability1Title": "智能对话",
|
|
171
183
|
"chatWelcomeCapability1Desc": "多轮上下文对话,支持多种 AI 模型",
|
|
184
|
+
"chatWelcomeCapability1Prompt": "帮我理解当前项目,并给出接下来最值得推进的三个具体建设方向。",
|
|
172
185
|
"chatWelcomeCapability2Title": "技能扩展",
|
|
173
186
|
"chatWelcomeCapability2Desc": "通过安装技能扩展 Agent 能力",
|
|
187
|
+
"chatWelcomeCapability2Prompt": "帮我看看这个项目适合启用哪些技能,并推荐我优先配置哪些能力。",
|
|
174
188
|
"chatWelcomeCapability3Title": "定时任务",
|
|
175
189
|
"chatWelcomeCapability3Desc": "设置定时执行的自动化任务",
|
|
190
|
+
"chatWelcomeCapability3Prompt": "帮我设计一个适合当前项目的定时自动化任务,包括触发条件、消息内容和安全检查。",
|
|
176
191
|
"chatSkillsPickerTitle": "技能",
|
|
177
192
|
"chatSkillsPickerEmpty": "暂无已安装技能",
|
|
178
193
|
"chatSkillsPickerSearchPlaceholder": "搜索技能",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"modelName": "模型",
|
|
50
50
|
"modelPickerNoOptions": "暂无可选模型",
|
|
51
51
|
"modelPickerUseCustom": "使用自定义模型:{value}",
|
|
52
|
+
"modelPickerToggleOptions": "展开或收起模型选项",
|
|
52
53
|
"modelInputCustomHint": "如果列表里没有目标模型,可直接输入自定义模型 ID。",
|
|
53
54
|
"modelIdentifierHelp": "智能体默认模型标识,使用带提供商前缀的格式。例如:openai/gpt-5.1、anthropic/claude-opus-4-1、deepseek/deepseek-chat、minimax/MiniMax-M2.5、openrouter/openai/gpt-5.3-codex。",
|
|
54
55
|
"maxToolIterations": "最大工具迭代次数",
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import{h as e,p as t,r as n,u as r,v as i}from"./react-DYQXXGbH.js";import{A as a,D as o,Dt as s,E as c,Gt as l,Ht as u,It as d,Jt as f,Kt as p,Lt as m,O as h,Ot as g,Pt as _,Qt as v,Ut as y,Vt as b,Xt as x,Yt as S,Zt as C,an as w,cn as T,ct as E,en as D,in as O,j as ee,k as te,kt as k,ln as ne,on as re,qt as ie,sn as ae,yt as oe}from"./api-C6EDHBDR.js";import{a as se,c as ce,i as A,l as le,n as ue,o as de,r as j,s as M}from"./mcp-marketplace-page-cnVWf7QQ.js";import{c as N}from"./dist-BIYV2-Ia.js";import{a as fe,i as pe,n as me,r as he,t as ge}from"./select-CIRwTNP4.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se}from"./confirm-dialog-B39X0pYp.js";import{n as Ce}from"./search-CKCzwLId.js";import{a as P,c as F,o as I,s as we}from"./doc-browser-CDtUtcim.js";import{t as Te}from"./provider-scoped-model-input-kdoNp4HG.js";import{t as Ee}from"./ellipsis-DDpgTzgx.js";import{t as De}from"./external-link-D2cBOCqn.js";import{t as Oe}from"./plus-CYE1onU2.js";import{n as ke}from"./doc-browser-context-DZbC9zVB.js";import{A as Ae,At as je,B as Me,C as Ne,Ct as Pe,D as Fe,Dt as Ie,E as Le,F as L,I as Re,J as R,L as z,M as ze,Mt as Be,N as Ve,Nt as He,O as Ue,Ot as We,P as Ge,Pt as Ke,R as qe,S as Je,T as Ye,X as B,Y as Xe,Z as Ze,_ as Qe,a as $e,b as et,bt as tt,d as nt,dt as rt,f as it,g as at,gt as ot,i as st,j as ct,k as lt,kt as V,m as ut,mt as dt,n as ft,o as pt,p as mt,pt as H,q as ht,r as gt,t as _t,u as vt,ut as yt,vt as bt,w as xt}from"./index-DTb_XVIH.js";import{l as St,t as Ct,u as wt}from"./use-config-DgKM9VIU.js";import{t as Tt}from"./tag-chip-DKhVFtTE.js";function Et(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Dt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ot=class extends ne{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,w.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!T(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Et(e,n).forEach(e=>{e.destroy()}),Et(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ae(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new O(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Dt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&w.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},U=i(e(),1);function kt({queries:e,...t},n){let r=D(n),i=v(),a=C(),o=U.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{l(e),f(e,a,r.getQueryCache().get(e.queryHash))}),x(a);let[s]=U.useState(()=>new Ot(r,o,t)),[c,u,d]=s.getOptimisticResult(o,t.combine),m=!i&&t.subscribed!==!1;U.useSyncExternalStore(U.useCallback(e=>m?s.subscribe(w.batchCalls(e)):re,[s,m]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),U.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let h=c.some((e,t)=>ie(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&ie(n,e)?p(n,new O(r,n),a):[]}):[];if(h.length>0)throw Promise.all(h);let g=c.find((e,t)=>{let n=o[t];return n&&S({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(g?.error)throw g.error;return u(d())}var At=N(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),jt=N(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Mt=N(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Nt=N(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Pt=N(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Ft=N(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),It=N(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),W=t(),G=U.forwardRef(({className:e,...t},n)=>(0,W.jsx)(`textarea`,{className:r(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));G.displayName=`Textarea`;function Lt(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Rt(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=L(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:z(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function zt({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?L(e):``,s=Rt({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(ge,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,W.jsx)(pe,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,W.jsx)(fe,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,W.jsx)(me,{className:`rounded-xl`,children:s.map(e=>(0,W.jsx)(he,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,W.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Bt({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,W.jsx)(ye,{open:e!==null,onOpenChange:a,children:e?(0,W.jsx)(Vt,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Vt(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,U.useState)(Lt(t));return(0,W.jsxs)(xe,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,W.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,W.jsxs)(be,{className:`text-left`,children:[(0,W.jsx)(Se,{children:n(`agentsEditDialogTitle`)}),(0,W.jsx)(ve,{children:n(`agentsEditDialogDescription`)})]})}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(yt,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,W.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,W.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,W.jsx)(d,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,W.jsx)(G,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,W.jsx)(d,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,W.jsx)(Te,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,W.jsx)(zt,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,W.jsxs)(_e,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,W.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,W.jsxs)(m,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,W.jsx)(bt,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var Ht=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Ut(e){let{agentCount:t,onCreate:r}=e;return(0,W.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,W.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,W.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,W.jsxs)(m,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,W.jsx)(Oe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function Wt(e){let{icon:t,label:n,disabled:i=!1,destructive:a=!1,onClick:o}=e;return(0,W.jsxs)(`button`,{type:`button`,className:r(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,W.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:n})]})}function Gt(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?r.find(e=>e.value===L(u))?.label??z(u):i;return(0,W.jsx)(g,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,W.jsxs)(k,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,W.jsx)(Ae,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,W.jsxs)(Tt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,W.jsx)(dt,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,W.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,W.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,W.jsx)(tt,{className:`h-4 w-4`})}),(0,W.jsxs)(xt,{children:[(0,W.jsx)(Le,{asChild:!0,children:(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,W.jsx)(Ee,{className:`h-4 w-4`})})}),(0,W.jsxs)(Ye,{align:`end`,className:`w-44 p-1.5`,children:[(0,W.jsx)(Wt,{icon:bt,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,W.jsx)(Wt,{icon:rt,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,W.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:d})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(Pe,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Kt(){let e=B(),t=Fe(),r=Ct(),i=wt(),a=St(),o=ft(),s=lt(),c=Ue(),[l,u]=(0,U.useState)(null),d=(0,U.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,U.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,U.useMemo)(()=>Me({config:r.data,providersView:i.data,templatesView:a.data,onlyConfigured:!0}),[r.data,i.data,a.data]),h=(0,U.useMemo)(()=>Ge(o.data?.options??[]),[o.data?.options]),v=(0,U.useMemo)(()=>L(o.data?.defaultType??`native`),[o.data?.defaultType]),y=(0,U.useMemo)(()=>h.find(e=>e.value===v)?.label??z(v),[v,h]),b=e=>{u(e)},x=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},S=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,Re(t,v))};return(0,W.jsxs)(_,{className:`space-y-5`,children:[(0,W.jsx)(Ut,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(Ht)}),(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,W.jsx)(g,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,W.jsx)(k,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,W.jsx)(g,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,W.jsxs)(k,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,W.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,W.jsx)(je,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,W.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,W.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,W.jsxs)(m,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(Ht),children:[(0,W.jsx)(Oe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,W.jsx)(Gt,{agent:e,runtimeOptions:h,defaultRuntimeLabel:y,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>S(e),onEdit:()=>b(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,W.jsx)(Bt,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:h,defaultRuntime:v,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:x})]})}function K(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function qt(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function q(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function Jt(e,t){return t??{type:e,total:0,specs:[],records:[]}}function Yt(e){let t=Jt(e.result.type,e.view),n=qt(e),r=t.records.findIndex(e=>q(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:K(i),total:i.length}}function Xt(e){let t=Jt(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!q(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:K(n),total:n.length}}let n=t.records.map(t=>q(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:e.result.action===`update`?{...t,installedAt:new Date().toISOString(),origin:t.origin??`marketplace`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:K(n),total:n.length}}function Zt(e){let t=le({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>o({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&Qt(r,e)?t:void 0},staleTime:15e3}),n=(0,U.useMemo)(()=>ce(t.data),[t.data]);return{...t,data:n}}function Qt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function $t(e=!0){return y({queryKey:[`marketplace-skill-scenes`],queryFn:te,enabled:e,staleTime:6e4})}function en(e,t=!0){let n=kt({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>o({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,U.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function tn(e){return y({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function nn(){let e=D();return u({mutationFn:e=>a(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Yt({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),b.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{b.error(e.message||n(`marketplaceInstallFailed`))}})}function rn(){let e=D();return u({mutationFn:e=>ee(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Xt({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):t.action===`update`?n(`marketplaceUpdateSuccess`):n(`marketplaceUninstallSuccess`);b.success(t.message||i)},onError:e=>{b.error(e.message||n(`marketplaceOperationFailed`))}})}var an=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function on(e){let{name:t,fallback:n,className:i}=e,a=t||n,o=a.substring(0,2).toUpperCase();return(0,W.jsx)(`div`,{className:r(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,sn(a),i),children:o})}function sn(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return an[Math.abs(t)%an.length]}function cn({title:e,spec:t,summary:n}){return(0,W.jsxs)(we,{delayDuration:400,children:[(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,W.jsx)(I,{className:`max-w-[300px] text-xs`,children:e})]}),(0,W.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5`,children:t?(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,W.jsx)(I,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null}),(0,W.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90`,children:n})]})}function ln(e){let{item:t,record:i,state:a,onInstall:o,onManage:s}=e,{isInstalling:c,isDisabled:l,canUpdate:u,canUninstall:d,busyAction:f}=a,p=!!f,m=!!(t&&!i||i&&(u||d));return(0,W.jsxs)(`div`,{className:r(`relative flex h-8 shrink-0 items-center justify-end`,i?`md:w-5`:`md:w-0`),children:[(0,W.jsx)(`div`,{className:r(`hidden items-center justify-end transition-opacity duration-150 md:flex`,m&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:i?(0,W.jsx)(un,{disabled:l}):null}),(0,W.jsxs)(`div`,{className:r(`flex w-max items-center justify-end gap-2 transition-opacity duration-150`,`opacity-100 md:pointer-events-none md:absolute md:right-0 md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!i&&(0,W.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),o(t)},disabled:c,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`,children:[(0,W.jsx)(Ie,{className:`h-3.5 w-3.5`}),n(c?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&u&&(0,W.jsxs)(`button`,{disabled:p,onClick:e=>{e.stopPropagation(),s(`update`,i)},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`,children:[(0,W.jsx)(ot,{className:`h-3.5 w-3.5`}),n(f===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),i&&d&&(0,W.jsxs)(`button`,{disabled:p,onClick:e=>{e.stopPropagation(),s(`uninstall`,i)},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`,children:[(0,W.jsx)(rt,{className:`h-3.5 w-3.5`}),n(f===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function un(e){let{disabled:t}=e,{language:n}=R(),i=fn(t?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},n);return(0,W.jsx)(we,{delayDuration:300,children:(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":i,className:r(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,W.jsx)(V,{className:`h-4 w-4 opacity-40`}):(0,W.jsx)(V,{className:`h-4 w-4`})})}),(0,W.jsx)(I,{className:`text-xs`,children:i})]})})}function dn(e){let{item:t,record:r,installState:i,manageState:a,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=R(),u=j(l),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=A(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?a.actionsByTarget.get(m):void 0,g=r?.type===`skill`&&r.source===`workspace`,_=r?.type===`skill`&&r.origin===`marketplace`,v=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,y=t?.install.spec,b=typeof y==`string`&&i.installingSpecs.has(y);return(0,W.jsxs)(`article`,{onClick:o,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`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,W.jsx)(on,{name:d,fallback:p||n(`marketplaceTypeSkill`)}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,W.jsx)(cn,{title:d,spec:p,summary:f})})]}),(0,W.jsx)(ln,{item:t,record:r,state:{isInstalling:b,isDisabled:v,canUpdate:_,canUninstall:g,busyAction:h},onInstall:s,onManage:c})]})}function fn(e,t){return t.startsWith(`zh`)?e.zh:e.en}function pn({model:e,showTitle:t,operationState:n,scroll:i,actions:a}){let{scope:o,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=i,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=a;return(0,W.jsxs)(`section`,{className:r(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,W.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,W.jsx)(`span`,{children:c.summary})]})]}),m&&(0,W.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,W.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,W.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,W.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:r(`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[104px] content-start`),children:[f&&(0,W.jsx)(M,{count:36}),!f&&!m&&s.map(e=>(0,W.jsx)(dn,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,W.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),o===`all`&&!f&&!m&&(0,W.jsx)(de,{hasMore:h,loading:g,sentinelRef:_})]})}function mn(e){let{entry:t,language:i,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=A(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,W.jsxs)(`article`,{onClick:()=>c(t),className:r(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)(on,{name:u.name,fallback:u.install.spec}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,W.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:hn(u)})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,W.jsx)(gn,{tags:u.tags})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:_n(u.updatedAt)}),h?(0,W.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,W.jsx)(V,{className:`h-3.5 w-3.5`}),vn({zh:`已安装`,en:`Installed`},i)]}):(0,W.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,W.jsx)(Ie,{className:`h-3.5 w-3.5`}),n(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function hn(e){return e.slug||e.install.spec}function gn({tags:e}){let t=e.slice(0,2);return t.length===0?null:(0,W.jsx)(`div`,{className:`mt-2 truncate text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function _n(e){return e.slice(0,10)||e}function vn(e,t){return t.startsWith(`zh`)?e.zh:e.en}var yn=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:It,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:At,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Ft,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Nt,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:We,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Pt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:H,tone:`teal`,span:`md:col-span-2`}],bn={icon:H,tone:`dark`,span:`md:col-span-2`},xn={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},Sn=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Cn(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=j(a),d=[...t].sort((e,t)=>On(e.item,t.item)).slice(0,6);return(0,W.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(Dn,{icon:Mt,title:J({zh:`场景`,en:`Scenes`},a),description:J({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,W.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,W.jsx)(M,{count:yn.length})}):(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,W.jsx)(wn,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,W.jsx)(En,{icon:jt,title:J({zh:`最近更新`,en:`Recently updated`},a),description:J({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function wn(e){let{scene:t,language:n,onSelect:i}=e,a=kn(t.scene),o=a.icon,s=xn[a.tone];return(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.scene),className:r(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,W.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:An(t,a,n)}),typeof t.count==`number`&&(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Mn(t.count,n)})]}),(0,W.jsx)(`p`,{className:r(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:jn(t,a,n)})]})})}function Tn(e){let{scene:t,entries:n,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=kn(t.scene),f=d.icon,p=xn[d.tone];return(0,W.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,W.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":J({zh:`返回`,en:`Back`},a),children:(0,W.jsx)(Ce,{className:`h-4 w-4`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,W.jsx)(f,{className:`h-4 w-4`})}),(0,W.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:An(t,d,a)}),(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:J(i?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},a)})]}),(0,W.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,W.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:jn(t,d,a)})})]})]}),i?(0,W.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:r(Sn,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,W.jsx)(M,{count:24})}):n.length>0?(0,W.jsx)(`div`,{className:Sn,children:n.map(e=>(0,W.jsx)(mn,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,W.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:J({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function En(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(Dn,{icon:t,title:n,description:r}),s?(0,W.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,W.jsx)(M,{count:4})}):(0,W.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,W.jsx)(mn,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Dn({icon:e,title:t,description:n}){return(0,W.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,W.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function On(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function J(e,t){return t.startsWith(`zh`)?e.zh:e.en}function kn(e){return yn.find(t=>t.scene===e)??{scene:e,...bn}}function An(e,t,n){return t.title?J(t.title,n):e.title}function jn(e,t,n){return t.summary?J(t.summary,n):e.description??e.scene}function Mn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Nn({label:e,className:t,onClick:n}){return(0,W.jsxs)(`button`,{type:`button`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-[13px] font-medium text-primary transition-colors hover:text-primary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,t),onClick:n,children:[(0,W.jsx)(De,{className:`h-3.5 w-3.5`}),e]})}var Pn=`https://skillhub.cn/`;function Fn(){return(0,W.jsx)(Nn,{label:n(`marketplaceExternalSkillSourceTitle`),onClick:()=>void Ze.openExternalUrl(Pn)})}function Y(e){return(e??``).trim().toLowerCase()}function X(e,t){let n=Y(t);return n.length>0?`${e}:${n}`:``}function In(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Ln(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Rn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=X(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function zn(e,t){return t.get(X(e.type,e.spec))||t.get(X(e.type,e.id))||t.get(X(e.type,e.label))}function Bn(e,t,n,r){let i=Y(n);if(!i)return!0;let a=A(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>Y(e)).filter(Boolean).some(e=>e.includes(i))}function Vn(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=$t(a===`skill`),f=(0,U.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=en(f,a===`skill`),m=(0,U.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,U.useMemo)(()=>t.map(e=>({item:e,record:Rn(e,n)})),[t,n]),g=(0,U.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}function Hn(){let e=nn(),t=rn(),{confirm:r,ConfirmDialog:i}=Qe(),[a,o]=(0,U.useState)(new Set),[s,c]=(0,U.useState)(new Map);return{installState:{installingSpecs:a},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!a.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,i)=>{let a=e===`update`?i.catalogSlug||i.id||i.spec:i.id||i.spec;if(!(!a||s.has(a))&&!(e===`uninstall`&&!await r({title:`${n(`marketplaceUninstallTitle`)} ${a}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(a,e));try{await t.mutateAsync({type:i.type,action:e,id:a,spec:i.spec})}finally{c(e=>{let t=new Map(e);return t.delete(a),t})}}},ConfirmDialog:i}}function Z(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Un(e){let t=e.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
|
|
4
|
-
`).trim():e}function Q(e){return Z(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function Wn(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Gn(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;return{html:`<div class="code-block">${n[1]?`<span class="code-language">${Z(n[1])}</span>`:``}<pre><code>${Z(r.join(`
|
|
5
|
-
`))}</code></pre></div>`,nextIndex:i+1}}function Kn(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${Q(e[2]??``)}</h${n}>`,nextIndex:t+1}}function qn(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${Q((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function Jn(e,t){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{html:`<blockquote>${Q(n.join(` `))}</blockquote>`,nextIndex:r}}function Yn(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||Wn(t))break;n.push(t),r+=1}return{html:`<p>${Q(n.join(` `))}</p>`,nextIndex:r}}function Xn(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Gn(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Kn(i,t):/^[-*]\s+/.test(n)?qn(e,t,!1):/^\d+\.\s+/.test(n)?qn(e,t,!0):/^>\s?/.test(n)?Jn(e,t):Yn(e,t)}function Zn(e){let t=Un(e).replace(/\r\n/g,`
|
|
6
|
-
`).split(`
|
|
7
|
-
`),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Xn(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Qn(e){return Array.isArray(e)?e.map(e=>Qn(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function $n(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Qn(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function er(e){return e.replace(/\r\n/g,`
|
|
8
|
-
`).split(`
|
|
9
|
-
`).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function tr(e){let t=$n(e),n=t.length>0?t:er(e);return n.length===0?`<pre class="code">${Z(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Z(e.key)}</dt><dd>${Z(e.value)}</dd></div>`).join(``)}</dl>`}function $(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d,loading:f}=e,p=o?.trim()||`-`,m=s?.trim()||`-`,h=i?.trim(),g=a?.trim(),_=!!g&&g!==h,v=tr(p),y=Zn(m),b=`<!doctype html>
|
|
10
|
-
<html>
|
|
11
|
-
<head>
|
|
12
|
-
<meta charset="utf-8" />
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
14
|
-
<title>${Z(t)}</title>
|
|
15
|
-
<style>
|
|
16
|
-
:root { color-scheme: light; }
|
|
17
|
-
body { margin: 0; background: #f9f8f5; color: #2f2212; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
|
18
|
-
.wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 36px; }
|
|
19
|
-
.hero { border: 1px solid #f0e2c8; border-radius: 14px; background: linear-gradient(180deg, #fff9f1 0%, #ffffff 28%); padding: 18px; box-shadow: 0 1px 3px rgba(30, 20, 10, 0.05); }
|
|
20
|
-
.hero h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
|
|
21
|
-
.meta { margin-top: 7px; color: #78644d; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
|
|
22
|
-
.summary { margin: 12px 0 0; font-size: 13px; line-height: 1.65; color: #5f5142; }
|
|
23
|
-
.grid { display: grid; grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
|
|
24
|
-
.card { border: 1px solid #eee3d1; background: #fffdf9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(30, 20, 10, 0.035); }
|
|
25
|
-
.card h2 { margin: 0; padding: 11px 13px; font-size: 12px; font-weight: 650; color: #3f472f; border-bottom: 1px solid #f1e7d4; background: #fffaf2; }
|
|
26
|
-
.card .body { padding: 12px 13px; font-size: 12px; color: #4e463d; line-height: 1.65; }
|
|
27
|
-
.code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; margin: 0; }
|
|
28
|
-
.metadata-list { margin: 0; }
|
|
29
|
-
.metadata-list div { display: grid; grid-template-columns: minmax(72px, 0.36fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2eadc; }
|
|
30
|
-
.metadata-list div:last-child { border-bottom: 0; }
|
|
31
|
-
.metadata-list dt { color: #7a5a24; font-weight: 650; overflow-wrap: anywhere; }
|
|
32
|
-
.metadata-list dd { margin: 0; color: #4e463d; overflow-wrap: anywhere; }
|
|
33
|
-
.markdown { font-size: 13px; line-height: 1.68; }
|
|
34
|
-
.markdown > *:first-child { margin-top: 0; }
|
|
35
|
-
.markdown > *:last-child { margin-bottom: 0; }
|
|
36
|
-
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; color: #2f2212; line-height: 1.25; letter-spacing: 0; }
|
|
37
|
-
.markdown h1 { font-size: 20px; }
|
|
38
|
-
.markdown h2 { font-size: 17px; }
|
|
39
|
-
.markdown h3 { font-size: 15px; }
|
|
40
|
-
.markdown h4 { font-size: 13px; }
|
|
41
|
-
.markdown p { margin: 10px 0; }
|
|
42
|
-
.markdown ul, .markdown ol { margin: 10px 0; padding-left: 20px; }
|
|
43
|
-
.markdown li { margin: 5px 0; }
|
|
44
|
-
.markdown blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid #d9b56f; border-radius: 8px; background: #fff7ea; color: #6d5841; }
|
|
45
|
-
.markdown code { border: 1px solid #eadcc6; border-radius: 5px; background: #fff7ea; padding: 1px 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #6b4b16; }
|
|
46
|
-
.markdown a { color: #5f6b45; text-decoration: none; font-weight: 600; }
|
|
47
|
-
.markdown a:hover { text-decoration: underline; }
|
|
48
|
-
.code-block { position: relative; margin: 12px 0; overflow: hidden; border: 1px solid #eadcc6; border-radius: 10px; background: #2f2a24; }
|
|
49
|
-
.code-block pre { margin: 0; overflow-x: auto; padding: 13px; }
|
|
50
|
-
.code-block code { border: 0; border-radius: 0; background: transparent; padding: 0; color: #f7efe3; }
|
|
51
|
-
.code-language { position: absolute; right: 10px; top: 8px; color: #d8c3a0; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
52
|
-
.tags { margin-top: 10px; }
|
|
53
|
-
.tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid #ecd9b5; border-radius: 999px; background: #fff7ea; color: #7a5a24; font-size: 11px; }
|
|
54
|
-
.source { color: #5f6b45; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
|
|
55
|
-
.source:hover { text-decoration: underline; }
|
|
56
|
-
.skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, #f0e6d6 0%, #fffaf2 42%, #f0e6d6 78%); background-size: 220% 100%; animation: shimmer 1.35s ease-in-out infinite; }
|
|
57
|
-
.detail-skeleton .hero { padding: 18px; }
|
|
58
|
-
.sk-title { width: 52%; height: 24px; }
|
|
59
|
-
.sk-meta { width: 78%; height: 12px; margin-top: 12px; }
|
|
60
|
-
.sk-line { height: 12px; margin-top: 12px; }
|
|
61
|
-
.sk-line.short { width: 62%; }
|
|
62
|
-
.sk-line.mid { width: 82%; }
|
|
63
|
-
.sk-body { height: 220px; margin: 13px; }
|
|
64
|
-
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
|
|
65
|
-
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
|
|
66
|
-
</style>
|
|
67
|
-
</head>
|
|
68
|
-
<body>
|
|
69
|
-
<main class="wrap${f?` detail-skeleton`:``}"${f?` aria-busy="true"`:``}>
|
|
70
|
-
${f?`
|
|
71
|
-
<section class="hero">
|
|
72
|
-
<span class="skeleton sk-title"></span>
|
|
73
|
-
<span class="skeleton sk-meta"></span>
|
|
74
|
-
<span class="skeleton sk-line mid"></span>
|
|
75
|
-
<span class="skeleton sk-line"></span>
|
|
76
|
-
<span class="skeleton sk-line short"></span>
|
|
77
|
-
</section>
|
|
78
|
-
<section class="grid">
|
|
79
|
-
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
80
|
-
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
81
|
-
</section>
|
|
82
|
-
`:`
|
|
83
|
-
<section class="hero">
|
|
84
|
-
<h1>${Z(t)}</h1>
|
|
85
|
-
<div class="meta">${Z(n)} · ${Z(r)}${d?` · ${Z(d)}`:``}</div>
|
|
86
|
-
${h?`<p class="summary">${Z(h)}</p>`:``}
|
|
87
|
-
${_?`<p class="summary">${Z(g)}</p>`:``}
|
|
88
|
-
${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Z(e)}</span>`).join(``)}</div>`:``}
|
|
89
|
-
${c?`<p class="meta" style="margin-top:12px;">${Z(l??`Source`)}: <a class="source" href="${Z(c)}" target="_blank" rel="noopener noreferrer">${Z(c)}</a></p>`:``}
|
|
90
|
-
</section>
|
|
91
|
-
|
|
92
|
-
<section class="grid">
|
|
93
|
-
<article class="card">
|
|
94
|
-
<h2>Metadata</h2>
|
|
95
|
-
<div class="body">${v}</div>
|
|
96
|
-
</article>
|
|
97
|
-
<article class="card">
|
|
98
|
-
<h2>Content</h2>
|
|
99
|
-
<div class="body markdown">${y}</div>
|
|
100
|
-
</article>
|
|
101
|
-
</section>
|
|
102
|
-
`}
|
|
103
|
-
</main>
|
|
104
|
-
</body>
|
|
105
|
-
</html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}function nr(e){let t=ke(),r=(0,U.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(i,a)=>{let o=i?.name??a?.label??a?.id??a?.spec??n(`marketplaceUnknownItem`),s=i?`marketplace:${i.type}:${i.slug}`:`marketplace:${a?.type??`unknown`}:${a?.id??a?.spec??o}`,c={title:o,kind:`content`,dedupeKey:s},l={...c,activate:!1},u=n(`marketplaceTypeSkill`);if(!i){t.open($({title:o,typeLabel:u,spec:a?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(a??{},null,2),contentRaw:`-`}),c);return}let d=r.current.seq+1;r.current.seq=d,r.current.byKey.set(s,d);let f=A(i.summaryI18n,i.summary,e);t.open($({title:o,typeLabel:u,spec:i.install.spec,loading:!0}),c);try{let e=await h(i.slug);if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:i.tags,author:i.author}),l)}catch(e){if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:n(`marketplaceOperationFailed`)}),l)}}}}function rr(e){let{scope:t,typeFilter:r,query:i,localeFallbacks:a,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,U.useMemo)(()=>s?.records??[],[s?.records]),h=(0,U.useMemo)(()=>o?.items??[],[o?.items]),g=(0,U.useMemo)(()=>In(h),[h]),_=(0,U.useMemo)(()=>Ln(m),[m]),v=(0,U.useMemo)(()=>m.filter(e=>e.type===r).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:zn(e,g)})).filter(e=>Bn(e.record,e.item,i,a)).sort((e,t)=>ir(e.record,t.record)),[m,r,g,i,a]),y=(0,U.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:Rn(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?n(`loading`):`${v.length} ${n(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${h.length} / ${o.total}`:n(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:n(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:n(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:n(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:n(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function ir(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var ar=20;function or({forcedType:e}={}){let t=He(),r=Ke(),{language:i}=R(),a=`skill`,o=(0,U.useMemo)(()=>j(i),[i]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`all`),[p,m]=(0,U.useState)(`relevance`),{installState:h,manageState:g,handleInstall:v,handleManage:y,ConfirmDialog:b}=Hn(),{openItemDetail:x}=nr(o);(0,U.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let S=tn(a),C=a===`skill`?r.scene?.trim():void 0,w=Zt({q:C?void 0:l||void 0,scene:C,type:a,sort:p,pageSize:ar}),{containerRef:T,sentinelRef:E}=ue({disabled:d!==`all`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${a}:${d}:${l}:${C??``}:${p}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`});(0,U.useEffect)(()=>{let e=T.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[T,l,C,d,p,a]);let D=rr({scope:d,typeFilter:a,query:l,localeFallbacks:o,catalogView:w.data,installedView:S.data,isCatalogLoading:w.isLoading,isCatalogFetching:w.isFetching,isCatalogFetchingNextPage:w.isFetchingNextPage,catalogError:w.isError?w.error:void 0,isInstalledLoading:S.isLoading,installedError:S.isError?S.error:void 0}),O=Vn({items:D.allItems,installedRecordLookup:D.installedRecordLookup,scene:C,forcedType:e,typeFilter:a,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:w.isError});return(0,W.jsxs)(_,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,W.jsx)(et,{value:d,onValueChange:e=>f(e),children:(0,W.jsxs)(Je,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,W.jsx)(Ne,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:n(`marketplaceTabMarketplaceSkills`)}),(0,W.jsxs)(Ne,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[n(`marketplaceTabInstalledSkills`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,W.jsx)(Fn,{})]}),(0,W.jsx)(se,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:n(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:c,onSortChange:m})]}),(0,W.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,W.jsxs)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||w.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,W.jsx)(Tn,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:i,localeFallbacks:o,installState:h,onBack:()=>t(O.backPath),onOpen:e=>void x(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,W.jsx)(de,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:E}),O.showShelves&&(0,W.jsx)(Cn,{entries:O.entries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton,language:i,installState:h,onOpen:e=>void x(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,W.jsx)(pn,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:h,manageState:g},scroll:{hasMore:!!w.hasNextPage,loadingMore:w.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void x(e,t),onInstall:v,onManage:y}})]})}),(0,W.jsx)(b,{})]})}function sr(e){let{view:t,routeSessionKey:n,syncRouteSessionSelection:r}=e;(0,U.useEffect)(()=>{r({isChatView:t===`chat`,routeSessionKey:n})},[n,r,t])}function cr({view:e,confirmDialog:t}){let{isMobile:n}=ht();return(0,W.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,W.jsx)($e,{}),e===`chat`?n?(0,W.jsx)(pt,{}):(0,W.jsx)(vt,{}):(0,W.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(at,{})})}):e===`agents`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(Kt,{})})}):(0,W.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,W.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(or,{forcedType:`skills`})})})}),t]})}function lr(e){let t=B(),n=Ct(),r=wt(),i=St(),a=ut({limit:200}),o=ft(),s=e.sessionKey?.trim()||`draft-session`,c=mt({sessionId:s});(0,U.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function ur(){let e=B();(0,U.useEffect)(()=>E.eventBus.on(s.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function dr(){let e=_t(),t=B();(0,U.useEffect)(()=>{let n=n=>{t.startAgentCreationDraft(n.prompt),e.chatDraftIntentManager.markConsumed(n.id)},r=e.chatDraftIntentManager.subscribe(n),i=e.chatDraftIntentManager.consumePending();return i&&n(i),r},[e,t])}function fr(){let{sessionId:e}=Ke(),t=(0,U.useMemo)(()=>st(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function pr(e){let t=B(),{agent:n,sessionKey:r}=e;(0,U.useEffect)(()=>(t.chatRunManager.setActiveRuntime({sessionKey:r??null,sendEnvelope:e=>n.send(e),abortCurrentRun:()=>n.abort(),resumeCurrentSessionRun:()=>n.streamRun()}),()=>{t.chatRunManager.setActiveRuntime(null)}),[n,t,r])}function mr(){let e=B(),{confirm:t,ConfirmDialog:n}=Qe(),r=Be(),i=He();return(0,U.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,W.jsx)(n,{})}function hr(e){let t=B(),{agent:n,isRunning:r,isSending:i,lastSendError:a,routeSessionKey:o}=e;(0,U.useEffect)(()=>{t.chatRunManager.applyRunSnapshot({routeSessionKey:o,isHydrating:n.isHydrating,isSending:i,isRunning:r,visibleMessages:n.visibleMessages,contextWindow:ct(n.snapshot.contextWindow),sendErrorMessage:a,materializedSessionKey:n.snapshot.activeRun?.sessionId??n.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null})},[n.isHydrating,n.snapshot.activeRun?.sessionId,n.snapshot.contextWindow,n.visibleMessages,r,i,a,t,o])}function gr({view:e}){let t=_t(),[n]=(0,U.useState)(()=>new gt(t));return(0,W.jsx)(Xe,{presenter:n,children:(0,W.jsx)(_r,{view:e})})}function _r({view:e}){let t=B(),n=oe(),r=ze(n),i=mr(),{routeSessionKey:a,sessionKey:o}=fr();lr({sessionKey:o??null});let s=qe(o??null),c=it(o),l=c.hydrateError?.message??c.snapshot.error?.message??null,u=n.phase===`ready`&&nt(l)?null:l,d=c.isRunning||s?.status===`running`,f=c.isSending||d,p=r?null:n.phase===`ready`?u:Ve({message:u,status:n});return pr({agent:c,sessionKey:o}),sr({view:e,routeSessionKey:a,syncRouteSessionSelection:t.chatSessionListManager.syncRouteSessionSelection}),dr(),ur(),hr({agent:c,isRunning:d,routeSessionKey:a,lastSendError:p,isSending:f}),(0,W.jsx)(cr,{view:e,confirmDialog:i})}function vr({view:e}){return(0,W.jsx)(gr,{view:e})}export{vr as ChatPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./doc-browser-CDtUtcim.js";export{e as DocBrowser};
|