n.right?r.right-n.right:0;i&&(e.scrollLeft+=i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[p]);let g=[...r?[{key:`capabilities`,label:f(`capabilities.title`)}]:[],{key:`provider`,label:f(`settings.modelProvider`)},{key:`machine`,label:f(`settings.globalCapabilities`)},{key:`lark`,label:`Lark`},{key:`appearance`,label:f(`settings.appearance`)},{key:`language`,label:f(`settings.language`)}],_=[{label:f(`settings.languageEnglish`),value:`en`},{label:f(`settings.languageSimplifiedChinese`),value:`zh-CN`}],v={appearance:{title:f(`settings.appearance`)},capabilities:{title:f(`capabilities.title`)},language:{title:f(`settings.language`)},lark:{title:`Lark`},machine:{title:f(`settings.globalCapabilities`)},provider:{title:f(`settings.modelProvider`)}}[p];return(0,z.jsxs)(`section`,{"aria-label":f(`settings.title`),className:`personal-settings-page`,"data-pw-theme":l,children:[(0,z.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,z.jsxs)(`button`,{autoFocus:!0,className:`personal-settings-back`,onClick:s,type:`button`,children:[(0,z.jsx)(Zp,{size:17}),(0,z.jsx)(`span`,{children:f(`settings.back`)})]}),(0,z.jsx)(`div`,{className:`personal-settings-title`,children:(0,z.jsx)(`strong`,{children:f(`settings.title`)})}),(0,z.jsx)(`nav`,{"aria-label":f(`settings.categories`),className:`personal-settings-tabs`,ref:h,children:g.map(e=>{let t=kS[e.key];return(0,z.jsxs)(`button`,{"aria-current":p===e.key?`page`:void 0,onClick:()=>m(e.key),type:`button`,children:[(0,z.jsx)(t,{size:17}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})})]},e.key)})})]}),(0,z.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,z.jsx)(`header`,{className:`personal-settings-header`,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{children:v.title})})}),p===`lark`?(0,z.jsx)(qx,{embedded:!0,focusGoalConnection:t,goals:n,initialGoalId:r,onChanged:o,onClose:s}):null,p===`provider`?(0,z.jsx)(`div`,{className:`personal-provider-settings`,children:(0,z.jsx)(OS,{})}):null,p===`machine`?(0,z.jsx)(TS,{}):null,p===`capabilities`?(0,z.jsx)(vS,{callbacks:e,goalId:r,notification:a.find(e=>e.goalId===r),onChanged:o}):null,p===`appearance`?(0,z.jsx)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:(0,z.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":f(`settings.workspaceTheme`),children:[(0,z.jsxs)(`button`,{"aria-checked":l===`loopx`,onClick:()=>c(`loopx`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,z.jsx)(`strong`,{children:f(`settings.themeLoopx`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`paper`,onClick:()=>c(`paper`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,z.jsx)(`strong`,{children:f(`settings.themeDefault`)})]}),(0,z.jsxs)(`button`,{"aria-checked":l===`brutal`,onClick:()=>c(`brutal`),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,z.jsx)(`strong`,{children:f(`settings.themeHighContrast`)})]})]})}):null,p===`language`?(0,z.jsx)(`section`,{className:`personal-settings-card`,children:(0,z.jsx)(`div`,{"aria-label":f(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:_.map(e=>(0,z.jsxs)(`button`,{"aria-checked":u===e.value,className:u===e.value?`is-selected`:``,onClick:()=>d(e.value),role:`radio`,type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:e.label})}),u===e.value?(0,z.jsx)(om,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var jS=`loopx-pw-theme`,MS=`loopx`;function NS(){try{let e=window.localStorage.getItem(jS);return e===`loopx`||e===`paper`||e===`brutal`?e:MS}catch{return MS}}function PS(e){try{window.localStorage.setItem(jS,e)}catch{}}function FS({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=Ji(),l=(0,R.useRef)(null),u=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,z.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,z.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,z.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,z.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,z.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,z.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,z.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function IS(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function LS(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function RS(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function zS({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=Ji(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{key:`needs_you`,label:a(`home.lane.needsYou`)},{key:`running`,label:a(`home.lane.running`)},{key:`observing`,label:a(`home.lane.observing`)},{key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[];e.filter(e=>!e.loadState).forEach(e=>{let t=Mb(e);t===`history`?u.push(e):t!==`stopped`&&l[t].push(e)});let d=e=>(0,z.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`span`,{className:`personal-home-goal-meta`,children:e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId}),(0,z.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,i)}),(0,z.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?RS(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,z.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,z.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,z.jsx)(um,{size:15}),(0,z.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,z.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,z.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,z.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,z.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,z.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(d)]}):null,(0,z.jsx)(`div`,{className:`personal-home-lanes`,children:c.filter(e=>l[e.key].length>0).map(e=>(0,z.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{}),e.label]}),(0,z.jsx)(`b`,{children:l[e.key].length})]}),(0,z.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].map(d)})]},e.key))}),u.length?(0,z.jsxs)(`details`,{className:`personal-home-history`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:a(`home.history`)}),(0,z.jsx)(`b`,{children:u.length}),(0,z.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,z.jsx)(`div`,{children:u.map(d)})]}):null]})}function BS({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=Ji();return(0,z.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:i(`files.title`)}),(0,z.jsx)(`span`,{children:e.length})]}),n?.loading?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,z.jsx)(Um,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,z.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,z.jsx)(um,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,z.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,z.jsx)(Sm,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,z.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-file-icon`,children:(0,z.jsx)(Sm,{size:16})}),(0,z.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,z.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,z.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,z.jsx)(`small`,{title:e.output.createdAt,children:[e.output.kind===`report`?i(`files.verifiedReport`):null,RS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function VS({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=Ji(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,R.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(rm,{size:16}),(0,z.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,z.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,z.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,z.jsx)(km,{size:13}),(0,z.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,z.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,z.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,z.jsx)(sh,{size:14})}):null]})]}),(0,z.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,z.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,z.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,z.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,z.jsx)(`p`,{children:t.text}):(0,z.jsx)(bb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Fy,{request:t.collaboration}),(0,z.jsx)(Tb,{delivery:t.returnDelivery})]})]},t.id))})]})}function HS({onClose:e,onOpenDetails:t,run:n}){let{t:r}=Ji();return(0,z.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(rm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(sh,{size:15})})]}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:n.title})}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:n.agentLabel})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:Xi(n.sessionStatus??n.status,r)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Session`}),(0,z.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function US(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Ab(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Mb(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;if(i.needsYou){let t=e.userTodos.find(e=>e.goalId===i.goalId);r.push({attention:t?{...t,goalTitle:i.title}:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`})}jb(i)&&r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function WS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function GS(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function KS(e,t,n){let r=t.operationFrame,i=r?.content.fields.map((e,t)=>({key:`projection:${t}`,label:e.label,value:e.value})).slice(0,8)??[];return[{key:`operation_state`,label:n(`proposal.field.operationState`),value:r?.lifecycleState??e.status},...r?.kind===`result`?[{key:`result_delivery`,label:n(`proposal.field.resultDelivery`),value:r.resultDeliveryVerified?n(`proposal.resultDelivery.verified`):n(`proposal.resultDelivery.pending`)}]:[],...i,...r?[{key:`warning`,label:n(`proposal.field.confirmationBoundary`),value:r.content.warning}]:[],...r?[{key:`expires_at`,label:n(`proposal.field.expiresAt`),value:r.expiresAt}]:[]].slice(0,10)}function qS(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function JS(e,t){let n=qS(e),r=Gy(e),i=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,a=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,o=r.operationFrame,s=o?.content.title??e.summary,c=e.action_kind===`operation.execute`?s:e.action_kind===`team.plan`?e.status===`applied`?nb(tb(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:Zy(e.normalized_parameters),count:Xy(e.normalized_parameters)}):e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:i}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:a}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:i}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:i}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:i}):e.summary;return{actionKind:e.action_kind,reviewPlan:r,fields:e.action_kind===`operation.execute`?KS(e,r,t):e.action_kind===`team.plan`?Yy(e.normalized_parameters,t):GS(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:r.retryOriginal?t(`actionReview.${r.reason}`):e.action_kind===`operation.execute`?t(`proposal.impact.operation`):e.action_kind===`team.plan`?e.status===`applied`?t(`proposal.teamPlan.assignedHint`):t(`proposal.impact.teamPlan`):e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):``,previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:r.retryOriginal?t(`drawer.retryOriginal`):e.action_kind===`operation.execute`?o?.kind===`result`?o.resultDeliveryVerified?t(`proposal.primary.operationResultVerified`):t(`proposal.primary.operationResultPending`):t(`proposal.primary.operationGroup`):e.action_kind===`team.plan`?t(e.status===`applied`?`proposal.teamPlan.viewResult`:`proposal.primary.teamPlan`):e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:r.retryOriginal||e.status===`applied`&&e.action_kind!==`operation.execute`&&r.interaction!==`completed`?`error`:WS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?tb(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?Qy(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?$y(e.receipt,e.normalized_parameters):void 0,title:c}}function YS(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function XS(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function ZS(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function QS(e,t){let n=ZS(e,[`目标`,`Objective`]),r=ZS(e,[`完成标准`,`Completion criteria`]),i=ZS(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||XS(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(`
+`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function $S(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function eC(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function tC(e,t){return ZS(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function nC(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function rC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function iC(e){let t=ZS(e,[`标题`,`任务标题`,`Todo 标题`]),n=ZS(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var aC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),oC=5242880,sC=4;function cC(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function lC({conversationSessionId:e,agents:t=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:n={},goalArchiveLoadState:r={error:null,phase:`ready`},managerChannelBinding:i,managerRuntime:a,model:o,readOnly:s=!1,selectedAgentId:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=Ji(),[p,m]=(0,R.useState)(l??null),[h,g]=(0,R.useState)(c??t.find(e=>e.available)?.agentId??`codex`),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)({}),[T,E]=(0,R.useState)(`chat`),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[ne,N]=(0,R.useState)(!1),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`queue`),[F,oe]=(0,R.useState)(``),[I,se]=(0,R.useState)([]),[L,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(()=>new Set),[pe,me]=(0,R.useState)(()=>new Set),[he,ge]=(0,R.useState)(`idle`),[_e,ve]=(0,R.useState)([]),[ye,be]=(0,R.useState)([]),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(NS),[Te,Ee]=(0,R.useState)({}),[De,Oe]=(0,R.useState)([]),ke=(0,R.useRef)(!1),Ae=(0,R.useRef)(NaN),je=(0,R.useRef)(null),Me=(0,R.useRef)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(new Set),Ie=(0,R.useRef)(new Set),[Le,Re]=(0,R.useState)(null),B=l===void 0?p:l,ze=c??h,Be=`${B??`manager`}:${ze}`,Ve=M[Be]??``;(0,R.useEffect)(()=>{se([]),ce(null)},[Be]);function He(e,t){te(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Ue(e){He(Be,e)}function We(e){return bh.find(t=>t.id===e)?.prompt??``}(0,R.useEffect)(()=>{let e=je.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ve]);let Ge=(0,R.useMemo)(()=>o.goals.map(e=>{let t=Te[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[Te,o.goals]),Ke=(0,R.useMemo)(()=>Ge.filter(e=>Mb(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Mb(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Ge]),V=Ge.find(e=>e.goalId===B)??null;function Je(e){Ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Se(!1),v(e)}function Ye(){v(null),window.requestAnimationFrame(()=>{let e=Ne.current;e?.isConnected&&e.getClientRects().length?e.focus({preventScroll:!0}):document.querySelector(`.personal-mobile-menu`)?.focus({preventScroll:!0})})}let Xe=_?.kind===`settings`,Ze=B,Qe=(0,R.useMemo)(()=>{let e=Object.values(C).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:ze,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:f(`drawer.schedulePending`),notificationRule:f(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??f(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??f(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...US(o,Ze,f),...o.timeline??[],...e,...LS(Object.values(C)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||e.proposal.reviewPlan?.retryOriginal===!0||_e.includes(e.proposal.previewId)).filter(e=>!B||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===B:e.kind===`attention`?e.attention.goalId===B:e.kind===`run`?e.run.goalId===B:e.kind===`schedule`?e.schedule.goalId===B:e.output.goalId===B)},[Ze,o,C,ze,B,_e,f]),$e=(0,R.useMemo)(()=>x?Qe.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===x.runId:e.kind===`output`&&e.output.runId===x.runId):Qe,[x,Qe]);(0,R.useEffect)(()=>{if(!x)return;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===x.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:x.completedSteps,latestActivity:x.latestActivity,messages:x.sessionMessages,sessionStatus:x.sessionStatus,status:x.status,totalSteps:x.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&S(e.run)},[x,Qe]);let et=(0,R.useMemo)(()=>Qe.flatMap(e=>e.kind===`message`?[e.message]:[]),[Qe]),tt=(0,R.useMemo)(()=>V?Qe.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[Qe,V]);(0,R.useEffect)(()=>{V||D||et.some(e=>e.pending)&&A(!0)},[D,et,V]),(0,R.useEffect)(()=>{!V||T===`chat`||tt.some(e=>e.pending)&&j(!0)},[tt,V,T]);let nt=(0,R.useMemo)(()=>Qe.filter(e=>e.kind===`message`||e.kind===`proposal`&&(_e.includes(e.proposal.previewId)||ye.includes(e.proposal.previewId))),[Qe,_e,ye]),rt=nt[nt.length-1],it=rt?.kind===`message`?rt.message.text.length:0;(0,R.useEffect)(()=>{if(!D||!Me.current)return;let e=window.requestAnimationFrame(()=>{Me.current&&(Me.current.scrollTop=Me.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[nt.length,D,it]);let at=(0,R.useMemo)(()=>{if(_?.kind===`settings`)return null;if(_?.kind===`attention`)return{kind:`attention`,item:Jd(_.item,o.attentionHistory??o.userTodos)};if(_?.kind===`goal`){let e=Ge.find(e=>e.goalId===_.item.goalId);return e?{item:e,kind:`goal`}:_}if(_?.kind!==`run`)return _;let e=Qe.find(e=>e.kind===`run`&&e.run.runId===_.item.runId);return e?{item:e.run,kind:`run`}:_},[Qe,_,Ge,o.attentionHistory,o.userTodos]);(0,R.useEffect)(()=>{if(s){Ee({}),Oe([]);return}let e=!1;return Promise.all([o_(),__()]).then(([t,n])=>{e||(Ee(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),Oe(n))}).catch(()=>{}),()=>{e=!0}},[s]),(0,R.useEffect)(()=>{if(!xe)return;function e(e){e.key===`Escape`&&Se(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[xe]),(0,R.useEffect)(()=>{if(B||!Qe.length)return;if(!ke.current){ke.current=!0;try{Ae.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{Ae.current=NaN}}let e=Ae.current,t=Qe.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};Re(e=>e?.done===r.done&&e.failed===r.failed?e:r)},[Qe,B]),(0,R.useEffect)(()=>{if(s){w({});return}let e=!1;return Gh(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||Gy(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>JS(e,f)),r=Object.fromEntries(n.map(e=>[e.previewId,e]));w(e=>({...e,...r})),B||be(n.map(e=>e.previewId))}).catch(()=>{}),()=>{e=!0}},[s,B,f]);async function ot(e,t={}){if(s)throw Error(f(`source.readOnlyWriteError`));let r;try{r=n.onPreviewAction?await n.onPreviewAction(e):JS(await Uh(e),f)}catch(t){if(!(t instanceof Rh)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??f(`proposal.workspaceGate.defaultSummary`))},impact:f(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:f(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return ve(e=>e.includes(r.previewId)?e:[...e,r.previewId]),w(e=>({...e,[r.previewId]:r})),t.select!==!1&&v({item:r,kind:`proposal`}),r}function st(){_t(null),He(`manager:${ze}`,f(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>je.current?.focus())}async function ct(e,t){Se(!1);let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:f(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:f(`proposal.summary.lifecycleResume`,{title:e.title}),stop:f(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(t===`stop`){if(Fe.current.has(e.goalId))return;Fe.current.add(e.goalId),fe(new Set(Fe.current)),v(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ue(f(`feedback.applying`,{title:i.stop})),n.onGoalActivationStateChange?.(e.goalId,`stopped`)}if(n.onExecuteGoalLifecycle){if(t===`delete`)throw Error(`The selected status source does not authorize Goal deletion.`);let a=await n.onExecuteGoalLifecycle({goalId:e.goalId,operation:t,reason:r[t]});if(!a.projectionVerified)throw Error(`Goal lifecycle projection did not verify.`);o=!0,n.onGoalActivationStateChange?.(e.goalId,a.activationState),ue(f(`feedback.completed`,{title:i[t]})),t===`stop`&&_t(null),await ft([e.goalId]);return}let s=await ot({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${t}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:t,reason:r[t]},summary:i[t]},{select:t!==`stop`});if(s.goalId!==e.goalId||s.lifecycleOperation!==t)throw v(null),Error(f(`actionReview.targetChanged`));t===`stop`&&(s.reviewPlan?.interaction===`direct`?(o=!0,await pt(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(s.gate?f(`feedback.gateRequired`,{summary:s.gate.summary}):f(`feedback.notCompleted`,{status:s.status})),v({item:s,kind:`proposal`})))}catch(e){a&&!o&&n.onGoalActivationStateChange?.(a.goalId,a.previous),ue(f(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{t===`stop`&&(Fe.current.delete(e.goalId),fe(new Set(Fe.current)))}}function lt(e,t){Ue(f(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),v(null),window.requestAnimationFrame(()=>je.current?.focus())}async function ut(e,t,r=``){let i=await n.onRequestScheduleConfig?.(e,t);if(i){ve(e=>e.includes(i.previewId)?e:[...e,i.previewId]),w(e=>({...e,[i.previewId]:i})),v({item:i,kind:`proposal`});return}if(!t){Ue(f(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await ot({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:t},idempotencyKey:`workspace-${e}-${t}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:ze,cadence:$S(r),goal_id:t,stop_condition:nC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:$S(r),goal_id:t,stop_condition:nC(r),target:tC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:tC(r,f)})})}async function dt(e){if(!Ie.current.has(e.todoId)){Ie.current.add(e.todoId),me(new Set(Ie.current)),ue(f(`feedback.preparingPreview`,{title:e.text}));try{await ot({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:f(`tasks.markComplete`,{name:e.text})}),ue(null)}catch(e){ue(f(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Ie.current.delete(e.todoId),me(new Set(Ie.current))}}}function ft(e){let t=n.onReconcileStatus,r=t?t({invalidateGoalIds:e}):n.onRefresh?.();return Promise.resolve(r).catch(()=>{ue(f(`feedback.goalRefreshFailed`))})}async function pt(e,t={}){let r=e.actionKind===`team.plan`&&e.status===`error`&&[`apply_failed`,`readback_unverified`].includes(e.reviewPlan?.reason??``);if(e.reviewPlan&&!e.reviewPlan.canApply&&!r)return;let i=t.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:o.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,s=t.lifecycleProjection??a;ue(f(`feedback.applying`,{title:e.title}));let c={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`pending`,reason:`apply_pending`,canApply:!1}:void 0,status:`applying`};w(t=>({...t,[e.previewId]:c})),i&&v({item:c,kind:`proposal`}),s&&!s.optimisticApplied&&n.onGoalActivationStateChange?.(s.goalId,s.next);try{if(n.onApplyProposal){await n.onApplyProposal(e);let t={...e,status:`applied`};w(n=>({...n,[e.previewId]:t})),i&&v({item:t,kind:`proposal`}),ue(f(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`&&((e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&_t(null),e.lifecycleOperation===`delete`&&e.goalId&&n.onGoalDeleted?.(e.goalId),ft(e.goalId?[e.goalId]:void 0));return}let t=await Kh(e.previewId);if(t.proposal.proposal_id!==e.previewId||t.proposal.action_kind!==e.actionKind||e.actionKind===`goal.lifecycle`&&(t.proposal.normalized_parameters.goal_id!==e.goalId||qS(t.proposal)!==e.lifecycleOperation))throw new Rh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=JS(t.proposal,f);if(w(t=>({...t,[e.previewId]:r})),i&&v({item:r,kind:`proposal`}),r.reviewPlan?.interaction!==`completed`){s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),v({item:r,kind:`proposal`}),ue(t.proposal.status===`stale`?f(`feedback.stale`):f(`actionReview.${r.reviewPlan.reason}`));return}ue(f(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await n.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&_t(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&n.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`&&ft(r.goalId?[r.goalId]:void 0)}catch(t){if(s&&n.onGoalActivationStateChange?.(s.goalId,s.previous),t instanceof Rh&&t.payload.error_code===`protected_action`){let r=t.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:`gated`,reason:`authority_gate`,canApply:!1}:void 0,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??t.message)},status:`gated`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(n.onRefresh?.(),_t(e.goalId));return}let r=t instanceof Rh&&Ky(t.payload),i=t instanceof Rh&&t.payload.error_code===`action_response_mismatch`,a={...e,reviewPlan:e.reviewPlan?{...e.reviewPlan,interaction:r?`refresh`:`repair`,reason:i?`readback_unverified`:r?`stale_proposal`:`apply_failed`,canApply:!1}:void 0,errorMessage:t instanceof Error?t.message:String(t),status:r?`stale`:`error`};w(t=>({...t,[e.previewId]:a})),v({item:a,kind:`proposal`}),ue(f(`feedback.executionFailed`,{error:a.errorMessage}))}}function mt(){E(`chat`),S(null),j(!1),window.requestAnimationFrame(()=>{let e=Me.current?.querySelectorAll(`.personal-message.is-assistant`);e?.item(e.length-1)?.scrollIntoView({block:`start`})})}let ht={...n,onOpenRunSession:async e=>{e.goalId!==B&&_t(e.goalId),E(`chat`),await n.onOpenRunSession?.(e),S(e),v(null)},onOpenGoal:e=>{_t(e),ft([e])},onOpenGoalView:e=>{e===`chat`?mt():E(e),v(null)},onOpenOutput:e=>{e.goalId!==B&&_t(e.goalId),E(`files`),n.onOpenOutput?.(e)},onApplyProposal:pt,onCancelProposal:async e=>{v(null),w(t=>{let n={...t};return delete n[e.previewId],n});try{n.onCancelProposal?.(e),n.onCancelProposal||await qh(e.previewId)}catch(t){w(t=>({...t,[e.previewId]:e})),ue(f(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=JS(await Jh(e.previewId,t),f);ve(e=>e.includes(n.previewId)?e:[...e,n.previewId]),w(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),v({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(w(t=>{let n={...t};return delete n[e.previewId],n}),await ot({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:ot,onRequestScheduleConfig:(e,t)=>lt(e,t),onOpenNotificationSettings:e=>Je({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>wg(),onSetupGoalChannel:e=>Eg(e),onToggleGoalAutoNotify:e=>Dg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await ot({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??ze,...!r&&t===`run_now`?{endpoint_id:ze}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},gt=s?{onOpenGoal:ht.onOpenGoal,onOpenGoalView:ht.onOpenGoalView,onOpenOutput:ht.onOpenOutput}:ht;function _t(e){m(e),O(!1),A(!1),j(!1),S(null),v(null),E(`tasks`),Se(!1),n.onSelectGoal?.(e)}function vt(e){g(e),n.onSelectAgent?.(e)}function yt(e){we(e),PS(e)}async function bt(r){let i=r?[]:I,a=(r??Ve).trim()||(i.length?f(`composer.imageAnalysisPrompt`):``);if(!(!a||ne)){if(P?.session_id===e&&P?.enabled&&P.active_turn_id&&e){if(i.length){ce(d===`zh-CN`?`运行中的消息投递暂不支持图片,请暂停后发送。`:`Pause execution before sending images.`);return}N(!0);try{let t=await pg(e,a,ie);r||Ue(``),oe(d===`zh-CN`?`${ie===`queue`?`已排队,等待后续回合`:ie===`inbox`?`已进入收件箱`:`已提交纠偏`} · ${t.status}`:`${ie}: ${t.status}`)}catch(e){ce(e instanceof Error?e.message:String(e))}finally{N(!1)}return}r||(Ue(``),se([])),ce(null),N(!0);try{if(i.length){B?T!==`chat`&&j(!0):A(!0);let e=await n.onSendMessage?.(a,ze,B,i);e&&await ot(e);return}let e=Ub(a,{agents:t.map(e=>({agentId:e.agentId,label:e.label})),goalId:B,todos:(V?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(e.route===`clarify`){Ue(a);let t=f(`composer.clarifySingleAction`);e.missingFields.includes(`resume_when`)&&(t=f(`composer.clarifyDefer`)),ue(t);return}if(e.actionKind===`goal.create`){let t=QS(a,f),n=YS(t.title);await ot({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:a},idempotencyKey:`workspace-goal-intent-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,completion_criteria:t.completionCriteria,execution_boundary:t.executionBoundary,goal_id:n,heartbeat:{cadence:$S(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:nC(a),title:t.title,workspace_ref:`current`},summary:f(`proposal.summary.goalCreate`,{title:t.title})});return}if(B&&e.actionKind===`heartbeat.bind`){await ut(`heartbeat`,B,a);return}if(B&&e.actionKind===`monitor.create`){let e=eC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=rC(a,t);if(B&&r&&e.actionKind===`agent.bind`){await ot({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-agent-bind-${B}-${r.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:r.agentId,goal_id:B},summary:`将 ${r.label} 绑定到 ${V?.title??B}`});return}if(B&&e.actionKind===`todo.create`){if(e.normalizedParameters.start_execution===!0){await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-task-start-${B}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:r?.agentId??ze,goal_id:B,start_execution:!0,text:a},summary:`交给 Agent 执行:${a.slice(0,120)}`});return}let t=r?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kiro|kimi)/iu.test(a)?ze:null);await ot({actionKind:`todo.create`,context:{kind:`goal`,goal_id:B,natural_language:a},idempotencyKey:`workspace-todo-create-${B}-${Date.now().toString(36)}`,normalizedParameters:{...t?{endpoint_id:t}:{},goal_id:B,text:iC(a)},summary:`创建 Todo:${iC(a)}`});return}let o=V?.agentTodos.find(e=>a.includes(e.todoId)||a.includes(e.text)),s=typeof e.normalizedParameters.operation==`string`?e.normalizedParameters.operation:null;if(B&&o&&e.actionKind===`todo.update`&&s){await ot({actionKind:`todo.update`,context:{kind:`todo`,goal_id:B,todo_id:o.todoId,natural_language:a},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:ze,...s===`reassign`&&r?{endpoint_id:r.agentId}:{},...s===`block`?{note:a}:{},...s===`defer`&&typeof e.normalizedParameters.resume_when==`string`?{resume_when:e.normalizedParameters.resume_when}:{},goal_id:B,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}B?T!==`chat`&&j(!0):A(!0);let c=await n.onSendMessage?.(a,ze,B);c&&await ot(c)}catch(e){r||(Ue(a),se(i));let t=e instanceof Error?e.message:f(`feedback.sendGenericError`);ue(f(`feedback.sendFailed`,{error:t}))}finally{N(!1)}}}let xt=t.find(e=>e.agentId===ze)?.label??ze,St=!V&&Ve.startsWith(f(`composer.createGoalDraftLead`));async function Ct(e){if(!e?.length)return;let t=sC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!aC.has(e.type)),i=n.find(e=>e.size>oC);if(t<=0){ce(f(`composer.imageCountError`,{count:sC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:oC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>cC(e,f)));se(e=>[...e,...t].slice(0,sC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:sC}):null)}catch(e){ce(e instanceof Error?e.message:f(`composer.imageReadGenericError`))}finally{Pe.current&&(Pe.current.value=``)}}function wt(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),Ct(t))}async function Tt(){let e=await __();Oe(e)}async function Et(){await Promise.all([Tt(),n.onRefresh?.()])}async function Dt(){if(!(!n.onRefresh||he===`loading`)){ge(`loading`);try{await n.onRefresh(),ge(`done`)}catch{ge(`error`)}window.setTimeout(()=>ge(`idle`),1800)}}let Ot=Xe?(0,z.jsx)(AS,{callbacks:gt,focusGoalConnection:!!(_?.kind===`settings`&&_.goalId),goalNotifications:o.goalNotifications??[],goals:Ge,initialGoalId:_?.kind===`settings`?_.goalId??B:B,initialTab:_?.kind===`settings`?_.tab??`lark`:`lark`,onChanged:()=>void Et(),onClose:Ye,onThemeChange:yt,theme:Ce}):null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{hidden:Xe,children:(0,z.jsx)(FS,{drawer:at?(0,z.jsx)(Qb,{agents:t,attentionHistory:o.attentionHistory??o.userTodos,onSelectAttention:e=>v({kind:`attention`,item:e}),callbacks:gt,goalNotifications:o.goalNotifications??[],goals:Ge,inspectorExpanded:y,larkConnections:s?[]:De,onClose:()=>{at.kind===`proposal`&&[`applied`,`rejected`].includes(at.item.status)&&(at.item.actionKind!==`heartbeat.bind`||at.item.status!==`applied`)&&w(e=>{let t={...e};return delete t[at.item.previewId],t}),b(!1),v(null)},onToggleInspectorSize:()=>b(e=>!e),readOnly:s,runs:Qe.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:at}):null,drawerMode:at?.kind===`todo`?y?`inspector-full`:`inspector`:`panel`,drawerOpen:at!==null,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),theme:Ce,main:(0,z.jsxs)(`div`,{className:`personal-channel`,children:[(0,z.jsx)(ib,{agents:t,managerChatOpen:D,managerChannelBinding:i,managerRuntime:a,mobileNavigationOpen:xe,onOpenGoalCapabilities:V&&!s?()=>Je({goalId:V.goalId,kind:`settings`,tab:`capabilities`}):void 0,onRefresh:n.onRefresh?()=>void Dt():void 0,onOpenNavigation:()=>Se(!0),onOpenManagerChat:()=>{A(!1),O(!0)},onSelectGoalTab:e=>{e===`chat`?mt():E(e)},onSelectAgent:vt,onReturnManagerHome:()=>{O(!1),A(!1),window.requestAnimationFrame(()=>Me.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:ze,refreshState:he,readOnlySourceLabel:s?u?.activeSource.label:void 0,selectedGoal:V,selectedGoalTab:T}),B&&T===`chat`&&!s&&ze===`codex`&&n.onStartLoopX?(0,z.jsx)(pb,{onPrepare:()=>n.onPrepareLoopX(ze,B),sessionId:e,onChange:re,onExecute:(e,t)=>n.onStartLoopX?.(e,ze,B,t)},`${B}:${ze}`):null,(0,z.jsxs)(`div`,{className:`personal-channel-scroll`,"data-active-goal-view":V?T:void 0,ref:Me,children:[!V&&!D&&Le&&Le.done+Le.failed>0?(0,z.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":f(`digest.away`),children:[(0,z.jsx)(`strong`,{children:f(`digest.away`)}),(0,z.jsxs)(`div`,{className:`personal-digest-stats`,children:[Le.done>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.done}),f(`digest.completed`)]}):null,Le.failed>0?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:Le.failed}),f(`digest.failed`)]}):null]})]}):null,!V&&!D?(0,z.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(rm,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(`home.greeting`)}),(0,z.jsx)(`p`,{children:o.goals.some(e=>e.activationState===`active`&&e.loadState)?f(`startup.partial`):(0,z.jsxs)(z.Fragment,{children:[f(`home.waitingCount`,{count:Ke}),` `,qe>0?f(`home.blockingSummary`,{count:qe}):null]})})]})]}):null,V?.loadState?(0,z.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:f(V.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,z.jsx)(`p`,{children:f(V.loadError?`startup.error.${V.loadError}`:`startup.independent`)}),V.loadState===`error`?(0,z.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void n.onRefresh?.(),children:f(`startup.retry`)}):null]})}):V?(0,z.jsx)(Hx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Vx,{active:!Xe&&T===`overview`,goal:V,items:Qe,userTodos:o.userTodos,readOnly:s,onOpenDetails:()=>v({kind:`goal`,item:V}),onSelect:v,onView:E}),tasks:(0,z.jsx)(wx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${IS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())},onOpenChat:mt,onQuickComplete:s?void 0:dt,onSelect:v,quickCompletingTodoIds:pe,selectedTodoId:at?.kind===`todo`?at.item.todoId:null,userTodos:o.userTodos}),files:(0,z.jsx)(BS,{items:Qe.filter(e=>e.kind===`output`),onSelect:v,reportState:o.periodicReports}),chat:(0,z.jsxs)(z.Fragment,{children:[V&&x?.goalId===V.goalId?(0,z.jsx)(HS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Eb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Eb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(zS,{goals:Ge,onRetry:()=>void n.onRefresh?.(),onSelectGoal:_t,systemHealth:o.systemHealth})]}),(0,z.jsxs)(`div`,{className:`personal-composer-wrap`,children:[P?.session_id===e&&P?.enabled&&P.active_turn_id?(0,z.jsxs)(`label`,{className:`goal-loopx-message-mode`,children:[d===`zh-CN`?`消息处理`:`Message delivery`,(0,z.jsxs)(`select`,{"aria-label":d===`zh-CN`?`消息处理方式`:`Message delivery mode`,value:ie,onChange:e=>ae(e.target.value),children:[(0,z.jsx)(`option`,{value:`queue`,children:d===`zh-CN`?`下一轮处理`:`Next turn`}),(0,z.jsx)(`option`,{value:`inbox`,children:d===`zh-CN`?`放入收件箱`:`Inbox`}),(0,z.jsx)(`option`,{value:`steer`,children:d===`zh-CN`?`立即纠偏`:`Steer now`})]}),(0,z.jsx)(`span`,{role:`status`,children:F})]}):null,s?(0,z.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,z.jsx)(`strong`,{children:f(`source.readOnlyNoticeTitle`)}),(0,z.jsx)(`span`,{children:f(`source.readOnlyNoticeDescription`)})]}):(0,z.jsxs)(z.Fragment,{children:[!V&&!D&&k&&et.length?(0,z.jsx)(VS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(VS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${IS(e)}`),ue(f(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>je.current?.focus())}:void 0,onOpenConversation:mt,title:`${V.title} · ${xt}`}):null,le?(0,z.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,z.jsx)(`span`,{children:le}),(0,z.jsx)(`button`,{"aria-label":f(`common.closeActionReceipt`),onClick:()=>ue(null),type:`button`,children:(0,z.jsx)(sh,{size:14})})]}):null,(0,z.jsxs)(`details`,{className:`personal-composer-tools`,children:[(0,z.jsx)(`summary`,{children:d===`zh-CN`?`快捷提问`:`Suggestions`}),V?(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.nextAction`),disabled:ne,onClick:()=>void bt(f(`composer.nextActionPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Nm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.nextAction`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.agentProgress`),disabled:ne,onClick:()=>void bt(f(`composer.agentProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(qm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.agentProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.monitor`),disabled:ne,onClick:()=>void bt(f(`composer.monitorShortcutTemplate`,{target:f(`schedule.defaultTarget`)})),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(am,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.monitor`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.blockers`),disabled:ne||!We(`gate`),onClick:()=>void bt(We(`gate`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(um,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.blockers`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.evidence`),disabled:ne||!We(`evidence`),onClick:()=>void bt(We(`evidence`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Sm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.evidence`)})]})]}):(0,z.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalTasks`),disabled:ne,onClick:()=>void bt(f(`composer.globalTasksPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(Nm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalTasks`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.globalProgress`),disabled:ne,onClick:()=>void bt(f(`composer.globalProgressPrompt`)),title:f(`composer.sendMessageHint`),type:`button`,children:[(0,z.jsx)(qm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.globalProgress`)})]}),(0,z.jsxs)(`button`,{"aria-label":f(`composer.createGoal`),onClick:st,title:f(`composer.createGoalHint`),type:`button`,children:[(0,z.jsx)(Vm,{size:13}),(0,z.jsx)(`span`,{children:f(`composer.createGoal`)})]})]})]},B??`manager`),St?(0,z.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,z.jsx)(`strong`,{children:f(`composer.createGoalDraft`)}),(0,z.jsx)(`span`,{children:f(`composer.createGoalDraftDescription`)})]}):null,I.length?(0,z.jsx)(`div`,{className:`personal-composer-images`,"aria-label":f(`composer.imagesPending`),children:I.map(e=>(0,z.jsxs)(`figure`,{children:[(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,z.jsx)(`button`,{"aria-label":f(`composer.sentImageAlt`,{name:e.name}),onClick:()=>se(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,z.jsx)(sh,{size:13})})]},e.id))}):null,L?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:L}):null,(0,z.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),Ct(t))},children:[(0,z.jsx)(`button`,{"aria-label":f(`composer.addImage`),className:`personal-composer-attach`,disabled:ne||I.length>=sC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(Rm,{size:17})}),(0,z.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":f(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:ne||I.length>=sC,multiple:!0,onChange:e=>void Ct(e.target.files),ref:Pe,type:`file`}),(0,z.jsx)(`textarea`,{"aria-label":f(`composer.sendMessage`),onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),bt())},onPaste:wt,placeholder:V?f(`composer.goalPlaceholder`,{goal:V.title}):f(`composer.managerPlaceholder`),ref:je,rows:1,value:Ve}),(0,z.jsx)(`button`,{"aria-label":f(St?`composer.createGoal`:`composer.send`),disabled:!Ve.trim()&&I.length===0||ne,onClick:()=>void bt(),title:f(St?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,z.jsx)(qm,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(bx,{attentionCount:Ke,goals:Ge,goalArchiveLoadState:r,goalLifecycleOperations:n.onExecuteGoalLifecycle?[`stop`,`resume`]:void 0,lifecycleBusyGoalIds:de,onRequestGoalCreate:s?void 0:st,onRequestGoalLifecycle:s&&!n.onExecuteGoalLifecycle?void 0:(e,t)=>void ct(e,t),onRetryGoalArchive:n.onRetryGoalArchive||n.onRefresh?()=>void(n.onRetryGoalArchive??n.onRefresh)?.():void 0,onOpenSettings:s?void 0:()=>Je({kind:`settings`}),onSelectGoal:_t,selectedGoalId:B,statusSourceControl:u},u?.activeSource.statusUrl??`/status.json`)})}),Ot]})}function uC(e){return(e??``).replace(/\s+/gu,` `).trim()}function dC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function fC(e,t,n){let r=uC(e);return!r||r===`暂无`?n?t(n):``:/refresh-state|latest_run|latest run-derived/iu.test(r)?t(`projection.refreshState`):/first read-only adapter tick|read-only adapter/iu.test(r)?t(`projection.firstReadOnlyAdapterCheck`):/todo update recorded for/iu.test(r)?t(`projection.todoStatusUpdated`):/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/iu.test(r)?t(n??`projection.agentPreparingNextStep`):dC(r)}function pC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function mC({eventCount:e,hasArtifact:t,hasLatestValidation:n},r){return{label:r(n?`projection.latestValidation`:`projection.latestRun`),metadata:e>0?r(`projection.events24h`,{count:e}):r(t?`projection.runEvidenceAvailable`:`projection.publicSafeProjection`)}}var hC=`/status.json`,gC=`loopx-status-source-catalog-v1`,_C={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:hC};function vC(e,t){let n=fh(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function yC(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function bC(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=vC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=ux(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:yC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function xC(){return{schemaVersion:1,sources:[_C]}}function SC(e,t){try{let n=e.getItem(gC);if(!n)return xC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return xC();let i=new Set([_C.statusUrl]);return{schemaVersion:1,sources:[_C,...r.sources.flatMap(e=>{let n=bC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return xC()}}function CC(e,t){e.setItem(gC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function wC(e,t){let n=new Set(t.filter(ux).map(e=>e.trim())),r=!1,i=e.sources.map(e=>e.kind!==`ssh_tunnel`||e.hostAlias||!n.has(e.label)?e:(r=!0,{...e,hostAlias:e.label}));return r?{...e,sources:i}:e}function TC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=vC(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};if(t.hostAlias!==void 0&&!ux(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:yC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function EC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function DC(e,t,n){if(!t.trim()||fh(t,n).source?.isRelative)return _C;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function OC(e,t,n){return DC(e,t,n)||(fh(t,n).source?.isRelative?_C:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function kC(e,t,n,r){return OC(e,t??n,r)}var AC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function jC(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${AC[n.operation]} · ${n.target}`}}var MC=hC;async function NC(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return Ap(await t.json())}function PC(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function FC(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??PC(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function IC(e){return(e??``).replace(/\s+/g,` `).trim()}function LC(e,t=132){let n=IC(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function RC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function zC(e,t){return e===void 0||t===void 0?void 0:e+t}function BC(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function VC(e){return e?.items.find(e=>!e.done)}function HC(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function UC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function WC(e,t,n){let r=[];for(let t of e){let e=BC(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function GC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var KC=`loopx.personal-agent-selection.v1`;function qC(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(KC)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var JC={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function YC(e,t){return IC(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function XC(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(`
+`).trim()}function ZC(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var QC=`已发现的项目 Agent`;function $C(e){switch(My(e)){case`codex`:return`Codex`;case`claude`:return`Claude Code`;case`kiro`:return`Kiro CLI`;case`trae`:return`Trae CLI Agent`;case`coco`:return`Coco Agent`;default:return YC(e)}}function ew(e,t){switch(Ny(e,t)){case`codex`:return`代码与项目执行`;case`claude`:return`复杂分析与长任务`;case`openai`:case`anthropic`:return`管家问答 · 无工具`;case`kiro`:return`终端编码 · 原生 /goal 循环`;case`trae`:return`前端与交互实现`;case`coco`:return`通用任务`;default:return QC}}function tw(e,t){let n=e.project_asset;return t===`user`?HC(n?.user_todos,e.user_todos,`project_asset.user_todos`):HC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function nw(e){return LC(e.title??e.text,112)}function rw(e){let t=e.resume_condition?.resume_receipt;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.receipt_id;return typeof n==`string`&&n.trim()?n.trim():null}function iw(e,t){return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:rw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?LC(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:nw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function aw(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function ow(e){return aw(e).map(t=>iw(t,e))}function sw(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=iw(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function cw(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:LC(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function lw(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=cw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function uw(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=aw(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>iw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:IC(t?.next??``)||(l?IC(l.title??``)||IC(l.text??``):``)||null,recentCompleted:c}}function dw(e,t){let n=IC(e);return n?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(n)?t(`projection.goalVerified`):fC(n,t,`projection.validationRecorded`):``}function fw(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function pw(e,t,n){let r=t.queueItem?.project_asset?.latest_validation,i=t.latestRun,a=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!r&&!i&&!a)return null;let o=[dw(r?.summary,n),fC(i?.health_check,n),fC(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=mC({eventCount:a?.events_24h??0,hasArtifact:!!(i?.json_exists||i?.markdown_exists),hasLatestValidation:!!r},n);return{generatedAt:r?.generated_at??i?.generated_at??a?.latest_event_at??``,label:s.label,metadata:s.metadata,runId:i?`${t.goal.id}:${i.generated_at}`:null,safePreview:[o,s.metadata].filter(Boolean).join(`
+`),summary:o,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function mw(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function hw(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function gw(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function _w(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!hw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||gw(t)}function vw(e,t){let n=hw(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??null}function yw(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function bw(e,t){let n=e.latestRun?.operator_gate;return fC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function xw(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=BC(t,`user`),r=BC(t,`agent`),i=!!VC(n),a=!!VC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||yw(t)?`等你`:_w(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:UC(t)===`eligible`||a?`推进中`:mw(t)?`已完成`:`安静运行`}function Sw(e,t,n,r){if(n===`已停止`)return pC(`stopped`,r);if(n===`需修复`)return fC(vw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return pC(`needs_you`,r);if(n===`推进中`){let e=[(BC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>IC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>IC(e)).find(e=>e!==``&&e!==`暂无`);return e?fC(e,r,`projection.agentAdvancingGoal`):pC(`advancing`,r)}return pC(n===`等待条件`?`waiting_external`:`idle`,r)}function Cw(e,t){return t.some(t=>e.includes(t))}function ww(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Cw(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(Cw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${YC(e.goalId)}」:${e.text}`:`当前最先处理「${YC(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(Cw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${YC(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Cw(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function Tw(e,t,n,r=!1){let i=new Map(t.map(e=>[e.goal.id,e])),a=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),o=RC(e.usage_summary),s=WC(t,e.todo_index,e.agent_management_projection),c=e.attention_queue.items.flatMap((e,t)=>{if(a.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(tw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:Kd(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:nw(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),l=c.filter(e=>!e.projectedDone),u=new Set(l.map(e=>e.goalId)),d=t.flatMap((t,r)=>a.has(t.goal.id)||u.has(t.goal.id)||!yw(t)?[]:[{details:Kd({task_class:`user_gate`,status:`open`,note:t.latestRun?.operator_gate?.reason_summary}),actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+r,taskClass:`user_gate`,text:bw(t,n),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),f=[...l,...d].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),p=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let a=i.get(t.id);if(!a)return[];let c=xw(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=uw(a),p=t.coordination?.registered_agents??[],m=new Set(p),h=[...s.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(m.size===0||m.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),g=new Set(h.map(e=>e.agentId)),_=[...h.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...p.filter(e=>!g.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],v=h[0],y=lw(ow(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,Sw(e,a,c,n)].map(e=>fC(e,n)).find(e=>e!==``&&e!==`暂无`)??n(`projection.nextUpdatePending`);return[{activationState:t.activation_state,agentId:v?.agentId??p[0]??`codex`,agentLaneCount:_.length,agentLanes:_,agentLabel:v?.agentId,agentSentence:Sw(e,a,c,n),agentTodos:[...y,...d.recentCompleted],doneTodoCount:d.doneTodoCount,acceptanceObservation:t.acceptance_observation,goalId:t.id,latestActivity:a.latestRun?.generated_at??``,needsYou:u,needsYouActionKind:l?.actionKind??null,needsYouBlocking:l?.blocking??!1,needsYouTaskClass:l?.taskClass??null,needsYouTodoId:l?.todoId??null,nextSentence:b,runEvidence:pw(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:sw(e,a,y),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,executionConfig:t.spawn_policy?.execution_config,maxChildren:t.spawn_policy?.max_children??0,modelConfig:t.spawn_policy?.model_config}}:{},title:YC(t.id,t.display_name),usage:(()=>{let e=o.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:zC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:zC(e.input_tokens_7d,e.output_tokens_7d)}:null})()}]}),m=[];if(e.ok||m.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;m.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||m.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&m.push(`[${t.kind}] ${t.message}`)}let h=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,g=m.length===0&&!h,_={ok:g,summary:g?`所有控制面契约与注册表检查均正常`:`发现 ${m.length+ +!!h} 项系统健康关注点`,issues:m,freshnessWarning:h};return{blockingTodoCount:f.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:p,openUserTodoCount:f.length,systemHealth:_,attentionHistory:[...c,...d],userTodos:f,visibleUserTodos:f.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?LC(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Ew({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,g=f.activeSource.kind===`ssh_tunnel`?f.activeSource.hostAlias:void 0,{t:_}=Ji(),[v,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>{let e=Tw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>Tw(e,FC(e.run_history.goals,e.attention_queue.items),_,b)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,attentionHistory:t.flatMap(e=>e.attentionHistory??e.userTodos),visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,b,_]),D=E.goals.find(e=>e.goalId===d)??null,O=l?.snapshots[d]??c,[k,A]=(0,R.useState)(null),[ee,j]=(0,R.useState)(null),[M,te]=(0,R.useState)(!1),ne=E.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:E.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),N=D?.goalId??`manager`;E.goals.some(e=>e.activationState===`active`&&e.loadState)||(E.systemHealth?!E.systemHealth.ok:!c.ok)||E.openUserTodoCount>0&&`${E.openUserTodoCount}${E.blockingTodoCount}`;let P=v.length>0?v.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:ew(e.agent_id,e.adapter_kind),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:ew(`codex`),label:`Codex`,statusLabel:`正在检测`}],re=[...P,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ie=P.find(e=>e.label===`Codex`&&e.available)?.agentId??P.find(e=>e.available)?.agentId??`status-only`,ae=w?.executor_endpoint?.trim()??``,F=ae?P.find(e=>e.agentId===ae)?.agentId:void 0,oe=e=>e===`manager`?F??ie:ie,[I,se]=(0,R.useState)(qC),L=vh(re,I[N]??oe(N),ie),[ce,le]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(`chat`),[me,he]=(0,R.useState)(``),[ge,_e]=(0,R.useState)({}),[ve,ye]=(0,R.useState)({}),[be,xe]=(0,R.useState)(null),[Se,Ce]=(0,R.useState)({}),[we,Te]=(0,R.useState)([]),[Ee,De]=(0,R.useState)(null),[Oe,ke]=(0,R.useState)({}),Ae=(0,R.useRef)(1),je=(0,R.useRef)(1),Me=(0,R.useRef)(new Map),Ne=(0,R.useRef)(new Set),Pe=(0,R.useRef)(new Map),Fe=(0,R.useRef)(new Map),Ie=(0,R.useRef)(new Set),Le=(0,R.useRef)(new Set),Re=(0,R.useRef)(null),B=(0,R.useRef)(null),ze=(0,R.useRef)(null),Be=(0,R.useRef)(null);(0,R.useRef)(null);let Ve=ge[N]??[];ve[N];let He=(e,t)=>e===`manager`?_(`header.manager`):t,Ue=D?E.userTodos.filter(e=>e.goalId===D.goalId):E.userTodos,We=D?.agentTodos??[];fw(We,D?.needsYou?3:4);let Ge=We.filter(e=>e.done).length,Ke=We.length>0?`${Ge}/${We.length}`:`暂无计划`;D&&({...E},Ue.filter(e=>e.blocking).length,Ue.length),(0,R.useEffect)(()=>{let e=dh(f.activeSource.statusUrl,window.location.href),t=e.source?hh(O,e.source):null;if(!D||!t?.indexUrl||!t.detailUrl){A(null),j(null),te(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return A(null),j(null),te(!0),gh(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?_h(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(jp(e))}).finally(()=>{i||te(!1)}),()=>{i=!0}},[O,D?.goalId,f.activeSource.statusUrl]);let qe=Se[N]?.sessionId;(0,R.useEffect)(()=>{if(h||!qe)return;let e=!1,t,n=async()=>{try{let t=await $h(qe);if(e)return;let n=t.messages.filter(e=>e.origin===`manager_followup`);_e(e=>{let r=e[N]??[],i=new Set(r.map(e=>e.sourceMessageId)),a=n.filter(e=>!i.has(e.message_id)),o=new Map(n.map(e=>[e.message_id,e.return_delivery])),s=new Map(t.messages.filter(e=>e.role!==`user`&&e.origin!==`manager_followup`).map(e=>[e.turn_id,e])),c=new Map(t.messages.map(e=>[e.message_id,e.collaboration])),l=!1,u=r.map(e=>{let t=e.sourceMessageId?o.get(e.sourceMessageId):void 0,n=e.sourceTurnId?s.get(e.sourceTurnId):void 0,r=e.sourceMessageId?c.get(e.sourceMessageId):n?.collaboration;return JSON.stringify(t)===JSON.stringify(e.returnDelivery)&&JSON.stringify(r)===JSON.stringify(e.collaboration)?e:(l=!0,{...e,sourceMessageId:e.sourceMessageId??n?.message_id,returnDelivery:t,collaboration:r})});return!a.length&&!l?e:{...e,[N]:[...u,...a.map(e=>({id:Ae.current++,sourceMessageId:e.message_id,role:`assistant`,agentLabel:`协作回执`,sourceLabel:`协作回执`,text:XC(e.text),lines:[],returnDelivery:e.return_delivery}))]}})}catch{}finally{e||(t=setTimeout(n,3e3))}};return n(),()=>{e=!0,t&&clearTimeout(t)}},[h,qe,N,L.label]);function V(e,t){Ce(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,R.useEffect)(()=>{if(h){y([]),x(!1),C(null),T(null);return}let e=!1;return Xh().then(t=>{if(!e){y(t.adapters??[]);let e=t.manager?.runtime;T(t.manager?.channel_binding??null),C(e?{schema_version:`manager_runtime_session_readback_v0`,runtime_profile:e.runtime_profile,configuration_revision:e.configuration_revision,status:e.status,sandbox:e.sandbox,standing_grant:e.standing_grant,tool_classes:e.tool_classes}:null),x(t.goal_subagent_configuration===`preview_locked`)}}).catch(()=>{e||x(!1)}),()=>{e=!0}},[h]),(0,R.useEffect)(()=>{try{window.localStorage.setItem(KC,JSON.stringify(I))}catch{}},[I]),(0,R.useEffect)(()=>{if(h||!L.available)return;let e=N,t=`${e}:${L.agentId}`,n=D?`goal`:`manager`,r=D?`goal.${D.goalId}`:`manager`,i=!1,a=null,o=null;return(async()=>{try{let s=await ng({agentId:n===`manager`?void 0:L.agentId,channelId:r,goalId:D?.goalId});if(i||(_e(t=>(t[e]?.length??0)>0?t:{...t,[e]:s.messages.map(t=>({sourceMessageId:t.message_id,agentLabel:t.role===`user`?void 0:t.origin===`manager_followup`?`协作回执`:He(e,L.label),attachments:GC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,returnDelivery:t.return_delivery,collaboration:t.collaboration,sourceLabel:t.role===`user`?void 0:t.role===`error`?`本地会话记录`:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:t.role===`user`?t.text:XC(t.text)}))}),L.agentId===`status-only`))return;let c=s.sessions[0];if(o=c?.session_id??null,c&&!c.resumable){Ne.current.add(t),V(e,{agentId:L.agentId,resumable:!1,sessionId:c.session_id,status:`resume_failed`});return}let l=n===`manager`?``:D?.goalId??``;if(n===`goal`&&!l)return;let u=await Qh(l,n===`manager`?I[e]:L.agentId,`resume_latest`,n);if(i)return;n===`manager`&&u.session.manager_runtime&&C(u.session.manager_runtime),Me.current.set(t,u.session_id);let d=s.snapshots.find(e=>e.session.session_id===u.session_id),f=d?.session.active_turn_id??``;if(V(e,{agentId:u.agent_id||L.agentId,resumable:!0,sessionId:u.session_id,status:f?`running`:`ready`,turnId:f||void 0}),Ne.current.delete(t),!f)return;let p=`${u.session_id}:${f}`;if(Le.current.has(p))return;Le.current.add(p),Pe.current.set(e,f),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`running`,turnId:f}),xe(e),a=new AbortController,Fe.current.set(e,a);let m=``,h=Je(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:He(e,L.label),lines:[],pending:!0,sourceLabel:e===`manager`?`恢复的${_(`header.manager`)}会话`:`恢复的 ${L.label} 会话`,text:``});try{let t=await gg(u.session_id,f,{signal:a.signal,onDelta:t=>{m+=t,Ye(e,h,{text:m})},onActivity:t=>{_e(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===h?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(i)return;Ye(e,h,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||m.trim()||`${He(e,L.label)} 已完成分析。`});let n=E.goals.find(e=>e.goalId===d?.session.goal_id)??D??E.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.filter(yh).map(e=>({goalId:n.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));r.length>0&&ye(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(i)return;Ye(e,h,{activity:[],lines:[],pending:!1,reconnect:t instanceof Rh&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{Le.current.delete(p),Pe.current.get(e)===f&&Pe.current.delete(e),V(e,{agentId:L.agentId,resumable:!0,sessionId:u.session_id,status:`ready`}),Fe.current.get(e)===a&&Fe.current.delete(e),i||xe(t=>t===e?null:t)}}catch(n){if(i)return;n instanceof Rh&&n.payload.error_code===`resume_failed`&&(Ne.current.add(t),o&&V(e,{agentId:L.agentId,resumable:!1,sessionId:o,status:`resume_failed`}))}})(),()=>{i=!0,a?.abort()}},[N,E.goals[0]?.goalId,h,D?.goalId,L.agentId,L.available,L.label,I]),(0,R.useEffect)(()=>{if(h||D||E.goals.length===0||ne===`loading`)return;let e=!1;return Promise.all(E.goals.filter(e=>!e.loadState).map(async e=>{let t=await eg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||Ce(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,ne,D?.goalId]),(0,R.useEffect)(()=>{if(De(null),h){Te([]),ke({});return}if(!D){Te([]),ke({});return}let e=!1,t=0,n=0;Te([]),ke({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await eg({goalId:D.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));Te(r);let i=await Promise.allSettled(r.map(e=>$h(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,De(e?`partial`:null),ke(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||De(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,D?.goalId]),(0,R.useEffect)(()=>{if(!ce)return;let e=window.requestAnimationFrame(()=>{Re.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),B.current?.focus()}},[ce]),(0,R.useEffect)(()=>{if(!ue)return;let e=window.requestAnimationFrame(()=>ze.current?.focus());return()=>{window.cancelAnimationFrame(e),Be.current?.focus()}},[ue]),(0,R.useEffect)(()=>{if(!ce&&!ue)return;let e=e=>{e.key===`Escape`&&(le(!1),de(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce,ue]);function Je(e,t){let n=Ae.current++;return _e(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ye(e,t,n){_e(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function Xe(e,t){let n=`${e}:${t}`,r=Me.current.get(n);if(r)return r;let i=await Qh(e,t,Ne.current.has(n)?`new`:`resume_latest`,`goal`);return Me.current.set(n,i.session_id),Ne.current.delete(n),V(e,{agentId:t,resumable:!0,sessionId:i.session_id,status:i.session.status}),i.session_id}async function Ze(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:N,i=r===`manager`?null:E.goals.find(e=>e.goalId===r)??null,a=t?.agentId?vh(re,t.agentId,ie):L,o=r===`manager`?E:i?{...E,blockingTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:E.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:E.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:E.userTodos.filter(e=>e.goalId===i.goalId)}:E,s=Ae.current++;if(_e(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),he(``),xe(r),a.agentId===`status-only`||!i&&r!==`manager`){let e=ww(O,o,n),t=a.agentId===`status-only`;Je(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),Zh({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(`
+`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),xe(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=r===`manager`?Me.current.get(c):await Xe(r,a.agentId);if(!e){let t=Ne.current.has(c)?`new`:`resume_latest`,n=r===`manager`?I[r]:a.agentId,o=await Qh(r===`manager`?``:i.goalId,n,t,r===`manager`?`manager`:`goal`);r===`manager`&&o.session.manager_runtime&&C(o.session.manager_runtime),e=o.session_id,Me.current.set(c,e),V(r,{agentId:o.agent_id||a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ne.current.delete(c)}let o=``;l=Je(r,{activity:[r===`manager`?`正在连接管家`:`正在连接 Agent`],agentLabel:He(r,a.label),lines:[],pending:!0,sourceLabel:r===`manager`?`${_(`header.manager`)} · 跨 Goal`:`${a.label} Agent · ${YC(i.goalId)}`,text:``});let s={attachments:t?.attachments,signal:(()=>{let e=new AbortController;return Fe.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ye(r,l,{text:o})},onActivity:e=>{l!==null&&_e(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{l!==null&&Ye(r,l,{sourceTurnId:n}),Pe.current.set(r,n),V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}},u;if(t?.loopxMode){let n=await fg(e,t.loopxMode.operation,t.loopxMode.settings);if(!n.turn_id)throw Error(`LoopX execution returned no turn identity`);s.onPhase(`turn.accepted`,n.turn_id),u=await gg(e,n.turn_id,s)}else u=await mg(e,n,s);let d=u.response;Ye(r,l,{lines:d.gate?[d.gate.summary,d.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:XC(d.message||o.trim())||`${He(r,a.label)} 已完成分析。`});let f=d.proposals.filter(yh);if(f.length>0&&!i&&Ye(r,l,{lines:[`请进入要修改的 Goal,预览并确认具体变更。`]}),f.length>0&&i){let e=f.map(e=>({goalId:i.goalId,id:je.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));ye(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&d.protected_action){let e=jC(r,n,d.protected_action);if(e)return e}}catch(e){if(Ie.current.delete(r)||t?.loopxMode&&e instanceof Rh&&e.payload.error_code===`turn_interrupted`){let e={agentLabel:He(r,a.label),lines:[],pending:!1,sourceLabel:r===`manager`?`${_(`header.manager`)}会话`:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Je(r,e):Ye(r,l,e);return}let n=e instanceof Rh?e.payload:null;n&&xh(n)&&Me.current.delete(c),n?.error_code===`resume_failed`&&(Me.current.delete(c),Ne.current.add(c),V(r,{agentId:a.agentId,resumable:!1,sessionId:Se[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let i=n?.gate,o=i&&typeof i==`object`?String(i.summary??``):``,s={agentLabel:He(r,a.label),lines:o?[o]:[],pending:!1,reconnect:n?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:n?.error_code===`resume_failed`?`原 ${He(r,a.label)} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${He(r,a.label)} 会话暂时不可用。`};l===null?Je(r,s):Ye(r,l,s)}finally{Pe.current.delete(r),Fe.current.delete(r);let e=Me.current.get(c);e&&V(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),xe(e=>e===r?null:e)}}async function Qe(e){let t=e?.goalId??N,n=Se[t],r=e?.agentId??n?.agentId??L.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Me.current.get(i),o=e?.turnId??n?.turnId??Pe.current.get(t);if(!(!a||!o))try{Ie.current.add(t),await og(a,o),Fe.current.get(t)?.abort()}catch(e){throw Ie.current.delete(t),e}finally{Pe.current.delete(t),V(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),Fe.current.delete(t),xe(e=>e===t?null:e)}}async function $e(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??Se[t]?.sessionId??Me.current.get(n);if(r)try{let i=await vg(r);Me.current.set(n,r),Ne.current.delete(n),V(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{V(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function et(e){let t=`${e.goalId}:${e.agentId}`;Me.current.delete(t),Ne.current.add(t),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function tt(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??Se[e.goalId]?.sessionId??Me.current.get(t);n&&n!==`new-session-pending`&&await _g(n),Me.current.delete(t),Ne.current.add(t),V(e.goalId,null)}function nt(e){re.some(t=>t.agentId===e&&t.available)&&(se(t=>({...t,[N]:e})),le(!1))}function rt(){i(``),pe(`chat`)}function it(e){i(e),pe(`chat`)}D&&JC[D.state],D&&(`${L.label}${D.state}`,We.length>0&&`${Ke}`,Ue.length>0&&`${Ue.length}`),D?.state===`需修复`||!D&&!c.ok?(D&&$C(D.agentId),D?.nextSentence,D?.agentSentence):D?.state===`等你`?(D.needsYouBlocking,D.needsYouBlocking,D.needsYou??D.nextSentence,D.needsYou):(D&&$C(D.agentId),D?.nextSentence);let at=[...!D&&Se.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:Se.manager.agentId,agentLabel:$C(Se.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:Se.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...D?we.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=D.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=Oe[e.session_id],a=i?.messages.some(e=>ZC(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:$C(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:D.goalId,goalTitle:D.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:ZC(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:XC(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...D&&(Se[D.goalId]?.turnId||D.runEvidence||jb(D))?[{id:`run:${D.goalId}`,kind:`run`,run:{agentId:Se[D.goalId]?.agentId??D.agentId,agentLabel:$C(Se[D.goalId]?.agentId??D.agentId),canInterrupt:!!Se[D.goalId]?.turnId,completedSteps:D.agentTodos.filter(e=>e.done).length,goalId:D.goalId,goalTitle:D.title,latestActivity:D.agentSentence,resumable:Se[D.goalId]?.resumable??!0,runId:`goal:${D.goalId}`,sessionId:Se[D.goalId]?.sessionId,sessionStatus:Se[D.goalId]?.status,status:Se[D.goalId]?.turnId?`running`:D.state===`需修复`?`failed`:`waiting`,title:D.nextSentence,totalSteps:D.agentTodos.length||1,turnId:Se[D.goalId]?.turnId,outputs:D.runEvidence?[{createdAt:D.runEvidence.generatedAt,kind:`evidence`,outputId:`${D.goalId}:latest-evidence`,title:D.runEvidence.label}]:[]}}]:[],...Ve.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,returnDelivery:e.returnDelivery,collaboration:e.collaboration,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(`
+`))}})),...(D?[D]:E.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:$C(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...D&&k?[{id:`output:${D.goalId}:report:${k.publication.publication_id}`,kind:`output`,output:{agentId:k.agent_id,agentLabel:$C(k.agent_id),createdAt:k.publication.delivered_at,goalId:D.goalId,goalTitle:D.title,kind:`report`,outputId:k.publication.publication_id,report:{addedCount:k.delta.added_count,changedCount:k.delta.changed_count,deliveredAt:k.publication.delivered_at,generationId:k.generation_id,items:k.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:k.period_window.end_at,periodStartAt:k.period_window.start_at,predecessorPublicationId:k.publication.predecessor_publication_id,publicationId:k.publication.publication_id},safePreview:k.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(`
-`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>qd(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...Eb(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(oC,{agents:re.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Kh((await Uh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await gg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:qC(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await $h(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:HC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:qC(t.text)}))})),V(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await xg(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await Sg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await mx(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(`
-`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function ww({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Dy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(th,{className:`h-4 w-4`}):(0,z.jsx)(Im,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Oy,{"data-testid":`initial-status-state`,children:(0,z.jsx)(ky,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(um,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Um,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Dy,{disabled:t,onClick:n,children:[(0,z.jsx)(Um,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function Tw(){let e=ST.useSearch(),t=ST.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Mp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>yC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(b_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:kC,j=!!(_&&C),M=EC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>MC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),AC(ph(e,`stopped`,window.location.href)).then(r=>{if(!w_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>q_(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{w_(O.current,t)&&S({error:jp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||kC,t=S_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>q_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),C_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=S_(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await Ip(n,window.location.href).catch(()=>null);if(!w_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Pp(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Lp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await zp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>w_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&w_(O.current,c)){await F(n,{resyncAttempt:1});return}w_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await AC(ph(n,`active`,window.location.href));if(!w_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!C_(O.current,c))return;r||v(jp(e))}finally{!r&&C_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=x_(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await px(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{bC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=SC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=xC(t,e);n!==t&&I(n)},onRemove:e=>{I(CC(f,e)),M.id===e&&oe(mC)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(kC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(ww,{error:_,isLoading:y,onRetry:()=>void F(A||kC),requestedUrl:A||kC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Cw,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Op(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Op(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>kp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||kC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||kC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var Ew=Q_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function Dw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Ty(Ew({variant:t}),e),...n})}var Ow=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],kw=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],Aw=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],jw=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],Mw=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function Nw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Pw(){return(0,z.jsx)(Nw,{icon:im,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:Ow.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Dw,{variant:`info`,children:e.label}),(0,z.jsx)(Dw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Fw(){return(0,z.jsx)(Nw,{icon:wm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:kw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function Iw(){return(0,z.jsx)(Nw,{icon:bm,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Aw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function Lw(){return(0,z.jsx)(Nw,{icon:fm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:jw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(tm,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Rw(){return(0,z.jsx)(Nw,{icon:pm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:Mw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Dw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function zw(){return(0,z.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,z.jsx)(nh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Om,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(vm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,z.jsx)(pm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Dw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Dw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Dw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Dw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Dw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Pw,{}),(0,z.jsx)(Fw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(Iw,{}),(0,z.jsx)(Lw,{})]}),(0,z.jsx)(Rw,{}),(0,z.jsx)(Nw,{icon:Zm,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var Bw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Vw=yd(W(),G().finite()).default({}),Hw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),Uw=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),Bw),effort:Vw,insight:Hw.nullable().optional()}),Ww=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),Bw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Vw,redacted_insight:Hw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),Gw=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),Kw=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),Gw),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),qw=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),Jw=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),qw)}).passthrough(),Yw=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q(Kw),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q(Uw),eligible_comparisons:q(Jw),largest_eligible_primary_contrast:Jw.nullable()})),runs:q(Ww),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function Xw(e){return Yw.parse(e)}function Zw(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var Qw=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function $w(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function eT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function tT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${eT(t)} min`}function nT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function rT(e){if(!e)return`—`;let t=e.total==null?eT(e.value):`${eT(e.value)}/${eT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function iT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${eT(n.value_mean)} mean`:`${$w(n.suite_micro_rate)} · ${eT(n.suite_micro_numerator)}/${eT(n.suite_micro_denominator)}`}function aT(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${eT(r.delta)}`}}function oT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function sT({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(oT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:iT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function cT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(oT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:iT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:tT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:nT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:nT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:nT(t.failure_class_counts)})]})]})]},t.arm_id))})}function lT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=aT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(oT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,rT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,rT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,tT(r.effort.duration_ms),` `,(0,z.jsx)(Qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function uT({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(oT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[tT(e.effort.duration_ms),` · `,eT(e.effort.agent_steps),` steps · `,eT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:rT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function dT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(uT,{packet:e,run:r})]})}function fT(){let e=DT.useSearch(),t=DT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:Zw(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return Xw(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(um,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Um,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(Yp,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(Zm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(oT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(hm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[$w(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(dm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(Qp,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(Yp,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[Qw.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Um,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(sT,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(cT,{packet:n}),e.view===`cases`&&(0,z.jsx)(lT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(dT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Zm,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var pT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),mT=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),hT=mT.omit({mode:!0}),gT=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function _T(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function vT({goalId:e,statusUrl:t}){let n=t?dh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function yT(){let e=CT.useSearch();return e.mode===`ops`?(0,z.jsx)(vT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(_T,{})}function bT(){return(0,z.jsx)(vT,{...wT.useSearch()})}var xT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),ST=xi({getParentRoute:()=>xT,path:`/`,validateSearch:e=>pT.parse(e),component:Tw}),CT=xi({getParentRoute:()=>xT,path:`/frontstage`,validateSearch:e=>mT.parse(e),component:yT}),wT=xi({getParentRoute:()=>xT,path:`/deprecated/frontstage/ops`,validateSearch:e=>hT.parse(e),component:bT}),TT=xi({getParentRoute:()=>xT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),ET=xi({getParentRoute:()=>xT,path:`/developers/projections`,component:zw}),DT=xi({getParentRoute:()=>xT,path:`/benchmarks/study`,validateSearch:e=>gT.parse(e),component:fT}),OT=xT.addChildren([ST,CT,wT,TT,ET,DT]);function kT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var AT=Li({routeTree:OT,basepath:kT(`/chat/`),trailingSlash:`preserve`}),jT=document.getElementById(`root`);if(!jT)throw Error(`Root element not found`);var MT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(jT).render((0,z.jsx)(Fe,{client:MT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:AT})})}));
\ No newline at end of file
+`),summary:k.summary,title:k.title}}]:[]],ot=f.connectionState===`connected`,st=new Map(E.goals.map(e=>[e.goalId,e.title])),ct=e=>qd(e,f.activeSource.statusUrl,ot&&!l?.errors[e.goalId],st.get(e.goalId)),lt={...kb(E),userTodos:E.userTodos.map(ct),attentionHistory:(E.attentionHistory??E.userTodos).map(ct),periodicReports:{error:ee,loading:M},timeline:at};return(0,z.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[Ee?(0,z.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:_(Ee===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,z.jsx)(lC,{agents:re.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>it(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await Kh((await Uh({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){Pe.current.set(e.goalId,r);let t=new AbortController;Fe.current.set(e.goalId,t);let n=``,i=Je(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await gg(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ye(e.goalId,i,{text:n})}});Ye(e.goalId,i,{activity:[],pending:!1,text:XC(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Ie.current.delete(e.goalId);Ye(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{Pe.current.delete(e.goalId),Fe.current.delete(e.goalId),V(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:tt,onInterruptRun:async e=>Qe(e),onOpenGoal:it,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await $h(t);ke(e=>({...e,[t]:n})),it(e.goalId),_e(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:GC(t.attachments),id:Ae.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:XC(t.text)}))})),V(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>it(e.goalId),...b?{onPreviewGoalSubagentConfiguration:async e=>{let t=await xg(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:t.codex_host_capacity.configured_children,newSessionRequired:t.codex_host_capacity.new_session_required,requiredChildren:t.codex_host_capacity.required_children,status:t.codex_host_capacity.status,writeRequired:t.codex_host_capacity.write_required,written:t.codex_host_capacity.written},enabled:t.feature_summary.multi_subagent===`enabled`,executionConfig:t.after.orchestration.execution_config,maxChildren:t.after.orchestration.max_children,modelConfig:t.after.orchestration.model_config},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await Sg(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,codexHostCapacity:{configuredChildren:n.codex_host_capacity.configured_children,newSessionRequired:n.codex_host_capacity.new_session_required,requiredChildren:n.codex_host_capacity.required_children,status:n.codex_host_capacity.status,writeRequired:n.codex_host_capacity.write_required,written:n.codex_host_capacity.written},enabled:n.feature_summary.multi_subagent===`enabled`,executionConfig:n.after.orchestration.execution_config,maxChildren:n.after.orchestration.max_children,modelConfig:n.after.orchestration.model_config}}}:{},...g?{onExecuteGoalLifecycle:async({goalId:e,operation:t,reason:n})=>{let r=await _x(g,e,t,n);return{activationState:r.activation_state,projectionVerified:r.projection_verified}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(`
+`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:$e,onSelectAgent:nt,onSelectGoal:e=>e?it(e):rt(),onSendMessage:async(e,t,n,r)=>Ze(e,{agentId:t,goalId:n,attachments:r}),onPrepareLoopX:(e,t)=>Xe(t,e),onStartLoopX:(e,t,n,r)=>{Ze(e===`start`?`开启 LoopX 模式,持续推进当前 Goal。`:`恢复 LoopX 模式。`,{agentId:t,goalId:n,loopxMode:{operation:e,settings:r}})},onStartNewRunSession:et},goalArchiveLoadState:e,managerChannelBinding:w,managerRuntime:S,conversationSessionId:Se[N]?.sessionId,model:lt,readOnly:h,selectedAgentId:L.agentId,selectedGoalId:D?.goalId??null,statusSourceControl:f})]})}function Dw({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,z.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,z.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,z.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,z.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,z.jsx)(Dy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,z.jsx)(th,{className:`h-4 w-4`}):(0,z.jsx)(Im,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,z.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,z.jsx)(`strong`,{children:`LoopX`}),(0,z.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,z.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,z.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,z.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,z.jsx)(Oy,{"data-testid":`initial-status-state`,children:(0,z.jsx)(ky,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,z.jsx)(um,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,z.jsx)(Um,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,z.jsxs)(Dy,{disabled:t,onClick:n,children:[(0,z.jsx)(Um,{className:`h-4 w-4`}),`重试`]})})]}):(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function Ow(){let e=TT.useSearch(),t=TT.useNavigate(),[n,r]=(0,R.useState)(`light`),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,R.useState)(Mp),[u,d]=(0,R.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,R.useState)(()=>SC(window.localStorage,window.location.href)),m=(0,R.useRef)(f);m.current=f;let[h,g]=(0,R.useState)(e.statusUrl),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)({error:null,phase:`idle`}),[C,w]=(0,R.useState)(e.statusUrl.trim()||null),[T,E]=(0,R.useState)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(b_(e.statusUrl.trim()||null)),k=!T&&u.kind===`example`?e.statusUrl.trim():``,A=C??k,ee=u.kind===`url`?u.label:MC,j=!!(_&&C),M=kC(f,C,ee,window.location.href),te=u.kind===`example`&&!T,ne=c.attention_queue,N=c.run_history,P=(0,R.useMemo)(()=>FC(N.goals,ne.items),[N.goals,ne.items]);function re(e,t,n=0){S({error:null,phase:`loading`}),NC(ph(e,`stopped`,window.location.href)).then(r=>{if(!w_(O.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>q_(e,r)),a&&n<1){F(e,{background:!0,resyncAttempt:n+1});return}S(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{w_(O.current,t)&&S({error:jp(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:h||MC,t=S_(O.current,e,{background:!0});if(i){F(e);return}t&&re(e,t)}async function ae(e,n,r){if(r.background)return l(e=>q_(e,n)),!0;let i={kind:`url`,label:e};return O.current.loadedUrl=e,l(n),d(i),g(e),await t({search:t=>({...t,statusUrl:e})}),C_(O.current,r)?(O.current.requestedUrl=null,w(null),!0):!1}async function F(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||v(`状态地址不能为空`);return}let c=S_(O.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(D.current=null,E(!1),w(n),b(!0),v(null),S({error:null,phase:`idle`}));try{let e=await Ip(n,window.location.href).catch(()=>null);if(!w_(O.current,c))return;if(e){let o=(t.retryOnly||t.reuseSnapshots)&&u.kind===`url`&&u.label===n?Pp(i,e,{invalidateGoalIds:t.invalidateGoalIds}):{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=Lp(e);if(r)l(m);else if(!await ae(n,m,c))return;if(S({error:null,phase:`loading`}),await zp(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>w_(O.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&w_(O.current,c)){await F(n,{resyncAttempt:1});return}w_(O.current,c)&&S({error:null,phase:`ready`});return}let o=await NC(ph(n,`active`,window.location.href));if(!w_(O.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){S({error:null,phase:`ready`});return}re(n,c,t.resyncAttempt??0)}catch(e){if(!C_(O.current,c))return;r||v(jp(e))}finally{!r&&C_(O.current,c)&&b(!1)}}function oe(e,t={}){o.current?.abort();let n=x_(O.current,e.statusUrl);D.current=null,E(!1),w(e.statusUrl),b(!0),v(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await gx(e.label,t)}catch{}}O.current.selectionRevision===n&&await F(e.statusUrl,{selectionRevision:n})})()}function I(e){m.current=e,p(e);try{CC(window.localStorage,e)}catch{}}let se={activeSource:M,connectionState:y?`loading`:j?`error`:`connected`,errorMessage:j?`未切换到 ${C??`所选来源`}:${_}`:null,onAdd:e=>{let t=TC(f,e,window.location.href);return`error`in t?{error:t.error}:(I(t.catalog),oe(t.source,{ensureTunnel:e.ensureTunnel}),{})},onConfiguredHostsLoaded:e=>{let t=m.current,n=wC(t,e);n!==t&&I(n)},onRemove:e=>{I(EC(f,e)),M.id===e&&oe(_C)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&oe(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:M.id===`temporary`?[...f.sources,M]:f.sources};(0,R.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(D.current===t||C&&C!==t)return;(u.kind!==`url`||u.label!==t)&&F(t);return}D.current=null,!T&&(C||u.kind===`example`&&F(MC))},[T,C,e.statusUrl,u.kind,u.label]),(0,R.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(P.map(e=>e.goal.id));if(P.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&x.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[x.phase,P,t,e.goalId,e.statusUrl,u.kind]),(0,R.useEffect)(()=>{if(!i||y||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&F(u.label,{retryOnly:!0})},[e.goalId,y,i,u]);function L(e){t({search:t=>({...t,goalId:e})})}return te?(0,z.jsx)(Dw,{error:_,isLoading:y,onRetry:()=>void F(A||MC),requestedUrl:A||MC,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,z.jsx)(Ew,{goalArchiveLoadState:x,isLoading:y,onGoalActivationStateChange:(e,t)=>{O.current.projectionRevision+=1,l(n=>Op(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Op(r,e,t)]))})},onGoalDeleted:e=>{O.current.projectionRevision+=1,l(t=>kp(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:L,onReconcileStatus:e=>F(u.kind===`url`?u.label:h||MC,{background:!0,invalidateGoalIds:e?.invalidateGoalIds,reuseSnapshots:!0}),onRetryGoalArchive:ie,onRefresh:()=>F(u.kind===`url`?u.label:h||MC,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:P,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var kw=Q_(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function Aw({className:e,variant:t,...n}){return(0,z.jsx)(`span`,{className:Ty(kw({variant:t}),e),...n})}var jw=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],Mw=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],Nw=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],Pw=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],Fw=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function Iw({children:e,icon:t,title:n}){return(0,z.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,z.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Lw(){return(0,z.jsx)(Iw,{icon:im,title:`Status Contract Explorer`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:jw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Aw,{variant:`info`,children:e.label}),(0,z.jsx)(Aw,{variant:`neutral`,children:`public contract`})]}),(0,z.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function Rw(){return(0,z.jsx)(Iw,{icon:wm,title:`Projection Diffing`,children:(0,z.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,z.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,z.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,z.jsx)(`tbody`,{children:Mw.map(e=>(0,z.jsxs)(`tr`,{className:`align-top`,children:[(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,z.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function zw(){return(0,z.jsx)(Iw,{icon:bm,title:`Fixture Generation`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:Nw.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function Bw(){return(0,z.jsx)(Iw,{icon:fm,title:`Smoke Checklist`,children:(0,z.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:Pw.map(e=>(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(tm,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,z.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function Vw(){return(0,z.jsx)(Iw,{icon:pm,title:`Component Examples`,children:(0,z.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:Fw.map(e=>(0,z.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,z.jsx)(Aw,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function Hw(){return(0,z.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,z.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,z.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,z.jsx)(nh,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,z.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/`,children:[(0,z.jsx)(Om,{className:`h-4 w-4`}),`LoopX home`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`,children:[(0,z.jsx)(vm,{className:`h-4 w-4`}),`Public cases`]}),(0,z.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/chat/developers/projections/`,children:[(0,z.jsx)(pm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,z.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Aw,{variant:`success`,children:`read-only`}),(0,z.jsx)(Aw,{variant:`neutral`,children:`public fixtures`})]}),(0,z.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,z.jsxs)(`section`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Aw,{variant:`info`,children:`developers/projections`}),(0,z.jsx)(Aw,{variant:`success`,children:`public-safe`}),(0,z.jsx)(Aw,{variant:`neutral`,children:`no browser writes`})]}),(0,z.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,z.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,z.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,z.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,z.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,z.jsx)(Lw,{}),(0,z.jsx)(Rw,{})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,z.jsx)(zw,{}),(0,z.jsx)(Bw,{})]}),(0,z.jsx)(Vw,{}),(0,z.jsx)(Iw,{icon:Zm,title:`Extension Boundary`,children:(0,z.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,z.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var Uw=J({value:G().finite(),total:G().finite().positive().optional(),unit:W().optional(),higher_is_better:K()}).passthrough(),Ww=yd(W(),G().finite()).default({}),Gw=J({outcome_status:W().optional(),failure_class:W(),causal_summary:W(),expectedness:W(),implication:W(),next_probe:W(),confidence:W(),evidence_refs:q(W()).optional()}).passthrough(),Kw=J({arm_id:W(),selected_run_id:W().nullable(),score_countable:K(),metrics:yd(W(),Uw),effort:Ww,insight:Gw.nullable().optional()}),qw=J({run_id:W(),case_id:W(),arm_id:W(),arm_role:W(),status:W(),protocol_id:W(),runner_revision:W().optional(),observed_at:W(),metrics:yd(W(),Uw),countability:J({integrity_qualified:K(),official_result_present:K(),score_countable:K()}).passthrough(),treatment_fidelity:W(),effort:Ww,redacted_insight:Gw.nullable().optional(),upload_provenance:J({producer_id:W(),producer_version:W(),observed_at:W(),source_revision:W()}).passthrough()}).passthrough(),Jw=J({case_denominator:G().int().nonnegative(),value_sum:G().finite(),value_mean:G().finite().nullable(),value_median:G().finite().nullable(),value_min:G().finite().nullable(),value_max:G().finite().nullable(),case_macro_rate:G().finite().optional(),suite_micro_rate:G().finite().optional(),suite_micro_numerator:G().finite().optional(),suite_micro_denominator:G().finite().positive().optional()}).passthrough(),Yw=J({arm_id:W(),arm_role:W(),factor_assignments:yd(W(),W()),protocol_counts:yd(W(),G().int().nonnegative()).default({}),runner_revision_counts:yd(W(),G().int().nonnegative()).default({}),orchestrator_runtime_counts:yd(W(),G().int().nonnegative()).default({}),intended_case_count:G().int().positive(),run_count:G().int().nonnegative(),terminal_run_count:G().int().nonnegative(),selected_score_countable_case_count:G().int().nonnegative(),coverage_rate:G().finite().min(0).max(1),metrics:yd(W(),Jw),binary_outcomes:yd(W(),J({success_count:G().int().nonnegative(),case_denominator:G().int().nonnegative(),success_rate:G().finite().min(0).max(1).nullable()})),effort:yd(W(),J({denominator:G().int().nonnegative(),mean:G().finite().nullable(),median:G().finite().nullable()})),failure_class_counts:yd(W(),G().int().nonnegative())}).passthrough(),Xw=J({baseline_value:G().finite(),candidate_value:G().finite(),delta:G().finite(),direction:Y([`improved`,`flat`,`regressed`]).optional()}).passthrough(),Zw=J({comparison_id:W(),comparison_anchor_run_id:W(),candidate_run_id:W(),candidate_arm_id:W(),primary_metric:W(),matched_pair_countable:X(!0),metric_deltas:yd(W(),Xw)}).passthrough(),Qw=J({ok:X(!0),schema_version:X(`benchmark_study_dashboard_v0`),benchmark_id:W(),study_id:W(),status:Y([`complete`,`provisional`]),design:J({protocol_id:W(),comparison_protocol_id:W(),baseline_arm_id:W(),case_set:J({case_set_id:W(),case_ids:q(W())}),metric_catalog:q(J({metric_name:W(),role:Y([`primary`,`guardrail`,`supporting`]),unit:W().optional(),higher_is_better:K(),binary:K()})),labels:yd(W(),W())}).passthrough(),campaign:J({intended_case_count:G().int().positive(),intended_arm_count:G().int().positive(),intended_cell_denominator:G().int().positive(),selected_score_countable_cell_count:G().int().nonnegative(),selected_score_countable_coverage_rate:G().finite().min(0).max(1),complete_declared_design_case_count:G().int().nonnegative(),ambiguous_score_countable_cell_count:G().int().nonnegative(),in_flight_run_count:G().int().nonnegative(),matched_pair_countable_count:G().int().nonnegative(),factorial_contrast_count:G().int().nonnegative(),factorial_contrast_countable_count:G().int().nonnegative(),runtime_observation_count:G().int().nonnegative(),runtime_classification_counts:yd(W(),G().int().nonnegative())}),arms:q(Yw),contrasts:yd(W(),J({matched_pair_denominator:G().int().nonnegative(),primary_metric_directions:J({improved:G().int().nonnegative(),flat:G().int().nonnegative(),regressed:G().int().nonnegative()}),binary_metric_transitions:yd(W(),J({"0_to_1":G().int().nonnegative(),"1_to_0":G().int().nonnegative(),same:G().int().nonnegative()}))})),cases:q(J({case_id:W(),complete_declared_design:K(),arms:q(Kw),eligible_comparisons:q(Zw),largest_eligible_primary_contrast:Zw.nullable()})),runs:q(qw),authority:J({score_source:W(),matched_comparison_source:W(),factorial_comparison_source:W().nullable(),manifest_changes_scores:X(!1),dashboard_is_execution_authority:X(!1)}),public_boundary:J({raw_task_recorded:X(!1),raw_trajectory_recorded:X(!1),hidden_evaluation_recorded:X(!1),raw_verifier_output_recorded:X(!1),credentials_recorded:X(!1),local_paths_recorded:X(!1)}),write_performed:X(!1),network_access_performed:X(!1)});function $w(e){return Qw.parse(e)}function eT(e,t){let n=new URL(t),r=new URL(e||`/benchmark-study.example.json`,n);if(!new Set([`http:`,`https:`]).has(r.protocol))throw Error(`Benchmark dashboard source must use HTTP or HTTPS`);if(r.origin!==n.origin)throw Error(`Benchmark dashboard source must use same-origin local readback`);return r.toString()}var tT=[{id:`campaign`,label:`Campaign`},{id:`arms`,label:`Arms`},{id:`cases`,label:`Cases`},{id:`runs`,label:`Runs`}];function nT(e){return e==null?`—`:`${(e*100).toFixed(e>=.995?0:1)}%`}function rT(e){return e==null?`—`:new Intl.NumberFormat(`en`,{maximumFractionDigits:2,notation:`compact`}).format(e)}function iT(e){if(e==null)return`—`;let t=e/6e4;return t>=120?`${(t/60).toFixed(1)} h`:`${rT(t)} min`}function aT(e){let t=Object.entries(e);return t.length?t.map(([e,t])=>`${e} (${t})`).join(`, `):`—`}function oT(e){if(!e)return`—`;let t=e.total==null?rT(e.value):`${rT(e.value)}/${rT(e.total)}`;return e.unit?`${t} ${e.unit}`:t}function sT(e,t){let n=e.metrics[t];return!n||n.case_denominator===0?`—`:n.suite_micro_rate==null?`${rT(n.value_mean)} mean`:`${nT(n.suite_micro_rate)} · ${rT(n.suite_micro_numerator)}/${rT(n.suite_micro_denominator)}`}function cT(e,t){let n=e.largest_eligible_primary_contrast,r=n?.metric_deltas[t];if(!n||!r)return null;let i=r.delta>0?`+`:``;return{direction:r.direction,text:`${n.candidate_arm_id}: ${i}${rT(r.delta)}`}}function lT({children:e,tone:t=`neutral`}){return(0,z.jsx)(`span`,{className:`benchmark-state benchmark-state-${t}`,children:e})}function uT({packet:e,primaryMetric:t}){return(0,z.jsxs)(`div`,{className:`benchmark-view-stack`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`arm-summary-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`ARM SUMMARY`}),(0,z.jsx)(`h2`,{id:`arm-summary-title`,children:`Comparable outcomes, denominator first`})]}),(0,z.jsx)(`p`,{children:`Only one score-countable run per declared case × arm cell is selected.`})]}),(0,z.jsx)(`div`,{className:`benchmark-arm-grid`,children:e.arms.map(e=>{let n=Object.values(e.binary_outcomes)[0];return(0,z.jsxs)(`article`,{className:`benchmark-arm-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:e.arm_role}),(0,z.jsx)(`h3`,{children:e.arm_id})]}),(0,z.jsx)(lT,{tone:e.coverage_rate===1?`success`:`warning`,children:e.coverage_rate===1?`Complete`:`Provisional`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[`Primary · `,t]}),(0,z.jsx)(`dd`,{children:sT(e,t)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Score-countable coverage`}),(0,z.jsxs)(`dd`,{children:[e.selected_score_countable_case_count,`/`,e.intended_case_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Binary success`}),(0,z.jsx)(`dd`,{children:n?`${n.success_count}/${n.case_denominator}`:`Not declared`})]})]})]},e.arm_id)})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`contrast-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`MATCHED CONTRASTS`}),(0,z.jsx)(`h2`,{id:`contrast-title`,children:`Direction counts on eligible pairs`})]}),(0,z.jsx)(`p`,{children:`Raw run volume is never used as a comparison denominator.`})]}),(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Candidate arm`}),(0,z.jsx)(`th`,{children:`Matched denominator`}),(0,z.jsx)(`th`,{children:`Improved`}),(0,z.jsx)(`th`,{children:`Flat`}),(0,z.jsx)(`th`,{children:`Regressed`}),(0,z.jsx)(`th`,{children:`Binary transitions`})]})}),(0,z.jsxs)(`tbody`,{children:[Object.entries(e.contrasts).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:e})}),(0,z.jsx)(`td`,{children:t.matched_pair_denominator}),(0,z.jsx)(`td`,{className:`benchmark-positive`,children:t.primary_metric_directions.improved}),(0,z.jsx)(`td`,{children:t.primary_metric_directions.flat}),(0,z.jsx)(`td`,{className:`benchmark-negative`,children:t.primary_metric_directions.regressed}),(0,z.jsx)(`td`,{children:Object.entries(t.binary_metric_transitions).map(([e,t])=>`${e}: 0→1 ${t[`0_to_1`]}, 1→0 ${t[`1_to_0`]}, same ${t.same}`).join(` · `)||`—`})]},e)),Object.keys(e.contrasts).length===0&&(0,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:6,children:`No matched comparisons are countable yet.`})})]})]})})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`runtime-health-title`,children:[(0,z.jsxs)(`div`,{className:`benchmark-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`benchmark-kicker`,children:`RUNTIME HEALTH`}),(0,z.jsx)(`h2`,{id:`runtime-health-title`,children:`Qualified observations, without execution authority`})]}),(0,z.jsxs)(`p`,{children:[e.campaign.runtime_observation_count,` public-safe runtime observations.`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-runtime-list`,children:[Object.entries(e.campaign.runtime_classification_counts).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`strong`,{children:t})]},e)),e.campaign.runtime_observation_count===0&&(0,z.jsx)(`p`,{className:`benchmark-muted`,children:`No runtime observations uploaded.`})]})]})]})}function dT({packet:e}){return(0,z.jsx)(`div`,{className:`benchmark-detail-grid`,children:e.arms.map(t=>(0,z.jsxs)(`article`,{className:`benchmark-detail-card`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:t.arm_role}),(0,z.jsx)(`h2`,{children:t.arm_id})]}),(0,z.jsxs)(lT,{tone:t.coverage_rate===1?`success`:`warning`,children:[t.selected_score_countable_case_count,`/`,t.intended_case_count,` countable`]})]}),(0,z.jsx)(`div`,{className:`benchmark-factor-row`,children:Object.entries(t.factor_assignments).map(([e,t])=>(0,z.jsxs)(`span`,{children:[e,`: `,(0,z.jsx)(`strong`,{children:t})]},e))}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list`,children:[e.design.metric_catalog.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`dt`,{children:[e.role,` · `,e.metric_name]}),(0,z.jsx)(`dd`,{children:sT(t,e.metric_name)})]},e.metric_name)),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runs terminal / observed`}),(0,z.jsxs)(`dd`,{children:[t.terminal_run_count,`/`,t.run_count]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Median duration`}),(0,z.jsx)(`dd`,{children:iT(t.effort.duration_ms?.median)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocols`}),(0,z.jsx)(`dd`,{children:aT(t.protocol_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revisions`}),(0,z.jsx)(`dd`,{children:aT(t.runner_revision_counts)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Orchestrator runtimes`}),(0,z.jsxs)(`dd`,{children:[Object.keys(t.orchestrator_runtime_counts).length||0,` distinct`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Failure classes`}),(0,z.jsx)(`dd`,{children:aT(t.failure_class_counts)})]})]})]},t.arm_id))})}function fT({packet:e,primaryMetric:t,onOpenRun:n}){return(0,z.jsx)(`div`,{className:`benchmark-table-shell benchmark-wide-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Design status`}),(0,z.jsx)(`th`,{children:`Largest eligible delta`}),e.arms.map(e=>(0,z.jsx)(`th`,{children:e.arm_id},e.arm_id))]})}),(0,z.jsx)(`tbody`,{children:e.cases.map(r=>{let i=cT(r,t);return(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`strong`,{children:r.case_id})}),(0,z.jsx)(`td`,{children:(0,z.jsx)(lT,{tone:r.complete_declared_design?`success`:`warning`,children:r.complete_declared_design?`Complete`:`Provisional`})}),(0,z.jsx)(`td`,{className:i?.direction===`improved`?`benchmark-positive`:i?.direction===`regressed`?`benchmark-negative`:void 0,children:i?.text??`—`}),r.arms.map(r=>(0,z.jsx)(`td`,{children:r.selected_run_id&&r.score_countable?(0,z.jsxs)(`button`,{className:`benchmark-cell-link`,onClick:()=>n(r.selected_run_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[t,`: `,oT(r.metrics[t])]}),e.design.metric_catalog.filter(e=>e.metric_name!==t).map(e=>(0,z.jsxs)(`small`,{className:`benchmark-cell-metric`,children:[e.metric_name,`: `,oT(r.metrics[e.metric_name])]},e.metric_name)),(0,z.jsxs)(`small`,{children:[`Countable · `,iT(r.effort.duration_ms),` `,(0,z.jsx)(Qp,{"aria-hidden":`true`,size:12})]}),r.insight&&(0,z.jsxs)(`small`,{children:[r.insight.failure_class,` · `,r.insight.confidence]})]}):(0,z.jsx)(`span`,{className:`benchmark-muted`,children:`Not countable`})},r.arm_id))]},r.case_id)})})]})})}function pT({run:e,packet:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Run detail for ${e.run_id}`,className:`benchmark-run-detail`,children:[(0,z.jsxs)(`div`,{className:`benchmark-card-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`benchmark-mono`,children:`RUN DETAIL`}),(0,z.jsx)(`h2`,{children:e.run_id})]}),(0,z.jsx)(lT,{tone:e.countability.score_countable?`success`:`warning`,children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-stat-list benchmark-run-facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case / arm`}),(0,z.jsxs)(`dd`,{children:[e.case_id,` · `,e.arm_id]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Lifecycle`}),(0,z.jsxs)(`dd`,{children:[e.status,` · `,e.observed_at]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:e.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Qualification`}),(0,z.jsxs)(`dd`,{children:[`Integrity `,e.countability.integrity_qualified?`qualified`:`not qualified`,` · result `,e.countability.official_result_present?`present`:`missing`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Treatment fidelity`}),(0,z.jsx)(`dd`,{children:e.treatment_fidelity})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Effort`}),(0,z.jsxs)(`dd`,{children:[iT(e.effort.duration_ms),` · `,rT(e.effort.agent_steps),` steps · `,rT(e.effort.token_count),` tokens`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Runner revision`}),(0,z.jsx)(`dd`,{children:e.runner_revision??`—`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Upload provenance`}),(0,z.jsxs)(`dd`,{children:[e.upload_provenance.producer_id,` · `,e.upload_provenance.source_revision]})]})]}),(0,z.jsx)(`div`,{className:`benchmark-run-metrics`,children:t.design.metric_catalog.map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:t.metric_name}),(0,z.jsx)(`strong`,{children:oT(e.metrics[t.metric_name])})]},t.metric_name))}),e.redacted_insight&&(0,z.jsxs)(`div`,{className:`benchmark-insight`,children:[(0,z.jsxs)(`span`,{className:`benchmark-mono`,children:[`REDACTED CASE INSIGHT · `,e.redacted_insight.confidence]}),(0,z.jsx)(`p`,{children:e.redacted_insight.causal_summary}),(0,z.jsxs)(`small`,{children:[`Implication: `,e.redacted_insight.implication]}),(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Next probe: `,e.redacted_insight.next_probe]}),!!e.redacted_insight.evidence_refs?.length&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[`Evidence: `,e.redacted_insight.evidence_refs.join(`, `)]})]})]})]})}function mT({packet:e,selectedRunId:t,onSelectRun:n}){let r=e.runs.find(e=>e.run_id===t)??e.runs[0];return(0,z.jsxs)(`div`,{className:`benchmark-runs-layout`,children:[(0,z.jsx)(`div`,{className:`benchmark-table-shell`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Run`}),(0,z.jsx)(`th`,{children:`Case`}),(0,z.jsx)(`th`,{children:`Arm`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Countability`})]})}),(0,z.jsx)(`tbody`,{children:e.runs.map(e=>(0,z.jsxs)(`tr`,{"aria-selected":e.run_id===r?.run_id,children:[(0,z.jsx)(`td`,{children:(0,z.jsx)(`button`,{className:`benchmark-run-link`,onClick:()=>n(e.run_id),type:`button`,children:e.run_id})}),(0,z.jsx)(`td`,{children:e.case_id}),(0,z.jsx)(`td`,{children:e.arm_id}),(0,z.jsx)(`td`,{children:e.status}),(0,z.jsx)(`td`,{children:e.countability.score_countable?`Score-countable`:`Diagnostic only`})]},e.run_id))})]})}),r&&(0,z.jsx)(pT,{packet:e,run:r})]})}function hT(){let e=AT.useSearch(),t=AT.useNavigate(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(0),c=(0,R.useMemo)(()=>{let t=e.dashboardUrl||`/chat/benchmark-study.example.json`;try{return{url:eT(t,window.location.href),error:null}}catch(e){return{url:``,error:e instanceof Error?e.message:`Invalid dashboard source`}}},[e.dashboardUrl]);if((0,R.useEffect)(()=>{let e=!0;return r(null),a(null),c.error?(a(c.error),()=>{e=!1}):(fetch(c.url,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} while loading the dashboard packet`);return $w(await e.json())}).then(t=>{e&&r(t)}).catch(t=>{e&&a(t instanceof Error?t.message:`Unable to load dashboard packet`)}),()=>{e=!1})},[o,c]),(0,R.useEffect)(()=>{n&&(document.title=`${n.design.labels.title??n.study_id} · LoopX Benchmark`)},[n]),i)return(0,z.jsxs)(`main`,{className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(um,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Dashboard packet unavailable`}),(0,z.jsx)(`p`,{children:i}),(0,z.jsxs)(`button`,{onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Um,{"aria-hidden":`true`,size:16}),` Retry readback`]})]});if(!n)return(0,z.jsxs)(`main`,{"aria-busy":`true`,className:`benchmark-page benchmark-loading`,children:[(0,z.jsx)(Yp,{"aria-hidden":`true`}),(0,z.jsx)(`h1`,{children:`Reading benchmark study`}),(0,z.jsx)(`p`,{children:`Validating the public-safe dashboard packet…`})]});let l=n.design.metric_catalog.find(e=>e.role===`primary`)?.metric_name??`primary`,u=(n,r=e.runId)=>t({search:e=>({...e,view:n,runId:r})}),d=new URL(c.url).pathname;return(0,z.jsxs)(`main`,{className:`benchmark-page`,children:[(0,z.jsxs)(`header`,{className:`benchmark-hero`,children:[(0,z.jsxs)(`div`,{className:`benchmark-hero-topline`,children:[(0,z.jsx)(`a`,{className:`benchmark-wordmark`,href:`/chat/`,children:`LoopX`}),(0,z.jsxs)(`div`,{className:`benchmark-readonly`,children:[(0,z.jsx)(Zm,{"aria-hidden":`true`,size:15}),` Derived read-only projection`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-hero-grid`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`benchmark-kicker`,children:[`BENCHMARK STUDY / `,n.benchmark_id]}),(0,z.jsxs)(`div`,{className:`benchmark-title-row`,children:[(0,z.jsx)(`h1`,{children:n.design.labels.title??n.study_id}),(0,z.jsx)(lT,{tone:n.status===`complete`?`success`:`warning`,children:n.status})]}),(0,z.jsx)(`p`,{className:`benchmark-lead`,children:`One declared study, explicit denominators, and the same countability rules from campaign summary to exact run.`})]}),(0,z.jsxs)(`dl`,{className:`benchmark-identity`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Study`}),(0,z.jsx)(`dd`,{children:n.study_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Protocol`}),(0,z.jsx)(`dd`,{children:n.design.protocol_id})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Case set`}),(0,z.jsx)(`dd`,{children:n.design.case_set.case_set_id})]})]})]}),(0,z.jsxs)(`div`,{className:`benchmark-kpi-grid`,children:[(0,z.jsxs)(`article`,{children:[(0,z.jsx)(hm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Score-countable cells`}),(0,z.jsxs)(`strong`,{children:[n.campaign.selected_score_countable_cell_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_cell_denominator]})]}),(0,z.jsxs)(`p`,{children:[nT(n.campaign.selected_score_countable_coverage_rate),` declared coverage`]})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(dm,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Complete designs`}),(0,z.jsxs)(`strong`,{children:[n.campaign.complete_declared_design_case_count,(0,z.jsxs)(`small`,{children:[` / `,n.campaign.intended_case_count]})]}),(0,z.jsx)(`p`,{children:`Cases with every declared arm`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(Qp,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`Matched comparisons`}),(0,z.jsx)(`strong`,{children:n.campaign.matched_pair_countable_count}),(0,z.jsx)(`p`,{children:`Eligible pairs only`})]}),(0,z.jsxs)(`article`,{children:[(0,z.jsx)(Yp,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:`In flight`}),(0,z.jsx)(`strong`,{children:n.campaign.in_flight_run_count}),(0,z.jsx)(`p`,{children:n.status===`provisional`?`Coverage remains provisional`:`Declared coverage complete`})]})]})]}),(0,z.jsxs)(`nav`,{"aria-label":`Benchmark dashboard views`,className:`benchmark-tabs`,children:[tT.map(t=>(0,z.jsx)(`button`,{"aria-current":e.view===t.id?`page`:void 0,onClick:()=>u(t.id),type:`button`,children:t.label},t.id)),(0,z.jsxs)(`button`,{className:`benchmark-refresh`,onClick:()=>s(e=>e+1),type:`button`,children:[(0,z.jsx)(Um,{"aria-hidden":`true`,size:14}),` Refresh local readback`]})]}),(0,z.jsxs)(`div`,{className:`benchmark-content`,children:[e.view===`campaign`&&(0,z.jsx)(uT,{packet:n,primaryMetric:l}),e.view===`arms`&&(0,z.jsx)(dT,{packet:n}),e.view===`cases`&&(0,z.jsx)(fT,{onOpenRun:e=>u(`runs`,e),packet:n,primaryMetric:l}),e.view===`runs`&&(0,z.jsx)(mT,{onSelectRun:e=>u(`runs`,e),packet:n,selectedRunId:e.runId})]}),(0,z.jsxs)(`footer`,{className:`benchmark-footer`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Zm,{"aria-hidden":`true`,size:16}),(0,z.jsxs)(`span`,{children:[`Scores: `,n.authority.score_source]}),(0,z.jsx)(`span`,{children:`Dashboard cannot launch, grade, or mutate runs.`})]}),(0,z.jsxs)(`code`,{title:d,children:[`local`,d]})]})]})}var gT=J({goalId:W().optional().default(``),statusUrl:W().optional().default(``)}),_T=J({goalId:W().optional().default(``),mode:Y([`showcase`,`developer`,`ops`]).optional().default(`showcase`),statusUrl:W().optional().default(``),todoLane:Y([`all`,`user`,`agent`]).optional().default(`all`),todoQuery:W().optional().default(``)}),vT=_T.omit({mode:!0}),yT=J({dashboardUrl:W().optional().default(``),view:Y([`campaign`,`arms`,`cases`,`runs`]).optional().default(`campaign`),runId:W().optional().default(``)});function bT(){let e=`https://loopx-project.github.io/loopx/docs/showcases/index.en.html`;return(0,R.useEffect)(()=>{window.location.replace(e)},[]),(0,z.jsx)(`a`,{href:e,children:`Open LoopX cases / 浏览案例`})}function xT({goalId:e,statusUrl:t}){let n=t?dh(t,window.location.href):null;return n?.error?(0,z.jsx)(`main`,{role:`alert`,children:n.error}):(0,z.jsx)(ii,{replace:!0,to:`/`,search:{goalId:e,statusUrl:t}})}function ST(){let e=ET.useSearch();return e.mode===`ops`?(0,z.jsx)(xT,{...e}):e.mode===`developer`?(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`}):(0,z.jsx)(bT,{})}function CT(){return(0,z.jsx)(xT,{...DT.useSearch()})}var wT=Ci({component:()=>(0,z.jsx)(Mi,{}),errorComponent:()=>(0,z.jsxs)(`main`,{role:`alert`,className:`p-8`,children:[(0,z.jsx)(`h1`,{children:`页面暂时无法显示 / Page unavailable`}),(0,z.jsx)(`p`,{children:`请重新加载页面;这不会执行任务。 / Reloading does not execute tasks.`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`重新加载 / Reload`})]})}),TT=xi({getParentRoute:()=>wT,path:`/`,validateSearch:e=>gT.parse(e),component:Ow}),ET=xi({getParentRoute:()=>wT,path:`/frontstage`,validateSearch:e=>_T.parse(e),component:ST}),DT=xi({getParentRoute:()=>wT,path:`/deprecated/frontstage/ops`,validateSearch:e=>vT.parse(e),component:CT}),OT=xi({getParentRoute:()=>wT,path:`/frontstage/developer`,component:()=>(0,z.jsx)(ii,{replace:!0,to:`/developers/projections`})}),kT=xi({getParentRoute:()=>wT,path:`/developers/projections`,component:Hw}),AT=xi({getParentRoute:()=>wT,path:`/benchmarks/study`,validateSearch:e=>yT.parse(e),component:hT}),jT=wT.addChildren([TT,ET,DT,OT,kT,AT]);function MT(e){return!e||e===`/`||e===`./`?`/`:(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``)||`/`}var NT=Li({routeTree:jT,basepath:MT(`/chat/`),trailingSlash:`preserve`}),PT=document.getElementById(`root`);if(!PT)throw Error(`Root element not found`);var FT=new je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}});(0,Vi.createRoot)(PT).render((0,z.jsx)(Fe,{client:FT,children:(0,z.jsx)(qi,{children:(0,z.jsx)(Bi,{router:NT})})}));
\ No newline at end of file
diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html
index 82d5efe7a..3e1135970 100644
--- a/loopx/web/chat/index.html
+++ b/loopx/web/chat/index.html
@@ -18,8 +18,8 @@
content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。"
/>
LoopX 个人 Agent 工作区
-
-
+
+
From b242531a9228a529dbdc1ec152900ef5f656a179 Mon Sep 17 00:00:00 2001
From: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Date: Mon, 21 Sep 2026 02:27:14 +0800
Subject: [PATCH 2/3] docs: explain artifact comparison and refresh
team-workspace checkpoint
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
---
.../rfcs/live-team-workspace-v0.md | 21 ++++++++++--------
.../rfcs/live-team-workspace-v0.zh-CN.md | 14 +++++++-----
.../rfcs/loopx-overall-roadmap-v0.md | 17 +++++++-------
.../rfcs/loopx-overall-roadmap-v0.zh-CN.md | 12 +++++-----
.../team-comparison-desktop.png | Bin 0 -> 113235 bytes
.../team-comparison-mobile.png | Bin 0 -> 48715 bytes
.../team-comparison-unavailable.png | Bin 0 -> 109698 bytes
docs/reference/local-delegation.md | 20 +++++++++++++++++
8 files changed, 55 insertions(+), 29 deletions(-)
create mode 100644 docs/assets/personal-workspace/team-comparison-desktop.png
create mode 100644 docs/assets/personal-workspace/team-comparison-mobile.png
create mode 100644 docs/assets/personal-workspace/team-comparison-unavailable.png
diff --git a/docs/architecture/rfcs/live-team-workspace-v0.md b/docs/architecture/rfcs/live-team-workspace-v0.md
index ea485dffd..530900289 100644
--- a/docs/architecture/rfcs/live-team-workspace-v0.md
+++ b/docs/architecture/rfcs/live-team-workspace-v0.md
@@ -309,16 +309,19 @@ Pausing the coordinator does not stop dispatched workers: name those workers and
the remaining execution scope. If worker cancellation is unsupported, state it
explicitly; a whole-team stop claim requires worker-owner termination readback.
-Implementation checkpoint (2026-09-20): [#4762](https://github.com/loopx-project/loopx/pull/4762)
-is open and proposes version-bound response/revision/use inputs, explicit
-requester adoption into an accepted downstream artifact, evidence navigation,
-contextual feedback and scoped coordinator pause. File/SQLite, CLI/MCP and
-packaged-browser checks cover that local slice; the real GPT attempt stopped at
-MCP tool approval before an accepted artifact. This is neither shipped acceptance
-nor L1 qualification. Review and reuse that producer rather than rebuilding it.
+Implementation checkpoint (2026-09-21): [#4762](https://github.com/loopx-project/loopx/pull/4762)
+and [#4811](https://github.com/loopx-project/loopx/pull/4811) are merged. The latter
+records native Codex MCP execution and a real-model correction/acceptance/adoption
+qualification. This retires the earlier host-approval blocker; it does not prove
+the released first-use journey, two continuing cycles or observer comprehension.
+Reuse the existing version-bound readback, feedback and scoped pause owners.
+The next presentation slice compares an explicitly selected dependency with the
+accepted output, requiring the referenced artifact and hash to match. A newer,
+missing or unverified source must not silently replace the requested version.
+Text differences do not establish semantic correctness or requester adoption.
+Keep readable output and comparison prominent; retain raw identifiers in details.
`consume_return` alone still means consumption, not version-bound adoption.
-Qualify the substantive independent objection, correction and useful synthesis
-through the selected real-model episode before claiming L1. Motion is retained
+Motion is retained
only when it clarifies these transitions;
remove effects that obscure absent execution, absent acceptance or source loss.
Broader semantic zoom, extra actors and renderer experiments follow this exit.
diff --git a/docs/architecture/rfcs/live-team-workspace-v0.zh-CN.md b/docs/architecture/rfcs/live-team-workspace-v0.zh-CN.md
index 57f30ebf9..7d28c2331 100644
--- a/docs/architecture/rfcs/live-team-workspace-v0.zh-CN.md
+++ b/docs/architecture/rfcs/live-team-workspace-v0.zh-CN.md
@@ -252,12 +252,14 @@ session、提高历史 receipt 的语义强度或重置 provider。默认概览
什么。暂停协调员不会停止已派发成员:须显示这些成员及仍在执行的范围。成员
不支持取消时明确说明;宣称整队停止需要成员执行 owner 的终止回读。
-实施检查点(2026-09-20):[#4762](https://github.com/loopx-project/loopx/pull/4762)
-仍开放,提出版本绑定的响应/修订/使用输入、请求方对已验收下游产物的显式采用、
-证据导航、上下文反馈和范围限定的协调者暂停。File/SQLite、CLI/MCP 与打包浏览器
-检查覆盖本地切片;真实 GPT 尝试在产物被验收前被 MCP 工具审批拦截。这不代表
-已发布验收或 L1 资格。review 并复用该 producer,避免重做;`consume_return` 单独
-仍只代表消费。宣称 L1 前须以真实模型过程验收实质的独立异议、纠偏与有用综合。
+实施检查点(2026-09-21):[#4762](https://github.com/loopx-project/loopx/pull/4762)
+和 [#4811](https://github.com/loopx-project/loopx/pull/4811) 已合并。后者记录了原生
+Codex MCP 执行与真实模型纠偏/验收/采用资格,原工具审批阻塞已经解除;这仍不能
+证明发布包首次使用、连续两轮协作或观察者理解度。复用现有版本回读、反馈与范围
+限定暂停的 owner。下一展示切片让用户选择一份依赖,与已验收产物并排阅读;指定
+文件和哈希必须匹配,更新、缺失或无法核验的来源不能替代当时引用的版本。文本
+差异不代表结论正确或请求方已采用。突出可读产物和对照,原始标识收进详情。
+`consume_return` 单独仍只代表消费,不能替代版本绑定的采用。
动态只有让上述变化更清楚才保留;掩盖未执行、未验收
或来源失联的效果应移除。更广的语义缩放、成员扩张和 renderer 探索在此后推进。
diff --git a/docs/architecture/rfcs/loopx-overall-roadmap-v0.md b/docs/architecture/rfcs/loopx-overall-roadmap-v0.md
index 023aff177..c67ed06f3 100644
--- a/docs/architecture/rfcs/loopx-overall-roadmap-v0.md
+++ b/docs/architecture/rfcs/loopx-overall-roadmap-v0.md
@@ -161,7 +161,7 @@ support. A missing dependency moves the date, not the acceptance bar.
| Stage / cumulative target | Complete work and existing owner | Exit / permitted claim |
| --- | --- | --- |
| Narrative and storyboard · 2–3 working days | S1/S5/S13: one audience, one task, first-screen design, 60–90s script, bilingual copy and public evidence plan | Reviewable polished draft; label concepts and replays. No runnable-product claim |
-| Recorded product preview · 5–7 working days | R2/R3 + S5: review/integrate #4762, resolve supported host-tool authorization, run one real L1 correction; refine the actual result and evidence view | Packaged frontend plus CLI show exact-version objection/revision/acceptance/adoption, intervention and scoped stop. Record an actual run; no synthetic activity presented as live |
+| Recorded product preview · 5–7 working days | R2/R3 + S5: reuse merged collaboration and host-tool authorization, run one reproducible L1 correction; refine the actual result and evidence view | Packaged frontend plus CLI show exact-version objection/revision/acceptance/adoption, intervention and scoped stop. Record an actual run; no synthetic activity presented as live |
| Focused public alpha · 2–3 weeks | S1/S4/S12: release-package onboarding, intent-respecting steward/Chat selection, readiness repair, single-Agent fallback, restart/reconnect and useful result return; S5 supplies focused team view | Freeze five independent clean-install attempts before testing; at least four reach the first useful result without maintainer shell intervention, all failures retained. G1's two real cycles must pass before advertising continued team collaboration |
| Repeatable beta / full launch kit · 4–6 weeks | S4/S5/S10/S12/S13: upgrade/rollback, revoke/unavailable/quota recovery, pilot-driven UX, measured cost and support; qualify optional Lark separately | At least three independent users repeat a task on another day; publish denominator, interruptions and limitations. Each advertised platform/transport has its own release-artifact evidence |
@@ -173,13 +173,14 @@ onboarding time (including prerequisites/login) and the post-readiness interval;
authentication or environment failures stay in the funnel. A small pilot is
feedback, not statistical reliability or product-market fit.
-The critical path is host/tool readiness → real L1 episode → packaged first-use
-repair → independent reproduction. #4758 is merged design; #4762 is open at this
-revision and does not establish a shipped or real-model-qualified journey.
-Its GPT trial ended at MCP approval with no accepted artifact. Resolve the
-supported authorization path with its owner; never turn off approval globally
-to obtain a recording. Existing implementation successors remain authoritative;
-inspect canonical Todos and related PRs before assigning a new slice.
+The critical path is usable evidence presentation → a reproducible real episode →
+packaged first-use repair → independent reproduction. As of 2026-09-21, #4762 and
+#4811 are merged; #4811 records native Codex MCP execution and a real-model
+correction lifecycle. The earlier MCP approval block is resolved. This evidence
+does not establish a released first-use journey, two continuing cycles or a
+polished launch film. Reuse those owners and canonical Todos; qualify the actual
+release package and record the episode through its frontend before publishing.
+Never disable approvals globally to obtain a recording.
The first launch does not wait for hundred-Agent scale, a new state provider,
full 3D, all hosts, mobile-native shells, a connector marketplace, payment/booking
diff --git a/docs/architecture/rfcs/loopx-overall-roadmap-v0.zh-CN.md b/docs/architecture/rfcs/loopx-overall-roadmap-v0.zh-CN.md
index 6c4653337..f58218b3d 100644
--- a/docs/architecture/rfcs/loopx-overall-roadmap-v0.zh-CN.md
+++ b/docs/architecture/rfcs/loopx-overall-roadmap-v0.zh-CN.md
@@ -144,7 +144,7 @@ Muse 设计页在浏览器超时,其文章通过网页检索读取。本次调
| 阶段 / 累计目标 | 完整工作与既有 owner | 出口 / 可以宣称什么 |
| --- | --- | --- |
| 定位与分镜 · 2–3 个工作日 | S1/S5/S13:一个人群、一个任务、首屏设计、60–90 秒脚本、双语文案、公开证据计划 | 可审阅的精美草稿;概念与回放明确标注,不宣称产品已可用 |
-| 产品实录预览 · 5–7 个工作日 | R2/R3 + S5:review/集成 #4762,解决受支持宿主工具授权,跑通一次真实 L1 纠偏,打磨真实结果与证据视图 | 打包前端 + CLI 展示精确版本的异议/修订/验收/采用、干预和范围准确的停止;实录运行,不把合成活动当 live |
+| 产品实录预览 · 5–7 个工作日 | R2/R3 + S5:复用已合并协作与宿主工具授权,复现一次真实 L1 纠偏,打磨真实结果与证据视图 | 打包前端 + CLI 展示精确版本的异议/修订/验收/采用、干预和范围准确的停止;实录运行,不把合成活动当 live |
| 聚焦公开 alpha · 2–3 周 | S1/S4/S12:发行包引导、遵守用户意图的管家/Chat 选路、就绪修复、单 Agent 降级、重启/重连和有用结果返回;S5 提供聚焦团队视图 | 测试前冻结五次独立干净安装,至少四次无需维护者 shell 救场拿到首个有用成果,保留全部失败。宣传持续团队协作前必须通过 G1 两轮真实协作 |
| 可重复 beta / 完整发布包 · 4–6 周 | S4/S5/S10/S12/S13:升级/回滚、撤权/失联/额度恢复、试用反馈驱动 UX、实测成本与支持负担;可选 Lark 单独验收 | 至少三位独立用户隔天再次完成任务,公开样本分母、干预和限制;每个宣传平台/transport 都有发行包证据 |
@@ -153,11 +153,11 @@ Muse 设计页在浏览器超时,其文章通过网页检索读取。本次调
性能数据。同时记录包含环境准备/登录的完整引导耗时与就绪后耗时,认证或环境
失败仍计入漏斗。小规模试用用于发现问题,不能据此宣称统计可靠性或 PMF。
-关键路径是:宿主/工具就绪 → 一次真实 L1 → 打包首次使用修复 → 独立复现。
-本修订时 #4758 已合并但属于设计,#4762 仍开放,不能证明已发布或真实模型验收。
-其中 GPT 尝试被 MCP 审批拦截,没有被验收的产物;通过所属 owner 解决受支持授权
-路径,不能为了录屏全局关闭审批。既有实施 successor 保持权威;分配新工作前核对
-canonical Todos 和相关 PR。
+关键路径是:证据可读的产品表现 → 可复现真实过程 → 打包首次使用修复 → 独立复现。
+截至 2026-09-21,#4762 与 #4811 已合并;#4811 记录了原生 Codex MCP 执行和真实
+模型纠偏闭环,原 MCP 审批阻塞已解除。这仍不能证明发布包首次使用、连续两轮协作
+或精美宣传片已经完成。复用现有 owner 和 canonical Todo;发布前验收实际安装包,
+并通过它的前端录制真实过程;不能为了录屏全局关闭审批。
首次发布不等待百 Agent、新状态 provider、完整 3D、全宿主、原生移动壳、连接器
市场、支付/订票或示教自动化。这些保留既有 owner 与独立需求/验收,不挤占 R1
diff --git a/docs/assets/personal-workspace/team-comparison-desktop.png b/docs/assets/personal-workspace/team-comparison-desktop.png
new file mode 100644
index 0000000000000000000000000000000000000000..5490871580d4561c273556cf9392b06fce456ef7
GIT binary patch
literal 113235
zcmb6Bby$?|7d;9al=P6&-5{OP3=PtaAdN_gh=7E2D=8o)4T@4CodP1FIEadL>Y$R+
z<+}&{e9!s)@m}Yg`Ge~c#+m22?|tvR_F8K{ar#%(iSTLh&zw0!q^W^4JaYycedf&h
z&v@tHHxyWF0%y*Up3y`q8T;q{n!02C>GOiZ$p8+5v^y-G0M`?{v8nO1!R4xP(`R>Y
zOS^sg{MoYMndNSU8>zoqTA-(${X>BtYARQL1|@l3tz
z^`7rdTsNv%or85Sd|*IBR8%xB_VmSFjn+i|dl@qeH?gq(eepiNI7y25`=Zn*^!)qo
z*jRjS9LfLQk4+Il_wVg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