@runfusion/fusion 0.43.1 → 0.44.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/dist/automation-store-EKXXEE2S.js +10 -0
- package/dist/automation-store-PLNG3X72.js +10 -0
- package/dist/automation-store-RDDYZFUJ.js +10 -0
- package/dist/bin.js +8097 -1796
- package/dist/chunk-2JI3F6MG.js +948 -0
- package/dist/chunk-4L6CLWJC.js +8345 -0
- package/dist/chunk-4VNS5WPM.js +42 -0
- package/dist/chunk-5RGECGQL.js +1139 -0
- package/dist/chunk-6JDLN7IL.js +409 -0
- package/dist/chunk-AICJATVW.js +948 -0
- package/dist/chunk-AWKNRUOR.js +1148 -0
- package/dist/chunk-BHM3UYWS.js +4651 -0
- package/dist/chunk-BMUXDSBF.js +4647 -0
- package/dist/chunk-GETECT6V.js +353 -0
- package/dist/chunk-GUV4QQT3.js +1143 -0
- package/dist/chunk-JKQO7YYZ.js +8369 -0
- package/dist/chunk-LYZVU6UV.js +409 -0
- package/dist/chunk-MAN4WYHO.js +353 -0
- package/dist/chunk-MCUG2Z7M.js +4651 -0
- package/dist/chunk-PSDYB45U.js +948 -0
- package/dist/chunk-RR2HM46R.js +8345 -0
- package/dist/chunk-RXMQ5OMY.js +9226 -0
- package/dist/chunk-S2EVJUY3.js +353 -0
- package/dist/chunk-UXR5XZFZ.js +409 -0
- package/dist/client/.vite/manifest.json +272 -261
- package/dist/client/assets/{AgentDetailView-BGN03dyz.css → AgentDetailView-CanIeYHg.css} +1 -1
- package/dist/client/assets/{AgentDetailView-DKMz3r04.js → AgentDetailView-DxV8pFHX.js} +3 -3
- package/dist/client/assets/{AgentPermissionPolicyEditor-BiY1a4KR.js → AgentPermissionPolicyEditor--YS4iMUY.js} +2 -2
- package/dist/client/assets/AgentsView-BVILQjdS.css +1 -0
- package/dist/client/assets/{AgentsView-Co-k4vjh.js → AgentsView-CTzbcvhK.js} +3 -3
- package/dist/client/assets/ChatView-COygcnyk.js +6 -0
- package/dist/client/assets/CommandCenter-CTaopaC0.css +1 -0
- package/dist/client/assets/CommandCenter-DoKX2HWm.js +56 -0
- package/dist/client/assets/DevServerView-Cyevyvqx.js +1 -0
- package/dist/client/assets/{DirectoryPicker-DTKtd8L2.css → DirectoryPicker-0rspvcMz.css} +1 -1
- package/dist/client/assets/{DirectoryPicker-CkcGjyv0.js → DirectoryPicker-DBdyXEhR.js} +1 -1
- package/dist/client/assets/DocumentsView-BzSMyrns.js +1 -0
- package/dist/client/assets/{EvalsView-CUfyj5GW.js → EvalsView-ikz00o9g.js} +1 -1
- package/dist/client/assets/ExperimentalAgentOnboardingModal-CZ_jbgep.css +1 -0
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-Dau9RTU_.js → ExperimentalAgentOnboardingModal-D-rzCCET.js} +10 -10
- package/dist/client/assets/GoalsView-Bfu1Oy2-.js +2 -0
- package/dist/client/assets/GoalsView-rg9VSIza.css +1 -0
- package/dist/client/assets/{InsightsView-BQPxHxKI.js → InsightsView-Cgmf5nES.js} +1 -1
- package/dist/client/assets/InsightsView-LMv1M1dU.css +1 -0
- package/dist/client/assets/MemoryView-DkEuDKQs.js +2 -0
- package/dist/client/assets/{NodesView-CSMvGwDU.js → NodesView-B_KYfS4o.js} +3 -3
- package/dist/client/assets/{PiExtensionsManager-BtqXF3fl.js → PiExtensionsManager-Dz69kkKs.js} +2 -2
- package/dist/client/assets/PluginManager-DSiHizRD.css +1 -0
- package/dist/client/assets/{PluginManager-CSSDb3VO.js → PluginManager-LHCVcduP.js} +1 -1
- package/dist/client/assets/PullRequestView-3AdbS2a1.css +1 -0
- package/dist/client/assets/{PullRequestView-Bjyfffdu.js → PullRequestView-DBJutLLl.js} +2 -2
- package/dist/client/assets/{ResearchView-CRU_NPho.js → ResearchView-gpn1XcVy.js} +1 -1
- package/dist/client/assets/{SecretsView-Bs8ySyC5.js → SecretsView-B7YqIowt.js} +1 -1
- package/dist/client/assets/SessionTerminal-9l4bdKcn.js +2 -0
- package/dist/client/assets/SessionTerminal-BNgtmXb3.css +1 -0
- package/dist/client/assets/SettingsModal-BGEK9_9A.js +31 -0
- package/dist/client/assets/{SettingsModal-DpAxDq6M.css → SettingsModal-CKv0TJfM.css} +1 -1
- package/dist/client/assets/SettingsModal-CXogw-Er.css +1 -0
- package/dist/client/assets/{SettingsModal-Nw5cTKAK.js → SettingsModal-DIIoHGUH.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-CE79myEy.js → SetupWizardModal-BcVeMxeX.js} +1 -1
- package/dist/client/assets/{SkillsView-Dc8YskAX.js → SkillsView-BxSJ4PHL.js} +1 -1
- package/dist/client/assets/{StashRecoveryView-CqKOFiXT.js → StashRecoveryView-BhFQ2FsP.js} +1 -1
- package/dist/client/assets/{TodoView-BqIRwcZw.js → TodoView-BZpewjy0.js} +2 -2
- package/dist/client/assets/WorkflowNodeEditor-Yn1FRF2v.css +1 -0
- package/dist/client/assets/WorkflowNodeEditor-tWsgCdVt.js +8 -0
- package/dist/client/assets/{addon-fit-B4jkcKk4.js → addon-fit-SnYDEvGm.js} +1 -1
- package/dist/client/assets/{addon-unicode11-Cdne2Sj4.js → addon-unicode11-s5GoZCpi.js} +1 -1
- package/dist/client/assets/{addon-web-links-CRNLzj7m.js → addon-web-links-jjt2f_oV.js} +1 -1
- package/dist/client/assets/{addon-webgl-CeCSULF1.js → addon-webgl-Icn-RnEx.js} +1 -1
- package/dist/client/assets/{app-sEkTyT-w.js → app-BmGA0Hiz.js} +3 -3
- package/dist/client/assets/{app-BffGU_HQ.js → app-CEVYlVuJ.js} +3 -3
- package/dist/client/assets/{app-C8AHhs5N.js → app-CbBFax2C.js} +3 -3
- package/dist/client/assets/{app-B2ZxMfJT.js → app-DORKrGAz.js} +3 -3
- package/dist/client/assets/{app-Ri9Te2Dv.js → app-DQibuQ9z.js} +3 -3
- package/dist/client/assets/app-k76GrQP0.js +13 -0
- package/dist/client/assets/{createLucideIcon-BYvOGRiO.js → createLucideIcon-DmVITl5d.js} +1 -1
- package/dist/client/assets/{dashboard-view-C3SsjXo1.js → dashboard-view-B4LXCv5H.js} +4 -4
- package/dist/client/assets/{dashboard-view-DlKsVySD.js → dashboard-view-BFoyhTYF.js} +1 -1
- package/dist/client/assets/{dashboard-view-BhbN8LPh.js → dashboard-view-Cxzm_eqc.js} +1 -1
- package/dist/client/assets/dashboard-view-_8yfNwju.css +1 -0
- package/dist/client/assets/{folder-open-Bw1mxVfa.js → folder-open-33WGVnbp.js} +1 -1
- package/dist/client/assets/index-Bglw05rM.js +791 -0
- package/dist/client/assets/index-FYgnflWD.css +1 -0
- package/dist/client/assets/shield-alert-CqeGWBUK.js +6 -0
- package/dist/client/assets/{upload-BCmd-1I0.js → upload-C11J2diI.js} +1 -1
- package/dist/client/assets/{users-DO_t3V1p.js → users-a-ELbyyZ.js} +1 -1
- package/dist/client/assets/{vendor-i18n-CV0mwX_-.js → vendor-i18n-DYlSUfot.js} +1 -1
- package/dist/client/assets/vendor-react-BTgM5bbZ.js +49 -0
- package/dist/client/assets/{vendor-reactflow-CRZcPCXF.js → vendor-reactflow-ZasuEfF9.js} +3 -3
- package/dist/client/assets/{vendor-xterm-tcedd2Jt.js → vendor-xterm-ea7-K05z.js} +1 -1
- package/dist/client/assets/{x-CqNX_9E2.js → x-PItWc-wQ.js} +1 -1
- package/dist/client/assets/{zoom-out-CSTHbJgD.js → zoom-out-CzlHv0Kj.js} +1 -1
- package/dist/client/icons/icon-192.png +0 -0
- package/dist/client/icons/icon-512.png +0 -0
- package/dist/client/index.html +6 -6
- package/dist/client/sw.js +1 -1
- package/dist/client/theme-data.css +288 -285
- package/dist/client/version.json +1 -1
- package/dist/droid-cli/package.json +1 -1
- package/dist/droid-cli/src/__tests__/execsync-guard.test.ts +17 -0
- package/dist/droid-cli/src/__tests__/process-manager.test.ts +1 -45
- package/dist/extension.js +4780 -793
- package/dist/extract-zip-WL55Z3AU.js +2497 -0
- package/dist/index.min-CHQ3ABYJ.js +2926 -0
- package/dist/memory-dreams-7USISKVE.js +32 -0
- package/dist/memory-dreams-PBPISUDD.js +32 -0
- package/dist/memory-dreams-XNO2B2QF.js +32 -0
- package/dist/migration-EH2YOCYQ.js +15 -0
- package/dist/migration-PLGTTKL5.js +15 -0
- package/dist/migration-WZEZK22R.js +15 -0
- package/dist/pi-claude-cli/index.ts +47 -8
- package/dist/pi-claude-cli/package.json +4 -1
- package/dist/pi-claude-cli/src/__tests__/acp-dispatch.test.ts +80 -0
- package/dist/pi-claude-cli/src/__tests__/acp-driver.test.ts +423 -0
- package/dist/pi-claude-cli/src/__tests__/execsync-guard.test.ts +14 -0
- package/dist/pi-claude-cli/src/__tests__/process-manager.test.ts +1 -45
- package/dist/pi-claude-cli/src/__tests__/provider.test.ts +0 -1
- package/dist/pi-claude-cli/src/acp-driver.ts +585 -0
- package/dist/pi-claude-cli/src/event-bridge.ts +7 -0
- package/dist/pi-claude-cli/src/mcp-config.ts +29 -0
- package/dist/pi-claude-cli/src/process-manager.ts +6 -38
- package/dist/plugin-sdk/index.d.ts +5179 -5144
- package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +263 -19
- package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +37 -7
- package/dist/plugins/fusion-plugin-compound-engineering/manifest.json +4 -4
- package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/src/__tests__/index.test.ts +5 -1
- package/dist/routine-store-GIJ6MXWY.js +10 -0
- package/dist/routine-store-HTVC2PUQ.js +10 -0
- package/dist/routine-store-KGHZBPDF.js +10 -0
- package/package.json +1 -1
- package/skill/fusion/references/engine-tools.md +6 -4
- package/dist/client/assets/AgentsView-DfznJDek.css +0 -1
- package/dist/client/assets/ChatView-BkAG99bj.js +0 -6
- package/dist/client/assets/DevServerView-C6DC0URX.js +0 -1
- package/dist/client/assets/DocumentsView-OCK1Vsw_.js +0 -1
- package/dist/client/assets/ExperimentalAgentOnboardingModal-BNpveCEk.css +0 -1
- package/dist/client/assets/GoalsView-CNLTn0rX.js +0 -2
- package/dist/client/assets/GoalsView-DI66UsjT.css +0 -1
- package/dist/client/assets/InsightsView-C9-mqVvf.css +0 -1
- package/dist/client/assets/MemoryView-D3xQIFjj.js +0 -2
- package/dist/client/assets/PluginManager-UHVLvWWl.css +0 -1
- package/dist/client/assets/PullRequestView-WQIS0zUC.css +0 -1
- package/dist/client/assets/ReliabilityView-QKMUDebT.js +0 -1
- package/dist/client/assets/ReliabilityView-eoKBhBc4.css +0 -1
- package/dist/client/assets/SessionTerminal-BiigPP2l.css +0 -1
- package/dist/client/assets/SessionTerminal-Dk1NgmN2.js +0 -2
- package/dist/client/assets/SettingsModal-JCaNvdAb.js +0 -31
- package/dist/client/assets/SettingsModal-nF_GaeeK.css +0 -1
- package/dist/client/assets/WorkflowNodeEditor-2jDuk2FR.js +0 -8
- package/dist/client/assets/WorkflowNodeEditor-BokhW3de.css +0 -1
- package/dist/client/assets/app-CUu1sm3x.js +0 -13
- package/dist/client/assets/dashboard-view-Du53JbmQ.css +0 -1
- package/dist/client/assets/index-CpTBp1RG.js +0 -793
- package/dist/client/assets/index-DqhCiU35.css +0 -1
- package/dist/client/assets/vendor-react-D37HfzIf.js +0 -49
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,j as r}from"./vendor-react-BTgM5bbZ.js";import{co as Pe,cp as pe,cq as sr,cr as he,s as Te,cs as Ne,ct as ke,cu as Ce,cv as je,cw as nr,cx as ce,cy as ar,cz as ir,cA as lr,cB as or,cC as cr,aI as Y,cD as de,L as se,S as dr,M as vr,cE as ur,bS as mr,a as fr,T as ze,cF as pr,Q as hr,b3 as gr,b4 as br,ah as wr,aD as xr,R as yr}from"./index-Bglw05rM.js";import{u as ne}from"./vendor-i18n-DYlSUfot.js";import{S as Fe}from"./shield-alert-CqeGWBUK.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";const ge=500,Sr=3e3;function W(e){return e instanceof Error?e.message:String(e)}function Oe(e){return e.length<=ge?e:e.slice(-ge)}function ve(e,o){return Oe([...e,o])}function Q(e){try{return JSON.parse(e)}catch{return null}}function ee(e){const o=e.text??"";return e.stream==="stderr"?`[stderr] ${o}`:o}function Nr(e){return e?.previewUrl??null}async function Ee(e){return ar(e)}async function Le(e,o){return ir(e,o)}async function kr(e){return lr(e)}async function Cr(e){return or(e)}async function Re(e){return cr(e)}function q(e){try{return e()}catch{return null}}function ue(){return typeof q(()=>pe)=="function"&&typeof q(()=>Pe)=="function"}function X(e){return{config:{id:e.id??"default",name:e.name??"Dev Server",command:e.command??"",cwd:e.cwd??"."},status:e.status,runtime:e.pid?{pid:e.pid,startedAt:e.startedAt??new Date().toISOString(),exitCode:e.exitCode??void 0,previewUrl:e.previewUrl}:void 0,previewUrl:e.previewUrl??e.detectedUrl??e.manualUrl??void 0,logHistory:(e.logs??[]).map(o=>({timestamp:new Date().toISOString(),stream:o.startsWith("[stderr]")?"stderr":"stdout",text:o.replace(/^\[stderr\]\s*/,"")}))}}function jr(e){const{t:o}=ne("app"),[s,f]=t.useState(null),[b,g]=t.useState([]),[x,d]=t.useState([]),[E,S]=t.useState([]),[z,N]=t.useState(!0),[y,u]=t.useState(null),i=t.useRef(0),[m,M]=t.useState(null),A=t.useCallback(n=>{if(f(n),n?.logHistory){const a=n.logHistory.slice(-ge).map(ee);d(a)}},[]),L=t.useCallback(async()=>{const n=i.current;try{if(ue())if(m){const a=await Pe(m,e);if(i.current!==n)return;A(a)}else{const a=await pe(e);if(i.current!==n)return;g(a),a.length>0&&(M(a[0].config.id),A(a[0]))}else{const a=await Ee(e);if(i.current!==n)return;const v=X(a);g([v]),A(v)}u(null)}catch(a){if(i.current!==n)return;u(W(a))}},[A,e,m]);t.useEffect(()=>{i.current+=1;const n=i.current;f(null),g([]),d([]),S([]),N(!0),u(null),M(null),(async()=>{try{const[v,c]=await Promise.allSettled([ue()?pe(e):Ee(e).then(C=>[X(C)]),typeof q(()=>ce)=="function"?ce(e):Re(e).then(C=>C.map(R=>({name:R.name,command:R.command,cwd:R.cwd,scriptName:R.scriptName,packagePath:R.packagePath})))]);if(i.current!==n)return;let h=null;if(v.status==="fulfilled"){const C=v.value;if(g(C),C.length>0){const R=C[0];ue()&&M(R.config.id),A(R)}}else h=W(v.reason);c.status==="fulfilled"&&S(c.value),h&&u(h)}catch(v){if(i.current!==n)return;u(W(v))}finally{i.current===n&&N(!1)}})()},[A,e]),t.useEffect(()=>{const n=m?sr(m,e):typeof q(()=>he)=="function"?he(e):null;if(!n)return;const a=i.current,v=Te(n,{events:{history:c=>{if(i.current!==a)return;const h=Q(c.data);if(h?.lines){const C=h.lines.map(ee);d(Oe(C))}},log:c=>{if(i.current!==a)return;const h=Q(c.data);if(h){const C=typeof h.line=="string"?h.line:ee(h);d(R=>ve(R,C))}},"dev-server:log":c=>{if(i.current!==a)return;const h=Q(c.data);if(h){const C=typeof h.line=="string"?h.line:ee(h);d(R=>ve(R,C))}},"dev-server:output":c=>{if(i.current!==a)return;const h=Q(c.data);h?.line&&d(C=>ve(C,h.line))},status:c=>{if(i.current!==a)return;const h=Q(c.data),C=h?.status;C&&f(R=>R&&{...R,status:C,runtime:h.pid?{...R.runtime??{startedAt:new Date().toISOString()},pid:h.pid}:R.runtime})},"dev-server:status":c=>{if(i.current!==a)return;const h=Q(c.data);if(h?.status){const C=X(h);f(C),g([C])}},stopped:()=>{i.current},failed:()=>{i.current}},onReconnect:()=>{i.current===a&&L()},onError:()=>{i.current===a&&u(c=>c??o("devserver.lostConnection","Lost log stream connection."))}});return()=>{v()}},[e,L,m]),t.useEffect(()=>{if(s?.status!=="running"&&s?.status!=="starting")return;const n=setInterval(()=>{L()},Sr);return()=>{clearInterval(n)}},[L,s?.status]);const _=t.useCallback(async(n,a)=>{i.current+=1;const v=i.current;try{let c;if(m&&typeof q(()=>Ne)=="function")c=await Ne(m,e);else{const h=await Le({command:n,cwd:a},e);c=X(h)}if(i.current!==v)return;f(c),u(null)}catch(c){if(i.current!==v)return;throw u(W(c)),c}},[e,m]),j=t.useCallback(async()=>{i.current+=1;const n=i.current;try{let a;if(m&&typeof q(()=>ke)=="function")a=await ke(m,e);else{const v=await kr(e);a=X(v)}if(i.current!==n)return;f(a),u(null)}catch(a){if(i.current!==n)return;throw u(W(a)),a}},[e,m]),B=t.useCallback(async()=>{i.current+=1;const n=i.current;try{let a;if(m&&typeof q(()=>Ce)=="function")a=await Ce(m,e);else{const v=await Cr(e);a=X(v)}if(i.current!==n)return;f(a),u(null)}catch(a){if(i.current!==n)return;throw u(W(a)),a}},[e,m]),P=t.useCallback(async n=>{i.current+=1;const a=i.current;try{let v;if(m&&typeof q(()=>je)=="function")v=await je(m,n,e);else{const c=await nr({url:n},e);v={url:c.manualUrl??c.previewUrl??c.detectedUrl??null,source:c.manualUrl?"manual":"auto"}}if(i.current!==a)return;f(c=>c?{...c,previewUrl:v.url??void 0}:null),u(null)}catch(v){if(i.current!==a)return;throw u(W(v)),v}},[e,m]),V=t.useCallback(async()=>{i.current+=1;const n=i.current;try{let a;try{a=await ce(e)}catch{a=(await Re(e)).map(c=>({name:c.name,command:c.command,cwd:c.cwd,scriptName:c.scriptName,packagePath:c.packagePath}))}if(i.current!==n)return;S(a),u(null)}catch(a){if(i.current!==n)return;throw u(W(a)),a}},[e]),l=t.useCallback(async(n,a)=>{if(typeof n!="string"&&!m)try{const h=n,C=await Le({command:h.command,cwd:h.cwd,scriptName:h.scriptName,packagePath:h.packagePath??h.cwd},e),R=X(C);f(R),g([R]),u(null);return}catch(h){throw u(W(h)),h}const v=typeof n=="string"?n:n.command,c=typeof n=="string"?a:n.cwd;await _(v,c)},[e,_,m]),D=t.useCallback(async()=>{await j()},[j]),U=t.useCallback(async()=>{await B()},[B]),F=t.useCallback(async n=>{await P(n)},[P]),O=t.useCallback(async()=>{await V()},[V]),$=t.useCallback(async()=>{await L()},[L]),k=Nr(s),w=s?{...s,pid:s.runtime?.pid}:null;return{session:s,sessions:b,logs:x,detectedCommands:E,previewUrl:k,isLoading:z,error:y,startServer:_,stopServer:j,restartServer:B,setPreviewUrl:P,detectCommands:V,refresh:L,candidates:E,serverState:w,loading:z,start:l,stop:D,restart:U,setManualUrl:F,detect:O,refreshStatus:$}}const De=500,_e=100;function $e(e){return e.length>De?e.slice(-De):e}function Be(e){return e==="stderr"?"stderr":"stdout"}function re(e){try{return JSON.parse(e.data)}catch{return null}}function te(e,o){return{id:typeof e.id=="number"&&Number.isFinite(e.id)?e.id:o,text:typeof e.text=="string"?e.text:"",stream:Be(e.stream),timestamp:typeof e.timestamp=="string"?e.timestamp:""}}function Er(e,o){return{id:o,text:e,stream:"stdout",timestamp:""}}function me(e,o){if(o.length===0)return e;const s=[...e],f=new Set(e.map(b=>b.id));for(const b of o)f.has(b.id)||(f.add(b.id),s.push(b));return s.sort((b,g)=>b.id-g.id),$e(s)}function Lr(e,o){const[s,f]=t.useState([]),[b,g]=t.useState(!1),[x,d]=t.useState(!1),[E,S]=t.useState(!1),[z,N]=t.useState(null),y=t.useRef(null),u=t.useRef(!1),i=t.useRef(0),m=t.useRef(0),M=t.useRef(e),A=t.useRef(o),L=t.useRef(0),_=t.useRef(1);(M.current!==e||A.current!==o)&&(M.current=e,A.current=o,i.current++,Y({view:"useDevServerLogs",trigger:"project-context-change",projectId:e,replayAttempted:!1,reason:"context-version-bumped"}),u.current=!0,L.current=0,_.current=1,f([]),g(!1),d(!1),S(!1),N(null),y.current&&(y.current(),y.current=null)),t.useEffect(()=>{if(!o){y.current&&(y.current(),y.current=null);return}const l=i.current,D=++m.current;u.current=!1,g(!0);const U=(k,w)=>{const n=$e(k);f(n),N(w),S(w!==null?w>n.length:!1);const a=n.length>0?n[n.length-1].id:0;L.current=a,_.current=a+1},F=k=>{if(u.current||i.current!==l||!k||typeof k!="object")return;const w=k.lines;if(!Array.isArray(w))return;if(w.length>0&&typeof w[0]=="string"){const a=w.filter(v=>typeof v=="string").map((v,c)=>Er(v,c+1));U(a,a.length);return}const n=w.filter(a=>!!a&&typeof a=="object").map((a,v)=>te(a,v+1));U(n,n.length)},O=k=>{if(u.current||i.current!==l)return;const w=typeof k.text=="string"?k.text:typeof k.line=="string"?k.line:null;if(!w)return;const n=_.current,a=typeof k.id=="number"&&Number.isFinite(k.id)?k.id:n,v={id:a,text:w,stream:Be(k.stream),timestamp:typeof k.timestamp=="string"?k.timestamp:""};L.current=Math.max(L.current,a),_.current=Math.max(_.current,a+1),f(c=>me(c,[v])),N(c=>c===null?c:Math.max(c+1,v.id))};async function $(){try{const w=await de({maxLines:_e},e);if(u.current||i.current!==l||m.current!==D)return;const n=w.lines.map((a,v)=>te(a,v+1));U(n,w.totalLines)}catch{if(u.current||i.current!==l||m.current!==D)return;U([],null)}finally{!u.current&&i.current===l&&m.current===D&&g(!1)}const k=he(e);y.current=Te(k,{events:{"dev-server:log":w=>{const n=re(w);n&&O(n)},log:w=>{const n=re(w);n&&O(n)},history:w=>{const n=re(w);F(n)},"dev-server:history":w=>{const n=re(w);F(n)}},onReconnect:()=>{Y({view:"useDevServerLogs",trigger:"sse-reconnect",projectId:e,replayAttempted:!0,replayFromEventId:L.current??null,sseChannel:k,reason:"history-replay"}),!(u.current||i.current!==l)&&de({lastEventId:L.current,maxLines:50},e).then(w=>{if(u.current||i.current!==l)return;const n=w.lines.map((a,v)=>te(a,_.current+v));if(n.length>0){const a=n[n.length-1].id;L.current=Math.max(L.current,a),_.current=Math.max(_.current,a+1)}f(a=>me(a,n)),N(w.totalLines)}).catch(()=>{})}}),Y({view:"useDevServerLogs",trigger:"sse-open",projectId:e,replayAttempted:!1,sseChannel:k})}return $(),()=>{u.current=!0,y.current&&(y.current(),y.current=null)}},[o,e]);const B=t.useCallback(async()=>{if(!o||x)return;const l=i.current,D=s.length;d(!0);try{const U=await de({maxLines:_e,offset:D},e);if(u.current||i.current!==l)return;const F=U.lines.map((O,$)=>te(O,$+1));f(O=>me(F,O)),S(U.totalLines>D+F.length),N(U.totalLines)}catch{}finally{d(!1)}},[o,s.length,x,e]),P=t.useCallback(()=>{f([])},[]),V=y.current!==null&&!b&&!u.current;return{entries:s,loading:b,loadingMore:x,hasMore:E,total:z,loadMore:B,clear:P,logs:s,isStreaming:V,clearLogs:P}}const Rr="This preview appears to block iframe embedding. Open it in a new tab instead.",Dr="The preview URL could not be loaded. Verify the server is running and the URL is correct.",_r="Preview is taking longer than expected and may block iframe embedding.";function Ur(e){return e==="blocked"?Rr:e==="error"?Dr:null}function Ar(e,o={}){const{loadTimeoutMs:s=1e4,detectionMethod:f=null}=o,b=t.useRef(null),g=t.useRef(null),[x,d]=t.useState("unknown"),[E,S]=t.useState(null),[z]=t.useState(f),N=t.useCallback(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),y=t.useCallback(j=>{d(j),S(Ur(j))},[]),u=t.useCallback(()=>{d("blocked"),S(_r)},[]);t.useEffect(()=>{if(N(),!e){d("unknown"),S(null);return}d("unknown"),S(null);let j=!1;return queueMicrotask(()=>{j||(d("loading"),S(null))}),()=>{j=!0,N()}},[N,e]),t.useEffect(()=>{if(x!=="loading"){N();return}const j=setTimeout(()=>{g.current=null,u()},s);return g.current=j,()=>{clearTimeout(j),g.current===j&&(g.current=null)}},[N,x,s,u]);const i=t.useCallback(()=>{const j=b.current;if(!j){y("embedded");return}try{if(j.contentWindow?.location?.href==="about:blank"&&j.src!=="about:blank"){y("blocked");return}}catch{}y("embedded")},[y]),m=t.useCallback(()=>{y("error")},[y]);t.useEffect(()=>{if(N(),!e){d("unknown"),S(null);return}d("unknown"),S(null)},[N]);const M=t.useCallback(()=>{N(),d("unknown"),S(null)},[N]),A=M,L=t.useMemo(()=>x==="embedded",[x]),_=t.useMemo(()=>x==="blocked"||x==="error",[x]);return{embedStatus:x,isEmbedded:L,isBlocked:_,blockReason:E,detectionMethod:z,iframeRef:b,resetEmbedStatus:M,setEmbedStatus:y,retry:A,embedContext:E,handleIframeLoad:i,handleIframeError:m}}const Mr=/\x1b\[[0-9;]*m/g;function be(e){return e.replace(Mr,"")}function Pr(e){if(!e)return"";const o=new Date(e);return Number.isNaN(o.getTime())?"":o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Tr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zr(e){if(e.stream==="stderr")return"error";const o=be(e.text).toLowerCase();return/\b(warn|warning)\b/.test(o)?"warn":/\b(error|fatal)\b/.test(o)?"error":"info"}function Fr(e,o){if(!o)return e;const s=new RegExp(`(${Tr(o)})`,"ig"),f=e.split(s),b=o.toLowerCase();return r.jsx(r.Fragment,{children:f.map((g,x)=>g.toLowerCase()===b?r.jsx("mark",{children:g},`${g}-${x}`):r.jsx("span",{children:g},`${g}-${x}`))})}function Or({entries:e,loading:o,loadingMore:s,hasMore:f,total:b,onLoadMore:g,isRunning:x}){const{t:d}=ne("app"),E=t.useRef(null),S=t.useRef(e.length),z=t.useRef(x),[N,y]=t.useState(!1),[u,i]=t.useState(!1),[m,M]=t.useState(""),[A,L]=t.useState("all"),_=t.useMemo(()=>A==="all"?e:e.filter(l=>zr(l)===A),[e,A]),j=t.useMemo(()=>{const l=m.trim().toLowerCase();return l?_.filter(D=>be(D.text).toLowerCase().includes(l)):_},[_,m]),B=j.length,P=t.useCallback(()=>{const l=E.current;l&&(l.scrollTop=l.scrollHeight,i(!1))},[]);t.useEffect(()=>{const l=z.current,D=S.current,U=e.length>D;x&&(!l||!u&&U)&&P(),z.current=x,S.current=e.length},[e.length,x,u,P]);const V=t.useCallback(()=>{const l=E.current;if(!l)return;const U=l.scrollTop+l.clientHeight>=l.scrollHeight-50;i(!U)},[]);return t.useEffect(()=>{o||e.length===0||!u&&x&&P()},[e,x,u,o,P]),o&&e.length===0?r.jsx("section",{className:"devserver-log-viewer","data-testid":"devserver-log-viewer",children:r.jsxs("div",{className:"devserver-log-viewer__loading","data-testid":"devserver-log-loading",children:[r.jsx(se,{size:16,className:"devserver-log-viewer__spinner"}),r.jsx("span",{children:d("devserver.loadingLogs","Loading logs…")})]})}):r.jsxs("section",{className:`devserver-log-viewer${N?" devserver-log-viewer--fullscreen":""}`,"data-testid":"devserver-log-viewer",children:[r.jsxs("header",{className:"devserver-log-viewer__toolbar",children:[r.jsxs("div",{className:"devserver-log-viewer__toolbar-meta",children:[r.jsx("span",{className:"devserver-log-viewer__title",children:d("devserver.logs","Logs")}),r.jsxs("span",{className:"devserver-log-viewer__count","data-testid":"devserver-log-count",children:[b!==null?`${e.length}/${b}`:`${e.length}`," ",d("devserver.lines","lines")]})]}),r.jsxs("div",{className:"devserver-log-viewer__toolbar-actions",children:[r.jsxs("label",{className:"devserver-log-viewer__severity",htmlFor:"devserver-log-severity-filter",children:[r.jsx("span",{className:"visually-hidden",children:d("devserver.filterBySeverity","Filter logs by severity")}),r.jsxs("select",{id:"devserver-log-severity-filter",className:"select devserver-log-viewer__severity-select",value:A,onChange:l=>L(l.target.value),"data-testid":"devserver-log-severity-filter","aria-label":d("devserver.filterBySeverity","Filter logs by severity"),children:[r.jsx("option",{value:"all",children:d("devserver.allSeverities","All severities")}),r.jsx("option",{value:"info",children:d("devserver.info","Info")}),r.jsx("option",{value:"warn",children:d("devserver.warn","Warn")}),r.jsx("option",{value:"error",children:d("devserver.error","Error")})]})]}),r.jsxs("label",{className:"devserver-log-viewer__search",htmlFor:"devserver-log-search",children:[r.jsx("span",{className:"visually-hidden",children:d("devserver.searchLogs","Search logs")}),r.jsx(dr,{size:14}),r.jsx("input",{id:"devserver-log-search",className:"input devserver-log-viewer__search-input",type:"text",value:m,onChange:l=>M(l.target.value),placeholder:d("devserver.searchLogs","Search logs"),"data-testid":"devserver-log-search-input","aria-label":d("devserver.searchLogs","Search logs")})]}),m.trim().length>0&&r.jsx("span",{className:"devserver-log-viewer__matches","data-testid":"devserver-log-match-count",children:d("devserver.matchCount",{count:B,defaultValue_one:"{{count}} match",defaultValue_other:"{{count}} matches"})}),r.jsx("button",{type:"button",className:"btn btn-sm btn-icon",onClick:()=>y(l=>!l),"data-testid":"devserver-log-fullscreen-toggle","aria-label":N?d("devserver.exitFullscreen","Exit fullscreen logs"):d("devserver.enterFullscreen","Enter fullscreen logs"),children:N?r.jsx(vr,{size:14}):r.jsx(ur,{size:14})})]})]}),r.jsxs("div",{className:"devserver-log-viewer__body",children:[f&&r.jsx("div",{className:"devserver-log-viewer__load-more","data-testid":"devserver-log-load-more",children:r.jsx("button",{type:"button",className:"btn btn-sm touch-target",onClick:g,disabled:s,"data-testid":"devserver-log-load-more-button",children:s?r.jsxs(r.Fragment,{children:[r.jsx(se,{size:14,className:"devserver-log-viewer__spinner"}),d("devserver.loadingOlderLogs","Loading older logs…")]}):d("devserver.loadOlderLogs","Load older logs")})}),r.jsxs("div",{ref:E,className:"devserver-log-viewer__content",onScroll:V,"data-testid":"devserver-log-content",children:[!o&&j.length===0&&r.jsx("p",{className:"devserver-log-viewer__empty","data-testid":"devserver-log-empty",children:e.length===0?d("devserver.noLogsYet","No logs yet. Start the dev server to see output."):_.length===0?d("devserver.noMatchesSeverity","No log lines match the selected severity."):d("devserver.noMatchesSearch","No log lines match your search.")}),j.map(l=>{const D=be(l.text),U=Pr(l.timestamp);return r.jsxs("div",{className:"devserver-log-line",children:[U&&r.jsx("span",{className:"devserver-log-timestamp","data-testid":"devserver-log-timestamp",children:U}),l.stream==="stderr"&&r.jsx("span",{className:"devserver-log-stream-badge","data-testid":"devserver-log-stderr-badge",children:d("devserver.errBadge","ERR")}),r.jsx("span",{className:"devserver-log-text",children:mr(Fr(D,m.trim()))})]},l.id)})]}),u&&x&&r.jsxs("button",{type:"button",className:"btn btn-sm devserver-log-viewer__new-logs-button",onClick:P,"data-testid":"devserver-log-jump-button",children:[r.jsx(fr,{size:14}),d("devserver.newLogs","New logs")]})]})]})}const $r="devserver-preview-iframe";function Br({url:e,embedStatus:o,onEmbedStatusChange:s,iframeRef:f,blockReason:b,onRetry:g,className:x=$r,embedContext:d}){const{t:E}=ne("app"),S=b??d??null,[z,N]=t.useState(0);t.useEffect(()=>{!e||o!=="unknown"||(N(m=>m+1),s("loading"))},[o,s,e]);const y=t.useCallback(()=>{const m=f.current;if(!m){s("embedded");return}try{if(m.contentWindow?.location?.href==="about:blank"&&m.src!=="about:blank"){s("blocked");return}}catch{}s("embedded")},[f,s]),u=t.useCallback(m=>{m.stopPropagation(),s("error")},[s]),i=t.useCallback(()=>{e&&window.open(e,"_blank","noopener,noreferrer")},[e]);return e?r.jsxs("div",{className:"devserver-preview-iframe-shell",children:[r.jsx("iframe",{src:e,ref:f,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox",className:x,title:"Dev server preview",onLoad:y,onError:u,onErrorCapture:u,"data-testid":"devserver-preview-iframe"},`${e}-${z}`),o==="loading"&&r.jsxs("div",{className:"devserver-preview-overlay","data-testid":"devserver-preview-loading",children:[r.jsx(se,{size:16,className:"dev-server-spin"}),r.jsx("span",{children:E("preview.loading","Loading preview...")})]}),o==="blocked"&&r.jsxs("div",{className:"devserver-preview-blocked-panel",role:"alert","data-testid":"devserver-preview-blocked-panel",children:[r.jsx(Fe,{className:"devserver-preview-blocked-icon","aria-hidden":"true"}),r.jsxs("div",{children:[r.jsx("p",{className:"devserver-preview-blocked-title",children:E("preview.blockedTitle","Preview cannot be embedded")}),S&&r.jsx("p",{className:"devserver-preview-blocked-context",children:S})]}),r.jsx("p",{className:"devserver-preview-blocked-description",children:E("preview.blockedDescription","You can view the preview in a separate browser tab.")}),r.jsxs("div",{className:"devserver-preview-blocked-actions",children:[r.jsx("button",{type:"button",className:"btn btn-primary",onClick:i,children:E("preview.openInNewTab","Open in new tab")}),g&&r.jsx("button",{type:"button",className:"btn btn-sm",onClick:g,children:E("actions.retry","Retry")})]})]}),o==="error"&&r.jsxs("div",{className:"devserver-preview-error-panel",role:"alert","data-testid":"devserver-preview-error-panel",children:[r.jsx(ze,{className:"devserver-preview-blocked-icon","aria-hidden":"true"}),r.jsxs("div",{children:[r.jsx("p",{className:"devserver-preview-blocked-title",children:E("preview.errorTitle","Unable to load preview")}),S&&r.jsx("p",{className:"devserver-preview-blocked-context",children:S})]}),r.jsx("p",{className:"devserver-preview-blocked-description",children:E("preview.blockedDescription","You can view the preview in a separate browser tab.")}),r.jsxs("div",{className:"devserver-preview-blocked-actions",children:[r.jsx("button",{type:"button",className:"btn btn-primary",onClick:i,children:E("preview.openInNewTab","Open in new tab")}),g&&r.jsx("button",{type:"button",className:"btn btn-sm",onClick:g,children:E("actions.retry","Retry")})]})]})]}):null}function Hr(e){return{stopped:{className:"dev-server-status-badge--stopped",label:e("devserver.status.stopped","Stopped")},starting:{className:"dev-server-status-badge--starting",label:e("devserver.status.starting","Starting...")},running:{className:"dev-server-status-badge--running",label:e("devserver.status.running","Running")},stopping:{className:"dev-server-status-badge--starting",label:e("devserver.status.stopping","Stopping...")},failed:{className:"dev-server-status-badge--failed",label:e("devserver.status.failed","Failed")}}}let fe=!1;function Ue(e){return e instanceof Error?e.message:String(e)}function He(e){return e==="."?"root":e}function Ae(e){return e?e==="root"?".":e:null}function Me(e,o,s){return!o||e.scriptName!==o?!1:s?He(e.cwd)===s:!0}function Vr(e){return e.cwd==="."?"root":e.cwd}function Wr(e){return e.length<=60?e:`${e.slice(0,60)}…`}function Kr({addToast:e,projectId:o}){const{t:s}=ne("app");t.useEffect(()=>(Y({view:"DevServerView",trigger:fe?"route-active":"remount",projectId:o,replayAttempted:!1}),fe=!1,()=>{fe=!0,Y({view:"DevServerView",trigger:"route-inactive",projectId:o,replayAttempted:!1})}),[o]);const{session:f,detectedCommands:b,previewUrl:g,isLoading:x,error:d,startServer:E,stopServer:S,restartServer:z,setPreviewUrl:N,detectCommands:y,refresh:u}=jr(o),i=f?.status??"stopped",m=i==="running"||i==="starting",M=Hr(s),A=M[i]??M.stopped,{entries:L,loading:_,loadingMore:j,hasMore:B,total:P,loadMore:V}=Lr(o,!!o),l=g,D=f?.config?.cwd??null,[U,F]=t.useState(!0),[O,$]=t.useState(""),[k,w]=t.useState(""),[n,a]=t.useState(null),[v,c]=t.useState(null),[h,C]=t.useState("embedded"),R=h==="embedded"?l:null,{embedStatus:H,setEmbedStatus:Ve,resetEmbedStatus:G,iframeRef:J,isEmbedded:We,isBlocked:ae,blockReason:ie,retry:we}=Ar(R),[xe,I]=t.useState(!1),ye=t.useRef(H);t.useEffect(()=>{const p=ye.current!==H;ae&&p&&I(!0),H==="embedded"&&I(!1),ye.current=H},[H,ae]),t.useEffect(()=>{I(!1)},[l]);const K=t.useMemo(()=>{if(!n)return null;const p=Ae(D);return b.find(T=>!(T.scriptName!==n||p&&T.cwd!==p||f?.config?.command&&T.command!==f.config.command))??b.find(T=>Me(T,n,D))??null},[b,f?.config?.command,n,D]);t.useEffect(()=>{typeof y=="function"&&y().catch(p=>{e(Ue(p),"error")})},[e,y]),t.useEffect(()=>{if(n){F(!1);return}F(!0)},[n]),t.useEffect(()=>{if(f?.status==="running"||f?.status==="starting"){f.config?.command?.trim().length>0&&$(f.config.command);return}if(K){$(K.command);return}b.length>0&&$(p=>p.trim().length>0?p:b[0]?.command??"")},[b,K,f?.config?.command,f?.status]),t.useEffect(()=>{w(l??"")},[l]);const le=t.useCallback(()=>{l&&window.open(l,"_blank","noopener,noreferrer")},[l]),Se=t.useCallback(()=>{I(!1),we()},[we]),qe=t.useCallback(()=>{try{const p=J.current;if(p?.contentWindow){p.contentWindow.location.reload(),I(!1),G();return}}catch{}if(!(!l||!J.current))try{const p=new URL(l);p.searchParams.set("_t",Date.now().toString()),J.current.src=p.toString(),I(!1),G()}catch{J.current.src=l,I(!1),G()}},[l,J,G]),Z=t.useCallback(async(p,T,oe)=>{c(p);try{await T(),e(oe,"success")}catch(tr){e(Ue(tr),"error")}finally{c(null)}},[e]),Ie=t.useCallback(p=>{a(p.scriptName),F(!1),$(p.command),e(s("devserver.toast.selectedScript","Selected {{name}} script.",{name:p.scriptName}),"success")},[e]),Xe=t.useCallback(()=>{a(null),F(!0),e(s("devserver.toast.clearedScript","Cleared selected dev server script."),"success")},[e]),Je=()=>{const p=O.trim();if(p.length===0){e(s("devserver.toast.enterCommand","Enter a command before starting the dev server."),"warning");return}const T=Ae(D)??".",oe=K?.cwd??T;Z("start",()=>E(p,oe),s("devserver.toast.started","Dev server started."))},Qe=()=>{Z("stop",S,s("devserver.toast.stopped","Dev server stopped."))},Ye=()=>{Z("restart",z,s("devserver.toast.restarted","Dev server restarted."))},Ge=()=>{const p=k.trim(),T=p.length>0?p:null;Z("preview",()=>N(T),T?s("devserver.toast.previewUpdated","Preview URL updated."):s("devserver.toast.previewCleared","Preview URL override cleared."))},Ke=t.useCallback(()=>{d&&u()},[d,u]),Ze=i==="starting"||i==="running"||v!==null,er=i==="stopped"||v!==null,rr=i==="stopped"||i==="starting"||v!==null;return r.jsxs("div",{className:"dev-server-view","data-testid":"dev-server-view",children:[r.jsxs("section",{className:"dev-server-header","aria-label":"Dev server controls header",children:[r.jsxs("div",{className:"dev-server-header-title",children:[r.jsx(pr,{size:16}),r.jsx("h2",{children:s("devserver.title","Dev Server")}),r.jsx("span",{className:`dev-server-status-badge ${A.className}`,"data-testid":"dev-server-status-badge",children:A.label})]}),r.jsxs("div",{className:"dev-server-header-actions",children:[r.jsxs("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Je,disabled:Ze,"data-testid":"dev-server-start-button",children:[r.jsx(hr,{size:14}),r.jsx("span",{children:v==="start"?s("devserver.starting","Starting..."):s("devserver.start","Start")})]}),r.jsxs("button",{type:"button",className:"btn btn-danger btn-sm",onClick:Qe,disabled:er,"data-testid":"dev-server-stop-button",children:[r.jsx(gr,{size:14}),r.jsx("span",{children:v==="stop"?s("devserver.stopping","Stopping..."):s("devserver.stop","Stop")})]}),r.jsxs("button",{type:"button",className:"btn btn-sm",onClick:Ye,disabled:rr,"data-testid":"dev-server-restart-button",children:[r.jsx(br,{size:14}),r.jsx("span",{children:v==="restart"?s("devserver.restarting","Restarting..."):s("devserver.restart","Restart")})]})]})]}),r.jsxs("section",{className:"dev-server-panel dev-server-config","aria-label":"Dev server configuration",children:[r.jsxs("div",{className:"dev-server-section-header",children:[r.jsx("h3",{children:s("devserver.configuration","Configuration")}),x&&r.jsx("span",{className:"dev-server-muted",children:s("devserver.loading","Loading...")})]}),x&&!f&&b.length===0&&r.jsxs("div",{className:"dev-server-loading-state","data-testid":"dev-server-loading-state",children:[r.jsx(se,{size:16,className:"dev-server-spin"}),r.jsx("span",{children:s("devserver.loadingConfig","Loading dev server configuration...")})]}),d&&r.jsxs("div",{className:"dev-server-error-box",role:"alert","data-testid":"dev-server-error-box",children:[r.jsx("p",{children:d}),r.jsx("button",{type:"button",className:"btn btn-sm",onClick:Ke,children:s("devserver.retry","Retry")})]}),r.jsxs("div",{className:"dev-server-section",children:[r.jsx("h3",{children:s("devserver.scriptSelection","Script Selection")}),n&&r.jsxs("div",{className:"dev-server-selected","data-testid":"dev-server-selected-summary",children:[r.jsx("span",{className:"dev-server-candidate-name",children:n}),r.jsx("span",{className:"dev-server-candidate-source",children:D??"root"}),r.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>F(!0),"data-testid":"dev-server-change-selection",children:s("devserver.change","Change")}),r.jsx("button",{type:"button",className:"btn btn-danger btn-sm",onClick:Xe,"data-testid":"dev-server-clear-selection",children:s("devserver.clear","Clear")})]}),U&&b.length===0&&r.jsx("p",{className:"dev-server-empty-state","data-testid":"dev-server-empty-candidates",children:s("devserver.noScriptsDetected","No dev server scripts detected. Check that your project has a package.json with a dev, start, or similar script.")}),U&&b.length>0&&r.jsx("div",{className:"dev-server-candidates","data-testid":"dev-server-candidates",children:b.map(p=>{const T=Me(p,n,D);return r.jsxs("button",{type:"button",className:`dev-server-candidate ${T?"dev-server-candidate--selected":""}`,onClick:()=>Ie(p),"data-testid":`dev-server-candidate-${p.scriptName}-${He(p.cwd)}`,children:[r.jsx("span",{className:"dev-server-candidate-name",children:p.scriptName}),r.jsx("span",{className:"dev-server-candidate-command",children:Wr(p.command)}),r.jsx("span",{className:"dev-server-candidate-source",children:Vr(p)})]},`${p.cwd}::${p.scriptName}::${p.command}`)})})]}),r.jsxs("div",{className:"dev-server-field-group",children:[r.jsx("label",{htmlFor:"dev-server-command",className:"dev-server-label",children:s("devserver.command","Command")}),r.jsx("input",{id:"dev-server-command",className:"input",value:O,onChange:p=>$(p.target.value),placeholder:"pnpm dev","data-testid":"dev-server-command-input",readOnly:i==="running"||i==="starting"})]}),(i==="running"||i==="starting")&&f&&r.jsxs("div",{className:"dev-server-current-command","data-testid":"dev-server-current-command",children:[r.jsx("span",{className:"dev-server-label",children:s("devserver.runningCommand","Running command")}),r.jsx("code",{children:f.config?.command??O})]}),r.jsxs("div",{className:"dev-server-preview-override",children:[r.jsx("label",{htmlFor:"dev-server-preview-input",className:"dev-server-label",children:s("devserver.previewUrlOverride","Preview URL Override")}),r.jsx("input",{id:"dev-server-preview-input",className:"input",type:"url",value:k,onChange:p=>w(p.target.value),placeholder:"http://localhost:3000","data-testid":"dev-server-preview-input"}),r.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Ge,disabled:v==="preview","data-testid":"dev-server-set-preview",children:s("devserver.save","Save")})]}),l&&r.jsx("p",{className:"dev-server-preview-hint",children:s("devserver.autoDetected","Auto-detected: {{url}}",{url:l})})]}),r.jsx("div",{className:"dev-server-content",children:r.jsxs("section",{className:"dev-server-panel dev-server-logs-panel","data-testid":"dev-server-logs-panel","aria-label":"Dev server logs",children:[r.jsxs("div",{className:"dev-server-section-header",children:[r.jsx("h3",{children:s("devserver.logs","Logs")}),r.jsx("span",{className:"dev-server-muted",children:s("devserver.lines","{{count}} lines",{count:P??L.length})})]}),r.jsx("div",{className:"dev-server-logs-viewer","data-testid":"dev-server-log-viewer",children:r.jsx(Or,{entries:L,loading:_,loadingMore:j,hasMore:B,total:P,onLoadMore:V,isRunning:m})})]})}),r.jsxs("section",{className:"dev-server-panel devserver-preview-panel","data-testid":"devserver-preview-panel","aria-label":"Dev server preview",children:[r.jsxs("div",{className:"devserver-preview-header",children:[r.jsxs("div",{className:"devserver-preview-title",children:[r.jsx(wr,{size:14}),r.jsx("span",{children:s("devserver.preview","Preview")})]}),r.jsxs("span",{className:"devserver-preview-url-badge devserver-preview-url-badge--auto",title:l??s("devserver.noPreviewUrl","No preview URL"),"data-testid":"devserver-preview-url-badge",children:[s("devserver.auto","Auto"),l?` · ${l}`:s("devserver.notAvailable"," · Not available")]}),r.jsxs("div",{className:"devserver-preview-actions",children:[r.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>C(p=>p==="embedded"?"external":"embedded"),"data-testid":"devserver-preview-mode-toggle",children:h==="embedded"?s("devserver.externalOnly","External only"):s("devserver.embedded","Embedded")}),r.jsx("button",{type:"button",className:"btn btn-sm btn-icon",title:s("devserver.openInNewTab","Open in new tab"),onClick:le,disabled:!l,"data-testid":"devserver-preview-open-tab",children:r.jsx(xr,{})}),r.jsx("button",{type:"button",className:"btn btn-sm btn-icon",title:s("devserver.refreshPreview","Refresh preview"),onClick:qe,disabled:!l,"data-testid":"devserver-preview-refresh",children:r.jsx(yr,{})})]})]}),r.jsxs("div",{className:"devserver-preview-container","data-embed-status":H,"data-embedded":We?"true":"false",children:[!l&&!m&&r.jsx("p",{className:"devserver-preview-empty",children:s("devserver.startDevServer","Start a dev server to see a live preview here.")}),!l&&m&&r.jsx("p",{className:"devserver-preview-empty",children:s("devserver.noPreviewDetected","No preview URL detected. Start the dev server or set a manual URL to preview your app.")}),l&&h==="external"&&r.jsxs("div",{className:"devserver-preview-external-only","data-testid":"devserver-preview-external-only",children:[r.jsx("p",{children:s("devserver.embeddedPreviewDisabled","Embedded preview is disabled. Open your app in a separate browser tab.")}),r.jsx("button",{type:"button",className:"btn btn-primary btn-sm touch-target",onClick:le,"data-testid":"devserver-preview-external-open-tab",children:s("devserver.openInNewTab","Open in new tab")})]}),l&&h==="embedded"&&xe&&ae&&r.jsxs("div",{className:H==="error"?"devserver-preview-error-panel":"devserver-preview-blocked-panel","data-testid":"devserver-preview-fallback",role:"alert",children:[H==="error"?r.jsx(ze,{className:"devserver-preview-blocked-icon","aria-hidden":"true"}):r.jsx(Fe,{className:"devserver-preview-blocked-icon","aria-hidden":"true"}),r.jsxs("div",{children:[r.jsx("p",{className:"devserver-preview-blocked-title",children:H==="error"?s("devserver.previewFailed","Preview failed"):s("devserver.previewBlocked","Preview blocked")}),ie&&r.jsx("p",{className:"devserver-preview-blocked-context",children:ie})]}),r.jsx("p",{className:"devserver-preview-blocked-description",children:s("devserver.openPreviewOrRetry","Open the preview in a new tab, or retry embedded mode after checking your server settings.")}),r.jsxs("div",{className:"devserver-preview-blocked-actions",children:[r.jsx("button",{type:"button",className:"btn btn-primary",onClick:le,"data-testid":"devserver-preview-fallback-open-tab",children:s("devserver.openPreviewInNewTab","Open preview in new tab")}),r.jsx("button",{type:"button",className:"btn btn-sm",onClick:Se,"data-testid":"devserver-preview-fallback-retry",children:s("devserver.retryEmbeddedPreview","Retry embedded preview")})]})]}),l&&h==="embedded"&&!xe&&r.jsx(Br,{url:l,embedStatus:H,onEmbedStatusChange:Ve,iframeRef:J,blockReason:ie,onRetry:Se})]})]})]})}export{Kr as DevServerView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.directory-picker{display:flex;flex-direction:column;gap:var(--space-sm)}.directory-picker-input-row{display:flex;gap:var(--space-sm)}.directory-picker-input{flex:1;min-width:0}.directory-picker-browse-btn{flex-shrink:0;white-space:nowrap}.directory-picker-browser{display:flex;flex-direction:column;background:var(--card);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;animation:fadeIn var(--transition-fast)}.directory-picker-breadcrumbs{display:flex;align-items:center;gap:var(--space-xs);padding:var(--space-sm) var(--space-md);background:var(--surface);border-bottom:1px solid var(--border);overflow-x:auto;white-space:nowrap}.directory-picker-breadcrumb{background:none;border:none;padding:var(--space-xs);border-radius:var(--radius-sm);color:var(--todo);cursor:pointer;font-family:var(--font-mono)}.directory-picker-breadcrumb:hover{background:var(--card-hover);text-decoration:underline}.directory-picker-breadcrumb:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-breadcrumb-item{display:inline-flex;align-items:center}.directory-picker-breadcrumb-sep{color:var(--text-dim);flex-shrink:0}.directory-picker-toolbar{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-xs) var(--space-md);border-bottom:1px solid var(--border)}.directory-picker-up-btn,.directory-picker-hidden-toggle{color:var(--text-muted)}.directory-picker-up-btn:hover,.directory-picker-hidden-toggle:hover{color:var(--text)}.directory-picker-up-btn:focus-visible,.directory-picker-hidden-toggle:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-entries{max-height:calc(var(--space-2xl) * 8);overflow-y:auto;padding:var(--space-xs) 0}.directory-picker-entry{display:flex;align-items:center;gap:var(--space-sm);width:100%;padding:var(--space-xs) var(--space-md);background:none;border:none;color:var(--text);cursor:pointer;text-align:left;transition:background-color var(--transition-fast)}.directory-picker-entry:hover{background:var(--card-hover)}.directory-picker-entry:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-entry-icon{color:var(--todo);flex-shrink:0}.directory-picker-entry-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.directory-picker-entry-arrow{color:var(--text-dim);flex-shrink:0}.directory-picker-loading,.directory-picker-empty{display:flex;align-items:center;justify-content:center;gap:var(--space-sm);padding:var(--space-xl);color:var(--text-muted)}.directory-picker-error{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-md);margin:var(--space-sm) var(--space-md);background:color-mix(in srgb,var(--color-error) 10%,transparent);border:1px solid var(--color-error);border-radius:var(--radius-md);color:var(--color-error)}.directory-picker-actions{display:flex;align-items:center;justify-content:space-between;gap:var(--space-md);padding:var(--space-sm) var(--space-md);border-top:1px solid var(--border);background:var(--surface)}.directory-picker-selected-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);color:var(--text-muted)}.directory-picker-select-btn{flex-shrink:0;padding:var(--space-sm) var(--space-lg)}.directory-picker-create-folder-toggle{color:var(--text-muted)}.directory-picker-create-folder-toggle:hover{color:var(--text)}.directory-picker-create-folder-toggle:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-create-folder{display:flex;flex-direction:column;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);border-top:1px solid var(--border);background:var(--surface)}.directory-picker-create-folder-input{width:100%}.directory-picker-create-folder-actions{display:flex;gap:var(--space-sm)}.directory-picker-create-folder-error{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm);background:color-mix(in srgb,var(--color-error) 10%,transparent);border:1px solid var(--color-error);border-radius:var(--radius-md);color:var(--color-error);font-size
|
|
1
|
+
.directory-picker{display:flex;flex-direction:column;gap:var(--space-sm)}.directory-picker-input-row{display:flex;gap:var(--space-sm)}.directory-picker-input{flex:1;min-width:0}.directory-picker-browse-btn{flex-shrink:0;white-space:nowrap}.directory-picker-browser{display:flex;flex-direction:column;background:var(--card);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;animation:fadeIn var(--transition-fast)}.directory-picker-breadcrumbs{display:flex;align-items:center;gap:var(--space-xs);padding:var(--space-sm) var(--space-md);background:var(--surface);border-bottom:1px solid var(--border);overflow-x:auto;white-space:nowrap}.directory-picker-breadcrumb{background:none;border:none;padding:var(--space-xs);border-radius:var(--radius-sm);color:var(--todo);cursor:pointer;font-family:var(--font-mono)}.directory-picker-breadcrumb:hover{background:var(--card-hover);text-decoration:underline}.directory-picker-breadcrumb:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-breadcrumb-item{display:inline-flex;align-items:center}.directory-picker-breadcrumb-sep{color:var(--text-dim);flex-shrink:0}.directory-picker-toolbar{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-xs) var(--space-md);border-bottom:1px solid var(--border)}.directory-picker-up-btn,.directory-picker-hidden-toggle{color:var(--text-muted)}.directory-picker-up-btn:hover,.directory-picker-hidden-toggle:hover{color:var(--text)}.directory-picker-up-btn:focus-visible,.directory-picker-hidden-toggle:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-entries{max-height:calc(var(--space-2xl) * 8);overflow-y:auto;padding:var(--space-xs) 0}.directory-picker-entry{display:flex;align-items:center;gap:var(--space-sm);width:100%;padding:var(--space-xs) var(--space-md);background:none;border:none;color:var(--text);cursor:pointer;text-align:left;transition:background-color var(--transition-fast)}.directory-picker-entry:hover{background:var(--card-hover)}.directory-picker-entry:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-entry-icon{color:var(--todo);flex-shrink:0}.directory-picker-entry-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.directory-picker-entry-arrow{color:var(--text-dim);flex-shrink:0}.directory-picker-loading,.directory-picker-empty{display:flex;align-items:center;justify-content:center;gap:var(--space-sm);padding:var(--space-xl);color:var(--text-muted)}.directory-picker-error{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-md);margin:var(--space-sm) var(--space-md);background:color-mix(in srgb,var(--color-error) 10%,transparent);border:1px solid var(--color-error);border-radius:var(--radius-md);color:var(--color-error)}.directory-picker-actions{display:flex;align-items:center;justify-content:space-between;gap:var(--space-md);padding:var(--space-sm) var(--space-md);border-top:1px solid var(--border);background:var(--surface)}.directory-picker-selected-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);color:var(--text-muted)}.directory-picker-select-btn{flex-shrink:0;padding:var(--space-sm) var(--space-lg)}.directory-picker-create-folder-toggle{color:var(--text-muted)}.directory-picker-create-folder-toggle:hover{color:var(--text)}.directory-picker-create-folder-toggle:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.directory-picker-create-folder{display:flex;flex-direction:column;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);border-top:1px solid var(--border);background:var(--surface)}.directory-picker-create-folder-input{width:100%}.directory-picker-create-folder-actions{display:flex;gap:var(--space-sm)}.directory-picker-create-folder-error{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm);background:color-mix(in srgb,var(--color-error) 10%,transparent);border:1px solid var(--color-error);border-radius:var(--radius-md);color:var(--color-error);font-size:.875rem}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as r}from"./vendor-react-
|
|
1
|
+
import{r as n,j as r}from"./vendor-react-BTgM5bbZ.js";import{de as v,df as z,dg as D,dh as x,b as j,al as S,ag as T,ah as B,J as A,L,aA as w}from"./index-Bglw05rM.js";import{u as K}from"./vendor-i18n-DYlSUfot.js";import{F as R}from"./folder-open-33WGVnbp.js";function q({value:p,onChange:u,placeholder:f,onInputKeyDown:N,nodeId:b,localNodeId:k}){const{t:i}=K("app"),[e,s]=n.useState({isOpen:!1,loading:!1,error:null,currentPath:"",parentPath:null,entries:[],showHidden:!1,createFolderOpen:!1,createFolderError:null}),[l,h]=n.useState(""),o=n.useCallback(async(t,c=!1)=>{s(d=>({...d,loading:!0,error:null}));try{const d=await v(t,c,b,k);s(a=>({...a,loading:!1,currentPath:d.currentPath,parentPath:d.parentPath,entries:d.entries}))}catch(d){s(a=>({...a,loading:!1,error:d instanceof Error?d.message:"Failed to browse directory"}))}},[b,k]),g=n.useCallback(()=>{s(t=>t.isOpen?{...t,isOpen:!1}:{...t,isOpen:!0})},[]);n.useEffect(()=>{e.isOpen&&!e.loading&&!e.currentPath&&!e.error&&o(p||void 0,e.showHidden)},[e.isOpen,e.loading,e.currentPath,e.error,p,e.showHidden,o,b,k]);const m=n.useCallback(t=>{o(t,e.showHidden)},[o,e.showHidden]),F=n.useCallback(()=>{u(e.currentPath),s(t=>({...t,isOpen:!1}))},[e.currentPath,u]),C=n.useCallback(()=>{s(t=>{const c=!t.showHidden;return{...t,showHidden:c}})},[]);n.useEffect(()=>{e.isOpen&&e.currentPath&&o(e.currentPath,e.showHidden)},[e.showHidden,o]);const P=n.useCallback(()=>{s(t=>({...t,createFolderOpen:!t.createFolderOpen,createFolderError:null})),h("")},[]),y=n.useCallback(async()=>{if(!l.trim()||!e.currentPath)return;const t=l.trim();if(t.includes("/")||t.includes("\\")||t.includes("..")){s(a=>({...a,createFolderError:i("dirPicker.createFolderError","Folder name cannot contain path separators or '..'")}));return}const c=e.currentPath.includes("\\")?"\\":"/",d=e.currentPath.endsWith(c)?e.currentPath+t:e.currentPath+c+t;s(a=>({...a,loading:!0,createFolderError:null}));try{await z(d),h(""),s(a=>({...a,createFolderOpen:!1})),await o(e.currentPath,e.showHidden)}catch(a){s(O=>({...O,loading:!1,createFolderError:a instanceof Error?a.message:"Failed to create folder"}))}},[l,e.currentPath,e.showHidden,o]),H=n.useCallback(t=>{t.key==="Enter"?(t.preventDefault(),y()):t.key==="Escape"&&(s(c=>({...c,createFolderOpen:!1,createFolderError:null})),h(""))},[y]),E=e.currentPath?D(e.currentPath):[];return r.jsxs("div",{className:"directory-picker",children:[r.jsxs("div",{className:"directory-picker-input-row",children:[r.jsx("input",{type:"text",className:"input directory-picker-input",value:p,onChange:t=>u(t.target.value),onKeyDown:N,placeholder:f||i("dirPicker.defaultPlaceholder","/path/to/your/project")}),r.jsxs("button",{type:"button",className:"btn btn-secondary btn-sm directory-picker-browse-btn",onClick:g,"aria-label":e.isOpen?i("dirPicker.closeBrowser","Close directory browser"):i("dirPicker.openBrowser","Browse directories"),children:[e.isOpen?r.jsx(R,{size:16}):r.jsx(x,{size:16}),r.jsx("span",{children:i("dirPicker.browse","Browse")})]})]}),e.isOpen&&r.jsxs("div",{className:"directory-picker-browser",role:"tree","aria-label":i("dirPicker.ariaLabel","Directory browser"),children:[r.jsx("div",{className:"directory-picker-breadcrumbs",children:E.map((t,c)=>r.jsxs("span",{className:"directory-picker-breadcrumb-item",children:[c>0&&r.jsx(j,{size:12,className:"directory-picker-breadcrumb-sep"}),r.jsx("button",{type:"button",className:"directory-picker-breadcrumb",onClick:()=>m(t.path),title:t.path,children:t.label})]},t.path))}),r.jsxs("div",{className:"directory-picker-toolbar",children:[e.parentPath&&r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-up-btn",onClick:()=>m(e.parentPath),"aria-label":i("dirPicker.parentDir","Go to parent directory"),title:i("dirPicker.parentDirTitle","Parent directory"),children:[r.jsx(S,{size:14}),r.jsx("span",{children:i("dirPicker.up","Up")})]}),r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-hidden-toggle",onClick:C,"aria-label":e.showHidden?i("dirPicker.hideHiddenAria","Hide hidden directories"):i("dirPicker.showHiddenAria","Show hidden directories"),title:e.showHidden?i("dirPicker.hideHiddenTitle","Hide hidden"):i("dirPicker.showHiddenTitle","Show hidden"),children:[e.showHidden?r.jsx(T,{size:14}):r.jsx(B,{size:14}),r.jsx("span",{children:e.showHidden?i("dirPicker.hideHidden","Hide hidden"):i("dirPicker.showHidden","Show hidden")})]}),r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-create-folder-toggle",onClick:P,"aria-label":i("dirPicker.createFolderAria","Create new folder"),title:i("dirPicker.createFolderTitle","Create folder"),children:[r.jsx(A,{size:14}),r.jsx("span",{children:i("dirPicker.createFolder","New folder")})]})]}),e.loading?r.jsxs("div",{className:"directory-picker-loading",children:[r.jsx(L,{size:20,className:"animate-spin"}),r.jsx("span",{children:i("dirPicker.loading","Loading…")})]}):e.error?r.jsxs("div",{className:"directory-picker-error",children:[r.jsx(w,{size:16}),r.jsx("span",{children:e.error})]}):r.jsx("div",{className:"directory-picker-entries",children:e.entries.length===0?r.jsx("div",{className:"directory-picker-empty",children:i("dirPicker.noSubdirs","No subdirectories")}):e.entries.map(t=>r.jsxs("button",{type:"button",className:"directory-picker-entry",onClick:()=>m(t.path),role:"treeitem",title:t.path,children:[r.jsx(x,{size:16,className:"directory-picker-entry-icon"}),r.jsx("span",{className:"directory-picker-entry-name",children:t.name}),t.hasChildren&&r.jsx(j,{size:14,className:"directory-picker-entry-arrow"})]},t.path))}),e.createFolderOpen&&r.jsxs("div",{className:"directory-picker-create-folder",children:[r.jsx("input",{type:"text",className:"input directory-picker-create-folder-input",value:l,onChange:t=>h(t.target.value),onKeyDown:H,placeholder:i("dirPicker.newFolderPlaceholder","Folder name"),autoFocus:!0}),r.jsxs("div",{className:"directory-picker-create-folder-actions",children:[r.jsx("button",{type:"button",className:"btn btn-sm btn-primary",onClick:y,disabled:!l.trim()||e.loading||!e.currentPath,children:i("dirPicker.createFolderConfirm","Create")}),r.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:P,children:i("dirPicker.cancel","Cancel")})]}),e.createFolderError&&r.jsxs("div",{className:"directory-picker-create-folder-error",children:[r.jsx(w,{size:14}),r.jsx("span",{children:e.createFolderError})]})]}),r.jsxs("div",{className:"directory-picker-actions",children:[r.jsx("span",{className:"directory-picker-selected-path",title:e.currentPath,children:e.currentPath}),r.jsx("button",{type:"button",className:"btn btn-primary directory-picker-select-btn",onClick:F,children:i("dirPicker.select","Select")})]})]})]})}export{q as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,j as e}from"./vendor-react-BTgM5bbZ.js";import{a7 as J,a8 as Z,a9 as be,aa as ve,ab as ee,ac as Ne,ad as I,f as Ce,ae as Se,af as Fe,F as z,ag as ye,ah as Te,S as Pe,X as Ee,R as Me,ai as Re,aj as te,ak as se,a as ne,b as Le,al as De}from"./index-Bglw05rM.js";import{u as U}from"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";function ze(a){const{projectId:o,searchQuery:h,includeProjectFiles:d=!0}=a??{},t=o?`${be.DOCUMENTS_PREFIX}${o}`:null,[r,u]=s.useState(()=>{if(!t)return[];const b=J(t,{maxAgeMs:Z});return Array.isArray(b)?b:[]}),[i,f]=s.useState([]),[l,p]=s.useState(()=>r.length===0),[g,y]=s.useState(null),w=s.useRef(null),j=s.useRef(r.length>0),k=s.useRef(null),v=s.useCallback(async()=>{w.current&&w.current.abort();const b=new AbortController;w.current=b;const F=!j.current;F&&p(!0),y(null);const P=ve(h?{q:h}:void 0,o),A=d?ee(o):Promise.resolve({files:[]}),[x,E]=await Promise.allSettled([P,A]);if(b.signal.aborted)return;let R=null;if(x.status==="fulfilled"){if(u(x.value),t){const T=x.value.length>500?x.value.slice(0,500):x.value;Ne(t,T,{maxBytes:5e5})}j.current=!0}else R=x.reason instanceof Error?x.reason.message:String(x.reason);if(E.status==="fulfilled"){const T=E.value.files,N=h?.trim().toLowerCase(),L=N?T.filter(D=>D.name.toLowerCase().includes(N)||D.path.toLowerCase().includes(N)):T;f(L)}y(R),F&&p(!1)},[t,d,o,h]);return s.useEffect(()=>{if(!t){j.current=!1,u([]),p(!0);return}const b=J(t,{maxAgeMs:Z});Array.isArray(b)?(u(b),j.current=!0,p(!1)):(j.current=!1,u([]),p(!0))},[t]),s.useEffect(()=>(k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{v()},300),()=>{k.current&&clearTimeout(k.current)}),[v]),s.useEffect(()=>(v(),()=>{w.current&&w.current.abort()}),[]),{documents:r,projectFiles:i,loading:l,error:g,refresh:v}}function Ae(a,o){const[h,d]=s.useState([]),[t,r]=s.useState(!0),[u,i]=s.useState(null),f=s.useRef(null),l=s.useRef(!1),p=o?.showHidden??!1,g=s.useCallback(async y=>{f.current&&f.current.abort();const w=new AbortController;f.current=w;const j=!l.current;j&&r(!0),i(null);try{const k=await ee(a,{showHidden:y?.showHidden??p});if(w.signal.aborted)return;d(k.files),l.current=!0}catch(k){if(w.signal.aborted)return;i(k instanceof Error?k.message:String(k))}finally{!w.signal.aborted&&j&&r(!1)}},[a,p]);return s.useEffect(()=>(l.current=!1,g({showHidden:p}),()=>{f.current&&f.current.abort()}),[g,p]),{files:h,loading:t,error:u,refresh:g}}const He=768;function ae(a){return a?new Date(a).toLocaleString():""}function $e(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(a>=10*1024?0:1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Oe(a,o=200){return a.length<=o?a:`${a.substring(0,o)}…`}function qe({document:a,renderMarkdown:o,onToggleMarkdown:h}){const{t:d}=U("app"),[t,r]=s.useState(!1),u=Oe(a.content),i=a.content.length>200;return e.jsxs("div",{className:"document-card",children:[e.jsxs("div",{className:"document-card-header",children:[e.jsxs("div",{className:"document-card-key",children:[e.jsx(z,{size:14}),e.jsx("span",{className:"document-card-key-text",children:a.key}),e.jsxs("span",{className:"document-card-revision-badge",children:["v",a.revision]})]}),e.jsx("div",{className:"document-card-actions",children:e.jsx("button",{className:"btn btn-sm document-card-expand-btn",onClick:()=>r(f=>!f),title:t?d("documents.collapse","Collapse"):d("documents.expand","Expand"),"aria-label":t?d("documents.collapseContent","Collapse content"):d("documents.expandContent","Expand content"),children:t?e.jsx(De,{size:14}):e.jsx(ne,{size:14})})})]}),e.jsxs("div",{className:"document-card-meta",children:[e.jsx("span",{className:"document-card-author",children:a.author}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{className:"document-card-date",children:ae(a.updatedAt)})]}),e.jsxs("div",{className:`document-card-content${t?" document-card-content--expanded":""}`,children:[t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"document-card-content-header",children:e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:h,"aria-label":o?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":o,title:o?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),children:o?d("documents.markdown","Markdown"):d("documents.plain","Plain")})}),o?e.jsx("div",{className:"document-card-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(te,{remarkPlugins:[se],children:a.content})})}):e.jsx("pre",{className:"document-card-content-text",children:a.content})]}):e.jsx("p",{className:"document-card-preview",children:u}),i&&!t&&e.jsx("p",{className:"document-card-preview-truncated",children:"…"})]})]})}function Be({taskId:a,taskTitle:o,documents:h,onOpenTask:d,renderMarkdownStates:t,onToggleMarkdown:r}){const{t:u}=U("app"),[i,f]=s.useState(!1);return e.jsxs("div",{className:"documents-group",children:[e.jsxs("div",{className:"documents-group-header",children:[e.jsxs("button",{className:"documents-group-toggle-btn",onClick:()=>f(l=>!l),"aria-expanded":i,"aria-label":`${i?u("documents.collapse","Collapse"):u("documents.expand","Expand")} documents for task ${a}`,children:[e.jsx("span",{className:"documents-group-toggle","aria-hidden":"true",children:i?e.jsx(ne,{size:16}):e.jsx(Le,{size:16})}),e.jsx("span",{className:"documents-group-task-id",children:a}),e.jsx("span",{className:"documents-group-task-title",children:o||u("documents.untitled","Untitled")})]}),e.jsx("span",{className:"documents-group-count",children:u("documents.docCount","{{count}} doc{{plural}}",{count:h.length,plural:h.length!==1?"s":""})}),e.jsx("button",{className:"documents-group-task-link",onClick:()=>d(a),"aria-label":`Open task ${a}: ${o||u("documents.untitled","Untitled")}`,children:u("documents.openTask","Open task")})]}),i&&e.jsx("div",{className:"documents-group-content",children:h.map(l=>e.jsx(qe,{document:l,renderMarkdown:t.get(l.id)??!1,onToggleMarkdown:()=>r(l.id)},l.id))})]})}function Xe({projectId:a,addToast:o,onOpenDetail:h,onSendSelectionToTask:d}){const{t}=U("app"),[r,u]=s.useState("project"),[i,f]=s.useState(""),[l,p]=s.useState(null),[g,y]=s.useState(!1),[w,j]=s.useState(null),[k,v]=s.useState(!1),[b,F]=s.useState(null),[P,A]=s.useState(!1),x=s.useRef(0),E=s.useRef(!1),R=s.useRef(null),T=s.useRef(null),[N,L]=s.useState(!1),[D,_]=s.useState(new Map),[Q,ce]=s.useState(!1),oe=I(R,{locked:Q}),re=I(T,{locked:Q}),H=N?oe:re,le=r==="tasks"?i.trim():"",{documents:M,loading:$,error:ie,refresh:K}=ze({projectId:a,searchQuery:le||void 0,includeProjectFiles:!1}),{files:S,loading:O,error:de,refresh:W}=Ae(a,{showHidden:g});s.useEffect(()=>{const n=()=>{A(window.innerWidth<=He)};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[]),s.useEffect(()=>{E.current=!1,u("project"),p(null),y(!1),j(null),F(null),v(!1),L(!1),_(new Map)},[a]),s.useEffect(()=>{E.current||$||O||(S.length>0?u("project"):M.length>0&&u("tasks"),E.current=!0)},[M.length,$,S.length,O]);const q=s.useMemo(()=>{const n=new Map;for(const c of M){const m=n.get(c.taskId)||[];n.set(c.taskId,[...m,c])}return Array.from(n.entries()).map(([c,m])=>{const C=[...m].sort((ke,ge)=>ge.updatedAt.localeCompare(ke.updatedAt));return{taskId:c,taskTitle:C[0]?.taskTitle,documents:C,latestUpdated:C[0]?.updatedAt??""}}).sort((c,m)=>m.latestUpdated.localeCompare(c.latestUpdated))},[M]),B=s.useMemo(()=>{const n=i.trim().toLowerCase();return n?S.filter(c=>{const m=c.path.toLowerCase(),C=c.name.toLowerCase();return m.includes(n)||C.includes(n)}):S},[S,i]);s.useEffect(()=>{if(!l)return;S.some(c=>c.path===l.path)||(p(null),j(null),F(null),v(!1))},[S,l]);const ue=s.useCallback(n=>{f(n.target.value)},[]),me=s.useCallback(()=>{f("")},[]),G=s.useCallback(n=>{u(n)},[]),he=s.useCallback(async n=>{try{const c=await Ce(n,a);h(c)}catch{o(`Failed to open task ${n}`,"error")}},[a,h,o]),pe=s.useCallback(async n=>{p(n),v(!0),F(null),j(null);const c=x.current+1;x.current=c;try{const m=await Se("project",n.path,a);if(x.current!==c)return;j(m.content)}catch(m){if(x.current!==c)return;const C=m instanceof Error?m.message:`Failed to open ${n.path}`;F(C),o(C,"error")}finally{x.current===c&&v(!1)}},[a,o]),fe=s.useCallback(()=>{p(null),j(null),F(null),v(!1)},[]),je=s.useCallback(n=>{_(c=>{const m=new Map(c),C=m.get(n)??!1;return m.set(n,!C),m})},[]),X=r==="project"?de:ie,xe=s.useCallback(async()=>{if(r==="project"){await W();return}await K()},[r,W,K]),V=r==="project"?B.length:M.length,we=l&&d&&H?e.jsx(Fe,{selectedText:H.selectedText,anchorRect:H.anchorRect,filePath:l.path,onSubmit:d,onOpenChange:ce}):null,Y=r==="project"?t("documents.searchProjectFiles","Search project markdown files…"):t("documents.searchTaskDocuments","Search task documents…");return e.jsxs("div",{className:"documents-view",children:[e.jsxs("div",{className:"documents-view-header",children:[e.jsxs("div",{className:"documents-view-title-row",children:[e.jsxs("h2",{className:"documents-view-title",children:[e.jsx(z,{size:20}),t("documents.title","Documents")]}),e.jsx("span",{className:"documents-view-count",children:t("documents.resultCount","{{count}} result{{plural}}",{count:V,plural:V!==1?"s":""})})]}),e.jsxs("div",{className:"documents-controls-row",children:[e.jsxs("div",{className:"documents-tab-bar",role:"tablist","aria-label":"Documents sections",children:[e.jsxs("button",{className:`btn documents-tab${r==="project"?" active":""}`,role:"tab","aria-selected":r==="project","aria-label":t("documents.showProjectFiles","Show project markdown files"),onClick:()=>G("project"),children:[t("documents.projectFilesTab","Project Files"),e.jsx("span",{className:"documents-tab-count",children:S.length})]}),e.jsxs("button",{className:`btn documents-tab${r==="tasks"?" active":""}`,role:"tab","aria-selected":r==="tasks","aria-label":t("documents.showTaskDocuments","Show task documents"),onClick:()=>G("tasks"),children:[t("documents.taskDocumentsTab","Task Documents"),e.jsx("span",{className:"documents-tab-count",children:q.length})]})]}),r==="project"&&e.jsxs("button",{className:"btn btn-sm documents-hidden-toggle",onClick:()=>y(n=>!n),"aria-pressed":g,"aria-label":g?t("documents.hideHidden","Hide hidden project files"):t("documents.showHidden","Show hidden project files"),title:g?t("documents.hideHiddenFiles","Hide hidden files"):t("documents.showHiddenFiles","Show hidden files"),children:[g?e.jsx(ye,{size:14}):e.jsx(Te,{size:14}),g?t("documents.hideHiddenLabel","Hide Hidden"):t("documents.showHiddenLabel","Show Hidden")]}),e.jsxs("div",{className:"documents-search",children:[e.jsx(Pe,{size:16,className:"documents-search-icon"}),e.jsx("input",{type:"text",className:"documents-search-input",placeholder:Y,value:i,onChange:ue,"aria-label":Y}),i&&e.jsx("button",{className:"documents-search-clear",onClick:me,"aria-label":t("documents.clearSearch","Clear search"),children:e.jsx(Ee,{size:16})})]})]})]}),e.jsx("div",{className:"documents-view-content",children:X?e.jsxs("div",{className:"documents-view-error",children:[e.jsx("p",{children:t("documents.failedToLoad","Failed to load {{type}}: {{error}}",{type:r==="project"?t("documents.projectFiles","project files"):t("documents.taskDocuments","task documents"),error:X})}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>void xe(),"aria-label":t("documents.retryLoading","Retry loading documents"),children:[e.jsx(Me,{size:16}),t("documents.retry","Retry")]})]}):r==="project"?O&&S.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:t("documents.loadingProjectFiles","Loading project markdown files…")})}):B.length===0?e.jsx("div",{className:"documents-view-empty",children:i.trim()?e.jsx("p",{children:t("documents.noMatchProject",'No project markdown files match "{{query}}".',{query:i.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(z,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noMarkdownFiles","No Markdown files found in this project.")})]})}):e.jsxs("div",{className:`documents-project-layout${P?" documents-project-layout--mobile":""}`,children:[(!P||!l)&&e.jsx("aside",{className:"documents-view-sidebar","aria-label":"Project markdown files",children:e.jsx("ul",{className:"markdown-file-list",children:B.map(n=>{const c=l?.path===n.path;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item${c?" markdown-file-item--selected":""}`,onClick:()=>void pe(n),"aria-label":`Open ${n.path}`,"aria-current":c?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:n.name}),e.jsx("span",{className:"markdown-file-item-path",children:n.path}),e.jsxs("span",{className:"markdown-file-item-meta",children:[$e(n.size)," · ",ae(n.mtime)]})]})},n.path)})})}),(!P||l)&&e.jsxs("section",{className:"documents-view-main","aria-label":"Project file content preview",children:[P&&l&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:fe,"aria-label":t("documents.backToFilesList","Back to project files list"),children:[e.jsx(Re,{size:14}),t("documents.backToFiles","Back to files")]}),l?e.jsxs("div",{className:"documents-content-viewer",children:[e.jsxs("div",{className:"documents-content-header",children:[e.jsx("p",{className:"documents-file-path-header",children:l.path}),e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>L(n=>!n),"aria-label":N?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":N,title:N?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:N?t("documents.markdown","Markdown"):t("documents.plain","Plain")})]}),k?e.jsx("p",{className:"documents-content-state",children:t("documents.loadingFileContent","Loading file content…")}):b?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:b}):N?e.jsx("div",{ref:R,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(te,{remarkPlugins:[se],children:w??""})})}):e.jsx("pre",{ref:T,className:"document-card-content-text documents-content-viewer-text",children:w??""}),we]}):e.jsx("div",{className:"documents-view-empty",children:e.jsx("p",{children:t("documents.selectFile","Select a Markdown file to view its content.")})})]})]}):$&&M.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:t("documents.loadingTaskDocuments","Loading task documents…")})}):q.length===0?e.jsx("div",{className:"documents-view-empty",children:i.trim()?e.jsx("p",{children:t("documents.noMatchTask",'No task documents match "{{query}}".',{query:i.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(z,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noTaskDocuments","No task documents yet.")}),e.jsx("p",{className:"documents-view-empty-hint",children:t("documents.documentsCreatedIn","Documents are created in task detail tabs.")})]})}):e.jsx("div",{className:"documents-task-list-wrap",children:e.jsx("div",{className:"documents-view-list",children:q.map(({taskId:n,taskTitle:c,documents:m})=>e.jsx(Be,{taskId:n,taskTitle:c,documents:m,onOpenTask:he,renderMarkdownStates:D,onToggleMarkdown:je},n))})})})]})}export{Xe as DocumentsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-BTgM5bbZ.js";import{a7 as P,a8 as F,a9 as O,aR as W,aS as G,ac as V,aT as Y,x as J,az as Q,R as Z,aD as ee}from"./index-Bglw05rM.js";import{u as se}from"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";const ae=300,te=15e3;function H(r){if(!r.trim())return;const s=Number(r);return Number.isFinite(s)?s:void 0}function k(...r){for(const s of r)if(Array.isArray(s))return s;return[]}function p(r){return typeof r=="object"&&r!==null?r:{}}function B(r){const s=p(r),m=p(s.taskSnapshot);return{id:String(s.id??s.evalId??""),runId:String(s.runId??s.batchId??""),taskId:String(s.taskId??m.taskId??""),taskTitle:String(m.title??s.taskTitle??s.title??"Untitled task"),createdAt:String(s.createdAt??s.timestamp??s.updatedAt??new Date(0).toISOString()),overallScore:typeof s.overallScore=="number"?s.overallScore:null,maxScore:typeof s.maxScore=="number"?s.maxScore:null,categoryScores:k(s.categoryScores,p(s.scores).categories)}}function le(r){const s=p(r);return{...B(s),rationale:String(s.rationale??s.summary??""),evidence:k(s.evidence,p(s.details).evidence),followUps:k(s.followUps,p(s.recommendations).followUps)}}function re(r){const s=r?.projectId,m=s??"",t=`${O.EVALS_RUNS_PREFIX}${m}`,h=`${O.EVALS_RESULTS_PREFIX}${m}`,f=P(t,{maxAgeMs:F}),v=P(h,{maxAgeMs:F}),S=l.useRef(Array.isArray(f)&&f.length>0||Array.isArray(v)&&v.length>0),[o,g]=l.useState({q:"",runId:"",scoreMin:"",scoreMax:""}),[A,w]=l.useState(()=>Array.isArray(f)?f:[]),[i,M]=l.useState(()=>Array.isArray(v)?v:[]),[u,N]=l.useState(null),[L,b]=l.useState(null),[a,d]=l.useState(0),[y,j]=l.useState(!S.current),[K,z]=l.useState(null),C=l.useRef(0),q=l.useRef(s),T=l.useRef(u);T.current=u;const I=l.useCallback(async()=>{const n=++C.current;S.current||j(!0),z(null);try{const[c,x]=await Promise.all([W({q:o.q||void 0,runId:o.runId||void 0,scoreMin:H(o.scoreMin),scoreMax:H(o.scoreMax),limit:100,offset:0},s),G(s)]);if(n!==C.current)return;const E=k(c.results,c.evals,c.items).map(B);M(E),V(h,E.length>500?E.slice(0,500):E,{maxBytes:5e5}),d(typeof c.count=="number"?c.count:E.length);const $=k(x.runs,x.items).map(U=>{const R=p(U),D=p(R.counts);return{id:String(R.id??""),createdAt:String(R.createdAt??""),completedAt:typeof R.completedAt=="string"?R.completedAt:void 0,status:String(R.status??"pending"),evaluatedTaskCount:typeof D.totalTasks=="number"?D.totalTasks:0}});w($),V(t,$,{maxBytes:5e5}),S.current=!0,T.current&&!E.some(U=>U.id===T.current)&&(N(null),b(null))}catch(c){if(n!==C.current)return;z(c instanceof Error?c.message:"Failed to load evals")}finally{n===C.current&&j(!1)}},[o.q,o.runId,o.scoreMax,o.scoreMin,s,h,t]),_=l.useCallback(async n=>{const c=await Y(n,s),x=c.result??c;b(le(x))},[s]);l.useEffect(()=>{if(q.current===s)return;q.current=s;const n=P(t,{maxAgeMs:F}),c=P(h,{maxAgeMs:F}),x=Array.isArray(n)&&n.length>0||Array.isArray(c)&&c.length>0;w(Array.isArray(n)?n:[]),M(Array.isArray(c)?c:[]),j(!x),S.current=x},[s,h,t]),l.useEffect(()=>{const n=window.setTimeout(()=>{I()},ae);return()=>window.clearTimeout(n)},[I]),l.useEffect(()=>{if(!u){b(null);return}_(u)},[_,u]),l.useEffect(()=>{const n=window.setInterval(()=>{I(),u&&_(u)},te);return()=>window.clearInterval(n)},[_,I,u]);const X=l.useCallback(n=>{T.current=n,N(n)},[]);return{loading:y,error:K,results:i,count:a,runs:A,filters:o,setFilters:g,refresh:I,selectedEvalId:u,setSelectedEvalId:X,selectedEval:L}}function he({projectId:r,onOpenSettings:s,onOpenTaskDetail:m}){const{t}=se("app"),{loading:h,error:f,results:v,runs:S,filters:o,setFilters:g,selectedEvalId:A,setSelectedEvalId:w,selectedEval:i,refresh:M}=re({projectId:r}),[u,N]=l.useState(!0);l.useEffect(()=>{let a=!1;return J(r).then(d=>{if(a)return;const y=d.evalSettings?.enabled;N(y??!1)}).catch(()=>{a||N(!1)}),()=>{a=!0}},[r]);const L=v.length>0,b=l.useMemo(()=>v.find(a=>a.id===A)??null,[v,A]);return u?e.jsxs("section",{className:"evals-view","data-testid":"evals-view",children:[e.jsxs("div",{className:"evals-list card",children:[e.jsxs("div",{className:"evals-toolbar",children:[e.jsx("input",{className:"input",placeholder:t("evals.searchPlaceholder","Search task or rationale"),value:o.q,onChange:a=>g(d=>({...d,q:a.target.value}))}),e.jsxs("select",{className:"select",value:o.runId,onChange:a=>g(d=>({...d,runId:a.target.value})),children:[e.jsx("option",{value:"",children:t("evals.allRuns","All runs")}),S.map(a=>e.jsx("option",{value:a.id,children:a.id},a.id))]}),e.jsx("input",{className:"input",placeholder:t("evals.minScorePlaceholder","Min score"),value:o.scoreMin,onChange:a=>g(d=>({...d,scoreMin:a.target.value}))}),e.jsx("input",{className:"input",placeholder:t("evals.maxScorePlaceholder","Max score"),value:o.scoreMax,onChange:a=>g(d=>({...d,scoreMax:a.target.value}))}),e.jsx("button",{className:"btn btn-icon",type:"button",onClick:()=>void M(),"aria-label":t("evals.refreshAria","Refresh evals"),children:e.jsx(Z,{size:16})})]}),h&&e.jsx("p",{className:"evals-state","data-testid":"evals-loading",children:t("evals.loading","Loading evals…")}),f&&e.jsx("p",{className:"evals-state evals-state--error",children:f}),!h&&!f&&!L&&e.jsx("p",{className:"evals-state",children:t("evals.empty","No evals yet. Scheduled evals review tasks completed since the last run.")}),e.jsx("ul",{className:"evals-results","data-testid":"evals-results",children:v.map(a=>e.jsx("li",{children:e.jsxs("button",{className:`evals-result ${a.id===A?"evals-result--active":""}`,type:"button",onClick:()=>w(a.id),children:[e.jsx("span",{className:"evals-result-title",children:a.taskTitle}),e.jsxs("span",{className:"evals-result-meta",children:[a.taskId," · ",a.runId," · ",a.overallScore??t("evals.naPlaceholder","n/a")]})]})},a.id))})]}),e.jsxs("div",{className:"evals-detail card","data-testid":"evals-detail",children:[!i&&e.jsx("p",{className:"evals-state",children:t("evals.selectPrompt","Select an evaluation to inspect scores, rationale, and evidence.")}),i&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"evals-detail-title",children:b?.taskTitle??i.taskTitle}),e.jsxs("p",{className:"evals-result-meta",children:[i.taskId," · ",i.runId]}),e.jsx("p",{className:"evals-score",children:t("evals.overallScore","Overall score: {{score}}",{score:i.overallScore??t("evals.naPlaceholder","n/a")})}),e.jsx("ul",{className:"evals-categories",children:i.categoryScores.map(a=>e.jsxs("li",{children:[a.category,": ",a.finalScore]},a.category))}),e.jsx("p",{className:"evals-rationale",children:i.rationale||t("evals.noRationale","No rationale recorded.")}),e.jsxs("div",{children:[e.jsx("h4",{children:t("evals.evidenceHeading","Evidence")}),e.jsx("ul",{className:"evals-links",children:i.evidence.map((a,d)=>{const y=typeof a.metadata?.taskId=="string"?a.metadata.taskId:void 0,j=typeof a.metadata?.url=="string"?a.metadata.url:void 0;return e.jsx("li",{children:y?e.jsx("button",{type:"button",className:"btn",onClick:()=>m?.(y),children:a.ref}):j?e.jsxs("a",{href:j,target:"_blank",rel:"noreferrer",className:"evals-external-link",children:[a.ref,e.jsx(ee,{size:14})]}):e.jsx("span",{children:a.ref})},`${a.ref}-${d}`)})})]}),e.jsxs("div",{children:[e.jsx("h4",{children:t("evals.suggestedFollowupsHeading","Suggested follow-up tasks")}),e.jsxs("ul",{className:"evals-follow-ups",children:[i.followUps.length===0&&e.jsx("li",{children:t("evals.noFollowups","None")}),i.followUps.map(a=>e.jsxs("li",{children:[e.jsx("strong",{children:a.title}),e.jsx("p",{children:a.rationale})]},a.suggestionId))]})]})]})]})]}):e.jsxs("section",{className:"evals-view card","data-testid":"evals-disabled",children:[e.jsx("h2",{className:"evals-title",children:t("evals.disabledTitle","Scheduled evals are disabled")}),e.jsx("p",{className:"evals-empty-copy",children:t("evals.enablePrompt","Enable Scheduled Evals to review scored tasks, evidence, and follow-up recommendations.")}),e.jsxs("button",{className:"btn btn-primary",type:"button",onClick:()=>s?.("scheduled-evals"),children:[e.jsx(Q,{size:16}),t("evals.openSettings","Open Scheduled Evals Settings")]})]})}export{he as EvalsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.skill-multiselect{display:flex;flex-direction:column;gap:var(--space-sm)}.skill-multiselect-label{font-size:13px;font-weight:500;color:var(--text-muted)}.skill-multiselect-chips{display:flex;flex-wrap:wrap;gap:4px}.skill-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 6px;background:var(--bg-tertiary);color:var(--text-muted);border-radius:4px;font-size:12px;line-height:1.4}.skill-chip-name{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.skill-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;background:transparent;border:none;border-radius:2px;color:var(--text-muted);font-size:14px;line-height:1;cursor:pointer;transition:color .15s,background .15s}.skill-chip-remove:hover:not(:disabled){color:var(--text);background:var(--surface-hover)}.skill-chip-remove:disabled{opacity:.5;cursor:not-allowed}.skill-multiselect-add{min-height:32px}.skill-multiselect-loading,.skill-multiselect-empty{font-size:13px;color:var(--text-muted);padding:4px 0}.skill-multiselect-dropdown{width:100%;font-size:13px}.agent-dialog-skills-hint{margin-top:4px;font-size:12px}.skill-badge-row{display:flex;flex-wrap:wrap;gap:4px}.skill-badge{display:inline-block;padding:2px 6px;background:var(--bg-tertiary);color:var(--text-muted);border-radius:4px;font-size:11px;line-height:1.4}.badge-skill{background:var(--bg-tertiary);color:var(--text-muted)}.agent-board-skills{display:flex;flex-wrap:wrap;gap:4px;padding:4px 8px}.skill-badge-sm{display:inline-block;padding:1px 5px;background:var(--bg-tertiary);color:var(--text-muted);border-radius:3px;font-size:10px;line-height:1.4}.skill-badge-extra{background:var(--bg-secondary)}.agent-tree__skill{display:inline-block;padding:1px 5px;background:var(--bg-tertiary);color:var(--text-muted);border-radius:3px;font-size:10px;line-height:1.4;margin-left:6px}.org-chart-node__skill{display:inline-block;padding:1px 5px;background:var(--bg-tertiary);color:var(--text-muted);border-radius:3px;font-size:10px;line-height:1.4}.divider{color:var(--border)}.text-muted{color:var(--text-muted)}.link{display:inline-flex;align-items:center;gap:4px;color:var(--todo);text-decoration:none}.link:hover{text-decoration:underline}.text-secondary{color:var(--text-muted)}.experimental-agent-onboarding-modal__textarea{min-height:calc(var(--space-2xl) * 4)}.experimental-agent-onboarding-modal__summary{display:flex;flex-direction:column;gap:var(--space-lg);padding:var(--space-lg)}.experimental-agent-onboarding-modal__summary-section{display:flex;flex-direction:column;gap:var(--space-sm)}.experimental-agent-onboarding-modal__summary-section h4{margin:0;color:var(--text);font-size:calc(var(--space-md) + var(--space-xs) * .25)}.experimental-agent-onboarding-modal__summary-intro{margin:var(--space-sm) 0;color:var(--text-muted)}.experimental-agent-onboarding-modal__summary-section p{margin:0;color:var(--text-muted)}.experimental-agent-onboarding-modal__summary-list{display:flex;flex-direction:column;gap:var(--space-sm);margin:0}.experimental-agent-onboarding-modal__summary-list>div{display:grid;gap:var(--space-sm);grid-template-columns:minmax(0,calc(var(--space-xl) * 5)) minmax(0,1fr)}.experimental-agent-onboarding-modal__summary-list dt{color:var(--text-muted)}.experimental-agent-onboarding-modal__summary-list dd{margin:0;color:var(--text)}.experimental-agent-onboarding-modal__summary-empty{color:var(--text-dim)}.experimental-agent-onboarding-modal__summary-block{white-space:pre-wrap}@media(max-width:768px){.experimental-agent-onboarding-modal__textarea{min-height:calc(var(--space-2xl) * 3)}.experimental-agent-onboarding-modal__summary{gap:var(--space-md);padding:var(--space-md)}.experimental-agent-onboarding-modal__summary-list>div{grid-template-columns:1fr;gap:var(--space-xs)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-
|
|
1
|
+
import{r,j as e}from"./vendor-react-BTgM5bbZ.js";import{bY as F,cY as V,cZ as U,c_ as K,c$ as B,d0 as Q}from"./index-Bglw05rM.js";import{u as _}from"./vendor-i18n-DYlSUfot.js";function ve({value:c,onChange:m,projectId:p,disabled:h=!1,id:y,label:x="Skills"}){const{t:g}=_("app"),[n,d]=r.useState([]),[l,b]=r.useState(!0);r.useEffect(()=>{let t=!1;return b(!0),F(p).then(f=>{t||d(f)}).catch(()=>{t||d([])}).finally(()=>{t||b(!1)}),()=>{t=!0}},[p]);const S=t=>{c.includes(t)||m([...c,t])},u=t=>{m(c.filter(f=>f!==t))},k=t=>n.find(E=>E.id===t)?.name??t,j=n.filter(t=>!c.includes(t.id));return e.jsxs("div",{className:"skill-multiselect","data-testid":"skill-multiselect",children:[x&&e.jsx("label",{htmlFor:y?`${y}-select`:void 0,className:"skill-multiselect-label",children:x}),c.length>0&&e.jsx("div",{className:"skill-multiselect-chips","data-testid":"skill-chips",children:c.map(t=>e.jsxs("span",{className:"skill-chip","data-testid":`skill-chip-${t}`,children:[e.jsx("span",{className:"skill-chip-name",children:k(t)}),e.jsx("button",{type:"button",className:"skill-chip-remove",onClick:()=>u(t),disabled:h,"aria-label":g("skills.removeSkill","Remove {{name}}",{name:k(t)}),"data-testid":`remove-skill-${t}`,children:"×"})]},t))}),e.jsx("div",{className:"skill-multiselect-add",children:l?e.jsx("span",{className:"skill-multiselect-loading","data-testid":"skills-loading",children:g("skills.loading","Loading skills…")}):j.length===0?e.jsx("span",{className:"skill-multiselect-empty","data-testid":"skills-empty",children:c.length===0?g("skills.noSkillsDiscovered","No skills discovered"):g("skills.allSkillsSelected","All skills selected")}):e.jsxs("select",{id:y?`${y}-select`:void 0,className:"select skill-multiselect-dropdown",value:"",onChange:t=>{t.target.value&&(S(t.target.value),t.target.value="")},disabled:h,"data-testid":"skill-dropdown",children:[e.jsx("option",{value:"",children:g("skills.addSkill","Add a skill…")}),j.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})})]})}const $=/(?:^|\/)skills\/([^/]+)\/SKILL\.md$/i;function we(c){const m=c.trim();if(!m)return c;const p=m.match($);return p?.[1]?p[1]:m}const G=`# Soul: Chief Executive Officer
|
|
2
2
|
|
|
3
3
|
I am a strategic leader who connects every decision to business outcomes.
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ I am a strategic leader who connects every decision to business outcomes.
|
|
|
17
17
|
## Communication Style
|
|
18
18
|
|
|
19
19
|
I am direct and economical. I use short sentences and active voice. I avoid jargon and hedge words like "maybe" or "perhaps" in decisive contexts. I communicate across levels without losing clarity.
|
|
20
|
-
`,
|
|
20
|
+
`,Y=`# Soul: Chief Technology Officer
|
|
21
21
|
|
|
22
22
|
I am a pragmatic technologist who thinks in systems and communicates tradeoffs in terms of risk and impact.
|
|
23
23
|
|
|
@@ -38,7 +38,7 @@ I am a pragmatic technologist who thinks in systems and communicates tradeoffs i
|
|
|
38
38
|
## Communication Style
|
|
39
39
|
|
|
40
40
|
I translate technical concepts into risk and impact language for non-technical stakeholders. I use diagrams and analogies when they clarify, not obscure. I say "I don't know" when that's true, and follow with "but I'll find out."
|
|
41
|
-
`,
|
|
41
|
+
`,Z=`# Soul: Chief Marketing Officer
|
|
42
42
|
|
|
43
43
|
I am a growth-focused strategist who understands audiences deeply and measures everything to optimize impact.
|
|
44
44
|
|
|
@@ -59,7 +59,7 @@ I am a growth-focused strategist who understands audiences deeply and measures e
|
|
|
59
59
|
## Communication Style
|
|
60
60
|
|
|
61
61
|
I am clear, action-oriented, and audience-aware. I write for scanning, not reading. I lead with value propositions and back them with evidence. I use data to persuade, not to impress.
|
|
62
|
-
`,
|
|
62
|
+
`,J=`# Soul: Chief Financial Officer
|
|
63
63
|
|
|
64
64
|
I am a disciplined financial steward who quantifies everything and ensures every investment has a measurable return.
|
|
65
65
|
|
|
@@ -78,7 +78,7 @@ I am a disciplined financial steward who quantifies everything and ensures every
|
|
|
78
78
|
## Communication Style
|
|
79
79
|
|
|
80
80
|
I speak in numbers and timelines, not estimates. I use comparisons and benchmarks to provide context. I am direct about tradeoffs: more features means more cost; faster delivery means more risk. I don't soften financial reality.
|
|
81
|
-
`,
|
|
81
|
+
`,X=`# Soul: Software Engineer
|
|
82
82
|
|
|
83
83
|
I am a reliable and versatile engineer who writes clean, well-tested code and leaves the codebase better than I found it.
|
|
84
84
|
|
|
@@ -418,19 +418,19 @@ I write review comments that explain why something is a concern, not just that i
|
|
|
418
418
|
Prioritize work that delivers the highest business value.
|
|
419
419
|
Communicate decisions with clear rationale and context.
|
|
420
420
|
Identify cross-team dependencies and resolve blockers proactively.
|
|
421
|
-
Keep long-term vision in focus while making short-term tradeoffs.`},{id:"cto",name:"CTO",icon:"⬡",title:"Chief Technology Officer",role:"custom",description:"Defines technical architecture, evaluates technology choices, and guides engineering standards across the project.",soul:
|
|
421
|
+
Keep long-term vision in focus while making short-term tradeoffs.`},{id:"cto",name:"CTO",icon:"⬡",title:"Chief Technology Officer",role:"custom",description:"Defines technical architecture, evaluates technology choices, and guides engineering standards across the project.",soul:Y,instructionsText:`Evaluate technology choices against scalability, maintainability, and team expertise.
|
|
422
422
|
Identify architectural risks early and propose mitigations.
|
|
423
423
|
Review changes for adherence to established patterns and conventions.
|
|
424
424
|
Prioritize simplicity — reject over-engineering and unnecessary abstraction.
|
|
425
|
-
Document architectural decisions with rationale for future reference.`},{id:"cmo",name:"CMO",icon:"◇",title:"Chief Marketing Officer",role:"custom",description:"Drives product positioning, audience engagement strategy, and content planning to grow user adoption.",soul:
|
|
425
|
+
Document architectural decisions with rationale for future reference.`},{id:"cmo",name:"CMO",icon:"◇",title:"Chief Marketing Officer",role:"custom",description:"Drives product positioning, audience engagement strategy, and content planning to grow user adoption.",soul:Z,instructionsText:`Evaluate all user-facing content for clarity and audience alignment.
|
|
426
426
|
Propose messaging that highlights user benefits over technical features.
|
|
427
427
|
Identify growth opportunities from product changes and new features.
|
|
428
428
|
Ensure consistent brand voice across all touchpoints.
|
|
429
|
-
Track engagement metrics to validate content and campaign effectiveness.`},{id:"cfo",name:"CFO",icon:"■",title:"Chief Financial Officer",role:"custom",description:"Manages budget allocation, cost optimization, and financial planning to maximize resource efficiency.",soul:
|
|
429
|
+
Track engagement metrics to validate content and campaign effectiveness.`},{id:"cfo",name:"CFO",icon:"■",title:"Chief Financial Officer",role:"custom",description:"Manages budget allocation, cost optimization, and financial planning to maximize resource efficiency.",soul:J,instructionsText:`Evaluate proposals for cost implications before implementation.
|
|
430
430
|
Flag infrastructure or dependency changes that may increase operating costs.
|
|
431
431
|
Quantify the impact of technical debt in terms of developer time and risk.
|
|
432
432
|
Recommend cost optimization opportunities in existing systems.
|
|
433
|
-
Ensure resource allocation aligns with project priorities.`},{id:"engineer",name:"Engineer",icon:"⎔",title:"Software Engineer",role:"engineer",description:"Implements features, fixes bugs, and writes well-tested code across the full application stack.",soul:
|
|
433
|
+
Ensure resource allocation aligns with project priorities.`},{id:"engineer",name:"Engineer",icon:"⎔",title:"Software Engineer",role:"engineer",description:"Implements features, fixes bugs, and writes well-tested code across the full application stack.",soul:X,instructionsText:`Write tests for every new function and bug fix.
|
|
434
434
|
Follow existing code patterns and conventions in the project.
|
|
435
435
|
Keep functions small, focused, and well-named.
|
|
436
436
|
Handle error cases explicitly — never silently swallow errors.
|
|
@@ -496,4 +496,4 @@ Include relevant context files for the executor to read first.`},{id:"reviewer",
|
|
|
496
496
|
Verify error handling is explicit and informative, not silent failures.
|
|
497
497
|
Ensure new code follows existing patterns and conventions in the codebase.
|
|
498
498
|
Look for missing tests on new logic paths, especially edge cases.
|
|
499
|
-
Flag performance concerns only when they have measurable impact.`}];function Ie({isOpen:c,onClose:m,onUseDraft:p,projectId:h,existingAgents:y,mode:x="create",existingAgentConfig:g}){const{t:n}=
|
|
499
|
+
Flag performance concerns only when they have measurable impact.`}];function Ie({isOpen:c,onClose:m,onUseDraft:p,projectId:h,existingAgents:y,mode:x="create",existingAgentConfig:g}){const{t:n}=_("app"),[d,l]=r.useState("initial"),[b,S]=r.useState(""),[u,k]=r.useState(null),[j,t]=r.useState(""),[f,E]=r.useState("answer"),[P,T]=r.useState(""),[a,D]=r.useState(null),[M,v]=r.useState(null),[q,N]=r.useState([]),C=x==="edit",O=r.useCallback(()=>{l("initial"),S(""),k(null),t(""),E("answer"),T(""),D(null),v(null),N([])},[]),R=r.useMemo(()=>ge.map(i=>({id:i.id,label:i.name,description:i.description})),[]);r.useEffect(()=>{if(!u)return;const i=V(u,h,{onThinking:o=>{N(H=>{const I=[...H],A=I[I.length-1];return A&&!A.question?(I[I.length-1]={...A,thinkingOutput:`${A.thinkingOutput??""}${o}`},I):[...I,{response:{},thinkingOutput:o}]})},onQuestion:o=>{t(o.question),E(o.id),l("question")},onSummary:o=>{D(o),l("summary")},onError:o=>{v(o),l("error")}});return()=>i.close()},[u,h]);const w=async()=>{try{u&&await K(u,h)}catch{}finally{O(),m()}};if(r.useEffect(()=>{c||O()},[c,O]),!c)return null;const s=i=>i==null||i===""?e.jsx("em",{className:"experimental-agent-onboarding-modal__summary-empty",children:n("agents.onboarding.notSet","Not set")}):e.jsx("span",{children:i}),W=async()=>{l("loading"),v(null);try{const i=await B(b,{mode:x,existingAgentConfig:g,existingAgents:y.map(o=>({id:o.id,name:o.name,role:o.role})),templates:R},h);k(i.sessionId)}catch(i){v(i.message),l("error")}},z=async()=>{if(u){l("loading"),v(null);try{const i={[f]:P};N(o=>[...o,{question:{id:f,type:"text",question:j},response:i}]),await Q(u,i,h),T("")}catch(i){v(i.message),l("error")}}},L=async()=>{a&&(p(a),await w())};return e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal modal-lg experimental-agent-onboarding-modal",role:"dialog","aria-modal":"true","aria-label":n("agents.onboarding.dialogLabel","AI Interview"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:n("agents.onboarding.title","AI Interview")}),e.jsx("button",{className:"modal-close",onClick:()=>void w(),"aria-label":n("common.closeAriaLabel","Close"),children:"×"})]}),q.length>0&&e.jsx(U,{entries:q}),d==="initial"&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"agent-onboarding-intent",children:C?n("agents.onboarding.intentLabelEdit","What should this agent change or improve?"):n("agents.onboarding.intentLabelCreate","What should this new agent own?")}),e.jsx("textarea",{id:"agent-onboarding-intent",className:"input experimental-agent-onboarding-modal__textarea",value:b,onChange:i=>S(i.target.value)}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",onClick:()=>void w(),children:n("common.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",disabled:!b.trim(),onClick:()=>void W(),children:C?n("agents.onboarding.startInterview","Start interview"):n("agents.onboarding.startOnboarding","Start onboarding")})]})]}),(d==="loading"||d==="question")&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"agent-onboarding-answer",children:j||n("agents.onboarding.thinking","Thinking...")}),e.jsx("textarea",{id:"agent-onboarding-answer",className:"input experimental-agent-onboarding-modal__textarea",value:P,onChange:i=>T(i.target.value)}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",onClick:()=>void w(),children:n("common.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",disabled:d==="loading"||!P.trim(),onClick:()=>void z(),children:n("agents.onboarding.continue","Continue")})]})]}),d==="summary"&&a&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:C?n("agents.onboarding.updatedDraftReady","Updated draft ready for review"):n("agents.onboarding.draftReady","Draft ready for review")}),e.jsx("p",{className:"experimental-agent-onboarding-modal__summary-intro",children:n("agents.onboarding.draftIntro","Review this generated draft. Nothing is applied until you confirm.")}),e.jsxs("div",{className:"experimental-agent-onboarding-modal__summary card",children:[e.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[e.jsx("h4",{children:n("agents.onboarding.sectionIdentity","Identity")}),e.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldName","Name")}),e.jsx("dd",{children:s(a.name)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldRole","Role")}),e.jsx("dd",{children:s(a.role)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldTitle","Title")}),e.jsx("dd",{children:s(a.title)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldIcon","Icon")}),e.jsx("dd",{children:s(a.icon)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldReportsTo","Reports To")}),e.jsx("dd",{children:s(a.reportsTo)})]})]})]}),e.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[e.jsx("h4",{children:n("agents.onboarding.sectionConfiguration","Configuration")}),e.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldInlineInstructions","Inline Instructions")}),e.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:s(a.instructionsText)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldSoul","Soul")}),e.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:s(a.soul)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldAgentMemory","Agent Memory")}),e.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:s(a.memory)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldSkills","Skills")}),e.jsx("dd",{children:s(a.skills?.join(", "))})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldThinkingLevel","Thinking Level")}),e.jsx("dd",{children:s(a.thinkingLevel)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldMaxTurns","Max Turns")}),e.jsx("dd",{children:s(a.maxTurns)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldTemplate","Template")}),e.jsx("dd",{children:s(a.templateId)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldPatternAgent","Pattern Agent")}),e.jsx("dd",{children:s(a.patternAgentId)})]})]})]}),(a.heartbeatProcedurePath||a.heartbeatIntervalMs||a.heartbeatEnabled!==void 0||a.modelHint||a.runtimeHint)&&e.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[e.jsx("h4",{children:n("agents.onboarding.sectionRuntimeHints","Runtime Hints")}),e.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldHeartbeatPath","Heartbeat Procedure Path")}),e.jsx("dd",{children:s(a.heartbeatProcedurePath)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldHeartbeatInterval","Heartbeat Interval")}),e.jsx("dd",{children:s(a.heartbeatIntervalMs?`${a.heartbeatIntervalMs}ms`:void 0)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldHeartbeatEnabled","Heartbeat Enabled")}),e.jsx("dd",{children:s(a.heartbeatEnabled===void 0?void 0:a.heartbeatEnabled?n("agents.onboarding.yes","yes"):n("agents.onboarding.no","no"))})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldModelHint","Model Hint")}),e.jsx("dd",{children:s(a.modelHint)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:n("agents.onboarding.fieldRuntimeHint","Runtime Hint")}),e.jsx("dd",{children:s(a.runtimeHint)})]})]})]}),a.rationale&&e.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[e.jsx("h4",{children:n("agents.onboarding.sectionRationale","Rationale")}),e.jsx("p",{className:"experimental-agent-onboarding-modal__summary-block",children:a.rationale})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",onClick:()=>void w(),children:n("common.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void L(),children:C?n("agents.onboarding.applyDraftSettings","Apply draft to settings form"):n("agents.onboarding.applyDraftAgent","Apply draft to agent form")})]})]}),d==="error"&&M&&e.jsxs("div",{className:"form-group",children:[e.jsx("div",{className:"form-error",children:M}),e.jsx("div",{className:"modal-actions",children:e.jsx("button",{className:"btn",onClick:()=>void w(),children:n("common.close","Close")})})]})]})})}export{ge as A,Ie as E,ve as S,we as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as n,j as t}from"./vendor-react-BTgM5bbZ.js";import{J as vs,ax as xs,aj as js,ak as ws,cQ as Ns,X as Es,cR as Ss,cS as Ms}from"./index-Bglw05rM.js";import{u as $s}from"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";const Cs=5,As=3,Gs=280;function ts(r){return!!(r&&typeof r=="object"&&"code"in r&&r.code==="ACTIVE_GOAL_LIMIT_EXCEEDED")}function Us({initialGoals:r,anchorGoalId:m,onNavigateToMission:es}){const{t:a}=$s("app"),[d,f]=n.useState(()=>r??[]),[is,v]=n.useState(null),g=n.useRef(null),[x,G]=n.useState(r===void 0),[T,l]=n.useState(null),[as,L]=n.useState(!1),[b,D]=n.useState(""),[P,j]=n.useState(""),[F,c]=n.useState(null),[R,U]=n.useState(!1),[k,w]=n.useState(!1),[N,I]=n.useState(null),[O,E]=n.useState(""),[_,S]=n.useState(""),[V,h]=n.useState(null),[q,B]=n.useState(!1),[ns,os]=n.useState(()=>new Set),[ls,rs]=n.useState([]),[y,M]=n.useState({}),[$,H]=n.useState({}),[C,W]=n.useState(null),[ds,J]=n.useState(null);n.useEffect(()=>{if(r!==void 0)return;let s=!0;return(async()=>{try{G(!0),l(null);const i=await fetch("/api/goals");if(!i.ok)throw new Error(`Failed to load goals (${i.status})`);const o=await i.json();if(!s)return;f(Array.isArray(o.goals)?o.goals:[])}catch{if(!s)return;l(a("goals.loadError","Unable to load goals right now. Please try again."))}finally{s&&G(!1)}})(),()=>{s=!1}},[r]),n.useEffect(()=>{let s=!0;return(async()=>{try{const i=await fetch("/api/missions");if(!i.ok)throw new Error(`Failed to load missions (${i.status})`);const o=await i.json(),u=Array.isArray(o)?o:Array.isArray(o.missions)?o.missions:[];s&&rs(u.map(p=>({id:p.id,title:p.title,status:p.status})))}catch{s&&l(a("goals.missionsLoadError","Unable to load missions right now. Please try again."))}})(),()=>{s=!1}},[a]);const K=async s=>{const e=await fetch(`/api/goals/${encodeURIComponent(s)}/missions`);if(!e.ok)throw new Error(`Failed to load linked missions (${e.status})`);const i=await e.json();return Array.isArray(i.missions)?i.missions:[]};n.useEffect(()=>{let s=!0;return(async()=>{if(d.length===0){M({});return}try{const i=await Promise.all(d.map(async o=>[o.id,await K(o.id)]));s&&M(Object.fromEntries(i))}catch{s&&l(a("goals.linkedMissionsLoadError","Unable to load linked missions right now. Please try again."))}})(),()=>{s=!1}},[d,a]);const A=n.useMemo(()=>d.filter(s=>s.status==="active").length,[d]),cs=A>=As&&A<=Cs;n.useEffect(()=>{if(!m){v(null);return}const s=document.getElementById(`goal-card-${m}`);if(s)return v(m),typeof s.scrollIntoView=="function"&&s.scrollIntoView({behavior:"smooth",block:"center"}),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{v(e=>e===m?null:e),g.current=null},1600),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[m,d]);function us(){l(null),c(null),L(!0)}function gs(s){I(s.id),E(s.title),S(s.description??""),h(null)}function X(){I(null),E(""),S(""),h(null)}function z(){L(!1),D(""),j(""),c(null),w(!1)}async function ms(){const s=b.trim();if(!s){c(a("goals.titleRequired","Title is required."));return}try{w(!0),c(null);const e=await Ss(s);j(e)}catch(e){c(Ms(e))}finally{w(!1)}}async function hs(){const s=b.trim();if(!s){c(a("goals.titleRequired","Title is required."));return}try{U(!0),c(null),l(null);const e=await fetch("/api/goals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({title:s,description:P})});if(e.ok){const o=await e.json();f(u=>[...u,o]),z();return}let i=null;try{i=await e.json()}catch{i=null}if(e.status===409&&ts(i)){l(a("goals.capError","Cannot activate more than 5 goals. Resolve an active goal before activating another."));return}c(a("goals.createError","Unable to create goal right now. Please try again."))}catch{c(a("goals.createError","Unable to create goal right now. Please try again."))}finally{U(!1)}}async function ps(){if(!N)return;const s=O.trim();if(!s){h(a("goals.titleRequired","Title is required."));return}try{B(!0),h(null);const e=await fetch(`/api/goals/${N}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:s,description:_})});if(!e.ok)throw new Error(`Failed to update goal (${e.status})`);const i=await e.json();f(o=>o.map(u=>u.id===i.id?i:u)),X()}catch{h(a("goals.saveError","Unable to save goal right now. Please try again."))}finally{B(!1)}}function fs(s){return s.length>Gs||s.includes(`
|
|
2
|
+
`)}function bs(s){os(e=>{const i=new Set(e);return i.has(s)?i.delete(s):i.add(s),i})}function Q(s){const e=new Set((y[s]??[]).map(i=>i.id));return ls.filter(i=>!e.has(i.id))}async function Y(s){const e=await K(s);M(i=>({...i,[s]:e})),H(i=>({...i,[s]:""}))}async function ks(s){const e=$[s];if(e)try{W(s),l(null);const i=await fetch(`/api/missions/${encodeURIComponent(e)}/goals/${encodeURIComponent(s)}`,{method:"POST"});if(!i.ok)throw new Error(`Failed to link mission (${i.status})`);await Y(s)}catch{l(a("goals.linkMissionError","Unable to link mission right now. Please try again."))}finally{W(null)}}async function ys(s,e){try{J(`${s}:${e}`),l(null);const i=await fetch(`/api/missions/${encodeURIComponent(e)}/goals/${encodeURIComponent(s)}`,{method:"DELETE"});if(!i.ok)throw new Error(`Failed to unlink mission (${i.status})`);await Y(s)}catch{l(a("goals.unlinkMissionError","Unable to unlink mission right now. Please try again."))}finally{J(null)}}async function Z(s){const e=s.status==="active"?`/api/goals/${s.id}/archive`:`/api/goals/${s.id}/unarchive`;try{l(null);const i=await fetch(e,{method:"POST"});if(i.ok){const u=await i.json();f(p=>p.map(ss=>ss.id===u.id?u:ss));return}let o=null;try{o=await i.json()}catch{o=null}if(i.status===409&&ts(o)){l(a("goals.capError","Cannot activate more than 5 goals. Resolve an active goal before activating another."));return}l(a("goals.updateError","Unable to update goal status right now. Please try again."))}catch{l(a("goals.updateError","Unable to update goal status right now. Please try again."))}}return t.jsxs("section",{className:"goals-view","data-testid":"goals-view",children:[t.jsxs("header",{className:"goals-header",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"goals-title",children:a("goals.title","Goals")}),t.jsx("p",{className:"goals-count","data-testid":"goals-active-count",children:a("goals.activeCount","{{count}} active goals",{count:A})})]}),t.jsxs("button",{type:"button",className:"btn btn-primary goals-add-button",onClick:us,"data-testid":"goals-add-button",children:[t.jsx(vs,{"aria-hidden":"true"}),a("goals.addGoal","Add Goal")]})]}),as?t.jsxs("div",{className:"card goals-form","data-testid":"goals-form",children:[t.jsx("label",{className:"goals-form-label",htmlFor:"goals-form-title",children:a("goals.labelTitle","Title")}),t.jsx("input",{id:"goals-form-title",className:"input",type:"text",value:b,maxLength:200,onChange:s=>D(s.target.value),"data-testid":"goals-form-title"}),t.jsxs("div",{className:"goals-form-label-row",children:[t.jsx("label",{className:"goals-form-label",htmlFor:"goals-form-description",children:a("goals.labelDescription","Description")}),t.jsxs("button",{type:"button",className:"btn goals-form-draft-button",onClick:()=>void ms(),disabled:!b.trim()||k,"data-testid":"goals-form-draft-ai",children:[t.jsx(xs,{"aria-hidden":"true"}),k?a("goals.drafting","Drafting…"):a("goals.draftWithAi","Draft with AI")]})]}),t.jsx("textarea",{id:"goals-form-description",className:"input",value:P,maxLength:5e3,onChange:s=>j(s.target.value),"data-testid":"goals-form-description"}),F?t.jsx("p",{className:"form-error goals-error",role:"alert",children:F}):null,t.jsxs("div",{className:"goals-form-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void hs(),disabled:R||k,"data-testid":"goals-form-submit",children:a("actions.save","Save")}),t.jsx("button",{type:"button",className:"btn",onClick:z,disabled:R||k,"data-testid":"goals-form-cancel",children:a("actions.cancel","Cancel")})]})]}):null,cs?t.jsx("p",{className:"goals-warning",role:"status",children:a("goals.capWarning","Approaching the 5-active goal cap. Keep active goals focused.")}):null,T?t.jsx("p",{className:"form-error goals-error",role:"alert","data-testid":"goals-error",children:T}):null,x?t.jsx("p",{className:"goals-loading",role:"status","data-testid":"goals-loading",children:a("goals.loading","Loading goals…")}):null,!x&&d.length===0?t.jsx("div",{className:"goals-empty card","data-testid":"goals-empty-state",children:a("goals.emptyState","No goals yet. Add one to begin tracking strategic outcomes.")}):null,!x&&d.length>0?t.jsx("div",{className:"goals-list","data-testid":"goals-list",children:d.map(s=>t.jsxs("article",{id:`goal-card-${s.id}`,className:`card goals-card ${s.status==="archived"?"goals-card-archived":""} ${is===s.id?"goals-card--anchored":""}`.trim(),"data-testid":`goal-card-${s.id}`,children:[N===s.id?t.jsxs("div",{className:"goals-card-main goals-card-edit",children:[t.jsx("label",{className:"goals-form-label",htmlFor:`goal-edit-title-${s.id}`,children:a("goals.labelTitle","Title")}),t.jsx("input",{id:`goal-edit-title-${s.id}`,className:"input",type:"text",value:O,maxLength:200,onChange:e=>E(e.target.value),"data-testid":`goal-edit-title-${s.id}`}),t.jsx("label",{className:"goals-form-label",htmlFor:`goal-edit-description-${s.id}`,children:a("goals.labelDescription","Description")}),t.jsx("textarea",{id:`goal-edit-description-${s.id}`,className:"input",value:_,maxLength:5e3,onChange:e=>S(e.target.value),"data-testid":`goal-edit-description-${s.id}`}),V?t.jsx("p",{className:"form-error goals-error",role:"alert",children:V}):null,t.jsxs("div",{className:"goals-card-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void ps(),disabled:q,"data-testid":`goal-edit-save-${s.id}`,children:a("actions.save","Save")}),t.jsx("button",{type:"button",className:"btn",onClick:X,disabled:q,"data-testid":`goal-edit-cancel-${s.id}`,children:a("actions.cancel","Cancel")})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"goals-card-main",children:[t.jsx("h3",{className:"goals-card-title",children:s.title}),s.description?(()=>{const e=fs(s.description),i=ns.has(s.id);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`markdown-body goals-card-description ${e&&!i?"goals-card-description-collapsed":""}`.trim(),children:t.jsx(js,{remarkPlugins:[ws],children:s.description})}),e?t.jsx("button",{type:"button",className:"btn goals-card-description-toggle","aria-expanded":i,"data-testid":`goal-description-toggle-${s.id}`,onClick:()=>bs(s.id),children:i?a("actions.showLess","Show less"):a("actions.showMore","Show more")}):null]})})():null,t.jsxs("p",{className:"goals-card-status",children:[a("goals.status","Status"),": ",s.status]})]}),t.jsxs("div",{className:"goals-card-actions",children:[t.jsx("button",{type:"button",className:"btn",onClick:()=>gs(s),"data-testid":`goal-edit-${s.id}`,children:a("actions.edit","Edit")}),s.status==="active"?t.jsx("button",{type:"button",className:"btn goals-activate-button",onClick:()=>void Z(s),"data-testid":`goal-archive-${s.id}`,children:a("goals.archive","Archive")}):t.jsx("button",{type:"button",className:"btn goals-activate-button",onClick:()=>void Z(s),"data-testid":`goal-unarchive-${s.id}`,children:a("goals.unarchive","Unarchive")})]})]}),t.jsxs("section",{className:"goals-linked-missions","aria-label":a("goals.linkedMissions","Linked missions"),children:[t.jsxs("div",{className:"goals-linked-missions-header",children:[t.jsx("h4",{className:"goals-linked-missions-title",children:a("goals.linkedMissionsTitle","Linked Missions")}),t.jsx("span",{className:"goals-linked-missions-count",children:a("goals.linkedMissionsCount",{count:y[s.id]?.length??0,defaultValue_one:"{{count}} linked",defaultValue_other:"{{count}} linked"})})]}),t.jsxs("div",{className:"goals-linked-missions-controls",children:[t.jsxs("select",{className:"input goals-linked-missions-picker","data-testid":`goal-mission-picker-${s.id}`,value:$[s.id]??"",onChange:e=>H(i=>({...i,[s.id]:e.target.value})),"aria-label":a("goals.missionPicker","Mission to link"),disabled:C===s.id||Q(s.id).length===0,children:[t.jsx("option",{value:"",children:a("goals.selectMission","Select a mission")}),Q(s.id).map(e=>t.jsx("option",{value:e.id,children:e.title},e.id))]}),t.jsxs("button",{type:"button",className:"btn btn-primary goals-linked-missions-link-button","data-testid":`goal-mission-link-button-${s.id}`,disabled:!$[s.id]||C===s.id,onClick:()=>void ks(s.id),children:[t.jsx(Ns,{size:16,"aria-hidden":"true"}),C===s.id?a("goals.linkingMission","Linking…"):a("goals.linkMission","Link mission")]})]}),(y[s.id]?.length??0)>0?t.jsx("div",{className:"goals-linked-missions-list",children:(y[s.id]??[]).map(e=>t.jsxs("div",{className:"goals-linked-mission-chip","data-testid":`goal-linked-mission-chip-${e.id}`,children:[t.jsx("button",{type:"button",className:"btn goals-linked-mission-link",onClick:()=>es?.(e.id),children:e.title}),t.jsx("span",{className:"goals-linked-mission-status",children:e.status}),t.jsx("button",{type:"button",className:"btn-icon goals-linked-mission-unlink","data-testid":`goal-linked-mission-unlink-${e.id}`,"aria-label":a("goals.unlinkMission","Unlink mission"),disabled:ds===`${s.id}:${e.id}`,onClick:()=>void ys(s.id,e.id),children:t.jsx(Es,{size:16,"aria-hidden":"true"})})]},e.id))}):t.jsx("p",{className:"goals-linked-missions-empty",children:a("goals.noLinkedMissions","No linked missions.")})]})]},s.id))}):null]})}export{Us as GoalsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.goals-view{display:flex;flex-direction:column;gap:var(--space-lg);height:100%;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:var(--space-lg)}.goals-header{display:flex;justify-content:space-between;align-items:center;gap:var(--space-md)}.goals-title{margin:0;color:var(--text);font-size:calc(var(--space-lg) + var(--space-xs))}.goals-count{margin:0;color:var(--text-muted)}.goals-add-button{display:inline-flex;align-items:center;gap:var(--space-sm)}.goals-add-button:focus-visible,.goals-card:focus-visible,.goals-activate-button:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.goals-warning{margin:0;padding:var(--space-md);border-radius:var(--radius-md);border:calc(var(--space-xs) / 4) solid var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent);color:var(--color-warning)}.goals-error{margin:0}.goals-form{display:flex;flex-direction:column;gap:var(--space-sm)}.goals-form-label{color:var(--text-muted)}.goals-form-label-row{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm)}.goals-form-draft-button{display:inline-flex;align-items:center;gap:var(--space-xs);align-self:flex-start}.goals-form textarea.input{min-height:calc(var(--space-2xl) * 2);resize:vertical}.goals-form-actions{display:flex;gap:var(--space-sm)}.goals-list{display:flex;flex-direction:column;gap:var(--space-md)}.goals-card{display:flex;align-items:stretch;justify-content:space-between;gap:var(--space-md);scroll-margin-top:var(--space-xl)}.goals-card--anchored{border-color:var(--color-warning);box-shadow:var(--focus-ring-strong)}.goals-card-archived{border-color:color-mix(in srgb,var(--text-muted) 25%,transparent)}.goals-card-main{min-width:0}.goals-card-edit{display:flex;flex:1;flex-direction:column;gap:var(--space-sm)}.goals-card-title{margin:0;color:var(--text);font-size:calc(var(--space-md) + var(--space-xs))}.goals-card-description{margin:var(--space-xs) 0 0;color:var(--text-muted)}.goals-card-description>:first-child{margin-top:0}.goals-card-description>:last-child{margin-bottom:0}.goals-card-description-collapsed{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;overflow:hidden;max-height:calc(var(--space-md) * 6)}.goals-card-description-toggle{margin-top:var(--space-xs);align-self:flex-start;color:var(--text-muted)}.goals-card-status{margin:var(--space-xs) 0 0;color:var(--text-muted)}.goals-card-actions{display:flex;gap:var(--space-sm)}.goals-linked-missions{display:flex;flex:1;min-width:0;flex-direction:column;gap:var(--space-sm);padding-left:var(--space-md);border-left:calc(var(--space-xs) / 4) solid var(--border)}.goals-linked-missions-header{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);flex-wrap:wrap}.goals-linked-missions-title{margin:0;color:var(--text-muted);font-size:calc(var(--space-sm) + var(--space-xs));font-weight:600}.goals-linked-missions-count,.goals-linked-mission-status,.goals-linked-missions-empty{color:var(--text-muted)}.goals-linked-missions-controls{display:flex;align-items:center;gap:var(--space-sm);flex-wrap:wrap}.goals-linked-missions-picker{flex:1 1 calc(var(--space-xl) * 10);min-width:0}.goals-linked-missions-link-button,.goals-linked-mission-chip,.goals-linked-mission-link{display:inline-flex;align-items:center;gap:var(--space-xs)}.goals-linked-missions-list{display:flex;flex-wrap:wrap;gap:var(--space-sm)}.goals-linked-mission-chip{gap:calc(var(--space-xs) / 2);padding:calc(var(--space-xs) / 2);border:calc(var(--space-xs) / 4) solid var(--border);border-radius:var(--radius-pill);background:var(--surface-1)}.goals-linked-mission-link{border-radius:var(--radius-pill)}.goals-linked-missions-empty{margin:0}.goals-activate-button{min-width:calc(var(--space-2xl) * 2)}.goals-empty{color:var(--text-muted)}@media(max-width:768px){.goals-header,.goals-card{flex-direction:column;align-items:stretch}.goals-form-actions,.goals-card-actions,.goals-linked-missions-controls{flex-direction:column}.goals-linked-missions{padding-left:0;padding-top:var(--space-md);border-left:0;border-top:calc(var(--space-xs) / 4) solid var(--border)}.goals-linked-missions-link-button,.goals-linked-missions-picker{width:100%}.goals-card-description-collapsed{-webkit-line-clamp:3;max-height:calc(var(--space-md) * 5)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-BTgM5bbZ.js";import{c as ze,a7 as ce,a8 as Se,a9 as ke,am as Ce,an as We,ac as je,ao as Ke,ap as Ye,aq as Ve,ar as Je,as as Qe,at as Ze,au as Me,av as es,i as ss,aw as Ae,ax as I,A as ts,X as Ie,ay as me,R as N,az as is,m as ns,C as _e,aA as le,aB as Ne,aC as as,J as Le,aD as rs,aE as De,aF as cs}from"./index-Bglw05rM.js";import{u as Pe}from"./vendor-i18n-DYlSUfot.js";import{U as Ee}from"./users-a-ELbyyZ.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.insights-view{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.insights-view-header{display:flex;align-items:center;justify-content:space-between;padding:var(--space-lg);border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}.insights-view-title{display:flex;align-items:center;gap:var(--space-sm)}.insights-view-title h2{margin:0;font-size:1.125rem;font-weight:600;display:flex;align-items:center;gap:var(--space-sm)}.insights-view-count{font-size:.8125rem;color:var(--text-muted);font-weight:400}.insights-view-actions{display:flex;align-items:center;gap:var(--space-sm)}.insights-model-config{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm) var(--space-lg);border-bottom:1px solid var(--border);background:var(--surface-subtle)}.insights-model-label{font-size:.8125rem;color:var(--text-muted);white-space:nowrap;flex-shrink:0}.insights-model-config .model-combobox{max-width:320px}.insights-model-toggle{position:relative}.insights-model-indicator{position:absolute;top:2px;right:2px;width:6px;height:6px;border-radius:50%;background:var(--todo, #f59e0b)}.insights-view-close{color:var(--text-muted)}.insights-view-close:hover{color:var(--text)}.insights-status-region{padding:var(--space-md) var(--space-lg);flex-shrink:0}.insights-status-region:empty{padding:0}.insights-status-message{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);border-radius:var(--radius-md);font-size:.8125rem}.insights-status-message--success{background:color-mix(in srgb,var(--color-success) 10%,transparent);color:var(--color-success)}.insights-status-message--error{background:color-mix(in srgb,var(--color-error) 10%,transparent);color:var(--color-error)}.insights-status-message--info{background:color-mix(in srgb,var(--accent) 10%,transparent);color:var(--accent)}.insights-error-callout{display:flex;align-items:center;gap:var(--space-sm);margin:0 var(--space-lg) var(--space-md);padding:var(--space-md);background:color-mix(in srgb,var(--color-error) 10%,transparent);border:1px solid color-mix(in srgb,var(--color-error) 30%,transparent);border-radius:var(--radius-md);color:var(--color-error);font-size:.8125rem;flex-shrink:0}.insights-run-info{padding:0 var(--space-lg) var(--space-md);flex-shrink:0}.insights-run-status{font-size:.75rem;color:var(--text-muted)}.insights-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-md);padding:var(--space-2xl);color:var(--text-muted)}.insights-error{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-md);padding:var(--space-2xl);text-align:center}.insights-error p{color:var(--text-muted);margin:0}.insights-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-md);padding:var(--space-2xl);text-align:center;flex:1}.insights-empty h3{margin:0;font-size:1.125rem;color:var(--text)}.insights-empty p{color:var(--text-muted);margin:0;max-width:calc(var(--space-2xl) * 12 + var(--space-lg))}.insights-body{flex:1;min-height:0;display:flex;overflow:hidden}.insights-sidebar{width:calc(var(--space-2xl) * 7 + var(--space-lg));flex-shrink:0;border-right:1px solid var(--border);background:var(--surface);overflow-y:auto;min-height:0}.insights-category-list{list-style:none;margin:0;padding:var(--space-sm);display:flex;flex-direction:column;gap:var(--space-xs)}.insights-category-item{width:100%;display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);background:transparent;border:1px solid transparent;border-radius:var(--radius-md);color:var(--text);font:inherit;font-size:.8125rem;text-align:left;cursor:pointer;transition:background var(--transition-fast),border-color var(--transition-fast)}.insights-category-item:hover{background:var(--surface-1)}.insights-category-item--active{background:color-mix(in srgb,var(--accent) 12%,transparent);border-color:color-mix(in srgb,var(--accent) 35%,transparent);color:var(--accent)}.insights-category-icon{flex-shrink:0;color:var(--accent)}.insights-category-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.insights-category-count{flex-shrink:0;font-size:.75rem;color:var(--text-muted);background:var(--surface-1);padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);border:1px solid var(--border)}.insights-category-item--active .insights-category-count{background:var(--surface);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 30%,transparent)}.insights-detail{flex:1;min-width:0;min-height:0;overflow-y:auto;padding:var(--space-lg)}.insights-section{background:var(--card);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}.insights-section-header{display:flex;align-items:center;justify-content:space-between;padding:var(--space-md) var(--space-lg);background:var(--surface);border-bottom:1px solid var(--border)}.insights-section-title{display:flex;align-items:center;gap:var(--space-sm)}.insights-section-title h3{margin:0;font-size:.9375rem;font-weight:600}.insights-section-icon{color:var(--accent)}.insights-section-count{font-size:.75rem;color:var(--text-muted);background:var(--surface-1);padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);border:1px solid var(--border)}.insights-section-content{padding:var(--space-md)}.insights-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--space-md)}.insight-item{padding:var(--space-md);background:var(--surface);border:1px solid var(--border);border-left:var(--space-xs) solid var(--accent);border-radius:var(--radius-md);transition:border-color var(--transition-fast)}.insight-item:hover{border-color:var(--accent)}.insight-item-header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-sm)}.insight-item-title{margin:0;font-size:.875rem;font-weight:600;color:var(--text);line-height:1.4}.insight-item-actions{display:flex;align-items:center;gap:var(--space-xs);flex-shrink:0}.insight-item-action-btn{display:inline-flex;align-items:center;justify-content:center;width:calc(var(--space-lg) * 2);height:calc(var(--space-lg) * 2);padding:0;background:transparent;border:none;border-radius:var(--radius-md);color:var(--text-muted);cursor:pointer;transition:background var(--transition-fast),color var(--transition-fast)}.insight-item-action-btn:hover:not(:disabled){background:var(--surface-1);color:var(--accent)}.insight-item-action-btn:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.insight-item-action-btn:disabled{opacity:.5;cursor:not-allowed}.insight-item-content{margin:var(--space-sm) 0 0;font-size:.8125rem;color:var(--text-muted);line-height:1.5;white-space:pre-wrap;word-break:break-word}.insight-item-meta{display:flex;align-items:center;gap:var(--space-md);margin-top:var(--space-sm);font-size:.75rem;color:var(--text-muted)}.insight-item-status{padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-sm);text-transform:capitalize;font-weight:500}.insight-item-status--generated{background:color-mix(in srgb,var(--accent) 15%,transparent);color:var(--accent)}.insight-item-status--confirmed{background:color-mix(in srgb,var(--color-success) 15%,transparent);color:var(--color-success)}.insight-item-status--stale{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.insight-item-status--dismissed,.insight-item-status--archived{background:color-mix(in srgb,var(--text-dim) 15%,transparent);color:var(--text-dim)}.insight-item--archived{opacity:.6;border-left-color:var(--text-dim)}.insight-item--archived .insight-item-title{text-decoration:line-through;color:var(--text-muted)}.insight-item--archived .insight-item-content{text-decoration:line-through}.insight-item-date{display:flex;align-items:center;gap:var(--space-xs)}@media(max-width:768px){.insights-view-header{flex-wrap:nowrap;gap:var(--space-sm);padding:var(--space-md)}.insights-view-title{min-width:0;flex:1 1 auto}.insights-view-title h2{font-size:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.insights-view-actions{flex-shrink:0;justify-content:flex-end;flex-wrap:nowrap;gap:var(--space-xs)}.insights-body{flex-direction:column}.insights-sidebar{width:100%;border-right:none;border-bottom:1px solid var(--border);overflow-x:auto;overflow-y:hidden;flex-shrink:0}.insights-category-list{flex-direction:row;flex-wrap:nowrap;padding:var(--space-sm);gap:var(--space-xs)}.insights-category-list>li{flex-shrink:0}.insights-category-item{white-space:nowrap;padding:var(--space-xs) var(--space-sm)}.insights-category-label{overflow:visible;text-overflow:clip}.insights-detail{padding:var(--space-md)}.insights-section-header{padding:var(--space-sm) var(--space-md)}.insights-section-content,.insight-item{padding:var(--space-sm)}.insight-item-title{word-break:break-word}.insight-item-header{flex-direction:column;gap:var(--space-sm)}.insight-item-meta{flex-wrap:wrap;gap:var(--space-sm)}.insight-item-actions{align-self:flex-end}.insight-item-action-btn{width:calc(var(--space-2xl) + var(--space-sm));height:calc(var(--space-2xl) + var(--space-sm))}.insights-view-actions .btn{min-height:calc(var(--space-2xl) + var(--space-xs))}.insights-show-archived-toggle{max-width:calc(var(--space-2xl) * 5 + var(--space-md));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.insights-view-close{min-height:calc(var(--space-2xl) + var(--space-xs));min-width:calc(var(--space-2xl) + var(--space-xs))}.insights-view-count{font-size:.75rem}.insights-model-config{padding:var(--space-xs) var(--space-md)}.insights-model-config .model-combobox{max-width:200px}}
|