@appthen/vibe-workspace 0.1.4 → 0.1.5

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 (27) hide show
  1. package/dist/{PluginContext-BTkDt_AE.js → PluginContext-CH3LG0v3.js} +2 -1
  2. package/dist/PluginContext-CH3LG0v3.js.map +1 -0
  3. package/dist/{Workbench-97d1mmiW.js → Workbench-BGO7IU10.js} +991 -513
  4. package/dist/{Workbench-97d1mmiW.js.map → Workbench-BGO7IU10.js.map} +1 -1
  5. package/dist/{activate-UAlxV7nF.js → activate-DKrF2R5j.js} +8 -6
  6. package/dist/{activate-UAlxV7nF.js.map → activate-DKrF2R5j.js.map} +1 -1
  7. package/dist/{devWorkbench-DIrIJP3G.js → devWorkbench-s_zBnSS2.js} +48 -5
  8. package/dist/devWorkbench-s_zBnSS2.js.map +1 -0
  9. package/dist/extension-cli/index.js +1 -1
  10. package/dist/extension-dev/index.js +1 -1
  11. package/dist/extension-dev-workbench/index.js +3 -3
  12. package/dist/index.js +5 -5
  13. package/dist/plugins/agent/PluginModule.js +2 -2
  14. package/dist/plugins/base/index.js +1 -1
  15. package/dist/vibe-workspace/src/extension-dev/workspace.d.ts +1 -0
  16. package/dist/vibe-workspace/src/plugins/workspace-agent/components/ModelProviderPanel.d.ts +7 -1
  17. package/dist/vibe-workspace/src/plugins/workspace-agent/components/WorkspaceAgentSettingsDialog.d.ts +9 -0
  18. package/dist/vibe-workspace/src/plugins/workspace-agent/components/WorkspaceRuntimeConfigPanel.d.ts +2 -0
  19. package/dist/vibe-workspace/src/plugins/workspace-agent/core/model-provider-service.d.ts +2 -0
  20. package/dist/vibe-workspace/src/plugins/workspace-agent/core/protocol.d.ts +7 -0
  21. package/dist/vibe-workspace/src/types.d.ts +1 -0
  22. package/dist/vibe-workspace/src/workbench/WorkbenchHome.d.ts +10 -0
  23. package/dist/vibe-workspace.css +1 -1
  24. package/dist/workbench/index.js +2 -2
  25. package/package.json +2 -1
  26. package/dist/PluginContext-BTkDt_AE.js.map +0 -1
  27. package/dist/devWorkbench-DIrIJP3G.js.map +0 -1
@@ -6,8 +6,8 @@ import { j as jsxRuntimeExports, c as clsx, R as ReactJsxRuntime, g as getDefaul
6
6
  import * as React from "react";
7
7
  import React__default, { useState, useRef, useEffect, useContext, useMemo, useCallback, createContext, memo, forwardRef, useLayoutEffect, useDebugValue as useDebugValue$1, useReducer } from "react";
8
8
  import { D as Dialog, b as DialogContent, h as DialogTitle, c as DialogDescription, e as DialogHeader, d as DialogFooter } from "./dialog-B_cvWVP-.js";
9
- import { E as ExtensionType, C as CoreTypes, c as createPluginContext, p as parseWorkbenchRoute, d as createWorkbenchLinkService, a as buildWorkbenchPath, e as getSystemWorkbenchRouteKey, r as resolveWorkbenchRouteExtensionId, f as getWorkbenchRouteExtensionKey } from "./PluginContext-BTkDt_AE.js";
10
- import { a1 as FileSystemContext, a4 as globalEventBus, a5 as createVibeTools, a6 as Lock, a7 as RotateCcw, Z as Bug, a8 as Terminal$1, E as ExternalLink, a9 as Globe, A as AgentPlugin, aa as User, v as ShieldCheck, ab as PanelsTopLeft, ac as Code$1, S as Sparkles, ad as Beaker, ae as Heart, af as Download, a3 as extensionRegistry, ag as LucideIcons, ah as Emitter, ai as API_BASE_URL, aj as getAuthHeaders, ak as CDN_ROOT, al as request$1, am as Package, J as Settings$1, $ as CircleCheck, r as Ellipsis, an as API_BASE_URL$1, ao as SquareCheckBig, ap as MessageSquare, aq as Type, ar as Eye, as as Play$1, at as Store$1, K as Shield$1, f as Activity$1, au as Layers$1, av as RefreshCw$1, aw as AppWindow$1, ax as CircleCheckBig, X as TriangleAlert, ay as Trash, az as Clipboard, aA as Grid3x3, aB as MousePointer2, _ as Plus, aC as Share2, aD as Infinity$1, aE as Waypoints, aF as Settings2, aG as Undo2, aH as Redo2, aI as Maximize, aJ as Trash2, aK as Zap, aL as Copy, aM as RotateCw, aN as Database, aO as Monitor, aP as CirclePlay, aQ as Video, W as Wrench, aR as Brain, aS as Component, aT as Clock, n as FileText, aU as UserPlus, aV as Tag, aW as Target, aX as Box, aY as Map$1, aZ as ListChecks, a_ as Image$1, a$ as Flag, b0 as EyeOff, b1 as Lightbulb, b2 as SkipBack, b3 as Pause, b4 as SkipForward, p as Users, N as Workflow, b5 as Send, b as Bot, x as CalendarClock, b6 as LockOpen, b7 as Maximize2, y as Building2, b8 as Server, b9 as Plug, ba as MessageCircle, bb as UserCheck, bc as Mail, bd as Webhook, be as Radio, bf as Phone, bg as BookOpen, bh as Aperture, bi as Cog, bj as Boxes, bk as Cpu, D as ArrowRight, bl as ArrowLeftRight, t as ScrollText, bm as KeyRound, bn as Link2, w as UserCog, d as Star, bo as LoaderCircle, bp as Network, bq as CircleAlert, br as RefreshCcw, bs as Hash, bt as Pin, bu as BellOff, bv as MessagesSquare, bw as remarkGfm, bx as Markdown, by as CircleX, c as CircleQuestionMark, bz as ClipboardList, Q as ShieldAlert, bA as Ban, bB as Pencil, bC as CircleMinus, bD as CircleDashed, bE as Briefcase, B as Blocks, bF as ChartColumn, I as LayoutGrid, bG as SquareStack, bH as Info, j as ArrowDown, bI as Paperclip, bJ as SendHorizontal, bK as Stethoscope, s as ChevronLeft, bL as CircleDot, bM as PackageCheck, P as CodeXml, bN as History, bO as Undo, bP as Redo, bQ as Heading1, bR as Heading2, bS as Heading3, bT as Bold$1, bU as Italic$1, bV as Underline$1, bW as Strikethrough, bX as TextAlignStart, bY as TextAlignCenter, bZ as TextAlignEnd, b_ as List, b$ as ListOrdered, c0 as Quote, c1 as Link$1, c2 as LayoutDashboard, c3 as UsersRound, c4 as LockKeyhole, c5 as UserRound, R as Rocket, c6 as TrendingUp, c7 as GitBranch, c8 as CloudUpload, c9 as CloudDownload, ca as Square, cb as EllipsisVertical, cc as Folder, cd as Laptop, ce as Cloud, cf as SquareTerminal, F as FolderKanban, cg as Earth, ch as FileCode, ci as Keyboard, i as ArrowUp, cj as Save, o as Clock3, e as SlidersHorizontal, H as HardDrive, ck as FileArchive, cl as AtSign, cm as ShieldOff, cn as Mic, h as ListTodo, co as Files, cp as FolderInput, Y as MessageSquarePlus, cq as Scissors, cr as PenLine, cs as Route, ct as MapPin, cu as FolderPlus, a as activate$9, a2 as authService, cv as getCurrentUser, cw as ApiRequestError } from "./activate-UAlxV7nF.js";
9
+ import { E as ExtensionType, C as CoreTypes, c as createPluginContext, p as parseWorkbenchRoute, d as createWorkbenchLinkService, a as buildWorkbenchPath, e as getSystemWorkbenchRouteKey, r as resolveWorkbenchRouteExtensionId, f as getWorkbenchRouteExtensionKey } from "./PluginContext-CH3LG0v3.js";
10
+ import { a1 as FileSystemContext, a4 as globalEventBus, a5 as createVibeTools, a6 as Lock, a7 as RotateCcw, Z as Bug, a8 as Terminal$1, E as ExternalLink, a9 as Globe, A as AgentPlugin, aa as User, v as ShieldCheck, ab as PanelsTopLeft, ac as Code$1, S as Sparkles, ad as Beaker, ae as Heart, af as Download, a3 as extensionRegistry, ag as LucideIcons, ah as Emitter, ai as API_BASE_URL, aj as getAuthHeaders, ak as CDN_ROOT, al as request$1, am as Package, J as Settings$1, $ as CircleCheck, r as Ellipsis, an as API_BASE_URL$1, ao as SquareCheckBig, ap as MessageSquare, aq as Type, ar as Eye, as as Play$1, at as Store$1, K as Shield$1, f as Activity$1, au as Layers$1, av as RefreshCw$1, aw as AppWindow$1, ax as CircleCheckBig, X as TriangleAlert, ay as Trash, az as Clipboard, aA as Grid3x3, aB as MousePointer2, _ as Plus, aC as Share2, aD as Infinity$1, aE as Waypoints, aF as Settings2, aG as Undo2, aH as Redo2, aI as Maximize, aJ as Trash2, aK as Zap, aL as Copy, aM as RotateCw, aN as Database, aO as Monitor, aP as CirclePlay, aQ as Video, W as Wrench, aR as Brain, aS as Component, aT as Clock, n as FileText, aU as UserPlus, aV as Tag, aW as Target, aX as Box, aY as Map$1, aZ as ListChecks, a_ as Image$1, a$ as Flag, b0 as EyeOff, b1 as Lightbulb, b2 as SkipBack, b3 as Pause, b4 as SkipForward, p as Users, N as Workflow, b5 as Send, b as Bot, x as CalendarClock, b6 as LockOpen, b7 as Maximize2, y as Building2, b8 as Server, b9 as Plug, ba as MessageCircle, bb as UserCheck, bc as Mail, bd as Webhook, be as Radio, bf as Phone, bg as BookOpen, bh as Aperture, bi as Cog, bj as Boxes, bk as Cpu, D as ArrowRight, bl as ArrowLeftRight, t as ScrollText, bm as KeyRound, bn as Link2, w as UserCog, d as Star, bo as LoaderCircle, bp as Network, bq as CircleAlert, br as RefreshCcw, bs as Hash, bt as Pin, bu as BellOff, bv as MessagesSquare, bw as remarkGfm, bx as Markdown, by as CircleX, c as CircleQuestionMark, bz as ClipboardList, Q as ShieldAlert, bA as Ban, bB as Pencil, bC as CircleMinus, bD as CircleDashed, bE as Briefcase, B as Blocks, bF as ChartColumn, I as LayoutGrid, bG as SquareStack, bH as Info, j as ArrowDown, bI as Paperclip, bJ as SendHorizontal, bK as Stethoscope, s as ChevronLeft, bL as CircleDot, bM as PackageCheck, P as CodeXml, bN as History, bO as Undo, bP as Redo, bQ as Heading1, bR as Heading2, bS as Heading3, bT as Bold$1, bU as Italic$1, bV as Underline$1, bW as Strikethrough, bX as TextAlignStart, bY as TextAlignCenter, bZ as TextAlignEnd, b_ as List, b$ as ListOrdered, c0 as Quote, c1 as Link$1, c2 as LayoutDashboard, c3 as UsersRound, c4 as LockKeyhole, c5 as UserRound, R as Rocket, c6 as TrendingUp, c7 as GitBranch, c8 as CloudUpload, c9 as CloudDownload, ca as Square, cb as EllipsisVertical, cc as Folder, cd as Laptop, ce as Cloud, cf as SquareTerminal, F as FolderKanban, cg as Earth, ch as Save, ci as FileCode, cj as Keyboard, i as ArrowUp, e as SlidersHorizontal, H as HardDrive, ck as FileArchive, cl as AtSign, cm as ShieldOff, cn as Mic, h as ListTodo, co as Files, cp as FolderInput, Y as MessageSquarePlus, o as Clock3, cq as Scissors, cr as PenLine, cs as Route, ct as MapPin, cu as FolderPlus, a as activate$9, cv as House, a2 as authService, cw as getCurrentUser, cx as ApiRequestError, cy as FlaskConical, m as FolderOpen } from "./activate-DKrF2R5j.js";
11
11
  import * as monaco from "monaco-editor";
12
12
  import { e as globalClientToolRegistry, f as getUnifiedBridge, B as BridgeEvent, r as registerFrontendToolDeclarationsFromManifest, U as UIMimeType, h as getUIResourceRegistry, i as getRuntimeUserId, j as getRuntimeUserName, k as getRuntimeTenantId$6, g as getRuntimeAccessToken, l as getRuntimeSubjectId, a as subscribeRuntimeActor, d as getRuntimeActor, c as createPluginFactory, m as refreshRuntimeActorFromServer } from "./types-BOt5rkJD.js";
13
13
  import { A as ArrowLeft, S as Search, B as Bell } from "./search-XoVltVb3.js";
@@ -16,7 +16,7 @@ import { useParams, useLocation } from "react-router-dom";
16
16
  import * as ReactDOM from "react-dom";
17
17
  import ReactDOM__default, { createPortal } from "react-dom";
18
18
  import { mergeExtensionAccessPolicy, canAccessExtensionCapability } from "./extension-schema/index.js";
19
- import { a6 as clamp$1, a7 as useDirection, D as DropdownMenu, t as DropdownMenuTrigger, f as Button, h as DropdownMenuContent, I as Input, j as DropdownMenuItem, o as DropdownMenuSeparator, c as Avatar, d as AvatarFallback, B as Badge, M as Textarea, e as AvatarImage, k as DropdownMenuLabel, S as Select, E as SelectTrigger, F as SelectValue, v as SelectContent, x as SelectItem, P as TooltipProvider, R as RadioGroup, u as RadioGroupItem, A as Alert, b as AlertTitle, a as AlertDescription, G as Skeleton, T as Tabs, K as TabsList, L as TabsTrigger, J as TabsContent, H as Switch, C as Checkbox, N as Tooltip, Q as TooltipTrigger, O as TooltipContent } from "./skeleton-F4QzGUZ6.js";
19
+ import { a6 as clamp$1, a7 as useDirection, D as DropdownMenu, t as DropdownMenuTrigger, f as Button, h as DropdownMenuContent, I as Input, j as DropdownMenuItem, o as DropdownMenuSeparator, c as Avatar$1, d as AvatarFallback, B as Badge, M as Textarea, e as AvatarImage, k as DropdownMenuLabel, S as Select, E as SelectTrigger, F as SelectValue, v as SelectContent, x as SelectItem, P as TooltipProvider, R as RadioGroup, u as RadioGroupItem, A as Alert, b as AlertTitle, a as AlertDescription, G as Skeleton, T as Tabs, K as TabsList, L as TabsTrigger, J as TabsContent, H as Switch, C as Checkbox, N as Tooltip, Q as TooltipTrigger, O as TooltipContent } from "./skeleton-F4QzGUZ6.js";
20
20
  import { y as Presence, z as composeEventHandlers, u as useComposedRefs, P as Primitive, s as createContextScope, w as useCallbackRef, v as useLayoutEffect2, n as cn, S as Sheet, b as SheetContent, e as SheetHeader, h as SheetTitle, c as SheetDescription, d as SheetFooter, I as formatTimeLabel } from "./sheet-DfjeQvFC.js";
21
21
  import { l as lookup, D as DaemonAgentClient, h as hydrateAgentStreamItems, a as appendTimelineItemsToStreamTail, p as prependTimelineItemsToStreamTail, b as applyAgentStreamEvent, c as appendAgentTextChunk, s as summarizeFileOperations, d as classifyFileOperation } from "./agent-stream-items-CzSB9JMo.js";
22
22
  import { C as Check, b as Circle, a as ChevronUp } from "./circle-Dkpez688.js";
@@ -32557,7 +32557,7 @@ const ConversationWorkbenchBrowse = ({
32557
32557
  )
32558
32558
  }
32559
32559
  ),
32560
- /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: "bg-muted text-[11px] font-medium text-muted-foreground", children: getConversationHubInitials(conversation.title || conversation.conversationId) }) }),
32560
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: "bg-muted text-[11px] font-medium text-muted-foreground", children: getConversationHubInitials(conversation.title || conversation.conversationId) }) }),
32561
32561
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
32562
32562
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
32563
32563
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [
@@ -37707,7 +37707,7 @@ function ParticipantBarItem({
37707
37707
  const roleBadge = isAgent ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 rounded-md border border-sky-400/20 bg-sky-400/10 px-1.5 py-px text-[9px] font-medium leading-4 text-sky-600 dark:text-sky-300", children: "Agent" }) : isExternal ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 rounded-md border border-amber-500/25 bg-amber-500/10 px-1.5 py-px text-[9px] font-medium leading-4 text-amber-700 dark:text-amber-300", children: "外部" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 rounded-md border border-border/60 bg-muted/40 px-1.5 py-px text-[9px] font-medium leading-4 text-muted-foreground", children: "成员" });
37708
37708
  const content = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
37709
37709
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative shrink-0", children: [
37710
- /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "h-10 w-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: avatarTone, children: getParticipantInitials(displayName) }) }),
37710
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "h-10 w-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: avatarTone, children: getParticipantInitials(displayName) }) }),
37711
37711
  /* @__PURE__ */ jsxRuntimeExports.jsx(
37712
37712
  "span",
37713
37713
  {
@@ -37879,7 +37879,7 @@ function AgentChannelItem({
37879
37879
  const roleBadge = isAgent ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 rounded-md border border-sky-400/20 bg-sky-400/10 px-1.5 py-px text-[9px] font-medium leading-4 text-sky-600 dark:text-sky-300", children: "Agent" }) : isExternal ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 rounded-md border border-amber-500/25 bg-amber-500/10 px-1.5 py-px text-[9px] font-medium leading-4 text-amber-700 dark:text-amber-300", children: "外部" }) : null;
37880
37880
  const content = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
37881
37881
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative shrink-0", children: [
37882
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar, { className: "h-6 w-6", children: [
37882
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar$1, { className: "h-6 w-6", children: [
37883
37883
  participant.avatarUrl ? /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarImage, { src: participant.avatarUrl, alt: displayName }) : null,
37884
37884
  /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: cn("text-[10px]", avatarTone), children: getAgentChannelInitials(displayName) })
37885
37885
  ] }),
@@ -38951,7 +38951,7 @@ function ConversationTimelineMessage(props) {
38951
38951
  ] }) : null;
38952
38952
  if (bubble) {
38953
38953
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("group flex min-w-0 gap-3", isOwn ? "justify-end" : "justify-start"), children: [
38954
- !isOwn ? /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "mt-1 h-8 w-8 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: senderAvatarTone || "bg-muted", children: getInitials$1(senderLabel) }) }) : null,
38954
+ !isOwn ? /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "mt-1 h-8 w-8 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: senderAvatarTone || "bg-muted", children: getInitials$1(senderLabel) }) }) : null,
38955
38955
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
38956
38956
  "div",
38957
38957
  {
@@ -39718,7 +39718,7 @@ function ConversationHubView({
39718
39718
  }, [availableWorkspaces, eligibleAgentSubjects]);
39719
39719
  const resolvedAgentTargets = useMemo(
39720
39720
  () => eligibleAgentSubjects.map((subject) => {
39721
- var _a3, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
39721
+ var _a3, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
39722
39722
  const subjectClass = (config.subjectClasses || []).find((item) => item.classId === subject.classId) || null;
39723
39723
  const workspace = resolveBoundWorkspace(
39724
39724
  availableWorkspaces,
@@ -39728,17 +39728,20 @@ function ConversationHubView({
39728
39728
  const workspaceRuntimeConfig = workspace ? workspaceRuntimeConfigsByWorkspaceId[workspaceRuntimeConfigKey(workspace)] ?? null : null;
39729
39729
  const agentProfile = subject.agentProfile;
39730
39730
  const providerDefaults = agentProfile && ((_e2 = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.capabilities) == null ? void 0 : _e2.providerDefaults) ? workspaceRuntimeConfig.capabilities.providerDefaults[agentProfile.provider || "codex"] : null;
39731
+ const routeProvider = (agentProfile == null ? void 0 : agentProfile.provider) || ((_f = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _f.provider) || "codex";
39732
+ const workspaceBinding = ((_g = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.modelBindings) == null ? void 0 : _g[routeProvider]) || (((_h = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.modelBinding) == null ? void 0 : _h.runtimeProvider) === routeProvider ? workspaceRuntimeConfig.modelBinding : null);
39733
+ const workspaceBindingModel = (workspaceBinding == null ? void 0 : workspaceBinding.model) || null;
39731
39734
  const binding = workspace && agentProfile ? {
39732
39735
  tenantId,
39733
39736
  projectId: workspace.projectId,
39734
39737
  workspaceId: workspace.workspaceId,
39735
39738
  targetSubjectId: subject.subjectId,
39736
39739
  capabilityId: agentProfile.capabilityId,
39737
- provider: ((_f = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _f.provider) || agentProfile.provider,
39738
- bindingId: (_g = agentProfile.binding) == null ? void 0 : _g.bindingId,
39739
- model: ((_i = (_h = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _h.bindingDefaults) == null ? void 0 : _i.model) || ((_j = agentProfile.binding) == null ? void 0 : _j.model) || (providerDefaults == null ? void 0 : providerDefaults.model) || null,
39740
- modeId: ((_k = agentProfile.binding) == null ? void 0 : _k.modeId) || (providerDefaults == null ? void 0 : providerDefaults.modeId) || "readonly",
39741
- thinkingOptionId: ((_l = agentProfile.binding) == null ? void 0 : _l.thinkingOptionId) ?? (providerDefaults == null ? void 0 : providerDefaults.thinkingOptionId) ?? null,
39740
+ provider: ((_i = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _i.provider) || agentProfile.provider,
39741
+ bindingId: (_j = agentProfile.binding) == null ? void 0 : _j.bindingId,
39742
+ model: ((_l = (_k = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _k.bindingDefaults) == null ? void 0 : _l.model) || ((_m = agentProfile.binding) == null ? void 0 : _m.model) || workspaceBindingModel || (providerDefaults == null ? void 0 : providerDefaults.model) || null,
39743
+ modeId: ((_n = agentProfile.binding) == null ? void 0 : _n.modeId) || (providerDefaults == null ? void 0 : providerDefaults.modeId) || "readonly",
39744
+ thinkingOptionId: ((_o = agentProfile.binding) == null ? void 0 : _o.thinkingOptionId) ?? (providerDefaults == null ? void 0 : providerDefaults.thinkingOptionId) ?? null,
39742
39745
  permissionStrategy: getSubjectClassPermissionStrategy(subjectClass)
39743
39746
  } : null;
39744
39747
  return {
@@ -39780,7 +39783,7 @@ function ConversationHubView({
39780
39783
  );
39781
39784
  const resolveRouteableAgentTargetNow = useCallback(
39782
39785
  (subject, workspaceOverride) => {
39783
- var _a3, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
39786
+ var _a3, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n;
39784
39787
  const existing = routeableAgentTargetsBySubjectId.get(subject.subjectId);
39785
39788
  if (existing) return existing;
39786
39789
  const agentProfile = subject.agentProfile;
@@ -39797,6 +39800,9 @@ function ConversationHubView({
39797
39800
  if (!workspace) return null;
39798
39801
  const workspaceRuntimeConfig = workspaceRuntimeConfigsByWorkspaceId[workspaceRuntimeConfigKey(workspace)] ?? null;
39799
39802
  const providerDefaults = ((_d = (_c2 = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.capabilities) == null ? void 0 : _c2.providerDefaults) == null ? void 0 : _d[agentProfile.provider || "codex"]) || null;
39803
+ const routeProvider = (agentProfile == null ? void 0 : agentProfile.provider) || ((_e2 = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _e2.provider) || "codex";
39804
+ const workspaceBinding = ((_f = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.modelBindings) == null ? void 0 : _f[routeProvider]) || (((_g = workspaceRuntimeConfig == null ? void 0 : workspaceRuntimeConfig.modelBinding) == null ? void 0 : _g.runtimeProvider) === routeProvider ? workspaceRuntimeConfig.modelBinding : null);
39805
+ const workspaceBindingModel = (workspaceBinding == null ? void 0 : workspaceBinding.model) || null;
39800
39806
  return {
39801
39807
  subject,
39802
39808
  subjectClass: (config.subjectClasses || []).find((item) => item.classId === subject.classId) || null,
@@ -39808,11 +39814,11 @@ function ConversationHubView({
39808
39814
  workspaceId: workspace.workspaceId,
39809
39815
  targetSubjectId: subject.subjectId,
39810
39816
  capabilityId: agentProfile.capabilityId,
39811
- provider: ((_e2 = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _e2.provider) || agentProfile.provider,
39812
- bindingId: (_f = agentProfile.binding) == null ? void 0 : _f.bindingId,
39813
- model: ((_h = (_g = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _g.bindingDefaults) == null ? void 0 : _h.model) || ((_i = agentProfile.binding) == null ? void 0 : _i.model) || (providerDefaults == null ? void 0 : providerDefaults.model) || null,
39814
- modeId: ((_j = agentProfile.binding) == null ? void 0 : _j.modeId) || (providerDefaults == null ? void 0 : providerDefaults.modeId) || "readonly",
39815
- thinkingOptionId: ((_k = agentProfile.binding) == null ? void 0 : _k.thinkingOptionId) ?? (providerDefaults == null ? void 0 : providerDefaults.thinkingOptionId) ?? null,
39817
+ provider: ((_h = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _h.provider) || agentProfile.provider,
39818
+ bindingId: (_i = agentProfile.binding) == null ? void 0 : _i.bindingId,
39819
+ model: ((_k = (_j = subjectClass == null ? void 0 : subjectClass.agentConfig) == null ? void 0 : _j.bindingDefaults) == null ? void 0 : _k.model) || ((_l = agentProfile.binding) == null ? void 0 : _l.model) || workspaceBindingModel || (providerDefaults == null ? void 0 : providerDefaults.model) || null,
39820
+ modeId: ((_m = agentProfile.binding) == null ? void 0 : _m.modeId) || (providerDefaults == null ? void 0 : providerDefaults.modeId) || "readonly",
39821
+ thinkingOptionId: ((_n = agentProfile.binding) == null ? void 0 : _n.thinkingOptionId) ?? (providerDefaults == null ? void 0 : providerDefaults.thinkingOptionId) ?? null,
39816
39822
  permissionStrategy: getSubjectClassPermissionStrategy(
39817
39823
  (config.subjectClasses || []).find((item) => item.classId === subject.classId) || null
39818
39824
  )
@@ -43093,7 +43099,7 @@ function ConversationHubView({
43093
43099
  index2 === mentionQueryState.activeIndex ? "bg-primary/10" : "hover:bg-muted/60"
43094
43100
  ),
43095
43101
  children: [
43096
- /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: suggestion.subject.avatarTone, children: getInitials$1(suggestion.subject.label) }) }),
43102
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "h-8 w-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: suggestion.subject.avatarTone, children: getInitials$1(suggestion.subject.label) }) }),
43097
43103
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
43098
43104
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
43099
43105
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[13px] font-medium", children: suggestion.subject.label }),
@@ -43397,7 +43403,7 @@ function ConversationHubView({
43397
43403
  {
43398
43404
  className: "flex min-w-0 items-center gap-3 px-3 py-3",
43399
43405
  children: [
43400
- /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "h-9 w-9 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43406
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "h-9 w-9 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43401
43407
  AvatarFallback,
43402
43408
  {
43403
43409
  className: isAgent ? "bg-sky-500/12 text-sky-600 dark:text-sky-300" : "bg-primary/10 text-primary",
@@ -43493,7 +43499,7 @@ function ConversationHubView({
43493
43499
  active ? "border-primary/30 bg-primary/[0.06]" : "border-border/60 bg-background hover:bg-muted/20"
43494
43500
  ),
43495
43501
  children: [
43496
- /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { className: "h-9 w-9 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: "bg-primary/10 text-primary", children: getInitials$1(conversation.title || conversation.conversationId) }) }),
43502
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { className: "h-9 w-9 shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: "bg-primary/10 text-primary", children: getInitials$1(conversation.title || conversation.conversationId) }) }),
43497
43503
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
43498
43504
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-sm font-medium text-foreground", children: conversation.title || conversation.conversationId }),
43499
43505
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 truncate text-[11px] text-muted-foreground", children: conversation.conversationId }),
@@ -96258,6 +96264,341 @@ function ResourceAccessSheet({
96258
96264
  ] }) }) })
96259
96265
  ] }) });
96260
96266
  }
96267
+ const emptyForm = {
96268
+ name: "",
96269
+ providerKind: "compatible",
96270
+ runtimeProvider: "reasonix",
96271
+ protocol: "openai",
96272
+ baseUrl: "",
96273
+ endpoint: "",
96274
+ authType: "api-key",
96275
+ apiKey: "",
96276
+ models: [],
96277
+ enabled: true
96278
+ };
96279
+ function providerStatusLabel(status) {
96280
+ if (status === "available") return "可用";
96281
+ if (status === "unavailable") return "不可用";
96282
+ return "未检查";
96283
+ }
96284
+ function providerStatusClass(status) {
96285
+ if (status === "available") return "border-emerald-500/30 bg-emerald-500/5 text-emerald-700 dark:text-emerald-300";
96286
+ if (status === "unavailable") return "border-red-500/30 bg-red-500/5 text-red-700 dark:text-red-300";
96287
+ return "border-border/60 bg-muted/20 text-muted-foreground";
96288
+ }
96289
+ function toModelInput(value) {
96290
+ return value.split(/[,\n]/).map((id2) => id2.trim()).filter(Boolean).filter((id2, index2, values) => values.indexOf(id2) === index2).map((id2) => ({ id: id2, enabled: true }));
96291
+ }
96292
+ const ModelProviderPanel = ({
96293
+ embedded = false,
96294
+ onProvidersChange
96295
+ }) => {
96296
+ const [providers, setProviders] = useState([]);
96297
+ const [form, setForm] = useState(emptyForm);
96298
+ const [editingId, setEditingId] = useState(null);
96299
+ const [loading, setLoading] = useState(true);
96300
+ const [saving, setSaving] = useState(false);
96301
+ const [checking, setChecking] = useState(null);
96302
+ const [message, setMessage] = useState(null);
96303
+ const [error, setError] = useState(null);
96304
+ const load = useCallback(async () => {
96305
+ setLoading(true);
96306
+ try {
96307
+ const nextProviders = await listModelProviders();
96308
+ setProviders(nextProviders);
96309
+ onProvidersChange == null ? void 0 : onProvidersChange(nextProviders);
96310
+ setError(null);
96311
+ } catch (loadError) {
96312
+ setError(loadError instanceof Error ? loadError.message : "读取模型连接失败");
96313
+ } finally {
96314
+ setLoading(false);
96315
+ }
96316
+ }, [onProvidersChange]);
96317
+ useEffect(() => {
96318
+ void load();
96319
+ }, [load]);
96320
+ const modelText = useMemo(() => (form.models || []).map((model) => model.id).join("\n"), [form.models]);
96321
+ const updateForm = (key, value) => {
96322
+ setForm((current2) => ({ ...current2, [key]: value }));
96323
+ setMessage(null);
96324
+ setError(null);
96325
+ };
96326
+ const edit = (provider) => {
96327
+ setEditingId(provider.id);
96328
+ setForm({
96329
+ name: provider.name,
96330
+ providerKind: provider.providerKind,
96331
+ runtimeProvider: provider.runtimeProvider || "reasonix",
96332
+ protocol: provider.protocol,
96333
+ baseUrl: provider.baseUrl,
96334
+ endpoint: provider.endpoint || "",
96335
+ authType: provider.authType,
96336
+ apiKey: "",
96337
+ models: provider.models.map((model) => ({ id: model.id, label: model.label, enabled: model.enabled })),
96338
+ enabled: provider.enabled
96339
+ });
96340
+ setMessage(null);
96341
+ setError(null);
96342
+ };
96343
+ const reset2 = () => {
96344
+ setEditingId(null);
96345
+ setForm(emptyForm);
96346
+ setMessage(null);
96347
+ setError(null);
96348
+ };
96349
+ const checkDraft = async () => {
96350
+ setChecking("draft");
96351
+ setMessage(null);
96352
+ setError(null);
96353
+ try {
96354
+ const result = await checkModelProviderInput(form);
96355
+ if (result.models.length > 0) {
96356
+ updateForm("models", result.models.map((model) => ({ id: model.id, label: model.label, enabled: true })));
96357
+ }
96358
+ setMessage(result.status === "available" ? `连接成功,发现 ${result.models.length} 个模型。` : result.error || "Provider 当前不可用。");
96359
+ } catch (checkError) {
96360
+ setError(checkError instanceof Error ? checkError.message : "连接检查失败");
96361
+ } finally {
96362
+ setChecking(null);
96363
+ }
96364
+ };
96365
+ const save = async () => {
96366
+ setSaving(true);
96367
+ setMessage(null);
96368
+ setError(null);
96369
+ try {
96370
+ const successMessage = editingId ? "模型连接已更新。" : "模型连接已添加。";
96371
+ if (editingId) {
96372
+ await updateModelProvider(editingId, form);
96373
+ } else {
96374
+ await createModelProvider(form);
96375
+ }
96376
+ await load();
96377
+ setEditingId(null);
96378
+ setForm(emptyForm);
96379
+ setMessage(successMessage);
96380
+ } catch (saveError) {
96381
+ setError(saveError instanceof Error ? saveError.message : "保存模型连接失败");
96382
+ } finally {
96383
+ setSaving(false);
96384
+ }
96385
+ };
96386
+ const checkSaved = async (provider) => {
96387
+ setChecking(provider.id);
96388
+ setMessage(null);
96389
+ setError(null);
96390
+ try {
96391
+ const result = await checkModelProvider(provider.id);
96392
+ setMessage(result.status === "available" ? `${provider.name} 连接成功,发现 ${result.models.length} 个模型。` : result.error || `${provider.name} 当前不可用。`);
96393
+ await load();
96394
+ } catch (checkError) {
96395
+ setError(checkError instanceof Error ? checkError.message : "连接检查失败");
96396
+ } finally {
96397
+ setChecking(null);
96398
+ }
96399
+ };
96400
+ const remove2 = async (provider) => {
96401
+ if (provider.ownerType === "system") return;
96402
+ if (!window.confirm(`确定删除「${provider.name}」吗?`)) return;
96403
+ try {
96404
+ await deleteModelProvider(provider.id);
96405
+ if (editingId === provider.id) reset2();
96406
+ await load();
96407
+ setMessage("模型连接已删除。");
96408
+ } catch (deleteError) {
96409
+ setError(deleteError instanceof Error ? deleteError.message : "删除模型连接失败");
96410
+ }
96411
+ };
96412
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: embedded ? "border-b border-border/60 pb-4" : "rounded-md border border-border/60 bg-background p-4", children: [
96413
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
96414
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2.5", children: [
96415
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-md border bg-muted/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Server, { className: "h-4 w-4 text-primary" }) }),
96416
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
96417
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: "模型" }),
96418
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 max-w-2xl text-xs leading-5 text-muted-foreground", children: "管理当前空间可用的模型连接。密钥仅用于连接检查和模型调用,读取时不会返回明文。" })
96419
+ ] })
96420
+ ] }),
96421
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 gap-1.5 px-2 text-xs", onClick: () => void load(), disabled: loading, children: [
96422
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw$1, { className: cn("h-3.5 w-3.5", loading && "animate-spin") }),
96423
+ "刷新"
96424
+ ] })
96425
+ ] }),
96426
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(280px,360px)]", children: [
96427
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
96428
+ loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-h-28 items-center justify-center text-xs text-muted-foreground", children: [
96429
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
96430
+ "正在读取模型连接"
96431
+ ] }) : null,
96432
+ !loading && providers.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md border border-dashed border-border/70 px-3 py-6 text-center text-xs text-muted-foreground", children: "还没有可用的模型连接,请先添加一个。" }) : null,
96433
+ providers.map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-md border border-border/60 px-3 py-2.5", children: [
96434
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
96435
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [
96436
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
96437
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-sm font-medium", children: provider.name }),
96438
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: cn("text-[10px]", providerStatusClass(provider.status)), children: providerStatusLabel(provider.status) }),
96439
+ provider.ownerType === "system" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px]", children: "系统预置" }) : null
96440
+ ] }),
96441
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 truncate text-[11px] text-muted-foreground", children: [
96442
+ provider.baseUrl,
96443
+ " · ",
96444
+ provider.protocol === "openai" ? "OpenAI 兼容" : "Anthropic"
96445
+ ] })
96446
+ ] }),
96447
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
96448
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 gap-1 px-2 text-xs", onClick: () => void checkSaved(provider), disabled: checking !== null, children: [
96449
+ checking === provider.id ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheck, { className: "h-3.5 w-3.5" }),
96450
+ "检查"
96451
+ ] }),
96452
+ provider.ownerType !== "system" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
96453
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2 text-xs", onClick: () => edit(provider), children: "编辑" }),
96454
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2 text-xs text-red-600", onClick: () => void remove2(provider), "aria-label": `删除${provider.name}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, { className: "h-3.5 w-3.5" }) })
96455
+ ] }) : null
96456
+ ] })
96457
+ ] }),
96458
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
96459
+ provider.models.filter((model) => model.enabled).slice(0, 12).map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded border border-border/60 px-1.5 py-0.5 text-[10px] text-muted-foreground", children: model.label || model.id }, model.id)),
96460
+ provider.models.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] text-muted-foreground", children: "尚未发现模型" }) : null
96461
+ ] })
96462
+ ] }, provider.id))
96463
+ ] }),
96464
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-md border border-border/60 bg-muted/10 p-3", children: [
96465
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3 flex items-center justify-between gap-2", children: [
96466
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-xs font-medium", children: [
96467
+ /* @__PURE__ */ jsxRuntimeExports.jsx(KeyRound, { className: "h-4 w-4 text-muted-foreground" }),
96468
+ editingId ? "编辑模型连接" : "添加模型连接"
96469
+ ] }),
96470
+ editingId ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 px-2 text-xs", onClick: reset2, children: "取消" }) : null
96471
+ ] }),
96472
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2.5", children: [
96473
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96474
+ "名称",
96475
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.name, placeholder: "例如:我的 DeepSeek", onChange: (event) => updateForm("name", event.target.value) })
96476
+ ] }),
96477
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2 sm:grid-cols-3", children: [
96478
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96479
+ "协议",
96480
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm", value: form.protocol, onChange: (event) => updateForm("protocol", event.target.value), children: [
96481
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "openai", children: "OpenAI 兼容" }),
96482
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "anthropic", children: "Anthropic" })
96483
+ ] })
96484
+ ] }),
96485
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96486
+ "运行时",
96487
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm", value: form.runtimeProvider, onChange: (event) => updateForm("runtimeProvider", event.target.value), children: [
96488
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "reasonix", children: "Reasonix" }),
96489
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "codex", children: "Codex" }),
96490
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "claude", children: "Claude Code" })
96491
+ ] })
96492
+ ] }),
96493
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96494
+ "认证方式",
96495
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm", value: form.authType, onChange: (event) => updateForm("authType", event.target.value), children: [
96496
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "api-key", children: "API Key" }),
96497
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "bearer", children: "Bearer Token" }),
96498
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "none", children: "无需认证" })
96499
+ ] })
96500
+ ] })
96501
+ ] }),
96502
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96503
+ "Base URL",
96504
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.baseUrl, placeholder: "https://api.example.com/v1", onChange: (event) => updateForm("baseUrl", event.target.value) })
96505
+ ] }),
96506
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96507
+ "模型接口路径(可选)",
96508
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.endpoint || "", placeholder: "默认使用 /models", onChange: (event) => updateForm("endpoint", event.target.value) })
96509
+ ] }),
96510
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96511
+ "API Key",
96512
+ editingId ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 font-normal text-muted-foreground", children: "留空则保留原凭据" }) : null,
96513
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", type: "password", autoComplete: "new-password", value: form.apiKey || "", placeholder: editingId ? "已配置,输入新 Key 可替换" : "输入 API Key", onChange: (event) => updateForm("apiKey", event.target.value) })
96514
+ ] }),
96515
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
96516
+ "模型列表",
96517
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 font-normal text-muted-foreground", children: "每行一个,也可由检查自动发现" }),
96518
+ /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { className: "mt-1.5 min-h-20 w-full resize-y rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring", value: modelText, placeholder: "deepseek-chat\\ngpt-4o-mini", onChange: (event) => updateForm("models", toModelInput(event.target.value)) })
96519
+ ] })
96520
+ ] }),
96521
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 flex flex-wrap justify-end gap-2", children: [
96522
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "gap-1.5", onClick: () => void checkDraft(), disabled: checking !== null || !form.baseUrl, children: [
96523
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CircleX, { className: "h-3.5 w-3.5" }),
96524
+ "检查连接"
96525
+ ] }),
96526
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", size: "sm", className: "gap-1.5", onClick: () => void save(), disabled: saving || !form.name || !form.baseUrl, children: [
96527
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "h-3.5 w-3.5" }),
96528
+ saving ? "保存中" : "保存模型"
96529
+ ] })
96530
+ ] })
96531
+ ] })
96532
+ ] }),
96533
+ error ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 rounded-md border border-red-500/25 bg-red-500/5 px-3 py-2 text-xs text-red-700 dark:text-red-300", children: error }) : null,
96534
+ message ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 rounded-md border border-emerald-500/25 bg-emerald-500/5 px-3 py-2 text-xs text-emerald-700 dark:text-emerald-300", children: message }) : null
96535
+ ] });
96536
+ };
96537
+ const WorkspaceAgentSettingsDialog = ({
96538
+ open,
96539
+ onOpenChange,
96540
+ onProvidersChange
96541
+ }) => {
96542
+ const [activeTab, setActiveTab] = useState("models");
96543
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
96544
+ SheetContent,
96545
+ {
96546
+ side: "right",
96547
+ mobileSide: "bottom",
96548
+ className: "flex max-h-[92dvh] w-full flex-col gap-0 overflow-hidden rounded-t-lg p-0 md:!w-[min(980px,calc(100vw-16px))] md:!max-w-[980px] md:rounded-none",
96549
+ children: [
96550
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetHeader, { className: "shrink-0 border-b border-border px-5 py-4 pr-14", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2.5", children: [
96551
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-md border bg-muted/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Settings2, { className: "h-4 w-4 text-primary" }) }),
96552
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
96553
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetTitle, { children: "设置" }),
96554
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetDescription, { className: "mt-1", children: "管理当前空间可用的模型和计算机能力。" })
96555
+ ] })
96556
+ ] }) }),
96557
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[160px_minmax(0,1fr)]", children: [
96558
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("nav", { className: "flex shrink-0 gap-1 border-b bg-muted/10 p-2 md:block md:border-b-0 md:border-r", "aria-label": "设置分类", children: [
96559
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
96560
+ "button",
96561
+ {
96562
+ type: "button",
96563
+ className: cn(
96564
+ "flex min-h-10 min-w-0 flex-1 items-center gap-2 rounded-md px-3 text-left text-sm font-medium transition-colors md:w-full",
96565
+ activeTab === "models" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
96566
+ ),
96567
+ "aria-current": activeTab === "models" ? "page" : void 0,
96568
+ onClick: () => setActiveTab("models"),
96569
+ children: [
96570
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Bot, { className: "h-4 w-4" }),
96571
+ "模型"
96572
+ ]
96573
+ }
96574
+ ),
96575
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
96576
+ "button",
96577
+ {
96578
+ type: "button",
96579
+ className: cn(
96580
+ "mt-0 flex min-h-10 min-w-0 flex-1 items-center gap-2 rounded-md px-3 text-left text-sm font-medium transition-colors md:mt-1 md:w-full",
96581
+ activeTab === "computers" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
96582
+ ),
96583
+ "aria-current": activeTab === "computers" ? "page" : void 0,
96584
+ onClick: () => setActiveTab("computers"),
96585
+ children: [
96586
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Laptop, { className: "h-4 w-4" }),
96587
+ "计算机"
96588
+ ]
96589
+ }
96590
+ )
96591
+ ] }),
96592
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 min-w-0 overflow-y-auto p-4 sm:p-5", children: activeTab === "models" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderPanel, { onProvidersChange }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-[360px] items-center justify-center rounded-md border border-dashed border-border/70 bg-muted/10 px-6 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-xs", children: [
96593
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Laptop, { className: "mx-auto h-8 w-8 text-muted-foreground/60" }),
96594
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "mt-3 text-sm font-semibold", children: "计算机能力" }),
96595
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1.5 text-xs leading-5 text-muted-foreground", children: "计算机控制能力正在建设中,完成后可在这里进行配置。" })
96596
+ ] }) }) })
96597
+ ] })
96598
+ ]
96599
+ }
96600
+ ) });
96601
+ };
96261
96602
  function WorkspaceManager() {
96262
96603
  var _a2;
96263
96604
  const { projectId: routeProjectId } = useParams();
@@ -96278,6 +96619,7 @@ function WorkspaceManager() {
96278
96619
  const [showCreateDialog, setShowCreateDialog] = useState(false);
96279
96620
  const [selectedWorkspace, setSelectedWorkspace] = useState(null);
96280
96621
  const [shareWorkspace, setShareWorkspace] = useState(null);
96622
+ const [settingsOpen, setSettingsOpen] = useState(false);
96281
96623
  const [isCreating, setIsCreating] = useState(false);
96282
96624
  const currentProjectId = routeProjectId || (activeSpace == null ? void 0 : activeSpace.projectId) || "";
96283
96625
  const currentSpaceName = (activeSpace == null ? void 0 : activeSpace.name) || "当前空间";
@@ -96535,6 +96877,21 @@ function WorkspaceManager() {
96535
96877
  },
96536
96878
  `${ws.projectId}:${ws.workspaceId}`
96537
96879
  )) }) }) }),
96880
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t bg-card/30 px-3 py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
96881
+ Button,
96882
+ {
96883
+ type: "button",
96884
+ variant: "ghost",
96885
+ size: "sm",
96886
+ className: "h-8 w-full justify-start gap-1.5 px-2 text-xs",
96887
+ onClick: () => setSettingsOpen(true),
96888
+ "aria-label": "打开设置",
96889
+ children: [
96890
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Settings2, { className: "h-3.5 w-3.5" }),
96891
+ "设置"
96892
+ ]
96893
+ }
96894
+ ) }),
96538
96895
  /* @__PURE__ */ jsxRuntimeExports.jsx(
96539
96896
  CreateWorkspaceDialog,
96540
96897
  {
@@ -96571,7 +96928,8 @@ function WorkspaceManager() {
96571
96928
  tenantId: shareWorkspace.tenantId
96572
96929
  } : null
96573
96930
  }
96574
- )
96931
+ ),
96932
+ /* @__PURE__ */ jsxRuntimeExports.jsx(WorkspaceAgentSettingsDialog, { open: settingsOpen, onOpenChange: setSettingsOpen })
96575
96933
  ] });
96576
96934
  }
96577
96935
  function dedupeWorkspaces(workspaces) {
@@ -104588,261 +104946,6 @@ class WorkspaceService {
104588
104946
  }
104589
104947
  }
104590
104948
  const workspaceService = new WorkspaceService();
104591
- const emptyForm = {
104592
- name: "",
104593
- providerKind: "compatible",
104594
- protocol: "openai",
104595
- baseUrl: "",
104596
- endpoint: "",
104597
- authType: "api-key",
104598
- apiKey: "",
104599
- models: [],
104600
- enabled: true
104601
- };
104602
- function providerStatusLabel(status) {
104603
- if (status === "available") return "可用";
104604
- if (status === "unavailable") return "不可用";
104605
- return "未检查";
104606
- }
104607
- function providerStatusClass(status) {
104608
- if (status === "available") return "border-emerald-500/30 bg-emerald-500/5 text-emerald-700 dark:text-emerald-300";
104609
- if (status === "unavailable") return "border-red-500/30 bg-red-500/5 text-red-700 dark:text-red-300";
104610
- return "border-border/60 bg-muted/20 text-muted-foreground";
104611
- }
104612
- function toModelInput(value) {
104613
- return value.split(/[,\n]/).map((id2) => id2.trim()).filter(Boolean).filter((id2, index2, values) => values.indexOf(id2) === index2).map((id2) => ({ id: id2, enabled: true }));
104614
- }
104615
- const ModelProviderPanel = () => {
104616
- const [providers, setProviders] = useState([]);
104617
- const [form, setForm] = useState(emptyForm);
104618
- const [editingId, setEditingId] = useState(null);
104619
- const [loading, setLoading] = useState(true);
104620
- const [saving, setSaving] = useState(false);
104621
- const [checking, setChecking] = useState(null);
104622
- const [message, setMessage] = useState(null);
104623
- const [error, setError] = useState(null);
104624
- const load = useCallback(async () => {
104625
- setLoading(true);
104626
- try {
104627
- setProviders(await listModelProviders());
104628
- setError(null);
104629
- } catch (loadError) {
104630
- setError(loadError instanceof Error ? loadError.message : "读取 Provider 失败");
104631
- } finally {
104632
- setLoading(false);
104633
- }
104634
- }, []);
104635
- useEffect(() => {
104636
- void load();
104637
- }, [load]);
104638
- const modelText = useMemo(() => (form.models || []).map((model) => model.id).join("\n"), [form.models]);
104639
- const updateForm = (key, value) => {
104640
- setForm((current2) => ({ ...current2, [key]: value }));
104641
- setMessage(null);
104642
- setError(null);
104643
- };
104644
- const edit = (provider) => {
104645
- setEditingId(provider.id);
104646
- setForm({
104647
- name: provider.name,
104648
- providerKind: provider.providerKind,
104649
- protocol: provider.protocol,
104650
- baseUrl: provider.baseUrl,
104651
- endpoint: provider.endpoint || "",
104652
- authType: provider.authType,
104653
- apiKey: "",
104654
- models: provider.models.map((model) => ({ id: model.id, label: model.label, enabled: model.enabled })),
104655
- enabled: provider.enabled
104656
- });
104657
- setMessage(null);
104658
- setError(null);
104659
- };
104660
- const reset2 = () => {
104661
- setEditingId(null);
104662
- setForm(emptyForm);
104663
- setMessage(null);
104664
- setError(null);
104665
- };
104666
- const checkDraft = async () => {
104667
- setChecking("draft");
104668
- setMessage(null);
104669
- setError(null);
104670
- try {
104671
- const result = await checkModelProviderInput(form);
104672
- if (result.models.length > 0) {
104673
- updateForm("models", result.models.map((model) => ({ id: model.id, label: model.label, enabled: true })));
104674
- }
104675
- setMessage(result.status === "available" ? `连接成功,发现 ${result.models.length} 个模型。` : result.error || "Provider 当前不可用。");
104676
- } catch (checkError) {
104677
- setError(checkError instanceof Error ? checkError.message : "连接检查失败");
104678
- } finally {
104679
- setChecking(null);
104680
- }
104681
- };
104682
- const save = async () => {
104683
- setSaving(true);
104684
- setMessage(null);
104685
- setError(null);
104686
- try {
104687
- const successMessage = editingId ? "Provider 已更新。" : "Provider 已添加。";
104688
- if (editingId) {
104689
- await updateModelProvider(editingId, form);
104690
- } else {
104691
- await createModelProvider(form);
104692
- }
104693
- await load();
104694
- setEditingId(null);
104695
- setForm(emptyForm);
104696
- setMessage(successMessage);
104697
- } catch (saveError) {
104698
- setError(saveError instanceof Error ? saveError.message : "保存 Provider 失败");
104699
- } finally {
104700
- setSaving(false);
104701
- }
104702
- };
104703
- const checkSaved = async (provider) => {
104704
- setChecking(provider.id);
104705
- setMessage(null);
104706
- setError(null);
104707
- try {
104708
- const result = await checkModelProvider(provider.id);
104709
- setMessage(result.status === "available" ? `${provider.name} 连接成功,发现 ${result.models.length} 个模型。` : result.error || `${provider.name} 当前不可用。`);
104710
- await load();
104711
- } catch (checkError) {
104712
- setError(checkError instanceof Error ? checkError.message : "连接检查失败");
104713
- } finally {
104714
- setChecking(null);
104715
- }
104716
- };
104717
- const remove2 = async (provider) => {
104718
- if (provider.ownerType === "system") return;
104719
- if (!window.confirm(`确定删除「${provider.name}」吗?`)) return;
104720
- try {
104721
- await deleteModelProvider(provider.id);
104722
- if (editingId === provider.id) reset2();
104723
- await load();
104724
- setMessage("Provider 已删除。");
104725
- } catch (deleteError) {
104726
- setError(deleteError instanceof Error ? deleteError.message : "删除 Provider 失败");
104727
- }
104728
- };
104729
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "rounded-md border border-border/60 bg-background p-4", children: [
104730
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
104731
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2.5", children: [
104732
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-md border bg-muted/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Server, { className: "h-4 w-4 text-primary" }) }),
104733
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
104734
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: "模型提供方" }),
104735
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 max-w-2xl text-xs leading-5 text-muted-foreground", children: "管理个人可用的模型连接。API Key 只用于连接检查和模型调用,读取时不会返回明文。" })
104736
- ] })
104737
- ] }),
104738
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 gap-1.5 px-2 text-xs", onClick: () => void load(), disabled: loading, children: [
104739
- /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw$1, { className: cn("h-3.5 w-3.5", loading && "animate-spin") }),
104740
- "刷新"
104741
- ] })
104742
- ] }),
104743
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(280px,360px)]", children: [
104744
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
104745
- loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-h-28 items-center justify-center text-xs text-muted-foreground", children: [
104746
- /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
104747
- "正在读取模型提供方"
104748
- ] }) : null,
104749
- !loading && providers.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md border border-dashed border-border/70 px-3 py-6 text-center text-xs text-muted-foreground", children: "还没有可用的模型提供方,请先添加一个。" }) : null,
104750
- providers.map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-md border border-border/60 px-3 py-2.5", children: [
104751
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
104752
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [
104753
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
104754
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-sm font-medium", children: provider.name }),
104755
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: cn("text-[10px]", providerStatusClass(provider.status)), children: providerStatusLabel(provider.status) }),
104756
- provider.ownerType === "system" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px]", children: "平台提供" }) : null
104757
- ] }),
104758
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 truncate text-[11px] text-muted-foreground", children: [
104759
- provider.baseUrl,
104760
- " · ",
104761
- provider.protocol === "openai" ? "OpenAI 兼容" : "Anthropic"
104762
- ] })
104763
- ] }),
104764
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
104765
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 gap-1 px-2 text-xs", onClick: () => void checkSaved(provider), disabled: checking !== null, children: [
104766
- checking === provider.id ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheck, { className: "h-3.5 w-3.5" }),
104767
- "检查"
104768
- ] }),
104769
- provider.ownerType !== "system" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
104770
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2 text-xs", onClick: () => edit(provider), children: "编辑" }),
104771
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2 text-xs text-red-600", onClick: () => void remove2(provider), "aria-label": `删除${provider.name}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, { className: "h-3.5 w-3.5" }) })
104772
- ] }) : null
104773
- ] })
104774
- ] }),
104775
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
104776
- provider.models.filter((model) => model.enabled).slice(0, 12).map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded border border-border/60 px-1.5 py-0.5 text-[10px] text-muted-foreground", children: model.label || model.id }, model.id)),
104777
- provider.models.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] text-muted-foreground", children: "尚未发现模型" }) : null
104778
- ] })
104779
- ] }, provider.id))
104780
- ] }),
104781
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-md border border-border/60 bg-muted/10 p-3", children: [
104782
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3 flex items-center justify-between gap-2", children: [
104783
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-xs font-medium", children: [
104784
- /* @__PURE__ */ jsxRuntimeExports.jsx(KeyRound, { className: "h-4 w-4 text-muted-foreground" }),
104785
- editingId ? "编辑模型提供方" : "添加模型提供方"
104786
- ] }),
104787
- editingId ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 px-2 text-xs", onClick: reset2, children: "取消" }) : null
104788
- ] }),
104789
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2.5", children: [
104790
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104791
- "名称",
104792
- /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.name, placeholder: "例如:我的 DeepSeek", onChange: (event) => updateForm("name", event.target.value) })
104793
- ] }),
104794
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
104795
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104796
- "协议",
104797
- /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm", value: form.protocol, onChange: (event) => updateForm("protocol", event.target.value), children: [
104798
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "openai", children: "OpenAI 兼容" }),
104799
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "anthropic", children: "Anthropic" })
104800
- ] })
104801
- ] }),
104802
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104803
- "认证方式",
104804
- /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm", value: form.authType, onChange: (event) => updateForm("authType", event.target.value), children: [
104805
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "api-key", children: "API Key" }),
104806
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "bearer", children: "Bearer Token" }),
104807
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "none", children: "无需认证" })
104808
- ] })
104809
- ] })
104810
- ] }),
104811
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104812
- "Base URL",
104813
- /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.baseUrl, placeholder: "https://api.example.com/v1", onChange: (event) => updateForm("baseUrl", event.target.value) })
104814
- ] }),
104815
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104816
- "模型接口路径(可选)",
104817
- /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", value: form.endpoint || "", placeholder: "默认使用 /models", onChange: (event) => updateForm("endpoint", event.target.value) })
104818
- ] }),
104819
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104820
- "API Key",
104821
- editingId ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 font-normal text-muted-foreground", children: "留空则保留原凭据" }) : null,
104822
- /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: "mt-1.5", type: "password", autoComplete: "new-password", value: form.apiKey || "", placeholder: editingId ? "已配置,输入新 Key 可替换" : "输入 API Key", onChange: (event) => updateForm("apiKey", event.target.value) })
104823
- ] }),
104824
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
104825
- "模型列表",
104826
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 font-normal text-muted-foreground", children: "每行一个,也可由检查自动发现" }),
104827
- /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { className: "mt-1.5 min-h-20 w-full resize-y rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring", value: modelText, placeholder: "deepseek-chat\\ngpt-4o-mini", onChange: (event) => updateForm("models", toModelInput(event.target.value)) })
104828
- ] })
104829
- ] }),
104830
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 flex flex-wrap justify-end gap-2", children: [
104831
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "gap-1.5", onClick: () => void checkDraft(), disabled: checking !== null || !form.baseUrl, children: [
104832
- /* @__PURE__ */ jsxRuntimeExports.jsx(CircleX, { className: "h-3.5 w-3.5" }),
104833
- "检查连接"
104834
- ] }),
104835
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", size: "sm", className: "gap-1.5", onClick: () => void save(), disabled: saving || !form.name || !form.baseUrl, children: [
104836
- /* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "h-3.5 w-3.5" }),
104837
- saving ? "保存中" : "保存提供方"
104838
- ] })
104839
- ] })
104840
- ] })
104841
- ] }),
104842
- error ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 rounded-md border border-red-500/25 bg-red-500/5 px-3 py-2 text-xs text-red-700 dark:text-red-300", children: error }) : null,
104843
- message ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 rounded-md border border-emerald-500/25 bg-emerald-500/5 px-3 py-2 text-xs text-emerald-700 dark:text-emerald-300", children: message }) : null
104844
- ] });
104845
- };
104846
104949
  const LOCAL_ECHO_MCP_SCRIPT = [
104847
104950
  "let b='';",
104848
104951
  "const tools=[{name:'echo',description:'回传输入文本,用于检查 MCP 连接。',inputSchema:{type:'object',properties:{text:{type:'string'}},required:['text']}},{name:'ping',description:'返回固定 pong,用于检查 MCP 健康状态。',inputSchema:{type:'object',properties:{}}}];",
@@ -105052,6 +105155,7 @@ function providerLabel(provider) {
105052
105155
  };
105053
105156
  return labels[provider] || provider;
105054
105157
  }
105158
+ const RUNTIME_PROVIDERS_WITH_MODEL_BINDING = /* @__PURE__ */ new Set(["reasonix", "codex", "claude"]);
105055
105159
  function healthLabel(id2, fallback) {
105056
105160
  const labels = {
105057
105161
  actions: "快捷动作",
@@ -105091,11 +105195,6 @@ function providerRuntimeTone(status) {
105091
105195
  if (status === "unavailable") return "warning";
105092
105196
  return "neutral";
105093
105197
  }
105094
- function providerSourceLabel(source2) {
105095
- if (source2 === "builtin") return "内置适配器";
105096
- if (source2 === "plugin") return "插件适配器";
105097
- return "来源未知";
105098
- }
105099
105198
  function errorMessage(error, fallback) {
105100
105199
  return error instanceof Error && error.message ? error.message : fallback;
105101
105200
  }
@@ -105246,9 +105345,10 @@ const WorkspaceRuntimeConfigPanel = ({
105246
105345
  workspaceId,
105247
105346
  agentConnectionStatus,
105248
105347
  className,
105249
- surface = "page"
105348
+ surface = "page",
105349
+ modelProviders: externalModelProviders
105250
105350
  }) => {
105251
- var _a2, _b, _c, _d, _e2, _f;
105351
+ var _a2, _b, _c;
105252
105352
  const token = getRuntimeAccessToken() || "";
105253
105353
  const modelDatalistId = useMemo(
105254
105354
  () => `runtime-models-${projectId}-${workspaceId}`.replace(/[^a-zA-Z0-9_-]/g, "-"),
@@ -105269,11 +105369,26 @@ const WorkspaceRuntimeConfigPanel = ({
105269
105369
  const [selectedProvider, setSelectedProvider] = useState(null);
105270
105370
  const [modelProviders, setModelProviders] = useState([]);
105271
105371
  const [modelBinding, setModelBinding] = useState({});
105372
+ const [modelBindings, setModelBindings] = useState({});
105373
+ const [bindingRuntimeProvider, setBindingRuntimeProvider] = useState("reasonix");
105272
105374
  const [advancedOpen, setAdvancedOpen] = useState(false);
105273
105375
  const [expandedProviderDiagnostics, setExpandedProviderDiagnostics] = useState({});
105274
105376
  const [providerDiagnostics, setProviderDiagnostics] = useState({});
105275
105377
  const [diagnosticLoading, setDiagnosticLoading] = useState(null);
105276
105378
  const [publishReport, setPublishReport] = useState({ phase: "idle" });
105379
+ const providerSelectionTouchedRef = useRef(false);
105380
+ useEffect(() => {
105381
+ if (!externalModelProviders) return;
105382
+ setModelProviders(externalModelProviders);
105383
+ setModelBinding((current2) => {
105384
+ if (!current2.providerId) return current2;
105385
+ const selected2 = externalModelProviders.find((provider) => provider.id === current2.providerId);
105386
+ if (!selected2) return current2;
105387
+ const enabledModels = selected2.models.filter((model) => model.enabled);
105388
+ if (current2.model && enabledModels.some((model) => model.id === current2.model)) return current2;
105389
+ return { ...current2, model: void 0 };
105390
+ });
105391
+ }, [externalModelProviders]);
105277
105392
  const draftState = useMemo(() => parseDraft(draft), [draft]);
105278
105393
  const capabilityConfig = draftState.config;
105279
105394
  const mcpHealthServers = useMemo(() => getMcpHealthServers(health), [health]);
@@ -105290,12 +105405,16 @@ const WorkspaceRuntimeConfigPanel = ({
105290
105405
  () => providerSnapshots.find((provider) => provider.provider === selectedProvider) || null,
105291
105406
  [providerSnapshots, selectedProvider]
105292
105407
  );
105293
- const selectedProviderDefaults = selectedProvider ? (_a2 = capabilityConfig == null ? void 0 : capabilityConfig.providerDefaults) == null ? void 0 : _a2[selectedProvider] : void 0;
105408
+ const supportsModelBinding = RUNTIME_PROVIDERS_WITH_MODEL_BINDING.has(bindingRuntimeProvider);
105409
+ const activeCapabilityProvider = selectedProvider;
105410
+ const selectedProviderDefaults = activeCapabilityProvider ? (_a2 = capabilityConfig == null ? void 0 : capabilityConfig.providerDefaults) == null ? void 0 : _a2[activeCapabilityProvider] : void 0;
105294
105411
  useEffect(() => {
105295
- if (!selectedProvider && providerOptions.length > 0) {
105412
+ if (!providerSelectionTouchedRef.current && bindingRuntimeProvider && providerOptions.includes(bindingRuntimeProvider)) {
105413
+ setSelectedProvider(bindingRuntimeProvider);
105414
+ } else if (!selectedProvider && providerOptions.length > 0) {
105296
105415
  setSelectedProvider(providerOptions[0]);
105297
105416
  }
105298
- }, [providerOptions, selectedProvider]);
105417
+ }, [bindingRuntimeProvider, providerOptions, selectedProvider]);
105299
105418
  useEffect(() => {
105300
105419
  const client = new DaemonAgentClient(
105301
105420
  {
@@ -105353,6 +105472,7 @@ const WorkspaceRuntimeConfigPanel = ({
105353
105472
  }
105354
105473
  }, []);
105355
105474
  const loadRuntimeConfig = useCallback(async () => {
105475
+ var _a3;
105356
105476
  setLoading(true);
105357
105477
  setError(null);
105358
105478
  try {
@@ -105363,7 +105483,16 @@ const WorkspaceRuntimeConfigPanel = ({
105363
105483
  const capabilities = (runtimeConfig == null ? void 0 : runtimeConfig.capabilities) || emptyCapabilityConfig();
105364
105484
  setDraft(JSON.stringify(capabilities, null, 2));
105365
105485
  setModelProviders(availableProviders);
105366
- setModelBinding((runtimeConfig == null ? void 0 : runtimeConfig.modelBinding) || {});
105486
+ const bindings = { ...(runtimeConfig == null ? void 0 : runtimeConfig.modelBindings) || {} };
105487
+ const legacyBinding = runtimeConfig == null ? void 0 : runtimeConfig.modelBinding;
105488
+ const inferredLegacyRuntime = (legacyBinding == null ? void 0 : legacyBinding.runtimeProvider) || ((_a3 = availableProviders.find((provider) => provider.id === (legacyBinding == null ? void 0 : legacyBinding.providerId))) == null ? void 0 : _a3.runtimeProvider);
105489
+ if (legacyBinding && inferredLegacyRuntime && !bindings[inferredLegacyRuntime]) {
105490
+ bindings[inferredLegacyRuntime] = { ...legacyBinding, runtimeProvider: inferredLegacyRuntime };
105491
+ }
105492
+ const initialRuntime = Object.keys(bindings)[0] || inferredLegacyRuntime || "reasonix";
105493
+ setModelBindings(bindings);
105494
+ setBindingRuntimeProvider(initialRuntime);
105495
+ setModelBinding(bindings[initialRuntime] || {});
105367
105496
  setPersistedUpdatedAt((runtimeConfig == null ? void 0 : runtimeConfig.updatedAt) || null);
105368
105497
  await refreshDaemonReports();
105369
105498
  } catch (loadError) {
@@ -105390,25 +105519,32 @@ const WorkspaceRuntimeConfigPanel = ({
105390
105519
  }, []);
105391
105520
  const importDiscoveredMcp = useCallback(() => {
105392
105521
  const current2 = draftState.config || emptyCapabilityConfig();
105522
+ const provider = activeCapabilityProvider;
105393
105523
  const importable = discoveredMcpServers.filter(
105394
- (server) => server.config && server.provider === selectedProvider && server.status !== "disabled" && !server.imported
105524
+ (server) => server.config && server.provider === provider && server.status !== "disabled" && !server.imported
105395
105525
  );
105396
105526
  if (!importable.length) return;
105397
- setDraft(JSON.stringify(withImportedMcpServers(current2, selectedProvider, importable), null, 2));
105527
+ setDraft(JSON.stringify(withImportedMcpServers(current2, provider, importable), null, 2));
105398
105528
  setMessage(`已导入 ${importable.length} 个 MCP 服务到提供方默认配置。`);
105399
- }, [discoveredMcpServers, draftState.config, selectedProvider]);
105529
+ }, [activeCapabilityProvider, discoveredMcpServers, draftState.config]);
105400
105530
  const updateSelectedProviderDefaults = useCallback((updates) => {
105401
- if (!selectedProvider) return;
105531
+ if (!activeCapabilityProvider) return;
105402
105532
  const current2 = draftState.config || emptyCapabilityConfig();
105403
105533
  setDraft(JSON.stringify(withProviderRuntimeDefaults(current2, {
105404
- provider: selectedProvider,
105534
+ provider: activeCapabilityProvider,
105405
105535
  ...updates
105406
105536
  }), null, 2));
105407
105537
  setMessage(null);
105408
105538
  setError(null);
105409
- }, [draftState.config, selectedProvider]);
105539
+ }, [activeCapabilityProvider, draftState.config]);
105540
+ const updateDefaultModel = useCallback((model) => {
105541
+ const nextModel = model || null;
105542
+ if (modelBinding.providerId) {
105543
+ setModelBinding((current2) => ({ ...current2, model: nextModel || void 0 }));
105544
+ }
105545
+ updateSelectedProviderDefaults({ model: nextModel });
105546
+ }, [modelBinding.providerId, updateSelectedProviderDefaults]);
105410
105547
  const save = useCallback(async () => {
105411
- var _a3;
105412
105548
  setError(null);
105413
105549
  setMessage(null);
105414
105550
  const parsed = parseDraft(draft);
@@ -105426,6 +105562,18 @@ const WorkspaceRuntimeConfigPanel = ({
105426
105562
  });
105427
105563
  try {
105428
105564
  const capabilities = parsed.config || {};
105565
+ const selectedModelProvider = modelProviders.find((provider) => provider.id === modelBinding.providerId);
105566
+ const nextModelBindings = {
105567
+ ...modelBindings,
105568
+ ...modelBinding.providerId ? {
105569
+ [bindingRuntimeProvider]: {
105570
+ providerId: modelBinding.providerId,
105571
+ runtimeProvider: bindingRuntimeProvider,
105572
+ ...modelBinding.model ? { model: modelBinding.model } : {}
105573
+ }
105574
+ } : {}
105575
+ };
105576
+ if (!modelBinding.providerId) delete nextModelBindings[bindingRuntimeProvider];
105429
105577
  const saved = await saveWorkspaceRuntimeConfig({
105430
105578
  projectId,
105431
105579
  workspaceId,
@@ -105435,13 +105583,17 @@ const WorkspaceRuntimeConfigPanel = ({
105435
105583
  ...modelBinding.providerId ? {
105436
105584
  modelBinding: {
105437
105585
  providerId: modelBinding.providerId,
105586
+ ...(selectedModelProvider == null ? void 0 : selectedModelProvider.runtimeProvider) ? { runtimeProvider: selectedModelProvider.runtimeProvider } : {},
105438
105587
  ...modelBinding.model ? { model: modelBinding.model } : {}
105439
105588
  }
105440
- } : {}
105589
+ } : {},
105590
+ ...Object.keys(nextModelBindings).length > 0 ? { modelBindings: nextModelBindings } : {}
105441
105591
  }
105442
105592
  });
105443
105593
  setPersistedUpdatedAt((saved == null ? void 0 : saved.updatedAt) || (/* @__PURE__ */ new Date()).toISOString());
105444
- setModelBinding((saved == null ? void 0 : saved.modelBinding) || modelBinding);
105594
+ const savedBindings = { ...(saved == null ? void 0 : saved.modelBindings) || nextModelBindings };
105595
+ setModelBindings(savedBindings);
105596
+ setModelBinding(savedBindings[bindingRuntimeProvider] || (saved == null ? void 0 : saved.modelBinding) || modelBinding);
105445
105597
  setDraft(JSON.stringify((saved == null ? void 0 : saved.capabilities) || capabilities, null, 2));
105446
105598
  setPublishReport((current2) => ({
105447
105599
  ...current2,
@@ -105464,15 +105616,18 @@ const WorkspaceRuntimeConfigPanel = ({
105464
105616
  }));
105465
105617
  }
105466
105618
  try {
105467
- const bindingResult = await clientRef.current.applyWorkspaceModelBinding(
105468
- ((_a3 = saved == null ? void 0 : saved.modelBinding) == null ? void 0 : _a3.providerId) ? saved.modelBinding : null
105469
- );
105470
- const bindingStep = bindingResult.status === "unsupported" ? { status: "warning", detail: bindingResult.detail || "当前终端代理不支持所选提供方。" } : { status: "success", detail: bindingResult.detail || "模型绑定已应用,新建会话会使用该模型。" };
105619
+ const bindingEntries = Object.entries(savedBindings);
105620
+ const bindingResults = await Promise.all(bindingEntries.map(async ([runtimeProvider, binding]) => ({
105621
+ runtimeProvider,
105622
+ result: await clientRef.current.applyWorkspaceModelBinding(binding)
105623
+ })));
105624
+ const unsupportedBindings = bindingResults.filter((item) => item.result.status === "unsupported");
105625
+ const bindingStep = unsupportedBindings.length > 0 ? { status: "warning", detail: unsupportedBindings.map((item) => item.result.detail).join(";") } : { status: "success", detail: bindingResults.length ? "模型绑定已按运行时分别应用,新建会话会使用对应模型。" : "当前没有需要下发的模型绑定。" };
105471
105626
  setPublishReport((current2) => {
105472
- var _a4;
105627
+ var _a3;
105473
105628
  return {
105474
105629
  ...current2,
105475
- phase: ((_a4 = current2.capabilities) == null ? void 0 : _a4.status) === "error" || bindingStep.status === "warning" ? "partial" : "published",
105630
+ phase: ((_a3 = current2.capabilities) == null ? void 0 : _a3.status) === "error" || bindingStep.status === "warning" ? "partial" : "published",
105476
105631
  binding: bindingStep
105477
105632
  };
105478
105633
  });
@@ -105510,7 +105665,7 @@ const WorkspaceRuntimeConfigPanel = ({
105510
105665
  } finally {
105511
105666
  setSaving(false);
105512
105667
  }
105513
- }, [daemonStatus, draft, modelBinding, projectId, refreshDaemonReports, workspaceId]);
105668
+ }, [bindingRuntimeProvider, daemonStatus, draft, modelBinding, modelBindings, projectId, refreshDaemonReports, workspaceId]);
105514
105669
  const loadProviderDiagnostic = useCallback(async (provider) => {
105515
105670
  const providerId = provider.provider;
105516
105671
  const expanded = !expandedProviderDiagnostics[providerId];
@@ -105605,132 +105760,6 @@ const WorkspaceRuntimeConfigPanel = ({
105605
105760
  ] })
105606
105761
  ] }) }),
105607
105762
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("space-y-4", bodyClassName), children: [
105608
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderPanel, {}),
105609
- /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "rounded-md border border-border/60 bg-background p-4", children: [
105610
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
105611
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105612
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: "工作区默认模型" }),
105613
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: "只保存 Provider 和模型引用。密钥仍由模型提供方安全保存,不会下发到运行配置。" })
105614
- ] }),
105615
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px]", children: "仅影响新会话" })
105616
- ] }),
105617
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 grid gap-3 md:grid-cols-2", children: [
105618
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
105619
- "Provider",
105620
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
105621
- "select",
105622
- {
105623
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105624
- value: modelBinding.providerId || "",
105625
- onChange: (event) => setModelBinding({ providerId: event.target.value || void 0 }),
105626
- children: [
105627
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "跟随客户端当前选择" }),
105628
- modelProviders.map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: provider.id, children: provider.name }, provider.id))
105629
- ]
105630
- }
105631
- )
105632
- ] }),
105633
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
105634
- "模型",
105635
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
105636
- "select",
105637
- {
105638
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105639
- value: modelBinding.model || "",
105640
- disabled: !modelBinding.providerId,
105641
- onChange: (event) => setModelBinding((current2) => ({ ...current2, model: event.target.value || void 0 })),
105642
- children: [
105643
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "跟随 Provider 默认模型" }),
105644
- (((_b = modelProviders.find((provider) => provider.id === modelBinding.providerId)) == null ? void 0 : _b.models) || []).filter((model) => model.enabled).map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: model.id, children: model.label || model.id }, model.id))
105645
- ]
105646
- }
105647
- )
105648
- ] })
105649
- ] }),
105650
- modelBinding.providerId && !modelProviders.some((provider) => provider.id === modelBinding.providerId) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-[11px] text-amber-700 dark:text-amber-300", children: "当前引用的 Provider 已不可见,保存前请重新选择。" }) : null
105651
- ] }),
105652
- /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "rounded-md border border-border/60 bg-background p-4", children: [
105653
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
105654
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2.5", children: [
105655
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-md border bg-muted/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Laptop, { className: "h-4 w-4 text-primary" }) }),
105656
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105657
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: "终端代理能力" }),
105658
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: "这里显示当前连接的客户端实际能运行什么。内置适配器不等于本机命令可用,模型列表和诊断结果来自当前终端代理。" })
105659
- ] })
105660
- ] }),
105661
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: "outline", className: "text-[10px]", children: [
105662
- providerSnapshots.filter((provider) => provider.status === "ready").length,
105663
- "/",
105664
- providerSnapshots.length,
105665
- " 可用"
105666
- ] })
105667
- ] }),
105668
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-2", children: [
105669
- providerSnapshots.map((provider) => {
105670
- var _a3, _b2;
105671
- const isExpanded = expandedProviderDiagnostics[provider.provider];
105672
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("rounded-md border p-3", toneClasses(providerRuntimeTone(provider.status))), children: [
105673
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
105674
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [
105675
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
105676
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-foreground", children: provider.label || providerLabel(provider.provider) }),
105677
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px]", children: providerSourceLabel(provider.source) }),
105678
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px]", children: providerRuntimeStatusLabel(provider.status) })
105679
- ] }),
105680
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: provider.description || "未提供适配器说明。" })
105681
- ] }),
105682
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
105683
- Button,
105684
- {
105685
- type: "button",
105686
- variant: "ghost",
105687
- size: "sm",
105688
- className: "h-8 gap-1.5 px-2 text-xs",
105689
- onClick: () => void loadProviderDiagnostic(provider),
105690
- disabled: diagnosticLoading === provider.provider || daemonStatus !== "connected",
105691
- children: [
105692
- diagnosticLoading === provider.provider ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "h-3.5 w-3.5" }),
105693
- isExpanded ? "收起诊断" : "查看诊断"
105694
- ]
105695
- }
105696
- )
105697
- ] }),
105698
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 grid gap-2 text-[11px] sm:grid-cols-3", children: [
105699
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded border border-border/50 bg-background/60 px-2.5 py-2", children: [
105700
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground", children: "模型" }),
105701
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-0.5 font-medium text-foreground", children: [
105702
- ((_a3 = provider.models) == null ? void 0 : _a3.length) || 0,
105703
- " 个"
105704
- ] })
105705
- ] }),
105706
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded border border-border/50 bg-background/60 px-2.5 py-2", children: [
105707
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground", children: "运行模式" }),
105708
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-0.5 font-medium text-foreground", children: [
105709
- ((_b2 = provider.modes) == null ? void 0 : _b2.length) || 0,
105710
- " 个"
105711
- ] })
105712
- ] }),
105713
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded border border-border/50 bg-background/60 px-2.5 py-2", children: [
105714
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground", children: "最近检查" }),
105715
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-0.5 flex items-center gap-1 font-medium text-foreground", children: [
105716
- /* @__PURE__ */ jsxRuntimeExports.jsx(Clock3, { className: "h-3 w-3" }),
105717
- formatRelativeTime$2(provider.fetchedAt)
105718
- ] })
105719
- ] })
105720
- ] }),
105721
- provider.error ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex items-start gap-1.5 text-[11px] text-red-700 dark:text-red-300", children: [
105722
- /* @__PURE__ */ jsxRuntimeExports.jsx(CircleAlert, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
105723
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: provider.error })
105724
- ] }) : null,
105725
- isExpanded ? /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "mt-3 max-h-52 overflow-auto whitespace-pre-wrap rounded border border-border/60 bg-black/20 p-2.5 font-mono text-[10px] leading-4 text-muted-foreground", children: providerDiagnostics[provider.provider] || "正在读取诊断信息。" }) : null
105726
- ] }, provider.provider);
105727
- }),
105728
- providerSnapshots.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 rounded-md border border-dashed border-border/70 px-3 py-3 text-xs text-muted-foreground", children: [
105729
- /* @__PURE__ */ jsxRuntimeExports.jsx(PackageCheck, { className: "mt-0.5 h-4 w-4 shrink-0" }),
105730
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "尚未收到终端代理的 Provider 状态。请确认客户端已连接,然后点击“刷新状态”。" })
105731
- ] }) : null
105732
- ] })
105733
- ] }),
105734
105763
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2 md:grid-cols-5", children: [
105735
105764
  /* @__PURE__ */ jsxRuntimeExports.jsx(MetricCard, { label: "快捷动作", value: String(summary.actions), detail: "显示在输入区附近的快捷动作。", tone: summary.actions ? "ready" : "neutral" }),
105736
105765
  /* @__PURE__ */ jsxRuntimeExports.jsx(MetricCard, { label: "快捷命令", value: String(summary.slash), detail: "可在输入框中通过 / 调用的命令。", tone: summary.slash ? "ready" : "neutral" }),
@@ -105745,8 +105774,8 @@ const WorkspaceRuntimeConfigPanel = ({
105745
105774
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [
105746
105775
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-muted/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bot, { className: "h-4 w-4 text-primary" }) }),
105747
105776
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [
105748
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold text-foreground", children: "运行提供方" }),
105749
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: "设置新建智能代理会话默认使用的运行提供方、模型和运行模式。" })
105777
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold text-foreground", children: "运行时配置" }),
105778
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: "选择新建会话使用的运行时,并设置默认模型与默认思考方式。对话开始后仍可单独调整。" })
105750
105779
  ] })
105751
105780
  ] }),
105752
105781
  /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "shrink-0 text-[10px]", children: "仅影响新会话" })
@@ -105764,7 +105793,12 @@ const WorkspaceRuntimeConfigPanel = ({
105764
105793
  "min-h-9 rounded-md border px-3 text-xs font-medium transition-colors",
105765
105794
  isSelected ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
105766
105795
  ),
105767
- onClick: () => setSelectedProvider(provider),
105796
+ onClick: () => {
105797
+ providerSelectionTouchedRef.current = true;
105798
+ setSelectedProvider(provider);
105799
+ setBindingRuntimeProvider(provider);
105800
+ setModelBinding(modelBindings[provider] || {});
105801
+ },
105768
105802
  children: [
105769
105803
  providerLabel(provider),
105770
105804
  (snapshot == null ? void 0 : snapshot.status) === "ready" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1.5 text-emerald-600", children: "●" }) : null
@@ -105776,67 +105810,172 @@ const WorkspaceRuntimeConfigPanel = ({
105776
105810
  /* @__PURE__ */ jsxRuntimeExports.jsx(Terminal$1, { className: "mt-0.5 h-4 w-4 shrink-0" }),
105777
105811
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "暂未发现可用的运行提供方。请先启动桌面客户端或容器中的终端代理。" })
105778
105812
  ] }),
105779
- selectedProvider ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3 md:grid-cols-2", children: [
105780
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground", children: [
105781
- "模型",
105782
- ((_c = selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) == null ? void 0 : _c.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
105783
- "select",
105784
- {
105785
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105786
- value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model) || "",
105787
- onChange: (event) => updateSelectedProviderDefaults({ model: event.target.value || null }),
105788
- children: [
105789
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用提供方默认模型" }),
105790
- selectedProviderSnapshot.models.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: model.id, children: formatModelDisplayLabel(model.id, model.label) }, model.id))
105791
- ]
105792
- }
105793
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
105794
- "input",
105795
- {
105796
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105797
- value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model) || "",
105798
- title: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model) || "模型 ID",
105799
- list: modelDatalistId,
105800
- placeholder: "输入模型 ID",
105801
- onChange: (event) => updateSelectedProviderDefaults({ model: event.target.value || null })
105802
- }
105803
- ),
105804
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-1 block text-[11px] font-normal leading-4 text-muted-foreground", children: ((_d = selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) == null ? void 0 : _d.length) ? "只能选择当前运行环境实际支持的模型。" : "当前运行环境未返回模型列表,可手动填写模型 ID。" }),
105805
- /* @__PURE__ */ jsxRuntimeExports.jsx("datalist", { id: modelDatalistId, children: ((selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) || []).map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: model.id, children: model.label || model.id }, model.id)) })
105806
- ] }),
105807
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground", children: [
105808
- "运行模式",
105809
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
105810
- "select",
105811
- {
105812
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105813
- value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.modeId) || "",
105814
- onChange: (event) => updateSelectedProviderDefaults({ modeId: event.target.value || null }),
105815
- children: [
105816
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用提供方默认模式" }),
105817
- ((selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.modes) || []).map((mode) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: mode.id, children: mode.label || mode.id }, mode.id)),
105818
- (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.modeId) && !((_e2 = selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.modes) == null ? void 0 : _e2.some((mode) => mode.id === selectedProviderDefaults.modeId)) ? /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: selectedProviderDefaults.modeId, children: selectedProviderDefaults.modeId }) : null
105819
- ]
105820
- }
105821
- )
105813
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 border-t border-border/50 pt-4", children: [
105814
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
105815
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105816
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "text-xs font-semibold text-foreground", children: "模型来源" }),
105817
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: "可选一个租户模型连接;不选择时使用运行时自身的默认配置。" })
105818
+ ] }),
105819
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px]", children: "仅影响新会话" })
105822
105820
  ] }),
105823
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground md:col-span-2", children: [
105824
- "思考选项",
105825
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
105826
- "select",
105827
- {
105828
- className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105829
- value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.thinkingOptionId) || "",
105830
- onChange: (event) => updateSelectedProviderDefaults({ thinkingOptionId: event.target.value || null }),
105831
- children: [
105832
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用提供方默认思考设置" }),
105833
- (((_f = ((selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) || []).find((model) => model.id === (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model))) == null ? void 0 : _f.thinkingOptions) || []).map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: option.id, children: option.label || option.id }, option.id)),
105834
- (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.thinkingOptionId) ? /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: selectedProviderDefaults.thinkingOptionId, children: selectedProviderDefaults.thinkingOptionId }) : null
105835
- ]
105836
- }
105837
- )
105821
+ supportsModelBinding ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
105822
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 grid gap-3 md:grid-cols-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium", children: [
105823
+ "租户模型连接",
105824
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
105825
+ "select",
105826
+ {
105827
+ className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105828
+ value: modelBinding.providerId || "",
105829
+ onChange: (event) => {
105830
+ var _a3;
105831
+ const providerId = event.target.value || void 0;
105832
+ const provider = modelProviders.find((item) => item.id === providerId);
105833
+ const firstModel = (_a3 = provider == null ? void 0 : provider.models.find((model) => model.enabled)) == null ? void 0 : _a3.id;
105834
+ setModelBinding({ providerId, ...firstModel ? { model: firstModel } : {} });
105835
+ updateSelectedProviderDefaults({ model: firstModel || null });
105836
+ },
105837
+ children: [
105838
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用运行时默认配置" }),
105839
+ modelProviders.filter((provider) => provider.runtimeProvider === bindingRuntimeProvider).map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: provider.id, children: provider.name }, provider.id))
105840
+ ]
105841
+ }
105842
+ )
105843
+ ] }) }),
105844
+ modelBinding.providerId && !modelProviders.some((provider) => provider.id === modelBinding.providerId && provider.runtimeProvider === bindingRuntimeProvider) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-[11px] text-amber-700 dark:text-amber-300", children: "当前引用的模型连接已不可见,保存前请重新选择。" }) : null
105845
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 flex items-start gap-2 rounded-md border border-dashed border-border/70 bg-muted/10 px-3 py-2.5 text-[11px] leading-5 text-muted-foreground", children: [
105846
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Terminal$1, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
105847
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "本地 CLI 使用本机默认配置,暂不支持租户级模型绑定。" })
105838
105848
  ] })
105839
- ] }) : null,
105849
+ ] }),
105850
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 border-t border-border/50 pt-4", children: [
105851
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
105852
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
105853
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Laptop, { className: "h-4 w-4 text-muted-foreground" }),
105854
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105855
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "text-xs font-semibold text-foreground", children: "终端代理能力" }),
105856
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "当前客户端实际可用的内置适配器、模型和运行模式。" })
105857
+ ] })
105858
+ ] }),
105859
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: "outline", className: "text-[10px]", children: [
105860
+ providerSnapshots.filter((provider) => provider.status === "ready").length,
105861
+ "/",
105862
+ providerSnapshots.length,
105863
+ " 可用"
105864
+ ] })
105865
+ ] }),
105866
+ selectedProviderSnapshot ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("mt-3 rounded-md border p-3", toneClasses(providerRuntimeTone(selectedProviderSnapshot.status))), children: [
105867
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
105868
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
105869
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-xs font-medium", children: selectedProviderSnapshot.label || providerLabel(selectedProviderSnapshot.provider) }),
105870
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px]", children: providerRuntimeStatusLabel(selectedProviderSnapshot.status) })
105871
+ ] }),
105872
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
105873
+ Button,
105874
+ {
105875
+ type: "button",
105876
+ variant: "ghost",
105877
+ size: "sm",
105878
+ className: "h-7 gap-1 px-2 text-[11px]",
105879
+ onClick: () => void loadProviderDiagnostic(selectedProviderSnapshot),
105880
+ disabled: diagnosticLoading === selectedProviderSnapshot.provider || daemonStatus !== "connected",
105881
+ children: [
105882
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "h-3.5 w-3.5" }),
105883
+ "查看诊断"
105884
+ ]
105885
+ }
105886
+ )
105887
+ ] }),
105888
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 grid gap-2 text-[11px] sm:grid-cols-3", children: [
105889
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105890
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "模型 " }),
105891
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium", children: [
105892
+ ((_b = selectedProviderSnapshot.models) == null ? void 0 : _b.length) || 0,
105893
+ " 个"
105894
+ ] })
105895
+ ] }),
105896
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105897
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "运行模式 " }),
105898
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium", children: [
105899
+ ((_c = selectedProviderSnapshot.modes) == null ? void 0 : _c.length) || 0,
105900
+ " 个"
105901
+ ] })
105902
+ ] }),
105903
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
105904
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "最近检查 " }),
105905
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: formatRelativeTime$2(selectedProviderSnapshot.fetchedAt) })
105906
+ ] })
105907
+ ] }),
105908
+ selectedProviderSnapshot.error ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-[11px] text-red-700 dark:text-red-300", children: selectedProviderSnapshot.error }) : null,
105909
+ expandedProviderDiagnostics[selectedProviderSnapshot.provider] ? /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "mt-3 max-h-40 overflow-auto whitespace-pre-wrap rounded border border-border/60 bg-black/20 p-2 font-mono text-[10px] leading-4 text-muted-foreground", children: providerDiagnostics[selectedProviderSnapshot.provider] || "正在读取诊断信息。" }) : null
105910
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3 rounded-md border border-dashed border-border/70 px-3 py-3 text-[11px] text-muted-foreground", children: "尚未收到终端代理状态,请确认客户端已连接。" })
105911
+ ] }),
105912
+ activeCapabilityProvider ? (() => {
105913
+ var _a3, _b2, _c2;
105914
+ const selectedTenantProvider = modelProviders.find((provider) => provider.id === modelBinding.providerId && provider.runtimeProvider === bindingRuntimeProvider);
105915
+ const defaultModelOptions = ((_a3 = selectedTenantProvider == null ? void 0 : selectedTenantProvider.models) == null ? void 0 : _a3.filter((model) => model.enabled)) || (selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) || [];
105916
+ const defaultModel = modelBinding.providerId ? modelBinding.model || "" : (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model) || "";
105917
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3 md:grid-cols-2", children: [
105918
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground", children: [
105919
+ "默认模型",
105920
+ defaultModelOptions.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
105921
+ "select",
105922
+ {
105923
+ className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105924
+ value: defaultModel,
105925
+ onChange: (event) => updateDefaultModel(event.target.value),
105926
+ children: [
105927
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用运行时默认模型" }),
105928
+ defaultModelOptions.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: model.id, children: formatModelDisplayLabel(model.id, model.label) }, model.id))
105929
+ ]
105930
+ }
105931
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
105932
+ "input",
105933
+ {
105934
+ className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105935
+ value: defaultModel,
105936
+ title: defaultModel || "模型 ID",
105937
+ list: modelDatalistId,
105938
+ placeholder: "输入模型 ID",
105939
+ onChange: (event) => updateDefaultModel(event.target.value)
105940
+ }
105941
+ ),
105942
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-1 block text-[11px] font-normal leading-4 text-muted-foreground", children: defaultModelOptions.length ? selectedTenantProvider ? "使用该模型连接中的模型作为新会话默认值。" : "使用当前运行时支持的模型作为新会话默认值。" : "当前没有可选模型,可手动填写模型 ID。" }),
105943
+ /* @__PURE__ */ jsxRuntimeExports.jsx("datalist", { id: modelDatalistId, children: defaultModelOptions.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: model.id, children: model.label || model.id }, model.id)) })
105944
+ ] }),
105945
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground", children: [
105946
+ "默认运行模式",
105947
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
105948
+ "select",
105949
+ {
105950
+ className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105951
+ value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.modeId) || "",
105952
+ onChange: (event) => updateSelectedProviderDefaults({ modeId: event.target.value || null }),
105953
+ children: [
105954
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用提供方默认模式" }),
105955
+ ((selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.modes) || []).map((mode) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: mode.id, children: mode.label || mode.id }, mode.id)),
105956
+ (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.modeId) && !((_b2 = selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.modes) == null ? void 0 : _b2.some((mode) => mode.id === selectedProviderDefaults.modeId)) ? /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: selectedProviderDefaults.modeId, children: selectedProviderDefaults.modeId }) : null
105957
+ ]
105958
+ }
105959
+ )
105960
+ ] }),
105961
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-xs font-medium text-foreground md:col-span-2", children: [
105962
+ "默认思考",
105963
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
105964
+ "select",
105965
+ {
105966
+ className: "mt-1.5 h-10 w-full rounded-md border bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
105967
+ value: (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.thinkingOptionId) || "",
105968
+ onChange: (event) => updateSelectedProviderDefaults({ thinkingOptionId: event.target.value || null }),
105969
+ children: [
105970
+ /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "使用提供方默认思考设置" }),
105971
+ (((_c2 = ((selectedProviderSnapshot == null ? void 0 : selectedProviderSnapshot.models) || []).find((model) => model.id === (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.model))) == null ? void 0 : _c2.thinkingOptions) || []).map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: option.id, children: option.label || option.id }, option.id)),
105972
+ (selectedProviderDefaults == null ? void 0 : selectedProviderDefaults.thinkingOptionId) ? /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: selectedProviderDefaults.thinkingOptionId, children: selectedProviderDefaults.thinkingOptionId }) : null
105973
+ ]
105974
+ }
105975
+ )
105976
+ ] })
105977
+ ] });
105978
+ })() : null,
105840
105979
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 flex items-start gap-2 border-t border-border/50 pt-3 text-[11px] leading-5 text-muted-foreground", children: [
105841
105980
  /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheck, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600" }),
105842
105981
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "保存后会写入当前工作区。已连接的智能代理会同步配置,但正在运行的会话不会自动切换模型。" })
@@ -113753,7 +113892,7 @@ function sessionIdentity(item) {
113753
113892
  ].filter(Boolean).join(":");
113754
113893
  }
113755
113894
  function resolveProviderDraftDefaults(input) {
113756
- var _a2, _b, _c, _d, _e2;
113895
+ var _a2, _b, _c, _d, _e2, _f;
113757
113896
  const provider = input.provider || null;
113758
113897
  if (!provider) return { provider: null, modeId: null, model: null, thinkingOptionId: null };
113759
113898
  const providerSnapshot = input.providers.find((item) => item.provider === provider);
@@ -113762,10 +113901,11 @@ function resolveProviderDraftDefaults(input) {
113762
113901
  const preferredMode = (prefs == null ? void 0 : prefs.mode) && modeIds.includes(prefs.mode) ? prefs.mode : (providerSnapshot == null ? void 0 : providerSnapshot.defaultModeId) || modeIds[0] || null;
113763
113902
  const models = (providerSnapshot == null ? void 0 : providerSnapshot.models) ?? [];
113764
113903
  const modelIds = new Set(models.map((model) => model.id));
113904
+ const workspaceModel = ((_c = input.workspaceBinding) == null ? void 0 : _c.runtimeProvider) === provider && input.workspaceBinding.model ? input.workspaceBinding.model : null;
113765
113905
  const allowExternalDefault = PROVIDERS_WITH_EXTERNAL_DEFAULT_MODEL.has(provider);
113766
- const preferredModel = (prefs == null ? void 0 : prefs.model) && modelIds.has(prefs.model) ? prefs.model : allowExternalDefault ? null : ((_c = models.find((model) => model.isDefault)) == null ? void 0 : _c.id) || ((_d = models[0]) == null ? void 0 : _d.id) || null;
113906
+ const preferredModel = workspaceModel && modelIds.has(workspaceModel) ? workspaceModel : (prefs == null ? void 0 : prefs.model) && modelIds.has(prefs.model) ? prefs.model : allowExternalDefault ? null : ((_d = models.find((model) => model.isDefault)) == null ? void 0 : _d.id) || ((_e2 = models[0]) == null ? void 0 : _e2.id) || null;
113767
113907
  const selectedModel = preferredModel ? models.find((model) => model.id === preferredModel) : null;
113768
- const preferredThinking = preferredModel ? (_e2 = prefs == null ? void 0 : prefs.thinkingByModel) == null ? void 0 : _e2[preferredModel] : null;
113908
+ const preferredThinking = preferredModel ? (_f = prefs == null ? void 0 : prefs.thinkingByModel) == null ? void 0 : _f[preferredModel] : null;
113769
113909
  const thinkingOptions = (selectedModel == null ? void 0 : selectedModel.thinkingOptions) ?? [];
113770
113910
  const thinkingOptionId = preferredThinking && thinkingOptions.some((option) => option.id === preferredThinking) ? preferredThinking : (selectedModel == null ? void 0 : selectedModel.defaultThinkingOptionId) || null;
113771
113911
  return {
@@ -114112,6 +114252,7 @@ const WorkspaceAgentPage = ({
114112
114252
  const token = getRuntimeAccessToken() || "";
114113
114253
  const displayName = safeWorkspaceName(workspace);
114114
114254
  const workspaceCwd = useMemo(() => resolveWorkspaceCwd(workspace), [workspace]);
114255
+ const [workspaceRuntimeBindings, setWorkspaceRuntimeBindings] = useState({});
114115
114256
  const preferredProvider = preferences.provider || null;
114116
114257
  const preferenceDraftDefaults = useMemo(() => {
114117
114258
  var _a3, _b2;
@@ -114134,6 +114275,7 @@ const WorkspaceAgentPage = ({
114134
114275
  defaultProvider: preferredProvider || void 0,
114135
114276
  draftDefaults: preferenceDraftDefaults
114136
114277
  });
114278
+ const workspaceRuntimeBinding = workspaceRuntimeBindings[controller.selectedProvider || preferredProvider || ""] || null;
114137
114279
  const applyCapabilitiesRef = useRef(controller.applyCapabilities);
114138
114280
  useEffect(() => {
114139
114281
  applyCapabilitiesRef.current = controller.applyCapabilities;
@@ -114178,8 +114320,16 @@ const WorkspaceAgentPage = ({
114178
114320
  projectId: workspace.projectId,
114179
114321
  workspaceId: workspace.workspaceId
114180
114322
  }).then((runtimeConfig) => {
114181
- if (disposed || !(runtimeConfig == null ? void 0 : runtimeConfig.capabilities)) return;
114182
- void applyCapabilitiesRef.current(runtimeConfig.capabilities);
114323
+ var _a3;
114324
+ if (disposed) return;
114325
+ const bindings = { ...(runtimeConfig == null ? void 0 : runtimeConfig.modelBindings) || {} };
114326
+ if (((_a3 = runtimeConfig == null ? void 0 : runtimeConfig.modelBinding) == null ? void 0 : _a3.runtimeProvider) && !bindings[runtimeConfig.modelBinding.runtimeProvider]) {
114327
+ bindings[runtimeConfig.modelBinding.runtimeProvider] = runtimeConfig.modelBinding;
114328
+ }
114329
+ setWorkspaceRuntimeBindings(bindings);
114330
+ if (runtimeConfig == null ? void 0 : runtimeConfig.capabilities) {
114331
+ void applyCapabilitiesRef.current(runtimeConfig.capabilities);
114332
+ }
114183
114333
  }).catch(() => void 0);
114184
114334
  return () => {
114185
114335
  disposed = true;
@@ -114188,8 +114338,9 @@ const WorkspaceAgentPage = ({
114188
114338
  const resolvedDraftDefaults = useMemo(() => resolveProviderDraftDefaults({
114189
114339
  provider: controller.selectedProvider || preferredProvider,
114190
114340
  providers: controller.state.providers,
114191
- preferences
114192
- }), [controller.selectedProvider, controller.state.providers, preferences, preferredProvider]);
114341
+ preferences,
114342
+ workspaceBinding: workspaceRuntimeBinding
114343
+ }), [controller.selectedProvider, controller.state.providers, preferences, preferredProvider, workspaceRuntimeBinding]);
114193
114344
  const sessions = useMemo(
114194
114345
  () => Object.values(controller.state.agents).sort((a, b2) => a.agentId.localeCompare(b2.agentId)),
114195
114346
  [controller.state.agents]
@@ -114452,11 +114603,11 @@ const WorkspaceAgentPage = ({
114452
114603
  size: "sm",
114453
114604
  className: "h-7 w-7 gap-1.5 p-0 text-xs sm:h-7 sm:w-auto sm:px-2",
114454
114605
  onClick: openCapabilityDialog,
114455
- title: "Runtime Config",
114456
- "aria-label": "Runtime Config",
114606
+ title: "运行时配置",
114607
+ "aria-label": "运行时配置",
114457
114608
  children: [
114458
114609
  /* @__PURE__ */ jsxRuntimeExports.jsx(Settings2, { className: "h-3.5 w-3.5" }),
114459
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:inline", children: "Runtime Config" })
114610
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:inline", children: "运行时配置" })
114460
114611
  ]
114461
114612
  }
114462
114613
  ),
@@ -118708,7 +118859,7 @@ function SubjectListItem({
118708
118859
  selected2 ? "bg-primary/[0.08] shadow-[inset_3px_0_0_hsl(var(--primary))]" : "hover:bg-muted/60"
118709
118860
  ),
118710
118861
  children: [
118711
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar, { className: "h-10 w-10 shrink-0", children: [
118862
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar$1, { className: "h-10 w-10 shrink-0", children: [
118712
118863
  /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarImage, { src: row.subject.avatarUrl }),
118713
118864
  /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: meta.avatar, children: getInitials(row.subject.displayName || row.subject.subjectId) })
118714
118865
  ] }),
@@ -121114,7 +121265,7 @@ function SubjectDetail({
121114
121265
  ] }) : null,
121115
121266
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-border/70 px-5 py-5", children: [
121116
121267
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-4", children: [
121117
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar, { className: "h-16 w-16 shrink-0", children: [
121268
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Avatar$1, { className: "h-16 w-16 shrink-0", children: [
121118
121269
  /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarImage, { src: row.subject.avatarUrl }),
121119
121270
  /* @__PURE__ */ jsxRuntimeExports.jsx(AvatarFallback, { className: cn("text-base", meta.avatar), children: getInitials(row.subject.displayName || row.subject.subjectId) })
121120
121271
  ] }),
@@ -125101,6 +125252,20 @@ class LegacyFileEventsClient {
125101
125252
  }
125102
125253
  }
125103
125254
  const INITIAL_EXTENSIONS = [
125255
+ {
125256
+ id: ExtensionType.WORKBENCH_HOME,
125257
+ name: "首页",
125258
+ description: "团队、工作台、最新消息与 AppThen 服务入口",
125259
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(House, { className: "w-6 h-6" }),
125260
+ installed: true,
125261
+ layout: {
125262
+ showInActivityBar: true,
125263
+ editorMode: "standard",
125264
+ defaultPosition: "left",
125265
+ shortLabel: "首页"
125266
+ },
125267
+ commands: []
125268
+ },
125104
125269
  {
125105
125270
  id: ExtensionType.CODE,
125106
125271
  name: "DevTools",
@@ -125414,7 +125579,8 @@ const WORKBENCH_EXTENSION_ALIASES = {
125414
125579
  "graph-modeling-studio": [ExtensionType.GRAPH_MODELING_STUDIO]
125415
125580
  };
125416
125581
  const ALWAYS_AVAILABLE_EXTENSION_IDS = /* @__PURE__ */ new Set([
125417
- ExtensionType.ASSISTANT
125582
+ ExtensionType.ASSISTANT,
125583
+ ExtensionType.WORKBENCH_HOME
125418
125584
  ]);
125419
125585
  const DEFAULT_ACTIVE_EXTENSION_BY_WORKBENCH = {
125420
125586
  "default-business": ExtensionType.CONVERSATION_HUB,
@@ -125802,7 +125968,7 @@ const initialState = {
125802
125968
  layoutTree: { type: "leaf", id: "leaf-0", groupId: 0 },
125803
125969
  extensions: [],
125804
125970
  runtimeExtensionIds: [],
125805
- activeLeftExtensionId: ExtensionType.CODE,
125971
+ activeLeftExtensionId: ExtensionType.WORKBENCH_HOME,
125806
125972
  leftSidebarVisible: true,
125807
125973
  leftSidebarWidth: 320,
125808
125974
  panelVisible: false,
@@ -126784,7 +126950,7 @@ function WorkbenchProvider({
126784
126950
  applyResolvedConfig(resolvedConfig);
126785
126951
  } catch (e) {
126786
126952
  console.error("[Workbench] Failed to load config:", e);
126787
- if (isWorkbenchAccessError(e)) {
126953
+ if (isWorkbenchAccessError(e) && workbenchId !== "vibecoding") {
126788
126954
  redirectToTeamEntry(tenantId, "workbench_denied");
126789
126955
  return;
126790
126956
  }
@@ -127663,6 +127829,245 @@ const EditorToolbar = ({
127663
127829
  onRefreshPreview && isPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { label: "Refresh Preview", onClick: onRefreshPreview, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw$1, { className: "h-3.5 w-3.5" }) }) : null
127664
127830
  ] }) });
127665
127831
  };
127832
+ const CONVERSATIONS = [
127833
+ {
127834
+ id: "delivery",
127835
+ title: "交付协作群",
127836
+ preview: "周宁:报告模板已经更新,请大家确认一下",
127837
+ time: "3 分钟前",
127838
+ unread: 4,
127839
+ tone: "bg-cyan-600",
127840
+ initial: "交"
127841
+ },
127842
+ {
127843
+ id: "research",
127844
+ title: "科研检测服务",
127845
+ preview: "林一:样本清单已放到项目资料库",
127846
+ time: "28 分钟前",
127847
+ unread: 2,
127848
+ tone: "bg-emerald-600",
127849
+ initial: "研"
127850
+ },
127851
+ {
127852
+ id: "customer",
127853
+ title: "客户管理助手",
127854
+ preview: "明天上午提醒我跟进明德科技",
127855
+ time: "昨天",
127856
+ tone: "bg-amber-700",
127857
+ initial: "客"
127858
+ },
127859
+ {
127860
+ id: "product",
127861
+ title: "产品讨论组",
127862
+ preview: "赵然:启动页的第一版交互可以看了",
127863
+ time: "周一",
127864
+ tone: "bg-violet-600",
127865
+ initial: "产"
127866
+ }
127867
+ ];
127868
+ const SERVICES = [
127869
+ { id: "weekly-report", title: "项目周报助手", description: "把零散进展整理成清晰的周报。", icon: FileText, tone: "bg-sky-500/15 text-sky-600" },
127870
+ { id: "file-qa", title: "文件问答", description: "基于项目资料,快速找到结论和依据。", icon: FolderOpen, tone: "bg-emerald-500/15 text-emerald-600" },
127871
+ { id: "flow", title: "流程设计师", description: "把想法拆成可以执行的协作流程。", icon: FlaskConical, tone: "bg-amber-500/15 text-amber-600" },
127872
+ { id: "analysis", title: "数据分析", description: "上传表格,得到可解释的趋势和图表。", icon: Sparkles, tone: "bg-violet-500/15 text-violet-600" }
127873
+ ];
127874
+ function Avatar({ initial, tone, small = false }) {
127875
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `relative inline-flex shrink-0 items-center justify-center rounded-lg font-semibold text-white ${small ? "h-7 w-7 text-[10px]" : "h-9 w-9 text-xs"} ${tone}`, children: [
127876
+ initial,
127877
+ !small && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute -bottom-1 -right-1 h-2.5 w-2.5 rounded-full border-2 border-vscode-sidebar bg-emerald-400" })
127878
+ ] });
127879
+ }
127880
+ function WorkbenchHomeSidebar({ workbenchConfig, onOpenConversation }) {
127881
+ const [teamOpen, setTeamOpen] = useState(false);
127882
+ const [activeTeam, setActiveTeam] = useState("科研检测服务团队");
127883
+ const isBuiltInWorkbench = (workbenchConfig == null ? void 0 : workbenchConfig.workbenchId) === "vibecoding";
127884
+ const workbenchName = isBuiltInWorkbench ? "工作台" : (workbenchConfig == null ? void 0 : workbenchConfig.name) || "默认工作台";
127885
+ const workbenchDescription = isBuiltInWorkbench ? "AppThen 内置工作台" : (workbenchConfig == null ? void 0 : workbenchConfig.description) || "AppThen 默认工作台";
127886
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-vscode-sidebar text-vscode-text", children: [
127887
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-vscode-border/70 px-4 pb-3 pt-4", children: [
127888
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3 flex items-center justify-between gap-2", children: [
127889
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.14em] text-vscode-textDark", children: "团队" }),
127890
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "rounded p-1 text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", "aria-label": "创建团队", title: "创建团队", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "h-3.5 w-3.5" }) })
127891
+ ] }),
127892
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
127893
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
127894
+ "button",
127895
+ {
127896
+ type: "button",
127897
+ className: "flex min-h-12 w-full items-center gap-2.5 rounded-lg border border-vscode-border/80 bg-vscode-bg/40 px-2.5 py-2 text-left transition-colors hover:border-vscode-accent/70 hover:bg-vscode-itemHover",
127898
+ "aria-expanded": teamOpen,
127899
+ onClick: () => setTeamOpen((open) => !open),
127900
+ children: [
127901
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { initial: activeTeam === "M1 测试租户" ? "M1" : "科", tone: activeTeam === "M1 测试租户" ? "bg-amber-700" : "bg-cyan-700", small: true }),
127902
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
127903
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block truncate text-xs font-semibold", children: activeTeam }),
127904
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[10px] text-vscode-textDark", children: "当前团队" })
127905
+ ] }),
127906
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: `h-3.5 w-3.5 shrink-0 text-vscode-textDark transition-transform ${teamOpen ? "rotate-180" : ""}` })
127907
+ ]
127908
+ }
127909
+ ),
127910
+ teamOpen && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-x-0 top-full z-50 mt-1 rounded-lg border border-vscode-border bg-vscode-sidebar p-1.5 shadow-2xl", children: ["科研检测服务团队", "M1 测试租户"].map((team) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
127911
+ "button",
127912
+ {
127913
+ type: "button",
127914
+ className: `flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-xs transition-colors ${activeTeam === team ? "bg-vscode-itemActive text-vscode-text" : "text-vscode-textDark hover:bg-vscode-itemHover hover:text-vscode-text"}`,
127915
+ onClick: () => {
127916
+ setActiveTeam(team);
127917
+ setTeamOpen(false);
127918
+ },
127919
+ children: [
127920
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { initial: team === "M1 测试租户" ? "M1" : "科", tone: team === "M1 测试租户" ? "bg-amber-700" : "bg-cyan-700", small: true }),
127921
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 truncate", children: team }),
127922
+ activeTeam === team && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[10px] text-vscode-textDark", children: "当前" })
127923
+ ]
127924
+ },
127925
+ team
127926
+ )) })
127927
+ ] })
127928
+ ] }),
127929
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-vscode-border/70 px-4 py-3", children: [
127930
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
127931
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.14em] text-vscode-textDark", children: "工作台" }),
127932
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "rounded p-1 text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", "aria-label": "工作台更多操作", title: "更多操作", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ellipsis, { className: "h-3.5 w-3.5" }) })
127933
+ ] }),
127934
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "group flex w-full items-center gap-2 rounded-lg bg-vscode-itemActive px-2.5 py-2 text-left text-vscode-text", children: [
127935
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-vscode-accent text-white", children: /* @__PURE__ */ jsxRuntimeExports.jsx(House, { className: "h-3.5 w-3.5" }) }),
127936
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
127937
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block truncate text-xs font-semibold", children: workbenchName }),
127938
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[10px] text-vscode-textDark", children: workbenchDescription })
127939
+ ] })
127940
+ ] }),
127941
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "mt-1 flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", children: [
127942
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-vscode-itemHover", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FlaskConical, { className: "h-3.5 w-3.5" }) }),
127943
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-xs", children: "科研检测服务台" })
127944
+ ] })
127945
+ ] }),
127946
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-2.5 py-3", children: [
127947
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between px-1.5 pb-2", children: [
127948
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.14em] text-vscode-textDark", children: "最新消息" }),
127949
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "text-[11px] text-vscode-textDark transition-colors hover:text-vscode-accent", onClick: () => onOpenConversation == null ? void 0 : onOpenConversation("all", "最新消息"), children: "更多" })
127950
+ ] }),
127951
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-0.5", children: CONVERSATIONS.map((conversation) => /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "group flex w-full items-center gap-2 rounded-lg px-1.5 py-2 text-left transition-colors hover:bg-vscode-itemHover", onClick: () => onOpenConversation == null ? void 0 : onOpenConversation(conversation.id, conversation.title), children: [
127952
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { initial: conversation.initial, tone: conversation.tone }),
127953
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
127954
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5", children: [
127955
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 truncate text-xs font-medium", children: conversation.title }),
127956
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] text-vscode-textDark", children: conversation.time })
127957
+ ] }),
127958
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[11px] text-vscode-textDark", children: conversation.preview })
127959
+ ] }),
127960
+ conversation.unread ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-vscode-accent px-1.5 text-[10px] font-semibold text-white", children: conversation.unread }) : null
127961
+ ] }, conversation.id)) }),
127962
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-extension-slot": "workbench-sidebar-after-messages", "aria-hidden": "true", className: "h-0 overflow-hidden" })
127963
+ ] }),
127964
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-vscode-border/70 p-2.5", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex min-h-9 w-full items-center gap-2 rounded-lg px-2 text-left text-xs text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", children: [
127965
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Settings2, { className: "h-3.5 w-3.5" }),
127966
+ "工作台设置"
127967
+ ] }) })
127968
+ ] });
127969
+ }
127970
+ function WorkbenchHomePage({ workbenchConfig, onOpenConversation, onOpenFile }) {
127971
+ const [prompt, setPrompt] = useState("");
127972
+ (workbenchConfig == null ? void 0 : workbenchConfig.name) || "默认工作台";
127973
+ const submitPrompt = (event) => {
127974
+ event.preventDefault();
127975
+ if (!prompt.trim()) return;
127976
+ onOpenConversation == null ? void 0 : onOpenConversation("new", "新对话");
127977
+ setPrompt("");
127978
+ };
127979
+ const openService = (serviceId, title) => onOpenConversation == null ? void 0 : onOpenConversation(serviceId, title);
127980
+ const extensionSlotLabel = useMemo(() => `workbench-start-page-after-services:${(workbenchConfig == null ? void 0 : workbenchConfig.workbenchId) || "default"}`, [workbenchConfig == null ? void 0 : workbenchConfig.workbenchId]);
127981
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full min-h-0 overflow-auto bg-vscode-bg text-vscode-text", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mx-auto w-full max-w-6xl px-5 py-7 lg:px-10 lg:py-9", children: [
127982
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6 flex items-start justify-between gap-6", children: [
127983
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
127984
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-[0.16em] text-vscode-accent", children: "AppThen / 默认入口" }),
127985
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-2xl font-semibold tracking-tight text-vscode-text lg:text-3xl", children: "早上好,开始工作" }),
127986
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-2 max-w-2xl text-sm leading-6 text-vscode-textDark", children: "从一个问题开始,连接你的团队、文件和工作服务。" })
127987
+ ] }),
127988
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden items-center gap-2 text-xs text-vscode-textDark sm:flex", children: [
127989
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-2 w-2 rounded-full bg-emerald-400" }),
127990
+ "服务运行正常"
127991
+ ] })
127992
+ ] }),
127993
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { className: "rounded-xl border border-vscode-border bg-vscode-panel p-3 shadow-lg shadow-black/5 transition-colors focus-within:border-vscode-accent", onSubmit: submitPrompt, children: [
127994
+ /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { value: prompt, onChange: (event) => setPrompt(event.target.value), className: "min-h-[78px] w-full resize-none border-0 bg-transparent px-1 py-1 text-sm leading-6 text-vscode-text outline-none placeholder:text-vscode-textDark", placeholder: "今天要一起完成什么?试试:整理这周的检测项目进展", "aria-label": "发起一段对话" }),
127995
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-vscode-border/70 pt-2", children: [
127996
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
127997
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "rounded-md p-2 text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", "aria-label": "添加文件", title: "添加文件", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Paperclip, { className: "h-4 w-4" }) }),
127998
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "rounded-md p-2 text-vscode-textDark transition-colors hover:bg-vscode-itemHover hover:text-vscode-text", "aria-label": "选择服务", title: "选择服务", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Sparkles, { className: "h-4 w-4" }) })
127999
+ ] }),
128000
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "submit", className: "flex h-9 items-center gap-1.5 rounded-md bg-vscode-accent px-3 text-xs font-semibold text-white transition-transform hover:-translate-y-px hover:bg-vscode-accent/90", children: [
128001
+ "开始对话",
128002
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowUp, { className: "h-3.5 w-3.5" })
128003
+ ] })
128004
+ ] })
128005
+ ] }),
128006
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3 mt-7 flex items-center justify-between", children: [
128007
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-semibold", children: "推荐服务" }),
128008
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "text-xs text-vscode-accent hover:underline", onClick: () => openService("services", "全部服务"), children: [
128009
+ "查看全部",
128010
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "ml-0.5 inline h-3.5 w-3.5 align-[-2px]" })
128011
+ ] })
128012
+ ] }),
128013
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-4", children: SERVICES.map(({ id: id2, title, description, icon: Icon, tone }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "group min-h-[132px] rounded-xl border border-vscode-border bg-vscode-panel p-4 text-left transition-all hover:-translate-y-0.5 hover:border-vscode-accent/60 hover:shadow-lg hover:shadow-black/5", onClick: () => openService(id2, title), children: [
128014
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `mb-4 flex h-8 w-8 items-center justify-center rounded-lg ${tone}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { className: "h-4 w-4" }) }),
128015
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block text-xs font-semibold", children: title }),
128016
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-1 block text-[11px] leading-5 text-vscode-textDark", children: description }),
128017
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "mt-3 block text-[10px] text-vscode-textDark", children: [
128018
+ "打开服务 ",
128019
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowUp, { className: "ml-0.5 inline h-3 w-3 rotate-45" })
128020
+ ] })
128021
+ ] }, id2)) }),
128022
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-extension-slot": extensionSlotLabel, "aria-hidden": "true", className: "h-0 overflow-hidden" }),
128023
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-7 grid gap-3 lg:grid-cols-[1.1fr_.9fr]", children: [
128024
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "rounded-xl border border-vscode-border bg-vscode-panel", children: [
128025
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-h-11 items-center justify-between border-b border-vscode-border px-4", children: [
128026
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
128027
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xs font-semibold", children: "团队动态" }),
128028
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-0.5 text-[10px] text-vscode-textDark", children: "来自当前团队的最新消息" })
128029
+ ] }),
128030
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "text-xs text-vscode-accent", onClick: () => onOpenConversation == null ? void 0 : onOpenConversation("all", "最新消息"), children: "更多" })
128031
+ ] }),
128032
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "divide-y divide-vscode-border/60", children: CONVERSATIONS.slice(0, 3).map((item) => /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-vscode-itemHover/60", onClick: () => onOpenConversation == null ? void 0 : onOpenConversation(item.id, item.title), children: [
128033
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { initial: item.initial, tone: item.tone, small: true }),
128034
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
128035
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block truncate text-xs font-medium", children: item.title }),
128036
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[11px] text-vscode-textDark", children: item.preview })
128037
+ ] }),
128038
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] text-vscode-textDark", children: item.time })
128039
+ ] }, item.id)) })
128040
+ ] }),
128041
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "rounded-xl border border-vscode-border bg-vscode-panel", children: [
128042
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex min-h-11 items-center justify-between border-b border-vscode-border px-4", children: [
128043
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
128044
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xs font-semibold", children: "最近工作" }),
128045
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-0.5 text-[10px] text-vscode-textDark", children: "继续上次留下的内容" })
128046
+ ] }),
128047
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "text-xs text-vscode-accent", onClick: () => onOpenFile == null ? void 0 : onOpenFile("recent-files"), children: "全部" })
128048
+ ] }),
128049
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "divide-y divide-vscode-border/60", children: [
128050
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-vscode-itemHover/60", onClick: () => onOpenFile == null ? void 0 : onOpenFile("q3-report"), children: [
128051
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "h-4 w-4 shrink-0 text-vscode-textDark" }),
128052
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
128053
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block truncate text-xs font-medium", children: "Q3 检测项目汇总.xlsx" }),
128054
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[11px] text-vscode-textDark", children: "刚刚 · 项目资料库" })
128055
+ ] }),
128056
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3.5 w-3.5 text-vscode-textDark" })
128057
+ ] }),
128058
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-vscode-itemHover/60", onClick: () => onOpenFile == null ? void 0 : onOpenFile("delivery-flow"), children: [
128059
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "h-4 w-4 shrink-0 text-vscode-textDark" }),
128060
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex-1", children: [
128061
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "block truncate text-xs font-medium", children: "客户交付流程 v2.md" }),
128062
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mt-0.5 block truncate text-[11px] text-vscode-textDark", children: "昨天 · 交付项目" })
128063
+ ] }),
128064
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3.5 w-3.5 text-vscode-textDark" })
128065
+ ] })
128066
+ ] })
128067
+ ] })
128068
+ ] })
128069
+ ] }) });
128070
+ }
127666
128071
  const EditorArea = ({
127667
128072
  activeExtension,
127668
128073
  activeFile,
@@ -127675,7 +128080,7 @@ const EditorArea = ({
127675
128080
  onUninstallExtension
127676
128081
  }) => {
127677
128082
  var _a2;
127678
- const { collaboration, state } = useWorkbench();
128083
+ const { collaboration, state, api } = useWorkbench();
127679
128084
  const fileSystem = useContext(FileSystemContext);
127680
128085
  const [viewMode, setViewMode] = useState("visual");
127681
128086
  const [currentTheme, setCurrentTheme] = useState(themeService.getCurrentTheme());
@@ -127741,6 +128146,25 @@ const EditorArea = ({
127741
128146
  previewService.refreshPreview(previewConfig.key, previewConfig.url);
127742
128147
  }
127743
128148
  }, [previewConfig]);
128149
+ const openHomeConversation = useCallback(
128150
+ (conversationId, title) => {
128151
+ const virtualFile = workspaceEditorService.createViewFile(
128152
+ CONVERSATION_HUB_VIEW_ID,
128153
+ title || "会话工作台",
128154
+ {
128155
+ title: title || "会话工作台",
128156
+ conversationId
128157
+ },
128158
+ `conversation-hub-${conversationId}`
128159
+ );
128160
+ api.openFile(virtualFile.id);
128161
+ },
128162
+ [api]
128163
+ );
128164
+ const openHomeFile = useCallback((fileId) => {
128165
+ const file = state.files.find((item) => item.id === fileId);
128166
+ if (file) api.openFile(file.id);
128167
+ }, [api, state.files]);
127744
128168
  useEffect(() => {
127745
128169
  return themeService.onThemeChange(() => {
127746
128170
  setCurrentTheme(themeService.getCurrentTheme());
@@ -127788,6 +128212,16 @@ const EditorArea = ({
127788
128212
  if (activeExtension === ExtensionType.DEBUGGER) {
127789
128213
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DebuggerView, {});
127790
128214
  }
128215
+ if (activeExtension === ExtensionType.WORKBENCH_HOME && !activeFile && !activeMainViewId) {
128216
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
128217
+ WorkbenchHomePage,
128218
+ {
128219
+ workbenchConfig: state.workbenchConfig,
128220
+ onOpenConversation: openHomeConversation,
128221
+ onOpenFile: openHomeFile
128222
+ }
128223
+ );
128224
+ }
127791
128225
  if (activeMainViewId) {
127792
128226
  const mainView = extensionRegistry.getMainView(activeMainViewId);
127793
128227
  if (mainView) {
@@ -128479,12 +128913,26 @@ const MobileSidebar = ({
128479
128913
  onClose,
128480
128914
  controller
128481
128915
  }) => {
128916
+ const { state, api } = useWorkbench();
128482
128917
  const [height, setHeight] = useState(DEFAULT_HEIGHT$1);
128483
128918
  const [isDragging, setIsDragging] = useState(false);
128484
128919
  const [mountedExtensionIds, setMountedExtensionIds] = useState(() => [String(activeExtensionId)]);
128485
128920
  const startYRef = useRef(0);
128486
128921
  const startHeightRef = useRef(DEFAULT_HEIGHT$1);
128487
128922
  const activeExtension = extensions.find((e) => e.id === activeExtensionId);
128923
+ const openConversation = useCallback(
128924
+ (conversationId, title) => {
128925
+ const virtualFile = workspaceEditorService.createViewFile(
128926
+ CONVERSATION_HUB_VIEW_ID,
128927
+ title || "会话工作台",
128928
+ { title: title || "会话工作台", conversationId },
128929
+ `conversation-hub-${conversationId}`
128930
+ );
128931
+ api.openFile(virtualFile.id);
128932
+ onClose();
128933
+ },
128934
+ [api, onClose]
128935
+ );
128488
128936
  useEffect(() => {
128489
128937
  if (!(activeExtension == null ? void 0 : activeExtension.layout.sidebarViewId)) return;
128490
128938
  setMountedExtensionIds((current2) => {
@@ -128615,6 +129063,13 @@ const MobileSidebar = ({
128615
129063
  )
128616
129064
  ] }),
128617
129065
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1 overflow-hidden", children: [
129066
+ activeExtensionId === ExtensionType.WORKBENCH_HOME && /* @__PURE__ */ jsxRuntimeExports.jsx(
129067
+ WorkbenchHomeSidebar,
129068
+ {
129069
+ workbenchConfig: state.workbenchConfig,
129070
+ onOpenConversation: openConversation
129071
+ }
129072
+ ),
128618
129073
  renderedExtensionIds.map((extensionId) => {
128619
129074
  const extension = extensions.find((item) => String(item.id) === extensionId);
128620
129075
  const viewId = extension == null ? void 0 : extension.layout.sidebarViewId;
@@ -128651,7 +129106,7 @@ const MobileSidebar = ({
128651
129106
  }),
128652
129107
  (activeExtension == null ? void 0 : activeExtension.runtimeStatus) === "loading" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center px-6 text-sm text-vscode-textDark", children: "正在加载扩展..." }),
128653
129108
  (activeExtension == null ? void 0 : activeExtension.runtimeStatus) === "error" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-vscode-textDark", children: "扩展加载失败,请重新打开" }),
128654
- !(activeExtension == null ? void 0 : activeExtension.runtimeStatus) && !(activeExtension == null ? void 0 : activeExtension.layout.sidebarViewId) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4 text-vscode-textDark", children: "No sidebar view available" })
129109
+ !(activeExtension == null ? void 0 : activeExtension.runtimeStatus) && !(activeExtension == null ? void 0 : activeExtension.layout.sidebarViewId) && activeExtensionId !== ExtensionType.WORKBENCH_HOME && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4 text-vscode-textDark", children: "No sidebar view available" })
128655
129110
  ] })
128656
129111
  ]
128657
129112
  }
@@ -129247,7 +129702,7 @@ const MobileLayout = (props) => {
129247
129702
  onReturnToPanel: handleReturnToPanel
129248
129703
  }
129249
129704
  ) }),
129250
- !hasOpenFiles && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-vscode-workbench", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center p-8", children: [
129705
+ !hasOpenFiles && activeLeftExtensionId !== ExtensionType.WORKBENCH_HOME && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-vscode-workbench", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center p-8", children: [
129251
129706
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-6xl mb-4", children: "✨" }),
129252
129707
  /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-2xl font-bold text-vscode-text mb-2", children: "选择一个工作内容" }),
129253
129708
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-vscode-textDark text-sm mb-6", children: "从下方扩展进入文件空间、会话或团队工具。" }),
@@ -129543,6 +129998,7 @@ const SidebarHost = React__default.memo(({
129543
129998
  onRetry
129544
129999
  }) => {
129545
130000
  var _a2, _b;
130001
+ const { api } = useWorkbench();
129546
130002
  const activeExtensionId = (activeExtension == null ? void 0 : activeExtension.id) ? String(activeExtension.id) : null;
129547
130003
  const [mountedExtensionIds, setMountedExtensionIds] = useState(
129548
130004
  () => activeExtensionId ? [activeExtensionId] : []
@@ -129558,7 +130014,29 @@ const SidebarHost = React__default.memo(({
129558
130014
  const mountedExtensions = renderedExtensionIds.map((id2) => extensions.find((extension) => String(extension.id) === id2)).filter((extension) => Boolean(extension));
129559
130015
  const activeSidebarViewComponent = ((_b = activeExtension == null ? void 0 : activeExtension.layout) == null ? void 0 : _b.sidebarViewId) ? extensionRegistry.getSidebarView(activeExtension.layout.sidebarViewId) : null;
129560
130016
  const showActiveView = (activeExtension == null ? void 0 : activeExtension.runtimeStatus) !== "loading" && (activeExtension == null ? void 0 : activeExtension.runtimeStatus) !== "error";
130017
+ const openConversation = useCallback(
130018
+ (conversationId, title) => {
130019
+ const virtualFile = workspaceEditorService.createViewFile(
130020
+ CONVERSATION_HUB_VIEW_ID,
130021
+ title || "会话工作台",
130022
+ {
130023
+ title: title || "会话工作台",
130024
+ conversationId
130025
+ },
130026
+ `conversation-hub-${conversationId}`
130027
+ );
130028
+ api.openFile(virtualFile.id);
130029
+ },
130030
+ [api]
130031
+ );
129561
130032
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full flex-1 flex-col overflow-hidden", children: [
130033
+ activeExtensionId === ExtensionType.WORKBENCH_HOME && showActiveView && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
130034
+ WorkbenchHomeSidebar,
130035
+ {
130036
+ workbenchConfig,
130037
+ onOpenConversation: openConversation
130038
+ }
130039
+ ) }),
129562
130040
  mountedExtensions.map((extension) => {
129563
130041
  var _a3;
129564
130042
  const viewId = (_a3 = extension.layout) == null ? void 0 : _a3.sidebarViewId;
@@ -129605,7 +130083,7 @@ const SidebarHost = React__default.memo(({
129605
130083
  }
129606
130084
  )
129607
130085
  ] }),
129608
- !(activeExtension == null ? void 0 : activeExtension.runtimeStatus) && !activeSidebarViewComponent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center text-sm text-vscode-textDark", children: "暂无可用的侧边栏视图" })
130086
+ !(activeExtension == null ? void 0 : activeExtension.runtimeStatus) && !activeSidebarViewComponent && activeExtensionId !== ExtensionType.WORKBENCH_HOME && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center text-sm text-vscode-textDark", children: "暂无可用的侧边栏视图" })
129609
130087
  ] });
129610
130088
  });
129611
130089
  SidebarHost.displayName = "SidebarHost";
@@ -130267,4 +130745,4 @@ export {
130267
130745
  themeService as t,
130268
130746
  useWorkbench as u
130269
130747
  };
130270
- //# sourceMappingURL=Workbench-97d1mmiW.js.map
130748
+ //# sourceMappingURL=Workbench-BGO7IU10.js.map