junhost 0.3.0 → 0.3.4
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/dist/browser-mcp-server.js +1 -1
- package/dist/index.js +46 -46
- package/dist/mcp-server.js +1 -1
- package/package.json +1 -1
- package/ui-dist/assets/{BrowserPage-DHyQHcXA.js → BrowserPage-9gVeSQwJ.js} +2 -1
- package/ui-dist/assets/{DashboardPage-CUuPkg6v.js → DashboardPage-DpUFKefL.js} +1 -1
- package/ui-dist/assets/{FilesPage-4pIFdyDG.js → FilesPage-DcAROlEl.js} +1 -1
- package/ui-dist/assets/{LogsPage-BMnY04x1.js → LogsPage-Cjy1u4mi.js} +1 -1
- package/ui-dist/assets/{McpPage-DjJyOTby.js → McpPage-CbF1n-r9.js} +1 -1
- package/ui-dist/assets/{MemoriesPage-bCrf5Euh.js → MemoriesPage-CZ0Djv0N.js} +1 -1
- package/ui-dist/assets/{RunsPage-DmL6kxm4.js → RunsPage-CoBKmzka.js} +5 -5
- package/ui-dist/assets/{SchedulesPage-DiEX_BG2.js → SchedulesPage-Do5nDZ-J.js} +1 -1
- package/ui-dist/assets/{SettingsPage-fztdWEUq.js → SettingsPage-B26G7vPS.js} +1 -1
- package/ui-dist/assets/{SkillsPage-Ba0OFfGe.js → SkillsPage-AkyZ2EQZ.js} +1 -1
- package/ui-dist/assets/architecture-7EHR7CIX-cCzS06Gh.js +1 -0
- package/ui-dist/assets/{architectureDiagram-3BPJPVTR-CTkJZekp.js → architectureDiagram-3BPJPVTR-DfC6sLNc.js} +1 -1
- package/ui-dist/assets/{blockDiagram-GPEHLZMM-DkKeuF3p.js → blockDiagram-GPEHLZMM-BS8EGcCG.js} +1 -1
- package/ui-dist/assets/{c4Diagram-AAUBKEIU-DCIXqWKO.js → c4Diagram-AAUBKEIU-CJkaD3Jx.js} +1 -1
- package/ui-dist/assets/channel-kSqogUuL.js +1 -0
- package/ui-dist/assets/{checkbox-C-XQQq3C.js → checkbox-vUBksx1q.js} +1 -1
- package/ui-dist/assets/{chunk-2J33WTMH-C_Do0fzJ.js → chunk-2J33WTMH-mhbuj50G.js} +1 -1
- package/ui-dist/assets/{chunk-3OPIFGDE-Dnq2pibd.js → chunk-3OPIFGDE-DY3vh1Nq.js} +1 -1
- package/ui-dist/assets/{chunk-5ZQYHXKU--3ftGxeU.js → chunk-5ZQYHXKU-CjgZVK38.js} +1 -1
- package/ui-dist/assets/{chunk-727SXJPM-CE9UFsBc.js → chunk-727SXJPM-BQTDUHRj.js} +1 -1
- package/ui-dist/assets/{chunk-AQP2D5EJ-IlAT6iTc.js → chunk-AQP2D5EJ-Sy1xPTv6.js} +1 -1
- package/ui-dist/assets/{chunk-BO2N2NFS-Bck0jxRI.js → chunk-BO2N2NFS-Bgx9ri0_.js} +4 -4
- package/ui-dist/assets/{chunk-CSCIHK7Q-DlysIzUR.js → chunk-CSCIHK7Q-BSHQXS7Y.js} +3 -3
- package/ui-dist/assets/{chunk-KSCS5N6A-DCPxMCgc.js → chunk-KSCS5N6A-eLYuhWcU.js} +1 -1
- package/ui-dist/assets/{chunk-L5ZTLDWV-Cj9_jpoi.js → chunk-L5ZTLDWV-BmpG0Ewi.js} +1 -1
- package/ui-dist/assets/{chunk-LZXEDZCA-GAi6scJw.js → chunk-LZXEDZCA-wjYpyGTZ.js} +2 -2
- package/ui-dist/assets/{chunk-ND2GUHAM-CC2nvwpG.js → chunk-ND2GUHAM-BkvdHoNV.js} +1 -1
- package/ui-dist/assets/{chunk-NZK2D7GU-CGITkLyN.js → chunk-NZK2D7GU-DD7-1aWi.js} +1 -1
- package/ui-dist/assets/{chunk-O5CBEL6O-BxDX-s5O.js → chunk-O5CBEL6O-cv64tuEA.js} +1 -1
- package/ui-dist/assets/{chunk-WU5MYG2G-BNy8p0ko.js → chunk-WU5MYG2G-DA1LQa1D.js} +1 -1
- package/ui-dist/assets/classDiagram-4FO5ZUOK-DIN_soal.js +1 -0
- package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-DIN_soal.js +1 -0
- package/ui-dist/assets/{collapsible-DL1Pa5At.js → collapsible-WgEfcx9l.js} +1 -1
- package/ui-dist/assets/{dagre-BM42HDAG-B-A8sAyD.js → dagre-BM42HDAG-BQ_Gt3C1.js} +1 -1
- package/ui-dist/assets/{diagram-2AECGRRQ-BlkmoJab.js → diagram-2AECGRRQ-DegViS8Q.js} +1 -1
- package/ui-dist/assets/{diagram-5GNKFQAL-DLurH93Z.js → diagram-5GNKFQAL-INLXoEGU.js} +1 -1
- package/ui-dist/assets/{diagram-KO2AKTUF-sXtOf-O5.js → diagram-KO2AKTUF-Bav-apee.js} +1 -1
- package/ui-dist/assets/{diagram-LMA3HP47-CVJgaCxQ.js → diagram-LMA3HP47-DetmV1XF.js} +1 -1
- package/ui-dist/assets/{diagram-OG6HWLK6-DlSJEniK.js → diagram-OG6HWLK6-DxSK26S7.js} +1 -1
- package/ui-dist/assets/{dialog-CYLeVyM-.js → dialog-BTcyz3qf.js} +1 -1
- package/ui-dist/assets/{erDiagram-TEJ5UH35-DXCrI6I5.js → erDiagram-TEJ5UH35-LZjEp26F.js} +1 -1
- package/ui-dist/assets/eventmodeling-FCH6USID-LEdFjPoC.js +1 -0
- package/ui-dist/assets/{flowDiagram-I6XJVG4X-DuXHlm5x.js → flowDiagram-I6XJVG4X-DQf-PrHy.js} +1 -1
- package/ui-dist/assets/{ganttDiagram-6RSMTGT7-9X5KI_9q.js → ganttDiagram-6RSMTGT7-DeK_z-Js.js} +1 -1
- package/ui-dist/assets/{gitGraph-WXDBUCRP-4lP61HuT.js → gitGraph-WXDBUCRP-BFMrYnF5.js} +1 -1
- package/ui-dist/assets/{gitGraphDiagram-PVQCEYII-DS7sOc3V.js → gitGraphDiagram-PVQCEYII-CIUYCNZd.js} +1 -1
- package/ui-dist/assets/{highlighted-body-OFNGDK62-DC-eZj7U.js → highlighted-body-OFNGDK62-CJEeWNGR.js} +1 -1
- package/ui-dist/assets/{index-N-aJPrjP.js → index-BV4eUtAp.js} +2 -2
- package/ui-dist/assets/{index-D3Qn6btz.css → index-BdtKSgW5.css} +1 -1
- package/ui-dist/assets/{info-J43DQDTF-BPA_aNjl.js → info-J43DQDTF-llmEniUV.js} +1 -1
- package/ui-dist/assets/{infoDiagram-5YYISTIA-DnVSGlrV.js → infoDiagram-5YYISTIA-BGI2mOhY.js} +1 -1
- package/ui-dist/assets/{input-F0nzOm5c.js → input-S0ZdxSeo.js} +1 -1
- package/ui-dist/assets/{ishikawaDiagram-YF4QCWOH-DsmzrCMt.js → ishikawaDiagram-YF4QCWOH-BkQI6c7Q.js} +1 -1
- package/ui-dist/assets/{journeyDiagram-JHISSGLW-CRuM8UdX.js → journeyDiagram-JHISSGLW-Coq6JWX7.js} +1 -1
- package/ui-dist/assets/{kanban-definition-UN3LZRKU-uSoN0lnh.js → kanban-definition-UN3LZRKU-CjxplmXf.js} +1 -1
- package/ui-dist/assets/katex-BI2iw9tJ.js +1 -0
- package/ui-dist/assets/{line-DBlKTrex.js → line-BEtII_LR.js} +1 -1
- package/ui-dist/assets/mermaid-GHXKKRXX-CfVWhIeR.js +1 -0
- package/ui-dist/assets/{mermaid-parser.core-CPYQHkLW.js → mermaid-parser.core-DaFgcYuk.js} +2 -2
- package/ui-dist/assets/{mindmap-definition-RKZ34NQL-CQAbVdBK.js → mindmap-definition-RKZ34NQL-B3J8wqEL.js} +1 -1
- package/ui-dist/assets/{packet-YPE3B663-B_jxDJ78.js → packet-YPE3B663-CfmL0nS0.js} +1 -1
- package/ui-dist/assets/{pie-LRSECV5Y-DdzUETNE.js → pie-LRSECV5Y-0q2SlDUq.js} +1 -1
- package/ui-dist/assets/{pieDiagram-4H26LBE5-eWkLmgTA.js → pieDiagram-4H26LBE5-D5MF1SI0.js} +1 -1
- package/ui-dist/assets/{quadrantDiagram-W4KKPZXB-SNBNPkHE.js → quadrantDiagram-W4KKPZXB-g6p42sLr.js} +1 -1
- package/ui-dist/assets/{radar-GUYGQ44K-CVFtMDrf.js → radar-GUYGQ44K-BmaImLTH.js} +1 -1
- package/ui-dist/assets/{requirementDiagram-4Y6WPE33-CDrbqGdB.js → requirementDiagram-4Y6WPE33-u0DaPOqm.js} +1 -1
- package/ui-dist/assets/{sankeyDiagram-5OEKKPKP-DjpIDQlh.js → sankeyDiagram-5OEKKPKP-D9pDA_0Q.js} +1 -1
- package/ui-dist/assets/{select-CyfVacuL.js → select-j1Z7DzXz.js} +1 -1
- package/ui-dist/assets/{sequenceDiagram-3UESZ5HK-43oP0nrT.js → sequenceDiagram-3UESZ5HK-K18mGDHD.js} +1 -1
- package/ui-dist/assets/{stateDiagram-AJRCARHV-BbNa4W6Z.js → stateDiagram-AJRCARHV-UcpM53Ws.js} +1 -1
- package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-J2d5S8Su.js +1 -0
- package/ui-dist/assets/{tabs-CMZKIx3J.js → tabs-A13Rxj36.js} +1 -1
- package/ui-dist/assets/{timeline-definition-PNZ67QCA-YzIE7mGL.js → timeline-definition-PNZ67QCA-CeeEL7tt.js} +1 -1
- package/ui-dist/assets/{treeView-BLDUP644-BZteZrd-.js → treeView-BLDUP644-hNdF1f8d.js} +1 -1
- package/ui-dist/assets/{treemap-LRROVOQU-CAzPGyTN.js → treemap-LRROVOQU-CdkcNxzK.js} +1 -1
- package/ui-dist/assets/{useOpenInteractionType-0pVIpVIn.js → useOpenInteractionType-Bq3-ALUl.js} +1 -1
- package/ui-dist/assets/{vennDiagram-CIIHVFJN-4KTFUlxw.js → vennDiagram-CIIHVFJN-DrvJRdOf.js} +1 -1
- package/ui-dist/assets/{wardley-L42UT6IY-Bkw1e9Ke.js → wardley-L42UT6IY-DlkMLhw2.js} +1 -1
- package/ui-dist/assets/{wardleyDiagram-YWT4CUSO-D0_SJSEO.js → wardleyDiagram-YWT4CUSO-sOLJdABg.js} +1 -1
- package/ui-dist/assets/{xychartDiagram-2RQKCTM6-PXl7Msmq.js → xychartDiagram-2RQKCTM6-BdoTJvuh.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/assets/architecture-7EHR7CIX-B-lLNHMj.js +0 -1
- package/ui-dist/assets/channel-Da_creZX.js +0 -1
- package/ui-dist/assets/classDiagram-4FO5ZUOK-Bn-f2je0.js +0 -1
- package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-Bn-f2je0.js +0 -1
- package/ui-dist/assets/eventmodeling-FCH6USID-m81sQw35.js +0 -1
- package/ui-dist/assets/katex-CO1WTfq9.js +0 -1
- package/ui-dist/assets/mermaid-GHXKKRXX-DdkJOHN3.js +0 -1
- package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-CIh0Hr2o.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{a as r,i,n as a,r as o,t as s}from"./select-CyfVacuL.js";import{t as c}from"./checkbox-C-XQQq3C.js";import{t as l}from"./play-D3mjFMmX.js";import{i as u}from"./useCompositeListItem-DRvL68vb.js";import{t as d}from"./rotate-cw-BUTALXBe.js";import{t as f}from"./trash-2-D5W0vize.js";import{c as p,i as m,n as h,r as g,t as _}from"./api-DTaM-PBA.js";import{Zt as v}from"./index-N-aJPrjP.js";import{t as y}from"./button-C5SbvNQM.js";import{t as b}from"./input-F0nzOm5c.js";import{t as ee}from"./textarea-CwL3B5t5.js";import{t as x}from"./badge-Czi0QcSt.js";import{t as S}from"./label-DIdZ-j1R.js";var C=e(t(),1),w=n(),T={unattended:{label:`Unattended`,hint:`A Codex subagent approves for you · workspace-write (recommended for 24/7)`,mode:{sandbox:`workspaceWrite`,approvalPolicy:`onRequest`,approvalsReviewer:`auto_review`}},all:{label:`Allow everything`,hint:`⚠ No approvals + full disk/network access. Use with care.`,mode:{sandbox:`dangerFullAccess`,approvalPolicy:`never`,approvalsReviewer:`user`}}};function E(e){for(let t of Object.keys(T)){let n=T[t].mode;if(e.sandbox===n.sandbox&&e.approvalPolicy===n.approvalPolicy&&e.approvalsReviewer===n.approvalsReviewer)return t}return`unattended`}var te=[{label:`Every hour`,cron:`0 * * * *`},{label:`Daily 9am`,cron:`0 9 * * *`},{label:`Weekdays 9am`,cron:`0 9 * * 1-5`},{label:`Mondays 8am`,cron:`0 8 * * 1`},{label:`1st of month`,cron:`0 9 1 * *`}];function D(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function O(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}var k=Intl.DateTimeFormat().resolvedOptions().timeZone;function A(){return{name:``,prompt:``,kind:`cron`,cron:`0 9 * * *`,runAtLocal:``,tz:k,modeKey:`unattended`,model:``,effort:``,resume:!1,enabled:!0}}function j(e){return{name:e.name,prompt:e.prompt,kind:e.kind,cron:e.cron??`0 9 * * *`,runAtLocal:D(e.runAt),tz:e.tz??``,modeKey:E(e.mode),model:e.mode.model??``,effort:e.mode.effort??``,resume:e.resume??!1,enabled:e.enabled}}function M(){let[e,t]=(0,C.useState)([]),[n,E]=(0,C.useState)([]),[D,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(A),[L,R]=(0,C.useState)(null),[z,B]=(0,C.useState)(!1),V=(0,C.useCallback)(async()=>{try{let{schedules:e}=await h(`/api/schedules`);t(e),R(null)}catch(e){R(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{V()},[V]),(0,C.useEffect)(()=>{h(`/api/models`).then(({models:e})=>E(e)).catch(()=>{})},[]);let H=()=>{M(null),P(!0),I(A()),R(null)},U=e=>{M(e.id),P(!1),I(j(e)),R(null)},W=(0,C.useCallback)(async e=>{B(!0),R(null);try{await e(),await V()}catch(e){R(e instanceof Error?e.message:String(e))}finally{B(!1)}},[V]),G=()=>{let e=T[F.modeKey].mode;return{name:F.name,prompt:F.prompt,kind:F.kind,cron:F.kind===`cron`?F.cron:void 0,runAt:F.kind===`once`&&F.runAtLocal?new Date(F.runAtLocal).toISOString():void 0,tz:F.tz||void 0,mode:{...e,model:F.model||void 0,effort:F.effort||void 0},resume:F.resume,enabled:F.enabled}},K=()=>{if(!F.name.trim()){R(`Name is required`);return}if(!F.prompt.trim()){R(`Prompt is required`);return}W(async()=>{let e=G();if(N){let{schedule:t}=await g(`/api/schedules`,e);M(t.id),P(!1),I(j(t))}else if(D){let{schedule:t}=await m(`/api/schedules/${D}`,e);I(j(t))}})},q=e=>W(()=>m(`/api/schedules/${e.id}`,{enabled:!e.enabled})),J=e=>W(()=>g(`/api/schedules/${e.id}/run`)),Y=e=>W(async()=>{window.confirm(`Delete schedule "${e.name}"?`)&&(await _(`/api/schedules/${e.id}`),D===e.id&&(M(null),P(!1)))}),X=(0,C.useMemo)(()=>e.find(e=>e.id===D)??null,[e,D]),Z=N||X!==null,Q=n.find(e=>e.model===F.model),ne=Q?.supportedReasoningEfforts??[],$=(e,t)=>I(n=>({...n,[e]:t}));return(0,w.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h1`,{className:`text-base font-semibold`,children:`Schedules`}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,w.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>V(),disabled:z,children:[(0,w.jsx)(d,{className:`size-3.5`}),` Refresh`]}),(0,w.jsxs)(y,{size:`sm`,onClick:H,disabled:z,children:[(0,w.jsx)(u,{className:`size-3.5`}),` New schedule`]})]})]}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run a prompt automatically on a cron schedule or once at a set time. Scheduled runs fire in the background and appear in the Runs page — they default to Unattended mode so approvals don't block while no one is watching.`}),L&&(0,w.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:L}),(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex w-80 shrink-0 flex-col gap-1 overflow-auto`,children:[e.map(e=>(0,w.jsxs)(`div`,{className:p(`group flex cursor-pointer items-start gap-2 rounded-md border px-2 py-2`,D===e.id?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>U(e),children:[(0,w.jsx)(v,{className:p(`mt-0.5 size-4 shrink-0`,e.enabled?`text-foreground`:`text-muted-foreground`)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),!e.enabled&&(0,w.jsx)(x,{variant:`outline`,className:`text-muted-foreground`,children:`paused`})]}),(0,w.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.kind===`cron`?(0,w.jsx)(`code`,{children:e.cron}):`once · ${O(e.runAt)}`}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.enabled?`next: ${O(e.nextRunAt)}`:`paused`}),e.lastError&&(0,w.jsxs)(`div`,{className:`truncate text-xs text-destructive`,title:e.lastError,children:[`last error: `,e.lastError]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-1`,children:[(0,w.jsx)(y,{size:`icon-sm`,variant:`ghost`,title:`Run now`,disabled:z,onClick:t=>{t.stopPropagation(),J(e)},children:(0,w.jsx)(l,{})}),(0,w.jsx)(y,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,title:`Delete`,disabled:z,onClick:t=>{t.stopPropagation(),Y(e)},children:(0,w.jsx)(f,{})})]})]},e.id)),e.length===0&&(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,w.jsx)(v,{className:`size-8`}),`No schedules in this workspace yet. Create one to run a prompt on a timer.`]})]}),(0,w.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-auto`,children:Z?(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border bg-card p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:N?`New schedule`:`Edit schedule`}),X&&(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,w.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>J(X),disabled:z,children:[(0,w.jsx)(l,{className:`size-3.5`}),` Run now`]}),(0,w.jsx)(y,{size:`sm`,variant:`outline`,onClick:()=>q(X),disabled:z,children:X.enabled?`Pause`:`Resume`})]})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{htmlFor:`sch-name`,children:`Name`}),(0,w.jsx)(b,{id:`sch-name`,value:F.name,placeholder:`Morning report`,onChange:e=>$(`name`,e.target.value)})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{htmlFor:`sch-prompt`,children:`Prompt`}),(0,w.jsx)(ee,{id:`sch-prompt`,value:F.prompt,placeholder:`What should the agent do each time?`,className:`min-h-24 resize-y font-mono text-sm`,onChange:e=>$(`prompt`,e.target.value)})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{children:`When`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(s,{value:F.kind,onValueChange:e=>$(`kind`,e??`cron`),children:[(0,w.jsx)(i,{size:`sm`,className:`w-32`,children:(0,w.jsx)(r,{children:F.kind===`cron`?`Repeating`:`One-off`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`cron`,children:`Repeating (cron)`}),(0,w.jsx)(o,{value:`once`,children:`One-off`})]})]}),F.kind===`cron`?(0,w.jsx)(b,{value:F.cron,placeholder:`0 9 * * *`,className:`w-44 font-mono`,onChange:e=>$(`cron`,e.target.value)}):(0,w.jsx)(b,{type:`datetime-local`,value:F.runAtLocal,className:`w-56`,onChange:e=>$(`runAtLocal`,e.target.value)})]}),F.kind===`cron`&&(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:te.map(e=>(0,w.jsx)(y,{size:`sm`,variant:`outline`,className:`h-6 text-xs`,onClick:()=>$(`cron`,e.cron),children:e.label},e.cron))}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(S,{htmlFor:`sch-tz`,className:`font-normal text-muted-foreground`,children:`Timezone`}),(0,w.jsx)(b,{id:`sch-tz`,value:F.tz,placeholder:k,className:`h-7 w-56`,onChange:e=>$(`tz`,e.target.value)})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Cron fields: minute hour day-of-month month day-of-week. Times are evaluated in the timezone above (defaults to the daemon's local time if blank).`})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{children:`Run mode`}),(0,w.jsxs)(s,{value:F.modeKey,onValueChange:e=>$(`modeKey`,e??`unattended`),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:T[F.modeKey].label})}),(0,w.jsx)(a,{children:Object.keys(T).map(e=>(0,w.jsx)(o,{value:e,children:(0,w.jsxs)(`span`,{className:`channel-mode-item`,children:[(0,w.jsx)(`span`,{className:`channel-mode-label`,children:T[e].label}),(0,w.jsx)(`span`,{className:`channel-mode-hint`,children:T[e].hint})]})},e))})]})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,w.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,w.jsx)(S,{children:`Model`}),(0,w.jsxs)(s,{value:F.model||`__default`,onValueChange:e=>$(`model`,e===`__default`?``:e??``),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:Q?.displayName??`Engine default`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`__default`,children:`Engine default`}),n.map(e=>(0,w.jsxs)(o,{value:e.model,children:[e.displayName,e.isDefault?` · default`:``]},e.id))]})]})]}),(0,w.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,w.jsx)(S,{children:`Reasoning effort`}),(0,w.jsxs)(s,{value:F.effort||`__default`,onValueChange:e=>$(`effort`,e===`__default`?``:e??``),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:F.effort||`Default (medium)`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`__default`,children:`Default (medium)`}),ne.map(e=>(0,w.jsx)(o,{value:e.reasoningEffort,children:e.reasoningEffort},e.reasoningEffort))]})]})]})]}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{checked:F.resume,onCheckedChange:e=>$(`resume`,e===!0)}),`Resume one persistent conversation each fire (context accumulates across runs)`]}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{checked:F.enabled,onCheckedChange:e=>$(`enabled`,e===!0)}),`Enabled`]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(y,{onClick:K,disabled:z,children:z?`Saving…`:N?`Create schedule`:`Save changes`}),(0,w.jsx)(y,{variant:`ghost`,onClick:()=>{P(!1),M(null)},disabled:z,children:`Cancel`})]}),X&&(0,w.jsxs)(`div`,{className:`mt-1 grid gap-0.5 border-t pt-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`div`,{children:[`Next run: `,O(X.nextRunAt)]}),(0,w.jsxs)(`div`,{children:[`Last run: `,O(X.lastRunAt)]}),X.lastRunId&&(0,w.jsxs)(`div`,{children:[`Last run id: `,X.lastRunId]}),X.lastError&&(0,w.jsxs)(`div`,{className:`text-destructive`,children:[`Last error: `,X.lastError]})]})]}):(0,w.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a schedule to edit, or create a new one.`})})]})]})}export{M as SchedulesPage};
|
|
1
|
+
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{a as r,i,n as a,r as o,t as s}from"./select-j1Z7DzXz.js";import{t as c}from"./checkbox-vUBksx1q.js";import{t as l}from"./play-D3mjFMmX.js";import{i as u}from"./useCompositeListItem-DRvL68vb.js";import{t as d}from"./rotate-cw-BUTALXBe.js";import{t as f}from"./trash-2-D5W0vize.js";import{c as p,i as m,n as h,r as g,t as _}from"./api-DTaM-PBA.js";import{Zt as v}from"./index-BV4eUtAp.js";import{t as y}from"./button-C5SbvNQM.js";import{t as b}from"./input-S0ZdxSeo.js";import{t as ee}from"./textarea-CwL3B5t5.js";import{t as x}from"./badge-Czi0QcSt.js";import{t as S}from"./label-DIdZ-j1R.js";var C=e(t(),1),w=n(),T={unattended:{label:`Unattended`,hint:`A Codex subagent approves for you · workspace-write (recommended for 24/7)`,mode:{sandbox:`workspaceWrite`,approvalPolicy:`onRequest`,approvalsReviewer:`auto_review`}},all:{label:`Allow everything`,hint:`⚠ No approvals + full disk/network access. Use with care.`,mode:{sandbox:`dangerFullAccess`,approvalPolicy:`never`,approvalsReviewer:`user`}}};function E(e){for(let t of Object.keys(T)){let n=T[t].mode;if(e.sandbox===n.sandbox&&e.approvalPolicy===n.approvalPolicy&&e.approvalsReviewer===n.approvalsReviewer)return t}return`unattended`}var te=[{label:`Every hour`,cron:`0 * * * *`},{label:`Daily 9am`,cron:`0 9 * * *`},{label:`Weekdays 9am`,cron:`0 9 * * 1-5`},{label:`Mondays 8am`,cron:`0 8 * * 1`},{label:`1st of month`,cron:`0 9 1 * *`}];function D(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function O(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}var k=Intl.DateTimeFormat().resolvedOptions().timeZone;function A(){return{name:``,prompt:``,kind:`cron`,cron:`0 9 * * *`,runAtLocal:``,tz:k,modeKey:`unattended`,model:``,effort:``,resume:!1,enabled:!0}}function j(e){return{name:e.name,prompt:e.prompt,kind:e.kind,cron:e.cron??`0 9 * * *`,runAtLocal:D(e.runAt),tz:e.tz??``,modeKey:E(e.mode),model:e.mode.model??``,effort:e.mode.effort??``,resume:e.resume??!1,enabled:e.enabled}}function M(){let[e,t]=(0,C.useState)([]),[n,E]=(0,C.useState)([]),[D,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(A),[L,R]=(0,C.useState)(null),[z,B]=(0,C.useState)(!1),V=(0,C.useCallback)(async()=>{try{let{schedules:e}=await h(`/api/schedules`);t(e),R(null)}catch(e){R(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{V()},[V]),(0,C.useEffect)(()=>{h(`/api/models`).then(({models:e})=>E(e)).catch(()=>{})},[]);let H=()=>{M(null),P(!0),I(A()),R(null)},U=e=>{M(e.id),P(!1),I(j(e)),R(null)},W=(0,C.useCallback)(async e=>{B(!0),R(null);try{await e(),await V()}catch(e){R(e instanceof Error?e.message:String(e))}finally{B(!1)}},[V]),G=()=>{let e=T[F.modeKey].mode;return{name:F.name,prompt:F.prompt,kind:F.kind,cron:F.kind===`cron`?F.cron:void 0,runAt:F.kind===`once`&&F.runAtLocal?new Date(F.runAtLocal).toISOString():void 0,tz:F.tz||void 0,mode:{...e,model:F.model||void 0,effort:F.effort||void 0},resume:F.resume,enabled:F.enabled}},K=()=>{if(!F.name.trim()){R(`Name is required`);return}if(!F.prompt.trim()){R(`Prompt is required`);return}W(async()=>{let e=G();if(N){let{schedule:t}=await g(`/api/schedules`,e);M(t.id),P(!1),I(j(t))}else if(D){let{schedule:t}=await m(`/api/schedules/${D}`,e);I(j(t))}})},q=e=>W(()=>m(`/api/schedules/${e.id}`,{enabled:!e.enabled})),J=e=>W(()=>g(`/api/schedules/${e.id}/run`)),Y=e=>W(async()=>{window.confirm(`Delete schedule "${e.name}"?`)&&(await _(`/api/schedules/${e.id}`),D===e.id&&(M(null),P(!1)))}),X=(0,C.useMemo)(()=>e.find(e=>e.id===D)??null,[e,D]),Z=N||X!==null,Q=n.find(e=>e.model===F.model),ne=Q?.supportedReasoningEfforts??[],$=(e,t)=>I(n=>({...n,[e]:t}));return(0,w.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h1`,{className:`text-base font-semibold`,children:`Schedules`}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,w.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>V(),disabled:z,children:[(0,w.jsx)(d,{className:`size-3.5`}),` Refresh`]}),(0,w.jsxs)(y,{size:`sm`,onClick:H,disabled:z,children:[(0,w.jsx)(u,{className:`size-3.5`}),` New schedule`]})]})]}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run a prompt automatically on a cron schedule or once at a set time. Scheduled runs fire in the background and appear in the Runs page — they default to Unattended mode so approvals don't block while no one is watching.`}),L&&(0,w.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:L}),(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex w-80 shrink-0 flex-col gap-1 overflow-auto`,children:[e.map(e=>(0,w.jsxs)(`div`,{className:p(`group flex cursor-pointer items-start gap-2 rounded-md border px-2 py-2`,D===e.id?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>U(e),children:[(0,w.jsx)(v,{className:p(`mt-0.5 size-4 shrink-0`,e.enabled?`text-foreground`:`text-muted-foreground`)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),!e.enabled&&(0,w.jsx)(x,{variant:`outline`,className:`text-muted-foreground`,children:`paused`})]}),(0,w.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.kind===`cron`?(0,w.jsx)(`code`,{children:e.cron}):`once · ${O(e.runAt)}`}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.enabled?`next: ${O(e.nextRunAt)}`:`paused`}),e.lastError&&(0,w.jsxs)(`div`,{className:`truncate text-xs text-destructive`,title:e.lastError,children:[`last error: `,e.lastError]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-1`,children:[(0,w.jsx)(y,{size:`icon-sm`,variant:`ghost`,title:`Run now`,disabled:z,onClick:t=>{t.stopPropagation(),J(e)},children:(0,w.jsx)(l,{})}),(0,w.jsx)(y,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,title:`Delete`,disabled:z,onClick:t=>{t.stopPropagation(),Y(e)},children:(0,w.jsx)(f,{})})]})]},e.id)),e.length===0&&(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,w.jsx)(v,{className:`size-8`}),`No schedules in this workspace yet. Create one to run a prompt on a timer.`]})]}),(0,w.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-auto`,children:Z?(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border bg-card p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:N?`New schedule`:`Edit schedule`}),X&&(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,w.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>J(X),disabled:z,children:[(0,w.jsx)(l,{className:`size-3.5`}),` Run now`]}),(0,w.jsx)(y,{size:`sm`,variant:`outline`,onClick:()=>q(X),disabled:z,children:X.enabled?`Pause`:`Resume`})]})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{htmlFor:`sch-name`,children:`Name`}),(0,w.jsx)(b,{id:`sch-name`,value:F.name,placeholder:`Morning report`,onChange:e=>$(`name`,e.target.value)})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{htmlFor:`sch-prompt`,children:`Prompt`}),(0,w.jsx)(ee,{id:`sch-prompt`,value:F.prompt,placeholder:`What should the agent do each time?`,className:`min-h-24 resize-y font-mono text-sm`,onChange:e=>$(`prompt`,e.target.value)})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{children:`When`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(s,{value:F.kind,onValueChange:e=>$(`kind`,e??`cron`),children:[(0,w.jsx)(i,{size:`sm`,className:`w-32`,children:(0,w.jsx)(r,{children:F.kind===`cron`?`Repeating`:`One-off`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`cron`,children:`Repeating (cron)`}),(0,w.jsx)(o,{value:`once`,children:`One-off`})]})]}),F.kind===`cron`?(0,w.jsx)(b,{value:F.cron,placeholder:`0 9 * * *`,className:`w-44 font-mono`,onChange:e=>$(`cron`,e.target.value)}):(0,w.jsx)(b,{type:`datetime-local`,value:F.runAtLocal,className:`w-56`,onChange:e=>$(`runAtLocal`,e.target.value)})]}),F.kind===`cron`&&(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:te.map(e=>(0,w.jsx)(y,{size:`sm`,variant:`outline`,className:`h-6 text-xs`,onClick:()=>$(`cron`,e.cron),children:e.label},e.cron))}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(S,{htmlFor:`sch-tz`,className:`font-normal text-muted-foreground`,children:`Timezone`}),(0,w.jsx)(b,{id:`sch-tz`,value:F.tz,placeholder:k,className:`h-7 w-56`,onChange:e=>$(`tz`,e.target.value)})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Cron fields: minute hour day-of-month month day-of-week. Times are evaluated in the timezone above (defaults to the daemon's local time if blank).`})]}),(0,w.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,w.jsx)(S,{children:`Run mode`}),(0,w.jsxs)(s,{value:F.modeKey,onValueChange:e=>$(`modeKey`,e??`unattended`),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:T[F.modeKey].label})}),(0,w.jsx)(a,{children:Object.keys(T).map(e=>(0,w.jsx)(o,{value:e,children:(0,w.jsxs)(`span`,{className:`channel-mode-item`,children:[(0,w.jsx)(`span`,{className:`channel-mode-label`,children:T[e].label}),(0,w.jsx)(`span`,{className:`channel-mode-hint`,children:T[e].hint})]})},e))})]})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,w.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,w.jsx)(S,{children:`Model`}),(0,w.jsxs)(s,{value:F.model||`__default`,onValueChange:e=>$(`model`,e===`__default`?``:e??``),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:Q?.displayName??`Engine default`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`__default`,children:`Engine default`}),n.map(e=>(0,w.jsxs)(o,{value:e.model,children:[e.displayName,e.isDefault?` · default`:``]},e.id))]})]})]}),(0,w.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,w.jsx)(S,{children:`Reasoning effort`}),(0,w.jsxs)(s,{value:F.effort||`__default`,onValueChange:e=>$(`effort`,e===`__default`?``:e??``),children:[(0,w.jsx)(i,{size:`sm`,className:`w-full`,children:(0,w.jsx)(r,{children:F.effort||`Default (medium)`})}),(0,w.jsxs)(a,{children:[(0,w.jsx)(o,{value:`__default`,children:`Default (medium)`}),ne.map(e=>(0,w.jsx)(o,{value:e.reasoningEffort,children:e.reasoningEffort},e.reasoningEffort))]})]})]})]}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{checked:F.resume,onCheckedChange:e=>$(`resume`,e===!0)}),`Resume one persistent conversation each fire (context accumulates across runs)`]}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(c,{checked:F.enabled,onCheckedChange:e=>$(`enabled`,e===!0)}),`Enabled`]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(y,{onClick:K,disabled:z,children:z?`Saving…`:N?`Create schedule`:`Save changes`}),(0,w.jsx)(y,{variant:`ghost`,onClick:()=>{P(!1),M(null)},disabled:z,children:`Cancel`})]}),X&&(0,w.jsxs)(`div`,{className:`mt-1 grid gap-0.5 border-t pt-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`div`,{children:[`Next run: `,O(X.nextRunAt)]}),(0,w.jsxs)(`div`,{children:[`Last run: `,O(X.lastRunAt)]}),X.lastRunId&&(0,w.jsxs)(`div`,{children:[`Last run id: `,X.lastRunId]}),X.lastError&&(0,w.jsxs)(`div`,{className:`text-destructive`,children:[`Last error: `,X.lastError]})]})]}):(0,w.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a schedule to edit, or create a new one.`})})]})]})}export{M as SchedulesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as i}from"./external-link-DCXGJhiP.js";import{t as a}from"./key-round-i_iJarVP.js";import{t as o}from"./rotate-cw-BUTALXBe.js";import{i as s,n as c,r as l}from"./api-DTaM-PBA.js";import{Yt as u}from"./index-N-aJPrjP.js";import{t as d}from"./button-C5SbvNQM.js";import{t as f}from"./input-F0nzOm5c.js";import{t as p}from"./badge-Czi0QcSt.js";var m=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),h=r(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),g=r(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),_=e(t(),1),v=n(),y=2e3;function b(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(null),[k,A]=(0,_.useState)(null),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(!1),z=(0,_.useCallback)(async()=>{try{let e=await c(`/api/account`);return r(e),x(null),e}catch(e){return x(e instanceof Error?e.message:String(e)),null}},[]);(0,_.useEffect)(()=>{c(`/api/status`).then(t).catch(()=>{}),c(`/api/settings`).then(e=>{A(e),P(e.browserProxy.noProxy??``)}).catch(()=>{}),z()},[z]);let B=(0,_.useCallback)(async e=>{I(!0),x(null);try{let t=await s(`/api/settings/browser-proxy`,e);A(t),M(``),P(t.browserProxy.noProxy??``),R(!0)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]),V=()=>{let e={noProxy:N.trim()||null};return j.trim()&&(e.proxyUrl=j.trim()),B(e)},H=()=>B({proxyUrl:null,noProxy:null}),U=async()=>{I(!0),x(null);try{await l(`/api/browser/stop`),await l(`/api/browser/start`),R(!1)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}};(0,_.useEffect)(()=>{if(!n?.pendingLogin){O.current!==null&&(window.clearInterval(O.current),O.current=null);return}if(O.current===null)return O.current=window.setInterval(z,y),()=>{O.current!==null&&(window.clearInterval(O.current),O.current=null)}},[n?.pendingLogin,z]);let W=(0,_.useCallback)(async e=>{C(!0),x(null);try{r(await e())}catch(e){x(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]),G=()=>W(async()=>{let e=await l(`/api/account/login`,{type:`chatgpt`});return e.pendingLogin?.authUrl&&window.open(e.pendingLogin.authUrl,`_blank`,`noopener`),e}),K=()=>W(()=>l(`/api/account/login`,{type:`chatgptDeviceCode`})),q=()=>W(async()=>{let e=await l(`/api/account/login`,{type:`apiKey`,apiKey:w.trim()});return T(``),D(!1),e}),J=()=>W(()=>l(`/api/account/login/cancel`)),Y=()=>W(()=>l(`/api/account/logout`)),X=n?.pendingLogin??null,Z=n?.lastLoginResult??null;return(0,v.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 overflow-auto p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h1`,{className:`text-base font-semibold`,children:`Settings`}),(0,v.jsx)(`div`,{className:`ml-auto`,children:(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>z(),disabled:S,children:[(0,v.jsx)(o,{className:`size-3.5`}),` Refresh`]})})]}),b&&(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:b}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsx)(`div`,{className:`mb-1 text-sm font-medium`,children:`Codex account`}),(0,v.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`The engine's sign-in — shared by every workspace. Auth is stored in the Jun Codex home, separate from your personal `,(0,v.jsx)(`code`,{children:`~/.codex`}),`.`]}),n?n.account?(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(g,{className:`size-4 text-muted-foreground`}),n.account.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:n.account.email}),(0,v.jsxs)(p,{variant:`outline`,children:[`ChatGPT · `,n.account.planType]})]}):n.account.type===`apiKey`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:`Signed in with an OpenAI API key`}),(0,v.jsx)(p,{variant:`outline`,children:`API key`})]}):(0,v.jsx)(p,{variant:`outline`,children:`Amazon Bedrock`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`ml-auto`,onClick:Y,disabled:S,children:[(0,v.jsx)(m,{className:`size-3.5`}),` Sign out`]})]}):X?(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[X.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`p`,{className:`text-sm`,children:`Finish signing in to ChatGPT in the browser tab that just opened.`}),X.authUrl&&(0,v.jsxs)(`a`,{href:X.authUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-muted-foreground underline underline-offset-2`,children:[`Open the sign-in page again `,(0,v.jsx)(i,{className:`size-3.5`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The sign-in callback lands on this machine — if Jun runs on a remote server, cancel and use the device code instead.`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[`Sign in at`,` `,X.verificationUrl?(0,v.jsx)(`a`,{href:X.verificationUrl,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2`,children:X.verificationUrl}):`the verification page`,` `,`and enter this code:`]}),(0,v.jsx)(`div`,{className:`w-fit rounded-md border bg-muted/40 px-4 py-2 font-mono text-xl tracking-widest`,children:X.userCode})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Waiting for sign-in…`}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:J,disabled:S,children:`Cancel`})]})]}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Z&&!Z.success&&(0,v.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[`Sign-in failed`,Z.error?`: ${Z.error}`:`.`]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsxs)(d,{size:`sm`,onClick:K,disabled:S,children:[(0,v.jsx)(h,{className:`size-3.5`}),` Sign in with ChatGPT`]}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:G,disabled:S,children:`Browser sign-in (local only)`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>D(e=>!e),disabled:S,children:[(0,v.jsx)(a,{className:`size-3.5`}),` Use an API key`]})]}),E&&(0,v.jsxs)(`div`,{className:`flex max-w-md items-center gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:`sk-…`,value:w,autoComplete:`off`,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w.trim()&&q()}}),(0,v.jsx)(d,{size:`sm`,onClick:q,disabled:S||!w.trim(),children:`Sign in`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sign-in uses a device code: open the link on any device, enter the code — works headless (VPS). Browser sign-in needs its callback to reach this machine, so use it only when Jun runs locally.`})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-sm font-medium`,children:[(0,v.jsx)(u,{className:`size-4 text-muted-foreground`}),` Browser proxy`]}),(0,v.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Routes the agent browser through a proxy (e.g. a residential exit when the host IP is datacenter space sites block). Browser traffic only — Codex API traffic is never proxied. Applies when the browser session (re)starts.`}),k?(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:k.browserProxy.proxyUrl?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`code`,{className:`rounded bg-muted/40 px-2 py-1 text-xs`,children:k.browserProxy.proxyUrl}),(0,v.jsx)(p,{variant:`outline`,children:k.browserProxy.source===`settings`?`from settings`:`from environment`}),k.browserProxy.source===`settings`&&(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:H,disabled:F,children:`Clear`})]}):(0,v.jsx)(`span`,{className:`text-muted-foreground`,children:`No proxy configured — the browser uses the host connection directly.`})}),(0,v.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:k.browserProxy.proxyUrl?`Replace proxy URL: http://user:pass@host:port`:`http://user:pass@host:port`,value:j,autoComplete:`off`,onChange:e=>M(e.target.value)}),(0,v.jsx)(f,{placeholder:`Bypass list (optional), e.g. localhost,*.internal`,value:N,onChange:e=>P(e.target.value)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(d,{size:`sm`,onClick:V,disabled:F||!j.trim()&&(N.trim()||``)===(k.browserProxy.noProxy??``),children:`Save`}),L&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved — restart the browser session to apply.`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:U,disabled:F,children:[(0,v.jsx)(o,{className:`size-3.5`}),` Restart browser`]})]})]})]})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium`,children:`Daemon status`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,disabled:S,onClick:()=>{c(`/api/status?refresh=1`).then(t).catch(()=>{})},children:[(0,v.jsx)(o,{className:`size-3.5`}),` Check for updates`]})]}),e?(0,v.jsx)(`pre`,{className:`overflow-auto rounded-md bg-muted/40 p-2 text-xs`,children:JSON.stringify(e,null,2)}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]})]})}export{b as SettingsPage};
|
|
1
|
+
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as i}from"./external-link-DCXGJhiP.js";import{t as a}from"./key-round-i_iJarVP.js";import{t as o}from"./rotate-cw-BUTALXBe.js";import{i as s,n as c,r as l}from"./api-DTaM-PBA.js";import{Yt as u}from"./index-BV4eUtAp.js";import{t as d}from"./button-C5SbvNQM.js";import{t as f}from"./input-S0ZdxSeo.js";import{t as p}from"./badge-Czi0QcSt.js";var m=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),h=r(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),g=r(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),_=e(t(),1),v=n(),y=2e3;function b(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(null),[k,A]=(0,_.useState)(null),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(!1),z=(0,_.useCallback)(async()=>{try{let e=await c(`/api/account`);return r(e),x(null),e}catch(e){return x(e instanceof Error?e.message:String(e)),null}},[]);(0,_.useEffect)(()=>{c(`/api/status`).then(t).catch(()=>{}),c(`/api/settings`).then(e=>{A(e),P(e.browserProxy.noProxy??``)}).catch(()=>{}),z()},[z]);let B=(0,_.useCallback)(async e=>{I(!0),x(null);try{let t=await s(`/api/settings/browser-proxy`,e);A(t),M(``),P(t.browserProxy.noProxy??``),R(!0)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]),V=()=>{let e={noProxy:N.trim()||null};return j.trim()&&(e.proxyUrl=j.trim()),B(e)},H=()=>B({proxyUrl:null,noProxy:null}),U=async()=>{I(!0),x(null);try{await l(`/api/browser/stop`),await l(`/api/browser/start`),R(!1)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}};(0,_.useEffect)(()=>{if(!n?.pendingLogin){O.current!==null&&(window.clearInterval(O.current),O.current=null);return}if(O.current===null)return O.current=window.setInterval(z,y),()=>{O.current!==null&&(window.clearInterval(O.current),O.current=null)}},[n?.pendingLogin,z]);let W=(0,_.useCallback)(async e=>{C(!0),x(null);try{r(await e())}catch(e){x(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]),G=()=>W(async()=>{let e=await l(`/api/account/login`,{type:`chatgpt`});return e.pendingLogin?.authUrl&&window.open(e.pendingLogin.authUrl,`_blank`,`noopener`),e}),K=()=>W(()=>l(`/api/account/login`,{type:`chatgptDeviceCode`})),q=()=>W(async()=>{let e=await l(`/api/account/login`,{type:`apiKey`,apiKey:w.trim()});return T(``),D(!1),e}),J=()=>W(()=>l(`/api/account/login/cancel`)),Y=()=>W(()=>l(`/api/account/logout`)),X=n?.pendingLogin??null,Z=n?.lastLoginResult??null;return(0,v.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 overflow-auto p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h1`,{className:`text-base font-semibold`,children:`Settings`}),(0,v.jsx)(`div`,{className:`ml-auto`,children:(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>z(),disabled:S,children:[(0,v.jsx)(o,{className:`size-3.5`}),` Refresh`]})})]}),b&&(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:b}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsx)(`div`,{className:`mb-1 text-sm font-medium`,children:`Codex account`}),(0,v.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`The engine's sign-in — shared by every workspace. Auth is stored in the Jun Codex home, separate from your personal `,(0,v.jsx)(`code`,{children:`~/.codex`}),`.`]}),n?n.account?(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(g,{className:`size-4 text-muted-foreground`}),n.account.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:n.account.email}),(0,v.jsxs)(p,{variant:`outline`,children:[`ChatGPT · `,n.account.planType]})]}):n.account.type===`apiKey`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:`Signed in with an OpenAI API key`}),(0,v.jsx)(p,{variant:`outline`,children:`API key`})]}):(0,v.jsx)(p,{variant:`outline`,children:`Amazon Bedrock`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`ml-auto`,onClick:Y,disabled:S,children:[(0,v.jsx)(m,{className:`size-3.5`}),` Sign out`]})]}):X?(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[X.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`p`,{className:`text-sm`,children:`Finish signing in to ChatGPT in the browser tab that just opened.`}),X.authUrl&&(0,v.jsxs)(`a`,{href:X.authUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-muted-foreground underline underline-offset-2`,children:[`Open the sign-in page again `,(0,v.jsx)(i,{className:`size-3.5`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The sign-in callback lands on this machine — if Jun runs on a remote server, cancel and use the device code instead.`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[`Sign in at`,` `,X.verificationUrl?(0,v.jsx)(`a`,{href:X.verificationUrl,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2`,children:X.verificationUrl}):`the verification page`,` `,`and enter this code:`]}),(0,v.jsx)(`div`,{className:`w-fit rounded-md border bg-muted/40 px-4 py-2 font-mono text-xl tracking-widest`,children:X.userCode})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Waiting for sign-in…`}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:J,disabled:S,children:`Cancel`})]})]}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Z&&!Z.success&&(0,v.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[`Sign-in failed`,Z.error?`: ${Z.error}`:`.`]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsxs)(d,{size:`sm`,onClick:K,disabled:S,children:[(0,v.jsx)(h,{className:`size-3.5`}),` Sign in with ChatGPT`]}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:G,disabled:S,children:`Browser sign-in (local only)`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>D(e=>!e),disabled:S,children:[(0,v.jsx)(a,{className:`size-3.5`}),` Use an API key`]})]}),E&&(0,v.jsxs)(`div`,{className:`flex max-w-md items-center gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:`sk-…`,value:w,autoComplete:`off`,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w.trim()&&q()}}),(0,v.jsx)(d,{size:`sm`,onClick:q,disabled:S||!w.trim(),children:`Sign in`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sign-in uses a device code: open the link on any device, enter the code — works headless (VPS). Browser sign-in needs its callback to reach this machine, so use it only when Jun runs locally.`})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-sm font-medium`,children:[(0,v.jsx)(u,{className:`size-4 text-muted-foreground`}),` Browser proxy`]}),(0,v.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Routes the agent browser through a proxy (e.g. a residential exit when the host IP is datacenter space sites block). Browser traffic only — Codex API traffic is never proxied. Applies when the browser session (re)starts.`}),k?(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:k.browserProxy.proxyUrl?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`code`,{className:`rounded bg-muted/40 px-2 py-1 text-xs`,children:k.browserProxy.proxyUrl}),(0,v.jsx)(p,{variant:`outline`,children:k.browserProxy.source===`settings`?`from settings`:`from environment`}),k.browserProxy.source===`settings`&&(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:H,disabled:F,children:`Clear`})]}):(0,v.jsx)(`span`,{className:`text-muted-foreground`,children:`No proxy configured — the browser uses the host connection directly.`})}),(0,v.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:k.browserProxy.proxyUrl?`Replace proxy URL: http://user:pass@host:port`:`http://user:pass@host:port`,value:j,autoComplete:`off`,onChange:e=>M(e.target.value)}),(0,v.jsx)(f,{placeholder:`Bypass list (optional), e.g. localhost,*.internal`,value:N,onChange:e=>P(e.target.value)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(d,{size:`sm`,onClick:V,disabled:F||!j.trim()&&(N.trim()||``)===(k.browserProxy.noProxy??``),children:`Save`}),L&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved — restart the browser session to apply.`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:U,disabled:F,children:[(0,v.jsx)(o,{className:`size-3.5`}),` Restart browser`]})]})]})]})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium`,children:`Daemon status`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,disabled:S,onClick:()=>{c(`/api/status?refresh=1`).then(t).catch(()=>{})},children:[(0,v.jsx)(o,{className:`size-3.5`}),` Check for updates`]})]}),e?(0,v.jsx)(`pre`,{className:`overflow-auto rounded-md bg-muted/40 p-2 text-xs`,children:JSON.stringify(e,null,2)}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]})]})}export{b as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as ee}from"./external-link-DCXGJhiP.js";import{a as i,i as a,n as o,r as te,t as ne}from"./tabs-CMZKIx3J.js";import{i as re}from"./useCompositeListItem-DRvL68vb.js";import{t as ie}from"./search-CKqhWG6h.js";import{t as ae}from"./trash-2-D5W0vize.js";import{a as oe,i as se,o as ce,r as s,s as c,t as l}from"./dialog-CYLeVyM-.js";import{c as u,i as le,n as d,r as f,t as ue}from"./api-DTaM-PBA.js";import{$t as p,en as de}from"./index-N-aJPrjP.js";import{t as m}from"./button-C5SbvNQM.js";import{t as h}from"./input-F0nzOm5c.js";import{t as g}from"./textarea-CwL3B5t5.js";import{t as _}from"./badge-Czi0QcSt.js";import{t as v}from"./label-DIdZ-j1R.js";var fe=r(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),pe=r(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),me=r(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),he=r(`store`,[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]),y=e(t(),1),b=n();function x({className:e,...t}){return(0,b.jsx)(i,{role:`status`,"aria-label":`Loading`,className:u(`size-4 animate-spin`,e),...t})}function ge(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(e.replace(/^/,``));if(!t)return{name:``,description:``,body:e,ok:!1};let n={};for(let e of t[1].split(/\r?\n/)){let t=/^([A-Za-z_][\w-]*):\s*(.*)$/.exec(e);t&&(n[t[1].toLowerCase()]=t[2].trim().replace(/^["']|["']$/g,``))}return{name:n.name??``,description:n.description??``,body:t[2].replace(/^\r?\n/,``),ok:!0}}function S(e,t,n){return`---\nname: ${e}\ndescription: ${t}\n---\n\n${n.trim()}\n`}function C(){let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(``),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(!1),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(null),[_e,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(``),[z,ve]=(0,y.useState)(``),[ye,B]=(0,y.useState)(null),[V,H]=(0,y.useState)(!1),[be,U]=(0,y.useState)(!1),[W,xe]=(0,y.useState)(``),[G,Se]=(0,y.useState)([]),[K,q]=(0,y.useState)(!1),[Ce,we]=(0,y.useState)(!1),[J,Y]=(0,y.useState)(null),[X,Te]=(0,y.useState)(null),[Ee,De]=(0,y.useState)(new Set),Z=(0,y.useCallback)(async()=>{try{let{skills:e}=await d(`/api/skills`);t(e),N(null)}catch(e){N(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{Z()},[Z]);let Q=(0,y.useCallback)(async e=>{r(e),C(null),B(null),k(!0);try{let{skill:t}=await d(`/api/skills/${e}`);C(t),T(t.content),D(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[]),$=(0,y.useMemo)(()=>ge(w),[w]),Oe=async()=>{if(!(!n||A)){j(!0),N(null);try{let{skill:e}=await le(`/api/skills/${n}`,{content:w});C(e),T(e.content),D(!1),await Z()}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}}},ke=async()=>{let e=F.trim(),t=L.trim();if(!(!e||!t)){N(null);try{let{skill:n}=await f(`/api/skills`,{name:e,description:t});P(!1),I(``),R(``),await Z(),await Q(n.info.id)}catch(e){N(e instanceof Error?e.message:String(e))}}},Ae=async()=>{if(n&&window.confirm(`Delete skill "${n}"? This removes its folder.`))try{await ue(`/api/skills/${n}`),r(null),C(null),await Z()}catch(e){N(e instanceof Error?e.message:String(e))}},je=async()=>{if(!(!n||!i))try{await f(`/api/skills/${n}/enable`,{enabled:!i.info.enabled}),await Z(),await Q(n)}catch(e){N(e instanceof Error?e.message:String(e))}},Me=async()=>{if(!(!n||V)){H(!0),B(null),N(null);try{let{run:e}=await f(`/api/skills/${n}/test`,{prompt:z.trim()||void 0});B(e)}catch(e){N(e instanceof Error?e.message:String(e))}finally{H(!1)}}},Ne=async()=>{let e=W.trim();if(!(!e||K)){q(!0),Y(null);try{let{results:t}=await d(`/api/skills/registry/search?q=${encodeURIComponent(e)}`);Se(t),we(!0)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}}},Pe=async e=>{if(!X){Te(e),Y(null);try{let n=await f(`/api/skills/registry/install`,{source:e});De(t=>new Set(t).add(e)),t(n.skills)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Te(null)}}},Fe=(e,t)=>{T(e===`description`?S($.name||n||``,t,$.body):S($.name||n||``,$.description,t)),D(!0)};return(0,b.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,b.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-r`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-sm font-semibold`,children:`Skills`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>U(!0),children:[(0,b.jsx)(he,{className:`size-3.5`}),` Browse`]}),(0,b.jsx)(m,{size:`icon-sm`,variant:`outline`,onClick:()=>P(!0),children:(0,b.jsx)(re,{})})]})]}),(0,b.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[e.map(e=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>Q(e.id),className:u(`w-full rounded-md px-2.5 py-2 text-left transition-colors hover:bg-muted/60`,e.id===n&&`bg-muted`),children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.errors.length>0&&(0,b.jsx)(fe,{className:`size-3.5 shrink-0 text-destructive`}),!e.enabled&&(0,b.jsx)(_,{variant:`outline`,className:`shrink-0`,children:`disabled`})]}),(0,b.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.description||`No description`})]},e.id)),e.length===0&&(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,b.jsx)(p,{className:`size-8`}),`No skills in the workspace yet. Create one — it becomes a folder with a SKILL.md, available to runs.`]})]})]}),(0,b.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[M&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}),!n&&(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,b.jsx)(p,{className:`size-8`}),`Select a skill or create a new one.`]}),n&&O&&(0,b.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,b.jsx)(x,{})}),n&&i&&!O&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h2`,{className:`text-base font-semibold`,children:i.info.name}),(0,b.jsx)(_,{variant:i.info.enabled?`secondary`:`outline`,children:i.info.enabled?`enabled`:`disabled`}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(m,{size:`sm`,variant:`outline`,onClick:je,children:i.info.enabled?`Disable`:`Enable`}),(0,b.jsxs)(m,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,onClick:Ae,children:[(0,b.jsx)(ae,{className:`size-3.5`}),` Delete`]}),(0,b.jsx)(m,{size:`sm`,onClick:Oe,disabled:!E||A,children:A?`Saving…`:E?`Save`:`Saved`})]})]}),i.info.errors.length>0&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:i.info.errors.map(e=>(0,b.jsx)(`div`,{children:e},e))}),(0,b.jsxs)(ne,{defaultValue:$.ok?`simple`:`advanced`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,b.jsxs)(te,{children:[(0,b.jsx)(a,{value:`simple`,disabled:!$.ok,children:`Simple`}),(0,b.jsx)(a,{value:`advanced`,children:`Advanced`}),(0,b.jsxs)(a,{value:`test`,children:[(0,b.jsx)(me,{className:`size-3.5`}),` Test`]})]}),(0,b.jsxs)(o,{value:`simple`,className:`flex min-h-0 flex-1 flex-col gap-3 pt-2`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`skill-description`,children:`Description`}),(0,b.jsx)(h,{id:`skill-description`,value:$.description,placeholder:`When should Codex reach for this skill?`,onChange:e=>Fe(`description`,e.target.value)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Codex reads this to decide when the skill applies.`})]}),(0,b.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`skill-instructions`,children:`Instructions`}),(0,b.jsx)(g,{id:`skill-instructions`,value:$.body,placeholder:`Step-by-step instructions for Codex…`,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>Fe(`body`,e.target.value)})]})]}),(0,b.jsxs)(o,{value:`advanced`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,b.jsx)(g,{value:w,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}}),i.files.length>0&&(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Extra files: `,i.files.join(`, `),` (edit via the Files page)`]})]}),(0,b.jsxs)(o,{value:`test`,className:`flex flex-col gap-3 pt-2`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`test-prompt`,children:`Test prompt`}),(0,b.jsx)(g,{id:`test-prompt`,value:z,rows:3,placeholder:`Leave empty for a default prompt that exercises "${i.info.name}".`,onChange:e=>ve(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(m,{size:`sm`,onClick:Me,disabled:V,children:V?`Starting…`:`Run test with Codex`}),ye&&(0,b.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Test run started —`,` `,(0,b.jsx)(de,{to:`/runs`,className:`text-primary underline-offset-2 hover:underline`,children:`watch it in Runs`})]})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The run loads this skill explicitly, so Codex follows its instructions even for a generic prompt.`})]})]})]})]}),(0,b.jsx)(l,{open:_e,onOpenChange:P,children:(0,b.jsxs)(s,{children:[(0,b.jsxs)(ce,{children:[(0,b.jsx)(c,{children:`New skill`}),(0,b.jsxs)(se,{children:[`Creates `,(0,b.jsx)(`code`,{children:`.agents/skills/<name>/SKILL.md`}),` in the workspace.`]})]}),(0,b.jsxs)(`div`,{className:`grid gap-3`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`new-skill-name`,children:`Name`}),(0,b.jsx)(h,{id:`new-skill-name`,value:F,placeholder:`my-skill (lowercase, dashes)`,onChange:e=>I(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`new-skill-description`,children:`Description`}),(0,b.jsx)(h,{id:`new-skill-description`,value:L,placeholder:`What this skill does and when to use it`,onChange:e=>R(e.target.value)})]})]}),(0,b.jsxs)(oe,{children:[(0,b.jsx)(m,{variant:`outline`,onClick:()=>P(!1),children:`Cancel`}),(0,b.jsx)(m,{onClick:ke,disabled:F.trim().length===0||L.trim().length===0,children:`Create`})]})]})}),(0,b.jsx)(l,{open:be,onOpenChange:U,children:(0,b.jsxs)(s,{className:`flex max-h-[80vh] flex-col sm:max-w-2xl`,children:[(0,b.jsxs)(ce,{children:[(0,b.jsx)(c,{children:`Browse skills.sh`}),(0,b.jsxs)(se,{children:[`Search the`,` `,(0,b.jsx)(`a`,{href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,className:`text-primary underline-offset-2 hover:underline`,children:`skills.sh`}),` `,`registry and install into the workspace. Skills run with full agent permissions — review before use.`]})]}),(0,b.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),Ne()},children:[(0,b.jsx)(h,{autoFocus:!0,value:W,placeholder:`Search skills (e.g. react, deploy, postgres)…`,onChange:e=>xe(e.target.value)}),(0,b.jsxs)(m,{type:`submit`,disabled:K||W.trim().length===0,children:[K?(0,b.jsx)(x,{className:`size-4`}):(0,b.jsx)(ie,{className:`size-4`}),`Search`]})]}),J&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm whitespace-pre-wrap text-destructive`,children:J}),(0,b.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[Ce&&G.length===0&&!K&&(0,b.jsxs)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:[`No skills found for “`,W.trim(),`”.`]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:G.map(e=>{let t=Ee.has(e.source);return(0,b.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border px-3 py-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.installs&&(0,b.jsx)(_,{variant:`outline`,className:`shrink-0`,children:e.installs})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,children:[e.repo,e.url&&(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center hover:text-foreground`,children:(0,b.jsx)(ee,{className:`size-3`})})]})]}),(0,b.jsx)(m,{size:`sm`,variant:t?`secondary`:`outline`,disabled:t||X!==null,onClick:()=>Pe(e.source),children:X===e.source?(0,b.jsx)(x,{className:`size-4`}):t?`Installed`:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(pe,{className:`size-3.5`}),` Install`]})})]},e.source)})})]})]})})]})}export{C as SkillsPage};
|
|
1
|
+
import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as ee}from"./external-link-DCXGJhiP.js";import{a as i,i as a,n as o,r as te,t as ne}from"./tabs-A13Rxj36.js";import{i as re}from"./useCompositeListItem-DRvL68vb.js";import{t as ie}from"./search-CKqhWG6h.js";import{t as ae}from"./trash-2-D5W0vize.js";import{a as oe,i as se,o as ce,r as s,s as c,t as l}from"./dialog-BTcyz3qf.js";import{c as u,i as le,n as d,r as f,t as ue}from"./api-DTaM-PBA.js";import{$t as p,en as de}from"./index-BV4eUtAp.js";import{t as m}from"./button-C5SbvNQM.js";import{t as h}from"./input-S0ZdxSeo.js";import{t as g}from"./textarea-CwL3B5t5.js";import{t as _}from"./badge-Czi0QcSt.js";import{t as v}from"./label-DIdZ-j1R.js";var fe=r(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),pe=r(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),me=r(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),he=r(`store`,[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]),y=e(t(),1),b=n();function x({className:e,...t}){return(0,b.jsx)(i,{role:`status`,"aria-label":`Loading`,className:u(`size-4 animate-spin`,e),...t})}function ge(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(e.replace(/^/,``));if(!t)return{name:``,description:``,body:e,ok:!1};let n={};for(let e of t[1].split(/\r?\n/)){let t=/^([A-Za-z_][\w-]*):\s*(.*)$/.exec(e);t&&(n[t[1].toLowerCase()]=t[2].trim().replace(/^["']|["']$/g,``))}return{name:n.name??``,description:n.description??``,body:t[2].replace(/^\r?\n/,``),ok:!0}}function S(e,t,n){return`---\nname: ${e}\ndescription: ${t}\n---\n\n${n.trim()}\n`}function C(){let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(``),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(!1),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(null),[_e,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(``),[z,ve]=(0,y.useState)(``),[ye,B]=(0,y.useState)(null),[V,H]=(0,y.useState)(!1),[be,U]=(0,y.useState)(!1),[W,xe]=(0,y.useState)(``),[G,Se]=(0,y.useState)([]),[K,q]=(0,y.useState)(!1),[Ce,we]=(0,y.useState)(!1),[J,Y]=(0,y.useState)(null),[X,Te]=(0,y.useState)(null),[Ee,De]=(0,y.useState)(new Set),Z=(0,y.useCallback)(async()=>{try{let{skills:e}=await d(`/api/skills`);t(e),N(null)}catch(e){N(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{Z()},[Z]);let Q=(0,y.useCallback)(async e=>{r(e),C(null),B(null),k(!0);try{let{skill:t}=await d(`/api/skills/${e}`);C(t),T(t.content),D(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[]),$=(0,y.useMemo)(()=>ge(w),[w]),Oe=async()=>{if(!(!n||A)){j(!0),N(null);try{let{skill:e}=await le(`/api/skills/${n}`,{content:w});C(e),T(e.content),D(!1),await Z()}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}}},ke=async()=>{let e=F.trim(),t=L.trim();if(!(!e||!t)){N(null);try{let{skill:n}=await f(`/api/skills`,{name:e,description:t});P(!1),I(``),R(``),await Z(),await Q(n.info.id)}catch(e){N(e instanceof Error?e.message:String(e))}}},Ae=async()=>{if(n&&window.confirm(`Delete skill "${n}"? This removes its folder.`))try{await ue(`/api/skills/${n}`),r(null),C(null),await Z()}catch(e){N(e instanceof Error?e.message:String(e))}},je=async()=>{if(!(!n||!i))try{await f(`/api/skills/${n}/enable`,{enabled:!i.info.enabled}),await Z(),await Q(n)}catch(e){N(e instanceof Error?e.message:String(e))}},Me=async()=>{if(!(!n||V)){H(!0),B(null),N(null);try{let{run:e}=await f(`/api/skills/${n}/test`,{prompt:z.trim()||void 0});B(e)}catch(e){N(e instanceof Error?e.message:String(e))}finally{H(!1)}}},Ne=async()=>{let e=W.trim();if(!(!e||K)){q(!0),Y(null);try{let{results:t}=await d(`/api/skills/registry/search?q=${encodeURIComponent(e)}`);Se(t),we(!0)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}}},Pe=async e=>{if(!X){Te(e),Y(null);try{let n=await f(`/api/skills/registry/install`,{source:e});De(t=>new Set(t).add(e)),t(n.skills)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Te(null)}}},Fe=(e,t)=>{T(e===`description`?S($.name||n||``,t,$.body):S($.name||n||``,$.description,t)),D(!0)};return(0,b.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,b.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-r`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-sm font-semibold`,children:`Skills`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>U(!0),children:[(0,b.jsx)(he,{className:`size-3.5`}),` Browse`]}),(0,b.jsx)(m,{size:`icon-sm`,variant:`outline`,onClick:()=>P(!0),children:(0,b.jsx)(re,{})})]})]}),(0,b.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[e.map(e=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>Q(e.id),className:u(`w-full rounded-md px-2.5 py-2 text-left transition-colors hover:bg-muted/60`,e.id===n&&`bg-muted`),children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.errors.length>0&&(0,b.jsx)(fe,{className:`size-3.5 shrink-0 text-destructive`}),!e.enabled&&(0,b.jsx)(_,{variant:`outline`,className:`shrink-0`,children:`disabled`})]}),(0,b.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.description||`No description`})]},e.id)),e.length===0&&(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,b.jsx)(p,{className:`size-8`}),`No skills in the workspace yet. Create one — it becomes a folder with a SKILL.md, available to runs.`]})]})]}),(0,b.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[M&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}),!n&&(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,b.jsx)(p,{className:`size-8`}),`Select a skill or create a new one.`]}),n&&O&&(0,b.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,b.jsx)(x,{})}),n&&i&&!O&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h2`,{className:`text-base font-semibold`,children:i.info.name}),(0,b.jsx)(_,{variant:i.info.enabled?`secondary`:`outline`,children:i.info.enabled?`enabled`:`disabled`}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(m,{size:`sm`,variant:`outline`,onClick:je,children:i.info.enabled?`Disable`:`Enable`}),(0,b.jsxs)(m,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,onClick:Ae,children:[(0,b.jsx)(ae,{className:`size-3.5`}),` Delete`]}),(0,b.jsx)(m,{size:`sm`,onClick:Oe,disabled:!E||A,children:A?`Saving…`:E?`Save`:`Saved`})]})]}),i.info.errors.length>0&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:i.info.errors.map(e=>(0,b.jsx)(`div`,{children:e},e))}),(0,b.jsxs)(ne,{defaultValue:$.ok?`simple`:`advanced`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,b.jsxs)(te,{children:[(0,b.jsx)(a,{value:`simple`,disabled:!$.ok,children:`Simple`}),(0,b.jsx)(a,{value:`advanced`,children:`Advanced`}),(0,b.jsxs)(a,{value:`test`,children:[(0,b.jsx)(me,{className:`size-3.5`}),` Test`]})]}),(0,b.jsxs)(o,{value:`simple`,className:`flex min-h-0 flex-1 flex-col gap-3 pt-2`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`skill-description`,children:`Description`}),(0,b.jsx)(h,{id:`skill-description`,value:$.description,placeholder:`When should Codex reach for this skill?`,onChange:e=>Fe(`description`,e.target.value)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Codex reads this to decide when the skill applies.`})]}),(0,b.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`skill-instructions`,children:`Instructions`}),(0,b.jsx)(g,{id:`skill-instructions`,value:$.body,placeholder:`Step-by-step instructions for Codex…`,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>Fe(`body`,e.target.value)})]})]}),(0,b.jsxs)(o,{value:`advanced`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,b.jsx)(g,{value:w,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}}),i.files.length>0&&(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Extra files: `,i.files.join(`, `),` (edit via the Files page)`]})]}),(0,b.jsxs)(o,{value:`test`,className:`flex flex-col gap-3 pt-2`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`test-prompt`,children:`Test prompt`}),(0,b.jsx)(g,{id:`test-prompt`,value:z,rows:3,placeholder:`Leave empty for a default prompt that exercises "${i.info.name}".`,onChange:e=>ve(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(m,{size:`sm`,onClick:Me,disabled:V,children:V?`Starting…`:`Run test with Codex`}),ye&&(0,b.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Test run started —`,` `,(0,b.jsx)(de,{to:`/runs`,className:`text-primary underline-offset-2 hover:underline`,children:`watch it in Runs`})]})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The run loads this skill explicitly, so Codex follows its instructions even for a generic prompt.`})]})]})]})]}),(0,b.jsx)(l,{open:_e,onOpenChange:P,children:(0,b.jsxs)(s,{children:[(0,b.jsxs)(ce,{children:[(0,b.jsx)(c,{children:`New skill`}),(0,b.jsxs)(se,{children:[`Creates `,(0,b.jsx)(`code`,{children:`.agents/skills/<name>/SKILL.md`}),` in the workspace.`]})]}),(0,b.jsxs)(`div`,{className:`grid gap-3`,children:[(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`new-skill-name`,children:`Name`}),(0,b.jsx)(h,{id:`new-skill-name`,value:F,placeholder:`my-skill (lowercase, dashes)`,onChange:e=>I(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,b.jsx)(v,{htmlFor:`new-skill-description`,children:`Description`}),(0,b.jsx)(h,{id:`new-skill-description`,value:L,placeholder:`What this skill does and when to use it`,onChange:e=>R(e.target.value)})]})]}),(0,b.jsxs)(oe,{children:[(0,b.jsx)(m,{variant:`outline`,onClick:()=>P(!1),children:`Cancel`}),(0,b.jsx)(m,{onClick:ke,disabled:F.trim().length===0||L.trim().length===0,children:`Create`})]})]})}),(0,b.jsx)(l,{open:be,onOpenChange:U,children:(0,b.jsxs)(s,{className:`flex max-h-[80vh] flex-col sm:max-w-2xl`,children:[(0,b.jsxs)(ce,{children:[(0,b.jsx)(c,{children:`Browse skills.sh`}),(0,b.jsxs)(se,{children:[`Search the`,` `,(0,b.jsx)(`a`,{href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,className:`text-primary underline-offset-2 hover:underline`,children:`skills.sh`}),` `,`registry and install into the workspace. Skills run with full agent permissions — review before use.`]})]}),(0,b.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),Ne()},children:[(0,b.jsx)(h,{autoFocus:!0,value:W,placeholder:`Search skills (e.g. react, deploy, postgres)…`,onChange:e=>xe(e.target.value)}),(0,b.jsxs)(m,{type:`submit`,disabled:K||W.trim().length===0,children:[K?(0,b.jsx)(x,{className:`size-4`}):(0,b.jsx)(ie,{className:`size-4`}),`Search`]})]}),J&&(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm whitespace-pre-wrap text-destructive`,children:J}),(0,b.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[Ce&&G.length===0&&!K&&(0,b.jsxs)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:[`No skills found for “`,W.trim(),`”.`]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-2`,children:G.map(e=>{let t=Ee.has(e.source);return(0,b.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border px-3 py-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.installs&&(0,b.jsx)(_,{variant:`outline`,className:`shrink-0`,children:e.installs})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,children:[e.repo,e.url&&(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center hover:text-foreground`,children:(0,b.jsx)(ee,{className:`size-3`})})]})]}),(0,b.jsx)(m,{size:`sm`,variant:t?`secondary`:`outline`,disabled:t||X!==null,onClick:()=>Pe(e.source),children:X===e.source?(0,b.jsx)(x,{className:`size-4`}):t?`Installed`:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(pe,{className:`size-3.5`}),` Install`]})})]},e.source)})})]})]})})]})}export{C as SkillsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-DaFgcYuk.js";export{e as createArchitectureServices};
|