@dmrlzz/davecode 0.3.0 → 0.4.0
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/README.md +5 -4
- package/bin/davecode.js +0 -0
- package/dist/{ChatApp-FO5SABXB.js → ChatApp-BO7QMBWD.js} +289 -137
- package/dist/ChatApp-BO7QMBWD.js.map +1 -0
- package/dist/{RunnerView-DLVR7C22.js → RunnerView-A7JSPUW5.js} +5 -5
- package/dist/account-UGNLJPQ4.js +23 -0
- package/dist/accounts-NM7IWP53.js +37 -0
- package/dist/{budget-RBHCEDPP.js → budget-INAW6FXD.js} +6 -6
- package/dist/chat-U4QJQ7M6.js +359 -0
- package/dist/chat-U4QJQ7M6.js.map +1 -0
- package/dist/{chunk-C7FDRA3U.js → chunk-3Q2KCXLN.js} +660 -139
- package/dist/chunk-3Q2KCXLN.js.map +1 -0
- package/dist/{chunk-BOLFK3BH.js → chunk-5LKOJBUL.js} +2 -2
- package/dist/{accounts-MTMGYKEP.js → chunk-CWBVNS3L.js} +24 -17
- package/dist/chunk-CWBVNS3L.js.map +1 -0
- package/dist/{chunk-PIIJ3RSI.js → chunk-DZ2FDABF.js} +1269 -1265
- package/dist/chunk-DZ2FDABF.js.map +1 -0
- package/dist/{chunk-OYEYNDOO.js → chunk-GE22VBCY.js} +3 -3
- package/dist/chunk-GHDOUII5.js +144 -0
- package/dist/chunk-GHDOUII5.js.map +1 -0
- package/dist/{chunk-MSLLH5XP.js → chunk-GZJ6JSO7.js} +4 -4
- package/dist/{chunk-VVCXGQMY.js → chunk-MC7RIPL7.js} +17 -8
- package/dist/chunk-MC7RIPL7.js.map +1 -0
- package/dist/{chunk-23KTE7IK.js → chunk-MOK5D3XJ.js} +2 -2
- package/dist/{chunk-OXRMGR72.js → chunk-PGPXE6LF.js} +2 -2
- package/dist/chunk-QA3O6RA2.js +81 -0
- package/dist/chunk-QA3O6RA2.js.map +1 -0
- package/dist/chunk-ROIUTNQV.js +20 -0
- package/dist/chunk-ROIUTNQV.js.map +1 -0
- package/dist/{chunk-IVZHKUCD.js → chunk-Z6NQDJEN.js} +3 -3
- package/dist/{config-FRMY5OHG.js → config-YEAPBMBX.js} +5 -5
- package/dist/dashboard/assets/Accounts-CeVyX4a3.js +1 -0
- package/dist/dashboard/assets/Badge-CGY6DgGx.js +55 -0
- package/dist/dashboard/assets/{Callout-B9g_wPDi.js → Callout-DauCk_cW.js} +1 -1
- package/dist/dashboard/assets/{Field-BfabPEcY.js → Field-OXMnT9Tb.js} +1 -1
- package/dist/dashboard/assets/{Goals-BsV-6m94.js → Goals-DH-KDh8M.js} +1 -1
- package/dist/dashboard/assets/{Library-CEA9P1m-.js → Library-C15szLjZ.js} +1 -1
- package/dist/dashboard/assets/{Markdown-ClRsddnB.js → Markdown-Xhao3sgL.js} +7 -7
- package/dist/dashboard/assets/Panel-Du40pM7n.js +1 -0
- package/dist/dashboard/assets/{RoutesPage-Dh-BJ3ir.js → RoutesPage-Cj1OelGO.js} +1 -1
- package/dist/dashboard/assets/{Runner-C_e9l5l2.js → Runner-BK1-ZF7h.js} +1 -1
- package/dist/dashboard/assets/{Settings-C6Yc1Gjg.js → Settings-C1nzQQhe.js} +1 -1
- package/dist/dashboard/assets/{Switch-CUpOJjUT.js → Switch-bwtIJ00H.js} +1 -1
- package/dist/dashboard/assets/Tasks-x4s8IiPG.js +2 -0
- package/dist/dashboard/assets/{Traffic-CE6wZSMr.js → Traffic-CV7TaTid.js} +1 -1
- package/dist/dashboard/assets/{Workspace-CxFxvkA6.js → Workspace-DAL-MBc0.js} +1 -1
- package/dist/dashboard/assets/arrow-up-goM9r-I9.js +1 -0
- package/dist/dashboard/assets/{forms-D6UIYgC5.js → forms-DtpfI65-.js} +1 -1
- package/dist/dashboard/assets/index-BCi-Vuvh.js +104 -0
- package/dist/dashboard/assets/{index-1iH716Xy.css → index-CcJFhc98.css} +1 -1
- package/dist/dashboard/assets/{task-errors-CE4oEr8H.js → task-errors-B2pgjUGN.js} +1 -1
- package/dist/dashboard/assets/{trash-CWqeZ7eg.js → trash-BVojETtF.js} +1 -1
- package/dist/dashboard/favicon.svg +1 -7
- package/dist/dashboard/index.html +4 -4
- package/dist/{dist-ZPXEVBEC.js → dist-RRQGUBL3.js} +24 -2
- package/dist/dist-RRQGUBL3.js.map +1 -0
- package/dist/{doctor-7RUD4D3A.js → doctor-MQYK44S2.js} +5 -5
- package/dist/{goal-JFRNPBSD.js → goal-6NUX4AIT.js} +5 -5
- package/dist/index.js +48 -30
- package/dist/index.js.map +1 -1
- package/dist/{init-NFYNO3A3.js → init-AXYIWAB3.js} +6 -6
- package/dist/{prompts-L37J72YW.js → prompts-TZ7UC42M.js} +9 -5
- package/dist/prompts-TZ7UC42M.js.map +1 -0
- package/dist/{run-ARUPXFFB.js → run-QRTLHFB3.js} +10 -10
- package/dist/runtime.js +18 -0
- package/dist/runtime.js.map +1 -0
- package/dist/{start-CFPOVIAR.js → start-O5I5TSO2.js} +5 -5
- package/dist/{status-E4EACVE2.js → status-LEA3RVUX.js} +6 -6
- package/dist/status-LEA3RVUX.js.map +1 -0
- package/dist/{tasks-ZIK6BVEX.js → tasks-XOTVICVZ.js} +6 -6
- package/package.json +21 -15
- package/dist/ChatApp-FO5SABXB.js.map +0 -1
- package/dist/accounts-MTMGYKEP.js.map +0 -1
- package/dist/chat-ZDXX3N6X.js +0 -95
- package/dist/chat-ZDXX3N6X.js.map +0 -1
- package/dist/chunk-C7FDRA3U.js.map +0 -1
- package/dist/chunk-DYQ56FBT.js +0 -47
- package/dist/chunk-DYQ56FBT.js.map +0 -1
- package/dist/chunk-PIIJ3RSI.js.map +0 -1
- package/dist/chunk-VVCXGQMY.js.map +0 -1
- package/dist/dashboard/assets/Accounts-BR3ZfVk4.js +0 -1
- package/dist/dashboard/assets/Badge-B-qzNRrZ.js +0 -55
- package/dist/dashboard/assets/Panel-B9tSgX6l.js +0 -1
- package/dist/dashboard/assets/Tasks-CTku0rR3.js +0 -2
- package/dist/dashboard/assets/arrow-up-DL3CuFOO.js +0 -1
- package/dist/dashboard/assets/index-BMWr9EKo.js +0 -104
- package/dist/prompts-L37J72YW.js.map +0 -1
- /package/dist/{RunnerView-DLVR7C22.js.map → RunnerView-A7JSPUW5.js.map} +0 -0
- /package/dist/{dist-ZPXEVBEC.js.map → account-UGNLJPQ4.js.map} +0 -0
- /package/dist/{status-E4EACVE2.js.map → accounts-NM7IWP53.js.map} +0 -0
- /package/dist/{budget-RBHCEDPP.js.map → budget-INAW6FXD.js.map} +0 -0
- /package/dist/{chunk-BOLFK3BH.js.map → chunk-5LKOJBUL.js.map} +0 -0
- /package/dist/{chunk-OYEYNDOO.js.map → chunk-GE22VBCY.js.map} +0 -0
- /package/dist/{chunk-MSLLH5XP.js.map → chunk-GZJ6JSO7.js.map} +0 -0
- /package/dist/{chunk-23KTE7IK.js.map → chunk-MOK5D3XJ.js.map} +0 -0
- /package/dist/{chunk-OXRMGR72.js.map → chunk-PGPXE6LF.js.map} +0 -0
- /package/dist/{chunk-IVZHKUCD.js.map → chunk-Z6NQDJEN.js.map} +0 -0
- /package/dist/{config-FRMY5OHG.js.map → config-YEAPBMBX.js.map} +0 -0
- /package/dist/{doctor-7RUD4D3A.js.map → doctor-MQYK44S2.js.map} +0 -0
- /package/dist/{goal-JFRNPBSD.js.map → goal-6NUX4AIT.js.map} +0 -0
- /package/dist/{init-NFYNO3A3.js.map → init-AXYIWAB3.js.map} +0 -0
- /package/dist/{run-ARUPXFFB.js.map → run-QRTLHFB3.js.map} +0 -0
- /package/dist/{start-CFPOVIAR.js.map → start-O5I5TSO2.js.map} +0 -0
- /package/dist/{tasks-ZIK6BVEX.js.map → tasks-XOTVICVZ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,n,o as r,r as i,s as a,t as o,u as s}from"./Panel-
|
|
1
|
+
import{c as e,i as t,n,o as r,r as i,s as a,t as o,u as s}from"./Panel-Du40pM7n.js";import{B as c,E as l,dt as u,ft as d,gt as f,o as p,t as m,vt as h,yt as g}from"./Badge-CGY6DgGx.js";import{i as _,n as v}from"./forms-DtpfI65-.js";import{t as y}from"./Callout-DauCk_cW.js";import{I as b,L as x,O as S,U as C,t as w,v as T,y as E}from"./index-BCi-Vuvh.js";import{n as D,t as O}from"./Field-OXMnT9Tb.js";var k={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};k.node;var A=r(k),j={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};j.node;var M=r(j),N={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};N.node;var P=r(N),F=s(e(),1),I=a(),L=`https://github.com/DMRLZZ/DaveCode`;function R(){let e=g(),r=l(),{connection:a}=c(),[s,k]=(0,F.useState)(e.gatewayUrl),[j,N]=(0,F.useState)(e.token),[R,z]=(0,F.useState)(null),[B,V]=(0,F.useState)(!1),[H,U]=(0,F.useState)(null),W=()=>{let e=s.trim();return e&&!_(e)?`Enter an http(s) origin such as http://127.0.0.1:4040, or leave empty.`:null},G=e=>{e.preventDefault();let t=W();z(t),!t&&(h({gatewayUrl:s.trim().replace(/\/+$/,``),token:j.trim()}),E({tone:`ok`,title:`Connection settings saved`,description:`Stored in this browser only.`}))},K=async()=>{let e=W();if(z(e),!e){V(!0),U(null);try{let e=await u({baseUrl:s.trim(),token:j.trim()}).health();U({ok:!0,text:`Connected: DaveCode ${e.version}, ${e.status}, up ${p(e.uptimeSec)}.`})}catch(e){U({ok:!1,text:d(e)})}finally{V(!1)}}},q=f();return(0,I.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,I.jsx)(o,{title:`Settings`,description:`Preferences are stored in this browser's localStorage.`}),(0,I.jsxs)(n,{"aria-labelledby":`conn-title`,children:[(0,I.jsx)(i,{id:`conn-title`,title:`Gateway connection`}),(0,I.jsxs)(`form`,{onSubmit:G,noValidate:!0,className:`flex flex-col gap-4 p-4`,children:[(0,I.jsx)(O,{label:`Gateway URL`,error:R,hint:`Leave empty when the dashboard is served by the gateway or the Vite dev proxy (same origin).`,children:({id:e,describedBy:t,invalid:n})=>(0,I.jsx)(D,{id:e,type:`url`,value:s,placeholder:`same origin`,onChange:e=>k(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`font-mono`})}),(0,I.jsx)(O,{label:`Bearer token`,hint:`Needed when server.authToken is set. Sent as Authorization: Bearer, and as ?token= for the event stream.`,children:({id:e,describedBy:t})=>(0,I.jsx)(v,{id:e,value:j,onChange:N,placeholder:`not set`,describedBy:t})}),H&&(0,I.jsx)(y,{tone:H.ok?`info`:`err`,title:H.ok?`Gateway reachable`:`Connection failed`,children:H.text}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(t,{type:`submit`,variant:`primary`,children:`Save`}),(0,I.jsx)(t,{icon:P,onClick:K,loading:B,children:`Test connection`}),a.unauthorized&&(0,I.jsx)(m,{tone:`err`,children:`gateway returned 401`})]})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`data-title`,children:[(0,I.jsx)(i,{id:`data-title`,title:`Data source`}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,I.jsx)(w,{label:`Data source`,value:e.dataMode,onChange:e=>h({dataMode:e}),options:[{value:`auto`,label:`Auto`},{value:`live`,label:`Live only`},{value:`mock`,label:`Mock data`}]}),(0,I.jsxs)(`p`,{className:`text-[12px] leading-5 text-muted`,children:[(0,I.jsx)(`strong`,{className:`font-medium text-fg-2`,children:`Auto`}),` uses the gateway and falls back to simulated data when it is unreachable, re-checking every 15 s.`,` `,(0,I.jsx)(`strong`,{className:`font-medium text-fg-2`,children:`Mock data`}),` always simulates a busy gateway, handy for demos and screenshots.`]}),q&&(0,I.jsxs)(y,{tone:`info`,children:[`Mock mode is currently forced by `,(0,I.jsx)(`code`,{className:`font-mono`,children:`?mock=1`}),` or`,` `,(0,I.jsx)(`code`,{className:`font-mono`,children:`VITE_DAVECODE_MOCK=1`}),`; this setting applies once that is removed.`]})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`look-title`,children:[(0,I.jsx)(i,{id:`look-title`,title:`Appearance`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,I.jsx)(w,{label:`Theme`,value:e.theme,onChange:e=>h({theme:e}),options:[{value:`dark`,label:`Dark`,icon:b},{value:`light`,label:`Light`,icon:S},{value:`system`,label:`System`,icon:M}]}),(0,I.jsx)(t,{variant:`ghost`,icon:x,onClick:T.openHelp,children:`Keyboard shortcuts`})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`about-title`,children:[(0,I.jsx)(i,{id:`about-title`,title:`About`}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 text-[13px]`,children:[(0,I.jsxs)(`dl`,{className:`grid grid-cols-[120px_1fr] gap-y-1.5`,children:[(0,I.jsx)(`dt`,{className:`text-muted`,children:`Gateway`}),(0,I.jsx)(`dd`,{className:`font-mono text-fg-2`,children:r.data?`v${r.data.version} · ${r.data.status}`:a.mode===`probing`?`checking…`:`unreachable`}),(0,I.jsx)(`dt`,{className:`text-muted`,children:`Data`}),(0,I.jsx)(`dd`,{className:`text-fg-2`,children:a.mode===`mock`?`Simulated (mock mode)`:`Live gateway`}),(0,I.jsx)(`dt`,{className:`text-muted`,children:`Experimental`}),(0,I.jsxs)(`dd`,{className:`flex flex-wrap gap-1.5`,children:[(0,I.jsxs)(m,{tone:r.data?.experimental.geminiWeb?`warn`:`neutral`,mono:!0,children:[`geminiWeb `,r.data?.experimental.geminiWeb?`on`:`off`]}),(0,I.jsxs)(m,{tone:r.data?.experimental.multiAccountRotation?`warn`:`neutral`,mono:!0,children:[`multiAccountRotation `,r.data?.experimental.multiAccountRotation?`on`:`off`]})]})]}),(0,I.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:[[`README`,`${L}#readme`],[`Architecture`,`${L}/blob/main/docs/ARCHITECTURE.md`],[`HTTP API`,`${L}/blob/main/docs/API.md`]].map(([e,t])=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-line px-2.5 text-[12px] text-fg-2 transition-colors duration-150 hover:border-line-strong hover:text-fg`,children:[(0,I.jsx)(C,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),e,(0,I.jsx)(A,{"aria-hidden":!0,className:`size-3 text-muted`,strokeWidth:1.75}),(0,I.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})},e))})]})]})]})}export{R as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,o as t,s as n}from"./Panel-
|
|
1
|
+
import{a as e,o as t,s as n}from"./Panel-Du40pM7n.js";var r={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};r.node;var i=t(r),a=n();function o({checked:t,onChange:n,label:r,disabled:i,className:o}){return(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":r,disabled:i,onClick:e=>{e.stopPropagation(),n(!t)},className:e(`relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full border transition-colors duration-150 ease-snappy`,t?`border-accent bg-accent`:`border-line-strong bg-track`,`disabled:cursor-not-allowed disabled:opacity-45`,o),children:(0,a.jsx)(`span`,{"aria-hidden":!0,className:e(`inline-block size-3 rounded-full shadow-sm transition-transform duration-150 ease-snappy`,t?`translate-x-[15px] bg-accent-fg`:`translate-x-[2px] bg-fg-2`)})})}export{i as n,o as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{G as l,H as u,J as d,K as f,L as p,N as m,S as h,U as g,W as _,X as v,Y as y,Z as b,b as x,d as S,ft as C,k as w,m as T,q as E,t as D}from"./Badge-CGY6DgGx.js";import{n as O,t as k}from"./Markdown-Xhao3sgL.js";import{t as A}from"./Callout-DauCk_cW.js";import{n as ee,t as j}from"./task-errors-B2pgjUGN.js";import{t as M}from"./trash-BVojETtF.js";import{A as te,B as ne,C as re,N,P as ie,S as P,a as ae,c as oe,g as F,h as I,i as se,m as L,o as ce,s as le,t as R,u as ue,w as de,y as z,z as B}from"./index-BCi-Vuvh.js";import{i as V,n as H,t as U}from"./Field-OXMnT9Tb.js";var W={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};W.node;var fe=i(W),G={name:`kanban`,size:24,node:[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]};G.node;var pe=i(G),K={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};K.node;var me=i(K),q={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};q.node;var he=i(q),J=c(t(),1),ge={nodeWidth:220,nodeHeight:60,gapX:64,gapY:16,padding:16,sweeps:4,direction:`LR`};function Y(e,t={}){let n={...ge,...t},r=new Map(e.map(e=>[e.id,e])),i=[],a=[],o=new Map;for(let t of e){let e=[];for(let n of t.dependsOn)r.has(n)?e.push(n):i.push({task:t.id,dependsOn:n});o.set(t.id,e)}let s=new Map,c=new Set,l=e=>{let t=s.get(e);if(t!==void 0)return t;c.add(e);let n=0,r=[];for(let t of o.get(e)??[])c.has(t)?a.push({from:t,to:e}):(r.push(t),n=Math.max(n,l(t)+1));return o.set(e,r),c.delete(e),s.set(e,n),n};for(let t of e)l(t.id);let u=e.length?Math.max(...s.values())+1:0,d=Array.from({length:u},()=>[]),f=[...e].sort((e,t)=>(t.priority??0)-(e.priority??0)||e.id.localeCompare(t.id));for(let e of f)d[s.get(e.id)??0]?.push(e.id);let p=new Map;for(let[e,t]of o)for(let n of t)p.set(n,[...p.get(n)??[],e]);let m=new Map,h=()=>{for(let e of d)e.forEach((e,t)=>{m.set(e,t)})};h();let g=(e,t)=>{let n=(t??[]).map(e=>m.get(e)).filter(e=>e!==void 0);return n.length?n.reduce((e,t)=>e+t,0)/n.length:m.get(e)??0};for(let e=0;e<n.sweeps;e++){for(let e=1;e<d.length;e++){let t=d[e];t&&(t.sort((e,t)=>g(e,o.get(e))-g(t,o.get(t))),h())}for(let e=d.length-2;e>=0;e--){let t=d[e];t&&(t.sort((e,t)=>g(e,p.get(e))-g(t,p.get(t))),h())}}let _=n.direction===`TB`,v=Math.max(0,...d.map(e=>e.length)),y=_?n.nodeWidth:n.nodeHeight,b=_?n.gapX:n.gapY,x=_?n.nodeHeight:n.nodeWidth,S=_?n.gapY:n.gapX,C=v*y+Math.max(0,v-1)*b,w=u*x+Math.max(0,u-1)*S,T=n.padding*2+(_?C:w),E=n.padding*2+(_?w:C),D=[],O=new Map;d.forEach((e,t)=>{let r=e.length*y+Math.max(0,e.length-1)*b,i=n.padding+(C-r)/2;e.forEach((e,r)=>{let a=n.padding+t*(x+S),o=i+r*(y+b),s=_?o:a,c=_?a:o;O.set(e,{x:s,y:c}),D.push({id:e,layer:t,order:r,x:s,y:c})})});let k=[];for(let t of e){let e=O.get(t.id);if(e)for(let r of o.get(t.id)??[]){let i=O.get(r);if(!i)continue;let a;if(_){let t=i.x+n.nodeWidth/2,r=i.y+n.nodeHeight,o=e.x+n.nodeWidth/2,s=e.y,c=Math.max(20,(s-r)/2);a=`M${t},${r} C${t},${r+c} ${o},${s-c} ${o},${s}`}else{let t=i.x+n.nodeWidth,r=i.y+n.nodeHeight/2,o=e.x,s=e.y+n.nodeHeight/2,c=Math.max(24,(o-t)/2);a=`M${t},${r} C${t+c},${r} ${o-c},${s} ${o},${s}`}k.push({from:r,to:t.id,path:a})}}return{nodes:D,edges:k,width:T,height:E,layers:u,missing:i,cycleEdges:a}}function _e(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=new Set,i=e=>{let a=n.get(e);if(a)return a;let o=t.get(e);if(!o)return`waiting`;let s={SUCCESS:`done`,IN_PROGRESS:`running`,FAILED:`failed`,PENDING:null}[o.status];if(!s){if(r.has(e))return`waiting`;r.add(e);let n=o.dependsOn.filter(e=>t.has(e)).map(i);r.delete(e),s=n.some(e=>e===`failed`||e===`blocked`)?`blocked`:n.every(e=>e===`done`)?`ready`:`waiting`}return n.set(e,s),s};for(let t of e)i(t.id);return n}function ve(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map;for(let t of e)for(let e of t.dependsOn)r.set(e,[...r.get(e)??[],t.id]);let i=(e,t)=>{let n=new Set,r=[...t(e)];for(;r.length;){let e=r.pop();e===void 0||n.has(e)||(n.add(e),r.push(...t(e)))}return n};return{up:i(t,e=>n.get(e)?.dependsOn??[]),down:i(t,e=>r.get(e)??[])}}var X=o();function ye({task:e,tasks:t,readiness:r,onSelect:i,onClose:a,onEdit:o}){let s=p(),c=h(),l=w(),[u,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),g=(t,n)=>s.mutate({id:e.id,patch:{status:t}},{onSuccess:()=>z({tone:`ok`,title:n,description:e.id}),onError:e=>z({tone:`err`,title:`Could not ${n.toLowerCase()}`,description:j(e)})}),_=()=>l.mutate(e.id,{onSuccess:()=>z({tone:`info`,title:`Runner started`,description:e.id}),onError:e=>z({tone:`err`,title:`Could not start the runner`,description:j(e)})}),v=()=>c.mutate(e.id,{onSuccess:()=>{z({tone:`ok`,title:`Task deleted`,description:e.id}),d(!1),a()},onError:e=>m(j(e))}),b=new Map(t.map(e=>[e.id,e])),x=t.filter(t=>t.dependsOn.includes(e.id)),C=e.status===`SUCCESS`;return(0,X.jsxs)(`article`,{"aria-labelledby":`task-title`,className:`flex flex-col gap-4 p-4`,children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`p`,{className:`flex items-center gap-1 font-mono text-2xs text-muted`,children:[e.id,(0,X.jsx)(ue,{value:e.id,label:`Copy task id`,className:`size-5`})]}),(0,X.jsx)(`h3`,{id:`task-title`,className:`mt-0.5 text-[15px] leading-5 font-semibold tracking-tight text-fg`,children:e.title})]}),(0,X.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Close task details`,className:`-mr-1 inline-flex size-7 items-center justify-center rounded-md text-muted hover:bg-hover hover:text-fg`,children:(0,X.jsx)(de,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.75})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(I,{status:e.status}),r===`ready`&&(0,X.jsx)(D,{tone:`ok`,children:`ready to run`}),r===`blocked`&&(0,X.jsx)(D,{tone:`err`,children:`blocked by a failed dependency`}),e.priority!==void 0&&(0,X.jsxs)(D,{mono:!0,children:[`priority `,e.priority]}),e.attempts!==void 0&&(0,X.jsxs)(D,{mono:!0,children:[`attempt `,e.attempts]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r===`ready`&&(0,X.jsx)(n,{size:`sm`,variant:`primary`,icon:ie,loading:l.isPending,onClick:_,children:`Run now`}),y(e.status).map(e=>(0,X.jsx)(n,{size:`sm`,variant:e.variant,disabled:s.isPending,onClick:()=>g(e.to,e.label),children:e.label},e.to)),(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,X.jsx)(n,{size:`sm`,variant:`ghost`,icon:ee,onClick:o,children:`Edit`}),(0,X.jsx)(n,{size:`sm`,variant:`ghost`,iconOnly:!0,icon:M,"aria-label":`Delete task ${e.id}`,onClick:()=>{m(null),d(!0)},className:`text-err hover:bg-err-soft hover:text-err`})]})]}),e.branch&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5 font-mono text-[12px] text-fg-2`,children:[(0,X.jsx)(B,{"aria-hidden":!0,className:`size-3.5 text-muted`,strokeWidth:1.75}),e.branch]}),e.description&&(0,X.jsx)(`p`,{className:`text-[13px] leading-5 text-fg-2`,children:e.description}),e.acceptance&&e.acceptance.length>0&&(0,X.jsxs)(`section`,{"aria-labelledby":`acc-title`,children:[(0,X.jsx)(`h4`,{id:`acc-title`,className:`eyebrow mb-1.5`,children:`Acceptance criteria`}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.acceptance.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 text-[13px] leading-5 text-fg-2`,children:[C?(0,X.jsx)(ne,{"aria-label":`met`,className:`mt-0.5 size-3.5 shrink-0 text-ok`,strokeWidth:1.75}):(0,X.jsx)(fe,{"aria-label":`not verified yet`,className:`mt-0.5 size-3.5 shrink-0 text-faint`,strokeWidth:1.75}),e]},e))})]}),e.notes&&(0,X.jsxs)(`section`,{"aria-labelledby":`notes-title`,children:[(0,X.jsx)(`h4`,{id:`notes-title`,className:`eyebrow mb-1.5`,children:`Notes`}),(0,X.jsx)(`p`,{className:`rounded-md border border-line bg-raised p-2.5 text-[12px] leading-5 text-fg-2`,children:e.notes})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`deps-title`,className:`grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{id:`deps-title`,className:`eyebrow mb-1.5`,children:`Depends on`}),(0,X.jsx)(Z,{ids:e.dependsOn,byId:b,onSelect:i})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`eyebrow mb-1.5`,children:`Unblocks`}),(0,X.jsx)(Z,{ids:x.map(e=>e.id),byId:b,onSelect:i})]})]}),e.updatedAt&&(0,X.jsxs)(`p`,{className:`text-2xs text-muted`,children:[`Updated `,S(Date.parse(e.updatedAt))]}),(0,X.jsxs)(le,{open:u,onClose:()=>d(!1),title:`Delete ${e.id}?`,description:x.length>0?`Other tasks depend on this one, so the gateway will refuse until those dependencies are removed.`:`The task is removed from TASK_GRAPH.json. Its branch and any merged work stay in git.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(n,{variant:`ghost`,onClick:()=>d(!1),children:`Keep task`}),(0,X.jsx)(n,{variant:`danger`,icon:M,loading:c.isPending,onClick:v,children:`Delete task`})]}),children:[(0,X.jsx)(`p`,{className:`truncate text-[13px] text-fg-2`,children:e.title}),x.length>0&&(0,X.jsxs)(`p`,{className:`mt-2 font-mono text-[12px] text-muted`,children:[`Needed by `,x.map(e=>e.id).join(`, `)]}),f&&(0,X.jsx)(A,{tone:`err`,title:`Could not delete the task`,className:`mt-3`,children:f})]})]})}function Z({ids:e,byId:t,onSelect:n}){return e.length===0?(0,X.jsx)(`p`,{className:`text-[12px] text-faint`,children:`None`}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map(e=>{let r=t.get(e);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex w-full min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left font-mono text-[12px] text-fg-2 hover:bg-hover hover:text-fg`,children:[r?(0,X.jsx)(F,{status:r.status}):(0,X.jsx)(`span`,{className:`text-err`,children:`?`}),(0,X.jsx)(`span`,{className:`truncate`,children:e})]})},e)})})}var Q=204,$=56,be={SUCCESS:`stroke-ok/50`,IN_PROGRESS:`stroke-info/70`,FAILED:`stroke-err/70`,PENDING:`stroke-line-strong`},xe={SUCCESS:`border-line-strong`,IN_PROGRESS:`border-info/50 shadow-[0_0_0_3px_var(--dc-info-soft)]`,FAILED:`border-err/50`,PENDING:`border-line-strong border-dashed`};function Se({tasks:t,ready:n,selectedId:r,onSelect:i}){let a=(0,J.useMemo)(()=>Y(t,{nodeWidth:Q,nodeHeight:$,gapX:14,gapY:40,padding:20,direction:`TB`}),[t]),[o,s]=(0,J.useState)(null),c=o??r,l=(0,J.useMemo)(()=>c?ve(t,c):null,[t,c]),u=(0,J.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),d=e=>!l||e===c||l.up.has(e)||l.down.has(e),f=(e,t)=>!l||(e===c||l.up.has(e))&&(t===c||l.up.has(t))||(t===c||l.down.has(t))&&(e===c||l.down.has(e));return(0,X.jsx)(`div`,{className:`relative overflow-x-auto`,children:(0,X.jsxs)(`div`,{className:`relative mx-auto`,style:{width:a.width,height:a.height},children:[(0,X.jsxs)(`svg`,{width:a.width,height:a.height,className:`pointer-events-none absolute inset-0`,"aria-hidden":!0,children:[(0,X.jsx)(`defs`,{children:(0,X.jsx)(`marker`,{id:`dag-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,X.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,className:`fill-faint`})})}),a.edges.map(t=>{let n=u.get(t.from),r=f(t.from,t.to);return(0,X.jsx)(`path`,{d:t.path,fill:`none`,strokeWidth:r&&l?1.75:1.25,markerEnd:`url(#dag-arrow)`,className:e(`transition-opacity duration-200`,n?be[n.status]:`stroke-line-strong`,!r&&`opacity-20`)},`${t.from}->${t.to}`)})]}),a.nodes.map(t=>{let a=u.get(t.id);if(!a)return null;let o=n.get(a.id),c=a.id===r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(a.id),onPointerEnter:()=>s(a.id),onPointerLeave:()=>s(null),onFocus:()=>s(a.id),onBlur:()=>s(null),"aria-pressed":c,"aria-label":`${a.id}: ${a.title}. ${a.status.toLowerCase().replace(`_`,` `)}${o===`ready`?`, ready to run`:o===`blocked`?`, blocked by a failed dependency`:``}`,className:e(`absolute flex flex-col justify-center gap-1 rounded-md border bg-panel px-2.5 text-left transition-[opacity,border-color,box-shadow,transform] duration-200 ease-snappy`,`hover:-translate-y-px hover:border-fg-2/40`,xe[a.status],c&&`border-accent shadow-[0_0_0_3px_var(--dc-accent-soft)]`,!d(a.id)&&`opacity-35`),style:{left:t.x,top:t.y,width:Q,height:$},children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(F,{status:a.status}),(0,X.jsx)(`span`,{className:`truncate font-mono text-2xs text-muted`,children:a.id}),o===`ready`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-ok/30 px-1 text-[10px] leading-4 text-ok`,children:`ready`}),o===`blocked`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-err/30 px-1 text-[10px] leading-4 text-err`,children:`blocked`}),a.status===`IN_PROGRESS`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-info/30 px-1 text-[10px] leading-4 text-info`,children:`running`})]}),(0,X.jsx)(`span`,{className:`truncate text-[12px] leading-4 text-fg`,children:a.title})]},t.id)})]})})}function Ce({open:e,task:t,tasks:n,onClose:r}){let i=t!==void 0;return(0,X.jsx)(oe,{open:e,onClose:r,title:i?`Edit task`:`New task`,description:i?(0,X.jsx)(`span`,{className:`font-mono`,children:t.id}):`The task starts as pending and is picked up in dependency order.`,width:`w-[min(560px,100vw)]`,children:e&&(0,X.jsx)(we,{task:t,tasks:n,onDone:r},t?.id??`new`)})}function we({task:e,tasks:t,onDone:r}){let i=x(),a=p(),[o,s]=(0,J.useState)(()=>e?_(e):l()),[c,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)({}),[y,S]=(0,J.useState)(null),C=i.isPending||a.isPending,w=(e,t)=>s(n=>({...n,[e]:t})),T=n=>s(r=>({...r,title:n,...!e&&!c?{id:v(d(n),t)}:{}}));return(0,X.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),S(null);let s=b(o,t,e?.id);if(g(s),!(Object.keys(s).length>0))try{if(e){let t=E(e,o);f(t)||await a.mutateAsync({id:e.id,patch:t}),z({tone:`ok`,title:`Task updated`,description:e.id})}else{let e=await i.mutateAsync(u(o));z({tone:`ok`,title:`Task created`,description:e.id})}r()}catch(e){S(j(e))}},noValidate:!0,className:`flex flex-col gap-5`,children:[(0,X.jsx)(U,{label:`Title`,required:!0,error:h.title,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,autoFocus:!0,value:o.title,onChange:e=>T(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,placeholder:`Add the /health endpoint`})}),!e&&(0,X.jsx)(U,{label:`Id`,required:!0,error:h.id,hint:`Lowercase kebab-case. Used for the branch name and in dependencies; it cannot change later.`,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,value:o.id,onChange:e=>{m(!0),w(`id`,e.target.value)},"aria-describedby":t,"aria-invalid":n||void 0,spellCheck:!1,autoCapitalize:`off`,className:`font-mono`})}),(0,X.jsx)(U,{label:`Description`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.description,onChange:e=>w(`description`,e.target.value),"aria-describedby":t,placeholder:`What needs to be done and why.`})}),(0,X.jsx)(U,{label:`Acceptance criteria`,hint:`One per line. The validator and judge check the result against these.`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.acceptance,onChange:e=>w(`acceptance`,e.target.value),"aria-describedby":t,placeholder:`GET /health returns 200
|
|
2
|
+
The route has a test`})}),(0,X.jsx)(U,{label:`Priority`,error:h.priority,hint:`Higher runs first among unblocked tasks. Empty means 0.`,className:`max-w-40`,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,inputMode:`decimal`,value:o.priority,onChange:e=>w(`priority`,e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})}),(0,X.jsx)(Te,{tasks:t,selfId:e?.id,value:o.dependsOn,onChange:e=>w(`dependsOn`,e),error:h.dependsOn}),e&&(0,X.jsx)(U,{label:`Notes`,hint:`Written by the runner after each attempt; edit to leave a hint.`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.notes,onChange:e=>w(`notes`,e.target.value),"aria-describedby":t})}),y&&(0,X.jsx)(A,{tone:`err`,title:e?`Could not save the task`:`Could not create the task`,children:y}),(0,X.jsxs)(`div`,{className:`sticky -bottom-4 -mx-5 -mb-4 flex items-center justify-end gap-2 border-t border-line bg-panel px-5 py-3`,children:[(0,X.jsx)(n,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,X.jsx)(n,{type:`submit`,variant:`primary`,loading:C,children:e?`Save changes`:`Create task`})]})]})}function Te({tasks:t,selfId:n,value:r,onChange:i,error:a}){let[o,s]=(0,J.useState)(``),c=(0,J.useMemo)(()=>g(t,n),[t,n]),l=new Set(t.map(e=>e.id)),u=t.length-c.length-+!!n,d=o.trim().toLowerCase(),f=c.filter(e=>!d||e.id.toLowerCase().includes(d)||e.title.toLowerCase().includes(d)),p=r.filter(e=>!l.has(e)),m=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,"aria-describedby":a?`deps-error`:void 0,children:[(0,X.jsxs)(`legend`,{className:`mb-1.5 flex w-full items-baseline gap-2 text-[12px] font-medium text-fg-2`,children:[`Depends on`,(0,X.jsx)(`span`,{className:`tnum font-normal text-muted`,children:r.length===0?`none`:`${r.length} selected`})]}),(0,X.jsxs)(`div`,{className:`rounded-md border border-line-strong bg-bg`,children:[(0,X.jsxs)(`div`,{className:`relative border-b border-line`,children:[(0,X.jsx)(te,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,X.jsx)(`input`,{type:`search`,"aria-label":`Filter tasks`,placeholder:`Filter tasks`,value:o,onChange:e=>s(e.target.value),className:`h-8 w-full bg-transparent pr-2.5 pl-8 text-[13px] text-fg placeholder:text-faint focus-visible:outline-none`})]}),(0,X.jsxs)(`ul`,{className:`max-h-48 overflow-y-auto p-1`,children:[p.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-[12px] hover:bg-hover`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>m(e,!1),className:`size-3.5 accent-accent`}),(0,X.jsx)(`span`,{className:`font-mono text-err`,children:e}),(0,X.jsx)(`span`,{className:`text-muted`,children:`unknown task, uncheck to remove`})]})},e)),f.length===0&&p.length===0&&(0,X.jsx)(`li`,{className:`px-2 py-3 text-center text-[12px] text-faint`,children:t.length===0?`No other tasks yet.`:`No tasks match.`}),f.map(t=>{let n=r.includes(t.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:e(`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-[12px] hover:bg-hover`,n&&`bg-hover/60`),children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>m(t.id,e.target.checked),className:`size-3.5 accent-accent`}),(0,X.jsx)(F,{status:t.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg`,children:t.title}),(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-muted`,children:t.id})]})},t.id)})]})]}),a?(0,X.jsx)(`p`,{id:`deps-error`,role:`alert`,className:`text-[12px] leading-4 text-err`,children:a}):(0,X.jsxs)(`p`,{className:`text-[12px] leading-4 text-muted`,children:[`This task waits until every selected task is done.`,n&&u>0&&` ${u} dependent task${u===1?``:`s`} hidden: choosing them would create a cycle.`]})]})}var Ee=[`IN_PROGRESS`,`PENDING`,`FAILED`,`SUCCESS`];function De(){let e=m(),t=T(),{params:i}=re(),o=[`graph`,`board`,`list`].includes(i.get(`view`)??``)?i.get(`view`):`graph`,c=i.get(`task`),l=i.get(`panel`),u=i.get(`new`)===`1`,d=i.get(`edit`),f=e.data?.graph.tasks??[],p=(0,J.useMemo)(()=>_e(f),[f]),h=f.find(e=>e.id===c),g=f.find(e=>e.id===d),_=l??(h?`task`:`state`),v=(0,J.useMemo)(()=>Y(f),[f]),y=(0,J.useMemo)(()=>{let e={PENDING:0,IN_PROGRESS:0,SUCCESS:0,FAILED:0};for(let t of f)e[t.status]+=1;return e},[f]),b=f.length?y.SUCCESS/f.length:0,x=e=>{P(`panel`,null),P(`task`,e)},S=e.data?.project;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(s,{title:`Tasks`,description:S?(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-fg-2`,children:S.name}),` `,(0,X.jsxs)(`span`,{className:`font-mono text-2xs text-faint`,children:[S.root,`/.davecode/TASK_GRAPH.json`]})]}):`The project task graph the autonomous runner works through.`,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(n,{variant:`primary`,icon:N,onClick:()=>P(`new`,`1`),children:`New task`}),(0,X.jsx)(R,{label:`Task view`,value:o,onChange:e=>P(`view`,e===`graph`?null:e),options:[{value:`graph`,label:`Graph`,icon:he},{value:`board`,label:`Board`,icon:pe},{value:`list`,label:`List`,icon:me}]})]})}),e.isError&&(0,X.jsx)(A,{tone:`err`,title:`Could not load the task graph`,children:C(e.error)}),f.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 text-[12px]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`h-1.5 w-40 overflow-hidden rounded-full bg-track`,role:`progressbar`,"aria-label":`Tasks done`,"aria-valuemin":0,"aria-valuemax":f.length,"aria-valuenow":y.SUCCESS,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-ok transition-[width] duration-500 ease-snappy`,style:{width:`${b*100}%`}})}),(0,X.jsxs)(`span`,{className:`tnum text-fg-2`,children:[y.SUCCESS,` of `,f.length,` done`]})]}),Ee.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,X.jsx)(F,{status:e}),L[e],` `,(0,X.jsx)(`span`,{className:`tnum text-fg-2`,children:y[e]})]},e)),v.missing.length>0&&(0,X.jsxs)(D,{tone:`warn`,children:[v.missing.length,` unknown dependencies`]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_380px]`,children:[(0,X.jsx)(r,{className:`min-h-[420px]`,children:e.isPending?(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(ae,{className:`h-[380px] w-full`})}):f.length===0?(0,X.jsx)(se,{icon:B,title:`No task graph yet`,description:`Describe the work as a DAG of tasks and the runner will pick them up in dependency order. You can also edit .davecode/TASK_GRAPH.json by hand.`,command:`davecode run`,action:(0,X.jsx)(n,{variant:`primary`,icon:N,onClick:()=>P(`new`,`1`),children:`New task`}),className:`py-20`}):o===`graph`?(0,X.jsx)(Se,{tasks:f,ready:p,selectedId:c,onSelect:x}):o===`board`?(0,X.jsx)(ke,{tasks:f,ready:p,selectedId:c,onSelect:x}):(0,X.jsx)(Ae,{tasks:f,ready:p,selectedId:c,onSelect:x})}),(0,X.jsxs)(r,{className:`xl:sticky xl:top-16 xl:max-h-[calc(100dvh-5rem)] xl:self-start`,children:[(0,X.jsx)(a,{title:(0,X.jsx)(R,{size:`sm`,label:`Side panel`,value:_,onChange:e=>P(`panel`,e),options:[...h?[{value:`task`,label:`Task`,icon:B}]:[],{value:`state`,label:`STATE.md`,icon:O},{value:`architecture`,label:`ARCHITECTURE.md`,icon:O}]})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:_===`task`&&h?(0,X.jsx)(ye,{task:h,tasks:f,readiness:p.get(h.id),onSelect:x,onEdit:()=>P(`edit`,h.id),onClose:()=>{P(`task`,null),P(`panel`,null)}}):t.isPending?(0,X.jsx)(ce,{rows:6}):t.isError?(0,X.jsx)(`p`,{className:`p-4 text-[12px] text-err`,children:C(t.error)}):(0,X.jsx)(k,{className:`p-4`,source:(_===`architecture`?t.data?.architecture:t.data?.state)||`_This file is empty._`})})]})]}),(0,X.jsx)(Ce,{open:u,tasks:f,onClose:()=>P(`new`,null)}),(0,X.jsx)(Ce,{open:!!g,task:g,tasks:f,onClose:()=>P(`edit`,null)})]})}function Oe({r:e}){return e===`ready`?(0,X.jsx)(D,{tone:`ok`,children:`ready`}):e===`blocked`?(0,X.jsx)(D,{tone:`err`,children:`blocked`}):null}function ke({tasks:t,ready:n,selectedId:r,onSelect:i}){return(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-px overflow-x-auto bg-line sm:grid-cols-2 lg:grid-cols-4`,children:Ee.map(a=>{let o=t.filter(e=>e.status===a).sort((e,t)=>(t.priority??0)-(e.priority??0));return(0,X.jsxs)(`section`,{"aria-label":L[a],className:`flex min-w-0 flex-col bg-panel`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 border-b border-line px-3 py-2 text-[12px] font-medium text-fg-2`,children:[(0,X.jsx)(F,{status:a}),L[a],(0,X.jsx)(`span`,{className:`tnum ml-auto text-muted`,children:o.length})]}),(0,X.jsxs)(`ul`,{className:`flex flex-col gap-2 p-2`,children:[o.length===0&&(0,X.jsx)(`li`,{className:`px-1 py-3 text-center text-[12px] text-faint`,children:`Empty`}),o.map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t.id),"aria-pressed":t.id===r,className:e(`flex w-full flex-col gap-1.5 rounded-md border bg-raised p-2.5 text-left transition-colors duration-150 hover:border-fg-2/30`,t.id===r?`border-accent`:`border-line`),children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`truncate font-mono text-2xs text-muted`,children:t.id}),(0,X.jsx)(`span`,{className:`ml-auto`,children:(0,X.jsx)(Oe,{r:n.get(t.id)})})]}),(0,X.jsx)(`span`,{className:`text-[12px] leading-4 text-fg`,children:t.title}),t.dependsOn.length>0&&(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10px] text-faint`,children:[`after `,t.dependsOn.join(`, `)]})]})},t.id))]})]},a)})})}function Ae({tasks:t,ready:n,selectedId:r,onSelect:i}){let a=(0,J.useMemo)(()=>new Map(Y(t).nodes.map(e=>[e.id,e.layer])),[t]),o=[...t].sort((e,t)=>(a.get(e.id)??0)-(a.get(t.id)??0)||(t.priority??0)-(e.priority??0));return(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-[640px] text-[12px]`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Tasks in dependency order`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2 font-medium`,children:`Task`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 text-right font-medium`,children:`Priority`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Depends on`})]})}),(0,X.jsx)(`tbody`,{children:o.map(t=>(0,X.jsxs)(`tr`,{className:e(`border-b border-line last:border-b-0`,t.id===r&&`bg-hover/60`),children:[(0,X.jsx)(`td`,{className:`max-w-0 px-3.5 py-2`,children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t.id),className:`block w-full min-w-0 text-left hover:underline`,children:[(0,X.jsx)(`span`,{className:`block truncate text-[13px] text-fg`,children:t.title}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-2xs text-muted`,children:t.id})]})}),(0,X.jsx)(`td`,{className:`px-2 py-2`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(I,{status:t.status}),(0,X.jsx)(Oe,{r:n.get(t.id)})]})}),(0,X.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:t.priority??`—`}),(0,X.jsx)(`td`,{className:`max-w-0 truncate px-2 py-2 font-mono text-2xs text-muted`,children:t.dependsOn.join(`, `)||`—`})]},t.id))})]})})}export{De as Tasks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,s as a,t as o,u as s}from"./Panel-B9tSgX6l.js";import{B as c,V as l,c as u,ct as d,f,i as p,l as m,lt as h,p as g,r as _,t as v,ut as y}from"./Badge-B-qzNRrZ.js";import{A as b,C as x,F as S,G as C,P as w,S as T,V as E,c as D,i as O,o as k,p as A,t as j,u as M,w as N}from"./index-BMWr9EKo.js";import{n as P,r as F}from"./Field-BfabPEcY.js";var I={name:`loader`,size:24,node:[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]};I.node;var L=i(I),R=s(t(),1),z=a();function B({chain:t,accounts:n,className:r}){let i=t.attempts.map(e=>{let t=n.get(e.accountId)?.label??e.accountId;return e.outcome===`failed`?`${t} failed (${y(e)})`:`${t} ${e.outcome}`}).join(`, then `);return(0,z.jsxs)(`div`,{className:e(`flex min-w-0 items-center gap-1`,r),title:i,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:i}),t.attempts.map((e,r)=>(0,z.jsxs)(R.Fragment,{children:[r>0&&(0,z.jsx)(V,{attempt:t.attempts[r-1]}),(0,z.jsx)(H,{attempt:e,account:n.get(e.accountId),compact:t.attempts.length>2&&r<t.attempts.length-1})]},r))]})}function V({attempt:e}){return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-1 text-faint`,children:[(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),e?.outcome===`failed`&&(0,z.jsx)(`span`,{className:`rounded border border-err/30 bg-err-soft px-1 font-mono text-[10px] leading-4 text-err`,children:y(e)}),(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),(0,z.jsx)(`span`,{className:`-ml-1.5 text-[10px] leading-none`,children:`▸`})]})}function H({attempt:t,account:n,compact:r}){let i=n?.label??t.accountId;return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:e(`inline-flex h-6 max-w-[180px] min-w-0 items-center gap-1.5 rounded border pr-1.5 pl-0.5 text-[12px]`,t.outcome===`failed`?`border-line text-muted`:`border-line-strong bg-raised text-fg`),children:[(0,z.jsx)(A,{provider:t.provider,size:`sm`,className:`size-[18px] border-0 bg-transparent`}),!r&&(0,z.jsx)(`span`,{className:e(`truncate`,t.outcome===`failed`&&`line-through decoration-faint`),children:i}),t.outcome===`success`&&(0,z.jsx)(E,{className:`size-3 shrink-0 text-ok`,strokeWidth:2.25}),t.outcome===`failed`&&(0,z.jsx)(N,{className:`size-3 shrink-0 text-err`,strokeWidth:2.25}),t.outcome===`pending`&&(0,z.jsx)(L,{className:`size-3 shrink-0 animate-spin text-info [animation-duration:1.6s]`,strokeWidth:2})]})}function U({chain:e}){return e.outcome===`pending`?(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`}):e.outcome===`failed`?(0,z.jsx)(v,{tone:`err`,dot:!0,children:`failed`}):e.failovers>0?(0,z.jsxs)(v,{tone:`warn`,dot:!0,children:[`ok · `,e.failovers,` failover`,e.failovers>1?`s`:``]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,children:`ok`})}function W({chain:e,accounts:t,onClose:n}){return(0,z.jsx)(D,{open:!!e,onClose:n,title:`Request`,description:e&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[e.requestId,(0,z.jsx)(M,{value:e.requestId,label:`Copy request id`})]}),width:`w-[min(520px,100vw)]`,children:e&&(0,z.jsx)(G,{chain:e,accounts:t})})}function G({chain:t,accounts:n}){let r=h(t),i=d(t),a=[[`Outcome`,(0,z.jsx)(U,{chain:t},`o`)],[`Model`,(0,z.jsx)(`span`,{className:`font-mono`,children:t.model||`—`},`m`)],[`Started`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:_(t.startedTs,!0)},`s`)],[`End-to-end`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:i===void 0?`—`:m(i)},`l`)],[`Tokens`,(0,z.jsxs)(`span`,{className:`tnum font-mono`,children:[u(r.prompt),` in · `,u(r.completion),` out`]},`t`)],[`Failovers`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:t.failovers},`f`)]];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,z.jsx)(`dl`,{className:`grid grid-cols-[110px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:a.map(([e,t])=>(0,z.jsxs)(`div`,{className:`contents`,children:[(0,z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`min-w-0 text-fg`,children:t})]},e))}),(0,z.jsxs)(`section`,{"aria-labelledby":`attempts-title`,children:[(0,z.jsx)(`h3`,{id:`attempts-title`,className:`mb-2 text-[12px] font-medium text-fg-2`,children:`Attempts`}),(0,z.jsx)(`ol`,{className:`relative flex flex-col gap-0`,children:t.attempts.map((r,i)=>{let a=n.get(r.accountId),o=r.startedTs-t.startedTs,s=i===t.attempts.length-1;return(0,z.jsxs)(`li`,{className:`relative flex gap-3 pb-4 last:pb-0`,children:[!s&&(0,z.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7 bottom-0 left-[11px] w-px bg-line-strong`}),(0,z.jsx)(`span`,{className:e(`z-10 mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-semibold`,r.outcome===`success`?`border-ok/40 bg-ok-soft text-ok`:r.outcome===`failed`?`border-err/40 bg-err-soft text-err`:`border-info/40 bg-info-soft text-info`),children:i+1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1 rounded-md border border-line bg-raised p-2.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(A,{provider:r.provider,size:`sm`}),(0,z.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:a?.label??r.accountId}),(0,z.jsx)(`span`,{className:`ml-auto`,children:r.outcome===`success`?(0,z.jsx)(v,{tone:`ok`,children:`served`}):r.outcome===`failed`?(0,z.jsxs)(v,{tone:`err`,mono:!0,children:[y(r),` `,r.errorKind]}):(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`})})]}),(0,z.jsxs)(`p`,{className:`tnum mt-1.5 font-mono text-2xs text-muted`,children:[r.accountId,` · +`,m(o),r.latencyMs!==void 0&&` · took ${m(r.latencyMs)}`,r.outcome===`success`&&` · ${u(r.promptTokens??0)} → ${u(r.completionTokens??0)} tok`]}),r.errorMessage&&(0,z.jsx)(`p`,{className:`mt-1.5 text-[12px] text-fg-2`,children:r.errorMessage})]})]},i)})})]}),(0,z.jsxs)(`details`,{className:`rounded-md border border-line`,children:[(0,z.jsx)(`summary`,{className:`px-3 py-2 text-[12px] font-medium text-fg-2 select-none hover:text-fg`,children:`Raw chain`}),(0,z.jsx)(`pre`,{className:`max-h-80 overflow-auto border-t border-line p-3 font-mono text-2xs leading-5 text-fg-2`,children:JSON.stringify(t,null,2)})]})]})}function K(e,t){switch(t){case`ok`:return e.outcome===`success`&&e.failovers===0;case`failover`:return e.failovers>0;case`failed`:return e.outcome===`failed`;case`pending`:return e.outcome===`pending`;default:return!0}}var q=250;function J(){let t=l(),{connection:i}=c(),a=g(),{params:s}=x(),[u,y]=(0,R.useState)(``),[E,D]=(0,R.useState)(`all`),[A,M]=(0,R.useState)(``),[N,I]=(0,R.useState)(null),L=(0,R.useMemo)(()=>new Map((a.data??[]).map(e=>[e.id,e])),[a.data]),V=N??t.chains,H=N?Math.max(0,t.chains.length-N.length):0,G=(0,R.useMemo)(()=>{let e={all:0,ok:0,failover:0,failed:0,pending:0};for(let t of V)e.all+=1,K(t,`ok`)&&(e.ok+=1),K(t,`failover`)&&(e.failover+=1),K(t,`failed`)&&(e.failed+=1),K(t,`pending`)&&(e.pending+=1);return e},[V]),J=u.trim().toLowerCase(),Y=V.filter(e=>K(e,E)&&(!A||e.attempts.some(e=>e.accountId===A))&&(!J||e.requestId.toLowerCase().includes(J)||e.model.toLowerCase().includes(J)||e.attempts.some(e=>e.accountId.toLowerCase().includes(J)||(L.get(e.accountId)?.label.toLowerCase().includes(J)??!1)))).slice(0,q),X=s.get(`req`),Z=X?t.chains.find(e=>e.requestId===X):void 0,Q=t.chains.length===0&&i.mode!==`live`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(o,{title:`Traffic`,description:`Every request through /v1, with failover hops shown inline.`,actions:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N?(0,z.jsxs)(v,{tone:`warn`,children:[`paused`,H>0&&` · ${H} new`]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,pulse:!0,children:`streaming`}),(0,z.jsx)(n,{icon:N?w:S,onClick:()=>I(N?null:t.chains),"aria-pressed":!!N,children:N?`Resume`:`Pause`})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`relative w-full sm:w-64`,children:[(0,z.jsx)(b,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,z.jsx)(P,{type:`search`,"aria-label":`Filter requests`,placeholder:`Model, request id or account`,value:u,onChange:e=>y(e.target.value),className:`pl-8`,"data-filter-input":!0})]}),(0,z.jsx)(j,{label:`Outcome`,value:E,onChange:D,options:[{value:`all`,label:`All`,count:G.all},{value:`ok`,label:`OK`,count:G.ok},{value:`failover`,label:`Failover`,count:G.failover},{value:`failed`,label:`Failed`,count:G.failed},{value:`pending`,label:`In flight`,count:G.pending}]}),(0,z.jsxs)(F,{"aria-label":`Filter by account`,value:A,onChange:e=>M(e.target.value),className:`w-auto min-w-44`,children:[(0,z.jsx)(`option`,{value:``,children:`All accounts`}),(a.data??[]).map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,z.jsx)(r,{children:Q?(0,z.jsx)(k,{rows:8}):Y.length===0?t.chains.length===0?(0,z.jsx)(O,{icon:C,title:`No requests yet`,description:`Point any OpenAI-compatible client at the gateway and use a davecode/<route> model.`,command:`curl http://127.0.0.1:4040/v1/chat/completions -H 'content-type: application/json' -d '{"model":"davecode/auto","messages":[{"role":"user","content":"hi"}]}'`}):(0,z.jsx)(O,{icon:b,title:`No matching requests`,description:`Try a different filter.`}):(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)(`table`,{className:`w-full min-w-[920px] text-[12px]`,children:[(0,z.jsx)(`caption`,{className:`sr-only`,children:`Recent requests, newest first`}),(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-3.5 py-2 font-medium`,children:`Time`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-2 py-2 font-medium`,children:`Request`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-40 px-2 py-2 font-medium`,children:`Model`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Accounts`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-20 px-2 py-2 text-right font-medium`,children:`Latency`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-28 px-2 py-2 text-right font-medium`,children:`Tokens in → out`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-36 px-3.5 py-2 text-right font-medium`,children:`Status`})]})}),(0,z.jsx)(`tbody`,{children:Y.map(t=>{let n=h(t),r=d(t);return(0,z.jsxs)(`tr`,{onClick:()=>T(`req`,t.requestId),className:e(`animate-row-in cursor-pointer border-b border-line transition-colors duration-150 last:border-b-0 hover:bg-hover/60`,X===t.requestId&&`bg-hover/60`),children:[(0,z.jsx)(`td`,{className:`tnum px-3.5 py-2 font-mono text-muted`,children:_(t.startedTs)}),(0,z.jsx)(`td`,{className:`px-2 py-2`,children:(0,z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(`req`,t.requestId)},className:`font-mono text-fg-2 hover:text-fg hover:underline focus-visible:underline`,"aria-label":`Open request ${t.requestId}`,children:f(t.requestId)})}),(0,z.jsx)(`td`,{className:`max-w-0 truncate px-2 py-2 font-mono text-fg`,children:t.model||`—`}),(0,z.jsx)(`td`,{className:`max-w-0 px-2 py-1.5`,children:(0,z.jsx)(B,{chain:t,accounts:L})}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:r===void 0?`…`:m(r)}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:n.prompt||n.completion?(0,z.jsxs)(z.Fragment,{children:[p(n.prompt),` `,(0,z.jsx)(`span`,{className:`text-faint`,children:`→`}),` `,p(n.completion)]}):(0,z.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,z.jsx)(`td`,{className:`px-3.5 py-2 text-right`,children:(0,z.jsx)(U,{chain:t})})]},t.requestId)})})]})})}),Y.length===q&&(0,z.jsxs)(`p`,{className:`text-center text-[12px] text-muted`,children:[`Showing the latest `,q,` requests.`]}),(0,z.jsx)(W,{chain:Z,accounts:L,onClose:()=>T(`req`,null)})]})}export{J as Traffic};
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,s as a,t as o,u as s}from"./Panel-Du40pM7n.js";import{B as c,V as l,c as u,ct as d,f,i as p,l as m,lt as h,p as g,r as _,t as v,ut as y}from"./Badge-CGY6DgGx.js";import{A as b,C as x,F as S,G as C,P as w,S as T,V as E,c as D,i as O,o as k,p as A,t as j,u as M,w as N}from"./index-BCi-Vuvh.js";import{n as P,r as F}from"./Field-OXMnT9Tb.js";var I={name:`loader`,size:24,node:[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]};I.node;var L=i(I),R=s(t(),1),z=a();function B({chain:t,accounts:n,className:r}){let i=t.attempts.map(e=>{let t=n.get(e.accountId)?.label??e.accountId;return e.outcome===`failed`?`${t} failed (${y(e)})`:`${t} ${e.outcome}`}).join(`, then `);return(0,z.jsxs)(`div`,{className:e(`flex min-w-0 items-center gap-1`,r),title:i,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:i}),t.attempts.map((e,r)=>(0,z.jsxs)(R.Fragment,{children:[r>0&&(0,z.jsx)(V,{attempt:t.attempts[r-1]}),(0,z.jsx)(H,{attempt:e,account:n.get(e.accountId),compact:t.attempts.length>2&&r<t.attempts.length-1})]},r))]})}function V({attempt:e}){return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-1 text-faint`,children:[(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),e?.outcome===`failed`&&(0,z.jsx)(`span`,{className:`rounded border border-err/30 bg-err-soft px-1 font-mono text-[10px] leading-4 text-err`,children:y(e)}),(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),(0,z.jsx)(`span`,{className:`-ml-1.5 text-[10px] leading-none`,children:`▸`})]})}function H({attempt:t,account:n,compact:r}){let i=n?.label??t.accountId;return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:e(`inline-flex h-6 max-w-[180px] min-w-0 items-center gap-1.5 rounded border pr-1.5 pl-0.5 text-[12px]`,t.outcome===`failed`?`border-line text-muted`:`border-line-strong bg-raised text-fg`),children:[(0,z.jsx)(A,{provider:t.provider,size:`sm`,className:`size-[18px] border-0 bg-transparent`}),!r&&(0,z.jsx)(`span`,{className:e(`truncate`,t.outcome===`failed`&&`line-through decoration-faint`),children:i}),t.outcome===`success`&&(0,z.jsx)(E,{className:`size-3 shrink-0 text-ok`,strokeWidth:2.25}),t.outcome===`failed`&&(0,z.jsx)(N,{className:`size-3 shrink-0 text-err`,strokeWidth:2.25}),t.outcome===`pending`&&(0,z.jsx)(L,{className:`size-3 shrink-0 animate-spin text-info [animation-duration:1.6s]`,strokeWidth:2})]})}function U({chain:e}){return e.outcome===`pending`?(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`}):e.outcome===`failed`?(0,z.jsx)(v,{tone:`err`,dot:!0,children:`failed`}):e.failovers>0?(0,z.jsxs)(v,{tone:`warn`,dot:!0,children:[`ok · `,e.failovers,` failover`,e.failovers>1?`s`:``]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,children:`ok`})}function W({chain:e,accounts:t,onClose:n}){return(0,z.jsx)(D,{open:!!e,onClose:n,title:`Request`,description:e&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[e.requestId,(0,z.jsx)(M,{value:e.requestId,label:`Copy request id`})]}),width:`w-[min(520px,100vw)]`,children:e&&(0,z.jsx)(G,{chain:e,accounts:t})})}function G({chain:t,accounts:n}){let r=h(t),i=d(t),a=[[`Outcome`,(0,z.jsx)(U,{chain:t},`o`)],[`Model`,(0,z.jsx)(`span`,{className:`font-mono`,children:t.model||`—`},`m`)],[`Started`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:_(t.startedTs,!0)},`s`)],[`End-to-end`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:i===void 0?`—`:m(i)},`l`)],[`Tokens`,(0,z.jsxs)(`span`,{className:`tnum font-mono`,children:[u(r.prompt),` in · `,u(r.completion),` out`]},`t`)],[`Failovers`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:t.failovers},`f`)]];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,z.jsx)(`dl`,{className:`grid grid-cols-[110px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:a.map(([e,t])=>(0,z.jsxs)(`div`,{className:`contents`,children:[(0,z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`min-w-0 text-fg`,children:t})]},e))}),(0,z.jsxs)(`section`,{"aria-labelledby":`attempts-title`,children:[(0,z.jsx)(`h3`,{id:`attempts-title`,className:`mb-2 text-[12px] font-medium text-fg-2`,children:`Attempts`}),(0,z.jsx)(`ol`,{className:`relative flex flex-col gap-0`,children:t.attempts.map((r,i)=>{let a=n.get(r.accountId),o=r.startedTs-t.startedTs,s=i===t.attempts.length-1;return(0,z.jsxs)(`li`,{className:`relative flex gap-3 pb-4 last:pb-0`,children:[!s&&(0,z.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7 bottom-0 left-[11px] w-px bg-line-strong`}),(0,z.jsx)(`span`,{className:e(`z-10 mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-semibold`,r.outcome===`success`?`border-ok/40 bg-ok-soft text-ok`:r.outcome===`failed`?`border-err/40 bg-err-soft text-err`:`border-info/40 bg-info-soft text-info`),children:i+1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1 rounded-md border border-line bg-raised p-2.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(A,{provider:r.provider,size:`sm`}),(0,z.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:a?.label??r.accountId}),(0,z.jsx)(`span`,{className:`ml-auto`,children:r.outcome===`success`?(0,z.jsx)(v,{tone:`ok`,children:`served`}):r.outcome===`failed`?(0,z.jsxs)(v,{tone:`err`,mono:!0,children:[y(r),` `,r.errorKind]}):(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`})})]}),(0,z.jsxs)(`p`,{className:`tnum mt-1.5 font-mono text-2xs text-muted`,children:[r.accountId,` · +`,m(o),r.latencyMs!==void 0&&` · took ${m(r.latencyMs)}`,r.outcome===`success`&&` · ${u(r.promptTokens??0)} → ${u(r.completionTokens??0)} tok`]}),r.errorMessage&&(0,z.jsx)(`p`,{className:`mt-1.5 text-[12px] text-fg-2`,children:r.errorMessage})]})]},i)})})]}),(0,z.jsxs)(`details`,{className:`rounded-md border border-line`,children:[(0,z.jsx)(`summary`,{className:`px-3 py-2 text-[12px] font-medium text-fg-2 select-none hover:text-fg`,children:`Raw chain`}),(0,z.jsx)(`pre`,{className:`max-h-80 overflow-auto border-t border-line p-3 font-mono text-2xs leading-5 text-fg-2`,children:JSON.stringify(t,null,2)})]})]})}function K(e,t){switch(t){case`ok`:return e.outcome===`success`&&e.failovers===0;case`failover`:return e.failovers>0;case`failed`:return e.outcome===`failed`;case`pending`:return e.outcome===`pending`;default:return!0}}var q=250;function J(){let t=l(),{connection:i}=c(),a=g(),{params:s}=x(),[u,y]=(0,R.useState)(``),[E,D]=(0,R.useState)(`all`),[A,M]=(0,R.useState)(``),[N,I]=(0,R.useState)(null),L=(0,R.useMemo)(()=>new Map((a.data??[]).map(e=>[e.id,e])),[a.data]),V=N??t.chains,H=N?Math.max(0,t.chains.length-N.length):0,G=(0,R.useMemo)(()=>{let e={all:0,ok:0,failover:0,failed:0,pending:0};for(let t of V)e.all+=1,K(t,`ok`)&&(e.ok+=1),K(t,`failover`)&&(e.failover+=1),K(t,`failed`)&&(e.failed+=1),K(t,`pending`)&&(e.pending+=1);return e},[V]),J=u.trim().toLowerCase(),Y=V.filter(e=>K(e,E)&&(!A||e.attempts.some(e=>e.accountId===A))&&(!J||e.requestId.toLowerCase().includes(J)||e.model.toLowerCase().includes(J)||e.attempts.some(e=>e.accountId.toLowerCase().includes(J)||(L.get(e.accountId)?.label.toLowerCase().includes(J)??!1)))).slice(0,q),X=s.get(`req`),Z=X?t.chains.find(e=>e.requestId===X):void 0,Q=t.chains.length===0&&i.mode!==`live`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(o,{title:`Traffic`,description:`Every request through /v1, with failover hops shown inline.`,actions:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N?(0,z.jsxs)(v,{tone:`warn`,children:[`paused`,H>0&&` · ${H} new`]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,pulse:!0,children:`streaming`}),(0,z.jsx)(n,{icon:N?w:S,onClick:()=>I(N?null:t.chains),"aria-pressed":!!N,children:N?`Resume`:`Pause`})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`relative w-full sm:w-64`,children:[(0,z.jsx)(b,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,z.jsx)(P,{type:`search`,"aria-label":`Filter requests`,placeholder:`Model, request id or account`,value:u,onChange:e=>y(e.target.value),className:`pl-8`,"data-filter-input":!0})]}),(0,z.jsx)(j,{label:`Outcome`,value:E,onChange:D,options:[{value:`all`,label:`All`,count:G.all},{value:`ok`,label:`OK`,count:G.ok},{value:`failover`,label:`Failover`,count:G.failover},{value:`failed`,label:`Failed`,count:G.failed},{value:`pending`,label:`In flight`,count:G.pending}]}),(0,z.jsxs)(F,{"aria-label":`Filter by account`,value:A,onChange:e=>M(e.target.value),className:`w-auto min-w-44`,children:[(0,z.jsx)(`option`,{value:``,children:`All accounts`}),(a.data??[]).map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,z.jsx)(r,{children:Q?(0,z.jsx)(k,{rows:8}):Y.length===0?t.chains.length===0?(0,z.jsx)(O,{icon:C,title:`No requests yet`,description:`Point any OpenAI-compatible client at the gateway and use a davecode/<route> model.`,command:`curl http://127.0.0.1:4040/v1/chat/completions -H 'content-type: application/json' -d '{"model":"davecode/auto","messages":[{"role":"user","content":"hi"}]}'`}):(0,z.jsx)(O,{icon:b,title:`No matching requests`,description:`Try a different filter.`}):(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)(`table`,{className:`w-full min-w-[920px] text-[12px]`,children:[(0,z.jsx)(`caption`,{className:`sr-only`,children:`Recent requests, newest first`}),(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-3.5 py-2 font-medium`,children:`Time`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-2 py-2 font-medium`,children:`Request`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-40 px-2 py-2 font-medium`,children:`Model`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Accounts`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-20 px-2 py-2 text-right font-medium`,children:`Latency`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-28 px-2 py-2 text-right font-medium`,children:`Tokens in → out`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-36 px-3.5 py-2 text-right font-medium`,children:`Status`})]})}),(0,z.jsx)(`tbody`,{children:Y.map(t=>{let n=h(t),r=d(t);return(0,z.jsxs)(`tr`,{onClick:()=>T(`req`,t.requestId),className:e(`animate-row-in cursor-pointer border-b border-line transition-colors duration-150 last:border-b-0 hover:bg-hover/60`,X===t.requestId&&`bg-hover/60`),children:[(0,z.jsx)(`td`,{className:`tnum px-3.5 py-2 font-mono text-muted`,children:_(t.startedTs)}),(0,z.jsx)(`td`,{className:`px-2 py-2`,children:(0,z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(`req`,t.requestId)},className:`font-mono text-fg-2 hover:text-fg hover:underline focus-visible:underline`,"aria-label":`Open request ${t.requestId}`,children:f(t.requestId)})}),(0,z.jsx)(`td`,{className:`max-w-0 truncate px-2 py-2 font-mono text-fg`,children:t.model||`—`}),(0,z.jsx)(`td`,{className:`max-w-0 px-2 py-1.5`,children:(0,z.jsx)(B,{chain:t,accounts:L})}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:r===void 0?`…`:m(r)}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:n.prompt||n.completion?(0,z.jsxs)(z.Fragment,{children:[p(n.prompt),` `,(0,z.jsx)(`span`,{className:`text-faint`,children:`→`}),` `,p(n.completion)]}):(0,z.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,z.jsx)(`td`,{className:`px-3.5 py-2 text-right`,children:(0,z.jsx)(U,{chain:t})})]},t.requestId)})})]})})}),Y.length===q&&(0,z.jsxs)(`p`,{className:`text-center text-[12px] text-muted`,children:[`Showing the latest `,q,` requests.`]}),(0,z.jsx)(W,{chain:Z,accounts:L,onClose:()=>T(`req`,null)})]})}export{J as Traffic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,s as n,u as r}from"./Panel-
|
|
1
|
+
import{c as e,i as t,s as n,u as r}from"./Panel-Du40pM7n.js";import{B as i,C as a,M as o,N as s,T as c,ft as l,g as u,p as d,pt as f}from"./Badge-CGY6DgGx.js";import{t as p}from"./arrow-up-goM9r-I9.js";import{t as m}from"./Markdown-Xhao3sgL.js";import{t as h}from"./Callout-DauCk_cW.js";import{C as g,P as _,V as v,b as y,k as b,x}from"./index-BCi-Vuvh.js";import{GoalDetail as S,isActiveGoal as C,t as w}from"./Goals-DH-KDh8M.js";var T=r(e(),1),E=n(),D={planning:`Putting a plan together`,running:`Working on it`,reviewing:`Checking the result`,planned:`Your plan is ready`,succeeded:`Done`,failed:`Something needs attention`,cancelled:`Stopped`,budget_exhausted:`Usage limit reached`},O=[{title:`Make something`,prompt:`Help me turn an idea into something useful. First help me define who it is for and what it should do.`},{title:`Understand a project`,prompt:`Explain this project in plain language and write a short getting-started guide for someone without a technical background.`},{title:`Improve a design`,prompt:`Review this project’s interface. Propose a distinctive visual direction, explain the most useful improvements and make a plan before changing code.`}];function k(){let{params:e}=g(),{connection:n}=i(),r=c(),k=d(),A=s(),j=o(),M=a(),N=u(),P=(0,T.useRef)(null),[F,I]=(0,T.useState)(()=>(e.get(`brief`)??``).slice(0,4e3)),[L,R]=(0,T.useState)(`plan`),[z,B]=(0,T.useState)(`50000`),[V,H]=(0,T.useState)(),U=r.data??[],W=U.find(C),G=e.has(`new`)||e.has(`brief`)?void 0:U.find(t=>t.id===e.get(`goal`))??W,K=n.mode===`mock`,q=f(r.error)&&r.error.status===501,J=(k.data??[]).some(e=>e.enabled),Y=r.isPending||r.isError||k.isPending||k.isError||!J||j.isPending||!!W&&L===`work`;function X(e){e.preventDefault(),!Y&&F.trim()&&(H(void 0),j.mutate({objective:F.trim(),dryRun:L===`plan`,maxTokens:Number(z)},{onSuccess:e=>{I(``),x(`/?goal=${encodeURIComponent(e.id)}`)},onError:e=>H(l(e))}))}return(0,E.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[780px] flex-1 flex-col`,children:[K&&(0,E.jsxs)(`p`,{className:`mb-4 text-center text-[12px] text-muted`,children:[`This is a demo.`,` `,(0,E.jsx)(y,{to:`/settings`,className:`underline`,children:`Connect your device`}),` `,`to work on your files.`]}),q&&(0,E.jsxs)(h,{tone:`warn`,title:`Open a project to start`,children:[`Start DaveCode in your project folder.`,` `,(0,E.jsx)(y,{to:`/goals`,className:`underline`,children:`Setup instructions`})]}),r.isError&&!q&&(0,E.jsx)(h,{tone:`err`,title:`Could not load your work`,children:l(r.error)}),k.isError&&(0,E.jsx)(h,{tone:`err`,title:`Could not load AI connections`,children:l(k.error)}),G?(0,E.jsxs)(`div`,{className:`flex flex-1 flex-col gap-7 pb-10 pt-6`,children:[(0,E.jsx)(`div`,{className:`ml-auto max-w-[90%] rounded-2xl bg-raised px-5 py-4 text-[15px] leading-7 text-fg`,children:G.objective}),(0,E.jsxs)(`section`,{"aria-labelledby":`work-status`,className:`px-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`h1`,{id:`work-status`,className:`text-[19px] font-medium tracking-tight text-fg`,children:D[G.status]}),C(G)&&(0,E.jsx)(t,{size:`sm`,variant:`ghost`,icon:b,loading:N.isPending,onClick:()=>N.mutate(G.id,{onError:e=>H(l(e))}),children:`Stop`})]}),G.tasks.length>0&&(0,E.jsx)(`ol`,{className:`mt-5 flex flex-col gap-4`,children:G.tasks.map(e=>(0,E.jsxs)(`li`,{className:`flex items-start gap-3 text-[14px] leading-6 text-fg-2`,children:[e.status===`SUCCESS`?(0,E.jsx)(v,{"aria-hidden":!0,className:`mt-1 size-4 shrink-0 text-fg-2`}):(0,E.jsx)(`span`,{className:`mt-0.5 w-4 shrink-0 text-center text-muted`,"aria-hidden":!0,children:e.id===G.activeTaskId?`→`:`−`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{children:e.title}),e.status===`FAILED`&&(0,E.jsx)(`p`,{className:`mt-1 text-[12px] text-err`,children:`This step needs attention.`})]})]},e.id))}),G.summary&&(0,E.jsx)(m,{source:G.summary,className:`mt-6 text-[14px]`}),G.lastError&&(0,E.jsx)(`p`,{role:`alert`,className:`mt-4 text-[13px] text-err`,children:G.lastError}),G.status===`planned`&&(0,E.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(t,{size:`sm`,variant:`primary`,icon:_,loading:M.isPending,disabled:!!W,onClick:()=>{H(void 0),M.mutate(G.id,{onError:e=>H(l(e))})},children:`Execute this plan`}),(0,E.jsx)(`span`,{className:`text-[13px] leading-6 text-muted`,children:`Runs the planned steps above without re-planning.`})]})]}),(0,E.jsxs)(`details`,{className:`text-[12px] text-muted`,children:[(0,E.jsx)(`summary`,{className:`mb-3 cursor-pointer`,children:`Task details`}),(0,E.jsx)(S,{goal:G},G.id)]})]}):(0,E.jsxs)(`section`,{className:`flex flex-1 flex-col items-center justify-center pb-8 pt-16 text-center md:pt-20`,children:[(0,E.jsx)(`h1`,{className:`text-3xl font-medium tracking-tight text-fg md:text-[38px]`,children:`What are we making?`}),(0,E.jsx)(`p`,{className:`mt-3 text-[15px] text-muted`,children:`An idea is a good place to start.`}),(0,E.jsx)(`div`,{className:`mt-8 flex flex-wrap justify-center gap-2`,children:O.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>{I(e.prompt),R(`plan`),P.current?.focus()},className:`rounded-xl border border-line px-4 py-3 text-[13px] text-fg-2 transition-colors hover:border-line-strong hover:bg-hover`,children:e.title},e.title))})]}),(0,E.jsxs)(`div`,{className:`sticky bottom-0 bg-bg pb-3 pt-3`,children:[(0,E.jsxs)(`form`,{onSubmit:X,className:`rounded-2xl border border-line-strong bg-panel p-4 focus-within:border-faint`,children:[(0,E.jsx)(`label`,{htmlFor:`workspace-composer`,className:`sr-only`,children:`What would you like to do?`}),(0,E.jsx)(`textarea`,{id:`workspace-composer`,ref:P,required:!0,rows:3,maxLength:4e3,value:F,onChange:e=>I(e.target.value),placeholder:`Describe what you have in mind…`,"aria-describedby":V?`workspace-error`:void 0,className:`block w-full resize-none border-0 bg-transparent px-1 py-2 text-[15px] leading-6 text-fg outline-none placeholder:text-muted`}),(0,E.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(`label`,{className:`sr-only`,htmlFor:`workspace-mode`,children:`How to start`}),(0,E.jsxs)(`select`,{id:`workspace-mode`,value:L,onChange:e=>R(e.target.value),className:`max-w-44 rounded-lg border-0 bg-transparent py-2 pr-3 text-[12px] text-fg-2 outline-accent`,children:[(0,E.jsx)(`option`,{value:`plan`,children:`Plan first`}),(0,E.jsx)(`option`,{value:`work`,children:`Plan and work`})]}),(0,E.jsxs)(`details`,{className:`relative`,children:[(0,E.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1 text-[12px] text-muted`,children:[`Options`,(0,E.jsx)(w,{"aria-hidden":!0,className:`size-3`})]}),(0,E.jsxs)(`div`,{className:`absolute bottom-9 left-0 z-10 w-56 rounded-xl border border-line-strong bg-panel p-4 shadow-overlay`,children:[(0,E.jsx)(`label`,{htmlFor:`workspace-limit`,className:`text-[12px] text-fg-2`,children:`AI usage limit`}),(0,E.jsxs)(`select`,{id:`workspace-limit`,value:z,onChange:e=>B(e.target.value),className:`mt-2 w-full rounded-md border border-line-strong bg-panel px-2 py-2 text-[12px] text-fg`,children:[(0,E.jsx)(`option`,{value:`50000`,children:`50k tokens`}),(0,E.jsx)(`option`,{value:`250000`,children:`250k tokens`}),(0,E.jsx)(`option`,{value:`1000000`,children:`1m tokens`})]}),(0,E.jsx)(`p`,{className:`mt-2 text-[11px] leading-5 text-muted`,children:`A usage limit, not a price cap.`})]})]})]}),(0,E.jsx)(t,{type:`submit`,icon:p,iconOnly:!0,"aria-label":K?`Try demo`:L===`plan`?`Make a plan`:`Start working`,variant:`primary`,disabled:Y||!F.trim(),loading:j.isPending,className:`size-9 rounded-xl`})]})]}),V&&(0,E.jsx)(`p`,{id:`workspace-error`,role:`alert`,className:`mt-2 text-[12px] text-err`,children:V}),!k.isPending&&!k.isError&&!J&&(0,E.jsxs)(`p`,{className:`mt-3 text-center text-[12px] text-muted`,children:[(0,E.jsx)(y,{to:`/accounts`,className:`underline`,children:`Connect an AI tool`}),` `,`to get started.`]}),W&&L===`work`&&(0,E.jsx)(`p`,{role:`status`,className:`mt-3 text-center text-[12px] text-muted`,children:`A task is running. You can still plan the next one.`}),(0,E.jsxs)(`p`,{className:`mt-3 text-center text-[11px] leading-5 text-muted`,children:[L===`plan`?`Planning does not execute tasks.`:`Execution can edit files and merge changes.`,A.data?.project?` Working in ${A.data.project.name}.`:``]})]})]})}export{k as Workspace};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./Panel-Du40pM7n.js";var t={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,o as t,s as n,u as r}from"./Panel-
|
|
1
|
+
import{c as e,o as t,s as n,u as r}from"./Panel-Du40pM7n.js";import{n as i,r as a,t as o}from"./Field-OXMnT9Tb.js";var s={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};s.node;var c=t(s),l={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};l.node;var u=t(l),d=r(e(),1),f=n(),p=[{key:`tpm`,label:`Tokens / min`},{key:`rpm`,label:`Requests / min`},{key:`tokens5h`,label:`Tokens / 5 h`},{key:`requests5h`,label:`Requests / 5 h`},{key:`tokensDaily`,label:`Tokens / 24 h`},{key:`requestsDaily`,label:`Requests / 24 h`}];function m(e={}){let t={};for(let{key:n}of p)t[n]=e[n]===void 0?``:String(e[n]);return t}function h(e){let t={},n={};for(let{key:r}of p){let i=e[r].replace(/[,_\s]/g,``);if(!i)continue;let a=Number(i);!Number.isInteger(a)||a<=0?n[r]=`Whole number above 0`:t[r]=a}return{limits:t,errors:n}}function g({value:e,onChange:t,errors:n}){return(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-3`,children:p.map(({key:r,label:a})=>(0,f.jsx)(o,{label:a,error:n[r],children:({id:n,describedBy:a,invalid:o})=>(0,f.jsx)(i,{id:n,inputMode:`numeric`,placeholder:`unlimited`,value:e[r],"aria-describedby":a,"aria-invalid":o||void 0,onChange:n=>t({...e,[r]:n.target.value}),className:`tnum font-mono`})},r))})}function _({id:e,value:t,onChange:n,placeholder:r,describedBy:a,invalid:o}){let[s,l]=(0,d.useState)(!1);return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(i,{id:e,type:s?`text`:`password`,autoComplete:`new-password`,spellCheck:!1,autoCapitalize:`off`,value:t,placeholder:r,"aria-describedby":a,"aria-invalid":o||void 0,onChange:e=>n(e.target.value),className:`pr-9 font-mono`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":s?`Hide secret`:`Show secret`,"aria-pressed":s,className:`absolute top-1/2 right-1 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:s?(0,f.jsx)(c,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}):(0,f.jsx)(u,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})]})}function v(e){return{plan:e?.plan??``,amount:e?.price?String(e.price.amount):``,currency:e?.price?.currency??`USD`,period:e?.price?.period??`month`,paidAt:e?.paidAt?.slice(0,10)??``,renewsAt:e?.renewsAt?.slice(0,10)??``,notes:e?.notes??``}}function y(e){let t={},n={};e.plan.trim()&&(n.plan=e.plan.trim()),e.notes.trim()&&(n.notes=e.notes.trim()),e.paidAt&&(n.paidAt=e.paidAt),e.renewsAt&&(n.renewsAt=e.renewsAt);let r=e.amount.replace(/[,\s]/g,``);if(r){let i=Number(r),a=e.currency.trim().toUpperCase();(!Number.isFinite(i)||i<0)&&(t.amount=`Number, 0 or more`),/^[A-Z]{3}$/.test(a)||(t.currency=`3-letter code`),!t.amount&&!t.currency&&(n.price={amount:i,currency:a,period:e.period})}return{subscription:Object.keys(n).length>0?n:void 0,errors:t}}function b({value:e,onChange:t,errors:n}){let r=(n,r)=>t({...e,[n]:r});return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(o,{label:`Plan`,hint:`As the vendor calls it, e.g. Claude Pro or API pay-as-you-go.`,children:({id:t,describedBy:n})=>(0,f.jsx)(i,{id:t,value:e.plan,placeholder:`Claude Pro`,"aria-describedby":n,onChange:e=>r(`plan`,e.target.value)})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_5.5rem_7rem] gap-3`,children:[(0,f.jsx)(o,{label:`Price`,error:n.amount,children:({id:t,describedBy:n,invalid:a})=>(0,f.jsx)(i,{id:t,inputMode:`decimal`,placeholder:`20`,value:e.amount,"aria-describedby":n,"aria-invalid":a||void 0,onChange:e=>r(`amount`,e.target.value),className:`tnum font-mono`})}),(0,f.jsx)(o,{label:`Currency`,error:n.currency,children:({id:t,describedBy:n,invalid:a})=>(0,f.jsx)(i,{id:t,maxLength:3,value:e.currency,"aria-describedby":n,"aria-invalid":a||void 0,onChange:e=>r(`currency`,e.target.value.toUpperCase()),className:`font-mono uppercase`})}),(0,f.jsx)(o,{label:`Per`,children:({id:t})=>(0,f.jsxs)(a,{id:t,value:e.period,onChange:e=>r(`period`,e.target.value),children:[(0,f.jsx)(`option`,{value:`month`,children:`month`}),(0,f.jsx)(`option`,{value:`year`,children:`year`})]})})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsx)(o,{label:`Last paid`,children:({id:t})=>(0,f.jsx)(i,{id:t,type:`date`,value:e.paidAt,onChange:e=>r(`paidAt`,e.target.value),className:`font-mono`})}),(0,f.jsx)(o,{label:`Renews on`,children:({id:t})=>(0,f.jsx)(i,{id:t,type:`date`,value:e.renewsAt,onChange:e=>r(`renewsAt`,e.target.value),className:`font-mono`})})]}),(0,f.jsx)(o,{label:`Notes`,children:({id:t})=>(0,f.jsx)(i,{id:t,value:e.notes,placeholder:`Shared with the team, prepaid credits…`,onChange:e=>r(`notes`,e.target.value)})})]})}function x(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function S(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}export{m as a,y as c,S as i,v as l,_ as n,h as o,b as r,x as s,g as t};
|