pisper 0.6.14 → 0.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pisper.mjs +5 -1
- package/lib/executor-node.mjs +590 -0
- package/lib/npm-update.mjs +2 -0
- package/package.json +5 -5
- package/web/.vite/manifest.json +852 -856
- package/web/assets/{AppDialog-DrhCZm1r.js → AppDialog-CgJEhcYw.js} +1 -1
- package/web/assets/{AppOverlays-CxgReqGn.js → AppOverlays-BBlYyb_U.js} +1 -1
- package/web/assets/{AppSelect-BGVBQRP1.js → AppSelect-BD6RAaJ5.js} +1 -1
- package/web/assets/{AssetsPage-CKK-byQY.js → AssetsPage-D3F4T0_j.js} +1 -1
- package/web/assets/BoardPage-CO7nU2Mw.js +3 -0
- package/web/assets/BotAvatar-CNL-APwP.js +1 -0
- package/web/assets/ChannelsPage-CsRbj9St.js +1 -0
- package/web/assets/{ChatAppearancePage-BhqRLf-2.js → ChatAppearancePage-Sc1V75I3.js} +1 -1
- package/web/assets/{ChatHistoryPage-DBsNyGYj.js → ChatHistoryPage-BT0mIaDN.js} +1 -1
- package/web/assets/ChatPage-C-hswZf9.js +553 -0
- package/web/assets/ConfigPage-DH2d8YGn.js +5 -0
- package/web/assets/{DesktopWindowControls-DCtIkpTs.js → DesktopWindowControls-Bo5vvIFH.js} +1 -1
- package/web/assets/{FeaturePage-Bkt1wWVg.js → FeaturePage-B3wCvGpC.js} +1 -1
- package/web/assets/{FileAttachmentPreview-Cnmi_2U-.js → FileAttachmentPreview-D8YqjbeC.js} +1 -1
- package/web/assets/{FloatingWidgets-BIJSFz34.js → FloatingWidgets-Dz_T7XWC.js} +1 -1
- package/web/assets/FocusRuntimeControls-hYDoXwg7.js +1 -0
- package/web/assets/{GitDiffViewer-rjt5_KOt.js → GitDiffViewer-CBju_Sj4.js} +3 -3
- package/web/assets/ManageProjectsDialog-Dtb2K7BK.js +1 -0
- package/web/assets/{MarkdownMessage-yl-PSRAz.js → MarkdownMessage-BDztlYIy.js} +1 -1
- package/web/assets/{McpPage-D6GyZCpt.js → McpPage-DQ6AILOH.js} +1 -1
- package/web/assets/MemoryPage-CK4evs_P.js +1 -0
- package/web/assets/{MobileNavigation-DcBH2I9Y.js → MobileNavigation-BICCops3.js} +1 -1
- package/web/assets/MobileViewportStabilizer-uKI4Zp7f.js +1 -0
- package/web/assets/{MorePage-BBfiQbiP.js → MorePage-DuML7bhr.js} +1 -1
- package/web/assets/NewBotDialog--2DSe9Sy.js +1 -0
- package/web/assets/{NewFolderDialog-BinpbTs8.js → NewFolderDialog-S-Qzjzfu.js} +1 -1
- package/web/assets/{PageHeader-D_J-19ni.js → PageHeader-B78dHJed.js} +1 -1
- package/web/assets/{PhoneDrawer-CwxDkWZQ.js → PhoneDrawer-DHRBi4XA.js} +1 -1
- package/web/assets/PhoneMenuButton-BjDV-dPl.js +1 -0
- package/web/assets/PhoneTopBar-BuyzXL4Z.js +1 -0
- package/web/assets/PluginsPage-Cd9bu2AS.js +1 -0
- package/web/assets/{SafeModePrompt-CLyt-z14.js → SafeModePrompt-BnoccbWI.js} +1 -1
- package/web/assets/SchedulesPage-DUhUUQP5.js +1 -0
- package/web/assets/SessionBrowserPane-B3weAiaB.js +2 -0
- package/web/assets/SessionContextPanel-BtxUlk9m.js +2 -0
- package/web/assets/SessionHome-ByiFmH18.js +1 -0
- package/web/assets/SessionInspector-VKOz4Rxs.js +1 -0
- package/web/assets/SessionShell-BsDAwWHd.js +1 -0
- package/web/assets/{SettingsSidebar-IqsOv5h1.js → SettingsSidebar-B-COw6Uw.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-DKDAF94g.js → ShortcutHelpDialog-DquhK-Uh.js} +1 -1
- package/web/assets/{ShortcutKeys-DQFnMnX1.js → ShortcutKeys-BgwCWvNY.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-Cbwy5ii9.js → SidebarUpdateStatus-Ci0ugb91.js} +1 -1
- package/web/assets/{SkillsPage-DTOzYSaS.js → SkillsPage-B46uoO_g.js} +1 -1
- package/web/assets/{TaskProcessesPane-DRFmGkE3.js → TaskProcessesPane-CI_5lWbf.js} +1 -1
- package/web/assets/{TaskTerminalView-DWNACXyI.js → TaskTerminalView-C2acHnAH.js} +1 -1
- package/web/assets/{TerminalPanel-QEt-SRiM.js → TerminalPanel-BAQ2VwKg.js} +1 -1
- package/web/assets/{WebDesktopPet-4CDch3gC.js → WebDesktopPet-D3bdxKPz.js} +1 -1
- package/web/assets/{WorkflowsPage-AMKQBlPo.js → WorkflowsPage-Dp1PRKQb.js} +1 -1
- package/web/assets/WorkspacePicker-BJhBGRH0.js +1 -0
- package/web/assets/accordion-CiJMkjqX.js +1 -0
- package/web/assets/{api-BO7LAPSQ.js → api-CKJOip3Q.js} +1 -1
- package/web/assets/{app-update-DKWPHTUY.js → app-update-yPQVXuw5.js} +1 -1
- package/web/assets/{approval-confirm-ByiI22Wo.js → approval-confirm-Cv754IjO.js} +1 -1
- package/web/assets/board-messages-CIYKjAla.js +1 -0
- package/web/assets/board-projects-wd79Rqt5.js +2 -0
- package/web/assets/channels-messages-KabR1HOR.js +1 -0
- package/web/assets/chat-api-Bvirerdj.js +1 -0
- package/web/assets/{client-store-6GNC8uyK.js → client-store-BaTctJrB.js} +1 -1
- package/web/assets/collapsible-Dcoy-qnz.js +1 -0
- package/web/assets/config-search-KYVClDpx.js +1 -0
- package/web/assets/{dialog-CUhFgsVd.js → dialog-Cb_sjjQV.js} +1 -1
- package/web/assets/{collapsible-DMaUQRX4.js → dist-DUSSw9eQ.js} +1 -1
- package/web/assets/events-CZTn9wa-.js +1 -0
- package/web/assets/file-diff-GxOMJkLj.js +1 -0
- package/web/assets/folder-paths--euvEC5U.js +1 -0
- package/web/assets/{hosts-1yQREdMi.js → hosts-BRPznOHU.js} +1 -1
- package/web/assets/i18n-DEs6BBob.js +1 -0
- package/web/assets/{index-CsE52ydO.js → index-C5aKcTGw.js} +2 -2
- package/web/assets/index-DD2H2OOC.css +2 -0
- package/web/assets/message-circle-question-mark-D7ehy_mi.js +1 -0
- package/web/assets/{mobile-remote-fallback-NJCTBu85.js → mobile-remote-fallback-DG_urwIg.js} +1 -1
- package/web/assets/mount-app-BdXRP9D-.js +9 -0
- package/web/assets/navigation-DkcKi1_5.js +1 -0
- package/web/assets/new-task-uLEgjs2Z.js +1 -0
- package/web/assets/{palette-navigation-ByC1_QS5.js → palette-navigation-HbVGltCo.js} +1 -1
- package/web/assets/{permission-rules-api-BoJ_1W-m.js → permission-rules-api-C9oRUm6Z.js} +1 -1
- package/web/assets/{pick-system-directory-B_RJmP26.js → pick-system-directory-B__qKy-X.js} +1 -1
- package/web/assets/placements-Bn0vPyEI.js +2 -0
- package/web/assets/{popover--UmYQ9yB.js → popover-CiVxYUEU.js} +1 -1
- package/web/assets/public-9meoHs0K.js +4 -0
- package/web/assets/public-D6X148yH.js +2 -0
- package/web/assets/public-DenVz3gW.js +2 -0
- package/web/assets/{public-components-DYGekkA7.js → public-components-BfHcj0Pn.js} +1 -1
- package/web/assets/public-diff-BqcNo4lt.js +1 -0
- package/web/assets/public-events-DCyxz5zX.js +1 -0
- package/web/assets/public-flags-BOI2nkm4.js +1 -0
- package/web/assets/public-launch-D0t4Hqf5.js +1 -0
- package/web/assets/public-sidebar-CdxAohEH.js +1 -0
- package/web/assets/react-bits-BsPlLi8F.css +1 -0
- package/web/assets/routes-DIeaqWVc.js +1 -0
- package/web/assets/runtime-capabilities-CHYOF_hE.js +1 -0
- package/web/assets/{runtime-capabilities-store-C2Qv7uDP.js → runtime-capabilities-store-D2d_9z0D.js} +1 -1
- package/web/assets/{safe-mode-instance-BiAPYJ2-.js → safe-mode-instance-hnF1BJYr.js} +1 -1
- package/web/assets/safe-mode-sentinel-CPmhLLXT.js +1 -0
- package/web/assets/{session-change-summary-api-DgRT32uh.js → session-change-summary-api-DmmNGbP7.js} +1 -1
- package/web/assets/{session-home-BktP6sGF.js → session-home-BAFT2Fk1.js} +1 -1
- package/web/assets/{session-organization-api-DFu3Chto.js → session-organization-api-Bs8DdxU1.js} +1 -1
- package/web/assets/{session-scope-DQPNgQMm.js → session-scope-XRVRtwow.js} +1 -1
- package/web/assets/{session-tree-actions-DfO8QHBO.js → session-tree-actions-Dzj7hrvM.js} +1 -1
- package/web/assets/{session-tree-summary-BwYRdui2.js → session-tree-summary-BXVKYODc.js} +1 -1
- package/web/assets/settings-navigation-DiP_AM1C.js +1 -0
- package/web/assets/{shortcuts-Cvp9WD9O.js → shortcuts-IA6Uq_O6.js} +1 -1
- package/web/assets/side-chat-context-CZ4IqNxt.js +7 -0
- package/web/assets/sidebar-Do_8-Hyh.js +2 -0
- package/web/assets/sidebar-store-DuRlD5qg.js +1 -0
- package/web/assets/{speech-session-DK_09Wky.js → speech-session-D_W5Ulli.js} +1 -1
- package/web/assets/{startup-queries-6Oztqpto.js → startup-queries-DeNu46nT.js} +1 -1
- package/web/assets/storage-DH3bQdy6.js +1 -0
- package/web/assets/tool-labels-ghvpPFmc.js +1 -0
- package/web/assets/{use-i18n-B5p-Kzvz.js → use-i18n-CUS2_EGy.js} +1 -1
- package/web/assets/use-mobile-C2tPBAza.js +1 -0
- package/web/assets/use-studio-actions-CYnwfaOn.js +3 -0
- package/web/assets/useNewProjectPicker-CacWA0IS.js +1 -0
- package/web/assets/usePhoneShell-cYrS53S8.js +1 -0
- package/web/assets/useSessionRowActions-DtunSg_Q.js +1 -0
- package/web/assets/useSidebarModel-6sqN4VA5.js +1 -0
- package/web/assets/web-preview-Dgng80ZD.js +1 -0
- package/web/assets/{web-preview-events-DQchQHt3.js → web-preview-events-JGegs4uF.js} +1 -1
- package/web/assets/workflow-messages-Cj35aJZc.js +1 -0
- package/web/assets/workspace-order-store-BuPmheRT.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/BoardPage-vwv5vTDm.js +0 -3
- package/web/assets/ChannelsPage-L-wcVDSN.js +0 -1
- package/web/assets/ChatPage-DS0euFxR.js +0 -553
- package/web/assets/ConfigPage-pOzONr8e.js +0 -5
- package/web/assets/DispatchOverlay-n-qbkOP-.js +0 -1
- package/web/assets/FocusRuntimeControls-C7NIdpV4.js +0 -1
- package/web/assets/LaunchConsole-DtxzpXJo.js +0 -3
- package/web/assets/ManageProjectsDialog-RiFg3h1p.js +0 -1
- package/web/assets/MemoryPage-Dsx_6JpI.js +0 -1
- package/web/assets/MobileViewportStabilizer-OtwVmIPm.js +0 -1
- package/web/assets/PhoneMenuButton-B0AwvqEo.js +0 -1
- package/web/assets/PhoneTopBar-Dw0mIaWC.js +0 -1
- package/web/assets/PluginsPage-BzxPAX26.js +0 -1
- package/web/assets/QuickPromptIdeas-Cd3SwBqS.js +0 -1
- package/web/assets/SchedulesPage-Cbgl5v_8.js +0 -1
- package/web/assets/SessionBrowserPane-CB7jn-MS.js +0 -2
- package/web/assets/SessionContextPanel-CNmAp0ed.js +0 -2
- package/web/assets/SessionHome-Ck_daJT0.js +0 -1
- package/web/assets/SessionInspector-cSzwsc4b.js +0 -1
- package/web/assets/SessionShell-BOZ7h0yz.js +0 -1
- package/web/assets/WorkspacePicker-B9vYtfab.js +0 -1
- package/web/assets/board-launch-BmmPYZe8.js +0 -1
- package/web/assets/board-messages-BOWWyhz_.js +0 -1
- package/web/assets/board-projects-BU9fZB1q.js +0 -1
- package/web/assets/channels-messages-DazltGVm.js +0 -1
- package/web/assets/chat-api-DkdyVQY9.js +0 -1
- package/web/assets/config-search-HBKDuym0.js +0 -1
- package/web/assets/events-DrAPv0se.js +0 -1
- package/web/assets/file-text-N9JICX6E.js +0 -1
- package/web/assets/folder-paths-DQTpuGh9.js +0 -1
- package/web/assets/i18n-CHmr7GzM.js +0 -1
- package/web/assets/index-CfTBR7Rs.css +0 -2
- package/web/assets/list-checks-B5Jl4aiO.js +0 -1
- package/web/assets/mount-app-DfSFF0xv.js +0 -9
- package/web/assets/navigation-EoDz3gT8.js +0 -1
- package/web/assets/new-task-C3wuHTor.js +0 -1
- package/web/assets/placements-CqwqXPTp.js +0 -2
- package/web/assets/public-diff-DK-VNIar.js +0 -1
- package/web/assets/public-fqyTjQ0F.js +0 -2
- package/web/assets/public-jQjEc6OO.js +0 -1
- package/web/assets/public-launch-CT_m9KWo.js +0 -1
- package/web/assets/react-bits-DQli9s7O.css +0 -1
- package/web/assets/routes-Da0OHSy6.js +0 -1
- package/web/assets/runtime-capabilities-4_ZwLBqF.js +0 -1
- package/web/assets/safe-mode-sentinel-Ccu3Vmta.js +0 -1
- package/web/assets/session-workspaces-BWTBYaGT.js +0 -1
- package/web/assets/settings-navigation-_yUm71Uk.js +0 -1
- package/web/assets/shield-B1ruzHd0.js +0 -1
- package/web/assets/side-chat-context-BfOm4dFp.js +0 -7
- package/web/assets/sidebar-BLeRyb55.js +0 -2
- package/web/assets/sidebar-commands-ZA1UOA_F.js +0 -1
- package/web/assets/sidebar-store-1-aNPlDu.js +0 -1
- package/web/assets/storage-BY6wEHPw.js +0 -1
- package/web/assets/tool-labels-BUEvdohv.js +0 -1
- package/web/assets/use-mobile-DauOEda6.js +0 -1
- package/web/assets/use-studio-actions-D6c_pSJK.js +0 -3
- package/web/assets/useBoardItems-CzEbgTLJ.js +0 -1
- package/web/assets/useFleetSystemInfo-Bd8zJIFa.js +0 -1
- package/web/assets/useNewProjectPicker-DQY1X_ua.js +0 -1
- package/web/assets/useNow-Bxn4_OW9.js +0 -1
- package/web/assets/usePagePrimaryAction-CWPC0C_f.js +0 -1
- package/web/assets/usePhoneShell-Bvb7m-m4.js +0 -1
- package/web/assets/useSessionListQuery-D44XZfGr.js +0 -2
- package/web/assets/useSessionRowActions-Cr6SUAeE.js +0 -1
- package/web/assets/useSidebarModel-CWED0rsw.js +0 -1
- package/web/assets/wand-sparkles-CvEBNUFz.js +0 -1
- package/web/assets/web-preview-CqwSe9Zn.js +0 -1
- package/web/assets/workflow-messages-CMCQrs5q.js +0 -1
- package/web/assets/workspace-order-store-RYWvGOeR.js +0 -1
- /package/web/assets/{AnimatedList-D8fxDNGr.js → AnimatedList-DB5vqafO.js} +0 -0
- /package/web/assets/{ClickSpark-DmnEAJNI.js → ClickSpark-B1Rn7ZwL.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CUS2_EGy.js";import{t as i}from"./runtime-capabilities-store-D2d_9z0D.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";var n=e(t(),1);function r({enabled:e,shellRef:t}){return(0,n.useEffect)(()=>{if(!e)return;let n=t.current;if(!n)return;let r=window.visualViewport,i=0,a=0,o=0,s=Math.max(window.innerHeight,r?.height??0),c=`[data-mobile-composer-input]`,l=()=>{o&&window.clearTimeout(o),o=0},u=e=>{l(),n.dataset.mobileKeyboardTransition=e,e===`opening`&&(o=window.setTimeout(()=>{n.dataset.mobileKeyboard||delete n.dataset.mobileKeyboardTransition,o=0},500))},d=e=>{!(e instanceof Element)||!e.closest(c)||u(`opening`)},f=e=>d(e.target),p=e=>d(e.target),m=e=>{let t=e.target;!(t instanceof Element)||!t.closest(c)||window.requestAnimationFrame(()=>{let e=document.activeElement;e instanceof Element&&e.closest(c)||(u(`closing`),o=window.setTimeout(()=>{delete n.dataset.mobileKeyboardTransition,o=0},240))})},h=()=>{i=0;let e=Math.max(1,Math.round(r?.height??window.innerHeight)),t=Math.max(0,Math.round(r?.offsetTop??0));s=Math.max(s,window.innerHeight,e+t),Math.max(0,s-e-t)>=s*.2?(n.style.height=`${e}px`,n.style.transform=t?`translate3d(0, ${t}px, 0)`:``,n.dataset.mobileKeyboard=`open`,l()):(n.style.height=``,n.style.transform=``,delete n.dataset.mobileKeyboard,n.dataset.mobileKeyboardTransition===`opening`&&u(`closing`))},g=()=>{i&&window.cancelAnimationFrame(i),i=window.requestAnimationFrame(h)},_=()=>{window.clearTimeout(a),a=window.setTimeout(()=>{s=0,g()},150)};return h(),r?.addEventListener(`resize`,g),r?.addEventListener(`scroll`,g),window.addEventListener(`resize`,g),window.addEventListener(`orientationchange`,_),document.addEventListener(`touchstart`,f,!0),document.addEventListener(`pointerdown`,f,!0),document.addEventListener(`focusin`,p,!0),document.addEventListener(`focusout`,m,!0),()=>{i&&window.cancelAnimationFrame(i),window.clearTimeout(a),l(),r?.removeEventListener(`resize`,g),r?.removeEventListener(`scroll`,g),window.removeEventListener(`resize`,g),window.removeEventListener(`orientationchange`,_),document.removeEventListener(`touchstart`,f,!0),document.removeEventListener(`pointerdown`,f,!0),document.removeEventListener(`focusin`,p,!0),document.removeEventListener(`focusout`,m,!0),delete n.dataset.mobileKeyboard,delete n.dataset.mobileKeyboardTransition}},[e,t]),null}export{r as MobileViewportStabilizer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B5p-Kzvz.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-BO7LAPSQ.js";import{a as s,n as c,t as l}from"./runtime-capabilities-4_ZwLBqF.js";import{t as u}from"./runtime-capabilities-store-C2Qv7uDP.js";import{m as d}from"./placements-CqwqXPTp.js";import{t as ee}from"./client-store-6GNC8uyK.js";import{t as f}from"./usePhoneShell-Bvb7m-m4.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-DrAPv0se.js";import{n as N,r as P}from"./config-search-HBKDuym0.js";import{s as F}from"./shortcuts-Cvp9WD9O.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CUS2_EGy.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-CKJOip3Q.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-D2d_9z0D.js";import{m as d}from"./placements-Bn0vPyEI.js";import{t as ee}from"./client-store-BaTctJrB.js";import{t as f}from"./usePhoneShell-cYrS53S8.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-CZTn9wa-.js";import{n as N,r as P}from"./config-search-KYVClDpx.js";import{s as F}from"./shortcuts-IA6Uq_O6.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{c as r}from"./i18n-DEs6BBob.js";import{t as i}from"./use-i18n-CUS2_EGy.js";import{o as a}from"./vendor-state-GkUciC5H.js";import{a as o,l as s}from"./api-CKJOip3Q.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./WorkspacePicker-BJhBGRH0.js";import{t as te}from"./folder-open-FIShC5Qk.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./button-CCcCN8tE.js";import{a as ne,i as d,l as f,o as p,s as re,t as ie}from"./dialog-Cb_sjjQV.js";import{t as m}from"./input-CPw-zkYh.js";import{t as ae}from"./textarea-DmATpOqT.js";import{n as h}from"./field-DoLEb0np.js";import{a as g,i as _,o as v,r as y,s as b,t as x}from"./BotAvatar-CNL-APwP.js";var oe=c(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]);r.addResourceBundle(`zh-CN`,`bots`,{"sidebar.title":`Bots`,"sidebar.newBot":`新建 Bot`,"activity.idle":`空闲`,"activity.paused":`已暂停,不接新任务`,"activity.review":`改动待你确认 · {count} 个文件`,"activity.failed":`上次任务失败了`,"activity.interrupted":`任务被中断,等你决定`,"activity.working":`正在做:{title}`,"character.blob":`小圆`,"character.bean":`豆豆`,"character.robot":`机器人`,"character.cat":`小猫`,"character.owl":`猫头鹰`,"character.ghost":`小幽灵`,"character.cloud":`云朵`,"character.octo":`章鱼`,"character.bunny":`兔子`,"character.bear":`小熊`,"character.fox":`小狐`,"character.star":`星星`,"new.title":`新建 Bot`,"new.description":`起个名字就能开始。它负责什么可以现在写,也可以之后在对话里告诉它。`,"new.name":`名字`,"new.namePlaceholder":`例如:审查员`,"new.character":`角色`,"new.color":`颜色`,"new.colorOption":`颜色 {index}`,"new.pick":`选择…`,"new.cancel":`取消`,"new.create":`开始对话`,"new.creating":`正在创建…`,"page.disabledTitle":`Bots 还没打开`,"page.disabledDescription":`Bots 是实验功能,在设置 › 实验功能里打开后就能用。`,"page.openLabs":`去实验功能`,"page.loading":`正在读取…`,"page.notFound":`这个 Bot 不存在了`,"page.emptyTitle":`还没有 Bot`,"page.emptyDescription":`Bot 是常驻的同事:在对话里交代事情,它在后台做完再找你。`,"header.closeDetails":`关闭详情`,"composer.label":`发消息给{name}`,"composer.placeholder":`发消息给{name}…`,"composer.followUp":`继续对{name}说…会在同一个分支上接着改`,"composer.busy":`{name}在忙,新消息会排在后面…`,"composer.send":`发送`,"conversation.label":`和{name}的对话`,"conversation.greeting":`你好,我是{name}。交代我做什么吧,我会在独立分支上改,改完交给你确认。`,"conversation.greetingHint":`想让我一直记住的要求,点右上角的设置写进“它负责什么”。`,"card.queued":`排队中,前面的事做完就开始`,"card.working":`正在干活…`,"card.stop":`停止`,"card.review":`{count} 个文件有改动`,"card.showChanges":`查看改动`,"card.discard":`放弃`,"card.acceptApply":`接受并应用到当前分支`,"card.failed":`任务失败了`,"card.interrupted":`任务被中断了`,"card.resume":`继续`,"card.openSession":`完整记录`,"card.discarded":`已放弃`,"card.applied":`已接受并应用到当前分支(分支 {branch} 保留)`,"card.accepted":`已接受,改动在分支 {branch} 上`,"card.noChanges":`完成,没有改动`,"details.tabChangesCount":`改动 · {count}`,"details.instructions":`它负责什么`,"details.instructionsPlaceholder":`例如:你负责 pisper 仓库的 PR 审查;小问题直接改,其余只提建议;先跑 npm test 再下结论。`,"details.save":`保存`,"details.acceptsWork":`接收新任务`,"details.permission":`执行权限上限`,"details.modeApproval":`需要审批`,"details.modeWorkspace":`工作区写入`,"details.modeFull":`完全访问`,"details.delivery":`交付方式`,"details.deliveryDiff":`改动待确认`,"details.deliveryCommit":`提交到任务分支`,"details.deliveryReply":`只回复`,"details.noChanges":`现在没有等你确认的改动`,"details.loadingChanges":`正在读取改动…`,"computer.description":`它在这台电脑上读写代码、跑命令。可以换成另一台运行 pisper executor 的电脑。`,"computer.runsOn":`运行在`,"computer.local":`本机`,"computer.isolated":`每次任务一个独立分支`,"computer.shared":`直接在目录里改`,"computer.currentBranch":`正在分支 {branch} 上干活`,"activity.approval":`等你批准一个操作`,"activity.question":`有问题问你`,"waiting.approval":`需要你批准:{tool}`,"waiting.allow":`允许`,"waiting.deny":`拒绝`,"waiting.critical":`这是高风险操作,确认没问题再允许。`,"waiting.confirmAllow":`确认允许`,"waiting.cancel":`取消`,"waiting.truncated":`内容太长,这里只显示了一部分。要允许的话,请在完整记录里看完再批准。`,"waiting.question":`{name}问你`,"waiting.otherLabel":`你的回答`,"waiting.otherPlaceholder":`或者直接写你的回答…`,"waiting.answer":`回答`,"waiting.skip":`跳过`,"waiting.answerInLog":`这个问题有多项,请在完整记录里回答。`,"details.tools":`可用工具`,"details.toolsAll":`全部工具`,"details.toolsReadOnly":`只读`,"details.toolsCustom":`自定义({count} 个)`,"details.toolsHint":`只读:能读代码、搜索,不能改文件、不能跑命令。范围外的工具在执行前就会被拦下。`,"activity.environment":`等它的电脑上线`,"computer.unnamed":`未命名的电脑`,"computer.online":`在线`,"computer.offline":`离线`,"computer.option":`{name}({state})`,"computer.folder":`工作目录`,"computer.folderPlaceholder":`/path/to/repo`,"computer.folderInRoots":`必须在这台电脑允许的目录里:{roots}`,"computer.switch":`换到这里`,"computer.listTitle":`电脑`,"computer.usedBy":`{names} 在用`,"computer.remove":`移除`,"computer.confirmRemove":`确定移除`,"computer.cancel":`取消`,"computer.add":`添加电脑`,"computer.addTitle":`添加一台电脑`,"computer.done":`完成`,"computer.code":`配对码`,"computer.codeHint":`10 分钟内有效,只能用一次`,"computer.remoteOff":`先打开远程访问,那台电脑才连得上这里。`,"computer.openRemote":`打开远程访问`,"computer.runThere":`在那台电脑上运行(把目录换成允许 Bot 读写的代码目录,可以写多个 --root):`,"computer.rootPlaceholder":`~/code`,"computer.rootHint":`那台电脑只需要 Node.js,不需要模型密钥。`,"computer.copy":`复制命令`,"computer.copied":`已复制`,"computer.brainPlaceholder":`https://<这台电脑的远程访问地址>`,"triggers.chats":`可以叫它的聊天`,"triggers.chatsHint":`在这些聊天里发“/{name} 要做的事”或“@Pisper {name} 要做的事”就能叫它。聊天与人的 ID 在聊天里发 /whoami 查看。`,"triggers.p2p":`私聊`,"triggers.group":`群聊`,"triggers.peers":`聊天 {ids}`,"triggers.allPeers":`所有聊天`,"triggers.senders":`{ids} 能叫它`,"triggers.ownerOnly":`只有你能叫它`,"triggers.remove":`删除`,"triggers.platform":`渠道`,"triggers.peerIds":`聊天 ID`,"triggers.peerIdsPlaceholder":`聊天 ID,多个用逗号分开;不填表示所有聊天`,"triggers.senderIds":`谁能叫它`,"triggers.senderIdsPlaceholder":`谁能叫它(ID,逗号分开);不填只有你`,"triggers.senderIdsRequired":`谁能叫它(ID,逗号分开);群聊必须填写`,"triggers.cancel":`取消`,"triggers.add":`添加`,"triggers.addChat":`添加聊天`,"triggers.feishu":`飞书`,"triggers.weixin":`微信`,"triggers.qq":`QQ`,"triggers.telegram":`Telegram`,"triggers.schedules":`定时让它做`,"triggers.scheduleEnabled":`启用这个定时`,"triggers.scheduleMessage":`要做的事`,"triggers.scheduleMessagePlaceholder":`例如:检查依赖有没有安全更新`,"triggers.frequency":`频率`,"triggers.daily":`每天`,"triggers.weekly":`每周`,"triggers.once":`一次`,"triggers.weekday":`星期`,"triggers.date":`日期`,"triggers.time":`时间`,"triggers.addSchedule":`添加定时`,"triggers.monday":`周一`,"triggers.tuesday":`周二`,"triggers.wednesday":`周三`,"triggers.thursday":`周四`,"triggers.friday":`周五`,"triggers.saturday":`周六`,"triggers.sunday":`周日`,"triggers.onceAt":`{date} {time} 一次`,"triggers.weeklyAt":`每{day} {time}`,"triggers.dailyAt":`每天 {time}`,"triggers.otherSchedule":`按定时任务页里的设置`,"new.shuffle":`换一个样子`,"new.chooseLook":`自己挑样子`,"new.duty":`它负责什么(可选)`,"new.dutyPlaceholder":`例如:审查 pisper 仓库的 PR;小问题直接改,其余只提建议。`,"new.folder":`工作目录`,"new.folderDefault":`不填就用默认工作目录`,"new.folderSummary":`在本机的默认工作目录里干活。`,"new.changeFolder":`换个目录`,"header.onComputer":`在 {computer} 上`,"settings.title":`设置`,"settings.changeLook":`换个样子`,"settings.doneLook":`选好了`,"settings.computer":`电脑`,"settings.computerSummary":`{computer} · {folder}`,"settings.chatsCount":`{count} 个聊天`,"settings.notSet":`未设置`,"settings.advanced":`高级`,"settings.advancedSummary":`权限、交付方式、工具、暂停`,"settings.botTitle":`{name}的设置`}),r.addResourceBundle(`en-US`,`bots`,{"sidebar.title":`Bots`,"sidebar.newBot":`New Bot`,"activity.idle":`Idle`,"activity.paused":`Paused, not taking new work`,"activity.review":`Changes waiting for you · {count} files`,"activity.failed":`The last task failed`,"activity.interrupted":`A task was interrupted`,"activity.working":`Working on: {title}`,"character.blob":`Blob`,"character.bean":`Bean`,"character.robot":`Robot`,"character.cat":`Cat`,"character.owl":`Owl`,"character.ghost":`Ghost`,"character.cloud":`Cloud`,"character.octo":`Octopus`,"character.bunny":`Bunny`,"character.bear":`Bear`,"character.fox":`Fox`,"character.star":`Star`,"new.title":`New Bot`,"new.description":`A name is all it needs. Say what it’s responsible for now, or tell it later in the chat.`,"new.name":`Name`,"new.namePlaceholder":`e.g. Reviewer`,"new.character":`Character`,"new.color":`Color`,"new.colorOption":`Color {index}`,"new.pick":`Choose…`,"new.cancel":`Cancel`,"new.create":`Start chatting`,"new.creating":`Creating…`,"page.disabledTitle":`Bots are turned off`,"page.disabledDescription":`Bots is a Labs feature. Turn it on in Settings › Labs.`,"page.openLabs":`Open Labs`,"page.loading":`Loading…`,"page.notFound":`This Bot no longer exists`,"page.emptyTitle":`No Bots yet`,"page.emptyDescription":`A Bot is a teammate that's always around: tell it what to do in the chat and it comes back when it's done.`,"header.closeDetails":`Close details`,"composer.label":`Message {name}`,"composer.placeholder":`Message {name}…`,"composer.followUp":`Keep talking to {name}… it continues on the same branch`,"composer.busy":`{name} is busy; new messages wait in line…`,"composer.send":`Send`,"conversation.label":`Chat with {name}`,"conversation.greeting":`Hi, I'm {name}. Tell me what to do. I'll work on a separate branch and hand the changes to you to confirm.`,"conversation.greetingHint":`For things I should always remember, open Settings (top right) and add them under “What it’s responsible for”.`,"card.queued":`Queued; starts when the previous work finishes`,"card.working":`Working…`,"card.stop":`Stop`,"card.review":`{count} files changed`,"card.showChanges":`View changes`,"card.discard":`Discard`,"card.acceptApply":`Accept and apply to current branch`,"card.failed":`The task failed`,"card.interrupted":`The task was interrupted`,"card.resume":`Continue`,"card.openSession":`Full log`,"card.discarded":`Discarded`,"card.applied":`Accepted and applied to the current branch (branch {branch} kept)`,"card.accepted":`Accepted; the changes are on branch {branch}`,"card.noChanges":`Done, no changes`,"details.tabChangesCount":`Changes · {count}`,"details.instructions":`What it’s responsible for`,"details.instructionsPlaceholder":`e.g. You review PRs in the pisper repo; fix small issues directly, otherwise only suggest; run npm test before concluding.`,"details.save":`Save`,"details.acceptsWork":`Accept new work`,"details.permission":`Permission limit`,"details.modeApproval":`Approval required`,"details.modeWorkspace":`Workspace write`,"details.modeFull":`Full access`,"details.delivery":`Delivery`,"details.deliveryDiff":`Changes for review`,"details.deliveryCommit":`Commit to task branch`,"details.deliveryReply":`Reply only`,"details.noChanges":`No changes waiting for you`,"details.loadingChanges":`Loading changes…`,"computer.description":`It reads and writes code and runs commands on this computer. You can switch it to another computer running pisper executor.`,"computer.runsOn":`Runs on`,"computer.local":`This computer`,"computer.isolated":`Separate branch per task`,"computer.shared":`Edit the folder directly`,"computer.currentBranch":`Working on branch {branch}`,"activity.approval":`Waiting for your approval`,"activity.question":`Has a question for you`,"waiting.approval":`Needs your approval: {tool}`,"waiting.allow":`Allow`,"waiting.deny":`Deny`,"waiting.critical":`This is a high-risk action. Allow it only if you are sure.`,"waiting.confirmAllow":`Yes, allow`,"waiting.cancel":`Cancel`,"waiting.truncated":`This is too long to show in full here. To allow it, review it in the full log first.`,"waiting.question":`{name} asks`,"waiting.otherLabel":`Your answer`,"waiting.otherPlaceholder":`Or type your answer…`,"waiting.answer":`Answer`,"waiting.skip":`Skip`,"waiting.answerInLog":`This question has several parts. Answer it in the full log.`,"details.tools":`Tools`,"details.toolsAll":`All tools`,"details.toolsReadOnly":`Read only`,"details.toolsCustom":`Custom ({count})`,"details.toolsHint":`Read only: it can read and search code but not edit files or run commands. Tools outside the scope are blocked before they run.`,"activity.environment":`Waiting for its computer to come online`,"computer.unnamed":`Unnamed computer`,"computer.online":`online`,"computer.offline":`offline`,"computer.option":`{name} ({state})`,"computer.folder":`Working folder`,"computer.folderPlaceholder":`/path/to/repo`,"computer.folderInRoots":`Must be inside a folder this computer allows: {roots}`,"computer.switch":`Switch here`,"computer.listTitle":`Computers`,"computer.usedBy":`Used by {names}`,"computer.remove":`Remove`,"computer.confirmRemove":`Yes, remove`,"computer.cancel":`Cancel`,"computer.add":`Add a computer`,"computer.addTitle":`Add a computer`,"computer.done":`Done`,"computer.code":`Pairing code`,"computer.codeHint":`valid for 10 minutes, single use`,"computer.remoteOff":`Turn on remote access first so the other computer can reach this one.`,"computer.openRemote":`Open remote access`,"computer.runThere":`Run this on that computer (replace the folder with the code folder Bots may use; repeat --root for more):`,"computer.rootPlaceholder":`~/code`,"computer.rootHint":`That computer only needs Node.js, no model keys.`,"computer.copy":`Copy commands`,"computer.copied":`Copied`,"computer.brainPlaceholder":`https://<remote-access-address-of-this-computer>`,"triggers.chats":`Chats that can call it`,"triggers.chatsHint":`In these chats, send “/{name} what to do” or “@Pisper {name} what to do”. Send /whoami in a chat to see its IDs.`,"triggers.p2p":`Direct`,"triggers.group":`Group`,"triggers.peers":`chats {ids}`,"triggers.allPeers":`all chats`,"triggers.senders":`{ids} can call it`,"triggers.ownerOnly":`only you can call it`,"triggers.remove":`Remove`,"triggers.platform":`Channel`,"triggers.peerIds":`Chat IDs`,"triggers.peerIdsPlaceholder":`Chat IDs, comma separated; empty means all chats`,"triggers.senderIds":`Who can call it`,"triggers.senderIdsPlaceholder":`Who can call it (IDs, comma separated); empty means only you`,"triggers.senderIdsRequired":`Who can call it (IDs, comma separated); required for groups`,"triggers.cancel":`Cancel`,"triggers.add":`Add`,"triggers.addChat":`Add a chat`,"triggers.feishu":`Feishu`,"triggers.weixin":`WeChat`,"triggers.qq":`QQ`,"triggers.telegram":`Telegram`,"triggers.schedules":`On a schedule`,"triggers.scheduleEnabled":`Schedule on`,"triggers.scheduleMessage":`What to do`,"triggers.scheduleMessagePlaceholder":`e.g. Check dependencies for security updates`,"triggers.frequency":`Frequency`,"triggers.daily":`Daily`,"triggers.weekly":`Weekly`,"triggers.once":`Once`,"triggers.weekday":`Day`,"triggers.date":`Date`,"triggers.time":`Time`,"triggers.addSchedule":`Add a schedule`,"triggers.monday":`Monday`,"triggers.tuesday":`Tuesday`,"triggers.wednesday":`Wednesday`,"triggers.thursday":`Thursday`,"triggers.friday":`Friday`,"triggers.saturday":`Saturday`,"triggers.sunday":`Sunday`,"triggers.onceAt":`Once on {date} at {time}`,"triggers.weeklyAt":`Every {day} at {time}`,"triggers.dailyAt":`Daily at {time}`,"triggers.otherSchedule":`As set on the Schedules page`,"new.shuffle":`Try another look`,"new.chooseLook":`Pick a look`,"new.duty":`What it’s responsible for (optional)`,"new.dutyPlaceholder":`e.g. Review PRs in the pisper repo; fix small issues, otherwise only suggest.`,"new.folder":`Working folder`,"new.folderDefault":`Leave empty for the default working folder`,"new.folderSummary":`Works in the default working folder on this computer.`,"new.changeFolder":`Change folder`,"header.onComputer":`on {computer}`,"settings.title":`Settings`,"settings.changeLook":`Change look`,"settings.doneLook":`Done`,"settings.computer":`Computer`,"settings.computerSummary":`{computer} · {folder}`,"settings.chatsCount":`{count} chats`,"settings.notSet":`Not set`,"settings.advanced":`Advanced`,"settings.advancedSummary":`Permissions, delivery, tools, pause`,"settings.botTitle":`{name}'s settings`});var S=new Set([`queued`,`preparing`,`running`]),C=[`read`,`grep`,`find`,`ls`];function w(e){if(e===null)return`all`;let t=[...e].sort();return t.length===C.length&&[...C].sort().every((e,n)=>t[n]===e)?`read-only`:`custom`}function T(e){return S.has(e)}function E(e){return e.activity?.needsYou?`need`:e.activity&&S.has(e.activity.status)?`running`:`idle`}function D(e,t){if(!t.enabled)return e(`bots:activity.paused`);let n=t.activity;if(!n)return e(`bots:activity.idle`);if(n.waiting===`approval`)return e(`bots:activity.approval`);if(n.waiting===`question`)return e(`bots:activity.question`);if(n.waiting===`environment`)return e(`bots:activity.environment`);switch(n.status){case`review`:return e(`bots:activity.review`,{count:n.changedFiles});case`failed`:return e(`bots:activity.failed`);case`interrupted`:return e(`bots:activity.interrupted`);case`queued`:case`preparing`:case`running`:return e(`bots:activity.working`,{title:n.title});default:return n.title}}var O=e(t(),1),k=n(),A=[`feishu`,`weixin`,`qq`,`telegram`];function j(e){return Array.isArray(e)?e.flatMap(e=>{let t=e&&typeof e==`object`?e:{};if(!A.includes(t.platform))return[];let n=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[];return[{platform:t.platform,chatType:t.chatType===`group`?`group`:`p2p`,peerIds:Array.isArray(t.peerIds)?n(t.peerIds):null,senderIds:n(t.senderIds)}]}):[]}var M=new Set([`queued`,`preparing`,`running`,`review`,`done`,`failed`,`interrupted`,`discarded`]);function N(e){if(!e||typeof e!=`object`||Array.isArray(e))throw s();return e}function P(e,t=``){return typeof e==`string`?e:t}function F(e){if(!M.has(String(e)))throw s();return e}function se(e){if(!e)return null;let t=N(e);return{taskId:P(t.taskId),status:F(t.status),title:P(t.title),changedFiles:Number(t.changedFiles)||0,needsYou:t.needsYou===!0,waiting:t.waiting===`approval`||t.waiting===`question`||t.waiting===`environment`?t.waiting:null,updatedAt:P(t.updatedAt)}}function I(e){if(!e)return null;let t=N(e),n=t.approval?N(t.approval):null,r=t.question?N(t.question):null,i={approval:n&&P(n.id)?{id:P(n.id),toolName:P(n.toolName),argsPreview:P(n.argsPreview),argsTruncated:n.argsTruncated===!0,severity:n.severity===`standard`?`standard`:`critical`,reason:P(n.reason)}:null,question:r&&P(r.id)?{id:P(r.id),prompt:P(r.prompt),header:P(r.header),options:Array.isArray(r.options)?r.options.filter(e=>typeof e==`string`):[],multiSelect:r.multiSelect===!0,count:Number(r.count)||1}:null};return i.approval||i.question?i:null}function L(e){let t=N(e),n=N(t.avatar??{}),r=N(t.workspace??{});if(typeof t.id!=`string`||typeof t.name!=`string`)throw s();return{id:t.id,name:t.name,avatar:{character:g(n.character)?n.character:`blob`,color:v(n.color)?n.color:`blue`},enabled:t.enabled!==!1,instructions:P(t.instructions),executionMode:t.executionMode===`workspace-write`||t.executionMode===`full-access`?t.executionMode:`approval-required`,delivery:t.delivery===`reply-only`||t.delivery===`commit`?t.delivery:`diff`,channels:j(t.channels),tools:Array.isArray(t.tools)?t.tools.filter(e=>typeof e==`string`):null,workspace:{environmentId:P(r.environmentId,`local`),cwd:P(r.cwd),isolation:r.isolation===`shared`?`shared`:`worktree`},threadSessionId:P(t.threadSessionId),activity:se(t.activity)}}function R(e){let t=N(e);if(typeof t.id!=`string`||typeof t.botId!=`string`)throw s();let n=Array.isArray(t.turns)?t.turns.map(e=>{let t=N(e);return{text:P(t.text),at:P(t.at),...typeof t.reply==`string`?{reply:t.reply}:{}}}):[{text:P(t.request),at:P(t.createdAt)}],r=t.workspace?N(t.workspace):null,i=t.result?N(t.result):null,a=t.error?N(t.error):null;return{id:t.id,botId:t.botId,status:F(t.status),title:P(t.title),turns:n,sessionId:typeof t.sessionId==`string`&&t.sessionId?t.sessionId:null,workspace:r?{kind:r.kind===`shared`?`shared`:`worktree`,branch:P(r.branch)||void 0,path:P(r.path)||void 0,state:P(r.state)}:null,result:i?{summary:P(i.summary),changedFiles:Number(i.changedFiles)||0,commit:P(i.commit)||void 0,applied:i.applied===!0,branch:P(i.branch)||void 0}:null,error:a?{code:P(a.code),message:P(a.message)}:null,waiting:I(t.waiting),createdAt:P(t.createdAt),updatedAt:P(t.updatedAt)}}function z(e){let t=N(e);if(!Array.isArray(t.files)||typeof t.diff!=`string`)throw s();return{files:t.files.map(e=>{let t=N(e);return{status:P(t.status),path:P(t.path)}}),diff:t.diff,truncated:t.truncated===!0}}function B(e,t){return n=>t(N(n)[e])}function V(e){return o(`/api/bots`,{signal:e,parse:e=>{let t=N(e).bots;if(!Array.isArray(t))throw s();return t.map(L)}})}function H(e){return o(`/api/bots`,{method:`POST`,data:e,parse:B(`bot`,L)})}function U(e,t){return o(`/api/bots/${encodeURIComponent(e)}`,{method:`PATCH`,data:t,parse:B(`bot`,L)})}function W(e,t){return o(`/api/bots/${encodeURIComponent(e)}/messages`,{method:`POST`,data:{text:t},parse:B(`task`,R)})}function G(e,t){return o(`/api/bot-tasks?botId=${encodeURIComponent(e)}&limit=50`,{signal:t,parse:e=>{let t=N(e).tasks;if(!Array.isArray(t))throw s();return t.map(R).reverse()}})}function K(e,t){return o(`/api/bot-tasks/${encodeURIComponent(e)}/diff`,{signal:t,parse:z})}function ce(e,t,n){return o(`/api/bot-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`,data:n??{},parse:B(`task`,R)})}function le(e,t,n){return o(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`,{method:`POST`,data:{approved:n},parse:()=>void 0})}function ue(e,t,n){return o(`/api/sessions/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}`,{method:`POST`,data:`skip`in n?{skip:!0}:{answers:[n]},parse:()=>void 0})}function q(e){let t=e&&typeof e==`object`?e:{};return{enabled:t.enabled===!0,endpoints:Array.isArray(t.endpoints)?t.endpoints.filter(e=>typeof e==`string`&&/^https:\/\//.test(e)):[],fingerprint:typeof t.fingerprint==`string`?t.fingerprint:null}}function de(e){let t=N(e);if(typeof t.id!=`string`||!t.id)throw s();let n=t.capabilities&&typeof t.capabilities==`object`?t.capabilities:{};return{id:t.id,kind:t.kind===`node`?`node`:`local`,name:P(t.name),online:t.online===!0,roots:Array.isArray(t.roots)?t.roots.filter(e=>typeof e==`string`):[],shell:n.shell===!0,usedBy:Array.isArray(t.usedBy)?t.usedBy.flatMap(e=>{let t=e&&typeof e==`object`?e:{};return typeof t.id==`string`&&typeof t.name==`string`?[{id:t.id,name:t.name}]:[]}):[],lastSeenAt:typeof t.lastSeenAt==`string`?t.lastSeenAt:null}}function fe(e){return o(`/api/environments`,{signal:e,parse:e=>{let t=N(e);if(!Array.isArray(t.environments))throw s();return{environments:t.environments.map(de),remote:q(t.remote)}}})}function pe(){return o(`/api/environments/pairing`,{method:`POST`,data:{},parse:e=>{let t=N(e),n=N(t.pairing);if(typeof n.code!=`string`)throw s();return{code:n.code,expiresAt:P(n.expiresAt),remote:q(t.remote)}}})}function me(e){return o(`/api/environments/${encodeURIComponent(e)}`,{method:`DELETE`,parse:()=>void 0})}function he(e,t){let n=N(e).tasks;if(!Array.isArray(n))throw s();return n.flatMap(e=>{let n=e&&typeof e==`object`?e:{};if(n.targetType!==`bot`||n.botId!==t||typeof n.id!=`string`)return[];let r=[`once`,`interval`,`daily`,`weekly`,`monthly`].includes(String(n.frequency))?n.frequency:`daily`;return[{id:n.id,enabled:n.enabled!==!1,botMessage:P(n.botMessage),frequency:r,time:P(n.time),date:P(n.date),dayOfWeek:Number(n.dayOfWeek)||0,nextRunAt:typeof n.nextRunAt==`string`?n.nextRunAt:null}]})}function ge(e,t){return o(`/api/schedules`,{signal:t,parse:t=>he(t,e)})}function _e(e){return o(`/api/schedules`,{method:`POST`,data:{...e,targetType:`bot`,enabled:!0},parse:()=>void 0})}function ve(e,t){return o(`/api/schedules/${encodeURIComponent(e)}`,{method:`PATCH`,data:{enabled:t},parse:()=>void 0})}function ye(e){return o(`/api/schedules/${encodeURIComponent(e)}`,{method:`DELETE`,parse:()=>void 0})}var J=null,Y=a()((e,t)=>({bots:[],loaded:!1,error:``,load:()=>(J??=V().then(t=>e({bots:t,loaded:!0,error:``})).catch(t=>e({loaded:!0,error:t instanceof Error?t.message:String(t)})).finally(()=>{J=null}),J),upsert:n=>{let r=t().bots;e({bots:r.findIndex(e=>e.id===n.id)<0?[...r,n]:r.map(e=>e.id===n.id?{...n,activity:e.activity}:e)})}}));function be(e){let t=Y(e=>e.load),n=Y(e=>e.bots.some(e=>[`queued`,`preparing`,`running`].includes(e.activity?.status??``)));(0,O.useEffect)(()=>{if(!e)return;t();let r=window.setInterval(()=>{document.visibilityState===`visible`&&t()},n?3e3:1e4);return()=>window.clearInterval(r)},[e,n,t])}function X(e,t){switch(t){case`bean`:return e(`bots:character.bean`);case`robot`:return e(`bots:character.robot`);case`cat`:return e(`bots:character.cat`);case`owl`:return e(`bots:character.owl`);case`ghost`:return e(`bots:character.ghost`);case`cloud`:return e(`bots:character.cloud`);case`octo`:return e(`bots:character.octo`);case`bunny`:return e(`bots:character.bunny`);case`bear`:return e(`bots:character.bear`);case`fox`:return e(`bots:character.fox`);case`star`:return e(`bots:character.star`);default:return e(`bots:character.blob`)}}function xe(e,t){return e(t===`full-access`?`bots:details.modeFull`:t===`workspace-write`?`bots:details.modeWorkspace`:`bots:details.modeApproval`)}function Se(e,t){return e(t===`reply-only`?`bots:details.deliveryReply`:t===`commit`?`bots:details.deliveryCommit`:`bots:details.deliveryDiff`)}function Z(e,t){return e(t===`weixin`?`bots:triggers.weixin`:t===`qq`?`bots:triggers.qq`:t===`telegram`?`bots:triggers.telegram`:`bots:triggers.feishu`)}function Q(e,t){switch(t){case 0:return e(`bots:triggers.sunday`);case 2:return e(`bots:triggers.tuesday`);case 3:return e(`bots:triggers.wednesday`);case 4:return e(`bots:triggers.thursday`);case 5:return e(`bots:triggers.friday`);case 6:return e(`bots:triggers.saturday`);default:return e(`bots:triggers.monday`)}}function Ce(e,t){return t.frequency===`once`?e(`bots:triggers.onceAt`,{date:t.date,time:t.time}):t.frequency===`weekly`?e(`bots:triggers.weeklyAt`,{day:Q(e,t.dayOfWeek),time:t.time}):t.frequency===`daily`?e(`bots:triggers.dailyAt`,{time:t.time}):e(`bots:triggers.otherSchedule`)}function we(e){return[...new Set(e.split(/[\s,,、]+/).map(e=>e.trim()).filter(Boolean))]}function $({value:e,onChange:t,disabled:n=!1}){let{t:r}=i();return(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.character`),className:`grid grid-cols-6 gap-2`,children:y.map(i=>(0,k.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.character===i,"aria-label":X(r,i),title:X(r,i),className:l(`grid place-items-center rounded-[12px] p-0.5 ring-offset-2 ring-offset-surface-raised`,e.character===i&&`ring-2 ring-content`),onClick:()=>t({...e,character:i}),children:(0,k.jsx)(x,{avatar:{...e,character:i},size:40,animate:!1})},i))}),(0,k.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.color`),className:`flex gap-2`,children:_.map(i=>(0,k.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.color===i,"aria-label":r(`bots:new.colorOption`,{index:_.indexOf(i)+1}),className:l(`rounded-full p-0.5 ring-offset-2 ring-offset-surface-raised`,e.color===i&&`ring-2 ring-content`),onClick:()=>t({...e,color:i}),children:(0,k.jsx)(x,{avatar:{...e,color:i},size:24,animate:!1,className:`rounded-full`})},i))})]})}function Te({open:e,onOpenChange:t,onCreated:n}){let{t:r}=i(),a=Y(e=>e.upsert),[o,s]=(0,O.useState)(``),[c,l]=(0,O.useState)(``),[g,_]=(0,O.useState)(b),[v,y]=(0,O.useState)(!1),[S,C]=(0,O.useState)(``),[w,T]=(0,O.useState)(!1),[E,D]=(0,O.useState)(!1),[A,j]=(0,O.useState)(!1),[M,N]=(0,O.useState)(``);return(0,O.useEffect)(()=>{e&&(_(b()),y(!1),T(!1),N(``))},[e]),(0,k.jsx)(ie,{open:e,onOpenChange:t,children:(0,k.jsxs)(d,{className:`sm:max-w-[440px]`,children:[(0,k.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),j(!0),N(``);try{let e=await H({name:o.trim(),avatar:g,instructions:c.trim(),workspace:{cwd:S.trim()}});a(e),t(!1),s(``),l(``),C(``),n(e)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},className:`flex flex-col gap-4`,children:[(0,k.jsxs)(re,{children:[(0,k.jsx)(f,{children:r(`bots:new.title`)}),(0,k.jsx)(ne,{children:r(`bots:new.description`)})]}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`group relative flex-none rounded-[28%]`,"aria-label":r(`bots:new.shuffle`),title:r(`bots:new.shuffle`),onClick:()=>_(b()),children:[(0,k.jsx)(x,{avatar:g,size:56}),(0,k.jsx)(`span`,{className:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full border border-stroke bg-surface-raised text-content-muted group-hover:text-content`,children:(0,k.jsx)(oe,{className:`size-3`,"aria-hidden":`true`})})]}),(0,k.jsxs)(h,{variant:`control`,className:`flex-1`,children:[r(`bots:new.name`),(0,k.jsx)(m,{value:o,autoFocus:!0,maxLength:24,placeholder:r(`bots:new.namePlaceholder`),onChange:e=>s(e.target.value)})]})]}),v?(0,k.jsx)($,{value:g,onChange:_}):(0,k.jsx)(`button`,{type:`button`,className:`-mt-2 self-start text-xs text-content-muted underline-offset-2 hover:text-content hover:underline`,onClick:()=>y(!0),children:r(`bots:new.chooseLook`)}),(0,k.jsxs)(h,{variant:`control`,children:[r(`bots:new.duty`),(0,k.jsx)(ae,{value:c,rows:3,maxLength:12e3,placeholder:r(`bots:new.dutyPlaceholder`),onChange:e=>l(e.target.value)})]}),w?(0,k.jsxs)(h,{variant:`control`,children:[r(`bots:new.folder`),(0,k.jsxs)(`span`,{className:`flex gap-2`,children:[(0,k.jsx)(m,{value:S,className:`font-mono`,placeholder:r(`bots:new.folderDefault`),onChange:e=>C(e.target.value)}),(0,k.jsxs)(u,{type:`button`,variant:`outline`,onClick:()=>D(!0),children:[(0,k.jsx)(te,{"aria-hidden":`true`}),r(`bots:new.pick`)]})]})]}):(0,k.jsxs)(`p`,{className:`text-xs text-content-muted`,children:[r(`bots:new.folderSummary`),` `,(0,k.jsx)(`button`,{type:`button`,className:`text-content-secondary underline underline-offset-2 hover:text-content`,onClick:()=>T(!0),children:r(`bots:new.changeFolder`)})]}),M&&(0,k.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:M}),(0,k.jsxs)(p,{children:[(0,k.jsx)(u,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:r(`bots:new.cancel`)}),(0,k.jsx)(u,{type:`submit`,disabled:A||!o.trim(),children:r(A?`bots:new.creating`:`bots:new.create`)})]})]}),(0,k.jsx)(ee,{open:E,initialPath:S,onOpenChange:D,onSelect:e=>{C(e),D(!1)}})]})})}export{T as A,W as C,D,C as E,E as O,le as S,U as T,ge as _,Z as a,fe as b,Q as c,A as d,ue as f,ye as g,pe as h,xe as i,w as k,be as l,_e as m,$ as n,Ce as o,ce as p,Se as r,we as s,Te as t,Y as u,K as v,ve as w,me as x,G as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CUS2_EGy.js";import{u as i}from"./api-CKJOip3Q.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{t as o}from"./folder-plus-OPHZsJho.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-Cb_sjjQV.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-B__qKy-X.js";import{r as S,t as C}from"./folder-paths--euvEC5U.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CUS2_EGy.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-IA6Uq_O6.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CUS2_EGy.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-DuRlD5qg.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CUS2_EGy.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import"./public-D6X148yH.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-DuRlD5qg.js";import{t as a}from"./useSidebarModel-6sqN4VA5.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CUS2_EGy.js";import{t as n}from"./PhoneMenuButton-BjDV-dPl.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CUS2_EGy.js";import{t as i}from"./api-CKJOip3Q.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-D2d_9z0D.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as ne,i as E,l as D,n as O,o as k,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-IA6Uq_O6.js";import{a as M,i as N,l as P,o as F,s as I,t as L}from"./dialog-Cb_sjjQV.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ce}from"./pick-system-directory-B__qKy-X.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-B3wCvGpC.js";import{t as U}from"./AppSelect-BD6RAaJ5.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-ghvpPFmc.js";var K=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),q=e(t(),1),J=n(),Y=Object.defineProperty,X=(e,t)=>Y(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[D]),Z=D(),we=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ne,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(k,{...r,...n})},`AlertDialogPortal`),Q=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=Se(`AlertDialogContent`),De=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=q.useRef(null),s=S(t,o),c=q.useRef(null);return(0,J.jsx)(Ee,{scope:n,cancelRef:c,children:(0,J.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(E,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(O,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Z(n),o=S(t,i);return(0,J.jsx)(O,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=we,Pe=Te,Fe=Q,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,J.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,J.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,J.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,J.jsxs)(He,{children:[(0,J.jsx)(Ue,{}),(0,J.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,J.jsx)(ze,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,J.jsx)(Be,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Le,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,J.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,J.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,J.jsx)(M,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await ce(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,J.jsx)(p,{})})]})]}),l&&(0,J.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,J.jsx)(c,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,J.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,J.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,J.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,J.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,J.jsxs)(he,{className:`m-0`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`span`,{children:m})]})]}),(0,J.jsxs)(F,{children:[(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,J.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,J.jsx)(oe,{className:`text-current`}):l?(0,J.jsx)(K,{}):(0,J.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,J.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,J.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,J.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,J.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,J.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,J.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,J.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,J.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,J.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,J.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,J.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(null),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[ee,b]=(0,q.useState)(``),x=(0,q.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,q.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},ne=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,J.jsxs)(J.Fragment,{children:[ne.map(e=>(0,J.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,J.jsx)(B,{children:e.items.map(t=>(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,J.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,J.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,J.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,J.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,J.jsx)(K,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,J.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,J.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,J.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,J.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,J.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,q.useState)(``),[h,v]=(0,q.useState)(null),[y,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(``),[T,ne]=(0,q.useState)(`all`),[E,D]=(0,q.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[O,k]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[ae,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(!1),[L,R]=(0,q.useState)(``),[ce,H]=(0,q.useState)(!1),U=(0,q.useCallback)(e=>{v(e),S(e.plugins),D(e.webSearch)},[]),W=(0,q.useCallback)(async()=>{R(``);try{U(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[U]);(0,q.useEffect)(()=>{W()},[W]);let G=(0,q.useMemo)(()=>ot(y),[y]),Y=(0,q.useMemo)(()=>at(y),[y]),X=h?!lt(Y,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(E)!==JSON.stringify(h.webSearch):!1,Se=(0,q.useCallback)(async()=>{if(!O){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}k(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:Y,webSearch:E,computerUseEnabled:st(y),piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[U,h,X,y,Y,e,O,c,E]),Ce=async()=>{ie(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(E)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{ie(!1)}},Z=(e,t,n)=>{S(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},we=()=>!X||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),Te=async()=>{if(!(!N||F)){I(!0),R(``);try{U(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),w(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Q=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,J.jsxs)(fe,{title:Q,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(pe,{search:(0,J.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>we()&&M(!0),children:[(0,J.jsx)(K,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,J.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:O,disabled:!h||O,onClick:()=>void Se(),children:[(0,J.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,J.jsx)(me,{options:f.map(e=>it(e,c)),value:it(T,c),onChange:e=>ne(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,J.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,J.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,J.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,J.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,J.jsx)(t,{}),name:(0,J.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,J.jsx)(ge,{value:e.enabled,onChange:t=>Z(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,J.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,J.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,J.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,J.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,J.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,J.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,J.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,J.jsx)(ft,{value:E,testing:re,onChange:D,onTest:Ce}),!e.pluginBuiltIn&&(0,J.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>we()&&P(e),children:[(0,J.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,J.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,J.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,J.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,J.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:ce,disabled:ce,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,J.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,J.jsx)(Qe,{open:ae,onOpenChange:M,onInstalled:W}),(0,J.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,J.jsxs)(We,{className:`z-[220]`,children:[(0,J.jsxs)(Ge,{children:[(0,J.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,J.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,J.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:Te,children:[F&&(0,J.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,J.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,J.jsx)(b,{size:13}),L]})]})}export{mt as PluginsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CUS2_EGy.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-Cb_sjjQV.js";import{t as d}from"./safe-mode-instance-hnF1BJYr.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-CUS2_EGy.js";import{t as a}from"./api-CKJOip3Q.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-BJhBGRH0.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{n as f,t as p}from"./send-QxBfLFo-.js";import{t as m}from"./play-DNDjDNGn.js";import{t as h}from"./plus-fQbSqB1n.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-IA6Uq_O6.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-Cb_sjjQV.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-B__qKy-X.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-B3wCvGpC.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-BD6RAaJ5.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:p}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[m,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===m),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===m).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,m]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(h,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=m===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:p,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(m,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:p,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:m,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:m,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,m,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(h,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-CBju_Sj4.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CUS2_EGy.js","assets/i18n-DEs6BBob.js","assets/vendor-router-CSN_DGvx.js","assets/index-C5aKcTGw.js","assets/index-DD2H2OOC.css","assets/storage-DH3bQdy6.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-CZTn9wa-.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-C2acHnAH.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-BD6RAaJ5.js","assets/use-mobile-C2tPBAza.js","assets/select-DD_WO-gs.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/dist-V8chnW6-.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-CI_5lWbf.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-D8YqjbeC.js","assets/api-CKJOip3Q.js","assets/abort-signal-f4JsiYKX.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-Cb_sjjQV.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-BDztlYIy.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-CUS2_EGy.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-up-DST6-qVQ.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{t as d}from"./earth-Ddy13fHh.js";import{t as f}from"./external-link-CEQqPcqc.js";import{t as p}from"./file-Bllajneu.js";import{M as m,a as h,i as g,l as _,m as v,o as y,p as b,r as x}from"./side-chat-context-CZ4IqNxt.js";import{t as S}from"./git-branch-N7LGjtzt.js";import{t as C}from"./image-BY_c3FYU.js";import{t as w}from"./link-2-mgasYn21.js";import{t as T}from"./message-square-SKjZyY3v.js";import{t as E}from"./refresh-cw-TbWxTY4K.js";import{t as D}from"./square-bHHVTT3G.js";import"./tooltip-D4MFbqcG.js";import{t as O}from"./utils-C8uzG5AZ.js";import{n as k,t as A}from"./button-CCcCN8tE.js";import{c as ee,r as te}from"./shortcuts-IA6Uq_O6.js";import{t as j}from"./chat-api-Bvirerdj.js";import{t as M}from"./input-CPw-zkYh.js";import{n as N}from"./session-change-summary-api-DmmNGbP7.js";import{n as P,t as F}from"./PageState-Cz6vFMXv.js";import{t as I}from"./AppSelect-BD6RAaJ5.js";import{i as L}from"./GitDiffViewer-CBju_Sj4.js";import{t as R}from"./web-preview-Dgng80ZD.js";import"./collapsible-Dcoy-qnz.js";import{o as z}from"./session-tree-summary-BXVKYODc.js";var B=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),V=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),H=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),U=e(n(),1),W=r(),G={completed:`completed`,in_progress:`running`,blocked:`blocked`,pending:`pending`};function K(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function q({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,W.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${G[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,W.jsx)(c,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,W.jsx)(k,{className:`size-3.5`}):e===`blocked`?(0,W.jsx)(H,{size:11,strokeWidth:2}):(0,W.jsx)(B,{size:11,strokeWidth:2}),(0,W.jsx)(`span`,{className:`sr-only`,children:n})]})}function J({item:e,current:t,t:n}){return(0,W.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,W.jsx)(q,{status:e.blocked?`blocked`:e.status,t:n}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,W.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:n(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,W.jsx)(m,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,W.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:n(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,W.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,W.jsx)(H,{size:11,className:`flex-none`}),(0,W.jsx)(`span`,{className:`truncate`,children:n(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function Y({plan:e,header:t,collapsible:n=!1}){let{t:r}=i(),a=(0,U.useRef)(null),[o,s]=(0,U.useState)(!0),c=e?.items||[],u=K(c),d=u.filter(e=>e.status===`completed`).length,f=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,p=u.filter(e=>e.blocked).length,m=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,U.useLayoutEffect)(()=>{if(n&&!o)return;let e=a.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top?e.scrollTop-=r.top-i.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[n,m,o,u.length]),!c.length)return null;let h=u.find(e=>e.id===m),g=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{className:`flex-none text-content-muted`,size:15}),(0,W.jsx)(`strong`,{className:`tabular-nums`,children:r(`chat:planBoard.progress`,{completed:d,total:c.length})}),h?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:h.title,children:h.title}):null,(0,W.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[f>0&&(0,W.jsx)(`span`,{children:r(`chat:planBoard.countInProgress`,{count:f})}),p>0&&(0,W.jsx)(`span`,{className:`blocked text-danger`,children:r(`chat:planBoard.countBlocked`,{count:p})})]}),t,n?(0,W.jsx)(l,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),_=(0,W.jsx)(`ul`,{ref:a,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,W.jsx)(J,{item:e,current:e.id===m,t:r},e.id))});return n?(0,W.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:o,onToggle:e=>s(e.currentTarget.open),children:[(0,W.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":r(`chat:planBoard.toggleAriaLabel`),children:g}),_]}):(0,W.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":r(`chat:planBoard.ariaLabel`),children:[(0,W.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:g}),_]})}var X=(0,U.memo)(Y),ne=(0,U.lazy)(()=>t(()=>import(`./GitDiffViewer-CBju_Sj4.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])));function Z({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?j.getFileDiff(e,t,{signal:r}):j.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,W.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,W.jsx)(k,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,W.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,W.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,W.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(ne,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function re({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>j.getVcsChanges(e,{signal:t})}),l=L(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),d=(0,U.useMemo)(()=>b(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),f=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),p=c.error?.message||c.data?.error,m=c.data?.files||[];return(0,W.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!p&&(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,d.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.removed]})]}),(0,W.jsx)(A,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,W.jsx)(E,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,W.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,W.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,W.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,W.jsx)(S,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsx)(A,{variant:`ghost`,size:`sm`,disabled:!m.length||!!p,onClick:()=>o({expandedFiles:m.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,W.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!p&&f.map(e=>(0,W.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,W.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):p?(0,W.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:p}):c.data?.isRepo?m.length?(0,W.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:m.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,W.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,W.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,W.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,W.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(d.files,t.path)&&(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,d.files[t.path].added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.files[t.path].removed]})]})]}),n&&(0,W.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,W.jsx)(Z,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,W.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,W.jsx)(F,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function ie({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,U.useState)(0),[s,c]=(0,U.useState)(0),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!0),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)(null),T=(0,U.useRef)(!1),E=(0,U.useRef)(0),D=(0,U.useRef)(0),O=(0,U.useRef)(!0),k=(0,U.useRef)(!1),A=(0,U.useRef)(t);return(0,U.useLayoutEffect)(()=>{A.current=t},[t]),(0,U.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,U.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),j.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await j.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Q(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await j.approveSessionFileChanges(e,t.path):await j.revertSessionFileChanges(e,t.path);if(N(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Q(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var ae=(0,U.lazy)(()=>t(()=>import(`./TaskTerminalView-C2acHnAH.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,20,11,21,15,14,16,13,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),oe=(0,U.lazy)(()=>t(()=>import(`./TaskProcessesPane-CI_5lWbf.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,39,11,20,21,40,26,16,30,35,13,14,15,22,23,24,25,27,28,29,31,32,33,34,36]))),se=(0,U.lazy)(()=>t(()=>import(`./FileAttachmentPreview-D8YqjbeC.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,42,43,44,11,45,46,12,47,14,30,16,32,48,13,15,49,50,51,33,52,53,54,55,56,26,57,58])));function ce({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=L(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,U.useContext)(v),[s,c]=(0,U.useState)(``),l=(0,U.useRef)(null),d=e.find(e=>e.id===s),f=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,W.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,W.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,W.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,W.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,W.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,W.jsx)(M,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,W.jsxs)(I,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,W.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,W.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,W.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,W.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,W.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!f.length&&(0,W.jsx)(F,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),f.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?C:e.method===`path`?w:p;return(0,W.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,W.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,W.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,W.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,W.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,W.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,W.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,W.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,W.jsx)(A,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),d&&(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(se,{attachment:d.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function le({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:c}=x(e),l=r.session?.id??``,u=(0,U.useMemo)(()=>e=>a.subscribeSessionState(l,e),[a,l]),d=(0,U.useMemo)(()=>()=>a.getSessionState(l),[a,l]),f=(0,U.useSyncExternalStore)(u,d),[p,m]=(0,U.useState)(!1),[v,b]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),w=(0,U.useRef)(!1),E=(0,U.useRef)(!1),O=(0,U.useRef)(r.draft);O.current=r.draft;let j=(0,U.useRef)(null),M=ee(e=>e.bindings),N=g(f,r.session);(0,U.useEffect)(()=>{t&&o(e)},[t,o,e]);let P=async t=>{t.preventDefault();let n=O.current.trim();if(!(!n||w.current||N||r.expired)){w.current=!0,m(!0),C(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;O.current.trim()===n&&c(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){C(z(e))}finally{w.current=!1,m(!1)}}},F=(0,U.useCallback)(async()=>{if(!(!l||a.getSessionState(l).streaming)){C(``);try{await a.retry(l),await o(e)}catch(e){C(z(e))}}},[o,e,a,l]),I=async()=>{if(!(!l||v)){b(!0);try{C(``),await a.abort(l)}catch(e){C(z(e))}finally{b(!1)}}},L=(0,W.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,W.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,W.jsx)(T,{className:`size-4`,"aria-hidden":`true`})}),(0,W.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&j.current?.focus()},children:[r.loading&&(0,W.jsx)(k,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),R=S||r.error||f.error;return(0,W.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,W.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),l?(0,W.jsx)(y,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:L,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:N,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(l),onRetryLastTurn:F}):(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:L}),(0,W.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:P,children:[R&&(0,W.jsx)(_,{error:R,onRetry:r.error||!f.loaded?async()=>{await o(e)}:F}),(0,W.jsx)(h,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(l,e,t)}catch{}}}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,W.jsx)(`textarea`,{ref:j,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>c(e,t.target.value),onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1},onKeyDown:e=>{!E.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&te(e.nativeEvent,M.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,W.jsx)(A,{type:N?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(N?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:N?v:p||r.loading||r.expired||!r.draft.trim(),onClick:N?()=>void I():void 0,children:p||v?(0,W.jsx)(k,{className:`size-4 text-current`}):N?(0,W.jsx)(D,{size:13,fill:`currentColor`}):(0,W.jsx)(s,{size:17})})]})]})]})}var $=(0,U.createContext)(null),ue=()=>{let e=(0,U.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},de=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,U.useState)(n),[s,c]=(0,U.useState)(!1),l=(0,U.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,U.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,W.jsx)($.Provider,{value:u,children:(0,W.jsx)(`div`,{className:O(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},fe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ue();return(0,W.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,W.jsx)(`iframe`,{className:O(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})};function pe({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,U.useState)(!1);return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,W.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=R(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,W.jsx)(M,{"aria-label":n(`common:webPreview.url`),className:`flex-1 font-mono`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,W.jsx)(A,{type:`submit`,variant:`secondary`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,W.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,W.jsx)(de,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:a,children:(0,W.jsx)(fe,{src:a,title:n(`common:webPreview.title`)})},a):(0,W.jsx)(F,{icon:d,className:`min-h-0 flex-1`,title:n(`chat:sessionContext.browserEmpty`)}),a&&(0,W.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,W.jsx)(f,{size:14}),n(`common:webPreview.openExternal`)]}),(0,W.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`common:webPreview.embedNotice`)})]})}export{ae as a,Z as c,oe as i,X as l,le as n,ie as o,ce as r,re as s,pe as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-CBju_Sj4.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CUS2_EGy.js","assets/i18n-DEs6BBob.js","assets/vendor-router-CSN_DGvx.js","assets/index-C5aKcTGw.js","assets/index-DD2H2OOC.css","assets/storage-DH3bQdy6.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-CZTn9wa-.js","assets/esm-DCV8yILT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-CUS2_EGy.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-D2d_9z0D.js";import{a as s}from"./permission-rules-api-C9oRUm6Z.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-B3weAiaB.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./file-diff-GxOMJkLj.js";import{F as S,L as C,N as w,_ as T,g as E,h as D}from"./side-chat-context-CZ4IqNxt.js";import{t as O}from"./link-2-mgasYn21.js";import{t as k}from"./message-square-SKjZyY3v.js";import{t as A}from"./plus-fQbSqB1n.js";import{t as j}from"./refresh-cw-TbWxTY4K.js";import{t as M}from"./square-terminal-BVG6cUT1.js";import{t as N}from"./x-07u4-129.js";import{n as P,t as F}from"./button-CCcCN8tE.js";import{s as I}from"./events-CZTn9wa-.js";import{a as ee,n as te,o as ne,t as re}from"./sheet-BTaIEX4w.js";import{t as L}from"./input-CPw-zkYh.js";import{n as R,t as z}from"./PageState-Cz6vFMXv.js";import{i as B}from"./GitDiffViewer-CBju_Sj4.js";import{t as V}from"./web-preview-Dgng80ZD.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-CBju_Sj4.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=B(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:S,snapshotRevision:C,writesDisabled:T,pendingCount:E,reversibleCount:D,displayedError:O,notice:k,viewDiff:A,runAction:M,refresh:N}=g({sessionId:e,streaming:t,requestConfirm:n}),I=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(F,{type:`button`,variant:`ghost`,size:`icon`,className:I,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:N,children:(0,U.jsx)(j,{className:_?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),E>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:E})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(F,{type:`button`,variant:`secondary`,size:`sm`,disabled:T||E===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void M({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,U.jsx)(j,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(F,{type:`button`,variant:`secondary`,size:`sm`,disabled:T||D===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void M({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,U.jsx)(j,{className:`animate-spin`,size:14}):(0,U.jsx)(w,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(F,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(F,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),O&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:O}),k&&!O&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:k}),_&&!h?(0,U.jsx)(R,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=p.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":S===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),S===t.path?(0,U.jsx)(P,{className:`size-3.5`}):(0,U.jsx)(x,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(F,{type:`button`,variant:`ghost`,size:`icon`,className:I,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:T||!t.pending||t.approved||t.reverted,onClick:()=>void M({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(F,{type:`button`,variant:`ghost`,size:`icon`,className:I,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:T||t.reverted||!t.canRevert,onClick:()=>void M({kind:`revert`,path:t.path}),children:(0,U.jsx)(w,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:C}),(0,U.jsx)(F,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void A(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!O&&(0,U.jsx)(z,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(a,window.location.href);c(!t),t&&n(t)},children:[(0,U.jsx)(L,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(F,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(F,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:w,streaming:j,plansAvailable:P,requestConfirm:L,onTabChange:R,onClose:B,onBack:V}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:M,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:x,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:O,label:W(`chat:workbench.sources`)},{id:`files`,icon:C,label:W(`chat:workbench.taskSnapshots`)},...P?[{id:`plan`,icon:S,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:k,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>E(g),[g]),J=D(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:A,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!D.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(I));let t=T(J,e);D.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&B()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(F,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(A,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[V&&(0,U.jsx)(F,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:V,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(N,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),D.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(v,{sessionId:l,cwd:u,streaming:j,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>D.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(p,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:j,requestConfirm:L}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:w?.items?.length?(0,U.jsx)(m,{plan:w}):(0,U.jsx)(z,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(re,{open:!0,onOpenChange:e=>!e&&B(),children:(0,U.jsxs)(te,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(ee,{className:`sr-only`,children:(0,U.jsx)(ne,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-CUS2_EGy.js";import{n as s,t as c}from"./usePhoneShell-cYrS53S8.js";import"./public-D6X148yH.js";import{t as l}from"./PhoneMenuButton-BjDV-dPl.js";import{t as u}from"./button-CCcCN8tE.js";import{a as d}from"./board-projects-wd79Rqt5.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-BAFT2Fk1.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=d(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(l,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(u,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(u,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
|