diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-loopx-mode.css b/apps/presentation/dashboard/src/features/personal-workspace/goal-loopx-mode.css index 05461ed1f7..039d7e2acf 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-loopx-mode.css +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-loopx-mode.css @@ -110,6 +110,7 @@ .goal-team-result-check { margin-left: auto; visibility: hidden; } .goal-team-result-list button[aria-pressed="true"] .goal-team-result-check { visibility: visible; } .goal-team-result-reader { min-width: 0; border-left: 1px solid var(--pw-line); padding-left: 24px; } +.goal-team-result-reader > details:first-child summary { font-size: 14px; font-weight: 500; } .goal-team-results .goal-team-report { padding: 24px 0; } .goal-team-result-reader > label { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; } .goal-team-result-reader select { max-width: 100%; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-team-results.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-team-results.tsx index f5b960c52f..07b0f8c9f2 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-team-results.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-team-results.tsx @@ -75,6 +75,18 @@ export function GoalTeamResults({sessionId, zh, refreshKey}: {sessionId: string; finally {if (current === generation.current) setBusy(false);} } const rows = page ? readableRows(page) : []; + const adoptions = selection?.result.adoptions ?? []; + const currentAdoptions = adoptions.filter(row => row.state === "current").length; + const unavailableAdoptions = adoptions.length - currentAdoptions; + const adoptionSummary = currentAdoptions && unavailableAdoptions + ? (zh ? "部分采用可核验 · 查看后续结果与失效项" : "Some adoption is verifiable · inspect results and unavailable evidence") + : currentAdoptions + ? (zh ? "已记录采用 · 查看后续结果" : "Adoption recorded · inspect downstream results") + : unavailableAdoptions + ? (zh ? "采用证据无法核验 · 查看版本依据" : "Adoption evidence unavailable · inspect versions") + : selection?.result.dependencies?.length + ? (zh ? "此结果关联来源版本 · 查看依据" : "This result references source versions · inspect evidence") + : (zh ? "尚无采用记录 · 查看验收与版本依据" : "No adoption recorded · inspect acceptance and versions"); return

{zh ? "团队成果" : "Team results"}

@@ -91,6 +103,7 @@ export function GoalTeamResults({sessionId, zh, refreshKey}: {sessionId: string; {page.has_more && page.next_cursor ? : null} : null} {selection ?
+
{adoptionSummary} void read(operationId)}/>
{selection.result.artifacts && selection.result.artifacts.length > 1 ? : null} -
{zh ? "验收与采用关系" : "Acceptance and adoption"} void read(operationId)}/>
: null}
; diff --git a/examples/personal-workspace-browser/team-evidence.mjs b/examples/personal-workspace-browser/team-evidence.mjs index 8010ea3bbc..1a27cfd80d 100644 --- a/examples/personal-workspace-browser/team-evidence.mjs +++ b/examples/personal-workspace-browser/team-evidence.mjs @@ -22,6 +22,7 @@ export const teamEvidenceScenario = { const results = page.getByRole("region", {name: "团队成果", exact: true}); // Accepted report opens in the original conversation without an extra click. await results.getByRole("table").waitFor(); + await results.getByText("尚无采用记录 · 查看验收与版本依据", {exact: true}).waitFor(); assert.equal(await results.getByLabel("当前报告").evaluate(el => el === document.activeElement), false, "Automatic readback must not steal focus"); const reads = api.loopxModeRequests.filter(row => row.operation === "read").length; await results.getByRole("button", {name: "刷新成果", exact: true}).click(); @@ -66,6 +67,21 @@ export const teamEvidenceScenario = { assert.equal(await results.getByRole("table").count(), 0); assert.equal(await results.getByText("newer unverified report").count(), 0); await page.unroute("**/api/chat/sessions/*/loopx", changedReport); + mode.fixtureAdoptionState = "current"; + await results.getByRole("button", {name: "刷新成果", exact: true}).click(); + await results.getByText("已记录采用 · 查看后续结果", {exact: true}).waitFor(); + await page.screenshot({path: resolve(outputDir, "team-adoption-source.png"), animations: "disabled"}); + await results.getByText("已记录采用 · 查看后续结果", {exact: true}).click(); + await results.getByRole("button", {name: "查看后续结果", exact: true}).click(); + await results.getByText("Reviewed cash allocation").waitFor(); + await results.getByText("此结果关联来源版本 · 查看依据", {exact: true}).waitFor(); + await page.screenshot({path: resolve(outputDir, "team-adoption-return.png"), animations: "disabled"}); + assert.equal(api.turnRequests.length, 0, "Following adopted results must not start a model"); + await results.getByRole("button", {name: /local-analyst · report.md/}).click(); + mode.fixtureAdoptionState = "unavailable"; + await results.getByRole("button", {name: "刷新成果", exact: true}).click(); + await results.getByText("采用证据无法核验 · 查看版本依据", {exact: true}).waitFor(); + delete mode.fixtureAdoptionState; await page.getByRole("button", {name: "团队执行情况", exact: true}).click(); const dialog = page.getByRole("dialog", {name: "团队执行情况"}); const openEvidence = dialog.getByRole("button", {name: "查看证据与反馈", exact: true}); diff --git a/loopx/web/chat/asset-retention.json b/loopx/web/chat/asset-retention.json index 43ca88ff52..c743e582d1 100644 --- a/loopx/web/chat/asset-retention.json +++ b/loopx/web/chat/asset-retention.json @@ -13,8 +13,8 @@ "assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2", "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", - "assets/index-BGlmetKk.js", - "assets/index-C_Imc7ZG.css" + "assets/index-Bm8PVjll.js", + "assets/index-DTJTDfC1.css" ], [ "assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2", @@ -28,7 +28,7 @@ "assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2", "assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2", "assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2", - "assets/index-CFEaAATG.js", + "assets/index-BGlmetKk.js", "assets/index-C_Imc7ZG.css" ] ] diff --git a/loopx/web/chat/assets/index-CFEaAATG.js b/loopx/web/chat/assets/index-Bm8PVjll.js similarity index 83% rename from loopx/web/chat/assets/index-CFEaAATG.js rename to loopx/web/chat/assets/index-Bm8PVjll.js index 14b088ac03..744b7dbc87 100644 --- a/loopx/web/chat/assets/index-CFEaAATG.js +++ b/loopx/web/chat/assets/index-Bm8PVjll.js @@ -127,10 +127,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `),r=[],i=[],a=()=>{i.length>0&&(r.push({type:`paragraph`,lines:i}),i=[])},o=0;for(;o/^:?-{3,}:?$/.test(e))){a();let e=[];for(o+=2;o{let n=`b${t}`;if(e.type===`code`)return(0,z.jsx)(`pre`,{className:`personal-md-pre`,children:(0,z.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,z.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:yb(e.text,n)},n);if(e.type===`table`)return(0,z.jsx)(`div`,{className:`personal-md-table-scroll`,tabIndex:0,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsx)(`tr`,{children:e.headers.map((e,t)=>(0,z.jsx)(`th`,{scope:`col`,children:yb(e,`${n}-h${t}`)},t))})}),(0,z.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,z.jsx)(`tr`,{children:e.map((e,r)=>(0,z.jsx)(`td`,{children:yb(e,`${n}-${t}-${r}`)},r))},t))})]})},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,z.jsx)(`li`,{children:yb(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,z.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,z.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,z.jsx)(`p`,{children:e.lines.map((e,t)=>(0,z.jsxs)(R.Fragment,{children:[t>0?(0,z.jsx)(`br`,{}):null,yb(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}var Tb=e=>/\.(md|markdown)$/i.test(e);function Eb({artifact:e,label:t,raw:n=!1}){return!n&&Tb(e.ref)?(0,z.jsx)(`div`,{className:`goal-team-report`,"aria-label":t,tabIndex:0,children:(0,z.jsx)(wb,{text:e.text,report:!0})}):(0,z.jsx)(`pre`,{tabIndex:0,"aria-label":t,children:e.text})}function Db({artifact:e,zh:t,heading:n=e.ref}){let[r,i]=(0,R.useState)(!1);return(0,z.jsxs)(`article`,{className:`goal-team-artifact`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h4`,{children:n}),Tb(e.ref)?(0,z.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?t?`阅读报告`:`Read report`:t?`查看原文`:`View source`}):null]}),(0,z.jsx)(Eb,{artifact:e,raw:r,label:`${t?`证据内容`:`Evidence content`}: ${e.ref}`}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`产物版本`:`Artifact version`}),(0,z.jsx)(`code`,{children:e.sha256})]})]})}function Ob({sessionId:e,result:t,zh:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(0),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(0);(0,R.useEffect)(()=>(p.current++,i(null),u(``),c(!1),o(0),()=>{p.current++}),[t,e]);let m=t.status===`accepted`&&!t.error&&!t.recovery_required?t.artifacts??[]:[],h=t.dependencies??[];async function g(t){let r=++p.current;i(null),u(``),c(!0),o(hb(t.ref,m)),f(!1);try{let a=await _g(e,t.operation_id);if(r!==p.current)return;gb(t,a)?i({link:t,source:a}):u(n?`指定来源版本无法核验,未展示对照。`:`The referenced source version cannot be verified. Comparison withheld.`)}catch{r===p.current&&u(n?`来源读取失败,已清除上次对照。可重试或查看执行详情。`:`Source read failed; previous comparison cleared. Retry or inspect the execution.`)}finally{r===p.current&&c(!1)}}if(!h.length||!m.length)return null;let _=r?gb(r.link,r.source):null,v=m[a],y=_&&v?_b(_.text,v.text):null,b=n?{revises:`修订依据`,responds_to:`回应依据`,uses:`使用依据`}:{revises:`Revision source`,responds_to:`Response source`,uses:`Input source`};return(0,z.jsxs)(`section`,{className:`goal-team-comparison`,"aria-label":n?`依据与结果对照`:`Source and result comparison`,"aria-busy":s,children:[(0,z.jsxs)(`div`,{className:`goal-team-comparison-heading`,children:[(0,z.jsx)(`h4`,{children:n?`看清这次变化`:`See what changed`}),(0,z.jsx)(`span`,{children:n?`按需核验`:`On-demand verification`})]}),(0,z.jsx)(`div`,{className:`goal-team-comparison-sources`,children:h.map((e,t)=>(0,z.jsxs)(`button`,{type:`button`,disabled:s||e.state!==`current`,"aria-pressed":r?.link===e,onClick:()=>void g(e),children:[(0,z.jsx)(`span`,{children:b[e.relation]}),(0,z.jsx)(`strong`,{children:e.ref}),h.filter(t=>t.ref===e.ref).length>1?(0,z.jsx)(`span`,{children:e.operation_id}):null,e.state===`current`?null:(0,z.jsx)(`span`,{children:n?`无法核验`:`Unavailable`})]},`${e.operation_id}:${e.input_ref}:${t}`))}),s?(0,z.jsx)(`p`,{role:`status`,children:n?`正在读取指定来源版本…`:`Reading the referenced source version…`}):null,l?(0,z.jsx)(`p`,{role:`alert`,children:l}):null,_&&v&&y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(e=>!e),children:d?n?`阅读对照`:`Read comparison`:n?`查看原文差异`:`View source changes`}),m.length>1?(0,z.jsxs)(`label`,{children:[n?`对照产物`:`Compare output`,(0,z.jsx)(`select`,{value:a,onChange:e=>o(Number(e.target.value)),children:m.map((e,t)=>(0,z.jsx)(`option`,{value:t,children:e.ref},`${e.ref}:${t}`))})]}):null,(0,z.jsx)(`div`,{className:`goal-team-comparison-grid`,children:[{kind:`source`,title:n?`指定来源`:`Referenced source`,artifact:_,lines:y.left,end:y.leftEnd},{kind:`result`,title:n?`本次产物`:`This output`,artifact:v,lines:y.right,end:y.rightEnd}].map(e=>(0,z.jsxs)(`article`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{children:e.title}),(0,z.jsx)(`strong`,{children:e.artifact.ref})]}),d?(0,z.jsx)(`pre`,{tabIndex:0,"aria-label":`${e.title}: ${e.artifact.ref}`,children:e.lines.map((t,n)=>(0,z.jsxs)(`span`,{"data-changed":n>=y.start&&n(w(),()=>{C.current++}),[e,t]);async function w(){let n=++C.current;s(null),l(``),p(``),d(!0);try{let r=await _g(e,t);n===C.current&&(s(r),l(new Date().toLocaleTimeString()))}catch(e){n===C.current&&p(e instanceof Error?e.message:String(e))}finally{n===C.current&&d(!1)}}async function T(){if((!o||!m.trim())&&!S.current)return;let r=S.current??{id:crypto.randomUUID(),text:[`${n?`针对团队执行`:`Regarding team execution`}: ${t}`,...(o?.artifacts??[]).map(e=>`${e.ref} · sha256:${e.sha256}`),m.trim()].join(` -`)};S.current=r,_(!0),y(``);try{let t=await Sg(e,r.text,`inbox`,r.id);x({id:r.id,status:t.status})}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}let E=b?i.find(e=>e.client_ingress_id===b.id)?.status??b.status:``,D=E===`pending`?n?`已进入协调员收件箱,等待读取`:`In the coordinator inbox; awaiting read`:E===`delivered`?n?`已交给协调员;尚无应用回执`:`Delivered to coordinator; application not confirmed`:n?`投递状态待核实`:`Delivery requires reconciliation`;return(0,z.jsxs)(`section`,{className:`goal-team-evidence`,"aria-label":n?`执行证据`:`Execution evidence`,"aria-busy":u,children:[(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`h3`,{children:n?`执行证据`:`Execution evidence`}),(0,z.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void w(),children:n?`重新读取证据`:`Recheck evidence`})]}),u?(0,z.jsx)(`p`,{role:`status`,children:n?`正在核验绑定、验收与文件…`:`Checking bindings, acceptance and files…`}):null,f?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`无法核验,已清除上次证据。`:`Cannot verify; previous evidence cleared.`,` `,f]}):null,o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{role:`status`,children:[(0,z.jsxs)(`strong`,{children:[o.agent_id,` · `,vg(o,n)]}),` · `,c]}),(0,z.jsx)(`p`,{children:n?`按需读取的当前观察,不是持续在线状态;验收不代表协调员已采用。`:`An on-demand observation, not continuous liveness; acceptance does not establish coordinator adoption.`}),(0,z.jsx)(Ob,{sessionId:e,result:o,zh:n}),(0,z.jsx)(mb,{result:o,zh:n,onInspect:a}),o.error?(0,z.jsx)(`p`,{role:`alert`,children:o.error}):null,o.status===`accepted`&&!o.error&&!o.recovery_required&&o.artifacts?.length?o.artifacts.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Db,{artifact:e,zh:n}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`版本与来源标识`:`Version and source identifiers`}),(0,z.jsx)(`code`,{children:t}),(0,z.jsx)(`code`,{children:o.request_id}),(0,z.jsx)(`code`,{children:o.todo_id})]})]},`${e.ref}:${e.sha256}`)):(0,z.jsx)(`p`,{children:n?`本次读取没有可展示的已验收产物。`:`No accepted artifact is available in this readback.`}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),T()},children:[(0,z.jsxs)(`label`,{children:[n?`向协调员反馈此执行`:`Send feedback about this execution`,(0,z.jsx)(`textarea`,{value:m,maxLength:6e3,rows:3,disabled:!!S.current,onChange:e=>h(e.target.value)})]}),(0,z.jsx)(`p`,{children:n?`附上执行标识及当前产物版本,交给原协调员收件箱;不会直接改写任务或中断成员。`:`Includes the operation and observed artifact versions in the original coordinator inbox; does not change tasks or interrupt members.`}),r?null:(0,z.jsx)(`p`,{children:n?`协调员未在执行或当前观察不可用;恢复执行后可发送。`:`Coordinator inactive or observation unavailable; resume execution to send.`}),(0,z.jsx)(`button`,{type:`submit`,disabled:!r||g||!!b||!m.trim(),children:g?n?`正在投递…`:`Sending…`:v?n?`重试同一条反馈`:`Retry this feedback`:n?`发送反馈`:`Send feedback`})]})]}):null,v?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`未确认投递,请重试同一条反馈,避免重复发送。`:`Delivery not confirmed; retry the same feedback to avoid duplicates.`,` `,v]}):null,b?(0,z.jsx)(`p`,{role:`status`,children:D}):null]})}var Ab={authority_unavailable:{en:`Canonical authority unavailable`,zh:`缺少规范权限状态`},turn_blocked:{en:`Task admission blocked`,zh:`当前任务未获准执行`},acceptance_unavailable:{en:`Acceptance binding unavailable`,zh:`缺少有效验收绑定`},runtime_unavailable:{en:`Runtime unavailable`,zh:`运行时不可用`},runtime_unverified:{en:`Runtime availability unverified`,zh:`运行时可用性尚未验证`},launchable:{en:`Local launch prerequisites met`,zh:`本机启动条件已满足`}};function jb({check:e,zh:t}){let n=e.executor?[e.executor.host,e.executor.reason].filter(Boolean).join(` · `):e.authority_reason,r=e.state===`authority_unavailable`?t?`未检查或启动执行器`:`No executor was inspected or launched`:t?`不代表正在执行`:`Does not mean executing`,i=e.authority_next_action===`preview_reviewed_goal_authority_promotion`?t?`下一步:预览整 Goal 协调 Authority 晋级`:`Next: preview whole-Goal coordination-authority promotion`:e.authority_next_action===`repair_canonical_authority`?t?`下一步:修复规范 Authority 读回`:`Next: repair canonical authority readback`:null;return(0,z.jsxs)(`p`,{role:`status`,children:[t?Ab[e.state].zh:Ab[e.state].en,n?` · ${n}`:``,i?` · ${i}`:``,` · ${r}`]})}function Mb({sessionId:e,members:t,zh:n,canMessage:r,ingress:i}){let[a,o]=(0,R.useState)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)({}),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(``),v=(0,R.useRef)(0);(0,R.useEffect)(()=>{(a?s.current:l.current)?.focus()},[a]),(0,R.useEffect)(()=>(v.current++,d(null),p({}),_(``),h(!1),y(),()=>{v.current++}),[e]);async function y(t){let n=++v.current;h(!0),_(``),d(null),o(null);try{let r=await yg(e,t);n===v.current&&d(r)}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}async function b(t){let n=++v.current;h(!0),_(``),p(e=>{let n={...e};return delete n[t],n});try{let r=await bg(e,t);n===v.current&&p(e=>({...e,[t]:r}))}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}return a?(0,z.jsxs)(`div`,{className:`goal-team-work`,children:[(0,z.jsx)(`button`,{ref:s,type:`button`,onClick:()=>o(null),children:n?`返回执行列表`:`Back to executions`}),(0,z.jsx)(kb,{sessionId:e,operationId:a,zh:n,canMessage:r,ingress:i,onInspect:o},`${e}:${a}`)]}):(0,z.jsx)(`div`,{className:`goal-team-work`,children:(0,z.jsxs)(`section`,{"aria-label":n?`团队执行详情`:`Team execution details`,children:[(0,z.jsx)(`p`,{children:n?`检查不会启动成员。暂停协调员后,已派发的工作仍会继续。`:`Inspection starts no members. Dispatched work continues when the coordinator is paused.`}),(0,z.jsx)(`h3`,{children:n?`已绑定成员`:`Bound members`}),(0,z.jsx)(`ul`,{className:`goal-team-bindings`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(e.id),children:n?`检查启动条件`:`Check prerequisites`})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`任务与执行配置`:`Task and execution details`}),(0,z.jsx)(`code`,{children:e.todo_id}),f[e.id]?.executor?.profile?(0,z.jsx)(`code`,{children:f[e.id]?.executor?.profile}):null]}),f[e.id]?(0,z.jsx)(jb,{check:f[e.id],zh:n}):null]},e.id))}),(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`strong`,{children:n?`此协调身份的持久工作`:`Durable work for this coordinator`}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>{p({}),y()},children:n?`重新核验`:`Refresh`}),u?.has_more&&u.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void y(u.next_cursor),children:n?`下一页`:`Next page`}):null]}),m?(0,z.jsx)(`p`,{role:`status`,children:n?`正在读取当前事实…`:`Reading current facts…`}):null,g?(0,z.jsx)(`p`,{role:`alert`,children:g}):null,u?(0,z.jsxs)(z.Fragment,{children:[u.page_readback_complete?null:(0,z.jsx)(`p`,{role:`status`,children:n?`本页有无法核验的工作,请检查原请求;不要直接重新派工。`:`Some work cannot be verified. Reconcile the original request before redispatching.`}),u.items.length?null:(0,z.jsx)(`p`,{children:n?`此页没有委派记录;不代表整个团队没有工作或 Goal 已完成。`:`No records on this page; this does not establish an idle team or a completed Goal.`}),(0,z.jsx)(`ul`,{className:`goal-team-operations`,children:u.items.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`strong`,{children:[e.agent_id??(n?`记录不可读`:`Unreadable record`),` · `,vg(e,n)]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`执行标识`:`Execution identifier`}),(0,z.jsx)(`code`,{children:e.operation_id??e.record_id})]}),e.operation_id?(0,z.jsx)(`button`,{ref:e.operation_id===c.current?l:void 0,type:`button`,onClick:()=>{c.current=e.operation_id,o(e.operation_id)},children:n?`查看证据与反馈`:`Evidence and feedback`}):null]},e.record_id))}),(0,z.jsxs)(`p`,{children:[n?`仅限当前协调身份;分页不是团队快照。`:`Scoped to this coordinator; paging is not a team snapshot.`,u.has_more?n?` 还有下一页。`:` More pages remain.`:``]})]}):null]})})}function Nb({sessionId:e,onPrepare:t,onExecute:n,onChange:r}){let{locale:i}=Ji(),a=i===`zh-CN`,[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),u=c===`settings`,d=e=>l(e?`settings`:null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{c&&!f.current?.open?f.current?.showModal():!c&&f.current?.open&&f.current.close()},[c]);let[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)({agent_id:``,token_budget:0});(0,R.useEffect)(()=>{let t=!0,n=!1;if(s(null),r(null),g(``),v(``),d(!1),!e||e===`new-session-pending`)return;async function i(){if(!n){n=!0;try{let n=await gg(e);t&&(s(n),r(n),v(``))}catch(e){t&&v(e instanceof Error?e.message:String(e))}finally{n=!1}}}i();let a=window.setInterval(()=>{document.hidden||i()},2500);return()=>{t=!1,window.clearInterval(a)}},[e]);let x=!!(o?.enabled&&o.active_turn_id),S=o?.native.status??`absent`,C=![`absent`,`complete`].includes(S),w=!!(o?.settings.agent_id&&o.settings.token_budget&&o.settings.execution_config),T=e=>{b({agent_id:e.settings.agent_id??``,token_budget:e.settings.token_budget??0}),d(!0)},E=o?.enabled?o.recovery_required?a?`LoopX · 需要恢复连接`:`LoopX · Reconnect required`:S===`blocked`?a?`LoopX · 需要处理阻塞`:`LoopX · Blocked`:x?a?`LoopX · 正在推进`:`LoopX · Working`:S===`complete`?a?`LoopX · 本轮已结束`:`LoopX · Run finished`:[`budgetLimited`,`usageLimited`].includes(S)?a?`LoopX · 已到额度限制`:`LoopX · Usage limit`:a?`LoopX · 已暂停`:`LoopX · Paused`:a?`普通对话`:`Conversation`,D=()=>{o&&!u?T(o):d(!1)};async function O(){m(!0),g(``);try{let e=await gg(await t());s(e),r(e),T(e)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function k(t){if(e){m(!0),g(``);try{let n=await xg(e,t,t===`configure`?y:void 0);s(n),r(n),(t===`configure`||t===`exit`)&&d(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}}let A=o?.deliveries.some(e=>[`rejected`,`unavailable`].includes(e.status)),ee=o?.ingress.filter(e=>e.status!==`delivered`)??[];return(0,z.jsxs)(`section`,{className:`goal-loopx-mode`,"aria-label":a?`LoopX 运行模式`:`LoopX execution mode`,children:[(0,z.jsxs)(`div`,{className:`goal-loopx-mode-bar`,children:[(0,z.jsxs)(`span`,{className:`goal-loopx-mode-status`,"data-active":x,role:`status`,children:[(0,z.jsx)(`i`,{"aria-hidden":`true`}),E]}),(0,z.jsxs)(`div`,{className:`goal-loopx-mode-actions`,children:[w&&e?(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-team-trigger`,onClick:()=>l(`team`),"aria-haspopup":`dialog`,children:[(0,z.jsx)(hh,{size:16}),a?`团队执行情况`:`Team execution`,A?(0,z.jsx)(`span`,{className:`goal-loopx-alert-dot`,"aria-label":a?`最近回读需要核验`:`Last observations need review`}):null]}):null,(0,z.jsx)(`button`,{type:`button`,disabled:p||o?.conversation_busy||!o,onClick:D,"aria-label":a?`运行设置`:`Settings`,title:a?`运行设置与用量`:`Settings and usage`,"aria-haspopup":`dialog`,children:(0,z.jsx)(ah,{size:16})}),(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-primary`,disabled:p||!!(o?.conversation_busy&&!x),title:x?a?`暂停协调员;已派发的成员继续执行`:`Pause coordinator; dispatched members keep working`:void 0,onClick:async()=>{if(!o){await O();return}x?k(`pause`):!w||Number(o.settings.token_budget??0)<=Number(o.native.tokensUsed??0)?D():n(C?`resume`:`start`)},children:[x?(0,z.jsx)(Jm,{size:14}):(0,z.jsx)(Ym,{size:14}),x?a?`暂停协调员`:`Pause coordinator`:o?.enabled?S===`complete`?a?`开启新一轮`:`Start new run`:a?`恢复推进`:`Continue`:a?`开启 LoopX 模式`:`Enable LoopX`]})]})]}),ee.length?(0,z.jsxs)(`p`,{role:`status`,children:[a?`待处理消息:`:`Pending messages: `,ee.map(e=>`${e.mode===`loopx_queue`?`queue`:`inbox`} · ${e.status}`).join(` / `)]}):null,A?(0,z.jsx)(`button`,{className:`goal-loopx-review-notice`,type:`button`,onClick:()=>l(`team`),children:a?`最近成员回读有未通过或无法核验的结果 · 查看团队`:`Last member observations include rejected or unverified results · View team`}):null,(h||_)&&!c?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,(0,z.jsx)(`dialog`,{className:`goal-loopx-dialog`,ref:f,"aria-labelledby":`goal-loopx-dialog-title`,onClose:()=>l(null),onClick:e=>{e.target===e.currentTarget&&l(null)},children:c?(0,z.jsxs)(`div`,{className:`goal-loopx-dialog-content`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h2`,{id:`goal-loopx-dialog-title`,children:c===`team`?a?`团队执行情况`:`Team execution`:a?`运行设置`:`Execution settings`}),(0,z.jsx)(`button`,{type:`button`,autoFocus:!0,"aria-label":a?`关闭`:`Close`,onClick:()=>l(null),children:(0,z.jsx)(gh,{size:18})})]}),h||_?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,c===`team`&&e&&!_?(0,z.jsx)(Mb,{sessionId:e,members:o?.members??[],zh:a,canMessage:x&&!o?.paused&&!_,ingress:o?.ingress??[]},`${e}:${o?.settings.agent_id}:${o?.settings.execution_config}`):null,c===`team`?(0,z.jsxs)(`div`,{className:`goal-team-control`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:p||!x||!!_,onClick:()=>void k(`pause`),children:a?`暂停协调员`:`Pause coordinator`}),(0,z.jsxs)(`p`,{role:`status`,children:[o?.paused?x?a?`已暂停后续调度,等待当前协调轮次停止回读。`:`Further dispatch paused; awaiting coordinator turn stop readback.`:a?`协调员已暂停。`:`Coordinator paused.`:null,a?`此操作不会停止已派发成员;成员状态以上次执行回读为准。当前入口不支持停止整个团队。`:`This does not stop dispatched members; their states are last-read observations. Whole-team stop is unavailable here.`]})]}):null,u?(0,z.jsxs)(`div`,{className:`goal-loopx-mode-settings`,children:[(0,z.jsxs)(`label`,{children:[a?`已注册的协调身份`:`Registered coordinator`,(0,z.jsxs)(`select`,{value:y.agent_id,onChange:e=>b({...y,agent_id:e.target.value}),children:[(0,z.jsx)(`option`,{value:``,children:a?`选择已授权身份`:`Select authorized identity`}),o?.registered_agents.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsxs)(`label`,{children:[a?`协调员总 token 额度`:`Coordinator total token allowance`,(0,z.jsx)(`input`,{type:`number`,min:1,max:2147483647,value:y.token_budget||``,onChange:e=>b({...y,token_budget:Number(e.target.value)})})]}),(0,z.jsxs)(`label`,{children:[a?`成员执行绑定文件(Goal 配置)`:`Member execution bindings (Goal configuration)`,(0,z.jsx)(`input`,{readOnly:!0,value:o?.settings.execution_config??(a?`未配置`:`Not configured`)})]}),(0,z.jsx)(`p`,{children:a?`绑定文件由 Goal 子代理设置统一管理;额度包含协调员历史用量,成员授权不会因开启模式而扩大。`:`Manage the binding file in Goal sub-agent settings. The allowance includes coordinator history; enabling this mode does not expand member grants.`}),(0,z.jsx)(`button`,{type:`button`,disabled:p||!y.agent_id||y.token_budget<1||!o?.settings.execution_config,onClick:()=>void k(`configure`),children:a?`保存设置`:`Save settings`})]}):null,c===`settings`&&o?.enabled&&o.native.tokensUsed!==void 0?(0,z.jsxs)(`p`,{className:`goal-loopx-mode-usage`,children:[a?`协调员累计用量`:`Coordinator usage`,` `,o.native.tokensUsed.toLocaleString(),` / `,o.native.tokenBudget?.toLocaleString()??`—`,` tokens`]}):null,c===`settings`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:a?`开启后,当前协调员持续推进本 Goal。暂停仅影响协调员,已派发成员继续执行;本轮结束不等于 Goal 完成。`:`The coordinator continues this Goal. Pausing affects only the coordinator; dispatched members keep working. A finished run does not complete the Goal.`}),o?.enabled&&!x?(0,z.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void k(`exit`),children:a?`退出模式`:`Exit mode`}):null]}):null]}):null})]})}var Pb=e=>e.items.filter(e=>e.operation_id&&e.status===`accepted`&&!e.recovery_required&&e.artifacts?.length);function Fb({sessionId:e,zh:t,refreshKey:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=(0,R.useRef)(0),f=(0,R.useRef)(null),p=(0,R.useRef)(void 0),m=(0,R.useRef)(!1),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{f.current=null,p.current=void 0},[e]),(0,R.useEffect)(()=>(v(p.current),()=>{d.current++}),[e,n]),(0,R.useEffect)(()=>{a&&m.current&&(h.current?.focus(),m.current=!1)},[a]);let g=t?`产物或验收已变化,未展示旧报告。请重新选择可核验的产物。`:`Artifact or acceptance changed. Previous report cleared; select a verified artifact again.`;async function _(t,n,r){let i=await _g(e,t);if(r!==d.current)return;let a=i.artifacts??[],s=n?.ref?a.filter(e=>e.ref===n.ref):[],c=n?.ref?s.length===1&&s[0].sha256===n.sha256?s[0]:void 0:a.find(e=>Tb(e.ref))??a[0];i.operation_id!==t||i.status!==`accepted`||i.error||i.recovery_required||!c?u(g):(f.current={operationId:t,ref:c.ref,sha256:c.sha256},o({result:i,artifact:c}))}async function v(n,r=!1){let a=++d.current;r&&(f.current=null),p.current=n,m.current=!1,c(!0),u(``),i(null),o(null);try{let t=await yg(e,n);if(a!==d.current)return;i(t);let r=f.current;if(!r){let e=Pb(t)[0],n=e?.artifacts?.find(e=>Tb(e.ref))??e?.artifacts?.[0];e?.operation_id&&n&&(r={operationId:e.operation_id,...n})}r&&(f.current=r,await _(r.operationId,r,a))}catch(e){a===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{a===d.current&&c(!1)}}async function y(e,n){let r=++d.current;m.current=!0,c(!0),u(``),o(null);let i={operationId:e,...n};f.current=i;try{await _(e,i,r)}catch(e){r===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{r===d.current&&c(!1)}}let b=r?Pb(r):[];return(0,z.jsxs)(`section`,{className:`goal-team-results`,"aria-label":t?`团队成果`:`Team results`,"aria-busy":s,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:t?`团队成果`:`Team results`}),(0,z.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void v(p.current),children:[(0,z.jsx)(Qm,{size:14,"aria-hidden":`true`}),t?`刷新成果`:`Refresh results`]})]}),s?(0,z.jsx)(`p`,{role:`status`,children:t?`正在核验产物…`:`Verifying artifacts…`}):null,l?(0,z.jsx)(`p`,{role:`alert`,children:l}):null,r&&!r.page_readback_complete?(0,z.jsx)(`p`,{role:`status`,children:t?`部分工作无法核验,请在团队执行中检查。`:`Some work cannot be verified; inspect Team execution.`}):null,(0,z.jsxs)(`div`,{className:`goal-team-results-layout`,children:[r?(0,z.jsxs)(`nav`,{className:`goal-team-result-list`,"aria-label":t?`选择团队产物`:`Choose a team artifact`,children:[b.map(e=>{let t=e.artifacts.find(e=>Tb(e.ref))??e.artifacts[0];return(0,z.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":`${e.agent_id} · ${t.ref}`,"aria-pressed":a?.result.operation_id===e.operation_id,onClick:()=>void y(e.operation_id,t),children:[(0,z.jsx)(jm,{size:16,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`small`,{children:t.ref})]}),(0,z.jsx)(hm,{className:`goal-team-result-check`,size:14,"aria-hidden":`true`})]},e.record_id)}),b.length?null:(0,z.jsx)(`p`,{children:t?`本页没有可读取的已验收产物。`:`No accepted artifact is available on this page.`}),r.has_more&&r.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>void v(r.next_cursor,!0),children:t?`下一页成果`:`Next results page`}):null]}):null,a?(0,z.jsxs)(`div`,{ref:h,tabIndex:-1,className:`goal-team-result-reader`,"aria-label":t?`当前报告`:`Current report`,children:[(0,z.jsx)(Db,{artifact:a.artifact,zh:t,heading:t?`已通过当前验收`:`Currently accepted`},`${a.result.operation_id}:${a.artifact.sha256}`),a.result.artifacts&&a.result.artifacts.length>1?(0,z.jsxs)(`label`,{children:[t?`其他产物`:`Other artifacts`,(0,z.jsx)(`select`,{value:a.artifact.ref,onChange:e=>{let t=a.result.artifacts.find(t=>t.ref===e.target.value);t&&(f.current={operationId:a.result.operation_id,ref:t.ref,sha256:t.sha256},o({...a,artifact:t}))},children:a.result.artifacts.map(e=>(0,z.jsx)(`option`,{value:e.ref,children:e.ref},e.ref))})]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`验收与采用关系`:`Acceptance and adoption`}),(0,z.jsx)(mb,{result:a.result,zh:t,onInspect:e=>void y(e)})]})]}):null]})]})}function Ib({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,z.jsx)(ym,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,z.jsx)(`strong`,{children:e.text})]}),(0,z.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,z.jsx)(_m,{size:17})]})}function Lb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?jm:Am;return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,z.jsx)(r,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,z.jsx)(`strong`,{children:t.title}),t.summary?(0,z.jsx)(`span`,{children:t.summary}):null,t.report?(0,z.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,z.jsx)(`time`,{children:t.createdAt}):null,(0,z.jsx)(_m,{size:17})]})}var Rb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function zb({onSelect:e,run:t,showGoal:n=!0}){let{t:r}=Ji();return(0,z.jsxs)(`button`,{"aria-label":`${r(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[n?`${t.goalTitle} · `:``,t.agentLabel]}),(0,z.jsx)(`strong`,{children:t.title}),t.latestActivity===t.title?null:(0,z.jsx)(`small`,{children:t.latestActivity})]}),(0,z.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):null,r(Rb[t.status])]}),(0,z.jsx)(_m,{size:17})]})}function Bb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,z.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,z.jsx)(Zm,{size:17}):(0,z.jsx)(mm,{size:17})}),(0,z.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,z.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,z.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,z.jsx)(_m,{size:16})]})}function Vb({delivery:e}){let{t}=Ji();if(!e)return null;let n=e.status===`delivered`?e.verification===`reconciled_after_restart`?t(`returnDelivery.reconciled`):t(`returnDelivery.delivered`):e.status===`verification_required`?t(`returnDelivery.verifying`):e.status===`explicit_unverified`?t(`returnDelivery.unverified`):t(`returnDelivery.queued`),r=e.status===`delivered`?`delivered`:e.status===`verification_required`?`verification_required`:e.status===`explicit_unverified`?`explicit_unverified`:`queued`;return(0,z.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function Hb({items:e,onSelect:t,selectedGoal:n}){let{locale:r,t:i}=Ji();if(e.length===0)return(0,z.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:20})}),(0,z.jsx)(`strong`,{children:i(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,z.jsx)(`p`,{children:i(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let a=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),o=a?.kind===`message`?`${a.message.agentLabel??i(`header.manager`)}:${a.message.pending?i(`timeline.pending`):a.message.text}`:a?.kind===`proposal`?`${a.proposal.title}:${a.proposal.status}`:a?.kind===`run`?i(`timeline.runCompleted`,{run:a.run.title}):``,s=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),c=e.filter(e=>e.kind===`run`&&[`queued`,`running`,`completed`].includes(e.run.status)),l=new Set(c.map(e=>e.id)),u=e.filter(e=>e.kind!==`proposal`&&!l.has(e.id)),d=c.filter(e=>e.run.status===`running`&&!!e.run.sessionId&&!!e.run.canInterrupt).length,f=c.filter(e=>e.run.status===`queued`).length,p=c.filter(e=>e.run.status===`completed`).length,m=c.length-d-f-p,h=r===`zh-CN`?[d&&`${d} 个执行中`,f&&`${f} 个排队中`,p&&`${p} 次执行已结束`,m&&`${m} 项进展更新`].filter(Boolean).join(` · `):[d&&`${d} running`,f&&`${f} queued`,p&&`${p} runs finished`,m&&`${m} progress updates`].filter(Boolean).join(` · `),g=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function _(e){return e.kind===`attention`?(0,z.jsx)(Ib,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,z.jsx)(zb,{showGoal:!n,onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,z.jsx)(Lb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,z.jsx)(Bb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,z.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:17})}),(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,z.jsx)(`strong`,{children:e.proposal.title}),e.proposal.impact?(0,z.jsx)(`p`,{children:e.proposal.impact}):null]}),(0,z.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?i(`timeline.review`):e.proposal.primaryLabel??i(`timeline.reviewAndConfirm`)})]},e.id):(0,z.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,z.jsx)(`span`,{className:`personal-message-avatar`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.message.role===`user`?i(`common.you`):e.message.agentLabel??i(`header.manager`)}),e.message.time?(0,z.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,z.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,z.jsx)(`p`,{children:e.message.text}):(0,z.jsx)(wb,{text:e.message.text}),e.message.pending?(0,z.jsx)(`span`,{className:`personal-message-pending`,children:i(`timeline.pending`)}):null,(0,z.jsx)(Wy,{request:e.message.collaboration}),(0,z.jsx)(Vb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:o}),(0,z.jsxs)(`div`,{className:`personal-channel-timeline`,children:[c.length?(0,z.jsxs)(`details`,{className:`personal-activity-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(im,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`strong`,{children:r===`zh-CN`?`执行动态`:`Execution activity`}),(0,z.jsx)(`span`,{children:h})]}),(0,z.jsx)(`div`,{children:c.map(_)})]}):null,u.map(_),s.length?(0,z.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:16})}),(0,z.jsx)(`strong`,{children:i(`timeline.waitingConfirmation`)}),(0,z.jsx)(`small`,{children:i(`timeline.gateHistory`,{count:s.length})})]}),(0,z.jsx)(`div`,{children:s.map(_)})]}):null,g.map(_)]})]})}function Ub({goal:e}){let{t,locale:n}=Ji(),r=n===`zh-CN`?{checkpoint_satisfied:`检查点满足`,checkpoint_fresh:`检查点有效`,path_outcome_valid:`路径决策有效`,evidence_refs_present:`证据引用齐全`,final_outcome_claim_present:`最终成果声明齐全`,no_reported_outcome_gap:`无已报告成果缺口`}:{checkpoint_satisfied:`Checkpoint satisfied`,checkpoint_fresh:`Checkpoint current`,path_outcome_valid:`Valid path decision`,evidence_refs_present:`Evidence refs present`,final_outcome_claim_present:`Final outcome claim present`,no_reported_outcome_gap:`No reported outcome gap`},i={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},a=e=>i[e]??t(`acceptance.unknown`),o=e.acceptanceObservation,s=e.loadState||!o||o.goal_id!==e.goalId||o.coverage===`unavailable`;return(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,z.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,z.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,z.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,z.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,z.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,z.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.agent`)}),(0,z.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.task`)}),(0,z.jsx)(`dd`,{children:e.todo_id})]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,z.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,z.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,z.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,z.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,z.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Wb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,z.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,z.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,z.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,z.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Todo`}),(0,z.jsx)(`dd`,{children:e.todoId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,z.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,z.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,z.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,z.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,z.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,z.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Gb({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,z.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,z.jsx)(`h3`,{children:db(e.teamPlanOutcome??null,t)}),(0,z.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,z.jsxs)(`div`,{className:`is-pending`,children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsxs)(`dd`,{children:[e.task||e.laneId,(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,lb(e.reasonCode,t)]})]})]},e.laneId))]}),(0,z.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,z.jsx)(`dl`,{children:e.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function Kb(e){return e.replace(/\s+/gu,` `).trim()}function qb(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Jb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Yb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Xb(e){return Kb(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Zb(e,t){let n=Kb(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!qb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!qb(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!qb(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!qb(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&Yb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!qb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!qb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!qb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!qb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Xb(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Jb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Qb(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var $b=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),ex=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],tx=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],nx=Array.from({length:32},(e,t)=>t+1),rx=/^[a-z][a-z0-9_.-]{0,63}$/u;function ix(e){let t=String(e??``).trim().toLowerCase();return rx.test(t)?t:null}function ax(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&(e.executionConfig??``)===(t.executionConfig??``)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ox({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=Ji(),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(`idle`),[x,S]=(0,R.useState)(`record`),[C,w]=(0,R.useState)([]),[T,E]=(0,R.useState)(null),[D,O]=(0,R.useState)(2),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(``),[M,te]=(0,R.useState)(``),[ne,N]=(0,R.useState)(`idle`),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(null),F=(0,R.useRef)(null),oe=(0,R.useRef)(null),[I,se]=(0,R.useState)(e.find(e=>e.available)?.agentId??`codex`),[L,ce]=(0,R.useState)(``),[le,ue]=(0,R.useState)(``),de=(0,R.useRef)(null),fe=(0,R.useRef)(null),pe=(0,R.useRef)(null),me=(0,R.useRef)(null),he=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,R.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ue(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),A(e?.modelConfig?.model??``),j(e?.modelConfig?.reasoning_effort??``),te(e?.executionConfig??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),N(`idle`),re(null),ae(null),F.current=e??null,oe.current=null},[he]);let ge=f.kind===`goal`?f.item.subagentExecution:void 0;(0,R.useEffect)(()=>{let e=F.current,t=ge?!e||!ax(e,ge):e!==null;if(F.current=ge??null,!ie){t&&ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2),E(null),N(`idle`),re(null));return}let n=oe.current;(!ge||ax(ie,ge)||n&&!ax(n,ge))&&(ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2)),oe.current=null,ae(null))},[ge,ie]),(0,R.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!fe.current?.contains(e)&&(pe.current=e);let t=window.requestAnimationFrame(()=>me.current?.focus());return()=>window.cancelAnimationFrame(t)},[he]);let _e=(0,R.useCallback)(()=>{let e=pe.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,R.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),_e();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(fe.current?.querySelectorAll($b)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[_e,f.kind]);let ve=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`&&f.item.actionKind===`team.plan`&&f.item.status===`applied`?m(`proposal.teamPlan.resultTitle`):f.kind===`proposal`?m(f.item.reviewPlan?.retryOriginal?`drawer.recoverEditResult`:f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),ye=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,be=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.kind===`proposal`&&f.item.status===`applied`&&f.item.actionKind===`team.plan`?f.item.goalId??m(`drawer.currentGoal`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),xe=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,Se=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),Ce=f.kind===`attention`?Zi(f.item.updatedAt,m):null,we=Xb(le);async function Te(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Ee(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??I,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function De(e,t,n){u||!of(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Oe=f.kind===`goal`?ie??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},ke=ne===`previewing`||ne===`applying`,Ae=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Oe.allowedDomains){let n=ix(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Oe.domainCandidates)for(let t of Oe.domainCandidates){let n=ix(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=ix(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function je(){w(Oe.allowedDomains),A(Oe.modelConfig?.model??``),j(Oe.modelConfig?.reasoning_effort??``),te(Oe.executionConfig??``),O(Oe.maxChildren||2),E(null),N(`idle`),re(null)}function Me(){let e=[...new Set(C.map(e=>ix(e)))];return e.every(e=>!!e)?e:null}function Ne(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),re(null),N(`idle`),E(null)}async function Pe(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Me():[];if(t&&!k.trim()&&ee){N(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){N(`error`),E(m(`drawer.subagentDomainInvalid`)),re(null);return}let i={alignCodexHostCapacity:e,allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,executionConfig:M.trim(),...Qb(t,k,ee)};N(`previewing`),E(m(`drawer.subagentPreviewing`)),re(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){oe.current=ge??null,ae({...e.configuration,domainCandidates:Oe.domainCandidates}),w(e.configuration.allowedDomains),A(e.configuration.modelConfig?.model??``),j(e.configuration.modelConfig?.reasoning_effort??``),te(e.configuration.executionConfig??``),O(e.configuration.maxChildren||2),N(`success`),E(m(`drawer.subagentNoChange`));return}re({...i,codexHostCapacity:e.configuration.codexHostCapacity,changed:e.changed,previewId:e.previewId}),N(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Fe(){if(!(!P||!r.onApplyGoalSubagentConfiguration)){N(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:P.allowedDomains,alignCodexHostCapacity:P.enabled,enabled:P.enabled,goalId:P.goalId,maxChildren:P.maxChildren,modelConfig:P.modelConfig,executionConfig:P.executionConfig,previewId:P.previewId});oe.current=ge??null,ae({...e,domainCandidates:Oe.domainCandidates}),w(e.allowedDomains),A(e.modelConfig?.model??``),j(e.modelConfig?.reasoning_effort??``),te(e.executionConfig??``),O(e.maxChildren||2),N(`success`),E(m(e.codexHostCapacity?.newSessionRequired?`drawer.subagentAppliedRestart`:`drawer.subagentApplied`)),re(null);try{await r.onRefresh?.()}catch{N(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,z.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:fe,role:`dialog`,children:[(0,z.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{id:`personal-drawer-title`,ref:me,tabIndex:-1,children:ve}),(0,z.jsx)(`p`,{children:be})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,z.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,z.jsx)(Wm,{size:17}):(0,z.jsx)(Bm,{size:17})}):null,(0,z.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:be}),className:`personal-icon-button personal-drawer-close`,onClick:_e,ref:de,type:`button`,children:[(0,z.jsx)(om,{className:`personal-mobile-back`,size:18}),(0,z.jsx)(gh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,z.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,z.jsx)(`h3`,{children:f.item.text}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??`medium`})]}),Ce?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.waiting`)}),(0,z.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:Ce})})]}):null]})]}),(0,z.jsx)(Wb,{item:f.item,onSelect:n,successor:af(f.item,t)}),!u&&of(f.item)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void De(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.decisionReview`)]}),(0,z.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.decisionMore`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,z.jsx)(Hm,{size:16}),m(`drawer.explainDecision`)]}),tx.map(e=>(0,z.jsx)(`button`,{onClick:()=>void De(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,z.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,z.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,z.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,z.jsx)(`span`,{children:f.item.priority}):null,(0,z.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,z.jsx)(`h3`,{children:f.item.text})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,z.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.owner`)}),(0,z.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.status`)}),(0,z.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,z.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,z.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,f.item.validationDigest?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevision`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevision??0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationDigest`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:f.item.validationDigest})})]}),f.item.validationRevisionActor?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevisionActor`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevisionActor})]}):null]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,z.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,z.jsxs)(`details`,{className:`personal-task-management`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:16}),m(`drawer.taskManage`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,z.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>se(e.target.value),value:I,children:e.filter(e=>e.available).map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${I}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:I,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.taskPriority`),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.taskPriority`),value:L,onChange:e=>ce(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.taskPriorityChoose`)}),[`P0`,`P1`,`P2`,`P3`,`P4`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e)),(0,z.jsx)(`option`,{value:`clear`,children:m(`drawer.taskPriorityClear`)})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!L,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-priority-${L}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:f.item.goalId,todo_id:f.item.todoId,operation:`edit`,...L===`clear`?{clear_priority:!0}:{priority:L}},summary:`${m(`drawer.taskPriority`)}: ${L===`clear`?m(`drawer.taskPriorityClear`):L}`}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,z.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!le.trim()&&!we,onChange:e=>ue(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:le}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!we,onClick:()=>void Ee(f.item,`defer`,m(`drawer.taskDefer`),we??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,z.jsx)(`small`,{children:le.trim()&&!we?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,z.jsx)(`div`,{className:`personal-task-management-secondary`,children:ex.map(e=>(0,z.jsx)(`button`,{onClick:()=>void Ee(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ee(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,z.jsx)(hm,{size:16}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,z.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.agentSentence}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Yd),` / `,Qd(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Yd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Xd),` / `,Qd(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Xd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Zd),` / `,Qd(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Zd)]})]})]})]}),(0,z.jsx)(Ub,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,z.jsxs)(z.Fragment,{children:[f.item.repository?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`small`,{children:m(`drawer.repository`)}),(0,z.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(Mm,{size:16}),f.item.repository.label]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,z.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Role`}),(0,z.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,z.jsx)(Cm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,z.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,z.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,z.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,z.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`h3`,{children:[t.app_label,(0,z.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.group`)}),(0,z.jsx)(`dd`,{children:t.chat_name})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,z.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,z.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,z.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,z.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,z.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,z.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,z.jsx)(dm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,z.jsx)(`small`,{children:m(`drawer.runDetails`)}),xe?.sessionId?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:Xi(xe.sessionStatus??xe.status,m)}),(0,z.jsx)(`p`,{children:xe.title}),r.onOpenRunSession?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(xe),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,z.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,z.jsx)(Zm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,z.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,z.jsxs)(`button`,{"aria-checked":Oe.enabled,"aria-label":m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":P&&ne===`ready`?`true`:void 0,disabled:u||ke||!!P||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Pe(!Oe.enabled),role:`switch`,type:`button`,children:[(0,z.jsx)(`span`,{}),m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`common.on`:`common.off`)]})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),P&&ne===`ready`?(0,z.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,z.jsx)(`strong`,{children:m(P.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,z.jsx)(`p`,{children:P.enabled?m(`drawer.subagentPreviewSummary`,{count:P.maxChildren,domains:P.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),P.modelConfig===void 0?null:(0,z.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,P.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,P.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,z.jsxs)(`p`,{children:[m(`drawer.subagentExecutionConfig`),`: `,P.executionConfig||m(`drawer.subagentExecutionConfigNone`)]}),P.enabled&&P.codexHostCapacity?(0,z.jsx)(`p`,{children:m(P.codexHostCapacity.writeRequired?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:P.codexHostCapacity.configuredChildren??m(`drawer.subagentHostCapacityImplicit`),required:P.codexHostCapacity.requiredChildren})}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Fe(),type:`button`,children:m(`common.confirm`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:je,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,z.jsxs)(`p`,{className:`personal-subagent-feedback is-${ne}`,role:`status`,children:[ne===`previewing`||ne===`applying`?(0,z.jsx)($m,{className:`personal-spin`,size:13}):null,T]}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,z.jsx)(`dd`,{children:Oe.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,z.jsx)(`dd`,{children:Oe.maxChildren||0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`dd`,{children:Oe.executionConfig||m(`drawer.subagentExecutionConfigNone`)})]})]}),u?(0,z.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,z.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,z.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:ke,children:[(0,z.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ae.length>0?(0,z.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ae.map(e=>{let t=C.includes(e.value);return(0,z.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,z.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ne(e.value,t.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.value}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,z.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:ke,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{A(e.target.value),re(null),N(`idle`),E(null)}})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:ke,value:ee,onChange:e=>{j(e.target.value),re(null),N(`idle`),E(null)},children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(`gpt-5.6-luna`),j(`max`),re(null),N(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(``),j(``),re(null),N(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,z.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentExecutionConfig`),disabled:ke,onChange:e=>{te(e.target.value),re(null),N(`idle`),E(null)},placeholder:`.loopx/config/delegations.json`,value:M})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentExecutionConfigHint`)}),(0,z.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,z.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:ke,onChange:e=>{O(Number(e.target.value)),re(null),N(`idle`),E(null)},value:D,children:nx.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,onClick:()=>void Pe(Oe.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,z.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,z.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,z.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,z.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,z.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,z.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,z.jsx)(`p`,{className:`personal-session-empty`,children:Se?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,z.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,z.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,z.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,z.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,z.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,z.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,z.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,z.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,z.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,z.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,z.jsx)(`header`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,z.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,z.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,z.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,z.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void Te(),type:`button`,children:(0,z.jsx)(nh,{size:16})})]})]}),u?null:(0,z.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.moreRunActions`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,z.jsx)(Jm,{size:16}),m(`drawer.runInterrupt`)]}),(0,z.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runNewSession`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:f.item.kind??`output`}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,z.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,z.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,z.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,z.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,z.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,z.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,z.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,z.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,z.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,z.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),m(`files.openConversation`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,z.jsx)(Tm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,z.jsx)(Gb,{proposal:f.item,t:m}):(0,z.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,z.jsx)(`h3`,{children:f.item.title}),f.item.impact?(0,z.jsx)(`p`,{children:f.item.impact}):null,f.item.reviewPlan&&!f.item.reviewPlan.retryOriginal&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,z.jsx)(`dl`,{children:f.item.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,z.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,z.jsx)(hm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(f.item.actionKind===`team.plan`?`proposal.teamPlan.openGoal`:`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`&&!f.item.reviewPlan?.retryOriginal?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,z.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,z.jsx)(`small`,{children:f.item.errorMessage}):null,(0,z.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,z.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,z.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,z.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,z.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,z.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,z.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,z.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`||f.item.reviewPlan?.retryOriginal?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,z.jsx)($m,{size:17}),m(f.item.reviewPlan?.retryOriginal?`drawer.retryOriginal`:f.item.actionKind===`team.plan`?`proposal.teamPlan.retry`:`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`&&(f.item.actionKind!==`team.plan`||f.item.status!==`applied`)?(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,z.jsx)(hm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,z.jsx)(`h3`,{children:f.item.label}),(0,z.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,z.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,z.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,z.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,z.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,z.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,z.jsx)(Ym,{size:16}):(0,z.jsx)(Jm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,z.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,z.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,z.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.timestamp})]}),(0,z.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,z.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,z.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,z.jsx)(gm,{className:_?`is-open`:``,size:16})]}),_?(0,z.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,z.jsxs)(`code`,{children:[`goal_id: `,ye]}),(0,z.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,z.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,z.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var sx=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],cx={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function lx(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(cx,e)?e:t}}}function ux(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(null),[a,o]=(0,R.useState)(`stable`),[s,c]=(0,R.useState)({phase:`idle`}),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(!1),m=window.__TAURI__?.core.invoke,h=sx.includes(s.phase);(0,R.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,R.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(lx(t))})}).catch(()=>{e&&c(lx(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,R.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(lx(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,runtime_pairing_required:t?`本机 CLI 运行时与 App 自带运行时不一致。回到 App 启动界面可「更新 App 与运行时」或「回退 CLI」。`:`This host's CLI runtime and the App's bundled runtime differ. On the App boot screen, update both or use the App's runtime.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:cx[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,z.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,z.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,z.jsx)(Tm,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:v}),(0,z.jsx)(vm,{size:14,"aria-hidden":`true`})]}),(0,z.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,z.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,z.jsx)(gh,{size:16,"aria-hidden":`true`})})]}),(0,z.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,z.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,z.jsx)(Qm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,z.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,z.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,z.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,z.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,z.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,z.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,z.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,z.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,z.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,z.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,z.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var dx=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function fx(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function px(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function mx(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function hx(e,t){let n=dx(t),[r,i]=(0,R.useState)(()=>{try{return fx(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(!1),p=px(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=mx(r,m,t,a,s);if(l===r)return;i(l);let u=px(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var gx=`/ssh-hosts`,_x=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function vx(e){return typeof e==`string`&&_x.test(e.trim())}function yx(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!vx(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function bx(e=fetch,t=gx){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return yx(await n.json())}function xx(e,t){let n=e.trim();if(!vx(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var Sx=`/api/ssh-source/ensure`,Cx=`/api/ssh-source/goal-lifecycle`;async function wx(e,t){let n=await fetch(Sx,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Tx(e,t,n,r,i=fetch){let a=await i(Cx,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function Ex({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(`configured`),[h,g]=(0,R.useState)([]),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)(`8876`),[k,A]=(0,R.useState)(``),ee=`configured:`,j=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${ee}${e.alias}`}))],M=(0,R.useMemo)(()=>h.some(e=>e.alias===C)?xx(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,R.useEffect)(()=>{te()},[]);async function te(){b(!0),v(null);try{let e=await bx();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function ne(){u(!0),m(`configured`),f(null),te()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),A(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in M){f(M.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:M.hostAlias,label:M.label,statusUrl:M.statusUrl});if(e.error){f(e.error);return}N()}function ie(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=xx(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function ae(){if(`error`in M){f(M.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(M.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,z.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{children:`Control plane`}),(0,z.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,z.jsx)(Xm,{size:14})})]}),(0,z.jsx)(fb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,z.jsx)(ih,{size:15}),onChange:e=>{if(e.startsWith(ee)){ie(e.slice(11));return}o(e)},options:j,value:e.id}),(0,z.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,z.jsxs)(`span`,{className:`is-${t}`,children:[(0,z.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,z.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,z.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,z.jsx)(fh,{size:12})}):null]}),n?(0,z.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,z.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,z.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,z.jsx)(gh,{size:13})})]}),(0,z.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,z.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,z.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,z.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,z.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,z.jsx)(`option`,{value:e.alias},e.alias))}),(0,z.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void te(),title:c(`source.refreshHosts`),type:`button`,children:(0,z.jsx)(eh,{size:13})})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.localPort`)}),(0,z.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,z.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,z.jsx)(`code`,{children:`error`in M?c(`source.tunnelCommandPending`):M.command}),(0,z.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in M,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(Cm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,z.jsx)(`p`,{className:`is-error`,children:_}):null,(0,z.jsx)(`p`,{children:c(`source.description`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in M,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.name`)}),(0,z.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,z.jsx)(`input`,{onChange:e=>A(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,z.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,z.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Dx={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Ox({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=Ji(),[m,h]=(0,R.useState)(!1),g=hx(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,z.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,z.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Dx[e.state]}`}),(0,z.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,z.jsx)(_m,{size:15})]}),!t&&m?(0,z.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,z.jsx)(lm,{"aria-hidden":`true`,size:13})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,z.jsx)(am,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,z.jsx)(zm,{size:13}):t?(0,z.jsx)($m,{size:13}):(0,z.jsx)(Jm,{size:13})}),t&&y(`delete`)?(0,z.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,z.jsx)(fh,{size:13})}):null]}):null]},e.goalId);return(0,z.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,z.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,z.jsx)(`span`,{className:`personal-brand-mark`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,z.jsx)(Ex,{...d}):null,(0,z.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,z.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-manager-icon`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,z.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,z.jsx)(_m,{size:15})]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,z.jsx)(`span`,{children:`Goals`}),(0,z.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,z.jsx)(`small`,{children:_.length}),(0,z.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,z.jsx)(cm,{"aria-hidden":`true`,size:15})}),a?(0,z.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,z.jsx)(Xm,{size:15})}):null]})]}),g.saveFailed?(0,z.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,z.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,z.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,z.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:13}),(0,z.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,z.jsx)(zm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,z.jsx)(`small`,{children:v.length})]}),(0,z.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,z.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,z.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,z.jsx)(ux,{}),o?(0,z.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,z.jsx)(ah,{size:17})}),(0,z.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,z.jsx)(`strong`,{children:p(`settings.open`)})}),(0,z.jsx)(_m,{"aria-hidden":`true`,size:15})]}):null]})]})}var kx=J({ok:X(!0),total:G().int().nonnegative(),next_cursor:W().nullable(),items:q(J({todo_id:W(),text:W(),claimed_by:W().nullable(),evidence:W().nullable(),priority:W().nullable(),task_class:W().nullable()})).max(40)});function Ax({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=Ji(),s=(0,R.useId)(),[c,l]=(0,R.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,R.useState)(n),[m,h]=(0,R.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,R.useState)(void 0),[v,y]=(0,R.useState)(!1),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)({top:0,height:600}),[E,D]=(0,R.useState)(null),O=(0,R.useRef)(null),k=(0,R.useRef)(null),[A,ee]=(0,R.useState)(0);(0,R.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let j=g===void 0||w.top+w.height>=f.length*d-d*2;(0,R.useEffect)(()=>{if(!r||!u||!j||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=kx.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,j,g,b,A,e.goalId,t,v]),(0,R.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let M=Math.max(0,Math.floor(w.top/d)-3),te=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,te-M)},(e,t)=>M+t);return E!==null&&El(e=>!e),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,z.jsx)(`span`,{children:m})]}),(0,z.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,z.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,z.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,z.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,z.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,z.jsx)(`strong`,{children:$d(n.text,112)}),(0,z.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,z.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),ee(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,z.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function jx({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,R.useId)(),o=(0,R.useRef)(null),s=(0,R.useRef)([]),c=(0,R.useRef)(null),[l,u]=(0,R.useState)({after:!1,before:!1}),d=(0,R.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,R.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,R.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,z.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:16}),(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,z.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,z.jsxs)(`header`,{id:a,children:[(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function Mx({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=Ji(),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)({goalId:``,laneId:`all`}),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:e.priority===`P3`?3:e.priority===`P4`?4:50,v=(0,R.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,A=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,z.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,z.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,z.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(fm,{size:15}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,z.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,z.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,z.jsx)(gm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,z.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,z.jsx)(Um,{size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:u(A?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,z.jsx)(`small`,{children:k?.returnDelivery?u(`tasks.chatReturn`):k?.agentLabel})]}),(0,z.jsx)(`div`,{className:`personal-task-reply-preview`,children:(0,z.jsx)(wb,{text:A?u(`tasks.chatPendingDescription`):(k?.text??O.text).trim().split(/\r?\n/,1)[0]})})]}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,z.jsx)(Um,{size:14}),u(`tasks.chatViewReply`)]}),k&&!A&&r?(0,z.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,z.jsx)(Rm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,z.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,z.jsxs)(jx,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,z.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,z.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,z.jsxs)(jx,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,z.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,z.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`○`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[e.priority?(0,z.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,z.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,z.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,z.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,z.jsx)(Dm,{size:14}),(0,z.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,z.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):(0,z.jsx)(hm,{size:14})}):null,(0,z.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,z.jsx)(Em,{size:14})})]})]},e.todoId)}),x.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,z.jsxs)(jx,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,z.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`◷`}),(0,z.jsx)(`strong`,{children:e.schedule.label}),(0,z.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,z.jsx)(Ax,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var Nx=yd(W(),q(W())),Px=J({node_id:W().min(1),kind:Y([`deliverable`,`gate`,`gate_summary`,`lease`,`validation`,`repair`,`handoff`,`evidence`]),title:W(),state:Y([`open`,`ready`,`blocked`,`done`,`waiting`,`unknown`]),refs:Nx,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),Fx=J({edge_id:W().min(1),from_node_id:W(),to_node_id:W(),relation:Y([`depends_on`,`blocks`,`validates`,`repairs`,`audits`,`continues`,`hands_off_to`,`supersedes`]),reason:W(),refs:Nx.optional()}),Ix=J({schema_version:X(`task_graph_projection_v0`),mode:X(`read_only`),goal_id:W(),generated_at:W().nullable(),truth_contract:J({projection_is_writable:X(!1),write_api:X(!1)}),limits:J({user_gate_node_limit:G().int().nonnegative(),user_gate_open_count:G().int().nonnegative(),user_gate_truncated_count:G().int().nonnegative(),source_truncated:K().optional(),predecessor_truncated:K().optional(),missing_predecessor_count:G().int().nonnegative().optional(),topology_complete:K().optional()}),nodes:q(Px),edges:q(Fx)}).superRefine((e,t)=>{let n=new Set(e.nodes.map(e=>e.node_id)),r=new Set(e.edges.map(e=>e.edge_id));(n.size!==e.nodes.length||r.size!==e.edges.length||e.edges.some(e=>!n.has(e.from_node_id)||!n.has(e.to_node_id)))&&t.addIssue({code:`custom`,message:`Graph identities or endpoints are invalid`})}),Lx=J({ok:X(!0),goal_id:W(),observed_at:W().datetime({offset:!0}),graph:Ix.nullable(),acceptance:uf.nullable()});function Rx(e,t){let n=Lx.parse(e);if(n.goal_id!==t||n.graph&&n.graph.goal_id!==t||n.acceptance&&n.acceptance.goal_id!==t)throw Error(`Review source does not match the selected Goal`);return n}async function zx(e,t){let n=new URLSearchParams({goal_id:e}),r=await fetch(`/api/chat/delivery-review?${n}`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Review unavailable (${r.status})`);return Rx(await r.json(),e)}function Bx(e,t,n,r){let i=new Set([r]);for(let t of e.edges)t.from_node_id===r&&i.add(t.to_node_id),t.to_node_id===r&&i.add(t.from_node_id);let a=t.trim().toLocaleLowerCase();return e.nodes.filter(e=>{let t=[e.title,e.owner_agent,e.actor_agent,e.from_agent,e.to_agent,...Object.values(e.refs).flat()].some(e=>e?.toLocaleLowerCase().includes(a)),r=n===`all`||n===`related`&&i.has(e.node_id)||n===`conditions`&&[`gate`,`gate_summary`,`lease`].includes(e.kind)||n===`evidence`&&[`evidence`,`validation`,`repair`,`handoff`].includes(e.kind);return t&&r})}function Vx(e){let t=e.limits;return t.topology_complete!==!0||t.source_truncated===!0||t.predecessor_truncated===!0||(t.missing_predecessor_count??0)>0||t.user_gate_truncated_count>0}function Hx(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function Ux(e,t){let n=e=>String(e??t.unavailable).replace(/[\\`*_{}[\]<>|#]/g,`\\$&`).replace(/[\r\n]+/g,` `),r=[`# ${t.title}`,``,`Goal: ${n(e.goal_id)}`,`${t.observed}: ${n(e.observed_at)}`,``,t.scope,``,t.acceptanceBoundary,``,`## ${t.chain}`,``],i=e.graph;if(!i)r.push(t.noGraph);else{Vx(i)&&r.push(t.incomplete,``),r.push("```json",JSON.stringify(i.limits,null,2),"```",``);for(let e of i.nodes)r.push(`- ${n(e.title)} · ${t.kind[e.kind]} · ${t.state[e.state]}${e.owner_agent?` · ${n(e.owner_agent)}`:``}`,` ${t.refs}: ${n(e.node_id)}; ${n(JSON.stringify(e.refs))}`),(e.from_agent||e.to_agent)&&r.push(` ${n(e.from_agent)} → ${n(e.to_agent)}`),e.actor_agent&&r.push(` actor: ${n(e.actor_agent)}`);let e=new Map(i.nodes.map(e=>[e.node_id,e.title]));r.push(``,`## ${t.relations}`,``);for(let a of i.edges)r.push(`- ${n(e.get(a.from_node_id))} → ${t.relation[a.relation]} → ${n(e.get(a.to_node_id))}: ${n(a.reason)} (${n(a.edge_id)})`,` ${t.refs}: ${n(JSON.stringify(a.refs??{}))}`)}r.push(``,`## ${t.acceptance}`,``);let a=e.acceptance;if(!a)r.push(t.unavailable);else{let e=a.coverage===`partial`;r.push(`${t.required}: ${e?a.acceptance_gaps.length:t.unavailable}`,`${t.guards}: ${e?a.guards.length:t.unavailable}`,``);for(let e of a.acceptance_gaps)r.push(`### ${n(e.evidence_required)}`,``,`${t.owner}: ${n(e.owner)}`,`${t.reason}: ${n(e.reason)}`,`${t.observed}: ${n(e.observed_at)}`,`${t.refs}: ${n(e.source)}`),e.resolution_hint&&r.push(n(e.resolution_hint)),e.component_checks&&r.push(`${t.checks}:`,"```json",JSON.stringify(e.component_checks,null,2),"```"),r.push(``);r.push(`### ${t.guards}`,``);for(let e of a.guards)r.push(`- ${n(e.reason)}`,` ${t.owner}: ${n(e.owner)}; ${t.required}: ${n(e.evidence_required)}`,` ${t.refs}: ${n(e.todo_id)}; ${n(e.blocks_agent)}; ${n(e.decision_scope)}`);r.push(``,`### ${t.historical}`,``);for(let e of a.historical_progress)r.push(`- ${n(e.kind)} · ${n(e.observed_at)} · ${n(e.source)} · ${n(e.evidence_refs.join(`, `))}`);r.push(``,`${t.observedScope}: ${n(a.coverage)}; truncated=${a.truncated}`,`${t.missingSources}: ${n(a.missing_sources.join(`, `))}`,`${t.next}: ${n(a.next_action)} (${n(a.next_action_source)})`)}let o=a?.goal_acceptance_contract;if(o?.enabled===!0){let i=t.contract;r.push(``,`## ${i.title}`,``,i.boundary,`${i.source}: ${n(e.goal_id)}`,`${i.revision}: ${o.revision}`,`${i.digest}: ${n(o.digest)}`,``,`### ${i.objective}`,n(o.objective||i.unknown),``,`### ${i.criteria}`),o.non_goals.length&&r.push(`${i.nonGoals}: ${n(o.non_goals.join(`; `))}`),o.criteria.length||r.push(i.noCriteria);for(let e of o.criteria)r.push(`- ${n(e.id)}: ${n(e.description)}`);r.push(``,`### ${i.tasks}`),o.tasks.length||r.push(i.noTasks);for(let e of o.tasks)r.push(`- ${n(e.todo_id)}: ${i.taskState[e.state]}`,` ${i.criteria}: ${n(e.criterion_ids.join(`, `)||i.unknown)}`),e.reason&&r.push(` ${n(e.reason)}`),e.applicable===!1&&r.push(` ${i.notApplicable}`);r.push(``,`### ${i.verification}`,i.verificationState[o.status]),o.held_todo_ids.length&&r.push(`${i.heldTasks}: ${n(o.held_todo_ids.join(`, `))}`),r.push(``,`### ${i.receipt}`);let a=o.verification;if(!a)r.push(i.unknown);else{r.push(i.receiptNote,`${i.operation}: ${n(a.operation_id)}`,`${i.revision}: ${a.contract_revision}`,`${i.digest}: ${n(a.contract_digest)}`,`${i.verificationScope}: ${n(a.todo_id??i.allCriteria)}`);for(let e of a.results)r.push(`- ${n(e.criterion_id)}: ${e.passed?i.passed:i.failed}; ${i.exitCode}: ${e.exit_code??i.unknown}`)}}return r.join(` +`)};S.current=r,_(!0),y(``);try{let t=await Sg(e,r.text,`inbox`,r.id);x({id:r.id,status:t.status})}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}let E=b?i.find(e=>e.client_ingress_id===b.id)?.status??b.status:``,D=E===`pending`?n?`已进入协调员收件箱,等待读取`:`In the coordinator inbox; awaiting read`:E===`delivered`?n?`已交给协调员;尚无应用回执`:`Delivered to coordinator; application not confirmed`:n?`投递状态待核实`:`Delivery requires reconciliation`;return(0,z.jsxs)(`section`,{className:`goal-team-evidence`,"aria-label":n?`执行证据`:`Execution evidence`,"aria-busy":u,children:[(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`h3`,{children:n?`执行证据`:`Execution evidence`}),(0,z.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void w(),children:n?`重新读取证据`:`Recheck evidence`})]}),u?(0,z.jsx)(`p`,{role:`status`,children:n?`正在核验绑定、验收与文件…`:`Checking bindings, acceptance and files…`}):null,f?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`无法核验,已清除上次证据。`:`Cannot verify; previous evidence cleared.`,` `,f]}):null,o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{role:`status`,children:[(0,z.jsxs)(`strong`,{children:[o.agent_id,` · `,vg(o,n)]}),` · `,c]}),(0,z.jsx)(`p`,{children:n?`按需读取的当前观察,不是持续在线状态;验收不代表协调员已采用。`:`An on-demand observation, not continuous liveness; acceptance does not establish coordinator adoption.`}),(0,z.jsx)(Ob,{sessionId:e,result:o,zh:n}),(0,z.jsx)(mb,{result:o,zh:n,onInspect:a}),o.error?(0,z.jsx)(`p`,{role:`alert`,children:o.error}):null,o.status===`accepted`&&!o.error&&!o.recovery_required&&o.artifacts?.length?o.artifacts.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(Db,{artifact:e,zh:n}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`版本与来源标识`:`Version and source identifiers`}),(0,z.jsx)(`code`,{children:t}),(0,z.jsx)(`code`,{children:o.request_id}),(0,z.jsx)(`code`,{children:o.todo_id})]})]},`${e.ref}:${e.sha256}`)):(0,z.jsx)(`p`,{children:n?`本次读取没有可展示的已验收产物。`:`No accepted artifact is available in this readback.`}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),T()},children:[(0,z.jsxs)(`label`,{children:[n?`向协调员反馈此执行`:`Send feedback about this execution`,(0,z.jsx)(`textarea`,{value:m,maxLength:6e3,rows:3,disabled:!!S.current,onChange:e=>h(e.target.value)})]}),(0,z.jsx)(`p`,{children:n?`附上执行标识及当前产物版本,交给原协调员收件箱;不会直接改写任务或中断成员。`:`Includes the operation and observed artifact versions in the original coordinator inbox; does not change tasks or interrupt members.`}),r?null:(0,z.jsx)(`p`,{children:n?`协调员未在执行或当前观察不可用;恢复执行后可发送。`:`Coordinator inactive or observation unavailable; resume execution to send.`}),(0,z.jsx)(`button`,{type:`submit`,disabled:!r||g||!!b||!m.trim(),children:g?n?`正在投递…`:`Sending…`:v?n?`重试同一条反馈`:`Retry this feedback`:n?`发送反馈`:`Send feedback`})]})]}):null,v?(0,z.jsxs)(`p`,{role:`alert`,children:[n?`未确认投递,请重试同一条反馈,避免重复发送。`:`Delivery not confirmed; retry the same feedback to avoid duplicates.`,` `,v]}):null,b?(0,z.jsx)(`p`,{role:`status`,children:D}):null]})}var Ab={authority_unavailable:{en:`Canonical authority unavailable`,zh:`缺少规范权限状态`},turn_blocked:{en:`Task admission blocked`,zh:`当前任务未获准执行`},acceptance_unavailable:{en:`Acceptance binding unavailable`,zh:`缺少有效验收绑定`},runtime_unavailable:{en:`Runtime unavailable`,zh:`运行时不可用`},runtime_unverified:{en:`Runtime availability unverified`,zh:`运行时可用性尚未验证`},launchable:{en:`Local launch prerequisites met`,zh:`本机启动条件已满足`}};function jb({check:e,zh:t}){let n=e.executor?[e.executor.host,e.executor.reason].filter(Boolean).join(` · `):e.authority_reason,r=e.state===`authority_unavailable`?t?`未检查或启动执行器`:`No executor was inspected or launched`:t?`不代表正在执行`:`Does not mean executing`,i=e.authority_next_action===`preview_reviewed_goal_authority_promotion`?t?`下一步:预览整 Goal 协调 Authority 晋级`:`Next: preview whole-Goal coordination-authority promotion`:e.authority_next_action===`repair_canonical_authority`?t?`下一步:修复规范 Authority 读回`:`Next: repair canonical authority readback`:null;return(0,z.jsxs)(`p`,{role:`status`,children:[t?Ab[e.state].zh:Ab[e.state].en,n?` · ${n}`:``,i?` · ${i}`:``,` · ${r}`]})}function Mb({sessionId:e,members:t,zh:n,canMessage:r,ingress:i}){let[a,o]=(0,R.useState)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)({}),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(``),v=(0,R.useRef)(0);(0,R.useEffect)(()=>{(a?s.current:l.current)?.focus()},[a]),(0,R.useEffect)(()=>(v.current++,d(null),p({}),_(``),h(!1),y(),()=>{v.current++}),[e]);async function y(t){let n=++v.current;h(!0),_(``),d(null),o(null);try{let r=await yg(e,t);n===v.current&&d(r)}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}async function b(t){let n=++v.current;h(!0),_(``),p(e=>{let n={...e};return delete n[t],n});try{let r=await bg(e,t);n===v.current&&p(e=>({...e,[t]:r}))}catch(e){n===v.current&&_(e instanceof Error?e.message:String(e))}finally{n===v.current&&h(!1)}}return a?(0,z.jsxs)(`div`,{className:`goal-team-work`,children:[(0,z.jsx)(`button`,{ref:s,type:`button`,onClick:()=>o(null),children:n?`返回执行列表`:`Back to executions`}),(0,z.jsx)(kb,{sessionId:e,operationId:a,zh:n,canMessage:r,ingress:i,onInspect:o},`${e}:${a}`)]}):(0,z.jsx)(`div`,{className:`goal-team-work`,children:(0,z.jsxs)(`section`,{"aria-label":n?`团队执行详情`:`Team execution details`,children:[(0,z.jsx)(`p`,{children:n?`检查不会启动成员。暂停协调员后,已派发的工作仍会继续。`:`Inspection starts no members. Dispatched work continues when the coordinator is paused.`}),(0,z.jsx)(`h3`,{children:n?`已绑定成员`:`Bound members`}),(0,z.jsx)(`ul`,{className:`goal-team-bindings`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(e.id),children:n?`检查启动条件`:`Check prerequisites`})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`任务与执行配置`:`Task and execution details`}),(0,z.jsx)(`code`,{children:e.todo_id}),f[e.id]?.executor?.profile?(0,z.jsx)(`code`,{children:f[e.id]?.executor?.profile}):null]}),f[e.id]?(0,z.jsx)(jb,{check:f[e.id],zh:n}):null]},e.id))}),(0,z.jsxs)(`div`,{className:`goal-team-work-actions`,children:[(0,z.jsx)(`strong`,{children:n?`此协调身份的持久工作`:`Durable work for this coordinator`}),(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>{p({}),y()},children:n?`重新核验`:`Refresh`}),u?.has_more&&u.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void y(u.next_cursor),children:n?`下一页`:`Next page`}):null]}),m?(0,z.jsx)(`p`,{role:`status`,children:n?`正在读取当前事实…`:`Reading current facts…`}):null,g?(0,z.jsx)(`p`,{role:`alert`,children:g}):null,u?(0,z.jsxs)(z.Fragment,{children:[u.page_readback_complete?null:(0,z.jsx)(`p`,{role:`status`,children:n?`本页有无法核验的工作,请检查原请求;不要直接重新派工。`:`Some work cannot be verified. Reconcile the original request before redispatching.`}),u.items.length?null:(0,z.jsx)(`p`,{children:n?`此页没有委派记录;不代表整个团队没有工作或 Goal 已完成。`:`No records on this page; this does not establish an idle team or a completed Goal.`}),(0,z.jsx)(`ul`,{className:`goal-team-operations`,children:u.items.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`strong`,{children:[e.agent_id??(n?`记录不可读`:`Unreadable record`),` · `,vg(e,n)]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n?`执行标识`:`Execution identifier`}),(0,z.jsx)(`code`,{children:e.operation_id??e.record_id})]}),e.operation_id?(0,z.jsx)(`button`,{ref:e.operation_id===c.current?l:void 0,type:`button`,onClick:()=>{c.current=e.operation_id,o(e.operation_id)},children:n?`查看证据与反馈`:`Evidence and feedback`}):null]},e.record_id))}),(0,z.jsxs)(`p`,{children:[n?`仅限当前协调身份;分页不是团队快照。`:`Scoped to this coordinator; paging is not a team snapshot.`,u.has_more?n?` 还有下一页。`:` More pages remain.`:``]})]}):null]})})}function Nb({sessionId:e,onPrepare:t,onExecute:n,onChange:r}){let{locale:i}=Ji(),a=i===`zh-CN`,[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),u=c===`settings`,d=e=>l(e?`settings`:null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{c&&!f.current?.open?f.current?.showModal():!c&&f.current?.open&&f.current.close()},[c]);let[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)({agent_id:``,token_budget:0});(0,R.useEffect)(()=>{let t=!0,n=!1;if(s(null),r(null),g(``),v(``),d(!1),!e||e===`new-session-pending`)return;async function i(){if(!n){n=!0;try{let n=await gg(e);t&&(s(n),r(n),v(``))}catch(e){t&&v(e instanceof Error?e.message:String(e))}finally{n=!1}}}i();let a=window.setInterval(()=>{document.hidden||i()},2500);return()=>{t=!1,window.clearInterval(a)}},[e]);let x=!!(o?.enabled&&o.active_turn_id),S=o?.native.status??`absent`,C=![`absent`,`complete`].includes(S),w=!!(o?.settings.agent_id&&o.settings.token_budget&&o.settings.execution_config),T=e=>{b({agent_id:e.settings.agent_id??``,token_budget:e.settings.token_budget??0}),d(!0)},E=o?.enabled?o.recovery_required?a?`LoopX · 需要恢复连接`:`LoopX · Reconnect required`:S===`blocked`?a?`LoopX · 需要处理阻塞`:`LoopX · Blocked`:x?a?`LoopX · 正在推进`:`LoopX · Working`:S===`complete`?a?`LoopX · 本轮已结束`:`LoopX · Run finished`:[`budgetLimited`,`usageLimited`].includes(S)?a?`LoopX · 已到额度限制`:`LoopX · Usage limit`:a?`LoopX · 已暂停`:`LoopX · Paused`:a?`普通对话`:`Conversation`,D=()=>{o&&!u?T(o):d(!1)};async function O(){m(!0),g(``);try{let e=await gg(await t());s(e),r(e),T(e)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function k(t){if(e){m(!0),g(``);try{let n=await xg(e,t,t===`configure`?y:void 0);s(n),r(n),(t===`configure`||t===`exit`)&&d(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}}let A=o?.deliveries.some(e=>[`rejected`,`unavailable`].includes(e.status)),ee=o?.ingress.filter(e=>e.status!==`delivered`)??[];return(0,z.jsxs)(`section`,{className:`goal-loopx-mode`,"aria-label":a?`LoopX 运行模式`:`LoopX execution mode`,children:[(0,z.jsxs)(`div`,{className:`goal-loopx-mode-bar`,children:[(0,z.jsxs)(`span`,{className:`goal-loopx-mode-status`,"data-active":x,role:`status`,children:[(0,z.jsx)(`i`,{"aria-hidden":`true`}),E]}),(0,z.jsxs)(`div`,{className:`goal-loopx-mode-actions`,children:[w&&e?(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-team-trigger`,onClick:()=>l(`team`),"aria-haspopup":`dialog`,children:[(0,z.jsx)(hh,{size:16}),a?`团队执行情况`:`Team execution`,A?(0,z.jsx)(`span`,{className:`goal-loopx-alert-dot`,"aria-label":a?`最近回读需要核验`:`Last observations need review`}):null]}):null,(0,z.jsx)(`button`,{type:`button`,disabled:p||o?.conversation_busy||!o,onClick:D,"aria-label":a?`运行设置`:`Settings`,title:a?`运行设置与用量`:`Settings and usage`,"aria-haspopup":`dialog`,children:(0,z.jsx)(ah,{size:16})}),(0,z.jsxs)(`button`,{type:`button`,className:`goal-loopx-primary`,disabled:p||!!(o?.conversation_busy&&!x),title:x?a?`暂停协调员;已派发的成员继续执行`:`Pause coordinator; dispatched members keep working`:void 0,onClick:async()=>{if(!o){await O();return}x?k(`pause`):!w||Number(o.settings.token_budget??0)<=Number(o.native.tokensUsed??0)?D():n(C?`resume`:`start`)},children:[x?(0,z.jsx)(Jm,{size:14}):(0,z.jsx)(Ym,{size:14}),x?a?`暂停协调员`:`Pause coordinator`:o?.enabled?S===`complete`?a?`开启新一轮`:`Start new run`:a?`恢复推进`:`Continue`:a?`开启 LoopX 模式`:`Enable LoopX`]})]})]}),ee.length?(0,z.jsxs)(`p`,{role:`status`,children:[a?`待处理消息:`:`Pending messages: `,ee.map(e=>`${e.mode===`loopx_queue`?`queue`:`inbox`} · ${e.status}`).join(` / `)]}):null,A?(0,z.jsx)(`button`,{className:`goal-loopx-review-notice`,type:`button`,onClick:()=>l(`team`),children:a?`最近成员回读有未通过或无法核验的结果 · 查看团队`:`Last member observations include rejected or unverified results · View team`}):null,(h||_)&&!c?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,(0,z.jsx)(`dialog`,{className:`goal-loopx-dialog`,ref:f,"aria-labelledby":`goal-loopx-dialog-title`,onClose:()=>l(null),onClick:e=>{e.target===e.currentTarget&&l(null)},children:c?(0,z.jsxs)(`div`,{className:`goal-loopx-dialog-content`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h2`,{id:`goal-loopx-dialog-title`,children:c===`team`?a?`团队执行情况`:`Team execution`:a?`运行设置`:`Execution settings`}),(0,z.jsx)(`button`,{type:`button`,autoFocus:!0,"aria-label":a?`关闭`:`Close`,onClick:()=>l(null),children:(0,z.jsx)(gh,{size:18})})]}),h||_?(0,z.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:h||_}):null,c===`team`&&e&&!_?(0,z.jsx)(Mb,{sessionId:e,members:o?.members??[],zh:a,canMessage:x&&!o?.paused&&!_,ingress:o?.ingress??[]},`${e}:${o?.settings.agent_id}:${o?.settings.execution_config}`):null,c===`team`?(0,z.jsxs)(`div`,{className:`goal-team-control`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:p||!x||!!_,onClick:()=>void k(`pause`),children:a?`暂停协调员`:`Pause coordinator`}),(0,z.jsxs)(`p`,{role:`status`,children:[o?.paused?x?a?`已暂停后续调度,等待当前协调轮次停止回读。`:`Further dispatch paused; awaiting coordinator turn stop readback.`:a?`协调员已暂停。`:`Coordinator paused.`:null,a?`此操作不会停止已派发成员;成员状态以上次执行回读为准。当前入口不支持停止整个团队。`:`This does not stop dispatched members; their states are last-read observations. Whole-team stop is unavailable here.`]})]}):null,u?(0,z.jsxs)(`div`,{className:`goal-loopx-mode-settings`,children:[(0,z.jsxs)(`label`,{children:[a?`已注册的协调身份`:`Registered coordinator`,(0,z.jsxs)(`select`,{value:y.agent_id,onChange:e=>b({...y,agent_id:e.target.value}),children:[(0,z.jsx)(`option`,{value:``,children:a?`选择已授权身份`:`Select authorized identity`}),o?.registered_agents.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsxs)(`label`,{children:[a?`协调员总 token 额度`:`Coordinator total token allowance`,(0,z.jsx)(`input`,{type:`number`,min:1,max:2147483647,value:y.token_budget||``,onChange:e=>b({...y,token_budget:Number(e.target.value)})})]}),(0,z.jsxs)(`label`,{children:[a?`成员执行绑定文件(Goal 配置)`:`Member execution bindings (Goal configuration)`,(0,z.jsx)(`input`,{readOnly:!0,value:o?.settings.execution_config??(a?`未配置`:`Not configured`)})]}),(0,z.jsx)(`p`,{children:a?`绑定文件由 Goal 子代理设置统一管理;额度包含协调员历史用量,成员授权不会因开启模式而扩大。`:`Manage the binding file in Goal sub-agent settings. The allowance includes coordinator history; enabling this mode does not expand member grants.`}),(0,z.jsx)(`button`,{type:`button`,disabled:p||!y.agent_id||y.token_budget<1||!o?.settings.execution_config,onClick:()=>void k(`configure`),children:a?`保存设置`:`Save settings`})]}):null,c===`settings`&&o?.enabled&&o.native.tokensUsed!==void 0?(0,z.jsxs)(`p`,{className:`goal-loopx-mode-usage`,children:[a?`协调员累计用量`:`Coordinator usage`,` `,o.native.tokensUsed.toLocaleString(),` / `,o.native.tokenBudget?.toLocaleString()??`—`,` tokens`]}):null,c===`settings`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:a?`开启后,当前协调员持续推进本 Goal。暂停仅影响协调员,已派发成员继续执行;本轮结束不等于 Goal 完成。`:`The coordinator continues this Goal. Pausing affects only the coordinator; dispatched members keep working. A finished run does not complete the Goal.`}),o?.enabled&&!x?(0,z.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void k(`exit`),children:a?`退出模式`:`Exit mode`}):null]}):null]}):null})]})}var Pb=e=>e.items.filter(e=>e.operation_id&&e.status===`accepted`&&!e.recovery_required&&e.artifacts?.length);function Fb({sessionId:e,zh:t,refreshKey:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=(0,R.useRef)(0),f=(0,R.useRef)(null),p=(0,R.useRef)(void 0),m=(0,R.useRef)(!1),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{f.current=null,p.current=void 0},[e]),(0,R.useEffect)(()=>(v(p.current),()=>{d.current++}),[e,n]),(0,R.useEffect)(()=>{a&&m.current&&(h.current?.focus(),m.current=!1)},[a]);let g=t?`产物或验收已变化,未展示旧报告。请重新选择可核验的产物。`:`Artifact or acceptance changed. Previous report cleared; select a verified artifact again.`;async function _(t,n,r){let i=await _g(e,t);if(r!==d.current)return;let a=i.artifacts??[],s=n?.ref?a.filter(e=>e.ref===n.ref):[],c=n?.ref?s.length===1&&s[0].sha256===n.sha256?s[0]:void 0:a.find(e=>Tb(e.ref))??a[0];i.operation_id!==t||i.status!==`accepted`||i.error||i.recovery_required||!c?u(g):(f.current={operationId:t,ref:c.ref,sha256:c.sha256},o({result:i,artifact:c}))}async function v(n,r=!1){let a=++d.current;r&&(f.current=null),p.current=n,m.current=!1,c(!0),u(``),i(null),o(null);try{let t=await yg(e,n);if(a!==d.current)return;i(t);let r=f.current;if(!r){let e=Pb(t)[0],n=e?.artifacts?.find(e=>Tb(e.ref))??e?.artifacts?.[0];e?.operation_id&&n&&(r={operationId:e.operation_id,...n})}r&&(f.current=r,await _(r.operationId,r,a))}catch(e){a===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{a===d.current&&c(!1)}}async function y(e,n){let r=++d.current;m.current=!0,c(!0),u(``),o(null);let i={operationId:e,...n};f.current=i;try{await _(e,i,r)}catch(e){r===d.current&&u(`${t?`无法核验,已清除上次报告。`:`Cannot verify; previous report cleared.`} ${String(e)}`)}finally{r===d.current&&c(!1)}}let b=r?Pb(r):[],x=a?.result.adoptions??[],S=x.filter(e=>e.state===`current`).length,C=x.length-S,w=S&&C?t?`部分采用可核验 · 查看后续结果与失效项`:`Some adoption is verifiable · inspect results and unavailable evidence`:S?t?`已记录采用 · 查看后续结果`:`Adoption recorded · inspect downstream results`:C?t?`采用证据无法核验 · 查看版本依据`:`Adoption evidence unavailable · inspect versions`:a?.result.dependencies?.length?t?`此结果关联来源版本 · 查看依据`:`This result references source versions · inspect evidence`:t?`尚无采用记录 · 查看验收与版本依据`:`No adoption recorded · inspect acceptance and versions`;return(0,z.jsxs)(`section`,{className:`goal-team-results`,"aria-label":t?`团队成果`:`Team results`,"aria-busy":s,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:t?`团队成果`:`Team results`}),(0,z.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>void v(p.current),children:[(0,z.jsx)(Qm,{size:14,"aria-hidden":`true`}),t?`刷新成果`:`Refresh results`]})]}),s?(0,z.jsx)(`p`,{role:`status`,children:t?`正在核验产物…`:`Verifying artifacts…`}):null,l?(0,z.jsx)(`p`,{role:`alert`,children:l}):null,r&&!r.page_readback_complete?(0,z.jsx)(`p`,{role:`status`,children:t?`部分工作无法核验,请在团队执行中检查。`:`Some work cannot be verified; inspect Team execution.`}):null,(0,z.jsxs)(`div`,{className:`goal-team-results-layout`,children:[r?(0,z.jsxs)(`nav`,{className:`goal-team-result-list`,"aria-label":t?`选择团队产物`:`Choose a team artifact`,children:[b.map(e=>{let t=e.artifacts.find(e=>Tb(e.ref))??e.artifacts[0];return(0,z.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":`${e.agent_id} · ${t.ref}`,"aria-pressed":a?.result.operation_id===e.operation_id,onClick:()=>void y(e.operation_id,t),children:[(0,z.jsx)(jm,{size:16,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.agent_id}),(0,z.jsx)(`small`,{children:t.ref})]}),(0,z.jsx)(hm,{className:`goal-team-result-check`,size:14,"aria-hidden":`true`})]},e.record_id)}),b.length?null:(0,z.jsx)(`p`,{children:t?`本页没有可读取的已验收产物。`:`No accepted artifact is available on this page.`}),r.has_more&&r.next_cursor?(0,z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>void v(r.next_cursor,!0),children:t?`下一页成果`:`Next results page`}):null]}):null,a?(0,z.jsxs)(`div`,{ref:h,tabIndex:-1,className:`goal-team-result-reader`,"aria-label":t?`当前报告`:`Current report`,children:[(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:w}),(0,z.jsx)(mb,{result:a.result,zh:t,onInspect:e=>void y(e)})]}),(0,z.jsx)(Db,{artifact:a.artifact,zh:t,heading:t?`已通过当前验收`:`Currently accepted`},`${a.result.operation_id}:${a.artifact.sha256}`),a.result.artifacts&&a.result.artifacts.length>1?(0,z.jsxs)(`label`,{children:[t?`其他产物`:`Other artifacts`,(0,z.jsx)(`select`,{value:a.artifact.ref,onChange:e=>{let t=a.result.artifacts.find(t=>t.ref===e.target.value);t&&(f.current={operationId:a.result.operation_id,ref:t.ref,sha256:t.sha256},o({...a,artifact:t}))},children:a.result.artifacts.map(e=>(0,z.jsx)(`option`,{value:e.ref,children:e.ref},e.ref))})]}):null]}):null]})]})}function Ib({attention:e,onSelect:t}){let{t:n}=Ji(),r=Zi(e.updatedAt,n);return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,z.jsx)(ym,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,z.jsx)(`strong`,{children:e.text})]}),(0,z.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,z.jsx)(_m,{size:17})]})}function Lb({onSelect:e,output:t}){let{t:n}=Ji(),r=t.kind===`report`?jm:Am;return(0,z.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,z.jsx)(r,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,z.jsx)(`strong`,{children:t.title}),t.summary?(0,z.jsx)(`span`,{children:t.summary}):null,t.report?(0,z.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,z.jsx)(`time`,{children:t.createdAt}):null,(0,z.jsx)(_m,{size:17})]})}var Rb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function zb({onSelect:e,run:t,showGoal:n=!0}){let{t:r}=Ji();return(0,z.jsxs)(`button`,{"aria-label":`${r(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,z.jsxs)(`small`,{children:[n?`${t.goalTitle} · `:``,t.agentLabel]}),(0,z.jsx)(`strong`,{children:t.title}),t.latestActivity===t.title?null:(0,z.jsx)(`small`,{children:t.latestActivity})]}),(0,z.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):null,r(Rb[t.status])]}),(0,z.jsx)(_m,{size:17})]})}function Bb({onSelect:e,schedule:t}){let{t:n}=Ji(),r=t.scheduleKind===`heartbeat`;return(0,z.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,z.jsx)(Zm,{size:17}):(0,z.jsx)(mm,{size:17})}),(0,z.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,z.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,z.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,z.jsx)(_m,{size:16})]})}function Vb({delivery:e}){let{t}=Ji();if(!e)return null;let n=e.status===`delivered`?e.verification===`reconciled_after_restart`?t(`returnDelivery.reconciled`):t(`returnDelivery.delivered`):e.status===`verification_required`?t(`returnDelivery.verifying`):e.status===`explicit_unverified`?t(`returnDelivery.unverified`):t(`returnDelivery.queued`),r=e.status===`delivered`?`delivered`:e.status===`verification_required`?`verification_required`:e.status===`explicit_unverified`?`explicit_unverified`:`queued`;return(0,z.jsx)(`small`,{className:`personal-return-delivery is-${r}`,role:`status`,children:n})}function Hb({items:e,onSelect:t,selectedGoal:n}){let{locale:r,t:i}=Ji();if(e.length===0)return(0,z.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:20})}),(0,z.jsx)(`strong`,{children:i(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,z.jsx)(`p`,{children:i(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let a=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),o=a?.kind===`message`?`${a.message.agentLabel??i(`header.manager`)}:${a.message.pending?i(`timeline.pending`):a.message.text}`:a?.kind===`proposal`?`${a.proposal.title}:${a.proposal.status}`:a?.kind===`run`?i(`timeline.runCompleted`,{run:a.run.title}):``,s=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),c=e.filter(e=>e.kind===`run`&&[`queued`,`running`,`completed`].includes(e.run.status)),l=new Set(c.map(e=>e.id)),u=e.filter(e=>e.kind!==`proposal`&&!l.has(e.id)),d=c.filter(e=>e.run.status===`running`&&!!e.run.sessionId&&!!e.run.canInterrupt).length,f=c.filter(e=>e.run.status===`queued`).length,p=c.filter(e=>e.run.status===`completed`).length,m=c.length-d-f-p,h=r===`zh-CN`?[d&&`${d} 个执行中`,f&&`${f} 个排队中`,p&&`${p} 次执行已结束`,m&&`${m} 项进展更新`].filter(Boolean).join(` · `):[d&&`${d} running`,f&&`${f} queued`,p&&`${p} runs finished`,m&&`${m} progress updates`].filter(Boolean).join(` · `),g=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function _(e){return e.kind===`attention`?(0,z.jsx)(Ib,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,z.jsx)(zb,{showGoal:!n,onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,z.jsx)(Lb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,z.jsx)(Bb,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,z.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:17})}),(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,z.jsx)(`strong`,{children:e.proposal.title}),e.proposal.impact?(0,z.jsx)(`p`,{children:e.proposal.impact}):null]}),(0,z.jsx)(`b`,{children:e.proposal.status===`gated`&&e.proposal.actionKind!==`operation.execute`?i(`timeline.review`):e.proposal.primaryLabel??i(`timeline.reviewAndConfirm`)})]},e.id):(0,z.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,z.jsx)(`span`,{className:`personal-message-avatar`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.message.role===`user`?i(`common.you`):e.message.agentLabel??i(`header.manager`)}),e.message.time?(0,z.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,z.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,z.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,z.jsx)(`p`,{children:e.message.text}):(0,z.jsx)(wb,{text:e.message.text}),e.message.pending?(0,z.jsx)(`span`,{className:`personal-message-pending`,children:i(`timeline.pending`)}):null,(0,z.jsx)(Wy,{request:e.message.collaboration}),(0,z.jsx)(Vb,{delivery:e.message.returnDelivery})]})]},e.id)}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:o}),(0,z.jsxs)(`div`,{className:`personal-channel-timeline`,children:[c.length?(0,z.jsxs)(`details`,{className:`personal-activity-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(im,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`strong`,{children:r===`zh-CN`?`执行动态`:`Execution activity`}),(0,z.jsx)(`span`,{children:h})]}),(0,z.jsx)(`div`,{children:c.map(_)})]}):null,u.map(_),s.length?(0,z.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(ch,{size:16})}),(0,z.jsx)(`strong`,{children:i(`timeline.waitingConfirmation`)}),(0,z.jsx)(`small`,{children:i(`timeline.gateHistory`,{count:s.length})})]}),(0,z.jsx)(`div`,{children:s.map(_)})]}):null,g.map(_)]})]})}function Ub({goal:e}){let{t,locale:n}=Ji(),r=n===`zh-CN`?{checkpoint_satisfied:`检查点满足`,checkpoint_fresh:`检查点有效`,path_outcome_valid:`路径决策有效`,evidence_refs_present:`证据引用齐全`,final_outcome_claim_present:`最终成果声明齐全`,no_reported_outcome_gap:`无已报告成果缺口`}:{checkpoint_satisfied:`Checkpoint satisfied`,checkpoint_fresh:`Checkpoint current`,path_outcome_valid:`Valid path decision`,evidence_refs_present:`Evidence refs present`,final_outcome_claim_present:`Final outcome claim present`,no_reported_outcome_gap:`No reported outcome gap`},i={connected:t(`acceptance.connected`),mapped:t(`acceptance.mapped`),refreshed:t(`acceptance.refreshed`),adapter_inspected:t(`acceptance.inspected`),run_recorded:t(`acceptance.recorded`),reward_judged:t(`acceptance.judged`),operator_approved:t(`acceptance.approved`),controller_ready:t(`acceptance.ready`),attention_queue:t(`acceptance.attentionSource`),agent_vision:t(`acceptance.visionSource`),todo_projection:t(`acceptance.todoSource`),current_run:t(`acceptance.runSource`)},a=e=>i[e]??t(`acceptance.unknown`),o=e.acceptanceObservation,s=e.loadState||!o||o.goal_id!==e.goalId||o.coverage===`unavailable`;return(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-acceptance`,"aria-label":t(`acceptance.title`),children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`h3`,{children:t(`acceptance.title`)}),(0,z.jsx)(`em`,{children:t(`common.readOnly`)})]}),(0,z.jsx)(`p`,{role:`status`,children:t(s?`acceptance.unavailable`:`acceptance.partial`)}),!s&&o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:t(`acceptance.gaps`)}),o.acceptance_gaps.length?o.acceptance_gaps.map((e,i)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),e.resolution_hint?(0,z.jsx)(`p`,{children:e.resolution_hint}):null,e.component_checks?(0,z.jsx)(`div`,{children:Object.entries(e.component_checks).map(([e,t])=>(0,z.jsxs)(`p`,{children:[r[e],`: `,n===`zh-CN`?t?`通过`:`未通过`:t?`Passed`:`Failed`]},e))}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.observed`)}),(0,z.jsx)(`dd`,{children:e.observed_at??t(`acceptance.unknown`)})]})]})]},`${e.kind}:${e.owner}:${i}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGaps`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.guards`)}),o.guards.length?o.guards.map((e,n)=>(0,z.jsxs)(`div`,{className:`personal-acceptance-observation`,children:[(0,z.jsx)(`p`,{children:e.reason??t(`acceptance.reasonUnknown`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.owner`)}),(0,z.jsx)(`dd`,{children:e.owner??t(`acceptance.unknown`)})]}),e.blocks_agent?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.agent`)}),(0,z.jsx)(`dd`,{children:e.blocks_agent})]}):null,e.todo_id?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`common.task`)}),(0,z.jsx)(`dd`,{children:e.todo_id})]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.required`)}),(0,z.jsx)(`dd`,{children:e.evidence_required??t(`acceptance.unknown`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`acceptance.scope`)}),(0,z.jsx)(`dd`,{children:e.decision_scope??t(`acceptance.unknown`)})]})]})]},`${e.todo_id}:${n}`)):(0,z.jsx)(`p`,{children:t(`acceptance.noGuards`)}),(0,z.jsx)(`h4`,{children:t(`acceptance.next`)}),(0,z.jsx)(`p`,{children:o.next_action??t(`acceptance.unknown`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{children:[t(`acceptance.historical_progress`),` · `,o.historical_progress.length]}),(0,z.jsx)(`p`,{children:t(`acceptance.historical`)}),o.historical_progress.map(e=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:a(e.kind)}),` · `,e.observed_at??t(`acceptance.unknown`),` `,e.evidence_refs.join(`, `)]},e.kind))]}),o.missing_sources.length?(0,z.jsxs)(`p`,{children:[t(`acceptance.missing`),` `,o.missing_sources.map(a).join(`, `)]}):null,o.truncated?(0,z.jsx)(`p`,{children:t(`acceptance.truncated`)}):null]}):null]})}function Wb({item:e,successor:t,onSelect:n}){let{t:r}=Ji(),i=e.details;return(0,z.jsxs)(`section`,{className:`personal-detail-card`,"aria-label":r(`attentionDetail.title`),children:[(0,z.jsx)(`h3`,{children:r(`attentionDetail.title`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.request`)}),(0,z.jsx)(`dd`,{children:r(i?.interaction===`decision`?`attentionDetail.decision`:`attentionDetail.unknownRequest`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`common.status`)}),(0,z.jsx)(`dd`,{children:r(`attentionDetail.${i?.lifecycle??`unknown`}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.reason`)}),(0,z.jsx)(`dd`,{children:i?.reason??e.explanation??r(`attentionDetail.unknownReason`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Todo`}),(0,z.jsx)(`dd`,{children:e.todoId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetTodo`)}),(0,z.jsx)(`dd`,{children:i?.unblocksTodoId??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.targetAgent`)}),(0,z.jsx)(`dd`,{children:i?.blocksAgent??r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`attentionDetail.scope`)}),(0,z.jsx)(`dd`,{children:i?.decisionScope?`${i.decisionScope.kind} · ${i.decisionScope.granularity} · ${i.decisionScope.scopeKey}`:r(`attentionDetail.notProvided`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:r(`drawer.evidence`)}),(0,z.jsx)(`dd`,{children:i?.evidence??e.evidence??r(`drawer.decisionDefaultEvidence`)})]})]}),i?.supersededBy?(0,z.jsxs)(`p`,{children:[r(`attentionDetail.replacement`),`: `,i.supersededBy]}):null,t&&n?(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>n(t),type:`button`,children:r(`attentionDetail.openReplacement`)}):null,(0,z.jsx)(`p`,{children:r(`attentionDetail.boundary`)})]})}function Gb({proposal:e,t}){let n=e.teamPlanOutcome?.kind===`already_present`;return(0,z.jsxs)(`section`,{className:`personal-proposal-card personal-team-plan-result`,children:[(0,z.jsx)(`h3`,{children:db(e.teamPlanOutcome??null,t)}),(0,z.jsxs)(`dl`,{className:`personal-team-plan-assignments`,children:[e.teamPlanAssignments?.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsx)(`dd`,{children:e.task})]},e.laneId)),e.teamPlanGapLanes?.map(e=>(0,z.jsxs)(`div`,{className:`is-pending`,children:[(0,z.jsx)(`dt`,{children:e.agentId||e.laneId}),(0,z.jsxs)(`dd`,{children:[e.task||e.laneId,(0,z.jsx)(`br`,{}),(0,z.jsxs)(`small`,{children:[t(`proposal.teamPlan.pending`),` · `,lb(e.reasonCode,t)]})]})]},e.laneId))]}),(0,z.jsx)(`p`,{children:t(n?`proposal.teamPlan.recoveredHint`:`proposal.teamPlan.assignedHint`)}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t(`proposal.teamPlan.originalPlan`)}),(0,z.jsx)(`dl`,{children:e.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]})]})}function Kb(e){return e.replace(/\s+/gu,` `).trim()}function qb(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function Jb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function Yb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function Xb(e){return Kb(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63}|resume_at:[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}t[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?(?:z|[+-][0-9]{2}:[0-9]{2}))(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function Zb(e,t){let n=Kb(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!qb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!qb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!qb(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!qb(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!qb(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&Yb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!qb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!qb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!qb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!qb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?Xb(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&Jb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}function Qb(e,t,n){if(!e)return{};if(!t.trim())return{modelConfig:null};let r={model:t.trim()};return n&&(r.reasoning_effort=n),{modelConfig:r}}var $b=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),ex=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],tx=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],nx=Array.from({length:32},(e,t)=>t+1),rx=/^[a-z][a-z0-9_.-]{0,63}$/u;function ix(e){let t=String(e??``).trim().toLowerCase();return rx.test(t)?t:null}function ax(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&JSON.stringify(e.modelConfig??null)===JSON.stringify(t.modelConfig??null)&&(e.executionConfig??``)===(t.executionConfig??``)&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function ox({agents:e,attentionHistory:t=[],onSelectAttention:n,callbacks:r,goalNotifications:i=[],goals:a=[],inspectorExpanded:o=!1,larkConnections:s=[],onClose:c,onToggleInspectorSize:l,readOnly:u=!1,runs:d=[],selection:f}){let{locale:p,t:m}=Ji(),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(`idle`),[x,S]=(0,R.useState)(`record`),[C,w]=(0,R.useState)([]),[T,E]=(0,R.useState)(null),[D,O]=(0,R.useState)(2),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(``),[M,te]=(0,R.useState)(``),[ne,N]=(0,R.useState)(`idle`),[P,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(null),F=(0,R.useRef)(null),oe=(0,R.useRef)(null),[I,se]=(0,R.useState)(e.find(e=>e.available)?.agentId??`codex`),[L,ce]=(0,R.useState)(``),[le,ue]=(0,R.useState)(``),de=(0,R.useRef)(null),fe=(0,R.useRef)(null),pe=(0,R.useRef)(null),me=(0,R.useRef)(null),he=f.kind===`run`?`run:${f.item.runId}`:f.kind===`proposal`?`proposal:${f.item.previewId}`:f.kind===`todo`?`todo:${f.item.todoId}`:f.kind===`attention`?`attention:${f.item.todoId}`:f.kind===`output`?`output:${f.item.outputId}`:f.kind===`schedule`?`schedule:${f.item.scheduleId}`:`goal:${f.item.goalId}`;(0,R.useEffect)(()=>{b(`idle`),v(!1),S(`record`),ue(``);let e=f.kind===`goal`?f.item.subagentExecution:void 0;w(e?.allowedDomains??[]),A(e?.modelConfig?.model??``),j(e?.modelConfig?.reasoning_effort??``),te(e?.executionConfig??``),O(e?.maxChildren?Math.min(e.maxChildren,32):2),E(null),N(`idle`),re(null),ae(null),F.current=e??null,oe.current=null},[he]);let ge=f.kind===`goal`?f.item.subagentExecution:void 0;(0,R.useEffect)(()=>{let e=F.current,t=ge?!e||!ax(e,ge):e!==null;if(F.current=ge??null,!ie){t&&ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2),E(null),N(`idle`),re(null));return}let n=oe.current;(!ge||ax(ie,ge)||n&&!ax(n,ge))&&(ge&&(w(ge.allowedDomains),A(ge.modelConfig?.model??``),j(ge.modelConfig?.reasoning_effort??``),te(ge.executionConfig??``),O(ge.maxChildren||2)),oe.current=null,ae(null))},[ge,ie]),(0,R.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!fe.current?.contains(e)&&(pe.current=e);let t=window.requestAnimationFrame(()=>me.current?.focus());return()=>window.cancelAnimationFrame(t)},[he]);let _e=(0,R.useCallback)(()=>{let e=pe.current;c(),window.requestAnimationFrame(()=>e?.focus())},[c]);(0,R.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),_e();return}if(e.key===`Tab`&&f.kind!==`todo`){let t=Array.from(fe.current?.querySelectorAll($b)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[_e,f.kind]);let ve=f.kind===`attention`?m(`drawer.titleAttention`):f.kind===`todo`?m(`drawer.taskDetails`):f.kind===`run`?m(`drawer.runDetails`):f.kind===`output`?m(`drawer.titleOutput`):f.kind===`proposal`&&f.item.actionKind===`team.plan`&&f.item.status===`applied`?m(`proposal.teamPlan.resultTitle`):f.kind===`proposal`?m(f.item.reviewPlan?.retryOriginal?`drawer.recoverEditResult`:f.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):f.kind===`schedule`?f.item.scheduleKind===`heartbeat`?`Heartbeat`:m(`drawer.titleSchedule`):m(`drawer.goalDetails`),ye=f.kind===`proposal`?f.item.goalId??`manager`:f.item.goalId,be=f.kind===`attention`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`todo`||f.kind===`run`?f.item.goalTitle:f.kind===`output`?f.item.goalTitle??m(`drawer.currentGoal`):f.kind===`goal`?f.item.title:f.kind===`schedule`?m(`drawer.goalAutoRun`):f.kind===`proposal`&&f.item.status===`applied`&&f.item.actionKind===`team.plan`?f.item.goalId??m(`drawer.currentGoal`):f.item.goalId?m(`drawer.goalChanges`):m(`drawer.managerChanges`),xe=f.kind===`goal`?d.find(e=>e.goalId===f.item.goalId&&!!e.sessionId)??d.find(e=>e.goalId===f.item.goalId):null,Se=f.kind===`run`&&(f.item.completedSteps>0||!!f.item.latestActivity||!!f.item.outputs?.length),Ce=f.kind===`attention`?Zi(f.item.updatedAt,m):null,we=Xb(le);async function Te(){f.kind!==`run`||!h.trim()||(await r.onCorrectRun?.(f.item,h.trim()),g(``))}async function Ee(e,t,n,i){if(t===`successor_create`){await r.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:m(`drawer.taskSuccessorText`,{task:e.text})},summary:m(`drawer.taskSuccessorSummary`,{task:e.text})});return}await r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??I,goal_id:e.goalId,operation:t,...t===`block`?{note:m(`drawer.taskSuccessorNote`)}:{},...t===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${n}:${e.text}`})}async function De(e,t,n){u||!of(e)||await r.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${t}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:t,todo_id:e.todoId},summary:`${n}:${e.text}`})}let Oe=f.kind===`goal`?ie??f.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},ke=ne===`previewing`||ne===`applying`,Ae=(()=>{if(f.kind!==`goal`)return[];let e=new Map;for(let t of Oe.allowedDomains){let n=ix(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(Oe.domainCandidates)for(let t of Oe.domainCandidates){let n=ix(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of f.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=ix(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function je(){w(Oe.allowedDomains),A(Oe.modelConfig?.model??``),j(Oe.modelConfig?.reasoning_effort??``),te(Oe.executionConfig??``),O(Oe.maxChildren||2),E(null),N(`idle`),re(null)}function Me(){let e=[...new Set(C.map(e=>ix(e)))];return e.every(e=>!!e)?e:null}function Ne(e,t){w(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),re(null),N(`idle`),E(null)}async function Pe(e,t=e){if(f.kind!==`goal`||!r.onPreviewGoalSubagentConfiguration)return;let n=e?Me():[];if(t&&!k.trim()&&ee){N(`error`),E(m(`drawer.subagentModelRequired`));return}if(e&&!n){N(`error`),E(m(`drawer.subagentDomainInvalid`)),re(null);return}let i={alignCodexHostCapacity:e,allowedDomains:n??[],enabled:e,goalId:f.item.goalId,maxChildren:e?D:0,executionConfig:M.trim(),...Qb(t,k,ee)};N(`previewing`),E(m(`drawer.subagentPreviewing`)),re(null);try{let e=await r.onPreviewGoalSubagentConfiguration(i);if(!e.changed){oe.current=ge??null,ae({...e.configuration,domainCandidates:Oe.domainCandidates}),w(e.configuration.allowedDomains),A(e.configuration.modelConfig?.model??``),j(e.configuration.modelConfig?.reasoning_effort??``),te(e.configuration.executionConfig??``),O(e.configuration.maxChildren||2),N(`success`),E(m(`drawer.subagentNoChange`));return}re({...i,codexHostCapacity:e.configuration.codexHostCapacity,changed:e.changed,previewId:e.previewId}),N(`ready`),E(m(`drawer.subagentPreviewReady`))}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentPreviewFailed`))}}async function Fe(){if(!(!P||!r.onApplyGoalSubagentConfiguration)){N(`applying`),E(m(`drawer.subagentApplying`));try{let e=await r.onApplyGoalSubagentConfiguration({allowedDomains:P.allowedDomains,alignCodexHostCapacity:P.enabled,enabled:P.enabled,goalId:P.goalId,maxChildren:P.maxChildren,modelConfig:P.modelConfig,executionConfig:P.executionConfig,previewId:P.previewId});oe.current=ge??null,ae({...e,domainCandidates:Oe.domainCandidates}),w(e.allowedDomains),A(e.modelConfig?.model??``),j(e.modelConfig?.reasoning_effort??``),te(e.executionConfig??``),O(e.maxChildren||2),N(`success`),E(m(e.codexHostCapacity?.newSessionRequired?`drawer.subagentAppliedRestart`:`drawer.subagentApplied`)),re(null);try{await r.onRefresh?.()}catch{N(`warning`),E(m(`drawer.subagentAppliedRefreshFailed`))}}catch(e){N(`error`),E(e instanceof Error?e.message:m(`drawer.subagentApplyFailed`))}}}return(0,z.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":f.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":f.kind,ref:fe,role:`dialog`,children:[(0,z.jsxs)(`header`,{className:`personal-drawer-header${f.kind===`todo`?` is-task-inspector`:``}`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{id:`personal-drawer-title`,ref:me,tabIndex:-1,children:ve}),(0,z.jsx)(`p`,{children:be})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[f.kind===`todo`&&l?(0,z.jsx)(`button`,{"aria-label":m(o?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:l,title:m(o?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:o?(0,z.jsx)(Wm,{size:17}):(0,z.jsx)(Bm,{size:17})}):null,(0,z.jsxs)(`button`,{"aria-label":m(`drawer.closeDetail`,{context:be}),className:`personal-icon-button personal-drawer-close`,onClick:_e,ref:de,type:`button`,children:[(0,z.jsx)(om,{className:`personal-mobile-back`,size:18}),(0,z.jsx)(gh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,z.jsxs)(`div`,{className:`personal-drawer-body`,children:[f.kind===`attention`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,z.jsx)(`small`,{children:f.item.blocking?m(`drawer.attentionBlocking`):m(`drawer.attentionWaiting`)}),(0,z.jsx)(`h3`,{children:f.item.text}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??`medium`})]}),Ce?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.waiting`)}),(0,z.jsx)(`dd`,{children:m(`tasks.waitingAge`,{age:Ce})})]}):null]})]}),(0,z.jsx)(Wb,{item:f.item,onSelect:n,successor:af(f.item,t)}),!u&&of(f.item)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void De(f.item,`approve`,m(`common.confirm`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.decisionReview`)]}),(0,z.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.decisionMore`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{onClick:()=>void r.onExplainDecision?.(f.item),type:`button`,children:[(0,z.jsx)(Hm,{size:16}),m(`drawer.explainDecision`)]}),tx.map(e=>(0,z.jsx)(`button`,{onClick:()=>void De(f.item,e.resolution,m(e.key)),type:`button`,children:m(e.key)},e.resolution))]})]})]}):null]}):null,f.kind===`todo`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,z.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,z.jsxs)(`span`,{className:f.item.done?`is-done`:f.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,z.jsx)(`i`,{}),f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)]}),f.item.priority?(0,z.jsx)(`span`,{children:f.item.priority}):null,(0,z.jsx)(`span`,{children:f.item.taskClass===`advancement_task`?m(`drawer.taskAdvancement`):f.item.taskClass??m(`drawer.taskOrdinary`)})]}),(0,z.jsx)(`h3`,{children:f.item.text})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,z.jsx)(`h4`,{children:m(`drawer.taskInfo`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.owner`)}),(0,z.jsx)(`dd`,{children:f.item.ownerLabel??f.item.claimedBy??m(`drawer.notAssigned`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`common.status`)}),(0,z.jsx)(`dd`,{children:f.item.done?m(`drawer.taskStatusCompleted`):f.item.status===`deferred`?m(`drawer.taskStatusDeferred`):f.item.status===`blocked`?m(`drawer.taskStatusBlocked`):m(`drawer.taskStatusOpen`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.priority`)}),(0,z.jsx)(`dd`,{children:f.item.priority??m(`drawer.notSet`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.dependencies`)}),(0,z.jsx)(`dd`,{children:f.item.dependencies?.join(` · `)||m(`common.none`)})]}),f.item.status===`deferred`||f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeWhen`)}),(0,z.jsx)(`dd`,{children:f.item.resumeWhen||m(`drawer.notSet`)})]}):null,f.item.resumeWhen?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeState`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReady?m(`drawer.resumeReady`):m(`drawer.resumePending`)})]}):null,f.item.resumeReceiptId?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.resumeReceipt`)}),(0,z.jsx)(`dd`,{children:f.item.resumeReceiptId})]}):null,f.item.validationDigest?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevision`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevision??0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationDigest`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:f.item.validationDigest})})]}),f.item.validationRevisionActor?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.validationRevisionActor`)}),(0,z.jsx)(`dd`,{children:f.item.validationRevisionActor})]}):null]}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.nextTransition`)}),(0,z.jsx)(`dd`,{children:f.item.nextTransition??(f.item.done?m(`drawer.taskNextCompleted`):f.item.resumeReady?m(`drawer.taskNextResumeReady`):f.item.status===`deferred`?m(`drawer.taskNextDeferred`):m(`drawer.taskNextOpen`))})]})]})]}),!u&&!f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":m(`drawer.taskActions`),children:[(0,z.jsxs)(`details`,{className:`personal-task-management`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:16}),m(`drawer.taskManage`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.reassign`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.reassign`),(0,z.jsx)(`select`,{"aria-label":m(`drawer.reassign`),onChange:e=>se(e.target.value),value:I,children:e.filter(e=>e.available).map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-reassign-${I}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:I,goal_id:f.item.goalId,operation:`reassign`,todo_id:f.item.todoId},summary:m(`drawer.reassignSummary`,{task:f.item.text})}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[m(`drawer.taskPriority`),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.taskPriority`),value:L,onChange:e=>ce(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.taskPriorityChoose`)}),[`P0`,`P1`,`P2`,`P3`,`P4`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e)),(0,z.jsx)(`option`,{value:`clear`,children:m(`drawer.taskPriorityClear`)})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!L,onClick:()=>void r.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:f.item.goalId,kind:`todo`,todo_id:f.item.todoId},idempotencyKey:`workspace-todo-${f.item.todoId}-priority-${L}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:f.item.goalId,todo_id:f.item.todoId,operation:`edit`,...L===`clear`?{clear_priority:!0}:{priority:L}},summary:`${m(`drawer.taskPriority`)}: ${L===`clear`?m(`drawer.taskPriorityClear`):L}`}),type:`button`,children:m(`timeline.review`)})]}),(0,z.jsx)(`strong`,{children:m(`drawer.taskDeferUntil`)}),(0,z.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[m(`drawer.taskDeferUntil`),(0,z.jsx)(`input`,{"aria-label":m(`drawer.taskDeferCondition`),"aria-invalid":!!le.trim()&&!we,onChange:e=>ue(e.target.value),placeholder:m(`drawer.taskDeferPlaceholder`),value:le}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:!we,onClick:()=>void Ee(f.item,`defer`,m(`drawer.taskDefer`),we??void 0),type:`button`,children:m(`drawer.taskDeferReview`)}),(0,z.jsx)(`small`,{children:le.trim()&&!we?m(`drawer.taskDeferInvalid`):m(`drawer.taskDeferSupported`)})]}),(0,z.jsx)(`div`,{className:`personal-task-management-secondary`,children:ex.map(e=>(0,z.jsx)(`button`,{onClick:()=>void Ee(f.item,e.operation,m(e.key)),type:`button`,children:m(e.key)},e.operation))})]})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void Ee(f.item,`complete`,m(`drawer.taskComplete`)),type:`button`,children:[(0,z.jsx)(hm,{size:17}),m(`drawer.taskComplete`)]})]}):null,f.item.done?(0,z.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,z.jsx)(hm,{size:16}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.taskCompletedTitle`)}),(0,z.jsx)(`small`,{children:m(`drawer.taskCompletedNote`)})]})]}):null]}):null,f.kind===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:Yi(f.item.state,p)}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.agentSentence}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.tokens`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.tokens24h,m(`drawer.usageNotMeasured`),Yd),` / `,Qd(f.item.usage?.tokens7d,m(`drawer.usageNotMeasured`),Yd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.cost`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.costUsd24h,m(`drawer.usageNotMeasured`),Xd),` / `,Qd(f.item.usage?.costUsd7d,m(`drawer.usageNotMeasured`),Xd)]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.duration`)}),(0,z.jsxs)(`dd`,{children:[Qd(f.item.usage?.durationMs24h,m(`drawer.usageNotMeasured`),Zd),` / `,Qd(f.item.usage?.durationMs7d,m(`drawer.usageNotMeasured`),Zd)]})]})]})]}),(0,z.jsx)(Ub,{goal:f.item}),(()=>{let e=i.find(e=>e.goalId===f.item.goalId),t=s.find(e=>e.goal_id===f.item.goalId);return(0,z.jsxs)(z.Fragment,{children:[f.item.repository?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,z.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,z.jsx)(`small`,{children:m(`drawer.repository`)}),(0,z.jsx)(`em`,{children:m(`common.readOnly`)})]}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(Mm,{size:16}),f.item.repository.label]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.branch`)}),(0,z.jsx)(`dd`,{children:f.item.repository.branch||`detached`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Role`}),(0,z.jsx)(`dd`,{children:m(`drawer.repositoryRole`)})]})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(f.item.repository?.identity??``);if(!e){b(`error`);return}e.then(()=>b(`copied`)).catch(()=>b(`error`))},type:`button`,children:[(0,z.jsx)(Cm,{size:15}),m(y===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),y===`error`?(0,z.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:m(`drawer.copyRepositoryError`)}):y===`copied`?(0,z.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:m(`drawer.copyRepositorySuccess`)}):null]}):null,u?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),(0,z.jsx)(`h3`,{children:m(`drawer.remoteDetailsUnavailable`)}),(0,z.jsx)(`p`,{children:m(`drawer.remoteDetailsDescription`)})]}):(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,z.jsx)(`small`,{children:m(`drawer.larkConnection`)}),t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`h3`,{children:[t.app_label,(0,z.jsx)(`span`,{className:`personal-connection-status`,children:m(`drawer.connected`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.group`)}),(0,z.jsx)(`dd`,{children:t.chat_name})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.topic`)}),(0,z.jsxs)(`dd`,{children:[`# `,t.topic_name]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.trigger`)}),(0,z.jsx)(`dd`,{children:t.incoming_mode===`mentions`?m(`lark.someoneMentions`):m(`lark.allMessages`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.replyMode`)}),(0,z.jsx)(`dd`,{children:m(`lark.topicReply`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.autoNotify`)}),(0,z.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?m(`common.on`):m(`common.off`)})]}),e?.lastNotifiedAt?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.lastNotification`)}),(0,z.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.larkNotConfigured`)}),(0,z.jsx)(`p`,{children:m(`drawer.larkNotConfiguredDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onOpenNotificationSettings?.(f.item.goalId),type:`button`,children:[(0,z.jsx)(dm,{size:16}),m(t?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,z.jsx)(`small`,{children:m(`drawer.runDetails`)}),xe?.sessionId?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:Xi(xe.sessionStatus??xe.status,m)}),(0,z.jsx)(`p`,{children:xe.title}),r.onOpenRunSession?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onOpenRunSession?.(xe),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runLatest`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:m(`drawer.noRun`)}),(0,z.jsx)(`p`,{children:m(`drawer.noRunDescription`)})]})]}),u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`heartbeat`,f.item.goalId),type:`button`,children:[(0,z.jsx)(Zm,{size:16}),m(`drawer.setupHeartbeat`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>r.onRequestScheduleConfig?.(`monitor`,f.item.goalId),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleAdd`)]})]}),f.item.subagentExecution?(0,z.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,z.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:m(`drawer.subagentLabel`)}),(0,z.jsxs)(`h3`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.subagentTitle`)]})]}),(0,z.jsxs)(`button`,{"aria-checked":Oe.enabled,"aria-label":m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":P&&ne===`ready`?`true`:void 0,disabled:u||ke||!!P||!r.onPreviewGoalSubagentConfiguration,onClick:()=>void Pe(!Oe.enabled),role:`switch`,type:`button`,children:[(0,z.jsx)(`span`,{}),m(P&&ne===`ready`?`drawer.subagentPending`:Oe.enabled?`common.on`:`common.off`)]})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentDescription`)}),P&&ne===`ready`?(0,z.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,z.jsx)(`strong`,{children:m(P.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,z.jsx)(`p`,{children:P.enabled?m(`drawer.subagentPreviewSummary`,{count:P.maxChildren,domains:P.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)}):m(`drawer.subagentDisableSummary`)}),P.modelConfig===void 0?null:(0,z.jsxs)(`p`,{children:[m(`drawer.subagentModel`),`: `,P.modelConfig?.model||m(`drawer.subagentModelDefault`),` · `,P.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)]}),(0,z.jsxs)(`p`,{children:[m(`drawer.subagentExecutionConfig`),`: `,P.executionConfig||m(`drawer.subagentExecutionConfigNone`)]}),P.enabled&&P.codexHostCapacity?(0,z.jsx)(`p`,{children:m(P.codexHostCapacity.writeRequired?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:P.codexHostCapacity.configuredChildren??m(`drawer.subagentHostCapacityImplicit`),required:P.codexHostCapacity.requiredChildren})}):null,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Fe(),type:`button`,children:m(`common.confirm`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:je,type:`button`,children:m(`common.cancel`)})]})]}):null,T?(0,z.jsxs)(`p`,{className:`personal-subagent-feedback is-${ne}`,role:`status`,children:[ne===`previewing`||ne===`applying`?(0,z.jsx)($m,{className:`personal-spin`,size:13}):null,T]}):null,(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.model||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentEffort`)}),(0,z.jsx)(`dd`,{children:Oe.modelConfig?.reasoning_effort||m(`drawer.subagentModelDefault`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentCurrentBoundary`)}),(0,z.jsx)(`dd`,{children:Oe.allowedDomains.join(` · `)||m(`drawer.subagentDomainsUnrestricted`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentChildLimit`)}),(0,z.jsx)(`dd`,{children:Oe.maxChildren||0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`dd`,{children:Oe.executionConfig||m(`drawer.subagentExecutionConfigNone`)})]})]}),u?(0,z.jsx)(`p`,{className:`personal-subagent-read-only`,children:m(`drawer.subagentRemoteReadOnly`)}):(0,z.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,z.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:ke,children:[(0,z.jsx)(`legend`,{children:m(`drawer.subagentDomains`)}),Ae.length>0?(0,z.jsx)(`div`,{className:`personal-subagent-domain-options`,children:Ae.map(e=>{let t=C.includes(e.value);return(0,z.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,z.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>Ne(e.value,t.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.value}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,z.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:m(`drawer.subagentDomainsEmpty`)}),(0,z.jsx)(`small`,{children:m(`drawer.subagentDomainsHint`)})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentModel`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentModel`),disabled:ke,value:k,placeholder:`gpt-5.6-luna`,onChange:e=>{A(e.target.value),re(null),N(`idle`),E(null)}})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentEffort`)}),(0,z.jsxs)(`select`,{"aria-label":m(`drawer.subagentEffort`),disabled:ke,value:ee,onChange:e=>{j(e.target.value),re(null),N(`idle`),E(null)},children:[(0,z.jsx)(`option`,{value:``,children:m(`drawer.subagentModelDefault`)}),[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(`gpt-5.6-luna`),j(`max`),re(null),N(`idle`),E(null)},children:m(`drawer.subagentLunaPreset`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,type:`button`,onClick:()=>{A(``),j(``),re(null),N(`idle`),E(null)},children:m(`drawer.subagentClearModel`)}),(0,z.jsx)(`p`,{children:m(`drawer.subagentModelHint`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentExecutionConfig`)}),(0,z.jsx)(`input`,{"aria-label":m(`drawer.subagentExecutionConfig`),disabled:ke,onChange:e=>{te(e.target.value),re(null),N(`idle`),E(null)},placeholder:`.loopx/config/delegations.json`,value:M})]}),(0,z.jsx)(`p`,{children:m(`drawer.subagentExecutionConfigHint`)}),(0,z.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,z.jsx)(`span`,{children:m(`drawer.subagentMaxChildren`)}),(0,z.jsx)(`select`,{"aria-label":m(`drawer.subagentMaxChildren`),disabled:ke,onChange:e=>{O(Number(e.target.value)),re(null),N(`idle`),E(null)},value:D,children:nx.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,disabled:ke,onClick:()=>void Pe(Oe.enabled,!0),type:`button`,children:m(`drawer.subagentPreviewBoundary`)})]})]}):null]}):null,f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"aria-label":m(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":x===`record`,onClick:()=>S(`record`),role:`tab`,type:`button`,children:m(`drawer.executionRecordAndResult`)}),(0,z.jsx)(`button`,{"aria-selected":x===`details`,onClick:()=>S(`details`),role:`tab`,type:`button`,children:m(`drawer.detailsAndActions`)})]}),x===`record`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.sessionStatus??f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]})]})]}),(0,z.jsxs)(`section`,{"aria-label":m(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,z.jsx)(`h3`,{children:m(`drawer.executionRecord`)}),f.item.sessionMessages?.length?(0,z.jsx)(`ol`,{children:f.item.sessionMessages.map(e=>(0,z.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:e.role===`user`?m(`drawer.runRoleUser`):e.role===`assistant`?m(`drawer.runRoleAssistant`):m(`drawer.runRoleSystem`)}),e.createdAt?(0,z.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(p,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,z.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,z.jsx)(`p`,{className:`personal-session-empty`,children:Se?m(`drawer.runRecordProjected`,{completed:f.item.completedSteps,outputs:f.item.outputs?.length?m(`drawer.runRecordProjectedOutputs`,{count:f.item.outputs.length}):``,total:f.item.totalSteps}):m(`drawer.runRecordEmpty`)}),f.item.status===`running`?(0,z.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,z.jsx)(`i`,{}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:m(`drawer.analysis`)}),(0,z.jsx)(`small`,{children:m(`drawer.agentWorking`)})]})]}):null]}),f.item.outputs?.length?(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,z.jsx)(`h3`,{id:`personal-run-outputs-title`,children:m(`drawer.outputs`)}),(0,z.jsx)(`ol`,{children:f.item.outputs.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.createdAt??e.kind??m(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.agentLabel,` · `,Xi(f.item.status,m)]}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.latestActivity}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.progress`)}),(0,z.jsxs)(`dd`,{children:[f.item.completedSteps,`/`,f.item.totalSteps]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionStatus`)}),(0,z.jsx)(`dd`,{children:Xi(f.item.sessionStatus??f.item.status,m)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.sessionRecoverable`)}),(0,z.jsx)(`dd`,{children:f.item.resumable===!1?m(`drawer.resumeNo`):m(`drawer.resumeYes`)})]})]})]}),f.item.sessionStatus===`resume_failed`&&!u?(0,z.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":m(`drawer.recoveryFailed`),children:[(0,z.jsx)(`strong`,{children:m(`drawer.recoveryFailed`)}),(0,z.jsx)(`p`,{children:m(`drawer.recoveryDescription`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.recoveryNewSession`)]})]}):null,u?null:(0,z.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,z.jsx)(`header`,{children:(0,z.jsxs)(`span`,{children:[(0,z.jsx)(fm,{size:16}),m(`drawer.correctionLabel`,{agent:f.item.agentLabel})]})}),(0,z.jsx)(`p`,{children:m(`drawer.correctionDescription`)}),(0,z.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,z.jsx)(`textarea`,{"aria-label":m(`drawer.correctionTextarea`,{agent:f.item.agentLabel,goal:f.item.goalTitle,run:f.item.title}),onChange:e=>g(e.target.value),placeholder:m(`drawer.correctionPlaceholder`),rows:3,value:h}),(0,z.jsx)(`button`,{"aria-label":m(`drawer.correctionSend`),disabled:!h.trim(),onClick:()=>void Te(),type:`button`,children:(0,z.jsx)(nh,{size:16})})]})]}),u?null:(0,z.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(Em,{size:17}),m(`drawer.moreRunActions`)]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{disabled:!f.item.canInterrupt,onClick:()=>void r.onInterruptRun?.(f.item),type:`button`,children:[(0,z.jsx)(Jm,{size:16}),m(`drawer.runInterrupt`)]}),(0,z.jsxs)(`button`,{disabled:f.item.resumable===!1,onClick:()=>void r.onRetryResumeRun?.(f.item),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.recoveryRetry`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onStartNewRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.runNewSession`)]}),(0,z.jsxs)(`button`,{onClick:()=>void r.onCloseRunSession?.(f.item),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.runCloseSession`)]})]})]})]})]}):null,f.kind===`output`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsx)(`small`,{children:f.item.kind??`output`}),(0,z.jsx)(`h3`,{children:f.item.title}),(0,z.jsx)(`p`,{children:f.item.summary??m(`drawer.outputRecorded`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Goal`}),(0,z.jsx)(`dd`,{children:f.item.goalTitle??f.item.goalId})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputTodo`)}),(0,z.jsx)(`dd`,{children:f.item.todoId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.outputRun`)}),(0,z.jsx)(`dd`,{children:f.item.runId??m(`drawer.notLinked`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Agent`}),(0,z.jsx)(`dd`,{children:f.item.agentLabel??f.item.agentId??`LoopX`})]})]})]}),f.item.report?(0,z.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(`strong`,{children:[`+`,f.item.report.addedCount]}),m(`files.reportAdded`)]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.report.changedCount}),m(`files.reportChanged`)]})]}),(0,z.jsxs)(`p`,{children:[f.item.report.periodStartAt,` → `,f.item.report.periodEndAt]}),(0,z.jsx)(`ol`,{children:f.item.report.items.map(e=>(0,z.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,z.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`span`,{children:[m(`files.reportPublication`),`: `,f.item.report.publicationId]}),(0,z.jsxs)(`span`,{children:[m(`files.reportGeneration`),`: `,f.item.report.generationId]})]})]}):null,f.item.safePreview?(0,z.jsx)(`pre`,{"aria-label":m(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:f.item.safePreview}):(0,z.jsx)(`p`,{className:`personal-preview-unavailable`,children:m(`drawer.previewUnavailable`)}),(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:!r.onOpenOutput,onClick:()=>{r.onOpenOutput?.(f.item),c()},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),m(`files.openConversation`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!r.onExportOutput,onClick:()=>void r.onExportOutput?.(f.item),type:`button`,children:[(0,z.jsx)(Tm,{size:16}),m(`files.exportSummary`)]})]})]}):null,f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[f.item.actionKind===`team.plan`&&f.item.status===`applied`?(0,z.jsx)(Gb,{proposal:f.item,t:m}):(0,z.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.actionKind,` · `,f.item.status]}),(0,z.jsx)(`h3`,{children:f.item.title}),f.item.impact?(0,z.jsx)(`p`,{children:f.item.impact}):null,f.item.reviewPlan&&!f.item.reviewPlan.retryOriginal&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,"data-action-review":f.item.reviewPlan.interaction,children:f.item.actionKind===`operation.execute`&&f.item.status===`gated`?m(`actionReview.operation_group_confirmation`):f.item.actionKind===`operation.execute`&&f.item.reviewPlan.reason===`readback_unverified`?m(`actionReview.operation_result_delivery_pending`):m(`actionReview.${f.item.reviewPlan.reason}`)}):null,f.item.status===`ready`&&f.item.actionKind!==`team.plan`?(0,z.jsx)(`p`,{className:`personal-proposal-explainer`,children:m(`drawer.proposalExplainer`)}):null,(0,z.jsx)(`dl`,{children:f.item.fields.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.key))})]}),f.item.status===`applied`&&f.item.actionKind!==`team.plan`?(0,z.jsxs)(`p`,{className:`personal-proposal-state ${f.item.actionKind===`operation.execute`&&f.item.reviewPlan?.reason===`readback_unverified`?`is-gated`:`is-applied`}`,children:[(0,z.jsx)(hm,{size:16}),f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.proposalApplied`)]}):null,f.item.status===`applied`&&f.item.actionKind!==`operation.execute`&&f.item.goalId?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=f.item.goalId;c(),r.onOpenGoal?.(e)},type:`button`,children:[(0,z.jsx)(Dm,{size:16}),f.item.actionKind===`goal.create`?m(`drawer.proposalEnterGoal`):m(f.item.actionKind===`team.plan`?`proposal.teamPlan.openGoal`:`drawer.proposalViewGoal`)]}):null,f.item.status===`stale`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:m(`drawer.proposalStale`)}):null,f.item.status===`error`&&!f.item.reviewPlan?.retryOriginal?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,z.jsx)(`span`,{children:f.item.reviewPlan?.reason===`readback_unverified`?m(`actionReview.readback_unverified`):m(`drawer.proposalApplyFailed`)}),f.item.errorMessage?(0,z.jsx)(`small`,{children:f.item.errorMessage}):null,(0,z.jsx)(`small`,{children:m(f.item.actionKind===`team.plan`?`proposal.teamPlan.retryHint`:`drawer.proposalApplyFailedHint`)})]}):null,f.item.status===`rejected`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-error`,children:m(`drawer.proposalRejected`)}):null,f.item.status===`deferred`?(0,z.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:m(`drawer.proposalDeferred`)}):null,f.item.status===`gated`?(0,z.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:f.item.actionKind===`operation.execute`?f.item.primaryLabel:m(`drawer.gateRequiresHost`)}),f.item.actionKind===`operation.execute`?f.item.impact:m(`drawer.gateRequiresHostDescription`)]}),f.item.gate?.nextAction?(0,z.jsx)(`small`,{children:f.item.gate.nextAction}):null]}):null,f.item.status===`gated`&&f.item.actionKind===`gate.resolve`?(()=>{let e=e=>f.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,z.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,z.jsx)(`small`,{children:m(`drawer.gateApproveHint`)}),(0,z.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,z.jsx)(`small`,{children:m(`drawer.gateRejectHint`)})]})})():null,!u&&f.item.workspaceCandidates?.length?(0,z.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":m(`drawer.workspaceCandidates`),children:f.item.workspaceCandidates.map(e=>(0,z.jsxs)(`button`,{onClick:()=>void r.onSelectWorkspaceCandidate?.(f.item,e.workspaceRef),type:`button`,children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!u&&f.item.actionKind!==`operation.execute`&&f.item.status===`error`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void(f.item.actionKind===`team.plan`||f.item.reviewPlan?.retryOriginal?r.onApplyProposal?.(f.item):r.onTransitionProposal?.(f.item,`regenerate`)),type:`button`,children:[(0,z.jsx)($m,{size:17}),m(f.item.reviewPlan?.retryOriginal?`drawer.retryOriginal`:f.item.actionKind===`team.plan`?`proposal.teamPlan.retry`:`drawer.proposalRegenerate`)]}):!u&&f.item.actionKind!==`operation.execute`&&f.item.status!==`gated`&&(f.item.actionKind!==`team.plan`||f.item.status!==`applied`)?(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(f.item.status)||f.item.reviewPlan?.canApply===!1,onClick:()=>void r.onApplyProposal?.(f.item),type:`button`,children:[(0,z.jsx)(hm,{size:17}),f.item.status===`applying`?m(`drawer.applying`):f.item.primaryLabel??m(`drawer.apply`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&([`stale`,`gated`,`rejected`].includes(f.item.status)||f.item.status===`ready`&&f.item.reviewPlan?.canApply===!1)?(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`regenerate`),type:`button`,children:[(0,z.jsx)($m,{size:16}),m(`drawer.proposalRecheck`)]}):null,!u&&f.item.actionKind!==`operation.execute`&&[`ready`,`gated`].includes(f.item.status)?(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`defer`),type:`button`,children:m(`drawer.proposalDefer`)}),(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onTransitionProposal?.(f.item,`reject`),type:`button`,children:m(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(f.item.status)?null:(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:c,type:`button`,children:m(`drawer.proposalClose`)})]}):null,f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,z.jsxs)(`small`,{children:[f.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,f.item.status??`active`]}),(0,z.jsx)(`h3`,{children:f.item.label}),(0,z.jsx)(`p`,{children:f.item.target??f.item.schedule??m(`drawer.scheduleDefaultTarget`)}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleTimezone`)}),(0,z.jsx)(`dd`,{children:f.item.timezone??m(`drawer.scheduleLocalTimezone`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNext`)}),(0,z.jsx)(`dd`,{children:f.item.nextRunAt??m(`drawer.schedulePending`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleLast`)}),(0,z.jsx)(`dd`,{children:f.item.previousRunAt??m(`drawer.scheduleNeverRun`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleNotification`)}),(0,z.jsx)(`dd`,{children:f.item.notificationRule??m(`drawer.scheduleDefaultNotification`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:m(`drawer.scheduleStopCondition`)}),(0,z.jsx)(`dd`,{children:f.item.stopCondition??m(`drawer.scheduleDefaultStop`)})]})]})]}),!u&&f.item.scheduleKind===`monitor`?(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`run_now`),type:`button`,children:[(0,z.jsx)(Ym,{size:16}),m(`drawer.scheduleRunNow`)]}):null,u?null:(0,z.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,f.item.status===`paused`?`resume`:`pause`),type:`button`,children:[f.item.status===`paused`?(0,z.jsx)(Ym,{size:16}):(0,z.jsx)(Jm,{size:16}),f.item.status===`paused`?m(`drawer.scheduleResume`):m(`drawer.schedulePause`)]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`edit`),type:`button`,children:[(0,z.jsx)(mm,{size:16}),m(`drawer.scheduleEdit`)]})]}),u?null:(0,z.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void r.onUpdateSchedule?.(f.item,`stop`),type:`button`,children:[(0,z.jsx)(lh,{size:16}),m(`drawer.scheduleStop`,{kind:f.item.scheduleKind===`heartbeat`?` Heartbeat`:m(`drawer.titleSchedule`)})]}),(0,z.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,z.jsx)(`h3`,{id:`personal-execution-history-title`,children:m(`drawer.executionHistory`)}),f.item.executionHistory?.length?(0,z.jsx)(`ol`,{children:f.item.executionHistory.map((e,t)=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.timestamp})]}),(0,z.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,z.jsx)(`p`,{children:m(`drawer.noExecutionHistory`)})]})]}):null,f.kind===`run`||f.kind===`proposal`||f.kind===`schedule`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{"aria-expanded":_,className:`personal-diagnostics-trigger`,onClick:()=>v(e=>!e),type:`button`,children:[(0,z.jsx)(`span`,{children:m(`drawer.advancedDiagnostics`)}),(0,z.jsx)(gm,{className:_?`is-open`:``,size:16})]}),_?(0,z.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,z.jsxs)(`code`,{children:[`goal_id: `,ye]}),(0,z.jsxs)(`code`,{children:[`kind: `,f.kind]}),f.kind===`run`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`session_id: `,f.item.sessionId??m(`drawer.notLinked`)]}),(0,z.jsxs)(`code`,{children:[`turn_id: `,f.item.turnId??m(`common.none`)]}),(0,z.jsxs)(`code`,{children:[`adapter: `,f.item.agentId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.sessionStatus??f.item.status]})]}):f.kind===`proposal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`action: `,f.item.actionKind]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`code`,{children:[`schedule_id: `,f.item.scheduleId]}),(0,z.jsxs)(`code`,{children:[`status: `,f.item.status??`active`]})]})]}):null]}):null]})]})}var sx=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],cx={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function lx(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(cx,e)?e:t}}}function ux(){let{locale:e}=Ji(),t=e===`zh-CN`,[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(null),[a,o]=(0,R.useState)(`stable`),[s,c]=(0,R.useState)({phase:`idle`}),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(!1),m=window.__TAURI__?.core.invoke,h=sx.includes(s.phase);(0,R.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,R.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(lx(t))})}).catch(()=>{e&&c(lx(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,R.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(lx(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,runtime_pairing_required:t?`本机 CLI 运行时与 App 自带运行时不一致。回到 App 启动界面可「更新 App 与运行时」或「回退 CLI」。`:`This host's CLI runtime and the App's bundled runtime differ. On the App boot screen, update both or use the App's runtime.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:cx[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,z.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,z.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,z.jsx)(Tm,{size:16,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:v}),(0,z.jsx)(vm,{size:14,"aria-hidden":`true`})]}),(0,z.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,z.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,z.jsx)(gh,{size:16,"aria-hidden":`true`})})]}),(0,z.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,z.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,z.jsx)(Qm,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,z.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,z.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,z.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,z.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,z.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,z.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,z.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,z.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,z.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,z.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,z.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,z.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var dx=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function fx(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function px(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function mx(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function hx(e,t){let n=dx(t),[r,i]=(0,R.useState)(()=>{try{return fx(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(!1),p=px(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=mx(r,m,t,a,s);if(l===r)return;i(l);let u=px(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var gx=`/ssh-hosts`,_x=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function vx(e){return typeof e==`string`&&_x.test(e.trim())}function yx(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!vx(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function bx(e=fetch,t=gx){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return yx(await n.json())}function xx(e,t){let n=e.trim();if(!vx(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,hostAlias:n,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var Sx=`/api/ssh-source/ensure`,Cx=`/api/ssh-source/goal-lifecycle`;async function wx(e,t){let n=await fetch(Sx,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}async function Tx(e,t,n,r,i=fetch){let a=await i(Cx,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({goal_id:t,host_alias:e,operation:n,reason:r})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error(o?.error??`无法更新远端 Goal 生命周期。`);if(!o?.ok||o.schema_version!==`loopx_remote_goal_lifecycle_v1`||o.goal_id!==t||o.host_alias!==e||o.operation!==n||o.activation_state!==(n===`stop`?`stopped`:`active`)||o.projection_verified!==!0)throw Error(`远端 Goal 生命周期回读未验证。`);return o}function Ex({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onConfiguredHostsLoaded:i,onRemove:a,onSelect:o,sources:s}){let{t:c}=Ji(),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(`configured`),[h,g]=(0,R.useState)([]),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)(`8876`),[k,A]=(0,R.useState)(``),ee=`configured:`,j=[...s.map(e=>({label:e.label,value:e.id})),...h.filter(e=>!s.some(t=>t.label===e.alias)).map(e=>({group:c(`source.configuredGroup`,{count:h.length}),label:e.alias,value:`${ee}${e.alias}`}))],M=(0,R.useMemo)(()=>h.some(e=>e.alias===C)?xx(C,D):{error:c(`source.selectHost`)},[h,C,D,c]);(0,R.useEffect)(()=>{te()},[]);async function te(){b(!0),v(null);try{let e=await bx();g(e.hosts),i?.(e.hosts.map(e=>e.alias)),w(t=>t||e.hosts[0]?.alias||``),e.hosts.length||v(c(`source.hostEmpty`))}catch(e){v(e instanceof Error?e.message:c(`source.hostLoadError`))}finally{b(!1)}}function ne(){u(!0),m(`configured`),f(null),te()}function N(){u(!1),m(`configured`),v(null),S(!1),w(``),f(null),E(``),O(`8876`),A(``)}function P(){let e=r({label:T,statusUrl:k});if(e.error){f(e.error);return}N()}function re(){if(`error`in M){f(M.error??c(`source.invalid`));return}let e=r({ensureTunnel:!0,hostAlias:M.hostAlias,label:M.label,statusUrl:M.statusUrl});if(e.error){f(e.error);return}N()}function ie(e){let t=new Set;for(let e of s)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=xx(e,n);if(`error`in i){f(i.error??c(`source.invalid`));return}let a=r({ensureTunnel:!0,hostAlias:i.hostAlias,label:i.label,statusUrl:i.statusUrl});a.error?f(a.error):f(null),O(n)}async function ae(){if(`error`in M){f(M.error??c(`source.invalid`));return}try{await navigator.clipboard.writeText(M.command),S(!0),f(null)}catch{f(c(`source.copyError`))}}return(0,z.jsxs)(`section`,{"aria-label":c(`source.controlPlane`),className:`personal-status-source`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{children:`Control plane`}),(0,z.jsx)(`button`,{"aria-label":c(`source.addSsh`),onClick:ne,title:c(`source.add`),type:`button`,children:(0,z.jsx)(Xm,{size:14})})]}),(0,z.jsx)(fb,{ariaLabel:c(`source.select`),className:`personal-status-source-select`,icon:(0,z.jsx)(ih,{size:15}),onChange:e=>{if(e.startsWith(ee)){ie(e.slice(11));return}o(e)},options:j,value:e.id}),(0,z.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,z.jsxs)(`span`,{className:`is-${t}`,children:[(0,z.jsx)(`i`,{}),c(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,z.jsx)(`small`,{children:e.readOnly?c(`source.readOnly`):c(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,z.jsx)(`button`,{"aria-label":c(`source.remove`,{source:e.label}),onClick:()=>a(e.id),title:c(`source.removeCurrent`),type:`button`,children:(0,z.jsx)(fh,{size:12})}):null]}),n?(0,z.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,l?(0,z.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:c(`source.addSsh`)}),(0,z.jsx)(`button`,{"aria-label":c(`source.closeForm`),onClick:N,type:`button`,children:(0,z.jsx)(gh,{size:13})})]}),(0,z.jsxs)(`div`,{"aria-label":c(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,z.jsx)(`button`,{"aria-selected":p===`configured`,onClick:()=>{m(`configured`),f(null)},role:`tab`,type:`button`,children:c(`source.configured`)}),(0,z.jsx)(`button`,{"aria-selected":p===`manual`,onClick:()=>{m(`manual`),f(null)},role:`tab`,type:`button`,children:c(`source.manual`)})]}),p===`configured`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.configuredCount`,{count:h.length})}),(0,z.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,z.jsx)(`input`,{"aria-label":c(`source.host`),disabled:y||!h.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{w(e.target.value),S(!1)},placeholder:c(y?`source.loadingHosts`:`source.hostPlaceholder`),value:C}),(0,z.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:h.map(e=>(0,z.jsx)(`option`,{value:e.alias},e.alias))}),(0,z.jsx)(`button`,{"aria-label":c(`source.refreshHosts`),disabled:y,onClick:()=>void te(),title:c(`source.refreshHosts`),type:`button`,children:(0,z.jsx)(eh,{size:13})})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.localPort`)}),(0,z.jsx)(`input`,{"aria-label":c(`source.localPort`),inputMode:`numeric`,onChange:e=>{O(e.target.value),S(!1)},value:D})]}),(0,z.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,z.jsx)(`code`,{children:`error`in M?c(`source.tunnelCommandPending`):M.command}),(0,z.jsxs)(`button`,{"aria-label":c(`source.copyCommand`),disabled:`error`in M,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(Cm,{size:12}),c(x?`source.copied`:`source.copy`)]})]}),_?(0,z.jsx)(`p`,{className:`is-error`,children:_}):null,(0,z.jsx)(`p`,{children:c(`source.description`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in M,onClick:re,type:`button`,children:c(`source.addConfigured`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.name`)}),(0,z.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>E(e.target.value),placeholder:c(`source.namePlaceholder`),value:T})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:c(`source.statusUrl`)}),(0,z.jsx)(`input`,{onChange:e=>A(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:k})]}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,z.jsx)(`p`,{children:c(`source.manualDescription`)}),(0,z.jsx)(`button`,{className:`personal-status-source-add`,onClick:P,type:`button`,children:c(`source.addConfigured`)})]}),d?(0,z.jsx)(`p`,{className:`is-error`,role:`alert`,children:d}):null]}):null]})}var Dx={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Ox({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,goalLifecycleOperations:i,onRequestGoalCreate:a,onOpenSettings:o,onRetryGoalArchive:s,onRequestGoalLifecycle:c,onSelectGoal:l,selectedGoalId:u,statusSourceControl:d}){let{locale:f,t:p}=Ji(),[m,h]=(0,R.useState)(!1),g=hx(t.filter(e=>e.activationState!==`stopped`),d?.activeSource.statusUrl??`/status.json`),_=g.sorted,v=t.filter(e=>e.activationState===`stopped`),y=e=>!!c&&(!i||i.includes(e)),b=(e,t)=>(0,z.jsxs)(`div`,{className:`personal-goal-row${g.target?.id===e.goalId?g.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,z.jsxs)(`button`,{...t?{}:g.pointerProps(e.goalId),title:t?void 0:p(`sidebar.dragGoal`),"aria-current":u===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>l(e.goalId),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Dx[e.state]}`}),(0,z.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsxs)(`small`,{children:[e.loadState&&(!t||u===e.goalId)?p(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):Yi(e.state,f),e.needsYou&&!t?` · ${p(`home.lane.needsYou`)}`:``]})]}),(0,z.jsx)(_m,{size:15})]}),!t&&m?(0,z.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveUp`,{goal:e.title}),disabled:_[0]?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,-1),children:(0,z.jsx)(lm,{"aria-hidden":`true`,size:13})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":p(`sidebar.moveDown`,{goal:e.title}),disabled:_.at(-1)?.goalId===e.goalId,onClick:()=>g.moveBy(e.goalId,1),children:(0,z.jsx)(am,{"aria-hidden":`true`,size:13})})]}):null,c&&y(t?`resume`:`stop`)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{"aria-label":`${p(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>c(e,t?`resume`:`stop`),title:p(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,z.jsx)(zm,{size:13}):t?(0,z.jsx)($m,{size:13}):(0,z.jsx)(Jm,{size:13})}),t&&y(`delete`)?(0,z.jsx)(`button`,{"aria-label":`${p(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>c(e,`delete`),title:p(`sidebar.deleteGoal`),type:`button`,children:(0,z.jsx)(fh,{size:13})}):null]}):null]},e.goalId);return(0,z.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,z.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,z.jsx)(`span`,{className:`personal-brand-mark`,children:(0,z.jsx)(fm,{size:18})}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:`LoopX`})})]}),d?(0,z.jsx)(Ex,{...d}):null,(0,z.jsxs)(`nav`,{"aria-label":p(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,z.jsxs)(`button`,{"aria-current":u===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>l(null),type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-manager-icon`,children:(0,z.jsx)(fm,{size:17})}),(0,z.jsx)(`span`,{children:p(`sidebar.manager`)}),e>0?(0,z.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,z.jsx)(_m,{size:15})]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,z.jsx)(`span`,{children:`Goals`}),(0,z.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,z.jsx)(`small`,{children:_.length}),(0,z.jsx)(`button`,{"aria-label":p(`sidebar.sortGoals`),title:p(`sidebar.sortGoals`),"aria-pressed":m,onClick:()=>h(!m),type:`button`,children:(0,z.jsx)(cm,{"aria-hidden":`true`,size:15})}),a?(0,z.jsx)(`button`,{"aria-label":p(`sidebar.createGoal`),onClick:a,type:`button`,children:(0,z.jsx)(Xm,{size:15})}):null]})]}),g.saveFailed?(0,z.jsx)(`p`,{role:`status`,children:p(`sidebar.orderNotSaved`)}):null,(0,z.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:g.lastMoved?p(`sidebar.goalMoved`,{goal:g.lastMoved.title,position:g.lastMoved.position}):``}),(0,z.jsx)(`div`,{className:`personal-goal-list`,children:_.map(e=>b(e,!1))}),v.length||n.phase===`loading`||n.phase===`error`?(0,z.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:13}),(0,z.jsx)(`span`,{children:p(`sidebar.stopped`)}),n.phase===`loading`?(0,z.jsx)(zm,{"aria-label":p(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,z.jsx)(`small`,{children:v.length})]}),(0,z.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,z.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,z.jsx)(`span`,{children:p(`sidebar.stoppedLoadFailed`)}),s?(0,z.jsx)(`button`,{onClick:s,type:`button`,children:p(`sidebar.retryStopped`)}):null]}):null,v.map(e=>b(e,!0))]})]}):null]}),(0,z.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,z.jsx)(ux,{}),o?(0,z.jsxs)(`button`,{"aria-label":p(`settings.open`),className:`personal-sidebar-utility`,onClick:o,type:`button`,children:[(0,z.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,z.jsx)(ah,{size:17})}),(0,z.jsx)(`span`,{className:`personal-sidebar-utility-copy`,children:(0,z.jsx)(`strong`,{children:p(`settings.open`)})}),(0,z.jsx)(_m,{"aria-hidden":`true`,size:15})]}):null]})]})}var kx=J({ok:X(!0),total:G().int().nonnegative(),next_cursor:W().nullable(),items:q(J({todo_id:W(),text:W(),claimed_by:W().nullable(),evidence:W().nullable(),priority:W().nullable(),task_class:W().nullable()})).max(40)});function Ax({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=Ji(),s=(0,R.useId)(),[c,l]=(0,R.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,R.useState)(n),[m,h]=(0,R.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,R.useState)(void 0),[v,y]=(0,R.useState)(!1),[b,x]=(0,R.useState)(!1),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)({top:0,height:600}),[E,D]=(0,R.useState)(null),O=(0,R.useRef)(null),k=(0,R.useRef)(null),[A,ee]=(0,R.useState)(0);(0,R.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let j=g===void 0||w.top+w.height>=f.length*d-d*2;(0,R.useEffect)(()=>{if(!r||!u||!j||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=kx.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,j,g,b,A,e.goalId,t,v]),(0,R.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let M=Math.max(0,Math.floor(w.top/d)-3),te=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),ne=Array.from({length:Math.max(0,te-M)},(e,t)=>M+t);return E!==null&&El(e=>!e),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,z.jsx)(`span`,{children:m})]}),(0,z.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,z.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:ne.map(t=>{let n=f[t];return(0,z.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,z.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,z.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,z.jsx)(`strong`,{children:$d(n.text,112)}),(0,z.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,z.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),ee(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,z.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function jx({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,R.useId)(),o=(0,R.useRef)(null),s=(0,R.useRef)([]),c=(0,R.useRef)(null),[l,u]=(0,R.useState)({after:!1,before:!1}),d=(0,R.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,R.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,R.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,z.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(gm,{size:16}),(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,z.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,z.jsxs)(`header`,{id:a,children:[(0,z.jsxs)(`strong`,{children:[(0,z.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,z.jsx)(`span`,{children:t})]}),(0,z.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function Mx({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=Ji(),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)({goalId:``,laneId:`all`}),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:e.priority===`P3`?3:e.priority===`P4`?4:50,v=(0,R.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,A=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,z.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,z.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,z.jsx)(`div`,{children:(0,z.jsx)(`strong`,{children:u(`header.tasks`)})}),(0,z.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(fm,{size:15}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:u(`tasks.agentLane`)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,z.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,z.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,z.jsx)(gm,{"aria-hidden":!0,size:14})]})]}):null,O?(0,z.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,z.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,z.jsx)(Um,{size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:u(A?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,z.jsx)(`small`,{children:k?.returnDelivery?u(`tasks.chatReturn`):k?.agentLabel})]}),(0,z.jsx)(`div`,{className:`personal-task-reply-preview`,children:(0,z.jsx)(wb,{text:A?u(`tasks.chatPendingDescription`):(k?.text??O.text).trim().split(/\r?\n/,1)[0]})})]}),(0,z.jsxs)(`footer`,{children:[(0,z.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,z.jsx)(Um,{size:14}),u(`tasks.chatViewReply`)]}),k&&!A&&r?(0,z.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,z.jsx)(Rm,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,z.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,z.jsxs)(jx,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Zi(e.updatedAt,u);return(0,z.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[(0,z.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,z.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,z.jsxs)(jx,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,z.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,z.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`○`}),(0,z.jsx)(`strong`,{children:e.text}),(0,z.jsxs)(`small`,{children:[e.priority?(0,z.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,z.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,z.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,z.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,z.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,z.jsx)(Dm,{size:14}),(0,z.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,z.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,z.jsx)(zm,{className:`personal-spin`,size:14}):(0,z.jsx)(hm,{size:14})}):null,(0,z.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,z.jsx)(Em,{size:14})})]})]},e.todoId)}),x.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,z.jsxs)(jx,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,z.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,z.jsx)(`span`,{children:`◷`}),(0,z.jsx)(`strong`,{children:e.schedule.label}),(0,z.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,z.jsx)(Ax,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,z.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}var Nx=yd(W(),q(W())),Px=J({node_id:W().min(1),kind:Y([`deliverable`,`gate`,`gate_summary`,`lease`,`validation`,`repair`,`handoff`,`evidence`]),title:W(),state:Y([`open`,`ready`,`blocked`,`done`,`waiting`,`unknown`]),refs:Nx,owner_agent:W().optional(),actor_agent:W().optional(),from_agent:W().optional(),to_agent:W().optional()}),Fx=J({edge_id:W().min(1),from_node_id:W(),to_node_id:W(),relation:Y([`depends_on`,`blocks`,`validates`,`repairs`,`audits`,`continues`,`hands_off_to`,`supersedes`]),reason:W(),refs:Nx.optional()}),Ix=J({schema_version:X(`task_graph_projection_v0`),mode:X(`read_only`),goal_id:W(),generated_at:W().nullable(),truth_contract:J({projection_is_writable:X(!1),write_api:X(!1)}),limits:J({user_gate_node_limit:G().int().nonnegative(),user_gate_open_count:G().int().nonnegative(),user_gate_truncated_count:G().int().nonnegative(),source_truncated:K().optional(),predecessor_truncated:K().optional(),missing_predecessor_count:G().int().nonnegative().optional(),topology_complete:K().optional()}),nodes:q(Px),edges:q(Fx)}).superRefine((e,t)=>{let n=new Set(e.nodes.map(e=>e.node_id)),r=new Set(e.edges.map(e=>e.edge_id));(n.size!==e.nodes.length||r.size!==e.edges.length||e.edges.some(e=>!n.has(e.from_node_id)||!n.has(e.to_node_id)))&&t.addIssue({code:`custom`,message:`Graph identities or endpoints are invalid`})}),Lx=J({ok:X(!0),goal_id:W(),observed_at:W().datetime({offset:!0}),graph:Ix.nullable(),acceptance:uf.nullable()});function Rx(e,t){let n=Lx.parse(e);if(n.goal_id!==t||n.graph&&n.graph.goal_id!==t||n.acceptance&&n.acceptance.goal_id!==t)throw Error(`Review source does not match the selected Goal`);return n}async function zx(e,t){let n=new URLSearchParams({goal_id:e}),r=await fetch(`/api/chat/delivery-review?${n}`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Review unavailable (${r.status})`);return Rx(await r.json(),e)}function Bx(e,t,n,r){let i=new Set([r]);for(let t of e.edges)t.from_node_id===r&&i.add(t.to_node_id),t.to_node_id===r&&i.add(t.from_node_id);let a=t.trim().toLocaleLowerCase();return e.nodes.filter(e=>{let t=[e.title,e.owner_agent,e.actor_agent,e.from_agent,e.to_agent,...Object.values(e.refs).flat()].some(e=>e?.toLocaleLowerCase().includes(a)),r=n===`all`||n===`related`&&i.has(e.node_id)||n===`conditions`&&[`gate`,`gate_summary`,`lease`].includes(e.kind)||n===`evidence`&&[`evidence`,`validation`,`repair`,`handoff`].includes(e.kind);return t&&r})}function Vx(e){let t=e.limits;return t.topology_complete!==!0||t.source_truncated===!0||t.predecessor_truncated===!0||(t.missing_predecessor_count??0)>0||t.user_gate_truncated_count>0}function Hx(e){return[`gate`,`gate_summary`,`lease`].includes(e.kind)?0:e.kind===`deliverable`?1:2}function Ux(e,t){let n=e=>String(e??t.unavailable).replace(/[\\`*_{}[\]<>|#]/g,`\\$&`).replace(/[\r\n]+/g,` `),r=[`# ${t.title}`,``,`Goal: ${n(e.goal_id)}`,`${t.observed}: ${n(e.observed_at)}`,``,t.scope,``,t.acceptanceBoundary,``,`## ${t.chain}`,``],i=e.graph;if(!i)r.push(t.noGraph);else{Vx(i)&&r.push(t.incomplete,``),r.push("```json",JSON.stringify(i.limits,null,2),"```",``);for(let e of i.nodes)r.push(`- ${n(e.title)} · ${t.kind[e.kind]} · ${t.state[e.state]}${e.owner_agent?` · ${n(e.owner_agent)}`:``}`,` ${t.refs}: ${n(e.node_id)}; ${n(JSON.stringify(e.refs))}`),(e.from_agent||e.to_agent)&&r.push(` ${n(e.from_agent)} → ${n(e.to_agent)}`),e.actor_agent&&r.push(` actor: ${n(e.actor_agent)}`);let e=new Map(i.nodes.map(e=>[e.node_id,e.title]));r.push(``,`## ${t.relations}`,``);for(let a of i.edges)r.push(`- ${n(e.get(a.from_node_id))} → ${t.relation[a.relation]} → ${n(e.get(a.to_node_id))}: ${n(a.reason)} (${n(a.edge_id)})`,` ${t.refs}: ${n(JSON.stringify(a.refs??{}))}`)}r.push(``,`## ${t.acceptance}`,``);let a=e.acceptance;if(!a)r.push(t.unavailable);else{let e=a.coverage===`partial`;r.push(`${t.required}: ${e?a.acceptance_gaps.length:t.unavailable}`,`${t.guards}: ${e?a.guards.length:t.unavailable}`,``);for(let e of a.acceptance_gaps)r.push(`### ${n(e.evidence_required)}`,``,`${t.owner}: ${n(e.owner)}`,`${t.reason}: ${n(e.reason)}`,`${t.observed}: ${n(e.observed_at)}`,`${t.refs}: ${n(e.source)}`),e.resolution_hint&&r.push(n(e.resolution_hint)),e.component_checks&&r.push(`${t.checks}:`,"```json",JSON.stringify(e.component_checks,null,2),"```"),r.push(``);r.push(`### ${t.guards}`,``);for(let e of a.guards)r.push(`- ${n(e.reason)}`,` ${t.owner}: ${n(e.owner)}; ${t.required}: ${n(e.evidence_required)}`,` ${t.refs}: ${n(e.todo_id)}; ${n(e.blocks_agent)}; ${n(e.decision_scope)}`);r.push(``,`### ${t.historical}`,``);for(let e of a.historical_progress)r.push(`- ${n(e.kind)} · ${n(e.observed_at)} · ${n(e.source)} · ${n(e.evidence_refs.join(`, `))}`);r.push(``,`${t.observedScope}: ${n(a.coverage)}; truncated=${a.truncated}`,`${t.missingSources}: ${n(a.missing_sources.join(`, `))}`,`${t.next}: ${n(a.next_action)} (${n(a.next_action_source)})`)}let o=a?.goal_acceptance_contract;if(o?.enabled===!0){let i=t.contract;r.push(``,`## ${i.title}`,``,i.boundary,`${i.source}: ${n(e.goal_id)}`,`${i.revision}: ${o.revision}`,`${i.digest}: ${n(o.digest)}`,``,`### ${i.objective}`,n(o.objective||i.unknown),``,`### ${i.criteria}`),o.non_goals.length&&r.push(`${i.nonGoals}: ${n(o.non_goals.join(`; `))}`),o.criteria.length||r.push(i.noCriteria);for(let e of o.criteria)r.push(`- ${n(e.id)}: ${n(e.description)}`);r.push(``,`### ${i.tasks}`),o.tasks.length||r.push(i.noTasks);for(let e of o.tasks)r.push(`- ${n(e.todo_id)}: ${i.taskState[e.state]}`,` ${i.criteria}: ${n(e.criterion_ids.join(`, `)||i.unknown)}`),e.reason&&r.push(` ${n(e.reason)}`),e.applicable===!1&&r.push(` ${i.notApplicable}`);r.push(``,`### ${i.verification}`,i.verificationState[o.status]),o.held_todo_ids.length&&r.push(`${i.heldTasks}: ${n(o.held_todo_ids.join(`, `))}`),r.push(``,`### ${i.receipt}`);let a=o.verification;if(!a)r.push(i.unknown);else{r.push(i.receiptNote,`${i.operation}: ${n(a.operation_id)}`,`${i.revision}: ${a.contract_revision}`,`${i.digest}: ${n(a.contract_digest)}`,`${i.verificationScope}: ${n(a.todo_id??i.allCriteria)}`);for(let e of a.results)r.push(`- ${n(e.criterion_id)}: ${e.passed?i.passed:i.failed}; ${i.exitCode}: ${e.exit_code??i.unknown}`)}}return r.join(` `)+` `}function Wx({goalId:e,contract:t,copy:n,current:r}){if(t?.enabled!==!0)return null;let i=`loopx --format json goal-acceptance inspect --goal-id '${e.replace(/'/g,`'\\''`)}'`;return(0,z.jsxs)(`details`,{className:`delivery-acceptance-contract`,children:[(0,z.jsx)(`summary`,{children:n.title}),(0,z.jsxs)(`div`,{className:`delivery-acceptance-content`,children:[(0,z.jsx)(`p`,{children:n.boundary}),r?null:(0,z.jsx)(`p`,{role:`status`,className:`delivery-notice`,children:n.retained}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.source}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:e})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.digest})})]})]}),(0,z.jsx)(`h3`,{children:n.objective}),(0,z.jsx)(`p`,{children:t.objective||n.unknown}),t.non_goals.length?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{children:n.nonGoals}),(0,z.jsx)(`ul`,{children:t.non_goals.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))})]}):null,(0,z.jsx)(`h3`,{children:n.criteria}),t.criteria.length?(0,z.jsx)(`ul`,{children:t.criteria.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.id}),` · `,e.description]},e.id))}):(0,z.jsx)(`p`,{children:n.noCriteria}),(0,z.jsx)(`h3`,{children:n.tasks}),t.tasks.length?(0,z.jsx)(`ul`,{className:`delivery-acceptance-tasks`,children:t.tasks.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`code`,{children:e.todo_id}),` · `,(0,z.jsx)(`strong`,{children:n.taskState[e.state]})]}),(0,z.jsxs)(`p`,{children:[n.criteria,`: `,e.criterion_ids.length?e.criterion_ids.join(`, `):n.unknown]}),e.applicable===!1?(0,z.jsx)(`p`,{children:n.notApplicable}):null,e.reason?(0,z.jsx)(`p`,{children:e.reason}):null]},e.todo_id))}):(0,z.jsx)(`p`,{children:n.noTasks}),(0,z.jsx)(`h3`,{children:n.verification}),(0,z.jsx)(`p`,{children:n.verificationState[t.status]}),t.held_todo_ids.length?(0,z.jsxs)(`p`,{children:[n.heldTasks,`: `,t.held_todo_ids.join(`, `)]}):null,(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.receipt}),t.verification?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{children:n.receiptNote}),(0,z.jsxs)(`dl`,{className:`delivery-acceptance-source`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.operation}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.operation_id})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.revision}),(0,z.jsx)(`dd`,{children:t.verification.contract_revision})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.digest}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.verification.contract_digest})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n.verificationScope}),(0,z.jsx)(`dd`,{children:t.verification.todo_id??n.allCriteria})]})]}),(0,z.jsx)(`ul`,{children:t.verification.results.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.criterion_id}),` · `,e.passed?n.passed:n.failed,` · `,n.exitCode,`: `,e.exit_code??n.unknown]},e.criterion_id))})]}):(0,z.jsx)(`p`,{children:n.unknown})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:n.help}),(0,z.jsx)(`p`,{children:n.guidance}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:i})}),(0,z.jsx)(`p`,{children:(0,z.jsx)(`code`,{children:`loopx goal-acceptance --help`})}),(0,z.jsx)(`a`,{href:`https://github.com/huangruiteng/loopx/blob/main/docs/reference/goal-acceptance-observations.md#owner-authorized-contract-v0`,target:`_blank`,rel:`noreferrer`,children:n.guide})]})]})]})}var Gx={en:{title:`Goal acceptance contract`,boundary:`Read-only owner contract. Task association and artifact checks are separate; neither automatically approves or completes the Goal.`,source:`Goal source`,revision:`Contract revision`,digest:`Contract digest`,objective:`Objective`,criteria:`Acceptance criteria`,nonGoals:`Outside scope`,tasks:`Task associations`,verification:`Artifact verification`,unknown:`Unknown`,noTasks:`No task associations reported. Coverage is unknown.`,noCriteria:`No acceptance criteria reported.`,retained:`Retained snapshot; refresh to read current acceptance facts.`,taskState:{ready:`Task association confirmed`,unbound:`Task association missing`,stale:`Task association stale`},verificationState:{unverified:`Artifact checks not verified`,accepted:`Artifact checks passed`,failed:`Artifact checks failed`,stale:`Artifact checks stale`,partial:`Task checks passed; Goal-wide verification unknown`,held:`Task associations require confirmation`},notApplicable:`Outside the current task gate`,heldTasks:`Tasks held`,receipt:`Recorded artifact checks`,receiptNote:`Recorded results use the revision below. The current contract status above accounts for stale checks and task holds.`,operation:`Verification reference`,verificationScope:`Verification scope`,allCriteria:`All contract criteria`,passed:`Passed`,failed:`Failed`,exitCode:`Exit code`,help:`Setup and readback`,guide:`Owner setup guide (v0)`,guidance:`The local Goal owner configures this contract through the CLI using configure --document and the inspected --expected-provider-revision. Changes and verification require --execute. Inspect before changing the contract; refresh this snapshot afterward. Disable with the current provider revision to hide this section.`},"zh-CN":{title:`Goal 验收合同`,boundary:`只读的所有者合同。任务关联与产物检查是独立事实,均不会自动批准或完成 Goal。`,source:`Goal 来源`,revision:`合同版本`,digest:`合同摘要`,objective:`目标`,criteria:`验收条件`,nonGoals:`范围之外`,tasks:`任务关联`,verification:`产物验证`,unknown:`未知`,noTasks:`未提供任务关联,覆盖范围未知。`,noCriteria:`未提供验收条件。`,retained:`当前保留旧快照,请刷新读取最新验收事实。`,taskState:{ready:`任务关联已确认`,unbound:`任务关联缺失`,stale:`任务关联已过期`},verificationState:{unverified:`产物检查未验证`,accepted:`产物检查通过`,failed:`产物检查失败`,stale:`产物检查已过期`,partial:`任务检查通过;Goal 整体验证未知`,held:`任务关联需要确认`},notApplicable:`不属于当前任务门禁范围`,heldTasks:`受阻任务`,receipt:`已记录的产物检查`,receiptNote:`记录对应下方版本。上方当前合同状态已考虑检查过期和任务阻塞。`,operation:`验证引用`,verificationScope:`验证范围`,allCriteria:`全部合同条件`,passed:`通过`,failed:`失败`,exitCode:`退出码`,help:`配置与读回`,guide:`所有者配置指南(v0)`,guidance:`本地 Goal 所有者通过 CLI 的 configure --document 配置合同,并提供 inspect 读到的 --expected-provider-revision。变更和验证都需要 --execute。变更前先检查合同,操作后刷新此快照;使用当前 provider revision 执行 disable 可隐藏本区块。`}},Kx={en:{contract:Gx.en,title:`Delivery & evidence`,scope:`Current work and a limited set of predecessors. Use Tasks for the full task inventory.`,observed:`Snapshot read`,chain:`Delivery chain`,relations:`Relationships`,acceptance:`Acceptance observations`,acceptanceBoundary:`Completed tasks and recorded evidence do not certify Goal acceptance.`,noGraph:`No delivery chain is available in this snapshot. This does not mean all work is complete.`,incomplete:`Some related information is missing or not expanded.`,unavailable:`Unknown`,refs:`Source references`,required:`Evidence still required`,guards:`Pending decisions`,next:`Next action`,owner:`Owner`,reason:`Reason`,historical:`Historical observations`,checks:`Component checks`,missingSources:`Missing sources`,observedScope:`Observation coverage`,kind:{deliverable:`Work`,gate:`Decision`,gate_summary:`Other decisions`,lease:`Ownership`,validation:`Validation`,repair:`Recovery`,handoff:`Handoff`,evidence:`Evidence`},state:{open:`Open`,ready:`Ready`,blocked:`Blocked`,done:`Done`,waiting:`Waiting`,unknown:`Unknown`},relation:{depends_on:`depends on`,blocks:`blocks`,validates:`validates / contextualizes`,repairs:`repairs`,audits:`audits`,continues:`continues`,hands_off_to:`hands off to`,supersedes:`supersedes`},refresh:`Refresh snapshot`,export:`Export delivery snapshot`,exported:`Snapshot downloaded`,loading:`Reading the current delivery chain…`,error:`The delivery snapshot could not be read. Refresh to retry.`,refreshError:`Refresh failed. The previous snapshot remains visible; refresh before opening linked work or exporting.`,changed:`Workspace facts changed after this snapshot. Refresh before opening linked work or exporting.`,search:`Search title, owner or reference`,all:`All nodes`,conditions:`Conditions & owners`,evidence:`Evidence & handoffs`,related:`Directly related`,map:`Map`,list:`List`,view:`Delivery chain layout`,filter:`Delivery chain focus`,visible:`Visible`,empty:`No nodes match these filters.`,reset:`Reset filters`,select:`Select a node to trace its relationships and open its source.`,work:`Work`,context:`Evidence & recovery`,details:`Selected item`,noRelations:`No relationships are recorded for this item.`,openTask:`Open task`,openGate:`Review decision`,openRun:`Open execution`,sourceUnavailable:`The linked item is not in the current workspace. Use its reference in the task board or CLI.`,omittedGates:`Decisions not expanded`,missing:`Missing predecessors`,clipped:`Expansion limited`,sourceClipped:`Source truncated`,yes:`Yes`,no:`No`,chainOnly:`Bounded chain`,exportFailed:`Download failed. Please retry.`},"zh-CN":{contract:Gx[`zh-CN`],title:`交付与依据`,scope:`仅含当前工作及有限前序,完整任务清单见任务页。`,observed:`快照读取时间`,chain:`交付链`,relations:`关联关系`,acceptance:`验收观察`,acceptanceBoundary:`任务完成、已有证据均不等于 Goal 已通过验收。`,noGraph:`当前快照没有可展示的交付链,这不代表工作已经全部完成。`,incomplete:`部分关联信息缺失或未展开。`,unavailable:`未知`,refs:`来源引用`,required:`仍需补齐的证据`,guards:`待你处理`,next:`下一步`,owner:`负责人`,reason:`原因`,historical:`历史观察`,checks:`组成检查`,missingSources:`缺失来源`,observedScope:`观察范围`,kind:{deliverable:`工作`,gate:`决策`,gate_summary:`其他决策`,lease:`责任归属`,validation:`验证`,repair:`恢复`,handoff:`交接`,evidence:`证据`},state:{open:`待处理`,ready:`就绪`,blocked:`受阻`,done:`已完成`,waiting:`等待`,unknown:`未知`},relation:{depends_on:`依赖`,blocks:`阻塞`,validates:`验证 / 提供背景`,repairs:`修复`,audits:`复核`,continues:`延续`,hands_off_to:`交接给`,supersedes:`替代`},refresh:`刷新快照`,export:`导出交付快照`,exported:`快照已下载`,loading:`正在读取当前交付链…`,error:`交付快照读取失败,请刷新重试。`,refreshError:`刷新失败,当前保留上次快照;请刷新后再打开关联工作或导出。`,changed:`工作区状态已在此快照之后变化,请刷新后再打开关联工作或导出。`,search:`搜索标题、负责人或引用`,all:`全部节点`,conditions:`条件与责任`,evidence:`证据与交接`,related:`直接关联`,map:`关系图`,list:`列表`,view:`交付链布局`,filter:`交付链范围`,visible:`当前显示`,empty:`没有匹配当前筛选的节点。`,reset:`重置筛选`,select:`选择一个节点,追溯关联关系并打开来源。`,work:`工作`,context:`证据与恢复`,details:`选中事项`,noRelations:`当前快照未记录此事项的关联关系。`,openTask:`打开任务`,openGate:`查看决策`,openRun:`打开执行`,sourceUnavailable:`关联事项未出现在当前工作区,可使用其引用到任务看板或 CLI 查找。`,omittedGates:`未展开决策`,missing:`缺失前序`,clipped:`展开受限`,sourceClipped:`来源被裁剪`,yes:`是`,no:`否`,chainOnly:`当前局部链`,exportFailed:`下载失败,请重试。`}};function qx({graph:e,nodes:t,selected:n,onSelect:r,copy:i}){let a=(0,R.useId)().replace(/:/g,``),o=[0,1,2].map(e=>t.filter(t=>Hx(t)===e)),s=new Map(o.flatMap((e,t)=>e.map((e,n)=>[e.node_id,{x:t*320+12,y:n*124+48}]))),c=Math.max(1,...o.map(e=>e.length))*124+48;return(0,z.jsx)(`div`,{className:`delivery-map-scroll`,role:`region`,"aria-label":i.map,tabIndex:0,children:(0,z.jsxs)(`div`,{className:`delivery-map`,style:{height:c},children:[[i.conditions,i.work,i.context].map((e,t)=>(0,z.jsx)(`strong`,{className:`delivery-map-heading`,style:{left:t*320+12},children:e},e)),(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:`960`,height:c,children:[(0,z.jsx)(`defs`,{children:(0,z.jsx)(`marker`,{id:a,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,z.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:`currentColor`})})}),e.edges.map(e=>{let t=s.get(e.from_node_id),r=s.get(e.to_node_id);if(!t||!r)return null;let i=t.x{let t=s.get(e.node_id);return(0,z.jsxs)(`button`,{className:`delivery-map-node`,style:{left:t.x,top:t.y},"aria-pressed":n===e.node_id,onClick:()=>r(e.node_id),type:`button`,children:[(0,z.jsxs)(`span`,{children:[i.kind[e.kind],(0,z.jsx)(`em`,{"data-state":e.state,children:i.state[e.state]})]}),(0,z.jsx)(`strong`,{title:e.title,children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??i.unavailable})]},e.node_id)})]})})}function Jx({goal:e,items:t,userTodos:n,onSelect:r,active:i}){let{locale:a}=Ji(),o=Kx[a],[s,c]=(0,R.useState)({kind:`loading`}),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(`all`),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(()=>window.matchMedia(`(min-width: 1024px)`).matches),[y,b]=(0,R.useState)(``),x=(0,R.useRef)(null),S=n.filter(t=>t.goalId===e.goalId),C=JSON.stringify([e.agentTodos,e.acceptanceObservation,S]),w=(0,R.useRef)(C);w.current=C,(0,R.useEffect)(()=>{if(!i)return;let t=new AbortController,n=w.current;return c(e=>({...e,kind:`loading`})),b(``),zx(e.goalId,t.signal).then(e=>{t.signal.aborted||c({kind:`ready`,snapshot:e,sourceKey:n})}).catch(()=>{t.signal.aborted||c(e=>({...e,kind:`error`}))}),()=>t.abort()},[e.goalId,l,i]);let T=s.snapshot?.goal_id===e.goalId?s.snapshot:null,E=!!T&&s.sourceKey!==C,D=!!T&&s.kind===`ready`&&!E,O=T?.graph,k=O?.nodes.find(e=>e.node_id===h),A=p===`related`&&!k?`all`:p,ee=(0,R.useMemo)(()=>O?Bx(O,d,A,h):[],[O,d,A,h]),j=O?.edges.filter(e=>e.from_node_id===h||e.to_node_id===h)??[],M=new Map(O?.nodes.map(e=>[e.node_id,e])),te=()=>{f(``),m(`all`)},ne=e=>{g(e),b(``),window.requestAnimationFrame(()=>x.current?.scrollIntoView({block:`nearest`}))};function N(n){let r=new Set(n.refs.todo_ids??[]),i=new Set(n.refs.gate_ids??[]),a=new Set(n.refs.run_ids??[]);return[...e.agentTodos.filter(e=>r.has(e.todoId)).map(t=>({kind:`todo`,item:{...t,goalId:e.goalId,goalTitle:e.title,ownerLabel:t.claimedBy}})),...S.filter(e=>i.has(e.todoId)||r.has(e.todoId)).map(e=>({kind:`attention`,item:e})),...t.filter(t=>t.kind===`run`&&t.run.goalId===e.goalId&&a.has(t.run.runId)).map(e=>({kind:`run`,item:e.run}))]}let P=k?N(k):[];function re(){if(!T||!D)return;let e;try{e=URL.createObjectURL(new Blob([Ux(T,o)],{type:`text/markdown;charset=utf-8`}));let t=document.createElement(`a`);t.href=e,t.download=`loopx-delivery-review.md`,t.click(),b(o.exported)}catch{b(o.exportFailed)}finally{e&&window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}}return(0,z.jsxs)(`section`,{className:`delivery-review`,"aria-label":o.title,children:[(0,z.jsxs)(`header`,{className:`delivery-review-toolbar`,children:[(0,z.jsx)(`h2`,{children:o.title}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`button`,{type:`button`,disabled:s.kind===`loading`,onClick:()=>u(e=>e+1),children:[(0,z.jsx)(Qm,{size:15}),o.refresh]}),(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:re,children:[(0,z.jsx)(Tm,{size:15}),o.export]})]})]}),y?(0,z.jsx)(`p`,{role:`status`,children:y}):null,T?(0,z.jsxs)(z.Fragment,{children:[s.kind===`ready`?null:(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.refreshError:o.loading}),(0,z.jsxs)(`p`,{className:`delivery-snapshot-time`,children:[o.observed,` · `,(0,z.jsx)(`time`,{dateTime:T.observed_at,children:new Date(T.observed_at).toLocaleString(a)})]}),E?(0,z.jsx)(`p`,{role:`alert`,className:`delivery-notice`,children:o.changed}):null,(0,z.jsxs)(`p`,{className:`delivery-boundary`,children:[o.scope,` `,o.acceptanceBoundary]}),O?(0,z.jsxs)(z.Fragment,{children:[Vx(O)?(0,z.jsxs)(`details`,{className:`delivery-notice`,children:[(0,z.jsx)(`summary`,{children:o.incomplete}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.omittedGates}),(0,z.jsx)(`dd`,{children:O.limits.user_gate_truncated_count})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.missing}),(0,z.jsx)(`dd`,{children:O.limits.missing_predecessor_count??o.unavailable})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.clipped}),(0,z.jsx)(`dd`,{children:O.limits.predecessor_truncated===void 0?o.unavailable:O.limits.predecessor_truncated?o.yes:o.no})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:o.sourceClipped}),(0,z.jsx)(`dd`,{children:O.limits.source_truncated===void 0?o.unavailable:O.limits.source_truncated?o.yes:o.no})]})]})]}):null,(0,z.jsxs)(`section`,{className:`delivery-chain`,"aria-label":o.chain,children:[(0,z.jsxs)(`header`,{className:`delivery-chain-toolbar`,children:[(0,z.jsx)(`h3`,{children:o.chain}),(0,z.jsxs)(`span`,{children:[o.visible,` `,ee.length,`/`,O.nodes.length]}),(0,z.jsxs)(`div`,{role:`group`,"aria-label":o.view,children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:()=>v(!0),children:o.map}),(0,z.jsx)(`button`,{type:`button`,"aria-pressed":!_,onClick:()=>v(!1),children:o.list})]})]}),(0,z.jsxs)(`div`,{className:`delivery-filters`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o.search,placeholder:o.search,value:d,onChange:e=>f(e.target.value)})]}),(0,z.jsxs)(`select`,{"aria-label":o.filter,value:A,onChange:e=>m(e.target.value),children:[(0,z.jsx)(`option`,{value:`all`,children:o.all}),(0,z.jsx)(`option`,{value:`conditions`,children:o.conditions}),(0,z.jsx)(`option`,{value:`evidence`,children:o.evidence}),(0,z.jsx)(`option`,{value:`related`,disabled:!k,children:o.related})]}),(0,z.jsx)(`button`,{type:`button`,onClick:te,children:o.reset})]}),ee.length?_?(0,z.jsx)(qx,{graph:O,nodes:ee,selected:h,onSelect:ne,copy:o}):(0,z.jsx)(`ul`,{className:`delivery-node-list`,children:ee.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,"aria-pressed":h===e.node_id,onClick:()=>ne(e.node_id),children:[(0,z.jsx)(`span`,{children:o.kind[e.kind]}),(0,z.jsx)(`strong`,{children:e.title}),(0,z.jsx)(`small`,{children:e.owner_agent??o.unavailable}),(0,z.jsx)(`em`,{"data-state":e.state,children:o.state[e.state]})]})},e.node_id))}):(0,z.jsx)(`p`,{className:`delivery-empty`,role:`status`,children:o.empty})]}),(0,z.jsx)(`section`,{className:`delivery-node-detail`,"aria-label":o.details,ref:x,children:k?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`span`,{children:[o.kind[k.kind],` · `,o.state[k.state]]}),(0,z.jsx)(`h3`,{children:k.title}),k.owner_agent?(0,z.jsx)(`p`,{children:k.owner_agent}):null]}),k.from_agent||k.to_agent?(0,z.jsxs)(`p`,{children:[k.from_agent??o.unavailable,` → `,k.to_agent??o.unavailable]}):null,(0,z.jsx)(`div`,{className:`delivery-source-actions`,children:P.length?P.map((e,t)=>(0,z.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>r(e),children:[(0,z.jsx)(Dm,{size:15}),e.kind===`todo`?o.openTask:e.kind===`attention`?o.openGate:o.openRun]},`${e.kind}:${t}`)):(0,z.jsx)(`p`,{children:o.sourceUnavailable})}),(0,z.jsx)(`h4`,{children:o.relations}),j.length?(0,z.jsx)(`ul`,{className:`delivery-relations`,children:j.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.from_node_id),children:M.get(e.from_node_id).title}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(sm,{size:13}),o.relation[e.relation],(0,z.jsx)(sm,{size:13})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>ne(e.to_node_id),children:M.get(e.to_node_id).title})]}),(0,z.jsx)(`p`,{children:e.reason})]},e.edge_id))}):(0,z.jsx)(`p`,{children:o.noRelations}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:o.refs}),(0,z.jsx)(`code`,{children:k.node_id}),Object.entries(k.refs).map(([e,t])=>(0,z.jsxs)(`p`,{children:[(0,z.jsx)(`strong`,{children:e}),` `,t.join(`, `)]},e))]})]}):(0,z.jsx)(`p`,{children:o.select})})]}):(0,z.jsx)(`p`,{className:`delivery-notice`,children:o.noGraph})]}):(0,z.jsx)(`p`,{role:s.kind===`error`?`alert`:`status`,className:`delivery-notice`,children:s.kind===`error`?o.error:o.loading}),(0,z.jsx)(Wx,{goalId:e.goalId,contract:T?.acceptance?.goal_acceptance_contract,copy:o.contract,current:D}),(0,z.jsx)(Ub,{goal:T?{...e,acceptanceObservation:T.acceptance}:e})]})}function Yx({active:e,goal:t,items:n,userTodos:r,readOnly:i,onOpenDetails:a,onSelect:o,onView:s}){let{t:c,locale:l}=Ji(),u=l===`zh-CN`?{progress:`当前进展`,attention:`需要你`,none:`当前没有已加载的待处理决定。`,details:`Goal 信息`,tasks:`查看任务`,usage:`最近 24 小时`,execution:`执行记录`,remote:`此来源仅提供同步的状态与验收观察,交付链需要实时本机来源。`}:{progress:`Current progress`,attention:`Needs you`,none:`No pending decisions are loaded.`,details:`Goal information`,tasks:`View tasks`,usage:`Last 24 hours`,execution:`Execution`,remote:`This source provides synchronized status and acceptance observations. The delivery chain requires the live local source.`},d=r.filter(e=>e.goalId===t.goalId),f=n.find(e=>e.kind===`run`&&e.run.goalId===t.goalId);return(0,z.jsxs)(`section`,{className:`goal-overview`,"aria-label":c(`header.overview`),children:[(0,z.jsxs)(`header`,{className:`goal-overview-heading`,children:[(0,z.jsx)(`h2`,{children:c(`header.overview`)}),(0,z.jsxs)(`button`,{onClick:a,type:`button`,children:[(0,z.jsx)(Pm,{size:15}),u.details]})]}),(0,z.jsxs)(`div`,{className:`goal-overview-summary${d.length?` has-attention`:``}`,children:[(0,z.jsxs)(`section`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.progress}),(0,z.jsx)(`span`,{children:Yi(t.state,l)})]}),(0,z.jsx)(`strong`,{children:t.nextSentence}),t.agentSentence&&t.agentSentence!==t.nextSentence?(0,z.jsx)(`p`,{children:t.agentSentence}):null,d.length?null:(0,z.jsx)(`p`,{className:`goal-overview-quiet`,children:u.none}),f?(0,z.jsxs)(`button`,{className:`goal-overview-run`,type:`button`,onClick:()=>o({kind:`run`,item:f.run}),children:[(0,z.jsxs)(`small`,{children:[u.execution,` · `,f.run.agentLabel]}),(0,z.jsx)(`strong`,{children:f.run.title}),(0,z.jsx)(sm,{size:15})]}):null]}),d.length?(0,z.jsxs)(`section`,{className:`goal-overview-attention`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`h3`,{children:u.attention}),(0,z.jsx)(`span`,{children:d.length})]}),(0,z.jsx)(`ul`,{children:d.slice(0,3).map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`attention`,item:e}),children:[(0,z.jsx)(`span`,{children:e.text}),(0,z.jsx)(sm,{size:15})]})},e.todoId))}),d.length>3?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>s(`tasks`),children:[u.tasks,` (`,d.length,`)`,(0,z.jsx)(sm,{size:14})]}):null]}):null]}),(0,z.jsxs)(`section`,{className:`goal-overview-usage`,"aria-label":u.usage,children:[(0,z.jsx)(`h3`,{children:u.usage}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.tokensShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.tokens24h,c(`drawer.usageNotMeasured`),Yd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.costShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.costUsd24h,c(`drawer.usageNotMeasured`),Xd)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:c(`drawer.durationShort`)}),(0,z.jsx)(`dd`,{children:Qd(t.usage?.durationMs24h,c(`drawer.usageNotMeasured`),Zd)})]})]})]}),i?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`goal-overview-source-note`,children:u.remote}),(0,z.jsx)(Ub,{goal:t})]}):(0,z.jsx)(Jx,{active:e,goal:t,items:n,userTodos:r,onSelect:o})]})}function Xx({activeTab:e,panels:t,scrollRef:n}){let[r,i]=(0,R.useState)(()=>new Set([e])),a=(0,R.useRef)({});return(0,R.useEffect)(()=>i(t=>t.has(e)?t:new Set([...t,e])),[e]),(0,R.useLayoutEffect)(()=>{let t=n.current;if(!t)return;t.scrollTop=a.current[e]??0;let r=()=>{a.current[e]=t.scrollTop};return t.addEventListener(`scroll`,r,{passive:!0}),()=>t.removeEventListener(`scroll`,r)},[e,n]),Object.keys(t).map(n=>r.has(n)||n===e?(0,z.jsx)(`div`,{className:`personal-goal-view-panel`,"data-goal-panel":n,hidden:n!==e,children:t[n]},n):null)}function Zx(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function Qx(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),state:`not_ready`}:e.listener_status===`retrying`&&e.listener_error_code===`lark_event_source_disconnected`?{label:t(`lark.health.sourceDisconnected`),detail:t(`lark.health.sourceDisconnectedDetail`),state:`not_ready`}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),state:`not_ready`}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),state:`not_ready`}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),state:`not_ready`}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),state:`not_ready`}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),state:`not_ready`}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),state:`ready`}:e.last_event_status===`context_only_captured`||e.last_event_status===`context_only_already_captured`?{label:t(`lark.health.contextCaptured`),detail:t(`lark.health.contextCapturedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),state:`ready`}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),state:`ready`}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),state:`not_ready`}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),state:`not_ready`}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),state:`ready`}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),state:`unverified`}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),state:e.reply_ready?`ready`:`not_ready`}}function $x(e){return e.history_permission_guidance?.api_document_url??null}function eS(e,t,n){if(e instanceof qh){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function tS({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=Ji(),[s,c]=(0,R.useState)(`connections`),[l,u]=(0,R.useState)([]),[d,f]=(0,R.useState)([]),[p,m]=(0,R.useState)(!0),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(t),[x,S]=(0,R.useState)(``),[C,w]=(0,R.useState)(r??n[0]?.goalId??``),[T,E]=(0,R.useState)(``),[D,O]=(0,R.useState)([]),[k,A]=(0,R.useState)(``),[ee,j]=(0,R.useState)(!1),[M,te]=(0,R.useState)(null),[ne,N]=(0,R.useState)(`addressed_only`),[P,re]=(0,R.useState)(t&&r?`goal`:`manager`),[ie,ae]=(0,R.useState)(`async_inbox`),[F,oe]=(0,R.useState)(`topic_reply`),[I,se]=(0,R.useState)(``),[L,ce]=(0,R.useState)(!1),[le,ue]=(0,R.useState)({}),[de,fe]=(0,R.useState)(!1),[pe,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),[_e,ve]=(0,R.useState)(null),[ye,be]=(0,R.useState)(null),[xe,Se]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(`loopx-workspace-bot`),[Te,Ee]=(0,R.useState)(`feishu`),[De,Oe]=(0,R.useState)(null),[ke,Ae]=(0,R.useState)(!1),[je,Me]=(0,R.useState)(null),Ne=(0,R.useRef)(null),Pe=(0,R.useRef)(null),Fe=(0,R.useRef)(!1);async function Ie(){m(!0),g(null);try{let[e,t]=await Promise.all([__(),E_()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(eS(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,R.useEffect)(()=>{Ie()},[]),(0,R.useEffect)(()=>{if(!t||p||Fe.current||!r)return;Fe.current=!0;let e=d.find(e=>e.goal_id===r);e?Je(e):V(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,R.useEffect)(()=>{if(!y||!x||_e){O([]),A(``),j(!1),te(null);return}let e=!1;j(!0),te(null);let t=window.setTimeout(()=>{w_(x,T).then(t=>{e||(O(t),A(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),A(``),te(eS(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||j(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y,_e]),(0,R.useEffect)(()=>{if(!xe||!De||[`ready`,`failed`,`cancelled`].includes(De.status))return;let e=!1,t=window.setTimeout(()=>{b_(De.setup_id).then(async t=>{e||(Oe(t),t.verification_url&&Pe.current!==t.verification_url&&(Pe.current=t.verification_url,Ne.current&&!Ne.current.closed&&(Ne.current.location.href=t.verification_url)),t.status===`ready`&&(await Ie(),S(t.app_ref),ue({}),Se(!1)),t.status===`failed`&&Me(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||Me(eS(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[xe,De]);let Le=n.find(e=>e.goalId===C),Re=Le?.agentId?[{agentId:Le.agentId,label:Le.agentLabel??Le.agentId}]:[],B=Le?.agentLanes?.length?Le.agentLanes:Re,ze=B.some(e=>e.agentId===I),Be=[];L?Be=B.map(e=>({agentId:e.agentId,appRef:le[e.agentId]??x})):ze&&(Be=[{agentId:I,appRef:x}]);let Ve=Be.map(e=>e.agentId),He=!!_e||Be.length>0&&Be.every(e=>l.some(t=>t.app_ref===e.appRef&&t.reply_ready)),Ue=o(`lark.connect`);he?Ue=o(`lark.saveConnection`):L&&(Ue=o(`lark.connectAllAgentsAction`,{count:Ve.length}));let We=l.find(e=>e.app_ref===x),Ge=D.find(e=>e.chat_id===k),Ke=(0,R.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]),qe=(0,R.useMemo)(()=>d.filter(e=>Qx(e,o).state===`unverified`).length,[d,o]);function V(e){let i=e??n.find(e=>e.goalId===r)??n[0];ge(null),ve(null),re(e||t?`goal`:`manager`),S(l.some(e=>e.app_ref===x)?x:l.find(e=>e.reply_ready)?.app_ref??l[0]?.app_ref??``),A(``),w(i?.goalId??``),se(i?.agentId??``),ce(!1),ue({}),N(`addressed_only`),ae(`async_inbox`),oe(`topic_reply`),E(``),me(null),b(!0)}function Je(e){ge(e.goal_id),ve(e),re(e.conversation_kind??`goal`),S(e.app_ref),w(e.goal_id);let t=n.find(t=>t.goalId===e.goal_id),r=t?.agentLanes?.length?t.agentLanes:t?.agentId?[{agentId:t.agentId}]:[];se(e.agent_id??(r.length===1?r[0].agentId:``)),ce(!1),ue({}),N(e.capture_scope),ae(e.ingress_mode===`direct_session`?`async_inbox`:e.ingress_mode),oe(e.reply_mode),E(e.chat_name),me(null),b(!0)}function Ye(){Oe(null),Me(null),Pe.current=null,Se(!0)}async function Xe(){if(!(ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce))){Ae(!0),Me(null),Pe.current=null,Ne.current=window.open(window.location.href,`_blank`);try{let e=await y_({appRef:Ce,brand:Te});Oe(e)}catch(e){Ne.current?.close(),Me(eS(e,o(`lark.error.setupStart`),o))}finally{Ae(!1)}}}async function Ze(){let e=De;if(Se(!1),Ne.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await x_(e.setup_id)}catch{}}async function Qe(){if(!(!x||!C||!_e&&!Ge||P===`goal`&&Ve.length===0||de)){fe(!0),me(null);try{let e={...P===`manager`?{..._e?{connectionId:_e.connection_id}:{appRef:x,chatId:Ge.chat_id,chatName:Ge.chat_name}}:_e?{connectionId:_e.connection_id,agentId:I}:{agentBindings:Be,chatId:Ge.chat_id,chatName:Ge.chat_name},conversationKind:P,captureScope:P===`manager`?`addressed_only`:ne,goalId:C,incomingMode:ne===`configured_chat_all`?`all`:`mentions`,ingressMode:P===`manager`?`session_queue`:ie,replyMode:F},t=await D_({...e,execute:!1});if(!t.ok)throw new qh(t.public_summary??t.blocker??o(`lark.error.bindPreview`),{error_code:t.blocker??`provider_api_failed`});let n=await D_({...e,execute:!0});if(!n.ok)throw new qh(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`});b(!1),await Ie(),i?.()}catch(e){me(eS(e,o(`lark.error.bind`),o))}finally{fe(!1)}}}async function $e(e,t){if(ye!==t){be(t);return}try{await O_(e,t),be(null),await Ie(),i?.()}catch(e){g(eS(e,o(`lark.error.disconnect`),o))}}return(0,z.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,z.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,z.jsx)(`h1`,{children:`Lark`})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,z.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,z.jsx)(`span`,{children:p?`…`:l.length})]}),(0,z.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,z.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,z.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,z.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,z.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,z.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ye,type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.newApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,z.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,z.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,z.jsx)(fm,{size:19})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,z.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,z.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,z.jsxs)(`div`,{className:`personal-lark-connections`,children:[qe>0?(0,z.jsxs)(`p`,{className:`personal-lark-route-readiness`,role:`status`,children:[(0,z.jsx)(Um,{size:15}),o(`lark.routesUnverified`,{count:qe})]}):null,(0,z.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(th,{size:16}),(0,z.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>V(),type:`button`,children:[(0,z.jsx)(Xm,{size:16}),o(`lark.connectApp`)]})]}),(0,z.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,z.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,z.jsx)(`span`,{children:o(`lark.connection`)}),(0,z.jsx)(`span`,{children:o(`common.goal`)}),(0,z.jsx)(`span`,{children:o(`lark.capture`)}),(0,z.jsx)(`span`,{children:o(`lark.processing`)}),(0,z.jsx)(`span`,{children:o(`common.actions`)})]}),Ke.map(e=>{let t=Qx(e,o);return(0,z.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.chat_name}),(0,z.jsxs)(`small`,{children:[e.app_label,` · `,t.label]}),(0,z.jsx)(`small`,{children:t.detail}),t.state===`unverified`?(0,z.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.openEventSettings`)]}):null,$x(e)?(0,z.jsxs)(`a`,{href:$x(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.goal_title}),(0,z.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,z.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.conversation_kind===`manager`?o(`lark.managerConversation`):Zx(e.ingress_mode,o).label}),(0,z.jsx)(`small`,{children:e.conversation_kind===`manager`?o(`lark.managerConversationDescription`):e.agent_id??Zx(e.ingress_mode,o).detail})]}),(0,z.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,z.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Je(e),type:`button`,children:(0,z.jsx)(ah,{size:15})}),(0,z.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:ye===e.connection_id?`is-confirm`:``,onClick:()=>void $e(e.goal_id,e.connection_id),type:`button`,children:[(0,z.jsx)(mh,{size:15}),ye===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)}),Ke.length===0?(0,z.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:`Goal Topic connection`}),(0,z.jsx)(`h2`,{id:`connect-lark-title`,children:o(he?`lark.editConnection`:`lark.connectApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.conversationKind`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.conversationKind`),disabled:!!_e,value:P,onChange:e=>re(e.target.value),children:[(0,z.jsx)(`option`,{value:`manager`,children:o(`lark.managerConversation`)}),(0,z.jsx)(`option`,{value:`goal`,children:o(`lark.workerConversation`)})]})]}),P===`manager`?(0,z.jsx)(`p`,{children:o(`lark.managerConversationDescription`)}):null,_e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`div`,{children:_e.app_label})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`div`,{children:_e.chat_name})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`div`,{children:_e.goal_title})]}),(0,z.jsx)(`small`,{children:o(`lark.editPreservesIdentity`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Ye():(S(e.target.value),ue({}))},value:x,children:p?(0,z.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,z.jsxs)(z.Fragment,{children:[l.map(e=>(0,z.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,z.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})}),(0,z.jsx)(`small`,{children:o(`lark.defaultAgentAppDescription`)})]}),We?.ready&&!We.reply_ready?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),ee?(0,z.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,z.jsx)(zm,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!ee&&M?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:M}):null,!ee&&!M&&D.length===0?(0,z.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!ee&&!M&&D.length>0?(0,z.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>A(e.target.value),value:k,children:D.map(e=>(0,z.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),se(n.find(e=>e.goalId===t)?.agentId??``),ue({})},value:C,children:n.map(e=>(0,z.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]})]}),(0,z.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,z.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,z.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,z.jsx)(Um,{size:15}),`# `,Le?.title??Le?.goalId??`Goal`]})]}),P===`goal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),disabled:_e?.ingress_mode===`direct_session`,onChange:e=>N(e.target.value),value:ne,children:[(0,z.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,z.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,z.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,z.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Zx(e,o);return(0,z.jsxs)(`label`,{className:ie===e?`is-active`:``,children:[(0,z.jsx)(`input`,{"aria-label":t.label,checked:ie===e,name:`lark-agent-ingress`,onChange:()=>ae(e),type:`radio`,value:e}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),disabled:!!_e?.agent_id,onChange:e=>se(e.target.value),value:I,children:[ze?null:(0,z.jsx)(`option`,{disabled:!0,value:I,children:I?o(`lark.agentUnavailable`,{agent:I}):o(`lark.noAgentConfigured`)}),B.map(e=>(0,z.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,z.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!he&&B.length>1?(0,z.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,z.jsx)(`input`,{checked:L,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,z.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:B.length})})]})]}):null,!he&&L&&B.length>1?(0,z.jsxs)(`fieldset`,{"aria-label":o(`lark.agentApps`),className:`personal-lark-agent-apps`,children:[(0,z.jsx)(`legend`,{children:o(`lark.agentApps`)}),(0,z.jsx)(`small`,{children:o(`lark.agentAppsDescription`)}),(0,z.jsx)(`div`,{children:B.map(e=>(0,z.jsxs)(`label`,{children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`small`,{children:e.agentId})]}),(0,z.jsx)(`select`,{"aria-label":o(`lark.agentAppSelection`,{agent:e.label}),onChange:t=>ue(n=>({...n,[e.agentId]:t.target.value})),value:le[e.agentId]??x,children:l.map(e=>(0,z.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref))})]},e.agentId))})]}):null,L&&Be.length>0&&!He?(0,z.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.agentAppPermissions`)}):null,Ve.length===0?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null]}):null,(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,z.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:F,children:(0,z.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,z.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,z.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,z.jsx)(hm,{size:15}),o(`lark.cardinality`)]}),pe?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:pe}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!_e&&(!We?.reply_ready||!k)||P===`goal`&&(!He||Ve.length===0)||!C||de,onClick:()=>void Qe(),type:`button`,children:[de?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):null,Ue]})]})]})}):null,xe?(0,z.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,z.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,z.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,z.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ze(),type:`button`,children:(0,z.jsx)(gh,{size:18})})]}),De?(0,z.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,z.jsx)(`span`,{className:`personal-lark-setup-icon is-${De.status}`,children:De.status===`ready`?(0,z.jsx)(hm,{size:22}):(0,z.jsx)(zm,{className:De.status===`failed`?``:`is-spinning`,size:22})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:De.status===`ready`?o(`lark.appCreated`):De.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,z.jsx)(`p`,{children:De.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):De.status===`starting`?o(`lark.waitingLink`):De.error})]}),De.verification_url?(0,z.jsxs)(`a`,{href:De.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(Dm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.profileName`)}),(0,z.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>we(e.target.value),placeholder:`loopx-workspace-bot`,value:Ce})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:o(`lark.region`)}),(0,z.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>Ee(e.target.value),value:Te,children:[(0,z.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,z.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),Ce&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce)?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),je?(0,z.jsx)(`p`,{className:`personal-notification-error`,children:je}):null,(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ze(),type:`button`,children:o(`lark.cancel`)}),De?null:(0,z.jsxs)(`button`,{className:`personal-primary-action`,disabled:ke||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(Ce),onClick:()=>void Xe(),type:`button`,children:[ke?(0,z.jsx)(zm,{className:`is-spinning`,size:15}):(0,z.jsx)(Dm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function nS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function rS(e,t,n){let r=nS(t),i=nS(n);return Object.fromEntries(e.fields.flatMap(({key:e,nullable:t})=>{let n=r[e],a=i[e];return Object.hasOwn(r,e)&&(n!=null||t&&n===null)?[[e,n]]:Object.hasOwn(i,e)&&a!=null?[[e,a]]:[]}))}function iS(e,t){let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=new Set(e.fields.map(e=>e.key));return Object.keys(n).some(e=>!r.has(e))?null:n}function aS(e,t,n){let r={...e,[t]:n},i=e.schedule;return t===`timezone`&&i&&typeof i==`object`&&`schema_version`in i&&i.schema_version===`periodic_report_schedule_v0`&&(r.schedule={...i,timezone:n}),r}function oS({id:e,value:t,timezone:n,onChange:r}){let{locale:i}=Ji(),a=i===`zh-CN`,o=t&&typeof t==`object`&&!Array.isArray(t)?t:null,s=String(o?.rrule??``).split(`;`).map(e=>e.split(`=`)),c=Object.fromEntries(s.filter(e=>e.length===2)),l=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],u=(e,t)=>e!==void 0&&/^\d+$/.test(e)&&Number(e)<=t,d=!o||o.schema_version===`periodic_report_schedule_v0`&&[`DAILY`,`WEEKLY`].includes(c.FREQ)&&o.timezone===n&&s.every(e=>e.length===2&&[`FREQ`,`BYDAY`,`BYHOUR`,`BYMINUTE`,`INTERVAL`].includes(e[0]))&&new Set(s.map(([e])=>e)).size===s.length&&u(c.BYHOUR,23)&&u(c.BYMINUTE??`0`,59)&&(c.FREQ===`WEEKLY`?l.includes(c.BYDAY):!c.BYDAY)&&(!c.INTERVAL||c.INTERVAL===`1`),f=a?[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`];function p(e){let t={FREQ:`WEEKLY`,BYDAY:`MO`,BYHOUR:`9`,BYMINUTE:`0`,...c,...e};r?.({schema_version:`periodic_report_schedule_v0`,schedule_id:o?.schedule_id??`report-schedule`,timezone:n,rrule:[`FREQ=${t.FREQ}`,...t.FREQ===`WEEKLY`?[`BYDAY=${t.BYDAY}`]:[],`BYHOUR=${t.BYHOUR}`,`BYMINUTE=${t.BYMINUTE}`].join(`;`)})}return(0,z.jsxs)(`div`,{className:`personal-report-schedule`,children:[(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:e,children:[(0,z.jsx)(`span`,{children:a?`按日历汇报`:`Calendar reports`}),(0,z.jsx)(`input`,{id:e,type:`checkbox`,role:`switch`,checked:!!o,disabled:!r,onChange:e=>e.target.checked?p({}):r?.(null)})]}),o?(0,z.jsxs)(z.Fragment,{children:[d?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{htmlFor:`${e}-frequency`,children:[(0,z.jsx)(`span`,{children:a?`频率`:`Frequency`}),(0,z.jsxs)(`select`,{id:`${e}-frequency`,value:c.FREQ,disabled:!r,onChange:e=>p({FREQ:e.target.value}),children:[(0,z.jsx)(`option`,{value:`DAILY`,children:a?`每天`:`Daily`}),(0,z.jsx)(`option`,{value:`WEEKLY`,children:a?`每周`:`Weekly`})]})]}),c.FREQ===`WEEKLY`&&(0,z.jsxs)(`label`,{htmlFor:`${e}-day`,children:[(0,z.jsx)(`span`,{children:a?`星期`:`Weekday`}),(0,z.jsx)(`select`,{id:`${e}-day`,value:c.BYDAY,disabled:!r,onChange:e=>p({BYDAY:e.target.value}),children:l.map((e,t)=>(0,z.jsx)(`option`,{value:e,children:f[t]},e))})]}),(0,z.jsxs)(`label`,{htmlFor:`${e}-time`,children:[(0,z.jsxs)(`span`,{children:[a?`当地时间`:`Local time`,` (`,n,`)`]}),(0,z.jsx)(`input`,{id:`${e}-time`,type:`time`,required:!0,disabled:!r,value:`${(c.BYHOUR??`9`).padStart(2,`0`)}:${(c.BYMINUTE??`0`).padStart(2,`0`)}`,onChange:e=>{if(!/^\d{2}:\d{2}$/.test(e.target.value))return;let[t,n]=e.target.value.split(`:`);p({BYHOUR:t,BYMINUTE:n})}})]})]}):(0,z.jsx)(`p`,{role:`alert`,children:a?`此计划需在 JSON 模式中编辑;当前内容已保留。`:`Edit this schedule in JSON mode; its current value is preserved.`}),(0,z.jsx)(`p`,{children:a?`由现有唤醒检查到期计划;实际送达以回执为准。`:`Existing wakes check the schedule; delivery is confirmed by its receipt.`})]}):(0,z.jsx)(`p`,{children:a?`未设置日历计划;保持阶段结束时汇报。`:`No calendar schedule; report at validated stage boundaries.`})]})}function sS({copy:e,field:t,id:n,onChange:r,value:i,timezone:a}){let o=e[t.key]?.label??t.label,s=!r;if(t.input_kind===`periodic_report_schedule`)return(0,z.jsx)(oS,{id:n,value:i,timezone:a,onChange:r?e=>r(t.key,e):void 0});if(t.input_kind===`boolean`)return(0,z.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,role:`switch`,type:`checkbox`})]});if(t.input_kind===`select`)return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,z.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})]});if(t.input_kind===`string_list`)return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` -`):``})]});let c=t.input_kind===`number`;return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,description:`配置本机管家的执行器、模型与选择边界;锁定路径禁止替代,灵活池只允许在已授权范围内回退。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},uS={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function dS(e,t){let n=lS[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await o_(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=rS(n.configuration_editor,i.draft,n.default),o=await s_(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.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)(om,{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=LS[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)(tS,{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)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{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)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({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 WS(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 GS(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 KS(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 qS({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=Jd(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?KS(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)(ym,{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 JS({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)(Qm,{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)(ym,{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)(jm,{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)(jm,{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,KS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function YS({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)(fm,{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)(Rm,{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)(gh,{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)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({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)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{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 ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(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`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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(` +`):``})]});let c=t.input_kind===`number`;return(0,z.jsxs)(`label`,{htmlFor:n,children:[(0,z.jsx)(`span`,{children:o}),(0,z.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``})]})}function cS({copy:e={},disabled:t=!1,editor:n,enabledAction:r,omitKeys:i=[],onChange:a,value:o}){let s=(0,R.useId)(),c=new Set(i);return(0,z.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!c.has(e.key)).map(t=>{let n=(0,z.jsx)(sS,{copy:e,field:t,id:`${s}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:a,value:o[t.key],timezone:String(o.timezone??`UTC`)},t.key);return t.key===`enabled`&&t.input_kind===`boolean`?(0,z.jsxs)(`div`,{className:`personal-capability-enabled-row`,children:[n,r]},t.key):n})})}var lS={en:{manager_runtime:{displayName:`Manager runtime`,description:`Selects the persistent host-tool profile used by owner manager conversations.`},steward_executor:{displayName:`Steward executor`,description:`Guides the steward executor, model, and selection boundary for this machine. A pinned route blocks substitution; a flexible pool permits only authorized fallback.`},todo_replan_cadence:{displayName:`Goal review cadence`,description:`Configures the Goal review cadence.`},change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},progress_review:{displayName:`Progress-review sentinel`,description:`Records typed drift receipts from an external bounded review of scoped file deltas; assist may raise the existing autonomous replan obligation.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},coordination_runtime_shadow:{displayName:`Coordination runtime shadow`,description:`Captures transaction-bound Todo and task-lease mutations for reviewed whole-Goal coordination-authority promotion.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},pull_request_review:{displayName:`Pull-request review`,description:`Ranks the public GitHub PR review queue with a machine-level default; it never grants GitHub, Todo, push, or merge authority.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Configures a reviewed local-private provider binding for Goal-scoped Agent recall and evidence-backed outcome learning.`}},"zh-CN":{manager_runtime:{displayName:`管家 Runtime`,description:`选择管家会话持续生效的宿主工具模式。`},steward_executor:{displayName:`管家执行器`,description:`配置本机管家的执行器、模型与选择边界;锁定路径禁止替代,灵活池只允许在已授权范围内回退。`},todo_replan_cadence:{displayName:`Goal 复核周期`,description:`配置 Goal 的复核周期。`},change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},progress_review:{displayName:`进展评估哨兵`,description:`记录外部有界评估对限定文件变化给出的类型化漂移回执;assist 模式可触发已有的自主重规划义务。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},coordination_runtime_shadow:{displayName:`协调 Runtime 影子`,description:`捕获事务绑定的 Todo 与 task lease 变更,为经评审的整 Goal 协调 Authority 晋级提供证据。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},pull_request_review:{displayName:`Pull-request Review`,description:`配置公开 GitHub PR 审阅队列的本机默认排序;不会授予 GitHub、Todo、push 或 merge 权限。`},reward_memory:{displayName:`Reward Memory 实验`,description:`为 Goal 内 Agent 的召回与证据化结果学习配置经过审阅的本机私有 Provider 绑定。`}}},uS={en:{runtime_profile:{label:`Runtime profile`,description:`Restricted keeps scoped LoopX reads only. Trusted owner enables normal host tools while protected operations retain separate checks.`},selection_policy:{label:`Selection policy`,description:`Preferred allows an explicit user choice; pinned rejects another executor; flexible permits fallback only inside the eligible pool.`},executor_endpoint:{label:`Primary steward executor`,description:`The preferred or pinned executor for this machine. In a flexible pool it is tried first when available.`},eligible_endpoints:{label:`Flexible eligible executors`,description:`One authorized executor per line. Use only with flexible selection and include the primary executor.`},executor_model:{label:`Model`,description:`Optional model for the selected executor. Leave blank to keep the executor's own default.`},executor_reasoning_effort:{label:`Reasoning effort`,description:`Optional reasoning effort for the selected executor. Leave blank to keep the executor's own default.`},completed_todos:{label:`Completed Todos between Goal reviews`,description:`Machine default or explicit Goal override, from 1 to 5.`},allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},model:{label:`Child model`,description:`For example gpt-5.6-luna. Blank clears the child model preference.`},reasoning_effort:{label:`Child reasoning effort`,description:`For example max; the host must support this model and effort.`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},wait_for_ci:{label:`Wait for CI`,description:`Disable to use local validation without querying or waiting for CI. Merge authority is unchanged.`},review_priority:{label:`Review priority`,description:`Choose whether other developers' PRs or the authenticated reviewer's own PRs are ranked first.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`},schedule:{label:`Calendar reports`,description:`Optional daily or weekly reports; no schedule preserves stage-only delivery.`},config_path:{label:`Local-private configuration path`,description:`Repo-relative ignored JSON under .loopx/config/. Leave blank to retain the current binding; the path is never returned.`},enabled_agents:{label:`Enabled Goal Agents`,description:`Enter one registered Goal-local Agent id per line. A private binding currently accepts exactly one Agent.`}},"zh-CN":{runtime_profile:{label:`运行模式`,description:`restricted 仅使用受限 LoopX 读取;trusted_owner 开放常规宿主工具,但受保护操作仍单独校验。`},selection_policy:{label:`选择策略`,description:`preferred 允许用户显式改选;pinned 拒绝其他执行器;flexible 只在已授权资源池内回退。`},executor_endpoint:{label:`首选管家执行器`,description:`本机首选或锁定的执行器;灵活池模式下优先尝试它。`},eligible_endpoints:{label:`灵活池可用执行器`,description:`每行一个已授权执行器,仅用于 flexible;必须包含首选执行器。`},executor_model:{label:`模型`,description:`所选执行器使用的模型,可留空;留空表示沿用执行器自身的默认模型。`},executor_reasoning_effort:{label:`推理档位`,description:`所选执行器使用的推理档位,可留空;留空表示沿用执行器自身的默认档位。`},completed_todos:{label:`两次 Goal 复核间的已完成 Todo 数`,description:`可设置 1–5;机器默认值可被 Goal 显式覆盖。`},allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},model:{label:`子 Agent 模型`,description:`例如 gpt-5.6-luna;留空清除模型偏好。`},reasoning_effort:{label:`子 Agent 推理档位`,description:`例如 max;宿主须支持所选模型与档位。`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},wait_for_ci:{label:`等待 CI`,description:`关闭后使用本地验证,不查询或等待 CI;不改变合并权限。`},review_priority:{label:`审阅优先级`,description:`选择先排其他开发者的 PR,还是先排当前已认证审阅者自己的 PR。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`},schedule:{label:`日历汇报`,description:`可选每日或每周计划;未设置时保持阶段结束汇报。`},config_path:{label:`本机私有配置路径`,description:`填写 .loopx/config/ 下、相对仓库且被忽略的 JSON;留空保留当前绑定,路径不会被回传。`},enabled_agents:{label:`已启用的 Goal Agent`,description:`每行填写一个已注册的 Goal 内 Agent ID;私有绑定当前只接受一个 Agent。`}}};function dS(e,t){let n=lS[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function fS(e){return uS[e]}Object.freeze(Object.keys(lS.en).sort());function pS(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function mS({values:e,t}){return(0,z.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,z.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,z.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function hS({source:e,t}){return e?(0,z.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:15}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function gS({available:e,description:t,t:n}){return e?null:(0,z.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,z.jsx)(`p`,{children:t})]})]})}function _S(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function vS(e,t){return[...e].sort((e,n)=>{let r=_S(e)-_S(n);if(r!==0)return r;let i=dS(e,t),a=dS(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function yS({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,z.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,tabIndex:0,children:vS(e,t).map(e=>{let o=dS(e,t);return(0,z.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(`strong`,{children:o.display_name})}),(0,z.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function bS({capability:e,locale:t,source:n}){let{t:r}=Ji(),i=dS(e,t);return(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`span`,{className:`personal-settings-icon`,children:(0,z.jsx)(sh,{"aria-hidden":!0,size:18})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`personal-capability-heading-row`,children:[(0,z.jsx)(`h2`,{children:i.display_name}),(0,z.jsx)(hS,{source:n,t:r})]}),e.context_contribution&&(0,z.jsxs)(`details`,{className:`personal-capability-help`,"data-testid":`capability-context-phases`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`主 Agent 协作指导`:`Coordinator workflow guidance`}),(0,z.jsx)(`p`,{children:t===`zh-CN`?`随能力开启。支持以下阶段;此处展示能力范围,不能证明某次运行已读取或采纳。`:`Enabled with this capability. These are supported phases, not proof that a run read or adopted the guidance.`}),(0,z.jsx)(`dl`,{children:e.context_contribution.supported_phases.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:(0,z.jsx)(`code`,{children:e})}),(0,z.jsx)(`dd`,{children:xS[e][t===`zh-CN`?`zh`:`en`]})]},e))}),(0,z.jsx)(`p`,{children:t===`zh-CN`?`LoopX Turn 在请求与结果中提供上下文;原生工具入口由 LoopX skill 调用同一只读接口。执行与采纳需另看运行证据。`:`LoopX Turn includes context in requests and results. For native tools, the LoopX skill reads the same interface. Execution and adoption require run evidence.`})]}),(0,z.jsxs)(`details`,{className:`personal-capability-help`,children:[(0,z.jsx)(`summary`,{children:t===`zh-CN`?`配置说明`:`Configuration help`}),(0,z.jsx)(`p`,{children:i.description}),(0,z.jsx)(`dl`,{children:e.configuration_editor.fields.map(e=>{let n=fS(t)[e.key],r=n?.description??e.description;return r?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:n?.label??e.label}),(0,z.jsx)(`dd`,{children:r})]},e.key):null})})]},e.capability_id)]})]})}var xS={before_plan:{zh:`规划前:识别独立问题并保留主 Agent 的核验与整合职责。`,en:`Before planning: identify independent questions and retain coordinator validation and integration.`},before_delegate:{zh:`委派前:明确子任务边界、模型偏好及预期证据。`,en:`Before delegation: specify task boundaries, model preferences and expected evidence.`},after_delegate_result:{zh:`回收后:核验结果,说明采纳决定并关联计划与成果。`,en:`After results: validate evidence, explain acceptance and link plans and deliverables.`}};function SS({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);async function l(n){if(e.onToggleGoalAutoNotify){o(!0),c(null);try{let a=await e.onToggleGoalAutoNotify({autoNotify:n,goalId:t});if(!a.ok){c(a.public_summary??a.blocker??i(`notifications.setupFailed`));return}r()}catch(e){c(e instanceof Error?e.message:i(`notifications.setupFailed`))}finally{o(!1)}}}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`personal-notification-toggle`,children:[(0,z.jsx)(`input`,{checked:n?.humanGateAutoNotifyEnabled??!1,disabled:a||n?.configured!==!0||!e.onToggleGoalAutoNotify,onChange:e=>void l(e.target.checked),type:`checkbox`}),(0,z.jsx)(`span`,{children:i(`notifications.autoNotify`)}),a?(0,z.jsx)(zm,{"aria-hidden":!0,className:`is-spinning`,size:14}):null]}),s?(0,z.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:s}):null]})}function CS({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,R.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(`guided`),[u,d]=(0,R.useState)(``),f=(0,R.useMemo)(()=>n?iS(n.configuration_editor,u):null,[n,u]),p=c===`guided`||f!==null;(0,R.useEffect)(()=>{l(`guided`),d(``),a({busy:null,draft:rS(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function m(t){if(!(!n||i.busy||!p)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await o_(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function h(){if(!(!n||!i.preview||i.busy||!p)){a(e=>({...e,busy:`apply`})),s(null);try{let r=rS(n.configuration_editor,i.draft,n.default),o=await s_(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function g(e,t){a(r=>({...r,draft:n?.capability_id===`periodic_report`?aS(r.draft,e,t):{...r.draft,[e]:t},preview:null})),s(null)}function _(e){if(!n||i.busy)return;d(e);let t=iS(n.configuration_editor,e);a(e=>({...e,preview:null,draft:t?rS(n.configuration_editor,t,n.default):e.draft})),s(null)}function v(){i.busy||!p||(c===`guided`&&d(JSON.stringify(i.draft,null,2)),l(c===`guided`?`json`:`guided`),a(e=>({...e,preview:null})))}return{apply:h,changeDraft:g,changeJson:_,changeMode:v,editorMode:c,jsonDraft:u,jsonValid:p,error:o,mutation:i,preview:m}}function wS({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=Ji();return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,z.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWrite`:`capabilities.partialWrite`)}),(0,z.jsx)(`p`,{children:i(n.host_capacity_pending?`capabilities.hostCapacityPartialWriteDescription`:`capabilities.partialWriteDescription`)}),(0,z.jsx)(`small`,{children:n.recommended_action})]}),(0,z.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,z.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,z.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,z.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),r.codex_host_capacity?(0,z.jsx)(`span`,{children:i(r.codex_host_capacity.write_required?`drawer.subagentHostCapacityRaise`:`drawer.subagentHostCapacityReady`,{configured:r.codex_host_capacity.configured_children??i(`drawer.subagentHostCapacityImplicit`),required:r.codex_host_capacity.required_children})}):null,(0,z.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function TS({callbacks:e,catalog:t,goalId:n,notification:r,onApplied:i,onNotificationChanged:a}){let{locale:o,t:s}=Ji(),c=(0,R.useMemo)(()=>vS(t.capabilities,o),[t.capabilities,o]),[l,u]=(0,R.useState)(()=>c[0]?.capability_id??``),d=(0,R.useMemo)(()=>c.find(e=>e.capability_id===l)??c[0],[c,l]),f=(0,R.useMemo)(()=>d?dS(d,o):void 0,[o,d]),{apply:p,changeDraft:m,changeJson:h,changeMode:g,editorMode:_,jsonDraft:v,jsonValid:y,error:b,mutation:x,preview:S}=CS({goalId:n,onApplied:i,selected:f,t:s}),{busy:C,draft:w,partialWrite:T,preview:E}=x;if(!d||!f)return(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:s(`capabilities.empty`)});let D=f.available_scopes.includes(`goal`),O=pS(f,`goal`),k=f.configuration_editor.read_only_reason??s(D?`capabilities.previewOnly`:`capabilities.machineOnly`);async function A(){if(!f||!O||C||!y)return;let e=rS(f.configuration_editor,w,f.default);await S(e)}async function ee(){!O||C||await S(null)}return(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:t.capabilities,locale:o,onSelect:u,scope:`goal`,selectedCapabilityId:f.capability_id,t:s}),(0,z.jsxs)(`article`,{"aria-label":f.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:d,locale:o,source:f.effective_configuration?.source}),(0,z.jsx)(gS,{available:O,t:s,description:k}),f.capability_id===`lark_event_inbox`?(0,z.jsxs)(`section`,{className:`personal-capability-linked-setting`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:s(`capabilities.larkInboxNotificationSetting`)}),(0,z.jsx)(`p`,{children:s(`capabilities.larkInboxNotificationDescription`)})]}),(0,z.jsx)(SS,{callbacks:e,goalId:n,notification:r,onChanged:a})]}):null,O?(0,z.jsxs)(z.Fragment,{children:[_===`json`||!f.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{disabled:!!C||!y,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(_===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,_===`guided`?(0,z.jsx)(`section`,{className:`personal-capability-field-summary`,children:(0,z.jsx)(cS,{disabled:!!C,copy:fS(o),editor:f.configuration_editor,onChange:m,value:w,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:g,type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),s(`machine.editJson`)]})})}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`goal-configuration-json`,children:[(0,z.jsx)(`span`,{children:s(`capabilities.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{id:`goal-configuration-json`,"aria-describedby":`goal-configuration-json-help`,disabled:!!C,onChange:e=>h(e.target.value),rows:12,spellCheck:!1,value:v}),(0,z.jsx)(`small`,{id:`goal-configuration-json-help`,children:s(`capabilities.jsonHelp`)}),y?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:s(`capabilities.jsonInvalid`)})]})]}):null,(0,z.jsx)(wS,{mutationError:b,onApplied:i,partialWrite:T,preview:E}),O?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[f.current&&f.available_scopes.includes(`machine`)?(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void ee(),type:`button`,children:s(`capabilities.restoreInheritance`)}):null,(0,z.jsx)(`button`,{disabled:!!C||!y,onClick:()=>void A(),type:`button`,children:s(C===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!C||!E||!y,onClick:()=>void p(),type:`button`,children:s(C===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,z.jsx)(mS,{values:[{label:s(`capabilities.goalValue`),value:f.current},{label:s(f.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:f.machine_current??f.default}],t:s},d.capability_id)]})]})}function ES({callbacks:e,goalId:t,notification:n,onChanged:r}){let{t:i}=Ji(),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);function d(){t&&(u(!0),c(null),a_(t).then(o).catch(e=>c(e instanceof Error?e.message:i(`capabilities.loadFailed`))).finally(()=>u(!1)))}return(0,R.useEffect)(d,[t]),t?l&&!a?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,z.jsx)(zm,{className:`personal-spin`,size:18}),i(`capabilities.loading`)]}):s?(0,z.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,z.jsx)(ph,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:i(`capabilities.loadFailed`)}),(0,z.jsx)(`small`,{children:s})]}),(0,z.jsxs)(`button`,{onClick:d,type:`button`,children:[(0,z.jsx)(Qm,{"aria-hidden":!0,size:15}),i(`capabilities.retry`)]})]}):a?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":a.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),i(`capabilities.atomicOverride`)]}),(0,z.jsx)(`p`,{children:i(`capabilities.atomicOverrideDescription`)})]}),(0,z.jsx)(TS,{callbacks:e,catalog:a.capability_catalog,goalId:t,notification:n,onApplied:d,onNotificationChanged:r})]}):null:(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.chooseGoal`)})}function DS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function OS(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function kS(e,t,n){let r={...DS(e.default),...DS(t),...n};return e.capability_id===`steward_executor`&&(Object.hasOwn(n,`selection_policy`)||Object.hasOwn(n,`eligible_endpoints`))&&(r.schema_version=DS(e.default).schema_version),r}function AS(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}if(e.capability_id===`periodic_report`&&t.enabled===!0)return!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim());if(e.capability_id===`steward_executor`){let e=String(t.selection_policy??`preferred`),n=String(t.executor_endpoint??``),r=Array.isArray(t.eligible_endpoints)?t.eligible_endpoints.map(e=>String(e)):[];return e===`flexible`?r.length>0&&r.includes(n)&&new Set(r).size===r.length:r.length===0}return!0}function jS(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function MS(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function NS(){let{locale:e,t}=Ji(),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(`{}`),[u,d]=(0,R.useState)(`guided`),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`upsert`),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(`load`),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useMemo)(()=>vS(n?.capability_catalog.capabilities??[],e),[n,e]),D=n?.invalid_namespaces[0],O=E.find(e=>e.capability_id===i)??(D?E.find(e=>e.machine_namespace===D):void 0)??E.find(e=>pS(e,`machine`))??E[0],k=O?dS(O,e):void 0,A=OS(n,k),ee=!!(k?.machine_namespace&&A),j=!!(k&&pS(k,`machine`)),M=(0,R.useMemo)(()=>jS(c),[c]),te=k?u===`json`?M:kS(k,A,o):null,ne=!!(k&&(u===`json`?M:AS(k,te??{})));async function N(){r(await i_())}(0,R.useEffect)(()=>{let e=!0;return i_().then(t=>{e&&r(t)}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,R.useEffect)(()=>{if(!k)return;let e=OS(n,k),t=rS(k.configuration_editor,e??k.default,k.default),r=kS(k,e,t);s(t),l(JSON.stringify(r,null,2)),d(j?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function P(e,t){s(n=>k?.capability_id===`periodic_report`?aS(n,e,t):{...n,[e]:t}),p(null),h(`upsert`),C(null),T(null)}function re(e){if(k){if(e===`json`)l(JSON.stringify(kS(k,A,o),null,2));else if(M)s(rS(k.configuration_editor,M,k.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!j||!k?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(k.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!j||!k?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(k.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function F(){if(!j||!k?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(k.machine_namespace,f.plan_revision):await l_(k.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await N(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function oe(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function I(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await N(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):k?(0,z.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),t(`machine.liveDefault`)]}),(0,z.jsx)(`p`,{children:t(`machine.liveDefaultDescription`)})]}),(0,z.jsxs)(`div`,{className:`personal-capability-body`,children:[n?.status===`invalid`?(0,z.jsxs)(`section`,{className:`personal-machine-error`,"data-testid":`machine-invalid-repair`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:t(`machine.invalidStoredConfiguration`)}),(0,z.jsx)(`p`,{children:t(`machine.invalidStoredConfigurationDescription`)})]}):null,(0,z.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,z.jsx)(yS,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:k.capability_id,t}),(0,z.jsxs)(`article`,{"aria-label":k.display_name,className:`personal-capability-detail`,tabIndex:0,children:[(0,z.jsx)(bS,{capability:O,locale:e,source:k.available_scopes.includes(`machine`)?ee?`machine_default`:`capability_default`:void 0}),(0,z.jsx)(gS,{available:j,t,description:k.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),k.capability_id===`periodic_report`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:A?.schedule?e===`zh-CN`?`日历与阶段汇报`:`Calendar and stage reports`:t(`machine.periodicReportActivation`)}),(0,z.jsx)(`p`,{children:A?.schedule?A.enabled===!0?e===`zh-CN`?`已配置日历计划,由现有唤醒检查;是否送达请核对报告回执。`:`A calendar schedule is configured and checked by existing wakes. Verify delivery in the report receipt.`:e===`zh-CN`?`日历计划已保存;启用此能力后才会检查和投递。`:`The schedule is saved; enable this capability to check and deliver reports.`:t(`machine.periodicReportActivationDescription`)})]})]}):null,k.capability_id===`change_quality_qualification`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.changeQualityActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.changeQualityActivationDescription`)})]})]}):null,k.capability_id===`todo_replan_cadence`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.replanCadenceActivation`)}),(0,z.jsx)(`p`,{children:t(`machine.replanCadenceActivationDescription`)})]})]}):null,k.capability_id===`pull_request_review`?(0,z.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:18}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e===`zh-CN`?`只改变队列排序`:`Queue ordering only`}),(0,z.jsx)(`p`,{children:e===`zh-CN`?`默认先审阅其他开发者的 PR;选择 owner-first 才会优先当前已认证审阅者自己的 PR。此配置不会发布 review、写 Todo、push 或 merge。`:`The default reviews other developers' PRs first; choose owner-first only when the authenticated reviewer's own PRs should lead. This setting never posts a review, writes Todos, pushes, or merges.`})]})]}):null,j?(0,z.jsxs)(z.Fragment,{children:[u===`json`||!k.configuration_editor.fields.some(e=>e.key===`enabled`&&e.input_kind===`boolean`)?(0,z.jsx)(`div`,{className:`personal-capability-editor-mode`,children:(0,z.jsxs)(`button`,{onClick:()=>re(u===`guided`?`json`:`guided`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(u===`guided`?`machine.editJson`:`machine.backToForm`)]})}):null,u===`guided`?(0,z.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,z.jsx)(cS,{copy:fS(e),disabled:!!b,editor:k.configuration_editor,onChange:P,value:o,enabledAction:(0,z.jsxs)(`button`,{className:`personal-capability-edit-json`,onClick:()=>re(`json`),type:`button`,children:[(0,z.jsx)(Sm,{"aria-hidden":!0,size:14}),t(`machine.editJson`)]})}),ne?null:(0,z.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,z.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,z.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,z.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,z.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),M?null:(0,z.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),w]}):null,f?(0,z.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.preview`)}),(0,z.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,z.jsxs)(`dl`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,z.jsx)(`dd`,{title:f.current_revision,children:MS(f.current_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,z.jsx)(`dd`,{title:f.desired_revision,children:MS(f.desired_revision)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,z.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,z.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,z.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,z.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,z.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?I():oe()),type:`button`,children:[(0,z.jsx)($m,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,j?(0,z.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,z.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,z.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void F(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,k.available_scopes.includes(`machine`)?(0,z.jsx)(mS,{values:[{label:t(`machine.currentValue`),value:A},{label:t(`capabilities.defaultValue`),value:k.default}],t},k.capability_id):null]})]})]})]}):(0,z.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}function PS(e,t){return t(e===`invalid`?`machine.credentialInvalid`:e===`configured`?`machine.credentialConfigured`:`machine.credentialAbsent`)}function FS(e,t){return t(e===`machine_store`?`machine.credentialSourceMachine`:e===`service_environment`?`machine.credentialSourceEnvironment`:`machine.credentialSourceUnset`)}function IS(){let{t:e}=Ji(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),p=(0,R.useCallback)(async()=>{c(`load`);try{let e=await n_();n(e),o(String(e.base_url.value??``))}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}},[e]);(0,R.useEffect)(()=>{p()},[p]);async function m(t,r){c(`store`),u(null),f(null);try{let e=await r_(t);n(e),o(String(e.base_url.value??``)),i(``),f(r)}catch(t){u(t instanceof Error?t.message:e(`machine.credentialError`))}finally{c(``)}}if(!t&&s===`load`)return(0,z.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:e(`common.loading`)});let h=t?`${PS(t.provider_key.configured?`configured`:`absent`,e)} · ${FS(t.provider_key.source,e)}`:``,g=t?`${t.base_url.value??e(`machine.credentialAbsent`)} · ${FS(t.base_url.source,e)}`:``;return(0,z.jsxs)(`section`,{className:`personal-operator-credential`,"data-testid":`operator-credential-settings`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(Fm,{"aria-hidden":!0,size:17}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e(`machine.credentialTitle`)}),(0,z.jsx)(`p`,{children:e(`machine.credentialDescription`)})]}),(0,z.jsx)(`span`,{className:`personal-operator-credential-status`,children:t?PS(t.status,e):e(`common.loading`)})]}),t?(0,z.jsxs)(`dl`,{className:`personal-operator-credential-readback`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`dd`,{children:h})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialFingerprint`)}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.provider_key.fingerprint??e(`common.none`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`dd`,{children:g})]})]}):null,t?.status===`invalid`&&t.repair?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:t.repair}):null,(0,z.jsxs)(`label`,{htmlFor:`operator-credential-api-key`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialApiKey`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-api-key`,onChange:e=>i(e.target.value),placeholder:e(`machine.credentialApiKeyPlaceholder`),type:`password`,value:r})]}),(0,z.jsxs)(`label`,{htmlFor:`operator-credential-base-url`,children:[(0,z.jsx)(`span`,{children:e(`machine.credentialBaseUrl`)}),(0,z.jsx)(`input`,{autoComplete:`off`,disabled:!!s,id:`operator-credential-base-url`,onChange:e=>o(e.target.value),placeholder:e(`machine.credentialBaseUrlPlaceholder`),type:`text`,value:a})]}),l?(0,z.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:l}):null,d?(0,z.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,z.jsx)(hm,{"aria-hidden":!0,size:16}),d]}):null,(0,z.jsxs)(`footer`,{className:`personal-operator-credential-actions`,children:[(0,z.jsx)(`button`,{className:`is-primary`,disabled:!!s||!r.trim()&&!a.trim(),onClick:()=>void m({...r.trim()?{provider_key:r}:{},...a.trim()?{base_url:a}:{}},e(`machine.credentialStored`)),type:`button`,children:e(s===`store`?`common.loading`:`machine.credentialStore`)}),(0,z.jsxs)(`button`,{disabled:!!s||t?.provider_key.configured!==!0,onClick:()=>void m({clear_provider_key:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearKey`)]}),(0,z.jsxs)(`button`,{disabled:!!s||t?.base_url.configured!==!0,onClick:()=>void m({clear_base_url:!0},e(`machine.credentialCleared`)),type:`button`,children:[(0,z.jsx)(fh,{"aria-hidden":!0,size:15}),e(`machine.credentialClearUrl`)]})]}),(0,z.jsxs)(`details`,{className:`personal-capability-scope-note`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(oh,{"aria-hidden":!0,size:17}),e(`machine.credentialTitle`)]}),(0,z.jsx)(`p`,{children:e(`machine.credentialBoundary`)})]})]})}var LS={appearance:Km,capabilities:sh,language:Im,lark:ah,machine:rh,provider:Fm};function RS({callbacks:e,focusGoalConnection:t=!1,goals:n,initialGoalId:r,initialTab:i=`lark`,goalNotifications:a,onChanged:o,onClose:s,onThemeChange:c,theme:l}){let{locale:u,setLocale:d,t:f}=Ji(),[p,m]=(0,R.useState)(i),h=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{if(e.scrollWidth<=e.clientWidth)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.leftn.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)(om,{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=LS[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)(tS,{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)(IS,{})}):null,p===`machine`?(0,z.jsx)(NS,{}):null,p===`capabilities`?(0,z.jsx)(ES,{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)(hm,{"aria-hidden":!0,size:17}):null]},e.value))})}):null]})]})}var zS=`loopx-pw-theme`,BS=`loopx`;function VS(){try{let e=window.localStorage.getItem(zS);return e===`loopx`||e===`paper`||e===`brutal`?e:BS}catch{return BS}}function HS(e){try{window.localStorage.setItem(zS,e)}catch{}}function US({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 WS(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 GS(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 KS(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 qS({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=Jd(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?KS(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)(ym,{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 JS({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)(Qm,{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)(ym,{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)(jm,{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)(jm,{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,KS(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function YS({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)(fm,{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)(Rm,{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)(gh,{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)(wb,{text:t.text}),t.pending?(0,z.jsx)(`small`,{children:o(`conversation.agentPending`)}):null,(0,z.jsx)(Wy,{request:t.collaboration}),(0,z.jsx)(Vb,{delivery:t.returnDelivery})]})]},t.id))})]})}function XS({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)(fm,{size:17}),r(`session.record`)]}),(0,z.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,z.jsx)(gh,{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 ZS(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??Kd(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>Jd(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`})}qd(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 QS(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function $S(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 eC(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 tC(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 nC(e,t){let n=tC(e),r=eb(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`?db(ub(e.receipt),t):t(`proposal.summary.teamPlan`,{goal:ob(e.normalized_parameters),count:ab(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`?eC(e,r,t):e.action_kind===`team.plan`?ib(e.normalized_parameters,t):$S(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`:QS(e.status),teamPlanOutcome:e.action_kind===`team.plan`?ub(e.receipt)??void 0:void 0,teamPlanAssignments:e.action_kind===`team.plan`?sb(e.receipt,e.normalized_parameters):void 0,teamPlanGapLanes:e.action_kind===`team.plan`?cb(e.receipt,e.normalized_parameters):void 0,title:c}}function rC(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 iC(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 aC(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 oC(e,t){let n=aC(e,[`目标`,`Objective`]),r=aC(e,[`完成标准`,`Completion criteria`]),i=aC(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||iC(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 sC(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 cC(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 lC(e,t){return aC(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 uC(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 dC(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function fC(e){let t=aC(e,[`标题`,`任务标题`,`Todo 标题`]),n=aC(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 pC=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),mC=5242880,hC=4;function gC(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 _C({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)(VS),[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 kh.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=>Jd(e)===`needs_you`).length,[Ge]),qe=(0,R.useMemo)(()=>Ge.filter(e=>Jd(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=[...ZS(o,Ze,f),...o.timeline??[],...e,...GS(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:rf(_.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([h_(),E_()]).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 eg(B?{goalId:B}:{contextKind:`manager`}).then(t=>{if(e)return;let n=t.filter(e=>[`preview_ready`,`gated`,`deferred`,`applying`].includes(e.status)||eb(e).retryOriginal===!0||e.action_kind===`operation.execute`&&e.status===`applied`).map(e=>nC(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):nC(await Qh(e),f)}catch(t){if(!(t instanceof qh)||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:sC(r),goal_id:t,stop_condition:uC(r),timezone:`Asia/Shanghai`}:{agent_id:ze,cadence:sC(r),goal_id:t,stop_condition:uC(r),target:lC(r,f),target_key:`goal-${t}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?f(`proposal.summary.heartbeat`):f(`proposal.summary.monitor`,{target:lC(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 tg(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||tC(t.proposal)!==e.lifecycleOperation))throw new qh(f(`actionReview.targetChanged`),{error_code:`action_response_mismatch`});let r=nC(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 qh&&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 qh&&tb(t.payload),i=t instanceof qh&&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 ng(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=nC(await rg(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:()=>Ng(),onSetupGoalChannel:e=>Fg(e),onToggleGoalAutoNotify:e=>Ig(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),HS(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 Sg(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=Zb(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=oC(a,f),n=rC(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:sC(a),enabled:e.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:t.initialTodos,objective:t.objective,permission:t.permission,stop_condition:uC(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=cC(a,f);if(e){Ue(a),ue(e);return}await ut(`monitor`,B,a);return}let r=dC(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:fC(a)},summary:`创建 Todo:${fC(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=hC-I.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!pC.has(e.type)),i=n.find(e=>e.size>mC);if(t<=0){ce(f(`composer.imageCountError`,{count:hC}));return}if(r){ce(f(`composer.imageTypeError`));return}if(i){ce(f(`composer.imageSizeError`,{size:mC/1024/1024}));return}try{let t=await Promise.all(n.map(e=>gC(e,f)));se(e=>[...e,...t].slice(0,hC)),ce(e.length>n.length?f(`composer.imageCountError`,{count:hC}):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 E_();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)(RS,{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)(US,{drawer:at?(0,z.jsx)(ox,{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)(pb,{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)(Nb,{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:[B&&T===`chat`&&!s&&ze===`codex`&&e&&P?.settings.execution_config&&P.settings.agent_id?(0,z.jsx)(Fb,{sessionId:e,zh:d===`zh-CN`,refreshKey:JSON.stringify(P.deliveries)},`${e}:${P.settings.agent_id}:${P.settings.execution_config}`):null,!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)(fm,{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)(Xx,{activeTab:T,scrollRef:Me,panels:{overview:(0,z.jsx)(Yx,{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)(Mx,{historyEnabled:!s,goal:V,items:Qe,onDraftTaskFromMessage:s?void 0:e=>{Ue(`创建一个 Task:${WS(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)(JS,{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)(XS,{onClose:()=>S(null),onOpenDetails:()=>v({item:x,kind:`run`}),run:x}):null,(0,z.jsx)(Hb,{items:$e,onSelect:v,selectedGoal:V})]})}},`${u?.activeSource.statusUrl??`/status.json`}:${V.goalId}`):D?(0,z.jsx)(Hb,{items:nt,onSelect:v,selectedGoal:null}):(0,z.jsx)(qS,{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)(YS,{messages:et,onClose:()=>A(!1),onOpenConversation:()=>{A(!1),O(!0)}}):null,V&&T!==`chat`&&ee&&tt.length?(0,z.jsx)(YS,{agentLabel:xt,messages:tt,onClose:()=>j(!1),onDraftTask:T===`tasks`?e=>{Ue(`创建一个 Task:${WS(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)(gh,{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)(Hm,{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)(nh,{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)(mm,{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)(ym,{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)(jm,{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)(Hm,{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)(nh,{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)(Xm,{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)(gh,{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>=hC,onClick:()=>Pe.current?.click(),title:f(`composer.attachImageHint`),type:`button`,children:(0,z.jsx)(qm,{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>=hC,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)(nh,{size:18})})]})]})]})]}),sidebar:(0,z.jsx)(Ox,{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 vC(e){return(e??``).replace(/\s+/gu,` `).trim()}function yC(e,t=120){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t-1).join(``)}…`}function bC(e,t,n){let r=vC(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`):yC(r)}function xC(e,t){return t({advancing:`projection.agentAdvancingGoal`,idle:`projection.agentIdle`,needs_you:`projection.agentNeedsDecision`,stopped:`projection.agentStopped`,waiting_external:`projection.agentWaitingExternal`}[e])}function SC({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 CC=`/status.json`,wC=`loopx-status-source-catalog-v1`,TC={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:CC};function EC(e,t){let n=xh(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 DC(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 OC(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=EC(n.statusUrl,t);if(!r||r.length>48||!(`url`in i))return null;let a=vx(n.hostAlias)?n.hostAlias.trim():void 0;return{...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function kC(){return{schemaVersion:1,sources:[TC]}}function AC(e,t){try{let n=e.getItem(wC);if(!n)return kC();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return kC();let i=new Set([TC.statusUrl]);return{schemaVersion:1,sources:[TC,...r.sources.flatMap(e=>{let n=OC(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return kC()}}function jC(e,t){e.setItem(wC,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function MC(e,t){let n=new Set(t.filter(vx).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 NC(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=EC(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&&!vx(t.hostAlias))return{error:`请选择有效的 SSH Host。`};let a=t.hostAlias?.trim(),o={...a?{hostAlias:a}:{},id:DC(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,o]},source:o}}function PC(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function FC(e,t,n){if(!t.trim()||xh(t,n).source?.isRelative)return TC;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function IC(e,t,n){return FC(e,t,n)||(xh(t,n).source?.isRelative?TC:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function LC(e,t,n,r){return IC(e,t??n,r)}var RC={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function zC(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:`请求受保护操作:${RC[n.operation]} · ${n.target}`}}var BC=CC;async function VC(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 zp(await t.json())}function HC(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 UC(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??HC(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 WC(e){return(e??``).replace(/\s+/g,` `).trim()}function GC(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function KC(e,t){return e===void 0||t===void 0?void 0:e+t}function qC(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 JC(e){return e?.items.find(e=>!e.done)}function YC(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 XC(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function ZC(e,t,n){let r=[];for(let t of e){let e=qC(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 QC(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var $C=`loopx.personal-agent-selection.v1`;function ew(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem($C)??`{}`);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 tw={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function nw(e,t){return WC(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 rw(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 iw(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}var aw=`已发现的项目 Agent`;function ow(e){switch(Vy(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 nw(e)}}function sw(e,t){switch(Hy(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 aw}}function cw(e,t){let n=e.project_asset;return t===`user`?YC(n?.user_todos,e.user_todos,`project_asset.user_todos`):YC(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function lw(e){return $d(e.title??e.text,112)}function uw(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 dw(e,t){let n=e.completion_validation_revision_history.at(-1);return{resumeWhen:e.resume_when??null,resumeReady:e.resume_ready??null,resumeReceiptId:uw(e),claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?$d(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:lw(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`,validationDigest:e.completion_validation_sha256??null,validationRevision:e.completion_validation_revision??null,validationRevisionActor:n?.actor_agent_id??null}}function fw(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 pw(e){return fw(e).map(t=>dw(t,e))}function mw(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=dw(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 hw(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:$d(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function gw(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=hw(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function _w(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=fw(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=>dw(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:WC(t?.next??``)||(l?WC(l.title??``)||WC(l.text??``):``)||null,recentCompleted:c}}function vw(e,t){let n=WC(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`):bC(n,t,`projection.validationRecorded`):``}function yw(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 bw(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=[vw(r?.summary,n),bC(i?.health_check,n),bC(i?.recommended_action,n)].find(e=>e!==``&&e!==`暂无`)??n(`projection.runRecorded`),s=SC({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 xw(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 Sw(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 Cw(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 ww(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!Sw(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||Cw(t)}function Tw(e,t){let n=Sw(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 Ew(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 Dw(e,t){let n=e.latestRun?.operator_gate;return bC(n?.operator_question??n?.reason_summary??n?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,t,`projection.confirmAgentDecision`)}function Ow(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=qC(t,`user`),r=qC(t,`agent`),i=!!JC(n),a=!!JC(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||Ew(t)?`等你`:ww(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:XC(t)===`eligible`||a?`推进中`:xw(t)?`已完成`:`安静运行`}function kw(e,t,n,r){if(n===`已停止`)return xC(`stopped`,r);if(n===`需修复`)return bC(Tw(e,t),r,`projection.statusRefreshNeeded`);if(n===`等你`)return xC(`needs_you`,r);if(n===`推进中`){let e=[(qC(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>WC(e)).find(e=>e!==``&&e!==`暂无`);return e?bC(e,r,`projection.agentAdvancingGoal`):xC(`advancing`,r)}return xC(n===`等待条件`?`waiting_external`:`idle`,r)}function Aw(e,t){return t.some(t=>e.includes(t))}function jw(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(Aw(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(Aw(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${nw(e.goalId)}」:${e.text}`:`当前最先处理「${nw(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(Aw(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${nw(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(Aw(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 Mw(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=GC(e.usage_summary),s=ZC(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(cw(e,`user`)?.items??[]).map((r,i)=>({projectedDone:r.done,details:tf(r),actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:lw(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)||!Ew(t)?[]:[{details:tf({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:Dw(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=Ow(e,a),l=f.find(e=>e.goalId===t.id),u=l?.text??null,d=_w(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=gw(pw(a),h,a),b=[d.nextTodoText,a.queueItem?.recommended_action,a.latestRun?.recommended_action,kw(e,a,c,n)].map(e=>bC(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:kw(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:bw(e,a,n),state:c,...r?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:mw(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:nw(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:KC(e.input_tokens_24h,e.output_tokens_24h),tokens7d:KC(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?$d(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function Nw({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=Mw(c,u,_,b);if(!l)return e;let t=Object.values(l.snapshots).map(e=>Mw(e,UC(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:sw(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:sw(`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)(ew),L=Dh(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??[];yw(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=bh(f.activeSource.statusUrl,window.location.href),t=e.source?wh(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),Th(r,D.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Eh(n,t):null}).then(e=>{i||A(e)}).catch(e=>{i||j(Bp(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 cg(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:rw(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 ag().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($C,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 dg({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:QC(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:rw(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 sg(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 Tg(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(Oh).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 qh&&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 qh&&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 lg({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 lg({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=>cg(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 sg(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?Dh(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=jw(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}),og({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` diff --git a/loopx/web/chat/assets/index-DTJTDfC1.css b/loopx/web/chat/assets/index-DTJTDfC1.css new file mode 100644 index 0000000000..161a73ef08 --- /dev/null +++ b/loopx/web/chat/assets/index-DTJTDfC1.css @@ -0,0 +1 @@ +.personal-collaboration{border:1px solid var(--color-border,#ebebeb);overflow-wrap:anywhere;border-radius:6px;margin-top:12px;padding:12px 16px}.personal-collaboration header{flex-wrap:wrap;justify-content:space-between;gap:8px;display:flex}.personal-collaboration header span,.personal-collaboration-status{opacity:.75;font-size:12px}.personal-collaboration-status{flex-wrap:wrap;gap:8px 16px;display:flex}.personal-collaboration summary{cursor:pointer;align-content:center;min-height:44px;display:list-item}.personal-collaboration h4{margin:12px 0 4px;font-size:13px}.personal-collaboration p{white-space:pre-wrap}.personal-collaboration ul{padding-left:20px}.personal-collaboration small{font-family:var(--font-mono);font-size:11px;display:block}.personal-collaboration summary:focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:2px}.goal-loopx-mode{color:var(--pw-text,#171717);border-bottom:1px solid var(--pw-line,#ebebeb);padding:8px 26px;font-size:13px}.goal-loopx-mode-bar,.goal-loopx-mode-actions{align-items:center;gap:8px;display:flex}.goal-loopx-mode-bar{justify-content:space-between;gap:16px}.goal-loopx-mode-status{align-items:center;gap:8px;min-width:0;font-weight:500;display:inline-flex}.goal-loopx-mode-status>i{background:var(--pw-muted,#666);border-radius:50%;flex:0 0 7px;width:7px;height:7px}.goal-loopx-mode-status[data-active=true]>i{background:var(--pw-green,#13804a)}.goal-loopx-mode p{color:var(--pw-muted,#666);margin:8px 0;font-size:12px;line-height:1.6}.goal-loopx-mode .personal-composer-error{color:var(--pw-red,#b42318)}.goal-loopx-mode button{border:1px solid var(--pw-line,#ebebeb);background:var(--pw-surface,#fff);min-width:44px;min-height:44px;color:inherit;font:inherit;cursor:pointer;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:8px 12px;display:inline-flex}.goal-loopx-mode .goal-loopx-primary{border-color:var(--pw-line-strong,#ddd);font-weight:500}.goal-loopx-mode .goal-loopx-team-trigger{background:0 0;border-color:#0000}.goal-loopx-mode button:disabled{opacity:.5;cursor:default}.goal-loopx-mode button:focus-visible,.goal-loopx-mode input:focus-visible,.goal-loopx-mode select:focus-visible,.goal-loopx-mode summary:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.goal-loopx-alert-dot{background:var(--pw-amber,#a66b00);border-radius:50%;width:7px;height:7px}.goal-loopx-mode .goal-loopx-review-notice{color:var(--pw-amber,#a66b00);text-align:left;background:0 0;border:0;padding-inline:0}.goal-loopx-dialog{border:1px solid var(--pw-line,#ebebeb);background:var(--pw-bg,#fafafa);width:min(680px,100vw - 32px);max-height:calc(100dvh - 48px);color:var(--pw-text,#171717);overscroll-behavior:contain;border-radius:16px;margin:auto;padding:0;overflow:auto}.goal-loopx-dialog::backdrop{background:#00000047}.goal-loopx-dialog-content{padding:24px}.goal-loopx-dialog header{justify-content:space-between;align-items:center;gap:16px;display:flex}.goal-loopx-dialog h2{letter-spacing:-.02em;margin:0;font-size:20px;font-weight:600}.goal-loopx-dialog h3{margin:24px 0 8px;font-size:13px;font-weight:600}.goal-loopx-mode-settings{grid-template-columns:1fr 1fr;gap:16px;margin-block:24px;display:grid}.goal-loopx-mode-settings label{flex-direction:column;gap:8px;display:flex}.goal-loopx-mode-settings input,.goal-loopx-mode-settings select{border:1px solid var(--pw-line,#ddd);background:var(--pw-surface,#fff);width:100%;min-width:0;min-height:44px;color:inherit;font:inherit;border-radius:6px;padding:8px}.goal-loopx-mode-settings label:nth-child(3),.goal-loopx-mode-settings p{grid-column:1/-1}.goal-loopx-message-mode{flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 8px;font-size:12px;display:flex}.goal-loopx-message-mode select{font:inherit;color:inherit;border:1px solid var(--pw-line,#ebebeb);background:var(--pw-surface,#fff);border-radius:6px;min-height:44px;padding:6px}.goal-team-work ul{margin:8px 0 24px;padding:0;list-style:none}.goal-team-work li{border-bottom:1px solid var(--pw-line,#ebebeb);overflow-wrap:anywhere;padding:12px 0}.goal-team-bindings li>div,.goal-team-work-actions{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;display:flex}.goal-team-work code{overflow-wrap:anywhere;white-space:normal;padding-bottom:8px;font-size:12px;display:block}.goal-team-work summary{cursor:pointer;min-height:44px;color:var(--pw-muted,#666);padding:12px 0;font-size:12px}@media (width<=640px){.goal-loopx-mode{padding:6px 14px}.goal-loopx-mode-bar{flex-wrap:wrap;gap:0}.goal-loopx-mode-status{min-height:32px}.goal-loopx-mode-actions{gap:2px;margin-left:auto}.goal-loopx-mode-actions button{padding-inline:8px}.goal-loopx-mode-settings{grid-template-columns:1fr}.goal-loopx-dialog-content{padding:16px}}.goal-team-evidence{border:1px solid var(--pw-line,#ebebeb);background:var(--pw-surface,#fff);border-radius:12px;margin-block:16px;padding:16px}.goal-team-evidence h3,.goal-team-evidence h4{margin:0;font-size:13px}.goal-team-evidence article{margin-block:16px}.goal-team-evidence pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;font:12px/1.6 var(--font-mono,monospace);border:1px solid var(--pw-line,#ebebeb);border-radius:6px;padding:12px;overflow:auto}.goal-team-evidence label{gap:8px;font-weight:500;display:grid}.goal-team-evidence textarea{box-sizing:border-box;resize:vertical;border:1px solid var(--pw-line,#ebebeb);background:var(--pw-bg,#fafafa);width:100%;min-height:88px;color:inherit;font:inherit;border-radius:6px;padding:8px}.goal-team-evidence textarea:focus-visible,.goal-team-evidence pre:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.goal-team-control{border-top:1px solid var(--pw-line,#ebebeb);padding-top:16px}.goal-team-evidence [role=alert]{color:var(--pw-red,#b42318)}.goal-team-lineage{border-block:1px solid var(--pw-line,#ebebeb);margin-block:16px;padding-block:16px}.goal-team-lineage ul{margin:12px 0;padding:0;list-style:none}.goal-team-lineage li{border-left:2px solid var(--pw-line,#ebebeb);overflow-wrap:anywhere;gap:8px;padding:0 0 16px 16px;display:grid}.goal-team-lineage button{overflow-wrap:anywhere;text-align:start;justify-self:start;max-width:100%}.goal-loopx-dialog:has(.goal-team-comparison){width:min(1040px,100vw - 32px)}.goal-team-comparison{margin-block:24px}.goal-team-comparison-heading{justify-content:space-between;align-items:baseline;gap:16px;display:flex}.goal-team-comparison-heading h4{letter-spacing:-.02em;font-size:20px}.goal-team-comparison-heading>span{color:var(--pw-muted,#666);font-size:12px}.goal-team-comparison-sources{flex-wrap:wrap;gap:8px;margin-block:16px;display:flex}.goal-team-comparison-sources button{overflow-wrap:anywhere;text-align:left;flex-direction:column;align-items:flex-start;max-width:100%}.goal-team-comparison-sources button>span{color:var(--pw-muted,#666);font-size:12px}.goal-team-comparison-sources button[aria-pressed=true]{border-color:var(--pw-text,#171717)}.goal-team-comparison-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.goal-team-comparison-grid article{border:1px solid var(--pw-line,#ebebeb);border-radius:12px;min-width:0;margin:0;overflow:hidden}.goal-team-comparison-grid header{border-bottom:1px solid var(--pw-line,#ebebeb);overflow-wrap:anywhere;gap:4px;padding:16px;display:grid}.goal-team-comparison-grid header span{color:var(--pw-muted,#666);font-size:12px}.goal-team-comparison-grid pre{border:0;border-radius:0;max-height:400px;margin:0;padding:16px;font-size:13px;line-height:1.8}.goal-team-comparison-grid pre span[data-changed=true]{background:color-mix(in srgb, var(--pw-text,#171717) 7%, transparent);text-decoration:underline;-webkit-text-decoration-color:var(--pw-muted,#666);text-decoration-color:var(--pw-muted,#666);text-underline-offset:4px}.goal-team-comparison select{background:var(--pw-surface,#fff);min-height:44px;color:inherit;border:1px solid var(--pw-line,#ebebeb);border-radius:6px;padding:8px}@media (width<=640px){.goal-team-comparison-grid{grid-template-columns:1fr}}.goal-team-artifact>header{justify-content:space-between;align-items:center;gap:16px;margin-bottom:16px;display:flex}.goal-team-artifact>header h4{color:var(--pw-muted);font-size:12px;font-weight:500}.goal-team-report{background:var(--pw-surface,#fff);color:var(--pw-text,#171717);overflow-wrap:anywhere;padding:24px}.goal-team-report .personal-md{gap:20px;font-size:15px;line-height:1.8}.goal-team-report .personal-md p{font-size:inherit;line-height:inherit;color:inherit;margin:0}.goal-team-report .personal-md .is-h1{letter-spacing:-.03em;font-size:26px;font-weight:600;line-height:1.3}.goal-team-report .personal-md .is-h2{margin-top:8px;font-size:18px;font-weight:600}.goal-team-report .personal-md-list{list-style:revert;margin:0;padding-left:24px}.goal-team-report .personal-md-list li{border:0;padding:0}.personal-md-table-scroll{min-width:0;max-width:100%;overflow-x:auto}.personal-md-table-scroll table{border-collapse:collapse;width:100%;font-size:14px;line-height:1.6}.personal-md-table-scroll th,.personal-md-table-scroll td{border-bottom:1px solid var(--pw-line,#ebebeb);text-align:left;vertical-align:top;padding:12px}.personal-md-table-scroll th{background:var(--pw-bg,#fafafa);font-weight:500}.goal-team-comparison-grid .goal-team-report{max-height:480px;overflow:auto}.goal-team-comparison-grid .goal-team-report .personal-md{font-size:14px}.goal-team-results{border:1px solid var(--pw-line,#ebebeb);background:var(--pw-surface,#fff);width:min(960px,100%);color:var(--pw-text,#171717);border-radius:12px;margin:16px auto 24px;padding:24px}.goal-team-results>header{justify-content:space-between;align-items:center;gap:16px;display:flex}.goal-team-results h3{margin:0;font-size:16px;font-weight:600}.goal-team-results p{color:var(--pw-muted);font-size:12px;line-height:1.7}.goal-team-results [role=alert]{color:var(--pw-red,#b42318)}.goal-team-results button,.goal-team-results select{border:1px solid var(--pw-line,#ebebeb);background:var(--pw-surface,#fff);min-height:44px;color:inherit;font:inherit;cursor:pointer;border-radius:6px;padding:8px 12px}.goal-team-results button[aria-pressed=true]{border-color:var(--pw-text)}.goal-team-results button:disabled{opacity:.5;cursor:default}.goal-team-results summary{cursor:pointer;min-height:44px;padding:12px 0;font-size:12px}.goal-team-results code{overflow-wrap:anywhere}.goal-team-report table code{white-space:pre;overflow-wrap:normal;word-break:normal}.goal-team-results pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:400px;font:13px/1.7 var(--font-mono,monospace);background:var(--pw-bg);padding:16px;overflow:auto}.goal-team-results h3{letter-spacing:-.02em;font-size:20px}.goal-team-results>header>button{align-items:center;gap:8px;display:inline-flex}.goal-team-results-layout{grid-template-columns:minmax(150px,190px) minmax(0,1fr);gap:24px;margin-top:24px;display:grid}.goal-team-result-list{flex-direction:column;gap:8px;min-width:0;display:flex}.goal-team-result-list button{align-items:flex-start;gap:10px;display:flex}.goal-team-result-list button>svg{flex-shrink:0;margin-top:2px}.goal-team-result-list button>span{gap:4px;min-width:0;display:grid}.goal-team-result-list button strong{font-size:13px;font-weight:500}.goal-team-result-list button small{color:var(--pw-muted,#666);font:11px/1.5 var(--font-mono,monospace)}.goal-team-result-check{visibility:hidden;margin-left:auto}.goal-team-result-list button[aria-pressed=true] .goal-team-result-check{visibility:visible}.goal-team-result-reader{border-left:1px solid var(--pw-line);min-width:0;padding-left:24px}.goal-team-result-reader>details:first-child summary{font-size:14px;font-weight:500}.goal-team-results .goal-team-report{padding:24px 0}.goal-team-result-reader>label{flex-wrap:wrap;align-items:center;gap:12px;font-size:12px;display:flex}.goal-team-result-reader select{max-width:100%}.goal-team-result-list button{overflow-wrap:anywhere;text-align:start;max-width:100%;font-size:13px}.goal-team-results .goal-team-artifact>header{margin-bottom:0}.goal-team-results :focus-visible,.goal-team-report:focus-visible,.personal-md-table-scroll:focus-visible{outline:2px solid var(--pw-blue-ink,#0070f3);outline-offset:2px}@media (width<=640px){.goal-team-results{padding:16px}.goal-team-results-layout{grid-template-columns:minmax(0,1fr);gap:16px}.goal-team-result-list{flex-direction:row;padding-bottom:4px;overflow-x:auto}.goal-team-result-list button{flex:none;max-width:240px}.goal-team-result-reader{border-left:0;border-top:1px solid var(--pw-line);padding-top:16px;padding-left:0}.goal-team-report{padding:16px 0}.goal-team-comparison-grid .goal-team-report{padding:16px}.goal-team-report .personal-md .is-h1{font-size:22px}}.delivery-review{min-width:0;color:var(--pw-text);gap:20px;padding:0;display:grid}.delivery-review h2,.delivery-review h3,.delivery-review h4,.delivery-review p{margin:0}.delivery-review h2{font-size:20px;font-weight:600;line-height:28px}.delivery-review h3{font-size:16px;font-weight:600;line-height:24px}.delivery-review h4{font-size:14px;line-height:20px}.delivery-review p{overflow-wrap:anywhere;line-height:1.6}.delivery-review button,.delivery-review select,.delivery-review input{color:inherit;font:inherit}.delivery-review button,.delivery-review select{border:1px solid var(--pw-line);background:var(--pw-card);cursor:pointer;border-radius:6px;min-height:44px;padding:8px 12px}.delivery-review button:disabled{opacity:.5;cursor:not-allowed}.delivery-review button[aria-pressed=true]{border-color:var(--pw-text);background:var(--pw-hover,var(--pw-card))}.delivery-review :is(button,input,select,summary,[tabindex]):focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:3px}.delivery-review-toolbar,.delivery-chain-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.delivery-review-toolbar>div,.delivery-chain-toolbar>div,.delivery-source-actions{flex-wrap:wrap;gap:8px;display:flex}.delivery-review-toolbar button,.delivery-source-actions button{align-items:center;gap:8px;display:inline-flex}.delivery-snapshot-time,.delivery-boundary,.delivery-chain-toolbar>span{color:var(--pw-muted);font-size:12px}.delivery-notice{border:1px solid var(--pw-line);border-left:3px solid var(--pw-amber,#a96500);border-radius:6px;padding:12px 16px;font-size:13px}.delivery-notice dl{flex-wrap:wrap;gap:8px 24px;margin:12px 0 0;display:flex}.delivery-notice dl>div{gap:8px;display:flex}.delivery-notice dd{margin:0;font-weight:600}.delivery-chain{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0;overflow:hidden}.delivery-chain-toolbar{border-bottom:1px solid var(--pw-line);padding:16px}.delivery-chain-toolbar h3{margin-right:auto}.delivery-filters{border-bottom:1px solid var(--pw-line);flex-wrap:wrap;gap:8px;padding:12px 16px;display:flex}.delivery-filters label{flex:1;align-items:center;gap:8px;min-width:160px;display:flex}.delivery-filters input{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:6px;width:100%;min-width:0;padding:10px 8px}.delivery-map-scroll{overscroll-behavior:contain;max-height:540px;overflow:auto}.delivery-map{width:960px;min-height:172px;position:relative}.delivery-map-heading{color:var(--pw-muted);font-size:12px;font-weight:500;position:absolute;top:16px}.delivery-map svg{color:var(--pw-muted);pointer-events:none;position:absolute;inset:0}.delivery-map svg>path{fill:none;stroke:currentColor;stroke-width:1px;opacity:.3}.delivery-map svg>path.is-related{stroke-width:2px;opacity:1}.delivery-map .delivery-map-node{text-align:left;background:var(--pw-card);border-radius:12px;gap:8px;width:280px;height:100px;padding:12px;display:grid;position:absolute}.delivery-map-node>span{color:var(--pw-muted);justify-content:space-between;align-items:center;font-size:11px;display:flex}.delivery-map-node>strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.delivery-map-node>small{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.delivery-review em{color:var(--pw-muted);font-size:11px;font-style:normal}.delivery-review em[data-state=blocked],.delivery-review em[data-state=waiting]{color:var(--pw-amber,#a96500)}.delivery-node-list,.delivery-relations{margin:0;padding:0;list-style:none}.delivery-node-list li+li{border-top:1px solid var(--pw-line)}.delivery-node-list button{text-align:left;border-radius:0;grid-template-columns:88px minmax(0,1fr) 120px 72px;align-items:center;gap:12px;width:100%;padding:16px;display:grid}.delivery-node-list strong,.delivery-node-list small{overflow-wrap:anywhere}.delivery-node-list span,.delivery-node-list small{color:var(--pw-muted);font-size:12px}.delivery-node-detail{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;gap:16px;padding:20px;display:grid}.delivery-node-detail header{gap:8px;display:grid}.delivery-node-detail header>span,.delivery-node-detail header>p,.delivery-source-actions p{color:var(--pw-muted);font-size:12px}.delivery-node-detail summary{cursor:pointer;min-height:44px;padding-top:12px}.delivery-node-detail code,.delivery-node-detail details p{overflow-wrap:anywhere;font-size:12px}.delivery-relations{gap:12px;display:grid}.delivery-relations li{border-bottom:1px solid var(--pw-line);padding-bottom:12px}.delivery-relations li>div{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:8px;display:grid}.delivery-relations button{text-align:left;overflow-wrap:anywhere;font-size:12px}.delivery-relations span{align-items:center;gap:4px;font-size:11px;display:flex}.delivery-relations p{color:var(--pw-muted);padding-top:8px;font-size:12px}.delivery-empty{padding:24px}.delivery-acceptance-contract{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.delivery-acceptance-contract summary{cursor:pointer;min-height:44px;padding:12px 16px;font-weight:500}.delivery-acceptance-content{gap:16px;padding:0 16px 16px;font-size:14px;display:grid}.delivery-acceptance-content ul{margin:0;padding-left:20px}.delivery-acceptance-content :is(li,dd,code){overflow-wrap:anywhere}.delivery-acceptance-source{gap:8px;margin:0;display:grid}.delivery-acceptance-source>div{grid-template-columns:minmax(100px,1fr) minmax(0,3fr);gap:12px;display:grid}.delivery-acceptance-source dt{color:var(--pw-muted)}.delivery-acceptance-source dd{margin:0}.delivery-acceptance-content code{font-family:var(--font-mono);font-size:12px}.delivery-acceptance-tasks{gap:12px;display:grid}.delivery-acceptance-content details{border-top:1px solid var(--pw-line)}.delivery-acceptance-content details summary{padding-left:0}.delivery-acceptance-content a{color:var(--color-link,#0070f3);text-decoration:underline}.delivery-acceptance-content a:focus-visible{outline:2px solid var(--color-link,#0070f3);outline-offset:3px}@media (width<=640px){.delivery-review{gap:16px}.delivery-review-toolbar>div{width:100%}.delivery-review-toolbar button{flex:1;justify-content:center;font-size:12px}.delivery-filters label{flex-basis:100%}.delivery-filters select{flex:1;min-width:0}.delivery-node-list button{grid-template-columns:minmax(0,1fr) auto;gap:8px}.delivery-node-list strong{grid-column:1/-1}.delivery-relations li>div{grid-template-columns:minmax(0,1fr)}.delivery-node-detail{padding:16px}}.delivery-notice summary{cursor:pointer;min-height:24px}.personal-goal-view-panel{min-width:0}.personal-goal-view-panel[hidden]{display:none}.personal-goal-view-panel[data-goal-panel=tasks]{height:100%}.goal-overview{gap:24px;min-width:0;display:grid}.goal-overview h2,.goal-overview h3,.goal-overview p{margin:0}.goal-overview h2{font-size:20px;font-weight:600}.goal-overview h3{font-size:14px;font-weight:600}.goal-overview button{border:1px solid var(--pw-line);background:var(--pw-card);min-height:40px;color:var(--pw-text);font:inherit;cursor:pointer;text-align:left;border-radius:6px;align-items:center;gap:8px;padding:8px 12px;display:inline-flex}.goal-overview button:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.goal-overview-heading,.goal-overview-summary header{justify-content:space-between;align-items:center;gap:16px;display:flex}.goal-overview-heading button,.goal-overview-summary header span{color:var(--pw-muted);font-size:12px}.goal-overview-summary{gap:20px;display:grid}.goal-overview-summary.has-attention{grid-template-columns:1fr 1fr}.goal-overview-summary>section{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;align-content:start;gap:16px;min-width:0;padding:20px;display:grid}.goal-overview-summary p,.goal-overview-source-note{color:var(--pw-muted);font-size:13px;line-height:1.6}.goal-overview-summary strong,.goal-overview-summary p,.goal-overview-summary button span{overflow-wrap:anywhere}.goal-overview-summary ul{margin:0;padding:0;list-style:none}.goal-overview-summary li+li{margin-top:8px}.goal-overview-summary li button{justify-content:space-between;width:100%;display:flex}.goal-overview-summary .goal-overview-run{grid-template-columns:1fr auto;gap:4px 12px;display:grid}.goal-overview-run small{color:var(--pw-muted);font-size:12px}.goal-overview-run strong{grid-row:2;font-size:13px}.goal-overview-run svg{grid-area:1/2/3}.goal-overview-usage{border-block:1px solid var(--pw-line);flex-wrap:wrap;align-items:center;gap:12px 24px;padding-block:12px;display:flex}.goal-overview-usage h3{color:var(--pw-muted);font-size:12px;font-weight:400}.goal-overview-usage dl{flex-wrap:wrap;gap:12px 24px;margin:0;display:flex}.goal-overview-usage dl>div{align-items:baseline;gap:8px;font-size:12px;display:flex}.goal-overview-usage dt{color:var(--pw-muted)}.goal-overview-usage dd{font-variant-numeric:tabular-nums;margin:0}@media (width<=640px){.goal-overview-summary.has-attention{grid-template-columns:1fr}}.personal-workspace-shell{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-amber:#a86a12;--pw-amber-bg:#fbf2df;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);min-height:100vh;color:var(--pw-text);grid-template-columns:272px minmax(520px,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid}.personal-workspace-shell.has-drawer{grid-template-columns:256px minmax(500px,1fr) minmax(340px,404px)}.personal-workspace-shell.has-task-inspector{grid-template-columns:minmax(520px,1fr) minmax(520px,50vw)}.personal-workspace-shell.has-task-inspector .personal-workspace-sidebar{display:none}.personal-workspace-shell.has-task-inspector.is-task-inspector-full{grid-template-columns:minmax(600px,1fr)}.personal-workspace-shell.is-task-inspector-full .personal-workspace-main{display:none}.personal-workspace-sidebar{border-right:1px solid var(--pw-line);background:#f5f3ee;min-width:0}.personal-workspace-sidebar-inner{width:100%;height:100%}.personal-sr-only{clip:rect(0, 0, 0, 0)!important;white-space:nowrap!important;border:0!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;position:absolute!important;overflow:hidden!important}.personal-workspace-main{min-width:0}.personal-workspace-drawer{border-left:1px solid var(--pw-line);background:#fff;min-width:0;position:relative;box-shadow:-14px 0 36px #1e1c140d}.personal-workspace-drawer[data-drawer-mode=inspector]{z-index:3;width:auto;position:relative;box-shadow:-8px 0 24px #1e284014}.personal-workspace-drawer[data-drawer-mode=inspector-full]{min-width:0;box-shadow:none;grid-column:1}.personal-sidebar-backdrop{display:none}.personal-workspace-shell :focus-visible:not(textarea):not(input){outline-offset:2px;outline:2px solid #5f87ed}.personal-goal-directory{flex-direction:column;width:100%;height:100vh;display:flex;position:sticky;top:0}.personal-sidebar-brand{border-bottom:1px solid var(--pw-line);align-items:center;gap:11px;height:74px;padding:0 18px;display:flex}.personal-sidebar-brand>span:last-child{gap:1px;display:grid}.personal-sidebar-brand strong{letter-spacing:.01em;font-size:16px}.personal-sidebar-brand small{color:var(--pw-muted);font-size:11px}.personal-brand-mark,.personal-manager-icon{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:10px;place-items:center;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-brand-mark{width:34px;height:34px}.personal-manager-icon{width:30px;height:30px;color:var(--pw-blue-ink);background:var(--pw-blue-soft);box-shadow:none}.personal-status-source{border-bottom:1px solid var(--pw-line);gap:7px;padding:12px 14px;display:grid;position:relative}.personal-status-source>header{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;align-items:center;padding:0 3px;font-size:10px;font-weight:700;display:flex}.personal-status-source>header button,.personal-status-source-meta button,.personal-status-source-form header button{width:25px;height:25px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-status-source>header button:hover,.personal-status-source-meta button:hover,.personal-status-source-form header button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-select{width:100%}.personal-status-source-meta{min-width:0;color:var(--pw-muted);align-items:center;gap:7px;padding:0 3px;font-size:10.5px;display:flex}.personal-status-source-meta>span{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}.personal-status-source-meta>span i{background:#3fbf82;border-radius:50%;width:6px;height:6px}.personal-status-source-meta>span.is-loading i{background:#e5a33d}.personal-status-source-meta>span.is-error i{background:#dd5b47}.personal-status-source-meta small{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-status-source-meta button{width:22px;height:22px;color:var(--pw-faint);margin-left:auto}.personal-status-source-error{color:var(--pw-red);overflow-wrap:anywhere;margin:0 3px;font-size:10px;line-height:1.4}.personal-status-source-form{z-index:12;border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:10px;padding:13px;display:grid;position:absolute;top:calc(100% - 4px);left:12px;right:12px;box-shadow:0 12px 32px #1e1c1424}.personal-status-source-form>header{justify-content:space-between;align-items:center;font-size:12.5px;display:flex}.personal-status-source-form label{color:var(--pw-muted);gap:5px;font-size:10.5px;display:grid}.personal-status-source-form input,.personal-status-source-form select{border:1px solid var(--pw-line-strong);width:100%;min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;outline:0;padding:0 9px;font:12px/1.2 inherit}.personal-status-source-form input:focus,.personal-status-source-form select:focus{border-color:#8aa7ed;box-shadow:0 0 0 2px #2f66e91a}.personal-status-source-form input:disabled,.personal-status-source-form select:disabled{color:var(--pw-faint);background:#f6f5f2}.personal-status-source-form p{color:var(--pw-muted);overflow-wrap:anywhere;margin:0;font-size:10px;line-height:1.45}.personal-status-source-form p.is-error{color:var(--pw-red)}.personal-status-source-form code{font:9.5px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-status-source-add{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:8px;min-height:34px;font-size:11.5px;font-weight:650}.personal-status-source-add:hover{background:var(--pw-blue-ink)}.personal-status-source-add:disabled{cursor:not-allowed;opacity:.48}.personal-status-source-modes{background:#f2f1ed;border-radius:9px;grid-template-columns:1fr 1fr;gap:3px;padding:3px;display:grid}.personal-status-source-modes button{min-height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;padding:0 8px;font-size:10.5px;font-weight:650}.personal-status-source-modes button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-status-source-field-row{grid-template-columns:minmax(0,1fr) 34px;gap:6px;display:grid}.personal-status-source-field-row>button{border:1px solid var(--pw-line-strong);width:34px;height:34px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;place-items:center;padding:0;display:grid}.personal-status-source-field-row>button:hover{color:var(--pw-text);background:#f8f7f4}.personal-status-source-field-row>button:disabled{cursor:wait;opacity:.45}.personal-status-source-command{background:#f6f5f2;border-radius:8px;gap:7px;padding:8px 9px;display:grid}.personal-status-source-command code{color:#4e5668;overflow-wrap:anywhere}.personal-status-source-command button{border:1px solid var(--pw-line-strong);min-height:25px;color:var(--pw-blue-ink);cursor:pointer;background:#fff;border-radius:7px;justify-content:center;justify-self:end;align-items:center;gap:5px;padding:0 8px;font-size:10px;font-weight:650;display:inline-flex}.personal-status-source-command button:disabled{color:var(--pw-faint);cursor:not-allowed}.personal-sidebar-nav{flex:1;padding:12px;overflow:auto}.personal-manager-link,.personal-goal-link,.personal-sidebar-utility{width:100%;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0}.personal-manager-link{border-radius:11px;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 10px;font-weight:650;display:grid}.personal-manager-link:hover,.personal-goal-link:hover{background:#ffffffa6}.personal-manager-link[aria-current=page],.personal-goal-link[aria-current=page]{background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-sidebar-count{background:var(--pw-amber-bg);min-width:22px;color:var(--pw-amber);text-align:center;border-radius:99px;padding:2px 7px;font-size:11px;font-weight:650}.personal-sidebar-section-title{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;justify-content:space-between;padding:20px 10px 7px;font-size:11px;font-weight:650;display:flex}.personal-sidebar-title-actions{align-items:center;gap:6px;display:flex}.personal-sidebar-title-actions button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-sidebar-title-actions button:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-list{gap:2px;display:grid}.personal-goal-row{border-radius:11px;grid-template-columns:minmax(0,1fr) 28px 28px;align-items:center;gap:2px;display:grid}.personal-goal-row:has(.personal-goal-move-actions){grid-template-columns:minmax(0,1fr) 52px 28px}.personal-goal-row[data-reorder-goal]>.personal-goal-link{cursor:grab;-webkit-user-select:none;user-select:none}.personal-goal-row[data-reorder-goal]>.personal-goal-link:active{cursor:grabbing}.personal-goal-row.is-drop-before{box-shadow:0 -2px var(--color-link,#0070f3)}.personal-goal-row.is-drop-after{box-shadow:0 2px var(--color-link,#0070f3)}.personal-goal-move-actions{display:flex}.personal-goal-move-actions button{min-width:26px;min-height:44px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.personal-goal-move-actions button:disabled{opacity:.35;cursor:default}.personal-goal-move-actions button:not(:disabled):hover{background:var(--color-surface-soft,#f2f2f2)}.personal-goal-link{border-radius:11px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:44px;padding:7px 5px 7px 10px;display:grid}.personal-goal-lifecycle{width:26px;height:26px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;padding:0;display:grid}.personal-goal-lifecycle:hover{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141f}.personal-goal-lifecycle:disabled{opacity:.45;cursor:wait}.personal-goal-lifecycle.is-pending svg{animation:.8s linear infinite personal-goal-lifecycle-spin}@keyframes personal-goal-lifecycle-spin{to{transform:rotate(360deg)}}.personal-goal-delete:hover{color:var(--pw-danger)}.personal-goal-link-copy{gap:2px;min-width:0;display:grid}.personal-goal-link-copy strong,.personal-goal-link-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-goal-link-copy strong{font-size:13px;font-weight:600}.personal-goal-link-copy small{color:var(--pw-muted);align-items:center;gap:5px;font-size:11px;display:flex}.personal-goal-state-dot{background:#e8ecf1;border-radius:9px;width:30px;height:30px;position:relative}.personal-goal-state-dot:after{content:"";background:#9aa3b2;border-radius:50%;width:7px;height:7px;position:absolute;bottom:3px;right:3px;box-shadow:0 0 0 2px #ffffffd9}.personal-goal-row:nth-child(5n+1) .personal-goal-state-dot{background:#e3ebfd}.personal-goal-row:nth-child(5n+2) .personal-goal-state-dot{background:#eee7fb}.personal-goal-row:nth-child(5n+3) .personal-goal-state-dot{background:#e2f2e4}.personal-goal-row:nth-child(5n+4) .personal-goal-state-dot{background:#fbf0dc}.personal-goal-row:nth-child(5n) .personal-goal-state-dot{background:#e8ecf1}.personal-goal-state-dot.is-danger:after{background:#dd5b47}.personal-goal-state-dot.is-warning:after{background:#e5a33d}.personal-goal-state-dot.is-info:after{background:#54a5e8}.personal-goal-state-dot.is-success:after{background:#3fae7c}.personal-goal-state-dot.is-quiet:after{background:#b6bcc9}.personal-goal-state-dot.is-stopped:after{background:#8f96a4}.personal-stopped-goals{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:8px}.personal-stopped-goals>summary{min-height:34px;color:var(--pw-muted);cursor:pointer;letter-spacing:.04em;border-radius:9px;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:6px;padding:5px 10px;font-size:11px;font-weight:650;list-style:none;display:grid}.personal-stopped-goals>summary::-webkit-details-marker{display:none}.personal-stopped-goals>summary:hover{color:var(--pw-text);background:#ffffff8c}.personal-stopped-goals>summary>svg:first-child{transition:transform .14s}.personal-stopped-goals[open]>summary>svg:first-child{transform:rotate(180deg)}.personal-stopped-goals>summary small{text-align:center;background:#ebe9e3;border-radius:99px;min-width:22px;padding:2px 6px}.personal-goal-list.is-stopped{opacity:.82;margin-top:2px}.personal-stopped-goal-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba;border-radius:9px;gap:7px;margin:6px 8px;padding:9px 10px;font-size:11px;line-height:1.45;display:grid}.personal-stopped-goal-error button{min-height:28px;color:inherit;cursor:pointer;font:inherit;background:0 0;border:1px solid;border-radius:7px;justify-self:start;padding:0 9px;font-weight:650}.personal-priority-dot{background:#aab2bf;border-radius:50%;width:7px;height:7px}.personal-priority-dot.is-high{background:#dd5b47}.personal-priority-dot.is-medium{background:#e5a33d}.personal-priority-dot.is-low{background:#3fae7c}.personal-sidebar-footer{border-top:1px solid var(--pw-line);flex-shrink:0;padding:12px}.personal-update-trigger{width:100%;min-height:44px;color:var(--pw-text);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;padding:0 9px;font-size:13px;display:flex}.personal-update-trigger span{text-align:left;flex:1}.personal-update-trigger:hover{background:var(--pw-card)}.personal-update-trigger:focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-update-panel{box-sizing:border-box;width:min(320px,100vw - 24px);max-height:calc(100dvh - 104px);color:var(--pw-text);background:var(--pw-card,#fff);font:inherit;border:1px solid var(--pw-line);border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:1.6;position:fixed;inset:auto auto 80px 12px;overflow-y:auto;box-shadow:0 8px 28px #0000001f}.personal-update-panel header{justify-content:space-between;align-items:center;display:flex}.personal-update-panel button{min-height:44px;color:inherit;background:var(--pw-card,#fff);border:1px solid var(--pw-line);cursor:pointer;border-radius:6px;padding:6px 10px}.personal-update-panel header button{border:0;place-items:center;min-width:44px;display:grid}.personal-update-panel summary{cursor:pointer;align-content:center;min-height:44px}.personal-update-panel p{margin:10px 0}.personal-update-panel label,.personal-update-panel small,.personal-update-panel code{display:block}.personal-update-panel select{width:100%;min-height:44px;color:inherit;background:var(--pw-card);border:1px solid var(--pw-line);border-radius:6px;margin-top:6px}.personal-update-actions{flex-wrap:wrap;gap:8px;display:flex}.personal-update-actions button{border:1px solid var(--pw-line);border-radius:6px;min-height:44px;padding:6px 10px}.personal-update-panel a{text-decoration:underline}.personal-update-panel :focus-visible{outline-offset:2px;outline:2px solid #0070f3}.personal-sidebar-utility{border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:54px;padding:7px 9px;font-size:13px;display:grid;box-shadow:0 1px 4px #1e1c1412}.personal-sidebar-utility:hover{background:#fff;border-color:#d6d2c8;box-shadow:0 2px 7px #1e1c141a}.personal-sidebar-utility-icon{background:var(--pw-blue-soft);width:32px;height:32px;color:var(--pw-blue-ink);border-radius:9px;place-items:center;display:grid}.personal-sidebar-utility-copy{gap:2px;min-width:0;display:grid}.personal-sidebar-utility-copy strong,.personal-sidebar-utility-copy small{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-sidebar-utility-copy strong{font-size:13px;font-weight:700}.personal-sidebar-utility-copy small{color:var(--pw-muted);font-size:10.5px}.personal-sidebar-utility>svg{color:var(--pw-faint)}.personal-owner-row{min-height:40px;color:var(--pw-muted);border-radius:10px;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;font-size:13px;display:flex}.personal-channel{grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);min-width:0;height:100vh;display:grid}.personal-channel-header{z-index:8;border-bottom:1px solid var(--pw-line);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fbfaf7eb;justify-content:space-between;align-items:center;gap:16px;min-height:72px;padding:12px 26px;display:flex;position:relative;overflow:visible}.personal-goal-tabs{background:#f2f1ed;border-radius:10px;align-self:center;align-items:center;gap:2px;margin-left:auto;padding:3px;display:flex}.personal-goal-tabs button{min-height:30px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 13px;font-size:12.5px;font-weight:600}.personal-goal-tabs button:hover{color:var(--pw-text)}.personal-goal-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 3px #1e1c141a}.personal-channel-title{min-width:0}.personal-channel-title h1{letter-spacing:-.015em;margin:0;font-size:17.5px;font-weight:700;line-height:1.25}.personal-channel-title p{color:var(--pw-muted);white-space:nowrap;text-overflow:ellipsis;margin:3px 0 0;font-size:12px;overflow:hidden}.personal-channel-title p.personal-manager-execution{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.personal-execution-chip{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:999px;flex:none;align-items:center;gap:6px;padding:0 8px;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;line-height:18px;display:inline-flex}.personal-execution-chip-endpoint{color:var(--pw-text);font-weight:650}.personal-execution-chip-kind{color:var(--pw-faint)}.personal-execution-chip-model,.personal-execution-chip-budget{color:var(--pw-muted)}.personal-execution-chip.is-unavailable{border-color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-execution-chip.is-unavailable .personal-execution-chip-endpoint,.personal-execution-chip.is-unavailable .personal-execution-chip-kind,.personal-execution-chip.is-unavailable .personal-execution-chip-model,.personal-execution-chip.is-unavailable .personal-execution-chip-budget{color:var(--pw-amber)}@media (width<=640px){.personal-channel-header:has(.personal-execution-chip-budget) .personal-channel-title{display:contents}.personal-channel-header:has(.personal-execution-chip-budget) .personal-channel-title h1{grid-area:1/2}.personal-channel-header:has(.personal-execution-chip-budget) .personal-channel-actions{grid-area:1/3}.personal-channel-header:has(.personal-execution-chip-budget) p.personal-manager-execution{grid-area:2/1/auto/-1;overflow:visible}.personal-channel-header:has(.personal-execution-chip-budget) .personal-execution-chip{border-radius:6px;flex-wrap:wrap;gap:0 6px;max-width:100%}}.personal-execution-note{color:var(--pw-muted);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-execution-rule-note{color:var(--pw-faint);text-overflow:ellipsis;font-size:11px;overflow:hidden}.personal-workspace-shell[data-pw-theme=brutal] .personal-execution-chip{border-color:#141414;border-radius:4px}.personal-channel-actions{flex:none;align-items:center;gap:9px;display:flex}.personal-icon-button.personal-mobile-menu{display:none}.personal-select{min-width:0;position:relative}.personal-select-trigger{border:1px solid var(--pw-line-strong);width:100%;min-height:36px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;padding:0 9px;font-size:12px;font-weight:500;line-height:16px;display:grid}.personal-select-trigger:hover,.personal-select-trigger[aria-expanded=true]{border-color:var(--pw-faint)}.personal-select-trigger:focus-visible{border-color:var(--pw-blue);outline-offset:1px;outline:2px solid #0070f329}.personal-select-trigger>svg{color:var(--pw-muted);transition:transform .15s}.personal-select-trigger>svg.is-open{transform:rotate(180deg)}.personal-select-icon{color:var(--pw-muted);place-items:center;display:grid}.personal-select-value{white-space:nowrap;align-items:center;gap:6px;min-width:0;display:flex}.personal-select-value>small{color:var(--pw-faint);flex:none;font-size:10px;font-weight:500}.personal-select-value>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.personal-select-listbox{z-index:50;border:1px solid var(--pw-line);background:#fff;border-radius:12px;min-width:max(100%,204px);max-width:min(300px,80vw);max-height:260px;padding:4px;display:grid;position:absolute;top:calc(100% + 5px);left:0;overflow:auto;box-shadow:0 10px 24px #00000017}.personal-agent-select .personal-select-listbox{min-width:216px;left:auto;right:0}.personal-select-option-wrap{display:grid}.personal-select-group-label{color:var(--pw-faint);letter-spacing:0;text-transform:uppercase;padding:8px 8px 4px;font:500 10px/14px Geist Mono Variable,Geist Mono,monospace}.personal-select-option{width:100%;min-height:32px;color:var(--pw-text);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:10px;padding:6px 8px;font-size:12px;font-weight:400;line-height:16px;display:grid}.personal-select-option:hover,.personal-select-option:focus-visible{background:#f2f2f2;outline:0}.personal-select-option[aria-selected=true]{font-weight:600}.personal-select-option[disabled]{color:var(--pw-faint);cursor:not-allowed}.personal-select-option>svg{color:var(--pw-text);justify-self:end}.personal-agent-select{width:188px}.personal-read-only-source{border:1px solid var(--pw-line-strong);max-width:190px;height:38px;color:var(--pw-text);white-space:nowrap;background:#fff;border-radius:10px;align-items:center;gap:7px;padding:0 10px;font-size:12.5px;font-weight:600;display:inline-flex;overflow:hidden}.personal-read-only-source>svg{color:var(--pw-muted);flex:none}.personal-read-only-source>small{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;padding:2px 6px;font-size:9.5px;font-weight:650}.personal-composer-attach{cursor:pointer;border:0;flex:none;place-items:center;display:grid;position:relative;overflow:hidden}.personal-composer-attach:disabled{cursor:not-allowed;opacity:.45}.personal-composer-file-input{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;overflow:hidden}.personal-action-feedback{border:1px solid var(--pw-line);background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;justify-content:space-between;align-items:center;gap:12px;margin:0 0 8px;padding:9px 12px;font-size:13px;font-weight:650;display:flex}.personal-action-feedback button{color:inherit;cursor:pointer;background:0 0;border:0;place-items:center;display:grid}.personal-refresh-control{flex:none;align-items:center;gap:6px;display:inline-flex}.personal-refresh-control small{color:var(--pw-muted);white-space:nowrap;font-size:11px}.personal-refresh-control.is-error small{color:var(--pw-danger)}.personal-icon-button{border:1px solid var(--pw-line);width:36px;min-width:36px;height:36px;min-height:36px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:10px;flex:0 0 36px;place-items:center;padding:0;display:inline-grid}.personal-icon-button:hover{border-color:var(--pw-line-strong);color:var(--pw-text)}.personal-channel-scroll{min-width:0;min-height:0;padding:22px max(26px,50% - 410px);overflow:auto}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:max(26px,50vw - 770px)}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow:hidden}.personal-manager-greeting{align-items:center;gap:14px;margin-bottom:16px;padding:18px 20px;display:flex}.personal-system-health-banner{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:12px;margin-bottom:16px;padding:12px 16px}.personal-system-health-header{align-items:center;gap:8px;font-size:13px;font-weight:600;display:flex}.personal-system-health-header small{color:#b91c1c;font-size:11.5px;font-weight:400}.personal-system-health-issues{color:#b91c1c;margin:6px 0 0 24px;padding:0;font-size:12px;line-height:1.5}.personal-home-lane{border:1px solid var(--pw-line);background:#fff;border-radius:16px;flex-direction:column;min-width:0;min-height:100%;display:flex;box-shadow:0 1px 4px #1e1c140a}.personal-manager-greeting>span{background:var(--pw-blue-soft);width:38px;height:38px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-manager-greeting div{gap:3px;display:grid}.personal-manager-greeting strong{letter-spacing:-.01em}.personal-manager-greeting p{color:var(--pw-muted);margin:0;font-size:13px}.personal-proposal-explainer{background:var(--pw-blue-soft);color:var(--pw-text);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.55}.personal-home-board{gap:12px;min-width:0;display:grid}.personal-home-lanes{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:10px;min-width:0;display:grid}.personal-home-lane{border:1px solid var(--pw-line);background:#ffffff85;border-radius:15px;align-content:start;min-width:0;min-height:0;padding:12px;display:grid}.personal-home-lane>header{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-home-lane>header span{align-items:center;gap:7px;font-size:13px;font-weight:700;display:inline-flex}.personal-home-lane>header i{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-home-lane>header b{min-width:24px;color:var(--pw-muted);font-variant-numeric:tabular-nums;text-align:right;font-size:12px}.personal-home-lane>p{min-height:34px;color:var(--pw-muted);margin:7px 0 10px;font-size:10.5px;line-height:1.55}.personal-home-lane.is-needs_you>header i{background:var(--pw-amber)}.personal-home-lane.is-running>header i{background:var(--pw-green)}.personal-home-lane.is-observing>header i{background:var(--pw-blue)}.personal-home-lane.is-scheduled>header i{background:#8b6bd8}.personal-home-lane-list{align-content:start;gap:9px;display:grid}.personal-home-goal-card{border:1px solid var(--pw-line);width:100%;min-width:0;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;gap:7px;padding:12px;transition:border-color .14s,transform .14s,box-shadow .14s;display:grid;box-shadow:0 1px 4px #1e1c140f}.personal-home-goal-card:hover{border-color:var(--pw-line-strong);transform:translateY(-1px);box-shadow:0 4px 12px #1e1c1414}.personal-home-goal-card:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-home-goal-meta{min-width:0;color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:10.5px;display:flex;overflow:hidden}.personal-home-goal-card>strong{text-overflow:ellipsis;font-size:13px;line-height:1.45;overflow:hidden}.personal-home-goal-card>p{color:var(--pw-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:11px;line-height:1.55;display:-webkit-box;overflow:hidden}.personal-home-goal-card>footer{justify-content:space-between;align-items:center;gap:8px;padding-top:2px;display:flex}.personal-home-goal-card>footer span{color:var(--pw-muted);background:#f2f1ed;border-radius:99px;flex:none;padding:2px 7px;font-size:9.5px}.personal-home-goal-card>footer small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.personal-home-history{border:1px solid var(--pw-line);background:#fff9;border-radius:13px}.personal-home-history>summary{cursor:pointer;align-items:center;gap:9px;min-height:44px;padding:0 14px;list-style:none;display:flex}.personal-home-history>summary::-webkit-details-marker{display:none}.personal-home-history>summary span{font-size:12.5px;font-weight:700}.personal-home-history>summary b{color:var(--pw-muted);font-size:11px}.personal-home-history>summary small{color:var(--pw-faint);margin-left:auto;font-size:10.5px}.personal-home-history>div{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:9px;padding:0 12px 12px;display:grid}.personal-session-record{background:var(--pw-blue-soft);border:1px solid #cfdcf9;border-radius:14px;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;margin-bottom:12px;padding:14px 16px;display:grid}.personal-session-record>header{grid-column:1/-1;justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-session-record>header span{color:var(--pw-blue-ink);align-items:center;gap:7px;font-size:12px;font-weight:700;display:inline-flex}.personal-session-record>header button{width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.personal-session-record>header button:hover{color:var(--pw-text);background:#ffffffb3}.personal-session-record>div{min-width:0}.personal-session-record>div strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;display:block;overflow:hidden}.personal-session-record>div p{color:var(--pw-muted);margin:4px 0 0;font-size:11px}.personal-session-record dl{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;display:grid}.personal-session-record dl div{background:#ffffff9e;border-radius:9px;gap:2px;min-width:0;padding:8px 10px;display:grid}.personal-session-record dt{color:var(--pw-faint);font-size:9.5px}.personal-session-record dd{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:0;font:10.5px/1.4 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow:hidden}.personal-session-record>.personal-secondary-action{grid-area:2/2;align-self:center}.personal-channel-timeline{gap:10px;display:grid}.personal-live-region{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;overflow:hidden}.personal-timeline-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;min-height:64px;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto auto 16px;align-items:center;gap:12px;padding:11px 15px;transition:border-color .14s,box-shadow .14s;display:grid}.personal-timeline-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-timeline-row:focus-visible{outline-offset:2px;outline:2px solid #7da2ff}.personal-row-icon{border-radius:11px;place-items:center;width:34px;height:34px;display:grid}.personal-row-icon.is-attention{color:var(--pw-amber);background:var(--pw-amber-bg)}.personal-row-icon.is-run{color:var(--pw-blue-ink);background:var(--pw-blue-soft)}.personal-row-icon.is-output{color:var(--pw-green);background:var(--pw-green-bg)}.personal-row-copy{gap:3px;min-width:0;display:grid}.personal-row-copy strong,.personal-row-copy small,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-row-copy strong{font-size:13.5px;font-weight:600}.personal-row-copy small,.personal-row-copy span{color:var(--pw-muted);font-size:11px}.personal-row-status{color:var(--pw-muted);white-space:nowrap;background:#f2f1ed;border-radius:99px;align-items:center;gap:5px;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-row-status.is-running{background:var(--pw-green-bg);color:var(--pw-green)}.personal-output-row time{color:var(--pw-muted);font-size:11px}.personal-spin{animation:1.2s linear infinite pw-spin}@keyframes pw-spin{to{transform:rotate(360deg)}}.personal-message{gap:11px;max-width:84%;padding:6px 2px;display:flex}.personal-message.is-user{background:var(--pw-blue-soft);color:var(--pw-text);border:1px solid #dbe7fd;border-radius:16px 16px 4px;justify-self:end;padding:11px 15px}.personal-message-avatar{background:var(--pw-blue-soft);height:34px;color:var(--pw-blue-ink);border-radius:11px;flex:0 0 34px;place-items:center;display:grid}.personal-message header{align-items:baseline;gap:8px;display:flex}.personal-message header strong{font-size:12px}.personal-message time{color:var(--pw-faint);font-size:10px}.personal-message p{white-space:pre-wrap;margin:6px 0 0;font-size:13.5px;line-height:1.7}.personal-message-pending{color:var(--pw-muted);font-size:11px}.personal-return-delivery{color:var(--pw-muted);margin-top:7px;font-size:11px;font-weight:600;display:inline-block}.personal-return-delivery.is-delivered{color:var(--pw-green)}.personal-return-delivery.is-verification_required{color:var(--pw-blue-ink)}.personal-return-delivery.is-explicit_unverified{color:var(--pw-amber)}.personal-message-images{flex-wrap:wrap;gap:7px;margin-top:8px;display:flex}.personal-message-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:min(220px,100%);max-height:180px}.personal-md{overflow-wrap:anywhere;font-size:13.5px;line-height:1.7}.personal-md>*+*{margin-top:8px}.personal-md p{margin:0}.personal-md-heading.is-h1,.personal-md-heading.is-h2{font-size:14.5px}.personal-md-code{color:#4d5361;background:#f0efe9;border-radius:5px;padding:1px 5px;font-family:SF Mono,ui-monospace,Menlo,Consolas,monospace;font-size:.86em}.personal-md-pre{color:#e8ecf3;white-space:pre;background:#23262e;border-radius:10px;margin:0;padding:12px 14px;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace;overflow-x:auto}.personal-md-pre code{font:inherit}.personal-md-link{color:var(--pw-blue-ink);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:13px;flex:none;place-items:center;width:44px;height:44px;font-size:18px;font-weight:700;display:grid;box-shadow:0 2px 6px #2f66e947}.personal-agent-health.is-off{color:var(--pw-muted);background:#f2f1ed}.personal-agent-persona dl{border-top:1px solid var(--pw-line);margin-top:14px;padding-top:13px}.personal-detail-card-title{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-detail-card-title em{color:var(--pw-muted);background:#f1f1ee;border-radius:99px;padding:2px 8px;font-size:10px;font-style:normal;font-weight:650}.personal-goal-repository h3{align-items:center;gap:8px;display:flex}.personal-goal-notification h3{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-connection-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;padding:2px 8px;font-size:10px;font-weight:650}.personal-subagent-heading{justify-content:space-between;align-items:flex-start;gap:14px;display:flex}.personal-subagent-heading h3{align-items:center;gap:7px;margin-bottom:0;display:flex}.personal-subagent-switch{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#f2f1ed;border-radius:99px;flex:none;align-items:center;gap:7px;padding:4px 9px 4px 5px;font-size:11px;font-weight:700;display:inline-flex}.personal-subagent-switch>span{background:#c8c8c2;border-radius:99px;width:30px;height:18px;transition:background .18s;position:relative}.personal-subagent-switch>span:after{content:"";background:#fff;border-radius:50%;width:12px;height:12px;transition:transform .18s;position:absolute;top:3px;left:3px}.personal-subagent-switch[aria-checked=true]{background:var(--pw-green-bg);color:var(--pw-green);border-color:#b9dccb}.personal-subagent-switch[aria-checked=true]>span{background:var(--pw-green)}.personal-subagent-switch[aria-checked=true]>span:after{transform:translate(12px)}.personal-subagent-switch[data-pending=true]{color:#8a6b00;opacity:1;background:#fffbed;border-color:#d8c67a}.personal-subagent-switch:disabled{cursor:default;opacity:.55}.personal-subagent-switch[data-pending=true]:disabled{opacity:1}.personal-subagent-fields{border-top:1px solid var(--pw-line);grid-template-columns:minmax(0,1fr) 112px;gap:10px;margin-top:14px;padding-top:13px;display:grid}.personal-subagent-fields label{color:var(--pw-text);align-content:start;gap:6px;font-size:11.5px;font-weight:650;display:grid}.personal-subagent-fields input:not([type=checkbox]),.personal-subagent-fields select{border:1px solid var(--pw-line-strong);min-width:0;min-height:38px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 10px;font-size:12px}.personal-subagent-fields label small{color:var(--pw-faint);font-size:10.5px;font-weight:450;line-height:1.45}.personal-subagent-domain-picker{border:0;grid-column:1/-1;min-width:0;margin:0;padding:0}.personal-subagent-domain-picker>legend{color:var(--pw-text);margin-bottom:7px;padding:0;font-size:11.5px;font-weight:650}.personal-subagent-domain-picker>small{color:var(--pw-faint);margin-top:7px;font-size:10.5px;line-height:1.45;display:block}.personal-subagent-domain-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;display:grid}.personal-subagent-domain-option{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:9px;grid-template-columns:auto minmax(0,1fr);min-height:44px;padding:8px 9px;align-items:center!important;display:grid!important}.personal-subagent-domain-option:hover{border-color:#b9c9dc}.personal-subagent-domain-option:has(input:focus-visible){outline:2px solid var(--pw-blue);outline-offset:2px}.personal-subagent-domain-option.is-selected{background:var(--pw-blue-soft);border-color:#9fc4ed}.personal-subagent-domain-option input{width:15px;height:15px;accent-color:var(--pw-blue);margin:0}.personal-subagent-domain-option>span{gap:1px;min-width:0;display:grid}.personal-subagent-domain-option strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.personal-subagent-domain-option small{font-size:9.5px!important;font-weight:450!important}.personal-subagent-domain-empty{border:1px dashed var(--pw-line-strong);background:var(--pw-bg);color:var(--pw-muted);border-radius:9px;grid-column:1/-1;margin:0;padding:10px;font-size:10.5px;line-height:1.5}.personal-subagent-limit-field{grid-column:1/-1;width:112px}.personal-subagent-fields .personal-secondary-action{grid-column:1/-1;margin-top:0}.personal-subagent-preview{background:#fffbed;border:1px solid #d8c67a;border-radius:10px;margin-top:10px;padding:12px}.personal-subagent-preview>strong{font-size:12.5px}.personal-subagent-preview>p{margin:5px 0 0}.personal-subagent-preview>div{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-subagent-preview .personal-primary-action,.personal-subagent-preview .personal-secondary-action{min-height:38px;margin-top:10px}.personal-subagent-feedback{align-items:flex-start;gap:7px;display:flex;margin:10px 0 0!important}.personal-subagent-feedback.is-success{color:var(--pw-green)!important}.personal-subagent-feedback.is-warning{color:#8a6b00!important}.personal-subagent-feedback.is-error{color:var(--pw-red)!important}.personal-subagent-read-only{margin-bottom:0}.personal-settings-page{--pw-bg:#fbfaf7;--pw-card:#fff;--pw-line:#eceae3;--pw-line-strong:#e0ddd4;--pw-muted:#82889a;--pw-faint:#aab0bf;--pw-text:#23262e;--pw-blue:#2f66e9;--pw-blue-ink:#2456c8;--pw-blue-soft:#ebf1fe;--pw-red:#c2402f;--pw-red-bg:#fcecea;--pw-green:#2e7d5b;--pw-green-bg:#e6f3ec;background:var(--pw-bg);height:100dvh;min-height:0;color:var(--pw-text);grid-template-rows:minmax(0,1fr);grid-template-columns:268px minmax(0,1fr);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;display:grid;overflow:hidden}.personal-settings-sidebar{overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--pw-line);background:#f5f3ee;flex-direction:column;gap:14px;min-width:0;height:100%;min-height:0;padding:18px 14px;display:flex;position:relative;overflow-y:auto}.personal-settings-page :focus-visible{outline-offset:2px;outline:2px solid #5f87ed}.personal-settings-back{width:100%;min-height:40px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:0 10px;font-size:13px;font-weight:650;display:inline-flex}.personal-settings-back:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-title{border-bottom:1px solid var(--pw-line);gap:3px;padding:8px 10px 10px;display:grid}.personal-settings-title small{color:var(--pw-faint);letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-settings-title strong{letter-spacing:-.02em;font-size:18px}.personal-settings-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:24px;display:flex}.personal-settings-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-settings-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-settings-tabs{gap:3px;display:grid}.personal-settings-tabs button{width:100%;min-height:54px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:9px;padding:8px 10px;display:grid}.personal-settings-tabs button:hover{color:var(--pw-text);background:#ffffffa6}.personal-settings-tabs button[aria-current=page]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141a}.personal-settings-tabs button>span{gap:2px;min-width:0;display:grid}.personal-settings-tabs strong{font-size:13px}.personal-settings-body{overscroll-behavior:contain;scrollbar-gutter:stable;min-width:0;min-height:0;padding:30px clamp(24px,5vw,72px);overflow:auto}.personal-settings-body:has(>.personal-capability-settings){grid-template-rows:auto minmax(0,1fr);display:grid;overflow:hidden}.personal-settings-body>.personal-settings-header{min-width:0}.personal-settings-page *,.personal-settings-page :before,.personal-settings-page :after{box-sizing:border-box}.personal-appearance-settings{max-width:680px}.personal-settings-choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;display:grid}.personal-settings-choice-group button{border:1px solid var(--pw-line);min-height:60px;color:inherit;cursor:pointer;text-align:left;background:#fff;border-radius:12px;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:13px;display:grid}.personal-settings-choice-group button:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-settings-choice-group button[aria-checked=true]{background:#f7f9ff;border-color:#9fb9f4;box-shadow:0 0 0 3px #2f66e91a}.personal-settings-choice-group strong{align-self:center;font-size:13px}.personal-settings-theme-swatch{border:1px solid var(--pw-line-strong);border-radius:10px;width:34px;height:34px;display:block}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 44%,#0070f3 44% 54%,#fafafa 54% 76%,#fff 76%);border-radius:6px}.personal-settings-theme-swatch.is-paper{background:linear-gradient(135deg,#fbfaf7 0 48%,#2f66e9 48% 58%,#fff 58%)}.personal-settings-theme-swatch.is-brutal{background:linear-gradient(135deg,#ffd91a 0 45%,#ff8fd0 45% 70%,#8fdcff 70%);border:2px solid #141414;border-radius:5px;box-shadow:2px 2px #141414}.personal-lark-settings{background:var(--pw-bg);min-height:100vh;color:var(--pw-text);padding:30px clamp(24px,5vw,72px);position:relative}.personal-lark-settings.is-embedded{background:0 0;min-height:0;padding:0}.personal-lark-header{justify-content:space-between;align-items:flex-start;gap:24px;max-width:1180px;margin:0 auto;display:flex}.personal-lark-header small{color:var(--pw-blue);letter-spacing:.08em;text-transform:uppercase;font-size:11px;font-weight:700}.personal-lark-header h1{letter-spacing:-.035em;margin:4px 0 2px;font-size:28px}.personal-lark-header p{color:var(--pw-muted);margin:0;font-size:13px}.personal-lark-tabs{border-bottom:1px solid var(--pw-line);gap:24px;max-width:1180px;margin:28px auto 20px;display:flex}.personal-lark-settings.is-embedded .personal-lark-tabs{margin-top:0}.personal-lark-tabs button{min-height:42px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;align-items:center;gap:8px;padding:0 2px;font-weight:650;display:flex}.personal-lark-tabs button[aria-current=page]{border-color:var(--pw-blue);color:var(--pw-text)}.personal-lark-tabs span{min-width:20px;height:20px;color:var(--pw-muted);background:#efeee9;border-radius:99px;place-items:center;padding:0 5px;font-size:10px;display:inline-grid}.personal-lark-section-heading{max-width:1180px;margin:0 auto 18px}.personal-lark-section-heading small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-section-heading h2{letter-spacing:-.025em;margin:4px 0;font-size:21px}.personal-lark-section-heading p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-subtabs{margin-top:0}.personal-settings-content{max-width:1180px;margin:0 auto}.personal-settings-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:16px;max-width:720px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-settings-card>header{border-bottom:1px solid var(--pw-line);align-items:center;gap:13px;padding:20px;display:flex}.personal-settings-card>header h2{letter-spacing:-.02em;margin:0;font-size:17px}.personal-settings-card>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-settings-icon{background:var(--pw-blue-soft);width:40px;height:40px;color:var(--pw-blue);border-radius:12px;flex:none;place-items:center;display:grid}.personal-language-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 20px;display:grid}.personal-language-options>button{border:1px solid var(--pw-line);min-height:66px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;padding:13px 15px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.personal-language-options>button:hover{border-color:var(--pw-line-strong);background:#fcfbf8}.personal-language-options>button.is-selected{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-color:#9bb5f0;box-shadow:0 0 0 1px #2f66e814}.personal-language-options>button>span{gap:4px;display:grid}.personal-language-options strong{font-size:13px}.personal-settings-card>footer{border-top:1px solid var(--pw-line);color:var(--pw-faint);background:#faf9f6;padding:13px 20px;font-size:11px}.personal-machine-loading{min-height:220px;color:var(--pw-muted);place-items:center;font-size:13px;display:grid}.personal-machine-layout{grid-template-columns:210px minmax(0,1fr);gap:22px;max-width:1080px;display:grid}.personal-machine-namespaces{min-width:0}.personal-machine-namespaces>div{gap:3px;margin-bottom:10px;padding:0 4px;display:grid}.personal-machine-namespaces>div small,.personal-machine-editor>header small,.personal-machine-editor-bar small{color:var(--pw-blue);letter-spacing:.07em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-machine-namespaces>div strong{font-size:13px}.personal-machine-namespaces nav{gap:5px;display:grid}.personal-machine-namespaces button{width:100%;min-height:52px;color:var(--pw-muted);cursor:pointer;text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;gap:3px;padding:9px 11px;display:grid}.personal-machine-namespaces button:hover{border-color:var(--pw-line);background:#fff9}.personal-machine-namespaces button[aria-current=page]{border-color:var(--pw-line-strong);color:var(--pw-text);background:#fff;box-shadow:0 2px 8px #1e1c140d}.personal-machine-namespaces button span{overflow-wrap:anywhere;font-size:12px;font-weight:650}.personal-machine-namespaces button small{color:var(--pw-muted);font-size:10px}.personal-machine-content{min-width:0}.personal-machine-summary{border:1px solid var(--pw-line);background:#fff;border-radius:14px;justify-content:space-between;align-items:center;gap:20px;margin-bottom:14px;padding:14px 16px;display:flex}.personal-machine-summary>div{align-items:center;gap:11px;min-width:0;display:flex}.personal-machine-summary>div>span:last-child{gap:3px;display:grid}.personal-machine-summary>div small{color:var(--pw-muted);text-transform:uppercase;font-size:10px;font-weight:650}.personal-machine-summary>div strong{font-size:13px}.personal-machine-summary dl{gap:22px;margin:0;display:flex}.personal-machine-summary dl div{gap:3px;display:grid}.personal-machine-summary dt{color:var(--pw-muted);font-size:10px}.personal-machine-summary dd{margin:0;font-family:SFMono-Regular,Consolas,monospace;font-size:11px;font-weight:650}.personal-machine-editor-bar{justify-content:space-between;align-items:center;gap:14px;margin-bottom:10px;padding:0 2px;display:flex}.personal-machine-editor-mode{border:1px solid var(--pw-line);background:#f5f4f0;border-radius:9px;flex:none;gap:3px;padding:3px;display:flex}.personal-machine-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;padding:0 12px;font-size:11px;font-weight:650}.personal-machine-editor-mode button[aria-pressed=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c1414}.personal-machine-editor{border:1px solid var(--pw-line);background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px #1e1c140a}.personal-machine-editor>header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;gap:20px;padding:20px;display:flex}.personal-machine-editor>header h2{letter-spacing:-.02em;margin:4px 0 3px;font-size:18px}.personal-machine-editor>header p{max-width:610px;color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-machine-switch{min-height:44px;color:var(--pw-muted);cursor:pointer;white-space:nowrap;flex:none;align-items:center;gap:9px;font-size:12px;font-weight:650;display:flex}.personal-machine-switch input{width:42px;height:24px;accent-color:var(--pw-blue);cursor:pointer;margin:0}.personal-machine-scope-note{color:var(--pw-blue-ink);background:#f6f8fd;border:1px solid #cfdaf3;border-radius:12px;align-items:flex-start;gap:10px;margin:18px 20px 0;padding:13px 14px;display:flex}.personal-machine-scope-note svg{flex:none;margin-top:1px}.personal-machine-scope-note strong{font-size:12px}.personal-machine-scope-note p{color:#52627f;margin:3px 0 0;font-size:11px;line-height:1.55}.personal-machine-editor fieldset{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0;padding:20px;display:grid}.personal-machine-editor fieldset label{align-content:start;gap:6px;min-width:0;display:grid}.personal-machine-editor fieldset label:last-child{grid-column:1/-1}.personal-machine-editor fieldset label>span{font-size:12px;font-weight:650}.personal-machine-editor fieldset label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.45}.personal-machine-editor input[type=text],.personal-machine-editor fieldset input{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px;font-size:13px}.personal-machine-editor fieldset:disabled{opacity:.58}.personal-machine-editor fieldset:disabled input{cursor:not-allowed}.personal-machine-json-editor>label{gap:7px;padding:20px;display:grid}.personal-machine-json-editor>label>span{font-size:12px;font-weight:650}.personal-machine-json-editor>label>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-machine-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-machine-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-machine-validation,.personal-machine-error,.personal-machine-notice{border-radius:9px;margin:0 20px 16px;padding:10px 12px;font-size:11px;line-height:1.5}.personal-machine-validation,.personal-machine-error{background:var(--pw-red-bg);color:var(--pw-red);border:1px solid #edc1ba}.personal-machine-notice{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #bcdacb;align-items:center;gap:8px;display:flex}.personal-machine-preview{background:#f8faff;border:1px solid #aebfec;border-radius:12px;margin:0 20px 18px;padding:14px}.personal-machine-preview header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-machine-preview header strong{font-size:12px}.personal-machine-preview header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:99px;padding:3px 8px;font-size:10px;font-weight:650}.personal-machine-preview dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;display:grid}.personal-machine-preview dl div{background:#fff;border:1px solid #dfe5f3;border-radius:8px;min-width:0;padding:8px}.personal-machine-preview dt{color:var(--pw-muted);font-size:9.5px}.personal-machine-preview dd{overflow-wrap:anywhere;margin:4px 0 0;font-family:SFMono-Regular,Consolas,monospace;font-size:10.5px;font-weight:650}.personal-machine-preview p{color:#52627f;margin:0;font-size:10.5px;line-height:1.5}.personal-machine-rollback{border:1px solid var(--pw-line);background:#faf9f6;border-radius:12px;justify-content:space-between;align-items:center;gap:18px;margin:0 20px 18px;padding:13px 14px;display:flex}.personal-machine-rollback strong{font-size:12px}.personal-machine-rollback p{color:var(--pw-muted);margin:3px 0 0;font-size:10.5px;line-height:1.45}.personal-machine-rollback .personal-secondary-action{flex:none;width:auto;min-height:40px;margin:0;padding:0 13px}.personal-machine-editor>footer{border-top:1px solid var(--pw-line);background:#faf9f6;justify-content:flex-end;gap:10px;padding:15px 20px;display:flex}.personal-machine-editor>footer .personal-primary-action,.personal-machine-editor>footer .personal-secondary-action,.personal-machine-editor>footer .personal-danger-action{width:auto;min-height:42px;margin:0;padding:0 15px}.personal-machine-unavailable{border:1px dashed var(--pw-line-strong);min-height:180px;color:var(--pw-muted);background:#fff;border-radius:14px;justify-items:start;gap:8px;padding:26px;display:grid}.personal-machine-unavailable strong{color:var(--pw-text);font-size:13px}.personal-machine-unavailable p{max-width:540px;margin:0;font-size:11px;line-height:1.6}.personal-lark-loading,.personal-lark-empty{min-height:130px;color:var(--pw-muted);justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.personal-lark-apps{max-width:1180px;margin:0 auto}.personal-lark-app-toolbar{color:var(--pw-muted);justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-size:11px;display:flex}.personal-lark-app-toolbar .personal-primary-action{width:auto;min-height:40px;margin:0;padding:0 16px}.personal-lark-app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;display:grid}.personal-lark-app-card{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:15px;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:11px;padding:18px;display:grid}.personal-lark-app-avatar{background:var(--pw-blue-soft);width:42px;height:42px;color:var(--pw-blue);border-radius:12px;place-items:center;display:grid}.personal-lark-app-card div{gap:3px;display:grid}.personal-lark-app-card small,.personal-lark-app-card p{color:var(--pw-muted);font-size:11px}.personal-lark-app-card em{border-radius:99px;padding:3px 9px;font-size:10px;font-style:normal;font-weight:650}.personal-lark-app-card em.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-app-card em.is-off{color:var(--pw-muted);background:#f1f1ee}.personal-lark-app-card p{grid-column:2/-1;margin:0}.personal-lark-connections{max-width:1180px;margin:0 auto}.personal-lark-route-readiness{background:var(--pw-amber-bg);color:var(--pw-amber);border:1px solid #ead49a;border-radius:10px;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;font-size:12px;font-weight:650;line-height:1.5;display:flex}.personal-lark-route-readiness svg{flex:none}.personal-lark-toolbar{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}.personal-lark-toolbar>label{border:1px solid var(--pw-line);max-width:680px;height:40px;color:var(--pw-faint);background:#fff;border-radius:10px;flex:1;align-items:center;gap:8px;padding:0 12px;display:flex}.personal-lark-toolbar input{width:100%;font:inherit;background:0 0;border:0;outline:0}.personal-lark-toolbar .personal-primary-action{flex:none;width:auto;min-height:40px;margin-top:0;padding:0 16px}.personal-lark-table{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:14px;overflow:hidden}.personal-lark-table-head,.personal-lark-table-row{grid-template-columns:1.35fr 1.35fr .72fr .72fr 100px;align-items:center;gap:16px;padding:12px 16px;display:grid}.personal-lark-table-head{border-bottom:1px solid var(--pw-line);min-height:42px;color:var(--pw-faint);letter-spacing:.04em;text-transform:uppercase;font-size:10px;font-weight:700}.personal-lark-table-row{border-bottom:1px solid var(--pw-line);min-height:70px;font-size:12px}.personal-lark-table-row:last-of-type{border-bottom:0}.personal-lark-table-row>span{gap:3px;min-width:0;display:grid}.personal-lark-table-row strong,.personal-lark-table-row small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.personal-lark-table-row small{color:var(--pw-muted);font-size:10px}.personal-lark-row-actions{justify-content:flex-end;display:flex!important}.personal-lark-row-actions button,.personal-lark-modal header button{border:1px solid var(--pw-line);min-height:30px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:8px;align-items:center;gap:4px;padding:0 8px;font-size:10px;display:inline-flex}.personal-lark-row-actions button.is-confirm{background:var(--pw-red-bg);color:var(--pw-red);border-color:#e6b0aa}.personal-lark-modal-backdrop{z-index:80;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1e1f2361;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.personal-lark-modal{border:1px solid var(--pw-line);background:#fff;border-radius:18px;gap:14px;width:min(560px,100%);max-height:calc(100vh - 48px);padding:22px;display:grid;overflow:auto;box-shadow:0 24px 70px #14182340}.personal-lark-modal header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.personal-lark-modal header small{color:var(--pw-muted);font-size:10px}.personal-lark-modal h2{letter-spacing:-.02em;margin:3px 0 0;font-size:20px}.personal-lark-modal>label{color:var(--pw-muted);gap:7px;font-size:11px;font-weight:650;display:grid}.personal-lark-modal>label>small{color:var(--pw-faint);font-size:10px;font-weight:450;line-height:1.45}.personal-lark-modal input[type=search],.personal-lark-modal input[type=text],.personal-lark-modal input:not([type]),.personal-lark-modal select{border:1px solid var(--pw-line-strong);width:100%;min-height:40px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:0 11px}.personal-lark-modal label:has(input[type=search]){grid-template-columns:1fr}.personal-lark-modal label:has(input[type=search]) input{margin-bottom:2px}.personal-lark-group-state{border:1px dashed var(--pw-line-strong);min-height:40px;color:var(--pw-muted);background:#fafaf8;border-radius:9px;align-items:center;gap:7px;padding:9px 11px;font-size:11px;font-weight:500;line-height:1.45;display:flex}.personal-lark-group-state.is-error{background:var(--pw-red-bg);color:var(--pw-red);border-style:solid;border-color:#efc3bd}.personal-lark-check{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;align-items:flex-start;padding:12px;gap:10px!important;display:flex!important}.personal-lark-check input{accent-color:var(--pw-blue);margin-top:2px}.personal-lark-check span{gap:2px;display:grid}.personal-lark-check strong{color:var(--pw-text)}.personal-lark-check small{font-weight:400}.personal-lark-agent-apps{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-agent-apps legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-agent-apps>small{color:var(--pw-faint);font-size:10px;line-height:1.45}.personal-lark-agent-apps>div{gap:8px;display:grid}.personal-lark-agent-apps label{border:1px solid var(--pw-line);background:#fafaf8;border-radius:10px;grid-template-columns:minmax(0,1fr) minmax(180px,1fr);align-items:center;gap:12px;padding:10px 11px;display:grid}.personal-lark-agent-apps label>span{gap:2px;min-width:0;display:grid}.personal-lark-agent-apps label strong{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.personal-lark-agent-apps label small{color:var(--pw-faint);text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.personal-lark-agent-apps select{min-width:0}.personal-lark-ingress{color:var(--pw-muted);border:0;gap:7px;margin:0;padding:0;display:grid}.personal-lark-ingress legend{margin-bottom:1px;font-size:11px;font-weight:650}.personal-lark-ingress>div{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.personal-lark-ingress label{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:10px;min-height:84px;padding:11px;display:block;position:relative}.personal-lark-ingress label.is-active{border-color:var(--pw-blue);background:#2f69eb0f;box-shadow:0 0 0 1px #2f69eb24}.personal-lark-ingress input{opacity:0;width:1px;height:1px;position:absolute}.personal-lark-ingress span{gap:5px;display:grid}.personal-lark-ingress strong{color:var(--pw-text);font-size:11px}.personal-lark-ingress small{color:var(--pw-faint);font-size:9px;font-weight:450;line-height:1.35}.personal-lark-topic-preview{border:1px solid var(--pw-line);min-height:40px;color:var(--pw-text);background:#f7f7f4;border-radius:9px;align-items:center;gap:8px;padding:0 11px;font-size:12px;font-weight:500;display:flex}.personal-lark-topic-preview.is-locked{color:var(--pw-muted)}.personal-lark-cardinality{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:9px;align-items:center;gap:8px;margin:0;padding:10px 12px;font-size:11px;display:flex}.personal-lark-modal footer{z-index:2;border-top:1px solid var(--pw-line);background:#fff;justify-content:flex-end;gap:9px;margin:0 -22px -22px;padding:12px 22px 22px;display:flex;position:sticky;bottom:-22px}.personal-lark-modal footer button{width:auto;min-width:96px;margin-top:0;padding:0 16px}@media (width<=640px){.personal-lark-agent-apps label{grid-template-columns:1fr}}.personal-lark-modal-backdrop.is-setup{z-index:90}.personal-lark-setup-modal{width:min(620px,100%)}.personal-lark-setup-copy{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-lark-setup-progress{border:1px solid var(--pw-line);background:#fafaf8;border-radius:13px;grid-template-columns:46px minmax(0,1fr);align-items:center;gap:13px;min-height:132px;padding:18px;display:grid}.personal-lark-setup-progress>div{gap:5px;display:grid}.personal-lark-setup-progress p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-lark-setup-progress a{width:fit-content;color:var(--pw-blue);grid-column:2;align-items:center;gap:6px;font-size:11px;font-weight:650;text-decoration:none;display:inline-flex}.personal-lark-setup-icon{background:var(--pw-blue-soft);width:46px;height:46px;color:var(--pw-blue);border-radius:13px;place-items:center;display:grid}.personal-lark-setup-icon.is-ready{background:var(--pw-green-bg);color:var(--pw-green)}.personal-lark-setup-icon.is-failed,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-row{width:100%;color:inherit;cursor:pointer;text-align:left;background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px;display:grid}.personal-proposal-row:hover{border-color:#8fabe9;box-shadow:0 2px 10px #2f66e814}.personal-proposal-row>span:first-child{color:#315fc8;background:#e4ebff;border-radius:11px;place-items:center;width:36px;height:36px;display:grid}.personal-proposal-row>span:nth-child(2){gap:3px;min-width:0;display:grid}.personal-proposal-row small{color:#5f74ad;font-size:10px}.personal-proposal-row strong{font-size:13px}.personal-proposal-row p{color:#686f7c;margin:0;font-size:11px}.personal-proposal-row>b{color:#315fc8;font-size:11px}.personal-proposal-row.is-applied{background:#f3fbf7;border-color:#b5ddcc}.personal-proposal-row.is-error,.personal-proposal-row.is-stale{background:#fff7f7;border-color:#efc3c3}.personal-proposal-row.is-gated{background:#fffaf0;border-color:#ead39c}.personal-gated-summary{background:#fffaf0;border:1px solid #ead39c;border-radius:14px}.personal-gated-summary>summary{color:#6d5620;cursor:pointer;align-items:center;gap:9px;padding:12px 14px;list-style:none;display:flex}.personal-gated-summary>summary::-webkit-details-marker{display:none}.personal-gated-summary>summary>span{color:#9a741d;background:#fff1c9;border-radius:9px;place-items:center;width:30px;height:30px;display:grid}.personal-gated-summary>summary small{color:#927d4c;margin-left:auto}.personal-gated-summary>div{gap:8px;padding:0 8px 8px;display:grid}.personal-gated-summary .personal-proposal-row{background:#fffdf7}.personal-schedule-row{border:1px solid var(--pw-line);background:var(--pw-card);width:100%;color:inherit;cursor:pointer;text-align:left;border-radius:14px;grid-template-columns:36px minmax(0,1fr) auto 16px;align-items:center;gap:12px;padding:13px 15px;display:grid}.personal-schedule-row:hover{border-color:var(--pw-line-strong);box-shadow:0 2px 8px #1e1c140f}.personal-schedule-icon{width:34px;height:34px;color:var(--pw-muted);background:#f2f1ed;border-radius:11px;place-items:center;display:grid}.personal-schedule-copy{gap:2px;min-width:0;display:grid}.personal-schedule-copy small,.personal-schedule-copy p{color:var(--pw-muted);margin:0;font-size:10px}.personal-schedule-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;overflow:hidden}.personal-schedule-status{background:var(--pw-green-bg);color:var(--pw-green);border-radius:99px;align-items:center;padding:2.5px 10px;font-size:11px;font-weight:600;display:inline-flex}.personal-schedule-status.is-paused{color:var(--pw-muted);background:#f2f1ed}.personal-timeline-empty{text-align:center;place-items:center;padding:70px 20px;display:grid}.personal-timeline-empty>span{background:var(--pw-blue-soft);width:44px;height:44px;color:var(--pw-blue);border-radius:14px;place-items:center;margin-bottom:14px;display:grid}.personal-timeline-empty p{max-width:420px;color:var(--pw-muted);font-size:13px}.personal-object-list{border:1px solid var(--pw-line);background:#fff;border-radius:14px;overflow:hidden}.personal-object-list>header,.personal-object-list>button{border:0;border-bottom:1px solid var(--pw-line);width:100%;min-height:52px;color:inherit;text-align:left;background:0 0;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 15px;display:grid}.personal-object-list>header{min-height:46px;color:var(--pw-faint);letter-spacing:.06em;grid-template-columns:minmax(0,1fr) auto;font-size:12px;font-weight:650}.personal-object-list>button{cursor:pointer}.personal-object-list>button:hover{background:#faf9f6}.personal-object-list>button:last-child{border-bottom:0}.personal-object-list>button>p{color:var(--pw-muted);text-overflow:ellipsis;white-space:nowrap;grid-column:2/-1;margin:-3px 0 0;font-size:12px;line-height:1.45;overflow:hidden}.personal-object-list>button>em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;justify-self:end;padding:2px 7px;font-size:10px;font-style:normal;font-weight:700}.personal-object-list small{color:var(--pw-muted)}.personal-object-list>button>small{white-space:nowrap;align-items:center;gap:8px;display:inline-flex}.personal-object-list-state{border-bottom:1px solid var(--pw-line);color:var(--pw-muted);align-items:center;gap:8px;margin:0;padding:14px 15px;font-size:12px;line-height:1.5;display:flex}.personal-object-list-state.is-error{color:var(--pw-red);background:var(--pw-red-bg)}.personal-object-list .is-done{color:var(--pw-green)}.personal-object-list .is-attention{color:var(--pw-amber);font-weight:700}.personal-task-age{color:var(--pw-faint);font-size:11px}.personal-task-empty{color:var(--pw-muted);margin:0;padding:4px 15px 16px;font-size:12.5px}.personal-task-lane-filter{border:1px solid var(--pw-line);background:#fff;border-radius:10px;justify-content:space-between;align-items:center;gap:16px;min-height:50px;padding:8px 12px;display:flex}.personal-capability-settings{grid-template-rows:auto minmax(0,1fr);gap:16px;width:100%;min-width:0;max-width:1050px;min-height:0;display:grid;overflow:hidden}.personal-capability-body{flex-direction:column;gap:16px;min-width:0;min-height:0;display:flex;overflow:hidden}.personal-capability-body>.personal-capability-layout{flex:auto}.personal-provider-settings{width:100%;min-width:0;max-width:1050px}.personal-provider-settings>.personal-operator-credential{margin-top:0}.personal-capability-scope-note{overscroll-behavior:contain;max-height:120px;color:var(--pw-muted);padding:12px 0;overflow:auto}.personal-capability-scope-note summary{cursor:pointer;align-items:center;gap:8px;font-size:12px;display:flex}.personal-capability-scope-note p{padding:10px 0 0 25px}.personal-capability-scope-note svg{flex:none;margin-top:2px}.personal-operator-credential{border:1px solid var(--pw-border);background:var(--pw-surface);border-radius:10px;gap:12px;margin:16px 0 24px;padding:16px;display:grid}.personal-operator-credential>header{grid-template-columns:auto 1fr auto;align-items:start;gap:10px;display:grid}.personal-operator-credential>header strong{font-size:13px;display:block}.personal-operator-credential>header p{color:var(--pw-muted);margin:4px 0 0;font-size:12px;line-height:1.5}.personal-operator-credential-status{color:var(--pw-muted);font-family:var(--pw-font-mono);font-size:11px}.personal-operator-credential-readback{gap:6px;margin:0;font-size:12px;display:grid}.personal-operator-credential-readback>div{grid-template-columns:140px 1fr;gap:10px;display:grid}.personal-operator-credential-readback dt{color:var(--pw-muted)}.personal-operator-credential-readback dd{overflow-wrap:anywhere;margin:0}.personal-operator-credential label{gap:4px;font-size:12px;display:grid}.personal-operator-credential input{border:1px solid var(--pw-border);background:var(--pw-canvas);color:inherit;border-radius:8px;padding:7px 9px;font-size:12px}.personal-operator-credential input:disabled{opacity:.6}.personal-capability-scope-note p{margin:0;font-size:12px;line-height:1.55}.personal-capability-scope-note strong{color:var(--pw-text);display:block}.personal-capability-layout{grid-template-columns:220px minmax(0,1fr);align-items:stretch;gap:24px;min-width:0;min-height:0;display:grid;overflow:hidden}.personal-capability-list{overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;gap:6px;min-height:0;padding:3px;display:grid;overflow-y:auto}.personal-capability-list button{min-height:44px;color:var(--pw-text);cursor:pointer;text-align:left;background:#fff;border:1px solid #0000;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;display:flex}.personal-capability-list button:hover{border-color:#b8c9f5}.personal-capability-list button[aria-current=page]{background:#f4f7ff;border-color:#8cacf0;box-shadow:0 0 0 3px #2f66e914}.personal-capability-list button>span{gap:2px;min-width:0;display:grid}.personal-capability-list em{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:999px;flex:none;padding:3px 6px;font-size:9px;font-style:normal;font-weight:750}.personal-capability-list strong{overflow-wrap:anywhere;font-size:13px;font-weight:500;line-height:1.5}.personal-capability-detail{overscroll-behavior:contain;scrollbar-gutter:stable;border:1px solid var(--pw-line);background:#fff;border-radius:14px;align-self:start;min-width:0;min-height:0;max-height:100%;overflow:auto}.personal-capability-detail>header{border-bottom:1px solid var(--pw-line);align-items:flex-start;gap:12px;padding:24px;display:flex}.personal-capability-detail>header>div{flex:1;min-width:0}.personal-capability-help{color:var(--pw-muted);margin-top:8px;font-size:12px}.personal-capability-help summary{cursor:pointer}.personal-capability-help p{padding-top:12px}.personal-capability-help dl{gap:12px;margin-bottom:0;display:grid}.personal-capability-help dt{color:var(--pw-text);font-weight:500}.personal-capability-help dd{margin:4px 0 0;line-height:1.6}.personal-capability-detail h2{margin:2px 0 4px;font-size:17px}.personal-capability-detail p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.55}.personal-capability-value-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px 18px;display:grid}.personal-capability-raw-values{border-top:1px solid var(--pw-line)}.personal-capability-raw-values>summary{cursor:pointer;color:var(--pw-text);padding:16px 18px;font-size:12px}.personal-capability-raw-values>summary:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-2px}.personal-capability-value-grid section{min-width:0}.personal-capability-value-grid strong,.personal-capability-field-summary>strong{font-size:11px}.personal-capability-value-grid pre{border:1px solid var(--pw-line);min-height:72px;max-height:220px;color:var(--pw-text);background:#faf9f6;border-radius:9px;margin:7px 0 0;padding:11px;font-size:10.5px;line-height:1.5;overflow:auto}.personal-capability-editor-status{border-radius:10px;align-items:flex-start;gap:10px;margin:20px 24px;padding:12px;display:flex}.personal-capability-heading-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.personal-capability-heading-row .personal-capability-effective-source{color:var(--pw-muted);align-items:center;gap:6px;margin:0;display:flex}.personal-capability-effective-source span{color:var(--pw-muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.personal-capability-effective-source strong{color:var(--pw-text)}.personal-capability-editor-status svg{flex:none;margin-top:1px}.personal-capability-editor-status strong{font-size:12px}.personal-capability-editor-status p{margin-top:3px}.personal-capability-editor-status.is-preview{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-capability-editor-status.is-read-only{color:#9a5a10;background:#fff5e8}.personal-capability-linked-setting{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:10px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;margin:0 24px 20px;padding:14px;display:grid}.personal-capability-linked-setting>div{gap:4px;display:grid}.personal-capability-linked-setting strong{font-size:12px}.personal-capability-linked-setting .personal-notification-toggle{justify-self:end;min-height:44px}.personal-capability-linked-setting .personal-notification-error{grid-column:1/-1}.personal-capability-behavior-note{border:1px solid var(--pw-line);background:var(--pw-amber-bg);color:var(--pw-amber);border-radius:6px;align-items:flex-start;gap:10px;margin:16px 24px;padding:12px;display:flex}.personal-capability-behavior-note svg{flex:none;margin-top:1px}.personal-capability-behavior-note strong{font-size:12px}.personal-capability-behavior-note p{color:inherit;margin-top:3px}.personal-capability-editor-mode{color:var(--pw-muted);justify-content:flex-end;align-items:center;gap:12px;margin:8px 24px 0;font-size:11px;display:flex}.personal-capability-editor-mode button{min-height:44px;color:var(--pw-muted);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-size:11px;font-weight:650;display:inline-flex}.personal-capability-editor-mode button:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-editor-mode button:disabled{cursor:not-allowed;opacity:.45}.personal-capability-field-summary{padding:20px 24px 24px}.personal-capability-field-summary .personal-capability-fields{margin-top:0}.personal-capability-fields{border:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0;padding:0;display:grid}.personal-report-schedule{grid-column:1/-1;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:12px;min-width:0;display:grid}.personal-report-schedule p{color:var(--pw-muted);overflow-wrap:anywhere;grid-column:1/-1;margin:0;font-size:12px}.personal-capability-fields label{align-content:start;gap:6px;min-width:0;display:grid}.personal-capability-fields label>span{font-size:12px;font-weight:650}.personal-capability-fields input:not([type=checkbox]),.personal-capability-fields select,.personal-capability-fields textarea{border:1px solid var(--pw-line-strong);width:100%;min-width:0;min-height:42px;color:var(--pw-text);font:inherit;background:#fff;border-radius:9px;padding:8px 11px;font-size:13px}.personal-capability-fields .is-boolean{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:48px;padding-bottom:12px}.personal-capability-enabled-row{border-bottom:1px solid var(--pw-line);grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;min-width:0;min-height:60px;padding-bottom:12px;display:grid}.personal-capability-enabled-row>.is-boolean{display:contents}.personal-capability-enabled-row>.is-boolean>span{grid-area:1/1}.personal-capability-enabled-row>.is-boolean>input{grid-area:1/3}.personal-capability-enabled-row>.personal-capability-edit-json{grid-area:1/2}.personal-capability-edit-json{min-height:44px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:6px;padding:0 8px;font-size:11px;display:inline-flex}.personal-capability-edit-json:hover{background:var(--pw-blue-soft);color:var(--pw-text)}.personal-capability-edit-json:disabled{cursor:not-allowed;opacity:.45}.personal-capability-fields .is-boolean input{appearance:none;border:1px solid var(--pw-line-strong);background:var(--pw-line);cursor:pointer;border-radius:999px;width:40px;height:24px;margin:0;padding:2px}.personal-capability-fields .is-boolean input:before{content:"";background:#fff;border-radius:50%;width:18px;height:18px;display:block}.personal-capability-fields .is-boolean input:checked{background:var(--pw-text)}.personal-capability-fields .is-boolean input:checked:before{transform:translate(16px)}.personal-capability-fields .is-boolean input:focus-visible{outline:2px solid var(--pw-blue);outline-offset:3px}.personal-capability-fields:disabled{opacity:.62}.personal-capability-json-editor{gap:7px;margin:0;padding:0 18px 18px;display:grid}.personal-capability-json-editor>span{font-size:11px;font-weight:650}.personal-capability-json-editor>small{color:var(--pw-muted);font-size:10.5px;line-height:1.5}.personal-capability-json-editor textarea{resize:vertical;border:1px solid var(--pw-line-strong);width:100%;min-width:0;color:var(--pw-text);tab-size:2;background:#fafafa;border-radius:9px;padding:12px 13px;font:12px/1.6 SFMono-Regular,Consolas,monospace}.personal-capability-json-editor textarea:focus-visible{outline:2px solid var(--pw-blue);outline-offset:2px}.personal-capability-preview{background:#f4f7ff;border:1px solid #9fb9f4;border-radius:10px;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:0 18px 16px;padding:12px;display:grid}.personal-capability-preview strong{font-size:12px}.personal-capability-preview span{color:var(--pw-blue-ink);font-size:11px;font-weight:700}.personal-capability-preview small{color:var(--pw-muted);grid-column:1/-1;font-size:10.5px}.personal-capability-actions,.personal-operator-credential-actions{border-top:1px solid var(--pw-line);background:0 0;justify-content:flex-end;gap:9px;padding:14px 18px;display:flex}.personal-capability-actions button,.personal-operator-credential-actions button{border:1px solid var(--pw-line-strong);min-height:44px;color:var(--pw-text);cursor:pointer;font:inherit;background:#fff;border-radius:9px;padding:0 14px;font-size:12px;font-weight:700}.personal-capability-actions button.is-primary,.personal-operator-credential-actions button.is-primary{border-color:var(--pw-blue);background:var(--pw-blue);color:#fff}.personal-capability-actions button.is-danger,.personal-operator-credential-actions button.is-danger{color:var(--pw-red);align-items:center;gap:6px;margin-right:auto;display:inline-flex}.personal-capability-actions button:disabled,.personal-operator-credential-actions button:disabled{cursor:not-allowed;opacity:.5}.personal-capability-empty,.personal-capability-error{border:1px solid var(--pw-line);max-width:720px;min-height:56px;color:var(--pw-muted);background:#fff;border-radius:11px;align-items:center;gap:9px;margin:0;padding:14px;font-size:12px;display:flex}.personal-capability-error{color:var(--pw-red);border-color:#efc1ba}.personal-capability-error span{gap:2px;display:grid}.personal-capability-error small{color:var(--pw-muted)}.personal-capability-error button{min-height:44px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:9px;align-items:center;gap:6px;margin-left:auto;padding:0 12px;display:inline-flex}.personal-capability-recovery{color:#74530d;background:#fffaf0;border:1px solid #dfc98d;border-radius:10px;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:9px;margin:0 20px 16px;padding:12px;font-size:11px;line-height:1.5;display:grid}.personal-capability-recovery div{gap:3px;display:grid}.personal-capability-recovery p{margin:0}.personal-capability-recovery small{color:var(--pw-muted);overflow-wrap:anywhere}.personal-capability-recovery button{min-height:40px;color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:8px;align-items:center;gap:6px;padding:0 10px;display:inline-flex}.personal-task-lane-filter>div{min-width:0;color:var(--pw-muted);align-items:center;gap:9px;display:flex}.personal-task-lane-filter>div>span{gap:1px;display:grid}.personal-task-lane-filter strong{color:var(--pw-text);font-size:12px}.personal-task-lane-filter small{color:var(--pw-faint);font-size:10.5px}.personal-task-lane-filter label{border:1px solid var(--pw-line-strong);background:var(--pw-bg);border-radius:8px;align-items:center;gap:6px;min-height:34px;padding:0 9px;display:flex}.personal-task-lane-filter select{max-width:300px;color:var(--pw-text);font:inherit;appearance:none;background:0 0;border:0;outline:0;font-size:11.5px;font-weight:600}.personal-task-board{flex-direction:column;gap:12px;height:100%;min-height:0;display:flex}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board.is-list-view){overflow-y:auto}.personal-task-board.is-list-view{gap:24px;height:auto;min-height:100%}.personal-task-view-toolbar{flex:none;justify-content:space-between;align-items:center;gap:16px;display:flex}.personal-task-view-toolbar>div:first-child{gap:4px;display:grid}.personal-task-view-toolbar strong{font-size:16px;font-weight:600}.personal-task-view-toolbar span{color:var(--pw-muted);font-size:12px}.personal-task-view-switch{border:1px solid var(--pw-line);background:var(--pw-bg);border-radius:8px;flex:none;padding:3px;display:flex}.personal-task-view-switch button{min-height:36px;color:var(--pw-muted);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:0 14px;font-size:13px}.personal-task-view-switch button[aria-pressed=true]{background:var(--pw-text);color:var(--pw-bg)}.personal-task-grouped-list{gap:24px;padding-bottom:24px;display:grid}.personal-completed-list{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px}.personal-completed-list>header{min-height:48px;color:var(--pw-text);padding:2px 16px}.personal-completed-list>header>button{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;min-height:44px;padding:0}.personal-completed-list .personal-task-lane-scroll{height:480px;max-height:60vh;overflow-y:auto}.personal-completed-list .personal-task-lane-scroll[hidden]{display:none}.personal-completed-list .personal-completed-row>button{border:0;border-bottom:1px solid var(--pw-line);text-align:left;background:0 0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;width:100%;height:100%;padding:16px;display:grid}.personal-completed-list .personal-completed-row>button>strong{-webkit-line-clamp:2}.personal-completed-list .personal-completed-row>button>small{grid-column:2}.personal-task-group{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:12px;min-width:0}.personal-task-group>summary{cursor:pointer;align-items:center;gap:8px;min-height:48px;padding:10px 16px;list-style:none;display:flex}.personal-task-group>summary::-webkit-details-marker{display:none}.personal-task-group>summary strong{font-size:12px;font-weight:600;line-height:18px}.personal-task-group>summary span{background:var(--pw-line);color:var(--pw-muted);border-radius:6px;padding:2px 7px;font-size:12px}.personal-task-group>summary svg{color:var(--pw-muted);transform:rotate(-90deg)}.personal-task-group[open]>summary svg{transform:none}.personal-task-group.tone-attention>summary{color:var(--pw-amber)}.personal-task-list-rows{padding:0 16px 8px}.personal-task-list-rows>button,.personal-task-list-rows>.personal-task-card>button{border:0;border-top:1px solid var(--pw-line);width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border-radius:0;grid-template-columns:20px minmax(0,1fr);gap:8px 12px;padding:16px 4px;display:grid}.personal-task-list-rows>button:hover,.personal-task-list-rows>.personal-task-card>button:hover{background:var(--pw-line)}.personal-task-list-rows>button>strong,.personal-task-list-rows>.personal-task-card>button>strong{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-list-rows>button>small,.personal-task-list-rows>.personal-task-card>button>small{color:var(--pw-muted);overflow-wrap:anywhere;flex-wrap:wrap;grid-column:2;align-items:center;gap:8px;font-size:12px;line-height:16px;display:flex}.personal-task-list-rows .personal-task-card-actions{background:var(--pw-card);top:auto;bottom:12px}@media (width>=721px){.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view){flex-wrap:wrap}.personal-channel-header:has(~.personal-channel-scroll[data-active-goal-view=tasks] .is-list-view) .personal-channel-title{flex-basis:100%}}.personal-task-kanban{flex:1;grid-template-columns:repeat(auto-fit,minmax(172px,1fr));align-items:stretch;gap:12px;min-height:0;display:grid}.personal-task-chat-receipt{background:#f8faff;border:1px solid #d8e2f8;border-radius:10px;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;display:grid;box-shadow:0 1px 3px #2f66e90a}.personal-task-chat-icon{background:var(--pw-blue-soft);width:28px;height:28px;color:var(--pw-blue-ink);border-radius:8px;place-items:center;display:grid}.personal-task-chat-receipt>div{min-width:0}.personal-task-chat-receipt header{align-items:center;gap:8px;display:flex}.personal-task-chat-receipt header strong{font-size:12px;font-weight:650}.personal-task-chat-receipt header small{color:var(--pw-faint);font-size:10px}.personal-task-chat-receipt .personal-task-reply-preview{min-width:0;overflow:hidden}.personal-task-chat-receipt .personal-task-reply-preview .personal-md{margin:0}.personal-task-chat-receipt .personal-task-reply-preview p{color:var(--pw-text);text-overflow:ellipsis;white-space:nowrap;margin:3px 0;font-size:12px;line-height:1.4;display:block;overflow:hidden}.personal-task-chat-receipt footer{gap:6px;display:flex}.personal-task-chat-receipt footer button{min-height:36px;color:var(--pw-blue-ink);cursor:pointer;white-space:nowrap;background:#fff;border:1px solid #b9c9ee;border-radius:7px;align-items:center;gap:4px;padding:6px 10px;font-size:10.5px;font-weight:650;display:inline-flex}.personal-task-chat-receipt footer button:hover{border-color:var(--pw-blue);background:var(--pw-blue-soft)}.personal-task-kanban .personal-object-list{background:#f6f4ee;flex-direction:column;min-height:0;padding:0;display:flex}.personal-task-kanban .personal-object-list>header{background:#f6f4ee;border-bottom:1px solid #e0ddd4b8;flex:none;align-items:center;gap:8px;min-height:38px;padding:10px 16px 7px;display:flex}.personal-task-kanban .personal-object-list>header>strong{align-items:center;gap:7px;min-width:0;font-size:12px;display:inline-flex}.personal-task-kanban .personal-object-list>header>span{margin-left:auto}.personal-task-lane-scroll{overscroll-behavior-y:contain;scrollbar-color:#bebbb2 transparent;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-direction:column;flex:auto;gap:8px;min-height:0;padding:8px;scroll-padding-block:8px;display:flex;overflow-y:auto}.personal-task-lane-scroll:focus-visible{outline:2px solid var(--pw-blue);outline-offset:-3px}.personal-task-lane-scroll.has-overflow-before{box-shadow:inset 0 12px 10px -13px #34312b94}.personal-task-lane-scroll.has-overflow-after{box-shadow:inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll.has-overflow-before.has-overflow-after{box-shadow:inset 0 12px 10px -13px #34312b94,inset 0 -16px 12px -15px #34312bb3}.personal-task-lane-scroll::-webkit-scrollbar{width:10px}.personal-task-lane-scroll::-webkit-scrollbar-track{background:0 0}.personal-task-lane-scroll::-webkit-scrollbar-thumb{background:#bebbb2 padding-box padding-box;border:3px solid #0000;border-radius:999px;min-height:40px}.personal-task-lane-scroll::-webkit-scrollbar-thumb:hover{background:#97938a padding-box padding-box}.personal-kanban-dot{background:var(--pw-faint);border-radius:50%;width:8px;height:8px}.personal-kanban-dot.tone-attention{background:var(--pw-amber)}.personal-kanban-dot.tone-progress{background:var(--pw-blue)}.personal-kanban-dot.tone-schedule{background:#8a6fd6}.personal-kanban-dot.tone-done{background:var(--pw-green)}.personal-task-kanban .personal-task-lane-scroll>button,.personal-task-kanban .personal-task-card>button{border:1px solid var(--pw-line);width:100%;min-height:0;color:inherit;text-align:left;cursor:pointer;background:#fff;border-radius:10px;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:6px 8px;padding:10px 12px;display:grid;box-shadow:0 1px 3px #1e1c140f}.personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-task-kanban .personal-task-card>button:hover{border-color:var(--pw-line-strong);background:#fff;box-shadow:0 2px 8px #1e1c1417}.personal-task-kanban .personal-task-lane-scroll>button>small,.personal-task-kanban .personal-task-card>button>small{white-space:normal;text-align:left;flex-wrap:wrap;grid-column:1/-1;justify-content:flex-start;align-items:center;gap:8px;display:inline-flex}.personal-task-kanban .personal-task-lane-scroll>button:last-child{border-bottom:1px solid var(--pw-line)}.personal-task-kanban .personal-task-lane-scroll>button:last-child:hover{border-color:var(--pw-line-strong)}.personal-task-lane-scroll>button,.personal-task-card{flex:none;min-width:0}.personal-task-lane-scroll>button>small,.personal-task-card>button>small{font-size:12px;line-height:16px}.personal-task-lane-scroll>button>strong,.personal-task-card>button>strong{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:14px;font-weight:500;line-height:20px;display:-webkit-box;overflow:hidden}.personal-task-card{position:relative}.personal-completed-window{flex-shrink:0;position:relative}.personal-completed-row{padding-bottom:8px;position:absolute;inset-inline:0}.personal-completed-row>button{width:100%;height:100%}.personal-completed-row>button>strong{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.personal-completed-footer{color:var(--pw-muted);text-align:center;flex-shrink:0;padding:12px 4px;font-size:12px}.personal-completed-footer button{border:1px solid var(--pw-line);min-height:32px;color:inherit;cursor:pointer;background:0 0;border-radius:6px}.personal-task-card>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:start;display:grid}.personal-task-card-actions{opacity:0;gap:4px;transition:opacity .12s;display:flex;position:absolute;top:6px;right:6px}.personal-task-card:hover .personal-task-card-actions,.personal-task-card:focus-within .personal-task-card-actions,.personal-task-card.has-session .personal-task-card-actions{opacity:1}.personal-task-card.is-selected>button,.personal-task-kanban .personal-task-lane-scroll>button.is-selected{background:#f5f8ff;border-color:#7c9df1;box-shadow:0 0 0 2px #2f66e91f,0 4px 14px #1e34681a}.personal-task-card.is-selected:before{z-index:2;background:var(--pw-blue);content:"";border-radius:0 3px 3px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.personal-task-card-actions button{border:1px solid var(--pw-line-strong);width:28px;height:28px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:7px;place-items:center;padding:0;display:grid;box-shadow:0 1px 3px #1e1c141f}.personal-task-card-actions button:hover{color:var(--pw-text);border-color:var(--pw-text)}.personal-task-card-actions button:disabled{cursor:wait;opacity:.72}.personal-task-card-actions .personal-task-session-link{width:auto;color:var(--pw-blue-ink);opacity:1;gap:5px;padding:0 8px;display:flex}.personal-task-session-link span{white-space:nowrap;font-size:10.5px;font-weight:650}.personal-task-session-status{color:var(--pw-blue-ink);font-weight:650}.personal-task-kanban .personal-task-empty{border:1px dashed var(--pw-line-strong);text-align:center;border-radius:10px;margin:2px 0 4px;padding:16px 10px;font-size:12px}.personal-workspace-shell.has-drawer .personal-task-kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-workspace-shell.has-task-inspector .personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-kanban){padding-inline:20px}.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:repeat(4,260px);width:max-content;min-width:100%}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-chat-receipt footer button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%);padding:10px max(26px,50% - 410px) 20px}.personal-read-only-notice{border:1px solid var(--pw-line);min-height:46px;color:var(--pw-muted);background:#f5f4f1;border-radius:12px;justify-content:center;align-items:center;gap:8px;padding:10px 16px;font-size:11.5px;display:flex}.personal-read-only-notice strong{color:var(--pw-text);white-space:nowrap}.personal-manager-conversation-tray{width:100%;max-height:320px;color:inherit;font:inherit;text-align:left;background:#fffffff7;border:1px solid #bfcdf1;border-radius:14px;gap:9px;margin-bottom:10px;padding:12px 14px;animation:.16s cubic-bezier(.16,1,.3,1) pw-tray-in;display:grid;overflow:hidden;box-shadow:0 5px 20px #223e781a}@keyframes pw-tray-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.personal-manager-conversation-tray:hover{border-color:#8fa9ee;box-shadow:0 7px 24px #223e7824}.personal-manager-conversation-tray:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 5px 20px #223e781a}.personal-manager-conversation-tray>header{justify-content:space-between;align-items:center;gap:12px;display:flex}.personal-manager-conversation-tray>header>span{color:var(--pw-blue-ink);align-items:center;gap:7px;display:flex}.personal-manager-conversation-tray>header strong{font-size:16px;font-weight:600;line-height:24px}.personal-manager-conversation-tray>header small{color:var(--pw-faint);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-actions{align-items:center;gap:8px;display:flex}.personal-manager-conversation-btn{min-height:32px;color:var(--pw-blue-ink);cursor:pointer;background:#f4f7fe;border:1px solid #b9c9ee;border-radius:8px;align-items:center;gap:5px;padding:5px 10px;font-size:12px;font-weight:600;line-height:16px;transition:all .12s;display:inline-flex}.personal-manager-conversation-btn:hover{background:var(--pw-blue-soft);border-color:var(--pw-blue)}.personal-manager-conversation-link{min-height:32px;color:var(--pw-blue);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:5px 8px;font-size:14px;font-weight:500;line-height:20px;transition:background .12s;display:inline-flex}.personal-manager-conversation-link:hover{background:var(--pw-blue-soft)}.personal-manager-conversation-close{width:32px;height:32px;color:var(--pw-faint);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:all .12s;display:inline-flex}.personal-manager-conversation-close:hover{color:#ef4444;background:#fee2e2}.personal-manager-conversation-messages{gap:7px;max-height:220px;display:grid;overflow-y:auto}.personal-manager-conversation-messages article{background:#f5f7fc;border-radius:10px;grid-template-columns:86px minmax(0,1fr);gap:10px;padding:10px 12px;font-size:14px;line-height:20px;display:grid}.personal-manager-conversation-messages article.is-user{background:#edf3ff}.personal-manager-conversation-messages article strong{color:var(--pw-muted);font-size:12px;font-weight:500;line-height:16px}.personal-manager-conversation-bubble{min-width:0}.personal-manager-conversation-bubble p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.personal-manager-conversation-bubble .personal-md{font-size:14px;line-height:20px}.personal-manager-conversation-bubble small{color:var(--pw-blue);margin-top:4px;font-size:12px;line-height:16px;display:inline-block}.personal-quick-prompts{flex-wrap:wrap;gap:8px;margin-bottom:9px;display:flex}.personal-quick-prompts button{border:1px solid var(--pw-line-strong);min-height:32px;color:var(--pw-muted);cursor:pointer;background:#fff;border-radius:99px;align-items:center;gap:6px;padding:5px 12px;font-size:12.5px;transition:all .14s;display:inline-flex}.personal-quick-prompts button:hover{border-color:var(--pw-blue);color:var(--pw-blue-ink)}.personal-quick-prompts button:disabled{opacity:.45;cursor:default}.personal-goal-draft-status{color:var(--pw-muted);background:#f5f7ff;border:1px solid #cfd9f5;border-radius:10px;align-items:center;gap:8px;margin-bottom:9px;padding:8px 11px;font-size:11px;display:flex}.personal-goal-draft-status strong{color:var(--pw-text)}.personal-channel-composer{border:1px solid var(--pw-line-strong);background:#fff;border-radius:16px;grid-template-columns:36px minmax(0,1fr) 40px;align-items:center;min-height:56px;padding:7px 7px 7px 14px;transition:border-color .15s,box-shadow .15s;display:grid;box-shadow:0 2px 10px #1e1c1412}.personal-channel-composer:focus-within{border-color:var(--pw-blue);box-shadow:0 0 0 3px #2f66e921,0 2px 10px #1e1c1412}.personal-channel-composer textarea{resize:none;border:0;border-left:1px solid var(--pw-line);width:100%;max-height:120px;color:inherit;font:inherit;background:0 0;outline:0;padding:9px 12px;line-height:1.4}.personal-channel-composer>button,.personal-correction-composer button{background:var(--pw-blue);color:#fff;cursor:pointer;border:0;border-radius:12px;place-items:center;width:40px;height:40px;display:grid;box-shadow:0 2px 6px #2f66e952}.personal-channel-composer>button:hover{background:var(--pw-blue-ink)}.personal-channel-composer>button:disabled,.personal-correction-composer button:disabled{opacity:.4;cursor:default;box-shadow:none}.personal-channel-composer>.personal-composer-attach{width:34px;height:34px;color:var(--pw-muted);box-shadow:none;background:0 0;border-radius:9px}.personal-channel-composer>.personal-composer-attach:hover{background:var(--pw-blue-soft);color:var(--pw-blue-ink)}.personal-composer-images{gap:8px;margin:0 0 8px;display:flex;overflow-x:auto}.personal-composer-images figure{flex:0 0 74px;height:58px;margin:0;position:relative}.personal-composer-images img{object-fit:cover;border:1px solid var(--pw-line-strong);background:#fff;border-radius:10px;width:100%;height:100%}.personal-composer-images button{border:1px solid var(--pw-line-strong);width:20px;height:20px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-5px;right:-5px;box-shadow:0 1px 4px #1e1c142e}.personal-composer-error{color:var(--pw-red);margin:0 0 7px;font-size:11.5px}.personal-context-drawer{grid-template-rows:auto minmax(0,1fr);height:100vh;display:grid}.personal-drawer-header{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:flex-start;min-height:84px;padding:20px 18px 16px;display:flex}.personal-drawer-header h2{letter-spacing:-.01em;margin:0;font-size:15.5px;font-weight:700}.personal-drawer-header p{color:var(--pw-faint);letter-spacing:.07em;text-transform:uppercase;margin:4px 0 0;font-size:11px;font-weight:650}.personal-drawer-close{flex:0 0 44px;width:44px;height:44px;margin-top:2px}.personal-drawer-body{padding:18px;overflow:auto}.personal-context-drawer[data-context-kind=todo]{background:#fbfbfc}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header{background:#fff;min-height:68px;padding:11px 22px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header h2{font-size:14px}.personal-context-drawer[data-context-kind=todo] .personal-drawer-header p{text-overflow:ellipsis;white-space:nowrap;max-width:330px;overflow:hidden}.personal-drawer-header-actions{align-items:center;gap:6px;display:flex}.personal-drawer-header-actions .personal-icon-button{flex:none}.personal-context-drawer[data-context-kind=todo] .personal-drawer-body{padding:0}.personal-task-inspector-summary{border-bottom:1px solid var(--pw-line);background:#fff;padding:24px 24px 20px}.personal-task-inspector-summary h3{letter-spacing:-.015em;overflow-wrap:anywhere;margin:14px 0 0;font-size:18px;font-weight:680;line-height:1.55}.personal-task-inspector-status{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.personal-task-inspector-status>span{color:#62697a;background:#f1f2f5;border-radius:6px;align-items:center;gap:6px;min-height:24px;padding:2px 8px;font-size:11px;font-weight:650;display:inline-flex}.personal-task-inspector-status>span:first-child{padding-left:7px}.personal-task-inspector-status i{background:var(--pw-blue);border-radius:50%;width:7px;height:7px}.personal-task-inspector-status .is-done{background:var(--pw-green-bg);color:var(--pw-green)}.personal-task-inspector-status .is-done i{background:var(--pw-green)}.personal-task-inspector-status .is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-task-inspector-status .is-blocked i{background:var(--pw-red)}.personal-task-inspector-fields{background:#fff;padding:20px 24px 22px}.personal-task-inspector-fields h4{color:var(--pw-text);margin:0 0 9px;font-size:12px;font-weight:700}.personal-task-inspector-fields dl{border-top:1px solid var(--pw-line);margin:0}.personal-task-inspector-fields dl div{border-bottom:1px solid var(--pw-line);grid-template-columns:92px minmax(0,1fr);gap:14px;min-height:44px;padding:11px 0;font-size:12px;line-height:1.55;display:grid}.personal-task-inspector-fields dt{color:var(--pw-muted)}.personal-task-inspector-fields dd{color:var(--pw-text);overflow-wrap:anywhere;margin:0}.personal-task-inspector-actions{border-top:1px solid var(--pw-line-strong);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fffffff5;grid-template-columns:auto minmax(170px,1fr);gap:10px;padding:13px 18px;display:grid;position:sticky;bottom:0;box-shadow:0 -8px 26px #1e284012}.personal-task-inspector-actions>.personal-primary-action{min-height:40px;margin:0}.personal-task-management{position:relative}.personal-task-management>summary{border:1px solid var(--pw-line-strong);min-width:128px;min-height:40px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:9px;justify-content:center;align-items:center;gap:7px;padding:0 14px;font-size:12px;font-weight:650;list-style:none;display:flex}.personal-task-management>summary::-webkit-details-marker{display:none}.personal-task-management[open]>summary{color:var(--pw-blue-ink);border-color:#9db3e9}.personal-task-management>div{border:1px solid var(--pw-line-strong);background:#fff;border-radius:12px;gap:9px;width:390px;padding:14px;display:grid;position:absolute;bottom:calc(100% + 9px);left:0;box-shadow:0 16px 38px #1e284029}.personal-task-management>div>strong{color:var(--pw-muted);font-size:10.5px;font-weight:650}.personal-task-management-secondary{border-top:1px solid var(--pw-line);grid-template-columns:1fr 1fr;gap:7px;padding-top:4px;display:grid}.personal-task-management-secondary button{border:1px solid var(--pw-line-strong);min-height:34px;color:var(--pw-text);cursor:pointer;background:#fff;border-radius:8px;font-size:11.5px}.personal-task-management-secondary button:hover{background:#f6f7fa}.personal-task-completed-note{background:var(--pw-green-bg);color:var(--pw-green);border:1px solid #cde4d8;border-radius:10px;align-items:center;gap:10px;margin:12px 24px 24px;padding:12px 14px;display:flex}.personal-task-completed-note>span{gap:2px;display:grid}.personal-task-completed-note strong{font-size:12px}.personal-task-completed-note small{color:#5d786c;font-size:10.5px}.personal-detail-card,.personal-correction-panel{border:1px solid var(--pw-line);background:#fff;border-radius:14px;padding:15px}.personal-proposal-card{background:#f5f8ff;border:1px solid #c3d3f9;border-radius:14px;padding:16px}.personal-proposal-card>small{color:#5270bd;letter-spacing:.05em;font-size:11px;font-weight:650}.personal-proposal-card h3{margin:8px 0;font-size:15.5px}.personal-proposal-card p{color:#5f6570;font-size:12px;line-height:1.55}.personal-proposal-card dl{gap:8px;margin:14px 0 0;display:grid}.personal-proposal-card dl div{grid-template-columns:82px minmax(0,1fr);gap:10px;font-size:11.5px;display:grid}.personal-proposal-card dt{color:var(--pw-faint)}.personal-proposal-card dd{overflow-wrap:anywhere;margin:0}.personal-context-drawer .personal-team-plan-result{border-color:var(--pw-line);background:var(--pw-card)}.personal-context-drawer .personal-team-plan-result h3{margin:0;font-size:18px;font-weight:600}.personal-context-drawer .personal-team-plan-result>p{color:var(--pw-muted);margin:16px 0 0;font-weight:400}.personal-team-plan-result .personal-team-plan-assignments{gap:16px;margin:20px 0}.personal-team-plan-result .personal-team-plan-assignments>div{grid-template-columns:minmax(0,1fr);gap:4px;font-size:13px}.personal-team-plan-result .personal-team-plan-assignments dt{color:var(--pw-muted);font-size:12px}.personal-team-plan-result .is-pending dd{color:var(--pw-muted)}.personal-team-plan-result details{border-top:1px solid var(--pw-line);margin-top:16px;padding-top:12px}.personal-team-plan-result summary{cursor:pointer;color:var(--pw-muted);font-size:12px}.personal-proposal-state{border-radius:9px;align-items:center;gap:7px;margin:10px 0 0;padding:10px 12px;font-size:11px;display:flex}.personal-proposal-state.is-applied{background:var(--pw-green-bg);color:var(--pw-green)}.personal-proposal-state.is-stale,.personal-proposal-state.is-error{background:var(--pw-red-bg);color:var(--pw-red)}.personal-proposal-state.is-gated{color:#825a00;background:#fff6df;gap:6px;display:grid}.personal-proposal-state.is-gated>span{gap:3px;display:grid}.personal-proposal-state.is-gated small{line-height:1.5}.personal-workspace-candidates{gap:8px;margin-top:10px;display:grid}.personal-workspace-candidates button{color:#263e76;cursor:pointer;text-align:left;background:#fff;border:1px solid #c3d3f9;border-radius:10px;gap:3px;min-height:48px;padding:9px 12px;display:grid}.personal-workspace-candidates small{color:var(--pw-muted)}.personal-detail-card.is-attention{background:#fffdf7;border-color:#f1d8ac}.personal-detail-card small{color:var(--pw-muted);font-size:11px}.personal-detail-card h3{margin:7px 0;font-size:14.5px;line-height:1.5}.personal-detail-card p,.personal-correction-panel p{color:var(--pw-muted);font-size:12px;line-height:1.55}.personal-detail-card dl{gap:9px;margin:14px 0 0;display:grid}.personal-detail-card dl div{grid-template-columns:74px minmax(0,1fr);gap:10px;font-size:12px;display:grid}.personal-detail-card dt{color:var(--pw-faint)}.personal-detail-card dd{overflow-wrap:anywhere;margin:0}.personal-run-drawer-tabs{background:#efefec;border-radius:11px;grid-template-columns:1fr 1fr;gap:4px;padding:4px;display:grid}.personal-run-drawer-tabs button{min-height:36px;color:var(--pw-muted);cursor:pointer;background:0 0;border:0;border-radius:8px;padding:0 8px;font-size:12px;font-weight:650}.personal-run-drawer-tabs button[aria-selected=true]{color:var(--pw-text);background:#fff;box-shadow:0 1px 4px #1e1c141f}.personal-session-summary{margin-top:12px}.personal-session-message-record{margin-top:14px}.personal-session-message-record>h3{color:var(--pw-faint);letter-spacing:.06em;text-transform:uppercase;margin:0 0 10px;font-size:11px}.personal-session-message-record ol{gap:0;margin:0;padding:0;list-style:none;display:grid}.personal-session-message-record li{grid-template-columns:13px minmax(0,1fr);gap:9px;padding-bottom:15px;display:grid}.personal-session-message-record li>i,.personal-session-active-step>i{background:var(--pw-green);width:9px;height:9px;box-shadow:0 0 0 3px var(--pw-green-bg);border-radius:50%;margin-top:5px}.personal-session-message-record li.is-user>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft)}.personal-session-message-record li.is-error>i{background:var(--pw-red);box-shadow:0 0 0 3px var(--pw-red-bg)}.personal-session-message-record li>div{border-bottom:1px solid var(--pw-line);gap:5px;min-width:0;padding:0 0 15px;display:grid}.personal-session-message-record li header{justify-content:space-between;align-items:center;gap:8px;display:flex}.personal-session-message-record li strong{font-size:12px}.personal-session-message-record time{color:var(--pw-faint);font-size:10px}.personal-session-message-record li p{max-height:180px;color:var(--pw-muted);white-space:pre-wrap;margin:0;font-size:11.5px;line-height:1.6;overflow:auto}.personal-session-empty{border:1px dashed var(--pw-line-strong);color:var(--pw-muted);text-align:center;border-radius:10px;margin:0;padding:18px 12px;font-size:11.5px}.personal-session-active-step{grid-template-columns:13px minmax(0,1fr);align-items:start;gap:9px;padding-top:4px;display:grid}.personal-session-active-step>i{background:var(--pw-blue);box-shadow:0 0 0 3px var(--pw-blue-soft);animation:1.4s ease-in-out infinite personal-session-pulse}.personal-session-active-step>span{gap:3px;display:grid}.personal-session-active-step strong{font-size:12px}.personal-session-active-step small{color:var(--pw-muted);font-size:10.5px}@keyframes personal-session-pulse{50%{opacity:.35}}.personal-todo-actions{grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;display:grid}.personal-todo-actions>button{margin-top:0}.personal-todo-actions-title{color:var(--pw-faint);letter-spacing:.06em;grid-column:1/-1;font-size:11px;font-weight:650}.personal-todo-actions .personal-primary-action,.personal-todo-actions .personal-compact-menu{grid-column:1/-1;margin-top:0}.personal-inline-agent-select{border:1px solid var(--pw-line);color:var(--pw-muted);border-radius:10px;grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;font-size:11px;display:grid}.personal-inline-agent-select select{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-agent-select .personal-secondary-action{width:auto;min-height:36px;margin:0;padding:0 12px}.personal-inline-resume-when input{border:1px solid var(--pw-line-strong);color:#333;background:#fff;border-radius:8px;min-width:0;min-height:36px;padding:0 8px}.personal-inline-resume-when small{color:var(--pw-faint);grid-column:2/-1}.personal-primary-action,.personal-secondary-action,.personal-danger-action{cursor:pointer;border-radius:11px;justify-content:center;align-items:center;gap:8px;width:100%;min-height:42px;margin-top:12px;font-size:13.5px;font-weight:650;display:flex}.personal-primary-action{border:1px solid var(--pw-blue);background:var(--pw-blue);color:#fff;box-shadow:0 2px 6px #2f66e947}.personal-primary-action:hover{background:var(--pw-blue-ink)}.personal-secondary-action{border:1px solid var(--pw-line-strong);color:var(--pw-text);background:#fff}.personal-secondary-action:hover{border-color:var(--pw-faint)}.personal-danger-action{color:var(--pw-red);background:#fff;border:1px solid #efd2cd}.personal-danger-action:hover{background:var(--pw-red-bg)}.personal-primary-action:disabled,.personal-secondary-action:disabled,.personal-danger-action:disabled{opacity:.46;cursor:default;box-shadow:none}.personal-drawer-action-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.personal-correction-panel{margin-top:12px}.personal-correction-panel header{justify-content:space-between;align-items:center;display:flex}.personal-correction-panel header span{align-items:center;gap:7px;font-size:12px;font-weight:700;display:flex}.personal-correction-panel header button{color:var(--pw-muted);cursor:pointer;background:0 0;border:0}.personal-correction-composer{border:1px solid var(--pw-line-strong);border-radius:12px;position:relative;overflow:hidden}.personal-correction-composer:focus-within{border-color:var(--pw-blue)}.personal-correction-composer textarea{resize:vertical;width:100%;min-height:84px;font:inherit;border:0;outline:0;padding:10px 56px 10px 12px;font-size:12.5px}.personal-correction-composer button{border-radius:10px;width:34px;height:34px;position:absolute;bottom:6px;right:6px}.personal-recovery-panel{background:#fffaf0;border:1px solid #eccf94;border-radius:12px;margin-top:12px;padding:14px}.personal-recovery-panel>strong{font-size:13px}.personal-recovery-panel>p,.personal-preview-unavailable{color:var(--pw-muted);font-size:12px;line-height:1.5}.personal-compact-menu{margin-top:12px;position:relative}.personal-compact-menu>summary{border:1px solid var(--pw-line-strong);cursor:pointer;background:#fff;border-radius:11px;justify-content:center;align-items:center;gap:8px;min-height:42px;padding:0 12px;font-size:12.5px;font-weight:650;list-style:none;display:flex}.personal-compact-menu>summary::-webkit-details-marker{display:none}.personal-compact-menu[open]>summary{border-color:var(--pw-faint)}.personal-compact-menu>div{border:1px solid var(--pw-line);background:#fff;border-radius:11px;margin-top:6px;padding:6px;display:grid;box-shadow:0 8px 24px #1e1c141a}.personal-compact-menu>div button{min-height:40px;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:0 10px;display:flex}.personal-compact-menu>div button:hover{background:#f5f4f1}.personal-compact-menu>div button:disabled{color:var(--pw-faint);cursor:default;opacity:.55}.personal-safe-preview{border:1px solid var(--pw-line);color:#333943;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f6f3;border-radius:11px;max-height:280px;margin:12px 0 0;padding:14px;font:12px/1.6 Geist Mono,SFMono-Regular,Consolas,monospace;overflow:auto}.personal-report-detail{border:1px solid var(--pw-line);background:#fff;border-radius:14px;margin-top:12px;padding:14px}.personal-report-detail>header{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.personal-report-detail>header span{background:var(--pw-blue-soft);color:var(--pw-blue-ink);border-radius:10px;flex-direction:column;gap:2px;padding:10px;font-size:10px;font-weight:650;display:flex}.personal-report-detail>header strong{font-size:18px}.personal-report-detail>p{color:var(--pw-muted);margin:10px 0;font-size:11px}.personal-report-detail ol{gap:8px;margin:0;padding:0;list-style:none;display:grid}.personal-report-detail li{border:1px solid var(--pw-line);border-radius:10px;gap:4px;padding:10px;display:grid}.personal-report-detail li[data-change-kind=changed]{background:#fffaf0;border-color:#e8d3a5}.personal-report-detail li small{color:var(--pw-muted);text-transform:uppercase;font-size:10px}.personal-report-detail li strong{font-size:12px;line-height:1.45}.personal-report-detail li p{color:var(--pw-muted);margin:0;font-size:11px;line-height:1.5}.personal-report-detail>footer{color:var(--pw-faint);overflow-wrap:anywhere;gap:4px;margin-top:10px;font:10px/1.5 Geist Mono,SFMono-Regular,Consolas,monospace;display:grid}.personal-execution-history{margin-top:18px}.personal-execution-history h3{letter-spacing:.07em;text-transform:uppercase;color:var(--pw-faint);margin:0 0 10px;font-size:11.5px;font-weight:650}.personal-execution-history>p{color:var(--pw-muted);font-size:12px}.personal-execution-history ol{border-top:1px solid var(--pw-line);margin:0;padding:0;list-style:none}.personal-execution-history li{border-bottom:1px solid var(--pw-line);justify-content:space-between;align-items:center;gap:12px;min-height:50px;display:flex}.personal-execution-history li>span{gap:3px;display:grid}.personal-execution-history li strong{font-size:12px}.personal-execution-history li small{color:var(--pw-muted);font-size:10px}.personal-execution-history li em{color:var(--pw-muted);font-size:10px;font-style:normal}.personal-execution-history li em.is-completed{color:var(--pw-green)}.personal-execution-history li em.is-failed{color:var(--pw-red)}.personal-mobile-back{display:none}.personal-message:not(.is-user)>div{border:1px solid var(--pw-line);background:var(--pw-card);border-radius:4px 16px 16px;flex:1;min-width:0;padding:10px 14px}.personal-md{gap:8px;margin-top:5px;font-size:13.5px;line-height:1.7;display:grid}.personal-md p{white-space:normal;overflow-wrap:anywhere;margin:0}.personal-md-heading{letter-spacing:-.01em;font-weight:700}.personal-md-heading.is-h1{font-size:15.5px}.personal-md-heading.is-h2{font-size:14.5px}.personal-md-heading.is-h3,.personal-md-heading.is-h4{font-size:13.5px}.personal-md-list{gap:4px;margin:0;padding-left:20px;display:grid}.personal-md ul.personal-md-list{list-style-type:disc}.personal-md ol.personal-md-list{list-style-type:decimal}.personal-md-list li{overflow-wrap:anywhere;padding-left:2px}.personal-md-list li::marker{color:var(--pw-faint)}.personal-md-code{border:1px solid var(--pw-line);overflow-wrap:anywhere;background:#f5f4f1;border-radius:6px;padding:1px 5px;font:12px/1.5 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-pre{border:1px solid var(--pw-line);background:#f7f6f3;border-radius:11px;margin:0;padding:12px 14px;overflow-x:auto}.personal-md-pre code{color:#333943;white-space:pre;font:12px/1.65 SF Mono,ui-monospace,Menlo,Consolas,monospace}.personal-md-link{color:var(--pw-blue-ink);border-bottom:1px solid #c3d3f9;text-decoration:none}.personal-md-link:hover{border-bottom-color:var(--pw-blue-ink)}.personal-agent-persona-head{align-items:center;gap:12px;display:flex}.personal-agent-avatar{color:#fff;background:linear-gradient(135deg,#2f66e9,#6f9bff);border-radius:14px;flex:0 0 46px;place-items:center;height:46px;font-size:19px;font-weight:700;display:grid;box-shadow:0 2px 8px #2f66e942}.personal-agent-persona-id{flex:1;min-width:0}.personal-agent-persona-id h3{margin:0}.personal-agent-persona-id p{margin:2px 0 0}.personal-agent-health{border-radius:99px;flex:none;padding:2.5px 10px;font-size:11px;font-weight:650}.personal-agent-health.is-ok{background:var(--pw-green-bg);color:var(--pw-green)}.personal-agent-health.is-off,.personal-row-status.is-blocking{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-pending{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-row-status.is-failed{background:var(--pw-red-bg);color:var(--pw-red)}.personal-row-status.is-completed{background:var(--pw-green-bg);color:var(--pw-green)}.personal-row-status.is-queued,.personal-row-status.is-waiting,.personal-row-status.is-interrupted{color:var(--pw-muted);background:#f2f1ed}.personal-diagnostics-trigger{border:0;border-top:1px solid var(--pw-line);width:100%;color:var(--pw-muted);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;margin-top:18px;padding:12px 0;font-size:12.5px;display:flex}.personal-diagnostics-trigger svg{transition:transform .16s}.personal-diagnostics-trigger svg.is-open{transform:rotate(180deg)}.personal-diagnostics{color:var(--pw-muted);overflow-wrap:anywhere;background:#f5f4f1;border-radius:10px;gap:7px;padding:12px;font-size:10.5px;display:grid}.personal-copy-feedback{color:var(--pw-green);margin:7px 0 0;font-size:11px}.personal-copy-feedback.is-error{color:var(--pw-red)}@media (width<=1300px){.personal-workspace-shell.has-drawer .personal-channel-title p{max-width:260px}}@media (width<=1100px){.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{flex-wrap:wrap;align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}}@media (width<=1050px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:minmax(0,1fr)}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-sidebar-backdrop{z-index:35;cursor:default;background:#14182047;border:0;display:block;position:fixed;inset:0}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-workspace-drawer{z-index:30;width:min(410px,90vw);position:fixed;inset:0 0 0 auto}.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{z-index:30;width:min(520px,92vw);position:fixed;inset:0 0 0 auto;box-shadow:-18px 0 44px #1e284024}.personal-run-row{grid-template-columns:36px minmax(0,1fr) auto 16px}}@media (width<=720px){.personal-workspace-shell,.personal-workspace-shell.has-drawer{grid-template-columns:1fr}.personal-workspace-shell,.personal-workspace-main,.personal-channel{width:100%;max-width:100vw;overflow-x:hidden}.personal-workspace-sidebar{z-index:40;width:min(310px,86vw);display:none;position:fixed;inset:0 auto 0 0;box-shadow:18px 0 50px #1e1c1429}.personal-workspace-shell.mobile-sidebar-open .personal-workspace-sidebar{display:block}.personal-icon-button.personal-mobile-menu{flex:0 0 36px;display:inline-grid}.personal-channel-header{grid-template-columns:36px minmax(0,1fr) auto;gap:10px;min-height:60px;padding:10px 14px;display:grid}.personal-channel-title p{display:none}.personal-channel-title p.personal-manager-execution{display:flex}.personal-channel-actions{min-width:0}.personal-agent-select{min-width:0;max-width:132px}.personal-channel-actions>.personal-icon-button{display:none}.personal-goal-tabs{order:4;grid-column:1/-1;align-self:auto;margin-left:0;overflow-x:auto}.personal-channel-scroll,.personal-composer-wrap{padding-left:14px;padding-right:14px}.personal-channel-scroll[data-active-goal-view=tasks]:has(.personal-task-board){overflow-y:auto}.personal-task-board{height:auto;min-height:100%}.personal-task-kanban,.personal-workspace-shell.has-drawer .personal-task-kanban,.personal-workspace-shell.has-task-inspector .personal-task-kanban{grid-template-columns:minmax(0,1fr);width:100%;height:auto}.personal-task-kanban .personal-object-list{min-height:auto}.personal-task-lane-scroll,.personal-task-lane-scroll.has-overflow-before,.personal-task-lane-scroll.has-overflow-after{min-height:auto;box-shadow:none;scrollbar-gutter:auto;flex:none;padding-right:8px;overflow:visible}.personal-quick-prompts{flex-wrap:nowrap;overflow-x:auto}.personal-quick-prompts button{flex:none;min-height:36px}.personal-manager-conversation-tray>header{flex-wrap:wrap;align-items:flex-start}.personal-manager-conversation-actions{justify-content:flex-end;width:100%}.personal-manager-conversation-messages article{grid-template-columns:minmax(0,1fr);gap:4px}.personal-timeline-row,.personal-output-row{grid-template-columns:34px minmax(0,1fr) 14px;gap:9px;padding:10px 12px}.personal-timeline-row>time,.personal-timeline-row>.personal-row-status,.personal-timeline-row .personal-priority-dot{display:none}.personal-task-chat-receipt{grid-template-columns:32px minmax(0,1fr);padding:11px}.personal-task-lane-filter{flex-direction:column;align-items:stretch;gap:8px}.personal-task-lane-filter label,.personal-task-lane-filter select{width:100%;max-width:none}.personal-capability-layout,.personal-capability-value-grid,.personal-capability-fields,.personal-capability-linked-setting{grid-template-columns:minmax(0,1fr)}.personal-capability-linked-setting .personal-notification-toggle{justify-self:start}.personal-capability-layout{grid-template-rows:auto minmax(0,1fr)}.personal-capability-list{min-width:0;max-height:90px;padding:3px;display:flex;overflow-x:auto}.personal-capability-list button{flex:0 0 180px}.personal-task-chat-icon{width:32px;height:32px}.personal-task-chat-receipt footer{flex-wrap:wrap;grid-column:1/-1;justify-content:flex-end}.personal-task-chat-receipt footer button{min-height:44px}.personal-composer-wrap{max-width:100vw}.personal-workspace-drawer,.personal-workspace-drawer[data-drawer-mode=inspector],.personal-workspace-drawer[data-drawer-mode=inspector-full]{width:100vw}.personal-inspector-size{display:none!important}.personal-context-drawer{height:100dvh}.personal-drawer-body{padding-bottom:max(18px, env(safe-area-inset-bottom))}.personal-composer-wrap{padding-bottom:max(16px, env(safe-area-inset-bottom))}.personal-mobile-back{display:block}.personal-desktop-close{display:none}.personal-goal-tabs button{min-height:34px}.personal-correction-composer{padding-bottom:2px}.personal-correction-composer textarea{min-height:84px;padding-right:56px;padding-bottom:max(14px, env(safe-area-inset-bottom))}.personal-correction-composer button{width:40px;height:40px}.personal-todo-actions{grid-template-columns:1fr}.personal-task-management>div{width:calc(100vw - 28px)}.personal-home-lanes{grid-template-columns:1fr}.personal-home-lane{min-height:0}.personal-session-record,.personal-session-record dl{grid-template-columns:1fr}.personal-session-record>.personal-secondary-action{grid-area:auto/1}.personal-settings-page{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.personal-settings-sidebar{border-right:0;border-bottom:1px solid var(--pw-line);gap:10px;height:auto;max-height:30dvh;padding:12px 14px;position:static;overflow:auto}.personal-settings-title{display:none}.personal-settings-tabs{display:flex;overflow-x:auto}.personal-settings-tabs button{flex:0 0 180px}.personal-settings-body{padding:20px 14px}.personal-settings-header{align-items:center;gap:14px}.personal-settings-header h1{font-size:24px}.personal-machine-layout{grid-template-columns:1fr;gap:14px}.personal-machine-namespaces nav{overscroll-behavior-x:contain;scroll-snap-type:x proximity;display:flex;overflow-x:auto}.personal-machine-namespaces button{scroll-snap-align:start;flex:0 0 180px}.personal-machine-summary{align-items:flex-start}.personal-machine-editor-bar{flex-direction:column;align-items:stretch}.personal-machine-editor-mode{width:100%}.personal-machine-editor-mode button{flex:1 1 0}.personal-machine-summary dl{flex-direction:column;gap:8px}.personal-machine-editor fieldset{grid-template-columns:1fr}.personal-machine-editor fieldset label:last-child{grid-column:auto}.personal-machine-preview dl{grid-template-columns:1fr}.personal-machine-rollback{flex-direction:column;align-items:stretch}.personal-machine-rollback .personal-secondary-action{width:100%}.personal-lark-settings.is-embedded .personal-lark-tabs{overflow-x:auto}.personal-lark-settings.is-embedded .personal-lark-tabs button{flex:none}}@media (prefers-reduced-motion:reduce){.personal-timeline-row,.personal-diagnostics-trigger svg,.personal-workspace-sidebar,.personal-stopped-goals>summary>svg:first-child,.personal-subagent-switch>span,.personal-subagent-switch>span:after{transition:none}.personal-goal-lifecycle.is-pending svg,.personal-spin{animation:none}}.personal-workspace-shell[data-pw-theme=loopx],.personal-settings-page[data-pw-theme=loopx]{--pw-bg:#fafafa;--pw-card:#fff;--pw-line:#ebebeb;--pw-line-strong:#dedede;--pw-muted:#6b6b6b;--pw-faint:#8f8f8f;--pw-text:#171717;--pw-blue:#0070f3;--pw-blue-ink:#0060d1;--pw-blue-soft:#edf6ff;--pw-amber:#9a6200;--pw-amber-bg:#fff7df;--pw-red:#d90000;--pw-red-bg:#fff0f0;--pw-green:#197342;--pw-green-bg:#edf9f1;font-family:Geist Variable,Geist,Inter,Helvetica Neue,Arial,PingFang SC,Microsoft YaHei,sans-serif}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-sidebar,.personal-settings-page[data-pw-theme=loopx] .personal-settings-sidebar{background:#fff}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-header{box-shadow:none;background:#fafafaf0}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-title h1{letter-spacing:0;font-size:20px;font-weight:600;line-height:28px}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-section-title{letter-spacing:0;font-size:12px;font-weight:500;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>header span,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>strong{font-size:14px;font-weight:600;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link-copy small,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card>p{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-select-option{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-workspace-drawer{box-shadow:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-brand-mark{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-icon{color:#171717;background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-greeting>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-utility:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-link[aria-current=page],.personal-settings-page[data-pw-theme=loopx] .personal-settings-tabs button[aria-current=page]{box-shadow:none;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes{background:#f2f2f2;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button{border-radius:4px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page],.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-modes button[aria-selected=true]{box-shadow:0 1px 2px #0000000f}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs{background:0 0;border-radius:0;align-self:stretch;gap:20px;padding:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button{border-radius:0;min-height:46px;padding:0 1px;font-size:12px;font-weight:500;position:relative}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]{box-shadow:none;color:#171717;background:0 0}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-tabs button[aria-current=page]:after{content:"";background:#171717;height:2px;position:absolute;bottom:-1px;left:0;right:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-sidebar-count{color:#4d4d4d;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-state-dot,.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-row:nth-child(n) .personal-goal-state-dot{background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=loopx] .personal-read-only-source,.personal-workspace-shell[data-pw-theme=loopx] .personal-icon-button,.personal-workspace-shell[data-pw-theme=loopx] .personal-status-source-select .personal-select-trigger,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-secondary-action{border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-detail-card,.personal-settings-page[data-pw-theme=loopx] .personal-settings-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-app-card,.personal-settings-page[data-pw-theme=loopx] .personal-lark-table,.personal-settings-page[data-pw-theme=loopx] .personal-lark-topic-panel{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lanes{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;min-height:0;padding:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card{box-shadow:none;border-radius:12px;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-goal-card:hover{box-shadow:none;border-color:#a1a1a1;transform:none}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-timeline{gap:8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-row:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-schedule-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-row-icon{color:#4d4d4d;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message.is-user{background:#f2f2f2;border-color:#dedede;border-radius:12px 12px 4px;padding:10px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message-avatar{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message:not(.is-user)>div{box-shadow:none;border-radius:4px 12px 12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-message p,.personal-workspace-shell[data-pw-theme=loopx] .personal-md{font-size:13px;line-height:1.65}.personal-workspace-shell[data-pw-theme=loopx] .personal-timeline-empty>span{color:#171717;background:#fff;border:1px solid #ebebeb;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>span:first-child{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row small,.personal-workspace-shell[data-pw-theme=loopx] .personal-proposal-row>b{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record{background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record>header span{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-session-record dl div{background:#fafafa;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt{box-shadow:none;background:#fff;border-color:#dedede;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-icon{color:#171717;background:#f2f2f2;border:1px solid #ebebeb;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button{color:#171717;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-chat-receipt footer button:hover{background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban{border-block:1px solid #ebebeb;gap:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border:0;background:0 0;border-left:1px solid #ebebeb;border-radius:0;gap:8px;padding:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header{padding:4px 2px 8px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>header>strong{font-size:12px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-lane-scroll>button>strong,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>strong{overflow-wrap:anywhere;font-size:14px;font-weight:500;line-height:20px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button>small,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button>small{color:#6b6b6b;font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-card>button:hover{box-shadow:none;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list>button.is-selected{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card.is-selected:before{background:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions button{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-card-actions .personal-task-session-link,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-session-status{color:#4d4d4d}.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-task-empty{border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list{box-shadow:none;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>header{letter-spacing:0;min-height:44px;padding:8px 14px;font-weight:500}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button{min-height:58px;padding:10px 14px}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button:hover{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-file-icon{color:#4d4d4d;background:#fafafa;border:1px solid #ebebeb;border-radius:6px;place-items:center;width:28px;height:28px;display:grid}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>strong{font-size:13px;font-weight:600}.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>p,.personal-workspace-shell[data-pw-theme=loopx] .personal-files-list>button>small{font-size:12px;line-height:16px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action{box-shadow:none;background:#171717;border-color:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-primary-action:hover,.personal-settings-page[data-pw-theme=loopx] .personal-primary-action:hover{background:#333;border-color:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-code,.personal-workspace-shell[data-pw-theme=loopx] .personal-safe-preview,.personal-workspace-shell[data-pw-theme=loopx] .personal-diagnostics{background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-md-pre{color:#fafafa;background:#171717;border:1px solid #242424}.personal-workspace-shell[data-pw-theme=loopx] .personal-digest-card{background:#fff;border-radius:12px}.personal-workspace-shell[data-pw-theme=loopx] .personal-action-feedback{color:#171717;background:#f2f2f2}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button{color:#171717;box-shadow:none;background:#fff;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-quick-prompts button:hover{color:#171717;box-shadow:none;background:#f2f2f2;border-color:#a1a1a1}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status{color:#6b6b6b;background:#f2f2f2;border-color:#dedede;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-goal-draft-status strong{color:#171717}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer{box-shadow:none;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer:focus-within{border-color:#0070f3;box-shadow:0 0 0 2px #0070f31f}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button{box-shadow:none;background:#171717;border-radius:6px}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>button:hover,.personal-workspace-shell[data-pw-theme=loopx] .personal-correction-composer button:hover{background:#333}.personal-workspace-shell[data-pw-theme=loopx] .personal-channel-composer>.personal-composer-attach{color:#6b6b6b;background:0 0}.personal-settings-theme-swatch.is-loopx{background:linear-gradient(135deg,#171717 0 48%,#fafafa 48% 78%,#fff 78%)}.personal-settings-page[data-pw-theme=loopx] .personal-settings-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-header small,.personal-settings-page[data-pw-theme=loopx] .personal-lark-section-heading small{color:#0070f3;font-family:Geist Mono Variable,Geist Mono,JetBrains Mono,SFMono-Regular,monospace;font-weight:500}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button{box-shadow:none;border-radius:12px}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button:hover{box-shadow:none;border-color:#c8c8c8}.personal-settings-page[data-pw-theme=loopx] .personal-settings-choice-group button[aria-checked=true]{background:#fff;border-color:#171717;box-shadow:0 0 0 1px #171717}@media (width<=720px){.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list{border-top:1px solid #ebebeb;border-left:0}.personal-workspace-shell[data-pw-theme=loopx] .personal-home-lane:first-child,.personal-workspace-shell[data-pw-theme=loopx] .personal-task-kanban .personal-object-list:first-child{border-top:0}}.personal-workspace-shell[data-pw-theme=brutal],.personal-settings-page[data-pw-theme=brutal]{--pw-bg:#fdf8e7;--pw-card:#fff;--pw-line:#141414;--pw-line-strong:#141414;--pw-muted:#3f3f3f;--pw-faint:#666;--pw-text:#141414;--pw-blue:#141414;--pw-blue-ink:#141414;--pw-blue-soft:#ffe23f;--pw-amber:#141414;--pw-amber-bg:#ffd23f;--pw-red:#141414;--pw-red-bg:#ff9d8a;--pw-green:#141414;--pw-green-bg:#8fe6a4}.personal-workspace-shell[data-pw-theme=brutal] :focus-visible:not(textarea):not(input),.personal-settings-page[data-pw-theme=brutal] :focus-visible:not(textarea):not(input){outline-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-brand{border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-brand-mark{color:#ffd91a;box-shadow:none;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-icon{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-utility:hover{background:#ffffff8c}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-link[aria-current=page],.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-link[aria-current=page]{background:#ff8fd0;border:2px solid #141414;border-radius:4px;font-weight:700;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-count{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-section-title{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-title-actions button:hover{box-shadow:none;background:#fff;border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-sidebar-footer{border-top:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-sidebar{background:#ffd91a;border-right:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-title small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-header small,.personal-settings-page[data-pw-theme=brutal] .personal-settings-back,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button{color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-back:hover,.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button:hover{background:#ffffff8c}.personal-settings-page[data-pw-theme=brutal] .personal-settings-tabs button[aria-current=page]{color:#141414;background:#ff8fd0;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-detail-card,.personal-settings-page[data-pw-theme=brutal] .personal-machine-editor,.personal-settings-page[data-pw-theme=brutal] .personal-machine-summary,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card,.personal-settings-page[data-pw-theme=brutal] .personal-lark-table,.personal-settings-page[data-pw-theme=brutal] .personal-lark-topic-panel{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-machine-namespaces button[aria-current=page],.personal-settings-page[data-pw-theme=brutal] .personal-machine-preview,.personal-settings-page[data-pw-theme=brutal] .personal-machine-scope-note,.personal-settings-page[data-pw-theme=brutal] .personal-machine-rollback{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button:hover{background:#fff8d6;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-settings-choice-group button[aria-checked=true]{background:#ffe23f;border-color:#141414;box-shadow:3px 3px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action,.personal-settings-page[data-pw-theme=brutal] .personal-secondary-action,.personal-settings-page[data-pw-theme=brutal] .personal-lark-toolbar label{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-settings-page[data-pw-theme=brutal] .personal-primary-action{background:#ffe23f}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs{border-bottom:2px solid #141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs button[aria-current=page]{color:#141414;border-color:#141414}.personal-settings-page[data-pw-theme=brutal] .personal-lark-tabs span,.personal-settings-page[data-pw-theme=brutal] .personal-lark-app-card em,.personal-settings-page[data-pw-theme=brutal] .personal-connection-status{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-header{background:#fdf8e7;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs{background:0 0;gap:6px;padding:0}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-tabs button[aria-current=page]{background:#ffe23f;font-weight:700;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-agent-select .personal-select-trigger,.personal-workspace-shell[data-pw-theme=brutal] .personal-icon-button{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message.is-user{background:#8fdcff;border:2px solid #141414;border-radius:8px 8px 2px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-message-avatar{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-pre{color:#fdf8e7;background:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-code{color:#141414;background:#ffe23f;border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-md-link{color:#141414;text-decoration-thickness:2px}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-object-list>button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-row-status{border:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list{background:#fff}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header{background:#fff;border-bottom:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-lane-scroll>button:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-card:hover>button{background:#fff;border-color:#141414;transform:translate(-1px,-1px);box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-object-list>header>span{color:#fff;background:#141414;border-radius:3px;padding:1px 7px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot{border:2px solid #141414;border-radius:2px;width:10px;height:10px}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-attention{background:#ff9d5c}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-progress{background:#35c5f0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-schedule{background:#b49bf0}.personal-workspace-shell[data-pw-theme=brutal] .personal-kanban-dot.tone-done{background:#7ddb8a}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-kanban .personal-task-empty{border:2px dashed #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-task-card-actions button{color:#141414;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-composer-wrap{background:linear-gradient(transparent, var(--pw-bg) 22%)}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-banner{color:#141414;background:#fee2e2;border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-header small{color:#555}.personal-workspace-shell[data-pw-theme=brutal] .personal-system-health-issues{color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray{background:#fff;border:2px solid #141414;border-radius:6px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:hover,.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-tray:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-btn:hover{background:#ffd91a}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-link{color:#141414;text-decoration:underline}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-close{color:#141414;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article{background:#fdf8e7;border:1.5px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-manager-conversation-messages article.is-user{background:#8fdcff}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button{color:#141414;background:#fff;border:2px solid #141414;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-quick-prompts button:hover{color:#141414;background:#ffe23f;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer{border:2px solid #141414;border-radius:6px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer:focus-within{border-color:#141414;box-shadow:5px 5px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer textarea{border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button,.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>.personal-composer-attach,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer button{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-channel-composer>button:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-composer:focus-within{border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-workspace-drawer{box-shadow:none;border-left:2px solid #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card,.personal-workspace-shell[data-pw-theme=brutal] .personal-correction-panel{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-detail-card.is-attention{background:#fff3c9;border-color:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-primary-action:hover{background:#ffd91a;transform:translate(1px,1px);box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action{color:#141414;background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-secondary-action:hover{border-color:#141414;transform:translate(1px,1px);box-shadow:1px 1px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-danger-action{color:#141414;background:#ff9d8a;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>summary{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div{border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-compact-menu>div button:hover{background:#fff8d6}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select{border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-agent-select select,.personal-workspace-shell[data-pw-theme=brutal] .personal-inline-resume-when input,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields input:not([type=checkbox]),.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-fields select,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-domain-option,.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{color:#141414;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch{background:#fff;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]{background:#baf2c7}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch>span{background:#777}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-switch[aria-checked=true]>span{background:#141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-subagent-preview{background:#fff3c9;box-shadow:2px 2px #141414}.personal-digest-card{border:1px solid var(--pw-line);background:linear-gradient(135deg,#fff,#fbf7ee);border-radius:14px;justify-content:space-between;align-items:center;gap:14px;margin-bottom:12px;padding:13px 16px;display:flex}.personal-digest-card>strong{letter-spacing:.01em;font-size:13px}.personal-digest-stats{gap:8px;display:flex}.personal-digest-stats span{border:1px solid var(--pw-line-strong);color:var(--pw-muted);background:#fff;border-radius:99px;align-items:baseline;gap:6px;padding:6px 13px;font-size:12px;display:inline-flex}.personal-digest-stats b{color:var(--pw-text);font-size:14px}.personal-priority-badge{color:var(--pw-muted);background:#f2f1ed;border-radius:6px;padding:1px 7px;font-size:10.5px;font-weight:700}.personal-priority-badge.is-p0{background:var(--pw-red-bg);color:var(--pw-red)}.personal-priority-badge.is-p1{background:var(--pw-amber-bg);color:var(--pw-amber)}.personal-priority-badge.is-blocked{background:var(--pw-red-bg);color:var(--pw-red)}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-card{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:3px 3px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-digest-stats span{color:#141414;border:2px solid #141414;border-radius:99px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-priority-badge{border:1.5px solid #141414;border-radius:3px}.personal-goal-notification code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);word-break:break-all;border-radius:5px;padding:1px 5px;font-size:11px}.personal-workspace-shell[data-pw-theme=brutal] .personal-goal-notification code{background:#fff;border:1.5px solid #141414;border-radius:3px}.personal-proposal-state.is-error:has(small){align-items:start;gap:4px;display:grid}.personal-proposal-state.is-error small{word-break:break-all;line-height:1.5}.personal-gate-cli-hint{gap:6px;margin-top:10px;display:grid}.personal-gate-cli-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;word-break:break-all;border-radius:7px;padding:8px 10px;font-size:11.5px;line-height:1.5;display:block}.personal-gate-cli-hint small{color:var(--pw-muted);line-height:1.5}.personal-notification-list{gap:0;margin:12px 0 0;padding:0;list-style:none;display:grid}.personal-notification-row{border-top:1px solid var(--pw-line);gap:8px;padding:12px 0;display:grid}.personal-notification-row:first-child{border-top:0;padding-top:4px}.personal-notification-row-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.personal-notification-row-head strong{font-size:13px}.personal-notification-badge{border-radius:99px;flex:none;padding:2px 8px;font-size:11px;font-weight:650}.personal-notification-badge.is-on{background:var(--pw-green-bg);color:var(--pw-green)}.personal-notification-badge.is-off{background:var(--pw-bg,#f5f4ef);color:var(--pw-muted)}.personal-notification-meta{color:var(--pw-muted);flex-wrap:wrap;gap:4px 12px;font-size:11.5px;display:flex}.personal-notification-toggle{color:var(--pw-text);cursor:pointer;align-items:center;gap:8px;font-size:12.5px;display:flex}.personal-notification-toggle input{accent-color:var(--pw-blue);cursor:pointer;width:15px;height:15px}.personal-notification-bind{gap:8px;display:flex}.personal-notification-bind select{border:1px solid var(--pw-line-strong);min-width:0;height:34px;color:var(--pw-text);background:#fff;border-radius:8px;flex:1;padding:0 10px;font-size:12.5px}.personal-notification-bind .personal-secondary-action{flex:none}.personal-notification-confirm{border:1px solid var(--pw-line);background:var(--pw-bg,#faf9f5);border-radius:9px;gap:8px;padding:10px 12px;display:grid}.personal-notification-confirm p{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-actions{gap:8px;display:flex}.personal-notification-error{color:var(--pw-red);margin:0;font-size:12px;line-height:1.5}.personal-notification-hint{color:var(--pw-muted);margin:0;font-size:12px;line-height:1.6}.personal-notification-hint code{border:1px solid var(--pw-line);background:var(--pw-bg,#f7f6f2);-webkit-user-select:all;user-select:all;border-radius:5px;margin-top:4px;padding:2px 7px;font-size:11px;display:inline-block}.is-spinning{animation:.9s linear infinite personal-notification-spin}@keyframes personal-notification-spin{to{transform:rotate(360deg)}}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-badge{border:1.5px solid #141414;border-radius:3px}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-bind select{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-notification-confirm{background:#fff;border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-card{border:2px solid #141414;border-radius:4px;box-shadow:4px 4px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-settings-icon{color:#141414;background:#ffe23f;border:2px solid #141414;border-radius:4px}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button{border:2px solid #141414;border-radius:4px;box-shadow:2px 2px #141414}.personal-workspace-shell[data-pw-theme=brutal] .personal-language-options>button.is-selected{color:#141414;background:#8fdcff}@media (width<=720px){.personal-lark-settings{padding:20px 16px calc(24px + env(safe-area-inset-bottom))}.personal-lark-header h1{font-size:24px}.personal-lark-tabs{gap:18px;margin-top:20px}.personal-settings-card>header,.personal-language-options{padding-left:15px;padding-right:15px}}.personal-goal-acceptance h4{margin:16px 0 8px;font-size:14px}.personal-goal-acceptance .personal-acceptance-observation{border-top:1px solid var(--color-border,#ebebeb);padding:8px 0}.personal-goal-acceptance dd,.personal-goal-acceptance p{overflow-wrap:anywhere}.personal-goal-acceptance details{margin-top:16px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:max(24px,50% - 560px)}.personal-channel-header[data-goal-selected=true]{grid-template-columns:auto minmax(0,1fr) auto;gap:4px 16px;padding-block:12px 0;display:grid}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-area:1/1/auto/3}.personal-channel-header[data-goal-selected=true] .personal-channel-title h1{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.personal-channel-header[data-goal-selected=true] .personal-channel-actions{grid-area:1/3}.personal-goal-navigation{grid-area:2/1/auto/-1;justify-content:space-between;align-items:center;gap:16px;min-width:0;display:flex}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{order:0;margin-left:0;overflow:visible}.personal-channel-actions>.personal-goal-settings-action{justify-content:center;align-items:center;min-width:44px;min-height:44px;display:inline-flex}@media (width<=1050px){.personal-channel-header[data-goal-selected=true] .personal-mobile-menu{grid-area:1/1}.personal-channel-header[data-goal-selected=true] .personal-channel-title{grid-column:2}}@media (width<=720px){.personal-channel-header[data-goal-selected=true]{gap:4px 8px}.personal-goal-navigation{gap:12px}.personal-goal-navigation .personal-agent-select{max-width:132px}.personal-goal-navigation .personal-select-value>small{display:none}.personal-channel-header[data-goal-selected=true] .personal-goal-tabs{gap:8px}.personal-goal-navigation .personal-goal-tabs button{min-width:44px;padding-inline:0}.personal-goal-navigation .personal-read-only-source{max-width:132px}.personal-channel-scroll[data-active-goal-view=overview]{padding-inline:14px}}.personal-channel:has(>.goal-loopx-mode){grid-template-rows:auto auto minmax(0,1fr) auto}.personal-run-row{grid-template-columns:38px minmax(0,1fr) auto 16px}.personal-activity-summary{border-bottom:1px solid var(--pw-line)}.personal-activity-summary>summary{cursor:pointer;min-height:44px;color:var(--pw-muted);flex-wrap:wrap;align-items:center;gap:10px;font-size:12px;display:flex}.personal-activity-summary>summary:after{content:"+";margin-left:auto}.personal-activity-summary[open]>summary:after{content:"−"}.personal-activity-summary>div{gap:8px;padding:8px 0 16px;display:grid}.personal-composer-tools{margin-bottom:6px}.personal-composer-tools>summary,.personal-runtime-details>summary{cursor:pointer;color:var(--pw-muted);min-height:44px;padding-block:12px;font-size:12px}.personal-composer-tools .personal-quick-prompts{flex-wrap:wrap;overflow:visible}.personal-composer-tools .personal-quick-prompts button{min-height:44px}.personal-runtime-details{position:relative}.personal-runtime-details[open]{padding-bottom:8px}.personal-channel-composer textarea{min-width:0}@media (width<=720px){.personal-run-row{grid-template-columns:32px minmax(0,1fr) auto 16px;gap:8px}.personal-run-row .personal-row-copy{display:grid}.personal-run-row>.personal-row-status{display:inline-flex}.personal-run-row .personal-row-copy strong,.personal-run-row .personal-row-copy small{overflow-wrap:anywhere;white-space:normal}}.benchmark-page{--benchmark-ink:#171717;--benchmark-body:#4d4d4d;--benchmark-muted:#767676;--benchmark-canvas:#fafafa;--benchmark-surface:#fff;--benchmark-soft:#f2f2f2;--benchmark-border:#e5e5e5;--benchmark-link:#0068d7;width:100%;max-width:100vw;min-height:100vh;color:var(--benchmark-ink);background:var(--benchmark-canvas);font-family:Geist,Inter,Helvetica Neue,Arial,sans-serif;overflow-x:clip}.benchmark-page,.benchmark-page *{box-sizing:border-box}.benchmark-hero{border-bottom:1px solid var(--benchmark-border);background:var(--benchmark-surface);padding:24px max(24px,50vw - 600px)}.benchmark-hero-topline,.benchmark-title-row,.benchmark-card-heading,.benchmark-footer>div{align-items:center;display:flex}.benchmark-hero-topline{justify-content:space-between;margin-bottom:64px}.benchmark-wordmark{color:var(--benchmark-ink);letter-spacing:-.04em;font-weight:650;text-decoration:none}.benchmark-readonly{color:var(--benchmark-muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.benchmark-hero-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,.5fr);align-items:end;gap:64px;display:grid}.benchmark-kicker,.benchmark-mono{color:var(--benchmark-muted);letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font:500 11px/16px Geist Mono,JetBrains Mono,monospace}.benchmark-title-row{align-items:baseline;gap:16px}.benchmark-title-row h1{letter-spacing:-.05em;max-width:780px;margin:0;font-size:clamp(32px,4.5vw,48px);font-weight:600;line-height:1}.benchmark-lead{max-width:680px;color:var(--benchmark-body);margin:20px 0 0;font-size:16px;line-height:24px}.benchmark-identity,.benchmark-stat-list{margin:0}.benchmark-identity>div{border-top:1px solid var(--benchmark-border);grid-template-columns:80px minmax(0,1fr);gap:16px;padding:10px 0;display:grid}.benchmark-identity dt,.benchmark-stat-list dt{color:var(--benchmark-muted);font-size:12px}.benchmark-identity dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font:500 12px/18px Geist Mono,monospace;overflow:hidden}.benchmark-kpi-grid{border:1px solid var(--benchmark-border);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:64px;display:grid;overflow:hidden}.benchmark-kpi-grid article{border-right:1px solid var(--benchmark-border);min-width:0;padding:20px 24px}.benchmark-kpi-grid article:last-child{border-right:0}.benchmark-kpi-grid svg{color:var(--benchmark-muted)}.benchmark-kpi-grid span{color:var(--benchmark-muted);margin-top:16px;font-size:12px;display:block}.benchmark-kpi-grid strong{letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin-top:6px;font-size:30px;font-weight:600;display:block}.benchmark-kpi-grid strong small{color:var(--benchmark-muted);letter-spacing:0;font-size:14px;font-weight:400}.benchmark-kpi-grid p{color:var(--benchmark-body);margin:8px 0 0;font-size:12px}.benchmark-state{border:1px solid var(--benchmark-border);width:fit-content;color:var(--benchmark-body);background:var(--benchmark-soft);text-transform:capitalize;border-radius:999px;align-items:center;padding:3px 8px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-state-success{color:#087a44;background:#ecf9f2;border-color:#b8e7ce}.benchmark-state-warning{color:#8a5100;background:#fff8e8;border-color:#f0d2a3}.benchmark-state-info{color:#0057b8;background:#eef6ff;border-color:#b9d7f5}.benchmark-tabs{z-index:3;border-bottom:1px solid var(--benchmark-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fafafaf0;align-items:center;gap:4px;padding:12px max(24px,50vw - 600px);display:flex;position:sticky;top:0}.benchmark-tabs button,.benchmark-loading button{min-height:40px;color:var(--benchmark-body);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:0 14px;font-size:13px;font-weight:500}.benchmark-tabs button[aria-current=page]{color:#fff;background:var(--benchmark-ink)}.benchmark-tabs .benchmark-refresh{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:7px;margin-left:auto;display:inline-flex}.benchmark-tabs button:focus-visible,.benchmark-cell-link:focus-visible,.benchmark-run-link:focus-visible,.benchmark-loading button:focus-visible{outline:2px solid var(--benchmark-link);outline-offset:2px}.benchmark-content{width:min(100vw - 48px,1200px);min-width:0;margin:0 auto;padding:40px 0 64px}.benchmark-view-stack{gap:48px;min-width:0;display:grid}.benchmark-view-stack>section{min-width:0}.benchmark-section-heading{justify-content:space-between;align-items:end;gap:24px;margin-bottom:16px;display:flex}.benchmark-section-heading h2,.benchmark-detail-card h2,.benchmark-run-detail h2{letter-spacing:-.02em;margin:0;font-size:20px;line-height:28px}.benchmark-section-heading>p{max-width:420px;color:var(--benchmark-muted);text-align:right;margin:0;font-size:12px;line-height:18px}.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;display:grid}.benchmark-arm-card,.benchmark-detail-card,.benchmark-run-detail{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;padding:24px}.benchmark-card-heading{justify-content:space-between;align-items:start;gap:24px}.benchmark-card-heading h3{letter-spacing:-.02em;margin:0;font-size:16px;line-height:24px}.benchmark-stat-list{margin-top:24px}.benchmark-stat-list>div{border-top:1px solid var(--benchmark-border);grid-template-columns:minmax(0,1fr) auto;gap:16px;padding:11px 0;display:grid}.benchmark-stat-list dd{font-variant-numeric:tabular-nums;text-align:right;margin:0;font:500 12px/18px Geist Mono,monospace}.benchmark-factor-row{flex-wrap:wrap;gap:8px;margin-top:20px;display:flex}.benchmark-factor-row span{color:var(--benchmark-muted);background:var(--benchmark-soft);border-radius:6px;padding:5px 8px;font-size:11px}.benchmark-runtime-list{flex-wrap:wrap;gap:8px;display:flex}.benchmark-runtime-list>div{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:6px;align-items:center;gap:20px;padding:9px 11px;font:500 11px/16px Geist Mono,monospace;display:inline-flex}.benchmark-runtime-list>div span{color:var(--benchmark-muted)}.benchmark-runtime-list>div strong{font-weight:600}.benchmark-table-shell{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);border-radius:12px;width:100%;max-width:100%;overflow:auto}.benchmark-table-shell table{border-collapse:collapse;width:100%;font-size:12px}.benchmark-table-shell th,.benchmark-table-shell td{border-bottom:1px solid var(--benchmark-border);text-align:left;white-space:nowrap;padding:14px 16px}.benchmark-table-shell tr:last-child td{border-bottom:0}.benchmark-table-shell th{color:var(--benchmark-muted);background:var(--benchmark-soft);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}.benchmark-table-shell td{color:var(--benchmark-body)}.benchmark-positive{color:#087a44!important}.benchmark-negative{color:#b42318!important}.benchmark-muted{color:var(--benchmark-muted)}.benchmark-wide-table{min-height:300px}.benchmark-cell-link,.benchmark-run-link{color:var(--benchmark-ink);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.benchmark-cell-link span{font-family:Geist Mono,monospace;display:block}.benchmark-cell-link small{color:var(--benchmark-link);align-items:center;gap:4px;margin-top:5px;display:flex}.benchmark-cell-link small+small{color:var(--benchmark-muted)}.benchmark-cell-link .benchmark-cell-metric{color:var(--benchmark-body);font-family:Geist Mono,monospace}.benchmark-run-link{max-width:280px;color:var(--benchmark-link);text-overflow:ellipsis;overflow:hidden}.benchmark-runs-layout{grid-template-columns:minmax(0,1.3fr) minmax(340px,.7fr);align-items:start;gap:16px;display:grid}.benchmark-table-shell tr[aria-selected=true] td{background:#f3f7fb}.benchmark-run-detail{position:sticky;top:82px}.benchmark-run-detail h2{overflow-wrap:anywhere;max-width:340px}.benchmark-run-facts dd{overflow-wrap:anywhere;white-space:normal;max-width:310px}.benchmark-run-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:20px;display:grid}.benchmark-run-metrics>div{background:var(--benchmark-soft);border-radius:6px;padding:10px}.benchmark-run-metrics span,.benchmark-run-metrics strong{display:block}.benchmark-run-metrics span{color:var(--benchmark-muted);font-size:10px}.benchmark-run-metrics strong{margin-top:5px;font:600 12px/18px Geist Mono,monospace}.benchmark-insight{border-left:2px solid var(--benchmark-link);margin-top:20px;padding:4px 0 4px 14px}.benchmark-insight p{color:var(--benchmark-body);margin:8px 0;font-size:13px;line-height:20px}.benchmark-insight small{color:var(--benchmark-muted);line-height:18px}.benchmark-footer{border-top:1px solid var(--benchmark-border);color:var(--benchmark-muted);background:var(--benchmark-surface);justify-content:space-between;gap:24px;padding:20px max(24px,50vw - 600px);font-size:11px;display:flex}.benchmark-footer>div{flex-wrap:wrap;gap:12px}.benchmark-footer code{text-overflow:ellipsis;white-space:nowrap;max-width:360px;overflow:hidden}.benchmark-loading{text-align:center;place-content:center;min-height:100vh;display:grid}.benchmark-loading svg{color:var(--benchmark-muted);margin:0 auto}.benchmark-loading h1{margin:18px 0 0;font-size:24px}.benchmark-loading p{max-width:520px;color:var(--benchmark-muted);margin:8px auto 0}.benchmark-loading button{border:1px solid var(--benchmark-border);background:var(--benchmark-surface);align-items:center;gap:8px;margin:20px auto 0;display:inline-flex}@media (width<=900px){.benchmark-hero-grid,.benchmark-runs-layout{grid-template-columns:1fr}.benchmark-hero-grid{gap:32px}.benchmark-kpi-grid{grid-template-columns:repeat(2,1fr)}.benchmark-kpi-grid article:nth-child(2){border-right:0}.benchmark-kpi-grid article:nth-child(-n+2){border-bottom:1px solid var(--benchmark-border)}.benchmark-run-detail{position:static}}@media (width<=640px){.benchmark-hero{padding-inline:20px}.benchmark-hero-topline{margin-bottom:40px}.benchmark-title-row,.benchmark-section-heading,.benchmark-footer{flex-direction:column;align-items:flex-start}.benchmark-title-row h1{font-size:34px}.benchmark-kpi-grid,.benchmark-arm-grid,.benchmark-detail-grid{grid-template-columns:1fr}.benchmark-kpi-grid article{border-right:0;border-bottom:1px solid var(--benchmark-border)}.benchmark-kpi-grid article:last-child{border-bottom:0}.benchmark-tabs{padding-inline:20px;overflow-x:auto}.benchmark-tabs .benchmark-refresh{display:none}.benchmark-content{width:calc(100vw - 40px);padding-top:28px}.benchmark-section-heading>p{text-align:left}.benchmark-footer code{max-width:100%}}@media (prefers-reduced-motion:reduce){.benchmark-page *,.benchmark-page :before,.benchmark-page :after{scroll-behavior:auto!important;transition:none!important}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/chat/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-50:oklch(98.5% 0 0);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-normal:0em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\!visible{visibility:visible!important}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.relative{position:relative}.static{position:static}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[calc\(100vh-80px\)\]{min-height:calc(100vh - 80px)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[1500px\]{max-width:1500px}.max-w-xl{max-width:var(--container-xl)}.min-w-\[260px\]{min-width:260px}.min-w-full{min-width:100%}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing) * 0);--tw-border-spacing-y:calc(var(--spacing) * 0);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.animate-spin{animation:var(--animate-spin)}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-rose-200{border-color:var(--color-rose-200)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/80{border-color:#e2e8f0cc}@supports (color:color-mix(in lab, red, red)){.border-slate-200\/80{border-color:color-mix(in oklab, var(--color-slate-200) 80%, transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-900{border-color:var(--color-slate-900)}.border-transparent{border-color:#0000}.bg-\[\#f6f7f9\]{background-color:#f6f7f9}.bg-\[\#f7f7f4\]{background-color:#f7f7f4}.bg-amber-50{background-color:var(--color-amber-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.pt-0{padding-top:calc(var(--spacing) * 0)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-amber-950{color:var(--color-amber-950)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-950{color:var(--color-emerald-950)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-800{color:var(--color-rose-800)}.text-rose-900{color:var(--color-rose-900)}.text-sky-800{color:var(--color-sky-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-slate-400:focus{--tw-ring-color:var(--color-slate-400)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-slate-400:focus-visible{--tw-ring-color:var(--color-slate-400)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media (width>=48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=80rem){.xl\:sticky{position:sticky}.xl\:top-4{top:calc(var(--spacing) * 4)}.xl\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[260px_minmax\(0\,1fr\)\]{grid-template-columns:260px minmax(0,1fr)}.xl\:grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(360px\,0\.65fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr)}.xl\:grid-cols-\[minmax\(0\,1fr\)_420px\]{grid-template-columns:minmax(0,1fr) 420px}.xl\:self-start{align-self:flex-start}}:where(.dark\:divide-zinc-900:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-zinc-900)}.dark\:border-amber-900:where(.dark,.dark *){border-color:var(--color-amber-900)}.dark\:border-emerald-900:where(.dark,.dark *){border-color:var(--color-emerald-900)}.dark\:border-rose-900:where(.dark,.dark *){border-color:var(--color-rose-900)}.dark\:border-sky-900:where(.dark,.dark *){border-color:var(--color-sky-900)}.dark\:border-zinc-100:where(.dark,.dark *){border-color:var(--color-zinc-100)}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:border-zinc-800:where(.dark,.dark *){border-color:var(--color-zinc-800)}.dark\:bg-\[\#09090b\]:where(.dark,.dark *){background-color:#09090b}.dark\:bg-amber-950:where(.dark,.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:#46190166}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 40%, transparent)}}.dark\:bg-emerald-950:where(.dark,.dark *){background-color:var(--color-emerald-950)}.dark\:bg-rose-950:where(.dark,.dark *){background-color:var(--color-rose-950)}.dark\:bg-sky-950:where(.dark,.dark *){background-color:var(--color-sky-950)}.dark\:bg-zinc-50:where(.dark,.dark *){background-color:var(--color-zinc-50)}.dark\:bg-zinc-900:where(.dark,.dark *){background-color:var(--color-zinc-900)}.dark\:bg-zinc-950:where(.dark,.dark *){background-color:var(--color-zinc-950)}.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.dark\:bg-zinc-950\/40:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-zinc-950) 40%, transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-emerald-200:where(.dark,.dark *){color:var(--color-emerald-200)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\:text-rose-200:where(.dark,.dark *){color:var(--color-rose-200)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-sky-200:where(.dark,.dark *){color:var(--color-sky-200)}.dark\:text-zinc-50:where(.dark,.dark *){color:var(--color-zinc-50)}.dark\:text-zinc-100:where(.dark,.dark *){color:var(--color-zinc-100)}.dark\:text-zinc-200:where(.dark,.dark *){color:var(--color-zinc-200)}.dark\:text-zinc-300:where(.dark,.dark *){color:var(--color-zinc-300)}.dark\:text-zinc-400:where(.dark,.dark *){color:var(--color-zinc-400)}.dark\:text-zinc-500:where(.dark,.dark *){color:var(--color-zinc-500)}.dark\:text-zinc-950:where(.dark,.dark *){color:var(--color-zinc-950)}@media (hover:hover){.dark\:hover\:bg-zinc-200:where(.dark,.dark *):hover{background-color:var(--color-zinc-200)}.dark\:hover\:bg-zinc-900:where(.dark,.dark *):hover{background-color:var(--color-zinc-900)}}.dark\:focus\:ring-zinc-500:where(.dark,.dark *):focus,.dark\:focus-visible\:ring-zinc-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-zinc-500)}}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:Geist Variable,Geist,Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{-webkit-font-smoothing:antialiased;text-rendering:geometricprecision;margin:0}button,input,select{font:inherit}.personal-home{--personal-accent:#2563eb;--personal-border:#e2ded6;color:#23272d;background:#f8f7f3;grid-template-columns:196px minmax(0,1fr);width:100%;min-height:100vh;display:grid;overflow-x:clip}.personal-sidebar{border-right:1px solid var(--personal-border);background:#fcfbf8;flex-direction:column;height:100vh;padding:1.5rem 1rem;display:flex;position:sticky;top:0}.personal-wordmark{color:#181d24;letter-spacing:-.01em;align-items:center;gap:.625rem;padding-inline:.5rem;font-size:.9375rem;font-weight:700;text-decoration:none;display:flex}.personal-wordmark-mark,.personal-manager-icon{color:#fff;background:#1e40af;border-radius:.625rem;flex:none;place-items:center;width:1.875rem;height:1.875rem;display:grid;box-shadow:0 1px 2px #0f172a24}.personal-nav{gap:.25rem;margin-top:2rem;display:grid}.personal-nav-item{color:#646971;text-align:left;background:0 0;border:0;border-radius:.625rem;align-items:center;gap:.625rem;width:100%;padding:.625rem .75rem;font-size:.875rem;font-weight:500;text-decoration:none;display:flex}.personal-nav-item-active{color:#1e40af;background:#e8eefc}.personal-nav-item:disabled{cursor:default;opacity:.72}.personal-health{color:#71717a;align-items:center;gap:.5rem;margin-top:auto;padding:.75rem .5rem 0;font-size:.75rem;display:flex}.personal-health-dot,.personal-state-dot{background:#94a3b8;border-radius:9999px;flex:none;width:.5rem;height:.5rem}.personal-health-dot.is-healthy{background:#22c55e;box-shadow:0 0 0 3px #22c55e1f}.personal-health-dot.is-unhealthy{background:#e11d48;box-shadow:0 0 0 3px #e11d481f}.personal-main{min-width:0;padding-bottom:6rem;position:relative}.personal-header{border-bottom:1px solid var(--personal-border);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#fcfbf8eb;justify-content:space-between;align-items:center;gap:1.5rem;min-height:7rem;padding:1.5rem clamp(1.5rem,5vw,4.5rem);display:flex}.personal-header h1{color:#181d24;letter-spacing:-.035em;margin:0;font-size:clamp(1.625rem,2.5vw,2rem);font-weight:650}.personal-header p{color:#71717a;margin:.375rem 0 0;font-size:.875rem}.personal-primary-link,.personal-row-action{color:#fff;background:var(--personal-accent);border-radius:.625rem;flex:none;justify-content:center;align-items:center;gap:.375rem;font-size:.8125rem;font-weight:600;text-decoration:none;display:inline-flex;box-shadow:0 1px 2px #2563eb33}.personal-primary-link{min-height:2.375rem;padding-inline:.875rem}.personal-content{width:min(100%,70rem);margin-inline:auto;padding:2rem clamp(1.5rem,5vw,4.5rem)}.personal-manager-summary{background:#ffffffb8;border:1px solid #dbe0e8;border-radius:.75rem;align-items:center;gap:.875rem;padding:.875rem 1rem;display:flex;box-shadow:0 1px 2px #0f172a09}.personal-manager-summary p{color:#474f5b;margin:0;font-size:.875rem;line-height:1.5}.personal-manager-icon{color:#1e40af;width:1.75rem;height:1.75rem;box-shadow:none;background:#e2e9f9}.personal-section{margin-top:2.25rem}.personal-section-heading{justify-content:space-between;align-items:end;gap:1rem;margin-bottom:.75rem;display:flex}.personal-section-heading h2{color:#23272d;letter-spacing:-.01em;margin:0;font-size:1rem;font-weight:650}.personal-section-heading p{color:#7d7d85;margin:.25rem 0 0;font-size:.75rem}.personal-section-heading>span{color:#7d7d85;font-variant-numeric:tabular-nums;font-size:.75rem}.personal-list{border:1px solid var(--personal-border);background:#ffffffdb;border-radius:.75rem;overflow:hidden;box-shadow:0 2px 8px #1d232b09}.personal-list-row{border-bottom:1px solid #ebe8e2;align-items:center;gap:1rem;min-width:0;padding:1rem;display:grid}.personal-list-row:last-child{border-bottom:0}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto auto}.personal-goal-row{color:inherit;grid-template-columns:minmax(0,1fr) auto auto;text-decoration:none;transition:background-color .12s}.personal-goal-row:hover{background:#f8fafc}.personal-goal-meta{align-items:center;gap:.75rem;display:inline-flex}.personal-state-dot.is-blocking{background:#d97706;box-shadow:0 0 0 3px #d977061f}.personal-row-copy{min-width:0}.personal-row-copy strong,.personal-row-copy span{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-row-copy strong{color:#2a2f36;font-size:.875rem;font-weight:580}.personal-row-copy span{color:#7d7d85;margin-top:.3125rem;font-size:.75rem}.personal-row-action{color:#1e40af;min-height:2rem;box-shadow:none;background:#e8eefc;padding-inline:.75rem}.personal-empty{color:#7d7d85;text-align:center;padding:1.5rem 1rem;font-size:.8125rem}.personal-source-tools{color:#94949c;justify-content:flex-end;align-items:center;gap:.25rem;margin-top:1rem;font-size:.6875rem;display:flex}.personal-source-tools button{min-height:1.75rem;color:inherit;background:0 0;border:0;border-radius:.375rem;align-items:center;gap:.25rem;padding-inline:.375rem;display:inline-flex}.personal-source-tools button:not(:disabled):hover{color:#475569;background:#f1efea}.personal-manager-input{color:#7d7d85;text-align:left;cursor:pointer;background:#fffffff0;border:1px solid #d8d6d0;border-radius:9999px;align-items:center;gap:.625rem;min-width:12rem;padding:.75rem 1rem;font-size:.8125rem;transition:border-color .12s,box-shadow .12s,color .12s;display:inline-flex;position:fixed;bottom:1.5rem;right:1.5rem;box-shadow:0 8px 24px #0f172a14}.personal-manager-input:hover{color:#475569;border-color:#bfc9da;box-shadow:0 10px 28px #0f172a1f}.personal-manager-backdrop{z-index:50;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-manager-drawer{color:#23272d;background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(26.25rem,100vw);min-width:0;height:100%;display:grid;box-shadow:-12px 0 36px #0f172a29}.personal-manager-drawer-header{border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:1rem;display:grid}.personal-manager-drawer-header h2,.personal-manager-drawer-header p{margin:0}.personal-manager-drawer-header h2{color:#181d24;font-size:.9375rem;font-weight:650}.personal-manager-drawer-header p{color:#7d7d85;margin-top:.125rem;font-size:.6875rem}.personal-manager-source{color:#475569;background:#f1efea;border-radius:9999px;padding:.25rem .5rem;font-size:.6875rem}.personal-manager-drawer-header button,.personal-manager-composer button{color:#646971;cursor:pointer;background:0 0;border:0;border-radius:.5rem;flex:none;place-items:center;width:2rem;height:2rem;display:inline-grid}.personal-manager-drawer-header button:hover{color:#23272d;background:#f1efea}.personal-manager-quick-actions{border-bottom:1px solid #ebe8e2;gap:.5rem;padding:.75rem 1rem;display:flex;overflow-x:auto}.personal-manager-thread{min-width:0;padding:1rem;overflow-y:auto}.personal-message-answer{white-space:pre-wrap;color:#323944;line-height:1.7}.personal-message-pending{color:#64748b}.personal-message-activity{color:#646a74;border-top:1px solid #d6d3cc;margin-top:.625rem;padding-top:.5rem}.personal-message-activity summary{cursor:pointer;width:fit-content;font-size:.6875rem;font-weight:600}.personal-message-activity ol{gap:.25rem;margin:.5rem 0 0;padding-left:1.125rem;font-size:.6875rem;display:grid}.personal-message-reconnect{color:#1e40af;background:#fff;border:1px solid #cbd5e1;border-radius:.5rem;margin-top:.625rem;padding:.35rem .65rem;font-size:.6875rem;font-weight:700}.personal-message-reconnect:hover{background:#eff6ff;border-color:#93c5fd}.personal-manager-composer{border-top:1px solid var(--personal-border);padding:.875rem 1rem max(.875rem, env(safe-area-inset-bottom));background:#fcfbf8;align-items:center;gap:.5rem;display:flex}.personal-manager-composer input{color:#23272d;background:#fff;border:1px solid #d8d6d0;border-radius:.625rem;outline:none;width:100%;min-width:0;height:2.5rem;padding-inline:.75rem}.personal-manager-composer input:focus{border-color:#60a5fa;box-shadow:0 0 0 3px #3b82f61f}.personal-manager-composer button{color:#fff;background:var(--personal-accent)}.personal-manager-composer button:disabled{cursor:default;opacity:.42}@media (width<=760px){.personal-home{display:block}.personal-sidebar{border-right:0;border-bottom:1px solid var(--personal-border);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;height:auto;padding:.75rem 1rem;display:grid;position:static}.personal-nav{justify-content:flex-end;min-width:0;margin-top:0;display:flex}.personal-nav-item{width:auto;padding:.5rem}.personal-nav-item:not(.personal-nav-item-active){font-size:0}.personal-health{margin-top:0;padding:0;font-size:0}.personal-header{min-height:auto;padding:1.25rem 1rem}.personal-content{padding:1.5rem 1rem}.personal-list{box-shadow:none;background:0 0;border:0;overflow:visible}.personal-list-row{border:1px solid var(--personal-border);background:#ffffffe6;border-radius:.75rem;margin-bottom:.625rem}.personal-needs-row{grid-template-columns:auto minmax(0,1fr) auto}.personal-needs-row .personal-row-action{grid-column:2/-1;justify-self:start}.personal-manager-input{bottom:1rem;right:1rem}}@media (width<=640px){.personal-manager-backdrop{align-items:flex-end}.personal-manager-drawer{width:100%;max-width:none;height:100dvh}}@media (width<=420px){.personal-wordmark-mark{display:none}.personal-sidebar{grid-template-columns:auto minmax(0,1fr) auto;padding-inline:.75rem}.personal-nav{gap:0}.personal-nav-item{gap:.25rem;padding-inline:.375rem}.personal-header{align-items:flex-start}.personal-primary-link{padding-inline:.625rem}.personal-primary-link svg{display:none}.personal-needs-row,.personal-goal-row{grid-template-columns:minmax(0,1fr) auto}.personal-needs-row .personal-state-dot{display:none}.personal-manager-input{min-width:0;max-width:calc(100vw - 2rem)}.personal-goal-meta svg{display:none}.personal-manager-drawer-header{grid-template-columns:auto minmax(0,1fr) auto auto}}.personal-workspace{--workspace-accent:#2563eb;--workspace-border:#e5e2dc;--workspace-muted:#70747e;color:#1e2228;background:#faf9f6;grid-template-columns:4.5rem 20rem minmax(0,1fr);height:100vh;min-height:42rem;display:grid;overflow:hidden}.personal-global-rail{border-right:1px solid var(--workspace-border);background:#fcfbf8;flex-direction:column;align-items:center;min-height:0;padding:1.125rem .75rem;display:flex}.personal-rail-logo{color:#fff;background:#1e40af;border-radius:.75rem;place-items:center;width:2.5rem;height:2.5rem;display:grid;box-shadow:0 4px 12px #1e40af2e}.personal-global-rail nav{gap:.5rem;margin-top:2rem;display:grid}.personal-global-rail nav button,.personal-global-rail>button{color:#80848c;cursor:pointer;background:0 0;border:0;border-radius:.625rem;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-global-rail nav button.is-active{color:#1e40af;background:#e8eefc}.personal-global-rail nav button:disabled{cursor:default;opacity:.42}.personal-global-rail .personal-health-dot{margin-top:auto}.personal-goal-sidebar{border-right:1px solid var(--workspace-border);background:#fcfbf8;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-goal-sidebar>header{justify-content:space-between;align-items:center;height:4.75rem;padding:0 1.25rem;display:flex}.personal-goal-sidebar>header h1{letter-spacing:-.02em;margin:0;font-size:1rem;font-weight:680}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{color:#70747e;background:0 0;border:0;border-radius:.5rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-goal-sidebar>header button:disabled{opacity:.4}.personal-manager-row,.personal-goal-list-row{width:calc(100% - 1.5rem);min-width:0;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.75rem;align-items:center;gap:.75rem;margin:0 .75rem;padding:.75rem;display:grid}.personal-manager-row{grid-template-columns:auto minmax(0,1fr);margin-bottom:.5rem}.personal-manager-row.is-selected,.personal-goal-list-row.is-selected{background:#e9eefa}.personal-goal-icon{color:#2563eb;background:#ffffffe6;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid;box-shadow:0 1px 2px #0f172a0f}.personal-manager-row strong,.personal-manager-row small,.personal-goal-list-copy strong,.personal-goal-list-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.personal-manager-row strong,.personal-goal-list-copy strong{font-size:.8125rem;font-weight:620}.personal-manager-row small,.personal-goal-list-copy small{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-goal-scroll{min-height:0;padding-bottom:1rem;overflow-y:auto}.personal-goal-list-row{grid-template-columns:auto minmax(0,1fr) auto;margin-bottom:.25rem}.personal-goal-list-row:hover{background:#f5f3ef}.personal-goal-list-row.is-selected:hover{background:#e9eefa}.personal-goal-list-row .personal-state-dot{width:.4375rem;height:.4375rem}.personal-state-dot.is-progressing{background:#10b981}.personal-state-dot.is-repair{background:#f43f5e}.personal-goal-list-row .rounded-full{padding-inline:.45rem;font-size:.625rem}.personal-goal-sidebar>footer{border-top:1px solid var(--workspace-border);min-height:3.25rem;color:var(--workspace-muted);justify-content:space-between;align-items:center;padding:0 1.25rem;font-size:.6875rem;display:flex}.personal-chat-pane{background:#faf9f6;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;display:grid}.personal-chat-header{z-index:20;border-bottom:1px solid var(--workspace-border);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);background:#fcfbf8f0;justify-content:space-between;align-items:center;gap:1rem;min-width:0;min-height:4.75rem;padding:.75rem clamp(1rem,2.5vw,2rem);display:flex;position:relative}.personal-chat-title,.personal-chat-actions{align-items:center;gap:.75rem;min-width:0;display:flex}.personal-chat-title{flex:auto;overflow:hidden}.personal-chat-title>div{min-width:0}.personal-chat-actions{flex:none}.personal-chat-title h2,.personal-chat-title p{margin:0}.personal-chat-title h2{color:#181d24;letter-spacing:-.02em;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;font-weight:680;overflow:hidden}.personal-chat-title p{max-width:28rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.15rem;font-size:.6875rem;overflow:hidden}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{color:#5b606a;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.625rem;flex:none;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-mobile-goals-button,.personal-agent-menu-backdrop{display:none}.personal-chat-back:hover,.personal-chat-actions>button:hover{border-color:var(--workspace-border);background:#fff}.personal-chat-actions>button.personal-progress-trigger{border-color:var(--workspace-border);color:#3c434e;background:#fffc;gap:.4rem;width:auto;padding-inline:.75rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-agent-picker{position:relative}.personal-agent-trigger{color:#292e36;cursor:pointer;background:#fff;border:1px solid #dadadc;border-radius:.625rem;align-items:center;gap:.45rem;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;display:inline-flex}.personal-agent-menu{z-index:40;border:1px solid var(--workspace-border);background:#fffffffa;border-radius:.875rem;width:min(21rem,100vw - 2rem);padding:.5rem;position:absolute;top:calc(100% + .5rem);right:0;box-shadow:0 18px 48px #0f172a29}.personal-agent-menu-title,.personal-agent-menu-footer{color:var(--workspace-muted);padding:.5rem .625rem;font-size:.6875rem}.personal-agent-menu-title{color:#23272d;font-weight:650}.personal-agent-menu-footer{border-top:1px solid var(--workspace-border);margin-top:.375rem}.personal-agent-menu>button{width:100%;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.625rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.625rem;padding:.625rem;display:grid}.personal-agent-menu>button:hover,.personal-agent-menu>button.is-selected{background:#eff3fc}.personal-agent-menu>button:disabled{cursor:not-allowed;opacity:.52}.personal-agent-menu strong,.personal-agent-menu small{display:block}.personal-agent-menu strong{font-size:.75rem}.personal-agent-menu small{color:var(--workspace-muted);margin-top:.125rem;font-size:.65rem}.personal-agent-avatar{color:#1e40af;background:#e2e9f9;border-radius:.625rem;flex:none;place-items:center;width:2rem;height:2rem;font-size:.75rem;font-weight:700;display:grid}.personal-agent-online{background:#10b981;border-radius:9999px;width:.4375rem;height:.4375rem}.personal-agent-online.is-offline{background:#94a3b8}.personal-live-badge{color:#33634e;background:#f5fcf8;border:1px solid #d1eddf;border-radius:9999px;align-items:center;gap:.375rem;padding:.35rem .625rem;font-size:.65rem;display:inline-flex}.personal-live-badge>span{background:#10b981;border-radius:9999px;width:.375rem;height:.375rem}.personal-chat-scroll{width:100%;min-height:0;padding:2rem clamp(1rem,5vw,5rem) 1.5rem;overflow-y:auto}.personal-chat-scroll>*{width:min(100%,56rem);margin-inline:auto}.personal-chat-welcome{background:#f1efea;border-radius:1rem;align-items:flex-start;gap:.875rem;margin-top:clamp(4rem,14vh,9rem);padding:1rem 1.125rem;display:flex}.personal-chat-welcome h3,.personal-chat-welcome p{margin:0}.personal-chat-welcome h3{font-size:.875rem;font-weight:650}.personal-chat-welcome p{color:#474f5b;margin-top:.25rem;font-size:.8125rem;line-height:1.55}.personal-manager-quick-actions{border:0;justify-content:center;gap:.625rem;padding:1rem 0;display:flex;overflow-x:auto}.personal-manager-quick-actions button{color:#3c434e;cursor:pointer;background:#ffffffc7;border:1px solid #d7dae1;border-radius:.625rem;flex:none;padding:.625rem .875rem;font-size:.75rem}.personal-manager-quick-actions button:hover{color:#1e40af;border-color:#a3b5dc}.personal-goal-summary{border:1px solid var(--workspace-border);background:#ffffffd1;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a08}.personal-goal-summary>div{border-bottom:1px solid #ebe8e2;grid-template-columns:7rem minmax(0,1fr);gap:1rem;padding:.8rem 1rem;font-size:.75rem;display:grid}.personal-goal-summary>div:last-child{border-bottom:0}.personal-goal-summary span{color:var(--workspace-muted)}.personal-goal-summary strong{min-width:0;font-weight:560}.personal-goal-summary .is-attention{background:#fffbeb}.personal-goal-summary .is-attention span,.personal-goal-summary .is-attention strong{color:#92400e}.personal-goal-projection{gap:.75rem;display:grid}.personal-projection-author{align-items:center;gap:.75rem;padding:0 .125rem .25rem;display:flex}.personal-projection-author strong,.personal-projection-author small{display:block}.personal-projection-author strong{color:#23272d;font-size:.8125rem;font-weight:660}.personal-projection-author small{color:var(--workspace-muted);margin-top:.15rem;font-size:.65rem}.personal-plan-card{border:1px solid var(--workspace-border);background:#ffffffdb;border-radius:.875rem;overflow:hidden;box-shadow:0 2px 8px #0f172a06}.personal-plan-card>header{border-bottom:1px solid #ebe8e2;justify-content:space-between;align-items:center;gap:1rem;min-height:3.25rem;padding:.75rem 1rem;display:flex}.personal-plan-card>header strong,.personal-plan-card>header small{display:block}.personal-plan-card>header strong{font-size:.75rem;font-weight:660}.personal-plan-card>header small{color:var(--workspace-muted);margin-top:.2rem;font-size:.625rem}.personal-plan-card>header>span{color:#5a5e65;background:#faf9f6;border:1px solid #e0ddd7;border-radius:.5rem;flex:none;padding:.25rem .45rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.65rem}.personal-plan-row{color:#343a43;border-bottom:1px solid #f0eee9;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-height:2.625rem;padding:.625rem 1rem;font-size:.75rem;display:grid}.personal-plan-row svg{color:#2563eb}.personal-plan-row.is-done svg{color:#059669}.personal-plan-row.is-done>span{color:#5c626b}.personal-plan-row small{color:var(--workspace-muted);font-size:.625rem}.personal-plan-card>button{color:#545b66;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;gap:.25rem;width:100%;min-height:2.625rem;font-size:.6875rem;display:flex}.personal-plan-card>button:hover{color:#1e40af;background:#f8f9fc}.personal-plan-card.is-empty>header{border-bottom:0}.personal-plan-card.is-empty>p{color:var(--workspace-muted);margin:-.25rem 0 0;padding:0 1rem 1rem;font-size:.75rem;line-height:1.55}.personal-run-evidence-card{border:1px solid var(--workspace-border);width:100%;min-height:3.75rem;color:inherit;text-align:left;cursor:pointer;background:#ffffffd1;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem 1rem;display:grid}.personal-run-evidence-card:hover{background:#fff;border-color:#c7ccd6}.personal-evidence-icon{color:#059669;background:#ecfdf5;border-radius:.625rem;place-items:center;width:2rem;height:2rem;display:grid}.personal-run-evidence-card strong,.personal-run-evidence-card small{display:block}.personal-run-evidence-card strong{font-size:.75rem;font-weight:650}.personal-run-evidence-card small{max-width:38rem;color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.2rem;font-size:.65rem;overflow:hidden}.personal-run-evidence-card em{color:var(--workspace-muted);white-space:nowrap;font-size:.625rem;font-style:normal}.personal-decision-card{background:#fffaee;border:1px solid #f5c068;border-radius:.875rem;justify-content:space-between;align-items:center;gap:1.5rem;margin-top:1rem;padding:1rem;display:flex}.personal-decision-card span{color:#b45309;text-transform:uppercase;font-size:.6875rem;font-weight:700}.personal-decision-card h3,.personal-decision-card p{margin:0}.personal-decision-card h3{margin-top:.25rem;font-size:.9375rem;font-weight:650}.personal-decision-card p{color:var(--workspace-muted);margin-top:.25rem;font-size:.75rem}.personal-decision-actions{flex:none;gap:.5rem;display:flex}.personal-decision-actions button,.personal-execution-card button,.personal-ops-link{color:#1e40af;cursor:pointer;background:#fff;border:1px solid #bbc9ea;border-radius:.625rem;justify-content:center;align-items:center;min-height:2.25rem;padding:0 .75rem;font-size:.75rem;font-weight:600;text-decoration:none;display:inline-flex}.personal-decision-actions button:last-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-manager-thread{min-width:0;padding:1.25rem 0 0;overflow:visible}.personal-manager-message{color:#474f5b;background:#f1efea;border-radius:.875rem;width:fit-content;max-width:min(88%,43rem);margin-bottom:1rem;padding:.75rem .875rem;font-size:.8125rem;line-height:1.55}.personal-manager-message.is-user{color:#fff;background:#2563eb;margin-left:auto}.personal-message-author{color:#1e40af;margin-bottom:.25rem;font-size:.6875rem;font-weight:700;display:block}.personal-manager-message p,.personal-manager-message ul{margin:0}.personal-manager-message ul{gap:.375rem;margin-top:.5rem;padding-left:1rem;display:grid}.personal-manager-message small{color:#7d7d85;margin-top:.5rem;font-size:.625rem;display:block}.personal-manager-message.is-user small{color:#dbeafe}.personal-manager-message.is-pending{color:#64748b;background:#f8fafc}.personal-proposal-list{gap:.75rem;width:min(100%,43rem);margin:0 0 1.25rem;display:grid}.personal-proposal-card{background:#f9fbff;border:1px solid #d3dcee;border-radius:.875rem;gap:.625rem;padding:.875rem;display:grid}.personal-proposal-card>header{align-items:center;gap:.5rem;display:flex}.personal-proposal-card>header span{color:#1e40af;background:#dbeafe;border-radius:999px;padding:.125rem .5rem;font-size:.625rem;font-weight:700}.personal-proposal-card>header strong{font-size:.75rem}.personal-proposal-card>header small{color:var(--workspace-muted);margin-left:auto;font-size:.625rem}.personal-proposal-card>p,.personal-proposal-card>small{margin:0}.personal-proposal-card>p{color:#1e293b;font-size:.8125rem;font-weight:600;line-height:1.5}.personal-proposal-card>small,.personal-proposal-status{color:#64748b;font-size:.6875rem;line-height:1.5}.personal-proposal-card>code{color:#475569;background:#f1f5f9;border-radius:.375rem;width:fit-content;padding:.25rem .375rem;font-size:.625rem}.personal-proposal-card.is-approved{background:#f7fefa;border-color:#a7f3d0}.personal-proposal-card.is-stale,.personal-proposal-card.is-error{background:#fffbeb;border-color:#fdba74}.personal-proposal-actions{flex-wrap:wrap;gap:.5rem;display:flex}.personal-proposal-actions button{color:#475569;cursor:pointer;background:#fff;border:1px solid #cbd5e1;border-radius:.625rem;min-height:2.25rem;padding:0 .75rem;font-size:.6875rem;font-weight:650}.personal-proposal-actions button:first-child{border-color:var(--workspace-accent);color:#fff;background:var(--workspace-accent)}.personal-proposal-actions button:disabled{cursor:wait;opacity:.55}.personal-execution-card{border:1px solid var(--workspace-border);background:#fffc;border-radius:.875rem;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;margin-top:1.25rem;padding:.875rem;display:grid}.personal-execution-card strong,.personal-execution-card p{margin:0}.personal-execution-card strong{font-size:.8125rem}.personal-execution-card p{color:var(--workspace-muted);text-overflow:ellipsis;white-space:nowrap;margin-top:.25rem;font-size:.6875rem;overflow:hidden}.personal-manager-composer{background:#fffffff5;border:1px solid #d5d5d6;border-radius:1rem;grid-template-rows:1fr;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;width:min(100% - 2rem,58rem);min-height:4rem;margin:0 auto 1rem;padding:.5rem .625rem;display:grid;position:relative;box-shadow:0 10px 30px #0f172a14}.personal-manager-composer input{color:#23272d;background:0 0;border:0;outline:none;grid-area:1/2;height:2.75rem;padding:0 .25rem}.personal-manager-composer input:focus{box-shadow:none;border:0}.personal-composer-tools{grid-area:1/1;align-self:center;align-items:center;min-width:0;display:flex}.personal-composer-tools button{color:#334155;cursor:pointer;background:#f5f3ef;border:0;border-radius:.75rem;align-items:center;gap:.35rem;width:auto;min-width:0;height:2.5rem;min-height:2.5rem;padding:0 .625rem;font-size:.6875rem;font-weight:620;display:inline-flex}.personal-composer-tools button span{text-overflow:ellipsis;white-space:nowrap;max-width:8rem;display:block;overflow:hidden}.personal-manager-composer .personal-send-button{color:#fff;background:var(--workspace-accent);cursor:pointer;border:0;border-radius:.75rem;grid-area:1/3;align-self:center;place-items:center;width:2.5rem;height:2.5rem;display:grid}.personal-manager-composer .personal-send-button:disabled{cursor:default;opacity:.34}.personal-details-backdrop{z-index:70;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a2e;justify-content:flex-end;display:flex;position:fixed;inset:0}.personal-running-details{background:#fcfbf8;width:min(28rem,100vw);height:100%;padding:1rem;overflow-y:auto;box-shadow:-12px 0 36px #0f172a29}.personal-running-details>header{justify-content:space-between;align-items:center;gap:1rem;padding-bottom:1rem;display:flex}.personal-running-details h2,.personal-running-details header p{margin:0}.personal-running-details h2{font-size:1rem;font-weight:680}.personal-running-details header p{color:var(--workspace-muted);margin-top:.25rem;font-size:.6875rem}.personal-running-details header button{cursor:pointer;background:#f1efea;border:0;border-radius:.625rem;place-items:center;width:2.25rem;height:2.25rem;display:grid}.personal-diagnosis-card{border:1px solid var(--workspace-border);background:#fff;border-radius:.875rem;padding:1rem}.personal-diagnosis-card>span{color:#059669;font-size:.6875rem;font-weight:700}.personal-diagnosis-card h3{margin:.375rem 0 1rem;font-size:.875rem;line-height:1.5}.personal-diagnosis-card dl,.personal-diagnosis-card dd{margin:0}.personal-diagnosis-card dl{gap:.625rem;display:grid}.personal-diagnosis-card dl>div{grid-template-columns:3.5rem minmax(0,1fr);gap:.75rem;font-size:.75rem;display:grid}.personal-diagnosis-card dt{color:var(--workspace-muted)}.personal-running-details details{border-bottom:1px solid var(--workspace-border);padding:1rem .25rem}.personal-running-details summary{cursor:pointer;font-size:.8125rem;font-weight:620}.personal-running-details details p{color:var(--workspace-muted);margin:.75rem 0 0;font-size:.75rem;line-height:1.55}.personal-details-todo-list{gap:.375rem;margin:.75rem 0 0;padding:0;list-style:none;display:grid}.personal-details-todo-list li{color:#484f59;padding-left:1rem;font-size:.71875rem;line-height:1.45;position:relative}.personal-details-todo-list li:before{content:"";background:#2563eb;border-radius:9999px;width:.375rem;height:.375rem;position:absolute;top:.45em;left:0}.personal-details-todo-list li.is-done{color:#7e838b}.personal-details-todo-list li.is-done:before{background:#059669}.personal-ops-link{gap:.375rem;width:100%;margin-top:1rem}.dark .personal-workspace,.dark .personal-chat-pane{color:#f4f4f5;background:#131417}.dark .personal-global-rail,.dark .personal-goal-sidebar,.dark .personal-chat-header,.dark .personal-running-details{color:#f4f4f5;background:#191a1e}.dark .personal-plan-card,.dark .personal-run-evidence-card,.dark .personal-projection-author strong{color:#f4f4f5;background:#1e1f23}.dark .personal-plan-card>header,.dark .personal-plan-row{border-color:#3f3f46}.dark .personal-plan-row,.dark .personal-plan-row.is-done>span{color:#d4d4d8}.dark .personal-decision-card{background:#45290d;border-color:#92400e}@media (width<=1000px){.personal-workspace{grid-template-columns:3.75rem 16.5rem minmax(0,1fr)}.personal-live-badge{display:none}.personal-chat-scroll{padding-inline:1.25rem}}@media (width<=720px){.personal-workspace{grid-template-rows:minmax(0,1fr);grid-template-columns:1fr;height:100dvh;min-height:100dvh;overflow:hidden}.personal-global-rail{display:none}.personal-goal-sidebar{border-right:0;height:100dvh;display:none}.personal-workspace.mobile-goals-visible .personal-goal-sidebar{display:grid}.personal-workspace.mobile-goals-visible .personal-chat-pane{display:none}.personal-chat-pane{height:100dvh;min-height:0}.personal-chat-header{-webkit-backdrop-filter:none;backdrop-filter:none;gap:.5rem;min-height:4.25rem;padding-inline:.75rem}.personal-mobile-goals-button{display:grid}.personal-goal-sidebar>header button,.personal-goal-sidebar>footer button{width:2.75rem;height:2.75rem}.personal-chat-title p,.personal-chat-title>span,.personal-chat-actions>button:first-of-type,.personal-chat-actions>button.personal-progress-trigger span{display:none}.personal-chat-actions>button.personal-progress-trigger{width:2.75rem;padding:0}.personal-chat-back,.personal-mobile-goals-button,.personal-chat-actions>button{width:2.75rem;height:2.75rem}.personal-agent-trigger{min-height:2.75rem;padding-inline:.5rem}.personal-agent-menu-backdrop{z-index:35;-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);background:#0f172a33;border:0;display:block;position:fixed;inset:0}.personal-agent-menu{z-index:40;border-radius:1rem;width:auto;max-height:calc(100dvh - 1.5rem);position:fixed;inset:auto .75rem .75rem;overflow-y:auto}.personal-agent-menu>button{min-height:3.5rem}.personal-chat-scroll{padding:1rem .75rem}.personal-chat-welcome{margin-top:1rem}.personal-manager-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));display:grid;overflow:visible}.personal-manager-quick-actions button{white-space:normal;width:100%}.personal-manager-quick-actions button:last-child{grid-column:1/-1}.personal-goal-summary>div{grid-template-columns:5.5rem minmax(0,1fr)}.personal-decision-card{flex-direction:column;align-items:stretch}.personal-run-evidence-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-run-evidence-card em,.personal-plan-row small{display:none}.personal-decision-actions{grid-template-columns:1fr 1fr;display:grid}.personal-decision-actions button,.personal-manager-quick-actions button,.personal-execution-card button,.personal-ops-link,.personal-running-details header button{min-height:2.75rem}.personal-running-details header button{width:2.75rem;height:2.75rem}.personal-execution-card{grid-template-columns:auto minmax(0,1fr) auto}.personal-execution-card .rounded-full{display:none}.personal-execution-card button{grid-column:2/-1;justify-self:start}.personal-manager-composer{margin-bottom:.5rem;position:sticky;bottom:.5rem}.personal-composer-tools button,.personal-send-button{min-width:2.75rem;min-height:2.75rem}}.chat-shell{background:radial-gradient(circle at 48% 0,#ffffffeb,#0000 30rem),#f7f8f6}.chat-goal-map{isolation:isolate;position:relative;overflow:hidden}.chat-goal-map:before{z-index:0;content:"";opacity:.44;background-image:radial-gradient(#94a3b83b .7px,#0000 .7px);background-size:18px 18px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 18% 84%,#0000);mask-image:linear-gradient(#0000,#000 18% 84%,#0000)}.chat-map-goal:after{content:"";background:#cbd5e1;width:1px;height:3rem;position:absolute;top:100%;left:50%}.chat-map-branches:before{content:"";background:#cbd5e1;height:1px;position:absolute;top:-1.5rem;left:16.666%;right:16.666%}.chat-map-branches>div{position:relative}.chat-map-branches>div:before{content:"";background:#cbd5e1;width:1px;height:1.5rem;position:absolute;bottom:100%;left:50%}.chat-map-branches:after{content:"";background:#cbd5e1;width:1px;height:2.5rem;position:absolute;top:100%;left:50%}@media (width<=767px){.chat-map-goal:after,.chat-map-branches:before,.chat-map-branches:after,.chat-map-branches>div:before{display:none}}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/loopx/web/chat/index.html b/loopx/web/chat/index.html index 84dad0d361..a31de6ece4 100644 --- a/loopx/web/chat/index.html +++ b/loopx/web/chat/index.html @@ -18,8 +18,8 @@ content="LoopX 个人 Agent 工作区:在同一个频道里查看、纠偏并推进 Goal。" /> LoopX 个人 Agent 工作区 - - + +