@frumu/tandem-panel 0.5.5 → 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.
- package/dist/assets/{AutomationsPage-6mRHsh9V.js → AutomationsPage-BGqpmilp.js} +12 -12
- package/dist/assets/BugMonitorPage-BVzdj9y-.js +4 -0
- package/dist/assets/{ChannelsPage-oJ5a717t.js → ChannelsPage-B-InJ4Yh.js} +1 -1
- package/dist/assets/{ChatInterfacePanel-3nvwn0cJ.js → ChatInterfacePanel-BrMo4cXg.js} +1 -1
- package/dist/assets/{ChatPage-CGKFC9ev.js → ChatPage-Bc-BfOG1.js} +1 -1
- package/dist/assets/CodingWorkflowsPage-xgfwLRlt.js +8 -0
- package/dist/assets/{ControlPanelDialogs-BBIPHXnw.js → ControlPanelDialogs-yFfCht3Y.js} +1 -1
- package/dist/assets/DashboardPage-CrA1itFc.js +1 -0
- package/dist/assets/{ExperimentsPage-DuYHzo7d.js → ExperimentsPage-Bkg1_6rw.js} +2 -2
- package/dist/assets/FilesPage-DChyHlO_.js +1 -0
- package/dist/assets/{IntentPlannerPage-BwlF9wfW.js → IntentPlannerPage-Dti1h8Tm.js} +4 -4
- package/dist/assets/MarketplacePage-90fAVNGg.js +1 -0
- package/dist/assets/{McpToolAllowlistEditor-B3qCkiFT.js → McpToolAllowlistEditor-BzQ64HrZ.js} +1 -1
- package/dist/assets/{MemoryImportDialog-BWT93PW1.js → MemoryImportDialog-DSpS1JF5.js} +1 -1
- package/dist/assets/MemoryPage-DRRLgoc0.js +1 -0
- package/dist/assets/{OrchestratorPage-HDyjjwF-.js → OrchestratorPage-CYU-ESPI.js} +1 -1
- package/dist/assets/PacksPage-dRmjjdKD.js +3 -0
- package/dist/assets/PlannerDiagnosticsPanel-C1uIuRIx.js +1 -0
- package/dist/assets/RunsPage-DEy8vbRT.js +1 -0
- package/dist/assets/SettingsPage-CwH_FzOs.js +5 -0
- package/dist/assets/{TeamsPage-CwMnVES9.js → TeamsPage-Dn81V0EB.js} +3 -3
- package/dist/assets/{WorkflowStudioPage-CyWDhEEE.js → WorkflowStudioPage-yFhlA4KV.js} +1 -1
- package/dist/assets/WorkflowsPage-vmaKHFox.js +2 -0
- package/dist/assets/{index-DAWzCKcg.css → index-C8Bjo7hU.css} +1 -1
- package/dist/assets/index-TvymvGva.js +3 -0
- package/dist/assets/{useEngineStream-ChEkuUVV.js → useEngineStream-Diqri33l.js} +1 -1
- package/dist/index.html +3 -5
- package/package.json +3 -3
- package/dist/assets/BugMonitorPage-B9mcxV8k.js +0 -4
- package/dist/assets/CodingWorkflowsPage-DosUtoeO.js +0 -8
- package/dist/assets/DashboardPage-Cv9_TUZQ.js +0 -1
- package/dist/assets/FilesPage-NAInb3WU.js +0 -1
- package/dist/assets/MarketplacePage-Wo7biaBa.js +0 -1
- package/dist/assets/MemoryPage-gSBH1OKG.js +0 -1
- package/dist/assets/PacksPage-BWnL4dRB.js +0 -3
- package/dist/assets/PlannerDiagnosticsPanel-VyacxaCM.js +0 -1
- package/dist/assets/RunsPage-B6ttNeUJ.js +0 -1
- package/dist/assets/SettingsPage-DhAKDQHw.js +0 -5
- package/dist/assets/WorkflowsPage-BWGWH8uD.js +0 -2
- package/dist/assets/api-CpR5ozpc.js +0 -1
- package/dist/assets/index-picB46b5.js +0 -3
- package/dist/assets/ui-CV-Z6sqF.js +0 -1
- /package/dist/assets/{LazyJson-DYncL_RR.js → LazyJson-vfWw7G9F.js} +0 -0
- /package/dist/assets/{ProviderModelSelector-B_IE0-e7.js → ProviderModelSelector-BdtOpkJR.js} +0 -0
- /package/dist/assets/{TaskBoard-DSRrmiyQ.js → TaskBoard-CCY_Qy5S.js} +0 -0
- /package/dist/assets/{TimezoneField-DKINpKxU.js → TimezoneField-B5i---lF.js} +0 -0
- /package/dist/assets/{chatPageHelpers-D-NhHk4M.js → chatPageHelpers-Dmb4waDk.js} +0 -0
- /package/dist/assets/{explorerHandoff-KpFRPNQc.js → explorerHandoff-BPKxMR82.js} +0 -0
- /package/dist/assets/{format-CimuGHiH.js → format-DyX5imzJ.js} +0 -0
- /package/dist/assets/{markdown-DJurGVIJ.js → markdown-Dwwtq3bu.js} +0 -0
- /package/dist/assets/{messages-AWZpX-Rw.js → messages-uD0aB_MZ.js} +0 -0
- /package/dist/assets/{plannerShared-1kHFyAp-.js → plannerShared-Dx7-Sxpc.js} +0 -0
- /package/dist/assets/{sse-B1wvyjPI.js → sse-B4A2m-Nk.js} +0 -0
- /package/dist/assets/{workflowStability-Dsk2DR6F.js → workflowStability-C8USyGOY.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{C as e,E as t,g as n,v as r}from"./fullcalendar-Bn75j0xM.js";import{n as i}from"./react-query-BIbNygEJ.js";import{i as a,n as o}from"./motion-B3ZE8SGR.js";import{h as s,i as c,n as l,t as u,u as d}from"./ui-CV-Z6sqF.js";import{a as f}from"./index-picB46b5.js";import{t as p}from"./ProviderModelSelector-B_IE0-e7.js";import{i as ee,n as m,r as te,t as ne}from"./plannerShared-1kHFyAp-.js";import{t as re}from"./ChatInterfacePanel-3nvwn0cJ.js";import{n as h,r as g,t as ie}from"./PlannerDiagnosticsPanel-VyacxaCM.js";function _({value:e,error:n=``,open:r,browseDir:i,search:o,parentDir:s,currentDir:l,directories:u,label:d=`Workspace root`,helperText:f=`Select the local workspace folder the planner should inspect.`,onOpen:p,onClose:ee,onClear:m,onSearchChange:te,onBrowseParent:ne,onBrowseDirectory:re,onSelectDirectory:h}){let g=String(o||``).trim().toLowerCase();return a(t,{children:[a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:d}),a(`div`,{className:`grid gap-2 md:grid-cols-[auto_1fr_auto]`,children:[a(`button`,{className:`tcp-btn h-10 px-3`,type:`button`,onClick:p,children:`Browse`}),a(`input`,{className:`tcp-input text-sm ${n?`border-red-500/70 text-red-100`:``}`,value:e,readOnly:!0,placeholder:`Select a local directory with Browse`}),a(`button`,{className:`tcp-btn h-10 px-3`,type:`button`,onClick:m,disabled:!e,children:`Clear`})]}),a(`span`,{className:`text-xs ${n?`text-red-300`:`tcp-subtle`}`,children:n||f})]}),r?a(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:[a(`button`,{type:`button`,className:`tcp-confirm-backdrop`,"aria-label":`Close workspace directory dialog`,onClick:ee}),a(`div`,{className:`tcp-confirm-dialog max-w-2xl`,children:[a(`h3`,{className:`tcp-confirm-title`,children:`Select Workspace Folder`}),a(`p`,{className:`tcp-confirm-message`,children:[`Current: `,l||i||`n/a`]}),a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(`button`,{className:`tcp-btn`,type:`button`,onClick:ne,disabled:!s,children:`Up`}),a(`button`,{className:`tcp-btn-primary`,type:`button`,onClick:h,disabled:!l,children:`Select This Folder`}),a(`button`,{className:`tcp-btn`,type:`button`,onClick:ee,children:`Close`})]}),a(`div`,{className:`mb-2`,children:a(`input`,{className:`tcp-input`,placeholder:`Type to filter folders...`,value:o,onInput:e=>te(e.target.value)})}),a(`div`,{className:`max-h-[360px] overflow-auto rounded-lg border border-slate-700/60 bg-slate-900/20 p-2`,children:u.length?u.map(e=>a(`button`,{className:`tcp-list-item mb-1 w-full text-left`,type:`button`,onClick:()=>re(String(e?.path||``)),children:a(`span`,{children:String(e?.name||e?.path||``)})},String(e?.path||e?.name))):a(c,{text:g?`No folders match your search.`:`No subdirectories in this folder.`})})]})]}):null]})}var v=[{id:`automation`,label:`Workflow automation`,detail:`Package the result into a governed automation draft.`},{id:`mission`,label:`Mission execution`,detail:`Shape a mission-style plan with multi-agent handoff and runtime review.`},{id:`coding`,label:`Coder`,detail:`Turn intent into repo-aware work that can publish into coding flows.`},{id:`orchestrator`,label:`Orchestrator`,detail:`Prepare an execution-ready plan for orchestration and approvals.`}],y=[{id:`same_day`,label:`Same day`,detail:`Split work into waves that should complete in a single day.`},{id:`multi_day`,label:`Multi-day`,detail:`Break the mission into a plan that spans several days.`},{id:`weekly`,label:`Weekly recurring`,detail:`Plan recurring work that should execute on a weekly cadence.`},{id:`monthly`,label:`Monthly recurring`,detail:`Plan recurring synthesis or review across a monthly cycle.`},{id:`mixed`,label:`Mixed cadence`,detail:`Blend one-time setup work with recurring follow-on work.`}],b=[`Plan a week-long multi-agent launch workflow`,`Turn this outcome into a phased mission with approvals`,`Break this into daily work waves and recurring follow-up`];function x(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t].sort((e,t)=>e.localeCompare(t))}function S(e){return String(e||``).trim()}function ae({draft:t,onChange:n,providerOptions:i,plannerCanUseLlm:o,basePlannerLabel:s,availableMcpServers:c,workspaceRootError:u=``,workspaceBrowserOpen:d,workspaceBrowserDir:ee,workspaceBrowserSearch:te,workspaceBrowserParentDir:re,workspaceBrowserCurrentDir:h,workspaceBrowserDirectories:g,onOpenWorkspaceBrowser:ie,onCloseWorkspaceBrowser:ae,onClearWorkspaceRoot:C,onWorkspaceBrowserSearchChange:w,onWorkspaceBrowserParent:T,onWorkspaceBrowserDirectory:E,onSelectWorkspaceDirectory:oe,onReset:D,disabled:O=!1}){let[se,k]=r(!1);e(()=>{try{f()}catch{}});let ce=v.find(e=>e.id===t.targetSurface),A=y.find(e=>e.id===t.planningHorizon),le=ne(t.goal).knowledge,j=m(t.goal).rollout,ue=S(le.subject||t.goal);return a(`div`,{className:`grid gap-4 min-h-0`,children:[a(`div`,{className:`rounded-2xl border border-emerald-500/10 bg-emerald-500/5 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:`ok`,children:`planner workbench`}),a(l,{tone:o?`ok`:`warn`,children:o?`model ready`:`model missing`}),a(`div`,{className:`flex-1`}),a(`button`,{type:`button`,className:`tcp-btn h-6 px-2 text-[10px]`,onClick:D,title:`Start a new mission and clear the current planner state`,disabled:O,children:[a(`i`,{"data-lucide":`plus`,className:`mr-1 h-3 w-3`}),`New mission`]})]}),a(`p`,{className:`tcp-subtle mt-2 text-xs`,children:`The planner turns your intent into a structured workflow. Describe the full system — connected agents, schedules, and handoffs — and the planner will decompose it.`})]}),a(`div`,{className:`rounded-2xl border border-cyan-500/10 bg-cyan-500/5 p-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-cyan-200/80`,children:`Knowledge defaults`}),a(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[a(l,{tone:`info`,children:`project scope`}),a(l,{tone:`info`,children:`preflight reuse`}),a(l,{tone:`info`,children:`promoted trust floor`}),ue?null:a(l,{tone:`warn`,children:`subject inferred later`})]}),ue?a(`div`,{className:`mt-3 rounded border border-white/5 bg-black/20 p-2 text-xs tcp-subtle break-words`,children:[a(`strong`,{className:`text-emerald-500/80 uppercase tracking-wide mr-1`,children:`Subject:`}),a(`span`,{className:`line-clamp-3`,children:ue})]}):null,a(`p`,{className:`tcp-subtle mt-2 text-xs`,children:`The planner will start from project-scoped promoted knowledge and reuse prior work before it recomputes. Raw working notes stay local unless they are promoted later.`})]}),a(`div`,{className:`rounded-2xl border border-amber-500/15 bg-amber-500/5 p-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-amber-200/80`,children:`Rollout guardrails`}),a(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[a(l,{tone:`warn`,children:`project-first pilot`}),a(l,{tone:`warn`,children:`promoted only`}),a(l,{tone:`warn`,children:`approved_default rare`})]}),a(`ul`,{className:`tcp-subtle mt-2 space-y-1 text-xs`,children:j.guardrails.map(e=>a(`li`,{children:[`• `,e]},e))})]}),a(_,{value:t.workspaceRoot,error:u,open:d,browseDir:ee,search:te,parentDir:re,currentDir:h,directories:g,helperText:`This folder is required. The planner uses it to inspect the repo and generate the plan.`,onOpen:ie,onClose:ae,onClear:C,onSearchChange:w,onBrowseParent:T,onBrowseDirectory:E,onSelectDirectory:oe}),a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Intent`}),a(`textarea`,{className:`tcp-input min-h-32 text-sm`,value:t.goal,onInput:e=>n({...t,goal:e.target.value}),placeholder:`Describe the long-horizon outcome you want, including what success looks like.`,disabled:O}),a(`div`,{className:`flex flex-wrap gap-2`,children:b.map(e=>a(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>n({...t,goal:e}),disabled:O,children:e},e))}),a(`span`,{className:`tcp-subtle text-xs`,children:`Keep this high-level. The planner should turn the goal into structure after the first draft.`})]}),a(`div`,{className:`rounded-2xl border border-white/10 bg-black/20 p-4`,children:[a(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[a(`div`,{children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Optional guidance`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:`Leave this collapsed if you want the planner to infer the setup from your intent.`})]}),a(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>k(e=>!e),disabled:O,children:se?`Hide guidance`:`Add guidance`})]}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`span`,{className:`tcp-badge-info`,children:ce?.label||`Mission execution`}),a(`span`,{className:`tcp-badge-info`,children:A?.label||`Mixed cadence`}),a(`span`,{className:`tcp-badge-info`,children:t.selectedMcpServers.length?`${t.selectedMcpServers.length} MCP source${t.selectedMcpServers.length===1?``:`s`}`:`all connected MCP sources`})]}),se?a(`div`,{className:`mt-4 grid gap-4`,children:[a(`div`,{className:`grid gap-2`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Target surface`}),a(`select`,{className:`tcp-input text-sm`,value:t.targetSurface,onChange:e=>n({...t,targetSurface:e.target.value}),disabled:O,children:v.map(e=>a(`option`,{value:e.id,children:e.label},e.id))}),a(`div`,{className:`tcp-subtle text-xs`,children:ce?.detail})]}),a(`div`,{className:`grid gap-2`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Planning horizon`}),a(`select`,{className:`tcp-input text-sm`,value:t.planningHorizon,onChange:e=>n({...t,planningHorizon:e.target.value}),disabled:O,children:y.map(e=>a(`option`,{value:e.id,children:e.label},e.id))}),a(`div`,{className:`tcp-subtle text-xs`,children:A?.detail})]}),a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Outputs or constraints`}),a(`textarea`,{className:`tcp-input min-h-28 text-sm`,value:[t.outputExpectations,t.constraints].filter(Boolean).join(`
|
|
1
|
+
import{C as e,E as t,g as n,v as r}from"./fullcalendar-Bn75j0xM.js";import{n as i}from"./react-query-BIbNygEJ.js";import{i as a,n as o}from"./motion-B3ZE8SGR.js";import{E as s,_ as c,a as l,h as u,m as d,x as f}from"./index-TvymvGva.js";import{t as p}from"./ProviderModelSelector-BdtOpkJR.js";import{i as ee,n as m,r as te,t as ne}from"./plannerShared-Dx7-Sxpc.js";import{t as re}from"./ChatInterfacePanel-BrMo4cXg.js";import{n as h,r as g,t as ie}from"./PlannerDiagnosticsPanel-C1uIuRIx.js";function _({value:e,error:n=``,open:r,browseDir:i,search:o,parentDir:s,currentDir:l,directories:u,label:d=`Workspace root`,helperText:f=`Select the local workspace folder the planner should inspect.`,onOpen:p,onClose:ee,onClear:m,onSearchChange:te,onBrowseParent:ne,onBrowseDirectory:re,onSelectDirectory:h}){let g=String(o||``).trim().toLowerCase();return a(t,{children:[a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:d}),a(`div`,{className:`grid gap-2 md:grid-cols-[auto_1fr_auto]`,children:[a(`button`,{className:`tcp-btn h-10 px-3`,type:`button`,onClick:p,children:`Browse`}),a(`input`,{className:`tcp-input text-sm ${n?`border-red-500/70 text-red-100`:``}`,value:e,readOnly:!0,placeholder:`Select a local directory with Browse`}),a(`button`,{className:`tcp-btn h-10 px-3`,type:`button`,onClick:m,disabled:!e,children:`Clear`})]}),a(`span`,{className:`text-xs ${n?`text-red-300`:`tcp-subtle`}`,children:n||f})]}),r?a(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:[a(`button`,{type:`button`,className:`tcp-confirm-backdrop`,"aria-label":`Close workspace directory dialog`,onClick:ee}),a(`div`,{className:`tcp-confirm-dialog max-w-2xl`,children:[a(`h3`,{className:`tcp-confirm-title`,children:`Select Workspace Folder`}),a(`p`,{className:`tcp-confirm-message`,children:[`Current: `,l||i||`n/a`]}),a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(`button`,{className:`tcp-btn`,type:`button`,onClick:ne,disabled:!s,children:`Up`}),a(`button`,{className:`tcp-btn-primary`,type:`button`,onClick:h,disabled:!l,children:`Select This Folder`}),a(`button`,{className:`tcp-btn`,type:`button`,onClick:ee,children:`Close`})]}),a(`div`,{className:`mb-2`,children:a(`input`,{className:`tcp-input`,placeholder:`Type to filter folders...`,value:o,onInput:e=>te(e.target.value)})}),a(`div`,{className:`max-h-[360px] overflow-auto rounded-lg border border-slate-700/60 bg-slate-900/20 p-2`,children:u.length?u.map(e=>a(`button`,{className:`tcp-list-item mb-1 w-full text-left`,type:`button`,onClick:()=>re(String(e?.path||``)),children:a(`span`,{children:String(e?.name||e?.path||``)})},String(e?.path||e?.name))):a(c,{text:g?`No folders match your search.`:`No subdirectories in this folder.`})})]})]}):null]})}var v=[{id:`automation`,label:`Workflow automation`,detail:`Package the result into a governed automation draft.`},{id:`mission`,label:`Mission execution`,detail:`Shape a mission-style plan with multi-agent handoff and runtime review.`},{id:`coding`,label:`Coder`,detail:`Turn intent into repo-aware work that can publish into coding flows.`},{id:`orchestrator`,label:`Orchestrator`,detail:`Prepare an execution-ready plan for orchestration and approvals.`}],y=[{id:`same_day`,label:`Same day`,detail:`Split work into waves that should complete in a single day.`},{id:`multi_day`,label:`Multi-day`,detail:`Break the mission into a plan that spans several days.`},{id:`weekly`,label:`Weekly recurring`,detail:`Plan recurring work that should execute on a weekly cadence.`},{id:`monthly`,label:`Monthly recurring`,detail:`Plan recurring synthesis or review across a monthly cycle.`},{id:`mixed`,label:`Mixed cadence`,detail:`Blend one-time setup work with recurring follow-on work.`}],b=[`Plan a week-long multi-agent launch workflow`,`Turn this outcome into a phased mission with approvals`,`Break this into daily work waves and recurring follow-up`];function x(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t].sort((e,t)=>e.localeCompare(t))}function S(e){return String(e||``).trim()}function ae({draft:t,onChange:n,providerOptions:i,plannerCanUseLlm:o,basePlannerLabel:s,availableMcpServers:c,workspaceRootError:d=``,workspaceBrowserOpen:f,workspaceBrowserDir:ee,workspaceBrowserSearch:te,workspaceBrowserParentDir:re,workspaceBrowserCurrentDir:h,workspaceBrowserDirectories:g,onOpenWorkspaceBrowser:ie,onCloseWorkspaceBrowser:ae,onClearWorkspaceRoot:C,onWorkspaceBrowserSearchChange:w,onWorkspaceBrowserParent:T,onWorkspaceBrowserDirectory:E,onSelectWorkspaceDirectory:oe,onReset:D,disabled:O=!1}){let[se,k]=r(!1);e(()=>{try{l()}catch{}});let ce=v.find(e=>e.id===t.targetSurface),A=y.find(e=>e.id===t.planningHorizon),le=ne(t.goal).knowledge,j=m(t.goal).rollout,ue=S(le.subject||t.goal);return a(`div`,{className:`grid gap-4 min-h-0`,children:[a(`div`,{className:`rounded-2xl border border-emerald-500/10 bg-emerald-500/5 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:`ok`,children:`planner workbench`}),a(u,{tone:o?`ok`:`warn`,children:o?`model ready`:`model missing`}),a(`div`,{className:`flex-1`}),a(`button`,{type:`button`,className:`tcp-btn h-6 px-2 text-[10px]`,onClick:D,title:`Start a new mission and clear the current planner state`,disabled:O,children:[a(`i`,{"data-lucide":`plus`,className:`mr-1 h-3 w-3`}),`New mission`]})]}),a(`p`,{className:`tcp-subtle mt-2 text-xs`,children:`The planner turns your intent into a structured workflow. Describe the full system — connected agents, schedules, and handoffs — and the planner will decompose it.`})]}),a(`div`,{className:`rounded-2xl border border-cyan-500/10 bg-cyan-500/5 p-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-cyan-200/80`,children:`Knowledge defaults`}),a(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[a(u,{tone:`info`,children:`project scope`}),a(u,{tone:`info`,children:`preflight reuse`}),a(u,{tone:`info`,children:`promoted trust floor`}),ue?null:a(u,{tone:`warn`,children:`subject inferred later`})]}),ue?a(`div`,{className:`mt-3 rounded border border-white/5 bg-black/20 p-2 text-xs tcp-subtle break-words`,children:[a(`strong`,{className:`text-emerald-500/80 uppercase tracking-wide mr-1`,children:`Subject:`}),a(`span`,{className:`line-clamp-3`,children:ue})]}):null,a(`p`,{className:`tcp-subtle mt-2 text-xs`,children:`The planner will start from project-scoped promoted knowledge and reuse prior work before it recomputes. Raw working notes stay local unless they are promoted later.`})]}),a(`div`,{className:`rounded-2xl border border-amber-500/15 bg-amber-500/5 p-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-amber-200/80`,children:`Rollout guardrails`}),a(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[a(u,{tone:`warn`,children:`project-first pilot`}),a(u,{tone:`warn`,children:`promoted only`}),a(u,{tone:`warn`,children:`approved_default rare`})]}),a(`ul`,{className:`tcp-subtle mt-2 space-y-1 text-xs`,children:j.guardrails.map(e=>a(`li`,{children:[`• `,e]},e))})]}),a(_,{value:t.workspaceRoot,error:d,open:f,browseDir:ee,search:te,parentDir:re,currentDir:h,directories:g,helperText:`This folder is required. The planner uses it to inspect the repo and generate the plan.`,onOpen:ie,onClose:ae,onClear:C,onSearchChange:w,onBrowseParent:T,onBrowseDirectory:E,onSelectDirectory:oe}),a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Intent`}),a(`textarea`,{className:`tcp-input min-h-32 text-sm`,value:t.goal,onInput:e=>n({...t,goal:e.target.value}),placeholder:`Describe the long-horizon outcome you want, including what success looks like.`,disabled:O}),a(`div`,{className:`flex flex-wrap gap-2`,children:b.map(e=>a(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>n({...t,goal:e}),disabled:O,children:e},e))}),a(`span`,{className:`tcp-subtle text-xs`,children:`Keep this high-level. The planner should turn the goal into structure after the first draft.`})]}),a(`div`,{className:`rounded-2xl border border-white/10 bg-black/20 p-4`,children:[a(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[a(`div`,{children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Optional guidance`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:`Leave this collapsed if you want the planner to infer the setup from your intent.`})]}),a(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>k(e=>!e),disabled:O,children:se?`Hide guidance`:`Add guidance`})]}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`span`,{className:`tcp-badge-info`,children:ce?.label||`Mission execution`}),a(`span`,{className:`tcp-badge-info`,children:A?.label||`Mixed cadence`}),a(`span`,{className:`tcp-badge-info`,children:t.selectedMcpServers.length?`${t.selectedMcpServers.length} MCP source${t.selectedMcpServers.length===1?``:`s`}`:`all connected MCP sources`})]}),se?a(`div`,{className:`mt-4 grid gap-4`,children:[a(`div`,{className:`grid gap-2`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Target surface`}),a(`select`,{className:`tcp-input text-sm`,value:t.targetSurface,onChange:e=>n({...t,targetSurface:e.target.value}),disabled:O,children:v.map(e=>a(`option`,{value:e.id,children:e.label},e.id))}),a(`div`,{className:`tcp-subtle text-xs`,children:ce?.detail})]}),a(`div`,{className:`grid gap-2`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Planning horizon`}),a(`select`,{className:`tcp-input text-sm`,value:t.planningHorizon,onChange:e=>n({...t,planningHorizon:e.target.value}),disabled:O,children:y.map(e=>a(`option`,{value:e.id,children:e.label},e.id))}),a(`div`,{className:`tcp-subtle text-xs`,children:A?.detail})]}),a(`label`,{className:`grid gap-2`,children:[a(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Outputs or constraints`}),a(`textarea`,{className:`tcp-input min-h-28 text-sm`,value:[t.outputExpectations,t.constraints].filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`),onInput:e=>n({...t,outputExpectations:e.target.value,constraints:``}),placeholder:`Optional: add anything the planner must produce or respect.`,disabled:O})]}),a(`div`,{className:`rounded-xl border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:a(`div`,{children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Planner model`}),a(`div`,{className:`tcp-subtle text-xs`,children:[`Base model: `,s||`not configured`]})]})}),a(p,{providerLabel:`Planner provider`,modelLabel:`Planner model`,draft:{provider:t.plannerProvider,model:t.plannerModel},providers:i,onChange:({provider:e,model:r})=>n({...t,plannerProvider:e,plannerModel:r}),inheritLabel:`Workspace default`,disabled:O})]}),a(`div`,{className:`rounded-xl border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`MCP sources`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:`Optional: limit which connected systems the planner should reference.`})]}),a(`div`,{className:`flex flex-wrap gap-2`,children:c.length?c.map(e=>a(`button`,{type:`button`,className:t.selectedMcpServers.includes(e.name)?`tcp-btn-primary h-8 px-3 text-xs`:`tcp-btn h-8 px-3 text-xs`,onClick:()=>n({...t,selectedMcpServers:x(t.selectedMcpServers,e.name)}),disabled:O||!e.connected,title:e.lastError||e.transport||``,children:e.name},e.name)):a(`div`,{className:`tcp-subtle text-xs`,children:`No MCP servers are currently connected.`})})]})]}):null]})]})}function C(e){return String(e||``).trim()}function w(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function T(e){let t=w(e?.knowledge);if(Object.keys(t).length)return t;let n=w(w(w(e?.metadata).builder).knowledge);return Object.keys(n).length?n:null}function E(e,t=`n/a`){let n=Array.isArray(e)?e.map(e=>{if(e&&typeof e==`object`){let t=C(e.scope),n=C(e.namespace);if(t&&n)return`${t}:${n}`;if(t)return t}return C(e)}).filter(Boolean):[];return n.length?n.join(`, `):t}function oe({planPreview:e,brief:t,planPackage:n,planPackageBundle:r}){let i=Array.isArray(e?.steps)?e.steps:[],o=Array.isArray(n?.routine_graph)?n.routine_graph:[],s=w(r?.scope_snapshot||r?.scopeSnapshot),c=w(s.output_roots||s.outputRoots),u=i.map(T).find(Boolean)||null,f=m(t.goal).rollout;return a(d,{title:`Plan summary`,subtitle:`Review the compiler draft and bundle snapshot before handing it off downstream.`,children:e?a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:n?`ok`:`warn`,children:n?`plan package ready`:`plan package pending`}),a(l,{tone:r?`ok`:`warn`,children:r?`bundle ready`:`bundle pending`}),a(l,{tone:`info`,children:t.targetSurface.replace(`_`,` `)}),a(l,{tone:`info`,children:t.planningHorizon.replace(`_`,` `)})]}),a(h,{metrics:[{label:`Plan title`,value:C(e?.title)||C(e?.plan_id)||`Draft`},{label:`Plan id`,value:C(e?.plan_id||e?.planId)||`pending`},{label:`Routines`,value:o.length||`pending`},{label:`Steps`,value:i.length||`pending`}]}),a(g,{title:`Description`,children:a(`div`,{className:`text-slate-200`,children:C(e?.description)||`No description returned yet.`})}),a(g,{title:`Knowledge defaults`,description:`The compiler now carries reusable knowledge defaults alongside each step.`,children:u?a(`div`,{className:`grid gap-2 text-xs text-slate-200`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:u.enabled===!1?`warn`:`ok`,children:u.enabled===!1?`knowledge off`:`knowledge on`}),a(l,{tone:`info`,children:[`reuse: `,C(u.reuse_mode||`preflight`)]}),a(l,{tone:`info`,children:[`trust: `,C(u.trust_floor||`promoted`)]})]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`subject:`,` `,C(u.subject||e?.original_prompt||`n/a`)]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`reads: `,E(u.read_spaces,`project`)]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`promotes: `,E(u.promote_spaces,`project`)]})]}):a(`div`,{className:`tcp-subtle text-xs`,children:`No knowledge defaults surfaced yet; the plan compiler may not have normalized the step metadata.`})}),a(g,{title:`Rollout guardrails`,description:`Use these checks when expanding reusable knowledge across workflows.`,children:a(`div`,{className:`grid gap-2 text-xs text-slate-200`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:`warn`,children:`project-first pilot`}),a(l,{tone:`warn`,children:`promoted only`}),a(l,{tone:`warn`,children:`approved_default rare`})]}),a(`div`,{className:`tcp-subtle`,children:f.rollout_mode===`project_first_pilot`?`Run a project-scoped pilot first, then widen only after the reuse path is stable.`:`Rollout guidance is missing or incomplete.`}),a(`ul`,{className:`space-y-1`,children:f.guardrails.map(e=>a(`li`,{children:[`• `,e]},e))})]})}),a(g,{title:`Bundle snapshot`,children:a(h,{metrics:[{label:`Bundle version`,value:C(r?.bundle_version||r?.bundleVersion)||`pending`},{label:`Snapshot plan`,value:C(s.plan_id||s.planId)||`pending`},{label:`Snapshot revision`,value:C(s.plan_revision||s.planRevision)||`pending`},{label:`Output roots`,value:a(`div`,{className:`text-xs text-slate-200`,children:[c.plan?a(`div`,{children:[`plan: `,C(c.plan)]}):null,c.history?a(`div`,{children:[`history: `,C(c.history)]}):null,c.proof?a(`div`,{children:[`proof: `,C(c.proof)]}):null,c.drafts?a(`div`,{children:[`drafts: `,C(c.drafts)]}):null,!c.plan&&!c.history&&!c.proof&&!c.drafts?a(`div`,{className:`tcp-subtle`,children:`No bundle roots available yet.`}):null]})}]})}),a(g,{title:`Step graph`,children:a(`div`,{className:`grid gap-2`,children:i.length?i.map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:`info`,children:[`Step `,t+1]}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:C(e?.objective)||C(e?.title)||`Untitled step`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:[`role: `,C(e?.agent_role||e?.agentRole)||`n/a`]}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`depends on:`,` `,Array.isArray(e?.depends_on)&&e.depends_on.length?e.depends_on.join(`, `):`none`]}),T(e)?a(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px]`,children:[a(l,{tone:T(e)?.enabled===!1?`warn`:`ok`,children:T(e)?.enabled===!1?`knowledge off`:`knowledge on`}),a(l,{tone:`info`,children:[`reuse: `,C(T(e)?.reuse_mode||`preflight`)]}),a(l,{tone:`info`,children:[`trust: `,C(T(e)?.trust_floor||`promoted`)]}),a(`span`,{className:`tcp-subtle text-[11px]`,children:[`subject: `,C(T(e)?.subject||`inferred`)]})]}):null]},C(e?.step_id||e?.stepId||t))):a(`div`,{className:`tcp-subtle text-xs`,children:`No step graph has been returned yet.`})})})]}):a(`div`,{className:`tcp-subtle text-sm`,children:`No plan yet. Start with the intent brief and planner chat to generate a draft.`})})}function D(e){return String(e||``).trim()}function O(e){switch(e){case`same_day`:return 2;case`multi_day`:return 3;case`weekly`:return 2;case`monthly`:return 3;default:return 3}}function se(e,t,n){return t===1?`One-time delivery`:e===0?`Setup and framing`:e===t-1?n===`weekly`||n===`monthly`||n===`mixed`?`Recurring follow-up`:`Review and handoff`:`Core delivery`}function k(e,t){let n=Math.max(1,Math.min(O(t),e.length||1)),r=Math.max(1,Math.ceil((e.length||1)/n)),i=[];for(let a=0;a<n;a+=1){let o=e.slice(a*r,(a+1)*r);!o.length&&e.length||i.push({index:a,title:se(a,n,t),steps:o})}return i.length||i.push({index:0,title:se(0,1,t),steps:[]}),i}function ce({brief:e,planPreview:t}){let n=Array.isArray(t?.steps)?t.steps:[],r=k(n,e.planningHorizon),i=e.planningHorizon===`weekly`||e.planningHorizon===`monthly`||e.planningHorizon===`mixed`;return a(d,{title:`Timeline`,subtitle:`Preview the mission as time waves and milestones instead of one flattened schedule.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:`info`,children:e.planningHorizon.replace(`_`,` `)}),a(l,{tone:i?`ok`:`info`,children:i?`one-time + recurring`:`one-time only`}),a(l,{tone:n.length?`ok`:`warn`,children:n.length?`${n.length} step${n.length===1?``:`s`}`:`no steps yet`})]}),a(g,{title:`Timeline model`,children:a(`div`,{className:`text-slate-200`,children:i?`This horizon is treated as a mix of one-time setup work plus recurring follow-up waves.`:`This horizon is treated as one-time work split into sequential execution waves.`})}),a(`div`,{className:`grid gap-2`,children:r.map(e=>a(g,{title:`Milestone ${e.index+1}`,description:e.title,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:e.index===r.length-1&&i?`ok`:`info`,children:e.title}),a(`span`,{className:`tcp-subtle text-xs`,children:e.steps.length?`${e.steps.length} step${e.steps.length===1?``:`s`}`:`no assigned steps`})]}),e.steps.length?a(`div`,{className:`mt-3 grid gap-2`,children:e.steps.map((t,n)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-2`,children:[a(`div`,{className:`text-sm font-medium text-slate-100`,children:D(t?.objective)||D(t?.title)||`Untitled step`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`role: `,D(t?.agent_role||t?.agentRole)||`n/a`]})]},D(t?.step_id||t?.stepId||`${e.index}-${n}`)))}):null]},`${e.index}-${e.title}`))})]})})}function A(e){return String(e||``).trim()}function le({validationReport:e}){let t=Array.isArray(e?.issues)?e.issues:[],n=t.filter(e=>e?.blocking),r=t.filter(e=>!e?.blocking);return a(d,{title:`Validation`,subtitle:`Compiler checks that gate preview, apply, and activation.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:e?`ok`:`warn`,children:e?`report ready`:`report pending`}),a(l,{tone:Number(e?.ready_for_apply||e?.readyForApply)?`ok`:`warn`,children:Number(e?.ready_for_apply||e?.readyForApply)?`ready for apply`:`apply blocked`}),a(l,{tone:Number(e?.ready_for_activation||e?.readyForActivation)?`ok`:`warn`,children:Number(e?.ready_for_activation||e?.readyForActivation)?`ready for activation`:`activation blocked`})]}),a(h,{metrics:[{label:`Blockers`,value:Number(n.length||e?.blocker_count||0)},{label:`Warnings`,value:Number(r.length||e?.warning_count||0)}]}),t.length?a(`div`,{className:`grid gap-2`,children:t.slice(0,4).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:e?.blocking?`err`:`warn`,children:e?.blocking?`blocking`:`warning`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:A(e?.code)||`validation issue`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:A(e?.path)||`unknown path`}),a(`div`,{className:`mt-1 text-slate-200`,children:A(e?.message)})]},`${A(e?.code)}-${t}`))}):a(`div`,{className:`tcp-subtle text-xs`,children:e?`No validation issues were reported for the current draft.`:`Validation results will appear after the planner generates a draft.`}),e?.validation_state?a(g,{title:`Validation state`,children:a(`div`,{className:`text-slate-100`,children:A(e.validation_state.state||e.validationState?.state)||`pending`})}):null]})})}function j(e){return String(e||``).trim()}function ue({overlapAnalysis:e}){let t=j(e?.matched_plan_id||e?.matchedPlanId),n=j(e?.matched_plan_revision||e?.matchedPlanRevision),r=j(e?.decision||``).replace(/_/g,` `),i=j(e?.match_layer||e?.matchLayer).replace(/_/g,` `),o=e?.similarity_score??e?.similarityScore,s=!!(e?.requires_user_confirmation||e?.requiresUserConfirmation);return a(d,{title:`Overlap`,subtitle:`Match the current draft against prior plans and decide how it should evolve.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:t?`ok`:`warn`,children:t?`prior match found`:`no prior match`}),r?a(l,{tone:`info`,children:r}):null,i?a(l,{tone:`info`,children:i}):null,a(l,{tone:s?`warn`:`ok`,children:s?`confirmation needed`:`no confirmation needed`})]}),a(h,{metrics:[{label:`Matched plan`,value:t||`none`},{label:`Matched revision`,value:n||`none`},{label:`Similarity`,value:typeof o==`number`?o.toFixed(2):`n/a`},{label:`Reason`,value:j(e?.reason)||`No overlap reason provided.`}]})]})})}function M(e){return String(e||``).trim()}function N(e){return Array.isArray(e)?e:[]}function de({planPackageReplay:e}){let t=!!e?.compatible,n=N(e?.issues),r=N(e?.diff_summary||e?.diffSummary),i=!!e?.scope_metadata_preserved,o=!!e?.handoff_rules_preserved,s=!!e?.credential_isolation_preserved;return a(d,{title:`Replay`,subtitle:`Compare the current draft against the baseline revision and review what changed.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:e&&t?`ok`:`warn`,children:e?t?`replay compatible`:`replay drift`:`replay pending`}),a(l,{tone:i?`ok`:`warn`,children:i?`scope preserved`:`scope changed`}),a(l,{tone:o?`ok`:`warn`,children:o?`handoff preserved`:`handoff changed`}),a(l,{tone:s?`ok`:`warn`,children:s?`credentials preserved`:`credentials changed`})]}),a(h,{metrics:[{label:`Previous plan`,value:M(e?.previous_plan_id)||`baseline`,detail:M(e?.previous_plan_revision)?`revision ${M(e?.previous_plan_revision)}`:`revision 1`},{label:`Current plan`,value:M(e?.next_plan_id)||`current draft`,detail:M(e?.next_plan_revision)?`revision ${M(e?.next_plan_revision)}`:`latest revision`},{label:`Issues`,value:n.length||0},{label:`Diffs`,value:r.length||0}]}),r.length?a(g,{title:`Replay deltas`,children:a(`div`,{className:`grid gap-2`,children:r.slice(0,6).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:e?.preserved?`ok`:`warn`,children:e?.preserved?`preserved`:`changed`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:M(e?.path)||`unknown path`})]}),e?.previous_value===void 0?null:a(`div`,{className:`mt-2 text-xs text-slate-400`,children:[`previous: `,JSON.stringify(e.previous_value)]}),e?.next_value===void 0?null:a(`div`,{className:`mt-1 text-xs text-slate-300`,children:[`next: `,JSON.stringify(e.next_value)]})]},`${M(e?.path)}-${t}`))})}):null,n.length?a(g,{title:`Replay issues`,children:a(`div`,{className:`grid gap-2`,children:n.slice(0,6).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:e?.blocking?`err`:`warn`,children:e?.blocking?`blocking`:`warning`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:M(e?.code)||`replay issue`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:M(e?.path)||`unknown path`}),a(`div`,{className:`mt-1 text-slate-200`,children:M(e?.message)})]},`${M(e?.code)}-${t}`))})}):a(`div`,{className:`tcp-subtle text-xs`,children:e?`No replay issues were reported for the current draft.`:`Replay results will appear after the planner generates or revises a draft.`})]})})}var P=`tandem.automations.plannerSeed`,F=`tandem.intent-planner.codingTaskHandoff.v1`;function I(e){return String(e||``).trim()}function L({brief:e,planPreview:t,planPackageBundle:n,planPackage:r,validationReport:i,overlapAnalysis:a,teachingLibrary:o}){return{goal:I(e.goal||t?.description||t?.title),workspaceRoot:I(e.workspaceRoot),notes:[`Target surface: ${e.targetSurface.replace(`_`,` `)}`,`Planning horizon: ${e.planningHorizon.replace(`_`,` `)}`,e.outputExpectations?`Expected outputs: ${I(e.outputExpectations)}`:``,e.constraints?`Constraints: ${I(e.constraints)}`:``].filter(Boolean).join(`
|
|
4
|
-
`),plannerProvider:I(e.plannerProvider),plannerModel:I(e.plannerModel),plan:r||t||null,conversation:null,changeSummary:[],plannerError:``,plannerDiagnostics:{validation_report:i||null,overlap_analysis:a||null,teaching_library:o||null,handoff_source:`intent_planner_page`},publishedAtMs:null,publishedTasks:[],planPackageBundle:n||null}}function fe({brief:e,planPreview:t,planPackage:i,planPackageBundle:o,validationReport:s,overlapAnalysis:c,teachingLibrary:u,navigate:f,toast:p}){let[ee,m]=r(``),te=!!o,ne=!!t||!!i,re=n(()=>L({brief:e,planPreview:t,planPackageBundle:o,planPackage:i,validationReport:s,overlapAnalysis:c,teachingLibrary:u}),[e,c,i,o,t,u,s]),h=()=>{let n=I(e.goal||t?.description||t?.title);if(!n){p(`warn`,`Add an intent first so we have something to hand off.`);return}try{sessionStorage.setItem(P,JSON.stringify({prompt:n,plan_source:`intent_planner_page`})),f(`automations`)}catch{p(`err`,`Unable to seed the automation draft handoff.`)}},g=()=>{if(!ne){p(`warn`,`Generate a plan before publishing a coding task bundle.`);return}try{sessionStorage.setItem(F,JSON.stringify(re)),f(`coding`)}catch{p(`err`,`Unable to seed the coding handoff.`)}},ie=async()=>{if(!te){p(`warn`,`Generate a bundle before exporting it.`);return}try{let e=JSON.stringify(o,null,2);typeof navigator<`u`&&navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),m(`Bundle copied to clipboard.`),p(`ok`,`Plan bundle copied to clipboard.`)):(m(`Clipboard unavailable.`),p(`warn`,`Clipboard unavailable in this environment.`))}catch{m(`Copy failed.`),p(`err`,`Unable to copy the plan bundle.`)}};return a(d,{title:`Handoff`,subtitle:`Send the plan downstream without rebuilding it in another page.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:ne?`ok`:`warn`,children:ne?`handoff ready`:`handoff pending`}),a(l,{tone:te?`ok`:`warn`,children:te?`bundle ready`:`bundle pending`}),a(l,{tone:`info`,children:e.targetSurface.replace(`_`,` `)})]}),a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:h,children:[a(`i`,{"data-lucide":`bot`,className:`mr-1 h-3 w-3`}),`Create automation draft`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>f(`studio`),children:[a(`i`,{"data-lucide":`network`,className:`mr-1 h-3 w-3`}),`Open in mission builder`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:g,children:[a(`i`,{"data-lucide":`code`,className:`mr-1 h-3 w-3`}),`Publish Coder task bundle`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>f(`orchestrator`),children:[a(`i`,{"data-lucide":`sparkles`,className:`mr-1 h-3 w-3`}),`Open task board`]}),a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:()=>void ie(),children:[a(`i`,{"data-lucide":`download`,className:`mr-1 h-3 w-3`}),`Export plan bundle`]})]}),ee?a(`div`,{className:`tcp-subtle text-xs`,children:ee}):null]})})}function R(e){return String(e||``).trim()}function z(e){return e?`ok`:`warn`}function pe({brief:e,planPreview:t,validationReport:n,overlapAnalysis:r}){let i=Array.isArray(t?.steps)?t.steps:[],o=!!R(e.goal),s=i.length>0,c=!!(r?.matched_plan_id||r?.matchedPlanId||r);return a(d,{title:`Plan formation`,subtitle:`See the compiler move from intent to decomposition, checks, and review-ready structure.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[{id:`intent-parsed`,label:`intent parsed`,active:o},{id:`decomposition`,label:`decomposition formed`,active:s},{id:`overlap`,label:`overlap checked`,active:c},{id:`validation`,label:`validation complete`,active:!!n}].map(e=>a(l,{tone:z(e.active),children:e.label},e.id))}),a(g,{title:`Formation summary`,children:a(`div`,{className:`text-slate-200`,children:s?`The current draft has ${i.length} planned step${i.length===1?``:`s`} and is ready for downstream review.`:`The planner has not yet produced a step decomposition for this intent.`})}),a(`div`,{className:`grid gap-2`,children:i.slice(0,4).map((e,t)=>{let n=R(e?.step_id||e?.stepId||`step-${t+1}`),r=R(e?.objective||e?.title||`Untitled step`),o=R(e?.agent_role||e?.agentRole||`n/a`);return a(g,{title:`Node ${t+1}`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:a(`span`,{className:`text-slate-100`,children:r})}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`agent: `,o]}),t<Math.min(i.length,4)-1?a(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-slate-500`,children:[a(`span`,{className:`h-px flex-1 bg-white/10`}),a(`span`,{children:`→`}),a(`span`,{className:`h-px flex-1 bg-white/10`})]}):null]},n)})})]})})}function me(){return a(`div`,{className:`relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-none border border-white/5 bg-black/40`,children:[a(`div`,{className:`absolute inset-0 opacity-20`,children:[a(`div`,{className:`tcp-shell-glow tcp-shell-glow-a opacity-50`}),a(`div`,{className:`tcp-shell-glow tcp-shell-glow-b opacity-30`})]}),a(`div`,{className:`relative z-10 grid w-full gap-5 px-6 py-6`,children:[a(s,{className:`mx-auto aspect-square w-full max-w-[17rem]`,mode:`panel`}),a(`div`,{className:`grid gap-2`,children:[`Mapping objective into shared workflow lanes`,`Scoring schedule and workspace constraints`,`Composing a mission draft with recovery steps`].map((e,t)=>a(`div`,{className:`grid gap-1 border border-white/5 bg-black/35 px-3 py-2`,children:[a(`div`,{className:`flex items-center justify-between gap-3`,children:[a(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.22em] text-slate-300`,children:e}),a(`span`,{className:`text-[10px] uppercase tracking-[0.22em] text-amber-200/75`,children:`Live`})]}),a(o.div,{className:`h-1.5 origin-left bg-[linear-gradient(90deg,rgba(245,158,11,0.18),rgba(255,233,171,0.94),rgba(245,158,11,0.18))]`,animate:{scaleX:[.22,.94,.38]},transition:{duration:1.8,ease:`easeInOut`,repeat:1/0,delay:t*.22}})]},e))})]}),a(`div`,{className:`absolute inset-x-0 bottom-6 text-center`,children:a(`div`,{className:`inline-flex items-center gap-2 rounded-none border border-primary/20 bg-black/60 px-4 py-2 backdrop-blur-md`,children:[a(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-primary`}),a(`span`,{className:`font-display text-xs font-semibold uppercase tracking-widest text-primary`,children:`Synthesizing Plan Flow`})]})})]})}var he=`tcp.intent-planner.v1`,B=`tcp.intent-planner.saved.v1`,V=`tcp.intent-planner.history.v1`;function H(e){return String(e||``).trim()}function ge(e){return`${he}:${H(e)||`default`}`}function _e(e){return`${B}:${H(e)||`default`}`}function ve(e){return`${V}:${H(e)||`default`}`}function ye(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!=`object`?null:n}catch{return null}}function be(e,t){if(typeof localStorage>`u`)return null;let n=Date.now();try{return localStorage.setItem(e,JSON.stringify({...t,updatedAtMs:n})),n}catch{return null}}function xe(e,t){let n=t.validationReport||{},r=t.overlapAnalysis||{},i=Array.isArray(t.planningConversation?.messages)?t.planningConversation.messages:Array.isArray(t.conversation?.messages)?t.conversation.messages:[];return{storageKey:e,name:H(t.name||t.title||t.brief?.goal||t.goal)||`Untitled planner draft`,updatedAtMs:Number(t.updatedAtMs||0)||0,planId:H(t.planPackage?.plan_id||t.planPreview?.plan_id||t.plan?.plan_id),planRevision:H(t.planPackage?.plan_revision||t.planPackageBundle?.scope_snapshot?.plan_revision||t.planPackageBundle?.scopeSnapshot?.planRevision),briefGoal:H(t.brief?.goal||t.goal),targetSurface:H(t.brief?.targetSurface||t.targetSurface),planningHorizon:H(t.brief?.planningHorizon||t.planningHorizon),messageCount:i.length,blockerCount:Number(n.blocker_count||n.blockerCount||0)||0,warningCount:Number(n.warning_count||n.warningCount||0)||0,hasOverlapMatch:!!H(r.matched_plan_id||r.matchedPlanId||r.match_layer)}}function U(e){return H(e).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function Se(e,t,n){if(typeof localStorage>`u`)return null;let r=Date.now(),i=`${e}:${U(t)||`draft`}:${r}`;try{return localStorage.setItem(i,JSON.stringify({...n,name:H(t)||`Untitled planner draft`,updatedAtMs:r})),{storageKey:i,updatedAtMs:r}}catch{return null}}function Ce(e){if(typeof localStorage>`u`)return[];let t=[];try{for(let n=0;n<localStorage.length;n+=1){let r=localStorage.key(n);if(!r||!r.startsWith(`${e}:`))continue;let i=localStorage.getItem(r);if(!i)continue;let a=JSON.parse(i);!a||typeof a!=`object`||t.push(xe(r,a))}}catch{return[]}return t.sort((e,t)=>t.updatedAtMs-e.updatedAtMs)}function we(e){Ae(e)}function Te(e){return JSON.stringify({goal:H(e.brief?.goal||e.goal),planId:H(e.planPreview?.plan_id||e.plan?.plan_id),planRevision:H(e.planPackage?.plan_revision||e.planPackageBundle?.scope_snapshot?.plan_revision),changeSummary:Array.isArray(e.planningChangeSummary)?e.planningChangeSummary:Array.isArray(e.changeSummary)?e.changeSummary:[],conversationLength:Array.isArray(e.planningConversation?.messages)?e.planningConversation.messages.length:Array.isArray(e.conversation?.messages)?e.conversation.messages.length:0,plannerError:H(e.plannerError)})}function Ee(e,t,n=24){if(typeof localStorage>`u`)return null;let r=Date.now(),i={...t,entryId:`${r}`,updatedAtMs:r,fingerprint:Te(t)};try{let t=ye(e)||[],r=Array.isArray(t)?t[0]:null;if(r?.fingerprint&&r.fingerprint===i.fingerprint)return r.entryId||null;let a=[i,...Array.isArray(t)?t:[]].slice(0,n);return localStorage.setItem(e,JSON.stringify(a)),i.entryId}catch{return null}}function De(e){let t=ye(e);return Array.isArray(t)?t.filter(e=>e&&typeof e==`object`).map(t=>({entryId:H(t.entryId)||`${Number(t.updatedAtMs||0)||0}`,...xe(e,t)})).sort((e,t)=>t.updatedAtMs-e.updatedAtMs):[]}function Oe(e,t){let n=ye(e);if(!Array.isArray(n))return null;let r=n.find(e=>H(e?.entryId)===H(t));return r&&typeof r==`object`?r:null}function ke(e,t){if(!(typeof localStorage>`u`))try{let n=ye(e);if(!Array.isArray(n))return;let r=n.filter(e=>H(e?.entryId)!==H(t));localStorage.setItem(e,JSON.stringify(r))}catch{}}function Ae(e){if(!(typeof localStorage>`u`))try{localStorage.removeItem(e)}catch{}}function je(e){return String(e||``).trim()}function Me(e){if(!e)return`unknown`;let t=Date.now()-e,n=Math.max(1,Math.round(t/6e4));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 Ne({storagePrefix:t,historyKey:i,draftName:o,onDraftNameChange:s,onSaveCurrentDraft:c,onOpenDraft:u,onDeleteDraft:p,onOpenHistory:ee,onDeleteHistory:m}){let[te,ne]=r(``),[re,ie]=r(!1),[_,v]=r(null);e(()=>{try{f()}catch{}});let y=Ce(t),b=De(i),x=je(te).toLowerCase(),S=n(()=>x?y.filter(e=>[e.name,e.planId,e.planRevision,e.briefGoal,e.targetSurface,e.planningHorizon].join(` `).toLowerCase().includes(x)):y,[y,x]),ae=n(()=>x?b.filter(e=>[e.name,e.planId,e.planRevision,e.briefGoal,e.targetSurface,e.planningHorizon].join(` `).toLowerCase().includes(x)):b,[b,x]);return a(d,{title:`Saved intents`,subtitle:`Open, inspect, and reopen saved planning work from local storage.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(l,{tone:y.length?`ok`:`warn`,children:y.length?`${y.length} saved draft${y.length===1?``:`s`}`:`no saved drafts`}),a(l,{tone:b.length?`info`:`warn`,children:b.length?`${b.length} autosave snapshots`:`no autosave snapshots`})]}),a(`input`,{className:`tcp-input`,value:te,onChange:e=>ne(e.target.value),placeholder:`Filter saved drafts and autosaves`}),a(g,{title:`Save current draft`,children:a(`div`,{className:`grid gap-2`,children:[a(`input`,{className:`tcp-input`,value:o,onChange:e=>s(e.target.value),placeholder:`Name this intent`}),a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:c,children:`Save named intent`})]})}),S.length?a(`div`,{className:`grid gap-2`,children:S.slice(0,8).map(e=>a(g,{title:e.name,children:[a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(l,{tone:`ok`,children:e.targetSurface||`planner`}),a(l,{tone:`info`,children:e.planningHorizon||`unspecified horizon`}),a(l,{tone:e.hasOverlapMatch?`warn`:`ok`,children:e.hasOverlapMatch?`overlap match`:`no overlap`})]}),a(h,{metrics:[{label:`Updated`,value:e.updatedAtMs?new Date(e.updatedAtMs).toLocaleString():`unknown`,detail:Me(e.updatedAtMs)},{label:`Plan`,value:e.planId||`pending`},{label:`Revision`,value:e.planRevision||`pending`},{label:`Brief`,value:a(`span`,{className:`block text-xs line-clamp-3`,title:e.briefGoal||`no saved goal`,children:e.briefGoal||`no saved goal`})},{label:`Conversation`,value:`${e.messageCount} turn${e.messageCount===1?``:`s`}`},{label:`Validation`,value:`${e.blockerCount} blocker${e.blockerCount===1?``:`s`}`,detail:`${e.warningCount} warning${e.warningCount===1?``:`s`}`}],columns:`grid-cols-1 sm:grid-cols-2`}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>u(e.storageKey),children:[a(`i`,{"data-lucide":`folder-open`,className:`mr-1 h-3 w-3`}),`Reopen draft`]}),_===e.storageKey?a(`div`,{className:`flex items-center gap-2 rounded border border-red-500/20 bg-red-500/10 px-2 py-1`,children:[a(`span`,{className:`text-xs text-red-400`,children:`Confirm delete?`}),a(`button`,{type:`button`,className:`tcp-btn bg-red-500/20 text-red-300 border-red-500/50 hover:bg-red-500/30`,onClick:()=>{p(e.storageKey),v(null)},children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Confirm`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(null),children:`Cancel`})]}):a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(e.storageKey),children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Delete`]})]})]},e.storageKey))}):a(`div`,{className:`tcp-subtle text-xs`,children:`Save a planner draft and it will appear here for quick reopening.`}),a(g,{title:`Recent autosaves`,children:re?ae.length?a(`div`,{className:`grid gap-2`,children:ae.slice(0,8).map(e=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(l,{tone:`info`,children:e.targetSurface||`planner`}),a(l,{tone:`info`,children:e.planningHorizon||`unspecified horizon`}),a(l,{tone:e.hasOverlapMatch?`warn`:`ok`,children:e.hasOverlapMatch?`overlap match`:`no overlap`})]}),a(h,{metrics:[{label:`Updated`,value:e.updatedAtMs?new Date(e.updatedAtMs).toLocaleString():`unknown`,detail:Me(e.updatedAtMs)},{label:`Plan`,value:e.planId||`pending`},{label:`Revision`,value:e.planRevision||`pending`},{label:`Brief`,value:a(`span`,{className:`block text-xs line-clamp-3`,title:e.briefGoal||`no saved goal`,children:e.briefGoal||`no saved goal`})},{label:`Conversation`,value:`${e.messageCount} turn${e.messageCount===1?``:`s`}`},{label:`Validation`,value:`${e.blockerCount} blocker${e.blockerCount===1?``:`s`}`,detail:`${e.warningCount} warning${e.warningCount===1?``:`s`}`}],columns:`grid-cols-1 sm:grid-cols-2`}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>ee(e.entryId),children:[a(`i`,{"data-lucide":`folder-open`,className:`mr-1 h-3 w-3`}),`Reopen autosave`]}),_===e.entryId?a(`div`,{className:`flex items-center gap-2 rounded border border-red-500/20 bg-red-500/10 px-2 py-1`,children:[a(`span`,{className:`text-xs text-red-400`,children:`Confirm delete?`}),a(`button`,{type:`button`,className:`tcp-btn bg-red-500/20 text-red-300 border-red-500/50 hover:bg-red-500/30`,onClick:()=>{m(e.entryId),v(null)},children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Confirm`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(null),children:`Cancel`})]}):a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(e.entryId),children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Delete`]})]})]},e.entryId))}):a(`div`,{className:`tcp-subtle text-xs`,children:x?`No autosaves match the current filter.`:`Recent autosaved planner states will appear here as the plan evolves.`}):a(`button`,{type:`button`,className:`tcp-btn w-full justify-start text-xs`,onClick:()=>ie(!0),children:[a(`i`,{"data-lucide":`chevron-down`,className:`mr-1 h-3 w-3`}),`Show `,b.length,` autosaved snapshots`]})})]})})}var W={goal:``,workspaceRoot:``,targetSurface:`mission`,planningHorizon:`mixed`,outputExpectations:``,constraints:``,plannerProvider:``,plannerModel:``,selectedMcpServers:[]};function G(e){return String(e||``).trim()}function Pe(e){let t=Array.isArray(e)?e.map(e=>G(e)).filter(Boolean):[];return t.length?t.join(`, `):`—`}function Fe(e){let t=G(e?.source_platform),n=G(e?.created_by_agent||e?.requesting_actor);return t===`control_panel`&&(!n||n===`human`)?`human`:n||`—`}function Ie(e){let t=e?.preview_payload?.plan||{},n=G(t?.title||t?.original_prompt),r=Array.isArray(t?.steps)?t.steps.length:0,i=G(t?.schedule?.cron_expression||t?.schedule?.type||t?.schedule?.label),a=[n||`Workflow preview`];return r&&a.push(`${r} step${r===1?``:`s`}`),i&&a.push(i),a.join(` • `)}function Le(e){return(Array.isArray(e)?e:Array.isArray(e?.servers)?e.servers:e&&typeof e==`object`?Object.entries(e).map(([e,t])=>({name:e,...t})):[]).map(e=>({name:String(e?.name||``).trim(),connected:!!e?.connected,enabled:e?.enabled!==!1,transport:String(e?.transport||``).trim(),lastError:String(e?.last_error||e?.lastError||``).trim()})).filter(e=>e.name)}function Re(e){let t=G(e);return t?t.startsWith(`/`)?``:`Workspace root must be an absolute path.`:`Workspace root is required.`}function ze(e){switch(e){case`same_day`:return`same-day split work`;case`multi_day`:return`multi-day plan`;case`weekly`:return`weekly recurring work`;case`monthly`:return`monthly recurring work`;default:return`mixed one-time and recurring work`}}function Be(e){switch(e){case`automation`:return`workflow automation`;case`mission`:return`mission execution`;case`coding`:return`coding workflow`;default:return`orchestrator handoff`}}function Ve(e){return[G(e.goal),`Planning horizon: ${ze(e.planningHorizon)}.`,`Target surface: ${Be(e.targetSurface)}.`,G(e.workspaceRoot)?`Workspace root: ${G(e.workspaceRoot)}`:``,G(e.outputExpectations)?`Expected outputs:\n${G(e.outputExpectations)}`:``,G(e.constraints)?`Constraints:\n${G(e.constraints)}`:``,`Default knowledge behavior: project-scoped preflight reuse with promoted trust floor.`,`Use clarifying questions instead of guessing when important details are missing.`,`Prefer multi-agent decomposition, milestones, and timeline-aware work waves when appropriate.`,`Return a workflow plan that can later be handed off to Automations, Coder, or Orchestrator.`].filter(Boolean).join(`
|
|
5
|
-
`)}var He=`tandem.workflow.importHandoff.v1`,K=`tandem.workflow.plannerSeed`;function Ue(){try{let e=localStorage.getItem(He);if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function We(){try{let e=sessionStorage.getItem(K);if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function Ge(){try{let e=window.location.hash||``,t=e.includes(`?`)?e.slice(e.indexOf(`?`)+1):``,n=new URLSearchParams(t);return String(n.get(`session_id`)||``).trim()||``}catch{return``}}function Ke({api:o,client:s,toast:c,providerStatus:p,identity:h,navigate:g}){let[_,v]=r(W),[y,b]=r(``),[x,S]=r(`idle`),[C,w]=r(null),[T,E]=r(null),[D,O]=r([]),[se,k]=r(``),[A,j]=r(null),[M,N]=r({status:`none`}),[P,F]=r(null),[I,L]=r(null),[R,z]=r(null),[he,B]=r(null),[V,H]=r(null),[xe,U]=r(null),[Ce,Te]=r(``),[De,je]=r(!1),[Me,ze]=r(null),[Be,K]=r(!1),[Ke,qe]=r(``),[q,Je]=r(null),[J,Ye]=r(null),[Xe,Ze]=r(!1),[Qe,$e]=r(``),[et,tt]=r(``),nt=n(()=>Ge(),[]),rt=n(()=>ge(h.botName),[h.botName]),it=n(()=>_e(h.botName),[h.botName]),at=n(()=>ve(h.botName),[h.botName]),ot=i({queryKey:[`intent-planner`,`providers`,`catalog`],queryFn:()=>s.providers.catalog().catch(()=>({all:[]})),refetchInterval:3e4}),st=i({queryKey:[`intent-planner`,`providers`,`config`],queryFn:()=>s.providers.config().catch(()=>({})),refetchInterval:3e4}),ct=i({queryKey:[`intent-planner`,`mcp-servers`],queryFn:()=>s.mcp.list().catch(()=>({})),refetchInterval:1e4}),lt=i({queryKey:[`global`,`health`],queryFn:()=>s.health().catch(()=>({})),refetchInterval:3e4}),ut=i({queryKey:[`intent-planner`,`workspace-browser`,Qe],enabled:Xe&&!!Qe,queryFn:()=>o(`/api/orchestrator/workspaces/list?dir=${encodeURIComponent(Qe)}`,{method:`GET`}).catch(()=>({}))}),Y=G(J?.session_id||q?.session_id||nt),dt=i({queryKey:[`intent-planner`,`workflow-handoff`,Y],enabled:!!Y,queryFn:()=>s.workflowPlannerSessions.get(Y).catch(()=>({session:null}))}),ft=n(()=>te({providerCatalog:ot.data,providerConfig:st.data,defaultProvider:p.defaultProvider,defaultModel:p.defaultModel}),[p.defaultModel,p.defaultProvider,ot.data,st.data]),pt=n(()=>Le(ct.data),[ct.data]),mt=n(()=>pt.filter(e=>e.connected).map(e=>e.name),[pt]),ht=!!(G(_.plannerProvider)&&G(_.plannerModel)||G(p.defaultProvider)&&G(p.defaultModel)),gt=n(()=>ee(T),[T]),_t=x===`generating`||x===`revising`,X=!!G(C?.plan_id||C?.planId),vt=!!(X||I||P||V||he||D.length),yt=x===`generating`?`Drafting plan`:x===`revising`?`Revising plan`:x===`clarifying`?`Waiting for clarification`:``,bt=x===`clarifying`?`Reply to the planner's question so it can continue shaping the mission.`:`The planner is composing a governed workflow plan from your intent.`,xt=Array.isArray(ut.data?.directories)?ut.data.directories:[],Z=dt.data?.session||null,St=G(Z?.source_kind||q?.source_kind||``),Q=Z?.draft?.review||null,$=Z?.planning||null,Ct=(Q?.preview_payload||null)?.plan||null,wt=G(Ct?.original_prompt||Z?.goal||G(J?.prompt||``)||Z?.title||`—`),Tt=G($?.draft_id||$?.linked_draft_plan_id||Z?.current_plan_id||Ct?.plan_id||`—`),Et=Q?`review ready`:`draft in progress`,Dt=G(Q?.validation_state||$?.validation_state||`incomplete`),Ot=G(Q?.approval_status||$?.approval_status||`not_required`),kt=G(J?.prompt||``),At=String(ut.data?.parent||``).trim(),jt=String(ut.data?.dir||Qe||``).trim(),Mt=n(()=>{let e=String(et||``).trim().toLowerCase();return e?xt.filter(t=>String(t?.name||t?.path||``).trim().toLowerCase().includes(e)):xt},[et,xt]),Nt=Re(_.workspaceRoot);e(()=>{let e=String(lt.data?.workspaceRoot||lt.data?.workspace_root||``).trim();e&&v(t=>G(t.workspaceRoot)?t:{...t,workspaceRoot:e})},[lt.data]),e(()=>{Je(Ue()),Ye(We())},[]),e(()=>{if(!Y||!Z||Z.session_id!==Y||Ke===Z.session_id)return;let e=Z.draft?.current_plan||Z.draft?.initial_plan;if(!e)return;v({...W,goal:G(Z.goal||Z.title||e.original_prompt||e.title),workspaceRoot:G(Z.workspace_root||e.workspace_root),targetSurface:W.targetSurface,planningHorizon:W.planningHorizon,outputExpectations:G(e.description),constraints:``,plannerProvider:G(Z.planner_provider),plannerModel:G(Z.planner_model),selectedMcpServers:Array.isArray(e.allowed_mcp_servers)?e.allowed_mcp_servers.map(e=>G(e)).filter(Boolean):[]}),b(G(Z.goal||Z.title||e.normalized_prompt||e.original_prompt)),w(e),E(Z.draft?.conversation||null),O([]),k(``),j(Z.import_scope_snapshot||Z.draft?.planner_diagnostics||null),F(null),L(null),z(null),B(null),H(null),U(null);let t=Z.draft?.review||null,n=t?.preview_payload||null;t&&n&&(j(n.planner_diagnostics||Z.draft?.planner_diagnostics||null),F(n.plan_package_validation||null),L(n.plan_package||null),z(n.plan_package_bundle||null),B(n.plan_package_replay||null),H(n.overlap_analysis||null),U(n.teaching_library||null),ze(Number.isFinite(Number(t.updated_at_ms))?Number(t.updated_at_ms):Number.isFinite(Number(Z.updated_at_ms))?Number(Z.updated_at_ms):null)),S(`idle`),K(!0),je(!0),Te(G(Z.title||e.title)),qe(Z.session_id),q?.session_id===Y&&Wt(!1)},[Z,Ke,Y,q?.session_id]),e(()=>{if(!J?.prompt||Y||De&&G(y||_.goal))return;let e=G(J.prompt);e&&(v(t=>({...t,goal:e,workspaceRoot:G(J.workspace_root||t.workspaceRoot)})),b(e),S(`idle`),K(!1),je(!0))},[_.goal,De,Y,y,J]);let Pt=()=>{Ae(rt),v(W),b(``),S(`idle`),w(null),E(null),O([]),k(``),j(null),N({status:`none`}),F(null),L(null),z(null),B(null),H(null),U(null),ze(null),K(!1),Te(``)},Ft=e=>e?(v({...W,goal:G(e.brief?.goal||e.goal),workspaceRoot:G(e.brief?.workspaceRoot||e.workspaceRoot),targetSurface:e.brief?.targetSurface||e.targetSurface||W.targetSurface,planningHorizon:e.brief?.planningHorizon||e.planningHorizon||W.planningHorizon,outputExpectations:G(e.brief?.outputExpectations||e.outputExpectations),constraints:G(e.brief?.constraints||e.constraints),plannerProvider:G(e.brief?.plannerProvider||e.plannerProvider),plannerModel:G(e.brief?.plannerModel||e.plannerModel),selectedMcpServers:Array.isArray(e.brief?.selectedMcpServers)?e.brief.selectedMcpServers.map(e=>G(e)).filter(Boolean):Array.isArray(e.selectedMcpServers)?e.selectedMcpServers.map(e=>G(e)).filter(Boolean):[]}),b(G(e.plannerInput)),S(`idle`),w(e.planPreview||e.planPreviewJson||e.plan||null),E(e.planningConversation||e.conversation||null),O(Array.isArray(e.planningChangeSummary||e.changeSummary)?(e.planningChangeSummary||e.changeSummary).map(e=>G(e)).filter(Boolean):[]),k(G(e.plannerError)),j(e.plannerDiagnostics||null),F(e.validationReport||null),L(e.planPackage||null),z(e.planPackageBundle||null),B(e.planPackageReplay||null),H(e.overlapAnalysis||null),U(e.teachingLibrary||null),ze(Number.isFinite(Number(e.updatedAtMs))?Number(e.updatedAtMs):null),K(!0),je(!0),Te(G(e.name||e.title||e.brief?.goal||e.goal)),!0):!1;e(()=>{je(!1);let e=ye(rt);if(!e){je(!0),K(!1);return}Ft(e)},[rt]),e(()=>{try{f()}catch{}}),e(()=>{if(!De)return;let e={name:Ce,brief:_,plannerInput:y,planPreview:C,planningConversation:T,planningChangeSummary:D,plannerError:se,plannerDiagnostics:A,validationReport:P,planPackage:I,planPackageBundle:R,planPackageReplay:he,overlapAnalysis:V,teachingLibrary:xe},t=be(rt,e);typeof t==`number`&&ze(t),Ee(at,e)},[_,V,rt,I,R,he,C,A,se,y,D,T,De,at,Ce,xe,P]);let It=async e=>{let t=G(e||y||_.goal),n=G(_.workspaceRoot);if(!t){c(`warn`,`Describe the intent you want the planner to turn into a long-horizon plan.`);return}if(!n){c(`warn`,`Workspace root is required so the planner can inspect the target workspace.`);return}if(!n.startsWith(`/`)){c(`warn`,`Workspace root must be an absolute path.`);return}S(`generating`),k(``),j(null),v(e=>({...e,goal:t}));try{let e=await s.workflowPlans.chatStart({prompt:Ve({..._,goal:t}),plan_source:`intent_planner_page`,workspace_root:n,allowed_mcp_servers:_.selectedMcpServers.length?_.selectedMcpServers:mt,operator_preferences:{planner_target_surface:_.targetSurface,planning_horizon:_.planningHorizon,expected_outputs:G(_.outputExpectations),constraints:G(_.constraints),planner_provider:G(_.plannerProvider),planner_model:G(_.plannerModel),...ne(t),...m(t)}});w(e?.plan||null),E(e?.conversation||null),O([]),j(e?.planner_diagnostics||null),F(e?.plan_package_validation||null),L(e?.plan_package||null),z(e?.plan_package_bundle||null),B(e?.plan_package_replay||null),H(e?.overlap_analysis||null),U(e?.teaching_library||null),K(!1);let r=typeof e?.clarifier?.question==`string`?String(e.clarifier.question):``,i=Array.isArray(e?.clarifier?.options)?e.clarifier.options.map(e=>({id:G(e?.id),label:G(e?.label)})).filter(e=>e.id&&e.label):[];r&&k(r),r&&i.length>0?(N({status:`waiting`,question:r,options:i}),S(`clarifying`)):(N({status:`none`}),S(`idle`)),b(``),c(`ok`,r?`Planner needs clarification before it can refine the mission.`:`Planner generated a draft mission plan.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),N({status:`none`}),S(`idle`),c(`err`,t)}},Lt=async e=>{let t=G(C?.plan_id||C?.planId);if(!t){c(`warn`,`Start a planning session before revising the plan.`);return}let n=G(e??y);if(!n){c(`warn`,`Add a message for the planner first.`);return}S(`revising`),k(``),j(null);try{let e=await s.workflowPlans.chatMessage({plan_id:t,message:n});w(e?.plan||null),E(e?.conversation||null),O(Array.isArray(e?.change_summary)?e.change_summary.map(e=>G(e)).filter(Boolean):[]),j(e?.planner_diagnostics||null),F(e?.plan_package_validation||null),L(e?.plan_package||null),z(e?.plan_package_bundle||null),B(e?.plan_package_replay||null),H(e?.overlap_analysis||null),U(e?.teaching_library||null),K(!1);let r=typeof e?.clarifier?.question==`string`?String(e.clarifier.question):``,i=Array.isArray(e?.clarifier?.options)?e.clarifier.options.map(e=>({id:G(e?.id),label:G(e?.label)})).filter(e=>e.id&&e.label):[];r&&k(r),r&&i.length>0?(N({status:`waiting`,question:r,options:i}),S(`clarifying`)):(N({status:`none`}),S(`idle`)),b(``),c(`ok`,`Planner revised the draft plan.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),N({status:`none`}),S(`idle`),c(`err`,t)}},Rt=async()=>{let e=G(C?.plan_id||C?.planId);if(!e||!s.workflowPlans.chatReset){Pt(),c(`ok`,`Planner draft reset.`);return}try{let t=await s.workflowPlans.chatReset({plan_id:e});w(t?.plan||null),E(t?.conversation||null),O([]),k(``),j(t?.planner_diagnostics||null),F(t?.plan_package_validation||null),L(t?.plan_package||null),z(t?.plan_package_bundle||null),B(t?.plan_package_replay||null),H(t?.overlap_analysis||null),U(t?.teaching_library||null),N({status:`none`}),S(`idle`),b(``),K(!1),c(`ok`,`Planner session reset.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),c(`err`,t)}},zt=()=>{let e=G(Ce||_.goal||C?.title||C?.plan_id);if(!e){c(`warn`,`Name the planner draft before saving it as a saved intent.`);return}if(!Se(it,e,{name:e,brief:_,plannerInput:y,planPreview:C,planningConversation:T,planningChangeSummary:D,plannerError:se,plannerDiagnostics:A,validationReport:P,planPackage:I,planPackageBundle:R,planPackageReplay:he,overlapAnalysis:V,teachingLibrary:xe})){c(`err`,`Unable to save the named planner draft.`);return}Te(e),K(!1),c(`ok`,`Saved planner draft “${e}”.`)},Bt=e=>{let t=ye(e);if(!t){c(`warn`,`That saved planner draft could not be loaded.`);return}if(!Ft(t)){c(`warn`,`That saved planner draft was empty.`);return}c(`ok`,`Reopened planner draft “${G(t.name||t.title)}”.`)},Vt=e=>{we(e),K(!1),c(`ok`,`Deleted the saved planner draft.`)},Ht=e=>{let t=Oe(at,e);if(!t){c(`warn`,`That autosaved planner state could not be loaded.`);return}if(!Ft(t)){c(`warn`,`That autosaved planner state was empty.`);return}c(`ok`,`Reopened a recent autosaved planner state.`)},Ut=e=>{ke(at,e),K(!1),c(`ok`,`Deleted the autosaved planner state.`)},Wt=(e=!0)=>{try{localStorage.removeItem(He)}catch{}Je(null),e&&c(`ok`,`Cleared the imported workflow handoff.`)};return a(u,{className:`flex flex-col min-h-0 h-full overflow-hidden`,children:[q?a(d,{title:`Imported workflow handoff`,subtitle:`This durable session was created from an imported bundle. Open the workflow center to inspect, revise, or continue it.`,className:`mb-4`,actions:a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn-secondary`,onClick:()=>g(`workflows`),children:`Open workflow center`}),a(`button`,{type:`button`,className:`tcp-btn-secondary`,onClick:()=>Wt(),children:`Dismiss`})]}),children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:St===`imported_bundle`?`warn`:`info`,children:St||`imported_bundle`}),a(l,{tone:`ghost`,children:G(q.session_id)})]}),a(`div`,{className:`grid gap-1 md:grid-cols-2`,children:[a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Title`}),a(`div`,{children:G(Z?.title||q.title||`Imported workflow`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Project`}),a(`div`,{children:G(Z?.project_slug||q.project_slug||`workflow-imports`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Bundle digest`}),a(`div`,{children:G(Z?.source_bundle_digest||q.source_bundle_digest||`—`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Current plan id`}),a(`div`,{children:G(Z?.current_plan_id||q.current_plan_id||`—`)})]})]})]})}):null,(Y||kt)&&!q?a(d,{title:`Workflow planner handoff`,subtitle:`This planner session was seeded from chat or a channel and will resume the governed draft here.`,className:`mb-4`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(l,{tone:Y?`info`:`warn`,children:Y?`session`:`seed`}),Y?a(l,{tone:`ghost`,children:Y}):null]}),a(`div`,{className:`grid gap-1 md:grid-cols-2 xl:grid-cols-3`,children:[a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Original request`}),a(`div`,{children:G(wt||kt||`Workflow planner`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Source platform`}),a(`div`,{children:G($?.source_platform||J?.source_platform||`chat`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Source channel`}),a(`div`,{children:G($?.source_channel||J?.source_channel||`—`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Planning mode`}),a(`div`,{children:G($?.mode||`workflow_planning`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Created by / actor`}),a(`div`,{children:G(Fe($))})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Draft id`}),a(`div`,{children:Tt})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Draft status`}),a(`div`,{children:Et})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Validation state`}),a(`div`,{children:Dt})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Validation status`}),a(`div`,{children:G(Q?.validation_status||$?.validation_status||`pending`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Approval requirements`}),a(`div`,{children:Ot})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Docs MCP`}),a(`div`,{children:Q?.docs_mcp_used?`used in the draft`:`not used yet`})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Required capabilities`}),a(`div`,{children:Pe(Q?.required_capabilities)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Blocked capabilities`}),a(`div`,{children:Pe(Q?.blocked_capabilities)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Missing requirements`}),a(`div`,{children:Pe($?.missing_requirements)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Workflow preview`}),a(`div`,{children:Ie(Q)})]})]})]})}):null,a(`div`,{className:`grid flex-1 gap-4 min-h-0 xl:grid-cols-[minmax(400px,0.8fr)_minmax(0,1.2fr)]`,children:[a(`div`,{className:`flex flex-col gap-4 min-h-0 h-full overflow-y-auto pr-1`,children:[a(d,{title:`Intent brief`,subtitle:`Describe the mission goal.`,className:`flex flex-col shrink-0`,actions:a(`div`,{className:`flex flex-wrap gap-2 text-[10px]`,children:[a(l,{tone:`ok`,children:`intent → plan`}),Be?a(l,{tone:`info`,children:`restored`}):null]}),children:a(ae,{draft:_,onChange:v,providerOptions:ft,plannerCanUseLlm:ht,basePlannerLabel:G(p.defaultProvider)&&G(p.defaultModel)?`${G(p.defaultProvider)} / ${G(p.defaultModel)}`:`not configured`,availableMcpServers:pt,workspaceRootError:Nt,workspaceBrowserOpen:Xe,workspaceBrowserDir:Qe,workspaceBrowserSearch:et,workspaceBrowserParentDir:At,workspaceBrowserCurrentDir:jt,workspaceBrowserDirectories:Mt,onOpenWorkspaceBrowser:()=>{$e(String(_.workspaceRoot||lt.data?.workspaceRoot||lt.data?.workspace_root||`/`).trim()||`/`),tt(``),Ze(!0)},onCloseWorkspaceBrowser:()=>{Ze(!1),tt(``)},onClearWorkspaceRoot:()=>v(e=>({...e,workspaceRoot:``})),onWorkspaceBrowserSearchChange:tt,onWorkspaceBrowserParent:()=>{At&&$e(At)},onWorkspaceBrowserDirectory:e=>$e(e),onSelectWorkspaceDirectory:()=>{jt&&(v(e=>({...e,workspaceRoot:jt})),Ze(!1),tt(``),c(`ok`,`Workspace selected: ${jt}`))},onReset:()=>{Pt(),c(`ok`,`Started a new empty mission draft.`)},disabled:_t})}),a(Ne,{storagePrefix:it,historyKey:at,draftName:Ce,onDraftNameChange:Te,onSaveCurrentDraft:zt,onOpenDraft:Bt,onDeleteDraft:Vt,onOpenHistory:Ht,onDeleteHistory:Ut})]}),a(`div`,{className:`flex flex-col gap-4 min-h-0 h-full overflow-y-auto pr-1 pb-10`,children:[a(d,{title:`Planner conversation`,subtitle:`Shape the full workflow plan.`,className:`flex flex-col shrink-0 h-[500px]`,actions:a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>void It(),disabled:_t,children:[a(`i`,{"data-lucide":X?`refresh-cw`:`play`,className:`mr-1 h-3 w-3`}),X?`Regenerate`:`Start planning`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>void Rt(),title:`Reset session`,children:a(`i`,{"data-lucide":`rotate-ccw`})})]}),children:a(`div`,{className:`tcp-chat-container flex-1`,children:[Me?a(`div`,{className:`mb-3 rounded-xl border border-white/5 bg-black/20 px-3 py-2 text-[10px] text-slate-500`,children:[`Last autosave: `,new Date(Me).toLocaleTimeString()]}):null,a(`div`,{className:`tcp-chat-fill flex flex-col`,children:a(re,{messages:gt,emptyText:`Describe your mission intent to start.`,inputValue:y,inputPlaceholder:X?`Refine the plan...`:`Describe the mission and outcome...`,sendLabel:X?`Send to planner`:`Start plan`,onInputChange:b,onSend:()=>void(X?Lt(y):It(y)),sendDisabled:_t||!G(y),inputDisabled:_t,statusTitle:yt,statusDetail:_t?bt:``,questionTitle:`Planner question`,questionText:M.status===`waiting`?M.question:``,quickReplies:M.status===`waiting`&&M.options||[],onQuickReply:e=>void Lt(e.label),questionHint:`Reply with more detail.`,botIdentity:{botName:`Tandem Planner`,botAvatarUrl:h.botAvatarUrl},showThinking:x===`generating`||x===`revising`,thinkingText:x===`revising`?`Revising plan`:`Drafting plan`})}),a(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:()=>void(X?Lt(y||_.goal):It()),disabled:_t||!X&&!G(_.goal)||!G(_.workspaceRoot),children:X?`Revise draft`:`Generate draft`}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>b(_.goal),disabled:_t||!G(_.goal),children:`Seed from brief`})]})]})}),_t?a(d,{title:`Generating plan flow`,subtitle:`The planner is synthesizing structure.`,className:`shrink-0`,children:a(me,{})}):null,vt?a(t,{children:[a(fe,{brief:_,planPreview:C,planPackage:I,planPackageBundle:R,validationReport:P,overlapAnalysis:V,teachingLibrary:xe,navigate:g,toast:c}),a(pe,{brief:_,planPreview:C,validationReport:P,overlapAnalysis:V}),a(ce,{brief:_,planPreview:C}),a(oe,{planPreview:C,brief:_,planPackage:I,planPackageBundle:R}),a(le,{validationReport:P}),a(ue,{overlapAnalysis:V}),a(de,{planPackageReplay:he}),a(ie,{plannerDiagnostics:A,teachingLibrary:xe,planningChangeSummary:D})]}):null]})]})]})}export{Ke as IntentPlannerPage};
|
|
3
|
+
`),onInput:e=>n({...t,outputExpectations:e.target.value,constraints:``}),placeholder:`Optional: add anything the planner must produce or respect.`,disabled:O})]}),a(`div`,{className:`rounded-xl border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:a(`div`,{children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Planner model`}),a(`div`,{className:`tcp-subtle text-xs`,children:[`Base model: `,s||`not configured`]})]})}),a(p,{providerLabel:`Planner provider`,modelLabel:`Planner model`,draft:{provider:t.plannerProvider,model:t.plannerModel},providers:i,onChange:({provider:e,model:r})=>n({...t,plannerProvider:e,plannerModel:r}),inheritLabel:`Workspace default`,disabled:O})]}),a(`div`,{className:`rounded-xl border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-3`,children:[a(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`MCP sources`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:`Optional: limit which connected systems the planner should reference.`})]}),a(`div`,{className:`flex flex-wrap gap-2`,children:c.length?c.map(e=>a(`button`,{type:`button`,className:t.selectedMcpServers.includes(e.name)?`tcp-btn-primary h-8 px-3 text-xs`:`tcp-btn h-8 px-3 text-xs`,onClick:()=>n({...t,selectedMcpServers:x(t.selectedMcpServers,e.name)}),disabled:O||!e.connected,title:e.lastError||e.transport||``,children:e.name},e.name)):a(`div`,{className:`tcp-subtle text-xs`,children:`No MCP servers are currently connected.`})})]})]}):null]})]})}function C(e){return String(e||``).trim()}function w(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function T(e){let t=w(e?.knowledge);if(Object.keys(t).length)return t;let n=w(w(w(e?.metadata).builder).knowledge);return Object.keys(n).length?n:null}function E(e,t=`n/a`){let n=Array.isArray(e)?e.map(e=>{if(e&&typeof e==`object`){let t=C(e.scope),n=C(e.namespace);if(t&&n)return`${t}:${n}`;if(t)return t}return C(e)}).filter(Boolean):[];return n.length?n.join(`, `):t}function oe({planPreview:e,brief:t,planPackage:n,planPackageBundle:r}){let i=Array.isArray(e?.steps)?e.steps:[],o=Array.isArray(n?.routine_graph)?n.routine_graph:[],s=w(r?.scope_snapshot||r?.scopeSnapshot),c=w(s.output_roots||s.outputRoots),l=i.map(T).find(Boolean)||null,d=m(t.goal).rollout;return a(f,{title:`Plan summary`,subtitle:`Review the compiler draft and bundle snapshot before handing it off downstream.`,children:e?a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:n?`ok`:`warn`,children:n?`plan package ready`:`plan package pending`}),a(u,{tone:r?`ok`:`warn`,children:r?`bundle ready`:`bundle pending`}),a(u,{tone:`info`,children:t.targetSurface.replace(`_`,` `)}),a(u,{tone:`info`,children:t.planningHorizon.replace(`_`,` `)})]}),a(h,{metrics:[{label:`Plan title`,value:C(e?.title)||C(e?.plan_id)||`Draft`},{label:`Plan id`,value:C(e?.plan_id||e?.planId)||`pending`},{label:`Routines`,value:o.length||`pending`},{label:`Steps`,value:i.length||`pending`}]}),a(g,{title:`Description`,children:a(`div`,{className:`text-slate-200`,children:C(e?.description)||`No description returned yet.`})}),a(g,{title:`Knowledge defaults`,description:`The compiler now carries reusable knowledge defaults alongside each step.`,children:l?a(`div`,{className:`grid gap-2 text-xs text-slate-200`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:l.enabled===!1?`warn`:`ok`,children:l.enabled===!1?`knowledge off`:`knowledge on`}),a(u,{tone:`info`,children:[`reuse: `,C(l.reuse_mode||`preflight`)]}),a(u,{tone:`info`,children:[`trust: `,C(l.trust_floor||`promoted`)]})]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`subject:`,` `,C(l.subject||e?.original_prompt||`n/a`)]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`reads: `,E(l.read_spaces,`project`)]}),a(`div`,{className:`tcp-subtle text-xs`,children:[`promotes: `,E(l.promote_spaces,`project`)]})]}):a(`div`,{className:`tcp-subtle text-xs`,children:`No knowledge defaults surfaced yet; the plan compiler may not have normalized the step metadata.`})}),a(g,{title:`Rollout guardrails`,description:`Use these checks when expanding reusable knowledge across workflows.`,children:a(`div`,{className:`grid gap-2 text-xs text-slate-200`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:`warn`,children:`project-first pilot`}),a(u,{tone:`warn`,children:`promoted only`}),a(u,{tone:`warn`,children:`approved_default rare`})]}),a(`div`,{className:`tcp-subtle`,children:d.rollout_mode===`project_first_pilot`?`Run a project-scoped pilot first, then widen only after the reuse path is stable.`:`Rollout guidance is missing or incomplete.`}),a(`ul`,{className:`space-y-1`,children:d.guardrails.map(e=>a(`li`,{children:[`• `,e]},e))})]})}),a(g,{title:`Bundle snapshot`,children:a(h,{metrics:[{label:`Bundle version`,value:C(r?.bundle_version||r?.bundleVersion)||`pending`},{label:`Snapshot plan`,value:C(s.plan_id||s.planId)||`pending`},{label:`Snapshot revision`,value:C(s.plan_revision||s.planRevision)||`pending`},{label:`Output roots`,value:a(`div`,{className:`text-xs text-slate-200`,children:[c.plan?a(`div`,{children:[`plan: `,C(c.plan)]}):null,c.history?a(`div`,{children:[`history: `,C(c.history)]}):null,c.proof?a(`div`,{children:[`proof: `,C(c.proof)]}):null,c.drafts?a(`div`,{children:[`drafts: `,C(c.drafts)]}):null,!c.plan&&!c.history&&!c.proof&&!c.drafts?a(`div`,{className:`tcp-subtle`,children:`No bundle roots available yet.`}):null]})}]})}),a(g,{title:`Step graph`,children:a(`div`,{className:`grid gap-2`,children:i.length?i.map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:`info`,children:[`Step `,t+1]}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:C(e?.objective)||C(e?.title)||`Untitled step`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:[`role: `,C(e?.agent_role||e?.agentRole)||`n/a`]}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`depends on:`,` `,Array.isArray(e?.depends_on)&&e.depends_on.length?e.depends_on.join(`, `):`none`]}),T(e)?a(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px]`,children:[a(u,{tone:T(e)?.enabled===!1?`warn`:`ok`,children:T(e)?.enabled===!1?`knowledge off`:`knowledge on`}),a(u,{tone:`info`,children:[`reuse: `,C(T(e)?.reuse_mode||`preflight`)]}),a(u,{tone:`info`,children:[`trust: `,C(T(e)?.trust_floor||`promoted`)]}),a(`span`,{className:`tcp-subtle text-[11px]`,children:[`subject: `,C(T(e)?.subject||`inferred`)]})]}):null]},C(e?.step_id||e?.stepId||t))):a(`div`,{className:`tcp-subtle text-xs`,children:`No step graph has been returned yet.`})})})]}):a(`div`,{className:`tcp-subtle text-sm`,children:`No plan yet. Start with the intent brief and planner chat to generate a draft.`})})}function D(e){return String(e||``).trim()}function O(e){switch(e){case`same_day`:return 2;case`multi_day`:return 3;case`weekly`:return 2;case`monthly`:return 3;default:return 3}}function se(e,t,n){return t===1?`One-time delivery`:e===0?`Setup and framing`:e===t-1?n===`weekly`||n===`monthly`||n===`mixed`?`Recurring follow-up`:`Review and handoff`:`Core delivery`}function k(e,t){let n=Math.max(1,Math.min(O(t),e.length||1)),r=Math.max(1,Math.ceil((e.length||1)/n)),i=[];for(let a=0;a<n;a+=1){let o=e.slice(a*r,(a+1)*r);!o.length&&e.length||i.push({index:a,title:se(a,n,t),steps:o})}return i.length||i.push({index:0,title:se(0,1,t),steps:[]}),i}function ce({brief:e,planPreview:t}){let n=Array.isArray(t?.steps)?t.steps:[],r=k(n,e.planningHorizon),i=e.planningHorizon===`weekly`||e.planningHorizon===`monthly`||e.planningHorizon===`mixed`;return a(f,{title:`Timeline`,subtitle:`Preview the mission as time waves and milestones instead of one flattened schedule.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:`info`,children:e.planningHorizon.replace(`_`,` `)}),a(u,{tone:i?`ok`:`info`,children:i?`one-time + recurring`:`one-time only`}),a(u,{tone:n.length?`ok`:`warn`,children:n.length?`${n.length} step${n.length===1?``:`s`}`:`no steps yet`})]}),a(g,{title:`Timeline model`,children:a(`div`,{className:`text-slate-200`,children:i?`This horizon is treated as a mix of one-time setup work plus recurring follow-up waves.`:`This horizon is treated as one-time work split into sequential execution waves.`})}),a(`div`,{className:`grid gap-2`,children:r.map(e=>a(g,{title:`Milestone ${e.index+1}`,description:e.title,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:e.index===r.length-1&&i?`ok`:`info`,children:e.title}),a(`span`,{className:`tcp-subtle text-xs`,children:e.steps.length?`${e.steps.length} step${e.steps.length===1?``:`s`}`:`no assigned steps`})]}),e.steps.length?a(`div`,{className:`mt-3 grid gap-2`,children:e.steps.map((t,n)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-2`,children:[a(`div`,{className:`text-sm font-medium text-slate-100`,children:D(t?.objective)||D(t?.title)||`Untitled step`}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`role: `,D(t?.agent_role||t?.agentRole)||`n/a`]})]},D(t?.step_id||t?.stepId||`${e.index}-${n}`)))}):null]},`${e.index}-${e.title}`))})]})})}function A(e){return String(e||``).trim()}function le({validationReport:e}){let t=Array.isArray(e?.issues)?e.issues:[],n=t.filter(e=>e?.blocking),r=t.filter(e=>!e?.blocking);return a(f,{title:`Validation`,subtitle:`Compiler checks that gate preview, apply, and activation.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:e?`ok`:`warn`,children:e?`report ready`:`report pending`}),a(u,{tone:Number(e?.ready_for_apply||e?.readyForApply)?`ok`:`warn`,children:Number(e?.ready_for_apply||e?.readyForApply)?`ready for apply`:`apply blocked`}),a(u,{tone:Number(e?.ready_for_activation||e?.readyForActivation)?`ok`:`warn`,children:Number(e?.ready_for_activation||e?.readyForActivation)?`ready for activation`:`activation blocked`})]}),a(h,{metrics:[{label:`Blockers`,value:Number(n.length||e?.blocker_count||0)},{label:`Warnings`,value:Number(r.length||e?.warning_count||0)}]}),t.length?a(`div`,{className:`grid gap-2`,children:t.slice(0,4).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:e?.blocking?`err`:`warn`,children:e?.blocking?`blocking`:`warning`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:A(e?.code)||`validation issue`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:A(e?.path)||`unknown path`}),a(`div`,{className:`mt-1 text-slate-200`,children:A(e?.message)})]},`${A(e?.code)}-${t}`))}):a(`div`,{className:`tcp-subtle text-xs`,children:e?`No validation issues were reported for the current draft.`:`Validation results will appear after the planner generates a draft.`}),e?.validation_state?a(g,{title:`Validation state`,children:a(`div`,{className:`text-slate-100`,children:A(e.validation_state.state||e.validationState?.state)||`pending`})}):null]})})}function j(e){return String(e||``).trim()}function ue({overlapAnalysis:e}){let t=j(e?.matched_plan_id||e?.matchedPlanId),n=j(e?.matched_plan_revision||e?.matchedPlanRevision),r=j(e?.decision||``).replace(/_/g,` `),i=j(e?.match_layer||e?.matchLayer).replace(/_/g,` `),o=e?.similarity_score??e?.similarityScore,s=!!(e?.requires_user_confirmation||e?.requiresUserConfirmation);return a(f,{title:`Overlap`,subtitle:`Match the current draft against prior plans and decide how it should evolve.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:t?`ok`:`warn`,children:t?`prior match found`:`no prior match`}),r?a(u,{tone:`info`,children:r}):null,i?a(u,{tone:`info`,children:i}):null,a(u,{tone:s?`warn`:`ok`,children:s?`confirmation needed`:`no confirmation needed`})]}),a(h,{metrics:[{label:`Matched plan`,value:t||`none`},{label:`Matched revision`,value:n||`none`},{label:`Similarity`,value:typeof o==`number`?o.toFixed(2):`n/a`},{label:`Reason`,value:j(e?.reason)||`No overlap reason provided.`}]})]})})}function M(e){return String(e||``).trim()}function N(e){return Array.isArray(e)?e:[]}function de({planPackageReplay:e}){let t=!!e?.compatible,n=N(e?.issues),r=N(e?.diff_summary||e?.diffSummary),i=!!e?.scope_metadata_preserved,o=!!e?.handoff_rules_preserved,s=!!e?.credential_isolation_preserved;return a(f,{title:`Replay`,subtitle:`Compare the current draft against the baseline revision and review what changed.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:e&&t?`ok`:`warn`,children:e?t?`replay compatible`:`replay drift`:`replay pending`}),a(u,{tone:i?`ok`:`warn`,children:i?`scope preserved`:`scope changed`}),a(u,{tone:o?`ok`:`warn`,children:o?`handoff preserved`:`handoff changed`}),a(u,{tone:s?`ok`:`warn`,children:s?`credentials preserved`:`credentials changed`})]}),a(h,{metrics:[{label:`Previous plan`,value:M(e?.previous_plan_id)||`baseline`,detail:M(e?.previous_plan_revision)?`revision ${M(e?.previous_plan_revision)}`:`revision 1`},{label:`Current plan`,value:M(e?.next_plan_id)||`current draft`,detail:M(e?.next_plan_revision)?`revision ${M(e?.next_plan_revision)}`:`latest revision`},{label:`Issues`,value:n.length||0},{label:`Diffs`,value:r.length||0}]}),r.length?a(g,{title:`Replay deltas`,children:a(`div`,{className:`grid gap-2`,children:r.slice(0,6).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:e?.preserved?`ok`:`warn`,children:e?.preserved?`preserved`:`changed`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:M(e?.path)||`unknown path`})]}),e?.previous_value===void 0?null:a(`div`,{className:`mt-2 text-xs text-slate-400`,children:[`previous: `,JSON.stringify(e.previous_value)]}),e?.next_value===void 0?null:a(`div`,{className:`mt-1 text-xs text-slate-300`,children:[`next: `,JSON.stringify(e.next_value)]})]},`${M(e?.path)}-${t}`))})}):null,n.length?a(g,{title:`Replay issues`,children:a(`div`,{className:`grid gap-2`,children:n.slice(0,6).map((e,t)=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:e?.blocking?`err`:`warn`,children:e?.blocking?`blocking`:`warning`}),a(`span`,{className:`text-sm font-medium text-slate-100`,children:M(e?.code)||`replay issue`})]}),a(`div`,{className:`tcp-subtle mt-2 text-xs`,children:M(e?.path)||`unknown path`}),a(`div`,{className:`mt-1 text-slate-200`,children:M(e?.message)})]},`${M(e?.code)}-${t}`))})}):a(`div`,{className:`tcp-subtle text-xs`,children:e?`No replay issues were reported for the current draft.`:`Replay results will appear after the planner generates or revises a draft.`})]})})}var P=`tandem.automations.plannerSeed`,F=`tandem.intent-planner.codingTaskHandoff.v1`;function I(e){return String(e||``).trim()}function L({brief:e,planPreview:t,planPackageBundle:n,planPackage:r,validationReport:i,overlapAnalysis:a,teachingLibrary:o}){return{goal:I(e.goal||t?.description||t?.title),workspaceRoot:I(e.workspaceRoot),notes:[`Target surface: ${e.targetSurface.replace(`_`,` `)}`,`Planning horizon: ${e.planningHorizon.replace(`_`,` `)}`,e.outputExpectations?`Expected outputs: ${I(e.outputExpectations)}`:``,e.constraints?`Constraints: ${I(e.constraints)}`:``].filter(Boolean).join(`
|
|
4
|
+
`),plannerProvider:I(e.plannerProvider),plannerModel:I(e.plannerModel),plan:r||t||null,conversation:null,changeSummary:[],plannerError:``,plannerDiagnostics:{validation_report:i||null,overlap_analysis:a||null,teaching_library:o||null,handoff_source:`intent_planner_page`},publishedAtMs:null,publishedTasks:[],planPackageBundle:n||null}}function fe({brief:e,planPreview:t,planPackage:i,planPackageBundle:o,validationReport:s,overlapAnalysis:c,teachingLibrary:l,navigate:d,toast:p}){let[ee,m]=r(``),te=!!o,ne=!!t||!!i,re=n(()=>L({brief:e,planPreview:t,planPackageBundle:o,planPackage:i,validationReport:s,overlapAnalysis:c,teachingLibrary:l}),[e,c,i,o,t,l,s]),h=()=>{let n=I(e.goal||t?.description||t?.title);if(!n){p(`warn`,`Add an intent first so we have something to hand off.`);return}try{sessionStorage.setItem(P,JSON.stringify({prompt:n,plan_source:`intent_planner_page`})),d(`automations`)}catch{p(`err`,`Unable to seed the automation draft handoff.`)}},g=()=>{if(!ne){p(`warn`,`Generate a plan before publishing a coding task bundle.`);return}try{sessionStorage.setItem(F,JSON.stringify(re)),d(`coding`)}catch{p(`err`,`Unable to seed the coding handoff.`)}},ie=async()=>{if(!te){p(`warn`,`Generate a bundle before exporting it.`);return}try{let e=JSON.stringify(o,null,2);typeof navigator<`u`&&navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),m(`Bundle copied to clipboard.`),p(`ok`,`Plan bundle copied to clipboard.`)):(m(`Clipboard unavailable.`),p(`warn`,`Clipboard unavailable in this environment.`))}catch{m(`Copy failed.`),p(`err`,`Unable to copy the plan bundle.`)}};return a(f,{title:`Handoff`,subtitle:`Send the plan downstream without rebuilding it in another page.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:ne?`ok`:`warn`,children:ne?`handoff ready`:`handoff pending`}),a(u,{tone:te?`ok`:`warn`,children:te?`bundle ready`:`bundle pending`}),a(u,{tone:`info`,children:e.targetSurface.replace(`_`,` `)})]}),a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:h,children:[a(`i`,{"data-lucide":`bot`,className:`mr-1 h-3 w-3`}),`Create automation draft`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>d(`studio`),children:[a(`i`,{"data-lucide":`network`,className:`mr-1 h-3 w-3`}),`Open in mission builder`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:g,children:[a(`i`,{"data-lucide":`code`,className:`mr-1 h-3 w-3`}),`Publish Coder task bundle`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>d(`orchestrator`),children:[a(`i`,{"data-lucide":`sparkles`,className:`mr-1 h-3 w-3`}),`Open task board`]}),a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:()=>void ie(),children:[a(`i`,{"data-lucide":`download`,className:`mr-1 h-3 w-3`}),`Export plan bundle`]})]}),ee?a(`div`,{className:`tcp-subtle text-xs`,children:ee}):null]})})}function R(e){return String(e||``).trim()}function z(e){return e?`ok`:`warn`}function pe({brief:e,planPreview:t,validationReport:n,overlapAnalysis:r}){let i=Array.isArray(t?.steps)?t.steps:[],o=!!R(e.goal),s=i.length>0,c=!!(r?.matched_plan_id||r?.matchedPlanId||r);return a(f,{title:`Plan formation`,subtitle:`See the compiler move from intent to decomposition, checks, and review-ready structure.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[{id:`intent-parsed`,label:`intent parsed`,active:o},{id:`decomposition`,label:`decomposition formed`,active:s},{id:`overlap`,label:`overlap checked`,active:c},{id:`validation`,label:`validation complete`,active:!!n}].map(e=>a(u,{tone:z(e.active),children:e.label},e.id))}),a(g,{title:`Formation summary`,children:a(`div`,{className:`text-slate-200`,children:s?`The current draft has ${i.length} planned step${i.length===1?``:`s`} and is ready for downstream review.`:`The planner has not yet produced a step decomposition for this intent.`})}),a(`div`,{className:`grid gap-2`,children:i.slice(0,4).map((e,t)=>{let n=R(e?.step_id||e?.stepId||`step-${t+1}`),r=R(e?.objective||e?.title||`Untitled step`),o=R(e?.agent_role||e?.agentRole||`n/a`);return a(g,{title:`Node ${t+1}`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:a(`span`,{className:`text-slate-100`,children:r})}),a(`div`,{className:`tcp-subtle mt-1 text-xs`,children:[`agent: `,o]}),t<Math.min(i.length,4)-1?a(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-slate-500`,children:[a(`span`,{className:`h-px flex-1 bg-white/10`}),a(`span`,{children:`→`}),a(`span`,{className:`h-px flex-1 bg-white/10`})]}):null]},n)})})]})})}function me(){return a(`div`,{className:`relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-none border border-white/5 bg-black/40`,children:[a(`div`,{className:`absolute inset-0 opacity-20`,children:[a(`div`,{className:`tcp-shell-glow tcp-shell-glow-a opacity-50`}),a(`div`,{className:`tcp-shell-glow tcp-shell-glow-b opacity-30`})]}),a(`div`,{className:`relative z-10 grid w-full gap-5 px-6 py-6`,children:[a(s,{className:`mx-auto aspect-square w-full max-w-[17rem]`,mode:`panel`}),a(`div`,{className:`grid gap-2`,children:[`Mapping objective into shared workflow lanes`,`Scoring schedule and workspace constraints`,`Composing a mission draft with recovery steps`].map((e,t)=>a(`div`,{className:`grid gap-1 border border-white/5 bg-black/35 px-3 py-2`,children:[a(`div`,{className:`flex items-center justify-between gap-3`,children:[a(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.22em] text-slate-300`,children:e}),a(`span`,{className:`text-[10px] uppercase tracking-[0.22em] text-amber-200/75`,children:`Live`})]}),a(o.div,{className:`h-1.5 origin-left bg-[linear-gradient(90deg,rgba(245,158,11,0.18),rgba(255,233,171,0.94),rgba(245,158,11,0.18))]`,animate:{scaleX:[.22,.94,.38]},transition:{duration:1.8,ease:`easeInOut`,repeat:1/0,delay:t*.22}})]},e))})]}),a(`div`,{className:`absolute inset-x-0 bottom-6 text-center`,children:a(`div`,{className:`inline-flex items-center gap-2 rounded-none border border-primary/20 bg-black/60 px-4 py-2 backdrop-blur-md`,children:[a(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-primary`}),a(`span`,{className:`font-display text-xs font-semibold uppercase tracking-widest text-primary`,children:`Synthesizing Plan Flow`})]})})]})}var he=`tcp.intent-planner.v1`,B=`tcp.intent-planner.saved.v1`,V=`tcp.intent-planner.history.v1`;function H(e){return String(e||``).trim()}function ge(e){return`${he}:${H(e)||`default`}`}function _e(e){return`${B}:${H(e)||`default`}`}function ve(e){return`${V}:${H(e)||`default`}`}function ye(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!=`object`?null:n}catch{return null}}function be(e,t){if(typeof localStorage>`u`)return null;let n=Date.now();try{return localStorage.setItem(e,JSON.stringify({...t,updatedAtMs:n})),n}catch{return null}}function xe(e,t){let n=t.validationReport||{},r=t.overlapAnalysis||{},i=Array.isArray(t.planningConversation?.messages)?t.planningConversation.messages:Array.isArray(t.conversation?.messages)?t.conversation.messages:[];return{storageKey:e,name:H(t.name||t.title||t.brief?.goal||t.goal)||`Untitled planner draft`,updatedAtMs:Number(t.updatedAtMs||0)||0,planId:H(t.planPackage?.plan_id||t.planPreview?.plan_id||t.plan?.plan_id),planRevision:H(t.planPackage?.plan_revision||t.planPackageBundle?.scope_snapshot?.plan_revision||t.planPackageBundle?.scopeSnapshot?.planRevision),briefGoal:H(t.brief?.goal||t.goal),targetSurface:H(t.brief?.targetSurface||t.targetSurface),planningHorizon:H(t.brief?.planningHorizon||t.planningHorizon),messageCount:i.length,blockerCount:Number(n.blocker_count||n.blockerCount||0)||0,warningCount:Number(n.warning_count||n.warningCount||0)||0,hasOverlapMatch:!!H(r.matched_plan_id||r.matchedPlanId||r.match_layer)}}function U(e){return H(e).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function Se(e,t,n){if(typeof localStorage>`u`)return null;let r=Date.now(),i=`${e}:${U(t)||`draft`}:${r}`;try{return localStorage.setItem(i,JSON.stringify({...n,name:H(t)||`Untitled planner draft`,updatedAtMs:r})),{storageKey:i,updatedAtMs:r}}catch{return null}}function Ce(e){if(typeof localStorage>`u`)return[];let t=[];try{for(let n=0;n<localStorage.length;n+=1){let r=localStorage.key(n);if(!r||!r.startsWith(`${e}:`))continue;let i=localStorage.getItem(r);if(!i)continue;let a=JSON.parse(i);!a||typeof a!=`object`||t.push(xe(r,a))}}catch{return[]}return t.sort((e,t)=>t.updatedAtMs-e.updatedAtMs)}function we(e){Ae(e)}function Te(e){return JSON.stringify({goal:H(e.brief?.goal||e.goal),planId:H(e.planPreview?.plan_id||e.plan?.plan_id),planRevision:H(e.planPackage?.plan_revision||e.planPackageBundle?.scope_snapshot?.plan_revision),changeSummary:Array.isArray(e.planningChangeSummary)?e.planningChangeSummary:Array.isArray(e.changeSummary)?e.changeSummary:[],conversationLength:Array.isArray(e.planningConversation?.messages)?e.planningConversation.messages.length:Array.isArray(e.conversation?.messages)?e.conversation.messages.length:0,plannerError:H(e.plannerError)})}function Ee(e,t,n=24){if(typeof localStorage>`u`)return null;let r=Date.now(),i={...t,entryId:`${r}`,updatedAtMs:r,fingerprint:Te(t)};try{let t=ye(e)||[],r=Array.isArray(t)?t[0]:null;if(r?.fingerprint&&r.fingerprint===i.fingerprint)return r.entryId||null;let a=[i,...Array.isArray(t)?t:[]].slice(0,n);return localStorage.setItem(e,JSON.stringify(a)),i.entryId}catch{return null}}function De(e){let t=ye(e);return Array.isArray(t)?t.filter(e=>e&&typeof e==`object`).map(t=>({entryId:H(t.entryId)||`${Number(t.updatedAtMs||0)||0}`,...xe(e,t)})).sort((e,t)=>t.updatedAtMs-e.updatedAtMs):[]}function Oe(e,t){let n=ye(e);if(!Array.isArray(n))return null;let r=n.find(e=>H(e?.entryId)===H(t));return r&&typeof r==`object`?r:null}function ke(e,t){if(!(typeof localStorage>`u`))try{let n=ye(e);if(!Array.isArray(n))return;let r=n.filter(e=>H(e?.entryId)!==H(t));localStorage.setItem(e,JSON.stringify(r))}catch{}}function Ae(e){if(!(typeof localStorage>`u`))try{localStorage.removeItem(e)}catch{}}function je(e){return String(e||``).trim()}function Me(e){if(!e)return`unknown`;let t=Date.now()-e,n=Math.max(1,Math.round(t/6e4));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 Ne({storagePrefix:t,historyKey:i,draftName:o,onDraftNameChange:s,onSaveCurrentDraft:c,onOpenDraft:d,onDeleteDraft:p,onOpenHistory:ee,onDeleteHistory:m}){let[te,ne]=r(``),[re,ie]=r(!1),[_,v]=r(null);e(()=>{try{l()}catch{}});let y=Ce(t),b=De(i),x=je(te).toLowerCase(),S=n(()=>x?y.filter(e=>[e.name,e.planId,e.planRevision,e.briefGoal,e.targetSurface,e.planningHorizon].join(` `).toLowerCase().includes(x)):y,[y,x]),ae=n(()=>x?b.filter(e=>[e.name,e.planId,e.planRevision,e.briefGoal,e.targetSurface,e.planningHorizon].join(` `).toLowerCase().includes(x)):b,[b,x]);return a(f,{title:`Saved intents`,subtitle:`Open, inspect, and reopen saved planning work from local storage.`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap gap-2`,children:[a(u,{tone:y.length?`ok`:`warn`,children:y.length?`${y.length} saved draft${y.length===1?``:`s`}`:`no saved drafts`}),a(u,{tone:b.length?`info`:`warn`,children:b.length?`${b.length} autosave snapshots`:`no autosave snapshots`})]}),a(`input`,{className:`tcp-input`,value:te,onChange:e=>ne(e.target.value),placeholder:`Filter saved drafts and autosaves`}),a(g,{title:`Save current draft`,children:a(`div`,{className:`grid gap-2`,children:[a(`input`,{className:`tcp-input`,value:o,onChange:e=>s(e.target.value),placeholder:`Name this intent`}),a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:c,children:`Save named intent`})]})}),S.length?a(`div`,{className:`grid gap-2`,children:S.slice(0,8).map(e=>a(g,{title:e.name,children:[a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(u,{tone:`ok`,children:e.targetSurface||`planner`}),a(u,{tone:`info`,children:e.planningHorizon||`unspecified horizon`}),a(u,{tone:e.hasOverlapMatch?`warn`:`ok`,children:e.hasOverlapMatch?`overlap match`:`no overlap`})]}),a(h,{metrics:[{label:`Updated`,value:e.updatedAtMs?new Date(e.updatedAtMs).toLocaleString():`unknown`,detail:Me(e.updatedAtMs)},{label:`Plan`,value:e.planId||`pending`},{label:`Revision`,value:e.planRevision||`pending`},{label:`Brief`,value:a(`span`,{className:`block text-xs line-clamp-3`,title:e.briefGoal||`no saved goal`,children:e.briefGoal||`no saved goal`})},{label:`Conversation`,value:`${e.messageCount} turn${e.messageCount===1?``:`s`}`},{label:`Validation`,value:`${e.blockerCount} blocker${e.blockerCount===1?``:`s`}`,detail:`${e.warningCount} warning${e.warningCount===1?``:`s`}`}],columns:`grid-cols-1 sm:grid-cols-2`}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>d(e.storageKey),children:[a(`i`,{"data-lucide":`folder-open`,className:`mr-1 h-3 w-3`}),`Reopen draft`]}),_===e.storageKey?a(`div`,{className:`flex items-center gap-2 rounded border border-red-500/20 bg-red-500/10 px-2 py-1`,children:[a(`span`,{className:`text-xs text-red-400`,children:`Confirm delete?`}),a(`button`,{type:`button`,className:`tcp-btn bg-red-500/20 text-red-300 border-red-500/50 hover:bg-red-500/30`,onClick:()=>{p(e.storageKey),v(null)},children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Confirm`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(null),children:`Cancel`})]}):a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(e.storageKey),children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Delete`]})]})]},e.storageKey))}):a(`div`,{className:`tcp-subtle text-xs`,children:`Save a planner draft and it will appear here for quick reopening.`}),a(g,{title:`Recent autosaves`,children:re?ae.length?a(`div`,{className:`grid gap-2`,children:ae.slice(0,8).map(e=>a(`div`,{className:`rounded-lg border border-white/10 bg-black/20 p-3`,children:[a(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[a(u,{tone:`info`,children:e.targetSurface||`planner`}),a(u,{tone:`info`,children:e.planningHorizon||`unspecified horizon`}),a(u,{tone:e.hasOverlapMatch?`warn`:`ok`,children:e.hasOverlapMatch?`overlap match`:`no overlap`})]}),a(h,{metrics:[{label:`Updated`,value:e.updatedAtMs?new Date(e.updatedAtMs).toLocaleString():`unknown`,detail:Me(e.updatedAtMs)},{label:`Plan`,value:e.planId||`pending`},{label:`Revision`,value:e.planRevision||`pending`},{label:`Brief`,value:a(`span`,{className:`block text-xs line-clamp-3`,title:e.briefGoal||`no saved goal`,children:e.briefGoal||`no saved goal`})},{label:`Conversation`,value:`${e.messageCount} turn${e.messageCount===1?``:`s`}`},{label:`Validation`,value:`${e.blockerCount} blocker${e.blockerCount===1?``:`s`}`,detail:`${e.warningCount} warning${e.warningCount===1?``:`s`}`}],columns:`grid-cols-1 sm:grid-cols-2`}),a(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>ee(e.entryId),children:[a(`i`,{"data-lucide":`folder-open`,className:`mr-1 h-3 w-3`}),`Reopen autosave`]}),_===e.entryId?a(`div`,{className:`flex items-center gap-2 rounded border border-red-500/20 bg-red-500/10 px-2 py-1`,children:[a(`span`,{className:`text-xs text-red-400`,children:`Confirm delete?`}),a(`button`,{type:`button`,className:`tcp-btn bg-red-500/20 text-red-300 border-red-500/50 hover:bg-red-500/30`,onClick:()=>{m(e.entryId),v(null)},children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Confirm`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(null),children:`Cancel`})]}):a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>v(e.entryId),children:[a(`i`,{"data-lucide":`trash-2`,className:`mr-1 h-3 w-3`}),`Delete`]})]})]},e.entryId))}):a(`div`,{className:`tcp-subtle text-xs`,children:x?`No autosaves match the current filter.`:`Recent autosaved planner states will appear here as the plan evolves.`}):a(`button`,{type:`button`,className:`tcp-btn w-full justify-start text-xs`,onClick:()=>ie(!0),children:[a(`i`,{"data-lucide":`chevron-down`,className:`mr-1 h-3 w-3`}),`Show `,b.length,` autosaved snapshots`]})})]})})}var W={goal:``,workspaceRoot:``,targetSurface:`mission`,planningHorizon:`mixed`,outputExpectations:``,constraints:``,plannerProvider:``,plannerModel:``,selectedMcpServers:[]};function G(e){return String(e||``).trim()}function Pe(e){let t=Array.isArray(e)?e.map(e=>G(e)).filter(Boolean):[];return t.length?t.join(`, `):`—`}function Fe(e){let t=G(e?.source_platform),n=G(e?.created_by_agent||e?.requesting_actor);return t===`control_panel`&&(!n||n===`human`)?`human`:n||`—`}function Ie(e){let t=e?.preview_payload?.plan||{},n=G(t?.title||t?.original_prompt),r=Array.isArray(t?.steps)?t.steps.length:0,i=G(t?.schedule?.cron_expression||t?.schedule?.type||t?.schedule?.label),a=[n||`Workflow preview`];return r&&a.push(`${r} step${r===1?``:`s`}`),i&&a.push(i),a.join(` • `)}function Le(e){return(Array.isArray(e)?e:Array.isArray(e?.servers)?e.servers:e&&typeof e==`object`?Object.entries(e).map(([e,t])=>({name:e,...t})):[]).map(e=>({name:String(e?.name||``).trim(),connected:!!e?.connected,enabled:e?.enabled!==!1,transport:String(e?.transport||``).trim(),lastError:String(e?.last_error||e?.lastError||``).trim()})).filter(e=>e.name)}function Re(e){let t=G(e);return t?t.startsWith(`/`)?``:`Workspace root must be an absolute path.`:`Workspace root is required.`}function ze(e){switch(e){case`same_day`:return`same-day split work`;case`multi_day`:return`multi-day plan`;case`weekly`:return`weekly recurring work`;case`monthly`:return`monthly recurring work`;default:return`mixed one-time and recurring work`}}function Be(e){switch(e){case`automation`:return`workflow automation`;case`mission`:return`mission execution`;case`coding`:return`coding workflow`;default:return`orchestrator handoff`}}function Ve(e){return[G(e.goal),`Planning horizon: ${ze(e.planningHorizon)}.`,`Target surface: ${Be(e.targetSurface)}.`,G(e.workspaceRoot)?`Workspace root: ${G(e.workspaceRoot)}`:``,G(e.outputExpectations)?`Expected outputs:\n${G(e.outputExpectations)}`:``,G(e.constraints)?`Constraints:\n${G(e.constraints)}`:``,`Default knowledge behavior: project-scoped preflight reuse with promoted trust floor.`,`Use clarifying questions instead of guessing when important details are missing.`,`Prefer multi-agent decomposition, milestones, and timeline-aware work waves when appropriate.`,`Return a workflow plan that can later be handed off to Automations, Coder, or Orchestrator.`].filter(Boolean).join(`
|
|
5
|
+
`)}var He=`tandem.workflow.importHandoff.v1`,K=`tandem.workflow.plannerSeed`;function Ue(){try{let e=localStorage.getItem(He);if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function We(){try{let e=sessionStorage.getItem(K);if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function Ge(){try{let e=window.location.hash||``,t=e.includes(`?`)?e.slice(e.indexOf(`?`)+1):``,n=new URLSearchParams(t);return String(n.get(`session_id`)||``).trim()||``}catch{return``}}function Ke({api:o,client:s,toast:c,providerStatus:p,identity:h,navigate:g}){let[_,v]=r(W),[y,b]=r(``),[x,S]=r(`idle`),[C,w]=r(null),[T,E]=r(null),[D,O]=r([]),[se,k]=r(``),[A,j]=r(null),[M,N]=r({status:`none`}),[P,F]=r(null),[I,L]=r(null),[R,z]=r(null),[he,B]=r(null),[V,H]=r(null),[xe,U]=r(null),[Ce,Te]=r(``),[De,je]=r(!1),[Me,ze]=r(null),[Be,K]=r(!1),[Ke,qe]=r(``),[q,Je]=r(null),[J,Ye]=r(null),[Xe,Ze]=r(!1),[Qe,$e]=r(``),[et,tt]=r(``),nt=n(()=>Ge(),[]),rt=n(()=>ge(h.botName),[h.botName]),it=n(()=>_e(h.botName),[h.botName]),at=n(()=>ve(h.botName),[h.botName]),ot=i({queryKey:[`intent-planner`,`providers`,`catalog`],queryFn:()=>s.providers.catalog().catch(()=>({all:[]})),refetchInterval:3e4}),st=i({queryKey:[`intent-planner`,`providers`,`config`],queryFn:()=>s.providers.config().catch(()=>({})),refetchInterval:3e4}),ct=i({queryKey:[`intent-planner`,`mcp-servers`],queryFn:()=>s.mcp.list().catch(()=>({})),refetchInterval:1e4}),lt=i({queryKey:[`global`,`health`],queryFn:()=>s.health().catch(()=>({})),refetchInterval:3e4}),ut=i({queryKey:[`intent-planner`,`workspace-browser`,Qe],enabled:Xe&&!!Qe,queryFn:()=>o(`/api/orchestrator/workspaces/list?dir=${encodeURIComponent(Qe)}`,{method:`GET`}).catch(()=>({}))}),Y=G(J?.session_id||q?.session_id||nt),dt=i({queryKey:[`intent-planner`,`workflow-handoff`,Y],enabled:!!Y,queryFn:()=>s.workflowPlannerSessions.get(Y).catch(()=>({session:null}))}),ft=n(()=>te({providerCatalog:ot.data,providerConfig:st.data,defaultProvider:p.defaultProvider,defaultModel:p.defaultModel}),[p.defaultModel,p.defaultProvider,ot.data,st.data]),pt=n(()=>Le(ct.data),[ct.data]),mt=n(()=>pt.filter(e=>e.connected).map(e=>e.name),[pt]),ht=!!(G(_.plannerProvider)&&G(_.plannerModel)||G(p.defaultProvider)&&G(p.defaultModel)),gt=n(()=>ee(T),[T]),_t=x===`generating`||x===`revising`,X=!!G(C?.plan_id||C?.planId),vt=!!(X||I||P||V||he||D.length),yt=x===`generating`?`Drafting plan`:x===`revising`?`Revising plan`:x===`clarifying`?`Waiting for clarification`:``,bt=x===`clarifying`?`Reply to the planner's question so it can continue shaping the mission.`:`The planner is composing a governed workflow plan from your intent.`,xt=Array.isArray(ut.data?.directories)?ut.data.directories:[],Z=dt.data?.session||null,St=G(Z?.source_kind||q?.source_kind||``),Q=Z?.draft?.review||null,$=Z?.planning||null,Ct=(Q?.preview_payload||null)?.plan||null,wt=G(Ct?.original_prompt||Z?.goal||G(J?.prompt||``)||Z?.title||`—`),Tt=G($?.draft_id||$?.linked_draft_plan_id||Z?.current_plan_id||Ct?.plan_id||`—`),Et=Q?`review ready`:`draft in progress`,Dt=G(Q?.validation_state||$?.validation_state||`incomplete`),Ot=G(Q?.approval_status||$?.approval_status||`not_required`),kt=G(J?.prompt||``),At=String(ut.data?.parent||``).trim(),jt=String(ut.data?.dir||Qe||``).trim(),Mt=n(()=>{let e=String(et||``).trim().toLowerCase();return e?xt.filter(t=>String(t?.name||t?.path||``).trim().toLowerCase().includes(e)):xt},[et,xt]),Nt=Re(_.workspaceRoot);e(()=>{let e=String(lt.data?.workspaceRoot||lt.data?.workspace_root||``).trim();e&&v(t=>G(t.workspaceRoot)?t:{...t,workspaceRoot:e})},[lt.data]),e(()=>{Je(Ue()),Ye(We())},[]),e(()=>{if(!Y||!Z||Z.session_id!==Y||Ke===Z.session_id)return;let e=Z.draft?.current_plan||Z.draft?.initial_plan;if(!e)return;v({...W,goal:G(Z.goal||Z.title||e.original_prompt||e.title),workspaceRoot:G(Z.workspace_root||e.workspace_root),targetSurface:W.targetSurface,planningHorizon:W.planningHorizon,outputExpectations:G(e.description),constraints:``,plannerProvider:G(Z.planner_provider),plannerModel:G(Z.planner_model),selectedMcpServers:Array.isArray(e.allowed_mcp_servers)?e.allowed_mcp_servers.map(e=>G(e)).filter(Boolean):[]}),b(G(Z.goal||Z.title||e.normalized_prompt||e.original_prompt)),w(e),E(Z.draft?.conversation||null),O([]),k(``),j(Z.import_scope_snapshot||Z.draft?.planner_diagnostics||null),F(null),L(null),z(null),B(null),H(null),U(null);let t=Z.draft?.review||null,n=t?.preview_payload||null;t&&n&&(j(n.planner_diagnostics||Z.draft?.planner_diagnostics||null),F(n.plan_package_validation||null),L(n.plan_package||null),z(n.plan_package_bundle||null),B(n.plan_package_replay||null),H(n.overlap_analysis||null),U(n.teaching_library||null),ze(Number.isFinite(Number(t.updated_at_ms))?Number(t.updated_at_ms):Number.isFinite(Number(Z.updated_at_ms))?Number(Z.updated_at_ms):null)),S(`idle`),K(!0),je(!0),Te(G(Z.title||e.title)),qe(Z.session_id),q?.session_id===Y&&Wt(!1)},[Z,Ke,Y,q?.session_id]),e(()=>{if(!J?.prompt||Y||De&&G(y||_.goal))return;let e=G(J.prompt);e&&(v(t=>({...t,goal:e,workspaceRoot:G(J.workspace_root||t.workspaceRoot)})),b(e),S(`idle`),K(!1),je(!0))},[_.goal,De,Y,y,J]);let Pt=()=>{Ae(rt),v(W),b(``),S(`idle`),w(null),E(null),O([]),k(``),j(null),N({status:`none`}),F(null),L(null),z(null),B(null),H(null),U(null),ze(null),K(!1),Te(``)},Ft=e=>e?(v({...W,goal:G(e.brief?.goal||e.goal),workspaceRoot:G(e.brief?.workspaceRoot||e.workspaceRoot),targetSurface:e.brief?.targetSurface||e.targetSurface||W.targetSurface,planningHorizon:e.brief?.planningHorizon||e.planningHorizon||W.planningHorizon,outputExpectations:G(e.brief?.outputExpectations||e.outputExpectations),constraints:G(e.brief?.constraints||e.constraints),plannerProvider:G(e.brief?.plannerProvider||e.plannerProvider),plannerModel:G(e.brief?.plannerModel||e.plannerModel),selectedMcpServers:Array.isArray(e.brief?.selectedMcpServers)?e.brief.selectedMcpServers.map(e=>G(e)).filter(Boolean):Array.isArray(e.selectedMcpServers)?e.selectedMcpServers.map(e=>G(e)).filter(Boolean):[]}),b(G(e.plannerInput)),S(`idle`),w(e.planPreview||e.planPreviewJson||e.plan||null),E(e.planningConversation||e.conversation||null),O(Array.isArray(e.planningChangeSummary||e.changeSummary)?(e.planningChangeSummary||e.changeSummary).map(e=>G(e)).filter(Boolean):[]),k(G(e.plannerError)),j(e.plannerDiagnostics||null),F(e.validationReport||null),L(e.planPackage||null),z(e.planPackageBundle||null),B(e.planPackageReplay||null),H(e.overlapAnalysis||null),U(e.teachingLibrary||null),ze(Number.isFinite(Number(e.updatedAtMs))?Number(e.updatedAtMs):null),K(!0),je(!0),Te(G(e.name||e.title||e.brief?.goal||e.goal)),!0):!1;e(()=>{je(!1);let e=ye(rt);if(!e){je(!0),K(!1);return}Ft(e)},[rt]),e(()=>{try{l()}catch{}}),e(()=>{if(!De)return;let e={name:Ce,brief:_,plannerInput:y,planPreview:C,planningConversation:T,planningChangeSummary:D,plannerError:se,plannerDiagnostics:A,validationReport:P,planPackage:I,planPackageBundle:R,planPackageReplay:he,overlapAnalysis:V,teachingLibrary:xe},t=be(rt,e);typeof t==`number`&&ze(t),Ee(at,e)},[_,V,rt,I,R,he,C,A,se,y,D,T,De,at,Ce,xe,P]);let It=async e=>{let t=G(e||y||_.goal),n=G(_.workspaceRoot);if(!t){c(`warn`,`Describe the intent you want the planner to turn into a long-horizon plan.`);return}if(!n){c(`warn`,`Workspace root is required so the planner can inspect the target workspace.`);return}if(!n.startsWith(`/`)){c(`warn`,`Workspace root must be an absolute path.`);return}S(`generating`),k(``),j(null),v(e=>({...e,goal:t}));try{let e=await s.workflowPlans.chatStart({prompt:Ve({..._,goal:t}),plan_source:`intent_planner_page`,workspace_root:n,allowed_mcp_servers:_.selectedMcpServers.length?_.selectedMcpServers:mt,operator_preferences:{planner_target_surface:_.targetSurface,planning_horizon:_.planningHorizon,expected_outputs:G(_.outputExpectations),constraints:G(_.constraints),planner_provider:G(_.plannerProvider),planner_model:G(_.plannerModel),...ne(t),...m(t)}});w(e?.plan||null),E(e?.conversation||null),O([]),j(e?.planner_diagnostics||null),F(e?.plan_package_validation||null),L(e?.plan_package||null),z(e?.plan_package_bundle||null),B(e?.plan_package_replay||null),H(e?.overlap_analysis||null),U(e?.teaching_library||null),K(!1);let r=typeof e?.clarifier?.question==`string`?String(e.clarifier.question):``,i=Array.isArray(e?.clarifier?.options)?e.clarifier.options.map(e=>({id:G(e?.id),label:G(e?.label)})).filter(e=>e.id&&e.label):[];r&&k(r),r&&i.length>0?(N({status:`waiting`,question:r,options:i}),S(`clarifying`)):(N({status:`none`}),S(`idle`)),b(``),c(`ok`,r?`Planner needs clarification before it can refine the mission.`:`Planner generated a draft mission plan.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),N({status:`none`}),S(`idle`),c(`err`,t)}},Lt=async e=>{let t=G(C?.plan_id||C?.planId);if(!t){c(`warn`,`Start a planning session before revising the plan.`);return}let n=G(e??y);if(!n){c(`warn`,`Add a message for the planner first.`);return}S(`revising`),k(``),j(null);try{let e=await s.workflowPlans.chatMessage({plan_id:t,message:n});w(e?.plan||null),E(e?.conversation||null),O(Array.isArray(e?.change_summary)?e.change_summary.map(e=>G(e)).filter(Boolean):[]),j(e?.planner_diagnostics||null),F(e?.plan_package_validation||null),L(e?.plan_package||null),z(e?.plan_package_bundle||null),B(e?.plan_package_replay||null),H(e?.overlap_analysis||null),U(e?.teaching_library||null),K(!1);let r=typeof e?.clarifier?.question==`string`?String(e.clarifier.question):``,i=Array.isArray(e?.clarifier?.options)?e.clarifier.options.map(e=>({id:G(e?.id),label:G(e?.label)})).filter(e=>e.id&&e.label):[];r&&k(r),r&&i.length>0?(N({status:`waiting`,question:r,options:i}),S(`clarifying`)):(N({status:`none`}),S(`idle`)),b(``),c(`ok`,`Planner revised the draft plan.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),N({status:`none`}),S(`idle`),c(`err`,t)}},Rt=async()=>{let e=G(C?.plan_id||C?.planId);if(!e||!s.workflowPlans.chatReset){Pt(),c(`ok`,`Planner draft reset.`);return}try{let t=await s.workflowPlans.chatReset({plan_id:e});w(t?.plan||null),E(t?.conversation||null),O([]),k(``),j(t?.planner_diagnostics||null),F(t?.plan_package_validation||null),L(t?.plan_package||null),z(t?.plan_package_bundle||null),B(t?.plan_package_replay||null),H(t?.overlap_analysis||null),U(t?.teaching_library||null),N({status:`none`}),S(`idle`),b(``),K(!1),c(`ok`,`Planner session reset.`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),c(`err`,t)}},zt=()=>{let e=G(Ce||_.goal||C?.title||C?.plan_id);if(!e){c(`warn`,`Name the planner draft before saving it as a saved intent.`);return}if(!Se(it,e,{name:e,brief:_,plannerInput:y,planPreview:C,planningConversation:T,planningChangeSummary:D,plannerError:se,plannerDiagnostics:A,validationReport:P,planPackage:I,planPackageBundle:R,planPackageReplay:he,overlapAnalysis:V,teachingLibrary:xe})){c(`err`,`Unable to save the named planner draft.`);return}Te(e),K(!1),c(`ok`,`Saved planner draft “${e}”.`)},Bt=e=>{let t=ye(e);if(!t){c(`warn`,`That saved planner draft could not be loaded.`);return}if(!Ft(t)){c(`warn`,`That saved planner draft was empty.`);return}c(`ok`,`Reopened planner draft “${G(t.name||t.title)}”.`)},Vt=e=>{we(e),K(!1),c(`ok`,`Deleted the saved planner draft.`)},Ht=e=>{let t=Oe(at,e);if(!t){c(`warn`,`That autosaved planner state could not be loaded.`);return}if(!Ft(t)){c(`warn`,`That autosaved planner state was empty.`);return}c(`ok`,`Reopened a recent autosaved planner state.`)},Ut=e=>{ke(at,e),K(!1),c(`ok`,`Deleted the autosaved planner state.`)},Wt=(e=!0)=>{try{localStorage.removeItem(He)}catch{}Je(null),e&&c(`ok`,`Cleared the imported workflow handoff.`)};return a(d,{className:`flex flex-col min-h-0 h-full overflow-hidden`,children:[q?a(f,{title:`Imported workflow handoff`,subtitle:`This durable session was created from an imported bundle. Open the workflow center to inspect, revise, or continue it.`,className:`mb-4`,actions:a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn-secondary`,onClick:()=>g(`workflows`),children:`Open workflow center`}),a(`button`,{type:`button`,className:`tcp-btn-secondary`,onClick:()=>Wt(),children:`Dismiss`})]}),children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:St===`imported_bundle`?`warn`:`info`,children:St||`imported_bundle`}),a(u,{tone:`ghost`,children:G(q.session_id)})]}),a(`div`,{className:`grid gap-1 md:grid-cols-2`,children:[a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Title`}),a(`div`,{children:G(Z?.title||q.title||`Imported workflow`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Project`}),a(`div`,{children:G(Z?.project_slug||q.project_slug||`workflow-imports`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Bundle digest`}),a(`div`,{children:G(Z?.source_bundle_digest||q.source_bundle_digest||`—`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Current plan id`}),a(`div`,{children:G(Z?.current_plan_id||q.current_plan_id||`—`)})]})]})]})}):null,(Y||kt)&&!q?a(f,{title:`Workflow planner handoff`,subtitle:`This planner session was seeded from chat or a channel and will resume the governed draft here.`,className:`mb-4`,children:a(`div`,{className:`grid gap-3 text-sm`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(u,{tone:Y?`info`:`warn`,children:Y?`session`:`seed`}),Y?a(u,{tone:`ghost`,children:Y}):null]}),a(`div`,{className:`grid gap-1 md:grid-cols-2 xl:grid-cols-3`,children:[a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Original request`}),a(`div`,{children:G(wt||kt||`Workflow planner`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Source platform`}),a(`div`,{children:G($?.source_platform||J?.source_platform||`chat`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Source channel`}),a(`div`,{children:G($?.source_channel||J?.source_channel||`—`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Planning mode`}),a(`div`,{children:G($?.mode||`workflow_planning`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Created by / actor`}),a(`div`,{children:G(Fe($))})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Draft id`}),a(`div`,{children:Tt})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Draft status`}),a(`div`,{children:Et})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Validation state`}),a(`div`,{children:Dt})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Validation status`}),a(`div`,{children:G(Q?.validation_status||$?.validation_status||`pending`)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Approval requirements`}),a(`div`,{children:Ot})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Docs MCP`}),a(`div`,{children:Q?.docs_mcp_used?`used in the draft`:`not used yet`})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Required capabilities`}),a(`div`,{children:Pe(Q?.required_capabilities)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Blocked capabilities`}),a(`div`,{children:Pe(Q?.blocked_capabilities)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Missing requirements`}),a(`div`,{children:Pe($?.missing_requirements)})]}),a(`div`,{children:[a(`div`,{className:`tcp-subtle text-xs`,children:`Workflow preview`}),a(`div`,{children:Ie(Q)})]})]})]})}):null,a(`div`,{className:`grid flex-1 gap-4 min-h-0 xl:grid-cols-[minmax(400px,0.8fr)_minmax(0,1.2fr)]`,children:[a(`div`,{className:`flex flex-col gap-4 min-h-0 h-full overflow-y-auto pr-1`,children:[a(f,{title:`Intent brief`,subtitle:`Describe the mission goal.`,className:`flex flex-col shrink-0`,actions:a(`div`,{className:`flex flex-wrap gap-2 text-[10px]`,children:[a(u,{tone:`ok`,children:`intent → plan`}),Be?a(u,{tone:`info`,children:`restored`}):null]}),children:a(ae,{draft:_,onChange:v,providerOptions:ft,plannerCanUseLlm:ht,basePlannerLabel:G(p.defaultProvider)&&G(p.defaultModel)?`${G(p.defaultProvider)} / ${G(p.defaultModel)}`:`not configured`,availableMcpServers:pt,workspaceRootError:Nt,workspaceBrowserOpen:Xe,workspaceBrowserDir:Qe,workspaceBrowserSearch:et,workspaceBrowserParentDir:At,workspaceBrowserCurrentDir:jt,workspaceBrowserDirectories:Mt,onOpenWorkspaceBrowser:()=>{$e(String(_.workspaceRoot||lt.data?.workspaceRoot||lt.data?.workspace_root||`/`).trim()||`/`),tt(``),Ze(!0)},onCloseWorkspaceBrowser:()=>{Ze(!1),tt(``)},onClearWorkspaceRoot:()=>v(e=>({...e,workspaceRoot:``})),onWorkspaceBrowserSearchChange:tt,onWorkspaceBrowserParent:()=>{At&&$e(At)},onWorkspaceBrowserDirectory:e=>$e(e),onSelectWorkspaceDirectory:()=>{jt&&(v(e=>({...e,workspaceRoot:jt})),Ze(!1),tt(``),c(`ok`,`Workspace selected: ${jt}`))},onReset:()=>{Pt(),c(`ok`,`Started a new empty mission draft.`)},disabled:_t})}),a(Ne,{storagePrefix:it,historyKey:at,draftName:Ce,onDraftNameChange:Te,onSaveCurrentDraft:zt,onOpenDraft:Bt,onDeleteDraft:Vt,onOpenHistory:Ht,onDeleteHistory:Ut})]}),a(`div`,{className:`flex flex-col gap-4 min-h-0 h-full overflow-y-auto pr-1 pb-10`,children:[a(f,{title:`Planner conversation`,subtitle:`Shape the full workflow plan.`,className:`flex flex-col shrink-0 h-[500px]`,actions:a(`div`,{className:`flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>void It(),disabled:_t,children:[a(`i`,{"data-lucide":X?`refresh-cw`:`play`,className:`mr-1 h-3 w-3`}),X?`Regenerate`:`Start planning`]}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>void Rt(),title:`Reset session`,children:a(`i`,{"data-lucide":`rotate-ccw`})})]}),children:a(`div`,{className:`tcp-chat-container flex-1`,children:[Me?a(`div`,{className:`mb-3 rounded-xl border border-white/5 bg-black/20 px-3 py-2 text-[10px] text-slate-500`,children:[`Last autosave: `,new Date(Me).toLocaleTimeString()]}):null,a(`div`,{className:`tcp-chat-fill flex flex-col`,children:a(re,{messages:gt,emptyText:`Describe your mission intent to start.`,inputValue:y,inputPlaceholder:X?`Refine the plan...`:`Describe the mission and outcome...`,sendLabel:X?`Send to planner`:`Start plan`,onInputChange:b,onSend:()=>void(X?Lt(y):It(y)),sendDisabled:_t||!G(y),inputDisabled:_t,statusTitle:yt,statusDetail:_t?bt:``,questionTitle:`Planner question`,questionText:M.status===`waiting`?M.question:``,quickReplies:M.status===`waiting`&&M.options||[],onQuickReply:e=>void Lt(e.label),questionHint:`Reply with more detail.`,botIdentity:{botName:`Tandem Planner`,botAvatarUrl:h.botAvatarUrl},showThinking:x===`generating`||x===`revising`,thinkingText:x===`revising`?`Revising plan`:`Drafting plan`})}),a(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[a(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:()=>void(X?Lt(y||_.goal):It()),disabled:_t||!X&&!G(_.goal)||!G(_.workspaceRoot),children:X?`Revise draft`:`Generate draft`}),a(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>b(_.goal),disabled:_t||!G(_.goal),children:`Seed from brief`})]})]})}),_t?a(f,{title:`Generating plan flow`,subtitle:`The planner is synthesizing structure.`,className:`shrink-0`,children:a(me,{})}):null,vt?a(t,{children:[a(fe,{brief:_,planPreview:C,planPackage:I,planPackageBundle:R,validationReport:P,overlapAnalysis:V,teachingLibrary:xe,navigate:g,toast:c}),a(pe,{brief:_,planPreview:C,validationReport:P,overlapAnalysis:V}),a(ce,{brief:_,planPreview:C}),a(oe,{planPreview:C,brief:_,planPackage:I,planPackageBundle:R}),a(le,{validationReport:P}),a(ue,{overlapAnalysis:V}),a(de,{planPackageReplay:he}),a(ie,{plannerDiagnostics:A,teachingLibrary:xe,planningChangeSummary:D})]}):null]})]})]})}export{Ke as IntentPlannerPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,g as t,v as n}from"./fullcalendar-Bn75j0xM.js";import{i as r}from"./motion-B3ZE8SGR.js";import{S as i,b as a,h as o,m as s,s as c,x as l}from"./index-TvymvGva.js";var u=[{packId:`planning-pack`,title:`Planning Pack`,summary:`Kickoff, weekly status, meeting notes, and action tracking for teams that need clarity fast.`,audience:`Project leads, operators, and team managers`,categories:[`planning`,`project management`,`operations`],tags:[`kickoff`,`weekly status`,`action tracking`],highlight:`Best starting point for general-purpose planning workflows.`},{packId:`writing-pack`,title:`Writing Pack`,summary:`Draft, polish, and repurpose articles with an SEO-aware workflow that keeps the story readable.`,audience:`Writers, editors, and marketers`,categories:[`writing`,`seo`,`content marketing`],tags:[`blog drafts`,`copy editing`,`content refresh`],highlight:`Useful when the output needs to read well and rank well.`},{packId:`research-pack`,title:`Research Pack`,summary:`Turn rough questions into structured briefs, source checks, and comparative analysis.`,audience:`Researchers, analysts, and product teams`,categories:[`research`,`analysis`,`fact finding`],tags:[`briefs`,`source verification`,`competitive scan`],highlight:`Good for turning uncertainty into a clear evidence trail.`},{packId:`build-pack`,title:`Build Pack`,summary:`Break features into implementation tasks, review changes, and keep engineering work moving.`,audience:`Developers, reviewers, and release teams`,categories:[`engineering`,`delivery`,`release`],tags:[`feature breakdown`,`bug triage`,`pr review`],highlight:`Best when you want a workflow that maps directly to coding work.`}];function d(d){let[f,p]=n(u[0]?.packId||``),m=t(()=>u.find(e=>e.packId===f)||u[0],[f]);return r(s,{className:`grid gap-4`,children:[r(a,{eyebrow:`Marketplace`,title:`Marketplace coming soon`,subtitle:`This route is intentionally hidden by default. If someone enables it manually, it stays a placeholder until the tandem.ac marketplace is live.`,badges:r(e,{children:[r(o,{tone:`info`,children:`coming soon`}),r(o,{tone:`ghost`,children:[u.length,` seed concepts`]}),r(o,{tone:`ghost`,children:`disabled by default`})]})}),r(l,{title:`Marketplace not live yet`,subtitle:`The public store will live on tandem.ac. This page is a placeholder until search, login, and purchase are ready.`,children:r(`div`,{className:`grid gap-3`,children:[r(`div`,{className:`tcp-list-item`,children:[r(`div`,{className:`tcp-subtle text-xs uppercase tracking-[0.24em]`,children:`Status`}),r(`div`,{className:`mt-2 text-sm`,children:`The marketplace page is intentionally a placeholder until the tandem.ac catalog API and listing pages go live.`})]}),r(`div`,{className:`flex flex-wrap gap-2`,children:[r(`button`,{className:`tcp-btn-primary`,type:`button`,disabled:!0,children:[r(`i`,{"data-lucide":`search`}),`Search marketplace`]}),r(`button`,{className:`tcp-btn`,type:`button`,disabled:!0,children:[r(`i`,{"data-lucide":`external-link`}),`Open tandem.ac`]})]})]})}),r(i,{main:r(`div`,{className:`grid gap-4`,children:[r(l,{title:`Seed concepts`,subtitle:`These are planning concepts, not published marketplace listings.`,children:r(`div`,{className:`grid gap-3`,children:u.map(e=>r(`button`,{type:`button`,className:`tcp-list-item text-left ${m?.packId===e.packId?`border-amber-400/70`:``}`,onClick:()=>p(e.packId),children:r(`div`,{className:`flex items-start justify-between gap-3`,children:[r(`div`,{className:`min-w-0 flex-1`,children:[r(`div`,{className:`mb-1 flex items-center gap-2`,children:[r(`strong`,{children:e.title}),r(o,{tone:`info`,children:e.packId}),r(o,{tone:`ghost`,children:`planned seed`})]}),r(`div`,{className:`tcp-subtle text-sm`,children:e.summary}),r(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs`,children:[r(o,{tone:`ghost`,children:e.audience}),e.categories.map(t=>r(o,{tone:`ghost`,children:t},`${e.packId}-${t}`))]})]}),r(o,{tone:`ghost`,children:e.highlight})]})},e.packId))})}),r(l,{title:`What tandem.ac will own later`,subtitle:`The store belongs on the web, not inside the control panel.`,children:r(`div`,{className:`grid gap-2 text-sm tcp-subtle`,children:[r(`div`,{children:`• login and account state`}),r(`div`,{children:`• pricing and purchase`}),r(`div`,{children:`• pack detail pages and publisher pages`}),r(`div`,{children:`• public search and browse results`}),r(`div`,{children:`• future entitlement and redemption flows`})]})})]}),aside:r(l,{title:`Selected concept`,subtitle:`This is a seed idea that will become a real listing later.`,children:m?r(`div`,{className:`grid gap-3`,children:[r(`div`,{className:`tcp-list-item`,children:[r(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[r(`strong`,{children:m.title}),r(o,{tone:`info`,children:m.packId}),r(o,{tone:`ghost`,children:`concept only`})]}),r(`div`,{className:`tcp-subtle text-sm`,children:m.summary}),r(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs`,children:[m.categories.map(e=>r(o,{tone:`ghost`,children:e},`${m.packId}-${e}-aside`)),m.tags.map(e=>r(o,{tone:`ghost`,children:e},`${m.packId}-${e}`))]})]}),r(`div`,{className:`tcp-list-item`,children:[r(`div`,{className:`tcp-subtle text-xs uppercase tracking-[0.24em]`,children:`Why it exists`}),r(`div`,{className:`mt-2 text-sm`,children:m.highlight})]})]}):r(c,{text:`Select a featured concept.`})})})]})}export{d as MarketplacePage};
|
package/dist/assets/{McpToolAllowlistEditor-B3qCkiFT.js → McpToolAllowlistEditor-BzQ64HrZ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,E as t,g as n,h as r,v as i}from"./fullcalendar-Bn75j0xM.js";import{i as a}from"./motion-B3ZE8SGR.js";import{a as o}from"./index-
|
|
1
|
+
import{C as e,E as t,g as n,h as r,v as i}from"./fullcalendar-Bn75j0xM.js";import{i as a}from"./motion-B3ZE8SGR.js";import{a as o}from"./index-TvymvGva.js";function s(e){let t=``,n=!1;for(let r of String(e||``).trim())/^[a-z0-9]$/i.test(r)?(t+=r.toLowerCase(),n=!1):n||=(t+=`_`,!0);return t.replace(/^_+|_+$/g,``)||`mcp`}function c(e){return String(e||``).trim()}function l(e){return c(e).toLowerCase().startsWith(`mcp.`)}function u(e){let t=Array.isArray(e)?e:Array.isArray(e?.toolCache)?e.toolCache:Array.isArray(e?.tool_cache)?e.tool_cache:[],n=new Set,r=[];for(let e of t){let t=typeof e==`string`?c(e):e&&typeof e==`object`?c(e.namespaced_name||e.namespacedName||e.tool_name||e.toolName||e.name):``;!t||n.has(t)||(n.add(t),r.push(t))}return r}function d(e){let t=Array.isArray(e)?e:[],n=[],r=[],i=new Set,a=new Set;for(let e of t){let t=c(e);if(t){if(l(t)){if(i.has(t))continue;i.add(t),n.push(t);continue}a.has(t)||(a.add(t),r.push(t))}}return{mcpTools:n,otherTools:r}}function f(e,t){let n=u(e),r=u(t);return n.length&&n.length===r.length&&n.every(e=>r.includes(e))?null:r}function p({title:s,subtitle:c,discoveredTools:l,value:d,onChange:p,disabled:m=!1,emptyText:h=`No MCP tools have been discovered for this server yet.`,collapsible:g=!1,defaultCollapsed:_=!1}){let v=r(null),[y,b]=i(_),x=n(()=>u(l),[l]),S=n(()=>d===null?[...x]:u(d),[d,x]),C=n(()=>new Set(S),[S]),w=n(()=>new Set(x),[x]),T=x.filter(e=>C.has(e)).length,E=S.filter(e=>!w.has(e)),D=x.length>0&&T===x.length&&E.length===0;e(()=>{v.current&&o(v.current)},[y,x.length,E.length,T]);let O=e=>{m||p(e)},k=e=>{if(m)return;let t=new Set(d===null?x:S);t.has(e)?t.delete(e):t.add(e);let n=Array.from(t);p(f(x,n)===null?null:n)};return a(`div`,{ref:v,className:`grid gap-3 rounded-xl border border-slate-700/70 bg-slate-950/30 p-3`,children:[a(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[a(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[g?a(`button`,{type:`button`,className:`mt-0.5 rounded-full border border-slate-700/80 p-1 text-slate-300 transition hover:border-slate-500 hover:text-slate-100`,"aria-label":y?`Expand ${s}`:`Collapse ${s}`,"aria-expanded":!y,onClick:()=>b(e=>!e),children:a(`i`,{"data-lucide":`chevron-down`,className:`block h-4 w-4 transition-transform ${y?``:`rotate-180`}`})}):null,a(`div`,{className:`grid gap-1`,children:[a(`div`,{className:`text-sm font-medium text-slate-100`,children:s}),c?a(`div`,{className:`text-xs text-slate-400`,children:c}):null]})]}),a(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px] text-slate-400`,children:[a(`span`,{className:`rounded-full border border-slate-700 px-2 py-1`,children:d===null||D?`all discovered`:`${T}/${x.length||0} selected`}),y?null:a(t,{children:[a(`button`,{type:`button`,className:`rounded-full border border-slate-700 px-2 py-1 text-slate-200 transition hover:border-slate-500 disabled:cursor-not-allowed disabled:opacity-50`,disabled:m||!x.length,onClick:()=>O(null),children:`Select all`}),a(`button`,{type:`button`,className:`rounded-full border border-slate-700 px-2 py-1 text-slate-200 transition hover:border-slate-500 disabled:cursor-not-allowed disabled:opacity-50`,disabled:m||!S.length&&!E.length,onClick:()=>O([]),children:`Clear all`})]})]})]}),y?null:!x.length&&!E.length?a(`div`,{className:`text-xs text-slate-500`,children:h}):a(t,{children:[x.length?a(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:x.map(e=>{let t=d===null||C.has(e);return a(`label`,{className:`flex items-start gap-2 rounded-lg border px-3 py-2 text-sm transition ${t?`border-amber-400/40 bg-amber-400/10 text-amber-100`:`border-slate-700/70 bg-slate-950/20 text-slate-300`} ${m?`opacity-60`:`cursor-pointer`}`,children:[a(`input`,{type:`checkbox`,className:`mt-1`,checked:t,disabled:m,onChange:()=>k(e)}),a(`span`,{className:`break-all font-mono text-[11px] leading-5`,children:e})]},e)})}):null,E.length?a(`div`,{className:`grid gap-2`,children:[a(`div`,{className:`text-[11px] uppercase tracking-wide text-amber-200`,children:`Saved but not currently discovered`}),a(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>a(`label`,{className:`flex items-start gap-2 rounded-lg border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-sm text-amber-100 ${m?`opacity-60`:`cursor-pointer`}`,children:[a(`input`,{type:`checkbox`,className:`mt-1`,checked:!0,disabled:m,onChange:()=>k(e)}),a(`span`,{className:`break-all font-mono text-[11px] leading-5`,children:e})]},e))})]}):null]})]})}export{s as n,d as r,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,h as t,v as n}from"./fullcalendar-Bn75j0xM.js";import{t as r}from"./react-query-BIbNygEJ.js";import{i,n as a,r as o}from"./motion-B3ZE8SGR.js";import{a as s}from"./index-
|
|
1
|
+
import{C as e,h as t,v as n}from"./fullcalendar-Bn75j0xM.js";import{t as r}from"./react-query-BIbNygEJ.js";import{i,n as a,r as o}from"./motion-B3ZE8SGR.js";import{a as s}from"./index-TvymvGva.js";var c=[[`discovered_files`,`Discovered files`],[`indexed_files`,`Indexed files`],[`skipped_files`,`Skipped files`],[`deleted_files`,`Deleted files`],[`chunks_created`,`Chunks created`],[`errors`,`Errors`]];function l({open:l,client:u,initialPath:d=``,initialTier:f=`global`,initialProjectId:p=``,note:m=``,toast:h,onCancel:g,onSuccess:_}){let v=t(null),[y,b]=n({path:d,format:`directory`,tier:f,projectId:p,sessionId:``,syncDeletes:!1}),[x,S]=n(null);e(()=>{l&&(b({path:d,format:`directory`,tier:f,projectId:p,sessionId:``,syncDeletes:!1}),S(null))},[d,p,f,l]),e(()=>{!l||!v.current||s(v.current)},[y.format,y.syncDeletes,y.tier,l,x]),e(()=>{if(!l||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),g())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,l]);let C=r({mutationFn:()=>u.memory.importPath({path:y.path.trim(),format:y.format,tier:y.tier,projectId:y.projectId.trim()||void 0,sessionId:y.sessionId.trim()||void 0,syncDeletes:y.syncDeletes}),onSuccess:async e=>{S(e),h(`ok`,`Indexed ${e.indexed_files} file(s) and created ${e.chunks_created} chunk(s).`),await _?.(e)},onError:e=>{h(`err`,e instanceof Error?e.message:String(e))}}),w=y.tier===`project`,T=y.tier===`session`,E=!y.path.trim(),D=w&&!y.projectId.trim()||T&&!y.sessionId.trim();return i(o,{children:l?i(a.div,{className:`tcp-confirm-overlay`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:g,children:i(a.div,{ref:v,className:`tcp-confirm-dialog w-[min(42rem,96vw)]`,initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.98},onClick:e=>e.stopPropagation(),children:[i(`h3`,{className:`tcp-confirm-title`,children:`Import Knowledge`}),i(`div`,{className:`tcp-confirm-message`,children:`Index this file or folder so Tandem agents can retrieve it as governed memory.`}),m?i(`div`,{className:`mb-3 rounded-lg border border-amber-500/20 bg-amber-950/20 p-2 text-xs text-amber-100`,children:m}):null,i(`div`,{className:`grid gap-3 text-left`,children:[i(`label`,{className:`grid gap-1`,children:[i(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Path`}),i(`input`,{className:`tcp-input`,value:y.path,placeholder:`/srv/tandem/imports/company-docs`,onChange:e=>b({...y,path:e.target.value})})]}),i(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[i(`label`,{className:`grid gap-1`,children:[i(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Format`}),i(`select`,{className:`tcp-select`,value:y.format,onChange:e=>b({...y,format:e.target.value}),children:[i(`option`,{value:`directory`,children:`directory`}),i(`option`,{value:`openclaw`,children:`openclaw`})]})]}),i(`label`,{className:`grid gap-1`,children:[i(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Tier`}),i(`select`,{className:`tcp-select`,value:y.tier,onChange:e=>b({...y,tier:e.target.value}),children:[i(`option`,{value:`global`,children:`global`}),i(`option`,{value:`project`,children:`project`}),i(`option`,{value:`session`,children:`session`})]})]}),i(`label`,{className:`flex items-center gap-2 rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-sm`,children:[i(`input`,{type:`checkbox`,className:`h-4 w-4 accent-sky-400`,checked:y.syncDeletes,onChange:e=>b({...y,syncDeletes:e.target.checked})}),`Sync deletes`]})]}),i(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(`label`,{className:`grid gap-1`,children:[i(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`project_id`}),i(`input`,{className:`tcp-input`,value:y.projectId,placeholder:w?`company-brain-demo`:`optional`,onChange:e=>b({...y,projectId:e.target.value})})]}),i(`label`,{className:`grid gap-1`,children:[i(`span`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`session_id`}),i(`input`,{className:`tcp-input`,value:y.sessionId,placeholder:T?`session id`:`optional`,onChange:e=>b({...y,sessionId:e.target.value})})]})]})]}),x?i(`div`,{className:`mt-3 grid gap-2 rounded-xl border border-white/10 bg-black/20 p-3 text-left`,children:[i(`div`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:`Import stats`}),i(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:c.map(([e,t])=>i(`div`,{className:`rounded-lg border border-white/10 bg-black/10 p-2`,children:[i(`div`,{className:`tcp-subtle text-[11px]`,children:t}),i(`div`,{className:`mt-1 font-semibold tabular-nums`,children:Number(x[e]||0)})]},e))})]}):null,i(`div`,{className:`tcp-confirm-actions mt-3`,children:[i(`button`,{type:`button`,className:`tcp-btn`,onClick:g,children:[i(`i`,{"data-lucide":`x`}),`Close`]}),i(`button`,{type:`button`,className:`tcp-btn-primary`,disabled:E||D||C.isPending,onClick:()=>C.mutate(),children:[i(`i`,{"data-lucide":`database-zap`}),C.isPending?`Importing...`:`Import to Memory`]})]})]})}):null})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,g as t,v as n}from"./fullcalendar-Bn75j0xM.js";import{a as r,n as i,t as a}from"./react-query-BIbNygEJ.js";import{i as o,n as s,r as c}from"./motion-B3ZE8SGR.js";import{T as l,h as u,m as d,s as f,u as p,x as m}from"./index-TvymvGva.js";import{t as h}from"./MemoryImportDialog-DSpS1JF5.js";var g=new Set([`user_message`,`assistant_message`,`assistant_response`,`assistant_final`,`channel_message`,`session_message`]);function _(e,t){return Array.isArray(e)?e:Array.isArray(e?.[t])?e[t]:[]}function v(e,t){let n=t.trim().toLowerCase();if(g.has(n)||n.endsWith(`_message`)||n.includes(`message`))return!0;let r=e?.metadata||{},i=e?.provenance||{},a=String(r?.origin||i?.origin_event_type||``).toLowerCase();return a.includes(`message`)||a.includes(`channel`)}function y({api:g,client:y,toast:b}){let x=r(),[S,C]=n(``),[w,T]=n(`knowledge`),[E,D]=n(null),[O,k]=n(!1),[A,j]=n(!1),[M,N]=n(``),[P,F]=n(`note`),[I,L]=n(``),[R,z]=n(`private`),B=i({queryKey:[`memory`,S],queryFn:()=>(S.trim()?y.memory.search({query:S,limit:40}):y.memory.list({q:``,limit:40})).catch(()=>({items:[]})),refetchInterval:15e3}),V=a({mutationFn:e=>y.memory.delete(e),onSuccess:async()=>{b(`ok`,`Memory record deleted.`),await x.invalidateQueries({queryKey:[`memory`]})},onError:e=>b(`err`,e instanceof Error?e.message:String(e))}),H=a({mutationFn:async()=>{let e=I.trim()||`default`,t=R===`shared`?`project`:`session`,n=`manual-memory-${Date.now()}`;return g(`/api/engine/memory/put`,{method:`POST`,body:JSON.stringify({run_id:n,partition:{org_id:`local`,workspace_id:`control-panel`,project_id:e,tier:t},kind:P,content:M.trim(),classification:`internal`,metadata:{origin:`control_panel_manual_add`,visibility:R},capability:{run_id:n,subject:`control-panel`,org_id:`local`,workspace_id:`control-panel`,project_id:e,memory:{read_tiers:[`session`,`project`],write_tiers:[t],promote_targets:[`project`],require_review_for_promote:!1,allow_auto_use_tiers:[`curated`]},expires_at:9007199254740991}})})},onSuccess:async()=>{b(`ok`,`Memory saved.`),N(``),j(!1),await x.invalidateQueries({queryKey:[`memory`]})},onError:e=>b(`err`,e instanceof Error?e.message:String(e))}),U=_(B.data,`items`),W=_(B.data,`results`),G=U.length?U:W,K=t(()=>G.map((e,t)=>{let n=String(e?.id||`mem-${t}`),r=String(e?.text||e?.content||e?.value||``),i=r.length>340?`${r.slice(0,340)}...`:r,a=e?.metadata||{},o=e?.linkage||{},s=String(e?.source_path||e?.sourcePath||a?.path||a?.source_path||a?.import_root||``),c=String(e?.source_type||e?.sourceType||e?.kind||e?.source||``),l=String(e?.project_tag||e?.projectTag||e?.project_id||e?.projectId||o?.project_id||a?.project_id||``),u=String(e?.visibility||a?.visibility||``),d=String(e?.run_id||e?.runId||o?.run_id||``);return{id:n,text:r,compact:i,html:p(r),sourcePath:s,sourceType:c,project:l,visibility:u,runId:d,runtime:v(e,c)}}),[G]),q=K.filter(e=>!e.runtime).length,J=K.filter(e=>e.runtime).length,Y=K.filter(e=>w===`knowledge`?!e.runtime:w===`runtime`?e.runtime:!0),X=w===`knowledge`?`No governed knowledge records found. Import docs or add memory to seed this view.`:w===`runtime`?`No runtime message records found.`:`No memory records found.`;return o(d,{className:`grid gap-4`,children:[o(m,{title:`Memory`,subtitle:`Search recent records and open full entry details inline.`,actions:o(e,{children:[o(u,{tone:`info`,children:[Y.length,` results`]}),S.trim()?o(u,{tone:`ghost`,children:[`Filter: `,S]}):o(u,{tone:`ghost`,children:w===`knowledge`?`Governed knowledge`:w===`runtime`?`Runtime messages`:`All memory`}),o(`button`,{type:`button`,className:`tcp-btn-primary`,onClick:()=>k(!0),children:[o(`i`,{"data-lucide":`database-zap`}),`Import Knowledge`]}),o(`button`,{type:`button`,className:`tcp-btn`,onClick:()=>j(e=>!e),children:[o(`i`,{"data-lucide":`plus`}),`Add Memory`]})]}),children:[A?o(`div`,{className:`mb-3 grid gap-3 rounded-xl border border-white/10 bg-black/20 p-3`,children:[o(`textarea`,{className:`tcp-input min-h-28 resize-y`,value:M,onChange:e=>N(e.target.value),placeholder:`Store a durable note, fact, or solution capsule.`}),o(`div`,{className:`grid gap-3 md:grid-cols-[1fr_1fr_1fr_auto]`,children:[o(`select`,{className:`tcp-select`,value:P,onChange:e=>F(e.target.value),children:[o(`option`,{value:`note`,children:`note`}),o(`option`,{value:`fact`,children:`fact`}),o(`option`,{value:`solution_capsule`,children:`solution_capsule`})]}),o(`input`,{className:`tcp-input`,value:I,onChange:e=>L(e.target.value),placeholder:`project id`}),o(`select`,{className:`tcp-select`,value:R,onChange:e=>z(e.target.value),children:[o(`option`,{value:`private`,children:`private`}),o(`option`,{value:`shared`,children:`shared`})]}),o(`button`,{type:`button`,className:`tcp-btn-primary`,disabled:!M.trim()||H.isPending,onClick:()=>H.mutate(),children:[o(`i`,{"data-lucide":`save`}),`Save`]})]})]}):null,o(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[[`knowledge`,`Knowledge`,q],[`runtime`,`Runtime`,J],[`all`,`All`,K.length]].map(([e,t,n])=>o(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs ${w===e?`border-sky-500/40 bg-sky-950/20 text-sky-100`:``}`.trim(),onClick:()=>T(e),children:[t,o(`span`,{className:`tcp-badge tcp-badge-ghost ml-1`,children:n})]},String(e)))}),o(l,{className:`mb-3`,children:[o(`input`,{className:`tcp-input flex-1`,value:S,onInput:e=>C(e.target.value),placeholder:`Search memory`}),o(`button`,{className:`tcp-btn`,onClick:()=>B.refetch(),children:[o(`i`,{"data-lucide":`search`}),`Search`]})]}),o(`div`,{className:`grid gap-2`,children:Y.length?Y.map(e=>{let t=E===e.id;return o(s.article,{layout:!0,className:`tcp-list-item cursor-pointer ${t?`border-amber-500/60`:``}`,onClick:()=>D(t?null:e.id),children:[o(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[o(`strong`,{className:`truncate`,children:e.id}),o(`div`,{className:`flex items-center gap-2`,children:[o(u,{tone:t?`info`:`ghost`,children:t?`expanded`:`compact`}),o(`button`,{className:`tcp-btn-danger h-7 px-2 text-xs`,onClick:t=>{t.stopPropagation(),V.mutate(e.id)},children:[o(`i`,{"data-lucide":`trash-2`}),`Delete`]})]})]}),o(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[e.sourceType?o(u,{tone:`ghost`,children:e.sourceType}):null,e.project?o(u,{tone:`info`,children:e.project}):null,e.visibility?o(u,{tone:`ghost`,children:e.visibility}):null,e.runId?o(u,{tone:`ghost`,children:e.runId}):null]}),e.sourcePath?o(`div`,{className:`tcp-subtle mb-2 truncate text-[11px]`,children:e.sourcePath}):null,o(c,{initial:!1,mode:`wait`,children:t?o(s.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18,ease:`easeOut`},className:`overflow-hidden`,children:o(`div`,{className:`tcp-markdown tcp-markdown-ai rounded-lg border border-slate-700/60 bg-black/20 p-3 text-sm`,dangerouslySetInnerHTML:{__html:e.html}})},`expanded`):o(s.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.14,ease:`easeOut`},className:`tcp-subtle whitespace-pre-wrap text-xs`,children:e.compact||`(empty)`},`compact`)})]},e.id)}):o(f,{text:X})})]}),o(h,{open:O,client:y,initialTier:`global`,toast:b,onCancel:()=>k(!1),onSuccess:async()=>{await x.invalidateQueries({queryKey:[`memory`]})}})]})}export{y as MemoryPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as e,E as t,b as n,g as r,h as i,v as a,x as o}from"./fullcalendar-Bn75j0xM.js";import{a as s,n as c,t as l}from"./react-query-BIbNygEJ.js";import{i as u,n as d,r as ee,t as te}from"./motion-B3ZE8SGR.js";import{a as ne,s as f,u as re}from"./index-
|
|
1
|
+
import{C as e,E as t,b as n,g as r,h as i,v as a,x as o}from"./fullcalendar-Bn75j0xM.js";import{a as s,n as c,t as l}from"./react-query-BIbNygEJ.js";import{i as u,n as d,r as ee,t as te}from"./motion-B3ZE8SGR.js";import{a as ne,s as f,u as re}from"./index-TvymvGva.js";import{n as ie,t as ae}from"./TaskBoard-CCY_Qy5S.js";import{n as oe}from"./LazyJson-vfWw7G9F.js";import{t as p}from"./sse-B4A2m-Nk.js";import{t as se}from"./useEngineStream-Diqri33l.js";import{t as ce}from"./messages-uD0aB_MZ.js";function le(e){return e>=1?`bg-rose-500`:e>=.8?`bg-amber-500`:`bg-emerald-500`}function m(e,t){return!t||t<=0?0:Math.min(e/t,1)}function h({label:e,used:t,max:n,unit:r,advisory:i=!1}){let a=m(t,n),o=i?a>=.8?`bg-sky-400`:`bg-cyan-500`:le(a);return u(`div`,{className:`grid gap-1`,children:[u(`div`,{className:`flex items-center justify-between text-xs`,children:[u(`span`,{className:`tcp-subtle`,children:e}),u(`span`,{className:`font-mono text-[11px] text-slate-200`,children:[t.toLocaleString(),r||``,` / `,n.toLocaleString(),r||``]})]}),u(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-slate-800/80`,children:u(`div`,{className:`h-full ${o}`,style:{width:`${a*100}%`}})})]})}function ue({budget:e}){let[t,n]=a(!1),r=e.limits_enforced===!1,i=Math.max(m(e.iterations_used,e.max_iterations),m(e.tokens_used,e.max_tokens),m(e.wall_time_secs,e.max_wall_time_secs),m(e.subagent_runs_used,e.max_subagent_runs));return u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-900/25 p-3`,children:[u(`button`,{className:`flex w-full items-center justify-between`,onClick:()=>n(e=>!e),children:[u(`div`,{className:`text-sm font-medium`,children:`Budget + Tokens`}),u(`div`,{className:`flex items-center gap-2`,children:[u(`div`,{className:`h-2 w-24 overflow-hidden rounded-full bg-slate-800/80`,children:u(`div`,{className:`h-full ${r?i>=.8?`bg-sky-400`:`bg-cyan-500`:le(i)}`,style:{width:`${i*100}%`}})}),u(`span`,{className:`tcp-subtle text-xs`,children:[Math.round(i*100),`%`]})]})]}),t?u(`div`,{className:`mt-3 grid gap-3 border-t border-slate-700/60 pt-3`,children:[u(h,{label:`Iterations`,used:e.iterations_used,max:e.max_iterations,advisory:r}),u(h,{label:`Tokens`,used:e.tokens_used,max:e.max_tokens,advisory:r}),u(h,{label:`Wall time`,used:e.wall_time_secs,max:e.max_wall_time_secs,unit:`s`,advisory:r}),u(h,{label:`Agent calls`,used:e.subagent_runs_used,max:e.max_subagent_runs,advisory:r}),r?u(`div`,{className:`rounded border border-cyan-500/30 bg-cyan-950/20 p-2 text-xs text-cyan-100`,children:`Advisory usage only. This run does not expose explicit enforced budget caps, so these limits are relaxed defaults for visibility.`}):null,e.exceeded&&e.exceeded_reason?u(`div`,{className:`rounded border border-rose-500/40 bg-rose-950/30 p-2 text-xs text-rose-200`,children:e.exceeded_reason}):null]}):null]})}function g(e,t=0){return String(e?.run_id||e?.runId||`run-${t}`).trim()}function de(e){let t=Number(e?.updated_at_ms||e?.updatedAtMs||0),n=Number(e?.created_at_ms||e?.createdAtMs||0),r=Number.isFinite(t)&&t>0?t:n;return Number.isFinite(r)&&r>0?r:0}function _(e,t=``){let n=String(t||``).trim(),r=[...Array.isArray(e)?e:[]].sort((e,t)=>de(t)-de(e));if(n){let e=r.find((e,t)=>g(e,t)===n);if(e){let t=String(e?.status||``).trim().toLowerCase();if(![`completed`,`failed`,`cancelled`].includes(t))return n}}let i=r.find(e=>{let t=String(e?.status||``).trim().toLowerCase();return![`completed`,`failed`,`cancelled`].includes(t)})||r[0];return i?g(i):``}function v(e,t){if(t.type===`sync_runs`){let n={},r=[];for(let e=0;e<t.runs.length;e+=1){let i=t.runs[e],a=g(i,e);a&&(n[a]=i,r.push(a))}let i=e.selectedRunId;return i||=_(t.runs,t.preferredRunId),{runsById:n,orderedRunIds:r,selectedRunId:i,cursorsByRunId:e.cursorsByRunId}}if(t.type===`select_run`)return{...e,selectedRunId:String(t.runId||``).trim()};if(t.type===`clear_selection`)return{...e,selectedRunId:``};if(t.type===`advance_cursor`){let n=String(t.runId||``).trim();if(!n)return e;let r=Number(t.seq||0);if(!Number.isFinite(r)||r<=0)return e;let i=String(t.kind||``).trim().toLowerCase(),a=e.cursorsByRunId[n]||{eventSeq:0,patchSeq:0},o={eventSeq:i===`context_run_event`?Math.max(a.eventSeq,r):a.eventSeq,patchSeq:i===`blackboard_patch`?Math.max(a.patchSeq,r):a.patchSeq};return o.eventSeq===a.eventSeq&&o.patchSeq===a.patchSeq?e:{...e,cursorsByRunId:{...e.cursorsByRunId,[n]:o}}}return e}function fe(t,i=``){let[a,o]=n(v,{runsById:{},orderedRunIds:[],selectedRunId:``,cursorsByRunId:{}});e(()=>{o({type:`sync_runs`,runs:Array.isArray(t)?t:[],preferredRunId:i})},[t,i]);let s=r(()=>a.orderedRunIds.map(e=>a.runsById[e]).filter(Boolean),[a.orderedRunIds,a.runsById]);return{runsById:a.runsById,orderedRunIds:a.orderedRunIds,orderedRuns:s,selectedRunId:a.selectedRunId,cursorsByRunId:a.cursorsByRunId,setSelectedRunId:e=>o({type:`select_run`,runId:e}),clearSelectedRunId:()=>o({type:`clear_selection`}),advanceCursor:(e,t,n)=>o({type:`advance_cursor`,runId:e,kind:t,seq:n})}}function pe(e){let t={},n={};for(let[r,i]of Object.entries(e||{})){let e=Number(i?.eventSeq||0),a=Number(i?.patchSeq||0);e>0&&(t[r]=e),a>0&&(n[r]=a)}let r=JSON.stringify({events:t,patches:n});return!r||r===`{"events":{},"patches":{}}`?``:btoa(r).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function me({workspace:t,runIds:n,cursorToken:i,onEnvelope:a,onError:o}){let s=r(()=>[...new Set((n||[]).map(e=>String(e||``).trim()).filter(Boolean))],[n]),c=r(()=>{let e=String(t||``).trim();if(!e||!s.length)return``;let n=new URLSearchParams;return n.set(`workspace`,e),n.set(`runIds`,s.join(`,`)),i&&n.set(`cursor`,i),`/api/orchestrator/events?${n.toString()}`},[i,s,t]);e(()=>{if(!c)return;let e=p(c,e=>{let t=null;try{t=JSON.parse(String(e?.data||`{}`))}catch{return}!t||typeof t!=`object`||a(t)},{onError:e=>{o&&o(e)}});return()=>e()},[a,o,c])}var he={max_iterations:500,iterations_used:0,max_tokens:4e5,tokens_used:0,max_wall_time_secs:10080*60,wall_time_secs:0,max_subagent_runs:2e3,subagent_runs_used:0,exceeded:!1,exceeded_reason:``,limits_enforced:!1,source:`derived`};function y(e){let t=String(e||``).trim().toLowerCase();return t===`done`||t===`completed`||t===`active`?`tcp-badge-ok`:t===`failed`||t===`error`||t===`cancelled`||t===`canceled`?`tcp-badge-err`:t===`running`||t===`in_progress`||t===`runnable`?`tcp-badge-warn`:`tcp-badge-info`}function ge(e){let t=String(e||``).trim().toLowerCase();return{created:`Created`,pending:`Pending`,runnable:`Ready`,assigned:`Assigned`,in_progress:`In Progress`,blocked:`Blocked`,done:`Done`,failed:`Failed`,validated:`Validated`}[t]||t||`Unknown`}function _e(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?`Run`:`Run ${new Date(t).toLocaleTimeString()}`}function ve(e){return Number(e?.updated_at_ms||e?.created_at_ms||0)}function b(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?`--:--:--`:new Date(t).toLocaleTimeString()}function ye(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?`0 B`:t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function be(e){let t=String(e||``).trim(),n=t.lastIndexOf(`.`);return n<0?``:t.slice(n+1).toLowerCase()}function x(e){let t=String(e||``).trim().replace(/\\/g,`/`);return t?t.startsWith(`/`)?t.replace(/\/{2,}/g,`/`):t:``}function xe(e,t){let n=x(e).replace(/\/+$/,``),r=x(t).replace(/^\/+/,``);return n?r?`${n}/${r}`:n:r}function Se(e,t){let n=x(e).replace(/\/+$/,``),r=x(t);return!n||!r?!1:r===n?!0:r.startsWith(`${n}/`)}function Ce(e){let t=[e?.workspace?.canonical_path,e?.workspace?.path,e?.workspace?.root,e?.workspace_root,e?.workspacePath,e?.cwd,e?.path];for(let e of t){let t=x(String(e||``));if(t.startsWith(`/`))return t}return``}function we(e){let t={};for(let n of e){let e=String(n?.type||``).trim().toLowerCase();if(![`task_started`,`step_started`,`task_completed`,`step_completed`].includes(e))continue;let r=String(n?.step_id||``).trim();if(!r)continue;let i=Number(n?.seq||0);!Number.isFinite(i)||i<=0||(t[r]=Math.max(Number(t[r]||0),i))}return t}function Te(e){return String(e?.event_type||e?.type||e?.event||`workflow.event`).trim().toLowerCase()}function Ee(e){let t=[`type: ${String(e.type||``).trim()||`unknown`}`,`task: ${String(e.taskId||``).trim()||`n/a`}`,`title: ${String(e.title||``).trim()||`n/a`}`,`mode: ${String(e.mode||``).trim()||`strict`}`,`at: ${b(e.at)}`,``,`reason:`,String(e.reason||``).trim()||`No verification detail.`],n=e.verification?.execution_trace;return n&&typeof n==`object`&&t.push(``,`execution_trace:`,`session: ${String(n.session_id||`n/a`)}`,`model: ${[String(n?.model?.provider||``).trim(),String(n?.model?.model_id||``).trim()].filter(Boolean).join(` / `)||`unknown`}`,`source: ${String(n?.model?.source||`n/a`)}`),t.push(``,`verification_json:`,JSON.stringify(e.verification||{},null,2)),t.join(`
|
|
2
2
|
`)}function S(e){let t=String(e?.task_id||e?.taskID||``).trim();if(t)return t;let n=e?.source_event_id||e?.sourceEventID,r=String(n||``).trim();if(!r)return``;let i=r.lastIndexOf(`:`);return i<0?``:r.slice(i+1).trim()}function De({api:n,toast:p,navigate:le}){let m=s(),h=!!te(),g=i(null),[de,_]=a(!0),[v,x]=a(!1),[De,Oe]=a(``),[C,ke]=a(``),[Ae,w]=a(!1),[je,Me]=a(``),[Ne,T]=a(``),[Pe,Fe]=a(!1),[Ie,Le]=a(`4`),[Re,ze]=a(`3`),[Be,Ve]=a(`swarm.blackboard.default`),[He,Ue]=a(``),[E,We]=a(``),[D,Ge]=a(``),[O,Ke]=a(``),[qe,Je]=a([]),[k,A]=a(``),[Ye,j]=a(``),[Xe,Ze]=a(``),[M,Qe]=a(!1);e(()=>{_(!0),nt()},[]);let N=c({queryKey:[`swarm`,`status`],queryFn:()=>n(`/api/orchestrator/status`),refetchInterval:5e3}),$e=c({queryKey:[`swarm`,`runs`,C],queryFn:()=>n(`/api/orchestrator/runs?workspace=${encodeURIComponent(C||``)}`),refetchInterval:6e3,enabled:!!N.data}),P=fe(Array.isArray($e.data?.runs)?$e.data.runs:[],String(N.data?.runId||``).trim()),et=P.selectedRunId,tt=P.setSelectedRunId,nt=P.clearSelectedRunId,rt=P.advanceCursor,F=de?``:String(et||``).trim(),I=P.orderedRuns,it=r(()=>{if(!F)return null;for(let e of I)if(String(e?.run_id||e?.runId||``).trim()===F)return e;return null},[I,F]),at=r(()=>pe(P.cursorsByRunId),[P.cursorsByRunId]),ot=String(C||N.data?.workspaceRoot||``).trim(),st=r(()=>{let e=String(F||``).trim();return e?[e]:[]},[F]),ct=i(0);me({workspace:ot,runIds:st,cursorToken:at,onEnvelope:o(e=>{let t=String(e?.kind||``).trim().toLowerCase(),n=String(e?.run_id||e?.runId||``).trim();if(F&&n&&n!==F)return;let r=Number(e?.seq||0);n&&r>0&&(t===`context_run_event`||t===`blackboard_patch`)&&rt(n,t,r);let i=Date.now();i-ct.current<900||(ct.current=i,m.invalidateQueries({queryKey:[`swarm`,`runs`]}),F&&m.invalidateQueries({queryKey:[`swarm`,`run`,F]}))},[rt,m,F])});let L=c({queryKey:[`swarm`,`run`,F],queryFn:()=>n(`/api/orchestrator/run/${encodeURIComponent(F)}`),refetchInterval:4e3,enabled:!!F}),lt=c({queryKey:[`swarm`,`workspace-browser`,je],enabled:Ae&&!!je,queryFn:()=>n(`/api/orchestrator/workspaces/list?dir=${encodeURIComponent(je)}`)}),R=String(L.data?.runStatus||L.data?.run?.status||N.data?.status||`idle`).trim().toLowerCase(),ut=r(()=>ie(L.data),[L.data]),z=ut.tasks,dt=r(()=>({...he,...L.data?.budget||{}}),[L.data?.budget]),B=String(Ce(L.data?.run)||Ce(it)||(F?``:String(N.data?.workspaceRoot||C||``))).trim();e(()=>{B&&(We(e=>!e||!Se(B,e)?B:e),Ge(e=>Se(B,e)?e:``))},[B]);let ft=Array.isArray(lt.data?.directories)?lt.data.directories:[],V=String(Ne||``).trim().toLowerCase(),pt=r(()=>V?ft.filter(e=>String(e?.name||e?.path||``).trim().toLowerCase().includes(V)):ft,[ft,V]),H=String(lt.data?.parent||``).trim(),U=String(lt.data?.dir||je||``).trim(),W=c({queryKey:[`swarm`,`workspace-files`,B,E],enabled:!!B&&!!E,queryFn:async()=>{let e=await n(`/api/orchestrator/workspaces/files?workspaceRoot=${encodeURIComponent(B)}&dir=${encodeURIComponent(E)}`).catch(()=>({directories:[],files:[],parent:null,dir:E})),t=Array.isArray(e?.directories)?e.directories:[],r=(Array.isArray(e?.files)?e.files:[]).map(e=>{let t=String(e?.path||``).trim();return{...e,name:String(e?.name||t||`file`),path:t||xe(B,String(e?.name||``))}});return{ok:!0,dir:String(e?.dir||E),parent:e?.parent||null,directories:t,files:r,fileAccessAllowed:!0}},refetchInterval:1e4}),mt=c({queryKey:[`swarm`,`workspace-file`,B,D],enabled:!!B&&!!D,queryFn:async()=>n(`/api/orchestrator/workspaces/read?workspaceRoot=${encodeURIComponent(B)}&path=${encodeURIComponent(D)}`)}),ht=Array.isArray(W.data?.directories)?W.data.directories:[],gt=Array.isArray(W.data?.files)?W.data.files:[],_t=String(W.data?.parent||``).trim(),vt=W.data?.fileAccessAllowed!==!1,G=String(mt.data?.text||``),yt=be(D),bt=[`md`,`markdown`,`mdx`].includes(yt),K=[`html`,`htm`].includes(yt);e(()=>{M&&!K&&Qe(!1)},[K,M]);let xt=r(()=>z.map(e=>`${e.id}:${e.state}:${e.error_message||``}`).join(`|`),[z]),q=r(()=>z.find(e=>e.id===Ye)||null,[Ye,z]),St=r(()=>{let e=Array.isArray(L.data?.events)?L.data.events:[],t=null,n=0;for(let r of e){let e=String(r?.type||``).trim().toLowerCase();if(![`step_completed`,`task_completed`].includes(e))continue;let i=r?.payload&&typeof r.payload==`object`?r.payload:{},a=String(i?.session_id||``).trim();if(!a)continue;let o=Number(r?.ts_ms||0);(!t||o>=n)&&(t={sessionId:a,event:r},n=o)}return t},[L.data?.events]),Ct=r(()=>{let e=Array.isArray(L.data?.events)?L.data.events:[];for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n?.type||``).trim().toLowerCase();if(![`task_started`,`step_started`,`task_completed`,`step_completed`].includes(r))continue;let i=n?.payload&&typeof n.payload==`object`?n.payload:{},a=String(i?.session_id||``).trim();if(a)return a}return String(St?.sessionId||``).trim()},[St?.sessionId,L.data?.events]),wt=r(()=>{let e=Array.isArray(L.data?.events)?L.data.events:[],t=we(e),n=[];for(let r=e.length-1;r>=0;--r){let i=e[r],a=String(i?.type||``).trim().toLowerCase();if(![`task_started`,`task_completed`,`task_failed`,`step_started`,`step_completed`,`step_failed`,`run_resumed`,`run_paused`,`run_completed`,`run_failed`].includes(a))continue;let o=i?.payload&&typeof i.payload==`object`?i.payload:{},s=String(i?.step_id||``).trim(),c=Number(i?.seq||0);if((a===`task_failed`||a===`step_failed`)&&s&&Number.isFinite(c)&&c>0&&Number(t[s]||0)>c)continue;let l=String(o?.step_title||i?.step_id||a).trim(),u=String(o?.why_next_step||o?.error||``).trim();if(n.push({id:`${String(i?.seq||r)}-${a}`,type:a,title:l||a,detail:u,at:Number(i?.ts_ms||0)}),n.length>=12)break}return n},[L.data?.events]),Tt=r(()=>{let e=Array.isArray(L.data?.events)?L.data.events:[];for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n?.type||``).trim().toLowerCase();if(r===`plan_seeded_llm`)return`llm`;if(r===`plan_seeded_local`)return`fallback_local`;if(r===`plan_failed_llm_required`)return`llm_failed`}return`unknown`},[L.data?.events]),J=c({queryKey:[`swarm`,`run-output-session`,String(Ct||``)],queryFn:()=>n(`/api/engine/session/${encodeURIComponent(String(Ct||``))}`),refetchInterval:6e3,enabled:!!Ct}),Et=r(()=>{let e=ce(J.data,`Assistant`);for(let t=e.length-1;t>=0;--t)if(e[t]?.role===`assistant`&&String(e[t]?.text||``).trim())return String(e[t]?.text||``).trim();return``},[J.data]),Dt=r(()=>{let e=Array.isArray(J.data)?J.data:Array.isArray(J.data?.messages)?J.data.messages:[],t=[];for(let n=e.length-1;n>=0;--n){let r=e[n],i=Array.isArray(r?.parts)?r.parts:[];for(let e=i.length-1;e>=0;--e){let n=i[e];if(!String(n?.type||n?.part_type||``).trim().toLowerCase().includes(`tool`))continue;let r=String(n?.tool||n?.name||``).trim(),a=String(n?.state||n?.status||``).trim(),o=String(n?.error||``).trim(),s=[r||`tool`,a||null,o?`err=${o}`:null].filter(Boolean).join(` · `);if(t.push(s),t.length>=10)return t}}return t},[J.data]),Ot=r(()=>{let e=Array.isArray(L.data?.events)?L.data.events:[],t=we(e),n=[];for(let r=e.length-1;r>=0;--r){let i=e[r],a=String(i?.type||``).trim().toLowerCase();if(![`task_failed`,`step_failed`,`task_completed`,`step_completed`].includes(a))continue;let o=i?.payload&&typeof i.payload==`object`?i.payload:{},s=String(i?.step_id||``).trim(),c=Number(i?.seq||0);if((a===`task_failed`||a===`step_failed`)&&s&&Number.isFinite(c)&&c>0&&Number(t[s]||0)>c)continue;let l=o?.verification&&typeof o.verification==`object`?o.verification:{},u=String(l?.reason||o?.error||``).trim(),d=String(l?.mode||`strict`).trim()||`strict`;if(n.push({id:`${String(i?.seq||r)}-${a}`,taskId:s,title:String(o?.step_title||i?.step_id||a),type:a,reason:u,mode:d,at:Number(i?.ts_ms||0),verification:l}),n.length>=8)break}return n},[L.data?.events]),Y=r(()=>Ot.find(e=>e.id===Xe)||null,[Xe,Ot]);e(()=>{if(!Y&&!q&&!M||typeof document>`u`)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[Y,q,M]);let X=String(L.data?.run?.workflowId||L.data?.run?.workflow_id||it?.workflowId||it?.workflow_id||Be||``).trim(),kt=c({queryKey:[`workflow`,`detail`,X],enabled:!!X,queryFn:()=>n(`/api/engine/workflows/${encodeURIComponent(X)}`),refetchInterval:15e3}),At=c({queryKey:[`workflow`,`runs`,X],enabled:!!X,queryFn:()=>n(`/api/engine/workflows/runs?workflow_id=${encodeURIComponent(X)}&limit=12`).catch(()=>({runs:[]})),refetchInterval:5e3}),jt=Array.isArray(At.data?.runs)?At.data.runs:[],Mt=r(()=>{let e={};for(let t of jt){let n=S(t);if(!n)continue;let r=e[n]||{runs:0,failed:0};r.runs+=1,String(t?.status||``).trim().toLowerCase()===`failed`&&(r.failed+=1),e[n]=r}return e},[jt]),Z=r(()=>k?jt.filter(e=>S(e)===k):jt,[k,jt]),Nt=r(()=>{let e=[];for(let t of Z){let n=String(t?.run_id||``).trim(),r=S(t);for(let i of Array.isArray(t?.actions)?t.actions:[])e.push({id:`${n}:${String(i?.action_id||i?.action||e.length)}`,runId:n,action:String(i?.action||`unknown action`),status:String(i?.status||`unknown`),detail:String(i?.detail||``),output:i?.output,updatedAt:Number(i?.updated_at_ms||t?.updated_at_ms||0),taskId:String(i?.task_id||r||``).trim()})}return e.sort((e,t)=>t.updatedAt-e.updatedAt),e},[Z]);e(()=>{let e=Z;if(!e.length){Ke(``);return}e.some(e=>{let t=String(e?.run_id||``).trim();return t&&t===O})||Ke(String(e[0]?.run_id||``).trim())},[Z,O]);let Q=c({queryKey:[`workflow`,`run`,O],enabled:!!O,queryFn:()=>n(`/api/engine/workflows/runs/${encodeURIComponent(O)}`),refetchInterval:5e3}).data?.run||null;e(()=>{let e=S(Q);e&&A(e)},[Q?.run_id,Q?.source_event_id]),e(()=>{Je([])},[X]),se(`/api/engine/workflows/events${X?`?workflow_id=${encodeURIComponent(X)}`:``}`,e=>{try{let t=JSON.parse(e.data);if(t?.status===`ready`)return;Je(e=>[...e.slice(-79),{at:Date.now(),data:t}])}catch{}},{enabled:!!X});let Pt=l({mutationFn:()=>{let e=String(De||``).trim(),t=String(C||``).trim();if(!e)throw Error(`Enter a prompt first.`);if(!t)throw Error(`Set workspace path first.`);return n(`/api/orchestrator/start`,{method:`POST`,body:JSON.stringify({objective:e,workspaceRoot:t,maxTasks:Number(Ie||4),maxAgents:Number(Re||3),workflowId:String(Be||`swarm.blackboard.default`).trim(),requireLlmPlan:!0,allowLocalPlannerFallback:!1,verificationMode:`strict`})})},onSuccess:async e=>{let t=String(e?.runId||``).trim();t&&tt(t),_(!1),p(`ok`,`Planning started.`),await m.invalidateQueries({queryKey:[`swarm`]})},onError:e=>p(`err`,e instanceof Error?e.message:String(e))}),$=l({mutationFn:({path:e,body:t})=>n(e,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(e,t)=>{if(t.path===`/api/orchestrator/request_revision`){let t=String(e?.runId||``).trim();t&&(tt(t),Ue(``)),p(`ok`,`Reworked plan created.`)}t.path===`/api/orchestrator/approve`&&p(`ok`,`Execution started.`),await m.invalidateQueries({queryKey:[`swarm`]})},onError:e=>p(`err`,e instanceof Error?e.message:String(e))}),Ft=l({mutationFn:async e=>{let t=String(e||``).trim();if(!t)throw Error(`Missing run id.`);return await n(`/api/orchestrator/cancel`,{method:`POST`,body:JSON.stringify({runId:t})}).catch(()=>null),await n(`/api/orchestrator/runs/hide`,{method:`POST`,body:JSON.stringify({runIds:[t]})}).catch(()=>null),t},onSuccess:async()=>{nt(),_(!0),Ue(``),Oe(``),p(`ok`,`Discarded pending plan. You can start a new prompt now.`),await m.invalidateQueries({queryKey:[`swarm`]})},onError:e=>p(`err`,e instanceof Error?e.message:String(e))}),It=o(()=>{_(!0),nt(),x(!1),Ue(``)},[nt]);e(()=>{let e=g.current;e&&ne(e)},[de,v,I,F,R,E,ht.length,gt.length,D,G,Ye,Xe,M,xt]);let Lt=!F,Rt=R===`planning`||R===`queued`,zt=R===`awaiting_approval`,Bt=[`completed`,`failed`,`cancelled`].includes(R),Vt=R===`running`,Ht=R===`paused`,Ut=R===`failed`||R===`blocked`,Wt=[`queued`,`planning`,`awaiting_approval`,`running`,`paused`,`blocked`].includes(R),Gt=u(t,{children:[u(d.aside,{className:`chat-sessions-panel ${v?`open`:``}`,initial:!1,animate:h?{x:v?0:`-104%`}:{x:v?0:`-104%`,transition:{duration:.18,ease:`easeOut`}},children:[u(`div`,{className:`chat-sessions-header`,children:[u(`h3`,{className:`chat-sessions-title`,children:[u(`i`,{"data-lucide":`history`}),`History`]}),u(`div`,{className:`flex items-center gap-1`,children:u(`button`,{type:`button`,className:`tcp-btn h-8 px-2.5 text-xs`,onClick:()=>{m.invalidateQueries({queryKey:[`swarm`,`runs`]})},children:u(`i`,{"data-lucide":`refresh-cw`})})})]}),u(`div`,{className:`chat-session-list`,children:[u(ee,{children:I.map((e,t)=>{let n=String(e?.run_id||e?.runId||`run-${t}`),r=n===F;return u(d.div,{className:`chat-session-row`,initial:h?!1:{opacity:0,y:6},animate:h?void 0:{opacity:1,y:0},exit:h?void 0:{opacity:0,y:-6},children:u(`button`,{type:`button`,className:`chat-session-btn ${r?`active`:``}`,onClick:()=>{_(!1),tt(n),x(!1)},children:[u(`span`,{className:`mb-0.5 inline-flex items-center gap-1 text-xs font-medium`,children:[u(`i`,{"data-lucide":`history`}),u(`span`,{children:_e(ve(e))})]}),u(`span`,{className:`tcp-subtle line-clamp-2 block text-[11px]`,children:String(e?.objective||``).trim()||`No objective`})]})},n)})}),I.length?null:u(`p`,{className:`chat-rail-empty px-1 py-2`,children:`No runs yet.`})]})]}),u(ee,{children:v?u(d.button,{type:`button`,className:`chat-scrim open`,"aria-label":`Close history`,initial:h?!1:{opacity:0},animate:h?void 0:{opacity:1},exit:h?void 0:{opacity:0},onClick:()=>x(!1)}):null})]});if(Lt){let e=String(De||``).trim().length>0&&String(C||``).trim().length>0;return u(t,{children:[u(`div`,{ref:g,className:`chat-layout min-w-0 min-h-0 h-full w-full flex-1`,children:[Gt,u(`div`,{className:`min-h-0 min-w-0 w-full`,children:u(`div`,{className:`flex h-full min-h-0 w-full flex-col gap-4 p-4 md:p-5`,children:[u(`div`,{className:`mb-3`,children:[u(`div`,{className:`inline-flex items-center gap-2 text-sm font-semibold`,children:[u(`button`,{type:`button`,className:`chat-icon-btn h-8 w-8`,title:`History`,onClick:()=>x(e=>!e),children:u(`i`,{"data-lucide":`history`})}),u(`span`,{children:`Task Board`})]}),u(`div`,{className:`tcp-subtle mt-1 text-sm`,children:`Describe the goal. The planner will build a task board.`})]}),u(`div`,{className:`grid min-h-0 flex-1 w-full content-start gap-3`,children:[u(`textarea`,{className:`tcp-input min-h-[360px] md:min-h-[52vh]`,placeholder:`What do you want the agents to build?`,value:De,onInput:e=>Oe(e.target.value)}),u(`div`,{className:`grid gap-2 md:grid-cols-[auto_1fr]`,children:[u(`button`,{className:`tcp-btn`,onClick:()=>{Me(String(C||N.data?.workspaceRoot||`/`).trim()||`/`),T(``),w(!0)},children:[u(`i`,{"data-lucide":`folder-open`}),`Browse`]}),u(`input`,{className:`tcp-input`,readOnly:!0,placeholder:`No workspace selected. Use Browse.`,value:C})]}),u(`div`,{className:`tcp-subtle text-xs`,children:[`Selected folder: `,C||`none`]}),C?null:u(`div`,{className:`rounded-lg border border-amber-400/40 bg-amber-950/20 p-2 text-xs text-amber-200`,children:`Select a workspace folder before sending.`}),u(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[u(`button`,{className:`tcp-btn-primary`,onClick:()=>Pt.mutate(),disabled:Pt.isPending||!e,children:[u(`i`,{"data-lucide":`send`}),`Send`]}),u(`button`,{className:`tcp-btn`,type:`button`,onClick:()=>Fe(e=>!e),children:[u(`i`,{"data-lucide":`sliders-horizontal`}),Pe?`Hide Advanced`:`Show Advanced`]})]}),Pe?u(`div`,{className:`grid gap-2 rounded-lg border border-slate-700/60 bg-slate-900/20 p-2 md:grid-cols-3`,children:[u(`input`,{className:`tcp-input`,type:`number`,min:`1`,value:Ie,onInput:e=>Le(e.target.value),title:`max tasks`}),u(`input`,{className:`tcp-input`,type:`number`,min:`1`,max:`16`,value:Re,onInput:e=>ze(e.target.value),title:`max agents`}),u(`input`,{className:`tcp-input`,value:Be,onInput:e=>Ve(e.target.value),title:`workflow id`}),u(`div`,{className:`tcp-subtle md:col-span-3 text-xs`,children:`Workflow id controls task routing template. Keep default unless you have a custom workflow.`})]}):null]})]})})]}),Ae?u(`div`,{className:`tcp-confirm-overlay`,children:u(`div`,{className:`tcp-confirm-dialog max-w-2xl`,children:[u(`h3`,{className:`tcp-confirm-title`,children:`Select Workspace Folder`}),u(`p`,{className:`tcp-confirm-message`,children:[`Current: `,U||`n/a`]}),u(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[u(`button`,{className:`tcp-btn`,onClick:()=>{H&&Me(H)},disabled:!H,children:[u(`i`,{"data-lucide":`arrow-up-circle`}),`Up`]}),u(`button`,{className:`tcp-btn-primary`,onClick:()=>{U&&(ke(U),w(!1),T(``),p(`ok`,`Workspace selected: ${U}`))},children:[u(`i`,{"data-lucide":`badge-check`}),`Select This Folder`]}),u(`button`,{className:`tcp-btn`,onClick:()=>{w(!1),T(``)},children:[u(`i`,{"data-lucide":`x`}),`Close`]})]}),u(`div`,{className:`mb-2`,children:u(`input`,{className:`tcp-input`,placeholder:`Type to filter folders...`,value:Ne,onInput:e=>T(e.target.value)})}),u(`div`,{className:`max-h-[360px] overflow-auto rounded-lg border border-slate-700/60 bg-slate-900/20 p-2`,children:pt.length?pt.map(e=>u(`button`,{className:`tcp-list-item mb-1 w-full text-left`,onClick:()=>Me(String(e?.path||``)),children:[u(`i`,{"data-lucide":`folder-open`}),String(e?.name||e?.path||``)]},String(e?.path||e?.name))):u(f,{text:V?`No folders match your search.`:`No subdirectories in this folder.`})})]})}):null]})}return u(t,{children:[u(`div`,{ref:g,className:`chat-layout min-w-0 min-h-0 h-full w-full flex-1`,children:[Gt,u(`div`,{className:`min-h-0 min-w-0 w-full`,children:u(`div`,{className:`grid h-full min-h-[calc(100vh-240px)] min-w-0 w-full gap-5 p-4 md:p-5 xl:grid-cols-[1.05fr_1fr]`,children:[u(`div`,{className:`flex h-full min-h-0 w-full flex-col gap-3`,children:[u(`div`,{className:`mb-3`,children:[u(`div`,{className:`inline-flex items-center gap-2 text-sm font-semibold`,children:[u(`button`,{type:`button`,className:`chat-icon-btn h-8 w-8`,title:`History`,onClick:()=>x(e=>!e),children:u(`i`,{"data-lucide":`history`})}),u(`button`,{type:`button`,className:`chat-icon-btn h-8 w-8`,title:`Back to start`,onClick:It,children:u(`i`,{"data-lucide":`arrow-left-to-line`})}),u(`span`,{children:`Task Board Run`})]}),u(`div`,{className:`tcp-subtle mt-1 text-sm`,children:`Plan review and execution`})]}),u(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 text-xs`,children:[u(`span`,{className:y(R),children:R||`unknown`}),u(`span`,{className:`inline-flex items-center gap-1 tcp-subtle`,children:[u(`i`,{"data-lucide":`history`}),u(`span`,{children:_e(L.data?.run?.updated_at_ms||L.data?.run?.created_at_ms)})]}),u(`span`,{className:`tcp-subtle`,children:[`id: `,F]}),u(`span`,{className:`tcp-subtle`,children:[`plan: `,Tt]})]}),Rt?u(`div`,{className:`mb-3 rounded-xl border border-slate-700/60 bg-slate-900/25 p-3`,children:[u(`div`,{className:`mb-1 text-sm font-medium`,children:`Planner is formulating a plan...`}),u(`div`,{className:`tcp-subtle text-xs`,children:`Waiting for tasks to be generated.`})]}):null,zt?u(`div`,{className:`mb-3 rounded-xl border border-amber-500/40 bg-amber-950/20 p-3`,children:[u(`div`,{className:`mb-2 text-sm font-medium text-amber-200`,children:`Plan Ready`}),u(`div`,{className:`mb-2 text-xs text-amber-100/90`,children:`Review the kanban. Request a rework or execute.`}),u(`textarea`,{className:`tcp-input mb-2 min-h-[80px]`,placeholder:`Feedback to rework the plan...`,value:He,onInput:e=>Ue(e.target.value)}),u(`div`,{className:`flex flex-wrap gap-2`,children:[u(`button`,{className:`tcp-btn`,disabled:!He.trim(),onClick:()=>$.mutate({path:`/api/orchestrator/request_revision`,body:{runId:F,feedback:He,maxTasks:Number(Ie||4),maxAgents:Number(Re||3),workflowId:Be}}),children:[u(`i`,{"data-lucide":`pencil`}),`Rework Plan`]}),u(`button`,{className:`tcp-btn-primary`,onClick:()=>$.mutate({path:`/api/orchestrator/approve`,body:{runId:F}}),children:[u(`i`,{"data-lucide":`play`}),`Execute Plan`]}),u(`button`,{className:`tcp-btn-danger`,disabled:Ft.isPending,onClick:()=>Ft.mutate(F),children:[u(`i`,{"data-lucide":`trash-2`}),`Discard Plan`]})]})]}):null,!Rt&&!zt?u(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:[Vt?u(`button`,{className:`tcp-btn`,onClick:()=>$.mutate({path:`/api/orchestrator/pause`,body:{runId:F}}),children:[u(`i`,{"data-lucide":`square`}),`Pause`]}):null,Ht?u(`button`,{className:`tcp-btn`,onClick:()=>$.mutate({path:`/api/orchestrator/resume`,body:{runId:F}}),children:[u(`i`,{"data-lucide":`play`}),`Resume`]}):null,Ut?u(`button`,{className:`tcp-btn`,onClick:()=>$.mutate({path:`/api/orchestrator/continue`,body:{runId:F}}),children:[u(`i`,{"data-lucide":`rotate-cw`}),`Continue Run`]}):null,Wt?u(`button`,{className:`tcp-btn-danger`,onClick:()=>$.mutate({path:`/api/orchestrator/cancel`,body:{runId:F}}),children:[u(`i`,{"data-lucide":`x`}),`Cancel`]}):null,u(`button`,{className:`tcp-btn`,onClick:It,children:[u(`i`,{"data-lucide":`plus`}),`New Prompt`]})]}):null,Bt?u(`div`,{className:`mb-3 rounded-lg border border-slate-700/60 bg-slate-900/25 p-2 text-xs tcp-subtle`,children:R===`failed`?`This run is failed. Continue the run or retry a failed task.`:`This run is ${R}. Start a new prompt to continue.`}):null,u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Workspace Files`}),u(`button`,{type:`button`,className:`chat-icon-btn h-7 w-7`,title:`Refresh`,"aria-label":`Refresh`,onClick:()=>void W.refetch(),disabled:!B,children:u(`i`,{"data-lucide":`refresh-cw`})})]}),u(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[u(`button`,{type:`button`,className:`chat-icon-btn h-7 w-7`,title:`Up`,"aria-label":`Up`,disabled:!_t,onClick:()=>{_t&&We(_t)},children:u(`i`,{"data-lucide":`arrow-up-circle`})}),u(`button`,{type:`button`,className:`chat-icon-btn h-7 w-7`,title:`Root`,"aria-label":`Root`,disabled:!B,onClick:()=>{B&&We(B)},children:u(`i`,{"data-lucide":`home`})})]}),u(`div`,{className:`mb-2 tcp-subtle text-[11px]`,style:{overflowWrap:`anywhere`},children:E||B||`No workspace`}),vt?null:u(`div`,{className:`mb-2 rounded-lg border border-amber-400/40 bg-amber-950/20 p-2 text-xs text-amber-200`,children:`File listing for this workspace is not exposed by the current server scope. Directory navigation still works.`}),u(`div`,{className:`grid max-h-[220px] min-h-0 gap-1 overflow-auto`,children:[ht.map(e=>{let t=String(e?.path||``);return u(`button`,{className:`tcp-list-item text-left`,onClick:()=>We(t),children:u(`span`,{className:`inline-flex items-center gap-2`,children:[u(`i`,{"data-lucide":`folder-open`}),u(`span`,{children:String(e?.name||t)})]})},`dir-${t}`)}),gt.map(e=>{let t=String(e?.path||``);return u(`button`,{className:`tcp-list-item text-left ${t===D?`border-amber-400/70`:``}`,onClick:()=>Ge(t),children:u(`div`,{className:`flex items-center justify-between gap-2`,children:[u(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[u(`i`,{"data-lucide":`file-up`}),u(`span`,{className:`truncate`,children:String(e?.name||t)})]}),u(`span`,{className:`tcp-subtle shrink-0 text-[11px]`,children:ye(e?.size)})]})},`file-${t}`)}),!ht.length&&!gt.length?u(f,{text:`No files or folders in this workspace location.`}):null]})]}),D?u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`File Preview`}),u(`div`,{className:`flex items-center gap-2`,children:[K?u(`button`,{type:`button`,className:`tcp-btn h-7 px-2 text-xs`,onClick:()=>Qe(!0),children:[u(`i`,{"data-lucide":`fullscreen`}),`Fullscreen`]}):null,u(`span`,{className:`tcp-subtle text-[11px]`,style:{overflowWrap:`anywhere`},children:D})]})]}),mt.isLoading?u(`div`,{className:`tcp-subtle text-xs`,children:`Loading file...`}):K?u(`div`,{className:`max-h-[420px] overflow-auto rounded-lg border border-slate-700/60 bg-black`,children:u(`iframe`,{className:`h-[420px] w-full bg-black`,sandbox:`allow-scripts allow-forms allow-pointer-lock allow-modals allow-downloads`,allow:`fullscreen; autoplay; clipboard-write`,allowFullScreen:!0,srcDoc:G,title:D,scrolling:`yes`})}):bt?u(`div`,{className:`tcp-markdown tcp-markdown-ai max-h-[260px] overflow-auto rounded-lg border border-slate-700/60 bg-slate-950/40 p-3`,dangerouslySetInnerHTML:{__html:re(G)}}):u(`pre`,{className:`tcp-code max-h-[260px] overflow-auto whitespace-pre-wrap break-words`,children:G||`No text content.`})]}):null,u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:u(`div`,{className:`font-medium`,children:`Executor Verification`})}),Ot.length?u(`div`,{className:`grid max-h-44 gap-2 overflow-auto`,children:Ot.map(e=>u(`div`,{className:`rounded border border-slate-700/60 p-2 text-xs`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`span`,{className:y(e.type.includes(`failed`)?`failed`:`running`),children:e.type}),u(`span`,{className:`tcp-subtle`,children:[`mode: `,e.mode]})]}),u(`div`,{className:`font-medium`,children:e.title}),u(`div`,{className:`tcp-subtle whitespace-pre-wrap break-words`,children:e.reason||`No verification detail.`}),u(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[u(`button`,{type:`button`,className:`tcp-btn h-7 px-2 text-xs`,onClick:()=>Ze(e.id),children:[u(`i`,{"data-lucide":`search`}),`View details`]}),u(`button`,{type:`button`,className:`tcp-btn h-7 px-2 text-xs`,onClick:async()=>{try{await navigator.clipboard.writeText(Ee(e)),p(`ok`,`Copied verification feedback.`)}catch(e){p(`err`,e instanceof Error?e.message:`Copy failed.`)}},children:[u(`i`,{"data-lucide":`copy-plus`}),`Copy feedback`]})]}),e.verification?.execution_trace?u(`div`,{className:`mt-2 rounded border border-slate-700/50 bg-slate-950/40 p-2 tcp-subtle`,children:[u(`div`,{children:[`session:`,` `,String(e.verification?.execution_trace?.session_id||`n/a`)]}),u(`div`,{children:[`model:`,` `,[String(e.verification?.execution_trace?.model?.provider||``).trim(),String(e.verification?.execution_trace?.model?.model_id||``).trim()].filter(Boolean).join(` / `)||`unknown`]}),u(`div`,{children:[`source:`,` `,String(e.verification?.execution_trace?.model?.source||`n/a`)]})]}):null]},e.id))}):u(`div`,{className:`tcp-subtle text-xs`,children:`No verification telemetry yet.`})]}),u(`div`,{className:`mt-3 grid gap-3 xl:grid-cols-2`,children:[u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Live Activity`}),u(`span`,{className:`tcp-subtle text-xs`,children:b(Date.now())})]}),wt.length?u(`div`,{className:`grid max-h-40 gap-2 overflow-auto`,children:wt.map(e=>u(`div`,{className:`rounded border border-slate-700/60 p-2 text-xs`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`span`,{className:y(e.type.includes(`failed`)?`failed`:`running`),children:e.type}),u(`span`,{className:`tcp-subtle`,children:b(e.at)})]}),u(`div`,{className:`font-medium`,children:e.title}),u(`div`,{className:`tcp-subtle`,children:e.detail||`No additional detail.`})]},e.id))}):u(`div`,{className:`tcp-subtle text-xs`,children:`No activity events yet.`})]}),u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:u(`div`,{className:`font-medium`,children:`Latest Output`})}),Ct?u(t,{children:[u(`div`,{className:`tcp-code max-h-28 overflow-auto whitespace-pre-wrap break-words`,children:Et||`No assistant output text yet.`}),u(`div`,{className:`mt-2 tcp-subtle text-xs`,children:`Recent tool calls`}),u(`div`,{className:`tcp-code mt-1 max-h-24 overflow-auto whitespace-pre-wrap break-words`,children:Dt.length?Dt.join(`
|
|
3
3
|
`):`No tool call records found in current session yet.`})]}):u(`div`,{className:`tcp-subtle text-xs`,children:`No completed step output session yet.`})]})]})]}),u(`div`,{className:`flex h-full min-h-0 w-full flex-col gap-3`,children:[u(`div`,{className:`mb-3`,children:[u(`div`,{className:`text-sm font-semibold`,children:`Kanban + Budget`}),u(`div`,{className:`tcp-subtle mt-1 text-sm`,children:`Tasks activate after execute`})]}),u(`div`,{className:`mb-3`,children:u(ue,{budget:dt})}),u(ae,{tasks:z,currentTaskId:ut.currentTaskId,selectedTaskId:k,workflowSummaryByTaskId:Mt,onTaskSelect:e=>{A(k===e.id?``:e.id),j(e.id)},onRetryTask:e=>$.mutate({path:`/api/orchestrator/retry`,body:{runId:F,stepId:e.id}})}),k?u(`div`,{className:`mt-3 rounded-xl border border-cyan-700/50 bg-cyan-950/20 p-3`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Selected Task Workflow Link`}),u(`button`,{className:`tcp-btn h-7 px-2 text-xs`,onClick:()=>A(``),children:`Clear task focus`})]}),u(`div`,{className:`tcp-subtle text-xs`,children:[`Task `,u(`strong`,{children:k}),` is filtering workflow runs and event stream.`]})]}):null,k?u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Task Workflow Artifacts`}),u(`span`,{className:`tcp-subtle text-xs`,children:[Nt.length,` actions`]})]}),Nt.length?u(`div`,{className:`grid max-h-56 gap-2 overflow-auto`,children:Nt.map(e=>u(`div`,{className:`rounded border border-slate-700/60 p-2 text-xs`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`span`,{className:`font-medium`,children:e.action}),u(`span`,{className:y(e.status),children:e.status})]}),u(`div`,{className:`tcp-subtle`,children:[`run: `,e.runId]}),u(`div`,{className:`tcp-subtle`,children:[`updated: `,b(e.updatedAt)]}),e.detail?u(`div`,{className:`mt-1 text-rose-200`,children:e.detail}):null,e.output?u(oe,{value:e.output,label:`Show output`,preClassName:`tcp-code mt-2 max-h-28 overflow-auto whitespace-pre-wrap break-words`}):null]},e.id))}):u(`div`,{className:`tcp-subtle text-xs`,children:`No workflow action artifacts are linked to this task yet.`})]}):null,u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Workflow Automation`}),u(`button`,{className:`tcp-btn h-7 px-2 text-xs`,onClick:()=>le(`packs-detail`),children:`Open Workflow Lab`})]}),u(`div`,{className:`mb-2 flex flex-wrap items-center gap-2 text-xs`,children:[u(`span`,{className:`tcp-badge-info`,children:X||`no workflow id`}),u(`span`,{className:`tcp-subtle`,children:Array.isArray(kt.data?.workflow?.steps)?`${kt.data.workflow.steps.length} steps`:`workflow metadata pending`}),u(`span`,{className:`tcp-subtle`,children:Array.isArray(kt.data?.hooks)?`${kt.data.hooks.length} hooks`:``})]}),u(`div`,{className:`grid gap-3 xl:grid-cols-[0.85fr_1.15fr]`,children:[u(`div`,{className:`grid gap-2`,children:[u(`div`,{className:`tcp-subtle text-xs uppercase tracking-[0.24em]`,children:`Workflow Runs`}),u(`div`,{className:`grid max-h-48 gap-2 overflow-auto`,children:Z.length?Z.map((e,t)=>{let n=String(e?.run_id||`workflow-run-${t}`).trim(),r=n===O,i=String(e?.status||`unknown`).trim(),a=S(e);return u(`button`,{type:`button`,className:`tcp-list-item text-left ${r?`border-amber-400/70`:``}`,onClick:()=>Ke(n),children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`strong`,{children:n}),u(`span`,{className:y(i),children:i})]}),u(`div`,{className:`tcp-subtle text-xs`,children:[`trigger:`,` `,String(e?.trigger_event||`manual`).trim()||`manual`]}),u(`div`,{className:`tcp-subtle text-xs`,children:[`task: `,a||`n/a`]}),u(`div`,{className:`tcp-subtle text-xs`,children:[`actions:`,` `,Array.isArray(e?.actions)?e.actions.length:0]})]},n)}):u(f,{text:k?`No workflow runs are linked to the selected task yet.`:`No workflow runs recorded for this orchestration workflow yet.`})})]}),u(`div`,{className:`grid gap-2`,children:[u(`div`,{className:`tcp-subtle text-xs uppercase tracking-[0.24em]`,children:`Workflow Run Drilldown`}),Q?u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 flex flex-wrap items-center gap-2 text-xs`,children:[u(`span`,{className:y(String(Q?.status||`unknown`)),children:String(Q?.status||`unknown`)}),u(`span`,{className:`tcp-subtle`,children:[`trigger: `,String(Q?.trigger_event||`manual`)]}),u(`span`,{className:`tcp-subtle`,children:[`source: `,String(Q?.source_event_id||`n/a`)]})]}),u(`div`,{className:`grid max-h-48 gap-2 overflow-auto`,children:Array.isArray(Q?.actions)&&Q.actions.length?Q.actions.map((e,t)=>u(`div`,{className:`rounded border border-slate-700/60 p-2 text-xs`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`span`,{className:`font-medium`,children:String(e?.action||`unknown action`)}),u(`span`,{className:y(String(e?.status||`unknown`)),children:String(e?.status||`unknown`)})]}),u(`div`,{className:`mb-1 flex flex-wrap items-center gap-2`,children:[u(`span`,{className:`tcp-subtle`,children:[`task:`,` `,String(e?.task_id||Q?.task_id||`n/a`)]}),String(e?.task_id||Q?.task_id||``).trim()?u(`button`,{className:`tcp-btn h-7 px-2 text-xs`,onClick:()=>A(String(e?.task_id||Q?.task_id||``).trim()),children:`Focus task`}):null]}),u(`div`,{className:`tcp-subtle`,children:[`started: `,b(e?.started_at_ms)]}),u(`div`,{className:`tcp-subtle`,children:[`finished: `,b(e?.finished_at_ms)]}),String(e?.error||``).trim()?u(`div`,{className:`mt-1 text-rose-200`,children:String(e.error)}):null]},`${String(e?.action||`action`)}-${t}`)):u(`div`,{className:`tcp-subtle text-xs`,children:`No recorded workflow actions for this run.`})})]}):u(f,{text:`Select a workflow run to inspect its action timeline.`})]})]})]}),u(`div`,{className:`mt-3 rounded-xl border border-slate-700/60 bg-slate-900/30 p-3`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Workflow Event Stream`}),u(`button`,{type:`button`,className:`chat-icon-btn h-7 w-7`,title:`Clear workflow events`,"aria-label":`Clear workflow events`,onClick:()=>Je([]),children:u(`i`,{"data-lucide":`trash-2`})})]}),qe.length?u(`div`,{className:`grid max-h-48 gap-2 overflow-auto`,children:[...qe].filter(e=>{let t=S(e.data?.properties||{});if(k&&t&&t!==k)return!1;if(!O)return!0;let n=String(e.data?.properties?.runID||``).trim();return!n||n===O}).reverse().map((e,t)=>{let n=Te(e.data);return u(`div`,{className:`rounded border border-slate-700/60 p-2 text-xs`,children:[u(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[u(`span`,{className:y(n.endsWith(`.failed`)?`failed`:n.endsWith(`.completed`)?`completed`:`running`),children:n}),u(`span`,{className:`tcp-subtle`,children:b(e.at)})]}),u(`div`,{className:`tcp-subtle`,children:[`run: `,String(e.data?.properties?.runID||`n/a`)]}),u(`div`,{className:`tcp-subtle`,children:[`action:`,` `,String(e.data?.properties?.action||e.data?.properties?.actionID||`-`)]})]},`${e.at}-${t}`)})}):u(`div`,{className:`tcp-subtle text-xs`,children:`No workflow events streamed for this run yet.`})]}),u(ee,{children:[q?u(d.div,{className:`tcp-confirm-overlay`,initial:h?!1:{opacity:0},animate:h?void 0:{opacity:1},exit:h?void 0:{opacity:0},children:[u(`button`,{type:`button`,className:`tcp-confirm-backdrop`,"aria-label":`Close task details`,onClick:()=>j(``)}),u(d.div,{className:`tcp-confirm-dialog tcp-verification-modal`,initial:h?!1:{opacity:0,y:8,scale:.98},animate:h?void 0:{opacity:1,y:0,scale:1},exit:h?void 0:{opacity:0,y:6,scale:.98},children:[u(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[u(`div`,{children:[u(`h3`,{className:`tcp-confirm-title`,children:`Kanban Task Details`}),u(`p`,{className:`tcp-confirm-message`,children:`Full task brief, dependencies, and runtime context for this kanban item.`})]}),u(`button`,{type:`button`,className:`tcp-btn h-8 px-2`,onClick:()=>j(``),children:u(`i`,{"data-lucide":`x`})})]}),u(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 text-xs`,children:[u(`span`,{className:y(q.state),children:ge(q.state)}),u(`span`,{className:`tcp-badge-info`,children:q.id}),q.assigned_role?u(`span`,{className:`tcp-subtle`,children:[`role: `,q.assigned_role]}):null,q.gate?u(`span`,{className:`tcp-subtle`,children:[`gate: `,q.gate]}):null,q.workflow_id?u(`span`,{className:`tcp-subtle`,children:[`workflow: `,q.workflow_id]}):null,q.session_id?u(`span`,{className:`tcp-subtle`,children:[`session: `,q.session_id]}):null]}),u(`div`,{className:`tcp-verification-content grid gap-3`,children:[u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Title`}),u(`div`,{className:`rounded-lg border border-slate-800/80 bg-slate-950/70 px-3 py-2 text-sm text-slate-100`,children:q.title||`Untitled task`})]}),q.description?u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Description`}),u(`pre`,{className:`tcp-code tcp-verification-feedback whitespace-pre-wrap break-words`,children:q.description})]}):null,u(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Dependencies`}),q.dependencies.length?u(`div`,{className:`flex flex-wrap gap-2`,children:q.dependencies.map(e=>u(`span`,{className:`rounded border border-slate-700/60 px-2 py-1 text-xs text-slate-200`,children:[`<-`,` `,e]},`${q.id}-${e}`))}):u(`div`,{className:`tcp-subtle text-sm`,children:`No blocking dependencies.`})]}),u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Runtime Context`}),u(`div`,{className:`grid gap-2 text-sm`,children:[u(`div`,{className:`tcp-subtle`,children:[`runtime status: `,q.runtime_status||`n/a`]}),u(`div`,{className:`tcp-subtle`,children:[`retry count: `,Number(q.retry_count||0)]}),Mt?.[q.id]?u(`div`,{className:`tcp-subtle`,children:[`workflow runs:`,` `,Mt[q.id].runs,Mt[q.id].failed?`, failed ${Mt[q.id].failed}`:``]}):null,q.runtime_detail?u(`div`,{className:`tcp-subtle whitespace-pre-wrap break-words`,children:[`detail: `,q.runtime_detail]}):null]})]})]}),String(q.error_message||``).trim()?u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Error`}),u(`pre`,{className:`tcp-code tcp-verification-feedback whitespace-pre-wrap break-words text-rose-100`,children:String(q.error_message||``).trim()})]}):null]}),u(`div`,{className:`tcp-confirm-actions mt-4`,children:[u(`button`,{className:`tcp-btn`,onClick:()=>{A(q.id),j(``)},children:`Focus task`}),u(`button`,{className:`tcp-btn`,onClick:()=>j(``),children:`Close`})]})]})]}):null,Y?u(d.div,{className:`tcp-confirm-overlay`,initial:h?!1:{opacity:0},animate:h?void 0:{opacity:1},exit:h?void 0:{opacity:0},children:[u(`button`,{type:`button`,className:`tcp-confirm-backdrop`,"aria-label":`Close verification details`,onClick:()=>Ze(``)}),u(d.div,{className:`tcp-confirm-dialog tcp-verification-modal`,initial:h?!1:{opacity:0,y:8,scale:.98},animate:h?void 0:{opacity:1,y:0,scale:1},exit:h?void 0:{opacity:0,y:6,scale:.98},children:[u(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[u(`div`,{children:[u(`h3`,{className:`tcp-confirm-title`,children:`Executor Verification Details`}),u(`p`,{className:`tcp-confirm-message`,children:`Raw verification and execution trace for debugging task feedback.`})]}),u(`button`,{type:`button`,className:`tcp-btn h-8 px-2`,onClick:()=>Ze(``),children:u(`i`,{"data-lucide":`x`})})]}),u(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 text-xs`,children:[u(`span`,{className:y(Y.type.includes(`failed`)?`failed`:`running`),children:Y.type}),u(`span`,{className:`tcp-badge-info`,children:Y.title}),u(`span`,{className:`tcp-subtle`,children:[`task: `,Y.taskId||`n/a`]}),u(`span`,{className:`tcp-subtle`,children:[`mode: `,Y.mode]}),u(`span`,{className:`tcp-subtle`,children:[`time: `,b(Y.at)]})]}),u(`div`,{className:`tcp-verification-content grid gap-3`,children:[u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[u(`div`,{className:`font-medium`,children:`Feedback`}),u(`button`,{type:`button`,className:`tcp-btn h-7 px-2 text-xs`,onClick:async()=>{try{await navigator.clipboard.writeText(Ee(Y)),p(`ok`,`Copied verification feedback.`)}catch(e){p(`err`,e instanceof Error?e.message:`Copy failed.`)}},children:[u(`i`,{"data-lucide":`copy-plus`}),`Copy feedback`]})]}),u(`pre`,{className:`tcp-code tcp-verification-feedback whitespace-pre-wrap break-words`,children:Y.reason||`No verification detail.`})]}),u(`div`,{className:`rounded-xl border border-slate-700/60 bg-slate-950/30 p-3`,children:[u(`div`,{className:`mb-2 font-medium`,children:`Verification JSON`}),u(`pre`,{className:`tcp-code tcp-verification-code whitespace-pre-wrap break-words`,children:JSON.stringify(Y.verification||{},null,2)})]})]}),u(`div`,{className:`tcp-confirm-actions mt-4`,children:u(`button`,{className:`tcp-btn`,onClick:()=>Ze(``),children:`Close`})})]})]}):null]})]})]})})]}),u(ee,{children:M&&D&&K?u(d.div,{className:`tcp-confirm-overlay`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Qe(!1),children:u(d.div,{className:`relative h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] overflow-hidden rounded-[1.4rem] border border-slate-700/70 bg-slate-950 shadow-[0_28px_64px_rgba(0,0,0,0.55)]`,initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.98},onClick:e=>e.stopPropagation(),children:[u(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-800/80 px-5 py-4`,children:[u(`div`,{className:`min-w-0`,children:[u(`div`,{className:`text-lg font-semibold text-slate-100`,children:`Fullscreen Preview`}),u(`div`,{className:`tcp-subtle mt-1 text-xs`,style:{overflowWrap:`anywhere`},children:D})]}),u(`div`,{className:`flex items-center gap-2`,children:[u(`button`,{type:`button`,className:`tcp-btn h-8 px-3 text-xs`,onClick:()=>void mt.refetch(),children:[u(`i`,{"data-lucide":`refresh-cw`}),`Refresh`]}),u(`button`,{type:`button`,className:`chat-icon-btn h-8 w-8`,"aria-label":`Close preview`,title:`Close preview`,onClick:()=>Qe(!1),children:u(`i`,{"data-lucide":`x`})})]})]}),u(`div`,{className:`h-[calc(100%-4.5rem)] p-3`,children:u(`div`,{className:`h-full overflow-auto rounded-xl border border-slate-700/60 bg-black`,children:u(`iframe`,{className:`h-full w-full bg-black`,sandbox:`allow-scripts allow-forms allow-pointer-lock allow-modals allow-downloads`,allow:`fullscreen; autoplay; clipboard-write`,allowFullScreen:!0,srcDoc:G,title:`${D} fullscreen preview`,scrolling:`yes`})})})]})}):null}),Ae?u(`div`,{className:`tcp-confirm-overlay`,children:u(`div`,{className:`tcp-confirm-dialog max-w-2xl`,children:[u(`h3`,{className:`tcp-confirm-title`,children:`Select Workspace Folder`}),u(`p`,{className:`tcp-confirm-message`,children:[`Current: `,U||`n/a`]}),u(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:[u(`button`,{className:`tcp-btn`,onClick:()=>{H&&Me(H)},disabled:!H,children:[u(`i`,{"data-lucide":`arrow-up-circle`}),`Up`]}),u(`button`,{className:`tcp-btn-primary`,onClick:()=>{U&&(ke(U),w(!1),T(``),p(`ok`,`Workspace selected: ${U}`))},children:[u(`i`,{"data-lucide":`badge-check`}),`Select This Folder`]}),u(`button`,{className:`tcp-btn`,onClick:()=>{w(!1),T(``)},children:[u(`i`,{"data-lucide":`x`}),`Close`]})]}),u(`div`,{className:`mb-2`,children:u(`input`,{className:`tcp-input`,placeholder:`Type to filter folders...`,value:Ne,onInput:e=>T(e.target.value)})}),u(`div`,{className:`max-h-[360px] overflow-auto rounded-lg border border-slate-700/60 bg-slate-900/20 p-2`,children:pt.length?pt.map(e=>u(`button`,{className:`tcp-list-item mb-1 w-full text-left`,onClick:()=>Me(String(e?.path||``)),children:[u(`i`,{"data-lucide":`folder-open`}),String(e?.name||e?.path||``)]},String(e?.path||e?.name))):u(f,{text:V?`No folders match your search.`:`No subdirectories in this folder.`})})]})}):null]})}export{De as OrchestratorPage};
|