@frumu/tandem-panel 0.5.4 → 0.5.6

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 (56) hide show
  1. package/bin/setup.js +1 -0
  2. package/dist/assets/AutomationsPage-BGqpmilp.js +946 -0
  3. package/dist/assets/BugMonitorPage-BVzdj9y-.js +4 -0
  4. package/dist/assets/ChannelsPage-B-InJ4Yh.js +1 -0
  5. package/dist/assets/ChatInterfacePanel-BrMo4cXg.js +1 -0
  6. package/dist/assets/ChatPage-Bc-BfOG1.js +1 -0
  7. package/dist/assets/CodingWorkflowsPage-xgfwLRlt.js +8 -0
  8. package/dist/assets/ControlPanelDialogs-yFfCht3Y.js +1 -0
  9. package/dist/assets/DashboardPage-CrA1itFc.js +1 -0
  10. package/dist/assets/ExperimentsPage-Bkg1_6rw.js +84 -0
  11. package/dist/assets/FilesPage-DChyHlO_.js +1 -0
  12. package/dist/assets/IntentPlannerPage-Dti1h8Tm.js +5 -0
  13. package/dist/assets/LazyJson-vfWw7G9F.js +1 -0
  14. package/dist/assets/MarketplacePage-90fAVNGg.js +1 -0
  15. package/dist/assets/McpToolAllowlistEditor-BzQ64HrZ.js +1 -0
  16. package/dist/assets/MemoryImportDialog-DSpS1JF5.js +1 -0
  17. package/dist/assets/MemoryPage-DRRLgoc0.js +1 -0
  18. package/dist/assets/OrchestratorPage-CYU-ESPI.js +3 -0
  19. package/dist/assets/PacksPage-dRmjjdKD.js +3 -0
  20. package/dist/assets/PlannerDiagnosticsPanel-C1uIuRIx.js +1 -0
  21. package/dist/assets/ProviderModelSelector-BdtOpkJR.js +1 -0
  22. package/dist/assets/RunsPage-DEy8vbRT.js +1 -0
  23. package/dist/assets/SettingsPage-CwH_FzOs.js +5 -0
  24. package/dist/assets/TaskBoard-CCY_Qy5S.js +1 -0
  25. package/dist/assets/TeamsPage-Dn81V0EB.js +4472 -0
  26. package/dist/assets/TimezoneField-B5i---lF.js +1 -0
  27. package/dist/assets/WorkflowStudioPage-yFhlA4KV.js +1854 -0
  28. package/dist/assets/WorkflowsPage-vmaKHFox.js +2 -0
  29. package/dist/assets/chatPageHelpers-Dmb4waDk.js +1 -0
  30. package/dist/assets/explorerHandoff-BPKxMR82.js +1 -0
  31. package/dist/assets/format-DyX5imzJ.js +1 -0
  32. package/dist/assets/fullcalendar-Bn75j0xM.js +1 -0
  33. package/dist/assets/index-C8Bjo7hU.css +1 -0
  34. package/dist/assets/index-TvymvGva.js +3 -0
  35. package/dist/assets/messages-uD0aB_MZ.js +3 -0
  36. package/dist/assets/motion-B3ZE8SGR.js +9 -0
  37. package/dist/assets/plannerShared-Dx7-Sxpc.js +1 -0
  38. package/dist/assets/preact-vendor-DaCG_P2o.js +1 -0
  39. package/dist/assets/react-query-BIbNygEJ.js +1 -0
  40. package/dist/assets/sse-B4A2m-Nk.js +2 -0
  41. package/dist/assets/useEngineStream-Diqri33l.js +1 -0
  42. package/dist/assets/vendor-DSaYtO9f.js +156 -0
  43. package/dist/assets/workflowStability-C8USyGOY.js +2 -0
  44. package/dist/index.html +8 -7
  45. package/lib/automations/workflow-list.js +147 -0
  46. package/lib/setup/control-panel-preferences.js +4 -0
  47. package/package.json +3 -3
  48. package/server/routes/capabilities.js +1 -0
  49. package/server/routes/knowledgebase.js +7 -1
  50. package/dist/assets/index-BL-9rGEh.css +0 -1
  51. package/dist/assets/index-DhoScTZK.js +0 -7379
  52. package/dist/assets/motion-CBnf8hfk.js +0 -9
  53. package/dist/assets/preact-vendor-B239Onrg.js +0 -1
  54. package/dist/assets/react-query-_hsOQSt5.js +0 -1
  55. package/dist/assets/vendor-DZYPF2Pz.js +0 -156
  56. /package/dist/assets/{markdown-Dd89TVib.js → markdown-Dwwtq3bu.js} +0 -0
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CrA1itFc.js","assets/fullcalendar-Bn75j0xM.js","assets/rolldown-runtime-Dgq8h090.js","assets/react-query-BIbNygEJ.js","assets/motion-B3ZE8SGR.js","assets/LazyJson-vfWw7G9F.js","assets/format-DyX5imzJ.js","assets/ChatPage-Bc-BfOG1.js","assets/ChatInterfacePanel-BrMo4cXg.js","assets/chatPageHelpers-Dmb4waDk.js","assets/messages-uD0aB_MZ.js","assets/explorerHandoff-BPKxMR82.js","assets/sse-B4A2m-Nk.js","assets/IntentPlannerPage-Dti1h8Tm.js","assets/ProviderModelSelector-BdtOpkJR.js","assets/PlannerDiagnosticsPanel-C1uIuRIx.js","assets/plannerShared-Dx7-Sxpc.js","assets/WorkflowsPage-vmaKHFox.js","assets/MarketplacePage-90fAVNGg.js","assets/WorkflowStudioPage-yFhlA4KV.js","assets/vendor-DSaYtO9f.js","assets/McpToolAllowlistEditor-BzQ64HrZ.js","assets/workflowStability-C8USyGOY.js","assets/AutomationsPage-BGqpmilp.js","assets/TimezoneField-B5i---lF.js","assets/TaskBoard-CCY_Qy5S.js","assets/useEngineStream-Diqri33l.js","assets/ExperimentsPage-Bkg1_6rw.js","assets/CodingWorkflowsPage-xgfwLRlt.js","assets/ControlPanelDialogs-yFfCht3Y.js","assets/ChannelsPage-B-InJ4Yh.js","assets/PacksPage-dRmjjdKD.js","assets/OrchestratorPage-CYU-ESPI.js","assets/FilesPage-DChyHlO_.js","assets/MemoryImportDialog-DSpS1JF5.js","assets/MemoryPage-DRRLgoc0.js","assets/RunsPage-DEy8vbRT.js","assets/BugMonitorPage-BVzdj9y-.js","assets/TeamsPage-Dn81V0EB.js","assets/SettingsPage-CwH_FzOs.js"])))=>i.map(i=>d[i]);
2
+ import{C as e,E as t,O as n,S as r,a as i,g as a,h as o,l as s,m as c,v as l,w as u,x as d,y as f}from"./fullcalendar-Bn75j0xM.js";import{t as p}from"./preact-vendor-DaCG_P2o.js";import{a as m,i as ee,n as h,t as te}from"./react-query-BIbNygEJ.js";import{$ as g,$t as _,A as v,At as y,B as b,Bt as x,C as S,Ct as C,D as w,Dt as T,E,Et as D,F as ne,Ft as re,G as ie,Gt as ae,H as oe,Ht as O,I as se,It as k,J as ce,Jt as A,K as le,Kt as j,L as ue,Lt as de,M as fe,Mt as M,N,Nt as pe,O as me,Ot as he,P as ge,Pt as _e,Q as ve,Qt as ye,R as be,Rt as xe,S as Se,St as Ce,T as we,Tt as Te,U as Ee,Ut as P,V as De,Vt as Oe,W as ke,Wt as Ae,X as je,Xt as Me,Y as Ne,Yt as Pe,Z as Fe,Zt as Ie,_ as Le,_t as Re,a as ze,an as Be,at as Ve,b as He,bt as Ue,c as We,cn as F,ct as Ge,d as Ke,dn as qe,dt as Je,en as Ye,et as Xe,f as Ze,fn as I,ft as Qe,g as $e,gt as et,h as tt,hn as nt,ht as rt,i as it,in as at,it as ot,j as st,jt as ct,k as lt,kt as ut,l as dt,ln as L,lt as ft,m as pt,mn as mt,mt as ht,n as gt,nn as _t,nt as vt,o as yt,on as R,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rt as Ot,s as kt,sn as z,st as At,tn as jt,tt as Mt,u as Nt,un as B,ut as Pt,v as Ft,vt as It,w as Lt,wt as Rt,x as zt,xt as Bt,y as Vt,yt as Ht,z as Ut,zt as Wt}from"./vendor-DSaYtO9f.js";import{i as V,n as H,r as U}from"./motion-B3ZE8SGR.js";import{n as Gt,t as Kt}from"./markdown-Dwwtq3bu.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var qt=class extends Error{constructor(e,t,n,r){super(`Tandem API Validation Error [${t}] at ${e}: ${n.length} issues found.`),this.endpoint=e,this.status=t,this.issues=n,this.rawSnippet=r,this.name=`TandemValidationError`}},Jt=I().or(B({id:I().optional(),runID:I().optional(),runId:I().optional(),run_id:I().optional(),sessionID:I().optional(),sessionId:I().optional(),session_id:I().optional(),missionID:I().optional(),missionId:I().optional(),mission_id:I().optional(),instanceID:I().optional(),instanceId:I().optional(),instance_id:I().optional()})).transform(e=>typeof e==`string`?e:e.id||e.runID||e.runId||e.run_id||e.sessionID||e.sessionId||e.session_id||e.missionID||e.missionId||e.mission_id||e.instanceID||e.instanceId||e.instance_id);R().transform(e=>e),qe(I(),R()).transform(e=>e);var Yt=B({ready:F().optional(),phase:I().optional(),workspace_root:I().optional(),workspaceRoot:I().optional()}).passthrough().transform(e=>({...e,workspaceRoot:e.workspace_root??e.workspaceRoot})),Xt=B({id:I(),title:I(),created_at_ms:L().optional(),createdAtMs:L().optional(),directory:I().optional(),workspace_root:I().optional(),workspaceRoot:I().optional(),source_kind:I().optional(),sourceKind:I().optional(),source_metadata:qe(I(),mt()).optional(),sourceMetadata:qe(I(),mt()).optional(),archived:F().optional()}).passthrough().transform(e=>({...e,createdAtMs:e.created_at_ms??e.createdAtMs??0,workspaceRoot:e.workspace_root??e.workspaceRoot,sourceKind:e.source_kind??e.sourceKind,sourceMetadata:e.source_metadata??e.sourceMetadata})),Zt=St([z(Xt).transform(e=>({sessions:e,count:e.length})),B({sessions:z(Xt).optional().default([]),count:L().optional().default(0)}).passthrough()]),Qt=B({active:B({runID:I().optional(),runId:I().optional(),run_id:I().optional(),attachEventStream:I().optional()}).passthrough().nullable().optional()}).passthrough().transform(e=>e.active?{active:{...e.active,runId:e.active.runId||e.active.runID||e.active.run_id}}:{active:null}),$t=B({ok:F().optional(),dry_run:F().optional(),dryRun:F().optional(),runID:I().optional(),runId:I().optional(),run_id:I().optional(),status:I().optional()}).passthrough().transform(e=>({...e,dryRun:e.dryRun??e.dry_run,runId:e.runId||e.runID||e.run_id})),en=B({id:I().optional(),runID:I().optional(),runId:I().optional(),run_id:I().optional(),routine_id:I().optional(),automation_id:I().optional(),status:I().optional(),started_at_ms:L().optional(),finished_at_ms:L().optional()}).passthrough().transform(e=>({...e,runId:e.runId||e.runID||e.run_id,routineId:e.routine_id,automationId:e.automation_id,startedAtMs:e.started_at_ms,finishedAtMs:e.finished_at_ms})),tn=B({ok:F().default(!0),rev:L().optional()}).passthrough(),nn=B({key:I(),value:R(),rev:L().optional(),updated_at_ms:L().optional(),updated_by:I().optional()}).passthrough().transform(e=>({...e,updatedAtMs:e.updated_at_ms,updatedBy:e.updated_by})),rn=B({items:z(nn).optional().default([]),count:L().optional().default(0)}).passthrough(),an=B({items:z(B({id:I().optional(),text:I().optional(),content:I().optional(),user_id:I().optional(),userID:I().optional(),source_type:I().optional(),sourceType:I().optional(),tags:z(I()).optional(),source:I().optional(),session_id:I().optional(),sessionID:I().optional(),run_id:I().optional(),runID:I().optional()}).passthrough().transform(e=>({...e,text:e.text||e.content,content:e.content||e.text,userId:e.userID||e.user_id,sourceType:e.sourceType||e.source_type,sessionId:e.session_id||e.sessionID,runId:e.run_id||e.runID}))).optional().default([]),count:L().optional().default(0)}).passthrough(),on=B({results:z(B({id:I(),text:I().optional(),content:I().optional(),score:L().optional(),source_type:I().optional(),sourceType:I().optional(),run_id:I().optional(),runID:I().optional(),tags:z(I()).optional()}).passthrough().transform(e=>({...e,text:e.text||e.content,content:e.content||e.text,sourceType:e.sourceType||e.source_type,runId:e.runID||e.run_id}))).optional().default([]),count:L().optional().default(0)}).passthrough(),sn=B({id:I(),uri:I(),parent_uri:I().optional(),node_type:I(),created_at:I(),updated_at:I(),metadata:qe(I(),R()).optional()}).passthrough(),cn=B({l0_preview:I().optional(),l1_preview:I().optional(),has_l2:F()}).passthrough(),ln=B({node:sn,children:z(R()).optional().default([]),layer_summary:cn.optional()}).passthrough(),un=B({node:sn.optional()}).passthrough(),dn=B({tree:z(ln).optional().default([])}).passthrough(),fn=B({ok:F(),distillation_id:I().optional(),session_id:I().optional(),facts_extracted:L().optional()}).passthrough(),pn=B({type:I(),properties:qe(I(),R()).optional().default({}),sessionID:I().optional(),session_id:I().optional(),sessionId:I().optional(),runID:I().optional(),run_id:I().optional(),runId:I().optional(),timestamp:I().optional()}).passthrough().transform(e=>({...e,properties:e.properties,sessionId:e.sessionId||e.sessionID||e.session_id,runId:e.runId||e.runID||e.run_id}));function W(e,t,n,r){let i=e.safeParse(t);if(!i.success){let e=JSON.stringify(t).substring(0,200);throw new qt(n,r,i.error.issues,e)}return i.data}function mn(e){let t=e.trim();if(!t||t===`: keep-alive`||t.startsWith(`:`))return null;try{let e=JSON.parse(t),n=pn.safeParse(e);return n.success?n.data:null}catch{return null}}async function*G(e,t,n){let r=n?.connectTimeoutMs??3e4,i=new AbortController,a=setTimeout(()=>i.abort(),r),o=n?.signal?hn([i.signal,n.signal]):i.signal,s;try{s=await fetch(e,{headers:{Accept:`text/event-stream`,Authorization:`Bearer ${t}`,"Cache-Control":`no-cache`},signal:o})}finally{clearTimeout(a)}if(!s.ok){let e=await s.text().catch(()=>``);throw Error(`SSE connect failed (${s.status} ${s.statusText}): ${e}`)}if(!s.body)throw Error(`SSE response has no body`);let c=new TextDecoder,l=s.body.getReader(),u=``;try{for(;;){let{done:e,value:t}=await l.read();if(e)break;u+=c.decode(t,{stream:!0});let n=u.split(`
3
+ `);u=n.pop()??``;let r=``;for(let e of n)if(e.startsWith(`data:`))r+=e.slice(5).trimStart();else if(e===``&&r){let e=mn(r);e&&(yield e),r=``}}}finally{l.releaseLock()}}function hn(e){let t=new AbortController;for(let n of e){if(n.aborted){t.abort(n.reason);break}n.addEventListener(`abort`,()=>t.abort(n.reason),{once:!0})}return t.signal}var K=e=>typeof e==`string`&&e.trim().length>0?e:null,gn=e=>new Promise(t=>setTimeout(t,e)),_n=e=>{try{let t=Jt.parse(e);if(t)return t}catch{let t=e.run||null;if(t)try{let e=Jt.parse(t);if(e)return e}catch{}}throw Error(`Run ID missing in engine response`)},vn=class{constructor(e){this.baseUrl=e.baseUrl.replace(/\/+$/,``),this.token=e.token,this.timeoutMs=e.timeoutMs??2e4;let t=this._request.bind(this);this.sessions=new wn(this.baseUrl,this.token,this.timeoutMs,t),this.permissions=new Tn(t),this.questions=new En(t),this.providers=new Dn(t),this.identity=new On(t),this.channels=new kn(t),this.mcp=new An(t,this._requestText.bind(this));let n=()=>this.token;this.routines=new Ln(this.baseUrl,n,t),this.automations=new Bn(this.baseUrl,n,t),this.automationsV2=new Vn(this.baseUrl,n,t),this.optimizations=new Hn(t),this.workflowPlans=new Rn(t),this.workflowPlannerSessions=new zn(t),this.memory=new jn(t),this.skills=new Mn(t),this.packs=new Nn(t),this.capabilities=new Pn(t),this.resources=new Fn(this.baseUrl,n,t),this.browser=new yn(t),this.storage=new bn(t),this.worktrees=new xn(t),this.workflows=new Sn(this.baseUrl,n,t),this.bugMonitor=new Cn(t),this.coder=new In(t),this.agentTeams=new Un(t),this.missions=new Wn(t)}setToken(e){this.token=e,this.sessions.setToken(e)}async health(){return W(Yt,await this._request(`/global/health`),`/global/health`,200)}async listToolIds(){return this._request(`/tool/ids`)}async listTools(){let e=await this._request(`/tool`);return Array.isArray(e)?e:[]}async executeTool(e,t){return this._request(`/tool/execute`,{method:`POST`,body:JSON.stringify({tool:e,args:t??{}})})}stream(e,t,n){let r=new URLSearchParams({sessionID:e});return t&&r.set(`runID`,t),G(`${this.baseUrl}/event?${r.toString()}`,this.token,n)}globalStream(e){return G(`${this.baseUrl}/global/event`,this.token,e)}async runEvents(e,t){let n=new URLSearchParams;t?.sinceSeq!==void 0&&n.set(`since_seq`,String(t.sinceSeq)),t?.tail!==void 0&&n.set(`tail`,String(t.tail));let r=n.toString()?`?${n.toString()}`:``,i=await this._request(`/run/${encodeURIComponent(e)}/events${r}`);return Array.isArray(i)?i:[]}async _request(e,t={}){let n=t.timeoutMs??this.timeoutMs,r=new AbortController,i=setTimeout(()=>r.abort(),n),a;try{a=await fetch(`${this.baseUrl}${e}`,{...t,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.token}`,...t.headers??{}},signal:r.signal})}catch(t){throw t instanceof Error&&t.name===`AbortError`?Error(`Request timed out after ${n}ms: ${e}`):t}finally{clearTimeout(i)}if(a.status!==204){if(!a.ok){let t=await a.text().catch(()=>``);throw a.status===524?Error(`Engine timed out while waiting for ${e} to finish.`):Error(`Request failed (${a.status} ${a.statusText}): ${t}`)}return a.json()}}async _requestText(e,t={}){let n=t.timeoutMs??this.timeoutMs,r=new AbortController,i=setTimeout(()=>r.abort(),n),a;try{a=await fetch(`${this.baseUrl}${e}`,{...t,headers:{Authorization:`Bearer ${this.token}`,...t.headers??{}},signal:r.signal})}catch(t){throw t instanceof Error&&t.name===`AbortError`?Error(`Request timed out after ${n}ms: ${e}`):t}finally{clearTimeout(i)}if(!a.ok){let t=await a.text().catch(()=>``);throw a.status===524?Error(`Engine timed out while waiting for ${e} to finish.`):Error(`Request failed (${a.status} ${a.statusText}): ${t}`)}return a.text()}},yn=class{constructor(e){this.req=e}async status(){return this.req(`/browser/status`)}async install(){return this.req(`/browser/install`,{method:`POST`})}async smokeTest(e){return this.req(`/browser/smoke-test`,{method:`POST`,body:JSON.stringify(e??{})})}},bn=class{constructor(e){this.req=e}async listFiles(e){let t=new URLSearchParams;e?.path&&t.set(`path`,e.path),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``;return this.req(`/global/storage/files${n}`)}async repair(e){return this.req(`/global/storage/repair`,{method:`POST`,body:JSON.stringify({force:e?.force??!1})})}},xn=class{constructor(e){this.req=e}async cleanup(e){return this.req(`/worktree/cleanup`,{method:`POST`,body:JSON.stringify({repo_root:e?.repoRoot,dry_run:e?.dryRun??!1,remove_orphan_dirs:e?.removeOrphanDirs??!0})})}},Sn=class{constructor(e,t,n){this.baseUrl=e,this.getToken=t,this.req=n}async list(){let e=await this.req(`/workflows`)??{},t=Array.isArray(e.workflows)?e.workflows:[];return{workflows:t,count:typeof e.count==`number`?e.count:t.length}}async get(e){return(await this.req(`/workflows/${encodeURIComponent(e)}`)).workflow??{}}async validate(e){return this.req(`/workflows/validate`,{method:`POST`,body:JSON.stringify(e??{})})}async simulate(e){return this.req(`/workflows/simulate`,{method:`POST`,body:JSON.stringify(e)})}events(e){let t=new URLSearchParams,n=e?.workflow_id??e?.workflowId,r=e?.run_id??e?.runId;n&&t.set(`workflow_id`,n),r&&t.set(`run_id`,r);let i=t.toString()?`?${t.toString()}`:``;return G(`${this.baseUrl}/workflows/events${i}`,this.getToken(),{signal:e?.signal})}async listRuns(e){let t=new URLSearchParams,n=e?.workflow_id??e?.workflowId;n&&t.set(`workflow_id`,n),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let r=t.toString()?`?${t.toString()}`:``,i=await this.req(`/workflows/runs${r}`)??{},a=Array.isArray(i.runs)?i.runs:[];return{runs:a,count:typeof i.count==`number`?i.count:a.length}}async getRun(e){return(await this.req(`/workflows/runs/${encodeURIComponent(e)}`)).run??{}}async run(e,t){return this.req(`/workflows/${encodeURIComponent(e)}/run`,{method:`POST`,body:JSON.stringify(t??{})})}async listHooks(e){let t=new URLSearchParams,n=e?.workflow_id??e?.workflowId;n&&t.set(`workflow_id`,n);let r=t.toString()?`?${t.toString()}`:``,i=await this.req(`/workflow-hooks${r}`)??{},a=Array.isArray(i.hooks)?i.hooks:[];return{hooks:a,count:typeof i.count==`number`?i.count:a.length}}async patchHook(e,t){return this.req(`/workflow-hooks/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}},Cn=class{constructor(e){this.req=e}async getConfig(){return this.req(`/config/bug-monitor`)}async patchConfig(e){let t=e&&typeof e==`object`&&`bug_monitor`in e?e:{bug_monitor:e};return this.req(`/config/bug-monitor`,{method:`PATCH`,body:JSON.stringify(t)})}async getStatus(){return this.req(`/bug-monitor/status`)}async recomputeStatus(){return this.req(`/bug-monitor/status/recompute`,{method:`POST`})}async pause(){return this.req(`/bug-monitor/pause`,{method:`POST`})}async resume(){return this.req(`/bug-monitor/resume`,{method:`POST`})}async debug(){return this.req(`/bug-monitor/debug`)}async listIncidents(e){let t=e?.limit===void 0?``:`?limit=${e.limit}`;return this.req(`/bug-monitor/incidents${t}`)}async getIncident(e){return(await this.req(`/bug-monitor/incidents/${encodeURIComponent(e)}`)).incident??{}}async replayIncident(e,t){return this.req(`/bug-monitor/incidents/${encodeURIComponent(e)}/replay`,{method:`POST`,body:JSON.stringify(t??{})})}async deleteIncident(e){return this.req(`/bug-monitor/incidents/${encodeURIComponent(e)}`,{method:`DELETE`})}async bulkDeleteIncidents(e){return this.req(`/bug-monitor/incidents/bulk-delete`,{method:`POST`,body:JSON.stringify(e)})}async deleteDraft(e){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}`,{method:`DELETE`})}async bulkDeleteDrafts(e){return this.req(`/bug-monitor/drafts/bulk-delete`,{method:`POST`,body:JSON.stringify(e)})}async deletePost(e){return this.req(`/bug-monitor/posts/${encodeURIComponent(e)}`,{method:`DELETE`})}async bulkDeletePosts(e){return this.req(`/bug-monitor/posts/bulk-delete`,{method:`POST`,body:JSON.stringify(e)})}async listDrafts(e){let t=e?.limit===void 0?``:`?limit=${e.limit}`;return this.req(`/bug-monitor/drafts${t}`)}async listPosts(e){let t=e?.limit===void 0?``:`?limit=${e.limit}`;return this.req(`/bug-monitor/posts${t}`)}async listIntakeKeys(){return this.req(`/bug-monitor/intake/keys`)}async createIntakeKey(e){return this.req(`/bug-monitor/intake/keys`,{method:`POST`,body:JSON.stringify(e)})}async disableIntakeKey(e){return this.req(`/bug-monitor/intake/keys/${encodeURIComponent(e)}/disable`,{method:`POST`})}async resetLogSourceOffset(e,t){return this.req(`/bug-monitor/log-sources/${encodeURIComponent(e)}/${encodeURIComponent(t)}/reset-offset`,{method:`POST`})}async replayLatestLogSourceCandidate(e,t){return this.req(`/bug-monitor/log-sources/${encodeURIComponent(e)}/${encodeURIComponent(t)}/replay-latest`,{method:`POST`})}async getDraft(e){return(await this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}`)).draft??{}}async approveDraft(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({reason:t})})}async denyDraft(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/deny`,{method:`POST`,body:JSON.stringify({reason:t})})}async report(e){let t=e&&typeof e==`object`&&`report`in e?e:{report:e};return this.req(`/bug-monitor/report`,{method:`POST`,body:JSON.stringify(t)})}async createTriageRun(e){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/triage-run`,{method:`POST`})}async createTriageSummary(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/triage-summary`,{method:`POST`,body:JSON.stringify(t)})}async createIssueDraft(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/issue-draft`,{method:`POST`,body:JSON.stringify(t??{})})}async publishDraft(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/publish`,{method:`POST`,body:JSON.stringify(t??{})})}async recheckMatch(e,t){return this.req(`/bug-monitor/drafts/${encodeURIComponent(e)}/recheck-match`,{method:`POST`,body:JSON.stringify(t??{})})}},wn=class{constructor(e,t,n,r){this.baseUrl=e,this.token=t,this.timeoutMs=n,this.req=r}setToken(e){this.token=e}async create(e={}){let t={title:e.title??`Tandem SDK Session`,directory:e.directory??`.`};return e.permissions&&(t.permission=e.permissions),e.sourceKind&&(t.sourceKind=e.sourceKind),e.sourceMetadata&&(t.sourceMetadata=e.sourceMetadata),e.model&&e.provider&&(t.model={providerID:e.provider,modelID:e.model},t.provider=e.provider),(await this.req(`/session`,{method:`POST`,body:JSON.stringify(t)})).id}async list(e={}){let t=new URLSearchParams;e.q&&t.set(`q`,e.q),e.page!==void 0&&t.set(`page`,String(e.page)),e.pageSize!==void 0&&t.set(`page_size`,String(e.pageSize)),e.archived!==void 0&&t.set(`archived`,String(e.archived)),e.scope&&t.set(`scope`,e.scope),e.workspace&&t.set(`workspace`,e.workspace),e.source&&t.set(`source`,e.source);let n=t.toString()?`?${t.toString()}`:``;return W(Zt,await this.req(`/session${n}`),`/session`,200)}async get(e){return W(Xt,await this.req(`/session/${encodeURIComponent(e)}`),`/session/${e}`,200)}async update(e,t){return W(Xt,await this.req(`/session/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),`/session/${e}`,200)}async archive(e){return this.update(e,{archived:!0})}async delete(e){await this.req(`/session/${encodeURIComponent(e)}`,{method:`DELETE`})}async messages(e){return this.req(`/session/${encodeURIComponent(e)}/message`)}async todos(e){let t=await this.req(`/session/${encodeURIComponent(e)}/todo`);return Array.isArray(t)?t:t.todos??[]}async activeRun(e){return W(Qt,await this.req(`/session/${encodeURIComponent(e)}/run`),`/session/${e}/run`,200)}async promptAsync(e,t,n,r){return this.promptAsyncParts(e,[{type:`text`,text:t}],n,r)}async promptAsyncParts(e,t,n,r){let i={parts:t};n?.provider&&n?.model&&(i.model={providerID:n.provider,modelID:n.model}),r?.toolMode&&(i.toolMode=r.toolMode),r?.toolAllowlist?.length&&(i.toolAllowlist=r.toolAllowlist),r?.contextMode&&(i.contextMode=r.contextMode);let a=`/session/${encodeURIComponent(e)}/prompt_async?return=run`,o=new AbortController,s=setTimeout(()=>o.abort(),this.timeoutMs),c;try{c=await fetch(`${this.baseUrl}${a}`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.token}`},body:JSON.stringify(i),signal:o.signal})}finally{clearTimeout(s)}if(c.status===409){let e=(await c.json().catch(()=>({}))).activeRun,t=K(e?.runID)||K(e?.runId)||K(e?.run_id);if(t)return{runId:t}}if(!c.ok){let e=await c.text().catch(()=>``);throw Error(`promptAsyncParts failed (${c.status}): ${e}`)}return{runId:_n(await c.json())}}async promptSync(e,t){let n={parts:[{type:`text`,text:t}]},r=await this.req(`/session/${encodeURIComponent(e)}/prompt_sync`,{method:`POST`,body:JSON.stringify(n)});return K(r.reply)||K(r.text)||K(r.output)||``}async abort(e){return this.req(`/session/${encodeURIComponent(e)}/abort`,{method:`POST`,body:JSON.stringify({})})}async cancel(e){return this.req(`/session/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:JSON.stringify({})})}async cancelRun(e,t){return this.req(`/session/${encodeURIComponent(e)}/run/${encodeURIComponent(t)}/cancel`,{method:`POST`,body:JSON.stringify({})})}async fork(e){return W(Xt,await this.req(`/session/${encodeURIComponent(e)}/fork`,{method:`POST`,body:JSON.stringify({})}),`/session/${e}/fork`,200)}async diff(e){return this.req(`/session/${encodeURIComponent(e)}/diff`)}async revert(e){return this.req(`/session/${encodeURIComponent(e)}/revert`,{method:`POST`,body:JSON.stringify({})})}async unrevert(e){return this.req(`/session/${encodeURIComponent(e)}/unrevert`,{method:`POST`,body:JSON.stringify({})})}async children(e){return W(Zt,await this.req(`/session/${encodeURIComponent(e)}/children`),`/session/${e}/children`,200).sessions}async summarize(e){return this.req(`/session/${encodeURIComponent(e)}/summarize`,{method:`POST`,body:JSON.stringify({})})}async attach(e,t){return this.req(`/session/${encodeURIComponent(e)}/attach`,{method:`POST`,body:JSON.stringify({target_workspace:t})})}},Tn=class{constructor(e){this.req=e}async list(){return this.req(`/permission`)}async reply(e,t){let n=await this.req(`/permission/${encodeURIComponent(e)}/reply`,{method:`POST`,body:JSON.stringify({reply:t})});if(!n.ok)throw Error(`Permission reply rejected: ${n.error??e}`);return{ok:!0}}},En=class{constructor(e){this.req=e}async list(){let e=await this.req(`/question`);return Array.isArray(e)?{questions:e}:e}async reply(e,t){return this.req(`/question/${encodeURIComponent(e)}/reply`,{method:`POST`,body:JSON.stringify({answer:t})})}async reject(e){return this.req(`/question/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify({})})}},Dn=class{constructor(e){this.req=e}async catalog(){return this.req(`/provider`)}async config(){return this.req(`/config/providers`)}async setDefaults(e,t){await this.req(`/config`,{method:`PATCH`,body:JSON.stringify({default_provider:e,providers:{[e]:{default_model:t}}})})}async setApiKey(e,t){await this.req(`/auth/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({apiKey:t})})}async oauthAuthorize(e){return this.req(`/provider/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`})}async oauthStatus(e,t){let n=t?`?session_id=${encodeURIComponent(t)}`:``;return this.req(`/provider/${encodeURIComponent(e)}/oauth/status${n}`)}async oauthUseLocalSession(e){return this.req(`/provider/${encodeURIComponent(e)}/oauth/session/local`,{method:`POST`})}async oauthDisconnect(e){return this.req(`/provider/${encodeURIComponent(e)}/oauth/session`,{method:`DELETE`})}async authStatus(){return this.req(`/provider/auth`)}},On=class{constructor(e){this.req=e}async get(){return this.req(`/config/identity`)}async patch(e){return this.req(`/config/identity`,{method:`PATCH`,body:JSON.stringify(e)})}},kn=class{constructor(e){this.req=e}async config(){return this.req(`/channels/config`)}async status(){return this.req(`/channels/status`)}async put(e,t){return this.req(`/channels/${e}`,{method:`PUT`,body:JSON.stringify(t)})}async delete(e){return this.req(`/channels/${e}`,{method:`DELETE`})}async verify(e,t={}){return this.req(`/channels/${e}/verify`,{method:`POST`,body:JSON.stringify(t)})}async toolPreferences(e){return this.req(`/channels/${e}/tool-preferences`)}async setToolPreferences(e,t){return this.req(`/channels/${e}/tool-preferences`,{method:`PUT`,body:JSON.stringify(t)})}},An=class{constructor(e,t){this.req=e,this.reqText=t}async list(){return this.req(`/mcp`)}async listTools(){return this.req(`/mcp/tools`)}async listResources(){let e=await this.req(`/mcp/resources`);return Array.isArray(e)?e:[]}async add(e){return this.req(`/mcp`,{method:`POST`,body:JSON.stringify(e)})}async connect(e){return this.req(`/mcp/${encodeURIComponent(e)}/connect`,{method:`POST`})}async disconnect(e){return this.req(`/mcp/${encodeURIComponent(e)}/disconnect`,{method:`POST`})}async refresh(e){return this.req(`/mcp/${encodeURIComponent(e)}/refresh`,{method:`POST`})}async patch(e,t){return this.req(`/mcp/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t??{})})}async setEnabled(e,t){return this.patch(e,{enabled:t})}async delete(e){return this.req(`/mcp/${encodeURIComponent(e)}`,{method:`DELETE`})}async auth(e,t){return this.req(`/mcp/${encodeURIComponent(e)}/auth`,{method:`POST`,body:JSON.stringify(t??{})})}async deleteAuth(e){return this.req(`/mcp/${encodeURIComponent(e)}/auth`,{method:`DELETE`})}async authCallback(e,t){return this.req(`/mcp/${encodeURIComponent(e)}/auth/callback`,{method:`POST`,body:JSON.stringify(t)})}async authenticate(e,t){return this.req(`/mcp/${encodeURIComponent(e)}/auth/authenticate`,{method:`POST`,body:JSON.stringify(t??{})})}async catalogToml(e){if(!this.reqText)throw Error(`Text request helper unavailable`);return this.reqText(`/mcp/catalog/${encodeURIComponent(e)}/toml`)}},jn=class{constructor(e){this.req=e}async put(e){return this.req(`/memory/put`,{method:`POST`,body:JSON.stringify(e)})}async search(e){return W(on,await this.req(`/memory/search`,{method:`POST`,body:JSON.stringify(e)}),`/memory/search`,200)}async importPath(e){let t={source:{kind:`path`,path:e.path},format:e.format??`directory`,tier:e.tier??`project`,project_id:e.projectId,session_id:e.sessionId,sync_deletes:e.syncDeletes??!1};return this.req(`/memory/import`,{method:`POST`,body:JSON.stringify(t)})}async list(e){let t=new URLSearchParams;e?.q&&t.set(`q`,e.q),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.userId&&t.set(`user_id`,e.userId);let n=t.toString()?`?${t.toString()}`:``;return W(an,await this.req(`/memory${n}`),`/memory`,200)}async delete(e){return this.req(`/memory/${encodeURIComponent(e)}`,{method:`DELETE`})}async promote(e){return this.req(`/memory/promote`,{method:`POST`,body:JSON.stringify(e)})}async demote(e){let t={id:e.id,run_id:e.runId};return this.req(`/memory/demote`,{method:`POST`,body:JSON.stringify(t)})}async audit(e){let t=new URLSearchParams;e?.run_id&&t.set(`run_id`,e.run_id),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``,r=await this.req(`/memory/audit${n}`);return Array.isArray(r)?{entries:r,count:r.length}:r}async contextResolveUri(e){return W(un,await this.req(`/memory/context/resolve`,{method:`POST`,body:JSON.stringify({uri:e})}),`/memory/context/resolve`,200)}async contextTree(e,t){let n=new URLSearchParams;n.set(`uri`,e),t!==void 0&&n.set(`max_depth`,String(t));let r=n.toString()?`?${n.toString()}`:``;return W(dn,await this.req(`/memory/context/tree${r}`),`/memory/context/tree`,200)}async contextGenerateLayers(e){return this.req(`/memory/context/layers/generate`,{method:`POST`,body:JSON.stringify({node_id:e})})}async contextDistill(e,t){return W(fn,await this.req(`/memory/context/distill`,{method:`POST`,body:JSON.stringify({session_id:e,conversation:t})}),`/memory/context/distill`,200)}},Mn=class{constructor(e){this.req=e}async list(e){let t=e?`?location=${encodeURIComponent(e)}`:``,n=await this.req(`/skills${t}`);return Array.isArray(n)?{skills:n,count:n.length}:n}async get(e){return this.req(`/skills/${encodeURIComponent(e)}`)}async import(e){let t={content:e.content,file_or_path:e.file_or_path??e.fileOrPath,location:e.location,namespace:e.namespace,conflict_policy:e.conflict_policy??e.conflictPolicy};return this.req(`/skills/import`,{method:`POST`,body:JSON.stringify(t)})}async preview(e){let t={content:e.content,file_or_path:e.file_or_path??e.fileOrPath,location:e.location,namespace:e.namespace,conflict_policy:e.conflict_policy??e.conflictPolicy};return this.req(`/skills/import/preview`,{method:`POST`,body:JSON.stringify(t)})}async templates(){let e=await this.req(`/skills/templates`);return Array.isArray(e)?{templates:e,count:e.length}:e}async catalog(){let e=await this.req(`/skills/catalog`),t=Array.isArray(e)?e:[];return{skills:t,count:t.length}}async validate(e){let t={content:e.content,file_or_path:e.file_or_path??e.fileOrPath};return this.req(`/skills/validate`,{method:`POST`,body:JSON.stringify(t)})}async match(e){let t={goal:e.goal,max_matches:e.max_matches??e.maxMatches,threshold:e.threshold};return this.req(`/skills/router/match`,{method:`POST`,body:JSON.stringify(t)})}async evalBenchmark(e){let t={threshold:e.threshold,cases:e.cases.map(e=>({prompt:e.prompt,expected_skill:e.expected_skill??e.expectedSkill}))};return this.req(`/skills/evals/benchmark`,{method:`POST`,body:JSON.stringify(t)})}async evalTriggers(e){let t={skill_name:e.skill_name??e.skillName,prompts:e.prompts,threshold:e.threshold};return this.req(`/skills/evals/triggers`,{method:`POST`,body:JSON.stringify(t)})}async compile(e){let t={skill_name:e.skill_name??e.skillName,goal:e.goal,threshold:e.threshold,max_matches:e.max_matches??e.maxMatches,schedule:e.schedule};return this.req(`/skills/compile`,{method:`POST`,body:JSON.stringify(t)})}async generate(e){return this.req(`/skills/generate`,{method:`POST`,body:JSON.stringify(e)})}async generateInstall(e){let t={prompt:e.prompt,threshold:e.threshold,location:e.location,conflict_policy:e.conflictPolicy,artifacts:e.artifacts?{"SKILL.md":e.artifacts[`SKILL.md`],"workflow.yaml":e.artifacts[`workflow.yaml`],"automation.example.yaml":e.artifacts[`automation.example.yaml`]}:void 0};return this.req(`/skills/generate/install`,{method:`POST`,body:JSON.stringify(t)})}},Nn=class{constructor(e){this.req=e}async list(){return this.req(`/packs`)}async inspect(e){return this.req(`/packs/${encodeURIComponent(e)}`)}async install(e){return this.req(`/packs/install`,{method:`POST`,body:JSON.stringify(e)})}async installFromAttachment(e){return this.req(`/packs/install_from_attachment`,{method:`POST`,body:JSON.stringify(e)})}async uninstall(e){return this.req(`/packs/uninstall`,{method:`POST`,body:JSON.stringify(e)})}async export(e){return this.req(`/packs/export`,{method:`POST`,body:JSON.stringify(e)})}async detect(e){return this.req(`/packs/detect`,{method:`POST`,body:JSON.stringify(e)})}async updates(e){let t=await this.req(`/packs/${encodeURIComponent(e)}/updates`)||{},n=Array.isArray(t.updates)?t.updates:[];return{pack_id:K(t.pack_id)??void 0,name:K(t.name)??void 0,current_version:K(t.current_version)??void 0,updates:n}}async update(e,t){let n=await this.req(`/packs/${encodeURIComponent(e)}/update`,{method:`POST`,body:JSON.stringify(t??{})});return{updated:!!n.updated,pack_id:K(n.pack_id)??void 0,name:K(n.name)??void 0,current_version:K(n.current_version)??void 0,target_version:K(n.target_version)??void 0,reason:K(n.reason)??void 0}}},Pn=class{constructor(e){this.req=e}async getBindings(){return(await this.req(`/capabilities/bindings`)).bindings}async setBindings(e){return this.req(`/capabilities/bindings`,{method:`PUT`,body:JSON.stringify(e)})}async discovery(){return this.req(`/capabilities/discovery`)}async resolve(e){return this.req(`/capabilities/resolve`,{method:`POST`,body:JSON.stringify(e)})}async readiness(e){return this.req(`/capabilities/readiness`,{method:`POST`,body:JSON.stringify(e)})}},Fn=class{constructor(e,t,n){this.baseUrl=e,this.getToken=t,this.req=n}async list(e){let t=new URLSearchParams;e?.prefix&&t.set(`prefix`,e.prefix),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``;return W(rn,await this.req(`/resource${n}`),`/resource`,200)}async write(e){return this.req(`/resource`,{method:`PUT`,body:JSON.stringify(e)})}async get(e){return W(nn,await this.req(`/resource/${encodeURIComponent(e)}`),`/resource/${e}`,200)}async putKey(e,t,n){return W(tn,await this.req(`/resource/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({value:t,...n??{}})}),`/resource/${e}`,200)}async patchKey(e,t){return W(tn,await this.req(`/resource/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),`/resource/${e}`,200)}async delete(e,t){return this.req(`/resource`,{method:`DELETE`,body:JSON.stringify({key:e,...t})})}async deleteKey(e){return this.req(`/resource/${encodeURIComponent(e)}`,{method:`DELETE`})}events(e){let t=new URLSearchParams;e?.sinceSeq!==void 0&&t.set(`since_seq`,String(e.sinceSeq)),e?.tail!==void 0&&t.set(`tail`,String(e.tail));let n=t.toString()?`?${t.toString()}`:``;return G(`${this.baseUrl}/resource/events${n}`,this.getToken())}},In=class{constructor(e){this.req=e}async createRun(e){return this.req(`/coder/runs`,{method:`POST`,body:JSON.stringify(e)})}async listRuns(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=e?.workflow_mode??e?.workflowMode,r=e?.repo_slug??e?.repoSlug;n&&t.set(`workflow_mode`,n),r&&t.set(`repo_slug`,r);let i=t.toString()?`?${t.toString()}`:``,a=await this.req(`/coder/runs${i}`)??{},o=Array.isArray(a.runs)?a.runs:[];return{runs:o,count:typeof a.count==`number`?a.count:o.length}}async getRun(e){let t=await this.req(`/coder/runs/${encodeURIComponent(e)}`)??{};return{...t,coderRun:t.coder_run??void 0,coder_run:t.coder_run??void 0,run:t.run??void 0}}async getProjectBinding(e){let t=await this.req(`/coder/projects/${encodeURIComponent(e)}/bindings`)??{};return{...t,binding:t.binding??null}}async putProjectBinding(e,t){let n=await this.req(`/coder/projects/${encodeURIComponent(e)}/bindings`,{method:`PUT`,body:JSON.stringify(t)})??{};return{...n,binding:n.binding}}async getProjectGithubInbox(e){let t=await this.req(`/coder/projects/${encodeURIComponent(e)}/github-project/inbox`)??{};return{...t,items:Array.isArray(t.items)?t.items:[],binding:t.binding,project_id:String(t.project_id||t.projectId||``),schema_drift:!!(t.schema_drift??t.schemaDrift),live_schema_fingerprint:String(t.live_schema_fingerprint||t.liveSchemaFingerprint||``)}}async intakeProjectItem(e,t){let n=await this.req(`/coder/projects/${encodeURIComponent(e)}/github-project/intake`,{method:`POST`,body:JSON.stringify(t)})??{};return{...n,coder_run:n.coder_run??void 0,coderRun:n.coder_run??void 0,run:n.run??void 0}}async executeNext(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/execute-next`,{method:`POST`,body:JSON.stringify(t??{})})}async executeAll(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/execute-all`,{method:`POST`,body:JSON.stringify(t??{})})}async createFollowOnRun(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/follow-on-run`,{method:`POST`,body:JSON.stringify(t)})}async approveRun(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({reason:t})})}async cancelRun(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:JSON.stringify({reason:t})})}async listArtifacts(e){let t=await this.req(`/coder/runs/${encodeURIComponent(e)}/artifacts`)??{},n=Array.isArray(t.artifacts)?t.artifacts:[];return{...t,artifacts:n,count:typeof t.count==`number`?t.count:n.length}}async getMemoryHits(e,t){let n=new URLSearchParams;t?.query&&n.set(`q`,t.query),t?.limit!==void 0&&n.set(`limit`,String(t.limit));let r=n.toString()?`?${n.toString()}`:``,i=await this.req(`/coder/runs/${encodeURIComponent(e)}/memory-hits${r}`)??{},a=Array.isArray(i.hits)?i.hits:[];return{...i,hits:a,count:typeof i.count==`number`?i.count:a.length}}async createTriageInspectionReport(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/triage-inspection-report`,{method:`POST`,body:JSON.stringify(t)})}async createTriageReproductionReport(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/triage-reproduction-report`,{method:`POST`,body:JSON.stringify(t)})}async createTriageSummary(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/triage-summary`,{method:`POST`,body:JSON.stringify(t)})}async createPrReviewEvidence(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/pr-review-evidence`,{method:`POST`,body:JSON.stringify(t)})}async createPrReviewSummary(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/pr-review-summary`,{method:`POST`,body:JSON.stringify(t)})}async createIssueFixValidationReport(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/issue-fix-validation-report`,{method:`POST`,body:JSON.stringify(t)})}async createIssueFixSummary(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/issue-fix-summary`,{method:`POST`,body:JSON.stringify(t)})}async createPrDraft(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/pr-draft`,{method:`POST`,body:JSON.stringify(t??{})})}async submitPr(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/pr-submit`,{method:`POST`,body:JSON.stringify(t??{})})}async createMergeReadinessReport(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/merge-readiness-report`,{method:`POST`,body:JSON.stringify(t)})}async createMergeRecommendationSummary(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/merge-recommendation-summary`,{method:`POST`,body:JSON.stringify(t)})}async listMemoryCandidates(e){let t=await this.req(`/coder/runs/${encodeURIComponent(e)}/memory-candidates`)??{},n=Array.isArray(t.candidates)?t.candidates:[];return{...t,candidates:n,count:typeof t.count==`number`?t.count:n.length}}async createMemoryCandidate(e,t){return this.req(`/coder/runs/${encodeURIComponent(e)}/memory-candidates`,{method:`POST`,body:JSON.stringify(t)})}async promoteMemoryCandidate(e,t,n){return this.req(`/coder/runs/${encodeURIComponent(e)}/memory-candidates/${encodeURIComponent(t)}/promote`,{method:`POST`,body:JSON.stringify(n??{})})}},Ln=class{constructor(e,t,n){this.baseUrl=e,this.getToken=t,this.req=n}async list(){return this.req(`/routines`)}async create(e){let t={...e};return`prompt`in t&&!(`entrypoint`in t)&&(t.entrypoint=t.prompt),this.req(`/routines`,{method:`POST`,body:JSON.stringify(t)})}async update(e,t){return this.req(`/routines/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}async delete(e){await this.req(`/routines/${encodeURIComponent(e)}`,{method:`DELETE`})}async runNow(e){return W($t,await this.req(`/routines/${encodeURIComponent(e)}/run_now`,{method:`POST`,body:JSON.stringify({})}),`/routines/${e}/run_now`,200)}async listRuns(e){let t=new URLSearchParams;e?.routine_id&&t.set(`routine_id`,e.routine_id),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``;return this.req(`/routines/runs${n}`)}async getRunsForRoutine(e,t=25){return this.req(`/routines/${encodeURIComponent(e)}/runs?limit=${t}`)}async getRun(e){return W(en,await this.req(`/routines/runs/${encodeURIComponent(e)}`),`/routines/runs/${e}`,200)}async listArtifacts(e){return this.req(`/routines/runs/${encodeURIComponent(e)}/artifacts`)}async approveRun(e,t){return this.req(`/routines/runs/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async denyRun(e,t){return this.req(`/routines/runs/${encodeURIComponent(e)}/deny`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async pauseRun(e,t){return this.req(`/routines/runs/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async resumeRun(e,t){return this.req(`/routines/runs/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async history(e,t){let n=t===void 0?``:`?limit=${t}`,r=await this.req(`/routines/${encodeURIComponent(e)}/history${n}`);return Array.isArray(r)?{history:r,count:r.length}:r}events(e){let t=new URLSearchParams,n=e?.routine_id??e?.routineId;n&&t.set(`routine_id`,n);let r=t.toString()?`?${t.toString()}`:``;return G(`${this.baseUrl}/routines/events${r}`,this.getToken(),{signal:e?.signal})}addArtifact(e,t){return this.req(`/routines/runs/${encodeURIComponent(e)}/artifacts`,{method:`POST`,body:JSON.stringify(t)})}},Rn=class{constructor(e){this.req=e,this.planSessionIds=new Map,this.chatProjectSlug=`workflow-plans-chat`}plannerSessions(){return new zn(this.req)}rememberSession(e,t){let n=K(e),r=K(t?.session_id);!n||!r||this.planSessionIds.set(n,r)}chatSessionTitle(e){let t=e.trim().replace(/\s+/g,` `);return t?t.length>80?`${t.slice(0,77)}...`:t:`Workflow planner chat`}async ensureChatSession(e){let t=K(e);if(!t)throw Error(`Workflow planner plan ID is required`);let n=this.planSessionIds.get(t);if(n)return n;let r=await this.get(t),i=await this.plannerSessions().create({projectSlug:this.chatProjectSlug,project_slug:this.chatProjectSlug,title:K(r.plan?.title)??`Workflow planner chat`,goal:K(r.plan?.title)??``,plan_source:`workflow_plans_chat`,plan:r.plan,conversation:r.conversation,planner_diagnostics:r.planner_diagnostics??void 0,plan_revision:Number(r.plan?.plan_revision??1)||1,last_success_materialization:null}),a=K(i.session?.session_id);if(!a)throw Error(`Workflow planner session creation failed`);return this.rememberSession(t,i.session),a}async preview(e){return this.req(`/workflow-plans/preview`,{method:`POST`,body:JSON.stringify({prompt:e.prompt,schedule:e.schedule,plan_source:e.plan_source??e.planSource,allowed_mcp_servers:e.allowed_mcp_servers??e.allowedMcpServers,workspace_root:e.workspace_root??e.workspaceRoot,operator_preferences:e.operator_preferences??e.operatorPreferences})})}async apply(e){return this.req(`/workflow-plans/apply`,{method:`POST`,body:JSON.stringify({plan_id:e.plan_id??e.planId,plan:e.plan,creator_id:e.creator_id??e.creatorId,pack_builder_export:e.pack_builder_export??e.packBuilderExport,overlap_decision:e.overlap_decision??e.overlapDecision})})}async chatStart(e){let t=K((await this.plannerSessions().create({projectSlug:this.chatProjectSlug,project_slug:this.chatProjectSlug,title:this.chatSessionTitle(e.prompt),workspace_root:e.workspace_root??e.workspaceRoot,goal:e.prompt,plan_source:e.plan_source??e.planSource??`workflow_plans_chat`,allowed_mcp_servers:e.allowed_mcp_servers??e.allowedMcpServers,operator_preferences:e.operator_preferences??e.operatorPreferences})).session?.session_id);if(!t)throw Error(`Workflow planner session creation failed`);let n=await this.plannerSessions().start(t,e);return this.rememberSession(n.plan?.plan_id,n.session),n}async get(e){return this.req(`/workflow-plans/${encodeURIComponent(e)}`)}async chatMessage(e){let t=e.plan_id??e.planId,n=await this.ensureChatSession(t??``),r=await this.plannerSessions().message(n,{message:e.message});return this.rememberSession(r.plan?.plan_id??t,r.session),r}async chatReset(e){let t=e.plan_id??e.planId,n=await this.ensureChatSession(t??``),r=await this.plannerSessions().reset(n);return this.rememberSession(r.plan?.plan_id??t,r.session),r}async importPreview(e){return this.req(`/workflow-plans/import/preview`,{method:`POST`,body:JSON.stringify({bundle:e.bundle,creator_id:e.creator_id??e.creatorId,project_slug:e.project_slug??e.projectSlug,title:e.title})})}async importPlan(e){return this.req(`/workflow-plans/import`,{method:`POST`,body:JSON.stringify({bundle:e.bundle,creator_id:e.creator_id??e.creatorId,project_slug:e.project_slug??e.projectSlug,title:e.title})})}async exportPack(e){return this.req(`/workflow-plans/export/pack`,{method:`POST`,body:JSON.stringify({session_id:e.session_id??e.sessionId,plan_id:e.plan_id??e.planId,name:e.name,title:e.title,version:e.version,description:e.description,creator_id:e.creator_id??e.creatorId,cover_image_path:e.cover_image_path??e.coverImagePath})})}async importPackPreview(e){return this.req(`/workflow-plans/import/pack/preview`,{method:`POST`,body:JSON.stringify({path:e.path,selected_workflow_ids:e.selected_workflow_ids??e.selectedWorkflowIds??[],creator_id:e.creator_id??e.creatorId,project_slug:e.project_slug??e.projectSlug,title:e.title})})}async importPack(e){return this.req(`/workflow-plans/import/pack`,{method:`POST`,body:JSON.stringify({path:e.path,selected_workflow_ids:e.selected_workflow_ids??e.selectedWorkflowIds??[],creator_id:e.creator_id??e.creatorId,project_slug:e.project_slug??e.projectSlug,title:e.title})})}},zn=class{constructor(e){this.req=e,this.kickoffTimeoutMs=2e4,this.operationTimeoutMs=62e4,this.operationPollIntervalMs=1500}async awaitOperation(e,t){let n=K(e);if(!n)throw Error(`Workflow planner session ID is required`);let r=Date.now()+this.operationTimeoutMs;for(;Date.now()<r;){let e=(await this.get(n)).session,r=e?.operation;if(!r){await gn(this.operationPollIntervalMs);continue}let i=K(r.request_id);if(t&&i&&i!==t)throw Error(`Workflow planner session was replaced by a newer operation`);let a=(K(r.status)??``).toLowerCase();if(a===`completed`){let t=r.response;if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Workflow planner completed without a usable response payload`);return Object.assign({},t,{session:e})}if(a===`failed`)throw Error(K(r.error)??`Workflow planner failed during background execution`);await gn(this.operationPollIntervalMs)}throw Error(`Workflow planner timed out before completion`)}async list(e){let t=new URLSearchParams,n=e?.project_slug??e?.projectSlug;n&&t.set(`project_slug`,n);let r=t.toString()?`?${t.toString()}`:``;return this.req(`/workflow-plans/sessions${r}`)}async create(e){return this.req(`/workflow-plans/sessions`,{method:`POST`,body:JSON.stringify({project_slug:e.project_slug??e.projectSlug,title:e.title,workspace_root:e.workspace_root??e.workspaceRoot,goal:e.goal,notes:e.notes,planner_provider:e.planner_provider??e.plannerProvider,planner_model:e.planner_model??e.plannerModel,plan_source:e.plan_source??e.planSource,plan:e.plan,conversation:e.conversation,planner_diagnostics:e.planner_diagnostics??e.plannerDiagnostics,plan_revision:e.plan_revision??e.planRevision,last_success_materialization:e.last_success_materialization??e.lastSuccessMaterialization,allowed_mcp_servers:e.allowed_mcp_servers??e.allowedMcpServers,operator_preferences:e.operator_preferences??e.operatorPreferences,planning:e.planning})})}async get(e){return this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}`)}async patch(e,t){return this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({title:t.title,workspace_root:t.workspace_root??t.workspaceRoot,goal:t.goal,notes:t.notes,planner_provider:t.planner_provider??t.plannerProvider,planner_model:t.planner_model??t.plannerModel,plan_source:t.plan_source??t.planSource,allowed_mcp_servers:t.allowed_mcp_servers??t.allowedMcpServers,operator_preferences:t.operator_preferences??t.operatorPreferences,planning:t.planning,current_plan_id:t.current_plan_id??t.currentPlanId,draft:t.draft,published_at_ms:t.published_at_ms??t.publishedAtMs,published_tasks:t.published_tasks??t.publishedTasks})})}async duplicate(e,t){return this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}/duplicate`,{method:`POST`,body:JSON.stringify({title:t?.title})})}async delete(e){return this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}`,{method:`DELETE`})}async start(e,t){let n=await this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}/start-async`,{method:`POST`,timeoutMs:this.kickoffTimeoutMs,body:JSON.stringify({prompt:t.prompt,schedule:t.schedule,plan_source:t.plan_source??t.planSource,allowed_mcp_servers:t.allowed_mcp_servers??t.allowedMcpServers,workspace_root:t.workspace_root??t.workspaceRoot,operator_preferences:t.operator_preferences??t.operatorPreferences})});return this.awaitOperation(e,n.session?.operation?.request_id??null)}async message(e,t){let n=await this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}/message-async`,{method:`POST`,timeoutMs:this.kickoffTimeoutMs,body:JSON.stringify({message:t.message})});return this.awaitOperation(e,n.session?.operation?.request_id??null)}async reset(e){return this.req(`/workflow-plans/sessions/${encodeURIComponent(e)}/reset`,{method:`POST`})}},Bn=class{constructor(e,t,n){this.baseUrl=e,this.getToken=t,this.req=n}async list(){return this.req(`/automations`)}async create(e){return this.req(`/automations`,{method:`POST`,body:JSON.stringify(e)})}async update(e,t){return this.req(`/automations/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}async delete(e){await this.req(`/automations/${encodeURIComponent(e)}`,{method:`DELETE`})}async runNow(e){return W($t,await this.req(`/automations/${encodeURIComponent(e)}/run_now`,{method:`POST`,body:JSON.stringify({})}),`/automations/${e}/run_now`,200)}async listRuns(e){let t=new URLSearchParams;e?.automation_id&&t.set(`automation_id`,e.automation_id),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString()?`?${t.toString()}`:``;return this.req(`/automations/runs${n}`)}async getRunsForAutomation(e,t=25){return this.req(`/automations/${encodeURIComponent(e)}/runs?limit=${t}`)}async getRun(e){return W(en,await this.req(`/automations/runs/${encodeURIComponent(e)}`),`/automations/runs/${e}`,200)}async listArtifacts(e){return this.req(`/automations/runs/${encodeURIComponent(e)}/artifacts`)}async approveRun(e,t){return this.req(`/automations/runs/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async denyRun(e,t){return this.req(`/automations/runs/${encodeURIComponent(e)}/deny`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async pauseRun(e,t){return this.req(`/automations/runs/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async resumeRun(e,t){return this.req(`/automations/runs/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async history(e,t){let n=t===void 0?``:`?limit=${t}`,r=await this.req(`/automations/${encodeURIComponent(e)}/history${n}`);return Array.isArray(r)?{history:r,count:r.length}:r}events(e){let t=new URLSearchParams,n=e?.automation_id??e?.automationId,r=e?.run_id??e?.runId;n&&t.set(`automation_id`,n),r&&t.set(`run_id`,r);let i=t.toString()?`?${t.toString()}`:``;return G(`${this.baseUrl}/automations/events${i}`,this.getToken(),{signal:e?.signal})}addArtifact(e,t){return this.req(`/automations/runs/${encodeURIComponent(e)}/artifacts`,{method:`POST`,body:JSON.stringify(t)})}},Vn=class{constructor(e,t,n){this.baseUrl=e,this.getToken=t,this.req=n}async create(e){return this.req(`/automations/v2`,{method:`POST`,body:JSON.stringify(e)})}async list(){return this.req(`/automations/v2`)}async get(e){return this.req(`/automations/v2/${encodeURIComponent(e)}`)}async update(e,t){return this.req(`/automations/v2/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}async delete(e){return this.req(`/automations/v2/${encodeURIComponent(e)}`,{method:`DELETE`})}async runNow(e,t){let n={dry_run:t?.dryRun===!0};return t?.executionProfile&&(n.execution_profile=t.executionProfile),this.req(`/automations/v2/${encodeURIComponent(e)}/run_now`,{method:`POST`,body:JSON.stringify(n)})}async pause(e,t){return this.req(`/automations/v2/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async resume(e){return this.req(`/automations/v2/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({})})}async listRuns(e,t=50){return this.req(`/automations/v2/${encodeURIComponent(e)}/runs?limit=${t}`)}async getRun(e){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}`)}async pauseRun(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/pause`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async resumeRun(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async recoverRun(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/recover`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async repairRun(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/repair`,{method:`POST`,body:JSON.stringify(t)})}async retryTask(e,t,n){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/retry`,{method:`POST`,body:JSON.stringify({reason:n??``})})}async previewTaskReset(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/reset_preview`)}async continueTask(e,t,n){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/continue`,{method:`POST`,body:JSON.stringify({reason:n??``})})}async requeueTask(e,t,n){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/requeue`,{method:`POST`,body:JSON.stringify({reason:n??``})})}async setTaskDisposition(e,t,n,r){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/disposition`,{method:`PATCH`,body:JSON.stringify({disposition:n,reason:r??``})})}async graduationSummary(e){let t=new URLSearchParams;e?.windowHours!==void 0&&t.set(`window_hours`,String(e.windowHours)),e?.automationId&&t.set(`automation_id`,e.automationId),e?.limit!==void 0&&t.set(`limit`,String(e.limit));let n=t.toString();return this.req(`/automations/v2/graduation/summary${n?`?${n}`:``}`)}async claimBacklogTask(e,t,n){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/backlog/tasks/${encodeURIComponent(t)}/claim`,{method:`POST`,body:JSON.stringify(n||{})})}async requeueBacklogTask(e,t,n){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/backlog/tasks/${encodeURIComponent(t)}/requeue`,{method:`POST`,body:JSON.stringify({reason:n??``})})}async cancelRun(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async gateDecide(e,t){return this.req(`/automations/v2/runs/${encodeURIComponent(e)}/gate`,{method:`POST`,body:JSON.stringify(t)})}async listHandoffs(e){return this.req(`/automations/v2/${encodeURIComponent(e)}/handoffs`)}events(e){let t=new URLSearchParams,n=e?.automation_id??e?.automationId,r=e?.run_id??e?.runId;n&&t.set(`automation_id`,n),r&&t.set(`run_id`,r);let i=t.toString()?`?${t.toString()}`:``;return G(`${this.baseUrl}/automations/v2/events${i}`,this.getToken(),{signal:e?.signal})}},Hn=class{constructor(e){this.req=e}async list(){return this.req(`/optimizations`)}async create(e){return this.req(`/optimizations`,{method:`POST`,body:JSON.stringify(e)})}async get(e){return this.req(`/optimizations/${encodeURIComponent(e)}`)}async action(e,t){return this.req(`/optimizations/${encodeURIComponent(e)}/actions`,{method:`POST`,body:JSON.stringify(t)})}async listExperiments(e){return this.req(`/optimizations/${encodeURIComponent(e)}/experiments`)}async getExperiment(e,t){return this.req(`/optimizations/${encodeURIComponent(e)}/experiments/${encodeURIComponent(t)}`)}async applyWinner(e,t){return this.req(`/optimizations/${encodeURIComponent(e)}/experiments/${encodeURIComponent(t)}`,{method:`POST`,body:JSON.stringify({})})}},Un=class{constructor(e){this.req=e}async listTemplates(e){let t=new URLSearchParams,n=String(e?.workspaceRoot||``).trim();n&&t.set(`workspaceRoot`,n);let r=t.toString()?`?${t.toString()}`:``;return this.req(`/agent-team/templates${r}`)}async createTemplate(e,t){let n=new URLSearchParams,r=String(t?.workspaceRoot||``).trim();r&&n.set(`workspaceRoot`,r);let i=n.toString()?`?${n.toString()}`:``;return this.req(`/agent-team/templates${i}`,{method:`POST`,body:JSON.stringify(e)})}async updateTemplate(e,t,n){let r=new URLSearchParams,i=String(n?.workspaceRoot||``).trim();i&&r.set(`workspaceRoot`,i);let a=r.toString()?`?${r.toString()}`:``;return this.req(`/agent-team/templates/${encodeURIComponent(e)}${a}`,{method:`PATCH`,body:JSON.stringify(t)})}async deleteTemplate(e,t){let n=new URLSearchParams,r=String(t?.workspaceRoot||``).trim();r&&n.set(`workspaceRoot`,r);let i=n.toString()?`?${n.toString()}`:``;return this.req(`/agent-team/templates/${encodeURIComponent(e)}${i}`,{method:`DELETE`})}async composeStandup(e){return this.req(`/agent-standup/compose`,{method:`POST`,body:JSON.stringify({name:e.name,workspace_root:e.workspaceRoot,schedule:e.schedule,participant_template_ids:e.participantTemplateIds,report_path_template:e.reportPathTemplate,model_policy:e.modelPolicy})})}async listInstances(e){let t=new URLSearchParams;e?.missionID&&t.set(`missionID`,e.missionID),e?.parentInstanceID&&t.set(`parentInstanceID`,e.parentInstanceID),e?.status&&t.set(`status`,e.status);let n=t.toString()?`?${t.toString()}`:``;return this.req(`/agent-team/instances${n}`)}async listMissions(){return this.req(`/agent-team/missions`)}async listApprovals(){return this.req(`/agent-team/approvals`)}async spawn(e){return this.req(`/agent-team/spawn`,{method:`POST`,body:JSON.stringify(e)})}async approveSpawn(e,t){return this.req(`/agent-team/approvals/spawn/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({reason:t??``})})}async denySpawn(e,t){return this.req(`/agent-team/approvals/spawn/${encodeURIComponent(e)}/deny`,{method:`POST`,body:JSON.stringify({reason:t??``})})}},Wn=class{constructor(e){this.req=e}async list(){return this.req(`/mission`)}async create(e){return this.req(`/mission`,{method:`POST`,body:JSON.stringify(e)})}async get(e){return this.req(`/mission/${encodeURIComponent(e)}`)}async applyEvent(e,t){return this.req(`/mission/${encodeURIComponent(e)}/event`,{method:`POST`,body:JSON.stringify({event:t})})}},Gn=`electric_blue`,Kn={"--radius":`0px`,"--border-width":`1px`,"--border-width-strong":`2px`,"--shadow-offset":`2px 2px 0 rgba(0, 0, 0, 0.32)`,"--shadow-offset-lg":`4px 4px 0 rgba(0, 0, 0, 0.32)`,"--clip-primary-cta":`polygon(10% 0, 100% 0, 100% 100%, 0 100%, 0 25%)`},q=[{id:`charcoal_fire`,name:`Charcoal & Fire`,description:`Deep charcoal surfaces with solar-yellow power accents and crimson security cues.`,cssVars:{"--color-background":`#121212`,"--color-surface":`#141414`,"--color-surface-elevated":`#1a1a1a`,"--color-border":`rgba(245, 245, 245, 0.10)`,"--color-border-subtle":`rgba(245, 245, 245, 0.06)`,"--color-primary":`#F59E0B`,"--color-primary-hover":`#D97706`,"--color-primary-muted":`#B45309`,"--color-secondary":`#EF4444`,"--color-secondary-hover":`#DC2626`,"--color-success":`#10B981`,"--color-warning":`#F59E0B`,"--color-error":`#EF4444`,"--color-text":`#F5F5F5`,"--color-text-muted":`rgba(245, 245, 245, 0.70)`,"--color-text-subtle":`rgba(245, 245, 245, 0.50)`,"--color-glass":`rgba(255, 255, 255, 0.03)`,"--color-glass-border":`rgba(255, 255, 255, 0.08)`,"--font-sans":`"Manrope", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(245, 158, 11, 0.16)`,"--tcp-glow-b":`rgba(239, 68, 68, 0.12)`}},{id:`electric_blue`,name:`Electric Blue`,description:`The original Tandem look: electric-blue primary with purple secondary.`,cssVars:{"--color-background":`#0a0a0f`,"--color-surface":`#12121a`,"--color-surface-elevated":`#1a1a24`,"--color-border":`#2a2a3a`,"--color-border-subtle":`#1f1f2e`,"--color-primary":`#3b82f6`,"--color-primary-hover":`#2563eb`,"--color-primary-muted":`#1d4ed8`,"--color-secondary":`#8b5cf6`,"--color-secondary-hover":`#7c3aed`,"--color-success":`#10b981`,"--color-warning":`#f59e0b`,"--color-error":`#ef4444`,"--color-text":`#f8fafc`,"--color-text-muted":`#94a3b8`,"--color-text-subtle":`#64748b`,"--color-glass":`rgba(18, 18, 26, 0.8)`,"--color-glass-border":`rgba(255, 255, 255, 0.1)`,"--font-sans":`"Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(59, 130, 246, 0.16)`,"--tcp-glow-b":`rgba(139, 92, 246, 0.12)`}},{id:`emerald_night`,name:`Emerald Night`,description:`Dark glass with emerald primary and cyan secondary highlights.`,cssVars:{"--color-background":`#0b1010`,"--color-surface":`#0f1616`,"--color-surface-elevated":`#142020`,"--color-border":`rgba(226, 232, 240, 0.12)`,"--color-border-subtle":`rgba(226, 232, 240, 0.08)`,"--color-primary":`#10B981`,"--color-primary-hover":`#059669`,"--color-primary-muted":`#047857`,"--color-secondary":`#22D3EE`,"--color-secondary-hover":`#06B6D4`,"--color-success":`#22C55E`,"--color-warning":`#F59E0B`,"--color-error":`#EF4444`,"--color-text":`#F1F5F9`,"--color-text-muted":`rgba(241, 245, 249, 0.72)`,"--color-text-subtle":`rgba(241, 245, 249, 0.52)`,"--color-glass":`rgba(15, 22, 22, 0.75)`,"--color-glass-border":`rgba(255, 255, 255, 0.10)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(16, 185, 129, 0.16)`,"--tcp-glow-b":`rgba(34, 211, 238, 0.12)`}},{id:`hello_bunny`,name:`Hello Bunny`,description:`Soft pink glass with berry accents and a cozy, playful vibe.`,cssVars:{"--color-background":`#140A12`,"--color-surface":`#1C0E1A`,"--color-surface-elevated":`#251022`,"--color-border":`rgba(255, 228, 242, 0.12)`,"--color-border-subtle":`rgba(255, 228, 242, 0.08)`,"--color-primary":`#FB7185`,"--color-primary-hover":`#F43F5E`,"--color-primary-muted":`#E11D48`,"--color-secondary":`#C084FC`,"--color-secondary-hover":`#A855F7`,"--color-success":`#34D399`,"--color-warning":`#FBBF24`,"--color-error":`#FB7185`,"--color-text":`#FFEAF4`,"--color-text-muted":`rgba(255, 234, 244, 0.74)`,"--color-text-subtle":`rgba(255, 234, 244, 0.52)`,"--color-glass":`rgba(255, 255, 255, 0.04)`,"--color-glass-border":`rgba(255, 228, 242, 0.10)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(251, 113, 133, 0.16)`,"--tcp-glow-b":`rgba(192, 132, 252, 0.12)`}},{id:`porcelain`,name:`Porcelain`,description:`Plain, bright whites with soft pastel accents and glassy structure.`,cssVars:{"--color-background":`#F8FAFC`,"--color-surface":`#FFFFFF`,"--color-surface-elevated":`#F1F5F9`,"--color-border":`rgba(15, 23, 42, 0.12)`,"--color-border-subtle":`rgba(15, 23, 42, 0.08)`,"--color-primary":`#6366F1`,"--color-primary-hover":`#4F46E5`,"--color-primary-muted":`#4338CA`,"--color-secondary":`#F472B6`,"--color-secondary-hover":`#EC4899`,"--color-success":`#10B981`,"--color-warning":`#F59E0B`,"--color-error":`#EF4444`,"--color-text":`#0F172A`,"--color-text-muted":`rgba(15, 23, 42, 0.70)`,"--color-text-subtle":`rgba(15, 23, 42, 0.50)`,"--color-glass":`rgba(255, 255, 255, 0.72)`,"--color-glass-border":`rgba(15, 23, 42, 0.10)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(99, 102, 241, 0.13)`,"--tcp-glow-b":`rgba(244, 114, 182, 0.11)`}},{id:`neon_riot`,name:`Neon Riot`,description:`Electric cyan and magenta over deep space surfaces.`,cssVars:{"--color-background":`#050014`,"--color-surface":`#0B0720`,"--color-surface-elevated":`#140A3A`,"--color-border":`rgba(248, 250, 252, 0.16)`,"--color-border-subtle":`rgba(248, 250, 252, 0.10)`,"--color-primary":`#00E5FF`,"--color-primary-hover":`#00B8D4`,"--color-primary-muted":`#00838F`,"--color-secondary":`#FF3DF5`,"--color-secondary-hover":`#D500F9`,"--color-success":`#22C55E`,"--color-warning":`#FBBF24`,"--color-error":`#FB7185`,"--color-text":`#F8FAFC`,"--color-text-muted":`rgba(248, 250, 252, 0.72)`,"--color-text-subtle":`rgba(248, 250, 252, 0.52)`,"--color-glass":`rgba(5, 0, 20, 0.55)`,"--color-glass-border":`rgba(255, 255, 255, 0.14)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(0, 229, 255, 0.20)`,"--tcp-glow-b":`rgba(255, 61, 245, 0.14)`}},{id:`cosmic_glass`,name:`Cosmic Glass`,description:`Transparent nebula glass panels with deep-space glow.`,cssVars:{"--color-background":`#03020F`,"--color-surface":`rgba(9, 6, 28, 0.72)`,"--color-surface-elevated":`rgba(18, 12, 40, 0.82)`,"--color-border":`rgba(120, 105, 255, 0.22)`,"--color-border-subtle":`rgba(120, 105, 255, 0.12)`,"--color-primary":`#7C5CFF`,"--color-primary-hover":`#6A40FF`,"--color-primary-muted":`#4C2ED8`,"--color-secondary":`#FF7AD9`,"--color-secondary-hover":`#FF4FC3`,"--color-success":`#3BE4C0`,"--color-warning":`#F9D86B`,"--color-error":`#FF5C7A`,"--color-text":`#F3F0FF`,"--color-text-muted":`rgba(243, 240, 255, 0.74)`,"--color-text-subtle":`rgba(243, 240, 255, 0.52)`,"--color-glass":`rgba(14, 10, 40, 0.48)`,"--color-glass-border":`rgba(255, 255, 255, 0.16)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(124, 92, 255, 0.20)`,"--tcp-glow-b":`rgba(255, 122, 217, 0.14)`}},{id:`pink_pony`,name:`Pink Pony`,description:`Candy pinks and dreamy pastels with brighter glass accents.`,cssVars:{"--color-background":`#240818`,"--color-surface":`rgba(56, 12, 38, 0.94)`,"--color-surface-elevated":`rgba(72, 16, 48, 0.96)`,"--color-border":`rgba(255, 184, 217, 0.36)`,"--color-border-subtle":`rgba(255, 184, 217, 0.22)`,"--color-primary":`#FF5FB1`,"--color-primary-hover":`#FF3B9A`,"--color-primary-muted":`#D91E7D`,"--color-secondary":`#FFB8E6`,"--color-secondary-hover":`#FF98D8`,"--color-success":`#58E5C1`,"--color-warning":`#FFD166`,"--color-error":`#FF5C8A`,"--color-text":`#FFF7FC`,"--color-text-muted":`rgba(255, 247, 252, 0.86)`,"--color-text-subtle":`rgba(255, 247, 252, 0.68)`,"--color-glass":`rgba(74, 17, 50, 0.78)`,"--color-glass-border":`rgba(255, 220, 238, 0.30)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(255, 95, 177, 0.20)`,"--tcp-glow-b":`rgba(255, 184, 230, 0.14)`}},{id:`zen_dusk`,name:`Zen Dusk`,description:`Muted green dusk tones for calmer long-session work.`,cssVars:{"--color-background":`#0B1110`,"--color-surface":`#101716`,"--color-surface-elevated":`#141D1C`,"--color-border":`rgba(226, 232, 240, 0.12)`,"--color-border-subtle":`rgba(226, 232, 240, 0.06)`,"--color-primary":`#7CC8A4`,"--color-primary-hover":`#6AB690`,"--color-primary-muted":`#559B7B`,"--color-secondary":`#9FB8B0`,"--color-secondary-hover":`#8AA59C`,"--color-success":`#5EC79B`,"--color-warning":`#E6C17B`,"--color-error":`#E38B8B`,"--color-text":`#E6EFEA`,"--color-text-muted":`rgba(230, 239, 234, 0.72)`,"--color-text-subtle":`rgba(230, 239, 234, 0.50)`,"--color-glass":`rgba(20, 28, 26, 0.72)`,"--color-glass-border":`rgba(255, 255, 255, 0.08)`,"--font-sans":`"Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-display":`"Rubik", "Geist Sans", "Inter", system-ui, -apple-system, sans-serif`,"--font-mono":`"Geist Mono", "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace`,"--tcp-glow-a":`rgba(124, 200, 164, 0.16)`,"--tcp-glow-b":`rgba(159, 184, 176, 0.12)`}}],J={duration:{fast:.14,normal:.22,slow:.38},easing:{standard:[.22,1,.36,1],soft:[.33,1,.68,1],exit:[.4,0,1,1]},spring:{gentle:{type:`spring`,stiffness:220,damping:26,mass:.9},snappy:{type:`spring`,stiffness:320,damping:30,mass:.82},modal:{type:`spring`,stiffness:280,damping:28,mass:.95},drawer:{type:`spring`,stiffness:340,damping:34,mass:.82}}};function qn(e){let t=String(e||``).trim()||`electric_blue`;return t===`web_control`&&(t=Gn),q.find(e=>e.id===t)||q[0]}function Jn(e){let t=qn(e).id,n=q.findIndex(e=>e.id===t);return n<0?Gn:q[(n+1)%q.length].id}function Yn(e,t=typeof document<`u`?document.documentElement:null){let n=qn(e);if(!t)return n;for(let[e,n]of Object.entries(Kn))t.style.setProperty(e,n);for(let[e,r]of Object.entries(n.cssVars))r!=null&&t.style.setProperty(e,r);return t.dataset.theme=n.id,t.style.colorScheme=n.id===`porcelain`?`light`:`dark`,n}function Xn(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Zn=`tandem.themeId`;function Qn(){try{return qn(localStorage.getItem(Zn)).id}catch{return Gn}}function $n(e){return Yn(e)}function er(e){let t=Yn(e);try{localStorage.setItem(Zn,t.id)}catch{}return t}function tr(){let[t,n]=l(()=>Xn());return e(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>n(e.matches);return t(),typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):(e.addListener(t),()=>e.removeListener(t))},[]),t}var nr=[{key:`topLeft`,d:`M 165.7787,0.020459 C 110.5808,0.078505 55.382896,0.1357013 0.18497613,0.1942872 c -0.13808,69.0470108 -0.28197,138.0943328 -0.0977,207.1414028 0.11052,70.36172 0.22237,140.72344 0.33206,211.08516 C 77.700496,418.71333 154.9818,419.01452 232.263,419.26154 c 9.5066,-0.0925 19.113,-1.11955 28.5387,0.59284 4.6532,1.08536 8.9565,3.23566 13.4536,4.79499 6.593,2.55589 12.7266,6.10955 18.9726,9.38867 13.4755,-16.05439 26.9519,-32.10807 40.4278,-48.16211 -12.1424,-6.81702 -24.1012,-14.20169 -37.2648,-18.93966 -13.5687,-4.91142 -27.9081,-7.38898 -42.2708,-8.40335 -11.0216,-0.79383 -22.0809,-0.70151 -33.1242,-0.72592 -10.7282,0.0403 -21.4565,0.0756 -32.1848,0.0358 -42.5681,6.3e-4 -85.1362,10e-4 -127.704264,0.002 0,-99.46224 0,-198.92448 0,-298.386721 91.275364,0 182.550764,0 273.826164,0 -0.014,56.512711 0.04,113.025721 -0.1026,169.538201 -0.4117,20.19995 -1.8163,40.48931 0.4545,60.63079 1.6786,15.01655 5.5662,29.97844 13.0059,43.21631 7.5387,13.60301 18.1131,25.18796 29.0127,36.15897 23.8256,24.12545 48.9172,46.9543 73.9775,69.78218 6.9487,5.87852 13.8953,11.75951 20.8454,17.63644 13.0693,-12.95418 26.1394,-25.90752 39.2109,-38.85937 -28.7582,-27.3941 -57.5601,-54.76749 -85.5909,-82.89143 -5.5883,-5.64711 -11.1906,-11.30599 -16.1884,-17.49334 -0.5249,-0.66821 -1.2376,-1.54691 -1.8149,-2.3185 -5.2184,-6.75403 -9.5006,-14.31908 -11.8959,-22.54362 -2.2613,-7.64006 -2.7179,-15.6557 -3.0509,-23.57147 -0.5245,-16.31096 0.6385,-32.74612 0.7322,-49.10694 0.046,-10.58259 -0.014,-21.16542 0.011,-31.74814 0,-62.47018 0.01,-124.940367 0.01,-187.4105497 -40.8839,-0.537121 -81.7722,-0.4363093 -122.6586,-0.4765625 -35.037,-0.00429 -70.074,0.00506 -105.111,0.019531 z`,offsetX:-18,offsetY:-18,packetA:{cx:[154,208,272,338,392],cy:[154,208,272,338,392]},packetB:{cx:[270,322,364,410,446],cy:[270,322,364,410,446]}},{key:`topRight`,d:`M 738.18805,0.00904887 C 652.65224,0.14687727 567.11644,0.28620927 481.58063,0.42311147 481.29355,77.736195 480.97641,155.04938 480.73994,232.36252 c 0.0951,9.50059 1.12257,19.10363 -0.61083,28.52103 -1.08724,4.6222 -3.22866,8.89525 -4.77671,13.3659 -2.11394,5.50021 -4.95558,10.65543 -7.73606,15.88318 -0.5514,1.03279 -1.10342,2.06526 -1.6529,3.09908 16.05439,13.47549 32.10807,26.95183 48.16211,40.42773 6.80088,-12.1143 14.16648,-24.04427 18.90635,-37.17241 4.70755,-12.97452 7.19327,-26.66148 8.28795,-40.39257 0.96234,-11.87369 0.85374,-23.79791 0.87506,-35.70103 -0.0448,-10.76015 -0.0708,-21.52028 -0.0362,-32.28047 -6.3e-4,-42.33412 -0.001,-84.66823 -0.002,-127.002348 99.46224,0 198.92448,0 298.38672,0 0,91.275388 0,182.550778 0,273.826178 -56.54657,-0.0148 -113.09344,0.0431 -169.63977,-0.10651 -20.19988,-0.41744 -40.49026,-1.8122 -60.63074,0.46855 -14.76186,1.67135 -29.47359,5.44353 -42.53126,12.68208 -13.67228,7.44177 -25.30466,17.9973 -36.29986,28.88593 -24.28534,23.96271 -47.26235,49.19759 -70.22483,74.41794 -5.87851,6.9487 -11.7595,13.89532 -17.63643,20.84537 12.95567,13.06842 25.9083,26.13986 38.86328,39.20898 27.66859,-29.06037 55.33459,-58.14591 83.75768,-86.45455 8.5617,-8.48715 17.33411,-17.0041 27.81511,-23.11301 6.25643,-3.65571 13.14158,-6.26131 20.29954,-7.44598 5.95822,-1.04868 11.924,-1.34198 17.974,-1.55197 16.53486,-0.49041 33.05458,0.76393 49.58797,0.75655 72.54855,0.0238 145.09719,0.0223 217.64578,0.0218 0.55496,-42.85079 0.44067,-85.70605 0.47573,-128.55937 0.007,-88.26801 -0.0861,-176.535983 -0.19253,-264.80391353 -53.87299,-0.1086191 -107.74602,-0.2217584 -161.61914,-0.1796876 z`,offsetX:18,offsetY:-18,packetA:{cx:[746,692,628,562,508],cy:[154,208,272,338,392]},packetB:{cx:[630,578,536,490,454],cy:[270,322,364,410,446]}},{key:`bottomLeft`,d:`m 416.44677,389.82499 c -27.63909,29.04056 -55.28159,58.0743 -83.68816,86.33426 -8.1962,8.0499 -16.58633,16.12467 -26.56533,21.95472 -6.62254,3.91501 -13.97516,6.59579 -21.58594,7.75282 -6.08601,0.97701 -12.18199,1.21688 -18.32138,1.39901 -17.19693,0.40632 -34.37442,-0.94673 -51.57082,-0.79907 -66.02773,-0.0225 -132.055473,-0.003 -198.083206,-0.0124 -5.384635,-1.2e-4 -10.7692708,-3.5e-4 -16.15390616,-4e-4 -0.5424246,41.45067 -0.4419914,82.90578 -0.47756399963,124.35898 -0.008,89.66814 0.0887219996,179.33624 0.19436079963,269.0043 69.81380636,0.14113 139.62791536,0.27714 209.44178536,0.0951 69.59493,-0.10965 139.18985,-0.22064 208.78477,-0.32945 0.29326,-77.24849 0.59162,-154.49714 0.84172,-231.74566 -0.092,-9.38018 -1.07737,-18.846 0.4955,-28.1585 0.94174,-4.60968 3.10009,-8.83662 4.63349,-13.25795 0.843,-2.189 1.75327,-4.34941 2.73288,-6.40453 2.16593,-4.48341 4.58573,-8.83746 6.92337,-13.23219 -16.05732,-13.47848 -32.11466,-26.95695 -48.17188,-40.43555 -7.04213,12.52672 -14.6781,24.87418 -19.38736,38.52837 -5.66567,16.14988 -7.88257,33.29731 -8.44331,50.33996 -0.47979,17.62097 -0.0831,35.24985 -0.20252,52.87425 6.5e-4,43.60143 10e-4,87.20286 0.002,130.8043 -99.46224,0 -198.92448,0 -298.386714,0 0,-91.27539 0,-182.55079 0,-273.82618 56.512704,0.0137 113.025714,-0.0402 169.538204,0.10259 20.23434,0.41703 40.55908,1.817 60.73424,-0.4647 14.916,-1.68335 29.77681,-5.53584 42.94199,-12.90038 13.61582,-7.51192 25.2132,-18.07117 36.18649,-28.96459 24.17327,-23.87479 47.05648,-49.00616 69.92358,-74.12285 5.8785,-6.94807 11.7596,-13.89394 17.63643,-20.84342 -12.95561,-13.07175 -25.90997,-26.14473 -38.86328,-39.21876 -0.36979,0.38933 -0.73958,0.77865 -1.10938,1.16797 z`,offsetX:-18,offsetY:18,packetA:{cx:[154,208,272,338,392],cy:[746,692,628,562,508]},packetB:{cx:[270,322,364,410,446],cy:[630,578,536,490,454]}},{key:`bottomRight`,d:`m 426.8571,444.59091 c -12.72985,12.61977 -25.46283,25.23638 -38.19336,37.85547 29.12691,27.73171 58.25373,55.43889 86.62972,83.92587 8.60302,8.72405 17.28324,17.63916 23.36358,28.37664 3.38707,5.99569 5.81075,12.551 6.99498,19.34006 0.10315,0.70198 0.28675,1.69505 0.39581,2.51939 0.71872,4.98285 0.98533,10.12075 1.1706,15.08218 0.49786,16.07496 -0.64911,32.13742 -0.72978,48.20992 -0.0746,12.71328 -0.005,25.42699 -0.0304,38.14047 -0.002,60.49453 -0.005,120.98906 -0.007,181.48359 42.91832,0.56029 85.84121,0.44262 128.76211,0.47547 88.20042,0.002 176.40082,-0.0852 264.60117,-0.19227 0.14305,-69.71328 0.28248,-139.42689 0.0946,-209.14023 -0.1095,-69.69544 -0.22033,-139.39088 -0.329,-209.08633 -77.28117,-0.29086 -154.56251,-0.59133 -231.84371,-0.83873 -9.52988,0.0858 -19.16335,1.13203 -28.60918,-0.6117 -4.23636,-0.97203 -8.15732,-2.91274 -12.24527,-4.33881 -5.77747,-2.14913 -11.22148,-5.06032 -16.63414,-7.98379 -1.15488,-0.6186 -2.3098,-1.23709 -3.46458,-1.85588 -13.47912,16.05798 -26.95826,32.11595 -40.4375,48.17383 12.19551,6.85207 24.21269,14.26933 37.44508,19.00784 12.8948,4.64093 26.48482,7.10173 40.12002,8.18796 11.765,0.95772 23.58036,0.84872 35.37474,0.87453 10.96718,-0.0435 21.93434,-0.0712 32.90157,-0.0372 42.23515,-6.2e-4 84.47031,-10e-4 126.70547,-0.002 -1e-5,99.46224 0,198.92448 0,298.38672 -91.2754,0 -182.55079,0 -273.82618,0 0.0161,-56.57923 -0.0465,-113.15884 0.11074,-169.73778 0.41464,-20.2322 1.81951,-40.55708 -0.49651,-60.7277 -1.71763,-15.19144 -5.73298,-30.3167 -13.38031,-43.64446 -7.65026,-13.55499 -18.30059,-25.08429 -29.21818,-36.05517 -23.64522,-23.89553 -48.51342,-46.53253 -73.36373,-69.15939 -6.9487,-5.87852 -13.89532,-11.7595 -20.84537,-17.63644 -0.33854,0.33594 -0.67708,0.67188 -1.01562,1.00782 z`,offsetX:18,offsetY:18,packetA:{cx:[746,692,628,562,508],cy:[746,692,628,562,508]},packetB:{cx:[630,578,536,490,454],cy:[630,578,536,490,454]}}];function rr({className:e=``,mode:n=`panel`,title:r}){let i=tr(),a=f().replace(/:/g,``),o=n===`compact`,s=o?`color-mix(in srgb, white 86%, var(--color-surface-elevated) 14%)`:`color-mix(in srgb, white 78%, var(--color-surface-elevated) 22%)`,c=o?`drop-shadow(0 0 10px rgba(245, 158, 11, 0.22))`:`drop-shadow(0 0 18px rgba(245, 158, 11, 0.34))`,l=[`topLeft`,`bottomRight`],u=[`topRight`,`bottomLeft`],d=o?`-48 -48 996 996`:`0 0 900 900`;return V(`div`,{className:`relative isolate ${o?`flex items-center justify-center overflow-visible`:`overflow-hidden border border-white/6 bg-black/30`} ${e}`.trim(),title:r,"aria-hidden":`true`,children:[o?null:V(`div`,{className:`pointer-events-none absolute inset-0 opacity-70`,children:[V(`div`,{className:`absolute left-[6%] top-[8%] h-[34%] w-[34%] bg-[radial-gradient(circle_at_center,rgba(245,158,11,0.24),transparent_68%)]`}),V(`div`,{className:`absolute bottom-[8%] right-[6%] h-[34%] w-[34%] bg-[radial-gradient(circle_at_center,rgba(148,163,184,0.16),transparent_72%)]`}),V(`div`,{className:`absolute inset-0 bg-[linear-gradient(135deg,rgba(255,255,255,0.04),transparent_36%,transparent_64%,rgba(245,158,11,0.08))]`})]}),V(H.svg,{viewBox:d,className:`relative z-10 h-full w-full`,animate:i||!o?void 0:{rotate:[0,0,360,360]},transition:i||!o?void 0:{duration:2.8,ease:`easeInOut`,repeat:1/0,times:[0,.24,.7,1]},style:{transformOrigin:`50% 50%`},children:[V(`defs`,{children:V(`radialGradient`,{id:`${a}-core`,cx:`50%`,cy:`50%`,r:`50%`,children:[V(`stop`,{offset:`0%`,stopColor:`rgba(251,191,36,0.98)`}),V(`stop`,{offset:`55%`,stopColor:`rgba(245,158,11,0.62)`}),V(`stop`,{offset:`100%`,stopColor:`rgba(245,158,11,0)`})]})}),o?null:V(`rect`,{x:`0`,y:`0`,width:`900`,height:`900`,style:{fill:`color-mix(in srgb, var(--color-surface-elevated) 78%, #000 22%)`}}),V(`g`,{transform:o?`translate(52 52) scale(0.885)`:void 0,children:[nr.map(e=>V(`path`,{d:e.d,style:{fill:s,opacity:o?.92:.82}},`base-${e.key}`)),V(H.g,{style:{transformBox:`fill-box`,transformOrigin:`50% 50%`,filter:c},animate:i?{opacity:.16,rotate:0}:{opacity:o?[.14,.32,.14,.14]:[.12,.34,.12],rotate:o?[0,0,16,0]:[-8,8,-8]},transition:i?void 0:o?{duration:2.8,ease:`easeInOut`,repeat:1/0,times:[0,.24,.7,1]}:{duration:2.4,ease:`easeInOut`,repeat:1/0},children:nr.filter(e=>l.includes(e.key)).map(e=>V(`path`,{d:e.d,fill:`rgba(245, 158, 11, 0.9)`},`spin-a-${e.key}`))}),V(H.g,{style:{transformBox:`fill-box`,transformOrigin:`50% 50%`,filter:o?`drop-shadow(0 0 9px rgba(255, 230, 170, 0.18))`:`drop-shadow(0 0 14px rgba(255, 230, 170, 0.22))`},animate:i?{opacity:.14,rotate:0}:{opacity:o?[.1,.24,.1,.1]:[.08,.24,.08],rotate:o?[0,0,-16,0]:[8,-8,8]},transition:i?void 0:o?{duration:2.8,ease:`easeInOut`,repeat:1/0,times:[0,.24,.7,1],delay:.08}:{duration:2.4,ease:`easeInOut`,repeat:1/0,delay:.18},children:nr.filter(e=>u.includes(e.key)).map(e=>V(`path`,{d:e.d,fill:`rgba(255, 243, 199, 0.82)`},`spin-b-${e.key}`))}),V(H.circle,{cx:`450`,cy:`450`,r:o?42:72,fill:`url(#${a}-core)`,animate:i?{opacity:.24}:o?{opacity:[.16,.16,.42,.16],scale:[.98,.98,1.06,.98]}:{opacity:[.32,.68,.32],scale:[.92,1.06,.92]},transition:i?void 0:o?{duration:2.8,ease:`easeInOut`,repeat:1/0,times:[0,.24,.7,1]}:{duration:2.4,ease:`easeInOut`,repeat:1/0}}),V(H.rect,{x:o?`420`:`410`,y:o?`420`:`410`,width:o?`60`:`80`,height:o?`60`:`80`,rx:o?`6`:`8`,style:{fill:o?`rgba(255, 243, 199, 0.76)`:`rgba(255, 243, 199, 0.9)`,filter:o?`drop-shadow(0 0 10px rgba(245, 158, 11, 0.22))`:`drop-shadow(0 0 16px rgba(245, 158, 11, 0.42))`,transformBox:`fill-box`,transformOrigin:`50% 50%`},animate:i?{rotate:45}:o?{rotate:[45,45,405,405],scale:[.96,.96,1.04,.96]}:{rotate:[45,135,225,315,405],scale:[.92,1,.92]},transition:i?void 0:o?{duration:2.8,ease:`easeInOut`,repeat:1/0,times:[0,.24,.7,1]}:{duration:6.5,ease:`linear`,repeat:1/0}})]}),o?null:V(t,{children:[V(H.circle,{cx:`450`,cy:`450`,r:`32`,fill:`none`,stroke:`rgba(255, 231, 179, 0.58)`,strokeWidth:`3`,animate:i?{opacity:.28}:{r:[26,44,64],opacity:[.48,.24,0]},transition:i?void 0:{duration:2.2,ease:`easeOut`,repeat:1/0}}),V(H.circle,{cx:`450`,cy:`450`,r:`22`,fill:`none`,stroke:`rgba(148, 163, 184, 0.42)`,strokeWidth:`2`,animate:i?{opacity:.24}:{r:[18,34,50],opacity:[.22,.12,0]},transition:i?void 0:{duration:2.2,ease:`easeOut`,repeat:1/0,delay:.62}})]}),o?null:V(`g`,{children:[0,1,2,3].map(e=>V(H.rect,{x:92+e*178,y:`804`,width:`128`,height:`10`,style:{fill:`rgba(255, 240, 200, 0.78)`,filter:`drop-shadow(0 0 12px rgba(245, 158, 11, 0.24))`,transformBox:`fill-box`,transformOrigin:`left center`},animate:i?{opacity:.32,scaleX:.62}:{opacity:[.22,.92,.32],scaleX:[.36,1,.42]},transition:{duration:1.6,ease:`easeInOut`,repeat:1/0,delay:e*.16}},`telemetry-${e}`))})]})]})}function ir(){let[t,n]=l(()=>Xn());return e(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>n(e.matches);return t(),typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):(e.addListener(t),()=>e.removeListener(t))},[]),t}function ar(e,t,n){return Math.min(n,Math.max(t,e))}function or({className:e=``,children:t}){return V(`div`,{className:`tcp-glow-layer ${e}`.trim(),children:t})}function sr({className:e=``,children:t}){let n=ir();return V(H.div,{className:e,initial:n?!1:{opacity:0,y:14},animate:n?void 0:{opacity:1,y:0},exit:n?void 0:{opacity:0,y:-10},transition:n?void 0:{duration:J.duration.normal,ease:J.easing.standard},children:t})}function cr({className:e=``,children:t}){let n=ir();return V(H.div,{className:e,initial:n?!1:`hidden`,animate:n?void 0:`show`,variants:n?void 0:{hidden:{},show:{transition:{staggerChildren:.06,delayChildren:.02}}},children:t})}function lr({className:e=``,children:t,as:n=`div`}){let r=ir();return V(n===`section`?H.section:n===`article`?H.article:H.div,{className:e,variants:r?void 0:{hidden:{opacity:0,y:12,scale:.985},show:{opacity:1,y:0,scale:1,transition:{duration:J.duration.normal,ease:J.easing.standard}}},initial:r?!1:`hidden`,animate:r?void 0:`show`,children:t})}function ur({value:t,format:n=e=>String(e),className:r=``}){let i=ir(),[a,s]=l(()=>Number(t||0)),c=o(Number(t||0));return e(()=>{let e=Number(t||0);if(!Number.isFinite(e)){s(0),c.current=0;return}if(i){s(e),c.current=e;return}let n=c.current,r=e-n;if(!r){s(e),c.current=e;return}let a=performance.now(),o=0,l=t=>{let i=ar((t-a)/420,0,1);s(n+r*(1-(1-i)**3)),i<1?o=window.requestAnimationFrame(l):c.current=e};return o=window.requestAnimationFrame(l),()=>window.cancelAnimationFrame(o)},[i,t]),V(`span`,{className:r,children:n(Number.isFinite(a)?a:0)})}function Y({tone:e=`ok`,text:t,className:n=``}){return V(`span`,{className:`tcp-status-pulse ${e} ${n}`.trim(),children:[V(`span`,{className:`tcp-status-pulse-dot`,"aria-hidden":`true`}),t?V(`span`,{children:t}):null]})}function dr({className:e=``,children:t}){return V(`div`,{className:`tcp-toolbar ${e}`.trim(),children:t})}function fr({className:e=``,title:t,children:n,...r}){return V(`button`,{type:`button`,title:t,className:`tcp-icon-btn ${e}`.trim(),...r,children:n})}function pr({tone:e=`info`,className:t=``,children:n}){return V(`span`,{className:`${e===`ok`?`tcp-badge-ok`:e===`warn`?`tcp-badge-warn`:e===`err`?`tcp-badge-err`:e===`ghost`?`tcp-badge tcp-badge-ghost`:`tcp-badge-info`} ${t}`.trim(),children:n})}function mr({title:e,subtitle:t,actions:n,className:r=``,fullHeight:i,children:a}){return V(lr,{as:`section`,className:`tcp-panel-card ${i?`flex flex-col h-full`:``} ${r}`.trim(),children:[e||t||n?V(`div`,{className:`tcp-panel-card-head shrink-0`,children:[V(`div`,{className:`min-w-0`,children:[e?V(`h3`,{className:`tcp-title`,children:e}):null,t?V(`p`,{className:`tcp-subtle mt-1`,children:t}):null]}),n?V(`div`,{className:`shrink-0`,children:n}):null]}):null,V(`div`,{className:i?`flex-1 flex flex-col min-h-0`:``,children:a})]})}function hr({text:e,title:t=`Nothing here yet`,action:n,className:r=``}){return V(`div`,{className:`tcp-empty-state ${r}`.trim(),children:[V(`div`,{className:`tcp-empty-state-orb`}),V(`div`,{className:`relative z-10`,children:[V(`div`,{className:`tcp-empty-state-title`,children:t}),V(`p`,{className:`tcp-subtle mt-1`,children:e}),n?V(`div`,{className:`mt-3`,children:n}):null]})]})}function gr({title:e=`Loading`,text:t,className:n=``}){return V(`div`,{className:`grid min-h-[12rem] place-items-center rounded-lg border border-white/6 bg-black/20 p-6 text-center ${n}`.trim(),role:`status`,"aria-live":`polite`,children:V(`div`,{className:`grid justify-items-center gap-3`,children:[V(rr,{mode:`compact`,className:`h-14 w-14`,title:e}),V(`div`,{children:[V(`div`,{className:`text-sm font-medium text-tcp-text-primary`,children:e}),t?V(`p`,{className:`tcp-subtle mt-1 text-xs`,children:t}):null]})]})})}function _r({eyebrow:e,title:t,subtitle:n,badges:r,actions:i,className:a=``}){return V(lr,{className:`tcp-page-header ${a}`.trim(),children:[V(or,{className:`tcp-page-header-glow`}),V(`div`,{className:`relative z-10 flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between`,children:[V(`div`,{className:`min-w-0`,children:[e?V(`div`,{className:`tcp-page-eyebrow`,children:e}):null,V(`h1`,{className:`tcp-page-title`,children:t}),n?V(`p`,{className:`tcp-subtle mt-2 max-w-3xl`,children:n}):null,r?V(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r}):null]}),i?V(dr,{className:`justify-start lg:justify-end`,children:i}):null]})]})}function vr({className:e=``,mainClassName:t=``,asideClassName:n=``,main:r,aside:i}){return V(`div`,{className:`tcp-split-view ${i?``:`tcp-split-view--solo`} ${e}`.trim(),children:[V(`div`,{className:`min-w-0 ${t}`.trim(),children:r}),i?V(`div`,{className:`min-w-0 ${n}`.trim(),children:i}):null]})}function yr({open:e,title:t,onClose:n,children:r}){let i=ir();return V(U,{children:e?V(H.div,{className:`tcp-drawer-root`,initial:i?!1:{opacity:0},animate:i?void 0:{opacity:1},exit:i?void 0:{opacity:0},children:[V(`button`,{type:`button`,className:`tcp-drawer-backdrop`,"aria-label":`Close`,onClick:n}),V(H.aside,{className:`tcp-drawer-panel`,initial:i?!1:{x:`100%`},animate:i?void 0:{x:0},exit:i?void 0:{x:`100%`},transition:i?void 0:J.spring.drawer,children:[V(`div`,{className:`tcp-drawer-head`,children:[V(`div`,{className:`min-w-0`,children:t?V(`h3`,{className:`tcp-title`,children:t}):null}),V(fr,{title:`Close drawer`,onClick:n,children:V(`i`,{"data-lucide":`x`})})]}),V(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:r})]})]}):null})}function br({loginMutation:e,savedToken:t,onCheckEngine:n,controlPanelName:r,controlPanelMode:i,controlPanelModeReason:a}){let[o,s]=l(t),[c,u]=l(!0),[d,f]=l(``),[p,m]=l(!1);return V(`main`,{className:`relative min-h-screen overflow-hidden px-5 py-8`,children:[V(or,{className:`tcp-shell-background`,children:[V(`div`,{className:`tcp-shell-glow tcp-shell-glow-a`}),V(`div`,{className:`tcp-shell-glow tcp-shell-glow-b`})]}),V(`div`,{className:`relative z-10 mx-auto grid min-h-[calc(100vh-4rem)] w-full max-w-6xl items-center gap-6 lg:grid-cols-[1.05fr_0.95fr]`,children:[V(`section`,{className:`grid gap-4`,children:[V(`div`,{className:`tcp-page-eyebrow`,children:`Tandem Control`}),V(`h1`,{className:`tcp-page-title max-w-3xl`,children:`Sign in to continue.`}),V(`p`,{className:`tcp-subtle max-w-2xl text-base`,children:`Enter your engine token to access chat, task board, automations, runs, memory, and settings.`})]}),V(mr,{title:r,subtitle:i===`aca`?`ACA install detected. Authenticate against your Tandem engine to continue.`:`Standalone install detected. Authenticate against your Tandem engine to continue.`,children:V(`form`,{className:`grid gap-3`,onSubmit:t=>{if(t.preventDefault(),!o.trim()){m(!1),f(`Token is required.`);return}e.mutate({token:o.trim(),remember:c})},children:[V(`label`,{className:`text-sm tcp-subtle`,children:`Engine token`}),V(`input`,{className:`tcp-input`,type:`password`,value:o,onInput:e=>s(e.target.value),placeholder:`tk_...`,autoComplete:`off`}),V(`label`,{className:`inline-flex items-center gap-2 text-xs tcp-subtle`,children:[V(`input`,{type:`checkbox`,className:`h-4 w-4 accent-slate-400`,checked:c,onChange:e=>u(e.target.checked)}),`Remember token on this browser`]}),V(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[V(`button`,{disabled:e.isPending,type:`submit`,className:`tcp-btn-primary w-full`,children:[V(`i`,{"data-lucide":`key-round`}),`Sign in`]}),V(`button`,{type:`button`,className:`tcp-btn w-full`,onClick:async()=>{try{let e=await n();m(!0),f(e)}catch(e){m(!1),f(e instanceof Error?e.message:String(e))}},children:[V(`i`,{"data-lucide":`activity`}),`Check engine`]})]}),V(`div`,{className:`min-h-[1.2rem] text-sm ${p?`text-lime-300`:`text-rose-300`}`,children:e.error?.message||d}),V(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[V(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[V(`div`,{className:`font-medium`,children:`Readiness`}),V(Y,{tone:p?`ok`:`warn`,text:p?`Engine reachable`:`Waiting`})]}),V(`p`,{className:`tcp-subtle text-xs`,children:`Connectivity checks are non-destructive and help verify the local panel can reach the engine before authentication.`}),a?V(`p`,{className:`tcp-subtle mt-2 text-xs`,children:a}):null]})]})})]})]})}function xr(t){e(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t])}function Sr({open:t,onClose:n,actions:r}){let[i,o]=l(``);e(()=>{t||o(``)},[t]),e(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,n]);let s=a(()=>{let e=i.trim().toLowerCase();return e?r.filter(t=>`${t.label} ${t.group}`.toLowerCase().includes(e)):r},[r,i]);return V(U,{children:t?V(H.div,{className:`tcp-confirm-overlay`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,children:V(H.div,{className:`tcp-doc-dialog w-[min(44rem,96vw)]`,initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.98},transition:{duration:.16,ease:`easeOut`},onClick:e=>e.stopPropagation(),children:[V(`div`,{className:`tcp-doc-header`,children:[V(`h3`,{className:`tcp-doc-title`,children:`Command Palette`}),V(`kbd`,{className:`tcp-subtle text-xs`,children:`Ctrl/Cmd + K`})]}),V(`div`,{className:`p-3`,children:[V(`input`,{autoFocus:!0,value:i,onInput:e=>o(e.target.value),placeholder:`Jump to route or action`,className:`tcp-input`}),V(`div`,{className:`mt-3 grid max-h-[50vh] gap-2 overflow-auto`,children:[s.map(e=>V(`button`,{type:`button`,className:`tcp-btn w-full justify-between`,onClick:()=>{e.onSelect(),n()},children:[V(`span`,{className:`inline-flex items-center gap-1.5`,children:[V(`i`,{"data-lucide":`list`}),V(`span`,{children:e.label})]}),V(`span`,{className:`tcp-subtle text-xs`,children:e.group})]},e.id)),s.length?null:V(`p`,{className:`tcp-subtle px-1 py-2`,children:`No matching action.`})]})]})]})}):null})}var Cr=[[`dashboard`,`Dashboard`,`home`],[`chat`,`Chat`,`message-square`],[`planner`,`Planner`,`compass`],[`workflows`,`Workflows`,`network`],[`marketplace`,`Marketplace`,`globe`],[`studio`,`Studio`,`blocks`],[`automations`,`Automations`,`bot`],[`experiments`,`Experiments`,`flask-conical`],[`coding`,`Coder`,`code`],[`agents`,`Agents`,`users`],[`orchestrator`,`Task Board`,`workflow`],[`files`,`Files`,`folder`],[`memory`,`Memory`,`database`],[`runs`,`Runs`,`activity`],[`approvals`,`Approvals`,`shield-check`],[`settings`,`Settings`,`settings`],[`packs`,`Packs`,`package`],[`teams`,`Teams`,`users`],[`channels`,`Channels`,`message-circle`],[`mcp`,`MCP`,`link`],[`bug-monitor`,`Bug Monitor`,`bug-play`],[`packs-detail`,`Packs`,`package`],[`teams-detail`,`Teams`,`users`]],wr=[`dashboard`,`chat`,`planner`,`workflows`,`marketplace`,`studio`,`automations`,`experiments`,`coding`,`agents`,`orchestrator`,`bug-monitor`,`files`,`memory`,`runs`,`approvals`,`settings`].map(e=>{let t=Cr.find(([t])=>t===e);if(!t)throw Error(`Missing navigation route: ${e}`);return t}),Tr={openai:{label:`OpenAI`,keyUrl:`https://platform.openai.com/api-keys`,placeholder:`sk-proj-...`},"openai-codex":{label:`Codex Account`,keyUrl:``,placeholder:`Browser sign-in required`,authMode:`oauth`,description:`Use your ChatGPT/Codex subscription on this machine without pasting a separate API key.`},anthropic:{label:`Anthropic`,keyUrl:`https://console.anthropic.com/settings/keys`,placeholder:`sk-ant-...`},google:{label:`Google`,keyUrl:`https://aistudio.google.com/app/apikey`,placeholder:`AIza...`},groq:{label:`Groq`,keyUrl:`https://console.groq.com/keys`,placeholder:`gsk_...`},mistral:{label:`Mistral`,keyUrl:`https://console.mistral.ai/api-keys/`,placeholder:`...`},together:{label:`Together`,keyUrl:`https://api.together.xyz/settings/api-keys`,placeholder:`...`},cohere:{label:`Cohere`,keyUrl:`https://dashboard.cohere.com/api-keys`,placeholder:`...`},openrouter:{label:`OpenRouter`,keyUrl:`https://openrouter.ai/settings/keys`,placeholder:`sk-or-v1-...`},azure:{label:`Azure OpenAI`,keyUrl:`https://portal.azure.com/`,placeholder:`...`},bedrock:{label:`Bedrock`,keyUrl:`https://console.aws.amazon.com/bedrock/`,placeholder:`...`},vertex:{label:`Vertex`,keyUrl:`https://console.cloud.google.com/vertex-ai`,placeholder:`...`},copilot:{label:`GitHub Copilot`,keyUrl:`https://github.com/settings/tokens`,placeholder:`ghp_...`},llama_cpp:{label:`llama.cpp`,keyUrl:``,placeholder:`No key required`},ollama:{label:`Ollama`,keyUrl:``,placeholder:`No key required`}},Er=Cr,Dr=wr,Or=new Map([[`packs`,`automations`],[`teams`,`automations`],[`feed`,`runs`],[`swarm`,`orchestrator`],[`failure-reporter`,`bug-monitor`]]),kr=new Set(Er.map(([e])=>e));function Ar(e,t=`dashboard`){return Or.get(String(e||``).trim())||(kr.has(e)?e:t)}function jr(e=`dashboard`){return Ar((window.location.hash||`#/${e}`).replace(/^#\//,``).split(`?`)[0].split(`/`)[0].trim(),e)}function Mr(e){window.location.hash=`#/${e}`}function Nr(t={}){let[n,r]=l(()=>jr()),i=o(n),a=o(t.canNavigate);e(()=>{i.current=n},[n]),e(()=>{a.current=t.canNavigate},[t.canNavigate]),e(()=>{let e=jr(i.current);window.location.hash!==`#/${e}`&&Mr(e)},[]);let s=d((e,t)=>{let n=i.current;return e===n?window.location.hash===`#/${n}`?(r(n),!0):(Mr(n),!0):!a.current||a.current(e,n)?window.location.hash===`#/${e}`?(r(e),!0):(Mr(e),!0):(t===`hashchange`&&window.location.hash!==`#/${n}`&&window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#/${n}`),!1)},[]);return e(()=>{let e=()=>{s(jr(),`hashchange`)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[s]),{route:n,navigate:d(e=>{s(Ar(e),`navigate`)},[s])}}var Pr=u({toast:()=>void 0});function Fr({children:e}){let[t,n]=l([]),r=d((e,t)=>{let r=Math.random().toString(36).slice(2);n(n=>[...n,{id:r,kind:e,text:t}].slice(-4)),window.setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},3500)},[]),i=a(()=>({toast:r}),[r]);return V(Pr.Provider,{value:i,children:[e,V(`div`,{className:`toasts`,"aria-live":`polite`,"aria-atomic":`true`,children:V(U,{children:t.map(e=>V(H.div,{initial:{opacity:0,y:-8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-6,scale:.98},transition:{duration:.16,ease:`easeOut`},className:`toast toast-${e.kind}`,children:e.text},e.id))})})]})}function Ir(){return r(Pr)}var Lr=class extends Error{status;code;retryable;transient;constructor(e,t={}){super(e),this.name=`ApiError`,this.status=t.status??0,this.code=t.code??`API_ERROR`,this.retryable=t.retryable??!1,this.transient=t.transient??!1}};function Rr(e){let t=e.trim().slice(0,300).toLowerCase();return t.startsWith(`<!doctype html`)||t.startsWith(`<html`)||t.includes(`<body`)||t.includes(`<head`)||t.includes(`<title>`)}function zr(e,t,n){if([502,503,504,524].includes(e))return!0;let r=t.toLowerCase();return n.includes(`text/html`)||Rr(t)||r.includes(`bad gateway`)||r.includes(`temporarily unavailable`)||r.includes(`service unavailable`)||r.includes(`cloudflare`)}function Br(e){return e===503?`Engine is restarting or temporarily unavailable. Reconnecting shortly.`:e===504||e===524?`Engine is taking too long to respond while restarting. Reconnecting shortly.`:`Engine is temporarily unavailable while restarting. Reconnecting shortly.`}function X(e){return e instanceof Lr&&e.transient&&e.code===`ENGINE_UNAVAILABLE`}async function Z(e,t={}){let n;try{n=await fetch(e,{...t,credentials:`include`,headers:{"content-type":`application/json`,...t.headers||{}}})}catch{throw new Lr(`Engine is unavailable. Reconnecting shortly.`,{code:`ENGINE_UNAVAILABLE`,retryable:!0,transient:!0})}if(!n.ok){let t=await n.text().catch(()=>``),r=String(n.headers.get(`content-type`)||``).toLowerCase();if(zr(n.status,t,r))throw new Lr(Br(n.status),{status:n.status,code:`ENGINE_UNAVAILABLE`,retryable:!0,transient:!0});let i=t||`${e} failed (${n.status})`;try{let e=t?JSON.parse(t):null;e?.error&&(i=e.error)}catch{Rr(t)&&(i=`${e} failed (${n.status})`)}throw new Lr(i,{status:n.status,code:`API_ERROR`,retryable:!1,transient:!1})}let r=await n.text();if(!r)return{};try{return JSON.parse(r)}catch{throw new Lr(`Engine returned an unexpected response. Reconnecting shortly.`,{status:n.status,code:`ENGINE_INVALID_RESPONSE`,retryable:!0,transient:!0})}}Kt.setOptions({gfm:!0,breaks:!0});function Vr(e){let t=String(e||``),n=Kt.parse(t,{async:!1});return Gt.sanitize(n)}function Hr({title:e,subtitle:t,children:n,actions:r,className:i,fullHeight:a}){return V(mr,{title:e,subtitle:t,actions:r,className:i||``,fullHeight:a,children:n})}function Ur({text:e,title:t,action:n}){return V(hr,{text:e,title:t,action:n})}function Wr(e){return JSON.stringify(e,null,2)}function Gr(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;let n=Math.round(t/60);if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function Kr(e){let t=e.surface_payload?.decide_endpoint;return typeof t==`string`&&t.startsWith(`/`)?t.startsWith(`/api/engine`)?t:`/api/engine${t}`:e.source===`automation_v2`&&e.run_id?`/api/engine/automations/v2/runs/${e.run_id}/gate`:null}async function qr(e,t,n){let r=Kr(e);if(!r)throw Error(`No decide endpoint known for source=${e.source}`);try{return await Z(r,{method:`POST`,body:JSON.stringify({decision:t,reason:n||void 0})}),{ok:!0}}catch(e){if(e?.status===409)return{ok:!1,alreadyDecidedBy:`another operator`,conflictBody:e?.message};throw e}}function Jr(e){switch(e){case`approve`:return`tcp-btn h-8 px-3 text-xs bg-emerald-600 text-white hover:bg-emerald-500`;case`cancel`:return`tcp-btn h-8 px-3 text-xs bg-rose-600 text-white hover:bg-rose-500`;case`rework`:return`tcp-btn h-8 px-3 text-xs`}}function Yr(e){switch(e){case`approve`:return`Approve`;case`rework`:return`Rework`;case`cancel`:return`Cancel run`}}function Xr({toast:e}){let t=m(),[n,r]=l({}),[i,a]=l(null),o=h({queryKey:[`approvals`,`pending`],queryFn:async()=>await Z(`/api/engine/approvals/pending`)||{},refetchInterval:5e3,staleTime:0}),s=te({mutationFn:async e=>qr(e.request,e.decision,e.reason),onSuccess:async(n,r)=>{n.ok?e(`ok`,`${Yr(r.decision)}d gate ${r.request.workflow_name||r.request.run_id}`):e(`warn`,`Already decided by ${n.alreadyDecidedBy||`another operator`}.`),await t.invalidateQueries({queryKey:[`approvals`,`pending`]}),a(null)},onError:t=>{e(`err`,t?.message||String(t))}}),c=o.data?.approvals??[],u=c.length,d=o.isLoading||o.isFetching&&u===0;return V(sr,{className:`grid h-full min-h-0 gap-4`,children:V(Hr,{title:`Approvals Inbox`,subtitle:`Pending approvals across every workflow that has paused on a human gate. Decisions go through the authoritative subsystem handler.`,actions:V(`div`,{className:`flex items-center gap-3 text-xs`,children:[V(Y,{tone:o.isFetching?`live`:u>0?`warn`:`info`,text:o.isFetching?`checking approvals`:`approvals`}),V(pr,{tone:u>0?`warn`:`ok`,children:[u,` pending`]}),V(`button`,{className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>o.refetch(),disabled:o.isFetching,children:[o.isFetching?V(rr,{mode:`compact`,className:`h-4 w-4`,title:`Refreshing approvals`}):null,o.isFetching?`Refreshing`:`Refresh`]})]}),fullHeight:!0,children:d?V(gr,{title:`Checking for pending approvals…`,text:`Polling /api/engine/approvals/pending`}):c.length===0?V(Ur,{title:`No approvals waiting`,text:`Workflows with auto-injected approval gates pause here when they reach an external action.`}):V(`div`,{className:`grid gap-4`,children:c.map(e=>V(mr,{title:e.workflow_name||e.run_id,subtitle:e.action_kind?`${Zr(e.source)} · ${e.action_kind}`:Zr(e.source),actions:V(`span`,{className:`text-xs text-tcp-text-tertiary`,children:Gr(e.requested_at_ms)}),children:V(`div`,{className:`grid gap-3 text-sm`,children:[e.instructions?V(`div`,{className:`text-tcp-text-secondary`,children:e.instructions}):null,e.action_preview_markdown?V(`div`,{className:`prose prose-invert max-w-none text-sm`,dangerouslySetInnerHTML:{__html:Vr(e.action_preview_markdown)}}):null,V(`div`,{className:`flex flex-wrap gap-2 text-xs text-tcp-text-tertiary`,children:[V(`span`,{children:[V(`strong`,{children:`run:`}),` `,V(`code`,{children:e.run_id})]}),e.node_id?V(`span`,{children:[V(`strong`,{children:`node:`}),` `,V(`code`,{children:e.node_id})]}):null,V(`span`,{children:[V(`strong`,{children:`tenant:`}),` `,V(`code`,{children:[e.tenant.org_id,`/`,e.tenant.workspace_id]})]})]}),i===e.request_id?V(`div`,{className:`grid gap-2 rounded-md border border-tcp-border-subtle p-3`,children:[V(`label`,{className:`text-xs font-medium`,children:`Rework feedback (sent to the agent so it can revise)`}),V(`textarea`,{className:`tcp-input h-20 w-full rounded text-xs`,placeholder:`What should change before this can be approved?`,value:n[e.request_id]||``,onChange:t=>r(n=>({...n,[e.request_id]:t.target.value}))}),V(`div`,{className:`flex justify-end gap-2`,children:[V(`button`,{className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>a(null),disabled:s.isPending,children:`Dismiss`}),V(`button`,{className:Jr(`rework`),onClick:()=>s.mutate({request:e,decision:`rework`,reason:n[e.request_id]||``}),disabled:s.isPending,children:`Send back for rework`})]})]}):V(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(e.decisions||[`approve`,`rework`,`cancel`]).map(t=>{let n=String(t).toLowerCase();return[`approve`,`rework`,`cancel`].includes(n)?n===`rework`?V(`button`,{className:Jr(n),onClick:()=>a(e.request_id),disabled:s.isPending,children:Yr(n)},n):V(`button`,{className:Jr(n),onClick:()=>s.mutate({request:e,decision:n}),disabled:s.isPending,children:Yr(n)},n):null})})]})},e.request_id))})})})}function Zr(e){switch(e){case`automation_v2`:return`automation v2`;case`coder`:return`coder`;case`workflow`:return`workflow`;default:return e}}var Qr=`modulepreload`,$r=function(e){return`/`+e},ei={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=$r(t,n),t in ei)return;ei[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Qr,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$=(e,t)=>c(()=>e().then(e=>({default:e[t]}))),ti=$(()=>Q(()=>import(`./DashboardPage-CrA1itFc.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`DashboardPage`),ni=$(()=>Q(()=>import(`./ChatPage-Bc-BfOG1.js`),__vite__mapDeps([7,1,2,3,4,8,9,10,11,12])),`ChatPage`),ri=$(()=>Q(()=>import(`./IntentPlannerPage-Dti1h8Tm.js`),__vite__mapDeps([13,1,2,3,4,8,14,15,16])),`IntentPlannerPage`),ii=$(()=>Q(()=>import(`./WorkflowsPage-vmaKHFox.js`),__vite__mapDeps([17,1,2,3,4,5])),`WorkflowsPage`),ai=$(()=>Q(()=>import(`./MarketplacePage-90fAVNGg.js`),__vite__mapDeps([18,1,2,4])),`MarketplacePage`),oi=$(()=>Q(()=>import(`./WorkflowStudioPage-yFhlA4KV.js`),__vite__mapDeps([19,20,2,3,1,4,21,22,16])),`WorkflowStudioPage`),si=$(()=>Q(()=>import(`./AutomationsPage-BGqpmilp.js`),__vite__mapDeps([23,20,2,3,1,4,8,21,14,5,24,9,11,25,22,16,26,12,6])),`AutomationsPage`),ci=$(()=>Q(()=>import(`./ExperimentsPage-Bkg1_6rw.js`),__vite__mapDeps([27,20,2,3,1,4,16])),`ExperimentsPage`),li=$(()=>Q(()=>import(`./CodingWorkflowsPage-xgfwLRlt.js`),__vite__mapDeps([28,1,2,3,4,8,29,14,5,15,16,12])),`CodingWorkflowsPage`),ui=$(()=>Q(()=>import(`./ChannelsPage-B-InJ4Yh.js`),__vite__mapDeps([30,3,1,2,4])),`ChannelsPage`),di=$(()=>Q(()=>import(`./PacksPage-dRmjjdKD.js`),__vite__mapDeps([31,1,2,3,4,5,26,12])),`PacksPage`),fi=$(()=>Q(()=>import(`./OrchestratorPage-CYU-ESPI.js`),__vite__mapDeps([32,1,2,3,4,5,10,25,26,12])),`OrchestratorPage`),pi=$(()=>Q(()=>import(`./FilesPage-DChyHlO_.js`),__vite__mapDeps([33,1,2,3,4,29,34,11])),`FilesPage`),mi=$(()=>Q(()=>import(`./MemoryPage-DRRLgoc0.js`),__vite__mapDeps([35,1,2,3,4,34])),`MemoryPage`),hi=$(()=>Q(()=>import(`./RunsPage-DEy8vbRT.js`),__vite__mapDeps([36,23,20,2,3,1,4,8,21,14,5,24,9,11,25,22,16,26,12,6])),`RunsPage`),gi=$(()=>Q(()=>import(`./BugMonitorPage-BVzdj9y-.js`),__vite__mapDeps([37,1,2,3,4,29])),`BugMonitorPage`),_i=$(()=>Q(()=>import(`./TeamsPage-Dn81V0EB.js`),__vite__mapDeps([38,1,2,3,4,14,24,16])),`TeamsPage`),vi=$(()=>Q(()=>import(`./SettingsPage-CwH_FzOs.js`),__vite__mapDeps([39,1,2,3,4,21,14,16])),`SettingsPage`);function yi(){return V(`div`,{className:`flex min-h-[40vh] items-center justify-center`,children:V(`div`,{className:`tcp-subtle text-sm`,children:`Loading…`})})}var bi=class extends n{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){if(!this.state.error)return this.props.children;let e=String(this.state.error?.message||this.state.error||``),t=e.includes(`dynamically imported module`)||e.includes(`Loading chunk`)||e.includes(`Importing a module script failed`);return V(`div`,{className:`grid min-h-[40vh] place-items-center p-6`,children:V(`div`,{className:`max-w-lg rounded-xl border border-amber-500/30 bg-amber-500/10 p-4`,children:[V(`div`,{className:`mb-2 font-semibold text-amber-100`,children:t?`Panel update detected`:`Page failed to load`}),V(`p`,{className:`tcp-subtle text-sm`,children:t?`This page chunk was rebuilt while your browser still had the old file name cached. Reload the control panel to fetch the current assets.`:e||`The route could not be loaded.`}),V(`button`,{className:`tcp-btn mt-3`,onClick:()=>window.location.reload(),children:`Reload control panel`})]})})}};function xi(e,t){switch(e){case`chat`:return V(ni,{...t});case`planner`:return V(ri,{...t});case`workflows`:return V(ii,{...t});case`marketplace`:return V(ai,{...t});case`studio`:return V(oi,{...t});case`automations`:case`packs`:case`teams`:return V(si,{...t});case`experiments`:return V(ci,{...t});case`coding`:return V(li,{...t});case`agents`:return V(_i,{...t});case`channels`:return V(ui,{...t});case`mcp`:return V(vi,{...t});case`packs-detail`:return V(di,{...t});case`orchestrator`:return V(fi,{...t});case`bug-monitor`:return V(gi,{...t});case`files`:return V(pi,{...t});case`memory`:return V(mi,{...t});case`teams-detail`:return V(_i,{...t});case`runs`:return V(hi,{...t});case`approvals`:return V(Xr,{...t});case`settings`:return V(vi,{...t});default:return V(ti,{...t})}}function Si({routeId:e,pageProps:t}){let n=Ar(e);return V(bi,{children:V(s,{fallback:V(yi,{}),children:xi(n,t)})},n)}var Ci={Activity:Be,Archive:at,ArrowDown:Dt,ArrowLeftToLine:_t,ArrowRight:jt,ArrowUpCircle:x,BadgeCheck:Ye,Binary:_,Blocks:ye,Bot:Me,BookOpen:Ie,Bug:A,BugPlay:Pe,Calendar:Tt,Check:j,ChevronDown:ae,ChevronLeft:Ae,ChevronRight:P,ChevronUp:O,ChevronsUpDown:Oe,ClipboardList:xe,Clock:k,Clock3:de,Code:re,Compass:_e,CornerUpLeft:ct,Copy:M,CopyPlus:pe,Cpu:y,Database:he,DatabaseZap:ut,Download:T,Eraser:D,ExternalLink:Te,FilePlus:C,FileText:Bt,FileInput:Rt,Files:Ht,FileSearch:Ce,FileUp:Ue,Filter:Pt,FilterX:Je,FlaskConical:It,Folder:Ct,FolderCode:Re,FolderOpen:et,FolderPlus:rt,FolderUp:ht,Fullscreen:Qe,Globe:ft,HardDrive:Ge,History:At,Home:bt,Info:Ve,KeyRound:ot,Layers:Ot,Link:vt,List:g,ListChecks:Mt,ListX:Xe,LoaderCircle:ve,LogOut:Fe,Menu:je,MessageCircle:Ne,MessageSquare:ce,MessagesSquare:wt,MonitorCog:le,Network:ie,Package:Ee,PackagePlus:ke,PaintBucket:oe,PanelLeft:De,Paperclip:b,Pause:Ut,Pencil:be,Play:ue,PlugZap:se,Plus:ne,Radio:N,Radar:ge,RefreshCw:fe,Rocket:st,RotateCcw:v,RotateCw:lt,Save:me,Search:w,Send:E,Settings:Lt,Settings2:we,Share2:S,Shield:He,ShieldAlert:Se,ShieldCheck:zt,Siren:Vt,SkipForward:Ft,SlidersHorizontal:Le,Sparkles:$e,Square:xt,SquareCheckBig:tt,SquarePen:pt,Star:Ze,Trash2:Ke,TriangleAlert:Nt,Unlink:dt,Upload:We,UserPlus:kt,Users:yt,Wrench:it,Workflow:ze,X:Et,XCircle:Wt},wi=new Set,Ti=0;function Ei(){Ti=0;let e=[...wi];wi.clear();for(let t of e)gt({icons:Ci,attrs:{width:`16`,height:`16`,"stroke-width":`1.8`},...t?{root:t}:{}})}function Di(e){wi.add(e||null),!Ti&&(Ti=window.requestAnimationFrame(Ei))}var Oi={dashboard:{title:`Overview`,subtitle:`Command status, activity, and fast paths into the system.`},chat:{title:`Chat`,subtitle:`Session-driven conversation, tools, uploads, and live responses.`},planner:{title:`Planner`,subtitle:`Advanced long-horizon intent, multi-agent planning, and governed handoff.`},studio:{title:`Studio`,subtitle:`Advanced template-first workflow builder with reusable role prompts and visual stages.`},automations:{title:`Automations`,subtitle:`Create, Calendar, Library, and Run History.`},experiments:{title:`Experiments`,subtitle:`Hidden by default. Turn this on in Settings when you need experimental surfaces.`},coding:{title:`Coder`,subtitle:`Durable coder runs, project intake, and repository work.`},agents:{title:`Agents`,subtitle:`Search reusable roles, inspect routines, and manage workflow-ready agent drafts.`},orchestrator:{title:`Task Board`,subtitle:`Plan-driven task execution with workspace visibility and approvals.`},memory:{title:`Memory`,subtitle:`Searchable memory records and operational context snapshots.`},runs:{title:`Runs`,subtitle:`Live operations overview with queue state and per-run inspection.`},approvals:{title:`Approvals Inbox`,subtitle:`Pending human approvals across every workflow that has paused on a gate.`},settings:{title:`Settings`,subtitle:`Provider defaults, identity, themes, and runtime diagnostics.`},channels:{title:`Channels`,subtitle:`Chat integrations, tool scope, and channel configuration.`},"bug-monitor":{title:`Bug Monitor`,subtitle:`Issue detection, draft review, and GitHub publishing controls.`},packs:{title:`Packs`,subtitle:`Starter packs and pack installation paths.`},teams:{title:`Teams`,subtitle:`Team instances, approvals, and shared execution state.`},mcp:{title:`MCP`,subtitle:`Catalog, readiness, and generated integration details.`},files:{title:`Files`,subtitle:`Managed uploads, artifacts, and exports.`},"packs-detail":{title:`Packs`,subtitle:`Starter packs, installation paths, and detected attachments.`},"teams-detail":{title:`Teams`,subtitle:`Team instances, approvals, and shared execution state.`}},ki=new Set([`chat`,`automations`,`approvals`,`files`,`runs`]);function Ai({identity:n,currentRoute:r,providerLocked:i,navRoutes:o,onNavigate:s,onPaletteOpen:c,onThemeCycle:u,onLogout:d,statusBar:f,routeKey:p,navigationLock:m,children:ee,providerGate:h}){let[te,g]=l(!1),_=String(n.botAvatarUrl||``).trim(),[v,y]=l(_?`custom`:`default`),b=Xn(),x=!!m;e(()=>{g(!1)},[r]),e(()=>{try{Di()}catch{}},[o,r,te,f.bugMonitor?.enabled,f.bugMonitor?.monitoringActive,f.bugMonitor?.paused,f.bugMonitor?.pendingIncidents,f.bugMonitor?.blocked,f.approvals?.pendingCount,f.approvals?.checking]),e(()=>{y(_?`custom`:`default`)},[_]);let S=Oi[r]||{title:String(o.find(([e])=>e===r)?.[1]||`Control Panel`),subtitle:`Desktop-inspired operations UI for Tandem.`},C=a(()=>o.find(([e])=>e===r)||null,[r,o]),w=a(()=>{let e=f.bugMonitor;return e?.enabled?e.blocked?{toneClass:`blocked`,label:`Bug Monitor blocked`,shortLabel:`Blocked`}:e.paused?{toneClass:`paused`,label:`Bug Monitor paused`,shortLabel:`Paused`}:e.pendingIncidents>0?{toneClass:`incidents`,label:`Bug Monitor incidents: ${e.pendingIncidents}`,shortLabel:`${e.pendingIncidents} incident${e.pendingIncidents===1?``:`s`}`}:e.monitoringActive?{toneClass:`watching`,label:`Bug Monitor watching`,shortLabel:`Watching`}:{toneClass:`ready`,label:`Bug Monitor ready`,shortLabel:`Ready`}:null},[f.bugMonitor]),T=Math.max(0,Number(f.approvals?.pendingCount||0)),E=`${T} approval${T===1?``:`s`} pending`,D=()=>v===`fallback`?V(`span`,{className:`text-sm font-semibold uppercase`,children:String(n.botName||`T`).trim().slice(0,1)||`T`}):V(`img`,{src:v===`custom`?_:`/icon.png`,alt:n.botName||`Tandem`,className:`block h-full w-full object-contain p-0.5`,onError:()=>y(e=>e===`custom`?`default`:`fallback`)}),ne=()=>o.map(([e,t,n])=>{let a=r===e,o=i&&e!==`settings`||x;return V(`button`,{type:`button`,title:t,disabled:o,className:`tcp-rail-icon ${a?`active`:``} ${o?`locked`:``}`,onClick:()=>s(e),children:[a?V(H.span,{layoutId:`tcp-icon-indicator`,className:`tcp-rail-icon-indicator`}):null,V(`i`,{"data-lucide":n})]},e)}),re=(e=!1)=>o.map(([t,n,a])=>{let o=r===t,c=i&&t!==`settings`||x;return V(`button`,{type:`button`,disabled:c,className:`tcp-context-link ${o?`active`:``} ${c?`locked`:``}`,onClick:()=>{s(t),e&&g(!1)},children:[V(`span`,{className:`inline-flex items-center gap-2`,children:[V(`i`,{"data-lucide":a}),V(`span`,{children:n})]}),o?V(`span`,{className:`tcp-context-link-dot`}):null]},t)}),ie=(e=!1)=>V(t,{children:[e?V(`div`,{className:`tcp-context-hero`,children:[V(or,{className:`tcp-context-hero-glow`}),V(`div`,{className:`relative z-10 flex items-center gap-3`,children:[V(`div`,{className:`tcp-brand-avatar h-11 w-11`,children:D()}),V(`div`,{className:`min-w-0`,children:[V(`div`,{className:`truncate text-sm font-semibold`,children:n.controlPanelName||`${n.botName} Control Panel`}),V(`div`,{className:`tcp-subtle text-xs`,children:`Workspace navigation and system status`})]})]})]}):null,V(`div`,{className:`tcp-context-section ${e?``:`xl:hidden`}`.trim(),children:[V(`div`,{className:`tcp-context-section-label`,children:`Navigation`}),V(`nav`,{className:`grid gap-1`,children:re(e)})]}),e?V(`div`,{className:`tcp-context-section`,children:[V(`div`,{className:`tcp-context-section-label`,children:`System`}),V(`div`,{className:`grid gap-2`,children:[V(`div`,{className:`tcp-context-stat`,children:[V(`span`,{className:`tcp-subtle text-xs`,children:`Engine`}),f.engineHealthy?V(Y,{tone:`ok`,text:`healthy`}):V(Y,{tone:`warn`,text:`checking`})]}),V(`div`,{className:`tcp-context-stat`,children:[V(`span`,{className:`tcp-subtle text-xs`,children:`Provider`}),V(`span`,{className:f.providerBadge,children:f.providerText})]}),V(`div`,{className:`tcp-context-stat`,children:[V(`span`,{className:`tcp-subtle text-xs`,children:`Active runs`}),f.activeRuns>0?V(Y,{tone:`live`,text:String(f.activeRuns)}):V(`span`,{className:`tcp-badge tcp-badge-ghost`,children:`idle`})]}),w?V(`div`,{className:`tcp-context-stat`,children:[V(`span`,{className:`tcp-subtle text-xs`,children:`Bug Monitor`}),V(`button`,{type:`button`,className:`tcp-bug-monitor-pill ${w.toneClass}`,disabled:x,title:f.bugMonitor?.lastError?`${w.label}: ${f.bugMonitor.lastError}`:w.label,onClick:()=>{s(`bug-monitor`),e&&g(!1)},children:[V(`i`,{"data-lucide":`bug-play`}),V(`span`,{className:`tcp-bug-monitor-dot`,"aria-hidden":`true`}),V(`span`,{children:w.shortLabel})]})]}):null,T>0?V(`div`,{className:`tcp-context-stat`,children:[V(`span`,{className:`tcp-subtle text-xs`,children:`Approvals`}),V(`button`,{type:`button`,className:`tcp-approval-pill`,disabled:x,title:E,onClick:()=>{s(`approvals`),e&&g(!1)},children:[V(`i`,{"data-lucide":`shield-alert`}),V(`span`,{children:T})]})]}):null]})]}):null,V(`div`,{className:`tcp-context-section mt-auto`,children:[V(`div`,{className:`tcp-context-section-label`,children:`Actions`}),V(`div`,{className:`grid gap-2`,children:[V(`button`,{type:`button`,className:`tcp-btn w-full justify-start`,onClick:()=>{c(),e&&g(!1)},children:[V(`i`,{"data-lucide":`search`}),`Command palette`]}),V(`button`,{type:`button`,className:`tcp-btn w-full justify-start`,onClick:()=>{u(),e&&g(!1)},children:[V(`i`,{"data-lucide":`paint-bucket`}),`Cycle theme`]}),V(`button`,{type:`button`,className:`tcp-btn w-full justify-start`,onClick:()=>{d(),e&&g(!1)},children:[V(`i`,{"data-lucide":`log-out`}),`Logout`]})]})]})]});return V(`div`,{className:`tcp-shell ${r===`chat`?`tcp-shell-chat`:``}`.trim(),children:[V(or,{className:`tcp-shell-background`,children:[V(`div`,{className:`tcp-shell-glow tcp-shell-glow-a`}),V(`div`,{className:`tcp-shell-glow tcp-shell-glow-b`})]}),V(`aside`,{className:`tcp-icon-rail hidden xl:flex`,children:[V(`button`,{type:`button`,className:`tcp-rail-brand`,disabled:x,onClick:()=>s(`dashboard`),children:V(`div`,{className:`tcp-brand-avatar h-10 w-10`,children:D()})}),V(`nav`,{className:`tcp-rail-nav`,children:ne()}),V(`div`,{className:`tcp-rail-footer`,children:[V(fr,{title:`Command palette`,onClick:c,disabled:x,children:V(`i`,{"data-lucide":`search`})}),V(fr,{title:`Cycle theme`,onClick:u,disabled:x,children:V(`i`,{"data-lucide":`paint-bucket`})}),V(fr,{title:`Logout`,onClick:d,disabled:x,children:V(`i`,{"data-lucide":`log-out`})}),V(`div`,{className:`mt-2 flex justify-center`,children:f.engineHealthy?V(Y,{tone:`ok`}):V(Y,{tone:`warn`})})]})]}),V(`aside`,{className:`tcp-context-rail hidden lg:flex xl:hidden`,children:ie(!1)}),V(`main`,{className:`tcp-main-shell ${ki.has(r)?`tcp-main-shell-fill`:``}`.trim(),children:[V(`section`,{className:`tcp-mobile-topbar lg:hidden`,children:[V(`button`,{type:`button`,className:`tcp-btn h-10 px-3`,disabled:x,onClick:()=>g(!0),children:[V(`i`,{"data-lucide":`menu`}),`Menu`]}),V(`div`,{className:`min-w-0 flex-1`,children:[V(`div`,{className:`truncate text-sm font-semibold`,children:S.title}),V(`div`,{className:`tcp-subtle truncate text-xs`,children:C?.[1]||S.subtitle})]}),w?V(`button`,{type:`button`,className:`tcp-bug-monitor-pill ${w.toneClass}`,disabled:x,title:f.bugMonitor?.lastError?`${w.label}: ${f.bugMonitor.lastError}`:w.label,onClick:()=>s(`bug-monitor`),children:[V(`i`,{"data-lucide":`bug-play`}),V(`span`,{className:`tcp-bug-monitor-dot`,"aria-hidden":`true`})]}):null,T>0?V(`button`,{type:`button`,className:`tcp-approval-pill`,disabled:x,title:E,onClick:()=>s(`approvals`),children:[V(`i`,{"data-lucide":`shield-alert`}),V(`span`,{children:T})]}):null,f.activeRuns>0?V(Y,{tone:`live`,text:String(f.activeRuns)}):null]}),V(`section`,{className:`tcp-topbar`,children:[V(`div`,{className:`min-w-0`,children:[V(`div`,{className:`tcp-page-eyebrow`,children:`Tandem Control`}),V(`h1`,{className:`tcp-main-title`,children:S.title}),V(`p`,{className:`tcp-subtle mt-1 line-clamp-2`,children:S.subtitle})]}),V(`div`,{className:`tcp-topbar-status`,children:[w?V(`button`,{type:`button`,className:`tcp-bug-monitor-pill ${w.toneClass}`,disabled:x,title:f.bugMonitor?.lastError?`${w.label}: ${f.bugMonitor.lastError}`:w.label,onClick:()=>s(`bug-monitor`),children:[V(`i`,{"data-lucide":`bug-play`}),V(`span`,{className:`tcp-bug-monitor-dot`,"aria-hidden":`true`}),V(`span`,{children:w.shortLabel})]}):null,T>0?V(`button`,{type:`button`,className:`tcp-approval-pill`,disabled:x,title:E,onClick:()=>s(`approvals`),children:[V(`i`,{"data-lucide":`shield-alert`}),V(`span`,{children:T}),V(`span`,{className:`hidden sm:inline`,children:[`Approval`,T===1?``:`s`]})]}):null,V(`span`,{className:f.providerBadge,children:f.providerText}),f.engineHealthy?V(Y,{tone:`ok`,text:`Engine healthy`}):V(Y,{tone:`warn`,text:`Checking engine`}),f.activeRuns>0?V(Y,{tone:`live`,text:`${f.activeRuns} run`}):V(`span`,{className:`tcp-badge tcp-badge-ghost`,children:`No active runs`})]})]}),V(U,{initial:!1,mode:`popLayout`,children:V(H.section,{className:`tcp-main-content ${ki.has(r)?`tcp-main-content-fill`:``}`.trim(),initial:b?!1:{opacity:0,y:18},animate:b?void 0:{opacity:1,y:0},exit:b?void 0:{opacity:0,y:-14},transition:b?void 0:{duration:J.duration.normal,ease:J.easing.standard},children:ee},p)})]}),V(U,{children:te?V(H.div,{className:`tcp-mobile-drawer lg:hidden`,initial:b?!1:{opacity:0},animate:b?void 0:{opacity:1},exit:b?void 0:{opacity:0},children:[V(`button`,{type:`button`,className:`tcp-mobile-drawer-backdrop`,"aria-label":`Close navigation`,onClick:()=>g(!1)}),V(H.aside,{className:`tcp-mobile-drawer-panel`,initial:b?!1:{x:`-100%`},animate:b?void 0:{x:0},exit:b?void 0:{x:`-100%`},transition:b?void 0:J.spring.drawer,children:[V(`div`,{className:`mb-3 flex items-center justify-between`,children:[V(`div`,{children:[V(`div`,{className:`text-sm font-semibold`,children:n.botName}),V(`div`,{className:`tcp-subtle text-xs`,children:S.title})]}),V(fr,{title:`Close`,onClick:()=>g(!1),children:V(`i`,{"data-lucide":`x`})})]}),ie(!0)]})]}):null}),V(U,{children:h||null}),V(U,{children:m?V(H.div,{className:`tcp-confirm-overlay`,style:{zIndex:180},initial:b?!1:{opacity:0},animate:b?void 0:{opacity:1},exit:b?void 0:{opacity:0},children:[V(`div`,{className:`tcp-confirm-backdrop`,"aria-hidden":`true`}),V(H.div,{className:`tcp-confirm-dialog w-[min(36rem,calc(100vw-2rem))]`,role:`alertdialog`,"aria-live":`assertive`,initial:b?!1:{opacity:0,y:10,scale:.985},animate:b?void 0:{opacity:1,y:0,scale:1},exit:b?void 0:{opacity:0,y:6,scale:.985},transition:b?void 0:{duration:J.duration.normal,ease:J.easing.standard},children:V(`div`,{className:`flex items-center gap-3`,children:[V(rr,{className:`h-12 w-12 shrink-0`,mode:`compact`}),V(`div`,{className:`min-w-0`,children:[V(`h3`,{className:`tcp-confirm-title`,children:m.title}),V(`p`,{className:`tcp-confirm-message`,children:m.message})]})]})})]}):null})]})}function ji(e){let t=String(e||``).trim().toLowerCase();return!!t&&t!==`ollama`&&t!==`llama_cpp`&&t!==`llama.cpp`&&t!==`local`&&t!==`openai-codex`}function Mi(e){if(!e||typeof e!=`object`)return!1;let t=String(e.auth_kind||e.authKind||``).trim().toLowerCase(),n=String(e.status||``).trim().toLowerCase();return t!==`oauth`||n===`reauth_required`||n===`expired`||n===`error`?!1:e.connected===!0||n===`connected`||n===`configured`}function Ni(e,t){let n=String(t||``).trim().toLowerCase();if(!n||!e||typeof e!=`object`)return!1;let r=e=>!e||typeof e!=`object`?!1:!!(Mi(e)||e.has_key===!0||e.hasKey===!0||e.configured===!0&&!ji(n));return r(e[n])||r(e.providers?.[n])}function Pi(e,t){let n=String(t||``).trim().toLowerCase();if(!n||!e||typeof e!=`object`)return null;let r=e[n];if(r&&typeof r==`object`)return r;let i=e.providers?.[n];return i&&typeof i==`object`?i:null}function Fi(e,t,n){let r=String(e?.default||e?.selected_model?.provider_id||``).trim(),i=e?.providers?.[r]||{},a=String(i.default_model||i.defaultModel||e?.selected_model?.model_id||``).trim(),o=new Set,s=e=>{if(!e||typeof e!=`object`)return;let t=e.providers&&typeof e.providers==`object`?e.providers:e;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(!n||typeof n!=`object`)continue;let t=String(e||``).trim().toLowerCase();if(!t)continue;let r=String(n.status||n.statusText||``).trim().toLowerCase();(n.connected===!0||r===`connected`||r===`configured`)&&o.add(t)}};if(Array.isArray(t?.connected))for(let e of t.connected){let t=String(e||``).trim().toLowerCase();t&&o.add(t)}s(n);let c=Pi(n,r),l=Ni(n,r),u=!!r&&!!a&&(!ji(r)||l);return{ready:u,defaultProvider:r,defaultModel:a,connected:[...o],error:``,needsOnboarding:!u,defaultProviderAuthKind:String(c?.auth_kind||c?.authKind||``).trim().toLowerCase(),defaultProviderSource:String(c?.source||``).trim().toLowerCase(),defaultProviderManagedBy:String(c?.managed_by||c?.managedBy||``).trim().toLowerCase()}}var Ii=`tcp.nav.visibility.v1`,Li=new Set([`dashboard`,`chat`,`workflows`,`automations`,`coding`,`files`,`bug-monitor`,`settings`]);function Ri(e){let t=new Set([`planner`,`studio`,`coding`,`memory`,`files`,`marketplace`,`orchestrator`,`experiments`,`teams`]);return Object.fromEntries(Dr.map(([n])=>[n,e?Li.has(n):!t.has(n)]))}function zi(e,t){let n=Ri(t);if(!e||typeof e!=`object`)return n;let r=e,i={...n};for(let[e]of Dr)typeof r[e]==`boolean`&&(i[e]=r[e]);return i}function Bi(e){try{let t=localStorage.getItem(Ii);return t?zi(JSON.parse(t),e):Ri(e)}catch{return Ri(e)}}function Vi(e){try{localStorage.setItem(Ii,JSON.stringify(e))}catch{}}function Hi(e){return Dr.filter(([t])=>e[t]!==!1)}function Ui(e=!0){return h({queryKey:[`system`,`health`],queryFn:()=>Z(`/api/system/health`),enabled:e,refetchInterval:e?15e3:!1,retry:(e,t)=>X(t)?e<6:e<2,retryDelay:e=>Math.min(1e3*2**e,1e4)})}function Wi(e=!0){return h({queryKey:[`swarm`,`status`],queryFn:()=>Z(`/api/swarm/status`),enabled:e,refetchInterval:e?5e3:!1,retry:(e,t)=>X(t)?e<6:e<2,retryDelay:e=>Math.min(1e3*2**e,1e4)})}function Gi(e=!0){return h({queryKey:[`system`,`capabilities`],queryFn:()=>Z(`/api/capabilities`),enabled:e,refetchInterval:e?6e4:!1,staleTime:3e4})}var Ki=`tandem_control_panel_token`,qi=new Set([`packs`,`teams`,`channels`,`mcp`,`files`,`packs-detail`,`teams-detail`]);function Ji(){try{return localStorage.getItem(Ki)||``}catch{return``}}function Yi(e){try{localStorage.setItem(Ki,e)}catch{}}function Xi(){try{localStorage.removeItem(Ki)}catch{}}function Zi(e,t){return h({queryKey:[`provider`,`status`],enabled:t&&!!e,refetchInterval:t?15e3:!1,queryFn:async()=>{if(!e)return{ready:!1,defaultProvider:``,defaultModel:``,connected:[],error:``,needsOnboarding:!1,defaultProviderAuthKind:``,defaultProviderSource:``,defaultProviderManagedBy:``};try{let[t,n]=await Promise.all([e.providers.config(),e.providers.authStatus().catch(()=>({}))]);return Fi(t,null,n)}catch(e){return{ready:!1,defaultProvider:``,defaultModel:``,connected:[],error:e instanceof Error?e.message:String(e),needsOnboarding:!1,defaultProviderAuthKind:``,defaultProviderSource:``,defaultProviderManagedBy:``}}}})}function Qi(e,t){return h({queryKey:[`identity`],enabled:t&&!!e,refetchInterval:t?3e4:!1,queryFn:async()=>{if(!e)return{botName:`Tandem`,botAvatarUrl:``,controlPanelName:`Tandem Control Panel`};try{let e=(await Z(`/api/engine/config/identity`,{method:`GET`}))?.identity||{},t=String(e?.bot?.canonical_name||e?.bot?.canonicalName||``).trim(),n=e?.bot?.aliases||{},r=String(e?.bot?.avatar_url||e?.bot?.avatarUrl||``).trim(),i=String(n?.control_panel||n?.controlPanel||``).trim(),a=t||`Tandem`;return{botName:a,botAvatarUrl:r,controlPanelName:i||`${a} Control Panel`}}catch{return{botName:`Tandem`,botAvatarUrl:``,controlPanelName:`Tandem Control Panel`}}}})}function $i(e){return h({queryKey:[`bug-monitor`,`status`],enabled:e,refetchInterval:e?1e4:!1,queryFn:async()=>{try{return await Z(`/api/engine/bug-monitor/status`,{method:`GET`})}catch{return null}}})}function ea(e){return h({queryKey:[`approvals`,`pending`,`count`],enabled:e,refetchInterval:e?5e3:!1,queryFn:async()=>{try{let e=await Z(`/api/engine/approvals/pending`,{method:`GET`}),t=Array.isArray(e?.approvals)?e.approvals:[],n=Number(e?.count);return{count:Number.isFinite(n)?n:t.length}}catch{return{count:0}}}})}function ta({controlPanelName:e,controlPanelMode:t,controlPanelModeReason:n,errorMessage:r,onRetry:i,onCheckEngine:a}){let[o,s]=l(``),[c,u]=l(!1);return V(`main`,{className:`relative min-h-screen overflow-hidden px-5 py-8`,children:[V(or,{className:`tcp-shell-background`,children:[V(`div`,{className:`tcp-shell-glow tcp-shell-glow-a`}),V(`div`,{className:`tcp-shell-glow tcp-shell-glow-b`})]}),V(`div`,{className:`relative z-10 mx-auto grid min-h-[calc(100vh-4rem)] w-full max-w-6xl items-center gap-6 lg:grid-cols-[1.05fr_0.95fr]`,children:[V(`section`,{className:`grid gap-4`,children:[V(`div`,{className:`tcp-page-eyebrow`,children:`Tandem Control`}),V(`h1`,{className:`tcp-page-title max-w-3xl`,children:`Reconnecting your session.`}),V(`p`,{className:`tcp-subtle max-w-2xl text-base`,children:`The control panel still has your session, but the engine is temporarily unavailable. We'll reconnect automatically as soon as it responds again.`})]}),V(mr,{title:e,subtitle:t===`aca`?`ACA install detected. Waiting for the Tandem engine to restore the existing session.`:`Standalone install detected. Waiting for the Tandem engine to restore the existing session.`,children:V(`div`,{className:`grid gap-3`,children:[V(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[V(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[V(`div`,{className:`font-medium`,children:`Session recovery`}),V(Y,{tone:c?`ok`:`warn`,text:c?`Engine reachable`:`Reconnecting`})]}),V(`p`,{className:`tcp-subtle text-xs`,children:`Existing auth is intact. The panel is waiting for the engine before reloading the app shell.`}),n?V(`p`,{className:`tcp-subtle mt-2 text-xs`,children:n}):null]}),V(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[V(`button`,{type:`button`,className:`tcp-btn-primary w-full`,onClick:i,children:[V(`i`,{"data-lucide":`refresh-cw`}),`Retry now`]}),V(`button`,{type:`button`,className:`tcp-btn w-full`,onClick:async()=>{try{let e=await a();u(!0),s(e)}catch(e){u(!1),s(e instanceof Error?e.message:String(e))}},children:[V(`i`,{"data-lucide":`activity`}),`Check engine`]})]}),V(`div`,{className:`min-h-[1.2rem] text-sm ${c?`text-lime-300`:`text-amber-200`}`,children:o||r})]})})]})]})}function na(){let n=m(),{toast:r}=Ir(),[i,s]=l(Qn()),[c,u]=l(!1),[f,p]=l(null),[ee,g]=l(!1),_=o(!1),v=o(null);v.current===null&&(v.current=Ji().trim());let[y,b]=l(()=>!!v.current),{route:x,navigate:S}=Nr({canNavigate:d((e,t)=>!f||e===t,[f])});e(()=>{$n(i)},[i]);let C=h({queryKey:[`auth`,`me`],enabled:!y,retry:(e,t)=>X(t)&&e<4,retryDelay:e=>Math.min(1e3*2**e,5e3),refetchInterval:e=>X(e.state.error)?5e3:e.state.data?3e4:!1,refetchOnWindowFocus:!0,queryFn:()=>Z(`/api/auth/me`,{method:`GET`,cache:`no-store`})}),w=X(C.error),T=C.data?.ok===!0,E=a(()=>T?new vn({baseUrl:`/api/engine`,token:`session`}):null,[T]),D=Zi(E,T),ne=Qi(E,T),re=Ui(T),ie=Wi(T),ae=$i(T),oe=ea(T),O=Gi(),se=String(O.data?.control_panel_mode||(O.data?.aca_integration?`aca`:`standalone`)).trim()||`standalone`,k=se===`aca`,ce=o(!1),[A,le]=l(()=>Bi(!1));e(()=>{!T||!O.isFetched||ce.current||(ce.current=!0,le(Bi(k)))},[k,T,O.isFetched]),e(()=>{ce.current&&Vi(A)},[A]),e(()=>{try{Di()}catch{}},[T,A,x]),e(()=>{f&&x!==`automations`&&p(null)},[f,x]),e(()=>{f&&u(!1)},[f]),e(()=>{if(!f)return;let e=e=>(e.preventDefault(),e.returnValue=``,``);return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[f]);let j=te({mutationFn:async({token:e})=>{await Z(`/api/auth/login`,{method:`POST`,body:JSON.stringify({token:e})})},onSuccess:(e,t)=>{t.remember?Yi(t.token):Xi(),n.invalidateQueries({queryKey:[`auth`,`me`]}),r(`ok`,`Signed in.`),S(`dashboard`)},onError:e=>{let t=e instanceof Error?e.message:String(e);r(X(e)?`info`:`err`,t)}});e(()=>{if(y||T||w||j.isPending||_.current)return;let e=Ji().trim();if(!e){_.current=!0;return}_.current=!0,j.mutate({token:e,remember:!0})},[y,w,T,j]),e(()=>{if(!y||j.isPending)return;let e=v.current||``;if(_.current=!0,!e){b(!1);return}j.mutate({token:e,remember:!0},{onError:()=>{Xi(),v.current=``},onSettled:()=>{b(!1)}})},[y,j]);let ue=d(async()=>{await Z(`/api/auth/logout`,{method:`POST`}).catch(()=>{}),n.removeQueries({queryKey:[`auth`]}),n.removeQueries({queryKey:[`control-panel`]}),n.removeQueries({queryKey:[`provider`]}),n.removeQueries({queryKey:[`identity`]}),n.invalidateQueries({queryKey:[`auth`,`me`]}),r(`info`,`Logged out.`)},[n,r]),de=a(()=>new Set([`chat`,`planner`,`studio`,`agents`,`orchestrator`,`teams`,`experiments`]),[]),fe=!!D.data?.needsOnboarding,M=T&&fe;e(()=>{if(!M){g(!1);return}de.has(x)&&(S(`settings`),ee||(g(!0),r(`info`,`Set provider + default model in Providers first to unlock the control panel.`)))},[de,S,ee,M,x,r]);let N=M&&de.has(x)?`settings`:x,pe=d(async()=>{await n.invalidateQueries({queryKey:[`provider`,`status`]})},[n]),me=d(async()=>{await n.invalidateQueries({queryKey:[`identity`]})},[n]),he=d((e,t)=>{le(n=>{let r={...n,[e]:t};return r[e]===n[e]?n:r})},[]),ge=d(()=>{le(e=>{let t={...e};for(let[e]of Dr)t[e]=!0;return t})},[]),_e=d(()=>{le(Ri(k))},[k]),ve=a(()=>Hi(A),[A]),ye=a(()=>({acaMode:k,routeVisibility:A,setRouteVisibility:he,showAllSections:ge,resetNavigation:_e}),[k,A,_e,he,ge]),be=d(e=>{let t=er(e);return s(t.id),t},[s]),xe=ne.data||{botName:`Tandem`,botAvatarUrl:``,controlPanelName:`Tandem Control Panel`},Se={client:E,api:Z,toast:r,navigate:S,currentRoute:N,providerStatus:{ready:!!D.data?.ready,defaultProvider:D.data?.defaultProvider||``,defaultModel:D.data?.defaultModel||``,connected:D.data?.connected||[],error:D.data?.error||``,needsOnboarding:!!D.data?.needsOnboarding,defaultProviderAuthKind:D.data?.defaultProviderAuthKind||``,defaultProviderSource:D.data?.defaultProviderSource||``,defaultProviderManagedBy:D.data?.defaultProviderManagedBy||``},identity:xe,refreshProviderStatus:pe,refreshIdentityStatus:me,providerHints:Tr,themes:q,setTheme:be,themeId:i,navigation:ye,navigationLock:f,setNavigationLock:p},Ce=a(()=>{let e=Er.filter(([e])=>A[e]!==!1&&!qi.has(e)).map(([e,t])=>({id:`route:${e}`,label:`Go to ${t}`,group:`Routes`,onSelect:()=>S(e)})),t=[{id:`action:new-chat`,label:`New chat session`,group:`Actions`,onSelect:()=>{window.dispatchEvent(new CustomEvent(`tcp:new-chat`)),S(`chat`)}},{id:`action:start-engine-check`,label:`Check engine health`,group:`Actions`,onSelect:async()=>{try{let e=await Z(`/api/system/health`);r(`info`,`Engine ${e?.engine?.ready||e?.engine?.healthy?`healthy`:`unhealthy`}: ${e?.engineUrl||`n/a`}`)}catch(e){let t=e instanceof Error?e.message:String(e);r(X(e)?`info`:`err`,t)}}},{id:`action:open-settings`,label:`Open provider settings`,group:`Actions`,onSelect:()=>S(`settings`)},...A.orchestrator===!1?[]:[{id:`action:open-task-board`,label:`Open task board`,group:`Actions`,onSelect:()=>S(`orchestrator`)}]];return[...e,...t]},[A,S,r]);if(xr(()=>{f||u(e=>!e)}),!T)return w?V(ta,{controlPanelName:xe.controlPanelName,controlPanelMode:se,controlPanelModeReason:String(O.data?.control_panel_mode_reason||``).trim(),errorMessage:C.error?.message||`Engine is reconnecting.`,onRetry:()=>{C.refetch()},onCheckEngine:async()=>{let e=await Z(`/api/system/health`,{cache:`no-store`});return`Engine check: ${e?.engine?.ready||e?.engine?.healthy?`healthy`:`unhealthy`} at ${e?.engineUrl||`n/a`}`}}):V(br,{loginMutation:j,savedToken:Ji(),controlPanelName:xe.controlPanelName,controlPanelMode:se,controlPanelModeReason:String(O.data?.control_panel_mode_reason||``).trim(),onCheckEngine:async()=>{let e=await Z(`/api/system/health`);return`Engine check: ${e?.engine?.ready||e?.engine?.healthy?`healthy`:`unhealthy`} at ${e?.engineUrl||`n/a`}`}});let we=D.data?.ready?`tcp-badge-ok`:`tcp-badge-warn`,Te=D.data?.ready?`${D.data?.defaultProvider||`none`}/${D.data?.defaultModel||`none`}`:`provider setup required`,Ee=ae.data||null,P=Ee?.status||Ee||null,De=!!P?.config?.enabled,Oe=Number(P?.runtime?.pending_incidents||0),ke=!!P?.runtime?.monitoring_active,Ae=!!P?.runtime?.paused,je=!!P?.readiness?.ingest_ready,Me=!!P?.readiness?.publish_ready,Ne=String(P?.runtime?.last_runtime_error||P?.last_error||``).trim();return V(t,{children:[V(Ai,{identity:xe,currentRoute:N,providerLocked:M,navRoutes:ve,onNavigate:S,onPaletteOpen:()=>u(!0),onThemeCycle:()=>be(Jn(i)),onLogout:ue,navigationLock:f,statusBar:{engineHealthy:!!(re.data?.engine?.ready||re.data?.engine?.healthy),providerBadge:we,providerText:Te,activeRuns:+!![`planning`,`awaiting_approval`,`running`].includes(String(ie.data?.status||``).toLowerCase()),bugMonitor:De?{enabled:!0,monitoringActive:ke,paused:Ae,pendingIncidents:Oe,blocked:!je,lastError:ke&&!Me&&Ne?`Watching locally only. ${Ne}`:Ne}:null,approvals:{pendingCount:Number(oe.data?.count||0),checking:oe.isFetching}},routeKey:N,providerGate:M&&N!==`settings`?V(H.div,{className:`tcp-confirm-overlay`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:V(H.div,{className:`tcp-confirm-dialog`,initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.98},children:[V(`h3`,{className:`tcp-confirm-title`,children:`Provider Setup Required`}),V(`p`,{className:`tcp-confirm-message`,children:`Configure provider and default model in Providers to unlock all sections.`}),V(`div`,{className:`tcp-confirm-actions`,children:V(`button`,{className:`tcp-btn-primary`,onClick:()=>S(`settings`),children:`Open Providers`})})]})}):null,children:V(Si,{routeId:N,pageProps:Se})}),V(Sr,{open:c,onClose:()=>u(!1),actions:Ce})]})}function ra(){return V(Fr,{children:V(na,{})})}var ia=new nt({defaultOptions:{queries:{retry:1,staleTime:5e3,refetchOnWindowFocus:!1}}}),aa=document.getElementById(`app`);if(!aa)throw Error(`Missing #app host`);p(aa).render(V(i,{children:V(ee,{client:ia,children:V(ra,{})})}));export{cr as C,J as D,rr as E,vr as S,dr as T,hr as _,Di as a,_r as b,Hr as c,Z as d,Dr as f,yr as g,pr as h,Vi as i,Wr as l,sr as m,Ui as n,Q as o,Tr as p,Ri as r,Ur as s,Gi as t,Vr as u,gr as v,Y as w,mr as x,ur as y};
@@ -0,0 +1,3 @@
1
+ function e(e){return Array.isArray(e)?e.map(e=>e?typeof e==`string`?e:typeof e.text==`string`?e.text:typeof e.delta==`string`?e.delta:typeof e.content==`string`?e.content:``:``).filter(Boolean).join(`
2
+ `).trim():``}function t(e){return String(e?.info?.role||e?.role||e?.message_role||e?.type||e?.author||`assistant`).trim().toLowerCase()}function n(t){let n=e(t?.parts);if(n)return n;let r=[t?.content,t?.text,t?.message,t?.delta,t?.body].map(e=>typeof e==`string`?e:``).find(e=>e.trim().length>0);if(r)return r.trim();let i=t?.content;if(Array.isArray(i)){let e=i.map(e=>e?typeof e==`string`?e:typeof e?.text==`string`?e.text:typeof e?.content==`string`?e.content:``:``).filter(Boolean);if(e.length)return e.join(`
3
+ `).trim()}return``}function r(e,t){return e===`assistant`?t||`Assistant`:e===`user`?`User`:e===`system`?`System`:e||`Assistant`}function i(e,i,a){let o=t(e),s=n(e),c=o===`assistant`||o===`system`;return{id:String(e?.id||e?.messageID||e?.message_id||e?.event_id||`${o}-${i}`).trim()||`${o}-${i}`,role:o,displayRole:r(o,a),text:s,markdown:c}}function a(e,t){return(Array.isArray(e)?e:Array.isArray(e?.messages)?e.messages:[]).map((e,n)=>i(e,n,t))}export{a as t};