pisper 0.6.28 → 0.6.29
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/package.json +6 -6
- package/web/.vite/manifest.json +654 -641
- package/web/assets/{AppDialog-Cjnspn8J.js → AppDialog-CX0n4qav.js} +1 -1
- package/web/assets/{AppOverlays-ielr5J2J.js → AppOverlays-J_rOhlw3.js} +1 -1
- package/web/assets/{AssetsPage-BC1mYvQw.js → AssetsPage-BuAZJf2M.js} +1 -1
- package/web/assets/{BoardPage-BS3oBeRU.js → BoardPage-BT684h8Y.js} +3 -3
- package/web/assets/{ChannelsPage-DOysYIcY.js → ChannelsPage-CznKEDyh.js} +1 -1
- package/web/assets/{ChatAppearancePage-DqNJD2hC.js → ChatAppearancePage-BrZ30LfD.js} +1 -1
- package/web/assets/{ChatHistoryPage-DcTFMdWO.js → ChatHistoryPage-BEJbiMs3.js} +1 -1
- package/web/assets/{ChatPage-DaKslieG.js → ChatPage-CCL8A95i.js} +3 -3
- package/web/assets/{ConfigPage-Cg93xSDY.js → ConfigPage-_YQZcZlC.js} +2 -2
- package/web/assets/{DesktopWindowControls-Zz88RwFF.js → DesktopWindowControls-C-LzcrLu.js} +1 -1
- package/web/assets/{FeaturePage-bqByIxYg.js → FeaturePage-C4fMefC-.js} +1 -1
- package/web/assets/{FileAttachmentPreview-Dc92kq62.js → FileAttachmentPreview-DCdc0GFC.js} +1 -1
- package/web/assets/{FloatingWidgets-CwJuWUMz.js → FloatingWidgets-C5PMwmK1.js} +1 -1
- package/web/assets/{FocusRuntimeControls-huHLWDdy.js → FocusRuntimeControls-D6Rj2AHK.js} +1 -1
- package/web/assets/{GitDiffViewer-b4QqrnGx.js → GitDiffViewer-D2QUzasQ.js} +1 -1
- package/web/assets/{ManageProjectsDialog-DpwUwosB.js → ManageProjectsDialog-CCg0vZ07.js} +1 -1
- package/web/assets/{MarkdownMessage-BEmTlPSn.js → MarkdownMessage-DbPFHAG0.js} +1 -1
- package/web/assets/{McpPage-COTq4Jjj.js → McpPage-DAg9VlnU.js} +1 -1
- package/web/assets/{MemoryEvolution-CNi44VEB.js → MemoryEvolution-CVF6CYuV.js} +1 -1
- package/web/assets/{MemoryPage-fUDrPE_v.js → MemoryPage-C4C8Efhi.js} +2 -2
- package/web/assets/{MobileNavigation-BvCRGO5c.js → MobileNavigation-EsJOtmUl.js} +1 -1
- package/web/assets/{MorePage-BuKQ5rBF.js → MorePage-BslKLMFa.js} +1 -1
- package/web/assets/{NewFolderDialog-Btk5x-Ar.js → NewFolderDialog-Bb4T0UPO.js} +1 -1
- package/web/assets/{PageHeader-BjhZ50ed.js → PageHeader-DjJ0Ab6e.js} +1 -1
- package/web/assets/{PhoneDrawer-Cs-ka4ZZ.js → PhoneDrawer-Cu2FDUc1.js} +1 -1
- package/web/assets/{PhoneMenuButton-CTlyYTpl.js → PhoneMenuButton-C8pYulkt.js} +1 -1
- package/web/assets/{PhoneTopBar-Cx2DM1ne.js → PhoneTopBar-CvMWkksM.js} +1 -1
- package/web/assets/{PluginsPage-B9Xlbo-c.js → PluginsPage-DxjMMa05.js} +1 -1
- package/web/assets/{SafeModePrompt-BCrBZdI6.js → SafeModePrompt-DG64bady.js} +1 -1
- package/web/assets/{SchedulesPage-Eh7MyRAr.js → SchedulesPage-Bd0sjkiZ.js} +1 -1
- package/web/assets/{SessionBrowserPane-Zeec5cZP.js → SessionBrowserPane-CigWhKGU.js} +2 -2
- package/web/assets/{SessionContextPanel-CVKmX-do.js → SessionContextPanel-HfjETMcF.js} +2 -2
- package/web/assets/{SessionHome-CJR_Ufgl.js → SessionHome-DtzbkF19.js} +1 -1
- package/web/assets/{SessionInspector-D5tmy63H.js → SessionInspector-BZyFstFl.js} +1 -1
- package/web/assets/{SessionShell-w3sKK33I.js → SessionShell-BCIVsKr9.js} +1 -1
- package/web/assets/{SettingsSidebar-CseRAdbZ.js → SettingsSidebar-F20r1qhh.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-R4Gx-9DQ.js → ShortcutHelpDialog-BSiv5k3S.js} +1 -1
- package/web/assets/{ShortcutKeys-DksC1OkE.js → ShortcutKeys-BWYkyL77.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-BCd1eq_6.js → SidebarUpdateStatus-BA3cyY6N.js} +1 -1
- package/web/assets/{SkillsPage-Bn2y_EfT.js → SkillsPage-C6cF2A7j.js} +1 -1
- package/web/assets/{TaskProcessesPane-FwGhuWob.js → TaskProcessesPane-B6O5Mirv.js} +1 -1
- package/web/assets/{TaskTerminalView-Cd4PIsW7.js → TaskTerminalView-IR5bGXk7.js} +1 -1
- package/web/assets/{TerminalPanel-48zgvDnP.js → TerminalPanel-BAl1Ytmx.js} +1 -1
- package/web/assets/{WebDesktopPet-gSDBRZ3C.js → WebDesktopPet-CLjE98zM.js} +1 -1
- package/web/assets/{WorkflowsPage-Cs8PPuKK.js → WorkflowsPage-5kMzkdP5.js} +1 -1
- package/web/assets/{WorkspacePicker-93gmdtjf.js → WorkspacePicker-Dy3QRSbL.js} +1 -1
- package/web/assets/{api-AeFmYDtL.js → api-BhPOJ07B.js} +1 -1
- package/web/assets/app-update-DK-2lnli.js +34 -0
- package/web/assets/{approval-confirm-D-cfu-xY.js → approval-confirm-BiKVYJXn.js} +1 -1
- package/web/assets/{board-projects-CjfuDvHx.js → board-projects-BmfKMy9W.js} +1 -1
- package/web/assets/{bots-store-vErH7x9u.js → bots-store-sXgxSYjm.js} +1 -1
- package/web/assets/browser-notifications-CvHO-BlP.js +1 -0
- package/web/assets/{chat-api-CSAs7Y6E.js → chat-api-CdqM-TFw.js} +1 -1
- package/web/assets/{client-store-B5wZ2IWH.js → client-store-CkmBBzE5.js} +1 -1
- package/web/assets/{config-search-eh2zQyZD.js → config-search-DTHZrqfb.js} +1 -1
- package/web/assets/{desktop-hosts-BNXtrr7R.js → desktop-hosts-BzI81G6K.js} +1 -1
- package/web/assets/{dialog-BDNbY1pW.js → dialog-BVAtioHy.js} +1 -1
- package/web/assets/{event-stream-Dh7h5sXJ.js → event-stream-B9eeQcgA.js} +1 -1
- package/web/assets/{events-CuVwhRWu.js → events-CcKmvwE6.js} +1 -1
- package/web/assets/{focus-session-composer-bits-Dkc0qSzm.js → focus-session-composer-bits-BuYWKdXR.js} +1 -1
- package/web/assets/{folder-paths-BKS24lJ6.js → folder-paths-D8nYAh7q.js} +1 -1
- package/web/assets/{hosts-B_02vF1S.js → hosts-BRNTbndS.js} +1 -1
- package/web/assets/{http-Bp65Kb4t.js → http-CXQuFoDX.js} +1 -1
- package/web/assets/{http-response-PZN5QIRk.js → http-response-scdqC11Q.js} +1 -1
- package/web/assets/i18n-D5XUOwJ3.js +1 -0
- package/web/assets/{index-CiRnxTh1.js → index-at6jiRd2.js} +2 -2
- package/web/assets/{machine-messages-Y3INM-Uy.js → machine-messages-BhLpbeyp.js} +1 -1
- package/web/assets/{machines-api-08M8wQiu.js → machines-api-c4gyvYeB.js} +1 -1
- package/web/assets/{memory-api-DSpQSQ5N.js → memory-api-BZLLcIF1.js} +1 -1
- package/web/assets/mount-app-713eDAlJ.js +9 -0
- package/web/assets/notification-sound-synth-DIRfyEoK.js +1 -0
- package/web/assets/{permission-rules-api-D931wxo9.js → permission-rules-api-BoggV-So.js} +1 -1
- package/web/assets/{pick-system-directory-CaiscVfr.js → pick-system-directory-COxOQmRm.js} +1 -1
- package/web/assets/{placements-BERPVxJD.js → placements-CWg24KPB.js} +2 -2
- package/web/assets/{popover-BKgOyW2Z.js → popover-BKEwGK6p.js} +1 -1
- package/web/assets/{public-DrlrVRdl.js → public-CFmAK4C5.js} +1 -1
- package/web/assets/{public-D9GopZqN.js → public-Ds92tfxs.js} +2 -2
- package/web/assets/{public-CEKKZh7R.js → public-DyoA5qbn.js} +2 -2
- package/web/assets/{public-CwI1S0by.js → public-_SuCE3iR.js} +1 -1
- package/web/assets/{public-components-BX9oxLC6.js → public-components-CiFLJxlo.js} +1 -1
- package/web/assets/public-diff-ByaSqbeU.js +1 -0
- package/web/assets/public-events-BZoQRupR.js +1 -0
- package/web/assets/{public-flags-DaG3PoAy.js → public-flags-wwqdZl3u.js} +1 -1
- package/web/assets/{public-folder-dialog-_QoxpOd4.js → public-folder-dialog-MYvmKYka.js} +1 -1
- package/web/assets/{public-greeting-hvhJuZMw.js → public-greeting-DFC9u9sY.js} +1 -1
- package/web/assets/{public-session-DUzugr9Y.js → public-session-qSMh175y.js} +1 -1
- package/web/assets/{public-sidebar-QGIKY-SE.js → public-sidebar-WFoUZVnB.js} +1 -1
- package/web/assets/{runtime-capabilities-store-Bd3gWIM7.js → runtime-capabilities-store-D0EC-a9c.js} +1 -1
- package/web/assets/{safe-mode-instance-B7_JMLGQ.js → safe-mode-instance-Ct43-TDv.js} +1 -1
- package/web/assets/safe-mode-sentinel-BKPGGJEL.js +1 -0
- package/web/assets/{session-change-summary-api-BHpd8dcW.js → session-change-summary-api-CyghX14t.js} +1 -1
- package/web/assets/{session-home-BmAnhROp.js → session-home-DY7RkKbH.js} +1 -1
- package/web/assets/{session-inspector-store-DHEIlh_X.js → session-inspector-store-BocK0l86.js} +1 -1
- package/web/assets/{session-organization-api-D9hTSIh7.js → session-organization-api-CGRK7VMP.js} +1 -1
- package/web/assets/{session-scope-yI3Hi_8F.js → session-scope-DDZF_AQ6.js} +1 -1
- package/web/assets/{session-tree-actions-BhCOaiTd.js → session-tree-actions-g769G3qz.js} +1 -1
- package/web/assets/{session-tree-summary-BLv-bkYC.js → session-tree-summary-CqrRroey.js} +1 -1
- package/web/assets/{shortcuts-Dsd4mjfP.js → shortcuts-BsrTXPiU.js} +1 -1
- package/web/assets/{side-chat-context-scyCH7W7.js → side-chat-context-DNQ3tThq.js} +4 -4
- package/web/assets/{sidebar-BKgF_JcM.js → sidebar-R690QKPw.js} +1 -1
- package/web/assets/{sidebar-store-DHwAOBnN.js → sidebar-store-QvX0w7hQ.js} +1 -1
- package/web/assets/{speech-session-B7DFYRtL.js → speech-session-DnBIZldd.js} +1 -1
- package/web/assets/{startup-queries-BlA4Hayt.js → startup-queries-BpV9-ykp.js} +1 -1
- package/web/assets/{use-i18n-BVRhlQ1v.js → use-i18n-AM3jlRYR.js} +1 -1
- package/web/assets/{use-open-bot-DyXtOatN.js → use-open-bot-BDco631W.js} +1 -1
- package/web/assets/{use-studio-actions-DEeR_rS9.js → use-studio-actions-C7W6Soh6.js} +1 -1
- package/web/assets/{useCatalogProjects-BD5GyCxg.js → useCatalogProjects-DCT51aGo.js} +1 -1
- package/web/assets/{useMachines-CwX7YqNe.js → useMachines-BJtbuUVt.js} +1 -1
- package/web/assets/{useNewProjectPicker-COxPJj6n.js → useNewProjectPicker-B85EuCYh.js} +2 -2
- package/web/assets/{useNow-CfPk0uIz.js → useNow-BUhFR4QI.js} +1 -1
- package/web/assets/{usePhoneShell-BpuKJgci.js → usePhoneShell-CK9XBtgf.js} +1 -1
- package/web/assets/{useSessionListQuery-CURESPBn.js → useSessionListQuery-B4Xmcfwa.js} +1 -1
- package/web/assets/{useSessionRowActions-DoCwFh8w.js → useSessionRowActions-BMestf2F.js} +1 -1
- package/web/assets/{useSidebarModel-CY79-mYl.js → useSidebarModel-BDfzya9Z.js} +1 -1
- package/web/assets/{workspace-order-store-C-jYrC0l.js → workspace-order-store-C_t43Zgq.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/app-update-Cf9JJ7WK.js +0 -34
- package/web/assets/browser-notifications-DBS0oXqN.js +0 -1
- package/web/assets/i18n-D80GstlU.js +0 -1
- package/web/assets/mount-app-DRohHSG7.js +0 -9
- package/web/assets/public-diff-DpNMZ8NJ.js +0 -1
- package/web/assets/public-events-CLCgth5h.js +0 -1
- package/web/assets/safe-mode-sentinel-B_NPQ0qy.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,m as n,r,u as i}from"./vendor-router-CSN_DGvx.js";import{i as a,r as o}from"./vendor-react-DwNgTV1j.js";import{t as s}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,m as n,r,u as i}from"./vendor-router-CSN_DGvx.js";import{i as a,r as o}from"./vendor-react-DwNgTV1j.js";import{t as s}from"./use-i18n-AM3jlRYR.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-left-BAtyp3_6.js";import{t as d}from"./chevron-right-C3t2Rckj.js";import{t as f}from"./copy-DHmIFc52.js";import{t as p}from"./WorkspacePicker-Dy3QRSbL.js";import{t as m}from"./monitor-ORxecA9m.js";import{t as h}from"./pencil-U08v_vV9.js";import{t as g}from"./plus-fQbSqB1n.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,s as w,t as T,u as ee}from"./use-open-bot-BDco631W.js";import{t as E}from"./trash-2-CNrPOoPR.js";import{i as D,n as O,r as k,t as te}from"./accordion-CiJMkjqX.js";import{t as A}from"./switch-D_G8wFhs.js";import{t as ne}from"./segmented-control-xkrEOP_d.js";import{t as re}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./input-CPw-zkYh.js";import{t as ie}from"./textarea-DmATpOqT.js";import{t as ae}from"./model-display-kDwvtxrW.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{t as oe}from"./BotAvatar-CNL-APwP.js";import{t as F}from"./AppSelect-DQYKUW5E.js";import{A as I,C as se,D as ce,S as le,T as L,_ as R,a as z,b as B,d as V,f as H,g as U,h as W,i as ue,k as de,l as fe,m as pe,n as G,o as K,p as me,r as q,s as he,t as ge,u as _e,v as ve,w as J,y as ye}from"./bots-store-sXgxSYjm.js";import{t as be}from"./public-flags-wwqdZl3u.js";var Y=e(a(),1);function X(e,t){return!t||t.kind===`local`?e(`bots:computer.local`):t.name||e(`bots:computer.unnamed`)}function xe(e,t){return[`npx pisper executor pair --brain ${e.remote.endpoints[0]||t.brain} --fingerprint ${e.remote.fingerprint||t.fingerprint} --code ${e.code} --root ${t.root}`,`npx pisper executor`]}var Z=o();function Se({environment:e,onRemoved:t,onError:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1),l=async()=>{c(!0);try{await le(e.id),t()}catch(e){n(e instanceof Error?e.message:String(e)),a(!1)}finally{c(!1)}};return(0,Z.jsxs)(`li`,{"data-environment":e.id,className:`flex flex-col gap-1 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:re(`size-2 flex-none rounded-full`,e.online?`bg-success`:`bg-content-faint`)}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-content`,children:X(r,e)}),(0,Z.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.online?r(`bots:computer.online`):r(`bots:computer.offline`)}),e.kind===`node`&&(i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(!1),children:r(`bots:computer.cancel`)}),(0,Z.jsx)(j,{size:`sm`,variant:`destructive`,disabled:o,onClick:()=>void l(),children:r(`bots:computer.confirmRemove`)})]}):(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:r(`bots:computer.remove`)}))]}),e.roots.length>0&&(0,Z.jsx)(`p`,{className:`truncate pl-4 font-mono text-xs text-content-muted`,children:e.roots.join(` · `)}),e.usedBy.length>0&&(0,Z.jsx)(`p`,{className:`pl-4 text-xs text-content-muted`,children:r(`bots:computer.usedBy`,{names:e.usedBy.map(e=>e.name).join(`、`)})})]})}function Ce({pairing:e,onDone:t}){let{t:n}=s(),r=i(),[a,o]=(0,Y.useState)(!1),c=xe(e,{brain:n(`bots:computer.brainPlaceholder`),fingerprint:`SHA256:…`,root:n(`bots:computer.rootPlaceholder`)}),l=async()=>{try{await navigator.clipboard.writeText(c.join(`
|
|
2
2
|
`)),o(!0)}catch{o(!1)}};return(0,Z.jsxs)(`section`,{"aria-label":n(`bots:computer.addTitle`),className:`mt-2 rounded-xl border border-stroke bg-surface-subtle p-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`h4`,{className:`font-semibold text-content`,children:n(`bots:computer.addTitle`)}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,onClick:t,children:n(`bots:computer.done`)})]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-content-muted`,children:[n(`bots:computer.code`),` `,(0,Z.jsx)(`b`,{"data-pairing-code":!0,className:`font-mono text-content`,children:e.code}),` `,`· `,n(`bots:computer.codeHint`)]}),!e.remote.enabled&&(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 rounded-lg border border-st-attn-border bg-surface-raised px-2.5 py-2 text-xs text-content-secondary`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:n(`bots:computer.remoteOff`)}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>r(`/config/remote-access`),children:n(`bots:computer.openRemote`)})]}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-content-muted`,children:n(`bots:computer.runThere`)}),(0,Z.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto rounded-lg bg-surface-raised p-2.5 font-mono text-xs whitespace-pre-wrap break-all text-content-secondary`,children:c.join(`
|
|
3
3
|
`)}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`bots:computer.rootHint`)}),(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,onClick:()=>void l(),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),n(a?`bots:computer.copied`:`bots:computer.copy`)]})]})]})}function we({bot:e,environments:t,onEnvironmentsChanged:n,onError:r}){let{t:i}=s(),a=G(e=>e.upsert),[o,c]=(0,Y.useState)(e.workspace.environmentId),[l,u]=(0,Y.useState)(e.workspace.cwd),[d,f]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{c(e.workspace.environmentId),u(e.workspace.cwd)},[e.id,e.workspace.environmentId,e.workspace.cwd]);let b=t.find(e=>e.id===o),x=o===`local`,S=o!==e.workspace.environmentId||l.trim()!==e.workspace.cwd,C=async t=>{_(!0);try{a(await J(e.id,{workspace:{...e.workspace,...t}})),n()}catch(e){r(e instanceof Error?e.message:String(e))}finally{_(!1)}},w=async()=>{try{y(await _e())}catch(e){r(e instanceof Error?e.message:String(e))}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`bots:computer.description`)}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:i(`bots:computer.runsOn`)}),(0,Z.jsxs)(F,{value:o,className:`w-48`,"aria-label":i(`bots:computer.runsOn`),disabled:h,onChange:t=>{c(t.target.value),u(t.target.value===e.workspace.environmentId?e.workspace.cwd:``)},children:[t.length===0&&(0,Z.jsx)(`option`,{value:`local`,children:i(`bots:computer.local`)}),t.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.kind===`local`?i(`bots:computer.local`):i(`bots:computer.option`,{name:X(i,e),state:e.online?i(`bots:computer.online`):i(`bots:computer.offline`)})},e.id))]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:i(`bots:computer.folder`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(m,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,Z.jsx)(M,{value:l,className:`font-mono text-xs`,"aria-label":i(`bots:computer.folder`),placeholder:x?i(`bots:computer.folderPlaceholder`):b?.roots[0]??i(`bots:computer.folderPlaceholder`),disabled:h,onChange:e=>u(e.target.value)}),x&&(0,Z.jsx)(j,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>f(!0),children:i(`bots:new.pick`)})]}),!x&&b&&(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`bots:computer.folderInRoots`,{roots:b.roots.join(`、`)})}),S&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(j,{size:`sm`,disabled:h||!l.trim(),onClick:()=>void C({environmentId:o,cwd:l.trim()}),children:i(`bots:computer.switch`)})})]}),(0,Z.jsxs)(`section`,{"aria-label":i(`bots:computer.listTitle`),className:`border-t border-stroke pt-3`,children:[(0,Z.jsx)(`h4`,{className:`text-xs font-medium text-content-muted`,children:i(`bots:computer.listTitle`)}),(0,Z.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.map(e=>(0,Z.jsx)(Se,{environment:e,onRemoved:n,onError:r},e.id))}),v?(0,Z.jsx)(Ce,{pairing:v,onDone:()=>{y(null),n()}}):(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,className:`mt-1`,onClick:()=>void w(),children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),i(`bots:computer.add`)]})]}),(0,Z.jsx)(p,{open:d,initialPath:l||e.workspace.cwd,onOpenChange:f,onSelect:e=>{u(e),f(!1)}})]})}function Te(e){return`ref`in e?`ref:${e.ref}`:`tier:${e.tier}`}function Ee(e){return e.startsWith(`ref:`)?{ref:e.slice(4)}:{tier:q.find(t=>`tier:${t}`===e)??`standard`}}function De({bot:e,saving:t,onSave:n}){let{t:r}=s(),[i,a]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{let e=!0;return U().then(t=>e&&a(t)).catch(()=>e&&a([])),()=>{e=!1}},[]);let o=i.map(e=>e.name),c=Te(e.model);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:r(`bots:model.model`)}),(0,Z.jsxs)(F,{value:c,className:`w-56`,"aria-label":r(`bots:model.model`),disabled:t,onChange:e=>n({model:Ee(e.target.value)}),children:[q.map(e=>(0,Z.jsx)(`option`,{value:`tier:${e}`,children:y(r,{tier:e})},e)),`ref`in e.model&&!i.some(e=>`ref:${e.ref}`===c)&&(0,Z.jsx)(`option`,{value:c,children:e.model.ref}),i.map(e=>(0,Z.jsx)(`option`,{value:`ref:${e.ref}`,children:`${ae(e.name,o)} · ${e.providerName}`},e.ref))]})]}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:r(`bots:model.thinking`)}),(0,Z.jsxs)(F,{value:e.thinking??``,className:`w-56`,"aria-label":r(`bots:model.thinking`),disabled:t,onChange:e=>n({thinking:K.find(t=>t===e.target.value)??null}),children:[(0,Z.jsx)(`option`,{value:``,children:r(`bots:model.thinkingDefault`)}),K.map(e=>(0,Z.jsx)(`option`,{value:e,children:_(r,e)},e))]})]}),(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`bots:model.hint`)})]})}function Oe({bot:e,saving:t=!1,onError:n,onCount:r,onReadGlobalChange:i}){let{t:a}=s(),[o,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let t=new AbortController;return W(e.id,t.signal).then(e=>c(e)).catch(e=>{t.signal.aborted||(c([]),n(e instanceof Error?e.message:String(e)))}),()=>t.abort()},[e.id,n]),(0,Y.useEffect)(()=>{o&&r?.(o.length)},[o,r]);let g=async e=>{m(!0);try{await e()}catch(e){n(e instanceof Error?e.message:String(e))}finally{m(!1)}},_=()=>g(async()=>{let t=await he(e.id,l);c(e=>[...(e||[]).filter(e=>e.id!==t.id),t]),u(``)}),v=()=>g(async()=>{if(!d)return;let t=await pe(e.id,d.id,d.text);c(e=>(e||[]).map(e=>e.id===t.id?t:e)),f(null)}),y=t=>g(async()=>{await V(e.id,t),c(e=>(e||[]).filter(e=>e.id!==t))});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:a(`bots:memory.hint`,{name:e.name})}),i&&(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{children:a(`bots:memory.readGlobal`)}),(0,Z.jsx)(`span`,{className:`text-xs text-content-muted`,children:a(`bots:memory.readGlobalHint`)})]}),(0,Z.jsx)(A,{checked:e.readGlobalMemory,disabled:t,onCheckedChange:i})]}),o&&!o.length&&(0,Z.jsx)(P,{compact:!0,title:a(`bots:memory.empty`,{name:e.name})}),o&&o.length>0&&(0,Z.jsx)(`ul`,{role:`list`,className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:[...o].reverse().map(e=>d?.id===e.id?(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(M,{value:d.text,maxLength:500,"aria-label":a(`bots:memory.editLabel`),onChange:t=>f({id:e.id,text:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&d.text.trim()&&v(),e.key===`Escape`&&f(null)}}),(0,Z.jsx)(j,{size:`sm`,disabled:p||!d.text.trim(),onClick:()=>void v(),children:a(`bots:memory.save`)}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,onClick:()=>f(null),children:a(`bots:memory.cancel`)})]},e.id):(0,Z.jsxs)(`li`,{"data-bot-memory":e.id,className:`group flex items-start gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-content`,children:e.text}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":a(`bots:memory.edit`),title:a(`bots:memory.edit`),disabled:p,onClick:()=>f({id:e.id,text:e.text}),children:(0,Z.jsx)(h,{"aria-hidden":`true`})}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":a(`bots:memory.delete`),title:a(`bots:memory.delete`),disabled:p,onClick:()=>void y(e.id),children:(0,Z.jsx)(E,{"aria-hidden":`true`})})]},e.id))}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(M,{value:l,maxLength:500,"aria-label":a(`bots:memory.addLabel`),placeholder:a(`bots:memory.addPlaceholder`),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l.trim()&&_()}}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,disabled:p||!l.trim(),onClick:()=>void _(),children:a(`bots:memory.add`)})]})]})}function Q({bot:e,onError:t}){let{t:n}=s(),r=G(e=>e.upsert),[i,a]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(`feishu`),[d,f]=(0,Y.useState)(`p2p`),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(``),_=async n=>{c(!0);try{return r(await J(e.id,{channels:n})),!0}catch(e){return t(e instanceof Error?e.message:String(e)),!1}finally{c(!1)}},v=async()=>{let t=b(p);await _([...e.channels,{platform:l,chatType:d,peerIds:t.length?t:null,senderIds:b(h)}])&&(a(!1),m(``),g(``))};return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:n(`bots:triggers.chatsHint`,{name:e.name})}),e.channels.length>0&&(0,Z.jsx)(`ul`,{role:`list`,className:`m-0 mb-2 flex list-none flex-col gap-1.5 p-0`,children:e.channels.map((t,r)=>(0,Z.jsxs)(`li`,{"data-bot-channel":t.platform,className:`flex items-start gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-xs`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`b`,{className:`font-medium text-content`,children:[w(n,t.platform),` ·`,` `,t.chatType===`group`?n(`bots:triggers.group`):n(`bots:triggers.p2p`)]}),(0,Z.jsxs)(`span`,{className:`block truncate text-content-muted`,children:[t.peerIds?n(`bots:triggers.peers`,{ids:t.peerIds.join(`、`)}):n(`bots:triggers.allPeers`),` · `,t.senderIds.length?n(`bots:triggers.senders`,{ids:t.senderIds.join(`、`)}):n(`bots:triggers.ownerOnly`)]})]}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>void _(e.channels.filter((e,t)=>t!==r)),children:n(`bots:triggers.remove`)})]},`${t.platform}-${r}`))}),i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-stroke p-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{value:l,className:`w-32`,"aria-label":n(`bots:triggers.platform`),onChange:e=>u(e.target.value),children:ue.map(e=>(0,Z.jsx)(`option`,{value:e,children:w(n,e)},e))}),(0,Z.jsx)(ne,{value:d,onValueChange:e=>f(e),options:[{value:`p2p`,label:n(`bots:triggers.p2p`)},{value:`group`,label:n(`bots:triggers.group`)}]})]}),(0,Z.jsx)(M,{value:p,"aria-label":n(`bots:triggers.peerIds`),placeholder:n(`bots:triggers.peerIdsPlaceholder`),onChange:e=>m(e.target.value)}),(0,Z.jsx)(M,{value:h,"aria-label":n(`bots:triggers.senderIds`),placeholder:n(d===`group`?`bots:triggers.senderIdsRequired`:`bots:triggers.senderIdsPlaceholder`),onChange:e=>g(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,onClick:()=>a(!1),children:n(`bots:triggers.cancel`)}),(0,Z.jsx)(j,{size:`sm`,disabled:o||d===`group`&&!b(h).length,onClick:()=>void v(),children:n(`bots:triggers.add`)})]})]}):(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>a(!0),children:n(`bots:triggers.addChat`)})]})}var ke=[1,2,3,4,5,6,0];function Ae(){let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function $({bot:e,initialMessage:t=``,onCancel:n,onCreated:r,onError:i}){let{t:a}=s(),[o,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(t),[d,f]=(0,Y.useState)(t?`weekly`:`daily`),[p,m]=(0,Y.useState)(`09:00`),[h,g]=(0,Y.useState)(Ae),[_,v]=(0,Y.useState)(t?5:1),y=async()=>{let t=l.trim();c(!0);try{await fe({botId:e.id,name:`${e.name}:${t.slice(0,40)}`,botMessage:t,frequency:d,time:p,date:d===`once`?h:``,dayOfWeek:_,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`Asia/Hong_Kong`}),r()}catch(e){i(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-stroke p-2.5`,children:[(0,Z.jsx)(M,{value:l,maxLength:12e3,"aria-label":a(`bots:triggers.scheduleMessage`),placeholder:a(`bots:triggers.scheduleMessagePlaceholder`),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(F,{value:d,className:`w-28`,"aria-label":a(`bots:triggers.frequency`),onChange:e=>f(e.target.value),children:[(0,Z.jsx)(`option`,{value:`daily`,children:a(`bots:triggers.daily`)}),(0,Z.jsx)(`option`,{value:`weekly`,children:a(`bots:triggers.weekly`)}),(0,Z.jsx)(`option`,{value:`once`,children:a(`bots:triggers.once`)})]}),d===`weekly`&&(0,Z.jsx)(F,{value:String(_),className:`w-24`,"aria-label":a(`bots:triggers.weekday`),onChange:e=>v(Number(e.target.value)),children:ke.map(e=>(0,Z.jsx)(`option`,{value:e,children:ee(a,e)},e))}),d===`once`&&(0,Z.jsx)(M,{type:`date`,value:h,className:`w-40`,"aria-label":a(`bots:triggers.date`),onChange:e=>g(e.target.value)}),(0,Z.jsx)(M,{type:`time`,value:p,className:`w-28`,"aria-label":a(`bots:triggers.time`),onChange:e=>m(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,onClick:n,children:a(`bots:triggers.cancel`)}),(0,Z.jsx)(j,{size:`sm`,disabled:o||!l.trim(),onClick:()=>void y(),children:a(`bots:triggers.add`)})]})]})}function je({bot:e,onError:t}){let{t:n}=s(),[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),u=(0,Y.useCallback)(async()=>{try{i(await R(e.id))}catch{}},[e.id]);(0,Y.useEffect)(()=>{u()},[u]);let d=async e=>{l(!0);try{await e(),await u()}catch(e){t(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[r.length>0&&(0,Z.jsx)(`ul`,{role:`list`,className:`m-0 mb-2 flex list-none flex-col gap-1.5 p-0`,children:r.map(e=>(0,Z.jsxs)(`li`,{"data-bot-schedule":e.id,className:`flex items-center gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-xs`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`b`,{className:`block truncate font-medium text-content`,children:e.botMessage}),(0,Z.jsx)(`span`,{className:`text-content-muted`,children:v(n,e)})]}),(0,Z.jsx)(A,{checked:e.enabled,disabled:c,"aria-label":n(`bots:triggers.scheduleEnabled`),onCheckedChange:t=>void d(()=>se(e.id,t))}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,disabled:c,onClick:()=>void d(()=>H(e.id)),children:n(`bots:triggers.remove`)})]},e.id))}),a?(0,Z.jsx)($,{bot:e,onCancel:()=>o(!1),onCreated:()=>{o(!1),u()},onError:t}):(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>o(!0),children:n(`bots:triggers.addSchedule`)})]})}function Me({bot:e,onError:t,onCount:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(null),[o,u]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let n=new AbortController;return ye(e.id,n.signal).then(e=>a(e)).catch(e=>{n.signal.aborted||(a([]),t(e instanceof Error?e.message:String(e)))}),()=>n.abort()},[e.id,t]),(0,Y.useEffect)(()=>{i&&n?.(i.length)},[i,n]);let g=n=>{if(o?.name===n){u(null);return}u({name:n,body:null}),ve(e.id,n).then(e=>u(t=>t?.name===n?{name:n,body:e.body}:t)).catch(e=>{u(null),t(e instanceof Error?e.message:String(e))})},_=async n=>{h(!0);try{await me(e.id,n),a(e=>(e||[]).filter(e=>e.name!==n)),o?.name===n&&u(null)}catch(e){t(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:skills.hint`,{name:e.name})}),i&&!i.length&&(0,Z.jsx)(P,{compact:!0,title:r(`bots:skills.empty`,{name:e.name})}),i&&i.length>0&&(0,Z.jsx)(`ul`,{role:`list`,className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:i.map(n=>{let i=o?.name===n.name;return(0,Z.jsxs)(`li`,{"data-bot-skill":n.name,className:`flex flex-col gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-[13px]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-start gap-1.5 text-left`,"aria-expanded":i,onClick:()=>g(n.name),children:[i?(0,Z.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 flex-none`}):(0,Z.jsx)(d,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 flex-none`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`b`,{className:`block truncate font-medium text-content`,children:n.name}),(0,Z.jsx)(`span`,{className:`block text-xs text-content-muted`,children:n.description})]})]}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":r(`bots:skills.schedule`),title:r(`bots:skills.schedule`),disabled:m,onClick:()=>p(e=>e===n.name?``:n.name),children:(0,Z.jsx)(c,{"aria-hidden":`true`})}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":r(`bots:skills.delete`),title:r(`bots:skills.delete`),disabled:m,onClick:()=>void _(n.name),children:(0,Z.jsx)(E,{"aria-hidden":`true`})})]}),i&&(0,Z.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md bg-surface px-2.5 py-2 text-xs whitespace-pre-wrap text-content`,children:o.body??r(`bots:skills.loading`)}),f===n.name&&(0,Z.jsx)($,{bot:e,initialMessage:r(`bots:skills.scheduleMessage`,{name:n.name}),onCancel:()=>p(``),onCreated:()=>p(``),onError:t})]},n.name)})})]})}function Ne({bot:e,saving:t,onSave:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(e.proactive.briefAt);return(0,Y.useEffect)(()=>a(e.proactive.briefAt),[e.id,e.proactive.briefAt]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{children:r(`bots:proactive.check`)}),(0,Z.jsx)(A,{checked:e.proactive.enabled,disabled:t,onCheckedChange:e=>n({enabled:e})})]}),e.proactive.enabled&&(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:r(`bots:proactive.every`)}),(0,Z.jsx)(F,{value:String(e.proactive.everyHours),className:`w-44`,"aria-label":r(`bots:proactive.every`),disabled:t,onChange:e=>n({everyHours:Number(e.target.value)}),children:z.map(e=>(0,Z.jsx)(`option`,{value:e,children:r(`bots:proactive.everyHours`,{count:e})},e))})]}),(0,Z.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:proactive.checkHint`,{name:e.name})}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{children:r(`bots:proactive.brief`)}),(0,Z.jsx)(A,{checked:e.proactive.brief,disabled:t,onCheckedChange:e=>n({brief:e})})]}),e.proactive.brief&&(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:r(`bots:proactive.briefAt`)}),(0,Z.jsx)(M,{type:`time`,value:i,className:`w-44`,"aria-label":r(`bots:proactive.briefAt`),disabled:t,onChange:e=>a(e.target.value),onBlur:()=>{/^\d{2}:\d{2}$/.test(i)&&i!==e.proactive.briefAt&&n({briefAt:i})}})]}),(0,Z.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:proactive.briefHint`)})]})}function Pe({bot:e,environments:t,openSection:n,onEnvironmentsChanged:r,onError:i}){let{t:a}=s(),o=G(e=>e.upsert),[c,l]=(0,Y.useState)(e.instructions),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null);(0,Y.useEffect)(()=>l(e.instructions),[e.id,e.instructions]);let b=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{n&&b.current?.querySelector(`[data-state="open"]`)?.scrollIntoView()},[n]);let x=async t=>{d(!0);try{o(await J(e.id,t))}catch(e){i(e instanceof Error?e.message:String(e))}finally{d(!1)}},w=t.find(t=>t.id===e.workspace.environmentId),T=de(e.workspace.cwd);return(0,Z.jsxs)(`div`,{ref:b,className:`flex flex-col gap-4 pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(oe,{avatar:e.avatar,state:ce(e),size:48}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-base font-semibold text-content`,children:e.name}),(0,Z.jsx)(`button`,{type:`button`,className:`text-xs text-content-muted underline-offset-2 hover:text-content hover:underline`,onClick:()=>p(e=>!e),children:a(f?`bots:settings.doneLook`:`bots:settings.changeLook`)})]})]}),f&&(0,Z.jsx)(C,{value:e.avatar,disabled:u,onChange:e=>void x({avatar:e})}),(0,Z.jsxs)(`section`,{"aria-label":a(`bots:details.instructions`),children:[(0,Z.jsx)(`h3`,{className:`mb-1 text-sm font-medium text-content`,children:a(`bots:details.instructions`)}),(0,Z.jsx)(ie,{value:c,rows:4,maxLength:12e3,"aria-label":a(`bots:details.instructions`),placeholder:a(`bots:details.instructionsPlaceholder`),onChange:e=>l(e.target.value)}),c!==e.instructions&&(0,Z.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,Z.jsx)(j,{size:`sm`,disabled:u,onClick:()=>void x({instructions:c}),children:a(`bots:details.save`)})})]}),(0,Z.jsxs)(te,{type:`multiple`,defaultValue:n?[n]:void 0,className:`border-t border-stroke`,children:[(0,Z.jsxs)(k,{value:`computer`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:settings.computer`),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:settings.computerSummary`,{computer:X(a,w),folder:T})})]})}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(we,{bot:e,environments:t,onEnvironmentsChanged:r,onError:i})})]}),(0,Z.jsxs)(k,{value:`memory`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:memory.title`),m!==null&&(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:memory.count`,{count:m})})]})}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(Oe,{bot:e,saving:u,onError:i,onCount:h,onReadGlobalChange:e=>void x({readGlobalMemory:e})})})]}),(0,Z.jsxs)(k,{value:`skills`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:skills.title`),g!==null&&(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:skills.count`,{count:g})})]})}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(Me,{bot:e,onError:i,onCount:v})})]}),(0,Z.jsxs)(k,{value:`proactive`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:proactive.title`),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:e.proactive.enabled||e.proactive.brief?[e.proactive.enabled?a(`bots:proactive.summaryCheck`,{count:e.proactive.everyHours}):``,e.proactive.brief?a(`bots:proactive.summaryBrief`,{time:e.proactive.briefAt}):``].filter(Boolean).join(` · `):a(`bots:proactive.off`)})]})}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(Ne,{bot:e,saving:u,onSave:e=>void x({proactive:e})})})]}),(0,Z.jsxs)(k,{value:`model`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:model.title`),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:model.summary`,{model:y(a,e.model),thinking:_(a,e.thinking)})})]})}),(0,Z.jsx)(O,{className:`flex h-auto flex-col gap-3`,children:(0,Z.jsx)(De,{bot:e,saving:u,onSave:e=>void x(e)})})]}),(0,Z.jsxs)(k,{value:`chats`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:triggers.chats`),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:e.channels.length?a(`bots:settings.chatsCount`,{count:e.channels.length}):a(`bots:settings.notSet`)})]})}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(Q,{bot:e,onError:i})})]}),(0,Z.jsxs)(k,{value:`schedules`,children:[(0,Z.jsx)(D,{children:a(`bots:triggers.schedules`)}),(0,Z.jsx)(O,{className:`h-auto`,children:(0,Z.jsx)(je,{bot:e,onError:i})})]}),(0,Z.jsxs)(k,{value:`advanced`,children:[(0,Z.jsx)(D,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:settings.advanced`),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:settings.advancedSummary`,{permission:S(a,e.executionMode)})})]})}),(0,Z.jsxs)(O,{className:`flex h-auto flex-col gap-3`,children:[(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{children:a(`bots:details.acceptsWork`)}),(0,Z.jsx)(A,{checked:e.enabled,disabled:u,onCheckedChange:e=>void x({enabled:e})})]}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.permission`)}),(0,Z.jsx)(F,{value:e.executionMode,className:`w-44`,"aria-label":a(`bots:details.permission`),disabled:u,onChange:e=>void x({executionMode:e.target.value}),children:[`approval-required`,`workspace-write`,`full-access`].map(e=>(0,Z.jsx)(`option`,{value:e,children:S(a,e)},e))})]}),(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.permissionHint`)}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.tools`)}),(0,Z.jsxs)(F,{value:I(e.tools),className:`w-44`,"aria-label":a(`bots:details.tools`),disabled:u,onChange:e=>void x({tools:e.target.value===`read-only`?[...L]:null}),children:[(0,Z.jsx)(`option`,{value:`all`,children:a(`bots:details.toolsAll`)}),(0,Z.jsx)(`option`,{value:`read-only`,children:a(`bots:details.toolsReadOnly`)}),I(e.tools)===`custom`&&(0,Z.jsx)(`option`,{value:`custom`,disabled:!0,children:a(`bots:details.toolsCustom`,{count:e.tools?.length??0})})]})]}),(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.toolsHint`)}),(0,Z.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.parallel`)}),(0,Z.jsx)(F,{value:String(e.maxParallelAgents),className:`w-44`,"aria-label":a(`bots:details.parallel`),disabled:u,onChange:e=>void x({maxParallelAgents:Number(e.target.value)}),children:[1,2,3,4,5,6].map(e=>(0,Z.jsx)(`option`,{value:e,children:a(`bots:details.parallelCount`,{count:e})},e))})]}),(0,Z.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.parallelHint`)})]})]})]})]})}var Fe={enabled:!1,endpoints:[],fingerprint:null};function Ie(){let[e,t]=(0,Y.useState)([]),[n,r]=(0,Y.useState)(Fe),[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(0),s=(0,Y.useCallback)(async()=>{let e=++o.current;try{let n=await B();if(e!==o.current)return;t(n.environments),r(n.remote)}catch{}finally{e===o.current&&a(!0)}},[]);return(0,Y.useEffect)(()=>{s();let e=window.setInterval(()=>{document.visibilityState===`visible`&&s()},1e4);return()=>{window.clearInterval(e),o.current+=1}},[s]),{environments:e,remote:n,loaded:i,refresh:s}}function Le({notify:e}){let{t:n}=s(),a=be(`bots`),{botId:o=``}=t(),c=i(),l=G(e=>e.bots),u=G(e=>e.loaded),[d,f]=(0,Y.useState)(!1),p=(0,Y.useCallback)(t=>e(t,`error`),[e]),m=T(p);ge(a);let h=l.find(e=>e.id===o)??null;return a?u?!o&&l[0]?(0,Z.jsx)(r,{to:`/bots/${encodeURIComponent(l[0].id)}`,replace:!0}):h?(0,Z.jsx)(Re,{botId:h.id,onOpenChat:()=>void m(h),onError:p},h.id):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{kind:`empty`,title:l.length?n(`bots:page.notFound`):n(`bots:page.emptyTitle`),description:n(`bots:page.emptyDescription`),action:(0,Z.jsxs)(j,{onClick:()=>f(!0),children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),n(`bots:sidebar.newBot`)]})}),(0,Z.jsx)(x,{open:d,onOpenChange:f,onCreated:e=>void m(e)})]}):(0,Z.jsx)(N,{kind:`loading`,title:n(`bots:page.loading`)}):(0,Z.jsx)(N,{kind:`empty`,title:n(`bots:page.disabledTitle`),description:n(`bots:page.disabledDescription`),action:(0,Z.jsx)(j,{onClick:()=>c(`/config/labs`),children:n(`bots:page.openLabs`)})})}function Re({botId:e,onOpenChat:t,onError:r}){let{t:i}=s(),a=G(t=>t.bots.find(t=>t.id===e)),o=G(e=>e.load),c=Ie(),[l]=n(),d=l.get(`section`)===`chats`?`chats`:void 0;return a?(0,Z.jsxs)(`div`,{"data-bot-settings":a.id,className:`flex h-full min-h-0 w-full min-w-0 flex-col`,children:[(0,Z.jsxs)(`header`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 border-b border-stroke px-3 [[data-custom-titlebar]_&]:pr-[144px]`,children:[(0,Z.jsxs)(j,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),i(`bots:settingsPage.backToChat`,{name:a.name})]}),(0,Z.jsx)(`h1`,{className:`sr-only`,children:i(`bots:settingsPage.title`,{name:a.name})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-[min(640px,calc(100%-32px))] py-6`,children:(0,Z.jsx)(Pe,{bot:a,environments:c.environments,openSection:d,onEnvironmentsChanged:()=>{c.refresh(),o()},onError:r})})})]}):null}export{Le as BotsPage};
|
|
@@ -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-AM3jlRYR.js";import{t as i}from"./runtime-capabilities-store-D0EC-a9c.js";import{t as a}from"./arrow-right-DqLOhpA2.js";import{t as o}from"./download-BCfIiuaL.js";import{t as s}from"./key-round-C29uZbsf.js";import{t as c}from"./search-D0mqDaf_.js";import{t as l}from"./server-BgNvmqwJ.js";import{t as u}from"./x-07u4-129.js";import{t as d}from"./utils-C8uzG5AZ.js";import{t as f}from"./button-CCcCN8tE.js";import{t as p}from"./kbd-CAufZTkl.js";import{n as m,r as h}from"./config-search-DTHZrqfb.js";import{s as g}from"./shortcuts-BsrTXPiU.js";import{a as _,i as v,l as y,o as b,s as x,t as S}from"./dialog-BVAtioHy.js";import{t as C}from"./input-CPw-zkYh.js";import{t as w}from"./BrandLogo-k3CvJjd4.js";var T=e(t(),1),E=n();function D({query:e,onQueryChange:t,onSelect:n,inputRef:a,placement:o=`toolbar`}){let{t:s,language:l}=r(),[u,f]=(0,T.useState)(!1),[_,v]=(0,T.useState)(0),y=(0,T.useRef)(null),b=i(e=>e.capabilities),x=g(`focusSearch`),S=(0,T.useMemo)(()=>h(e,l,{capabilities:b,mobileApp:!!window.__PISPER_MOBILE_APP__}),[l,e,b]);(0,T.useEffect)(()=>v(0),[e]),(0,T.useEffect)(()=>{if(!u)return;let e=e=>{y.current&&!y.current.contains(e.target)&&f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]);let w=e=>{if(f(!1),t(``),e.entry.card===`interface-custom-ui`){n(e.entry.section,`widgets`);return}m(e.entry.card,e.entry.section,{targetId:e.entry.targetId,targetText:e.title,expandGroup:e.entry.expandGroup}),n(e.entry.section)},D=u&&e.trim().length>0;return(0,E.jsxs)(`div`,{ref:y,className:d(`relative`,o===`sidebar`?`w-full`:`w-[min(250px,24vw)] max-[900px]:w-[190px] max-[650px]:col-start-1 max-[650px]:row-start-1 max-[650px]:w-full max-[650px]:min-w-0`),children:[(0,E.jsx)(c,{size:15,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-content-muted`}),(0,E.jsx)(C,{ref:a,value:e,title:s(`navigation:pageHeader.search`),"aria-label":s(`navigation:pageHeader.search`),className:d(`pl-8 text-sm`,o!==`sidebar`&&`max-[650px]:h-11 max-[650px]:text-[16px]`,o===`sidebar`&&`h-8 border-key-border bg-key pr-9 text-ellipsis shadow-key`),placeholder:s(o===`sidebar`?`config:configSearch.placeholderShort`:`config:configSearch.placeholder`),onChange:e=>{t(e.target.value),f(!0)},onFocus:()=>{e.trim()&&f(!0)},onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),t(``),f(!1)):e.key===`ArrowDown`?(e.preventDefault(),v(e=>Math.min(e+1,S.length-1))):e.key===`ArrowUp`?(e.preventDefault(),v(e=>Math.max(e-1,0))):e.key===`Enter`&&S[_]&&(e.preventDefault(),w(S[_]))}}),o===`sidebar`&&x&&!e&&(0,E.jsx)(p,{className:`absolute top-1/2 right-2 -translate-y-1/2 pointer-coarse:hidden`,children:x}),D&&(0,E.jsx)(`div`,{className:`absolute top-full left-0 z-50 mt-1.5 w-full overflow-hidden rounded-md bg-solid shadow-float`,children:S.length===0?(0,E.jsx)(`p`,{role:`status`,className:`px-3 py-3 text-xs text-content-muted`,children:s(`config:configSearch.noResults`)}):(0,E.jsx)(`ul`,{className:`max-h-[280px] overflow-auto py-1`,children:S.map((e,t)=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,className:d(`flex w-full flex-col gap-0.5 px-3 py-1.5 text-left pointer-coarse:min-h-11`,t===_?`bg-surface-hover`:`hover:bg-surface-subtle`),onMouseEnter:()=>v(t),onClick:()=>w(e),children:[(0,E.jsx)(`span`,{className:`text-sm text-content`,children:e.title}),(0,E.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.sectionTitle})]})},e.entry.id))})})]})}function O({open:e,onDismiss:t,onOpenImport:n,onOpenSettings:i}){let{t:c}=r();return(0,E.jsx)(S,{open:e,onOpenChange:e=>!e&&t(),children:(0,E.jsxs)(v,{showCloseButton:!1,overlayClassName:`z-[220]`,className:`z-[220] gap-0 rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,style:{maxWidth:`min(28rem, calc(100vw - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)) - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right))))`,maxHeight:`calc(100dvh - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)) - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)))`},"aria-describedby":`model-onboarding-description`,children:[(0,E.jsxs)(`div`,{className:`relative px-5 pt-5 pb-2 max-[650px]:px-4 max-[650px]:pt-4`,children:[(0,E.jsxs)(x,{className:`gap-3 pr-9 text-left`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`w-fit rounded-[13px] shadow-raise`,children:(0,E.jsx)(w,{size:44})}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(`p`,{className:`text-xs font-medium text-content-muted`,children:c(`config:modelOnboarding.eyebrow`)}),(0,E.jsx)(y,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em]`,children:c(`config:modelOnboarding.title`)}),(0,E.jsx)(_,{id:`model-onboarding-description`,className:`leading-6`,children:c(`config:modelOnboarding.description`)})]})]}),(0,E.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3 pointer-coarse:size-11`,"aria-label":c(`common:ui.closeDialog`),title:c(`common:ui.closeDialog`),onClick:t,children:(0,E.jsx)(u,{})})]}),(0,E.jsxs)(`div`,{className:`grid gap-3 px-5 pt-2 pb-4 max-[650px]:px-4`,children:[(0,E.jsx)(`ol`,{className:`m-0 list-none divide-y divide-stroke-soft border-y border-stroke-soft p-0`,children:[{Icon:l,title:c(`config:modelOnboarding.connectionTitle`),description:c(`config:modelOnboarding.connectionDescription`)},{Icon:s,title:c(`config:modelOnboarding.modelTitle`),description:c(`config:modelOnboarding.modelDescription`)}].map(({Icon:e,title:t,description:n},r)=>(0,E.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 shrink-0 place-items-center rounded-full bg-surface-subtle text-xs font-medium text-content-secondary tabular-nums`,children:r+1}),(0,E.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,E.jsxs)(`strong`,{className:`flex items-center gap-1.5 text-sm font-medium text-content`,children:[(0,E.jsx)(e,{className:`size-3.5 text-content-muted`,"aria-hidden":`true`}),t]}),(0,E.jsx)(`p`,{className:`text-xs leading-5 text-content-muted`,children:n})]})]},t))}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`w-full max-[650px]:h-11`,onClick:n,children:[(0,E.jsx)(o,{}),c(`config:modelOnboarding.findExisting`)]})]}),(0,E.jsxs)(b,{className:`m-0 rounded-none px-5 pt-3 max-[650px]:px-4`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,E.jsx)(f,{type:`button`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:t,children:c(`config:modelOnboarding.later`)}),(0,E.jsxs)(f,{type:`button`,className:`max-[650px]:h-11`,onClick:i,children:[c(`config:modelOnboarding.openSettings`),(0,E.jsx)(a,{})]})]})]})})}export{D as ConfigSearchBox,O as ModelOnboardingDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./GitDiffViewer-D2QUzasQ.js";export{e as InlineGitDiff};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./events-CcKmvwE6.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{o as n}from"./vendor-state-GkUciC5H.js";import{t as r}from"./http-response-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{o as n}from"./vendor-state-GkUciC5H.js";import{t as r}from"./http-response-scdqC11Q.js";import{n as i}from"./http-CXQuFoDX.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-D0EC-a9c.js";import{u as s}from"./events-CcKmvwE6.js";import"./public-events-BZoQRupR.js";var c=e(t(),1),l=Object.freeze([`experimental`,`preview`]),u=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,d=48;Object.freeze([{id:`bots`,stage:`experimental`,requires:[`bots`],feedbackUrl:`https://github.com/ling-kong-ran/pisper/issues`}]);function f(e){return typeof e==`string`&&e.length<=d&&u.test(e)}var p=`/api/settings/beta-features`,m=/^https:\/\/github\.com\/[^\s]{1,400}$/;function h(e){if(!e||typeof e!=`object`||Array.isArray(e))throw r();let t=e;if(!f(t.id)||!l.includes(t.stage)||typeof t.enabled!=`boolean`||typeof t.available!=`boolean`||t.unavailableReason!==null&&t.unavailableReason!==`runtime`)throw r();return{id:t.id,stage:t.stage,feedbackUrl:typeof t.feedbackUrl==`string`&&m.test(t.feedbackUrl)?t.feedbackUrl:``,enabled:t.enabled,available:t.available,unavailableReason:t.unavailableReason}}function g(e){if(!e||typeof e!=`object`||Array.isArray(e))throw r();let t=e.features;if(!Array.isArray(t))throw r();return t.map(h)}function _(e={}){return i(p,{signal:e.signal,parse:g})}function v(e,t){return i(p,{method:`PATCH`,data:{[e]:t},parse:g})}function y(e){return e instanceof Error&&e.message?e.message:String(e||``)}var b=null,x=n()((e,t)=>({features:[],status:`idle`,error:``,pending:{},rowErrors:{},load:()=>b||(e({status:t().status===`ready`?`ready`:`loading`,error:``}),b=_().then(n=>{let{pending:r}=t();e({features:n.map(e=>r[e.id]&&t().features.find(t=>t.id===e.id)||e),status:`ready`})}).catch(t=>{e({status:`error`,error:y(t)})}).finally(()=>{b=null}),b),setEnabled:async(n,r)=>{let i=t().features.find(e=>e.id===n);if(!i||t().pending[n]||!i.available)return;let{[n]:a,...o}=t().rowErrors;e({features:t().features.map(e=>e.id===n?{...e,enabled:r}:e),pending:{...t().pending,[n]:!0},rowErrors:o});try{let i=await v(n,r),{pending:a}=t();e({features:i.map(e=>e.id!==n&&a[e.id]&&t().features.find(t=>t.id===e.id)||e)}),s()}catch(a){e({features:t().features.map(e=>e.id===n?{...e,enabled:i.enabled}:e),rowErrors:{...t().rowErrors,[n]:{message:y(a),desired:r}}})}finally{let{[n]:r,...i}=t().pending;e({pending:i})}}}));function S(e){let t=o(e=>a(e.capabilities,`betaFeatures`)),n=x(e=>e.status),r=x(e=>e.load),i=x(t=>t.features.some(t=>t.id===e&&t.enabled&&t.available));return(0,c.useEffect)(()=>{t&&n===`idle`&&r()},[t,n,r]),t&&i}export{x as n,S as t};
|
|
@@ -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-AM3jlRYR.js";import{t as i}from"./server-BgNvmqwJ.js";import{t as a}from"./triangle-alert-CE1q54ci.js";import{n as o,t as s}from"./button-CCcCN8tE.js";import{a as c,i as l,l as u,o as d,s as f,t as p}from"./dialog-BVAtioHy.js";import{t as m}from"./input-CPw-zkYh.js";import{a as h,s as g}from"./machines-api-c4gyvYeB.js";import{n as _,t as v}from"./alert-DRIrgNI4.js";import{n as y,t as b}from"./field-DoLEb0np.js";import{n as x}from"./machine-messages-BhLpbeyp.js";var S=e(t(),1),C=n();function w({machine:e,initialCwd:t,onOpenChange:n,onChosen:w}){let{t:T}=r(),[E,D]=(0,S.useState)(t),[O,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(``),M=(0,S.useRef)(null);(0,S.useEffect)(()=>(e&&(D(t),j(``)),()=>{M.current?.abort(),M.current=null,k(!1)}),[e,t]);let N=async t=>{if(t.preventDefault(),!e||O)return;let n=new AbortController;M.current=n,k(!0),j(``);try{let t=await g(e.id,E.trim(),n.signal);n.signal.aborted||w(e,t)}catch(e){if(n.signal.aborted)return;j(x(T,h(e),e instanceof Error?e.message:``))}finally{n.signal.aborted||k(!1)}};return(0,C.jsx)(p,{open:!!e,onOpenChange:n,children:(0,C.jsx)(l,{className:`sm:max-w-md`,children:(0,C.jsxs)(`form`,{onSubmit:e=>void N(e),className:`grid gap-4`,children:[(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,C.jsx)(i,{className:`size-4`,"aria-hidden":`true`}),T(`board:machine.folderTitle`,{name:e?.name??``})]}),(0,C.jsx)(c,{children:T(`board:machine.folderDescription`)})]}),(0,C.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,C.jsx)(y,{htmlFor:`machine-folder`,children:T(`board:machine.folderLabel`)}),(0,C.jsx)(m,{id:`machine-folder`,value:E,autoFocus:!0,spellCheck:!1,className:`font-mono text-xs`,placeholder:e?.roots[0]||`~`,disabled:O,"data-machine-folder":!0,onChange:e=>D(e.target.value)}),(0,C.jsx)(b,{children:e?.kind===`node`?T(`board:machine.folderInRoots`,{roots:e.roots.join(`、`)}):T(`board:machine.folderHint`)})]}),A&&(0,C.jsxs)(v,{variant:`destructive`,"data-machine-folder-error":!0,children:[(0,C.jsx)(a,{"aria-hidden":`true`}),(0,C.jsx)(_,{children:A})]}),(0,C.jsxs)(d,{children:[(0,C.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>n(!1),children:T(`board:machine.cancel`)}),(0,C.jsxs)(s,{type:`submit`,disabled:O,"data-machine-folder-confirm":!0,children:[O&&(0,C.jsx)(o,{className:`size-3.5`}),T(O?`board:machine.checking`:`board:machine.confirm`)]})]})]})})})}export{w as MachineFolderDialog};
|
|
@@ -1 +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"./vendor-ui-DvrYggeS.js";import{t as a}from"./use-i18n-
|
|
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"./vendor-ui-DvrYggeS.js";import{t as a}from"./use-i18n-AM3jlRYR.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-right-DqLOhpA2.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./WorkspacePicker-Dy3QRSbL.js";import{t as u}from"./folder-open-FIShC5Qk.js";import{t as d}from"./message-circle-D-XrK6Ft.js";import{t as f}from"./dist-41X0pdUs.js";import"./separator-BPh_qxvc.js";import{t as p}from"./utils-C8uzG5AZ.js";import{t as m}from"./button-CCcCN8tE.js";import{u as h}from"./events-CcKmvwE6.js";import{t as g}from"./input-CPw-zkYh.js";import{t as _}from"./BotAvatar-CNL-APwP.js";import{t as v}from"./AppSelect-DQYKUW5E.js";import{D as y,O as b,a as x,k as S,n as C,w}from"./bots-store-sXgxSYjm.js";import"./public-events-BZoQRupR.js";import{t as T}from"./public-flags-wwqdZl3u.js";var E=o(`newspaper`,[[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2`,key:`39pd36`}],[`rect`,{width:`8`,height:`4`,x:`10`,y:`6`,rx:`1`,key:`aywv1n`}]]),D=e(n(),1),O=r(),k=i(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function A({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?f:`div`;return(0,O.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:p(k({variant:t,size:n,className:e})),...i})}var j=i(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function M({className:e,variant:t=`default`,...n}){return(0,O.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:p(j({variant:t,className:e})),...n})}function N({className:e,...t}){return(0,O.jsx)(`div`,{"data-slot":`item-content`,className:p(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function P({className:e,...t}){return(0,O.jsx)(`div`,{"data-slot":`item-title`,className:p(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function F({className:e,...t}){return(0,O.jsx)(`p`,{"data-slot":`item-description`,className:p(`line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function I({className:e,...t}){return(0,O.jsx)(`div`,{"data-slot":`item-actions`,className:p(`flex items-center gap-2`,e),...t})}function L({botId:e,collapsed:t=!1,fallback:n=null}){let r=T(`bots`),i=C(t=>t.bots.find(t=>t.id===e)),a=C(e=>e.loaded),o=C(e=>e.load);return(0,D.useEffect)(()=>{r&&!a&&o()},[r,o,a]),r?i?(0,O.jsx)(R,{bot:i,collapsed:t}):a?n:null:n}function R({bot:e,collapsed:n}){let{t:r}=a(),i=t(),o=C(e=>e.upsert),[s,c]=(0,D.useState)(!1),[f,T]=(0,D.useState)(e.proactive.briefAt),[k,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(!1),[N,P]=(0,D.useState)(e.proactive.everyHours),[F,I]=(0,D.useState)(!1),[L,R]=(0,D.useState)(``),B=b(e.instructions),V=e.workspace.environmentId===`local`,H=`/bots/${encodeURIComponent(e.id)}`,U=async t=>{I(!0),R(``);try{return o(await w(e.id,t)),!0}catch(e){return R(e instanceof Error?e.message:String(e)),!1}finally{I(!1)}},W=async e=>{e.preventDefault(),/^\d{2}:\d{2}$/.test(f)&&await U({proactive:{brief:!0,briefAt:f}})&&c(!1)};return(0,O.jsxs)(`section`,{"data-bot-greeting":e.id,"data-collapsed":n||void 0,"aria-label":r(`bots:greeting.hello`,{name:e.name}),className:p(`mx-auto w-full max-w-[var(--chat-content-width,1040px)]`,n?`mb-[var(--chat-message-gap,32px)]`:`[animation:transcript-reveal-enter_.22s_var(--ease-out)_both]`),children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,O.jsx)(_,{avatar:e.avatar,state:n?`idle`:y(e),animate:!n,size:56}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,O.jsx)(`h2`,{className:`text-[15px] leading-6 font-medium text-content`,children:r(`bots:greeting.hello`,{name:e.name})}),B?(0,O.jsxs)(`p`,{className:`text-sm leading-6 [overflow-wrap:anywhere] text-content-secondary`,children:[r(`bots:greeting.duty`,{duty:B}),` `,(0,O.jsx)(`button`,{type:`button`,"data-bot-greeting-edit":!0,className:`relative whitespace-nowrap text-content-muted underline underline-offset-2 after:absolute after:-inset-3 after:hidden after:content-[''] hover:text-content focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:after:block`,onClick:()=>i(H),children:r(`bots:greeting.editDuty`)})]}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-content-secondary`,children:r(n?`bots:greeting.talk`:`bots:greeting.ask`)})]})]}),!n&&(0,O.jsxs)(`div`,{className:`mt-4 flex max-w-[560px] flex-col gap-2`,children:[V&&(s?(0,O.jsxs)(`form`,{"data-bot-greeting-brief":!0,className:`flex flex-col gap-3 rounded-[var(--r-md)] border border-stroke px-3 py-2.5`,onSubmit:e=>void W(e),onKeyDown:e=>{e.key===`Escape`&&c(!1)},children:[(0,O.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium text-content`,children:[r(`bots:greeting.briefWhen`),(0,O.jsx)(g,{type:`time`,value:f,autoFocus:!0,disabled:F,className:`w-32 font-normal`,onChange:e=>T(e.target.value)})]}),(0,O.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:greeting.briefNote`)}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{type:`submit`,disabled:F||!f,children:r(`bots:greeting.briefConfirm`)}),(0,O.jsx)(m,{type:`button`,variant:`ghost`,disabled:F,onClick:()=>c(!1),children:r(`bots:new.cancel`)})]})]}):(0,O.jsx)(z,{action:`brief`,icon:E,done:e.proactive.brief,title:e.proactive.brief?r(`bots:greeting.briefOn`,{time:e.proactive.briefAt}):r(`bots:greeting.brief`),hint:e.proactive.brief?r(`bots:greeting.briefOnHint`):r(`bots:greeting.briefHint`),disabled:F,onClick:()=>{T(e.proactive.briefAt),c(!0)}})),V&&(j?(0,O.jsxs)(`form`,{"data-bot-greeting-watch":!0,className:`flex flex-col gap-3 rounded-[var(--r-md)] border border-stroke px-3 py-2.5`,onSubmit:e=>{e.preventDefault(),A(!0)},onKeyDown:e=>{e.key===`Escape`&&e.currentTarget.contains(e.target)&&M(!1)},children:[(0,O.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium text-content`,children:[r(`bots:greeting.watchWhen`),(0,O.jsx)(v,{value:String(N),className:`w-44 font-normal`,onChange:e=>P(Number(e.target.value)),children:x.map(e=>(0,O.jsx)(`option`,{value:e,children:r(`bots:proactive.everyHours`,{count:e})},e))})]}),(0,O.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:greeting.watchNote`)}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(m,{type:`submit`,autoFocus:!0,children:r(`bots:greeting.watchConfirm`)}),(0,O.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>M(!1),children:r(`bots:new.cancel`)})]})]}):(0,O.jsx)(z,{action:`folder`,icon:u,title:r(B?`bots:greeting.folder`:`bots:greeting.watch`),hint:B?e.proactive.enabled?r(`bots:greeting.folderWatchHint`,{folder:S(e.workspace.cwd),count:e.proactive.everyHours}):r(`bots:greeting.folderHint`,{folder:S(e.workspace.cwd)}):r(`bots:greeting.watchHint`,{count:e.proactive.everyHours}),disabled:F,onClick:()=>{if(B){A(!0);return}P(e.proactive.everyHours),M(!0)}})),(0,O.jsx)(z,{action:`chats`,icon:d,done:e.channels.length>0,title:e.channels.length?r(`bots:greeting.chatsOn`,{count:e.channels.length}):r(`bots:greeting.chats`),hint:e.channels.length?r(`bots:greeting.chatsOnHint`):r(`bots:greeting.chatsHint`),disabled:F,onClick:()=>i(`${H}?section=chats`)}),L&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:L}),(0,O.jsx)(l,{open:k,initialPath:e.workspace.cwd,onOpenChange:A,onSelect:async t=>{let n=await w(e.id,{workspace:{...e.workspace,cwd:t},...B?{}:{instructions:r(`bots:greeting.watchDuty`),proactive:{enabled:!0,everyHours:N}}});o(n),e.threadSessionId&&h({id:e.threadSessionId,cwd:n.workspace.cwd}),A(!1),M(!1)}})]})]})}function z({action:e,icon:t,title:n,hint:r,done:i=!1,disabled:a,onClick:o}){return(0,O.jsx)(A,{asChild:!0,variant:`outline`,children:(0,O.jsxs)(`button`,{type:`button`,"data-bot-greeting-action":e,disabled:a,className:`group/action w-full cursor-pointer text-left hover:bg-surface-hover disabled:cursor-default disabled:opacity-60`,onClick:o,children:[(0,O.jsx)(M,{variant:`icon`,children:(0,O.jsx)(t,{className:`text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,O.jsxs)(N,{children:[(0,O.jsx)(P,{children:n}),(0,O.jsx)(F,{children:r})]}),(0,O.jsx)(I,{children:(0,O.jsx)(i?c:s,{className:`size-4 text-content-faint group-hover/action:text-content-secondary`,"aria-hidden":`true`})})]})})}export{L as default};
|
|
@@ -1 +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-
|
|
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-AM3jlRYR.js";import{t as a}from"./settings-2-CXJjXJS9.js";import{t as o}from"./button-CCcCN8tE.js";import{t as s}from"./BotAvatar-CNL-APwP.js";import{D as c,n as l,t as u}from"./bots-store-sXgxSYjm.js";import{t as d}from"./public-flags-wwqdZl3u.js";var f=e(n(),1),p=r();function m({botId:e,part:n,animate:r=!0,fallback:m=null}){let{t:h}=i(),g=d(`bots`),_=t(),v=l(t=>t.bots.find(t=>t.id===e));u(g&&n===`avatar`);let y=l(e=>e.loaded),b=l(e=>e.load);if((0,f.useEffect)(()=>{g&&!y&&n!==`avatar`&&b()},[g,b,y,n]),!g||!v)return m;if(n===`mark`)return(0,p.jsx)(s,{avatar:v.avatar,state:r?c(v):`idle`,animate:r,size:22});if(n===`name`)return v.name;if(n===`avatar`)return(0,p.jsx)(`span`,{"data-session-bot":v.id,className:`flex flex-none items-center pl-1`,children:(0,p.jsx)(s,{avatar:v.avatar,state:c(v),size:22})});let x=h(`bots:settingsPage.title`,{name:v.name});return(0,p.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none text-content-muted hover:text-content pointer-coarse:size-11`,"data-session-bot-settings":v.id,"aria-label":x,title:x,onClick:()=>_(`/bots/${encodeURIComponent(v.id)}`),children:(0,p.jsx)(a,{"aria-hidden":`true`})})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{d as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{d as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-AM3jlRYR.js";import{t as s}from"./plus-fQbSqB1n.js";import{n as c,t as l}from"./use-open-bot-BDco631W.js";import{t as u}from"./utils-C8uzG5AZ.js";import{t as d}from"./BotAvatar-CNL-APwP.js";import{D as f,E as p,j as m,n as h,t as g}from"./bots-store-sXgxSYjm.js";import{t as _}from"./public-flags-wwqdZl3u.js";var v=e(r(),1),y=i();function b(){let{t:e}=o(),r=_(`bots`),i=h(e=>e.bots),b=n(),x=t(),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),E=l((0,v.useCallback)((e,t)=>b(`/bots/${encodeURIComponent(t)}`),[b]));if(g(r),!r)return null;let D=a(x.pathname),O=/^\/bots\/([^/]+)/.exec(x.pathname)?.[1]??i.find(e=>D&&e.threadSessionId===D)?.id,{shown:k,hidden:A}=m(i,{expanded:w,currentId:O});return(0,y.jsxs)(`section`,{"data-sidebar-bots":!0,"aria-label":e(`bots:sidebar.title`),className:`mb-2`,children:[(0,y.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1.5 px-2.5 text-xs font-medium text-content-muted`,children:[(0,y.jsx)(`h2`,{className:`flex-1`,children:e(`bots:sidebar.title`)}),(0,y.jsx)(`button`,{type:`button`,className:`grid size-6 place-items-center rounded-md hover:bg-surface-hover hover:text-content`,"aria-label":e(`bots:sidebar.newBot`),title:e(`bots:sidebar.newBot`),onClick:()=>C(!0),children:(0,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`})})]}),(0,y.jsx)(`ul`,{role:`list`,className:`m-0 list-none p-0`,children:k.map(t=>{let n=t.activity,r=p(e,t);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"data-sidebar-bot":t.id,"aria-current":O===t.id?`page`:void 0,title:r,className:u(`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left hover:bg-surface-hover pointer-coarse:h-11`,O===t.id&&`bg-surface-active hover:bg-surface-active`),onClick:()=>void E(t),children:[(0,y.jsx)(d,{avatar:t.avatar,state:f(t),size:20}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13.5px] text-content`,children:[t.name,(0,y.jsx)(`span`,{className:`sr-only`,children:` · ${r}`})]}),n?.working?(0,y.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-bot-working":n.working,className:`flex-none text-[11.5px] text-content-muted tabular-nums`,children:n.working}):null,n?.needsYou&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 flex-none rounded-full bg-st-attn`})]})},t.id)})}),(A>0||w&&i.length>3)&&(0,y.jsx)(`button`,{type:`button`,"data-sidebar-bots-more":!0,"aria-expanded":w,className:`flex h-7 w-full items-center rounded-[var(--r-md)] px-2.5 pl-9 text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>T(!w),children:w?e(`bots:sidebar.showLess`):e(`bots:sidebar.showAll`,{count:i.length})}),(0,y.jsx)(c,{open:S,onOpenChange:C,onCreated:e=>void E(e)})]})}export{b as default};
|
package/web/assets/{runtime-capabilities-store-Bd3gWIM7.js → runtime-capabilities-store-D0EC-a9c.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./vendor-state-GkUciC5H.js";import{t}from"./api-
|
|
1
|
+
import{o as e}from"./vendor-state-GkUciC5H.js";import{t}from"./api-BhPOJ07B.js";import{t as n}from"./runtime-capabilities-B7qveLBm.js";function r(e){let t={...n.features};for(let n of Object.keys(t)){let r=e.features?.[n];typeof r==`boolean`&&(t[n]=r)}let r=[`desktop`,`mobile-embedded`,`mobile-store`].includes(String(e.profile))?e.profile:`desktop`;return{version:Number(e.version)||0,profile:r,engine:`node`,degraded:e.degraded===!0,modules:{childProcess:e.modules?.childProcess!==!1,workerThreads:e.modules?.workerThreads!==!1,sqlite:e.modules?.sqlite!==!1,wasm:e.modules?.wasm!==!1},features:t,tools:Array.isArray(e.tools)?e.tools.filter(e=>typeof e==`string`):[]}}var i=null,a=e()((e,a)=>({capabilities:n,loaded:!1,load:({refresh:o=!0}={})=>i||(!o&&a().loaded?Promise.resolve():(i=(async()=>{try{e({capabilities:r(await t(`/api/runtime/capabilities`)),loaded:!0})}catch{e({capabilities:n,loaded:!0})}})().finally(()=>{i=null}),i))}));export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-at6jiRd2.js";import{t}from"./safe-mode-sentinel-BKPGGJEL.js";var n=`safe-mode`,r=`components`,i=3e3,a=64,o=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,95}$/;function s(e){if(!e||e.length>16384)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.loading;if(!n||typeof n!=`object`||Array.isArray(n))return null;let{at:r,instanceIds:i}=n;return typeof r!=`string`||!Number.isFinite(Date.parse(r))||!Array.isArray(i)?null:{loading:{at:r,instanceIds:i.filter(e=>typeof e==`string`&&o.test(e)).slice(0,a)}}}function c(e){try{return new URLSearchParams(e).get(n)===r}catch{return!1}}function l(e){return typeof window>`u`?()=>{}:(window.addEventListener(`beforeunload`,e),window.addEventListener(`pagehide`,e,{capture:!0}),()=>{window.removeEventListener(`beforeunload`,e),window.removeEventListener(`pagehide`,e,{capture:!0})})}function u({storage:e,search:n,now:r=()=>Date.now(),schedule:o=(e,t)=>setTimeout(e,t),cancel:u=e=>clearTimeout(e),listenUnload:d=l}){let f=new Set,p=()=>{try{return s(e.getItem(t))}catch{return null}},m=n=>{try{n?e.setItem(t,JSON.stringify(n)):e.removeItem(t)}catch{}},h=c(n)?null:p(),g=c(n)?`safe`:h?`pending`:`normal`,_=h,v=`idle`,y=new Set,b=[],x=null,S=null,C=()=>{S?.(),S=null},w=()=>{for(let e of[...f])e()};return{mode:()=>g,staleSentinel:()=>_,beginLoad(e){g===`normal`&&v!==`done`&&(x!==null&&(u(x),x=null),v=`loading`,S??=d(()=>{v===`loading`&&m(null)}),y.add(e),!b.includes(e)&&b.length<a&&b.push(e),m({loading:{at:new Date(r()).toISOString(),instanceIds:[...b]}}))},endLoad(e){v!==`loading`||!y.delete(e)||y.size||(x=o(()=>{x=null,!y.size&&(v=`done`,C(),m(null))},i))},resolve(e){g===`pending`&&(_=null,m(null),g=e===`safe`?`safe`:`normal`,w())},subscribe(e){return f.add(e),()=>{f.delete(e)}},dispose(){x!==null&&u(x),x=null,C(),f.clear()}}}var d=null;function f(){return d??=u({storage:e,search:typeof window>`u`?``:window.location.search}),d}export{f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./index-at6jiRd2.js";var t=`pisper-components-safe-mode`;function n(){try{return e.getItem(t)!==null}catch{return!1}}export{n,t};
|
package/web/assets/{session-change-summary-api-BHpd8dcW.js → session-change-summary-api-CyghX14t.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./startup-queries-
|
|
1
|
+
import{a as e}from"./startup-queries-BpV9-ykp.js";import{t}from"./api-BhPOJ07B.js";function n(e){if(!e||typeof e!=`object`)throw Error(`Invalid change summary`);let t=e;if(t.status!==`known`&&t.status!==`partial`&&t.status!==`unavailable`||!Number.isInteger(t.unknownFiles)||Number(t.unknownFiles)<0||typeof t.capped!=`boolean`||![`changedFiles`,`pendingFiles`,`added`,`removed`].every(e=>t.status===`known`?Number.isInteger(t[e])&&Number(t[e])>=0:t[e]===null))throw Error(`Invalid change summary`);return t}async function r(e){return n(await t(`/api/sessions/${encodeURIComponent(e)}/change-summary`))}function i(t){return e.invalidateQueries({queryKey:[`session-change-summary`,t]})}export{i as n,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-at6jiRd2.js";var t=`pisper-last-session`;function n(e){if(typeof e!=`string`)return``;let t=e.trim();return!t||t.length>256||t===`new`||/[\u0000-\u001f\u007f]/.test(t)?``:t}function r(){try{return n(e.getItem(t))}catch{return``}}function i(r){let i=n(r);if(i)try{e.getItem(`pisper-last-session`)!==i&&e.setItem(t,i)}catch{}}function a(n){try{e.getItem(`pisper-last-session`)===n&&e.removeItem(t)}catch{}}function o(e){if(!e||typeof e!=`object`)return null;let t=e.sessions;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let{id:t,archived:n}=e;return typeof t==`string`&&t?[{id:t,archived:n===!0}]:[]}):null}function s({lastId:e,data:t,failed:n}){if(!e)return{kind:`draft`};let r=o(t);if(!r)return n?{kind:`error`}:{kind:`loading`};let i=r.find(t=>t.id===e);return i&&!i.archived?{kind:`session`,id:i.id}:{kind:`draft`}}export{i,s as n,r,a as t};
|
package/web/assets/{session-inspector-store-DHEIlh_X.js → session-inspector-store-BocK0l86.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-at6jiRd2.js";import{a as t,i as n,o as r}from"./vendor-state-GkUciC5H.js";var i=[`changes`,`terminal`,`running`,`files`,`preview`,`plan`,`side-chat`],a=3,o=720;function s(e){return typeof e!=`number`||!Number.isFinite(e)?456:Math.min(o,Math.max(360,Math.round(e)))}function c(e){return Math.round(Math.min(80,Math.max(a,e))*100)/100}function l(e,t){return typeof e==`number`&&Number.isFinite(e)?c(e):typeof t==`number`&&s(t)!==456?null:39}function u(e,t){let n=Math.max(360,Math.min(t*80/100,t-480-8));return Math.round(Math.min(n,Math.max(360,e)))}function d({widthPercent:e,width:t},n){return u(e===null?s(t):n*e/100,n)}function f(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{},n=i.find(e=>e===t.tab)??`changes`,r=t.pinned===!0;return{open:r&&t.open!==!1,pinned:r,tab:n===`side-chat`?`changes`:n,widthPercent:l(t.widthPercent,t.width),width:s(t.width),terminalView:t.terminalView===`processes`?`processes`:`terminal`,changesView:t.changesView===`workspace`?`workspace`:`session`,diffMode:t.diffMode===`split`?`split`:`unified`}}var p=n(()=>({getItem:t=>{try{return e.getItem(t)}catch{return null}},setItem:(t,n)=>{try{e.setItem(t,n)}catch{}},removeItem:t=>{try{e.removeItem(t)}catch{}}})),m=r()(t((e,t)=>({...f(void 0),setOpen:n=>{t().open!==n&&e({open:n})},setPinned:t=>e(t?{pinned:t,open:!0}:{pinned:t}),setTab:n=>{t().tab!==n&&e({tab:n})},setWidth:(n,r)=>{if(!(r>0))return;let i=c(n/r*100);t().widthPercent!==i&&e({widthPercent:i,width:s(n)})},resetWidth:()=>e({widthPercent:39,width:456}),setTerminalView:t=>e({terminalView:t}),setChangesView:t=>e({changesView:t}),setDiffMode:t=>e({diffMode:t})}),{name:`pisper-session-inspector`,version:1,storage:p,partialize:({open:e,pinned:t,tab:n,widthPercent:r,width:i,terminalView:a,changesView:o,diffMode:s})=>({open:e,pinned:t,tab:n,widthPercent:r,width:i,terminalView:a,changesView:o,diffMode:s}),migrate:e=>f(e),merge:(e,t)=>({...t,...f(e)})}));export{d as n,m as r,u as t};
|
package/web/assets/{session-organization-api-D9hTSIh7.js → session-organization-api-CGRK7VMP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./api-
|
|
1
|
+
import{t as e}from"./api-BhPOJ07B.js";import{u as t}from"./events-CcKmvwE6.js";var n=class extends Error{code=`invalid_session_organization_response`};function r(e){if(!e||typeof e!=`object`)throw new n;let{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}=e;if(typeof t!=`string`||!t||typeof r!=`boolean`||typeof i!=`boolean`||typeof a!=`boolean`||typeof o!=`boolean`||s!==null&&s!==`approval`&&s!==`failure`)throw new n;return{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}}async function i(i,a){if(!i||!Object.keys(a).length)throw new n;let o=r(await e(`/api/sessions/${encodeURIComponent(i)}/organization`,{method:`PATCH`,body:JSON.stringify(a)}));if(o.id!==i)throw new n;return t(o),o}export{i as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./http-response-PZN5QIRk.js";import{n as t,r as n}from"./http-Bp65Kb4t.js";import{o as r}from"./session-board-status-D2lpFPiI.js";var i={all:[`custom-ui`],catalog:()=>[`custom-ui`,`catalog`],instances:()=>[`custom-ui`,`instances`],describe:e=>[`custom-ui`,`describe`,e],errors:e=>[`custom-ui`,`errors`,e],versions:e=>[`custom-ui`,`versions`,e],usage:e=>[`custom-ui`,`usage`,e],trash:()=>[`custom-ui`,`trash`],staged:e=>[`custom-ui`,`staged`,e]};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var o=[`overview-card`,`session-panel`,`feature-page`,`floating`],s=[`S`,`M`],c=/^[a-z0-9][a-z0-9._-]{0,63}$/,l=/^[a-f0-9]{24}$/,u=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,79}$/,d=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/,f=/^[a-f0-9]{16}$/,p=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`];function m(e,t=4e3){return typeof e==`string`?e.slice(0,t):``}function h(e){if(typeof e!=`string`||!e||e.length>512)return!1;let t=e.split(`/`);return t.length<=3&&t.every(e=>d.test(e))}function g(e,t=200){let n={};if(!a(e))return n;for(let[r,i]of Object.entries(e).slice(0,t))typeof i==`string`&&(n[r]=i);return n}function _(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,200)){if(!a(n)||typeof n.code!=`string`||!n.code)continue;let e={path:m(n.path,512),code:m(n.code,128)};if(a(n.params)){let t={};for(let[e,r]of Object.entries(n.params))(typeof r==`string`||typeof r==`number`&&Number.isFinite(r))&&(t[e]=r);e.params=t}t.push(e)}return t}function v(e){let t={};if(!a(e))return t;for(let n of[`zh-CN`,`en-US`]){let r=e[n];a(r)&&(t[n]={...typeof r.name==`string`?{name:r.name}:{},...typeof r.description==`string`?{description:r.description}:{},strings:g(r.strings,500)})}return t}function y(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!a(n)||!o.includes(n.surface))continue;let e=n.surface;if(t.some(t=>t.surface===e))continue;let r={surface:e};if(Array.isArray(n.sizes)){let e=s.filter(e=>n.sizes.includes(e));e.length&&(r.sizes=e)}a(n.size)&&typeof n.size.w==`number`&&typeof n.size.h==`number`&&Number.isFinite(n.size.w)&&Number.isFinite(n.size.h)&&n.size.w>0&&n.size.h>0&&(r.size={w:n.size.w,h:n.size.h}),t.push(r)}return t}function b(e){let t={};if(!a(e))return t;let n=e=>m(e.reason,500);for(let r of[`notify`,`sessions.read`,`sessions.open`]){let i=e[r];a(i)&&(t[r]={reason:n(i)})}let r=e[`provider.request`];a(r)&&Array.isArray(r.paths)&&Array.isArray(r.methods)&&(t[`provider.request`]={reason:n(r),paths:r.paths.filter(e=>typeof e==`string`),methods:r.methods.filter(e=>typeof e==`string`)});let i=e.network;a(i)&&Array.isArray(i.hosts)&&(t.network={reason:n(i),hosts:i.hosts.filter(e=>typeof e==`string`).slice(0,32),...Array.isArray(i.privateOrigins)&&{privateOrigins:i.privateOrigins.filter(e=>typeof e==`string`).slice(0,32)}});let o=e.storage;return a(o)&&(t.storage={reason:n(o),quotaKb:typeof o.quotaKb==`number`&&Number.isFinite(o.quotaKb)?o.quotaKb:256}),t}function x(e,t){if(!a(t)||t.runtime!==`native`||t.id!==e||!h(t.entry))return null;let n=a(t.props)?t.props:null;if(!n||n.type!==`object`||!a(n.properties))return null;let r=Array.isArray(t.styles)?t.styles:[];return r.every(h)?{runtime:`native`,id:e,name:m(t.name,120)||e,version:m(t.version,64),description:m(t.description,500),entry:t.entry,styles:r.slice(0,8),icon:m(t.icon,48),i18n:v(t.i18n),props:{type:`object`,properties:n.properties,required:Array.isArray(n.required)?n.required.filter(e=>typeof e==`string`):[]},placements:y(t.placements),capabilities:b(t.capabilities),sdk:typeof t.sdk==`number`?t.sdk:1,minHostVersion:m(t.minHostVersion,64)}:null}function S(e){return e===`agent`||e===`template`||e===`import`?e:`local`}function C(e){return Array.isArray(e)?p.filter(t=>e.includes(t)):[]}function w(e){return!a(e)||typeof e.stageId!=`string`||!f.test(e.stageId)||typeof e.id!=`string`||!c.test(e.id)?null:{stageId:e.stageId,id:e.id,name:m(e.name,120)||e.id,version:m(e.version,64),fileName:m(e.fileName,200)||`${e.id}.zip`,bytes:typeof e.bytes==`number`&&Number.isFinite(e.bytes)?e.bytes:0,sha256:/^[a-f0-9]{64}$/.test(String(e.sha256))?String(e.sha256):``,createdAt:m(e.createdAt,64),replaces:e.replaces===`native`||e.replaces===`legacy`||e.replaces===`broken`?e.replaces:null}}function T(e){if(!a(e)||typeof e.id!=`string`||!c.test(e.id))return null;let t=e.id,n={id:t,name:m(e.name,120)||t,version:m(e.version,64),description:m(e.description,500),directory:m(e.directory,4096),updatedAt:m(e.updatedAt,64),revoked:C(e.revoked)};if(e.kind!==`native`&&e.kind!==`broken`)return{...n,kind:`legacy`,status:`unsupported`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};if(e.kind===`broken`)return{...n,kind:`broken`,status:`invalid`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};let r=_(e.errors),i={...n,kind:`native`,status:e.status===`ready`?`ready`:`invalid`,enabled:e.enabled===!0,source:S(e.source),entry:m(e.entry,512),errors:r};if(e.manifest!==void 0){let n=x(t,e.manifest);n&&(i.manifest=n)}return i.status===`ready`&&(typeof e.rev==`string`&&l.test(e.rev)&&i.manifest?i.rev=e.rev:(i.status=`invalid`,i.errors=[...r,{path:``,code:`component_response_invalid`}])),i}function E(e){if(!a(e)||typeof e.root!=`string`||!Array.isArray(e.components))throw Error(`Invalid custom UI component response`);let t=a(e.features)?e.features:null,n=[],r=new Set;for(let t of e.components){let e=T(t);!e||r.has(e.id)||(r.add(e.id),n.push(e))}let i=[];for(let t of Array.isArray(e.staged)?e.staged.slice(0,50):[]){let e=w(t);e&&!i.some(t=>t.stageId===e.stageId)&&i.push(e)}return{root:e.root,features:{import:t?.import===!0,versions:t?.versions===!0,export:t?.export===!0,trash:t?.trash===`move`?`move`:`none`,trashRestore:t?.trashRestore===!0,usage:t?.usage===!0,revoke:t?.revoke===!0},components:n,staged:i,legacyShape:!t}}function D(e){return a(e)?e.type===`all`?{type:`all`}:e.type===`project`&&typeof e.cwd==`string`&&e.cwd?{type:`project`,cwd:e.cwd}:null:null}function O(e){if(!a(e)||typeof e.instanceId!=`string`||!u.test(e.instanceId)||typeof e.componentId!=`string`||!c.test(e.componentId)||!o.includes(e.surface))return null;let t=e.surface;return{instanceId:e.instanceId,componentId:e.componentId,surface:t,size:t===`overview-card`?s.includes(e.size)?e.size:`S`:null,scope:t===`session-panel`?D(e.scope)??{type:`all`}:null,title:m(e.title,80),props:a(e.props)?e.props:{},enabled:e.enabled!==!1,order:typeof e.order==`number`&&Number.isFinite(e.order)?e.order:0,createdAt:m(e.createdAt,64),updatedAt:m(e.updatedAt,64)}}function k(e){if(!a(e)||typeof e.revision!=`number`||!Number.isSafeInteger(e.revision)||!Array.isArray(e.instances))throw Error(`Invalid custom UI instances response`);let t=[],n=new Set;for(let r of e.instances){let e=O(r);!e||n.has(e.instanceId)||(n.add(e.instanceId),t.push(e))}return t.sort((e,t)=>e.order-t.order),{revision:e.revision,instances:t}}function A(e){let t=a(e)?O(e.instance):null;if(!t||!a(e)||typeof e.revision!=`number`)throw Error(`Invalid custom UI instance response`);return{revision:e.revision,instance:t}}function j(e){if(!a(e)||!Array.isArray(e.entries))throw Error(`Invalid custom UI errors response`);let t=[];for(let n of e.entries.slice(-200))!a(n)||typeof n.message!=`string`||t.push({at:m(n.at,64),kind:m(n.kind,32),level:m(n.level,16),message:m(n.message,500),...typeof n.stack==`string`?{stack:m(n.stack,4e3)}:{},...typeof n.instanceId==`string`?{instanceId:m(n.instanceId,80)}:{},...typeof n.surface==`string`?{surface:m(n.surface,32)}:{}});let n=a(e.network)?e.network:{},r={};if(a(n.hosts))for(let[e,t]of Object.entries(n.hosts).slice(0,64))typeof t==`number`&&Number.isFinite(t)&&(r[e]=t);return{entries:t,dropped:typeof e.dropped==`number`&&Number.isFinite(e.dropped)?e.dropped:0,network:{count:typeof n.count==`number`&&Number.isFinite(n.count)?n.count:0,lastAt:typeof n.lastAt==`string`?n.lastAt:null,hosts:r}}}function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function N(e){if(!a(e)||e.status!==`ok`)return{status:`unsupported`};let t=a(e.summary)?e.summary:{},n=[`danger`,`warn`,`info`];return{status:`ok`,hosts:(Array.isArray(e.hosts)?e.hosts.slice(0,50):[]).flatMap(e=>a(e)&&typeof e.host==`string`?[{host:m(e.host,253),declared:e.declared===!0,file:m(e.file,512),line:M(e.line)}]:[]),findings:(Array.isArray(e.findings)?e.findings.slice(0,200):[]).flatMap(e=>a(e)&&typeof e.rule==`string`&&n.includes(e.severity)?[{rule:m(e.rule,32),severity:e.severity,file:m(e.file,512),line:M(e.line),excerpt:m(e.excerpt,200)}]:[]),summary:{danger:M(t.danger),warn:M(t.warn),info:M(t.info),undeclaredHosts:M(t.undeclaredHosts)},truncated:e.truncated===!0}}function P(e){return Array.isArray(e)?e.filter(e=>a(e)&&typeof e.path==`string`&&typeof e.size==`number`&&typeof e.type==`string`).slice(0,256).map(e=>({path:e.path,size:e.size,type:e.type})):[]}function F(e){let t=a(e)?T(e.component):null;if(!t||!a(e)||!Array.isArray(e.files))throw Error(`Invalid custom UI describe response`);return{component:t,files:P(e.files),errors:_(e.errors),scan:N(e.scan)}}function I(e){if(!a(e)||typeof e.status!=`number`||typeof e.body!=`string`||e.bodyEncoding!==`utf8`&&e.bodyEncoding!==`base64`)throw Error(`Invalid custom UI fetch response`);return{status:e.status,statusText:m(e.statusText,200),headers:g(e.headers,64),body:e.body,bodyEncoding:e.bodyEncoding,url:m(e.url,2048),redirected:e.redirected===!0}}function L(t){if(!(t instanceof e)||!t.data)return null;let n=t.data.code??t.data.error;return typeof n==`string`&&/^[a-z0-9_]{1,64}$/.test(n)?n:null}function R(t){return!(t instanceof e)||!t.data?[]:_(t.data.errors)}var z=e=>`/api/custom-ui/components/${encodeURIComponent(e)}`;function B(e,t,n){if(!c.test(e)||!l.test(t)||!h(n))throw Error(`Invalid component module path`);return`${z(e)}/r/${t}/${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e,t,r,i){return n(B(e,t,r),{signal:i})}function H(e){return t(`/api/custom-ui/components`,{signal:e,parse:E})}function U(e,n){return t(`${z(e)}/describe`,{signal:n,parse:F})}function ee(e){return t(`/api/custom-ui/components`,{method:`POST`,body:e,parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function W(e,n){return t(z(e),{method:`PATCH`,body:{enabled:n},parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function G(e){return t(z(e),{method:`DELETE`,parse:e=>({trashedAs:a(e)?m(e.trashedAs,256):``})})}function K(e){return t(`/api/custom-ui/instances`,{signal:e,parse:k})}function q(e){return t(`/api/custom-ui/instances`,{method:`POST`,body:e,parse:A})}function J(e,n){return t(`/api/custom-ui/instances/${encodeURIComponent(e)}`,{method:`PATCH`,body:n,parse:A})}function Y(e){return t(`/api/custom-ui/instances/${encodeURIComponent(e)}`,{method:`DELETE`,parse:e=>({revision:a(e)&&typeof e.revision==`number`?e.revision:0})})}function X(e,n){return t(`${z(e)}/errors`,{signal:n,parse:j})}function Z(e,n){return t(`${z(e)}/errors`,{method:`POST`,body:n,keepalive:!0,parse:()=>void 0})}function Q(e,n){return t(`${z(e)}/usage`,{method:`POST`,body:{entries:n},keepalive:!0,parse:()=>void 0})}function $(e,n,r){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{signal:r,parse:e=>{if(!a(e)||!Object.hasOwn(e,`value`))throw Error(`Invalid custom UI storage response`);return{value:e.value}}})}function te(e,n,r){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{method:`PUT`,body:{value:r},parse:()=>void 0})}function ne(e,n){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{method:`DELETE`,parse:()=>void 0})}async function re(e,n,r,i){return await t(`/api/custom-ui/provider-session`,{method:`PUT`,body:{sessionId:n},signal:i,timeout:15e3,parse:()=>void 0}),t(`${z(e)}/provider-request`,{method:`POST`,body:{sessionId:n,request:r},signal:i,timeout:15e3,parse:I})}function ie(e,n,r){return t(`${z(e)}/fetch`,{method:`POST`,body:n,signal:r,timeout:15e3,parse:I})}var ae=/^[A-Za-z0-9._:-]{1,128}$/,oe=/^\/skill:[a-z0-9][a-z0-9-]{0,63}$/;function se(e){if(!a(e)||typeof e.sessionId!=`string`||!ae.test(e.sessionId))throw Error(`Invalid custom UI session response`);let t=typeof e.command==`string`&&oe.test(e.command)?e.command:``,n=a(e.session)&&e.session.id===e.sessionId?e.session:null;return{sessionId:e.sessionId,created:e.created===!0,command:t,session:n}}function ce(e){return t(`${z(e)}/session`,{method:`POST`,body:{},parse:se})}function le(e=!0){return{queryKey:i.catalog(),queryFn:({signal:e})=>H(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function ue(e=!0){return{queryKey:i.instances(),queryFn:({signal:e})=>K(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function de(e,t){if(!e||e.type===`all`)return!0;let n=r(t);return n!==``&&r(e.cwd)===n}export{J as A,x as C,Q as D,Z as E,ce as O,_ as S,V as T,H as _,ie as a,T as b,re as c,te as d,ee as f,U as g,Y as h,L as i,i as j,W as k,$ as l,G as m,le as n,R as o,q as p,ue as r,B as s,de as t,ne as u,X as v,w,N as x,P as y};
|
|
1
|
+
import{i as e}from"./http-response-scdqC11Q.js";import{n as t,r as n}from"./http-CXQuFoDX.js";import{o as r}from"./session-board-status-D2lpFPiI.js";var i={all:[`custom-ui`],catalog:()=>[`custom-ui`,`catalog`],instances:()=>[`custom-ui`,`instances`],describe:e=>[`custom-ui`,`describe`,e],errors:e=>[`custom-ui`,`errors`,e],versions:e=>[`custom-ui`,`versions`,e],usage:e=>[`custom-ui`,`usage`,e],trash:()=>[`custom-ui`,`trash`],staged:e=>[`custom-ui`,`staged`,e]};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var o=[`overview-card`,`session-panel`,`feature-page`,`floating`],s=[`S`,`M`],c=/^[a-z0-9][a-z0-9._-]{0,63}$/,l=/^[a-f0-9]{24}$/,u=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,79}$/,d=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/,f=/^[a-f0-9]{16}$/,p=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`];function m(e,t=4e3){return typeof e==`string`?e.slice(0,t):``}function h(e){if(typeof e!=`string`||!e||e.length>512)return!1;let t=e.split(`/`);return t.length<=3&&t.every(e=>d.test(e))}function g(e,t=200){let n={};if(!a(e))return n;for(let[r,i]of Object.entries(e).slice(0,t))typeof i==`string`&&(n[r]=i);return n}function _(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,200)){if(!a(n)||typeof n.code!=`string`||!n.code)continue;let e={path:m(n.path,512),code:m(n.code,128)};if(a(n.params)){let t={};for(let[e,r]of Object.entries(n.params))(typeof r==`string`||typeof r==`number`&&Number.isFinite(r))&&(t[e]=r);e.params=t}t.push(e)}return t}function v(e){let t={};if(!a(e))return t;for(let n of[`zh-CN`,`en-US`]){let r=e[n];a(r)&&(t[n]={...typeof r.name==`string`?{name:r.name}:{},...typeof r.description==`string`?{description:r.description}:{},strings:g(r.strings,500)})}return t}function y(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!a(n)||!o.includes(n.surface))continue;let e=n.surface;if(t.some(t=>t.surface===e))continue;let r={surface:e};if(Array.isArray(n.sizes)){let e=s.filter(e=>n.sizes.includes(e));e.length&&(r.sizes=e)}a(n.size)&&typeof n.size.w==`number`&&typeof n.size.h==`number`&&Number.isFinite(n.size.w)&&Number.isFinite(n.size.h)&&n.size.w>0&&n.size.h>0&&(r.size={w:n.size.w,h:n.size.h}),t.push(r)}return t}function b(e){let t={};if(!a(e))return t;let n=e=>m(e.reason,500);for(let r of[`notify`,`sessions.read`,`sessions.open`]){let i=e[r];a(i)&&(t[r]={reason:n(i)})}let r=e[`provider.request`];a(r)&&Array.isArray(r.paths)&&Array.isArray(r.methods)&&(t[`provider.request`]={reason:n(r),paths:r.paths.filter(e=>typeof e==`string`),methods:r.methods.filter(e=>typeof e==`string`)});let i=e.network;a(i)&&Array.isArray(i.hosts)&&(t.network={reason:n(i),hosts:i.hosts.filter(e=>typeof e==`string`).slice(0,32),...Array.isArray(i.privateOrigins)&&{privateOrigins:i.privateOrigins.filter(e=>typeof e==`string`).slice(0,32)}});let o=e.storage;return a(o)&&(t.storage={reason:n(o),quotaKb:typeof o.quotaKb==`number`&&Number.isFinite(o.quotaKb)?o.quotaKb:256}),t}function x(e,t){if(!a(t)||t.runtime!==`native`||t.id!==e||!h(t.entry))return null;let n=a(t.props)?t.props:null;if(!n||n.type!==`object`||!a(n.properties))return null;let r=Array.isArray(t.styles)?t.styles:[];return r.every(h)?{runtime:`native`,id:e,name:m(t.name,120)||e,version:m(t.version,64),description:m(t.description,500),entry:t.entry,styles:r.slice(0,8),icon:m(t.icon,48),i18n:v(t.i18n),props:{type:`object`,properties:n.properties,required:Array.isArray(n.required)?n.required.filter(e=>typeof e==`string`):[]},placements:y(t.placements),capabilities:b(t.capabilities),sdk:typeof t.sdk==`number`?t.sdk:1,minHostVersion:m(t.minHostVersion,64)}:null}function S(e){return e===`agent`||e===`template`||e===`import`?e:`local`}function C(e){return Array.isArray(e)?p.filter(t=>e.includes(t)):[]}function w(e){return!a(e)||typeof e.stageId!=`string`||!f.test(e.stageId)||typeof e.id!=`string`||!c.test(e.id)?null:{stageId:e.stageId,id:e.id,name:m(e.name,120)||e.id,version:m(e.version,64),fileName:m(e.fileName,200)||`${e.id}.zip`,bytes:typeof e.bytes==`number`&&Number.isFinite(e.bytes)?e.bytes:0,sha256:/^[a-f0-9]{64}$/.test(String(e.sha256))?String(e.sha256):``,createdAt:m(e.createdAt,64),replaces:e.replaces===`native`||e.replaces===`legacy`||e.replaces===`broken`?e.replaces:null}}function T(e){if(!a(e)||typeof e.id!=`string`||!c.test(e.id))return null;let t=e.id,n={id:t,name:m(e.name,120)||t,version:m(e.version,64),description:m(e.description,500),directory:m(e.directory,4096),updatedAt:m(e.updatedAt,64),revoked:C(e.revoked)};if(e.kind!==`native`&&e.kind!==`broken`)return{...n,kind:`legacy`,status:`unsupported`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};if(e.kind===`broken`)return{...n,kind:`broken`,status:`invalid`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};let r=_(e.errors),i={...n,kind:`native`,status:e.status===`ready`?`ready`:`invalid`,enabled:e.enabled===!0,source:S(e.source),entry:m(e.entry,512),errors:r};if(e.manifest!==void 0){let n=x(t,e.manifest);n&&(i.manifest=n)}return i.status===`ready`&&(typeof e.rev==`string`&&l.test(e.rev)&&i.manifest?i.rev=e.rev:(i.status=`invalid`,i.errors=[...r,{path:``,code:`component_response_invalid`}])),i}function E(e){if(!a(e)||typeof e.root!=`string`||!Array.isArray(e.components))throw Error(`Invalid custom UI component response`);let t=a(e.features)?e.features:null,n=[],r=new Set;for(let t of e.components){let e=T(t);!e||r.has(e.id)||(r.add(e.id),n.push(e))}let i=[];for(let t of Array.isArray(e.staged)?e.staged.slice(0,50):[]){let e=w(t);e&&!i.some(t=>t.stageId===e.stageId)&&i.push(e)}return{root:e.root,features:{import:t?.import===!0,versions:t?.versions===!0,export:t?.export===!0,trash:t?.trash===`move`?`move`:`none`,trashRestore:t?.trashRestore===!0,usage:t?.usage===!0,revoke:t?.revoke===!0},components:n,staged:i,legacyShape:!t}}function D(e){return a(e)?e.type===`all`?{type:`all`}:e.type===`project`&&typeof e.cwd==`string`&&e.cwd?{type:`project`,cwd:e.cwd}:null:null}function O(e){if(!a(e)||typeof e.instanceId!=`string`||!u.test(e.instanceId)||typeof e.componentId!=`string`||!c.test(e.componentId)||!o.includes(e.surface))return null;let t=e.surface;return{instanceId:e.instanceId,componentId:e.componentId,surface:t,size:t===`overview-card`?s.includes(e.size)?e.size:`S`:null,scope:t===`session-panel`?D(e.scope)??{type:`all`}:null,title:m(e.title,80),props:a(e.props)?e.props:{},enabled:e.enabled!==!1,order:typeof e.order==`number`&&Number.isFinite(e.order)?e.order:0,createdAt:m(e.createdAt,64),updatedAt:m(e.updatedAt,64)}}function k(e){if(!a(e)||typeof e.revision!=`number`||!Number.isSafeInteger(e.revision)||!Array.isArray(e.instances))throw Error(`Invalid custom UI instances response`);let t=[],n=new Set;for(let r of e.instances){let e=O(r);!e||n.has(e.instanceId)||(n.add(e.instanceId),t.push(e))}return t.sort((e,t)=>e.order-t.order),{revision:e.revision,instances:t}}function A(e){let t=a(e)?O(e.instance):null;if(!t||!a(e)||typeof e.revision!=`number`)throw Error(`Invalid custom UI instance response`);return{revision:e.revision,instance:t}}function j(e){if(!a(e)||!Array.isArray(e.entries))throw Error(`Invalid custom UI errors response`);let t=[];for(let n of e.entries.slice(-200))!a(n)||typeof n.message!=`string`||t.push({at:m(n.at,64),kind:m(n.kind,32),level:m(n.level,16),message:m(n.message,500),...typeof n.stack==`string`?{stack:m(n.stack,4e3)}:{},...typeof n.instanceId==`string`?{instanceId:m(n.instanceId,80)}:{},...typeof n.surface==`string`?{surface:m(n.surface,32)}:{}});let n=a(e.network)?e.network:{},r={};if(a(n.hosts))for(let[e,t]of Object.entries(n.hosts).slice(0,64))typeof t==`number`&&Number.isFinite(t)&&(r[e]=t);return{entries:t,dropped:typeof e.dropped==`number`&&Number.isFinite(e.dropped)?e.dropped:0,network:{count:typeof n.count==`number`&&Number.isFinite(n.count)?n.count:0,lastAt:typeof n.lastAt==`string`?n.lastAt:null,hosts:r}}}function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function N(e){if(!a(e)||e.status!==`ok`)return{status:`unsupported`};let t=a(e.summary)?e.summary:{},n=[`danger`,`warn`,`info`];return{status:`ok`,hosts:(Array.isArray(e.hosts)?e.hosts.slice(0,50):[]).flatMap(e=>a(e)&&typeof e.host==`string`?[{host:m(e.host,253),declared:e.declared===!0,file:m(e.file,512),line:M(e.line)}]:[]),findings:(Array.isArray(e.findings)?e.findings.slice(0,200):[]).flatMap(e=>a(e)&&typeof e.rule==`string`&&n.includes(e.severity)?[{rule:m(e.rule,32),severity:e.severity,file:m(e.file,512),line:M(e.line),excerpt:m(e.excerpt,200)}]:[]),summary:{danger:M(t.danger),warn:M(t.warn),info:M(t.info),undeclaredHosts:M(t.undeclaredHosts)},truncated:e.truncated===!0}}function P(e){return Array.isArray(e)?e.filter(e=>a(e)&&typeof e.path==`string`&&typeof e.size==`number`&&typeof e.type==`string`).slice(0,256).map(e=>({path:e.path,size:e.size,type:e.type})):[]}function F(e){let t=a(e)?T(e.component):null;if(!t||!a(e)||!Array.isArray(e.files))throw Error(`Invalid custom UI describe response`);return{component:t,files:P(e.files),errors:_(e.errors),scan:N(e.scan)}}function I(e){if(!a(e)||typeof e.status!=`number`||typeof e.body!=`string`||e.bodyEncoding!==`utf8`&&e.bodyEncoding!==`base64`)throw Error(`Invalid custom UI fetch response`);return{status:e.status,statusText:m(e.statusText,200),headers:g(e.headers,64),body:e.body,bodyEncoding:e.bodyEncoding,url:m(e.url,2048),redirected:e.redirected===!0}}function L(t){if(!(t instanceof e)||!t.data)return null;let n=t.data.code??t.data.error;return typeof n==`string`&&/^[a-z0-9_]{1,64}$/.test(n)?n:null}function R(t){return!(t instanceof e)||!t.data?[]:_(t.data.errors)}var z=e=>`/api/custom-ui/components/${encodeURIComponent(e)}`;function B(e,t,n){if(!c.test(e)||!l.test(t)||!h(n))throw Error(`Invalid component module path`);return`${z(e)}/r/${t}/${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e,t,r,i){return n(B(e,t,r),{signal:i})}function H(e){return t(`/api/custom-ui/components`,{signal:e,parse:E})}function U(e,n){return t(`${z(e)}/describe`,{signal:n,parse:F})}function ee(e){return t(`/api/custom-ui/components`,{method:`POST`,body:e,parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function W(e,n){return t(z(e),{method:`PATCH`,body:{enabled:n},parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function G(e){return t(z(e),{method:`DELETE`,parse:e=>({trashedAs:a(e)?m(e.trashedAs,256):``})})}function K(e){return t(`/api/custom-ui/instances`,{signal:e,parse:k})}function q(e){return t(`/api/custom-ui/instances`,{method:`POST`,body:e,parse:A})}function J(e,n){return t(`/api/custom-ui/instances/${encodeURIComponent(e)}`,{method:`PATCH`,body:n,parse:A})}function Y(e){return t(`/api/custom-ui/instances/${encodeURIComponent(e)}`,{method:`DELETE`,parse:e=>({revision:a(e)&&typeof e.revision==`number`?e.revision:0})})}function X(e,n){return t(`${z(e)}/errors`,{signal:n,parse:j})}function Z(e,n){return t(`${z(e)}/errors`,{method:`POST`,body:n,keepalive:!0,parse:()=>void 0})}function Q(e,n){return t(`${z(e)}/usage`,{method:`POST`,body:{entries:n},keepalive:!0,parse:()=>void 0})}function $(e,n,r){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{signal:r,parse:e=>{if(!a(e)||!Object.hasOwn(e,`value`))throw Error(`Invalid custom UI storage response`);return{value:e.value}}})}function te(e,n,r){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{method:`PUT`,body:{value:r},parse:()=>void 0})}function ne(e,n){return t(`${z(e)}/storage/${encodeURIComponent(n)}`,{method:`DELETE`,parse:()=>void 0})}async function re(e,n,r,i){return await t(`/api/custom-ui/provider-session`,{method:`PUT`,body:{sessionId:n},signal:i,timeout:15e3,parse:()=>void 0}),t(`${z(e)}/provider-request`,{method:`POST`,body:{sessionId:n,request:r},signal:i,timeout:15e3,parse:I})}function ie(e,n,r){return t(`${z(e)}/fetch`,{method:`POST`,body:n,signal:r,timeout:15e3,parse:I})}var ae=/^[A-Za-z0-9._:-]{1,128}$/,oe=/^\/skill:[a-z0-9][a-z0-9-]{0,63}$/;function se(e){if(!a(e)||typeof e.sessionId!=`string`||!ae.test(e.sessionId))throw Error(`Invalid custom UI session response`);let t=typeof e.command==`string`&&oe.test(e.command)?e.command:``,n=a(e.session)&&e.session.id===e.sessionId?e.session:null;return{sessionId:e.sessionId,created:e.created===!0,command:t,session:n}}function ce(e){return t(`${z(e)}/session`,{method:`POST`,body:{},parse:se})}function le(e=!0){return{queryKey:i.catalog(),queryFn:({signal:e})=>H(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function ue(e=!0){return{queryKey:i.instances(),queryFn:({signal:e})=>K(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function de(e,t){if(!e||e.type===`all`)return!0;let n=r(t);return n!==``&&r(e.cwd)===n}export{J as A,x as C,Q as D,Z as E,ce as O,_ as S,V as T,H as _,ie as a,T as b,re as c,te as d,ee as f,U as g,Y as h,L as i,i as j,W as k,$ as l,G as m,le as n,R as o,q as p,ue as r,B as s,de as t,ne as u,X as v,w,N as x,P as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l as e}from"./events-
|
|
1
|
+
import{l as e}from"./events-CcKmvwE6.js";import{t}from"./chat-api-CdqM-TFw.js";import{n,o as r,t as i}from"./session-tree-summary-CqrRroey.js";function a(e){if(typeof e!=`string`)return``;let t=e.trim();return t&&t.length<=200?t:``}async function o(n,a,{notify:o,t:s}){try{let r=await t.navigateSessionTree(n,a,!1);return i(n,r),e(n),o(s(`chat:sessionTree.undone`)),!0}catch(e){return o(r(e),`error`),!1}}function s(e,t,n,r){let i=a(t?.restoreEntryId);r.notify(n,`success`,i?{action:{label:r.t(`chat:sessionTree.undo`),onAction:()=>void o(e,i,r)}}:void 0)}function c(e){return{title:e(`chat:sessionTree.otherBranchTitle`),message:e(`chat:sessionTree.otherBranchMessage`),confirmLabel:e(`chat:sessionTree.switchBranch`),tone:`primary`}}async function l({sessionId:e,entryId:r,confirm:i,open:a,notify:o,t:l}){if(!await i(c(l)))return!1;let u=await t.navigateSessionTreeTarget(e,r);return!u.cancelled&&(n(e),a(e,r),s(e,u,l(`chat:sessionTree.switchedBranch`),{notify:o,t:l}),!0)}var u=8;function d(e,t){let n=e.files.filter(e=>e.action!==`unavailable`),r=e.files.filter(e=>e.action===`unavailable`),i=[];if(n.length){i.push(t(`chat:fileRewind.summary`,{count:n.length,restore:n.filter(e=>e.action===`restore`).length,remove:n.filter(e=>e.action===`delete`).length}));for(let e of n.slice(0,u))i.push(e.action===`delete`?t(`chat:fileRewind.deleteItem`,{path:e.path}):t(`chat:fileRewind.restoreItem`,{path:e.path}));n.length>u&&i.push(t(`chat:fileRewind.more`,{count:n.length-u}))}else i.push(t(`chat:fileRewind.nothing`));return r.length&&i.push(t(`chat:fileRewind.unavailable`,{count:r.length,paths:r.slice(0,u).map(e=>e.path).join(`, `)})),e.incomplete&&i.push(t(`chat:fileRewind.incomplete`)),i.push(t(`chat:fileRewind.scope`)),{title:t(`chat:fileRewind.title`),message:i.join(`
|
|
2
2
|
`),confirmLabel:n.length?t(`chat:fileRewind.confirm`):t(`chat:fileRewind.confirmChatOnly`),tone:n.length?`danger`:`primary`}}function f(e,t){let n=e.restored.length+e.deleted.length,r=n?t(`chat:fileRewind.done`,{count:n}):t(`chat:fileRewind.doneChatOnly`);return e.unavailable.length?`${r} ${t(`chat:fileRewind.doneUnavailable`,{count:e.unavailable.length})}`:r}export{d as fileRewindConfirmOptions,f as fileRewindNotice,s as notifyTreeNavigation,l as switchToTurnOnOtherBranch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./useQuery-DfOU-27z.js";import{a as r}from"./startup-queries-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./useQuery-DfOU-27z.js";import{a as r}from"./startup-queries-BpV9-ykp.js";import{t as i}from"./chat-api-CdqM-TFw.js";function a(e){return e instanceof Error?e.message:String(e)}function o(e){return/(?:当前会话已经结束运行|session .*?(?:ended|finished|no longer running))/i.test(a(e))}var s=e(t(),1),c=Object.freeze({});function l(e){return[`session-tree-summary`,e]}function u(e){let t=e&&typeof e==`object`?e:{},n=Number(t.branchCount),r={};for(let e of Array.isArray(t.nodes)?t.nodes:[]){if(!e||typeof e.id!=`string`||typeof e.label!=`string`)continue;let t=e.label.trim();t&&(r[e.id]=t.slice(0,80))}return{branchCount:Number.isFinite(n)&&n>0?Math.floor(n):0,labels:Object.keys(r).length?r:c}}async function d(e){return u(await i.getSessionTree(e))}function f(e,t){if(!e)return;let n=t;n&&Array.isArray(n.nodes)?r.setQueryData(l(e),u(n)):m(e)}function p(e){return r.fetchQuery({queryKey:l(e),queryFn:()=>d(e),staleTime:1/0})}function m(e){return r.invalidateQueries({queryKey:l(e)})}function h(e,{enabled:t,streaming:i,revision:a=0}){let o=t&&!i&&!!e,c=n({queryKey:l(e),queryFn:()=>d(e),enabled:o,staleTime:1/0},r),u=(0,s.useRef)({sessionId:e,streaming:i,revision:a});return(0,s.useEffect)(()=>{let t=u.current;u.current={sessionId:e,streaming:i,revision:a},!(!o||t.sessionId!==e)&&(t.streaming!==i||t.revision!==a)&&m(e)},[o,a,e,i]),c.data??null}function g(e,t){let i=n({queryKey:l(e),queryFn:()=>d(e),enabled:!1,staleTime:1/0,select:e=>t&&e.labels[t]||``},r);return t&&i.data||``}export{g as a,h as i,m as n,a as o,p as r,o as s,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-at6jiRd2.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-DtvZ_lEu.js";var r=Object.freeze([`commandPalette`,`primaryAction`,`focusSearch`,`toggleSidebar`,`toggleTerminal`,`openSettings`,`focusComposer`,`sendMessage`,`voiceInput`,`openBoard`,`openComponents`,`openMore`,`jumpToAttention`,`agentPanel`,`toggleInspector`,`previousAgent`,`nextAgent`,`steerMessage`,`shortcutHelp`,`openSession`,`sessionTree`,`sideChat`,`cycleFocusRegion`]),i=Object.freeze({commandPalette:`Mod+KeyK`,primaryAction:`Mod+KeyN`,focusSearch:`Slash`,toggleSidebar:`Mod+KeyB`,toggleTerminal:`Mod+Backquote`,openSettings:`Mod+Comma`,focusComposer:`Mod+Shift+KeyL`,sendMessage:`Enter`,voiceInput:`F8`,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`,jumpToAttention:`Alt+KeyA`,agentPanel:`Mod+KeyJ`,toggleInspector:`Mod+KeyI`,previousAgent:`Alt+ArrowUp`,nextAgent:`Alt+ArrowDown`,steerMessage:`Alt+Enter`,shortcutHelp:`Mod+Slash`,openSession:null,sessionTree:`Mod+Shift+KeyB`,sideChat:null,cycleFocusRegion:`F6`}),a=[`Mod`,`Ctrl`,`Meta`,`Alt`,`Shift`],o=new Set([`Space`,`Backquote`,`Minus`,`Equal`,`BracketLeft`,`BracketRight`,`Backslash`,`Semicolon`,`Quote`,`Comma`,`Period`,`Slash`,`IntlBackslash`,`IntlRo`,`IntlYen`,`NumpadAdd`,`NumpadSubtract`,`NumpadMultiply`,`NumpadDivide`,`NumpadDecimal`]),s=new Set([`KeyA`,`KeyC`,`KeyF`,`KeyL`,`KeyO`,`KeyP`,`KeyQ`,`KeyR`,`KeyS`,`KeyT`,`KeyV`,`KeyW`,`KeyX`,`KeyY`,`KeyZ`]),c=new Map([[` `,`Space`],[`Spacebar`,`Space`],["`",`Backquote`],[`~`,`Backquote`],[`-`,`Minus`],[`_`,`Minus`],[`=`,`Equal`],[`+`,`Equal`],[`[`,`BracketLeft`],[`{`,`BracketLeft`],[`]`,`BracketRight`],[`}`,`BracketRight`],[`\\`,`Backslash`],[`|`,`Backslash`],[`;`,`Semicolon`],[`:`,`Semicolon`],[`'`,`Quote`],[`"`,`Quote`],[`,`,`Comma`],[`<`,`Comma`],[`.`,`Period`],[`>`,`Period`],[`/`,`Slash`],[`?`,`Slash`],...[...`)!@#$%^&*(`].map((e,t)=>[e,`Digit${t}`])]),l=class extends Error{constructor(e,t=`invalid`,n=null,r=null){super(e),this.name=`ShortcutValidationError`,this.code=t,this.action=n,this.conflictingAction=r}};function u(e){if(typeof e!=`string`||!e)return null;let t=e.split(`+`),n=t.pop();if(!/^(Key[A-Z]|Digit[0-9]|Numpad[0-9]|F([1-9]|1[0-2])|Enter|Arrow(Up|Down))$/.test(n)&&!o.has(n))return null;let r=-1;for(let e of t){let t=a.indexOf(e);if(t<=r)return null;r=t}return t.filter(e=>[`Mod`,`Ctrl`,`Meta`].includes(e)).length>1?null:{code:n,primary:t.find(e=>[`Mod`,`Ctrl`,`Meta`].includes(e))||null,alt:t.includes(`Alt`),shift:t.includes(`Shift`)}}function d(e,t=null){let{code:n,primary:r,alt:i,shift:a}=e;return n.startsWith(`Arrow`)?i&&!r&&!a:n===`Enter`&&a&&!r&&!i||i&&(n===`F4`||n===`Space`)||r&&n===`F4`||(r===`Mod`||r===`Meta`)&&n===`Space`&&!a||r&&s.has(n)&&!(n===`KeyL`&&a)?!1:/^F\d+$/.test(n)||r||i?!0:a?!1:n===`Enter`&&(!t||t===`sendMessage`)||n===`Slash`&&(!t||t===`focusSearch`)}function f(e,t){return{ctrl:e.primary===`Ctrl`||e.primary===`Mod`&&!t,meta:e.primary===`Meta`||e.primary===`Mod`&&t,alt:e.alt,shift:e.shift}}function p(e,t,n){let r=f(e,n),i=f(t,n);return e.code===t.code&&r.ctrl===i.ctrl&&r.meta===i.meta&&r.alt===i.alt&&r.shift===i.shift}function m(e,t,n){let i=u(n);if(!i)return null;for(let n of r){if(n===t)continue;let r=u(e?.[n]);if(r&&(p(i,r,!1)||p(i,r,!0)))return n}return null}function h(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==r.length||!r.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete shortcut map with only known actions`);let t={};for(let n of r){let r=e[n];if(r!==null){let e=u(r);if(!e||!d(e,n))throw new l(`Invalid or reserved shortcut for ${n}`,`invalid`,n)}t[n]=r}for(let e of r){let n=m(t,e,t[e]);if(n)throw new l(`Shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}var g=Object.freeze({openBoard:`Mod+Digit1`,openComponents:`Mod+Digit2`,openMore:`Mod+Digit3`}),_=Object.freeze({openSession:`Mod+Digit1`,openBoard:`Mod+Digit2`,openComponents:`Mod+Digit3`,openMore:`Mod+Digit4`}),v=Object.freeze([`openMore`,`openComponents`,`openBoard`,`openSession`]),y=Object.freeze({openSession:null,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`});function b(e){for(let[t,n]of Object.entries(g))if(e[t]!==n)return;for(let t of v){let n=_[t];m(e,t,n)||(e[t]=n)}}function x(e){for(let[t,n]of Object.entries(_))if(e[t]!==n)return;Object.assign(e,y)}function S(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e)))return e;let t=r.filter(t=>Object.hasOwn(e,t));if(t.length===r.length&&Reflect.ownKeys(e).length===t.length)return e;let n={};for(let r of t)n[r]=e[r];Object.hasOwn(n,`sessionTree`)||(Object.hasOwn(n,`openSession`)||b(n),x(n));for(let e of r){if(Object.hasOwn(n,e))continue;let t=i[e];n[e]=m(n,e,t)?null:t}return n}function C(e){try{let t=h(S(e));return t.voiceInput===`Mod+Shift+Space`&&!m(t,`voiceInput`,`F8`)&&(t.voiceInput=`F8`),t}catch{return{...i}}}function w(e){if(e.code)return e.code;let t=e.key;return typeof t==`string`?/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:/^(Enter|Arrow(Up|Down)|F([1-9]|1[0-2]))$/.test(t)?t:c.get(t)||null:null}function T(e){return!e||e.defaultPrevented||e.repeat||e.isComposing||e.keyCode===229||[`Dead`,`Process`,`Unidentified`,`AltGraph`].includes(e.key)||e.getModifierState?.(`AltGraph`)}function E(e,t=!1){if(T(e)||e.ctrlKey&&e.metaKey)return null;let n=w(e);if(!n)return null;let r=[];(t?e.metaKey:e.ctrlKey)?r.push(`Mod`):e.ctrlKey?r.push(`Ctrl`):e.metaKey&&r.push(`Meta`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),r.push(n);let i=r.join(`+`),a=u(i);return a&&d(a)?i:null}function D(e,t,n=!1){if(T(e))return!1;let r=u(t);if(!r||!d(r)||w(e)!==r.code)return!1;let i=f(r,n);return!!e.ctrlKey===i.ctrl&&!!e.metaKey===i.meta&&!!e.altKey===i.alt&&!!e.shiftKey===i.shift}function O(e,t=!1){let n=u(e);if(!n)return``;let r=[];n.primary&&r.push(n.primary===`Mod`?t?`Cmd`:`Ctrl`:n.primary===`Meta`?`Cmd`:`Ctrl`),n.alt&&r.push(`Alt`),n.shift&&r.push(`Shift`);let i={Backquote:"`",Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,IntlBackslash:`\\`,IntlRo:`\\`,IntlYen:`Yen`,NumpadAdd:`Num +`,NumpadSubtract:`Num -`,NumpadMultiply:`Num *`,NumpadDivide:`Num /`,NumpadDecimal:`Num .`,ArrowUp:`↑`,ArrowDown:`↓`},a=n.code;return r.push(i[a]||a.replace(/^Key|^Digit/,``).replace(/^Numpad/,`Num `)),r.join(` + `)}var k=Object.freeze([`boardNext`,`boardPrevious`,`boardApprove`,`boardDeny`,`boardRetry`,`boardTriage`,`boardToggleGrouping`]),A=Object.freeze({boardNext:`KeyJ`,boardPrevious:`KeyK`,boardApprove:`KeyA`,boardDeny:`KeyD`,boardRetry:`KeyR`,boardTriage:`KeyT`,boardToggleGrouping:`KeyG`}),j=/^Key[A-Z]$/;function M(e,t,n){return typeof n!=`string`||!j.test(n)?null:k.find(r=>r!==t&&e?.[r]===n)||null}function N(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==k.length||!k.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete board shortcut map`);let t={};for(let n of k){let r=e[n];if(r!==null&&(typeof r!=`string`||!j.test(r)))throw new l(`Invalid board shortcut for ${n}`,`invalid`,n);t[n]=r}for(let e of k){let n=M(t,e,t[e]);if(n)throw new l(`Board shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}function P(e){try{let t=e&&typeof e==`object`&&!Array.isArray(e)?e:Object.create(null),n={};for(let e of k)Object.hasOwn(t,e)&&(n[e]=t[e]);for(let e of k){if(Object.hasOwn(n,e))continue;let t=A[e];n[e]=M(n,e,t)?null:t}return N(n)}catch{return{...A}}}function F(e){return!!(e?.ctrlKey||e?.metaKey||e?.altKey||e?.shiftKey)}function I(e){if(T(e)||F(e))return null;let t=w(e);return t&&j.test(t)?t:null}function L(e,t){return typeof t!=`string`||!j.test(t)?!1:I(e)===t}function R(){try{return C(JSON.parse(e.getItem(n.shortcuts)||`null`))}catch{return{...i}}}function z(){try{return P(JSON.parse(e.getItem(n.boardShortcuts)||`null`))}catch{return{...A}}}var B=t((t,r)=>{let a=r=>{e.setItem(n.shortcuts,JSON.stringify(r)),t({bindings:r})},o=r=>{e.setItem(n.boardShortcuts,JSON.stringify(r)),t({boardBindings:r})};return{bindings:R(),boardBindings:z(),setBinding:(e,t)=>a(h({...r().bindings,[e]:t})),setBoardBinding:(e,t)=>o(N({...r().boardBindings,[e]:t})),resetBindings:()=>{a({...i}),o({...A})}}});typeof window<`u`&&window.addEventListener(`storage`,e=>{(e.key===n.shortcuts||e.key===null)&&B.setState({bindings:R()}),(e.key===n.boardShortcuts||e.key===null)&&B.setState({boardBindings:z()})});var V=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``);function H(e,t=V){return O(e,t)}function U(e,t,n=V){return D(e,t,n)}function W(e,t=V){return E(e,t)}function G(e){return H(B(t=>t.bindings[e]))}function K(e){return e instanceof HTMLElement&&!!e.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]`)}function q(e,t=V){return t&&e.altKey&&!e.ctrlKey&&!e.metaKey&&K(e.target)}function J(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.repeat||document.visibilityState===`hidden`||!!document.querySelector(`[role="dialog"], [role="alertdialog"], dialog[open]`)||e.target instanceof HTMLElement&&!!e.target.closest(`[data-shortcut-recorder], .terminal-panel, [role="menu"], [role="listbox"]`)}export{h as _,J as a,B as c,i as d,r as f,L as g,m as h,q as i,k as l,M as m,K as n,W as o,I as p,U as r,G as s,H as t,A as u};
|