@wrongstack/webui 1.0.11 → 1.0.13

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.
Files changed (36) hide show
  1. package/dist/assets/{AgentRosterView-BzVZjThP.js → AgentRosterView-BuAsY8eB.js} +1 -1
  2. package/dist/assets/{AnalyticsDashboard-BT_KhdxY.js → AnalyticsDashboard-iIkpKNGk.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-CdGaL5ob.js → AudienceMemoryPanel-CgKWvpxv.js} +1 -1
  4. package/dist/assets/{ChangesView-BbNRQjPu.js → ChangesView-Cd3Tl17b.js} +1 -1
  5. package/dist/assets/{ChimeraReviewsView-DdLrY1rA.js → ChimeraReviewsView-CWo6AV3H.js} +1 -1
  6. package/dist/assets/{ChronicleDashboard-CXAqB0-c.js → ChronicleDashboard-D8HEQ32t.js} +1 -1
  7. package/dist/assets/{CodeEditor-BRVibv3L.js → CodeEditor-BmnUVoHj.js} +1 -1
  8. package/dist/assets/{CodeMap-BVSuBKUK.js → CodeMap-CYr1LK2u.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-DO8KnHyT.js → CronJobsPanel-B9X-N_ft.js} +1 -1
  10. package/dist/assets/{DebugDashboard-nitOcTHq.js → DebugDashboard-KEZZY9pu.js} +1 -1
  11. package/dist/assets/{DesignGalleryView-DhavCall.js → DesignGalleryView-DWDsOUD3.js} +1 -1
  12. package/dist/assets/{GoalView-CCdMVcp4.js → GoalView-CmRWtduc.js} +1 -1
  13. package/dist/assets/{KanbanView-PzDm4bt2.js → KanbanView-BVHyGhDq.js} +2 -2
  14. package/dist/assets/{MailboxDetailView-DAljvmny.js → MailboxDetailView-COFzilLE.js} +1 -1
  15. package/dist/assets/{MemoryDrawer-IMvyNAhc.js → MemoryDrawer-m9ZlZ_xi.js} +1 -1
  16. package/dist/assets/{MemoryManager-BtC4dOvO.js → MemoryManager-Bb_RMZhJ.js} +1 -1
  17. package/dist/assets/{ProcessMonitor-C39U4XNb.js → ProcessMonitor-Btj6_6aw.js} +1 -1
  18. package/dist/assets/{ProviderTestView-CSNA3lH_.js → ProviderTestView-CVKjGm2z.js} +1 -1
  19. package/dist/assets/{QueuePanel-D7TXqgFW.js → QueuePanel-CSlu_Hat.js} +1 -1
  20. package/dist/assets/{RepositoryHistoryView-yhAMRjpk.js → RepositoryHistoryView-CIsxftEC.js} +1 -1
  21. package/dist/assets/{RequirementIntakeView-Dhp5_d6J.js → RequirementIntakeView-Dah2aHco.js} +1 -1
  22. package/dist/assets/{SageTabs-BlLy8Phu.js → SageTabs-GuriCwuB.js} +2 -2
  23. package/dist/assets/{SddHub-KdxihXZy.js → SddHub-C7IlzHtw.js} +1 -1
  24. package/dist/assets/{SessionInspectView-kKzWEPpe.js → SessionInspectView-_qPDgZXH.js} +1 -1
  25. package/dist/assets/{SessionList-DjDxENAu.js → SessionList-nn7wHkrG.js} +1 -1
  26. package/dist/assets/{SessionsDashboard-CGCCMceU.js → SessionsDashboard-BjevWtcd.js} +1 -1
  27. package/dist/assets/{SetupScreen-D70VCq7r.js → SetupScreen-DCupHAif.js} +1 -1
  28. package/dist/assets/{SkillDetailView-Dp2kWAQb.js → SkillDetailView-EaPGctff.js} +1 -1
  29. package/dist/assets/{TechStackView-DYdZrkkA.js → TechStackView-DXoJPVZf.js} +1 -1
  30. package/dist/assets/{TerminalPanel-B9Ka6hvR.js → TerminalPanel-DxAt_S44.js} +1 -1
  31. package/dist/assets/{index-BhXxZMAb.js → index-B70B52lT.js} +44 -44
  32. package/dist/assets/{index-BssEH_2N.css → index-NBVZNAcU.css} +1 -1
  33. package/dist/assets/{stores-BIVCS5nu.js → stores-DxKcenvb.js} +1 -1
  34. package/dist/index.html +3 -3
  35. package/dist/index.js +52 -27
  36. package/package.json +9 -9
@@ -4,4 +4,4 @@ import{Dt as e,K as t,Nt as n,wt as r,zt as i}from"./config-store-BAUadwHd.js";i
4
4
  …`),{text:a,truncated:i}}function re(e){return e.length===0?``:[`[File reference contract]`,`Before answering or modifying anything related to these references, use the available file-reading tools to read each complete project file:`,...e.map(e=>`- ${JSON.stringify(e)}`),`If a read is paginated or chunked, continue on the same path until EOF. Do not treat an inline preview as the complete file.`].join(`
5
5
  `)}function ie(e,t){if(e.length===0)return``;let n=[],r=new Set;for(let i of e){if(i.kind===`file`){let e=t?.[i.path];if(e){let t=O(i.path),a=t?`\`\`\`${t}`:"```",o=k(e),s=o.truncated?`preview; complete read required`:`entire file`;n.push(`${a}\n// ${i.path} (${s})\n${o.text}\n\`\`\``),o.truncated&&r.add(i.path)}else n.push(`@${i.path}`),r.add(i.path);continue}let e=O(i.path),a=e?`\`\`\`${e}`:"```",o=`// ${i.path}:${i.startLine}-${i.endLine}`,s=k(i.kind===`snippet`?i.content:i.preview);n.push(`${a}\n${o}\n${s.text}\n\`\`\``),s.truncated&&r.add(i.path)}let i=re([...r]);return[...n,i].filter(Boolean).join(`
6
6
 
7
- `)}var ae=s()((e,t)=>({refs:[],addRef:n=>{let r=t();if(n.kind===`file`&&r.refs.find(e=>e.kind===`file`&&e.path===n.path))return;let i={...n,id:ne()};e({refs:[...r.refs,i]})},removeRef:t=>{e(e=>({refs:e.refs.filter(e=>e.id!==t)}))},clearRefs:()=>e({refs:[]})})),oe=s()(e=>({info:null,setInfo:t=>e({info:t}),clear:()=>e({info:null})})),A=s()((e,t)=>({result:null,loading:!1,currentSeq:0,setResult:t=>e(e=>t.reqSeq===e.currentSeq?{result:t,loading:!1}:{}),setLoading:()=>e({loading:!0,result:null}),clear:()=>e({result:null,loading:!1}),nextSeq:()=>{let n=t().currentSeq+1;return e({currentSeq:n}),n}})),j=s()(e=>({phases:[],activePhaseId:null,overallPercent:0,autonomous:!1,title:null,goal:null,status:`idle`,multiBoard:!1,lastEvent:null,lastError:null,graphs:[],progress:null,setState:t=>e(e=>({phases:t.phases??e.phases,activePhaseId:t.activePhaseId===void 0?e.activePhaseId:t.activePhaseId,overallPercent:t.overallPercent??e.overallPercent,autonomous:t.autonomous??e.autonomous,title:t.title===void 0?e.title:t.title,goal:t.goal===void 0?e.goal:t.goal,status:t.status??e.status,multiBoard:t.multiBoard??e.multiBoard,lastEvent:t.lastEvent===void 0?e.lastEvent:t.lastEvent,lastError:t.lastError===void 0?e.lastError:t.lastError,graphs:t.graphs??e.graphs,progress:t.progress===void 0?e.progress:t.progress})),clear:()=>e({phases:[],activePhaseId:null,overallPercent:0,autonomous:!1,title:null,goal:null,status:`idle`,multiBoard:!1,lastEvent:null,lastError:null,graphs:[],progress:null}),hydrateFromServer:e=>{e({type:`goal.list`}),e({type:`goal.state`})}}));function M(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!(typeof t.iteration!=`number`||!Number.isFinite(t.iteration)||t.task!==void 0&&typeof t.task!=`string`||t.status!==void 0&&typeof t.status!=`string`||t.progress!==void 0&&(typeof t.progress!=`number`||!Number.isFinite(t.progress))||t.progressNote!==void 0&&typeof t.progressNote!=`string`||t.timestamp!==void 0&&typeof t.timestamp!=`string`)}function N(e){return!e||typeof e.goal!=`string`||!e.goal.trim()?null:{goal:e.goal,refinedGoal:typeof e.refinedGoal==`string`?e.refinedGoal:void 0,goalState:[`active`,`paused`,`completed`,`failed`,`abandoned`].includes(e.goalState)?e.goalState:`active`,iterations:typeof e.iterations==`number`?e.iterations:0,progress:typeof e.progress==`number`?e.progress:0,progressNote:typeof e.progressNote==`string`?e.progressNote:void 0,progressTrend:e.progressTrend===`accelerating`?`up`:e.progressTrend===`stalling`?`down`:e.progressTrend===`steady`?`stable`:void 0,deliverables:Array.isArray(e.deliverables)?e.deliverables.map((e,t)=>typeof e==`string`?{id:`d${t}`,text:e,status:/^\[[x✓]\]|✅|\(done\)/i.test(e)?`done`:`pending`}:e):void 0,journal:Array.isArray(e.journal)?e.journal.filter(M):void 0,lastTask:typeof e.lastTask==`string`?e.lastTask:void 0,lastStatus:typeof e.lastStatus==`string`?e.lastStatus:void 0}}var P=s()(e=>({goal:null,setGoal:t=>e({goal:N(t)}),clear:()=>e({goal:null}),appendJournalEntry:t=>e(e=>e.goal?{goal:{...e.goal,iterations:Math.max(e.goal.iterations,t.iteration),lastTask:t.task??e.goal.lastTask,lastStatus:t.status??e.goal.lastStatus,journal:[t,...e.goal.journal??[]].slice(0,200)}}:e),refresh:()=>{try{t()?.send?.({type:`goal-state.get`})}catch{}}}));function F(e,t){return e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&t.includes(e.slice(8)))===!0}var I=3e5,L=s()((e,t)=>({boards:[],boardTotal:0,activeBoardTotal:0,orphanedBoardTotal:0,activeBoardId:null,activeBoard:null,loading:!1,lastOutboundAction:null,error:null,queueHealth:null,supervisorSnapshot:null,workbench:null,verificationActivity:{},boardHistory:[],fetchBoardHistory:e=>{t().sendKanban(`kanban.board.history`,{boardId:e})},setLoading:t=>e({loading:t}),sendKanban:(t,n)=>(e({loading:!0,lastOutboundAction:t}),t),transitionTask:(t,n,r,i)=>{let a=`kanban.task.transition`;return e({loading:!0,lastOutboundAction:a}),a},dispatchTask:(t,n,r)=>{let i=`kanban.task.dispatch`;return e({loading:!0,lastOutboundAction:i}),i},moveTask:(t,n,r)=>{let i=`kanban.task.move`;return e({loading:!0,lastOutboundAction:i}),i},removeTask:(t,n)=>{let r=`kanban.task.remove`;return e({loading:!0,lastOutboundAction:r}),r},setActiveBoardId:t=>e({activeBoardId:t,queueHealth:null,supervisorSnapshot:null,verificationActivity:{}}),setError:t=>e({error:t}),setQueueHealth:t=>e({queueHealth:t}),handleResult:(n,r)=>{if(!r.success){e({loading:!1,error:r.error??`Kanban request failed`});return}let i=r.data;if((n===`kanban.supervisor.status`||n===`kanban.supervisor.audit`)&&i){e({supervisorSnapshot:i,loading:!1,error:null});return}if(n===`kanban.health`&&r.data){e({queueHealth:r.data,loading:!1,error:null});return}if(n===`kanban.workbench`&&r.data){e({workbench:r.data,loading:!1,error:null});return}if(n===`kanban.list`){let t=H(i)?i:null,n=t?t.items:Array.isArray(i)?i:[];e({boards:n,boardTotal:t?.total??n.length,activeBoardTotal:t?.activeTotal??n.filter(e=>U(e)).length,orphanedBoardTotal:t?.orphanedTotal??n.filter(e=>!U(e)).length,loading:!1,error:null});return}if(n===`kanban.delete`){let n=t().activeBoardId,r=i,a=r?.removed===!0,o=r?.boardId??n;e(e=>{let t=a?e.boards.find(e=>e.id===o):void 0,n=t?U(t):void 0;return{boards:a?e.boards.filter(e=>e.id!==o):e.boards,boardTotal:a?Math.max(0,e.boardTotal-1):e.boardTotal,activeBoardTotal:n===!0?Math.max(0,e.activeBoardTotal-1):e.activeBoardTotal,orphanedBoardTotal:n===!1?Math.max(0,e.orphanedBoardTotal-1):e.orphanedBoardTotal,activeBoardId:a&&e.activeBoardId===o?null:e.activeBoardId,activeBoard:a&&e.activeBoard?.id===o?null:e.activeBoard,loading:!1,error:null}});return}if(n===`kanban.task.remove`){let t=i;e(e=>{let n=R(t?.board)?t.board:null;if(n&&e.activeBoardId===n.id)return{boards:K(e.boards,G(n)),activeBoard:n,loading:!1,error:null};let r=t?.boardId,i=t?.taskId,a=t?.removed===!0&&i&&e.activeBoard&&(!r||e.activeBoard.id===r)?{...e.activeBoard,tasks:e.activeBoard.tasks.filter(e=>e.id!==i)}:e.activeBoard;return{activeBoard:a,boards:a?K(e.boards,G(a)):e.boards,loading:!1,error:null}});return}if(n===`kanban.board.history`){Array.isArray(i)&&e({boardHistory:i});return}if(n===`kanban.task.verification_started`){let t=i;if(t?.boardId&&t.taskId){let n=`${t.boardId}:${t.taskId}`;e(e=>{let t=Date.now(),r=Object.fromEntries(Object.entries(e.verificationActivity).filter(([,e])=>t-e.startedAt<I));return r[n]={startedAt:t},{verificationActivity:r,loading:!1,error:null}})}return}if(n===`kanban.task.verification_completed`&&B(i)){let t=`${i.boardId}:${i.task.id}`;e(e=>{let n={...e.verificationActivity};if(delete n[t],e.activeBoard&&e.activeBoard.id===i.boardId){let t=q(e.activeBoard,i.task);return{verificationActivity:n,boards:K(e.boards,G(t)),activeBoard:t,loading:!1,error:null}}return{verificationActivity:n,loading:!1,error:null}});return}if(V(i)){let t=i.board;e(e=>({boards:K(e.boards,G(t)),activeBoard:e.activeBoardId===t.id?t:e.activeBoard,loading:!1,error:null}));return}if(B(i)){e(e=>{if(e.activeBoard&&e.activeBoard.id===i.boardId){let t=q(e.activeBoard,i.task);return{boards:K(e.boards,G(t)),activeBoard:t,loading:!1,error:null}}return{loading:!1,error:null}});return}if(R(i)){let t=G(i);if(n===`kanban.get`){e(e=>({boards:K(e.boards,t),activeBoard:e.activeBoardId===i.id?i:e.activeBoard,loading:!1,error:null}));return}e(e=>({boards:K(e.boards,t),activeBoardId:i.id,activeBoard:i,loading:!1,error:null}));return}if(z(i)){e(e=>({...e.activeBoard?(()=>{let t=q(e.activeBoard,i);return{activeBoard:t,boards:K(e.boards,G(t))}})():{activeBoard:e.activeBoard},loading:!1,error:null}));return}if(Array.isArray(i)&&i.every(W)){e(e=>({...e.activeBoard?(()=>{let t={...e.activeBoard,columns:i};return{activeBoard:t,boards:K(e.boards,G(t))}})():{activeBoard:e.activeBoard},loading:!1,error:null}));return}e({loading:!1,error:null})}}));function R(e){return!!e&&typeof e==`object`&&Array.isArray(e.columns)&&Array.isArray(e.tasks)}function z(e){return!!e&&typeof e==`object`&&typeof e.title==`string`}function B(e){return!!e&&typeof e==`object`&&typeof e.boardId==`string`&&z(e.task)}function V(e){return!!e&&typeof e==`object`&&R(e.board)}function H(e){return!!e&&typeof e==`object`&&Array.isArray(e.items)&&typeof e.total==`number`}function U(e){return F(e,[])}function W(e){return!!e&&typeof e==`object`&&typeof e.id==`string`}function G(e){return{id:e.id,title:e.title,description:e.description,tags:e.tags,presence:e.presence,createdAt:e.createdAt,updatedAt:e.updatedAt,columnCount:e.columns.length,taskCount:e.tasks.length,completedTaskCount:e.tasks.filter(e=>e.status===`completed`).length}}function K(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function q(e,t){let n=e.tasks.some(e=>e.id===t.id)?e.tasks.map(e=>e.id===t.id?t:e):[...e.tasks,t];return{...e,tasks:n}}function se(e){switch(e){case`tui`:return`tui`;case`cli`:case`repl`:return`repl`;case`webui`:return`webui`;default:return`webui`}}function ce(e){let t={tui:0,webui:0,repl:0},n=0,r=0,i={toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0};for(let a of e){t[se(a.clientType)]+=1;for(let e of a.agents)n+=1,(e.status===`running`||e.status===`streaming`)&&(r+=1),i.toolCalls+=e.toolCalls??0,i.costUsd+=e.costUsd??0,i.tokensIn+=e.tokensIn??0,i.tokensOut+=e.tokensOut??0}return{clientCounts:t,totalAgents:n,activeAgents:r,aggregate:i}}function le(e){if(e!==void 0)return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}function ue(e){return e.map(e=>({...e,agents:e.agents.map(e=>({...e,ctxPct:le(e.ctxPct)}))}))}var de=0,J=s()(e=>({clientCounts:{tui:0,webui:0,repl:0},mailActivity:[],totalMessages:0,openMessages:0,unreadMessages:0,totalAgents:0,activeAgents:0,currentSession:{},liveSessions:[],aggregate:{toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0},lastUpdated:Date.now(),setClientCounts:t=>e({clientCounts:t,lastUpdated:Date.now()}),setLiveSessions:t=>{let n=ue(t),r=J.getState().liveSessions;if(r.length===n.length){let e=!0;for(let t=0;t<n.length;t++){let i=n[t],a=r[t];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt||i.lastHeartbeatAt!==a.lastHeartbeatAt){e=!1;break}let o=i.agents??[],s=a.agents??[];if(o.length!==s.length){e=!1;break}for(let t=0;t<o.length;t++)if(o[t].id!==s[t].id||o[t].name!==s[t].name||o[t].status!==s[t].status||o[t].currentTool!==s[t].currentTool||o[t].iterations!==s[t].iterations||o[t].toolCalls!==s[t].toolCalls||o[t].ctxPct!==s[t].ctxPct||o[t].tokensIn!==s[t].tokensIn||o[t].tokensOut!==s[t].tokensOut||o[t].costUsd!==s[t].costUsd||o[t].recentTools?.[0]?.id!==s[t].recentTools?.[0]?.id||o[t].recentMail?.[0]?.id!==s[t].recentMail?.[0]?.id||o[t].activity?.reads!==s[t].activity?.reads||o[t].activity?.writes!==s[t].activity?.writes||o[t].activity?.edits!==s[t].activity?.edits||o[t].activity?.terminalCalls!==s[t].activity?.terminalCalls||o[t].activity?.mailReceived!==s[t].activity?.mailReceived||o[t].activity?.mailSent!==s[t].activity?.mailSent||o[t].activity?.linesAdded!==s[t].activity?.linesAdded||o[t].activity?.linesRemoved!==s[t].activity?.linesRemoved){e=!1;break}if(!e)break}if(e)return}e({liveSessions:n,...ce(n),lastUpdated:Date.now()})},addMailActivity:t=>e(e=>({mailActivity:[{...t,seq:t.seq??++de},...e.mailActivity].slice(0,50),lastUpdated:Date.now()})),setMailStats:(t,n,r)=>e({totalMessages:t,openMessages:n,unreadMessages:r,lastUpdated:Date.now()}),setAgentStats:(t,n)=>e({totalAgents:t,activeAgents:n,lastUpdated:Date.now()}),setCurrentSession:t=>e({currentSession:{...J.getState().currentSession,...t},lastUpdated:Date.now()}),clear:()=>e({clientCounts:{tui:0,webui:0,repl:0},mailActivity:[],totalMessages:0,openMessages:0,unreadMessages:0,totalAgents:0,activeAgents:0,currentSession:{},liveSessions:[],aggregate:{toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0},lastUpdated:Date.now()})})),fe=[3e4,6e4,12e4,3e5,6e5],Y=12e4,pe=s()(a(e=>({viewMode:`office`,showHud:!0,showLegend:!0,showMinimap:!0,showControls:!0,animateEdges:!0,showFeed:!0,background:`dots`,waitThresholdMs:Y,setViewMode:t=>e({viewMode:t}),setShowHud:t=>e({showHud:t}),setShowLegend:t=>e({showLegend:t}),setShowMinimap:t=>e({showMinimap:t}),setShowControls:t=>e({showControls:t}),setAnimateEdges:t=>e({animateEdges:t}),setShowFeed:t=>e({showFeed:t}),setBackground:t=>e({background:t}),setWaitThresholdMs:t=>e({waitThresholdMs:Number.isFinite(t)&&t>0?Math.round(t):Y})}),{name:`wrongstack-officemap`}));function X(e){return`${e.providerId}${e.meterId}`}function me(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.providerId==`string`&&typeof t.meterId==`string`&&Array.isArray(t.windows)&&typeof t.capturedAt==`number`}var he=s(e=>({meters:{},apply:t=>e(e=>{let n={...e.meters};for(let e of t){if(!me(e))continue;let t=n[X(e)];n[X(e)]={...e,...e.planLabel===void 0&&t?.planLabel!==void 0?{planLabel:t.planLabel}:{},...e.meterLabel===void 0&&t?.meterLabel!==void 0?{meterLabel:t.meterLabel}:{}}}return{meters:n}}),clear:()=>e({meters:{}})}));function ge(e){let t;for(let n of Object.values(e))for(let e of n.windows){if(!t||e.usedPercent>t.window.usedPercent){t={snapshot:n,window:e};continue}if(e.usedPercent===t.window.usedPercent){let r=e.resetsAt,i=t.window.resetsAt;r!==void 0&&(i===void 0||r<i)&&(t={snapshot:n,window:e})}}return t}function _e(e){if(e.label)return e.label;let t=e.windowMinutes;return t!==void 0&&Number.isFinite(t)&&t>0?t%1440==0?`${t/1440}d`:t%60==0?`${t/60}h`:`${t}m`:e.id}function ve(e,t=Date.now()){if(e?.resetsAt===void 0)return;let n=e.resetsAt*1e3-t;if(n<=0)return;let r=Math.floor(n/6e4);if(r<1)return`${Math.max(1,Math.round(n/1e3))}s`;let i=Math.floor(r/1440),a=Math.floor(r%1440/60),o=r%60;return i>0?a>0?`${i}d ${a}h`:`${i}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:`${o}m`}var Z=e=>`${e.providerId}\u0000${e.model}`,ye=s(e=>({entries:{},audit:[],summary:null,loading:!1,error:null,update:t=>e(e=>{let n={...e.entries},r=Z(t);if(t.state===`healthy`)delete n[r];else{let e=n[r],i=Object.fromEntries(Object.entries(t).filter(e=>e[1]!==void 0));n[r]={...e,...i}}return{entries:n}}),hydrate:t=>e({entries:Object.fromEntries(t.filter(e=>e.state!==`healthy`).map(e=>[Z(e),e]))}),applySnapshot:t=>{let n=t.statuses;if(!Array.isArray(n)){e({error:`Invalid snapshot from server`,loading:!1});return}let r={};for(let e of n){if(!e||typeof e!=`object`)continue;let t=e,n=typeof t.providerId==`string`?t.providerId:``,i=typeof t.model==`string`?t.model:``;if(!n||!i)continue;let a=t.state;(a===`healthy`||a===`degraded`||a===`blocked`)&&(r[`${n}\u0000${i}`]={providerId:n,model:i,state:a,reason:(typeof t.lastErrorKind==`string`?t.lastErrorKind:``)||a,updatedAt:typeof t.lastFailureAt==`number`?t.lastFailureAt:Date.now(),...typeof t.stateExpiresAt==`number`?{stateExpiresAt:t.stateExpiresAt}:{},...typeof t.consecutiveFailures==`number`?{consecutiveFailures:t.consecutiveFailures}:{},...typeof t.totalFailures==`number`?{totalFailures:t.totalFailures}:{},...typeof t.rateLimitHits==`number`?{rateLimitHits:t.rateLimitHits}:{},...typeof t.lastErrorMessage==`string`?{lastErrorMessage:t.lastErrorMessage}:{},...typeof t.lastErrorKind==`string`?{lastErrorKind:t.lastErrorKind}:{},...typeof t.lastErrorStatus==`number`?{lastErrorStatus:t.lastErrorStatus}:{},...Array.isArray(t.recentErrors)?{recentErrors:t.recentErrors.slice(0,20)}:{},...typeof t.lastSessionId==`string`?{lastSessionId:t.lastSessionId}:{},...typeof t.lastAgentId==`string`?{lastAgentId:t.lastAgentId}:{},...typeof t.lastFailureAt==`number`?{lastFailureAt:t.lastFailureAt}:{}})}let i=t;e({entries:r,summary:{totalPairs:typeof i.totalPairs==`number`?i.totalPairs:0,healthy:typeof i.healthy==`number`?i.healthy:0,degraded:typeof i.degraded==`number`?i.degraded:0,blocked:typeof i.blocked==`number`?i.blocked:0,totalFailures:typeof i.totalFailures==`number`?i.totalFailures:0,totalRateLimits:typeof i.totalRateLimits==`number`?i.totalRateLimits:0},error:null,loading:!1})},setAudit:t=>e({audit:t}),setLoading:t=>e({loading:t}),setError:t=>e({error:t,loading:!1}),removeEntry:(t,n)=>e(e=>{let r={...e.entries};return delete r[Z({providerId:t,model:n})],{entries:r}}),clear:()=>e({entries:{},audit:[],summary:null,error:null})})),be=s()(e=>({snapshot:null,boards:[],lifecycleResult:null,destroying:!1,setSnapshot:t=>e({snapshot:t}),setBoards:t=>e({boards:t}),setLifecycleResult:t=>e({lifecycleResult:t}),setDestroying:t=>e({destroying:t})})),xe=s()(e=>({snapshot:null,agentText:``,error:null,startedRunId:null,setSnapshot:t=>{if(t.discarded||t.phase===`idle`&&!t.sessionId){e({snapshot:null,agentText:``,error:null});return}e({snapshot:t,error:null,...t.lastAgentText?{agentText:t.lastAgentText}:{}})},setAgentText:t=>e({agentText:t}),setError:t=>e({error:t}),setStartedRunId:t=>e({startedRunId:t}),reset:()=>e({snapshot:null,agentText:``,error:null,startedRunId:null})})),Se=f(e=>({sideEffects:[],loading:!1,setSideEffects:t=>e({sideEffects:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({sideEffects:[],loading:!1})})),Ce=s()(e=>({specs:[],detail:null,expandedSpecId:null,setSpecs:t=>e({specs:t}),setDetail:t=>e({detail:t}),setExpanded:t=>e({expandedSpecId:t,detail:null})})),we=new Set([`idle`,`queued`,`discovering`,`inventorying`,`enriching`,`researching`,`synthesizing`,`completed`,`failed`,`cancelled`]);function Q(e){return we.has(e)?e:void 0}var $={snapshot:null,stale:!1,loading:!1,error:null,activeJob:null,lastWorkspaceId:null,reportId:null},Te=s()(e=>({...$,setSnapshot:(t,n=!1)=>e(e=>({snapshot:t,stale:n,loading:!1,error:null,activeJob:e.activeJob?{...e.activeJob,status:`completed`,error:null}:null})),setLoading:t=>e({loading:t}),setError:t=>e({error:t,loading:!1}),jobStarted:(t,n)=>e({activeJob:{id:t,kind:n,status:`queued`,progress:null,error:null},error:null,loading:!0}),jobProgress:(t,n)=>e(e=>{if(e.activeJob?.id!==t)return e;let r=Q(n.phase);return r?{activeJob:{...e.activeJob,status:r,progress:n},loading:!0}:e}),jobFailed:(t,n)=>e(e=>e.activeJob?.id===t?{activeJob:{...e.activeJob,status:`failed`,error:n},error:n,loading:!1}:e),jobCancelled:t=>e(e=>({activeJob:e.activeJob?.id===t?{...e.activeJob,status:`cancelled`,error:null}:e.activeJob,loading:!1})),workspaceCompleted:t=>e({lastWorkspaceId:t}),reportReady:t=>e({reportId:t}),clear:()=>e($)})),Ee=s()(e=>({worktrees:[],baseBranch:``,activity:[],orphans:[],canClean:!1,cleanResult:null,mergeResult:null,diffByDir:{},setSnapshot:(t,n)=>e({worktrees:t,baseBranch:n}),pushEvent:t=>e(e=>({activity:[...e.activity,t].slice(-40)})),setOrphans:(t,n,r)=>e({orphans:t,canClean:n,cleanBlockedReason:r}),setCleanResult:t=>e({cleanResult:t}),setMergeResult:t=>e({mergeResult:t}),setDiff:(t,n)=>e(e=>({diffByDir:{...e.diffByDir,[t]:n}}))}));export{D as C,f as D,te as E,u as O,ae as S,C as T,P as _,xe as a,oe as b,ve as c,he as d,fe as f,F as g,L as h,Se as i,_e as l,J as m,Te as n,be as o,pe as p,Ce as r,ye as s,Ee as t,ge as u,j as v,x as w,ie as x,A as y};
7
+ `)}var ae=s()((e,t)=>({refs:[],addRef:n=>{let r=t();if(n.kind===`file`&&r.refs.find(e=>e.kind===`file`&&e.path===n.path))return;let i={...n,id:ne()};e({refs:[...r.refs,i]})},removeRef:t=>{e(e=>({refs:e.refs.filter(e=>e.id!==t)}))},clearRefs:()=>e({refs:[]})})),oe=s()(e=>({info:null,setInfo:t=>e({info:t}),clear:()=>e({info:null})})),A=s()((e,t)=>({result:null,loading:!1,currentSeq:0,setResult:t=>e(e=>t.reqSeq===e.currentSeq?{result:t,loading:!1}:{}),setLoading:()=>e({loading:!0,result:null}),clear:()=>e({result:null,loading:!1}),nextSeq:()=>{let n=t().currentSeq+1;return e({currentSeq:n}),n}})),j=s()(e=>({phases:[],activePhaseId:null,overallPercent:0,autonomous:!1,title:null,goal:null,status:`idle`,multiBoard:!1,lastEvent:null,lastError:null,graphs:[],progress:null,setState:t=>e(e=>({phases:t.phases??e.phases,activePhaseId:t.activePhaseId===void 0?e.activePhaseId:t.activePhaseId,overallPercent:t.overallPercent??e.overallPercent,autonomous:t.autonomous??e.autonomous,title:t.title===void 0?e.title:t.title,goal:t.goal===void 0?e.goal:t.goal,status:t.status??e.status,multiBoard:t.multiBoard??e.multiBoard,lastEvent:t.lastEvent===void 0?e.lastEvent:t.lastEvent,lastError:t.lastError===void 0?e.lastError:t.lastError,graphs:t.graphs??e.graphs,progress:t.progress===void 0?e.progress:t.progress})),clear:()=>e({phases:[],activePhaseId:null,overallPercent:0,autonomous:!1,title:null,goal:null,status:`idle`,multiBoard:!1,lastEvent:null,lastError:null,graphs:[],progress:null}),hydrateFromServer:e=>{e({type:`goal.list`}),e({type:`goal.state`})}}));function M(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!(typeof t.iteration!=`number`||!Number.isFinite(t.iteration)||t.task!==void 0&&typeof t.task!=`string`||t.status!==void 0&&typeof t.status!=`string`||t.progress!==void 0&&(typeof t.progress!=`number`||!Number.isFinite(t.progress))||t.progressNote!==void 0&&typeof t.progressNote!=`string`||t.timestamp!==void 0&&typeof t.timestamp!=`string`)}function N(e){return!e||typeof e.goal!=`string`||!e.goal.trim()?null:{goal:e.goal,refinedGoal:typeof e.refinedGoal==`string`?e.refinedGoal:void 0,goalState:[`active`,`paused`,`completed`,`failed`,`abandoned`].includes(e.goalState)?e.goalState:`active`,iterations:typeof e.iterations==`number`?e.iterations:0,progress:typeof e.progress==`number`?e.progress:0,progressNote:typeof e.progressNote==`string`?e.progressNote:void 0,progressTrend:e.progressTrend===`accelerating`?`up`:e.progressTrend===`stalling`?`down`:e.progressTrend===`steady`?`stable`:void 0,deliverables:Array.isArray(e.deliverables)?e.deliverables.map((e,t)=>typeof e==`string`?{id:`d${t}`,text:e,status:/^\[[x✓]\]|✅|\(done\)/i.test(e)?`done`:`pending`}:e):void 0,journal:Array.isArray(e.journal)?e.journal.filter(M):void 0,lastTask:typeof e.lastTask==`string`?e.lastTask:void 0,lastStatus:typeof e.lastStatus==`string`?e.lastStatus:void 0}}var P=s()(e=>({goal:null,setGoal:t=>e({goal:N(t)}),clear:()=>e({goal:null}),appendJournalEntry:t=>e(e=>e.goal?{goal:{...e.goal,iterations:Math.max(e.goal.iterations,t.iteration),lastTask:t.task??e.goal.lastTask,lastStatus:t.status??e.goal.lastStatus,journal:[t,...e.goal.journal??[]].slice(0,200)}}:e),refresh:()=>{try{t()?.send?.({type:`goal-state.get`})}catch{}}}));function F(e,t){return e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&t.includes(e.slice(8)))===!0}var I=3e5,L=s()((e,t)=>({boards:[],boardTotal:0,activeBoardTotal:0,orphanedBoardTotal:0,activeBoardId:null,activeBoard:null,loading:!1,lastOutboundAction:null,error:null,queueHealth:null,supervisorSnapshot:null,workbench:null,verificationActivity:{},boardHistory:[],fetchBoardHistory:e=>{t().sendKanban(`kanban.board.history`,{boardId:e})},setLoading:t=>e({loading:t}),sendKanban:(t,n)=>(e({loading:!0,lastOutboundAction:t}),t),transitionTask:(t,n,r,i)=>{let a=`kanban.task.transition`;return e({loading:!0,lastOutboundAction:a}),a},dispatchTask:(t,n,r)=>{let i=`kanban.task.dispatch`;return e({loading:!0,lastOutboundAction:i}),i},moveTask:(t,n,r)=>{let i=`kanban.task.move`;return e({loading:!0,lastOutboundAction:i}),i},removeTask:(t,n)=>{let r=`kanban.task.remove`;return e({loading:!0,lastOutboundAction:r}),r},setActiveBoardId:t=>e({activeBoardId:t,queueHealth:null,supervisorSnapshot:null,verificationActivity:{}}),setError:t=>e({error:t}),setQueueHealth:t=>e({queueHealth:t}),handleResult:(n,r)=>{if(!r.success){e({loading:!1,error:r.error??`Kanban request failed`});return}let i=r.data;if((n===`kanban.supervisor.status`||n===`kanban.supervisor.audit`)&&i){e({supervisorSnapshot:i,loading:!1,error:null});return}if(n===`kanban.health`&&r.data){e({queueHealth:r.data,loading:!1,error:null});return}if(n===`kanban.workbench`&&r.data){e({workbench:r.data,loading:!1,error:null});return}if(n===`kanban.list`){let t=H(i)?i:null,n=t?t.items:Array.isArray(i)?i:[];e({boards:n,boardTotal:t?.total??n.length,activeBoardTotal:t?.activeTotal??n.filter(e=>U(e)).length,orphanedBoardTotal:t?.orphanedTotal??n.filter(e=>!U(e)).length,loading:!1,error:null});return}if(n===`kanban.delete`){let n=t().activeBoardId,r=i,a=r?.removed===!0,o=r?.boardId??n;e(e=>{let t=a?e.boards.find(e=>e.id===o):void 0,n=t?U(t):void 0;return{boards:a?e.boards.filter(e=>e.id!==o):e.boards,boardTotal:a?Math.max(0,e.boardTotal-1):e.boardTotal,activeBoardTotal:n===!0?Math.max(0,e.activeBoardTotal-1):e.activeBoardTotal,orphanedBoardTotal:n===!1?Math.max(0,e.orphanedBoardTotal-1):e.orphanedBoardTotal,activeBoardId:a&&e.activeBoardId===o?null:e.activeBoardId,activeBoard:a&&e.activeBoard?.id===o?null:e.activeBoard,loading:!1,error:null}});return}if(n===`kanban.task.remove`){let t=i;e(e=>{let n=R(t?.board)?t.board:null;if(n&&e.activeBoardId===n.id)return{boards:K(e.boards,G(n)),activeBoard:n,loading:!1,error:null};let r=t?.boardId,i=t?.taskId,a=t?.removed===!0&&i&&e.activeBoard&&(!r||e.activeBoard.id===r)?{...e.activeBoard,tasks:e.activeBoard.tasks.filter(e=>e.id!==i)}:e.activeBoard;return{activeBoard:a,boards:a?K(e.boards,G(a)):e.boards,loading:!1,error:null}});return}if(n===`kanban.board.history`){Array.isArray(i)&&e({boardHistory:i});return}if(n===`kanban.task.verification_started`){let t=i;if(t?.boardId&&t.taskId){let n=`${t.boardId}:${t.taskId}`;e(e=>{let t=Date.now(),r=Object.fromEntries(Object.entries(e.verificationActivity).filter(([,e])=>t-e.startedAt<I));return r[n]={startedAt:t},{verificationActivity:r,loading:!1,error:null}})}return}if(n===`kanban.task.verification_completed`&&B(i)){let t=`${i.boardId}:${i.task.id}`;e(e=>{let n={...e.verificationActivity};if(delete n[t],e.activeBoard&&e.activeBoard.id===i.boardId){let t=q(e.activeBoard,i.task);return{verificationActivity:n,boards:K(e.boards,G(t)),activeBoard:t,loading:!1,error:null}}return{verificationActivity:n,loading:!1,error:null}});return}if(V(i)){let t=i.board;e(e=>({boards:K(e.boards,G(t)),activeBoard:e.activeBoardId===t.id?t:e.activeBoard,loading:!1,error:null}));return}if(B(i)){e(e=>{if(e.activeBoard&&e.activeBoard.id===i.boardId){let t=q(e.activeBoard,i.task);return{boards:K(e.boards,G(t)),activeBoard:t,loading:!1,error:null}}return{loading:!1,error:null}});return}if(R(i)){let t=G(i);if(n!==`kanban.create`&&n!==`kanban.duplicate`&&n!==`kanban.generate`){e(e=>({boards:K(e.boards,t),activeBoard:e.activeBoardId===i.id?i:e.activeBoard,loading:!1,error:null}));return}e(e=>({boards:K(e.boards,t),activeBoardId:i.id,activeBoard:i,loading:!1,error:null}));return}if(z(i)){e(e=>({...e.activeBoard?(()=>{let t=q(e.activeBoard,i);return{activeBoard:t,boards:K(e.boards,G(t))}})():{activeBoard:e.activeBoard},loading:!1,error:null}));return}if(Array.isArray(i)&&i.every(W)){e(e=>({...e.activeBoard?(()=>{let t={...e.activeBoard,columns:i};return{activeBoard:t,boards:K(e.boards,G(t))}})():{activeBoard:e.activeBoard},loading:!1,error:null}));return}e({loading:!1,error:null})}}));function R(e){return!!e&&typeof e==`object`&&Array.isArray(e.columns)&&Array.isArray(e.tasks)}function z(e){return!!e&&typeof e==`object`&&typeof e.title==`string`}function B(e){return!!e&&typeof e==`object`&&typeof e.boardId==`string`&&z(e.task)}function V(e){return!!e&&typeof e==`object`&&R(e.board)}function H(e){return!!e&&typeof e==`object`&&Array.isArray(e.items)&&typeof e.total==`number`}function U(e){return F(e,[])}function W(e){return!!e&&typeof e==`object`&&typeof e.id==`string`}function G(e){return{id:e.id,title:e.title,description:e.description,tags:e.tags,presence:e.presence,createdAt:e.createdAt,updatedAt:e.updatedAt,columnCount:e.columns.length,taskCount:e.tasks.length,completedTaskCount:e.tasks.filter(e=>e.status===`completed`).length}}function K(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function q(e,t){let n=e.tasks.some(e=>e.id===t.id)?e.tasks.map(e=>e.id===t.id?t:e):[...e.tasks,t];return{...e,tasks:n}}function se(e){switch(e){case`tui`:return`tui`;case`cli`:case`repl`:return`repl`;case`webui`:return`webui`;default:return`webui`}}function ce(e){let t={tui:0,webui:0,repl:0},n=0,r=0,i={toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0};for(let a of e){t[se(a.clientType)]+=1;for(let e of a.agents)n+=1,(e.status===`running`||e.status===`streaming`)&&(r+=1),i.toolCalls+=e.toolCalls??0,i.costUsd+=e.costUsd??0,i.tokensIn+=e.tokensIn??0,i.tokensOut+=e.tokensOut??0}return{clientCounts:t,totalAgents:n,activeAgents:r,aggregate:i}}function le(e){if(e!==void 0)return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}function ue(e){return e.map(e=>({...e,agents:e.agents.map(e=>({...e,ctxPct:le(e.ctxPct)}))}))}var de=0,J=s()(e=>({clientCounts:{tui:0,webui:0,repl:0},mailActivity:[],totalMessages:0,openMessages:0,unreadMessages:0,totalAgents:0,activeAgents:0,currentSession:{},liveSessions:[],aggregate:{toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0},lastUpdated:Date.now(),setClientCounts:t=>e({clientCounts:t,lastUpdated:Date.now()}),setLiveSessions:t=>{let n=ue(t),r=J.getState().liveSessions;if(r.length===n.length){let e=!0;for(let t=0;t<n.length;t++){let i=n[t],a=r[t];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt||i.lastHeartbeatAt!==a.lastHeartbeatAt){e=!1;break}let o=i.agents??[],s=a.agents??[];if(o.length!==s.length){e=!1;break}for(let t=0;t<o.length;t++)if(o[t].id!==s[t].id||o[t].name!==s[t].name||o[t].status!==s[t].status||o[t].currentTool!==s[t].currentTool||o[t].iterations!==s[t].iterations||o[t].toolCalls!==s[t].toolCalls||o[t].ctxPct!==s[t].ctxPct||o[t].tokensIn!==s[t].tokensIn||o[t].tokensOut!==s[t].tokensOut||o[t].costUsd!==s[t].costUsd||o[t].recentTools?.[0]?.id!==s[t].recentTools?.[0]?.id||o[t].recentMail?.[0]?.id!==s[t].recentMail?.[0]?.id||o[t].activity?.reads!==s[t].activity?.reads||o[t].activity?.writes!==s[t].activity?.writes||o[t].activity?.edits!==s[t].activity?.edits||o[t].activity?.terminalCalls!==s[t].activity?.terminalCalls||o[t].activity?.mailReceived!==s[t].activity?.mailReceived||o[t].activity?.mailSent!==s[t].activity?.mailSent||o[t].activity?.linesAdded!==s[t].activity?.linesAdded||o[t].activity?.linesRemoved!==s[t].activity?.linesRemoved){e=!1;break}if(!e)break}if(e)return}e({liveSessions:n,...ce(n),lastUpdated:Date.now()})},addMailActivity:t=>e(e=>({mailActivity:[{...t,seq:t.seq??++de},...e.mailActivity].slice(0,50),lastUpdated:Date.now()})),setMailStats:(t,n,r)=>e({totalMessages:t,openMessages:n,unreadMessages:r,lastUpdated:Date.now()}),setAgentStats:(t,n)=>e({totalAgents:t,activeAgents:n,lastUpdated:Date.now()}),setCurrentSession:t=>e({currentSession:{...J.getState().currentSession,...t},lastUpdated:Date.now()}),clear:()=>e({clientCounts:{tui:0,webui:0,repl:0},mailActivity:[],totalMessages:0,openMessages:0,unreadMessages:0,totalAgents:0,activeAgents:0,currentSession:{},liveSessions:[],aggregate:{toolCalls:0,costUsd:0,tokensIn:0,tokensOut:0},lastUpdated:Date.now()})})),fe=[3e4,6e4,12e4,3e5,6e5],Y=12e4,pe=s()(a(e=>({viewMode:`office`,showHud:!0,showLegend:!0,showMinimap:!0,showControls:!0,animateEdges:!0,showFeed:!0,background:`dots`,waitThresholdMs:Y,setViewMode:t=>e({viewMode:t}),setShowHud:t=>e({showHud:t}),setShowLegend:t=>e({showLegend:t}),setShowMinimap:t=>e({showMinimap:t}),setShowControls:t=>e({showControls:t}),setAnimateEdges:t=>e({animateEdges:t}),setShowFeed:t=>e({showFeed:t}),setBackground:t=>e({background:t}),setWaitThresholdMs:t=>e({waitThresholdMs:Number.isFinite(t)&&t>0?Math.round(t):Y})}),{name:`wrongstack-officemap`}));function X(e){return`${e.providerId}${e.meterId}`}function me(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.providerId==`string`&&typeof t.meterId==`string`&&Array.isArray(t.windows)&&typeof t.capturedAt==`number`}var he=s(e=>({meters:{},apply:t=>e(e=>{let n={...e.meters};for(let e of t){if(!me(e))continue;let t=n[X(e)];n[X(e)]={...e,...e.planLabel===void 0&&t?.planLabel!==void 0?{planLabel:t.planLabel}:{},...e.meterLabel===void 0&&t?.meterLabel!==void 0?{meterLabel:t.meterLabel}:{}}}return{meters:n}}),clear:()=>e({meters:{}})}));function ge(e){let t;for(let n of Object.values(e))for(let e of n.windows){if(!t||e.usedPercent>t.window.usedPercent){t={snapshot:n,window:e};continue}if(e.usedPercent===t.window.usedPercent){let r=e.resetsAt,i=t.window.resetsAt;r!==void 0&&(i===void 0||r<i)&&(t={snapshot:n,window:e})}}return t}function _e(e){if(e.label)return e.label;let t=e.windowMinutes;return t!==void 0&&Number.isFinite(t)&&t>0?t%1440==0?`${t/1440}d`:t%60==0?`${t/60}h`:`${t}m`:e.id}function ve(e,t=Date.now()){if(e?.resetsAt===void 0)return;let n=e.resetsAt*1e3-t;if(n<=0)return;let r=Math.floor(n/6e4);if(r<1)return`${Math.max(1,Math.round(n/1e3))}s`;let i=Math.floor(r/1440),a=Math.floor(r%1440/60),o=r%60;return i>0?a>0?`${i}d ${a}h`:`${i}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:`${o}m`}var Z=e=>`${e.providerId}\u0000${e.model}`,ye=s(e=>({entries:{},audit:[],summary:null,loading:!1,error:null,update:t=>e(e=>{let n={...e.entries},r=Z(t);if(t.state===`healthy`)delete n[r];else{let e=n[r],i=Object.fromEntries(Object.entries(t).filter(e=>e[1]!==void 0));n[r]={...e,...i}}return{entries:n}}),hydrate:t=>e({entries:Object.fromEntries(t.filter(e=>e.state!==`healthy`).map(e=>[Z(e),e]))}),applySnapshot:t=>{let n=t.statuses;if(!Array.isArray(n)){e({error:`Invalid snapshot from server`,loading:!1});return}let r={};for(let e of n){if(!e||typeof e!=`object`)continue;let t=e,n=typeof t.providerId==`string`?t.providerId:``,i=typeof t.model==`string`?t.model:``;if(!n||!i)continue;let a=t.state;(a===`healthy`||a===`degraded`||a===`blocked`)&&(r[`${n}\u0000${i}`]={providerId:n,model:i,state:a,reason:(typeof t.lastErrorKind==`string`?t.lastErrorKind:``)||a,updatedAt:typeof t.lastFailureAt==`number`?t.lastFailureAt:Date.now(),...typeof t.stateExpiresAt==`number`?{stateExpiresAt:t.stateExpiresAt}:{},...typeof t.consecutiveFailures==`number`?{consecutiveFailures:t.consecutiveFailures}:{},...typeof t.totalFailures==`number`?{totalFailures:t.totalFailures}:{},...typeof t.rateLimitHits==`number`?{rateLimitHits:t.rateLimitHits}:{},...typeof t.lastErrorMessage==`string`?{lastErrorMessage:t.lastErrorMessage}:{},...typeof t.lastErrorKind==`string`?{lastErrorKind:t.lastErrorKind}:{},...typeof t.lastErrorStatus==`number`?{lastErrorStatus:t.lastErrorStatus}:{},...Array.isArray(t.recentErrors)?{recentErrors:t.recentErrors.slice(0,20)}:{},...typeof t.lastSessionId==`string`?{lastSessionId:t.lastSessionId}:{},...typeof t.lastAgentId==`string`?{lastAgentId:t.lastAgentId}:{},...typeof t.lastFailureAt==`number`?{lastFailureAt:t.lastFailureAt}:{}})}let i=t;e({entries:r,summary:{totalPairs:typeof i.totalPairs==`number`?i.totalPairs:0,healthy:typeof i.healthy==`number`?i.healthy:0,degraded:typeof i.degraded==`number`?i.degraded:0,blocked:typeof i.blocked==`number`?i.blocked:0,totalFailures:typeof i.totalFailures==`number`?i.totalFailures:0,totalRateLimits:typeof i.totalRateLimits==`number`?i.totalRateLimits:0},error:null,loading:!1})},setAudit:t=>e({audit:t}),setLoading:t=>e({loading:t}),setError:t=>e({error:t,loading:!1}),removeEntry:(t,n)=>e(e=>{let r={...e.entries};return delete r[Z({providerId:t,model:n})],{entries:r}}),clear:()=>e({entries:{},audit:[],summary:null,error:null})})),be=s()(e=>({snapshot:null,boards:[],lifecycleResult:null,destroying:!1,setSnapshot:t=>e({snapshot:t}),setBoards:t=>e({boards:t}),setLifecycleResult:t=>e({lifecycleResult:t}),setDestroying:t=>e({destroying:t})})),xe=s()(e=>({snapshot:null,agentText:``,error:null,startedRunId:null,setSnapshot:t=>{if(t.discarded||t.phase===`idle`&&!t.sessionId){e({snapshot:null,agentText:``,error:null});return}e({snapshot:t,error:null,...t.lastAgentText?{agentText:t.lastAgentText}:{}})},setAgentText:t=>e({agentText:t}),setError:t=>e({error:t}),setStartedRunId:t=>e({startedRunId:t}),reset:()=>e({snapshot:null,agentText:``,error:null,startedRunId:null})})),Se=f(e=>({sideEffects:[],loading:!1,setSideEffects:t=>e({sideEffects:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({sideEffects:[],loading:!1})})),Ce=s()(e=>({specs:[],detail:null,expandedSpecId:null,setSpecs:t=>e({specs:t}),setDetail:t=>e({detail:t}),setExpanded:t=>e({expandedSpecId:t,detail:null})})),we=new Set([`idle`,`queued`,`discovering`,`inventorying`,`enriching`,`researching`,`synthesizing`,`completed`,`failed`,`cancelled`]);function Q(e){return we.has(e)?e:void 0}var $={snapshot:null,stale:!1,loading:!1,error:null,activeJob:null,lastWorkspaceId:null,reportId:null},Te=s()(e=>({...$,setSnapshot:(t,n=!1)=>e(e=>({snapshot:t,stale:n,loading:!1,error:null,activeJob:e.activeJob?{...e.activeJob,status:`completed`,error:null}:null})),setLoading:t=>e({loading:t}),setError:t=>e({error:t,loading:!1}),jobStarted:(t,n)=>e({activeJob:{id:t,kind:n,status:`queued`,progress:null,error:null},error:null,loading:!0}),jobProgress:(t,n)=>e(e=>{if(e.activeJob?.id!==t)return e;let r=Q(n.phase);return r?{activeJob:{...e.activeJob,status:r,progress:n},loading:!0}:e}),jobFailed:(t,n)=>e(e=>e.activeJob?.id===t?{activeJob:{...e.activeJob,status:`failed`,error:n},error:n,loading:!1}:e),jobCancelled:t=>e(e=>({activeJob:e.activeJob?.id===t?{...e.activeJob,status:`cancelled`,error:null}:e.activeJob,loading:!1})),workspaceCompleted:t=>e({lastWorkspaceId:t}),reportReady:t=>e({reportId:t}),clear:()=>e($)})),Ee=s()(e=>({worktrees:[],baseBranch:``,activity:[],orphans:[],canClean:!1,cleanResult:null,mergeResult:null,diffByDir:{},setSnapshot:(t,n)=>e({worktrees:t,baseBranch:n}),pushEvent:t=>e(e=>({activity:[...e.activity,t].slice(-40)})),setOrphans:(t,n,r)=>e({orphans:t,canClean:n,cleanBlockedReason:r}),setCleanResult:t=>e({cleanResult:t}),setMergeResult:t=>e({mergeResult:t}),setDiff:(t,n)=>e(e=>({diffByDir:{...e.diffByDir,[t]:n}}))}));export{D as C,f as D,te as E,u as O,ae as S,C as T,P as _,xe as a,oe as b,ve as c,he as d,fe as f,F as g,L as h,Se as i,_e as l,J as m,Te as n,be as o,pe as p,Ce as r,ye as s,Ee as t,ge as u,j as v,x as w,ie as x,A as y};
package/dist/index.html CHANGED
@@ -11,7 +11,7 @@
11
11
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
12
12
  <meta name="apple-mobile-web-app-title" content="WrongStack" />
13
13
  <title>WrongStack WebUI</title>
14
- <script type="module" crossorigin src="/assets/index-BhXxZMAb.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-B70B52lT.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/react-core-wiHys0m2.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/xyflow-BqDBClm9.js">
@@ -32,13 +32,13 @@
32
32
  <link rel="modulepreload" crossorigin href="/assets/chat-store-DNRce6sE.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/codemap-activity-store-Ha7XbGgq.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/mailbox-store-C49LeBj8.js">
35
- <link rel="modulepreload" crossorigin href="/assets/stores-BIVCS5nu.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/stores-DxKcenvb.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/dialog-C7EIBM_2.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/button-9ewV4TF3.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/input-ag1CrUiS.js">
39
39
  <link rel="stylesheet" crossorigin href="/assets/xyflow-DLioOiRN.css">
40
40
  <link rel="stylesheet" crossorigin href="/assets/vendor-jL-bRT8f.css">
41
- <link rel="stylesheet" crossorigin href="/assets/index-BssEH_2N.css">
41
+ <link rel="stylesheet" crossorigin href="/assets/index-NBVZNAcU.css">
42
42
  </head>
43
43
  <body>
44
44
  <div id="root"></div>
package/dist/index.js CHANGED
@@ -48972,7 +48972,7 @@ var init_kanban_store = __esm({
48972
48972
  }
48973
48973
  if (isBoard(data)) {
48974
48974
  const summary = summarize(data);
48975
- if (type === "kanban.get") {
48975
+ if (type !== "kanban.create" && type !== "kanban.duplicate" && type !== "kanban.generate") {
48976
48976
  set((state) => ({
48977
48977
  boards: upsertSummary(state.boards, summary),
48978
48978
  activeBoard: state.activeBoardId === data.id ? data : state.activeBoard,
@@ -84463,7 +84463,7 @@ function KanbanView({ onClose }) {
84463
84463
  activityNote: `Moved in WebUI${from ? ` from ${from}` : ""} to ${to}.`
84464
84464
  });
84465
84465
  };
84466
- return /* @__PURE__ */ jsxs190("div", { className: "flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row", children: [
84466
+ return /* @__PURE__ */ jsxs190("div", { className: "flex h-full min-h-0 min-w-0 flex-col overflow-y-auto bg-background text-foreground md:flex-row md:overflow-hidden", children: [
84467
84467
  /* @__PURE__ */ jsx201(
84468
84468
  KanbanBoardSidebar,
84469
84469
  {
@@ -84489,7 +84489,7 @@ function KanbanView({ onClose }) {
84489
84489
  onBoardPageChange: changeBoardPage
84490
84490
  }
84491
84491
  ),
84492
- /* @__PURE__ */ jsxs190("main", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
84492
+ /* @__PURE__ */ jsxs190("main", { className: "flex min-h-0 min-w-0 flex-none flex-col md:flex-1", children: [
84493
84493
  /* @__PURE__ */ jsxs190("header", { className: "flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4", children: [
84494
84494
  /* @__PURE__ */ jsxs190("div", { className: "w-full min-w-0 sm:w-auto sm:flex-1", children: [
84495
84495
  /* @__PURE__ */ jsx201("h1", { className: "truncate text-sm font-semibold", children: activeBoard?.title ?? "No board selected" }),
@@ -84559,7 +84559,7 @@ function KanbanView({ onClose }) {
84559
84559
  }
84560
84560
  },
84561
84561
  className: cn(
84562
- "hidden h-8 items-center justify-center rounded-md border transition-colors sm:flex",
84562
+ "flex h-8 items-center justify-center rounded-md border transition-colors",
84563
84563
  confirmDeleteBoard ? "w-16 gap-1 border-destructive/40 bg-destructive/15 text-[11px] font-semibold text-destructive" : "w-16 text-muted-foreground hover:bg-destructive/10 hover:text-destructive"
84564
84564
  ),
84565
84565
  children: confirmDeleteBoard ? t("activity:kanban.confirmDelete") : /* @__PURE__ */ jsx201(Trash215, { size: 16 })
@@ -84627,7 +84627,7 @@ function KanbanView({ onClose }) {
84627
84627
  "div",
84628
84628
  {
84629
84629
  ref: boardScrollRef,
84630
- className: "kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain",
84630
+ className: "kanban-scroll-area min-h-64 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain md:min-h-0",
84631
84631
  children: showHistory ? /* @__PURE__ */ jsx201("div", { className: "h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsxs190("div", { className: "mx-auto max-w-2xl", children: [
84632
84632
  /* @__PURE__ */ jsx201("h3", { className: "mb-3 text-sm font-semibold text-muted-foreground", children: t("activity:kanban.boardHistory") }),
84633
84633
  boardHistory.length === 0 ? /* @__PURE__ */ jsx201("p", { className: "text-sm text-muted-foreground", children: t("activity:kanban.noHistory") }) : /* @__PURE__ */ jsx201("ol", { className: "space-y-2", children: [...boardHistory].reverse().map((entry) => /* @__PURE__ */ jsxs190("li", { className: "rounded-md border bg-card p-3 text-sm", children: [
@@ -113901,6 +113901,7 @@ var EMPTY_ANSWER = {
113901
113901
  customSelected: false,
113902
113902
  delegated: false
113903
113903
  };
113904
+ var SUBMIT_TIMEOUT_MS = 1e4;
113904
113905
  function UserInputDialog() {
113905
113906
  const wsUrl = useConfigStore((state) => state.wsUrl);
113906
113907
  const activeSessionId = useActiveSessionId();
@@ -113940,6 +113941,16 @@ function UserInputDialog() {
113940
113941
  setValidationMessage("");
113941
113942
  setSubmitting(false);
113942
113943
  }, [request]);
113944
+ useEffect41(() => {
113945
+ if (!submitting) return;
113946
+ const timer = setTimeout(() => {
113947
+ setSubmitting(false);
113948
+ setValidationMessage(
113949
+ "No confirmation received \u2014 check the connection, then retry or cancel."
113950
+ );
113951
+ }, SUBMIT_TIMEOUT_MS);
113952
+ return () => clearTimeout(timer);
113953
+ }, [submitting]);
113943
113954
  const questions = useMemo22(() => request?.tabs.flatMap((tab2) => tab2.questions) ?? [], [request]);
113944
113955
  const missing = questions.filter(
113945
113956
  (question) => question.required && !hasAnswer(draft[question.id])
@@ -113983,6 +113994,20 @@ function UserInputDialog() {
113983
113994
  setValidationMessage("Could not send the answers. Check the connection and try again.");
113984
113995
  }
113985
113996
  };
113997
+ const cancel = () => {
113998
+ if (!request || !entry) return;
113999
+ const sent = getWSClient(wsUrl).send({
114000
+ type: "user.input_submit",
114001
+ payload: {
114002
+ sessionId: entry.sessionId,
114003
+ response: { requestId: request.id, status: "cancelled", answers: [] }
114004
+ }
114005
+ });
114006
+ setSubmitting(false);
114007
+ setValidationMessage(
114008
+ sent ? "Cancel requested \u2014 it may not have reached the agent while the connection is down." : "Could not cancel \u2014 check the connection and try again."
114009
+ );
114010
+ };
113986
114011
  const applyRecommendations = (scope) => {
113987
114012
  const targets = scope === "all" ? questions : tab.questions;
113988
114013
  setDraft((current) => {
@@ -114132,6 +114157,7 @@ function UserInputDialog() {
114132
114157
  children: validationMessage || (valid ? "Ready to submit" : `${missing.length} required answer(s) missing`)
114133
114158
  }
114134
114159
  ),
114160
+ /* @__PURE__ */ jsx53(Button, { type: "button", variant: "outline", onClick: cancel, children: "Cancel" }),
114135
114161
  /* @__PURE__ */ jsx53(Button, { disabled: submitting, onClick: submit, children: submitting ? "Submitting\u2026" : request.submitLabel ?? "Submit answers" })
114136
114162
  ] })
114137
114163
  ]
@@ -139936,6 +139962,19 @@ import { useCallback as useCallback93, useEffect as useEffect155, useState as us
139936
139962
  // src/hooks/useIntegrationStatus.ts
139937
139963
  init_local_prefs();
139938
139964
  import { useEffect as useEffect154, useState as useState170 } from "react";
139965
+ async function probeIntegration(kind, signal) {
139966
+ const response = await fetch(`/api/integrations/${kind}/status`, {
139967
+ method: "GET",
139968
+ signal,
139969
+ headers: { accept: "application/json" }
139970
+ });
139971
+ const body = await response.json();
139972
+ return {
139973
+ connected: response.ok && body.connected === true,
139974
+ ...typeof body.latencyMs === "number" ? { latencyMs: body.latencyMs } : {},
139975
+ ...typeof body.error === "string" ? { error: body.error } : {}
139976
+ };
139977
+ }
139939
139978
  function useWrongProxyStatus() {
139940
139979
  const enabled = useLocalPrefs((s) => s.wrongProxyEnabled);
139941
139980
  const url = useLocalPrefs((s) => s.wrongProxyUrl);
@@ -139956,24 +139995,19 @@ function useWrongProxyStatus() {
139956
139995
  let disposed = false;
139957
139996
  const probe = async () => {
139958
139997
  const trimmed = url.trim().replace(/\/+$/, "");
139959
- const healthUrl = `${trimmed}/api/health`;
139960
139998
  const start = Date.now();
139961
139999
  const controller = new AbortController();
139962
140000
  const timer = setTimeout(() => controller.abort(), 2e3);
139963
140001
  try {
139964
- const res = await fetch(healthUrl, {
139965
- method: "GET",
139966
- signal: controller.signal,
139967
- headers: { accept: "application/json" }
139968
- });
140002
+ const result = await probeIntegration("wrong-proxy", controller.signal);
139969
140003
  clearTimeout(timer);
139970
140004
  if (disposed) return;
139971
- const ok = res.ok && res.status >= 200 && res.status < 300;
140005
+ const ok = result.connected;
139972
140006
  setState3({
139973
140007
  status: ok ? "connected" : "error",
139974
- latencyMs: Date.now() - start,
140008
+ latencyMs: result.latencyMs ?? Date.now() - start,
139975
140009
  url: trimmed,
139976
- error: ok ? void 0 : `HTTP ${res.status}`
140010
+ error: ok ? void 0 : result.error ?? "Unreachable"
139977
140011
  });
139978
140012
  } catch (err) {
139979
140013
  clearTimeout(timer);
@@ -140016,28 +140050,19 @@ function useHqStatus() {
140016
140050
  let disposed = false;
140017
140051
  const probe = async () => {
140018
140052
  const trimmed = url.trim().replace(/\/+$/, "");
140019
- const healthUrl = `${trimmed}/api/auth/status`;
140020
140053
  const start = Date.now();
140021
140054
  const controller = new AbortController();
140022
140055
  const timer = setTimeout(() => controller.abort(), 2e3);
140023
140056
  try {
140024
- const headers = { accept: "application/json" };
140025
- if (token) {
140026
- headers["Authorization"] = `Bearer ${token}`;
140027
- }
140028
- const res = await fetch(healthUrl, {
140029
- method: "GET",
140030
- signal: controller.signal,
140031
- headers
140032
- });
140057
+ const result = await probeIntegration("hq", controller.signal);
140033
140058
  clearTimeout(timer);
140034
140059
  if (disposed) return;
140035
- const ok = res.ok || res.status === 401;
140060
+ const ok = result.connected;
140036
140061
  setState3({
140037
140062
  status: ok ? "connected" : "error",
140038
- latencyMs: Date.now() - start,
140063
+ latencyMs: result.latencyMs ?? Date.now() - start,
140039
140064
  url: trimmed,
140040
- error: ok ? void 0 : `HTTP ${res.status}`
140065
+ error: ok ? void 0 : result.error ?? "Unreachable"
140041
140066
  });
140042
140067
  } catch (err) {
140043
140068
  clearTimeout(timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "license": "MIT",
5
5
  "description": "Browser-based WebUI for WrongStack — React + Vite frontend. The WebSocket backend lives in the separate @wrongstack/webui-server package (extracted in PR #018b to remove the CLI -> @wrongstack/webui/server cross-package edge).",
6
6
  "keywords": [
@@ -87,12 +87,12 @@
87
87
  "@radix-ui/react-tabs": "^1.1.21",
88
88
  "@tanstack/react-virtual": "^3.14.12",
89
89
  "@uiw/react-textarea-code-editor": "^3.1.1",
90
- "@wrongstack/core": "1.0.11",
91
- "@wrongstack/kanban": "1.0.11",
92
- "@wrongstack/plugins": "1.0.11",
93
- "@wrongstack/providers": "1.0.11",
94
- "@wrongstack/tools": "1.0.11",
95
- "@wrongstack/webui-protocol": "1.0.11",
90
+ "@wrongstack/core": "1.0.13",
91
+ "@wrongstack/kanban": "1.0.13",
92
+ "@wrongstack/plugins": "1.0.13",
93
+ "@wrongstack/providers": "1.0.13",
94
+ "@wrongstack/tools": "1.0.13",
95
+ "@wrongstack/webui-protocol": "1.0.13",
96
96
  "@xterm/addon-fit": "^0.11.0",
97
97
  "@xterm/xterm": "^6.0.0",
98
98
  "@xyflow/react": "^12.11.6",
@@ -128,8 +128,8 @@
128
128
  "@types/ws": "^8.18.1",
129
129
  "@vitejs/plugin-react": "^6.1.1",
130
130
  "@vitest/coverage-v8": "^5.0.0",
131
- "@wrongstack/sdd": "1.0.11",
132
- "@wrongstack/webui-server": "1.0.11",
131
+ "@wrongstack/sdd": "1.0.13",
132
+ "@wrongstack/webui-server": "1.0.13",
133
133
  "jsdom": "^30.0.1",
134
134
  "tailwindcss": "^4.3.3",
135
135
  "typescript": "^7.0.2",