@pi-harness/pi-harness 0.1.40 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/web/dist/assets/{index-BFuxvXBR.js → index-gS0fF2ev.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/apps/web/package.json +1 -1
- package/apps/web/server-dist/bin.js +1 -0
- package/apps/web/server-dist/bin.js.map +1 -1
- package/apps/web/src/server/bin.ts +1 -0
- package/node_modules/@pi-harness/api-gateway/package.json +1 -1
- package/node_modules/@pi-harness/cli/dist/main.d.ts.map +1 -1
- package/node_modules/@pi-harness/cli/dist/main.js +2 -0
- package/node_modules/@pi-harness/cli/dist/main.js.map +1 -1
- package/node_modules/@pi-harness/cli/package.json +1 -1
- package/node_modules/@pi-harness/host-webserver/package.json +1 -1
- package/node_modules/@pi-harness/web-app/package.json +1 -1
- package/package.json +6 -6
- package/packages/api-gateway/package.json +1 -1
- package/packages/bundle-web-app/package.json +1 -1
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +2 -0
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/main.ts +2 -0
- package/packages/cli/test/main.test.ts +11 -5
- package/packages/host-webserver/package.json +1 -1
|
@@ -24,4 +24,4 @@ import{i as e,n as t,r as n,t as r}from"./react-vendor-BxoMtjVy.js";import{n as
|
|
|
24
24
|
`||t===`\r`)))return;if(!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}}function Di(e,t,n){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=t&&e<=n?e:void 0}function Oi(e,t){return[...e].slice(0,t).join(``)}function ki(e){let t=Ci(e,pi);if(t===void 0||!wi(t,pi))return;let n=Ei(t.image,gi),r=Ti(t.command,hi),i=Ei(t.output,vi,!0,!0),a=Di(t.exitCode,-2147483648,2147483647);if(n===void 0||r===void 0||r.length===0||i===void 0||a===void 0||typeof t.write!=`boolean`||t.status!==`completed`&&t.status!==`failed`&&t.status!==`timed_out`)return;let o=[];for(let e of r){let t=Ei(e,_i,!1,!0);if(t===void 0||t.length===0)return;o.push(t)}return{image:Oi(n,512),command:o.slice(0,yi).map(e=>Oi(e,bi)),commandCount:o.length,write:t.write,exitCode:a,status:t.status,output:Oi(i,xi),truncated:n.length>512||o.length>yi||o.some(e=>e.length>bi)||i.length>xi}}function Ai(e){let t=Ci(e,mi);if(!(t===void 0||!wi(t,mi))){for(let[e,n]of Object.entries(di))if(t[e]!==n)return;return{...di}}}function ji(){return{latest:null,defaults:{...di},malformed:!0}}function Mi(e){let t=Ci(e,fi);if(t===void 0||!wi(t,fi))return ji();let n=Ai(t.defaults);if(n===void 0)return ji();if(t.latest===null)return{latest:null,defaults:n,malformed:!1};let r=ki(t.latest);return r===void 0?ji():{latest:r,defaults:n,malformed:!1}}var Ni=50,Pi=64,Fi=2048;function Ii(e){if(typeof e!=`object`||!e)return!1;try{return!Array.isArray(e)}catch{return!1}}function Li(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function Ri(e,t){return Ii(e)?Li(e,t):void 0}function zi(e){try{if(!Array.isArray(e))return}catch{return}let t=Li(e,`length`);return typeof t==`number`&&Number.isSafeInteger(t)&&t>=0?t:void 0}function Bi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function Vi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0?e:t}function Hi(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0&&e<=Ni?e:Ni}function Ui(e){if(!Ii(e))return;let t=Ri(e,`source`),n=Ri(e,`message`);if(typeof t!=`string`||typeof n!=`string`)return;let r=Ri(e,`time`),i=typeof r==`string`&&r.length<=64&&Number.isFinite(Date.parse(r))?new Date(r).toISOString():null,a=(t.trim()||`runtime`).replaceAll(`\0`,`�`),o=(n.trim()||I(`未知错误`)).replaceAll(`\0`,`�`);return{value:{time:i,source:a.slice(0,Pi),message:o.slice(0,Fi),occurrences:Vi(Ri(e,`occurrences`),1)},truncated:a.length>Pi||o.length>Fi||t.includes(`\0`)||n.includes(`\0`)}}function Wi(e){let t=Ii(e)?e:{},n=Ri(t,`failures`),r=zi(n)??0,i=Math.min(r,Ni),a=[],o=r>Ni;for(let e=0;e<i;e+=1){let t=Ui(Li(n,String(e)));if(t===void 0){o=!0;continue}a.push(t.value),t.truncated&&(o=!0)}let s=Bi(Ri(t,`total`),a.length);return{total:s,observed:Math.max(s,Bi(Ri(t,`observed`),s)),dropped:Bi(Ri(t,`dropped`),0),capacity:Hi(Ri(t,`capacity`)),failures:a,truncated:o}}var q={blocks:12,title:256,label:256,value:4e3,totalText:16384},Gi=2e3,Ki=new Set([`text`,`badge`,`progress`]),qi=new Set([`neutral`,`info`,`success`,`warning`,`danger`]);function Ji(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Yi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function Xi(e){if(!Ji(e)||typeof e.type!=`string`||!Ki.has(e.type)||typeof e.label!=`string`||e.label.trim()===``||typeof e.tone!=`string`||!qi.has(e.tone))return;let t=e.type,n=e.tone;if(t===`progress`)return typeof e.value!=`number`||!Number.isFinite(e.value)||e.value<0||e.value>100?void 0:{type:t,label:e.label.slice(0,q.label),value:e.value,tone:n};if(typeof e.value==`string`)return{type:t,label:e.label.slice(0,q.label),value:e.value.slice(0,Gi),tone:n}}function Zi(e){if(!Ji(e)||typeof e.title!=`string`||e.title.trim()===``||!Array.isArray(e.blocks))return null;let t=e.blocks.slice(0,q.blocks).map(Xi).filter(e=>e!==void 0),n=typeof e.renderedAt==`string`&&Number.isFinite(Date.parse(e.renderedAt))?new Date(e.renderedAt).toISOString():null;return{title:e.title.slice(0,q.title),renderedAt:n,blocks:t,truncated:e.title.length>q.title||e.blocks.length>q.blocks||t.length!==Math.min(e.blocks.length,q.blocks)||e.blocks.some(e=>Ji(e)&&(typeof e.label==`string`&&e.label.length>q.label||typeof e.value==`string`&&e.value.length>Gi))}}function Qi(e){let t=Ji(e)?e:{},n=Ji(t.limits)?t.limits:{};return{rendered:Yi(t.rendered,0),latest:Zi(t.latest),limits:{blocks:Yi(n.blocks,q.blocks)||q.blocks,title:Yi(n.title,q.title)||q.title,label:Yi(n.label,q.label)||q.label,value:Yi(n.value,q.value)||q.value,totalText:Yi(n.totalText,q.totalText)||q.totalText}}}var J={timeoutMs:15e3,capsuleBytes:8388608,inventory:256,directoryEntries:4096,displayLimit:20},$i=2e3;function ea(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function ta(e,t){try{if(!Array.isArray(e))return;let n=Object.getOwnPropertyDescriptor(e,`length`);if(n===void 0||!(`value`in n)||!Number.isSafeInteger(n.value)||n.value<0)return;let r=Math.min(n.value,t),i=[];for(let t=0;t<r;t+=1){let n=Object.getOwnPropertyDescriptor(e,String(t));if(n===void 0||!(`value`in n))return;i.push(n.value)}return{values:i,altered:n.value>t}}catch{return}}function na(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function ra(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function ia(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function aa(e){if(typeof e==`string`&&!(e.length===0||e.length>255||e!==e.trim()||new TextEncoder().encode(e).byteLength>255||!e.endsWith(`.patch`)||/[/\\\p{Cc}\p{Cf}\p{Cs}]/u.test(e)))return e}function oa(e){if(typeof e!=`string`)return null;let t=e.replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,$i);return t===``?null:t}function sa(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function ca(e){let t=ea(e);if(t===void 0||t.action!==`capture`&&t.action!==`restore`||t.status!==`completed`&&t.status!==`failed`&&t.status!==`cancelled`)return null;let n=sa(t.at);if(n===void 0)return null;let r=t.name===void 0?null:aa(t.name);if(t.name!==void 0&&r===void 0||t.status===`completed`&&r===null)return null;let i=oa(t.error),a=ra(t.bytes,J.capsuleBytes),o=ra(t.files,J.capsuleBytes);return t.status===`completed`&&(a===void 0||a===0||o===void 0||o===0)||t.action===`restore`&&t.status===`completed`&&t.restored!==!0||(t.status===`failed`||t.status===`cancelled`)&&i===null||t.status===`completed`&&i!==null?null:{action:t.action,status:t.status,at:n,name:r??null,bytes:a??0,files:o??0,error:i}}function la(e){return e.status===`completed`?ia(e,[`action`,`status`,`at`,`name`,`bytes`,`files`,...e.action===`restore`?[`restored`]:[]]):ia(e,[`action`,`status`,`at`,`error`])}function ua(e){let t=ea(e);if(t===void 0)return;let n=aa(t.name),r=ra(t.bytes,J.capsuleBytes);if(n!==void 0&&r!==void 0&&r!==0)return{name:n,bytes:r}}function da(e){let t=ea(e),n=t??{},r=ta(n.capsules,J.displayLimit),i=r?.values??[],a=i.map(e=>{let t=ea(e);return{value:ua(e),contractValid:t!==void 0&&ia(t,[`name`,`bytes`])}}),o=a.map(e=>e.value).filter(e=>e!==void 0),s=ea(n.inventory)??{},c=ea(n.limits)??{},l=ea(n.latest),u=ca(n.latest),d=na(s.total,o.length),f=na(s.shown,o.length),p=d>=o.length&&d<=J.inventory&&f===o.length&&s.truncated!==void 0&&typeof s.truncated==`boolean`&&s.displayLimit===J.displayLimit&&ia(s,[`total`,`shown`,`truncated`,`displayLimit`]),m=c.capsuleBytes===J.capsuleBytes&&c.inventory===J.inventory&&c.directoryEntries===J.directoryEntries&&ia(c,[`capsuleBytes`,`inventory`,`directoryEntries`]),h=typeof n.timeoutMs==`number`&&Number.isSafeInteger(n.timeoutMs)&&n.timeoutMs>=100&&n.timeoutMs<=6e4?n.timeoutMs:void 0,g=h!==void 0,_=t===void 0||r===void 0||r.altered||a.some(e=>!e.contractValid)||o.length!==i.length||n.latest!==null&&(l===void 0||u===null||!la(l))||typeof l?.error==`string`&&l.error!==u?.error||!p||!m||!g||!ia(n,[`latest`,`capsules`,`inventory`,`timeoutMs`,`limits`]);return{latest:u,capsules:o,inventory:{total:p?d:Math.max(o.length,Math.min(J.inventory,d)),shown:o.length,truncated:s.truncated===!0||_,displayLimit:J.displayLimit},timeoutMs:h??J.timeoutMs,limits:{capsuleBytes:J.capsuleBytes,inventory:J.inventory,directoryEntries:J.directoryEntries},truncated:_}}var fa=new Set([`USED_SKILL`,`SOLVED_BY`,`REQUIRES`,`PATCHES`,`CONFLICTS_WITH`,`RELATED_TO`]),pa={nodes:2e3,relations:5e3,fileBytes:4194304,searchResults:50},ma=8;function ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ga(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function _a(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0?e:t}function va(e,t){return typeof e==`string`&&e.trim()!==``?e.trim().slice(0,t):void 0}function ya(e){return typeof e==`string`&&Number.isFinite(Date.parse(e))?new Date(e).toISOString():null}function ba(e){if(!ha(e)||typeof e.id!=`string`||e.kind!==`task`&&e.kind!==`skill`&&e.kind!==`event`)return;let t=va(e.label,160),n=va(e.summary,2e3);if(t!==void 0&&n!==void 0)return{id:e.id.slice(0,160),kind:e.kind,label:t,summary:n,source:va(e.source,512)??null,updatedAt:ya(e.updatedAt)}}function xa(e){if(!ha(e)||typeof e.relation!=`string`||!fa.has(e.relation))return;let t=e.relation,n=va(e.fromLabel??e.from,160),r=va(e.toLabel??e.to,160);if(n!==void 0&&r!==void 0)return{id:va(e.id,160)??`relation`,relation:t,fromLabel:n,toLabel:r,createdAt:ya(e.createdAt)}}function Sa(e){let t=ha(e)?e:{},n=Array.isArray(t.recent)?t.recent:[],r=n.slice(0,ma),i=r.map(ba).filter(e=>e!==void 0),a=Array.isArray(t.recentRelations)?t.recentRelations:[],o=a.slice(0,ma),s=o.map(xa).filter(e=>e!==void 0),c=ha(t.kinds)?t.kinds:{},l=ha(t.limits)?t.limits:{},u=ha(t.lastSearch)?t.lastSearch:void 0,d=u!==void 0&&Array.isArray(u.nodes)?Math.min(u.nodes.length,pa.searchResults):0,f=u===void 0?void 0:va(u.query,160),p=r.some(e=>ha(e)&&[e.label,e.summary,e.source].some((e,t)=>typeof e==`string`&&e.length>[160,2e3,512][t])),m=n.length>ma||i.length!==r.length||a.length>ma||s.length!==o.length||p||u!==void 0&&typeof u.query==`string`&&u.query.length>160||u!==void 0&&Array.isArray(u.nodes)&&u.nodes.length>pa.searchResults;return{nodes:ga(t.nodes,i.length),relations:ga(t.relations,s.length),kinds:{task:ga(c.task,0),skill:ga(c.skill,0),event:ga(c.event,0)},recent:i,recentRelations:s,lastSearch:u===void 0||f===void 0?null:{query:f,total:ga(u.total,d),shown:d},limits:{nodes:_a(l.nodes,pa.nodes),relations:_a(l.relations,pa.relations),fileBytes:_a(l.fileBytes,pa.fileBytes),searchResults:_a(l.searchResults,pa.searchResults)},truncated:m}}var Ca=50,wa=2e3,Ta=500,Ea={fileBytes:4194304,depth:128,keysPerFile:5e4,flattenedKeyLength:2048,pathLength:4096,panelKeysPerSide:100},Da=new Set([`status`,`report`,`limits`]),Oa=new Set([`state`,`at`,`error`]),ka=new Set([`base`,`target`,`baseKeys`,`targetKeys`,`missing`,`extra`,`missingTotal`,`extraTotal`,`truncated`]),Aa=new Set(Object.keys(Ea)),ja=/[\p{Cc}\p{Cf}\p{Cs}]/u;function Ma(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Na(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function Pa(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Fa(e,t,n=!1){if(!(typeof e!=`string`||!n&&e.length===0||e!==e.trim()||ja.test(e))&&!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}function Ia(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function La(e){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let t=Object.getOwnPropertyDescriptor(e,`length`),n=t!==void 0&&`value`in t?t.value:void 0;if(!Number.isSafeInteger(n)||n<0||n>Ea.panelKeysPerSide)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)))||Object.values(r).some(e=>!(`value`in e)))return;let i=[];for(let e=0;e<n;e+=1){let t=r[String(e)],n=Fa(t!==void 0&&`value`in t?t.value:void 0,Ea.flattenedKeyLength,!0);if(n===void 0)return;i.push(n)}return i}catch{return}}function Ra(e){let t=Ma(e,Oa);if(t===void 0)return;if(t.state===`idle`&&Na(t,new Set([`state`])))return{state:`idle`,at:null,error:null};if(t.state===`running`&&Na(t,new Set([`state`])))return{state:`running`,at:null,error:null};let n=Ia(t.at);if(t.state===`completed`&&n!==void 0&&Na(t,new Set([`state`,`at`])))return{state:`completed`,at:n,error:null};if((t.state===`failed`||t.state===`cancelled`)&&n!==void 0&&Na(t,Oa)){let e=Fa(t.error,wa);if(e!==void 0)return{state:t.state,at:n,error:[...e].slice(0,Ta).join(``)}}}function za(e){let t=Ma(e,ka);if(t===void 0||!Na(t,ka))return;let n=Fa(t.base,Ea.pathLength),r=Fa(t.target,Ea.pathLength),i=Pa(t.baseKeys,Ea.keysPerFile),a=Pa(t.targetKeys,Ea.keysPerFile),o=La(t.missing),s=La(t.extra),c=Pa(t.missingTotal,Ea.keysPerFile),l=Pa(t.extraTotal,Ea.keysPerFile);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===void 0||l===void 0||typeof t.truncated!=`boolean`)return;let u=Math.min(c,Ea.panelKeysPerSide),d=Math.min(l,Ea.panelKeysPerSide),f=u<c||d<l;if(!(o.length!==u||s.length!==d||t.truncated!==f||c>i||l>a||i-c!==a-l||new Set(o).size!==o.length||new Set(s).size!==s.length||o.some(e=>s.includes(e))))return{base:n,target:r,baseKeys:i,targetKeys:a,missing:o.slice(0,Ca),extra:s.slice(0,Ca),missingTotal:c,extraTotal:l,truncated:f||o.length>Ca||s.length>Ca}}function Ba(e){let t=Ma(e,Aa);return t!==void 0&&Na(t,Aa)&&Object.entries(Ea).every(([e,n])=>t[e]===n)}function Va(){return{status:{state:`unknown`,at:null,error:null},report:null,malformed:!0,limits:{...Ea}}}function Ha(e){let t=Ma(e,Da);if(t===void 0||!Na(t,Da)||!Ba(t.limits))return Va();let n=Ra(t.status);if(n===void 0)return Va();let r=t.report===null?null:za(t.report);return r===void 0||n.state===`idle`&&r!==null||n.state===`completed`&&r===null?Va():{status:n,report:r,malformed:!1,limits:{...Ea}}}var Ua=12,Wa=8,Ga=8,Ka=12,qa={responseBytes:1048576,commandArgs:32,argumentBytes:4096,toolArgumentsBytes:65536,toolArgumentDepth:32,requestTimeoutMs:3e4,panelItems:20,inventoryItems:1e3,paginationPages:100,stderrBytes:8192,managedServers:128},Ja=new Set([`running`,`stopping`,`stopped`]);function Ya(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):t}function Xa(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>=t?Math.trunc(e):t}function Za(e,t){return typeof e==`string`&&e.length>0?e.slice(0,t):void 0}function Qa(e){let t=z(e);if(t===void 0)return;let n=Za(t.name,512);if(n===void 0)return;let r=Za(t.description,500);return{name:n,...r===void 0?{}:{description:r}}}function $a(e){let t=z(e);if(t===void 0)return;let n=Za(t.uri,4096);if(n===void 0)return;let r=Za(t.name,512),i=Za(t.mimeType,256);return{uri:n,...r===void 0?{}:{name:r},...i===void 0?{}:{mimeType:i}}}function eo(e){let t=z(e);if(t===void 0)return;let n=Za(t.name,512);if(n===void 0)return;let r=Za(t.description,500);return{name:n,...r===void 0?{}:{description:r}}}function to(e){let t=z(e);if(t===void 0)return;let n=Za(t.id,64);if(n!==void 0)return{id:n,status:typeof t.status==`string`&&Ja.has(t.status)?t.status:`unknown`,startedAt:typeof t.startedAt==`number`&&Number.isFinite(t.startedAt)&&t.startedAt>=0?Math.trunc(t.startedAt):0}}function no(e,t,n){let r=tn(e,t+2)??[],i=r.map(n).filter(e=>e!==void 0).slice(0,t);return{values:i,clipped:r.length>t||r.length!==i.length,rawLength:r.length}}function ro(e,t,n){let r=z(e)??{},i=Xa(r.total,t);return{total:i,shown:t,truncated:r.truncated===!0||n||i>t}}function io(e){let t=z(e)??{},n=no(t.tools,Ua,Qa),r=no(t.resources,Wa,$a),i=no(t.prompts,Ga,eo),a=no(t.servers,Ka,to),o=z(t.inventory)??{},s=z(t.limits)??{};return{server:t.server===null?null:Za(t.server,4096)??null,tools:n.values,resources:r.values,prompts:i.values,lastCall:t.lastCall===null?null:Za(t.lastCall,512)??null,servers:a.values,inventory:{tools:ro(o.tools,n.values.length,n.clipped),resources:ro(o.resources,r.values.length,r.clipped),prompts:ro(o.prompts,i.values.length,i.clipped),servers:ro(o.servers,a.values.length,a.clipped)},limits:{responseBytes:Ya(s.responseBytes,qa.responseBytes),commandArgs:Ya(s.commandArgs,qa.commandArgs),argumentBytes:Ya(s.argumentBytes,qa.argumentBytes),toolArgumentsBytes:Ya(s.toolArgumentsBytes,qa.toolArgumentsBytes),toolArgumentDepth:Ya(s.toolArgumentDepth,qa.toolArgumentDepth),requestTimeoutMs:Ya(s.requestTimeoutMs,qa.requestTimeoutMs),panelItems:Ya(s.panelItems,qa.panelItems),inventoryItems:Ya(s.inventoryItems,qa.inventoryItems),paginationPages:Ya(s.paginationPages,qa.paginationPages),stderrBytes:Ya(s.stderrBytes,qa.stderrBytes),managedServers:Ya(s.managedServers,qa.managedServers)}}}var ao={nameCharacters:128,recoveryEntries:1e4,persistenceErrorCharacters:2e3},oo=new Set([`idle`,`focused`,`happy`,`concerned`]),so=new Set([`session_start`,`agent_start`,`agent_end`,`tool_execution_end`,`feed`,`play`,`set_mood`]);function co(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function lo(e,t=0){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function uo(e,t){return typeof e==`string`?e.slice(0,t):``}function fo(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function po(e){let t=z(e)??{},n=z(t.limits)??{},r={nameCharacters:co(n.nameCharacters,ao.nameCharacters),recoveryEntries:co(n.recoveryEntries,ao.recoveryEntries),persistenceErrorCharacters:co(n.persistenceErrorCharacters,ao.persistenceErrorCharacters)},i=z(t.recovery)??{},a=lo(i.sessionEntries),o=Math.min(a,r.recoveryEntries,lo(i.scanned)),s=z(t.persistence)??{},c=lo(s.attempts),l=uo(t.name,r.nameCharacters),u=typeof t.mood==`string`&&oo.has(t.mood)?t.mood:`idle`,d=typeof t.lastEvent==`string`&&so.has(t.lastEvent)?t.lastEvent:`session_start`,f=typeof t.energy==`number`&&Number.isSafeInteger(t.energy)&&t.energy>=0&&t.energy<=100?t.energy:80;return{name:l||`Pi`,mood:u,energy:f,interactions:lo(t.interactions),lastEvent:d,updatedAt:fo(t.updatedAt),recovery:{sessionEntries:a,scanned:o,truncated:i.truncated===!0||a>o,restored:i.restored===!0},persistence:{attempts:c,failures:Math.min(c,lo(s.failures)),lastError:uo(s.lastError,r.persistenceErrorCharacters)||null},limits:r}}var mo={directoryEntries:4096,sessionBytes:4194304,sessions:100,allowedSessions:500,readConcurrency:8,contentParts:1e3,previewCharacters:500,panelItems:50,toolItems:100,queryCharacters:120,sessionIdCharacters:256,sessionNameCharacters:256,sessionPathCharacters:4096,statusErrorCharacters:2e3};function ho(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function go(e,t,n=t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=n?e:t}function _o(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function vo(e,t,n=``){return typeof e==`string`&&e.replaceAll(`\0`,`�`).slice(0,t)||n}function yo(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function bo(e,t){if(!ho(e))return{state:`idle`,at:null,error:null};let n=e.state===`running`||e.state===`completed`||e.state===`failed`||e.state===`cancelled`?e.state:`idle`,r=yo(e.at);return(n===`completed`||n===`failed`||n===`cancelled`)&&r===null?{state:`idle`,at:null,error:null}:{state:n,at:r,error:(n===`failed`||n===`cancelled`)&&vo(e.error,t)||null}}function xo(e){let t=ho(e)?e:{},n=ho(t.limits)?t.limits:{},r=go(n.allowedSessions,mo.allowedSessions),i={directoryEntries:go(n.directoryEntries,mo.directoryEntries),sessionBytes:go(n.sessionBytes,mo.sessionBytes),sessions:go(n.sessions,Math.min(mo.sessions,r),r),allowedSessions:r,readConcurrency:go(n.readConcurrency,mo.readConcurrency),contentParts:go(n.contentParts,mo.contentParts),previewCharacters:go(n.previewCharacters,mo.previewCharacters),panelItems:go(n.panelItems,mo.panelItems),toolItems:go(n.toolItems,mo.toolItems),queryCharacters:go(n.queryCharacters,mo.queryCharacters),sessionIdCharacters:go(n.sessionIdCharacters,mo.sessionIdCharacters),sessionNameCharacters:go(n.sessionNameCharacters,mo.sessionNameCharacters),sessionPathCharacters:go(n.sessionPathCharacters,mo.sessionPathCharacters),statusErrorCharacters:go(n.statusErrorCharacters,mo.statusErrorCharacters)},a=(Array.isArray(t.items)?t.items:[]).slice(0,i.panelItems).map(e=>{let t=ho(e)?e:{},n=vo(t.id,i.sessionIdCharacters,`unknown`);return{id:n,path:vo(t.path,i.sessionPathCharacters),cwd:vo(t.cwd,i.sessionPathCharacters),name:vo(t.name,i.sessionNameCharacters,n),modified:yo(t.modified),messageCount:_o(t.messageCount,i.sessionBytes),message:vo(t.message,i.previewCharacters)}}),o=ho(t.inventory)?t.inventory:{};return{scans:_o(t.scans,2**53-1),total:_o(t.total,i.sessions),items:a,status:bo(t.status,i.statusErrorCharacters),inventory:{available:_o(o.available,i.directoryEntries),candidates:_o(o.candidates,i.directoryEntries),scanned:_o(o.scanned,i.sessions),unread:_o(o.unread,i.sessions),shown:_o(o.shown,i.panelItems),truncated:o.truncated===!0,discoveryTruncated:o.discoveryTruncated===!0,scanTruncated:o.scanTruncated===!0,displayTruncated:o.displayTruncated===!0},limits:i}}var So={candidates:50,displayCandidates:8,scannedEntries:4096,contentParts:1e3,previewCharacters:500,entryIdCharacters:200,editorTextCharacters:4096,errorCharacters:2e3};function Y(e,t){if(typeof e!=`object`||!e)return;let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}function Co(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function wo(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function To(e,t,n=``){return typeof e==`string`&&e.slice(0,t).replaceAll(`\0`,`�`)||n}function Eo(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Do(e,t){return{entryId:To(Y(e,`entryId`),t.entryIdCharacters,`unknown`),text:To(Y(e,`text`),t.previewCharacters,I(`未命名轮次`))}}function Oo(e,t){let n=Y(e,`entryId`),r=Y(e,`text`);if(typeof n!=`string`||typeof r!=`string`)return;let i={entryId:To(n,t.entryIdCharacters),text:To(r,t.previewCharacters)};return i.entryId===``||i.text===``?void 0:i}function ko(e,t){let n=Y(e,`status`),r=n===`queued`||n===`running`||n===`completed`||n===`failed`||n===`cancelled`?n:void 0;return r===void 0?null:{status:r,target:Do(Y(e,`target`),t),cancelled:Y(e,`cancelled`)===!0,summarized:Y(e,`summarized`)===!0,editorText:To(Y(e,`editorText`),t.editorTextCharacters)||null,error:(r===`failed`||r===`cancelled`)&&To(Y(e,`error`),t.errorCharacters)||null,requestedAt:Eo(Y(e,`requestedAt`)),startedAt:Eo(Y(e,`startedAt`)),finishedAt:Eo(Y(e,`finishedAt`))}}function Ao(e){let t=Y(e,`limits`),n={candidates:Co(Y(t,`candidates`),So.candidates),displayCandidates:So.displayCandidates,scannedEntries:Co(Y(t,`scannedEntries`),So.scannedEntries),contentParts:Co(Y(t,`contentParts`),So.contentParts),previewCharacters:Co(Y(t,`previewCharacters`),So.previewCharacters),entryIdCharacters:Co(Y(t,`entryIdCharacters`),So.entryIdCharacters),editorTextCharacters:Co(Y(t,`editorTextCharacters`),So.editorTextCharacters),errorCharacters:Co(Y(t,`errorCharacters`),So.errorCharacters)},r=Y(e,`candidates`),i=[];if(Array.isArray(r)){let e=Math.max(0,r.length-Math.min(n.candidates,n.displayCandidates));for(let t=e;t<r.length;t+=1){let e=Object.getOwnPropertyDescriptor(r,String(t));if(e===void 0||!(`value`in e))continue;let a=Oo(e.value,n);a!==void 0&&i.push(a)}}let a=Y(e,`inventory`),o=Array.isArray(r)&&r.length>i.length,s=Y(a,`scanTruncated`)===!0,c=Y(a,`candidateTruncated`)===!0;return{candidates:i,inventory:{scannedEntries:wo(Y(a,`scannedEntries`),n.scannedEntries),shown:wo(Y(a,`shown`),n.candidates),truncated:Y(a,`truncated`)===!0||s||c||o,scanTruncated:s,candidateTruncated:c,displayTruncated:o},latest:ko(Y(e,`latest`),n),limits:n}}var jo={scannedMessages:1e4,jsonDepth:64,jsonNodesPerMessage:1e4,jsonNodesPerAudit:1e5,errorCharacters:2e3,recommendationCharacters:500,displayRecommendations:4,warnPercent:75,maxMessageBytes:65536,messageCount:4294967295};function X(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function Mo(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function No(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function Po(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:null}function Fo(e,t){return typeof e==`string`?e.slice(0,t).replaceAll(`\0`,`�`):``}function Io(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Lo(e){let t=X(e,`length`);return typeof t==`number`&&Number.isSafeInteger(t)&&t>=0?t:0}function Ro(e,t){let n=X(e,`status`),r=n===`idle`||n===`queued`||n===`running`||n===`completed`||n===`failed`||n===`cancelled`?n:`unknown`;return{status:r,error:(r===`failed`||r===`cancelled`)&&Fo(X(e,`error`),t)||null,requestedAt:Io(X(e,`requestedAt`)),startedAt:Io(X(e,`startedAt`)),finishedAt:Io(X(e,`finishedAt`))}}function zo(e){let t=X(e,`limits`),n={scannedMessages:Mo(X(t,`scannedMessages`),jo.scannedMessages),jsonDepth:Mo(X(t,`jsonDepth`),jo.jsonDepth),jsonNodesPerMessage:Mo(X(t,`jsonNodesPerMessage`),jo.jsonNodesPerMessage),jsonNodesPerAudit:Mo(X(t,`jsonNodesPerAudit`),jo.jsonNodesPerAudit),errorCharacters:Mo(X(t,`errorCharacters`),jo.errorCharacters),recommendationCharacters:jo.recommendationCharacters,displayRecommendations:jo.displayRecommendations},r=X(e,`status`),i=r===`ok`||r===`warning`?r:`unknown`,a=X(e,`usagePercent`),o=typeof a==`number`&&Number.isFinite(a)&&a>=0?a:null,s=No(X(e,`messageCount`),jo.messageCount),c=No(X(e,`scannedMessages`),Math.min(s,n.scannedMessages)),l=No(X(e,`oversizedMessages`),c),u=No(X(e,`uninspectableMessages`),l),d=No(X(e,`toolErrors`),c),f=X(e,`warnPercent`),p=typeof f==`number`&&Number.isFinite(f)&&f>=1&&f<=100?f:jo.warnPercent,m=Mo(X(e,`maxMessageBytes`),1048576),h=m===1048576&&X(e,`maxMessageBytes`)!==1048576?jo.maxMessageBytes:m,g=X(e,`recommendations`),_=[],v=!1;if(Array.isArray(g)){let e=Lo(g);for(let t=0;t<Math.min(e,n.displayRecommendations);t+=1){let e=Fo(X(g,String(t)),n.recommendationCharacters);if(e===``){v=!0;continue}_.push(e)}v||=e>_.length}return{status:i,usagePercent:o,tokens:Po(X(e,`tokens`)),contextWindow:Po(X(e,`contextWindow`)),messageCount:s,scannedMessages:c,messagesTruncated:X(e,`messagesTruncated`)===!0||s>c,oversizedMessages:l,uninspectableMessages:u,toolErrors:d,warnPercent:p,maxMessageBytes:h,recommendations:_,recommendationsTruncated:v,compaction:Ro(X(e,`compaction`),n.errorCharacters),limits:n}}var Bo={scannedMessages:1e4,retainedEvents:50,displayedEvents:6,eventTypeCharacters:128},Vo=4294967295,Ho=864e13;function Z(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function Uo(e,t=Vo){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function Wo(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:null}function Go(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}function Ko(e){if(typeof e!=`string`)return`unknown`;let t=e.trim().replaceAll(`\0`,`�`);return t===``?`unknown`:t.slice(0,Bo.eventTypeCharacters)}function qo(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=Ho?e:null}function Jo(e){return Array.isArray(e)?Uo(Z(e,`length`),Vo):0}function Yo(e,t){let n={user:Uo(Z(e,`user`),t),assistant:Uo(Z(e,`assistant`),t),toolResult:Uo(Z(e,`toolResult`),t),system:Uo(Z(e,`system`),t),other:Uo(Z(e,`other`),t)};return Object.values(n).reduce((e,t)=>e+t,0)===t?n:{user:0,assistant:0,toolResult:0,system:0,other:t}}function Xo(e){let t;try{t=Jo(e)}catch{return{events:[],truncated:!1}}let n=Math.min(t,Bo.retainedEvents),r=[];for(let i=0;i<Math.min(n,Bo.displayedEvents);i+=1){let n=t-i-1,a=Z(e,String(n));r.push({type:Ko(Z(a,`type`)),at:qo(Z(a,`at`))})}return{events:r,truncated:t>r.length}}function Zo(e){let t=Uo(Z(e,`messages`)),n=Uo(Z(e,`scannedMessages`),Math.min(t,Bo.scannedMessages)),r=Xo(Z(e,`recentEvents`));return{tokens:Wo(Z(e,`tokens`)),contextWindow:Wo(Z(e,`contextWindow`)),percent:Go(Z(e,`percent`)),messages:t,scannedMessages:n,messagesTruncated:Z(e,`messagesTruncated`)===!0||t>n,events:Uo(Z(e,`events`)),compactions:Uo(Z(e,`compactions`)),composition:Yo(Z(e,`composition`),n),recentEvents:r.events,recentEventsTruncated:r.truncated,limits:Bo}}var Qo={maxPercent:90,maxRunTokens:1e7,errorCharacters:2e3,streamingUpdateInterval:32,maxCount:2**53-1};function $o(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function es(e,t=Qo.maxCount){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:null}function ts(e){return typeof e!=`string`||e===``?null:e.replaceAll(`\0`,`�`).slice(0,Qo.errorCharacters)}function ns(e){let t=$o(e,`maxPercent`),n=typeof t==`number`&&Number.isFinite(t)&&t>=1&&t<=100?t:Qo.maxPercent,r=es($o(e,`maxRunTokens`),Qo.maxRunTokens)??0,i=$o(e,`percent`),a=typeof i==`number`&&Number.isFinite(i)&&i>=0?i:null,o=es($o(e,`tokens`)),s=es($o(e,`contextWindow`)),c=s!==null&&s>0?s:null,l=es($o(e,`runTokens`)),u=r>0&&l!==null&&l>=r;return{maxPercent:n,maxRunTokens:r,percent:a,tokens:o,contextWindow:c,runTokens:l,runExceeded:u,exceeded:a!==null&&a>=n||u,aborts:es($o(e,`aborts`))??0,lastError:ts($o(e,`lastError`)),limits:{maxRunTokens:Qo.maxRunTokens,errorCharacters:Qo.errorCharacters,streamingUpdateInterval:Qo.streamingUpdateInterval}}}var rs={packageBytes:262144,packageCharacters:262144,messages:100,messageCharacters:16e3,totalMessageCharacters:64e3,contentParts:1e3,attachments:100,attachmentMarkerCharacters:256,sessionIdCharacters:256,cwdCharacters:4096,modelFieldCharacters:256,previewTextCharacters:1e3,previewListItems:8,duplicateScanEntries:1e4,operationErrorCharacters:2e3};function is(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function as(e,t){return typeof e==`string`?e.slice(0,t):``}function os(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function ss(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:null}function cs(e,t,n){let r=z(e)??{},i=e=>(tn(e,n)??[]).slice(0,n).map(e=>as(e,t)).filter(e=>e!==``);return{goal:as(r.goal,t),currentState:as(r.currentState,t),decisions:i(r.decisions),keyFiles:i(r.keyFiles),nextStep:as(r.nextStep,t)}}function ls(e,t){let n=z(e);if(n===void 0)return null;let r=as(n.sessionId,t.sessionIdCharacters),i=as(n.cwd,t.cwdCharacters);if(r===``||i===``)return null;let a,o=z(n.model);if(o!==void 0){let e=as(o.provider,t.modelFieldCharacters),n=as(o.modelId,t.modelFieldCharacters);e!==``&&n!==``&&(a={provider:e,modelId:n})}return{sessionId:r,cwd:i,...a===void 0?{}:{model:a}}}function us(e,t){let n=z(e);if(n===void 0)return{state:`idle`,operation:null,at:null,error:null};let r=n.state===`idle`||n.state===`running`||n.state===`completed`||n.state===`failed`||n.state===`cancelled`?n.state:`idle`,i=n.operation===`export`||n.operation===`preview`||n.operation===`import`?n.operation:null,a=os(n.at);return r!==`idle`&&i===null||(r===`completed`||r===`failed`||r===`cancelled`)&&a===null?{state:`idle`,operation:null,at:null,error:null}:{state:r,operation:i,at:a,error:(r===`failed`||r===`cancelled`)&&as(n.error,t)||null}}function ds(e){let t=z(e)??{},n=z(t.limits)??{},r=Object.fromEntries(Object.entries(rs).map(([e,t])=>[e,is(n[e],t)])),i=z(t.latest),a=i?.direction===`export`||i?.direction===`import`?i.direction:void 0,o=as(i?.sessionId,r.sessionIdCharacters),s=ss(i?.messages,r.messages),c=ss(i?.attachments,r.attachments),l=os(i?.at),u=a===void 0||o===``||s===null||c===null||l===null?null:{direction:a,sessionId:o,messages:s,attachments:c,at:l},d=z(t.latestPreview),f=d!==void 0&&z(d.preview)!==void 0?d:void 0,p=ls(f?.source,r),m=f===void 0?t.currentPreview:f.preview;return{latest:u,source:f===void 0?null:p,preview:cs(m,r.previewTextCharacters,r.previewListItems),previewAt:f===void 0?null:os(f.at),status:us(t.status,r.operationErrorCharacters),formatVersion:1,limits:r}}var fs={queryCharacters:120,skillBytes:131072,skills:50,panelReports:20,nameCharacters:64,sourceCharacters:128,pathCharacters:4096,statusErrorCharacters:2e3,findingsPerSkill:6,findingCodeCharacters:64,findingMessageCharacters:256,score:28};function ps(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ms(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function hs(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function gs(e,t,n=``){return typeof e==`string`&&e.replaceAll(`\0`,`�`).slice(0,t)||n}function _s(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function vs(e,t){if(!ps(e))return{state:`idle`,at:null,error:null};let n=e.state===`running`||e.state===`completed`||e.state===`failed`||e.state===`cancelled`?e.state:`idle`,r=_s(e.at);return(n===`completed`||n===`failed`||n===`cancelled`)&&r===null?{state:`idle`,at:null,error:null}:{state:n,at:r,error:(n===`failed`||n===`cancelled`)&&gs(e.error,t)||null}}function ys(e){let t=ps(e)?e:{},n=ps(t.limits)?t.limits:{},r=Object.fromEntries(Object.entries(fs).map(([e,t])=>[e,ms(n[e],t)])),i=(Array.isArray(t.reports)?t.reports:[]).slice(0,r.panelReports).map(e=>{let t=ps(e)?e:{},n=t.risk===`safe`||t.risk===`review`||t.risk===`blocked`?t.risk:`review`,i=(Array.isArray(t.findings)?t.findings:[]).slice(0,r.findingsPerSkill).map(e=>{let t=ps(e)?e:{};return{code:gs(t.code,r.findingCodeCharacters,`finding`),severity:t.severity===`high`?`high`:`medium`,message:gs(t.message,r.findingMessageCharacters)}});return{name:gs(t.name,r.nameCharacters,`unknown`),risk:n,score:hs(t.score,r.score),findings:i,path:gs(t.path,r.pathCharacters),source:gs(t.source,r.sourceCharacters,`unknown`),scannedBytes:hs(t.scannedBytes,r.skillBytes)}}),a=ps(t.inventory)?t.inventory:{};return{scans:hs(t.scans,2**53-1),total:hs(t.total,r.skills),blocked:hs(t.blocked,r.skills),review:hs(t.review,r.skills),reports:i,status:vs(t.status,r.statusErrorCharacters),inventory:{available:hs(a.available,2**53-1),scanned:hs(a.scanned,r.skills),shown:hs(a.shown,r.panelReports),truncated:a.truncated===!0,scanTruncated:a.scanTruncated===!0,displayTruncated:a.displayTruncated===!0},limits:r}}var bs=12,xs=32,Ss=512,Cs=16384,ws=2e3,Ts=500,Es={timeoutMs:5e3},Ds={queryLength:65536,databaseBytes:268435456,rows:100,columns:128,stringLength:16384,resultBytes:1048576,blobPreviewBytes:256,panelRows:20},Os=new Set([`status`,`timeoutMs`,`latest`,`limits`]),ks=new Set([`state`,`at`,`error`]),As=new Set([`cwd`,`database`,`query`,`columns`,`rows`,`truncated`,`scannedRows`,`rowInventory`]),js=new Set([`scanned`,`returned`,`shown`,`truncated`,`displayLimit`]),Ms=new Set([`type`,`bytes`,`previewBase64`,`truncated`]),Ns=new Set(Object.keys(Ds)),Ps=/[\p{Cc}\p{Cf}\p{Cs}\u2028\u2029]/u;function Fs(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Is(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function Ls(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Rs(e,t,n=!1,r=!1){if(!(typeof e!=`string`||!n&&e.length===0)){for(let t of e)if(Ps.test(t)&&!(r&&(t===` `||t===`
|
|
25
25
|
`||t===`\r`)))return;if(!(e.length>t))return e}}function zs(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function Bs(e,t){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let n=Object.getOwnPropertyDescriptor(e,`length`),r=n!==void 0&&`value`in n?n.value:void 0;if(!Number.isSafeInteger(r)||r<0||r>t)return;let i=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(i).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)||Number(e)>=r||String(Number(e))!==e))||Object.values(i).some(e=>!(`value`in e)))return;let a=[];for(let e=0;e<r;e+=1){let t=i[String(e)];if(t===void 0||!(`value`in t))return;a.push(t.value)}return a}catch{return}}function Vs(e){let t=Fs(e,ks);if(t===void 0)return;if(t.state===`idle`&&Is(t,new Set([`state`])))return{state:`idle`,at:null,error:null};if(t.state===`running`&&Is(t,new Set([`state`])))return{state:`running`,at:null,error:null};let n=zs(t.at);if(t.state===`completed`&&n!==void 0&&Is(t,new Set([`state`,`at`])))return{state:`completed`,at:n,error:null};if((t.state===`failed`||t.state===`cancelled`)&&n!==void 0&&Is(t,ks)){let e=Rs(t.error,ws);if(e!==void 0)return{state:t.state,at:n,error:[...e].slice(0,Ts).join(``)}}}function Hs(e){if(e===null)return null;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`)return Rs(e,Cs,!0,!0);let t=Fs(e,Ms);if(t===void 0||!Is(t,Ms)||t.type!==`blob`||typeof t.truncated!=`boolean`||typeof t.previewBase64!=`string`||t.previewBase64.length>344||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(t.previewBase64))return;let n=Ls(t.bytes,2**53-1);return n===void 0?void 0:{type:`blob`,bytes:n,previewBase64:t.previewBase64,truncated:t.truncated}}function Us(e){let t=Fs(e,As);if(t===void 0||!Is(t,As))return;let n=Rs(t.cwd,4096),r=Rs(t.database,4096),i=Rs(t.query,Ds.queryLength,!1,!0),a=Bs(t.columns,Ds.columns),o=Bs(t.rows,Ds.panelRows),s=Ls(t.scannedRows,2**53-1),c=Fs(t.rowInventory,js);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===void 0||!Is(c,js)||typeof t.truncated!=`boolean`)return;let l=[];for(let e of a){let t=Rs(e,Ss);if(t===void 0)return;l.push(t)}if(l.length===0||new Set(l).size!==l.length)return;let u=Ls(c.scanned,2**53-1),d=Ls(c.returned,Ds.rows),f=Ls(c.shown,Ds.panelRows);if(u===void 0||d===void 0||f===void 0||u!==s||f!==o.length||f!==Math.min(d,Ds.panelRows)||d>u||c.displayLimit!==Ds.panelRows||typeof c.truncated!=`boolean`)return;let p=[];for(let e of o){let t=Fs(e,new Set(l));if(t===void 0||Object.keys(t).length!==l.length)return;let n=Object.create(null);for(let e of l){let r=Hs(t[e]);if(r===void 0)return;n[e]=r}p.push(n)}let m=p.slice(0,bs);return{cwd:n,database:r,query:i,columns:l.slice(0,xs),rows:m,rowInventory:{scanned:u,returned:d,shown:m.length,truncated:t.truncated||c.truncated||p.length!==d||p.length>m.length||l.length>xs,displayLimit:Ds.panelRows}}}function Ws(e){let t=Fs(e,Ns);return t!==void 0&&Is(t,Ns)&&Object.entries(Ds).every(([e,n])=>t[e]===n)}function Gs(){return{status:{state:`unknown`,at:null,error:null},timeoutMs:Es.timeoutMs,latest:null,malformed:!0,limits:{...Ds}}}function Ks(e){let t=Fs(e,Os);if(t===void 0||!Is(t,Os))return Gs();let n=Ls(t.timeoutMs,3e4);if(n===void 0||n<100||!Ws(t.limits))return Gs();let r=Vs(t.status);if(r===void 0)return Gs();let i=t.latest===null?null:Us(t.latest);return i===void 0||r.state===`idle`&&i!==null||r.state===`completed`&&i===null?Gs():{status:r,timeoutMs:n,latest:i,malformed:!1,limits:{...Ds}}}var qs={members:64,tasks:256,messages:1e3,messageCharacters:4e3,mailboxReadMessages:25,agentTextBytes:32768,stateBytes:8388608,stateScanEntries:1e4,panelMembers:12,panelTasks:20,panelMessages:5},Js=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/u,Ys=new Set([`todo`,`blocked`,`in_progress`,`done`]),Xs=new Set([`idle`,`working`]),Zs=200,Qs=200,$s=200,ec=20,tc=20,nc=20;function rc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ic(e,t,n=0){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:n}function ac(e,t){return typeof e==`string`?e.replaceAll(/\p{Cc}/gu,`�`).slice(0,t):``}function oc(e){return typeof e==`string`&&Js.test(e)?e:void 0}function sc(e){if(!rc(e))return;let t=oc(e.id),n=ac(e.name,Zs);if(t!==void 0&&n!==``)return{id:t,name:n,role:ac(e.role,Qs)||I(`协作成员`),status:typeof e.status==`string`&&Xs.has(e.status)?e.status:`idle`}}function cc(e){if(!rc(e))return;let t=oc(e.id),n=ac(e.title,$s),r=e.assignee===`unassigned`?`unassigned`:oc(e.assignee);if(t!==void 0&&n!==``&&r!==void 0)return{id:t,title:n,assignee:r,status:typeof e.status==`string`&&Ys.has(e.status)?e.status:`todo`,dependsOn:(Array.isArray(e.dependsOn)?e.dependsOn.slice(0,ec):[]).map(oc).filter(e=>e!==void 0)}}function lc(e){if(!rc(e))return;let t=oc(e.id),n=oc(e.from),r=oc(e.to),i=ac(e.body,qs.messageCharacters);if(t===void 0||n===void 0||r===void 0||i===``||typeof e.timestamp!=`string`)return;let a;try{a=new Date(e.timestamp).toISOString()}catch{return}if(a===e.timestamp)return{id:t,from:n,to:r,body:i,timestamp:a,read:e.read===!0}}function uc(e,t){return Array.isArray(e)?e.slice(0,t).map(oc).filter(e=>e!==void 0):[]}function dc(e){if(!rc(e))return!1;if(!Array.isArray(e.dependsOn))return e.dependsOn!==void 0;let t=e.dependsOn.slice(0,ec);return e.dependsOn.length>t.length||t.some(e=>oc(e)===void 0)}function fc(e,t,n,r){let i=rc(e)?e:{},a=Math.max(t,ic(i.total,n,t));return{total:a,shown:t,truncated:i.truncated===!0||r||a>t}}function pc(e){let t=rc(e)?e:{},n=Array.isArray(t.members)?t.members:[],r=Array.isArray(t.tasks)?t.tasks:[],i=Array.isArray(t.messages)?t.messages:[],a=n.slice(0,qs.panelMembers),o=r.slice(0,qs.panelTasks),s=i.slice(0,qs.panelMessages),c=a.map(sc).filter(e=>e!==void 0),l=o.map(cc).filter(e=>e!==void 0),u=s.map(lc).filter(e=>e!==void 0),d=uc(t.readyTasks,tc),f=Array.isArray(t.dependencyCycle)?uc(t.dependencyCycle,nc):null,p=t.members!==void 0&&!Array.isArray(t.members)||n.length>a.length||c.length!==a.length,m=t.tasks!==void 0&&!Array.isArray(t.tasks)||r.length>o.length||l.length!==o.length||o.some(dc)||t.readyTasks!==void 0&&!Array.isArray(t.readyTasks)||Array.isArray(t.readyTasks)&&t.readyTasks.length>d.length||t.dependencyCycle!==void 0&&t.dependencyCycle!==null&&!Array.isArray(t.dependencyCycle)||Array.isArray(t.dependencyCycle)&&t.dependencyCycle.length>(f?.length??0),h=t.messages!==void 0&&!Array.isArray(t.messages)||i.length>s.length||u.length!==s.length,g=p||m||h,_=rc(t.inventory)?t.inventory:{},v=fc(_.members,c.length,qs.members,p),y=fc(_.tasks,l.length,qs.tasks,m),b=rc(_.tasks)?_.tasks:{},x=Math.max(d.length,ic(b.ready,y.total,d.length)),S=rc(_.messages)?_.messages:{},C=fc(S,u.length,qs.messages,h),w=u.filter(e=>!e.read).length,T=ic(S.unread,C.total,w),E=rc(t.history)?t.history:{},D=ic(E.available,2**53-1),ee=ic(E.scanned,D);return{members:c,tasks:l,messages:u,readyTasks:d,dependencyCycle:f,inventory:{members:v,tasks:{...y,ready:x},messages:{...C,unread:T}},history:{available:D,scanned:ee,truncated:E.truncated===!0,restored:E.restored===!0},limits:qs,truncated:g}}var mc=[`png`,`jpeg`,`jpg`,`gif`,`webp`],hc=new Set(mc),gc=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),_c=2e3,vc={imageBytes:10485760,pathCharacters:4096,promptCharacters:4e3,evidenceBytes:524288,agentTextBytes:131072,timeoutMs:18e4,cacheEntries:64},yc=1e3,bc=3e5;function xc(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function Sc(e,t){if(typeof e!=`string`)return{value:void 0,altered:!0};let n=e.slice(0,t*2+1).replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,t);return{value:n===``?void 0:n,altered:n!==e}}function Cc(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function wc(e,t=[]){let n=xc(e);if(n===void 0)return{image:null,altered:e!==null};let r=n.mode===`native`||n.mode===`evidence`?n.mode:void 0,i=Sc(n.path,vc.pathCharacters),a=typeof n.mimeType==`string`&&gc.has(n.mimeType)?n.mimeType:void 0,o=typeof n.bytes==`number`&&Number.isSafeInteger(n.bytes)&&n.bytes>=0&&n.bytes<=vc.imageBytes?n.bytes:void 0,s=typeof n.cached==`boolean`&&!(r===`native`&&n.cached)?n.cached:void 0,c=Cc(n.at),l=new Set([`mode`,`path`,`mimeType`,`bytes`,`cached`,`at`,...t]),u=i.altered||Object.keys(n).some(e=>!l.has(e));return r===void 0||i.value===void 0||a===void 0||o===void 0||s===void 0||c===void 0?{image:null,altered:!0}:{image:{mode:r,path:i.value,mimeType:a,bytes:o,cached:s,at:c},altered:u}}function Tc(e){let t=xc(e);if(t===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`idle`)return{status:{state:`idle`},altered:Object.keys(t).some(e=>e!==`state`)};if(t.state===`completed`){let e=wc(t,[`state`]);return e.image===null?{status:{state:`idle`},altered:!0}:{status:{state:`completed`,...e.image},altered:e.altered}}if(t.state!==`running`&&t.state!==`failed`&&t.state!==`cancelled`)return{status:{state:`idle`},altered:!0};let n=t.mode===`native`||t.mode===`evidence`?t.mode:void 0,r=Sc(t.path,vc.pathCharacters),i=Cc(t.at);if(n===void 0||r.value===void 0||i===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`running`){let e=r.altered||Object.keys(t).some(e=>!new Set([`state`,`mode`,`path`,`at`]).has(e));return{status:{state:`running`,mode:n,path:r.value,at:i},altered:e}}let a=Sc(t.error,_c);if(a.value===void 0)return{status:{state:`idle`},altered:!0};let o=r.altered||a.altered||Object.keys(t).some(e=>!new Set([`state`,`mode`,`path`,`at`,`error`]).has(e));return{status:{state:t.state,mode:n,path:r.value,at:i,error:a.value},altered:o}}function Ec(e){try{if(!Array.isArray(e))return!1;let t=Object.getOwnPropertyDescriptor(e,`length`);if(t===void 0||!(`value`in t)||t.value!==mc.length)return!1;let n=new Set;for(let t=0;t<mc.length;t+=1){let r=Object.getOwnPropertyDescriptor(e,String(t));if(r===void 0||!(`value`in r)||typeof r.value!=`string`||!hc.has(r.value))return!1;n.add(r.value)}return n.size===mc.length}catch{return!1}}function Dc(e){let t=xc(e);if(t===void 0)return{attached:!1,image:null,status:{state:`idle`},supportedTypes:[...mc],limits:{...vc},truncated:!0};let n=wc(t.image),r=Tc(t.status),i=r.status.state!==`completed`||n.image!==null&&r.status.mode===n.image.mode&&r.status.path===n.image.path&&r.status.mimeType===n.image.mimeType&&r.status.bytes===n.image.bytes&&r.status.cached===n.image.cached&&r.status.at===n.image.at,a=xc(t.limits),o=a!==void 0&&typeof a.timeoutMs==`number`&&Number.isSafeInteger(a.timeoutMs)&&a.timeoutMs>=yc&&a.timeoutMs<=bc?a.timeoutMs:vc.timeoutMs,s=[`imageBytes`,`pathCharacters`,`promptCharacters`,`evidenceBytes`,`agentTextBytes`,`cacheEntries`],c=a===void 0||s.some(e=>a[e]!==vc[e])||Object.keys(a).some(e=>![...s,`timeoutMs`].includes(e))||o!==a.timeoutMs,l=n.image!==null,u=new Set([`attached`,`image`,`status`,`supportedTypes`,`limits`]),d=n.altered||r.altered||!i||c||!Ec(t.supportedTypes)||t.attached!==l||Object.keys(t).some(e=>!u.has(e));return{attached:l,image:n.image,status:r.status,supportedTypes:[...mc],limits:{...vc,timeoutMs:o},truncated:d}}var Oc=[`png`,`jpeg`,`jpg`,`gif`,`webp`],kc=new Set(Oc),Ac=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),Q={imageBytes:20971520,headerBytes:262144,pathCharacters:4096,assets:100,imageCandidates:256,scannedEntries:4096,scannedDirectories:512,depth:16,issues:20,issueCharacters:500,agentTextBytes:16384};function jc(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function Mc(e,t){try{if(!Array.isArray(e))return;let n=Object.getOwnPropertyDescriptor(e,`length`);if(n===void 0||!(`value`in n)||!Number.isSafeInteger(n.value)||n.value<0)return;let r=Math.min(n.value,t),i=[];for(let t=0;t<r;t+=1){let n=Object.getOwnPropertyDescriptor(e,String(t));if(n===void 0||!(`value`in n))return;i.push(n.value)}return{values:i,altered:n.value>t}}catch{return}}function Nc(e,t){if(typeof e!=`string`)return{value:void 0,altered:!0};let n=e.slice(0,t*2+1).replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,t);return{value:n===``?void 0:n,altered:n!==e}}function Pc(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Fc(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function Ic(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function Lc(e){let t=jc(e);if(t===void 0)return{asset:void 0,altered:!0};let n=Nc(t.path,Q.pathCharacters),r=typeof t.mimeType==`string`&&Ac.has(t.mimeType)?t.mimeType:void 0,i=Pc(t.bytes,Q.imageBytes),a=r===`image/png`?2147483647:r===`image/webp`?16777216:65535,o=t.width===null?null:Pc(t.width,a),s=t.height===null?null:Pc(t.height,a),c=typeof t.headerTruncated==`boolean`?t.headerTruncated:void 0,l=typeof o==`number`&&o>0&&typeof s==`number`&&s>0||o===null&&s===null&&c===!0&&r===`image/jpeg`,u=n.altered||!Ic(t,[`path`,`mimeType`,`bytes`,`width`,`height`,`headerTruncated`]);return n.value===void 0||r===void 0||i===void 0||c===void 0||!l?{asset:void 0,altered:!0}:{asset:{path:n.value,mimeType:r,bytes:i,width:o,height:s,headerTruncated:c},altered:u}}function Rc(e){let t=jc(e);if(t===void 0)return{issue:void 0,altered:!0};let n=Nc(t.path,Q.pathCharacters),r=Nc(t.reason,Q.issueCharacters),i=n.altered||r.altered||!Ic(t,[`path`,`reason`]);return n.value===void 0||r.value===void 0?{issue:void 0,altered:!0}:{issue:{path:n.value,reason:r.value},altered:i}}function zc(e){if(e===null)return{report:null,altered:!1};let t=jc(e);if(t===void 0)return{report:null,altered:!0};let n=Mc(t.assets,Q.assets),r=Mc(t.issues,Q.issues);if(n===void 0||r===void 0)return{report:null,altered:!0};let i=[],a=[],o=n.altered||r.altered;for(let e of n.values){let t=Lc(e);o||=t.altered,t.asset!==void 0&&i.push(t.asset)}for(let e of r.values){let t=Rc(e);o||=t.altered,t.issue!==void 0&&a.push(t.issue)}let s=Pc(t.inspectedCandidates,Q.imageCandidates),c=Pc(t.scannedEntries,Q.scannedEntries),l=Pc(t.scannedDirectories,Q.scannedDirectories),u=typeof t.truncated==`boolean`?t.truncated:void 0,d=typeof t.issuesTruncated==`boolean`?t.issuesTruncated:void 0,f=s!==void 0&&c!==void 0&&l!==void 0&&s<=c&&i.length<=s&&a.length<=c&&(d===!0||i.length+a.length<=c);return o||=!Ic(t,[`assets`,`issues`,`inspectedCandidates`,`scannedEntries`,`scannedDirectories`,`truncated`,`issuesTruncated`]),!f||u===void 0||d===void 0?{report:null,altered:!0}:{report:{assets:i,issues:a,inspectedCandidates:s,scannedEntries:c,scannedDirectories:l,truncated:u,issuesTruncated:d},altered:o}}function Bc(e){let t=jc(e);if(t===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`idle`)return{status:{state:`idle`},altered:!Ic(t,[`state`])};let n=t.operation===`catalog`||t.operation===`info`?t.operation:void 0,r=Fc(t.at),i=t.path===void 0?{value:void 0,altered:!1}:Nc(t.path,Q.pathCharacters),a=n===`catalog`?t.path===void 0:i.value!==void 0;if(n===void 0||r===void 0||!a)return{status:{state:`idle`},altered:!0};let o=i.value;if(t.state===`running`)return{status:{state:`running`,operation:n,...o===void 0?{}:{path:o},at:r},altered:i.altered||!Ic(t,[`state`,`operation`,...n===`info`?[`path`]:[],`at`])};if(t.state===`completed`){let e=Pc(t.count,Q.assets);return e===void 0||typeof t.truncated!=`boolean`?{status:{state:`idle`},altered:!0}:{status:{state:`completed`,operation:n,...o===void 0?{}:{path:o},count:e,truncated:t.truncated,at:r},altered:i.altered||!Ic(t,[`state`,`operation`,...n===`info`?[`path`]:[],`count`,`truncated`,`at`])}}if(t.state===`failed`||t.state===`cancelled`){let e=Nc(t.error,Q.issueCharacters);return e.value===void 0?{status:{state:`idle`},altered:!0}:{status:{state:t.state,operation:n,...o===void 0?{}:{path:o},error:e.value,at:r},altered:i.altered||e.altered||!Ic(t,[`state`,`operation`,...n===`info`?[`path`]:[],`error`,`at`])}}return{status:{state:`idle`},altered:!0}}function Vc(e){let t=Mc(e,Oc.length);return t===void 0||t.altered||t.values.some(e=>typeof e!=`string`)?!1:new Set(t.values).size===Oc.length&&t.values.every(e=>kc.has(e))}function Hc(e){let t=jc(e);return t===void 0||!Ic(t,Object.keys(Q))?!1:Object.entries(Q).every(([e,n])=>t[e]===n)}function Uc(e){let t=jc(e);if(t===void 0)return{status:{state:`idle`},report:null,supportedTypes:[...Oc],limits:{...Q},truncated:!0};let n=Bc(t.status),r=zc(t.report),i=n.status.state!==`completed`||r.report!==null&&n.status.count===r.report.assets.length&&n.status.truncated===r.report.truncated&&(n.status.operation===`catalog`||n.status.path===r.report.assets[0]?.path&&n.status.count===1),a=n.altered||r.altered||!i||!Vc(t.supportedTypes)||!Hc(t.limits)||!Ic(t,[`status`,`report`,`supportedTypes`,`limits`]);return{status:n.status,report:r.report,supportedTypes:[...Oc],limits:{...Q},truncated:a}}var Wc={nameCharacters:256,pathCharacters:512,scripts:256,plugins:256,errorCharacters:2e3},Gc=1048576,Kc=new Set([`generated`,`name`,`scripts`,`plugins`,`lastWrite`,`status`]),qc=new Set([`path`,`bytes`,`overwritten`]),Jc=new Set([`state`,`operation`,`at`,`error`]);function Yc(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Xc(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Zc(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function Qc(e){if(!(typeof e!=`string`||e.length===0||[...e].length>Wc.nameCharacters)&&!(new TextEncoder().encode(e).byteLength>512||/[\p{Cc}\p{Cf}\p{Cs}]/u.test(e)))return e}function $c(e){if(typeof e!=`string`||e===``||e!==e.trim()||[...e].length>Wc.pathCharacters||new TextEncoder().encode(e).byteLength>Wc.pathCharacters||/[\\\p{Cc}\p{Cf}\p{Cs}]/u.test(e))return;let t=e.split(`/`);if(t.some(e=>e===``||e===`.`||e===`..`||e!==e.trim()))return;let n=t.at(-1);return n!==void 0&&/^README(?:[._-][^/]*)?\.md$/iu.test(n)?e:void 0}function el(e){let t=Yc(e,Jc);if(t===void 0)return;let n=t.state,r=t.operation,i=t.at,a=t.error,o=Object.hasOwn(t,`operation`),s=Object.hasOwn(t,`at`),c=Object.hasOwn(t,`error`);if(n===`idle`&&!o&&!s&&!c)return{state:n,operation:null,at:null,error:null};if(n===`running`&&(r===`report`||r===`write`)&&!s&&!c)return{state:n,operation:r,at:null,error:null};let l=Zc(i);if(n===`completed`&&(r===`report`||r===`write`)&&l!==void 0&&!c)return{state:n,operation:r,at:l,error:null};if((n===`failed`||n===`cancelled`)&&(r===`report`||r===`write`)&&l!==void 0&&typeof a==`string`&&a.length>0&&a.length<=Wc.errorCharacters&&!/[\p{Cc}\p{Cf}\p{Cs}]/u.test(a))return{state:n,operation:r,at:l,error:a}}function tl(){return{generated:null,lastWrite:null,status:{state:`unknown`,operation:null,at:null,error:null},malformed:!0,limits:{...Wc}}}function nl(e){let t=Yc(e,Kc);if(t===void 0||typeof t.generated!=`boolean`)return tl();let n=el(t.status);if(n===void 0)return tl();let r=null;if(t.generated){let e=Qc(t.name),n=Xc(t.scripts,Wc.scripts),i=Xc(t.plugins,Wc.plugins);if(e===void 0||n===void 0||i===void 0)return tl();r={name:e,scripts:n,plugins:i}}else if(Object.hasOwn(t,`name`)||Object.hasOwn(t,`scripts`)||Object.hasOwn(t,`plugins`))return tl();let i=null;if(t.lastWrite!==null){let e=Yc(t.lastWrite,qc),n=$c(e?.path),r=Xc(e?.bytes,Gc),a=e?.overwritten;if(e===void 0||n===void 0||r===void 0||typeof a!=`boolean`)return tl();i={path:n,bytes:r,overwritten:a}}return!t.generated&&i!==null||n.state===`idle`&&(t.generated||i!==null)||n.state===`completed`&&(!t.generated||n.operation===`write`&&i===null)?tl():{generated:r,lastWrite:i,status:n,malformed:!1,limits:{...Wc}}}var $=(e,t=`—`)=>{if(e==null||e===``)return t;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},rl=[`button:not([disabled])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function il(e,t,n=!1,r){let i=(0,o.useRef)(null),a=(0,o.useRef)(t),s=(0,o.useRef)(n);return a.current=t,s.current=n,(0,o.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement?t:void 0,o=()=>Array.from(i.current?.querySelectorAll(rl)??[]).filter(e=>!e.hidden&&e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0),c=window.requestAnimationFrame(()=>{let e=i.current;!e||e.contains(document.activeElement)||(e.querySelector(`[data-dialog-initial-focus]`)??o()[0])?.focus()}),l=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopImmediatePropagation(),s.current||a.current();return}if(e.key!==`Tab`)return;let t=o();if(!t.length){e.preventDefault(),i.current?.focus();return}let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())};return window.addEventListener(`keydown`,l,!0),()=>{window.cancelAnimationFrame(c),window.removeEventListener(`keydown`,l,!0);let e=n?.isConnected?n:r?document.querySelector(r):void 0;e&&window.requestAnimationFrame(()=>e.focus())}},[e,r]),i}var al=(e,t)=>e?.cwd??(typeof t?.sessionFile==`string`?t.sessionFile:I(`未选择工作区`)),ol=120,sl=e=>{let t=$(e.type,``);if(t===`file_diff`)return I(`文件差异`);if(t===`file`)return I(`文件详情`);if(typeof e.summary==`string`&&e.summary!==``)return nu(e.summary,ol);let n=typeof e.message==`object`&&e.message!==null?e.message:void 0;if(n!==void 0){let e=$(n.role,`message`),t=St(n)||Ct(n);return t?nu(`${e}: ${t}`,ol):e}if(typeof e.toolName==`string`&&e.toolName!==``){let t=e.args===void 0?nu(ht(e.result)??``,ol):su(e.args);return t?nu(`${e.toolName} · ${t}`,ol):e.toolName}return lt(t)},cl=e=>[[`context`,I(`上下文`)],[`agent-teams`,I(`协作`)],[`modlens`,I(`视觉`)],[`token-guard`,I(`预算`)],[`git-time-capsule`,I(`版本控制`)],[`dependency-checker`,I(`工程诊断`)],[`at-file`,I(`文件上下文`)],[`test-harness`,I(`测试`)],[`session-insights`,I(`会话统计`)],[`session-compare`,I(`会话对比`)],[`secure-audit`,I(`安全审计`)],[`readme-gen`,I(`文档生成`)],[`i18n-pair`,I(`国际化`)],[`cleaner`,I(`清理`)],[`sql-lens`,I(`数据库`)],[`docker-sandbox`,I(`沙箱`)],[`mcp-client`,I(`工具协议`)],[`mcp-panel`,I(`MCP 控制台`)],[`browser-fetch`,I(`网页抓取`)],[`web-research`,I(`联网研究`)],[`browser-session`,I(`浏览器会话`)],[`yaml-validator`,I(`配置校验`)],[`mock-server`,I(`接口模拟`)],[`cli-notifier`,I(`桌面通知`)],[`obsidian-sync`,I(`知识库`)],[`context-doctor`,I(`上下文诊断`)],[`history-compressor`,I(`历史压缩`)],[`reviewer-bot`,I(`代码审查`)],[`auto-mode`,I(`安全执行`)],[`plan-execute`,I(`计划执行`)],[`plugin-finder`,I(`插件发现`)],[`taskboard`,I(`任务看板`)],[`synapse`,I(`会话地图`)],[`hol-guard`,I(`安全防护`)],[`plugin-radar`,I(`生态雷达`)],[`plugin-stars`,I(`排行榜`)],[`plugin-check`,I(`插件体检`)],[`annotation`,I(`批注上下文`)],[`cost-meter`,I(`成本账本`)],[`undo-savepoint`,I(`恢复保存点`)],[`skill-catalog`,I(`技能目录`)],[`graph-memory`,I(`知识图谱`)],[`memory`,I(`跨会话记忆`)],[`canvas-draw`,I(`流程图`)],[`image-compressor`,I(`图片压缩`)],[`workspace-search`,I(`工作区检索`)],[`prompt-guard`,I(`提示词防护`)],[`code2skill`,I(`技能打包`)],[`tab-manager`,I(`会话标签`)],[`genui`,I(`结构化界面`)],[`anchored-standard`,I(`轨迹锚定`)],[`telemetry-blocker`,I(`遥测拦截`)],[`change-verifier`,I(`变更门禁`)],[`plugin-dev`,I(`插件开发`)],[`openpets`,I(`桌面伙伴`)],[`vision-toolkit`,I(`视觉素材`)],[`session-bridge`,I(`会话交接`)],[`skill-guard`,I(`Skill 安全`)],[`recall-unread`,I(`会话召回`)],[`turn-rewind`,I(`会话回退`)],[`session-export`,I(`会话导出`)],[`session-search`,I(`会话搜索`)],[`session-bookmarks`,I(`会话书签`)],[`llm-verifier`,I(`模型校验`)],[`module-search`,I(`模块检索`)],[`workspace-navigator`,I(`工作区导航`)],[`better-sidebar`,I(`侧栏概览`)],[`archify`,I(`架构地图`)],[`mirage-bridge`,I(`Mirage 虚拟终端`)],[`theme-studio`,I(`主题`)],[`reverse-skill`,I(`技能隔离`)],[`colleague-skill`,I(`角色交接`)],[`prompt-library`,I(`提示词库`)],[`model`,I(`模型`)],[`tool`,I(`工具`)],[`session`,I(`会话`)],[`resource`,I(`资源`)],[`web`,I(`界面`)],[`gateway`,I(`界面`)]].find(([t])=>e.includes(t))?.[1]??I(`运行时`),ll=`restart-required`;function ul(){return I(`改动已写入 profile(~/.pi-harness/profiles/<profile>/cordis.yml)。控制台无法自行重启,请回到启动 Pi Harness 的终端按 Ctrl-C,再用原来的命令重新启动;在那之前这次改动不会生效,刚安装的插件也不会出现在「已安装」列表里。`)}var dl=new Map([[`Another marketplace plugin change is already running`,`已有插件操作正在进行,请等它完成后重试。`],[`Plugin installation is unavailable for this runtime`,`当前运行时不支持安装插件:请用带 profile 的方式启动 Pi Harness 后重试。`],[`Plugin configuration is unavailable for this runtime`,`当前运行时不支持修改插件配置:请用带 profile 的方式启动 Pi Harness 后重试。`],[`Plugin is already installed`,`这个插件已经安装过了,可以在「已安装」列表里管理它。`],[`Marketplace plugin was not found`,`插件市场里没有这个插件,它可能已经下架,请刷新页面。`],[`Installed plugin was not found`,`运行配置里没有这个插件,它可能已被移除,请刷新页面。`],[`Built-in plugins cannot be changed`,`内置插件由运行时管理,不能启用或停用。`],[`Only marketplace plugins can be uninstalled`,`只有从插件市场安装的插件才能卸载。`]]);function fl(e){let t=e.trim(),n=dl.get(t);if(n!==void 0)return I(n);let r=/^Request failed with status (\d+)$/u.exec(t);return r===null?e:I(`请求失败(HTTP {status}):请确认 Pi Harness 仍在运行,然后重试。`,{status:r[1]??``})}function pl(e,t,n){if(!t||!e.ctrlKey||e.metaKey||e.shiftKey||e.key.toLowerCase()!==`c`||n.trim().length>0)return!1;let r=e.target;return typeof r?.selectionStart!=`number`||typeof r.selectionEnd!=`number`||r.selectionStart===r.selectionEnd}function ml(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=`${i&&!/\s$/u.test(i)?` `:``}${n} `;return{text:`${i}${a}${e.slice(r)}`,caret:i.length+a.length}}var hl=`pi-harness.restart-pending-plugins`,gl={packages:new Set,process:``};function _l(e){if(e===void 0)return gl;try{let t=e.getItem(hl);if(t===null)return gl;let n=JSON.parse(t),r=Array.isArray(n)?{packages:n,process:``}:n,i=Array.isArray(r.packages)?r.packages.filter(e=>typeof e==`string`):[];return{packages:new Set(i),process:typeof r.process==`string`?r.process:``}}catch{return gl}}function vl(e,t){if(e!==void 0)try{e.setItem(hl,JSON.stringify({packages:[...t.packages],process:t.process}))}catch{}}function yl(e,t){return t===``||e.process===t?e:e.packages.size===0?{packages:e.packages,process:t}:{packages:new Set,process:t}}function bl(e,t){let n=[...e].filter(e=>!t.has(e));return n.length===e.size?e:new Set(n)}function xl(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var Sl=e=>{let t=new Map([[`@pi-harness/plugin-context`,`Context insights`],[`@pi-harness/plugin-agent-teams`,`Agent Teams`],[`@pi-harness/plugin-modlens`,`ModLens vision bridge`],[`@pi-harness/plugin-token-guard`,`Token Guard`],[`@pi-harness/plugin-git-time-capsule`,`Git Time Capsule`],[`@pi-harness/plugin-dependency-checker`,`Dependency Checker`],[`@pi-harness/plugin-at-file`,`@file context`],[`@pi-harness/plugin-fail-logger`,`Failure Logger`],[`@pi-harness/plugin-test-harness`,`Test Harness`],[`@pi-harness/plugin-session-insights`,`Session Insights`],[`@pi-harness/plugin-session-compare`,`Session Compare`],[`@pi-harness/plugin-secure-audit`,`Secure Audit`],[`@pi-harness/plugin-readme-gen`,`README Generator`],[`@pi-harness/plugin-i18n-pair`,`I18n Pair`],[`@pi-harness/plugin-cleaner`,`Harness Cleaner`],[`@pi-harness/plugin-sql-lens`,`SQL Lens`],[`@pi-harness/plugin-docker-sandbox`,`Docker Sandbox`],[`@pi-harness/plugin-mcp-client`,`MCP Client`],[`@pi-harness/plugin-mcp-panel`,`MCP Console`],[`@pi-harness/plugin-browser-fetch`,`Browser Fetch`],[`@pi-harness/plugin-web-research`,`Web Research`],[`@pi-harness/plugin-browser-session`,`Browser Session`],[`@pi-harness/plugin-yaml-validator`,`YAML Validator`],[`@pi-harness/plugin-mock-server`,`Mock Server`],[`@pi-harness/plugin-cli-notifier`,`CLI Notifier`],[`@pi-harness/plugin-obsidian-sync`,`Obsidian Sync`],[`@pi-harness/plugin-context-doctor`,`Context Doctor`],[`@pi-harness/plugin-history-compressor`,`History Compressor`],[`@pi-harness/plugin-reviewer-bot`,`Reviewer Bot`],[`@pi-harness/plugin-auto-mode`,`Auto Mode`],[`@pi-harness/plugin-plan-execute`,`Plan Execute`],[`@pi-harness/plugin-plugin-finder`,`Plugin Finder`],[`@pi-harness/plugin-taskboard`,`Taskboard`],[`@pi-harness/plugin-synapse`,`Synapse`],[`@pi-harness/plugin-hol-guard`,`HOL Guard`],[`@pi-harness/plugin-plugin-radar`,`Plugin Radar`],[`@pi-harness/plugin-plugin-check`,`Plugin Check`],[`@pi-harness/plugin-annotation`,`Annotations`],[`@pi-harness/plugin-cost-meter`,`Cost Meter`],[`@pi-harness/plugin-undo-savepoint`,`Undo Savepoints`],[`@pi-harness/plugin-skill-catalog`,`Skills Catalog`],[`@pi-harness/plugin-memory`,`Memory`],[`@pi-harness/plugin-graph-memory`,`Graph Memory`],[`@pi-harness/plugin-canvas-draw`,`Canvas Draw`],[`@pi-harness/plugin-image-compressor`,`Image Compressor`],[`@pi-harness/plugin-workspace-search`,`Workspace Search`],[`@pi-harness/plugin-prompt-guard`,`Prompt Guard`],[`@pi-harness/plugin-code2skill`,`Code2Skill`],[`@pi-harness/plugin-tab-manager`,`Session Tabs`],[`@pi-harness/plugin-genui`,`GenUI`],[`@pi-harness/plugin-anchored-standard`,`Anchored Standard`],[`@pi-harness/plugin-telemetry-blocker`,`Telemetry Blocker`],[`@pi-harness/plugin-change-verifier`,`Change Verifier`],[`@pi-harness/plugin-plugin-dev`,`Plugin Dev`],[`@pi-harness/plugin-openpets`,`OpenPets`],[`@pi-harness/plugin-vision-toolkit`,`Vision Toolkit`],[`@pi-harness/plugin-plugin-stars`,`Plugin Stars`],[`@pi-harness/plugin-session-bridge`,`Session Bridge`],[`@pi-harness/plugin-skill-guard`,`Skill Guard`],[`@pi-harness/plugin-recall-unread`,`Recall Unread`],[`@pi-harness/plugin-turn-rewind`,`Turn Rewind`],[`@pi-harness/plugin-session-export`,`Session Export`],[`@pi-harness/plugin-session-search`,`Session Search`],[`@pi-harness/plugin-session-bookmarks`,`Session Bookmarks`],[`@pi-harness/plugin-llm-verifier`,`LLM Verifier`],[`@pi-harness/plugin-module-search`,`Module Search`],[`@pi-harness/plugin-workspace-navigator`,`Workspace Navigator`],[`@pi-harness/plugin-better-sidebar`,`Better Sidebar`],[`@pi-harness/plugin-archify`,`Architecture Map`],[`@pi-harness/plugin-mirage-bridge`,`Mirage Bridge`],[`@pi-harness/plugin-theme-studio`,`Theme Studio`],[`@pi-harness/plugin-reverse-skill`,`Reverse Skill Firewall`],[`@pi-harness/plugin-colleague-skill`,`Colleague Skill`],[`@pi-harness/plugin-prompt-library`,`Prompt Library`],[`@pi-harness/plugin-runtime-doctor`,`Runtime Doctor`]]).get(e);if(t!==void 0)return t;let n=e.match(/^@[^/]+\/cordis-plugin-(.+)$/i);return n?I(`官方 · {scope}`,{scope:n[1]??``}):e.toLowerCase().includes(`cordis`)?e.replace(/cordis/gi,`runtime`):e},Cl=()=>{if(typeof window>`u`)return{page:`session`,view:`chat`,marketplaceQuery:``,marketplaceCapability:``,marketplaceCategory:``,marketplacePlugin:void 0,installedPlugin:void 0,marketplacePage:0};let e=new URLSearchParams(window.location.search),t=e.get(`page`),n=e.get(`view`),r=e.get(`settings`),i=t===`plugins`||t===`marketplace`?t:`session`,a=n===`trajectory`||n===`files`?n:`chat`,o=r===`providers`||r===`toml`||r===`general`?r:void 0,s=Number.parseInt(e.get(`marketplacePage`)??`0`,10);return{page:i,view:a,settings:o,sessionPath:e.get(`session`)??void 0,marketplaceQuery:e.get(`marketplaceQuery`)??``,marketplaceCapability:e.get(`capability`)??``,marketplaceCategory:e.get(`category`)??``,marketplacePlugin:Mt(e),installedPlugin:Xr(e),marketplacePage:Number.isFinite(s)&&s>=0?s:0}},wl=[`today`,`yesterday`,`earlier`];function Tl(e){return I(e===`today`?`今天`:e===`yesterday`?`昨天`:`更早`)}function El(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=new Map;for(let t of e){let e=t.modified??t.created,a=typeof e==`number`?e:typeof e==`string`?Date.parse(e):NaN,o=Number.isFinite(a)&&a>=n?`today`:Number.isFinite(a)&&a>=r?`yesterday`:`earlier`;i.set(o,[...i.get(o)??[],t])}return wl.flatMap(e=>{let t=i.get(e);return t?.length?[[e,t]]:[]})}function Dl({status:e,workspaces:t,onCreate:n,onStarter:r,onToml:i}){let a=[[I(`定位问题`),I(`分析当前仓库并给出根因`)],[I(`修复并测试`),I(`实现修复并运行相关测试`)],[I(`审查改动`),I(`只读检查未提交变更`)],[I(`解释代码`),I(`解释当前文件的关键逻辑`)]];return(0,j.jsxs)(`div`,{className:`new-session-screen`,children:[(0,j.jsx)(`div`,{className:`welcome-kicker`,children:`PI AGENT HARNESS · REAL RUNTIME`}),(0,j.jsxs)(`div`,{className:`welcome-heading`,children:[(0,j.jsx)(`span`,{className:`pi-mark large`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:I(`开始一个工作会话`)}),(0,j.jsx)(`p`,{children:I(`连接当前工作区,直接让 Pi agent 读取、修改并验证代码。`)})]})]}),(0,j.jsx)(`div`,{className:`workspace-picker`,children:t.length?t.map(t=>(0,j.jsxs)(`button`,{className:`workspace-row`,onClick:()=>n(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`workspace-status ${t.current?`live`:`offline`}`,children:t.current?I(`已连接`):I(`工作区`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`code`,{children:t.path}),(0,j.jsx)(`small`,{children:t.current&&e?`${t.branch} · ${e.model}`:t.branch})]}),(0,j.jsx)(`span`,{className:`workspace-arrow`,children:`↗`})]},t.path)):(0,j.jsxs)(`div`,{className:`workspace-row is-empty`,children:[(0,j.jsx)(`span`,{className:`workspace-status offline`,children:I(`加载中`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`code`,{children:e?.cwd??I(`加载工作区…`)}),(0,j.jsx)(`small`,{children:I(`正在读取 git worktree`)})]})]})}),(0,j.jsxs)(`div`,{className:`effective-config`,children:[(0,j.jsx)(`span`,{className:`config-label`,children:I(`当前运行时`)}),(0,j.jsx)(`span`,{children:e?.model??I(`由运行时提供`)}),(0,j.jsx)(`span`,{children:e?I(`{count} 条消息`,{count:e.messages}):`—`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),i()},children:I(`改配置 ⌘,`)})]}),(0,j.jsx)(`div`,{className:`starter-grid`,children:a.map(([e,t])=>(0,j.jsxs)(`button`,{className:`starter-card`,onClick:()=>r(t),type:`button`,children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:t})]},e))})]})}function Ol({workspaces:e,onSelect:t,onPickDirectory:n,onClose:r,error:i}){let a=il(!0,r),[s,c]=(0,o.useState)(``),l=()=>{let e=s.trim();e&&t({path:e,name:e.split(`/`).pop()||e,branch:`directory`,current:!1})};return(0,j.jsx)(`div`,{className:`workspace-chooser`,onClick:r,children:(0,j.jsxs)(`div`,{"aria-label":I(`选择工作区`),"aria-modal":`true`,className:`workspace-chooser-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`workspace-chooser-heading`,children:[(0,j.jsx)(`strong`,{children:I(`新建会话`)}),(0,j.jsx)(`button`,{"aria-label":I(`关闭工作区选择`),onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`small`,{children:I(`选择这个会话要使用的工作区`)}),i?(0,j.jsx)(`div`,{className:`workspace-chooser-error`,role:`alert`,children:i}):null,(0,j.jsxs)(`div`,{className:`workspace-path-input-row`,children:[(0,j.jsx)(`input`,{className:`workspace-path-input`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},placeholder:I(`输入绝对路径,如 /tmp/my-project`),type:`text`,value:s}),(0,j.jsx)(`button`,{className:`workspace-path-go`,disabled:!s.trim(),onClick:l,type:`button`,children:I(`打开`)})]}),(0,j.jsxs)(`button`,{className:`workspace-pick-directory`,"data-dialog-initial-focus":!0,onClick:()=>void n(),type:`button`,children:[(0,j.jsx)(`span`,{children:I(`打开目录`)}),(0,j.jsx)(`small`,{children:I(`从 Finder 选择一个新的工作目录`)})]}),(0,j.jsx)(`div`,{className:`workspace-chooser-divider`,children:(0,j.jsx)(`span`,{children:I(`或选择已有 worktree`)})}),e.length?e.map(e=>(0,j.jsxs)(`button`,{className:`workspace-chooser-row`,onClick:()=>t(e),type:`button`,children:[(0,j.jsx)(`span`,{className:`workspace-status ${e.current?`live`:`offline`}`,children:e.current?I(`当前`):`worktree`}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`code`,{children:e.path})]}),(0,j.jsx)(`small`,{children:e.branch})]},e.path)):(0,j.jsx)(`span`,{className:`workspace-chooser-empty`,children:I(`正在读取 git worktree…`)})]})})}function kl({kind:e,name:t,count:n,value:r,busy:i,onChange:a,onClose:o,onConfirm:s}){let c=e===`delete`||e===`batch-delete`,l=I(e===`rename`?`重命名会话`:e===`archive`?`归档会话`:c?`删除会话`:`会话操作`),u=e===`rename`?I(`给这个会话一个容易识别的名称。`):e===`archive`?I(`归档后会从默认列表隐藏,之后仍可在会话工具中恢复。`):n&&n>1?I(`将永久删除 {count} 个会话及其本地记录,此操作不可撤销。`,{count:n}):I(`将永久删除这个会话及其本地记录,此操作不可撤销。`),d=il(!0,o,i,`.session-menu`);return(0,j.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||o()},children:(0,j.jsxs)(`div`,{"aria-label":l,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:d,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:l}),(0,j.jsx)(`small`,{children:u})]}),(0,j.jsx)(`button`,{"aria-label":I(`关闭`),disabled:i,onClick:o,type:`button`,children:`×`})]}),e===`rename`&&(0,j.jsxs)(`label`,{className:`session-dialog-field`,children:[(0,j.jsx)(`span`,{children:I(`名称`)}),(0,j.jsx)(`input`,{"data-dialog-initial-focus":!0,disabled:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&!i&&s(),value:r})]}),t&&e!==`rename`&&(0,j.jsx)(`div`,{className:`session-dialog-target`,children:t}),(0,j.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":e===`rename`?void 0:``,disabled:i,onClick:o,type:`button`,children:I(`取消`)}),(0,j.jsx)(`button`,{className:c?`danger`:`primary`,disabled:i||e===`rename`&&!r.trim(),onClick:s,type:`button`,children:I(i?`处理中…`:e===`rename`?`保存名称`:e===`archive`?`归档`:`永久删除`)})]})]})})}function Al({title:e,description:t,target:n,confirmLabel:r,busy:i,onClose:a,onConfirm:o}){let s=il(!0,a,i);return(0,j.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||a()},children:(0,j.jsxs)(`div`,{"aria-label":e,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:s,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:t})]}),(0,j.jsx)(`button`,{"aria-label":I(`关闭`),disabled:i,onClick:a,type:`button`,children:`×`})]}),n&&(0,j.jsx)(`div`,{className:`session-dialog-target`,children:n}),(0,j.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:i,onClick:a,type:`button`,children:I(`取消`)}),(0,j.jsx)(`button`,{className:`danger`,disabled:i,onClick:o,type:`button`,children:i?I(`处理中…`):r})]})]})})}function jl({busy:e,position:t,themeStyle:n,onRename:r,onFork:i,onArchive:a,onDelete:o}){return(0,Le.createPortal)((0,j.jsxs)(`div`,{className:`session-row-menu-popover`,"data-session-popover":!0,onClick:e=>e.stopPropagation(),role:`menu`,style:{...n,...t},children:[(0,j.jsx)(`button`,{autoFocus:!0,disabled:e,onClick:r,role:`menuitem`,type:`button`,children:I(`重命名`)}),(0,j.jsx)(`button`,{disabled:e,onClick:i,role:`menuitem`,type:`button`,children:I(`复制会话`)}),(0,j.jsx)(`button`,{disabled:e,onClick:a,role:`menuitem`,type:`button`,children:I(`归档会话`)}),(0,j.jsx)(`button`,{className:`danger`,disabled:e,onClick:o,role:`menuitem`,type:`button`,children:I(`删除会话`)})]}),document.body)}var Ml=(e,t,n,r)=>{let i=e.getBoundingClientRect(),a=window.innerWidth-i.right-8>=t?i.right+8:Math.max(8,i.left-t-8),o=r===`below`?i.bottom+6:i.top-4;return{left:Math.round(a),top:Math.round(Math.min(Math.max(8,o),Math.max(8,window.innerHeight-n-8)))}};function Nl({message:e}){let t=/No API key found for everyapi/i.test(e),n=t||/No API key found|authentication|未配置认证/i.test(e);return(0,j.jsxs)(`div`,{className:`action-error`,role:`alert`,children:[(0,j.jsxs)(`div`,{className:`action-error-summary`,children:[(0,j.jsx)(`strong`,{children:I(t?`EveryAPI 认证未注入当前进程`:n?`模型尚未配置认证`:`发送失败`)}),(0,j.jsx)(`span`,{children:I(t?`请用 everyapi use pi-harness 启动,或设置 EVERYAPI_RELAY_KEY 后重启。`:n?`请在设置 → 提供商中配置 API key,然后重试。`:`运行时没有接受这次请求,请重试或查看错误详情。`)})]}),(0,j.jsxs)(`details`,{children:[(0,j.jsx)(`summary`,{children:I(`查看原始错误`)}),(0,j.jsx)(`code`,{children:e})]})]})}function Pl({text:e}){let t=At(e);return(0,j.jsxs)(`div`,{className:`user-bubble`,children:[(0,j.jsx)(`span`,{children:t.question}),t.count>0?(0,j.jsx)(`span`,{className:`ml-2 inline-flex rounded-md bg-[var(--color-blue-soft)] px-1.5 py-0.5 text-[10px] text-[var(--color-blue)]`,children:I(`批注 ×{v0}`,{v0:t.count})}):null]})}function Fl({event:e,onClose:t,onCopy:n}){if(!e)return(0,j.jsxs)(`aside`,{className:`details-panel`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`事件详情`)}),(0,j.jsx)(`button`,{"aria-label":I(`关闭事件详情`),onClick:t,type:`button`,children:`×`})]}),(0,j.jsx)(`div`,{className:`details-body`,children:(0,j.jsx)(`div`,{className:`empty-state`,children:I(`选择轨迹中的事件查看原始数据。`)})})]});let r=e.output??e.result??e.message,i=ht(r),a=e.type===`file`||e.type===`file_diff`,o=a?[[I(`来源`),`/api/files`],[I(`文件`),$(e.path)]]:[[I(`类型`),lt(e.type)],[I(`产生者`),pt(e)],[I(`耗时`),mt(e)],[I(`时间`),ft(e)]];return(0,j.jsxs)(`aside`,{className:`details-panel`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:sl(e)}),(0,j.jsx)(`button`,{"aria-label":I(a?`关闭文件差异`:`关闭事件详情`),onClick:t,type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`details-body`,children:[(0,j.jsx)(`div`,{className:`detail-stats ${a?`is-file`:``}`,children:o.map(([e,t])=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`small`,{children:e}),(0,j.jsx)(`b`,{children:t})]},e))}),r!==void 0&&(0,j.jsxs)(`div`,{className:`detail-section`,children:[(0,j.jsx)(`small`,{children:I(`输出`)}),(0,j.jsx)(`pre`,{className:`tool-output`,children:i??JSON.stringify(r,null,2)})]}),(0,j.jsxs)(`div`,{className:`detail-section`,children:[(0,j.jsx)(`small`,{children:I(a?`数据来源`:`经过的插件`)}),(0,j.jsx)(`div`,{className:`detail-plugin`,children:a?`Git workspace · /api/files`:`Runtime loader · event`})]}),(0,j.jsxs)(`div`,{className:`detail-actions`,children:[(0,j.jsx)(`button`,{onClick:n,type:`button`,children:I(`复制 JSON`)}),(0,j.jsx)(`button`,{disabled:!0,title:I(`当前 API 未提供重放接口`),type:`button`,children:I(`重放`)})]}),(0,j.jsxs)(`details`,{className:`raw-json`,children:[(0,j.jsx)(`summary`,{children:I(`原始 JSON`)}),(0,j.jsx)(`pre`,{className:`raw-json-body`,children:JSON.stringify(e,null,2)})]})]})]})}function Il({events:e,sessionMessages:t,onSelect:n}){let r=e.length===0&&t>0,[i,a]=(0,o.useState)(`all`),s=(0,o.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=$(e.type,`event`);t.set(n,(t.get(n)??0)+1)}),t},[e]),c=e.filter(e=>i===`all`||$(e.type,`event`)===i);return(0,j.jsxs)(`section`,{className:`view-panel trajectory-view`,children:[(0,j.jsxs)(`div`,{className:`trajectory-summary`,children:[(0,j.jsx)(`span`,{children:I(`按轮次`)}),(0,j.jsx)(`b`,{children:I(`{v0} 个事件`,{v0:e.length})}),(0,j.jsx)(`div`,{className:`timeline`,children:e.length?e.map((e,t)=>(0,j.jsx)(`span`,{className:`timeline-turn`,children:(0,j.jsx)(`i`,{className:`timeline-strip`,title:sl(e)})},t)):(0,j.jsx)(`span`,{className:`timeline-empty`,children:I(r?`本次打开后还没有事件`:`等待真实事件…`)})})]}),(0,j.jsxs)(`div`,{className:`source-filters`,children:[(0,j.jsx)(`button`,{className:`filter ${i===`all`?`active`:``}`,onClick:()=>a(`all`),type:`button`,children:I(`全部 {v0}`,{v0:e.length})}),[...s].map(([e,t])=>(0,j.jsxs)(`button`,{className:`filter ${i===e?`active`:``}`,onClick:()=>a(e),title:e,type:`button`,children:[lt(e),` `,t]},e))]}),(0,j.jsxs)(`div`,{className:`event-table`,children:[(0,j.jsxs)(`div`,{className:`event-head`,children:[(0,j.jsx)(`span`,{children:I(`时间`)}),(0,j.jsx)(`span`,{children:I(`类型`)}),(0,j.jsx)(`span`,{children:I(`事件`)}),(0,j.jsx)(`span`,{children:I(`产生者`)}),(0,j.jsx)(`span`,{children:I(`耗时`)})]}),c.map((e,t)=>(0,j.jsxs)(`button`,{className:`event-row`,onClick:()=>n(e),type:`button`,children:[(0,j.jsx)(`span`,{children:ft(e)}),(0,j.jsxs)(`span`,{title:$(e.type,`event`),children:[(0,j.jsx)(`i`,{className:`event-dot`}),lt(e.type)]}),(0,j.jsx)(`strong`,{children:sl(e)}),(0,j.jsx)(`span`,{children:pt(e)}),(0,j.jsx)(`span`,{children:mt(e)})]},t)),!c.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:r?I(`轨迹只记录控制台连上之后发生的事件,这条会话已有的 {count} 条消息请看「对话」。`,{count:t}):I(`暂无轨迹事件。`)})]})]})}function Ll({files:e,api:t,onDiff:n,onRefresh:r}){let i=e.filter(e=>e.status.includes(`A`)||e.status===`??`).length,a=e.filter(e=>e.status.includes(`D`)).length,[s,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),_=()=>{let n=s.trim();!n||l||(u(!0),m(``),t.commitFiles(e.map(e=>e.path),n).then(()=>{c(``),r()}).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},v=()=>{!e.length||l||(g(!1),u(!0),m(``),t.revertFiles(e.map(e=>e.path)).then(r).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},y=e=>{l||d||(f(e),m(``),n(e).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>f(void 0)))};return(0,j.jsxs)(`section`,{className:`view-panel files-view`,children:[(0,j.jsxs)(`div`,{className:`files-content`,children:[(0,j.jsxs)(`div`,{className:`files-title`,children:[(0,j.jsx)(`strong`,{children:I(`本次会话改动`)}),(0,j.jsx)(`span`,{children:I(`由 /api/files 提供`)})]}),(0,j.jsx)(`div`,{className:`file-summary`,children:I(`{files} 个文件 · {additions} 个新增文件 · {deletions} 个删除文件`,{files:e.length,additions:i,deletions:a})}),(0,j.jsx)(`div`,{className:`file-list`,children:e.length?e.map(e=>(0,j.jsxs)(`div`,{className:`file-row`,children:[(0,j.jsx)(`b`,{className:`file-kind ${e.label===`untracked`?`new`:``}`,children:e.label}),(0,j.jsx)(`code`,{children:e.path}),(0,j.jsx)(`span`,{className:e.status.includes(`D`)?`del`:`add`,children:e.status}),(0,j.jsx)(`button`,{"aria-label":d===e.path?I(`正在读取 {path} 的差异`,{path:e.path}):I(`查看 {path} 的差异`,{path:e.path}),className:`diff-button`,disabled:l||d!==void 0,onClick:()=>y(e.path),type:`button`,children:d===e.path?I(`读取中…`):I(`查看差异`)})]},e.path)):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`工作区没有未提交改动。`)})}),e.length>0&&(0,j.jsxs)(`div`,{className:`file-actions`,children:[(0,j.jsx)(`input`,{"aria-label":I(`提交说明`),onChange:e=>c(e.target.value),placeholder:I(`提交说明`),value:s}),(0,j.jsx)(`button`,{className:`primary`,disabled:l||!s.trim(),onClick:_,type:`button`,children:I(l?`处理中…`:`提交这些改动`)}),(0,j.jsx)(`button`,{disabled:l,onClick:()=>g(!0),type:`button`,children:I(`全部撤销`)})]}),p&&(0,j.jsx)(`p`,{className:`files-error`,children:p})]}),h&&(0,j.jsx)(Al,{busy:l,confirmLabel:I(`确认撤销`),description:I(`这会丢弃当前工作区的全部未提交改动,此操作不可恢复。`),onClose:()=>g(!1),onConfirm:v,target:I(`{count} 个文件`,{count:e.length}),title:I(`撤销全部改动`)})]})}function Rl(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??$(e)}catch{return $(e)}}function zl(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function Bl({panel:e,inline:t=!1}){let n=zl(e.data),r=n?Object.entries(n):[[I(`内容`),e.data]],i=n&&Array.isArray(n.items)?n.items:[],a=n&&Array.isArray(n.entries)?n.entries:[],o=n&&Array.isArray(n.capabilities)?n.capabilities:[];return(0,j.jsxs)(`div`,{className:`plugin-panel-card ${t?`pt-1`:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-4 shadow-[0_8px_24px_rgba(27,39,64,0.04)]`}`,children:[(0,j.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-blue-soft)] font-mono text-[15px] text-[var(--color-blue)]`,children:e.icon??`◈`}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`strong`,{className:`block text-[13px] font-semibold text-[var(--color-ink)]`,children:e.title}),(0,j.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-[var(--color-faint)]`,children:e.description??e.pluginId.replace(/cordis/gi,`runtime`)})]})]}),e.error?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[12px] text-[var(--color-red)]`,children:e.error}):e.id===`console-logger-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近日志`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[20px] font-semibold text-[var(--color-ink)]`,children:$(n?.total??0)})]}),(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)]`,children:i.length?i.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-2 border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:$(n.level??`log`)}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:$(n.source??`runtime`)}),(0,j.jsx)(`span`,{className:`block whitespace-pre-wrap break-words text-[11px] leading-4 text-[var(--color-muted)]`,children:Rl(n.args??``)})]})]},`${$(n.time??`log`)}-${t}`)}):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[var(--color-faint)]`,children:I(`暂无日志输出。`)})})]}):e.id===`plugin-group-panel`?(0,j.jsx)(`div`,{className:`mt-3 max-h-64 overflow-auto rounded-lg border border-[var(--color-line)]`,children:a.length?a.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.enabled===!1?`bg-[#a0a8b2]`:`bg-[#22c55e]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.name??`plugin`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:$(n.state??`unknown`)})]},`${$(n.id??`plugin`)}-${t}`)}):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[var(--color-faint)]`,children:I(`暂无插件条目。`)})}):e.id===`timer-service-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`服务状态`)}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${n?.registered===!0?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:n?.registered===!0?I(`已注册`):I(`未注册`)})]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map((e,t)=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:$(e)},`${$(e)}-${t}`))})]}):e.id===`agent-teams-panel`?(()=>{let e=pc(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[[I(`成员`),e.inventory.members.total],[I(`任务`),e.inventory.tasks.total],[I(`未读消息`),e.inventory.messages.unread],[I(`可执行任务`),e.inventory.tasks.ready]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),e.dependencyCycle!==null&&e.dependencyCycle.length>1?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[11px] text-[var(--color-red)]`,children:I(`依赖循环:{v0}`,{v0:e.dependencyCycle.join(` → `)})}):null,(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.members.length>0?e.members.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--color-line)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e.status===`working`?`bg-[#22c55e]`:`bg-[#a0a8b2]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold text-[var(--color-ink)]`,children:e.name}),(0,j.jsx)(`span`,{className:`truncate text-[10px] text-[var(--color-faint)]`,children:e.role}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-blue)]`,children:e.status})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-3 text-[12px] text-[var(--color-faint)]`,children:I(`暂无协作角色。`)})}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.tasks.length>0?e.tasks.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--color-line)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:e.title}),e.dependsOn.length>0?(0,j.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-[9px] text-[var(--color-faint)]`,children:I(`依赖:{v0}`,{v0:e.dependsOn.join(`, `)})}):null]}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.assignee}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] ${e.status===`blocked`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:e.status===`done`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`}`,children:e.status})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-3 text-[12px] text-[var(--color-faint)]`,children:I(`还没有任务。可让 Agent 使用 team_task 创建。`)})}),(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`会话内邮箱备注`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:[e.inventory.messages.shown,` / `,e.inventory.messages.total]})]}),e.messages.length>0?[...e.messages].reverse().map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${e.read?`border-[var(--color-line)] bg-[var(--color-surface)]`:`border-[#cfe0ff] bg-[var(--color-blue-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:[e.from,` → `,e.to]}),(0,j.jsx)(`span`,{className:`ml-auto`,children:e.read?I(`已读`):I(`未读`)})]}),(0,j.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-[var(--color-ink)]`,children:e.body})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-3 text-[12px] text-[var(--color-faint)]`,children:I(`暂无邮箱备注。`)})]}),e.truncated||e.inventory.members.truncated||e.inventory.tasks.truncated||e.inventory.messages.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`面板按固定安全上限展示;完整计数保留在上方。`)}):null,(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`这是当前 Pi 会话的协作账本,不会启动其他 Agent、创建进程或向外部发送消息。`)})]})})():e.id===`modlens-panel`?(()=>{let t=Dc(e.data),n=t.status.state===`running`?I(`正在读取视觉内容`):t.status.state===`failed`?I(`视觉检查失败`):t.status.state===`cancelled`?I(`视觉检查已取消`):t.status.state===`completed`?I(`视觉检查完成`):I(`等待图片`),r=t.status.state===`idle`?t.image?.mode:t.status.mode,i=t.status.state===`idle`?t.image?.path:t.status.path,a=t.status.state===`failed`?`border-[#f4caca] bg-[var(--color-red-soft)]`:t.status.state===`cancelled`?`border-[#f1d7a8] bg-[var(--color-amber-soft)]`:t.status.state===`running`?`border-[#c9d9f7] bg-[var(--color-blue-soft)]`:t.attached?`border-[#b9e6c9] bg-[var(--color-green-soft)]`:`border-[var(--color-line)] bg-[var(--color-soft)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${a}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:n}),(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[9px] text-[var(--color-blue)]`,children:r===`native`?I(`原生直传`):r===`evidence`?I(`ModLens 证据`):`vision_inspect`})]}),i===void 0?null:(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:i}),t.image===null?t.status.state===`idle`?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`让 Agent 调用 vision_inspect,并提供工作区内的图片路径。`)}):null:(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:t.image.mimeType}),(0,j.jsxs)(`span`,{children:[t.image.bytes.toLocaleString(L()),` bytes`]}),t.image.cached?(0,j.jsx)(`span`,{className:`font-semibold text-[var(--color-green)]`,children:I(`缓存命中`)}):null]}),t.status.state===`failed`||t.status.state===`cancelled`?(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[var(--color-red)]`,children:t.status.error}):null]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.supportedTypes.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:e},e))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{children:[`image:`,Math.round(t.limits.imageBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{children:[`evidence:`,Math.round(t.limits.evidenceBytes/1024),`KiB`]}),(0,j.jsxs)(`span`,{children:[`timeout:`,Math.round(t.limits.timeoutMs/1e3),`s`]}),(0,j.jsxs)(`span`,{children:[`cache:`,t.limits.cacheEntries]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`异常面板数据已按固定安全边界丢弃或截断。`)}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:I(`纯文本模型会启动外部 ModLens 引擎,可能使用网络和 provider 配额并产生费用。视觉证据是不可信数据,不构成指令或用户授权。`)})]})})():e.id===`vision-toolkit-panel`?(()=>{let t=Uc(e.data),n=t.report,r=t.status.state===`running`?t.status.operation===`catalog`?I(`正在盘点视觉素材`):I(`正在读取图片元数据`):t.status.state===`failed`?I(`视觉素材检查失败`):t.status.state===`cancelled`?I(`视觉素材检查已取消`):t.status.state===`completed`?I(`视觉素材检查完成`):I(`等待检查`),i=t.status.state===`failed`?`border-[#f4caca] bg-[var(--color-red-soft)]`:t.status.state===`cancelled`?`border-[#f1d7a8] bg-[var(--color-amber-soft)]`:t.status.state===`running`?`border-[#c9d9f7] bg-[var(--color-blue-soft)]`:t.status.state===`completed`?`border-[#b9e6c9] bg-[var(--color-green-soft)]`:`border-[var(--color-line)] bg-[var(--color-soft)]`,a=n?.assets.slice(0,20)??[],o=n?.issues.slice(0,10)??[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${i}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:r}),(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[9px] text-[var(--color-blue)]`,children:t.status.state===`idle`?`vision_catalog`:t.status.operation===`catalog`?`catalog`:`image info`})]}),t.status.state!==`idle`&&t.status.path!==void 0?(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:t.status.path}):null,t.status.state===`failed`||t.status.state===`cancelled`?(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[var(--color-red)]`,children:t.status.error}):null]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[[I(`已扫描`),n?.scannedEntries??0],[I(`候选图片`),n?.inspectedCandidates??0],[I(`有效素材`),n?.assets.length??0],[I(`问题`),n?.issues.length??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[16px] text-[var(--color-ink)]`,children:t})]},e))}),a.length>0?(0,j.jsx)(`div`,{className:`max-h-52 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)]`,children:a.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[10px] text-[var(--color-ink)]`,title:e.path,children:e.path}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] text-[var(--color-blue)]`,children:e.width===null?`?×?`:`${e.width}×${e.height}`})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:e.mimeType}),(0,j.jsxs)(`span`,{children:[e.bytes.toLocaleString(L()),` B`]}),e.headerTruncated?(0,j.jsx)(`span`,{className:`text-[var(--color-amber)]`,children:I(`仅扫描前 256 KiB`)}):null]})]},`${e.path}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(n===null?`让 Agent 调用 vision_catalog 盘点工作区图片,或调用 vision_image_info 检查单张图片。`:`未发现有效的受支持图片。`)}),o.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f1d7a8] bg-[var(--color-amber-soft)] px-3 py-3`,children:[(0,j.jsx)(`p`,{className:`text-[10px] font-semibold text-[var(--color-amber)]`,children:I(`图片问题(显示 {v0} 条)`,{v0:o.length})}),(0,j.jsx)(`div`,{className:`mt-2 grid gap-1.5`,children:o.map((e,t)=>(0,j.jsxs)(`p`,{className:`break-words font-mono text-[9px] leading-4 text-[var(--color-amber)]`,children:[e.path,`: `,e.reason]},`${e.path}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.supportedTypes.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[9px] text-[var(--color-blue)]`,children:e},e)),(0,j.jsxs)(`span`,{className:`rounded-md border border-[var(--color-line)] bg-[var(--color-soft)] px-2 py-1 font-mono text-[9px] text-[var(--color-faint)]`,children:[`file≤`,Math.round(t.limits.imageBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[var(--color-line)] bg-[var(--color-soft)] px-2 py-1 font-mono text-[9px] text-[var(--color-faint)]`,children:[`assets≤`,t.limits.assets]})]}),t.truncated||n?.truncated===!0||n?.issuesTruncated===!0||n!==null&&(n.assets.length>a.length||n.issues.length>o.length)?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`面板或扫描结果已按固定安全上限截断;计数与警告会保留可见。`)}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:I(`仅在当前 workspace 内本地读取图片头部,不上传图片、不调用外部视觉服务;这里展示的是元数据,不是完整图像解码结果。`)})]})})():e.id===`at-file-panel`?(()=>{let t=pn(e.data);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`最近附加`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:`file_context`})]}),t.lastFile===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`还没有附加文件。可使用 @file 或让 Agent 调用 file_context。`)}):(0,j.jsxs)(`p`,{className:`mt-2 min-w-0 whitespace-normal break-all text-[11px] leading-4 text-[var(--color-muted)]`,children:[t.lastFile.path,` · `,t.lastFile.bytes,` bytes`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`单文件上限`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:[t.maxBytes,` bytes`]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`面板数据不完整或已按固定安全上限调整。`)}):null]})})():e.id===`git-time-capsule-panel`?(()=>{let e=da(n),t=e.latest,r=t?.status===`completed`?I(`已完成`):t?.status===`cancelled`?I(`已取消`):I(`失败`),i=t?.status===`completed`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:t?.status===`cancelled`?`border-[#f1ddb1] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${t===null?`border-[var(--color-line)] bg-[var(--color-soft)]`:i}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:t?.action===`restore`?I(`最近撤销`):I(`最近捕获`)}),t===null?(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:`git_snapshot`}):(0,j.jsx)(`span`,{className:`rounded-full border border-current px-2 py-0.5 text-[9px] font-semibold`,children:r})]}),t===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-[var(--color-faint)]`,children:I(`当前没有撤销胶囊。先产生 unstaged tracked 改动,再让 Agent 调用 git_snapshot。`)}):(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[11px] text-[var(--color-muted)]`,children:[t.name===null?null:(0,j.jsx)(`p`,{className:`truncate font-mono text-[10px] text-[var(--color-ink)]`,children:t.name}),(0,j.jsxs)(`p`,{children:[t.files,` `,I(`个文件 ·`),` `,t.bytes,` bytes · `,(0,j.jsx)(`time`,{dateTime:t.at,children:t.at.replace(`T`,` `)})]}),t.error===null?null:(0,j.jsx)(`p`,{className:`break-words text-[var(--color-red)]`,children:t.error})]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`最近胶囊`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-blue)]`,children:[e.inventory.shown,` / `,e.inventory.total]})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`mt-2 max-h-44 overflow-y-auto border-l-2 border-[#cbd8ef] pl-3`,children:e.capsules.map(e=>(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-b border-[#eef1f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] text-[var(--color-ink)]`,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[var(--color-faint)]`,children:[e.bytes,` B`]})]},e.name))}):(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`尚未保存 tracked diff。`)}),e.inventory.truncated||e.truncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-amber)]`,children:I(`列表已按安全上限截断,仅展示最近 {v0} 条有效记录。`,{v0:e.inventory.displayLimit})}):null]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-soft)] px-2 py-1.5`,children:I(`Git 超时:{v0} ms`,{v0:e.timeoutMs})}),(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-soft)] px-2 py-1.5`,children:I(`单胶囊:{v0} B`,{v0:e.limits.capsuleBytes})})]}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`git_snapshot 捕获当前 unstaged tracked 改动;git_restore 会反向应用该 patch。staged 与未跟踪文件不包含在内,恢复必须传入 confirm=true。`)})]})})():e.id===`dependency-checker-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=ui(n),t=e.missingCount>0||e.invalidCount>0||e.conflictCount>0,r=e.unresolvedCount>0||e.truncated;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[var(--color-muted)]`,children:e.manifest}),(0,j.jsx)(`strong`,{className:`shrink-0 font-mono uppercase text-[var(--color-blue)]`,children:e.ecosystem})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[[I(`声明`),e.declared],[I(`已安装`),e.installed],[I(`问题`),e.missingCount+e.invalidCount],[I(`可选缺席`),e.optionalMissingCount],[I(`未决`),e.unresolvedCount]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`min-w-0 break-words rounded-lg border px-3 py-3 text-[11px] [overflow-wrap:anywhere] ${t?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:r?`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:e.missingCount||e.invalidCount?I(`缺失 {missing}、无效 {invalid}:{names}`,{missing:e.missingCount,invalid:e.invalidCount,names:[...e.missing,...e.invalid].join(`, `)}):e.conflictCount?I(`本地安装存在 {count} 组声明约束冲突。`,{count:e.conflictCount}):e.unresolvedCount?I(`{count} 组声明约束无法离线判定。`,{count:e.unresolvedCount}):e.truncated?I(`报告不完整,无法确认依赖状态。`):I(`依赖声明与本地安装一致。`)}),e.optionalMissingCount>0?(0,j.jsx)(`div`,{className:`min-w-0 break-words rounded-lg border border-[#f3dfab] bg-[var(--color-amber-soft)] px-3 py-2 text-[10px] text-[var(--color-amber)] [overflow-wrap:anywhere]`,children:I(`可选依赖未安装({v0}):{v1}`,{v0:e.optionalMissingCount,v1:e.optionalMissing.join(`, `)})}):null,e.conflicts.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[var(--color-amber-soft)] px-3 py-3 text-[11px] text-[var(--color-amber)]`,children:[(0,j.jsx)(`strong`,{children:I(`版本冲突`)}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:e.conflicts.map((e,t)=>(0,j.jsxs)(`li`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[(0,j.jsx)(`code`,{children:e.name}),`: `,e.constraints.join(` · `)||`—`]},`${e.name}-${t}`))})]}):null,e.unresolved.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[var(--color-amber-soft)] px-3 py-3 text-[11px] text-[var(--color-amber)]`,children:[(0,j.jsx)(`strong`,{children:I(`未决约束`)}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:e.unresolved.map((e,t)=>(0,j.jsxs)(`li`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[(0,j.jsx)(`code`,{children:e.name}),`: `,e.constraints.join(` · `)||`—`]},`${e.name}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`本地只读扫描 · 上限 {v0} 项`,{v0:e.scanLimit})}),e.truncated?(0,j.jsx)(`span`,{children:I(`面板明细已截断`)}):null]})]})})()}):e.id===`token-guard-panel`?(()=>{let e=ns(n),t=e.percent!==null&&e.percent>=e.maxPercent;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${t?`border-[#f4caca] bg-[var(--color-red-soft)]`:`border-[#e3eaf8] bg-[var(--color-blue-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`上下文预算`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:[e.percent===null?`—`:e.percent,`% / `,e.maxPercent,`%`]})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[var(--color-blue-soft)]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full ${t?`bg-[#d64545]`:`bg-[#5d8bea]`}`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[var(--color-muted)]`,children:[e.tokens===null?I(`上下文 token 未知`):`${e.tokens.toLocaleString(L())} / ${e.contextWindow?.toLocaleString(L())??`—`} tokens`,I(` · 已请求停止 {count} 次`,{count:e.aborts})]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.runExceeded?`border-[#f4caca] bg-[var(--color-red-soft)]`:`border-[#e3eaf8] bg-[var(--color-blue-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`本次运行已报告用量`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:[e.runTokens===null?`—`:e.runTokens.toLocaleString(L()),` /`,` `,e.maxRunTokens===0?`—`:e.maxRunTokens.toLocaleString(L())]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-muted)]`,children:e.maxRunTokens>0?I(`按 SDK 已报告用量请求停止;单次请求仍可能超额,不代表账单上限。`):I(`未启用绝对 Token 上限。`)})]})]}),e.lastError===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:I(`保护器错误:{v0}`,{v0:e.lastError})})]})})():e.id===`test-harness-panel`?(()=>{let t=On(e.data),n=t.latest,r=n?.status===`passed`?I(`验证通过`):n?.status===`failed`?I(`验证失败`):n?.status===`timed-out`?I(`验证超时`):n?.status===`cancelled`?I(`验证已取消`):I(`等待验证`),i=n?.status===`passed`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:n?.status===`failed`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:n?.status===`timed-out`||n?.status===`cancelled`?`border-[#f1d7a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[var(--color-line)] bg-[var(--color-soft)] text-[var(--color-faint)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border px-3 py-3 ${i}`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`break-all font-mono text-[11px] font-semibold text-[var(--color-ink)]`,children:n?.command??`npm run test`}),(0,j.jsx)(`span`,{className:`rounded-full border border-current px-2 py-0.5 text-[9px] font-semibold`,children:r})]}),n===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-[var(--color-faint)]`,children:I(`还没有执行验证脚本。可让 Agent 调用 run_project_tests。`)}):(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsxs)(`span`,{className:`w-full break-all`,children:[I(`执行目录:`),n.cwd]}),(0,j.jsxs)(`span`,{children:[`exit `,n.exitCode??`—`]}),n.signal===null?null:(0,j.jsx)(`span`,{children:n.signal}),(0,j.jsxs)(`span`,{children:[n.durationMs,` ms`]}),(0,j.jsxs)(`span`,{children:[n.outputBytes.toLocaleString(L()),` output bytes`]})]})]}),n!==null&&n.output!==``?(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[var(--color-line)] bg-[#111318] p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 text-[9px] text-[#9ba6b2]`,children:[(0,j.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.08em]`,children:I(`输出末尾`)}),(0,j.jsx)(`span`,{children:I(`最多 {v0} bytes`,{v0:t.limits.outputBytes})})]}),(0,j.jsx)(`pre`,{className:`max-h-52 min-w-0 overflow-auto whitespace-pre-wrap break-all font-mono text-[10px] leading-4 text-[#e6edf3]`,children:n.output})]}):null,n?.outputTruncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`输出只保留最后 12 KiB。`)}):null,n?.outputSanitized?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`终端控制字符已清理。`)}):null,(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.allowedScripts.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:e},e))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 font-mono text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{children:[`timeout `,t.limits.timeoutMs,` ms`]}),(0,j.jsxs)(`span`,{children:[`output `,t.limits.outputBytes,` bytes`]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`面板数据不完整或已按固定安全上限调整。`)}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#f1d7a8] bg-[var(--color-amber-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-amber)]`,children:I(`npm scripts 会执行当前项目定义的代码;仅在可信 workspace 中使用。Test Harness 不是沙箱,也不会把脚本输出当作用户授权。`)})]})})():e.id===`session-insights-panel`?(()=>{let t=Fn(e.data),n=t.report;if(n===null)return(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f3c4c4] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] leading-5 text-[var(--color-red)]`,children:I(`会话统计数据无效,已停止展示指标,避免把损坏数据误报为健康状态。`)});let r=n.contextUsage,i={idle:I(`尚未请求压缩`),queued:I(`等待 Agent 空闲`),running:I(`正在压缩`),completed:I(`压缩已完成`),failed:I(`压缩失败`),cancelled:I(`压缩已取消`),unknown:I(`压缩状态数据无效`)};return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`消息与用量累计整份日志(含历史分支及压缩),不等于当前上下文;成本为 SDK 报告值,不是账单。`)}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[9px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:`Session`}),(0,j.jsx)(`p`,{className:`mt-1 min-w-0 break-all font-mono text-[10px] leading-4 text-[var(--color-ink)]`,children:n.sessionId})]}),(0,j.jsx)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 min-[360px]:grid-cols-3`,children:[[I(`消息`),n.totalMessages.toLocaleString(`en-US`)],[I(`工具调用 / 结果`),`${n.toolCalls.toLocaleString(`en-US`)} / ${n.toolResults.toLocaleString(`en-US`)}`],[I(`SDK 成本`),`$${n.cost.toFixed(4)}`]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block break-all text-[16px] font-semibold text-[var(--color-ink)]`,children:t})]},e))}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`累计 token`)}),(0,j.jsx)(`strong`,{className:`break-all font-mono text-[14px] text-[var(--color-blue)]`,children:n.tokens.total.toLocaleString(`en-US`)})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap gap-x-3 gap-y-1 text-[10px] leading-4 text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{children:I(`输入 {v0}`,{v0:n.tokens.input.toLocaleString(`en-US`)})}),(0,j.jsx)(`span`,{children:I(`输出 {v0}`,{v0:n.tokens.output.toLocaleString(`en-US`)})}),(0,j.jsx)(`span`,{children:I(`缓存读取 {v0}`,{v0:n.tokens.cacheRead.toLocaleString(`en-US`)})}),(0,j.jsx)(`span`,{children:I(`缓存写入 {v0}`,{v0:n.tokens.cacheWrite.toLocaleString(`en-US`)})})]})]}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`当前上下文`)}),r===null?null:r.percent===null?(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[var(--color-amber)]`,children:I(`待下一次模型响应`)}):(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:[r.percent.toFixed(1),`%`]})]}),r===null?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`当前模型未提供上下文窗口。`)}):r.tokens===null?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`压缩后 token 暂不可估算 · 上下文窗口 {v0}`,{v0:r.contextWindow.toLocaleString(`en-US`)})}):(0,j.jsxs)(`p`,{className:`mt-2 text-[10px] leading-4 text-[var(--color-faint)]`,children:[r.tokens.toLocaleString(`en-US`),` / `,r.contextWindow.toLocaleString(`en-US`),` tokens`]})]}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border px-3 py-3 ${{idle:`border-[var(--color-line)] bg-[var(--color-soft)] text-[var(--color-faint)]`,queued:`border-[#f1d7a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`,running:`border-[#cbdaf6] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`,completed:`border-[#bfe4cb] bg-[var(--color-green-soft)] text-[var(--color-green)]`,failed:`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`,cancelled:`border-[#f1d7a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`,unknown:`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`}[t.compaction.status]}`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em]`,children:I(`会话压缩`)}),(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold`,children:i[t.compaction.status]})]}),t.compaction.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:t.compaction.error})]}),t.malformed&&t.compaction.status!==`unknown`?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-red)]`,children:I(`面板数据不完整或不一致。`)}):null]})})():e.id===`session-bridge-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=ds(n),t=[[I(`目标`),e.preview.goal],[I(`当前状态`),e.preview.currentState],[I(`下一步`),e.preview.nextStep]],r=[[I(`关键决策`),e.preview.decisions],[I(`关键文件`),e.preview.keyFiles]];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3 text-[11px] leading-5 text-[var(--color-blue)]`,children:I(`预览不会创建目标会话,也不会修改源会话。运行中的导入先排队,当前轮结束后追加到会话,后续模型轮可见;排队不代表已保存。`)}),e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`:`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:[e.status.operation===`import`?e.status.state===`failed`?I(`导入失败`):I(`导入已取消`):e.status.operation===`export`?e.status.state===`failed`?I(`导出失败`):I(`导出已取消`):e.status.state===`failed`?I(`预览失败`):I(`预览已取消`),e.status.error===null?null:(0,j.jsx)(`p`,{className:`mt-1`,children:I(`原因:{v0}`,{v0:e.status.error})})]}):null,t.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-[11px] leading-5 text-[var(--color-ink)]`,children:t||I(`暂无`)})]},e)),(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:$(e)}),t.length>0?(0,j.jsx)(`ul`,{className:`mt-2 grid gap-1 text-[10px] leading-4 text-[var(--color-muted)]`,children:t.map((e,t)=>(0,j.jsx)(`li`,{className:`break-words`,children:e},`${e}-${t}`))}):(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-faint)]`,children:I(`暂无`)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`格式 v{v0}`,{v0:e.formatVersion})}),(0,j.jsx)(`span`,{children:I(`最多 {v0} 条消息`,{v0:e.limits.messages})}),(0,j.jsx)(`span`,{children:I(`正文 {v0} 字符`,{v0:e.limits.totalMessageCharacters})}),(0,j.jsx)(`span`,{children:I(`附件标记 {v0} 个`,{v0:e.limits.attachments})}),e.source===null?null:(0,j.jsxs)(`span`,{className:`max-w-full truncate`,children:[I(`来源`),` `,e.source.sessionId]}),e.latest===null?null:(0,j.jsx)(`span`,{children:e.latest.direction===`import`?I(`最近导入请求`):I(`最近导出`)})]})]})})()}):e.id===`session-compare-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`按日志位置比较去除首尾空白的非空文本消息。差异列表每侧保留 40 条,每条预览最多 4,000 字符。`)}),n?.left&&typeof n.left==`object`&&n?.right&&typeof n.right==`object`?(()=>{let e=n.left,t=n.right;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[[I(`左侧会话`),e],[I(`右侧会话`),t]].map(([e,t])=>{let n=t;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-2 block truncate text-[12px] text-[var(--color-ink)]`,children:$(n.name??n.id)}),(0,j.jsx)(`code`,{className:`mt-1 block truncate text-[10px] text-[var(--color-blue)]`,children:$(n.id)}),(0,j.jsx)(`span`,{className:`mt-1 block text-[10px] text-[var(--color-muted)]`,children:I(`{v0} 条消息`,{v0:$(n.messageCount,`0`)})})]},$(e))})}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`共享`),n.shared??0],[I(`右侧新增`),n.addedCount??0],[I(`左侧删除`),n.removedCount??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${n.changed===!0?`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:n.changed===!0?I(`两个会话的文本消息在对应位置存在差异。`):I(`两个会话的文本消息投影一致;未比较图片、工具调用参数及元数据。`)}),Array.isArray(n.added)&&n.added.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`右侧差异预览(最多显示 4 条)`)}),(0,j.jsx)(`ul`,{className:`mt-2 grid gap-1 text-[10px] leading-4 text-[var(--color-muted)]`,children:n.added.slice(0,4).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{children:[`[`,$(n.role),`] `,$(n.text)]},`${$(n.role)}-${t}`)})})]}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`执行 session_compare 后显示两个会话的差异。`)})]}):e.id===`secure-audit-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:[[I(`扫描文件`),n?.scanned??0],[I(`严重`),n?.critical??0],[I(`高风险`),n?.high??0],[I(`总发现`),n?.total??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[16px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${Number(n?.total??0)>0?`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:n?.hasRun===!0?Number(n.total)>0?I(`发现需要人工确认的安全风险。`):I(`本次扫描范围内未命中规则,不代表安全。`):I(`尚未扫描。`)}),n?.incomplete===!0||n?.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`扫描或显示不完整:跳过 {v0} 个文件/目录,{v1} 行未检查通用凭据赋值;明细最多 200 项。`,{v0:$(n.skipped),v1:$(n.credentialLinesSkipped)})}):null,Array.isArray(n?.findings)&&n.findings.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.findings.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.severity,`medium`);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[10px] text-[var(--color-blue)]`,children:$(n.path)}),(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold ${r===`critical`?`text-[var(--color-red)]`:`text-[var(--color-amber)]`}`,children:r})]}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 text-[var(--color-muted)]`,children:I(`第 {v0} 行 · {v1}`,{v0:$(n.line),v1:$(n.message)})})]},`${$(n.path)}-${$(n.line)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`运行 security_audit 后显示脱敏结果。`)})]}):e.id===`context-doctor-panel`?(()=>{let e=zo(n),t={idle:I(`尚未请求`),queued:I(`已排队`),running:I(`压缩中`),completed:I(`已完成`),failed:I(`失败`),cancelled:I(`已取消`),unknown:I(`未知`)},r=e.compaction.status===`completed`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:e.compaction.status===`failed`?`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`:e.compaction.status===`cancelled`?`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#dce5f5] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${e.status===`warning`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:e.status===`ok`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:`border-[var(--color-line)] bg-[var(--color-soft)] text-[var(--color-faint)]`}`,children:e.status===`warning`?I(`需要关注上下文风险。`):e.status===`ok`?I(`上下文状态正常。`):I(`上下文状态不可用。`)}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[[I(`占用`),e.usagePercent===null?`—`:`${e.usagePercent}%`],[I(`超限/不可测`),e.oversizedMessages],[I(`无法安全检查`),e.uninspectableMessages],[I(`工具错误`),e.toolErrors]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t})]},String(e)))}),e.compaction.status===`idle`||e.compaction.status===`unknown`?null:(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{children:I(`最近压缩`)}),(0,j.jsx)(`strong`,{children:t[e.compaction.status]})]}),e.compaction.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:e.compaction.error})]}),e.recommendations.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-4 py-3 text-[10px] text-[var(--color-muted)]`,children:[e.recommendations.map((e,t)=>(0,j.jsx)(`li`,{children:e},`${e}-${t}`)),e.recommendationsTruncated?(0,j.jsx)(`li`,{children:I(`部分建议因浏览器显示上限被省略。`)}):null]}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`扫描 {v0} / {v1} 条消息{v2}`,{v0:e.scannedMessages,v1:e.messageCount,v2:e.messagesTruncated?I(`(已截断)`):``})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`告警阈值 {v0}%`,{v0:e.warnPercent})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`大消息阈值 {v0}B`,{v0:e.maxMessageBytes})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`结构预算 {v0} 节点 / 深度 {v1}`,{v0:e.limits.jsonNodesPerAudit,v1:e.limits.jsonDepth})})]})]})})():e.id===`history-compressor-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.enabled===!0?I(`自动压缩已启用`):I(`自动压缩已停用`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:I(`阈值 {v0}%`,{v0:$(n?.thresholdPercent??`—`)})})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`已压缩`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:$(n?.compactions??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`当前占用`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:typeof n?.lastUsagePercent==`number`?`${$(n.lastUsagePercent)}%`:`—`})]})]}),n?.lastError?(0,j.jsx)(`p`,{className:`text-[11px] text-[var(--color-red)]`,children:I(`最近错误:{v0}`,{v0:$(n.lastError)})}):null]}):e.id===`session-export-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近导出`)}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[11px] text-[var(--color-blue)]`,children:$(e.path??`pi-session.md`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-muted)]`,children:I(`{v0} 个文本段 · {v1} bytes`,{v0:$(e.messages??0),v1:$(e.bytes??0)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有导出当前会话。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`导出调用开始时的会话文本快照,不包含图片、思考块和工具调用参数。文件写入该会话工作区内的 .md 路径,覆盖需要显式确认,权限为 0600。`)})]}):e.id===`session-search-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`只搜索持久化日志中的用户和助手文本,包含历史分支;不含图片、思考或工具输出。以下为最近一次搜索,最多显示 8 个会话。`)}),n?.query?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`已扫描 {v0} 个文件,跳过 {v1} 个;{v2}。跳过的文件不计入匹配结果。`,{v0:$(n.scanned),v1:$(n.skipped),v2:n.truncated?I(`扫描范围或结果预览已截断`):I(`未触及扫描或预览上限`)})}):null,n?.query?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[var(--color-blue)]`,children:$(n.query)}),(0,j.jsx)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 个会话`,{v0:$(n.total??0)})})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`输入查询后显示匹配的历史会话。`)}),Array.isArray(n?.items)&&n.items.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.items.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.hits)?n.hits:[];return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:$(n.name??n.id??I(`未命名会话`))}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-faint)]`,children:I(`{v0} 条匹配消息 · 返回 {v1} 条预览`,{v0:$(n.totalHits),v1:r.length})}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:r.map(e=>$(typeof e==`object`&&e?e.text??``:e)).join(` | `)})]},`${$(n.id??`session`)}-${t}`)})}):n?.query?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`已扫描范围内没有匹配的用户或助手文本。`)}):null]}):e.id===`session-bookmarks-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`当前会话书签`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 个书签`,{v0:$(n?.total??0)})})]}),Array.isArray(n?.bookmarks)&&n.bookmarks.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.bookmarks.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:$(n.label??I(`未命名书签`))}),(0,j.jsxs)(`code`,{className:`mt-1 block truncate text-[10px] text-[var(--color-faint)]`,children:[`entry: `,$(n.entryId??`—`)]})]},`${$(n.id??`bookmark`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有标记重要节点。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`书签以标签追加到 Pi 原生会话记录,不修改已有消息;内存会话不会落盘。`)})]}):e.id===`llm-verifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`校验模型`)}),(0,j.jsxs)(`code`,{className:`max-w-[65%] truncate text-[11px] text-[var(--color-blue)]`,children:[$(n?.provider??`—`),`/`,$(n?.model??`—`)]})]}),n?.history&&typeof n.history==`object`?(()=>{let e=n.history,t=e.counts&&typeof e.counts==`object`?e.counts:{};return(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`累计`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[var(--color-ink)]`,children:$(e.total??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-green-soft)] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-green)]`,children:I(`通过`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[var(--color-green)]`,children:$(t.pass??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-red-soft)] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-red)]`,children:I(`失败`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[var(--color-red)]`,children:$(t.fail??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-amber-soft)] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-amber)]`,children:I(`未知`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[var(--color-amber)]`,children:$(t.unknown??0)})]})]})})():null,n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.verdict??`unknown`);return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t===`pass`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:t===`fail`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`strong`,{className:`uppercase`,children:t}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[$(e.evidenceChars??0),` chars`]})]}),(0,j.jsx)(`p`,{className:`mt-2 leading-4`,children:$(e.rationale??I(`没有返回校验理由。`))}),(0,j.jsx)(`p`,{className:`mt-2 truncate text-[10px] opacity-70`,children:I(`声明:{v0}`,{v0:$(e.claim??`—`)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有执行模型校验。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`证据按不可信数据处理,输入有长度上限;模型返回非结构化结果时显示 unknown。`)})]}):e.id===`module-search-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.matches)?e.matches:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[var(--color-blue)]`,children:$(e.query??``)}),(0,j.jsx)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 个结果`,{v0:$(t.length)})})]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,10).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsxs)(`code`,{className:`min-w-0 truncate text-[10px] text-[var(--color-blue)]`,children:[$(n.path??`—`),`:`,$(n.line??`—`)]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-[var(--color-faint)]`,children:$(n.kind??`symbol`)})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[var(--color-muted)]`,children:$(n.name??I(`未命名符号`))})]},`${$(n.path??`module`)}:${$(n.line??t)}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有找到匹配的模块符号。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`扫描 {v0} 个源码文件,跳过依赖和构建目录。`,{v0:$(e.scannedFiles??0)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`输入符号名后显示模块检索结果。`)})}):e.id===`better-sidebar-panel`?(()=>{let e=Array.isArray(n?.changedFiles)?n.changedFiles:[],t=n?.clean===!0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[var(--color-blue)]`,children:$(n?.cwd??I(`当前工作区`))}),(0,j.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] ${t?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:t?`clean`:I(`{count} 个变更`,{count:$(n?.changedCount??e.length)})})]}),(0,j.jsx)(`p`,{className:`mt-2 font-mono text-[10px] text-[var(--color-muted)]`,children:$(n?.summary??I(`等待工作区扫描`))}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-faint)]`,children:I(`会话 {v0} · 目录 {v1} · 文件 {v2}`,{v0:$(n?.sessionId??`—`),v1:$(n?.directoryCount??0),v2:$(n?.fileCount??0)})})]}),e.length>0?(0,j.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`显示 {v0} / {v1} 个变更`,{v0:Math.min(e.length,8),v1:$(n?.changedCount??e.length)})}),e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate py-0.5 text-[10px] text-[var(--color-muted)]`,children:[$(n.status??`??`),` `,$(n.path??I(`未命名`))]},`${$(n.path??`file`)}-${t}`)})]}):null,n?.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`概览包含截断的结果,显示数量与总数见上方。`)}):null]})})():e.id===`workspace-navigator-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`p`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:[I(`工作区:`),$(n?.cwd,``)]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.nodes)?e.nodes:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[var(--color-blue)]`,children:$(e.path??`.`)}),(0,j.jsx)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 个节点`,{v0:$(t.length)})})]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:t.slice(0,36).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=typeof n.depth==`number`?Math.min(6,Math.max(1,n.depth)):1;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 truncate py-1 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsxs)(`span`,{className:`shrink-0 text-[var(--color-faint)]`,children:[`· `.repeat(r-1),n.kind===`directory`?`▾`:`·`]}),(0,j.jsx)(`code`,{className:`truncate`,children:$(n.name??n.path??I(`未命名`))})]},`${$(n.path??`node`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前目录为空。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`目录 {v0} 个,文件 {v1} 个;跳过依赖和构建目录。`,{v0:$(e.directoryCount??0),v1:$(e.fileCount??0)})}),e.truncated===!0||t.length>36?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`目录树已截断;面板显示 {v0} / {v1} 个已收集节点。`,{v0:Math.min(36,t.length),v1:t.length})}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`执行 workspace_tree 后显示工作区结构。`)}),n?.git&&typeof n.git==`object`?(()=>{let e=n.git,t=Array.isArray(e.entries)?e.entries:[],r=e.available===!0;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--color-ink)]`,children:I(`Git 状态`)}),(0,j.jsx)(`span`,{className:`text-[10px] ${r?e.clean===!0?`text-[var(--color-green)]`:`text-[var(--color-red)]`:`text-[var(--color-faint)]`}`,children:r?e.clean===!0?`clean`:`${$(e.changedCount)} 个变更`:I(`不可用`)})]}),r?(0,j.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-[var(--color-muted)]`,children:$(e.branch??`detached HEAD`)}):null,e.truncated===!0||t.length>12?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`显示前 {v0} 条;共有 {v1} 个变更。`,{v0:Math.min(12,t.length),v1:$(e.changedCount)})}):null,t.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1`,children:t.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[10px] text-[var(--color-muted)]`,children:[$(n.status??`??`),` `,n.originalPath?`${$(n.originalPath)} → `:``,$(n.path??I(`未命名`))]},`${$(n.path??`file`)}-${t}`)})}):null]})})():null]}):e.id===`prompt-library-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[Array.isArray(n?.templates)&&n.templates.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.templates.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[];return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[11px] text-[var(--color-ink)]`,children:$(n.title??I(`未命名提示词`))}),(0,j.jsx)(`code`,{className:`shrink-0 text-[10px] text-[var(--color-faint)]`,children:$(n.id??`—`)})]}),(0,j.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.prompt??``)}),r.length>0?(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,6).map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-0.5 text-[9px] text-[var(--color-blue)]`,children:e},e))}):null]},`${$(n.id??`prompt`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有保存的提示词。可让 Agent 调用 prompt_library 保存模板。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`共 {v0} 个模板,数据跟随当前会话。`,{v0:$(n?.total??0)})})]}):e.id===`colleague-skill-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=t=>Array.isArray(e[t])?e[t].filter(e=>typeof e==`string`):[],r=t(`constraints`),i=t(`files`),a=t(`acceptance`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`交接给`)}),(0,j.jsx)(`strong`,{className:`text-[11px] text-[var(--color-blue)]`,children:$(e.toRole)})]}),(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3 text-[11px] text-[var(--color-ink)]`,children:$(e.objective)}),e.context?(0,j.jsx)(`p`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(e.context)}):null,i.length>0?(0,j.jsx)(`div`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:i.slice(0,8).map(e=>(0,j.jsx)(`code`,{className:`truncate text-[10px] text-[var(--color-muted)]`,children:e},e))}):null,r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-amber-soft)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`约束`)}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 text-[10px] text-[var(--color-muted)]`,children:r.slice(0,8).map((e,t)=>(0,j.jsxs)(`li`,{children:[`• `,e]},`${e}-${t}`))})]}):null,a.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-green-soft)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] text-[var(--color-green)]`,children:I(`验收条件`)}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 text-[10px] text-[var(--color-muted)]`,children:a.slice(0,8).map((e,t)=>(0,j.jsxs)(`li`,{children:[`• `,e]},`${e}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{children:I(`约束 {v0} 条`,{v0:r.length})}),(0,j.jsx)(`span`,{children:I(`验收 {v0} 条`,{v0:a.length})})]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`执行 colleague_handoff 后显示角色交接包。`)})}):e.id===`reverse-skill-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`复核风险内容的默认策略`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:n?.allowReviewByDefault===!0?I(`允许返回`):I(`拒绝返回`)})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.risk),r=Array.isArray(e.findings)?e.findings:[];return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t===`blocked`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:t===`review`?`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`strong`,{className:`uppercase`,children:t}),(0,j.jsx)(`span`,{className:`font-mono text-[10px]`,children:e.contentIncluded===!0?I(`已返回不可信文本`):I(`未返回原文`)})]}),(0,j.jsx)(`p`,{className:`mt-2`,children:I(`{v0} · {v1} 个风险项`,{v0:$(e.name??I(`未命名 Skill`)),v1:$(r.length)})}),r.length>0?(0,j.jsx)(`p`,{className:`mt-1 text-[10px] opacity-80`,children:r.slice(0,2).map(e=>$(e.message)).join(` · `)}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`执行 skill_inject 后显示隔离结果。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`未命中规则不代表安全;review 默认不返回原文,blocked 始终拒绝。文本标记不是执行沙箱,也不会自动激活 Skill。`)})]}):e.id===`reviewer-bot-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.status),r=e=>typeof e==`object`&&!!e&&e.severity===`error`,i=Array.isArray(e.findings)?[...e.findings].sort((e,t)=>Number(r(t))-Number(r(e))):[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`code`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:$(e.cwd)}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t===`error`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:t===`warning`?`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:[(0,j.jsx)(`span`,{children:I(t===`error`?`发现错误风险`:t===`warning`?`需要关注`:`未命中检查规则`)}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[$(e.findingCount),` findings`]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`文件`),e.changedFiles??0],[I(`新增`),e.addedLines??0],[I(`删除`),e.removedLines??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅检查相对 HEAD 的已跟踪改动;不含未跟踪文件,也不执行测试。显示 {v0}/{v1} 个风险项。`,{v0:Math.min(i.length,4),v1:$(e.findingCount)})}),e.filesTruncated===!0||e.findingsTruncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`明细超过上限,结果已截断;总数仍包含全部检查结果。`)}):null,i.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-4 py-3 text-[10px] text-[var(--color-muted)]`,children:i.slice(0,4).map((e,t)=>{let n=typeof e==`object`&&e?e:void 0;return(0,j.jsxs)(`li`,{className:`grid gap-1`,children:[typeof n?.path==`string`?(0,j.jsx)(`code`,{className:`break-all`,children:n.path}):null,$(n?.message??e)]},t)})}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有审查当前改动。可让 Agent 调用 review_changes。`)})}):e.id===`auto-mode-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:n?.mode===`confirm`?I(`确认模式`):I(`安全模式`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-muted)]`,children:I(`超时 {v0} ms`,{v0:$(n?.timeoutMs??`—`)})})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`阻断次数`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:I(`{v0} 次`,{v0:$(n?.blocked??0)})})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`最近命令`)}),(0,j.jsx)(`strong`,{className:`mt-1 block truncate font-mono text-[11px] text-[var(--color-ink)]`,children:n?.last&&typeof n.last==`object`?$(n.last.command??`—`):`—`})]})]}),n?.last&&typeof n.last==`object`?(0,j.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.last.stdout,``)||$(n.last.stderr??I(`无输出`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未执行命令。Agent 可调用 auto_mode_exec。`)})]}):e.id===`plan-execute-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate text-[11px] font-medium text-[var(--color-ink)]`,children:n?.title?$(n.title):I(`尚未创建计划`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:[$(n?.completed??0),` / `,$(n?.total??0)]})]}),Array.isArray(n?.steps)&&n.steps.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:n.steps.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=$(n.status??`pending`);return(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${r===`done`?`bg-[#32a35a]`:r===`in_progress`?`bg-[#3565c5]`:r===`skipped`?`bg-[#a0a7b0]`:`bg-[var(--color-blue-soft)]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${r===`done`?`text-[var(--color-green)]`:`text-[var(--color-ink)]`}`,children:$(n.title??I(`步骤`))}),Array.isArray(n.dependsOn)&&n.dependsOn.length>0&&(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`依赖步骤 {v0}`,{v0:n.dependsOn.map(e=>$(e)).join(`, `)})}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:r})]},$(n.id??t))})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 plan_create 创建执行计划。`)})]}):e.id===`plugin-stars-panel`?(()=>{let e=en(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Plugin Stars 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载排行榜。`)})]});let t=e.latest,r=t?.results??[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`社区排行榜`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-muted)]`,children:I(`结果上限 {v0}`,{v0:e.limit})})]}),t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:e.source===``?I(`需要配置榜单来源 sourceUrl,尚未连接 Pi Harness 排行榜。`):I(`Agent 可调用 plugin_stars_search 拉取并筛选社区排行榜。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{children:I(`查询:{v0}`,{v0:t.query||I(`全部`)})}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`显示 {v0}/{v1}`,{v0:e.inventory.shown,v1:e.inventory.total})})]}),r.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:r.map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`span`,{className:`w-5 shrink-0 text-center font-mono text-[10px] text-[var(--color-amber)]`,children:[`#`,e.rank]}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`a`,{className:`block truncate font-mono text-[11px] text-[var(--color-blue)] hover:underline`,href:e.htmlUrl,rel:`noreferrer`,target:`_blank`,children:e.fullName}),(0,j.jsx)(`span`,{className:`block truncate text-[10px] text-[var(--color-faint)]`,children:I(`更新于 {v0}`,{v0:e.updatedAt||I(`未知`)})})]}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--color-amber)]`,children:[`★ `,e.stars.toLocaleString(L())]})]},e.fullName))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有找到匹配的社区插件。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`来源:{v0} · 仅展示公开仓库信息,不会自动安装。`,{v0:t.source})})]})]})})():e.id===`plugin-finder-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`只读 Registry 搜索`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-muted)]`,children:I(`关键词 {v0} · 上限 {v1}`,{v0:$(n?.keyword??`pi-harness`),v1:$(n?.limit??`—`)})})]}),n?.query?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{children:I(`查询:{v0}`,{v0:$(n.query)})}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 个结果`,{v0:$(n.total??0)})})]}),n?.truncated===!0&&(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅显示部分匹配结果,请缩小查询范围。`)}),Array.isArray(n?.results)&&n.results.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:n.results.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.name??I(`未知插件`))}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:[`v`,$(n.version??`—`)]})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[var(--color-faint)]`,children:$(n.description,``)})]},`${$(n.name??`plugin`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有找到匹配插件。`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 plugin_search 搜索 npm Registry。`)})]}):e.id===`memory-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`跨会话记忆`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 条`,{v0:$(n?.count??0)})})]}),Array.isArray(n?.memories)&&n.memories.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:n.memories.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.key??I(`未知键`))}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[var(--color-faint)]`,children:$(n.value,``)})]},`${$(n.key??`memory`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未保存记忆。Agent 可调用 memory_set 明确写入。`)})]}):e.id===`graph-memory-panel`?(()=>{let e=Sa(n),t=e.kinds,r=e.recent,i=e.recentRelations;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`任务`),t.task??0,`bg-[#3565c5]`],[I(`技能`),t.skill??0,`bg-[#22a06b]`],[I(`事件`),t.event??0,`bg-[#d97706]`]].map(([e,t,n])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${$(n)}`}),$(e)]}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`本地关系图`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 节点 · {v1} 关系`,{v0:e.nodes,v1:e.relations})})]}),r.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsx)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近节点 {v0} / {v1}`,{v0:Math.min(r.length,5),v1:e.nodes})}),r.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.kind===`task`||n.kind===`skill`||n.kind===`event`?n.kind:`unknown`,i=I(r===`task`?`任务`:r===`skill`?`技能`:r===`event`?`事件`:`未知`);return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] font-semibold ${r===`task`?`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`:r===`skill`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:r===`event`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-soft)] text-[var(--color-muted)]`}`,children:i}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:$(n.label??I(`未命名节点`))})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.summary,``)}),n.source?(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[9px] text-[var(--color-faint)]`,children:I(`来源:{v0}`,{v0:$(n.source)})}):null]},`${$(n.id??`node`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未记录图记忆。Agent 可调用 graph_memory_record 创建任务、技能或事件节点。`)}),i.length>0?(0,j.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近关系 {v0} / {v1}`,{v0:Math.min(i.length,3),v1:e.relations})}),i.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:$(n.fromLabel??n.from??I(`节点`))}),(0,j.jsxs)(`span`,{className:`shrink-0 text-[var(--color-blue)]`,children:[`—`,$(n.relation??`RELATED_TO`),`→`]}),(0,j.jsx)(`span`,{className:`truncate`,children:$(n.toLabel??n.to??I(`节点`))})]},`${$(n.id??`relation`)}-${t}`)})]}):null,e.lastSearch===null?null:(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[var(--color-muted)]`,children:I(`最近搜索:{v0}`,{v0:e.lastSearch.query})}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[var(--color-blue)]`,children:[e.lastSearch.shown,` / `,e.lastSearch.total]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`节点 ≤ {v0}`,{v0:e.limits.nodes})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`关系 ≤ {v0}`,{v0:e.limits.relations})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`文件 ≤ {v0} B`,{v0:e.limits.fileBytes})})]}),e.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板内容已按安全显示上限截断。`)}):null]})})():e.id===`taskboard-panel`?(()=>{let e=n?.counts!==null&&typeof n?.counts==`object`?n.counts:{},t=Array.isArray(n?.recent)?n.recent:[],r=[[I(`待规划`),`backlog`,`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`],[I(`阻塞`),`blocked`,`bg-[var(--color-red-soft)] text-[var(--color-red)]`],[I(`已取消`),`canceled`,`bg-[var(--color-red-soft)] text-[var(--color-red)]`],[I(`待办`),`todo`,`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`],[I(`进行中`),`in_progress`,`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`],[I(`待验收`),`in_review`,`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`],[I(`已完成`),`done`,`bg-[var(--color-green-soft)] text-[var(--color-green)]`]];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`text-[var(--color-muted)]`,children:[I(`当前工作区任务:`),$(n?.workspace)]}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 个`,{v0:$(n?.total??0)})})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:r.map(([t,n,r])=>(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:t}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r}`,children:$(e[n]??0)})]})},n))}),t.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsx)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近任务 {v0} / {v1}`,{v0:Math.min(t.length,5),v1:$(n?.total??t.length)})}),t.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=typeof n.status==`string`?n.status:`unknown`,i=typeof n.priority==`string`?n.priority:`medium`,a=I(r===`backlog`?`待规划`:r===`todo`?`待办`:r===`in_progress`?`进行中`:r===`in_review`?`待验收`:r===`blocked`?`阻塞`:r===`canceled`?`已取消`:r===`done`?`已完成`:`未知`),o=r===`done`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:r===`blocked`||r===`canceled`?`bg-[var(--color-red-soft)] text-[var(--color-red)]`:r===`unknown`?`bg-[var(--color-soft)] text-[var(--color-muted)]`:`bg-[var(--color-blue-soft)] text-[var(--color-blue)]`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-[var(--color-blue)]`,children:$(n.key??`PIH-?`)}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:$(n.title??I(`未命名任务`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${o}`,children:a})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`优先级 {v0}`,{v0:i})}),n.dueDate?(0,j.jsx)(`span`,{children:I(`截止 {v0}`,{v0:$(n.dueDate)})}):null,Array.isArray(n.dependsOn)&&n.dependsOn.length>0?(0,j.jsxs)(`span`,{children:[I(`前置任务:`),n.dependsOn.map(e=>$(e)).join(`, `)]}):null]})]},`${$(n.id??`task`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未创建任务。Agent 可调用 taskboard_create 创建带稳定编号的任务。`)})]})})():e.id===`skill-catalog-panel`?(()=>{let e=Array.isArray(n?.skills)?n.skills:[],t=Array.isArray(n?.mcpServers)?n.mcpServers:[],r=Array.isArray(n?.diagnostics)?n.diagnostics:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:`Skills`}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-blue)]`,children:$(n?.skillCount??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`MCP 服务器`)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-blue)]`,children:$(n?.mcpCount??0)})]})]}),n?.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`目录结果或字段已截断,计数包含未展示条目。`)}):null,e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:$(n.name,I(`未命名技能`))}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-1.5 py-0.5 text-[9px] text-[var(--color-muted)]`,children:$(n.scope,`unknown`)})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] text-[var(--color-faint)]`,children:$(n.description,I(`无描述`))}),n.modelInvocationDisabled?(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-amber)]`,children:I(`已加载,仅允许显式调用`)}):null]},`${$(n.name??`skill`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前运行时没有加载 Skill。`)}),t.length>0?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold text-[var(--color-muted)]`,children:I(`MCP 状态`)}),(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:t.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[var(--color-muted)]`,children:$(n.id,I(`未命名服务器`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-soft)] text-[var(--color-muted)]`}`,children:$(n.status,`unknown`)})]},`${$(n.id??`server`)}-${t}`)})})]}):null,r.length>0?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#fff0c2] bg-[var(--color-amber-soft)] px-3 py-2 text-[10px] text-[var(--color-amber)]`,children:I(`资源诊断:{v0} 条`,{v0:$(n?.diagnosticCount)})}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`只读展示当前已加载资源,最多显示 8 个技能和 6 个 MCP 状态;不激活技能或启动服务器。读取技能采用启发式检查,不保证内容安全。`)})]})})():e.id===`cost-meter-panel`?(()=>{let e=typeof n?.budget==`number`?n.budget:null,t=typeof n?.budgetPercent==`number`?n.budgetPercent:null,r=ti(n),i=t!==null&&t>=100?`text-[var(--color-red)]`:t!==null&&t>=80?`text-[var(--color-amber)]`:`text-[var(--color-green)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`今日(UTC)`),`$${Number(n?.todayCost??0).toFixed(4)}`],[I(`当前会话`),`$${Number(n?.sessionCost??0).toFixed(4)}`],[I(`累计`),`$${Number(n?.lifetimeCost??0).toFixed(4)}`]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[15px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`每日预算(UTC)`)}),(0,j.jsx)(`strong`,{className:i,children:e===null?I(`未设置`):`$${e.toFixed(4)} · ${t?.toFixed(2)??`0.00`}%`})]}),e===null?null:(0,j.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--color-blue-soft)]`,children:(0,j.jsx)(`div`,{className:`h-full ${t!==null&&t>=100?`bg-[#d64545]`:`bg-[#4c83e8]`}`,style:{width:`${Math.min(100,t??0)}%`}})})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`{v0} 日账本`,{v0:r.dayBasis})}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-soft)] px-2 py-1`,children:I(`展示上限 {v0} 条`,{v0:r.entryLimit??`—`})})]}),r.lastError===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f0c8c4] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] text-[var(--color-red)]`,children:I(`最近写入错误:{v0}`,{v0:r.lastError})}),r.entries.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:r.entries.map((e,t)=>(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[var(--color-muted)]`,children:e.sessionId}),(0,j.jsx)(`strong`,{className:`shrink-0 font-mono text-[var(--color-ink)]`,children:I("${v0} 当日增量",{v0:e.dailyCost.toFixed(4)})})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{children:[`UTC `,e.utcDate]}),(0,j.jsx)(`span`,{children:I("会话累计 ${v0}",{v0:e.sessionCost.toFixed(4)})}),(0,j.jsxs)(`span`,{children:[e.tokens,` tokens`]}),(0,j.jsx)(`span`,{children:I(`{v0} 消息`,{v0:e.messages})})]})]},`${e.sessionId}-${e.utcDate}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未记录已完成会话。Agent 可调用 cost_report 的 refresh 操作写入账本。`)}),(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅记录运行时报告的实际成本,不内置或猜测模型价格。`)})]})})():e.id===`undo-savepoint-panel`?(()=>{let e=Array.isArray(n?.savepoints)?n.savepoints:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`p`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:[I(`工作区:`),$(n?.cwd)]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`保存点`)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-blue)]`,children:$(n?.count??e.length)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`跟踪路径`)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-blue)]`,children:$(Array.isArray(n?.trackedPaths)?n.trackedPaths.length:0)})]})]}),e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsx)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-[var(--color-blue)]`,children:$(n.id,`unknown`)}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:$(n.reason,`manual savepoint`)}),(0,j.jsxs)(`span`,{className:`text-[9px] text-[var(--color-faint)]`,children:[I(`{v0} 文件`,{v0:$(n.fileCount,`0`)}),n.truncated===!0?I(` · 不完整`):``]})]})},`${$(n.id??`savepoint`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未创建保存点。修改配置或插件代码前,让 Agent 调用 undo_savepoint 的 save 操作。`)}),(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`恢复会覆盖快照内文件,要求 confirm=true,不删除新增文件。列表为受限扫描结果,仅显示前 6 项;标为不完整的快照不能代表整个工作区。`)})]})})():e.id===`annotation-panel`?(()=>{let e=Array.isArray(n?.annotations)?n.annotations:[],t=typeof n?.lastPrompt==`string`?n.lastPrompt:``;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`待发送批注`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 条`,{v0:$(n?.count??0)})})]}),e.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2 text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-0.5 font-mono text-[var(--color-blue)]`,children:[`#`,$(n.id??t+1)]}),(0,j.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[var(--color-ink)]`,children:$(n.quote,``)})]}),n.note?(0,j.jsx)(`p`,{className:`mt-1 pl-8 text-[10px] text-[var(--color-faint)]`,children:$(n.note)}):null]},`${$(n.id??t)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未收集批注。Agent 可调用 annotation_manage 的 add 操作记录回复片段。`)}),t?(0,j.jsxs)(`details`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-muted)]`,children:I(`最近生成的提问上下文`)}),(0,j.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap text-[10px] text-[var(--color-ink)]`,children:t})]}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`批注按编号累积;生成上下文不会改写原会话消息。`)})]})})():e.id===`runtime-doctor-panel`?(()=>{let e=$(n?.status??`unknown`),t=Array.isArray(n?.checks)?n.checks:[],r=Array.isArray(n?.recommendations)?n.recommendations:[],i=e===`ok`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:e===`warning`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`运行时边界检查`)}),(0,j.jsx)(`span`,{className:`rounded px-2 py-0.5 font-mono text-[10px] uppercase ${i}`,children:e})]}),(0,j.jsx)(`div`,{className:`grid gap-1.5`,children:t.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.status??`unknown`),i=r===`ok`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:r===`warning`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r===`ok`?`bg-[#22c55e]`:r===`warning`?`bg-[#e6a21a]`:`bg-[#d64545]`}`}),(0,j.jsx)(`code`,{className:`w-20 shrink-0 text-[var(--color-muted)]`,children:$(n.id??`check`)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[var(--color-ink)]`,children:$(n.detail??`—`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${i}`,children:r})]},`${$(n.id??`check`)}-${t}`)})}),r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[var(--color-amber-soft)] px-3 py-2 text-[10px] text-[var(--color-amber)]`,children:[(0,j.jsx)(`strong`,{children:I(`建议`)}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:r.slice(0,5).map((e,t)=>(0,j.jsx)(`li`,{children:$(e)},`${$(e)}-${t}`))})]}):null]})})():e.id===`plugin-check-panel`?(()=>{let e=n?.latest!==null&&typeof n?.latest==`object`?n.latest:void 0,t=e?.checks!==null&&typeof e?.checks==`object`?e.checks:void 0,r=Array.isArray(e?.errors)?e.errors:[],i=Array.isArray(e?.warnings)?e.warnings:[],a=Array.isArray(e?.reports)?e.reports:[],o=Array.isArray(e?.checks)?e.checks:[],s=$(e?.verdict??`—`),c=s===`pass`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:s===`warn`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e?.scanned===void 0?e?.verdict===void 0?o.length>0?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px] text-[var(--color-muted)]`,children:I(`检查清单:{v0} 项`,{v0:o.length})}):null:(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate text-[var(--color-muted)]`,children:$(e.repo??I(`当前插件`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${c}`,children:s})]}):(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`目录扫描`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 个仓库`,{v0:$(e.scanned)})})]}),t?(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`通过`),t.passed??0],[I(`失败`),t.failed??0],[I(`警告`),t.warned??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}):null,a.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:a.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.verdict??`—`);return(0,j.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[var(--color-muted)]`,children:$(n.repo??I(`未知仓库`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r===`pass`?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:r===`warn`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:r})]},`${$(n.repo??`repo`)}-${t}`)})}):r.length>0||i.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:[...r,...i].slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-red)]`,children:$(n.code??`issue`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[var(--color-muted)]`,children:$(n.message,``)})]},`${$(n.code??`issue`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未检查插件。Agent 可调用 plugin_check 执行 check、scan 或 schema。`)}),(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`只读检查,不修改、不构建被检仓库。`)})]})})():e.id===`plugin-radar-panel`?(()=>{let e=Array.isArray(n?.results)?n.results:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`GitHub Pi Harness 生态`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 个仓库 · {v1} 个来源`,{v0:$(n?.total??0),v1:Array.isArray(n?.sources)?n.sources.length:0})})]}),n?.query?(0,j.jsx)(`div`,{className:`text-[11px] text-[var(--color-muted)]`,children:I(`查询:{v0}`,{v0:$(n.query)})}):null,e.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.topics)?n.topics.filter(e=>typeof e==`string`).slice(0,3):[],i=typeof n.url==`string`?n.url:void 0;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`w-4 shrink-0 text-right font-mono text-[10px] text-[var(--color-faint)]`,children:t+1}),i?(0,j.jsx)(`a`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--color-blue)] hover:underline`,href:i,rel:`noreferrer`,target:`_blank`,children:$(n.fullName??n.name??I(`未知仓库`))}):(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.fullName??n.name??I(`未知仓库`))}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--color-amber)]`,children:[`★ `,$(n.stars??0)]})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate pl-6 text-[10px] text-[var(--color-muted)]`,children:$(n.description,I(`暂无描述`))}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-2 pl-6 text-[9px] text-[var(--color-faint)]`,children:[n.language?(0,j.jsx)(`span`,{children:$(n.language)}):null,n.updatedAt?(0,j.jsx)(`span`,{className:`font-mono`,children:I(`更新 {v0}`,{v0:$(n.updatedAt)})}):null,r.length>0?(0,j.jsx)(`span`,{className:`truncate`,children:r.map(e=>`#${e}`).join(` `)}):null]})]},`${$(n.fullName??`repo`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:n?.fetchedAt?I(`未找到匹配的 Pi Harness 仓库。`):I(`尚未搜索插件。Agent 可调用 plugin_radar_search 从 GitHub 发现 Pi Harness 插件。`)}),n?.truncated||e.length>8?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅展示部分结果,可缩小查询范围;GitHub 可能返回不完整结果。`)}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`按 Star 排序的 Topic 匹配仓库,尚未验证插件可安装性;不会安装或执行仓库代码。`)})]})})():e.id===`hol-guard-panel`?(()=>{let e=Array.isArray(n?.receipts)?n.receipts:[],t=n?.latest!==null&&typeof n?.latest==`object`?n.latest:void 0,r=e=>I(e===`blocked`?`高风险`:e===`review`?`需复核`:`安全`),i=e=>e===`blocked`?`bg-[var(--color-red-soft)] text-[var(--color-red)]`:e===`review`?`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`bg-[var(--color-green-soft)] text-[var(--color-green)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`高风险`),n?.blocked??0],[I(`需复核`),n?.review??0],[I(`安全`),n?.safe??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),t?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] px-3 py-2 text-[10px] ${i(t.risk)}`,children:[(0,j.jsx)(`span`,{children:I(`最近一次:{v0}`,{v0:$(t.source,`unknown`)})}),(0,j.jsx)(`strong`,{children:I(`{v0} · {v1} 项`,{v0:r(t.risk),v1:$(t.findings&&Array.isArray(t.findings)?t.findings.length:0)})})]}):null,e.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsx)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近风险摘要`)}),e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},a=Array.isArray(n.findings)?n.findings:[];return(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${i(n.risk)}`,children:r(n.risk)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[var(--color-muted)]`,children:$(n.source,`unknown`)}),(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:I(`{v0} 项`,{v0:a.length})})]},`${$(n.source)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未收到工具调用。Agent 可调用 hol_guard_scan 预检命令或文本。`)}),(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅保存风险摘要和计数,不保存命令、路径或凭据原文;风险等级仅供审计,HOL Guard 不会阻止任何工具执行。`)})]})})():e.id===`tab-manager-panel`?(()=>{let e=Array.isArray(n?.tabs)?n.tabs:[],t=n?.activation!==null&&typeof n?.activation==`object`?n.activation:void 0,r={waiting:I(`等待当前轮结束`),switching:I(`正在切换会话`),completed:I(`会话切换完成`),cancelled:I(`会话切换已取消`),failed:I(`会话切换失败`)};return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3 text-[11px]`,children:[(0,j.jsxs)(`p`,{children:[I(`当前会话:`),(0,j.jsx)(`code`,{children:$(n?.currentSessionPath??I(`未持久化`))})]}),t?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dde3ec] p-3`,children:[(0,j.jsx)(`strong`,{children:r[$(t.state)]??I(`未知切换状态`)}),(0,j.jsx)(`p`,{className:`break-all`,children:$(t.sessionPath)}),t.error?(0,j.jsx)(`p`,{className:`text-[var(--color-red)]`,children:$(t.error)}):null]}):null,(0,j.jsx)(`p`,{children:I(`{v0} / 24 个标签 · {v1} 次存储写入`,{v0:e.length,v1:$(n?.writes??0)})}),(0,j.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let r=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#dde3ec] p-3`,children:[(0,j.jsx)(`strong`,{children:$(r.label)}),` `,r.pinned===!0?I(`已固定`):I(`未固定`),r.sessionPath===n?.currentSessionPath?I(` · 当前会话`):``,(0,j.jsx)(`p`,{className:`break-all font-mono text-[10px]`,children:$(r.sessionPath)})]},t)})}),(0,j.jsx)(`p`,{className:`text-[var(--color-faint)]`,children:I(`通过 session_tab_manage 管理标签。activate 在当前轮结束后切换真实会话;移除标签不会删除会话文件。`)})]})})():e.id===`synapse-panel`?(()=>{let e=Array.isArray(n?.nodes)?n.nodes:[],t=Array.isArray(n?.edges)?n.edges:[],r=new Map(e.filter(e=>typeof e==`object`&&!!e).map(e=>[$(e.id),e]));return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`会话`),e.length],[I(`分支`),t.length],[I(`父会话未显示`),n?.orphanCount??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),n?.activeSessionId?(0,j.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-1 rounded-lg border border-[#b9d0ff] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px] text-[var(--color-blue)]`,children:[I(`当前会话:`),(0,j.jsx)(`code`,{className:`font-mono`,children:$(n.activeSessionId)})]}):null,e.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsx)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`最近会话 {v0} / {v1}`,{v0:Math.min(e.length,8),v1:e.length})}),e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border px-3 py-2 ${n.active===!0?`border-[#b9d0ff] bg-[var(--color-blue-soft)]`:`border-[var(--color-line)] bg-[var(--color-surface)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.active===!0?`bg-[#3565c5]`:`bg-[var(--color-blue-soft)]`}`}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:$(n.label??n.sessionId??I(`未命名会话`))}),(0,j.jsx)(`span`,{className:`font-mono text-[9px] text-[var(--color-faint)]`,children:I(`{v0} 条消息`,{v0:$(n.messageCount??0)})})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:$(n.cwd??I(`未知工作区`))}),(0,j.jsx)(`span`,{children:I(`{v0} 个分支`,{v0:$(n.branchCount??0)})})]})]},`${$(n.id??`session`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前工作区还没有可投影的持久化会话。`)}),t.length>0?(0,j.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`text-[9px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`Fork 关系`)}),t.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},i=r.get($(n.from)),a=r.get($(n.to));return(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[var(--color-muted)]`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:$(i?.label??n.from)}),(0,j.jsx)(`span`,{className:`shrink-0 text-[var(--color-blue)]`,children:`→ fork →`}),(0,j.jsx)(`span`,{className:`truncate`,children:$(a?.label??n.to)})]},`${$(n.from)}-${$(n.to)}-${t}`)})]}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`数据来源:Pi 原生 JSONL 会话;Agent 可调用 synapse_session_map 刷新。节点展示 {v0} / {v1};{v2} 当前工作区:{v3}。面板最多显示 8 个节点和 5 条关系。`,{v0:e.length,v1:$(n?.total),v2:n?.truncated===!0?I(`结果已截断,未显示的父会话不代表文件丢失。`):I(`已返回全部列出的会话。`),v3:$(n?.cwd)})})]})})():e.id===`archify-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.components)?e.components:[],r=Array.isArray(e.dependencies)?e.dependencies:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`组件`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:$(t.length)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`外部依赖`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:$(r.length)})]})]}),(0,j.jsx)(`div`,{className:`grid gap-1.5`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3565c5]`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[var(--color-ink)]`,children:$(n.path??I(`组件`))}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:[$(n.files??0),` files`]})]},`${$(n.path??`component`)}-${t}`)})}),r.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.slice(0,12).map((e,t)=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-blue-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:$(e)},`${$(e)}-${t}`))}):null,(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(e.mermaid,``)}),e.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`扫描达到节点上限,架构图可能不完整。`)}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 architecture_map 生成当前工作区架构图。`)})}):e.id===`canvas-draw-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`Mermaid 流程图`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 节点 · {v1} 连线`,{v0:$(n?.nodeCount??0),v1:$(n?.edgeCount??0)})})]}),n?.latest&&typeof n.latest==`object`?(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.latest.mermaid,``)}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 canvas_draw 生成流程图源码。`)})]}):e.id===`image-compressor-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`PNG 无损压缩`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-muted)]`,children:I(`上限 32 MiB`)})]}),n?.last&&typeof n.last==`object`?(()=>{let e=n.last;return(0,j.jsx)(`div`,{className:`rounded-lg border border-[#b9e6c9] bg-[var(--color-green-soft)] px-3 py-3 text-[11px] text-[var(--color-green)]`,children:I(`{v0} → {v1},节省 {v2} bytes`,{v0:$(e.inputPath??I(`图片`)),v1:$(e.outputPath??I(`输出`)),v2:$(e.savedBytes??0)})})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 image_compress,写入前必须 confirm=true。`)})]}):e.id===`workspace-search-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`p`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:[I(`工作区:`),$(n?.cwd,``)]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[var(--color-ink)]`,children:I(`工作区文本检索`)}),(0,j.jsx)(`span`,{className:`font-mono text-[var(--color-blue)]`,children:I(`{v0} 个匹配`,{v0:$(n?.matchCount??0)})})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.matches)?e.matches:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`break-all text-[10px] text-[var(--color-muted)]`,children:I(`查询:{v0} · 路径:{v1}`,{v0:$(e.query),v1:$(e.path)})}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`已搜索 {v0} 个文件,跳过 {v1} 个;显示 {v2} / {v3} 条已收集匹配。`,{v0:$(e.scannedFiles),v1:$(e.skippedFiles),v2:Math.min(5,t.length),v3:t.length})}),e.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`结果不完整:已达到扫描、读取或结果上限,存在跳过文件,或匹配片段已裁剪。`)}):null,t.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:t.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`strong`,{className:`block truncate font-mono text-[10px] text-[var(--color-blue)]`,children:[$(n.path??I(`未知文件`)),`:`,$(n.line??`?`)]}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:$(n.text,``)})]},`${$(n.path??`match`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有找到匹配内容。`)})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`Agent 可调用 workspace_search 检索当前工作区。`)})]}):e.id===`recall-unread-panel`?(()=>{let e=xo(n),t=e.items.slice(0,8);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`:`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:[e.status.state===`failed`?I(`扫描失败`):I(`扫描已取消`),e.status.error===null?null:(0,j.jsx)(`p`,{className:`mt-1`,children:I(`原因:{v0}`,{v0:e.status.error})})]}):null,(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`候选`),e.inventory.candidates],[I(`已扫描`),e.inventory.scanned],[I(`未回答`),e.total]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map((e,t)=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:e.name}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] text-[var(--color-faint)]`,children:I(`{v0} 条消息`,{v0:e.messageCount})})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap break-words text-[10px] leading-4 text-[var(--color-muted)]`,children:e.message})]},`${e.id}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:e.status.state===`idle`?I(`当前会话尚未扫描,请运行 session_recall_unread。`):e.status.state===`running`?I(`正在扫描未回答的会话…`):I(`没有以未回答用户消息结束的会话。`)}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`已扫描 {scanned}/{available} 个会话文件,界面显示 {shown}/{unread} 个;只读扫描,不会修改会话。{note}`,{scanned:e.inventory.scanned,available:e.inventory.available,shown:t.length,unread:e.inventory.unread,note:e.inventory.truncated?I(` 部分结果因发现、扫描或展示上限被截断。`):``})})]})})():e.id===`turn-rewind-panel`?(()=>{let e=Ao(n),t={queued:I(`已排队`),running:I(`执行中`),completed:I(`已回退`),failed:I(`失败`),cancelled:I(`已取消`)};return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.latest===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有执行回退操作。`)}):(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${{queued:`border-[#dce5f5] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`,running:`border-[#dce5f5] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`,completed:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`,failed:`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`,cancelled:`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}[e.latest.status]}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em]`,children:I(`最近操作`)}),(0,j.jsx)(`span`,{className:`rounded-full bg-[var(--color-surface)]/70 px-2 py-1 text-[10px] font-semibold`,children:t[e.latest.status]})]}),(0,j.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-4 text-[var(--color-ink)]`,children:e.latest.target.text}),e.latest.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:e.latest.error}),e.latest.summarized?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-4`,children:I(`已请求分支摘要;该选项可能调用模型并产生费用。`)}):null]}),(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:I(`可回退轮次`)}),e.candidates.length>0?e.candidates.map((t,n)=>(0,j.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 font-mono text-[10px] text-[var(--color-blue)]`,children:e.candidates.length-n}),(0,j.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-[11px] leading-4 text-[var(--color-muted)]`,children:t.text})]},`${t.entryId}-${n}`)):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前会话还没有可回退的用户轮次。`)})]}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`已检查当前分支 {v0} 个条目;后端保留 {v1} 个候选,界面显示 {v2} 个。 {v3}`,{v0:e.inventory.scannedEntries,v1:e.inventory.shown,v2:e.candidates.length,v3:e.inventory.truncated?I(` 部分结果因扫描、候选或显示上限被截断。`):``})})]})})():e.id===`skill-guard-panel`?(()=>{let e=ys(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[var(--color-red-soft)] text-[var(--color-red)]`:`border-[#f4d8a8] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:[e.status.state===`failed`?I(`扫描失败`):I(`扫描已取消`),e.status.error===null?null:(0,j.jsx)(`p`,{className:`mt-1`,children:I(`原因:{v0}`,{v0:e.status.error})})]}):null,n?.query?(0,j.jsxs)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:[I(`最近完成扫描的查询:`),$(n.query)]}):null,(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`已扫描`),e.total],[I(`高风险`),e.blocked],[I(`待复核`),e.review]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.reports.length>0?e.reports.slice(0,8).map((e,t)=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e.risk===`blocked`?`bg-[#d64545]`:e.risk===`review`?`bg-[#e0a11a]`:`bg-[#22a06b]`}`}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[var(--color-ink)]`,children:e.name}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.risk===`blocked`?I(`高风险`):e.risk===`review`?I(`复核`):I(`未命中规则`)})]}),e.findings.length>0?(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[var(--color-muted)]`,children:e.findings.map(e=>e.code).join(` · `)}):null]},`${e.name}-${t}`)):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`暂无 Skill 扫描结果,可让 Agent 调用 skill_guard_scan。`)})}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`已加载 {v0} 个入口,本次查询匹配 {v1} 个,扫描 {v2} 个,面板显示 {v3} 个;风险等级仅供审计,不会禁用 Skill,也不证明内容安全。`,{v0:e.inventory.available,v1:$(n?.matched),v2:e.inventory.scanned,v3:Math.min(e.reports.length,8)})})]})})():e.id===`prompt-guard-panel`?(()=>{let e=n?.highest&&typeof n.highest==`object`?n.highest:void 0,t=e,r=e?.risk;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${r===`blocked`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:r===`review`?`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:[(0,j.jsxs)(`span`,{children:[I(r===`blocked`?`高风险,需处理`:r===`review`?`需要人工复核`:e?`未命中检测规则`:`尚未扫描`),t&&r!==`safe`&&r!==void 0?(0,j.jsx)(`span`,{className:`ml-2 font-mono text-[10px]`,children:$(t.source,`unknown`)}):null]}),(0,j.jsx)(`strong`,{className:`font-mono`,children:I(`{v0} 次扫描`,{v0:$(n?.scans??0)})})]}),t?(()=>{let e=t,n=Array.isArray(e.findings)?e.findings:[];return n.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-4 py-3 text-[10px] text-[var(--color-muted)]`,children:n.slice(0,4).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:$(n.code??`finding`)}),`: `,$(n.message,``)]},`${$(n.code??`finding`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`已扫描内容未命中当前检测规则,不代表没有风险。`)})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`尚未扫描任何内容。用户消息和工具输出会自动扫描,Agent 也可调用 prompt_guard_scan 检查不可信文本。`)}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`被动审计:不会阻断模型或工具执行。超出扫描上限的内容需要另行检查。`)})]})})():e.id===`code2skill-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`已生成技能`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:$(n?.generated??0)})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(0,j.jsx)(`p`,{className:`mt-2 truncate text-[11px] text-[var(--color-muted)]`,children:I(`{slug} · {files} 个参考文件`,{slug:$(n.latest.slug??`skill`),files:$(Array.isArray(n.latest.files)?n.latest.files.length:0)})}):(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`还没有生成技能。可让 Agent 调用 skill_pack_create。`)})]}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`输出目录:项目 .pi/skills/<name>,包含 SKILL.md 和原始参考文件。`)})]}):e.id===`genui-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(()=>{let e=Qi(n),t={neutral:`border-[var(--color-line)] bg-[var(--color-soft)] text-[var(--color-muted)]`,info:`border-[#d9e4f7] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`,success:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`,warning:`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`,danger:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`};return e.latest===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有结构化卡片。可让 Agent 调用 genui_render。`)}):(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 break-words text-[var(--color-ink)]`,children:e.latest.title}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--color-faint)]`,children:I(`{v0} 次`,{v0:e.rendered})})]}),e.latest.blocks.map((e,n)=>e.type===`progress`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${t[e.tone]}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label}),(0,j.jsxs)(`strong`,{className:`shrink-0`,children:[e.value,`%`]})]}),(0,j.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-[var(--color-surface)]/70`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-current`,style:{width:`${e.value}%`}})})]},`${e.label}-${n}`):e.type===`text`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 text-[11px] ${t[e.tone]}`,children:[(0,j.jsx)(`strong`,{className:`block text-[10px]`,children:e.label}),(0,j.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words leading-4`,children:e.value})]},`${e.label}-${n}`):(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-[11px] ${t[e.tone]}`,children:[(0,j.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label}),(0,j.jsx)(`strong`,{className:`min-w-0 break-words text-right`,children:e.value})]},`${e.label}-${n}`)),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`最多 {v0} 块`,{v0:e.limits.blocks})}),(0,j.jsx)(`span`,{children:I(`总文本上限 {v0} 字符`,{v0:e.limits.totalText})}),e.latest.renderedAt===null?null:(0,j.jsxs)(`span`,{children:[e.latest.renderedAt.slice(11,19),` UTC`]}),e.latest.truncated?(0,j.jsx)(`span`,{children:I(`面板明细已截断`)}):null]})]})})(),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`仅渲染结构化文本、徽标和进度块;HTML 与脚本按普通文本显示。`)})]}):e.id===`anchored-standard-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(()=>{let e=Array.isArray(n?.violations)?n.violations:[],t=n?.status===`violated`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`}`,children:[(0,j.jsx)(`span`,{children:t?I(`轨迹存在违规`):n?.status===`anchored`?I(`运行已锚定`):I(`等待 Agent 运行`)}),(0,j.jsx)(`strong`,{className:`font-mono`,children:I(`{v0} 事件`,{v0:$(n?.events??0)})})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`工具调用`),` `,(0,j.jsx)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:$(n?.toolCalls??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`违规项`),` `,(0,j.jsx)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:$(e.length)})]})]}),e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#f4caca] bg-[var(--color-soft)] px-3 py-2 text-[10px] text-[var(--color-red)]`,children:e.slice(0,4).map((e,t)=>(0,j.jsx)(`li`,{children:$(e&&typeof e==`object`?e.message??I(`违规`):e)},`${$(e)}-${t}`))}):null]})})(),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`可让 Agent 调用 trajectory_anchor_check 审计当前执行轨迹。`)})]}):e.id===`telemetry-blocker-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#b9e6c9] bg-[var(--color-green-soft)] px-3 py-3 text-[11px] text-[var(--color-green)]`,children:[(0,j.jsx)(`span`,{children:I(`本地遥测服务不发送事件`)}),(0,j.jsx)(`strong`,{className:`font-mono`,children:I(`丢弃 {v0} 次 · 总线观察 {v1} 次`,{v0:$(n?.discarded??0),v1:$(n?.observed??0)})})]}),(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[10px] text-[var(--color-muted)]`,children:Array.isArray(n?.names)&&n.names.length>0?I(`事件名:{names}`,{names:n.names.slice(0,8).map(String).join(I(`、`))}):I(`尚未收到遥测事件。`)}),(0,j.jsxs)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:[I(`最多保留 100 个事件名,界面显示前 8 个;`),n?.namesTruncated===!0?I(`事件名已截断。`):``,I(`不读取或保存事件属性。此服务不拦截网络,也不阻止其他事件监听器。`)]})]}):e.id===`plugin-dev-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=B(n),t={idle:{label:I(`等待重载`),style:`border-[var(--color-line)] bg-[var(--color-soft)] text-[var(--color-muted)]`},queued:{label:I(`等待当前运行结束`),style:`border-[#d9e4f7] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`},running:{label:I(`正在重载会话资源`),style:`border-[#d9e4f7] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`},reloaded:{label:I(`会话资源已重载`),style:`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`},failed:{label:I(`会话资源重载失败`),style:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`},cancelled:{label:I(`会话资源重载已取消`),style:`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}}[e.status];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t.style}`,children:[(0,j.jsx)(`span`,{children:t.label}),(0,j.jsx)(`strong`,{className:`font-mono`,children:e.status})]}),(0,j.jsx)(`p`,{className:`break-words text-[10px] text-[var(--color-faint)]`,children:e.reason||I(`修改本地扩展后调用 plugin_dev_reload`)}),e.error===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[var(--color-red-soft)] px-3 py-2 text-[10px] text-[var(--color-red)]`,children:e.error}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`原因上限 {v0} 字符`,{v0:e.limits.reasonCharacters})}),(0,j.jsx)(`span`,{children:I(`错误上限 {v0} 字符`,{v0:e.limits.errorCharacters})}),e.reloadedAt===null?null:(0,j.jsxs)(`span`,{children:[e.reloadedAt.slice(11,19),` UTC`]})]})]})})()}):e.id===`openpets-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=po(n),t={idle:I(`休息`),focused:I(`专注`),happy:I(`开心`),concerned:I(`担心`)}[e.mood];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-[var(--color-blue-soft)] text-[20px] text-[var(--color-blue)]`,children:`◉`}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[13px] text-[var(--color-ink)]`,children:e.name}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.lastEvent})]}),(0,j.jsx)(`span`,{className:`rounded-full bg-[var(--color-blue-soft)] px-2 py-1 text-[10px] text-[var(--color-blue)]`,children:t})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`能量`),` `,(0,j.jsxs)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:[e.energy,`%`]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`互动`),` `,(0,j.jsx)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:e.interactions})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:I(`恢复扫描 {v0} / {v1}`,{v0:e.recovery.scanned,v1:e.recovery.sessionEntries})}),(0,j.jsx)(`span`,{children:e.recovery.restored?I(`已恢复状态`):I(`使用初始状态`)}),(0,j.jsx)(`span`,{children:I(`持久化 {v0} / {v1}`,{v0:e.persistence.attempts-e.persistence.failures,v1:e.persistence.attempts})}),e.updatedAt===null?null:(0,j.jsxs)(`span`,{children:[e.updatedAt.slice(11,19),` UTC`]})]}),e.persistence.lastError===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[var(--color-red-soft)] px-3 py-2 text-[10px] text-[var(--color-red)]`,children:e.persistence.lastError}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`根据真实 Pi 会话事件自动反应,也可让 Agent 调用 pet_react 进行互动。`)})]})})()}):e.id===`change-verifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=e.tests&&typeof e.tests==`object`?e.tests:{},r=e.review&&typeof e.review==`object`?e.review:{},i=$(e.status??`fail`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${i===`pass`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:i===`warning`?`border-[#f3dfab] bg-[var(--color-amber-soft)] text-[var(--color-amber)]`:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:[(0,j.jsx)(`span`,{children:I(i===`pass`?`门禁通过`:i===`warning`?`门禁有警告`:`门禁失败`)}),(0,j.jsx)(`strong`,{className:`font-mono`,children:I(`{v0} 次`,{v0:$(n.runs??0)})})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[var(--color-muted)]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`测试 exit`),` `,(0,j.jsx)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:$(t.exitCode??`—`)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[I(`审查`),` `,(0,j.jsx)(`strong`,{className:`ml-1 text-[var(--color-ink)]`,children:$(r.status??`—`)})]})]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有执行发布门禁。可让 Agent 调用 verify_change_gate。`)}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`复用 run_project_tests 和 review_changes,不重复实现测试或审查逻辑。`)})]}):e.id===`readme-gen-panel`?(()=>{let e=nl(n);if(e.malformed)return(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] leading-5 text-[var(--color-red)]`,children:I(`README 面板数据无效,暂不展示生成或写入结果。`)});let t=e.status.state===`idle`?I(`等待生成`):e.status.state===`running`?e.status.operation===`write`?I(`正在写入`):I(`正在生成`):e.status.state===`completed`?e.status.operation===`write`?I(`写入已完成`):I(`草稿已生成`):e.status.state===`failed`?e.status.operation===`write`?I(`写入失败`):I(`生成失败`):e.status.operation===`write`?I(`写入已取消`):I(`生成已取消`),r=e.status.state===`failed`||e.status.state===`cancelled`?`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`:e.status.state===`completed`?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:`border-[#dce5f5] bg-[var(--color-blue-soft)] text-[var(--color-blue)]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 rounded-lg border px-3 py-2 text-[10px] ${r}`,children:[(0,j.jsx)(`strong`,{className:`font-semibold`,children:t}),e.status.at===null?null:(0,j.jsxs)(`time`,{className:`shrink-0 font-mono`,children:[e.status.at.slice(11,19),` UTC`]})]}),e.generated===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] leading-5 text-[var(--color-faint)]`,children:I(`还没有生成 README 草稿。让 Agent 调用 readme_report 先检查内容。`)}):(0,j.jsxs)(`div`,{className:`min-w-0 border-l-2 border-[#7aa2e8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsx)(`p`,{className:`break-all text-[12px] font-semibold leading-5 text-[var(--color-ink)]`,children:e.generated.name}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-faint)]`,children:I(`{v0} 个脚本 · {v1} 个运行时插件`,{v0:e.generated.scripts,v1:e.generated.plugins})})]}),e.lastWrite===null?null:(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#dce5f5] bg-[var(--color-surface)] px-3 py-2 text-[var(--color-blue)]`,children:[(0,j.jsx)(`p`,{className:`break-all font-mono text-[10px] leading-4`,children:e.lastWrite.path}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[var(--color-faint)]`,children:[new Intl.NumberFormat(L()).format(e.lastWrite.bytes),` bytes · `,e.lastWrite.overwritten?I(`已覆盖`):I(`新文件`)]})]}),e.status.error===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:e.status.error}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-faint)]`,children:I(`写入需要 confirm=true,覆盖已有 README 还需要 overwrite=true。`)})]})})():e.id===`sql-lens-panel`?(()=>{let e=Ks(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`SQL Lens 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再查询。`)})]});let t=e.latest,r=e.status.state===`running`?I(`查询中`):e.status.state===`completed`?I(`已完成`):e.status.state===`failed`?I(`查询失败`):e.status.state===`cancelled`?I(`已取消`):I(`等待查询`);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[var(--color-soft)] px-2 py-1 font-semibold text-[var(--color-blue)]`,children:r}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString(L())})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:e.status.error}),t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有查询数据库。可让 Agent 调用 sql_readonly。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`p`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:[I(`查询工作区:`),t.cwd]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,title:t.database,children:t.database}),(0,j.jsxs)(`strong`,{className:`shrink-0 font-mono text-[12px] text-[var(--color-blue)]`,children:[t.rowInventory.returned,` rows`]})]}),(0,j.jsx)(`code`,{className:`mt-2 block max-h-16 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[var(--color-faint)]`,children:t.query})]}),(0,j.jsxs)(`p`,{className:`break-words text-[10px] text-[var(--color-faint)]`,children:[I(`列:`),t.columns.join(`, `)]}),(0,j.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:JSON.stringify(t.rows,null,2)}),t.rowInventory.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板显示 {v0} / {v1} 行;已迭代 {v2} 行,行、列或单元格展示已截断。这不是匹配总行数。`,{v0:t.rowInventory.shown,v1:t.rowInventory.returned,v2:t.rowInventory.scanned})}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`timeout:`,e.timeoutMs,`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`rows:`,e.limits.rows]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`result:`,Math.round(e.limits.resultBytes/1024),`KiB`]})]})]})})():e.id===`theme-studio-panel`?(()=>{let t=Ie(e.data);return t?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px] text-[var(--color-ink)]`,children:t.label}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-muted)]`,children:t.description}),(0,j.jsxs)(`p`,{className:`mt-1 break-all text-[10px] text-[var(--color-muted)]`,children:[I(`会话:`),t.sessionId]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`light`,`midnight`,`paper`,`high-contrast`].map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] px-3 py-2 text-[11px] text-[var(--color-ink)]`,children:[e,e===t.theme?I(` · 当前`):``]},e))}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[var(--color-muted)]`,children:[I(`可让 Agent 调用 theme_set 切换预设。`),t.changedAt?I(`最近选择:{v0}`,{v0:t.changedAt}):I(`使用配置默认主题。`)]})]}):(0,j.jsx)(`p`,{className:`mt-3 text-[11px] text-[var(--color-red)]`,children:I(`主题数据无效,未应用颜色。`)})})():e.id===`mirage-bridge-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${n?.available===!0?`border-[#b9e6c9] bg-[var(--color-green-soft)]`:n?.available===!1?`border-[#f3dfab] bg-[var(--color-amber-soft)]`:`border-[var(--color-line)] bg-[var(--color-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`官方 Mirage CLI`)}),(0,j.jsx)(`strong`,{className:`text-[11px] ${n?.available===!0?`text-[var(--color-green)]`:n?.available===!1?`text-[var(--color-amber)]`:`text-[var(--color-faint)]`}`,children:n?.available===!0?I(`已连接`):n?.available===!1?I(`未检测到`):I(`未检查`)})]}),(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:$(n?.version??n?.executable??`mirage`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[11px] text-[var(--color-muted)]`,children:I(`虚拟工作区:{v0}`,{v0:$(n?.workspaceId??I(`未配置`))})})]}),n?.lastRun&&typeof n.lastRun==`object`?(()=>{let e=n.lastRun;return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.exitCode===0?`border-[#b9e6c9] bg-[var(--color-green-soft)]`:`border-[#f4caca] bg-[var(--color-red-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[var(--color-ink)]`,children:$(e.command??``)}),(0,j.jsxs)(`strong`,{className:`shrink-0 text-[11px] ${e.exitCode===0?`text-[var(--color-green)]`:`text-[var(--color-red)]`}`,children:[`exit `,$(e.exitCode??`—`)]})]}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-[var(--color-muted)]`,children:I(`耗时 {v0} ms`,{v0:$(e.durationMs??0)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`先调用 mirage_doctor 检查 CLI,再调用 mirage_execute。`)}),n?.lastError?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[var(--color-amber)]`,children:$(n.lastError)}):null]}):e.id===`docker-sandbox-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Mi(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Docker Sandbox 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再运行。`)})]});let t=e.latest,r=t?.status===`completed`&&t.exitCode===0;return(0,j.jsxs)(j.Fragment,{children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有沙箱运行。仅使用本地镜像,默认无网络、工作区只读。`)}):(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${r?`border-[#b9e6c9] bg-[var(--color-green-soft)]`:`border-[#f4caca] bg-[var(--color-red-soft)]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:t.image}),(0,j.jsx)(`strong`,{className:`shrink-0 font-mono text-[12px] ${r?`text-[var(--color-green)]`:`text-[var(--color-red)]`}`,children:t.status===`timed_out`?I(`超时`):`exit ${t.exitCode}`})]}),(0,j.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-4 text-[var(--color-muted)]`,children:t.command.map(e=>JSON.stringify(e)).join(` `)}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:t.write?I(`工作区可写(已确认)`):I(`工作区只读`)}),(0,j.jsx)(`span`,{children:I(`{v0} 个 argv 参数`,{v0:t.commandCount})}),t.truncated?(0,j.jsx)(`span`,{children:I(`面板明细已截断`)}):null]}),t.output?(0,j.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-[var(--color-surface)]/70 px-2 py-2 text-[10px] leading-4 text-[var(--color-muted)]`,children:t.output}):null]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`image:${e.defaults.image}`,`image`],[`pull:${e.defaults.pull}`,`pull`],[`network:${e.defaults.network}`,`network`],[`rootfs:${e.defaults.rootFilesystem}`,`rootfs`],[`workspace:${e.defaults.workspace}`,`workspace`],[`memory:${e.defaults.memory}`,`memory`],[`cpus:${e.defaults.cpus}`,`cpus`],[`pids:${e.defaults.pids}`,`pids`],[`timeout:${e.defaults.timeoutMs}ms`,`timeout`]].map(([e,t])=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:e},t))})]})})()}):e.id===`yaml-validator-panel`?(()=>{let e=Un(n),t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`p`,{className:`break-all text-[10px] text-[var(--color-faint)]`,children:[I(`工作区:`),e.cwd]}),e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[11px] text-[var(--color-red)]`,children:I(`最近一次校验{v0}。{v1}`,{v0:e.status.state===`cancelled`?I(`已取消`):I(`失败`),v1:e.status.error??``})}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有校验 YAML。可让 Agent 调用 yaml_validate。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`break-all font-mono text-[10px] text-[var(--color-muted)]`,children:t.path}),(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t.valid?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:t.valid?I(`YAML 语法有效。`):I(`发现 {count} 个语法错误。`,{count:t.errorCount})}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`文档`),t.documents],[I(`错误`),t.errorCount],[I(`警告`),t.warningCount]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t})]},e))}),!t.valid&&t.errors.length>0?(0,j.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-[#f4caca] bg-[var(--color-soft)] p-3 text-[10px] leading-4 text-[var(--color-red)]`,children:t.errors.map(e=>`${e.line??`?`}:${e.column??`?`} ${e.message}`).join(`
|
|
26
26
|
`)}):null,t.warnings.length>0?(0,j.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-[var(--color-amber-soft)] p-3 text-[10px] leading-4 text-[var(--color-amber)]`,children:t.warnings.map(e=>`${e.line??`?`}:${e.column??`?`} ${e.message}`).join(`
|
|
27
|
-
`)}):null,t.diagnosticsTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`诊断预览已截断,完整计数保留在摘要中。`)}):null]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`max:`,Math.round(e.limits.fileBytes/1024),`KiB · read-only`]})]})})():e.id===`browser-session-panel`?(()=>{let e=Tr(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Browser Session 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新连接后再试。`)})]});let t=e.tabs,r=e.latest,i=r?.screenshot?I(`已截图`):r?.clicked===!0?I(`已点击`):r?.status===`read`||typeof r?.text==`string`?I(`已读取`):r?.status===`navigated`?I(`已导航`):void 0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:e.endpoint||I(`本地浏览器未连接`)}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${e.connected?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:e.connected?I(`已连接`):I(`未连接`)})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`Chrome DevTools Protocol · 显示 {v0}/{v1} 个可调试页面`,{v0:e.inventory.shown,v1:e.inventory.total})}),e.connected?null:(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-red)]`,children:I(`请使用 remote-debugging-port 启动 Chrome。{v0}`,{v0:e.error??``})})]}),i?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`最近动作`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:i})]}):null,r?.text===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[var(--color-muted)]`,children:r.text}),r.previewTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-amber)]`,children:I(`面板正文预览已截断。`)}):null]}),r?.screenshot===void 0?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px] text-[var(--color-blue)]`,children:I(`截图元数据:{v0} · {v1} bytes`,{v0:r.screenshot.mimeType,v1:r.screenshot.bytes.toLocaleString(L())})}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:e.title}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[var(--color-faint)]`,children:e.url})]},e.targetId))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有可调试的浏览器页面。`)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`tabs`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`read`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`click`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`screenshot`})]})]})})():e.id===`mcp-client-panel`?(()=>{let e=io(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(e.server??I(`尚未连接 MCP 服务器`))}),(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsx)(`span`,{children:I(`{v0} 工具`,{v0:e.inventory.tools.total})}),(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:`·`}),(0,j.jsx)(`span`,{children:I(`{v0} 资源`,{v0:e.inventory.resources.total})}),(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:`·`}),(0,j.jsx)(`span`,{children:I(`{v0} 提示`,{v0:e.inventory.prompts.total})})]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:e.lastCall===null?I(`使用 mcp_list_tools 发现 stdio 工具。`):I(`最近调用:{call}`,{call:e.lastCall})})]}),e.tools.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.tools.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,title:e.description,children:e.name},`${e.name}-${t}`))}):null,e.resources.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--color-faint)]`,children:I(`资源`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.resources.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-muted)]`,title:e.uri,children:e.name??e.uri},`${e.uri}-${t}`))})]}):null,e.prompts.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--color-faint)]`,children:I(`提示模板`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.prompts.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-muted)]`,title:e.description,children:e.name},`${e.name}-${t}`))})]}):null,e.servers.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.servers.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[var(--color-ink)]`,children:e.id}),(0,j.jsx)(`span`,{className:e.status===`running`?`text-[var(--color-green)]`:`text-[var(--color-faint)]`,children:e.status})]},`${e.id}-${t}`))}):null,e.inventory.tools.truncated||e.inventory.resources.truncated||e.inventory.prompts.truncated||e.inventory.servers.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`面板仅显示受限预览;完整清单请使用对应 MCP 列表工具。`)}):null,(0,j.jsx)(`p`,{className:`font-mono text-[9px] text-[var(--color-faint)]`,children:I(`响应上限 {v0} KiB · 请求超时 {v1} 秒`,{v0:Math.round(e.limits.responseBytes/1024),v1:Math.round(e.limits.requestTimeoutMs/1e3)})})]})})():e.id===`mcp-panel`?(()=>{let e=Array.isArray(n?.servers)?n.servers:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.id,I(`未命名服务器`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:$(n.status,`unknown`)})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:typeof n.toolCount==`number`?I(`{v0} 个 MCP 工具`,{v0:n.toolCount}):I(`工具尚未查询`)}),(0,j.jsx)(`span`,{children:`·`}),(0,j.jsx)(`span`,{children:$(n.statusSource,`runtime`)})]})]},`${$(n.id??`server`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前没有 MCP 服务器快照。`)}),(0,j.jsxs)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:[I(`读取 MCP 运行状态;工具列表通过 mcp_panel 的 tools 操作查询,健康建议通过 health 操作查看。`),n?.writesEnabled===!0?` 已启用 profile patch 写入:${$(n.patchPath)}`:I(` profile patch 写入未配置,apply 会被拒绝。`)]})]})})():e.id===`mock-server-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.running===!0?I(`运行中`):I(`未启动`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 路由`,{v0:$(n?.routes??0)})})]}),n?.url?(0,j.jsx)(`code`,{className:`rounded-md bg-[var(--color-surface)] px-3 py-2 text-[10px] text-[var(--color-muted)]`,children:$(n.url)}):null,n?.lastRequest?(0,j.jsx)(`p`,{className:`text-[11px] text-[var(--color-faint)]`,children:I(`最近请求:{v0}`,{v0:$(n.lastRequest)})}):null]}):e.id===`cli-notifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.enabled===!0?I(`已启用`):I(`已停用`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:[$(n?.platform??`unknown`),` · `,$(n?.timeoutMs??1e4),`ms`]})]}),Array.isArray(n?.notifications)&&n.notifications.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.notifications.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[var(--color-ink)]`,children:$(n.title??`Pi Harness`)}),(0,j.jsx)(`span`,{className:n.delivered===!0?`text-[var(--color-green)]`:`text-[var(--color-red)]`,children:n.delivered===!0?I(`已送达`):I(`未送达`)})]}),(0,j.jsx)(`span`,{className:`mt-1 block text-[var(--color-muted)]`,children:$(n.message,``)}),n.delivered!==!0&&n.reason?(0,j.jsx)(`span`,{className:`mt-1 block break-words text-[var(--color-red)]`,children:$(n.reason)}):null]},`${$(n.time??`notification`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有发送通知。`)})]}):e.id===`obsidian-sync-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.configured===!0?I(`已配置`):I(`未配置 vault`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:`Markdown`})]}),n?.vaultPath?(0,j.jsx)(`code`,{className:`truncate rounded-md bg-[var(--color-surface)] px-3 py-2 text-[10px] text-[var(--color-muted)]`,children:$(n.vaultPath)}):null,n?.last!==null&&n?.last!==void 0&&typeof n.last==`object`?(0,j.jsx)(`p`,{className:`text-[11px] text-[var(--color-faint)]`,children:I(`最近写入:{v0}`,{v0:$(n.last.relativePath??`note.md`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有同步笔记。`)})]}):e.id===`web-research-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-blue)]`,children:n?.keyless===!0?I(`未配置搜索 API key`):I(`已配置搜索 API key`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`最多 {v0} 条`,{v0:$(n?.maxResults??8)})})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.items)?e.items:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[var(--color-ink)]`,children:$(e.query??I(`网页搜索`))}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--color-faint)]`,children:I(`前 {v0} / 共 {v1}`,{v0:Math.min(8,t.length),v1:t.length})})]}),e.status===`degraded`?(0,j.jsxs)(`p`,{className:`rounded-lg bg-[var(--color-amber-soft)] px-3 py-2 text-[11px] text-[var(--color-amber)]`,children:[I(`搜索结果不完整或没有可用来源。`),$(e.summary,``)]}):null,(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`a`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 transition-colors hover:border-[#bdd0f5] hover:bg-[var(--color-soft)]`,href:$(n.url,``),rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:$(n.title??n.url??I(`来源`))}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[var(--color-blue)]`,children:$(n.source??n.url,``)}),n.snippet?(0,j.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.snippet)}):null]},`${$(n.url??`source`)}-${t}`)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有联网搜索。可让 Agent 调用 web_search;单页读取使用 read_page。`)}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`搜索词会发送到 Firecrawl;页面读取{v0}。`,{v0:n?.readPageAvailable===!0?I(`已复用本地 Browser Fetch`):I(`需要启用 Browser Fetch`)})})]}):e.id===`browser-fetch-panel`?(()=>{let e=nr(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Browser Fetch 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再抓取。`)})]});let t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有抓取网页。默认阻止本地和私有网络目标。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(t.finalUrl||t.url||`page`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[var(--color-green)]`,children:[`HTTP `,$(t.status||`—`)]})]}),(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(t.text,``)}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`响应正文已达到抓取上限。`)}):null,t.previewTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板仅显示有界预览。`)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`max:`,$(Math.round(e.limits.responseBytes/1024)),`KiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`timeout:`,$(e.limits.timeoutMs),`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`redirects:`,$(e.limits.redirects)]}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:`scripts:disabled`}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`private:`,$(e.allowPrivate?`allowed`:`blocked`)]})]})]})})():e.id===`i18n-pair-panel`?(()=>{let e=Ha(n),t=e.report,r=t!==null&&t.missingTotal===0&&t.extraTotal===0,i=e.status.state===`unknown`?I(`数据异常`):e.status.state===`running`?I(`检查中`):e.status.state===`failed`?I(`检查失败`):e.status.state===`cancelled`?I(`已取消`):e.status.state===`completed`?I(`已完成`):I(`等待检查`);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[var(--color-soft)] px-2 py-1 font-semibold text-[var(--color-blue)]`,children:i}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString(L())})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:e.status.error}),e.malformed?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:I(`面板数据不完整或不可信,未显示语言包统计。`)}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有检查语言包。可让 Agent 调用 i18n_check。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:r?I(`语言包键完全一致。`):I(`缺失 {missing} 个,额外 {extra} 个。`,{missing:t.missingTotal,extra:t.extraTotal})}),(0,j.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3 font-mono text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:I(`基准`)}),(0,j.jsx)(`span`,{className:`truncate text-[var(--color-ink)]`,title:t.base,children:t.base})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:I(`目标`)}),(0,j.jsx)(`span`,{className:`truncate text-[var(--color-ink)]`,title:t.target,children:t.target})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`基准键`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t.baseKeys})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`目标键`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t.targetKeys})]})]}),t.missing.length>0||t.extra.length>0?(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[{label:I(`缺失 · {count}`,{count:t.missingTotal}),keys:t.missing,tone:`text-[var(--color-red)]`},{label:I(`额外 · {count}`,{count:t.extraTotal}),keys:t.extra,tone:`text-[var(--color-amber)]`}].map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] ${e.tone}`,children:e.label}),(0,j.jsx)(`ul`,{className:`mt-2 max-h-36 space-y-1 overflow-auto font-mono text-[10px] text-[var(--color-ink)]`,children:e.keys.map((e,t)=>(0,j.jsx)(`li`,{className:`truncate`,title:e,children:e},`${e}-${t}`))})]},e.label))}):null,t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板仅显示有界键列表;完整结果保留在工具调用详情中。`)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`file:`,Math.round(e.limits.fileBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`depth:`,e.limits.depth]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`keys:`,e.limits.keysPerFile]})]})]})})():e.id===`cleaner-panel`?(()=>{let e=Jr(n);if(e.malformed||e.inventory===null)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Cleaner 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再执行清理。`)})]});let t=e.inventory,r=e.lastCleanup,i=r?.status===`running`?I(`清理中`):r?.status===`completed`?I(`已完成`):r?.status===`cancelled`?I(`已取消`):r?.status===`failed`?I(`清理失败`):I(`尚未清理`);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`Git 胶囊库存`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:I(`{v0} 个`,{v0:t.total})})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`仅清理 agent 数据目录中的 .patch 胶囊,必须显式 confirm=true。`)}),(0,j.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`capsules:`,e.limits.capsules]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`scan:`,e.limits.directoryEntries]})]})]}),r===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:r.status===`failed`?`text-[var(--color-red)]`:`text-[var(--color-ink)]`,children:i}),r.at===null?null:(0,j.jsx)(`time`,{className:`font-mono text-[var(--color-faint)]`,children:new Date(r.at).toLocaleString(L())})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[11px] text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{children:[I(`已删`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.removed})]}),(0,j.jsxs)(`span`,{children:[I(`保留`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.kept??`—`})]}),(0,j.jsxs)(`span`,{children:[I(`请求保留`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.requestedKeep})]})]}),r.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[var(--color-red)]`,children:r.error})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)]`,children:e.capsules.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[var(--color-ink)]`,title:e.name,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[var(--color-faint)]`,children:[e.bytes.toLocaleString(L()),` B`]})]},`${e.name}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前没有可清理的 Git 胶囊。`)}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板显示 {v0} / {v1} 个条目;清理工具仍按完整的有界库存执行。`,{v0:t.shown,v1:t.total})}):null]})})():e.id===`fail-logger-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Wi(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-red-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-red)]`,children:I(`聚合后的失败记录`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[17px] text-[var(--color-red)]`,children:e.total})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3 text-[10px] text-[var(--color-red)]`,children:[(0,j.jsx)(`span`,{children:I(`观测 {v0} 次`,{v0:e.observed})}),(0,j.jsx)(`span`,{children:I(`容量 {v0} / {v1}`,{v0:e.total,v1:e.capacity})}),e.dropped>0?(0,j.jsx)(`span`,{children:I(`已淘汰 {v0} 条旧记录`,{v0:e.dropped})}):null,e.truncated?(0,j.jsx)(`span`,{children:I(`面板明细已截断`)}):null]})]}),(0,j.jsx)(`div`,{className:`max-h-56 overflow-auto rounded-lg border border-[var(--color-line)]`,children:e.failures.length>0?e.failures.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-red)]`,children:e.source}),(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 font-mono text-[9px] text-[var(--color-faint)]`,children:[e.occurrences>1?(0,j.jsxs)(`strong`,{className:`text-[var(--color-red)]`,children:[`×`,e.occurrences]}):null,e.time===null?I(`时间未知`):`${e.time.slice(11,19)} UTC`]})]}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-[11px] leading-4 text-[var(--color-muted)]`,children:e.message})]},`${e.time??`failure`}-${t}`)):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[var(--color-faint)]`,children:I(`暂无失败记录。`)})})]})})()}):e.id===`context-insight-panel`?(()=>{let e=Zo(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-muted)]`,children:I(`上下文占用`)}),(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[var(--color-blue)]`,children:e.percent===null?`—`:`${e.percent}%`})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[var(--color-blue-soft)]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-[#5d8bea] transition-[width] duration-300`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[var(--color-muted)]`,children:[e.tokens===null?I(`令牌数未知`):`${e.tokens.toLocaleString(L())} tokens`,e.contextWindow===null?``:I(` / {limit} 上限`,{limit:e.contextWindow.toLocaleString(L())})]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`消息`),e.messages],[I(`事件`),e.events],[I(`压缩`),e.compactions]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`消息组成`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.messagesTruncated?I(`最近 {scanned} / {total} 条`,{scanned:e.scannedMessages,total:e.messages}):I(`全部 {count} 条`,{count:e.scannedMessages})})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-5 gap-1.5`,children:[[I(`用户`),e.composition.user],[I(`助手`),e.composition.assistant],[I(`工具`),e.composition.toolResult],[I(`系统`),e.composition.system],[I(`其他`),e.composition.other]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded bg-[var(--color-soft)] px-2 py-1.5 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-0.5 block font-mono text-[13px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`最近上下文事件`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`显示 {v0} / 保留 {v1} 条`,{v0:e.limits.displayedEvents,v1:e.limits.retainedEvents})})]}),(0,j.jsx)(`div`,{className:`mt-2 max-h-28 overflow-auto`,children:e.recentEvents.length>0?e.recentEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#f0f2f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-muted)]`,children:e.type}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.at===null?`—`:new Date(e.at).toLocaleTimeString(L())})]},`${e.type}-${e.at??`unknown`}-${t}`)):(0,j.jsx)(`div`,{className:`py-2 text-[11px] text-[var(--color-faint)]`,children:I(`暂无上下文事件。`)})}),e.recentEventsTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-faint)]`,children:I(`更早事件已按浏览器显示上限省略。`)}):null]})]})})():(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[var(--color-ink)]`,children:Rl(t)})]},e))})]})}function Vl({pluginName:e,busy:t,error:n,onCancel:r,onConfirm:i}){let a=il(!0,r,t);return(0,j.jsx)(`div`,{className:`plugin-confirm-backdrop`,onClick:()=>{t||r()},children:(0,j.jsxs)(`div`,{"aria-label":I(`确认卸载插件`),"aria-modal":`true`,className:`plugin-confirm-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsx)(`header`,{children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`卸载插件?`)}),(0,j.jsx)(`small`,{children:I(`将从运行配置中移除,之后可以从插件市场重新安装。`)})]})}),(0,j.jsx)(`code`,{children:e}),n&&(0,j.jsx)(`p`,{className:`plugin-confirm-error`,role:`alert`,children:fl(n)}),(0,j.jsxs)(`footer`,{children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:t,onClick:r,type:`button`,children:I(`取消`)}),(0,j.jsx)(`button`,{className:`danger`,disabled:t,onClick:i,type:`button`,children:I(t?`卸载中…`:`确认卸载`)})]})]})})}function Hl({label:e,categories:t,activeCategory:n,onChange:r}){let i=(0,o.useRef)(null),[a,s]=(0,o.useState)(!1),[c,l]=(0,o.useState)(!1),u=(0,o.useCallback)(()=>{let e=i.current;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);s(e.scrollLeft>1),l(e.scrollLeft<t-1)},[]);(0,o.useEffect)(()=>{let e=i.current;if(!e)return;u();let t=typeof ResizeObserver>`u`?void 0:new ResizeObserver(u);return t?.observe(e),window.addEventListener(`resize`,u),()=>{t?.disconnect(),window.removeEventListener(`resize`,u)}},[t,u]);let d=e=>{let t=i.current;t&&t.scrollBy({behavior:`smooth`,left:e*Math.max(180,t.clientWidth*.72)})};return(0,j.jsxs)(`div`,{className:`marketplace-categories-shell ${a?`can-scroll-left`:``} ${c?`can-scroll-right`:``}`,children:[a&&(0,j.jsx)(`button`,{"aria-label":I(`向左查看更多分类`),className:`marketplace-category-scroll previous`,onClick:()=>d(-1),type:`button`,children:`‹`}),(0,j.jsx)(`nav`,{"aria-label":e,className:`marketplace-categories`,onScroll:u,ref:i,children:t.map(e=>{let t=n===e.id;return(0,j.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>r(e.id),type:`button`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:t?`font-mono text-[10px] text-[var(--color-blue)]`:`font-mono text-[10px] text-[var(--color-faint)]`,children:e.count})]},e.id||`all`)})}),c&&(0,j.jsx)(`button`,{"aria-label":I(`向右查看更多分类`),className:`marketplace-category-scroll next`,onClick:()=>d(1),type:`button`,children:`›`})]})}function Ul({plugins:e,panels:t,catalog:n,capabilityLabel:r,onMarketplace:i,onOpenDetail:a,onToml:s,onToggle:c,onUninstall:l}){let u=(0,o.useMemo)(()=>new Map(n.map(e=>[e.packageName,e])),[n]),d=(0,o.useMemo)(()=>new Set(t.map(e=>e.pluginId)),[t]),f=(0,o.useMemo)(()=>e.filter(e=>e.removable||d.has(e.name)),[d,e]),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(``),[_,v]=(0,o.useState)(),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(),T=(0,o.useRef)(null),E=(0,o.useMemo)(()=>{let e=new Map;for(let t of f){let n=u.get(t.name)?.category??t.category??{id:`other`,label:I(`其他`)},r=e.get(n.id);e.set(n.id,{...n,count:(r?.count??0)+1})}return Nt([...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label,L())))},[u,f]),D=(0,o.useMemo)(()=>f.filter(e=>{let t=u.get(e.name),n=t?.category??e.category??{id:`other`,label:I(`其他`)};if(h&&n.id!==h)return!1;let i=[e.name,t?.name,Sl(e.name),t?.category.label,...(t?.capabilities??[]).map(r),e.category?.label,cl(e.name)];return Yr(p,i)}),[r,u,h,f,p]);(0,o.useEffect)(()=>{T.current?.scrollTo({top:0})},[h,p]),(0,o.useEffect)(()=>{h&&!E.some(e=>e.id===h)&&g(``)},[h,E]);let ee=async(e,t)=>{b(``),S(``),v(e.id);try{return(await t(e))?.restartRequired===!0&&S(ul()),!0}catch(e){return b(e instanceof Error?e.message:String(e)),!1}finally{v(void 0)}};return(0,j.jsx)(`section`,{className:`view-panel plugins-view`,children:(0,j.jsxs)(`div`,{className:`plugins-page`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":I(`插件目录`),className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:I(`已安装`)}),(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:i,type:`button`,children:I(`插件市场`)})]}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),s()},children:I(`查看运行配置`)})]}),(0,j.jsxs)(`div`,{className:`plugins-toolbar`,children:[(0,j.jsx)(`input`,{"aria-label":I(`搜索已安装插件`),onChange:e=>m(e.target.value),placeholder:I(`搜索名称、包名或能力…`),type:`search`,value:p}),(0,j.jsx)(`span`,{"aria-live":`polite`,children:I(`{v0} 个插件`,{v0:p.trim()||h?`${D.length} / ${f.length}`:`${f.length}`})})]}),(0,j.jsx)(Hl,{activeCategory:h,categories:E,label:I(`已安装插件分类`),onChange:g}),(0,j.jsxs)(`div`,{className:`plugins-scroll`,ref:T,children:[(0,j.jsxs)(`div`,{className:`plugins-list`,children:[D.map(e=>{let t=u.get(e.name),n=t?.category.label??e.category?.label,i=cl(e.name),o=t?.name??Sl(e.name),s=Zr(e,t,r),l=e.state===ll;return(0,j.jsxs)(`article`,{className:`catalog-card plugin-card`,children:[(0,j.jsxs)(`div`,{className:`plugin-card-head`,children:[(0,j.jsx)(`span`,{className:`plugin-icon`,children:`◈`}),(0,j.jsx)(`div`,{className:`plugin-copy`,children:(0,j.jsxs)(`div`,{className:`plugin-heading`,children:[(0,j.jsxs)(`div`,{className:`plugin-title`,children:[(0,j.jsx)(`strong`,{children:o}),(0,j.jsx)(`span`,{className:`plugin-state ${l?``:e.enabled?`active`:``}`,children:l?I(`重启后生效`):e.enabled?I(`运行中`):I(`已停用`)}),n&&(0,j.jsx)(`span`,{className:`capability`,children:n}),n!==i&&(0,j.jsx)(`span`,{className:`capability`,children:i})]}),(0,j.jsx)(`div`,{className:`plugin-actions`,children:e.removable?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":e.enabled?I(`停用 {plugin}`,{plugin:o}):I(`启用 {plugin}`,{plugin:o}),"aria-pressed":e.enabled,className:`plugin-switch-button`,disabled:_!==void 0||l,onClick:()=>void ee(e,e=>c(e)),title:l?I(`插件已安装但还没加载,重启 Pi Harness 后才能停用或启用`):void 0,type:`button`,children:(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})}),(0,j.jsx)(`button`,{className:`plugin-uninstall`,disabled:_!==void 0,onClick:()=>{b(``),w(e)},type:`button`,children:I(`卸载`)})]}):(0,j.jsx)(`span`,{className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})})]})})]}),(0,j.jsxs)(`div`,{className:`plugin-card-body`,children:[(0,j.jsx)(`code`,{className:`plugin-package`,children:s.packageLabel}),(0,j.jsx)(`p`,{className:`plugin-description`,children:s.description}),(0,j.jsx)(`div`,{className:`hook-list`,children:s.tags.map((e,t)=>(0,j.jsx)(`span`,{children:e},`${e}-${t}`))})]}),(0,j.jsxs)(`footer`,{className:`plugin-card-footer`,children:[(0,j.jsx)(`button`,{"aria-label":I(`查看 {plugin} 详情`,{plugin:o}),className:`plugin-detail-link`,onClick:()=>a(e),type:`button`,children:I(`查看详情 →`)}),d.has(e.name)?(0,j.jsx)(`span`,{children:I(`实时面板`)}):null]})]},e.id)}),f.length?D.length?null:(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配当前搜索与分类条件的已安装插件。`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`还没有安装可管理的插件。去插件市场安装一个吧。`)})]}),y&&(0,j.jsx)(`p`,{className:`plugin-action-error`,role:`alert`,children:fl(y)}),x&&(0,j.jsx)(`p`,{"aria-live":`polite`,className:`plugin-action-notice`,children:x}),t.length>f.length&&(0,j.jsxs)(`section`,{className:`mt-4 border-t border-[var(--color-line)] pt-4`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`其他插件面板`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`由已启用插件提供的实时状态。`)})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:`LIVE`})]}),(0,j.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:t.filter(e=>!f.some(t=>t.name===e.pluginId)).map(e=>(0,j.jsx)(Bl,{panel:e},e.id))})]})]}),C&&(0,j.jsx)(Vl,{busy:_!==void 0,error:y,onCancel:()=>w(void 0),onConfirm:()=>void ee(C,l).then(e=>{e&&w(void 0)}),pluginName:u.get(C.name)?.name??Sl(C.name)})]})})}function Wl({plugin:e,panel:t,metadata:n,capabilityLabel:r,onBack:i,onToggle:a,onUninstall:s}){let[c,l]=(0,o.useState)(),u=e.state===ll,[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),_=n?.name??Sl(e.name),v=async(e,t)=>{f(``),m(``),l(e);try{return(await t())?.restartRequired===!0&&m(ul()),!0}catch(e){return f(e instanceof Error?e.message:String(e)),!1}finally{l(void 0)}};return(0,j.jsxs)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),i()},children:I(`← 已安装插件`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[var(--color-line)] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-2 py-1 font-mono text-[10px] ${e.enabled?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-soft)] text-[var(--color-faint)]`}`,children:e.enabled?I(`运行中`):I(`已停用`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 text-[10px] text-[var(--color-blue)]`,children:n?.category.label??e.category?.label??I(`运行时插件`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:cl(e.name)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--color-faint)]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[var(--color-ink)]`,children:_}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[var(--color-faint)]`,children:[e.name,n?` · v${n.version}`:``]})]}),e.removable?(0,j.jsxs)(`div`,{className:`plugin-detail-actions`,children:[(0,j.jsx)(`button`,{className:`plugin-detail-action`,disabled:c!==void 0||u,onClick:()=>void v(`toggle`,()=>a(e)),title:u?I(`插件已安装但还没加载,重启 Pi Harness 后才能停用或启用`):void 0,type:`button`,children:c===`toggle`?I(`处理中…`):u?I(`等待重启`):e.enabled?I(`停用插件`):I(`启用插件`)}),(0,j.jsx)(`button`,{className:`plugin-detail-action danger`,disabled:c!==void 0,onClick:()=>{f(``),g(!0)},type:`button`,children:I(`卸载插件`)})]}):(0,j.jsx)(`span`,{className:`rounded-full bg-[var(--color-soft)] px-3 py-1.5 text-[11px] text-[var(--color-faint)]`,children:I(`内置组件`)})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[var(--color-muted)]`,children:n?.description??(e.enabled?I(`由当前运行时加载并启用,能力与 hook 已注册。`):I(`插件保留在运行配置中,但当前处于停用状态。`))}),d&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-red)]`,role:`alert`,children:I(`操作失败:{v0}`,{v0:fl(d)})}),p&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-amber)]`,role:`status`,children:p})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`影响范围`)}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(n?.capabilities.length?n.capabilities.map(r):[cl(e.name)]).map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-blue-soft)] px-2 py-1 text-[11px] text-[var(--color-muted)]`,children:e},e))})]}),n?.hooks.length?(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`扩展点`)}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:n.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[var(--color-soft)] px-3 py-2 font-mono text-[11px] text-[var(--color-muted)]`,children:e},e))})]}):null,(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`实时详情`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`当前本机会话中的插件运行状态。`)})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.1em] text-[var(--color-faint)]`,children:`LIVE`})]}),t?(0,j.jsx)(Bl,{inline:!0,panel:t}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`这个插件暂未提供实时面板。`)})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`插件信息`)}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`运行状态`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:u?I(`已安装,重启后生效`):e.state})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`配置标识`)}),(0,j.jsx)(`dd`,{className:`max-w-[150px] break-all text-right font-mono text-[var(--color-ink)]`,children:e.id})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`分类`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.category?.label??I(`运行时插件`)})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`管理方式`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.removable?I(`可配置`):I(`随运行时加载`)})]}),n?(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`版本`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:n.version})]}):null]}),n?(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[var(--color-blue)]`,href:n.repository,rel:`noreferrer`,target:`_blank`,children:I(`查看源码 ↗`)}):null]})]})]})]}),h?(0,j.jsx)(Vl,{busy:c===`uninstall`,error:d,onCancel:()=>g(!1),onConfirm:()=>void v(`uninstall`,()=>s(e)).then(e=>{e&&g(!1)}),pluginName:_}):null]})}function Gl({plugins:e,capabilities:t,categories:n,total:r,page:i,hasNext:a,query:s,capabilityLabel:c,capabilityFilter:l,categoryFilter:u,onQueryChange:d,onCapabilityChange:f,onCategoryChange:p,onPageChange:m,onOpenDetail:h,onBack:g,onToml:_,installedPackages:v,restartPendingPackages:y,onInstall:b}){let[x,S]=(0,o.useState)(),[C,w]=(0,o.useState)(``),[T,E]=(0,o.useState)(!1),D=!T&&y.size>0,ee=(0,o.useMemo)(()=>Nt(n),[n]),O=async e=>{w(``),E(!1),S(e.id);try{await b(e)}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(void 0)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":I(`插件目录`),className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:g,type:`button`,children:I(`已安装`)}),(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:I(`插件市场`)})]}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),_()},children:I(`查看运行配置`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-toolbar`,children:[(0,j.jsx)(`input`,{className:`marketplace-search`,"aria-label":I(`搜索插件`),onChange:e=>d(e.target.value),placeholder:I(`搜索名称、包名、影响范围…`),value:s}),(0,j.jsxs)(`select`,{className:`marketplace-filter`,"aria-label":I(`按影响范围筛选`),onChange:e=>f(e.target.value),value:l,children:[(0,j.jsx)(`option`,{value:``,children:I(`全部影响`)}),t.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.count,`)`]},e.id))]}),(0,j.jsx)(`span`,{className:`marketplace-count`,children:I(`{v0} 个已审核条目 · 推荐排序`,{v0:r})}),(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`marketplace-toolbar-message`,children:[C&&(0,j.jsx)(`p`,{className:`marketplace-message error`,role:`alert`,children:I(`安装失败:{v0}`,{v0:fl(C)})}),D&&(0,j.jsxs)(`p`,{className:`marketplace-message notice`,children:[ul(),(0,j.jsx)(`button`,{className:`marketplace-message-dismiss`,onClick:()=>E(!0),type:`button`,children:I(`知道了`)})]})]})]}),(0,j.jsx)(Hl,{activeCategory:u,categories:ee,label:I(`插件分类`),onChange:p}),(0,j.jsxs)(`div`,{className:`marketplace-scroll`,children:[(0,j.jsxs)(`div`,{className:`marketplace-grid`,children:[e.map(e=>(0,j.jsxs)(`article`,{className:`catalog-card marketplace-card`,children:[(0,j.jsxs)(`header`,{className:`marketplace-card-head`,children:[(0,j.jsx)(`div`,{className:`marketplace-card-mark`,children:`◈`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,j.jsx)(`strong`,{className:`marketplace-title`,children:e.name}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[var(--color-green-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-green)]`:`rounded bg-[var(--color-amber-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-amber)]`,children:e.status===`verified`?I(`已验证`):I(`实验性`)}),(0,j.jsx)(`span`,{className:e.source===`official`?`rounded bg-[var(--color-blue-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-blue)]`:`rounded bg-[var(--color-amber-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-amber)]`,children:e.source===`official`?I(`官方`):I(`社区`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px text-[10px] text-[var(--color-blue)]`,children:e.category.label})]})})]}),(0,j.jsxs)(`div`,{className:`marketplace-card-body`,children:[(0,j.jsxs)(`code`,{className:`marketplace-package`,children:[Sl(e.packageName),` · v`,e.version]}),(0,j.jsx)(`p`,{className:`marketplace-description`,children:e.description}),(0,j.jsxs)(`div`,{className:`marketplace-tags`,children:[e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px text-[10px] text-[var(--color-muted)]`,children:c(e)},e)),e.hooks.map(e=>(0,j.jsxs)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-muted)]`,children:[`hook:`,e]},`hook:${e}`))]}),e.statistics&&(0,j.jsx)(`div`,{className:`marketplace-statistics mt-3 grid grid-cols-3 divide-x divide-[#e3e7ee] rounded-md border border-[var(--color-line)] bg-[var(--color-soft)]`,children:It(e.statistics).map(e=>(0,j.jsxs)(`span`,{className:`min-w-0 px-2 py-1.5`,title:`${e.label} ${e.value}`,children:[(0,j.jsx)(`small`,{className:`block truncate text-[9px] text-[var(--color-faint)]`,children:e.label}),(0,j.jsx)(`strong`,{className:`mt-0.5 block truncate font-mono text-[10px] font-medium text-[var(--color-ink)]`,children:e.value})]},e.label))})]}),(0,j.jsxs)(`footer`,{className:`marketplace-card-footer`,children:[(0,j.jsxs)(`span`,{children:[e.author,` · `,e.license]}),(0,j.jsx)(`a`,{href:jt(e.id),onClick:t=>{t.preventDefault(),h(e)},children:I(`查看详情 →`)}),(0,j.jsx)(`a`,{href:e.repository,target:`_blank`,rel:`noreferrer`,children:I(`查看源码 ↗`)}),(0,j.jsx)(`button`,{disabled:v.has(e.packageName)||y.has(e.packageName)||x!==void 0,onClick:()=>void O(e),type:`button`,children:v.has(e.packageName)?I(`已安装`):y.has(e.packageName)?I(`重启后生效`):x===e.id?I(`安装中…`):I(`安装`)})]})]},e.id)),!e.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配的插件。`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-pagination`,children:[(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:i===0,onClick:()=>m(i-1),type:`button`,children:I(`上一页`)}),(0,j.jsx)(`span`,{children:I(`第 {v0} 页`,{v0:i+1})}),(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:!a,onClick:()=>m(i+1),type:`button`,children:I(`下一页`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-contribute mt-3 flex items-center gap-2.5 rounded-[10px] border border-dashed border-[#b8ccf5] bg-[var(--color-blue-soft)] p-2.5 text-[11.5px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`strong`,{className:`text-[12px] text-[var(--color-ink)]`,children:I(`你有一个 Pi Harness 插件?`)}),(0,j.jsx)(`span`,{children:I(`在 entries 目录新增一个元数据文件,附测试和 README 后提交 PR;审核通过后会出现在这里。`)}),(0,j.jsx)(`a`,{className:`ml-auto flex-none text-[var(--color-blue)]`,href:`https://github.com/pi-harness/pi-harness/blob/main/docs/plugin-marketplace.md`,target:`_blank`,rel:`noreferrer`,children:I(`查看贡献规范 ↗`)})]})]})]})})}function Kl({plugin:e,installed:t,restartPending:n,capabilityLabel:r,onInstall:i,onBack:a}){let[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(``),p=async()=>{u(``),f(``),c(!0);try{(await i(e)).restartRequired===!0&&f(ul())}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),a()},children:I(`← 插件市场`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[var(--color-line)] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:e.source===`official`?I(`官方插件`):I(`社区插件`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 text-[10px] text-[var(--color-blue)]`,children:e.category.label}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[var(--color-green-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-green)]`:`rounded bg-[var(--color-amber-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-amber)]`,children:e.status===`verified`?I(`已验证`):I(`实验性`)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--color-faint)]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[var(--color-ink)]`,children:e.name}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[var(--color-faint)]`,children:[e.packageName,` · v`,e.version]})]}),(0,j.jsx)(`div`,{className:`plugin-detail-actions`,children:(0,j.jsx)(`button`,{className:`plugin-detail-action primary`,disabled:t||n||s,onClick:()=>void p(),type:`button`,children:I(t?`已安装`:n?`重启后生效`:s?`安装中…`:`安装插件`)})})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[var(--color-muted)]`,children:e.description}),d&&(0,j.jsx)(`p`,{"aria-live":`polite`,className:`mt-3 text-[12px] text-[var(--color-blue)]`,children:d}),l&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-red)]`,role:`alert`,children:I(`安装失败:{v0}`,{v0:fl(l)})})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`影响范围`)}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-blue-soft)] px-2 py-1 text-[11px] text-[var(--color-muted)]`,children:r(e)},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`扩展点`)}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[var(--color-soft)] px-3 py-2 font-mono text-[11px] text-[var(--color-muted)]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`运行配置`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`安装后会写入当前运行 profile。`)}),(0,j.jsx)(`pre`,{className:`mt-4 overflow-auto rounded-lg bg-[var(--color-soft)] p-4 text-[11px] leading-6 text-[var(--color-ink)]`,children:(0,j.jsx)(`code`,{children:JSON.stringify(e.profile,null,2)})})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`插件信息`)}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`作者`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.author})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`许可证`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.license})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`分类`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.category.label})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`版本`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.version})]}),It(e.statistics).map(e=>(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:e.label}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.value})]},e.label))]}),(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[var(--color-blue)]`,href:e.repository,target:`_blank`,rel:`noreferrer`,children:I(`查看源码 ↗`)})]})]})]})]})})}async function ql(e,t){t.busy(!0),t.state({text:I(`重载中…`),kind:`progress`});try{let n=await e.reloadConfig();t.config(n),t.sourceDraft(n.source),t.state({text:I(`已从磁盘重载`),kind:`done`})}catch(e){t.state({text:e instanceof Error?e.message:String(e),kind:`error`})}finally{t.busy(!1)}}function Jl({data:e,api:t,tab:n,onTab:r,onClose:i,onRefresh:a}){let s=e.status,[c,l]=(0,o.useState)({}),[u,d]=(0,o.useState)({}),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),g=at(),[_,v]=(0,o.useState)(),[y,b]=(0,o.useState)(`form`),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(!1),[T,E]=(0,o.useState)(),D=e.plugins.some(e=>e.name.endsWith(`/cli-notifier`)&&e.enabled),ee=il(f,()=>p(!1),u.__add!==void 0);(0,o.useEffect)(()=>{(n===`general`||n===`toml`)&&(E({text:I(`读取中…`),kind:`loading`}),t.getConfig().then(e=>{v(e),S(e.source),E(void 0)}).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})))},[t,n]);let O=(e,n)=>{w(!0),E({text:n,kind:`progress`}),t.updateConfig(e).then(e=>{v(e),S(e.source)}).then(()=>E({text:I(`已保存`),kind:`done`})).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})).finally(()=>w(!1))},te=(e,n)=>{u[e]||(d(t=>({...t,[e]:n})),l(t=>({...t,[e]:I(n===`test`?`测试中…`:`刷新中…`)})),n===`test`?t.testProvider(e).then(t=>{let n=t.auth,r=n&&typeof n==`object`&&`label`in n&&typeof n.label==`string`?n.label:void 0;l(n=>({...n,[e]:t.reachable?I(`连接正常`):r??I(`未检测到认证`)}))}).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:void 0}))):t.refreshProvider(e).then(t=>l(n=>({...n,[e]:I(`{count} 个模型已刷新`,{count:t.models.length})}))).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:void 0}))))};return(0,j.jsx)(`section`,{className:`view-panel settings-page`,children:(0,j.jsxs)(`div`,{className:`settings-dialog`,children:[(0,j.jsx)(`nav`,{"aria-label":I(`设置分类`),className:`settings-top-tabs`,children:[`general`,`providers`,`toml`].map(t=>(0,j.jsx)(`button`,{"aria-pressed":n===t,className:`settings-tab ${n===t?`active`:``}`,onClick:()=>r(t),type:`button`,children:t===`general`?I(`通用`):t===`providers`?I(`提供商 {count}`,{count:e.providers.length}):I(`运行配置`)},t))}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`button`,{className:`settings-back`,onClick:i,type:`button`,children:I(`← 返回会话`)}),(0,j.jsxs)(`div`,{className:`settings-header-copy`,children:[(0,j.jsx)(`strong`,{children:I(n===`general`?`通用`:n===`providers`?`提供商`:`运行配置`)}),(0,j.jsx)(`small`,{children:I(n===`toml`?`配置即代码,改完重载`:`运行时状态与快捷键`)})]})]}),(0,j.jsxs)(`div`,{className:`settings-body`,children:[n===`general`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`界面语言`)}),(0,j.jsx)(`small`,{children:I(`只改控制台自己的文字,你和模型对话用什么语言仍然由你决定。`)})]}),(0,j.jsx)(`select`,{"aria-label":I(`界面语言`),className:`setting-select`,onChange:e=>{let t=e.target.value;Ze(globalThis.localStorage,t),F(t).then(()=>{document.documentElement.lang=t})},value:g,children:Ge.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),[[I(`工作目录`),s?.cwd],[I(`agent 目录`),s?.agentDir],[I(`会话`),s?I(`{session} · {count} 条消息`,{session:s.sessionId,count:s.messages}):`—`],[I(`快捷键`),I(`⌘K 命令 · ⌘, 设置 · ⌃C 中断`)],[I(`权限策略`),I(`当前 API 未提供修改接口`)]].map(([e,t])=>(0,j.jsx)(`div`,{className:`general-row`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:$(t)})]})},e)),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`任务结束提醒插件`)}),(0,j.jsx)(`small`,{children:I(`由 CLI Notifier 提供,具体目标在插件配置中管理`)})]}),(0,j.jsx)(`span`,{className:`setting-status ${D?`on`:``}`,children:I(D?`已加载`:`未加载`)})]}),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`自动压缩上下文`)}),(0,j.jsx)(`small`,{children:I(`接近上下文上限时自动整理历史消息,可在运行配置中修改`)}),!_&&T&&T.kind!==`loading`?(0,j.jsx)(`small`,{className:`setting-error`,role:`alert`,children:I(`配置读取失败:{v0}`,{v0:T.text})}):null]}),(0,j.jsx)(`span`,{className:`setting-status ${_?.settings.compaction.enabled?`on`:``}`,children:_?_.settings.compaction.enabled?I(`已开启`):I(`已关闭`):T?.kind===`loading`?I(`读取中`):I(`不可用`)})]})]}),n===`providers`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`provider-add-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`已启用提供商`)}),(0,j.jsx)(`small`,{children:I(`模型列表只显示当前会话和已配置提供商。`)})]}),(0,j.jsx)(`button`,{className:`primary`,onClick:()=>p(!0),type:`button`,children:I(`添加提供商`)})]}),f&&(0,j.jsx)(`div`,{className:`provider-add-overlay`,onClick:()=>{u.__add||p(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),u.__add||p(!1))},children:(0,j.jsxs)(`div`,{"aria-busy":u.__add!==void 0,"aria-label":I(`添加提供商`),"aria-modal":`true`,className:`provider-add-modal`,onClick:e=>e.stopPropagation(),ref:ee,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`添加自定义提供商`)}),(0,j.jsx)(`small`,{children:I(`注册 OpenAI 兼容接口,凭据只提交到本机 Pi runtime。`)})]}),(0,j.jsx)(`button`,{"aria-label":I(`关闭添加提供商`),disabled:u.__add!==void 0,onClick:()=>p(!1),type:`button`,children:`×`})]}),(0,j.jsxs)(`form`,{className:`provider-add-form`,onSubmit:e=>{e.preventDefault(),!(!m.provider||!m.baseUrl||!m.apiKey||!m.model)&&(d(e=>({...e,__add:`add`})),l(e=>({...e,__add:I(`添加中…`)})),t.addProvider(m).then(async()=>{h({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),l(e=>({...e,__add:I(`已添加`)})),await a(),p(!1)}).catch(e=>l(t=>({...t,__add:e instanceof Error?e.message:String(e)}))).finally(()=>d(e=>({...e,__add:void 0}))))},children:[(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`提供商 ID`)}),(0,j.jsx)(`input`,{"aria-label":I(`提供商 ID`),"data-dialog-initial-focus":!0,maxLength:64,minLength:2,pattern:`[a-z0-9][a-z0-9._-]{1,63}`,placeholder:I(`例如 openrouter`),required:!0,value:m.provider,onChange:e=>h(t=>({...t,provider:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`显示名称`)}),(0,j.jsx)(`input`,{"aria-label":I(`提供商名称`),placeholder:I(`可选`),value:m.name,onChange:e=>h(t=>({...t,name:e.target.value}))})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:I(`接口地址`)}),(0,j.jsx)(`input`,{"aria-label":I(`接口地址`),placeholder:`https://api.example.com/v1`,required:!0,type:`url`,value:m.baseUrl,onChange:e=>h(t=>({...t,baseUrl:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`模型 ID`)}),(0,j.jsx)(`input`,{"aria-label":I(`模型 ID`),placeholder:I(`例如 gpt-4o`),required:!0,value:m.model,onChange:e=>h(t=>({...t,model:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`协议`)}),(0,j.jsxs)(`select`,{"aria-label":I(`协议`),value:m.api,onChange:e=>h(t=>({...t,api:e.target.value})),children:[(0,j.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,j.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`})]})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`API key`}),(0,j.jsx)(`input`,{"aria-label":`API key`,placeholder:I(`只在本机提交,不会回显`),required:!0,type:`password`,value:m.apiKey,onChange:e=>h(t=>({...t,apiKey:e.target.value}))})]}),(0,j.jsxs)(`div`,{className:`provider-add-actions`,children:[(0,j.jsx)(`button`,{className:`primary`,disabled:u.__add!==void 0,type:`submit`,children:u.__add?I(`添加中…`):I(`添加提供商`)}),c.__add&&(0,j.jsx)(`small`,{"aria-live":`polite`,children:c.__add})]})]})]})}),(0,j.jsx)(`small`,{children:I(`已启用提供商 · /api/providers`)}),e.providers.length?e.providers.map(e=>(0,j.jsxs)(`article`,{className:`provider-card`,children:[(0,j.jsxs)(`div`,{className:`provider-head`,children:[(0,j.jsx)(`span`,{className:`provider-dot`,children:`●`}),(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`provider-state`,children:e.active?I(`当前会话`):e.auth?.configured===!0?I(`已配置`):I(`未配置`)})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`provider`}),(0,j.jsx)(`input`,{"aria-label":I(`{provider} 提供商 ID`,{provider:e.name}),disabled:!0,value:e.provider,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`model`}),(0,j.jsxs)(`div`,{className:`provider-model-value`,title:e.models.map(e=>e.id).join(`, `)||I(`暂无模型`),children:[(0,j.jsx)(`span`,{children:e.activeModel?`${e.activeModel.provider}/${e.activeModel.id}`:I(`未选择模型`)}),e.models.length>0&&(0,j.jsxs)(`details`,{className:`provider-models-details`,children:[(0,j.jsx)(`summary`,{children:I(`查看 {v0} 个模型`,{v0:e.models.length})}),(0,j.jsx)(`div`,{className:`model-chips`,children:e.models.map(e=>(0,j.jsx)(`span`,{children:e.id},e.id))})]})]})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`api_key`}),(0,j.jsx)(`input`,{"aria-label":I(`{provider} API key 状态`,{provider:e.name}),disabled:!0,value:I(`不会在浏览器显示`),readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-footer`,children:[(0,j.jsx)(`code`,{children:I(`{v0} 个模型`,{v0:e.models.length})}),(0,j.jsx)(`button`,{disabled:u[e.provider]!==void 0,onClick:()=>te(e.provider,`test`),type:`button`,children:u[e.provider]===`test`?I(`测试中…`):I(`测试连接`)}),(0,j.jsx)(`button`,{className:`link-button`,disabled:u[e.provider]!==void 0,onClick:()=>te(e.provider,`refresh`),type:`button`,children:u[e.provider]===`refresh`?I(`刷新中…`):I(`拉取模型`)})]}),c[e.provider]&&(0,j.jsx)(`small`,{"aria-live":`polite`,className:`provider-result`,children:c[e.provider]})]},e.provider)):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`运行时没有注册提供商。`)})]}),n===`toml`&&(0,j.jsxs)(`div`,{className:`config-editor`,children:[(0,j.jsxs)(`div`,{className:`toml-toolbar`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`运行时配置`)}),(0,j.jsx)(`span`,{children:_?.path??`~/.pi/agent/settings.json`})]}),(0,j.jsx)(`button`,{className:y===`form`?`active`:``,onClick:()=>b(`form`),type:`button`,children:I(`表单`)}),(0,j.jsx)(`button`,{className:y===`source`?`active`:``,onClick:()=>b(`source`),type:`button`,children:I(`源码`)}),(0,j.jsx)(`button`,{className:`primary`,disabled:C,onClick:()=>{ql(t,{config:v,sourceDraft:S,state:E,busy:w})},type:`button`,children:I(`重载`)})]}),T&&(0,j.jsx)(`div`,{"aria-live":`polite`,className:`config-state ${T.kind===`error`?`error`:``}`,children:T.text}),_?y===`source`?(0,j.jsxs)(`div`,{className:`config-source-editor`,children:[(0,j.jsx)(`textarea`,{"aria-label":I(`settings.json 源码`),className:`config-source`,onChange:e=>S(e.target.value),spellCheck:!1,value:x}),(0,j.jsxs)(`div`,{className:`config-source-actions`,children:[(0,j.jsx)(`small`,{children:I(`完整 JSON 配置,可编辑未知字段;保存前会校验语法。`)}),(0,j.jsx)(`button`,{className:`primary`,disabled:C||!x.trim(),onClick:()=>{w(!0),E({text:I(`保存源码…`),kind:`progress`}),t.updateConfigSource(x).then(e=>{v(e),S(e.source),E({text:I(`已保存源码`),kind:`done`})}).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})).finally(()=>w(!1))},type:`button`,children:I(`保存源码`)})]})]}):(0,j.jsxs)(`div`,{className:`config-sections`,children:[(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`模型默认值`)}),(0,j.jsx)(`small`,{children:I(`新会话启动时使用的模型和思考级别`)})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`提供商`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({defaultProvider:e.target.value},I(`保存提供商…`)),value:_.settings.defaultProvider??``,children:[(0,j.jsx)(`option`,{value:``,children:I(`跟随运行时`)}),e.providers.map(e=>(0,j.jsx)(`option`,{value:e.provider,children:e.name},e.provider))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`模型`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({defaultModel:e.target.value},I(`保存模型…`)),value:_.settings.defaultModel??``,children:[(0,j.jsx)(`option`,{value:``,children:I(`跟随提供商`)}),e.models.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.provider,`/`,e.name]},`${e.provider}/${e.id}`))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`思考级别`)}),(0,j.jsx)(`select`,{disabled:C,onChange:e=>O({defaultThinkingLevel:e.target.value},I(`保存思考级别…`)),value:_.settings.defaultThinkingLevel??`medium`,children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`运行策略`)}),(0,j.jsx)(`small`,{children:I(`消息队列和网络传输行为`)})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`传输方式`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({transport:e.target.value},I(`保存传输方式…`)),value:_.settings.transport,children:[(0,j.jsx)(`option`,{value:`auto`,children:I(`自动`)}),(0,j.jsx)(`option`,{value:`sse`,children:`SSE`}),(0,j.jsx)(`option`,{value:`websocket`,children:`WebSocket`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Steering 消息`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({steeringMode:e.target.value},I(`保存队列策略…`)),value:_.settings.steeringMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:I(`逐条发送`)}),(0,j.jsx)(`option`,{value:`all`,children:I(`一次发送全部`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Follow-up 消息`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({followUpMode:e.target.value},I(`保存跟进策略…`)),value:_.settings.followUpMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:I(`逐条发送`)}),(0,j.jsx)(`option`,{value:`all`,children:I(`一次发送全部`)})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`上下文与显示`)}),(0,j.jsx)(`small`,{children:I(`控制思考内容和自动压缩`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`隐藏思考正文`)}),(0,j.jsx)(`small`,{children:I(`只显示可展开的思考摘要`)})]}),(0,j.jsx)(`input`,{checked:_.settings.hideThinkingBlock,disabled:C,onChange:e=>O({hideThinkingBlock:e.target.checked},I(`保存显示设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`自动压缩上下文`)}),(0,j.jsx)(`small`,{children:I(`接近上下文上限时自动整理历史消息`)})]}),(0,j.jsx)(`input`,{checked:_.settings.compaction.enabled,disabled:C,onChange:e=>O({compaction:{..._.settings.compaction,enabled:e.target.checked}},I(`保存压缩设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`自动重试`)}),(0,j.jsx)(`small`,{children:I(`临时网络错误时自动重试请求`)})]}),(0,j.jsx)(`input`,{checked:_.settings.retry.enabled,disabled:C,onChange:e=>O({retry:{..._.settings.retry,enabled:e.target.checked}},I(`保存重试设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`显示图片`)}),(0,j.jsx)(`small`,{children:I(`允许模型响应中的图片渲染`)})]}),(0,j.jsx)(`input`,{checked:_.settings.terminal.showImages,disabled:C,onChange:e=>O({terminal:{..._.settings.terminal,showImages:e.target.checked}},I(`保存图片设置…`)),type:`checkbox`})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`终端与导航`)}),(0,j.jsx)(`small`,{children:I(`控制命令行界面和消息渲染行为`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`安静启动`)}),(0,j.jsx)(`small`,{children:I(`启动时隐藏版本和更新提示`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.quietStartup,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,quietStartup:e.target.checked}},I(`保存启动设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`项目可信策略`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,projectTrust:e.target.value}},I(`保存信任策略…`)),value:_.settings.advanced.projectTrust,children:[(0,j.jsx)(`option`,{value:`ask`,children:I(`每次询问`)}),(0,j.jsx)(`option`,{value:`always`,children:I(`始终信任`)}),(0,j.jsx)(`option`,{value:`never`,children:I(`从不信任`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Mermaid 渲染`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,mermaid:e.target.value}},I(`保存 Mermaid 设置…`)),value:_.settings.advanced.mermaid,children:[(0,j.jsx)(`option`,{value:`off`,children:I(`关闭`)}),(0,j.jsx)(`option`,{value:`final`,children:I(`完成后渲染`)}),(0,j.jsx)(`option`,{value:`streaming`,children:I(`流式渲染`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`双击 Escape`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,doubleEscapeAction:e.target.value}},I(`保存快捷键设置…`)),value:_.settings.advanced.doubleEscapeAction,children:[(0,j.jsx)(`option`,{value:`tree`,children:I(`打开会话树`)}),(0,j.jsx)(`option`,{value:`fork`,children:I(`创建分支`)}),(0,j.jsx)(`option`,{value:`none`,children:I(`不执行`)})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`诊断与隐私`)}),(0,j.jsx)(`small`,{children:I(`控制缓存提示和匿名数据上报`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`显示缓存未命中`)}),(0,j.jsx)(`small`,{children:I(`在消息中显示模型缓存诊断`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.showCacheMissNotices,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,showCacheMissNotices:e.target.checked}},I(`保存诊断设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`安装遥测`)}),(0,j.jsx)(`small`,{children:I(`发送匿名安装和版本统计`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.enableInstallTelemetry,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,enableInstallTelemetry:e.target.checked}},I(`保存隐私设置…`)),type:`checkbox`})]})]})]}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`正在读取运行时配置…`)})]})]})]})]})})}var Yl=(e,t)=>{let n=t.trim().toLowerCase();return e.filter(e=>`${e.invocationName} ${e.description??``}`.toLowerCase().includes(n))};function Xl({commands:e,query:t,activeIndex:n,onActiveIndexChange:r,onUse:i}){let a=Yl(e,t),o=e=>{let t=a[e];t&&i(`/${t.invocationName}`)};return(0,j.jsx)(`div`,{"aria-label":I(`命令面板`),className:`command-palette`,id:`command-menu`,role:`listbox`,children:(0,j.jsxs)(`div`,{className:`palette-group`,children:[(0,j.jsxs)(`small`,{children:[`COMMANDS `,(0,j.jsx)(`span`,{children:`· RUNTIME REGISTRY`})]}),a.length?a.map((e,t)=>{let i=`/${e.invocationName}`;return(0,j.jsxs)(`button`,{"aria-selected":t===n,onClick:()=>o(t),onMouseEnter:()=>r(t),role:`option`,type:`button`,children:[(0,j.jsx)(`code`,{children:i}),(0,j.jsx)(`span`,{children:e.description??e.source??I(`由当前运行时注册`)})]},`${e.invocationName}:${e.source??`runtime`}`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:e.length?I(`没有匹配的命令。`):I(`还没有加载任何命令。命令由 pi 扩展注册:把扩展放进 ~/.pi/agent/extensions(或已信任工作区的 .pi/extensions)后重启 Pi Harness。`)})]})})}function Zl({kind:e,commands:t,files:n,query:r,activeIndex:i,onActiveIndexChange:a,onUse:o}){let s=e===`command`?Yl(t,r).slice(0,12):n.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(r.trim().toLowerCase())).slice(0,12);return(0,j.jsxs)(`div`,{"aria-label":I(e===`command`?`命令补全`:`文件补全`),className:`prompt-completion`,"data-prompt-completion":!0,id:`prompt-completion-list`,role:`listbox`,children:[(0,j.jsx)(`small`,{children:I(e===`command`?`命令`:`文件`)}),s.length?s.slice(0,12).map((t,n)=>{let r=e===`command`?`/${t.invocationName}`:`@${t.path}`,s=e===`command`?t.description??t.source??I(`由当前运行时注册`):t.status;return(0,j.jsxs)(`button`,{"aria-selected":n===i,id:`prompt-completion-option-${n}`,onClick:()=>o(r),onMouseEnter:()=>a(n),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:r}),(0,j.jsx)(`span`,{children:s})]},`${e}:${r}`)}):(0,j.jsx)(`span`,{className:`prompt-completion-empty`,children:I(`没有匹配项`)})]})}function Ql({commands:e,sessions:t,files:n,onClose:r,onUse:i,onOpenSession:a,onOpenFile:s}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(0),f=il(!0,r),p=c.trim().toLowerCase(),m=e=>!p||e.toLowerCase().includes(p),h=[...e.filter(e=>m(`${e.invocationName} ${e.description??``}`)).map(e=>({kind:`command`,command:e})),...t.filter(e=>m(`${$(e.name,``)} ${$(e.firstMessage,``)} ${$(e.sessionId,``)}`)).map(e=>({kind:`session`,session:e})),...n.filter(e=>m(`${e.path} ${e.label} ${e.status}`)).map(e=>({kind:`file`,file:e}))],g=h.length?Math.min(u,h.length-1):-1,_=g>=0?`global-search-option-${g}`:void 0;(0,o.useEffect)(()=>d(0),[c]);let v=e=>{e&&(e.kind===`command`?i(`/${e.command.invocationName}`):e.kind===`session`?a(e.session):s(e.file),r())};return(0,j.jsx)(`div`,{className:`global-search`,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,j.jsxs)(`div`,{"aria-label":I(`全局搜索`),"aria-modal":`true`,className:`global-search-dialog`,ref:f,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`global-search-heading`,children:[(0,j.jsx)(`strong`,{children:I(`全局搜索`)}),(0,j.jsx)(`small`,{children:I(`命令 · 会话 · 文件`)}),(0,j.jsx)(`button`,{"aria-label":I(`关闭全局搜索`),onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`input`,{"aria-activedescendant":_,"aria-autocomplete":`list`,"aria-controls":`global-search-results`,"aria-expanded":`true`,"aria-label":I(`全局搜索`),"data-dialog-initial-focus":!0,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):e.key===`ArrowDown`&&h.length?(e.preventDefault(),d(e=>(e+1)%h.length)):e.key===`ArrowUp`&&h.length?(e.preventDefault(),d(e=>(e-1+h.length)%h.length)):e.key===`Enter`&&(e.preventDefault(),v(h[g]))},placeholder:I(`搜索命令、会话或文件`),role:`combobox`,value:c}),(0,j.jsx)(`div`,{className:`global-search-results`,id:`global-search-results`,role:`listbox`,children:h.length?[`command`,`session`,`file`].map(e=>{let t=h.filter(t=>t.kind===e);if(!t.length)return null;let n=I(e===`command`?`命令`:e===`session`?`会话`:`文件`);return(0,j.jsxs)(`section`,{"aria-label":n,className:`global-search-group`,role:`group`,children:[(0,j.jsx)(`small`,{"aria-hidden":`true`,children:n}),t.map(e=>{let t=h.indexOf(e),n=e.kind===`command`?`/${e.command.invocationName}`:e.kind===`session`?$(e.session.name??e.session.firstMessage??e.session.sessionId,I(`未命名会话`)):e.file.label,r=e.kind===`command`?e.command.description??e.command.source??I(`由当前运行时注册`):e.kind===`session`?I(`{count} 条消息`,{count:$(e.session.messageCount,`0`)}):`${e.file.path} · ${e.file.status}`;return(0,j.jsxs)(`button`,{"aria-selected":t===g,id:`global-search-option-${t}`,onClick:()=>v(e),onMouseEnter:()=>d(t),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:n}),(0,j.jsx)(`span`,{children:r})]},`${e.kind}:${n}:${t}`)})]},e)}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配的命令、会话或文件。`)})})]})})}function $l(e){let t=e.event;return typeof t!=`object`||!t||t.type!==`message_update`}function eu(e,t){return e.subscribeEvents(e=>t.current(e))}function tu(e,t,n){if(e===void 0)return{kind:`clear`};let r=t.find(t=>t.id===e);return r===void 0?n===e?{kind:`keep`}:{kind:`fetch`}:{kind:`show`,plugin:r}}function nu(e,t,n=!0){let r=n?e.replace(/\s+/gu,` `).trim():e;return r.length<=t?r:`${r.slice(0,t-1)}…`}var ru=80;function iu(e){return nu(e,ru)}var au=140,ou=4e3;function su(e){return e==null?``:nu(typeof e==`object`?Object.entries(e).filter(([,e])=>e!=null&&e!==``).map(([e,t])=>`${e}=${typeof t==`string`?t:JSON.stringify(t)}`).join(` · `):$(e,``),au)}function cu(e){return e.map(e=>`${e.id}:${e.name}:${+!!e.failed}:${e.result?.length??-1}`).join(`|`)}var lu=(0,o.memo)(function({role:e,text:t,thinking:n,tools:r=[],stopped:i=!1,onMouseUp:a}){return(0,j.jsx)(`article`,{className:`turn ${e===`user`?`user`:`text`}`,children:e===`user`?(0,j.jsx)(Pl,{text:t}):(0,j.jsxs)(j.Fragment,{children:[n.trim()&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,open:!1,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:I(`思考`)}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(xt,{text:n})})]}),r.map((e,t)=>(0,j.jsxs)(`details`,{className:`turn-tool ${e.failed?`failed`:``}`,children:[(0,j.jsxs)(`summary`,{className:`turn-tool-head`,children:[(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`turn-tool-args`,children:su(e.arguments)}),(0,j.jsx)(`span`,{className:`turn-tool-status`,children:e.result===void 0?I(`执行中…`):e.failed?I(`失败`):I(`完成`)})]}),e.result!==void 0&&(0,j.jsx)(`pre`,{className:`turn-tool-output`,children:nu(e.result,ou,!1)})]},e.id||`${e.name}-${t}`)),t&&(0,j.jsx)(xt,{onMouseUp:a,text:t}),i&&(0,j.jsx)(`p`,{className:`turn-stopped`,children:I(`已中断`)})]})})},(e,t)=>e.locale===t.locale&&e.role===t.role&&e.text===t.text&&e.thinking===t.thinking&&e.stopped===t.stopped&&e.onMouseUp===t.onMouseUp&&cu(e.tools??[])===cu(t.tools??[]));function uu({api:e=ze(),appVersion:t}){let n=at(),r=(0,o.useMemo)(Cl,[]),[i,a]=(0,o.useState)({sessions:[],files:[],models:[],providers:[],plugins:[],pluginPanels:[],marketplace:[],marketplaceCapabilities:[],marketplaceCategories:[],marketplaceTotal:0,marketplacePage:0,marketplaceHasNext:!1,commands:[],workspaces:[]}),[s,c]=(0,o.useState)(r.view),[l,u]=(0,o.useState)(r.page),[d,f]=(0,o.useState)(r.settings),[p,m]=(0,o.useState)(),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(0),[C,w]=(0,o.useState)(!1),[T,E]=(0,o.useState)(),[D,ee]=(0,o.useState)(),[O,te]=(0,o.useState)(!1),[ne,re]=(0,o.useState)(),[ie,ae]=(0,o.useState)(!1),[oe,k]=(0,o.useState)(),[se,ce]=(0,o.useState)(),[le,ue]=(0,o.useState)(``),[de,fe]=(0,o.useState)(!1),[pe,me]=(0,o.useState)(``),[he,ge]=(0,o.useState)(),[_e,ve]=(0,o.useState)(r.sessionPath),ye=(0,o.useRef)(r.sessionPath),be=(0,o.useRef)(!1),[A,xe]=(0,o.useState)(``),[Se,Ce]=(0,o.useState)([]),[we,Te]=(0,o.useState)(``),[Ee,De]=(0,o.useState)(``),[Oe,ke]=(0,o.useState)(``),Ae=(0,o.useRef)(null),[je,Me]=(0,o.useState)(r.marketplaceQuery),[Ne,Pe]=(0,o.useState)(r.marketplaceCapability),[Fe,M]=(0,o.useState)(r.marketplaceCategory),[N,He]=(0,o.useState)(r.marketplacePlugin),[Ue,We]=(0,o.useState)(),[Ge,Ke]=(0,o.useState)(r.marketplacePlugin!==void 0),[qe,Je]=(0,o.useState)(``),[Ye,Xe]=(0,o.useState)([]),[P,Ze]=(0,o.useState)(r.installedPlugin),[Qe,$e]=(0,o.useState)(),[et,tt]=(0,o.useState)(r.marketplacePage),[nt,F]=(0,o.useState)(``),[rt,it]=(0,o.useState)(!1),[L,ot]=(0,o.useState)(``),[ct,lt]=(0,o.useState)(!1),[ut,dt]=(0,o.useState)(!1),[ft,pt]=(0,o.useState)(0),[mt,ht]=(0,o.useState)(0),[gt,_t]=(0,o.useState)(!1),[vt,yt]=(0,o.useState)(new Set),bt=(0,o.useRef)(null),Ct=(0,o.useRef)(null),[wt,Et]=(0,o.useState)(),[Dt,Ot]=(0,o.useState)(),[At,jt]=(0,o.useState)(0),Mt=(0,o.useRef)(null),Nt=(0,o.useRef)(null),Ft=(0,o.useRef)(!0),It=(0,o.useRef)(void 0),Rt=(0,o.useRef)(!1),zt=(0,o.useRef)(void 0),[Bt,Vt]=(0,o.useState)(0),[Ht,Ut]=(0,o.useState)(!1),[Wt,Gt]=(0,o.useState)(0),[Kt,qt]=(0,o.useState)(!0),[Jt,Yt]=(0,o.useState)([]);(0,o.useEffect)(()=>{let t=!1;return Lt(e).then(e=>{t||Xe(e)}).catch(()=>{t||Xe([])}),()=>{t=!0}},[e]),(0,o.useEffect)(()=>{!_e&&i.session?.sessionFile&&ve(i.session.sessionFile)},[i.session?.sessionFile,_e]);let R=(0,o.useMemo)(()=>Be(A,Bt),[A,Bt]),Xt=(0,o.useMemo)(()=>R?R.kind===`command`?Yl(i.commands,R.query).slice(0,12):i.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(R.query.trim().toLowerCase())).slice(0,12):[],[i.commands,i.files,R]),Zt=!!(R&&!Ht&&Xt.length),Qt=Math.min(Wt,Math.max(Xt.length-1,0)),$t=(0,o.useMemo)(()=>new Set(i.plugins.filter(e=>e.removable&&e.state!==ll).map(e=>e.name)),[i.plugins]),en=(0,o.useMemo)(()=>new Set(i.plugins.filter(e=>e.state===ll).map(e=>e.name)),[i.plugins]),z=i.status?.processStartedAt??``,tn=(0,o.useMemo)(()=>Pt(i.marketplaceCapabilities),[i.marketplaceCapabilities]),[nn,rn]=(0,o.useState)(()=>_l(xl())),an=e=>{rn(t=>t.process===z&&t.packages.has(e)?t:{packages:new Set([...t.process===z?t.packages:[],e]),process:z})};(0,o.useEffect)(()=>{rn(e=>yl(e,z))},[z]),(0,o.useEffect)(()=>{rn(e=>{let t=bl(e.packages,$t);return t===e.packages?e:{packages:t,process:e.process}})},[$t]),(0,o.useEffect)(()=>{vl(xl(),nn)},[nn]);let on=(0,o.useMemo)(()=>new Set([...en,...nn.packages]),[en,nn]),sn=!de&&!!(he||i.status?.cwd||i.workspaces.find(e=>e.current)?.path||i.session),cn=(0,o.useMemo)(()=>{let e=new Set(i.pluginPanels.map(e=>e.pluginId));return i.plugins.filter(t=>t.removable||e.has(t.name)).length},[i.pluginPanels,i.plugins]);(0,o.useEffect)(()=>{Gt(0)},[R?.kind,R?.query]),(0,o.useEffect)(()=>{if(!C&&!O)return;let e=e=>{e.target instanceof Element&&e.target.closest(`[data-session-popover]`)||(w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0))},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0),Ct.current?.focus())},n=()=>{w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[C,O]),(0,o.useEffect)(()=>{if(!h&&!Zt)return;let e=e=>{let t=e.target instanceof Element?e.target:void 0;h&&!t?.closest(`[data-command-palette]`)&&(g(!1),b(``)),Zt&&!t?.closest(`[data-prompt-completion]`)&&Ut(!0)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[h,Zt]),(0,o.useEffect)(()=>{let e=e=>{if(e instanceof KeyboardEvent&&e.key!==`Escape`)return;let t=e.target instanceof Element?e.target:void 0;document.querySelectorAll(`details.provider-models-details[open]`).forEach(n=>{e instanceof PointerEvent&&t&&n.contains(t)||(n.removeAttribute(`open`),e instanceof KeyboardEvent&&n.querySelector(`summary`)?.focus())})};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]),(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search);e.set(`page`,l),s===`chat`?e.delete(`view`):e.set(`view`,s),d?e.set(`settings`,d):e.delete(`settings`),_e?e.set(`session`,_e):e.delete(`session`),je?e.set(`marketplaceQuery`,je):e.delete(`marketplaceQuery`),Ne?e.set(`capability`,Ne):e.delete(`capability`),Fe?e.set(`category`,Fe):e.delete(`category`),l===`plugins`&&P?e.set(`plugin`,P):l===`marketplace`&&N?e.set(`plugin`,N):e.delete(`plugin`),et>0?e.set(`marketplacePage`,String(et)):e.delete(`marketplacePage`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},[P,Ne,Fe,et,N,je,l,_e,d,s]),(0,o.useEffect)(()=>{let e=()=>{let e=Cl();g(!1),v(!1),w(!1),m(void 0),u(e.page),c(e.view),f(e.settings),ve(e.sessionPath),Me(e.marketplaceQuery),Pe(e.marketplaceCapability),M(e.marketplaceCategory),tt(e.marketplacePage),Ze(e.installedPlugin),He(e.marketplacePlugin)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,o.useEffect)(()=>{let t=tu(N,[...i.marketplace,...Ye],zt.current);if(t.kind===`keep`)return;if(t.kind===`clear`){zt.current=void 0,We(void 0),Ke(!1),Je(``);return}if(t.kind===`show`){zt.current=N,We(t.plugin),Ke(!1),Je(``);return}let n=!1;return We(void 0),Ke(!0),Je(``),e.listMarketplace(``,``,0,100).then(e=>{if(n)return;zt.current=N;let t=e.items.find(e=>e.id===N);t===void 0?Je(I(`没有找到这个市场插件,它可能已下架。`)):We(t)}).catch(e=>{n||Je(e instanceof Error?e.message:String(e))}).finally(()=>{n||Ke(!1)}),()=>{n=!0}},[e,i.marketplace,Ye,N]),(0,o.useEffect)(()=>{if(P===void 0){$e(void 0);return}let t=Ye.find(e=>e.packageName===P);if(t!==void 0){$e(t);return}let n=!1;return $e(void 0),e.listMarketplace(``,``,0,100).then(e=>{n||$e(e.items.find(e=>e.packageName===P))}).catch(()=>{n||$e(void 0)}),()=>{n=!0}},[e,P,Ye]);let B=(0,o.useCallback)(async()=>{let t=await Promise.allSettled([e.getStatus(),e.getSession(),e.listSessions(ft,30,ut),e.getFiles(),e.listModels(),e.listProviders(),e.listPlugins(),e.listPluginPanels(),e.listMarketplace(je,Ne,et,24,Fe),e.listCommands(),e.listWorkspaces()]),[n,r,i,o,s,c,l,u,d,f,p]=t;Yt(Re([I(`运行状态`),I(`当前会话`),I(`会话列表`),I(`文件`),I(`模型`),I(`提供商`),I(`插件`),I(`插件面板`),I(`插件市场`),I(`命令`),I(`工作区`)],t)),qt(!1),a(e=>({status:n.status===`fulfilled`?n.value:e.status,session:r.status===`fulfilled`?r.value:e.session,sessions:i.status===`fulfilled`?i.value.items:e.sessions,files:o.status===`fulfilled`?o.value:e.files,models:s.status===`fulfilled`?s.value:e.models,providers:c.status===`fulfilled`?c.value:e.providers,plugins:l.status===`fulfilled`?l.value:e.plugins,pluginPanels:u.status===`fulfilled`?u.value:e.pluginPanels,marketplace:d.status===`fulfilled`?d.value.items:e.marketplace,marketplaceCapabilities:d.status===`fulfilled`?d.value.capabilities:e.marketplaceCapabilities,marketplaceCategories:d.status===`fulfilled`?d.value.categories:e.marketplaceCategories,marketplaceTotal:d.status===`fulfilled`?d.value.total:e.marketplaceTotal,marketplacePage:d.status===`fulfilled`?d.value.page:e.marketplacePage,marketplaceHasNext:d.status===`fulfilled`?d.value.hasNext:e.marketplaceHasNext,commands:f.status===`fulfilled`?f.value:e.commands,workspaces:p.status===`fulfilled`?p.value:e.workspaces})),i.status===`fulfilled`&&(ht(i.value.total),_t(i.value.hasNext))},[e,ut,Ne,Fe,et,je,ft]),ln=(0,o.useCallback)(()=>{Rt.current=!0,It.current===void 0&&(It.current=window.setTimeout(()=>{It.current=void 0,Rt.current&&(Rt.current=!1,B())},100))},[B]),un=(0,o.useCallback)(e=>{$l(e)&&ln();let t=e.event;if(typeof t!=`object`||!t)return;let n=t;if(n.type===`turn_start`){Et({thinking:``,text:``}),Ot(Date.now());return}if(n.type!==`message_update`||typeof n.assistantMessageEvent!=`object`||n.assistantMessageEvent===null)return;let r=n.assistantMessageEvent,i=r.type;if(i!==`thinking_delta`&&i!==`text_delta`)return;let a=typeof r.delta==`string`?r.delta:``;a&&Et(e=>({thinking:(e?.thinking??``)+(i===`thinking_delta`?a:``),text:(e?.text??``)+(i===`text_delta`?a:``)}))},[ln]),dn=(0,o.useRef)(un),fn=(0,o.useRef)(B),pn=(0,o.useCallback)(async t=>{F(``),me(``);try{let n=await e.createSession(t?.path);n.sessionFile&&ve(n.sessionFile),f(void 0),g(!1),v(!1),m(void 0),fe(!1),ge(t?.path),b(``),u(`session`),c(`chat`),w(!1),await B()}catch(e){let n=e instanceof Error?e.message:String(e);t?me(n):F(n)}},[e,B]),mn=()=>{F(``),me(``),ge(void 0),fe(!0)},hn=(0,o.useCallback)(async()=>{try{let t=await e.pickDirectory(),n=t.split(/[\\/]/).filter(Boolean).pop()??t;await pn({path:t,branch:`directory`,current:!1,name:n})}catch(e){me(e instanceof Error?e.message:String(e))}},[e,pn]),gn=(0,o.useCallback)(async()=>{await hn()},[hn]);(0,o.useEffect)(()=>{dn.current=un,fn.current=B},[un,B]),(0,o.useEffect)(()=>{B()},[B]),(0,o.useEffect)(()=>eu(e,dn),[e]),(0,o.useEffect)(()=>{let e=window.setInterval(()=>void fn.current(),5e3);return()=>{window.clearInterval(e),It.current!==void 0&&(window.clearTimeout(It.current),It.current=void 0)}},[]),(0,o.useEffect)(()=>{i.status?.status!==`running`&&(Et(void 0),Ot(void 0),jt(0))},[i.status?.status]),(0,o.useEffect)(()=>{if(!Dt||i.status?.status!==`running`)return;let e=setInterval(()=>jt(Math.floor((Date.now()-Dt)/1e3)),1e3);return()=>clearInterval(e)},[Dt,i.status?.status]),(0,o.useEffect)(()=>{let t=ye.current;if(!t||be.current||i.sessions.length===0)return;be.current=!0;let n=i.sessions.find(e=>e.path===t);if(!n||typeof n.path!=`string`){ve(void 0);return}i.session?.sessionFile!==n.path&&e.openSession(n.path).then(B).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,i.session?.sessionFile,i.sessions,B]),(0,o.useEffect)(()=>{if(S(0),!h)return;let e=window.requestAnimationFrame(()=>Ae.current?.focus());return()=>window.cancelAnimationFrame(e)},[h,y]);let _n=(0,o.useCallback)(()=>{F(``),e.abort().then(B).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,B]);(0,o.useEffect)(()=>{let e=e=>{if(pl(e,i.status?.status===`running`,window.getSelection()?.toString()??``)){e.preventDefault(),_n();return}if(e.key===`Escape`){if(oe){k(void 0);return}if(_){v(!1);return}if(h){g(!1),b(``);return}if(p!==void 0){m(void 0);return}g(!1),w(!1),te(!1),fe(!1),f(void 0)}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),g(!1),v(!0)),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),g(!1),v(!1),m(void 0),f(`general`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,i.status?.status,p,_,oe,_n]);let vn=i.session?.events??[],yn=(0,o.useMemo)(()=>st(vn),[vn]),bn=(0,o.useMemo)(()=>Tt(i.session?.messages??[]),[i.session?.messages]);(0,o.useEffect)(()=>{if(!Ft.current)return;let e=window.requestAnimationFrame(()=>{let e=Nt.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[i.session?.messages.length,i.status?.events,wt?.text.length,wt?.thinking.length,L,rt]);let xn=i.sessions.filter(e=>!Oe||$(e.name??e.firstMessage,I(`未命名会话`)).toLowerCase().includes(Oe.toLowerCase())),Sn=t=>{t.preventDefault();let n=A.trim(),r=Se.length>0?kt(Se,n):n;!r||rt||(xe(``),F(``),ot(r),Et(void 0),Ft.current=!0,it(!0),e.prompt(r).then(async()=>{Ce([]),await B()}).catch(e=>F(e instanceof Error?e.message:String(e))).finally(()=>ot(``)).finally(()=>it(!1)))},Cn=(0,o.useCallback)(()=>{window.requestAnimationFrame(()=>{let e=window.getSelection()?.toString().trim()??``;e.length>0&&Te(e.slice(0,4e3))})},[]),wn=()=>{let e=we.trim();e&&(Ce(t=>[...t,{id:t.length===0?1:Math.max(...t.map(e=>e.id))+1,quote:e,note:Ee.trim()}]),Te(``),De(``))},Tn=()=>{let e=Mt.current,t=e?.selectionStart??A.length,n=Be(A,t),r=t;if(n?.kind!==`command`){let e=`${t>0&&!/\s/.test(A[t-1]??``)?` `:``}/`,n=`${A.slice(0,t)}${e}${A.slice(t)}`;r=t+e.length,xe(n)}Vt(r),Ut(!1),Gt(0),window.requestAnimationFrame(()=>{e?.focus(),e?.setSelectionRange(r,r)})},En=e=>{xe(e),Vt(e.length),Ut(!1),window.requestAnimationFrame(()=>{let t=Mt.current;t?.focus(),t?.setSelectionRange(e.length,e.length)})},Dn=t=>{let n=typeof t.path==`string`?t.path:``;n&&(f(void 0),g(!1),v(!1),u(`session`),c(`chat`),m(void 0),ve(n),e.openSession(n).then(B).catch(e=>F(e instanceof Error?e.message:String(e))))},On=async e=>{if(!ct){lt(!0),F(``);try{await e(),await B(),yt(new Set),w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0),ae(!1),k(void 0)}catch(e){F(e instanceof Error?e.message:String(e))}finally{lt(!1)}}},V=i.session?.sessionFile,kn=e=>{yt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},An=(e,t,n)=>{if(C&&T===e){jn(),ce(void 0);return}te(!1),re(void 0),Ct.current=n,ue(t??``),ce({name:t||I(`未命名会话`),path:e}),E(e),ee(Ml(n,142,190,`beside`)),w(!0)},jn=()=>{w(!1),E(void 0),ee(void 0)},H=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`plugins`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),f(void 0),m(void 0),g(!1),v(!1),w(!1),E(void 0),u(`plugins`),Ze(e),He(void 0)},Mn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`marketplace`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),f(void 0),m(void 0),g(!1),v(!1),w(!1),E(void 0),u(`marketplace`),Ze(void 0),He(e)},Nn=P===void 0?void 0:i.plugins.find(e=>e.name===P),Pn=P===void 0?void 0:i.pluginPanels.find(e=>e.pluginId===P),Fn=d?(0,j.jsx)(Jl,{api:e,data:i,tab:d,onTab:f,onRefresh:B,onClose:()=>{f(void 0),u(`session`),c(`chat`),m(void 0)}}):l===`plugins`&&P&&Nn?(0,j.jsx)(Wl,{metadata:Qe,capabilityLabel:tn,onBack:()=>H(void 0),onToggle:async t=>{let n=await e.togglePlugin(t.id,!t.enabled);return await B(),n},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();a(e=>({...e,plugins:n.filter(e=>e.id!==t.id)})),H(void 0)},panel:Pn,plugin:Nn}):l===`plugins`&&P?(0,j.jsxs)(`section`,{className:`view-panel min-w-0 overflow-auto bg-[var(--color-soft)]`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav bg-[var(--color-surface)]`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),H(void 0)},children:I(`← 已安装插件`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:i.status?I(`没有找到这个已安装插件,它可能已被移除。`):I(`正在读取插件详情…`)})]}):l===`plugins`?(0,j.jsx)(Ul,{capabilityLabel:tn,plugins:i.plugins,panels:i.pluginPanels,catalog:Ye.length?Ye:i.marketplace,onMarketplace:()=>Mn(void 0),onOpenDetail:e=>H(e.name),onToml:()=>{m(void 0),f(`toml`)},onToggle:async t=>{let n=await e.togglePlugin(t.id,!t.enabled);return await B(),n},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();a(e=>({...e,plugins:n.filter(e=>e.id!==t.id)}))}}):l===`marketplace`?N&&Ue?.id===N?(0,j.jsx)(Kl,{plugin:Ue,capabilityLabel:tn,installed:$t.has(Ue.packageName),restartPending:on.has(Ue.packageName),onBack:()=>Mn(void 0),onInstall:async t=>{let n=await e.installMarketplace(t.id);return await B(),n.restartRequired===!0&&an(t.packageName),n}}):N?(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),Mn(void 0)},children:I(`← 插件市场`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:Ge?I(`正在读取插件详情…`):qe||I(`没有找到这个市场插件,它可能已下架。`)})]})}):(0,j.jsx)(Gl,{plugins:i.marketplace,capabilities:i.marketplaceCapabilities,capabilityLabel:tn,categories:i.marketplaceCategories,total:i.marketplaceTotal,page:i.marketplacePage,hasNext:i.marketplaceHasNext,query:je,capabilityFilter:Ne,categoryFilter:Fe,onQueryChange:e=>{Me(e),tt(0)},onCapabilityChange:e=>{Pe(e),tt(0)},onCategoryChange:e=>{M(e),tt(0)},onOpenDetail:e=>Mn(e.id),onPageChange:tt,onBack:()=>H(void 0),onToml:()=>{m(void 0),f(`toml`)},installedPackages:$t,restartPendingPackages:on,onInstall:async t=>{let n=await e.installMarketplace(t.id);return await B(),n.restartRequired===!0&&an(t.packageName),n}}):s===`chat`?(0,j.jsxs)(`section`,{className:`view-panel chat-view`,children:[(0,j.jsxs)(`div`,{className:`chat-scroll ${i.session?.messages.length?``:`is-empty`}`,onScroll:e=>{let t=e.currentTarget;Ft.current=t.scrollHeight-t.scrollTop-t.clientHeight<120},ref:Nt,children:[i.session?.messages.length?bn.map((e,t)=>(0,j.jsx)(lu,{locale:n,onMouseUp:Cn,role:e.role,stopped:e.stopped,text:e.text,thinking:e.thinking,tools:e.tools},t)):(0,j.jsx)(Dl,{status:i.status,workspaces:i.workspaces,onCreate:e=>void pn(e),onStarter:En,onToml:()=>{m(void 0),f(`toml`)}}),wt&&i.status?.status===`running`&&(0,j.jsxs)(`article`,{className:`turn text streaming-turn`,"aria-live":`polite`,children:[wt.thinking&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,open:!1,children:[(0,j.jsxs)(`summary`,{className:`reasoning-head`,children:[I(`思考中…`),At>0&&(0,j.jsxs)(`span`,{className:`streaming-elapsed`,children:[At,`s`]})]}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(xt,{text:wt.thinking})})]}),!wt.thinking&&!wt.text&&(0,j.jsxs)(`div`,{className:`streaming-placeholder`,children:[(0,j.jsx)(`span`,{className:`streaming-spinner`}),I(`正在生成…`),At>0&&(0,j.jsxs)(`span`,{className:`streaming-elapsed`,children:[At,`s`]})]}),wt.text&&(0,j.jsx)(xt,{onMouseUp:Cn,text:wt.text}),At>300&&(0,j.jsxs)(`div`,{className:`streaming-timeout-warning`,children:[(0,j.jsx)(`span`,{children:I(`已运行 {seconds} 秒,模型响应较慢`,{seconds:At})}),(0,j.jsx)(`button`,{onClick:()=>void e.abort(),type:`button`,children:I(`停止`)})]})]}),L&&!i.session?.messages.some(e=>e.role===`user`&&St(e)===L)&&(0,j.jsx)(`article`,{className:`turn user pending-turn`,children:(0,j.jsx)(Pl,{text:L})})]}),(0,j.jsxs)(`div`,{className:`composer-wrap`,children:[(0,j.jsx)(`div`,{className:`context-shell`,children:(0,j.jsxs)(`div`,{className:`context-line`,children:[(0,j.jsx)(`span`,{className:`context-label`,children:I(`实时上下文`)}),(0,j.jsxs)(`div`,{className:`context-metrics`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:i.status?.messages??0}),` `,I(`条消息`)]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:i.status?.events??vn.length}),` `,I(`个事件`)]}),(0,j.jsx)(`span`,{children:(0,j.jsx)(`b`,{children:$(i.status?.model)})})]})]})}),(0,j.jsxs)(`div`,{className:`composer-stack`,children:[nt&&(0,j.jsx)(Nl,{message:nt}),we?(0,j.jsxs)(`div`,{"aria-label":I(`添加批注`),className:`rounded-lg border border-[#cdddf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-[var(--color-blue-soft)] px-1.5 py-0.5 text-[10px] text-[var(--color-blue)]`,children:I(`选中片段`)}),(0,j.jsx)(`p`,{className:`max-h-16 flex-1 overflow-auto whitespace-pre-wrap text-[11px] text-[var(--color-ink)]`,children:we}),(0,j.jsx)(`button`,{"aria-label":I(`取消批注`),className:`text-[12px] text-[var(--color-faint)]`,onClick:()=>Te(``),type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,j.jsx)(`input`,{"aria-label":I(`批注备注`),className:`min-w-0 flex-1 rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1.5 text-[11px] outline-none`,onChange:e=>De(e.target.value),placeholder:I(`备注(可选)`),value:Ee}),(0,j.jsx)(`button`,{className:`rounded-md bg-[#3565c5] px-3 py-1.5 text-[11px] font-medium text-white`,onClick:wn,type:`button`,children:I(`加入批注`)})]})]}):null,Se.length>0?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto text-[10px]`,children:[(0,j.jsx)(`span`,{className:`shrink-0 rounded-md bg-[var(--color-blue-soft)] px-2 py-1 font-medium text-[var(--color-blue)]`,children:I(`批注 ×{v0}`,{v0:Se.length})}),Se.map(e=>(0,j.jsxs)(`button`,{className:`max-w-48 shrink-0 truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 text-left text-[var(--color-muted)]`,onClick:()=>Ce(t=>t.filter(t=>t.id!==e.id)),title:I(`点击移除批注`),type:`button`,children:[`#`,e.id,` `,e.quote]},e.id)),(0,j.jsx)(`button`,{className:`shrink-0 text-[var(--color-faint)]`,onClick:()=>Ce([]),type:`button`,children:I(`清空`)})]}):null,(0,j.jsxs)(`form`,{className:`composer`,onSubmit:Sn,children:[(0,j.jsx)(`textarea`,{"aria-activedescendant":Zt?`prompt-completion-option-${Qt}`:void 0,"aria-autocomplete":`list`,"aria-controls":Zt?`prompt-completion-list`:void 0,"aria-expanded":Zt,"aria-haspopup":`listbox`,"aria-label":`Prompt`,onChange:e=>{xe(e.target.value),Vt(e.currentTarget.selectionStart??e.target.value.length),Ut(!1),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,180)}px`},onKeyDown:e=>{let t=e.currentTarget.selectionStart??A.length,n=Be(e.currentTarget.value,t),r=n?n.kind===`command`?Yl(i.commands,n.query).slice(0,12):i.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(n.query.trim().toLowerCase())).slice(0,12):[],a=!!(n&&!Ht&&r.length);if(a&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),Gt(t=>(t+(e.key===`ArrowDown`?1:-1)+r.length)%r.length);return}if(a&&(e.key===`Enter`||e.key===`Tab`)){e.preventDefault();let t=r[Math.min(Wt,r.length-1)];if(t&&n){let r=n.kind===`command`?`/${t.invocationName}`:`@${t.path}`,i=Ve(e.currentTarget.value,n,`${r} `);xe(i.text),Vt(i.caret),Ut(!1),requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(i.caret,i.caret)})}return}if(e.key===`Escape`&&n&&!Ht){e.preventDefault(),Ut(!0);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onClick:()=>{sn||fe(!0)},onFocus:e=>{sn||(e.currentTarget.blur(),fe(!0))},placeholder:sn?i.commands.length?I(`描述要做的改动,⌘↵ 发送;@ 引用文件,/ 调用命令`):I(`描述要做的改动,⌘↵ 发送;@ 引用文件`):I(`先选择工作区,再描述要做的改动`),readOnly:!sn,ref:Mt,rows:2,"data-prompt-completion":!0,value:A}),Zt&&R&&(0,j.jsx)(Zl,{activeIndex:Qt,commands:i.commands,files:i.files,kind:R.kind,onActiveIndexChange:Gt,onUse:e=>{let t=Ve(A,R,`${e} `);xe(t.text),Vt(t.caret),Ut(!1),requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(t.caret,t.caret)})},query:R.query}),(0,j.jsxs)(`div`,{className:`composer-tools`,children:[(0,j.jsx)(`select`,{"aria-label":I(`模型`),disabled:!i.models.length||rt,value:i.status?.model??``,onChange:t=>{let[n,...r]=t.target.value.split(`/`),i=r.join(`/`);!n||!i||(F(``),e.selectModel(n,i).then(B).catch(e=>F(e instanceof Error?e.message:String(e))))},children:i.models.length?i.models.map(e=>(0,j.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.name===e.id?`${e.provider}/${e.id}`:`${e.name} (${e.provider})`},`${e.provider}/${e.id}`)):(0,j.jsx)(`option`,{value:``,children:I(`暂无可用模型`)})}),(0,j.jsx)(`span`,{className:`tool-chip-hint`,title:i.commands.length?I(`插入斜杠并列出命令`):I(`当前运行时还没有注册任何命令`),children:(0,j.jsx)(`button`,{className:`tool-chip`,disabled:!i.commands.length,onClick:Tn,type:`button`,children:I(`/ 命令`)})}),(0,j.jsx)(`span`,{className:`composer-hint`,children:I(`⌘↵ 发送 · ⌘K 命令 · ⌃C 中断`)}),(0,j.jsx)(`button`,{"aria-label":I(rt?`发送中`:`发送消息`),className:`send-button`,disabled:rt||!A.trim(),title:I(rt?`正在发送`:`发送消息(⌘↵)`),type:`submit`,children:rt?`…`:`↑`})]})]})]})]})]}):s===`trajectory`?(0,j.jsx)(Il,{events:yn,onSelect:m,sessionMessages:i.status?.messages??0}):(0,j.jsx)(Ll,{api:e,files:i.files,onDiff:async t=>{let n=await e.getFileDiff(t);m({type:`file_diff`,path:n.path,output:n.diff||I(`没有可显示的差异(工作区可能已更新)。`)})},onRefresh:()=>void B()}),In=El(xn),U=!!(i.session&&!Oe&&!xn.some(e=>e.sessionId===i.session?.sessionId)),Ln=Yl(i.commands,y),Rn=i.pluginPanels.find(e=>e.id===`better-sidebar-panel`),zn=Rn?.data!==null&&typeof Rn?.data==`object`&&!Array.isArray(Rn?.data)?Rn.data:void 0,W=i.pluginPanels.find(e=>e.id===`theme-studio-panel`),Bn=(0,o.useMemo)(()=>Ie(W?.data),[W?.data]),Vn=Bn?{...Bn.tokens,color:Bn.tokens[`--color-ink`],colorScheme:Bn.theme===`midnight`?`dark`:`light`}:void 0,Hn=Bn?.theme,Un=(0,o.useCallback)(e=>{let t=Mt.current,n=ml(A,t?.selectionStart??A.length,e);xe(n.text),Vt(n.caret),Ut(!1),g(!1),b(``),requestAnimationFrame(()=>requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(n.caret,n.caret)}))},[A]);return(0,j.jsxs)(`div`,{className:`app-frame`,"data-theme":Hn,style:Vn,children:[(0,j.jsxs)(`aside`,{className:`sidebar`,children:[(0,j.jsxs)(`header`,{className:`brand-row`,children:[(0,j.jsx)(`span`,{className:`pi-mark`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsx)(`strong`,{children:`pi harness`}),t?(0,j.jsx)(`span`,{className:`version`,children:t}):null]}),(0,j.jsxs)(`div`,{className:`sidebar-actions`,children:[(0,j.jsx)(`button`,{className:`new-session`,onClick:mn,type:`button`,"aria-expanded":de,children:I(`+ 新建会话`)}),(0,j.jsxs)(`div`,{className:`session-search`,"data-command-palette":!0,children:[(0,j.jsx)(`input`,{"aria-controls":h?`command-menu`:void 0,"aria-expanded":h,"aria-label":I(h?`搜索命令`:`搜索会话`),onChange:e=>{let t=e.target.value;if(!h&&t.startsWith(`/`)){g(!0),b(t.slice(1));return}h?b(t.replace(/^\/\s?/,``)):ke(t)},onKeyDown:e=>{h&&(e.key===`ArrowDown`&&Ln.length?(e.preventDefault(),S(e=>(e+1)%Ln.length)):e.key===`ArrowUp`&&Ln.length?(e.preventDefault(),S(e=>(e-1+Ln.length)%Ln.length)):e.key===`Enter`&&Ln.length&&(e.preventDefault(),Un(`/${Ln[x]?.invocationName??``}`)))},placeholder:I(h?`输入命令名称或描述`:`搜索会话 · ⌘K 命令`),ref:Ae,type:`search`,value:h?`/${y}`:Oe}),h&&(0,j.jsx)(Xl,{activeIndex:x,commands:i.commands,onActiveIndexChange:S,onUse:Un,query:y})]}),(0,j.jsx)(`input`,{accept:`.jsonl,application/json,application/x-ndjson`,"aria-label":I(`导入会话文件`),hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&On(async()=>{let t=await e.importSession(await n.text(),n.name);t.sessionFile&&ve(t.sessionFile)})},ref:bt,type:`file`})]}),(0,j.jsxs)(`div`,{className:`session-list-toolbar`,children:[(0,j.jsxs)(`div`,{className:`session-list-title`,children:[(0,j.jsx)(`strong`,{children:I(`会话`)}),(0,j.jsx)(`span`,{children:mt||i.sessions.length})]}),(0,j.jsxs)(`div`,{className:`session-list-tools`,children:[(0,j.jsx)(`button`,{"aria-pressed":ie,className:`session-tool-button ${ie?`active`:``}`,onClick:()=>{ae(!ie),yt(new Set),te(!1),jn()},type:`button`,children:I(ie?`完成`:`选择`)}),(0,j.jsxs)(`div`,{className:`session-tools-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":O,"aria-haspopup":`menu`,"aria-label":I(`会话工具`),className:`session-tool-button icon`,onClick:e=>{jn(),Ct.current=e.currentTarget,ce(void 0),O?(te(!1),re(void 0)):(re(Ml(e.currentTarget,150,190,`below`)),te(!0))},type:`button`,children:`⋯`}),O&&ne&&(0,Le.createPortal)((0,j.jsxs)(`div`,{className:`session-tools-popover`,"data-session-popover":!0,role:`menu`,style:{...Vn,...ne},children:[(0,j.jsx)(`button`,{autoFocus:!0,onClick:()=>window.location.reload(),role:`menuitem`,type:`button`,children:I(`刷新列表`)}),(0,j.jsx)(`button`,{onClick:()=>{te(!1),re(void 0),bt.current?.click()},role:`menuitem`,type:`button`,children:I(`导入会话`)}),(0,j.jsx)(`button`,{disabled:!V||ct,onClick:()=>{V&&On(async()=>{let t=await e.exportSession(V),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${i.session?.sessionId??`session`}.jsonl`,n.click(),URL.revokeObjectURL(n.href)})},role:`menuitem`,type:`button`,children:I(`导出当前会话`)}),(0,j.jsx)(`button`,{onClick:()=>{dt(e=>!e),te(!1),re(void 0),B()},role:`menuitem`,type:`button`,children:I(ut?`隐藏归档会话`:`显示归档会话`)})]}),document.body)]})]})]}),ie&&vt.size>0&&(0,j.jsxs)(`div`,{className:`session-batch-bar`,children:[(0,j.jsx)(`span`,{children:I(`{v0} 个已选择`,{v0:vt.size})}),(0,j.jsx)(`button`,{onClick:()=>void On(()=>e.batchSessions(`archive`,[...vt]).then(()=>void 0)),type:`button`,children:I(`归档`)}),(0,j.jsx)(`button`,{onClick:()=>void On(()=>e.batchSessions(`pin`,[...vt]).then(()=>void 0)),type:`button`,children:I(`置顶`)}),(0,j.jsx)(`button`,{className:`danger`,onClick:()=>{ce(void 0),k(`batch-delete`)},type:`button`,children:I(`删除`)})]}),(0,j.jsxs)(`div`,{className:`sidebar-scroll`,children:[U&&i.session&&(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:I(`当前`)}),(0,j.jsxs)(`div`,{className:`session-row-wrap current-session-row`,children:[ie&&(0,j.jsx)(`input`,{"aria-label":I(`选择当前会话`),checked:V?vt.has(V):!1,onChange:()=>V&&kn(V),type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row active`,onClick:()=>{f(void 0),g(!1),v(!1),u(`session`),c(`chat`),m(void 0),w(!1),B()},type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:i.session.messages.length?i.session.sessionId.slice(0,12):I(`新会话`)}),(0,j.jsx)(`small`,{children:I(`{v0} 条消息`,{v0:i.session.messages.length})})]})]}),!ie&&V&&(0,j.jsx)(`button`,{"aria-expanded":C&&T===V,"aria-haspopup":`menu`,"aria-label":I(`当前会话操作`),className:`session-row-more`,"data-session-popover":!0,onClick:e=>An(V,i.session?.messages.length?i.session?.sessionId.slice(0,12):I(`新会话`),e.currentTarget),type:`button`,children:`⋯`}),!ie&&V&&T===V&&C&&D&&(0,j.jsx)(jl,{busy:ct,position:D,themeStyle:Vn,onArchive:()=>{jn(),k(`archive`)},onDelete:()=>{jn(),k(`delete`)},onFork:()=>void On(async()=>{let t=await e.forkSession(V);t.sessionFile&&(ve(t.sessionFile),await e.openSession(t.sessionFile))}),onRename:()=>{jn(),k(`rename`)}})]})]}),In.length?In.map(([t,n])=>(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:Tl(t)}),n.map((t,n)=>(0,j.jsxs)(`div`,{className:`session-row-wrap`,children:[ie&&(0,j.jsx)(`input`,{"aria-label":I(`选择会话 {name}`,{name:$(t.name??t.firstMessage,I(`未命名会话`))}),checked:typeof t.path==`string`&&vt.has(t.path),onChange:()=>{typeof t.path==`string`&&kn(t.path)},type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row ${t.sessionId===i.session?.sessionId?`active`:``}`,onClick:()=>Dn(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:$(t.name??(typeof t.firstMessage==`string`?iu(t.firstMessage):``),`未命名会话`)}),(0,j.jsx)(`small`,{children:I(`{v0} 条消息{v1} {v2}`,{v0:$(t.messageCount,`0`),v1:t.pinned===!0?I(` · 已置顶`):``,v2:t.archived===!0?I(` · 已归档`):``})})]})]}),!ie&&typeof t.path==`string`&&(0,j.jsx)(`button`,{"aria-expanded":C&&T===t.path,"aria-haspopup":`menu`,"aria-label":I(`会话操作 {name}`,{name:$(t.name??t.firstMessage,I(`未命名会话`))}),className:`session-row-more`,"data-session-popover":!0,onClick:e=>{e.stopPropagation(),An(t.path,$(t.name??t.firstMessage,``),e.currentTarget)},type:`button`,children:`⋯`}),!ie&&typeof t.path==`string`&&T===t.path&&C&&D&&(0,j.jsx)(jl,{busy:ct,position:D,themeStyle:Vn,onArchive:()=>{jn(),k(`archive`)},onDelete:()=>{jn(),k(`delete`)},onFork:()=>void On(async()=>{let n=await e.forkSession(t.path);n.sessionFile&&(ve(n.sessionFile),await e.openSession(n.sessionFile))}),onRename:()=>{jn(),k(`rename`)}})]},n))]},t)):U?null:(0,j.jsx)(`div`,{className:`empty-state`,children:I(`暂无已保存会话`)}),mt>30&&(0,j.jsxs)(`div`,{className:`session-pagination`,children:[(0,j.jsx)(`button`,{disabled:ft===0,onClick:()=>pt(e=>Math.max(0,e-1)),type:`button`,children:I(`上一页`)}),(0,j.jsxs)(`span`,{children:[ft+1,` / `,Math.max(1,Math.ceil(mt/30))]}),(0,j.jsx)(`button`,{disabled:!gt,onClick:()=>pt(e=>e+1),type:`button`,children:I(`下一页`)})]}),zn&&(0,j.jsxs)(`section`,{"aria-label":I(`工作区概览`),className:`mx-3 mt-3 rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`工作区概览`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[9px] ${zn.clean===!0?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:zn.clean===!0?`clean`:I(`{count} 变更`,{count:$(zn.changedCount??0)})})]}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[10px] text-[var(--color-blue)]`,children:$(zn.cwd??I(`当前工作区`))}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:$(zn.branch??I(`非 Git 工作区`))}),Array.isArray(zn.changedFiles)&&zn.changedFiles.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1 border-t border-[#dce5f5] pt-2`,children:zn.changedFiles.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[9px] text-[var(--color-muted)]`,children:[$(n.status??`??`),` `,$(n.path??I(`未命名`))]},`${$(n.path??`file`)}-${t}`)})}):null]})]}),(0,j.jsxs)(`footer`,{className:`sidebar-footer`,children:[(0,j.jsxs)(`div`,{className:`runtime-cells`,children:[(0,j.jsxs)(`span`,{children:[`model `,(0,j.jsx)(`b`,{children:$(i.status?.model)})]}),(0,j.jsxs)(`span`,{children:[`msgs `,(0,j.jsx)(`b`,{children:i.status?.messages??0})]}),(0,j.jsxs)(`span`,{children:[`status `,(0,j.jsx)(`b`,{children:$(i.status?.status,`connecting`)})]})]}),(0,j.jsx)(`button`,{"aria-label":I(`搜索会话、文件和命令`),className:`sidebar-link compact-session-search`,onClick:()=>{g(!1),te(!1),jn(),v(!0)},title:I(`搜索会话、文件和命令`),type:`button`,children:`⌕`}),(0,j.jsx)(`button`,{"aria-label":I(`新建会话`),className:`sidebar-link compact-new-session`,onClick:mn,title:I(`新建会话`),type:`button`,children:`+`}),(0,j.jsxs)(`button`,{"aria-label":I(`插件,已安装 {count} 个`,{count:cn}),className:`sidebar-link ${l===`plugins`||l===`marketplace`?`active`:``}`,onClick:()=>H(void 0),title:I(`插件 · {count} 个`,{count:cn}),type:`button`,children:[`◈ `,(0,j.jsx)(`span`,{children:I(`插件`)}),(0,j.jsx)(`b`,{children:cn})]}),(0,j.jsxs)(`button`,{"aria-label":I(`设置`),className:`sidebar-link ${d?`active`:``}`,onClick:()=>{g(!1),v(!1),w(!1),E(void 0),m(void 0),f(`general`)},title:I(`设置`),type:`button`,children:[`⚙ `,(0,j.jsx)(`span`,{children:I(`设置`)})]})]})]}),(0,j.jsxs)(`section`,{className:`main-pane`,children:[(0,j.jsxs)(`header`,{className:`main-header ${!d&&l===`session`?`session-track`:``}`,children:[(0,j.jsxs)(`div`,{className:`active-heading`,children:[(0,j.jsx)(`strong`,{children:d?I(`设置`):l===`plugins`||l===`marketplace`?I(P||N?`插件详情`:`插件`):i.session?.messages.length?i.session.sessionId.slice(0,12):I(`新会话`)}),(0,j.jsx)(`small`,{children:d?I(`运行时状态与配置`):l===`plugins`?P?Qe?.name??Sl(P):I(`安装、启用与卸载`):l===`marketplace`?N?Ue?.name??N:I(`官方与社区 · 已审核目录`):al(i.status,i.session)})]}),(0,j.jsx)(`div`,{className:`header-spacer`}),i.status?.status===`running`&&(0,j.jsxs)(`div`,{className:`run-indicator running`,children:[(0,j.jsx)(`span`,{className:`run-dot`}),(0,j.jsx)(`span`,{children:I(`运行中 · Pi agent`)}),(0,j.jsx)(`button`,{className:`stop-button`,onClick:_n,title:I(`停止当前运行(⌃C)`),type:`button`,children:I(`停止`)})]}),!d&&l===`session`&&(0,j.jsx)(`div`,{"aria-label":I(`会话视图`),className:`view-tabs`,children:[`chat`,`trajectory`,`files`].map(e=>(0,j.jsx)(`button`,{"aria-pressed":s===e,className:`view-tab ${s===e?`active`:``}`,onClick:()=>{c(e),m(void 0)},type:`button`,children:I(e===`chat`?`对话`:e===`trajectory`?`轨迹`:`产出`)},e))}),!d&&l===`session`&&(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`header-divider`}),!d&&l===`session`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`session-menu-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":C&&!T,"aria-haspopup":`menu`,className:`session-menu`,onClick:e=>{let t=C&&!T;E(void 0),ee(void 0),Ct.current=e.currentTarget,ce(!t&&V?{name:i.session?.sessionId?.slice(0,12)||I(`当前会话`),path:V}:void 0),w(!t)},type:`button`,"aria-label":I(`会话操作`),children:`⋯`}),C&&!T&&(0,j.jsxs)(`div`,{className:`session-menu-popover compact-session-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>{ue(i.session?.sessionId?.slice(0,12)??``),k(`rename`),w(!1)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`重命名`)}),(0,j.jsx)(`small`,{children:I(`设置一个容易识别的名称`)})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>void On(async()=>{let t=await e.forkSession(V);t.sessionFile&&(ve(t.sessionFile),await e.openSession(t.sessionFile))}),role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`复制会话`)}),(0,j.jsx)(`small`,{children:I(`复制上下文并打开副本`)})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>{w(!1),k(`archive`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`归档会话`)}),(0,j.jsx)(`small`,{children:I(`从默认列表隐藏`)})]}),(0,j.jsxs)(`button`,{className:`session-action danger`,disabled:!V||ct,onClick:()=>{w(!1),k(`delete`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`删除会话`)}),(0,j.jsx)(`small`,{children:I(`永久删除本地记录`)})]})]})]}),(0,j.jsxs)(`button`,{"aria-label":I(p===void 0?`打开详情`:`关闭详情`),"aria-pressed":p!==void 0,className:`details-toggle`,onClick:()=>m(p?void 0:{}),type:`button`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`◨`}),` `,(0,j.jsx)(`span`,{className:`details-toggle-label`,children:I(`详情`)})]})]})]}),Jt.length>0&&(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`refresh-warning`,role:`status`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`部分数据刷新失败:`)}),I(`{v0} 可能为空或显示上次结果。`,{v0:Jt.join(` · `)})]}),(0,j.jsx)(`button`,{onClick:()=>void B(),type:`button`,children:I(`重试`)})]}),(0,j.jsx)(`div`,{className:`view-host`,children:Kt?(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`initial-loading`,role:`status`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`}),I(`正在连接 Pi runtime…`)]}):Fn})]}),!d&&l===`session`&&p!==void 0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":I(`关闭详情`),className:`details-backdrop`,onClick:()=>m(void 0),type:`button`}),(0,j.jsx)(Fl,{event:Object.keys(p).length?p:void 0,onClose:()=>m(void 0),onCopy:()=>void navigator.clipboard?.writeText(JSON.stringify(p,null,2))})]}),_&&(0,j.jsx)(Ql,{commands:i.commands,files:i.files,onClose:()=>v(!1),onOpenFile:e=>{u(`session`),c(`files`),m({type:`file`,path:e.path,status:e.status})},onOpenSession:Dn,onUse:Un,sessions:i.sessions}),de&&(0,j.jsx)(Ol,{error:pe,onClose:()=>fe(!1),onPickDirectory:gn,onSelect:e=>void pn(e),workspaces:i.workspaces}),oe&&(0,j.jsx)(kl,{busy:ct,count:oe===`batch-delete`?vt.size:void 0,kind:oe,name:oe===`rename`||oe===`batch-delete`?void 0:se?.name??$(i.session?.sessionId,I(`当前会话`)),onChange:ue,onClose:()=>{k(void 0),ce(void 0)},onConfirm:()=>{let t=se?.path??V;oe===`rename`&&t?On(()=>e.renameSession(t,le.trim()).then(()=>void 0)):oe===`archive`&&t?On(async()=>{await e.setSessionMetadata(t,{archived:!0})}):oe===`delete`&&t?On(async()=>{await e.deleteSession(t)}):oe===`batch-delete`&&On(()=>e.batchSessions(`delete`,[...vt]).then(()=>void 0))},value:le})]})}var du=class{context;root;version;#e;constructor(e,t={}){this.root=e,this.version=t.version,this.context=new Ae}async run(){await F(P(globalThis.localStorage)??Xe(navigator.languages)),document.documentElement.lang=nt(),this.context.provide(`clientRoot`,this.root),this.context.provide(`clientApi`,ze()),this.#e=(0,s.createRoot)(this.root),this.#e.render((0,o.createElement)(uu,{api:this.context.clientApi,appVersion:this.version}))}async dispose(){this.#e?.unmount(),await this.context.fiber.dispose()}},fu=document.getElementById(`root`);if(!(fu instanceof HTMLElement))throw Error(`Pi Harness web app is missing #root`);new du(fu,{version:`0.1.40`}).run().catch(e=>{fu.textContent=e instanceof Error?e.message:String(e)});
|
|
27
|
+
`)}):null,t.diagnosticsTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`诊断预览已截断,完整计数保留在摘要中。`)}):null]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`max:`,Math.round(e.limits.fileBytes/1024),`KiB · read-only`]})]})})():e.id===`browser-session-panel`?(()=>{let e=Tr(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Browser Session 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新连接后再试。`)})]});let t=e.tabs,r=e.latest,i=r?.screenshot?I(`已截图`):r?.clicked===!0?I(`已点击`):r?.status===`read`||typeof r?.text==`string`?I(`已读取`):r?.status===`navigated`?I(`已导航`):void 0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:e.endpoint||I(`本地浏览器未连接`)}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${e.connected?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-amber-soft)] text-[var(--color-amber)]`}`,children:e.connected?I(`已连接`):I(`未连接`)})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`Chrome DevTools Protocol · 显示 {v0}/{v1} 个可调试页面`,{v0:e.inventory.shown,v1:e.inventory.total})}),e.connected?null:(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-red)]`,children:I(`请使用 remote-debugging-port 启动 Chrome。{v0}`,{v0:e.error??``})})]}),i?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-muted)]`,children:I(`最近动作`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:i})]}):null,r?.text===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[var(--color-muted)]`,children:r.text}),r.previewTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-amber)]`,children:I(`面板正文预览已截断。`)}):null]}),r?.screenshot===void 0?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-2 text-[10px] text-[var(--color-blue)]`,children:I(`截图元数据:{v0} · {v1} bytes`,{v0:r.screenshot.mimeType,v1:r.screenshot.bytes.toLocaleString(L())})}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:e.title}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[var(--color-faint)]`,children:e.url})]},e.targetId))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`没有可调试的浏览器页面。`)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`tabs`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`read`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`click`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[var(--color-blue)]`,children:`screenshot`})]})]})})():e.id===`mcp-client-panel`?(()=>{let e=io(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(e.server??I(`尚未连接 MCP 服务器`))}),(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsx)(`span`,{children:I(`{v0} 工具`,{v0:e.inventory.tools.total})}),(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:`·`}),(0,j.jsx)(`span`,{children:I(`{v0} 资源`,{v0:e.inventory.resources.total})}),(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:`·`}),(0,j.jsx)(`span`,{children:I(`{v0} 提示`,{v0:e.inventory.prompts.total})})]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:e.lastCall===null?I(`使用 mcp_list_tools 发现 stdio 工具。`):I(`最近调用:{call}`,{call:e.lastCall})})]}),e.tools.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.tools.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,title:e.description,children:e.name},`${e.name}-${t}`))}):null,e.resources.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--color-faint)]`,children:I(`资源`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.resources.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-muted)]`,title:e.uri,children:e.name??e.uri},`${e.uri}-${t}`))})]}):null,e.prompts.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--color-faint)]`,children:I(`提示模板`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.prompts.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-muted)]`,title:e.description,children:e.name},`${e.name}-${t}`))})]}):null,e.servers.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.servers.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[var(--color-ink)]`,children:e.id}),(0,j.jsx)(`span`,{className:e.status===`running`?`text-[var(--color-green)]`:`text-[var(--color-faint)]`,children:e.status})]},`${e.id}-${t}`))}):null,e.inventory.tools.truncated||e.inventory.resources.truncated||e.inventory.prompts.truncated||e.inventory.servers.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`面板仅显示受限预览;完整清单请使用对应 MCP 列表工具。`)}):null,(0,j.jsx)(`p`,{className:`font-mono text-[9px] text-[var(--color-faint)]`,children:I(`响应上限 {v0} KiB · 请求超时 {v1} 秒`,{v0:Math.round(e.limits.responseBytes/1024),v1:Math.round(e.limits.requestTimeoutMs/1e3)})})]})})():e.id===`mcp-panel`?(()=>{let e=Array.isArray(n?.servers)?n.servers:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(n.id,I(`未命名服务器`))}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:$(n.status,`unknown`)})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{children:typeof n.toolCount==`number`?I(`{v0} 个 MCP 工具`,{v0:n.toolCount}):I(`工具尚未查询`)}),(0,j.jsx)(`span`,{children:`·`}),(0,j.jsx)(`span`,{children:$(n.statusSource,`runtime`)})]})]},`${$(n.id??`server`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前没有 MCP 服务器快照。`)}),(0,j.jsxs)(`div`,{className:`text-[10px] text-[var(--color-faint)]`,children:[I(`读取 MCP 运行状态;工具列表通过 mcp_panel 的 tools 操作查询,健康建议通过 health 操作查看。`),n?.writesEnabled===!0?` 已启用 profile patch 写入:${$(n.patchPath)}`:I(` profile patch 写入未配置,apply 会被拒绝。`)]})]})})():e.id===`mock-server-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.running===!0?I(`运行中`):I(`未启动`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[var(--color-blue)]`,children:I(`{v0} 路由`,{v0:$(n?.routes??0)})})]}),n?.url?(0,j.jsx)(`code`,{className:`rounded-md bg-[var(--color-surface)] px-3 py-2 text-[10px] text-[var(--color-muted)]`,children:$(n.url)}):null,n?.lastRequest?(0,j.jsx)(`p`,{className:`text-[11px] text-[var(--color-faint)]`,children:I(`最近请求:{v0}`,{v0:$(n.lastRequest)})}):null]}):e.id===`cli-notifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.enabled===!0?I(`已启用`):I(`已停用`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:[$(n?.platform??`unknown`),` · `,$(n?.timeoutMs??1e4),`ms`]})]}),Array.isArray(n?.notifications)&&n.notifications.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.notifications.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[var(--color-ink)]`,children:$(n.title??`Pi Harness`)}),(0,j.jsx)(`span`,{className:n.delivered===!0?`text-[var(--color-green)]`:`text-[var(--color-red)]`,children:n.delivered===!0?I(`已送达`):I(`未送达`)})]}),(0,j.jsx)(`span`,{className:`mt-1 block text-[var(--color-muted)]`,children:$(n.message,``)}),n.delivered!==!0&&n.reason?(0,j.jsx)(`span`,{className:`mt-1 block break-words text-[var(--color-red)]`,children:$(n.reason)}):null]},`${$(n.time??`notification`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有发送通知。`)})]}):e.id===`obsidian-sync-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-ink)]`,children:n?.configured===!0?I(`已配置`):I(`未配置 vault`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-faint)]`,children:`Markdown`})]}),n?.vaultPath?(0,j.jsx)(`code`,{className:`truncate rounded-md bg-[var(--color-surface)] px-3 py-2 text-[10px] text-[var(--color-muted)]`,children:$(n.vaultPath)}):null,n?.last!==null&&n?.last!==void 0&&typeof n.last==`object`?(0,j.jsx)(`p`,{className:`text-[11px] text-[var(--color-faint)]`,children:I(`最近写入:{v0}`,{v0:$(n.last.relativePath??`note.md`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有同步笔记。`)})]}):e.id===`web-research-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-blue)]`,children:n?.keyless===!0?I(`未配置搜索 API key`):I(`已配置搜索 API key`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-blue)]`,children:I(`最多 {v0} 条`,{v0:$(n?.maxResults??8)})})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.items)?e.items:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[var(--color-ink)]`,children:$(e.query??I(`网页搜索`))}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--color-faint)]`,children:I(`前 {v0} / 共 {v1}`,{v0:Math.min(8,t.length),v1:t.length})})]}),e.status===`degraded`?(0,j.jsxs)(`p`,{className:`rounded-lg bg-[var(--color-amber-soft)] px-3 py-2 text-[11px] text-[var(--color-amber)]`,children:[I(`搜索结果不完整或没有可用来源。`),$(e.summary,``)]}):null,(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`a`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-2 transition-colors hover:border-[#bdd0f5] hover:bg-[var(--color-soft)]`,href:$(n.url,``),rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[var(--color-ink)]`,children:$(n.title??n.url??I(`来源`))}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[var(--color-blue)]`,children:$(n.source??n.url,``)}),n.snippet?(0,j.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-[10px] leading-4 text-[var(--color-muted)]`,children:$(n.snippet)}):null]},`${$(n.url??`source`)}-${t}`)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有联网搜索。可让 Agent 调用 web_search;单页读取使用 read_page。`)}),(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`搜索词会发送到 Firecrawl;页面读取{v0}。`,{v0:n?.readPageAvailable===!0?I(`已复用本地 Browser Fetch`):I(`需要启用 Browser Fetch`)})})]}):e.id===`browser-fetch-panel`?(()=>{let e=nr(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Browser Fetch 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再抓取。`)})]});let t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有抓取网页。默认阻止本地和私有网络目标。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--color-ink)]`,children:$(t.finalUrl||t.url||`page`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[var(--color-green)]`,children:[`HTTP `,$(t.status||`—`)]})]}),(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3 text-[10px] leading-4 text-[var(--color-muted)]`,children:$(t.text,``)}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`响应正文已达到抓取上限。`)}):null,t.previewTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板仅显示有界预览。`)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`max:`,$(Math.round(e.limits.responseBytes/1024)),`KiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`timeout:`,$(e.limits.timeoutMs),`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`redirects:`,$(e.limits.redirects)]}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:`scripts:disabled`}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:[`private:`,$(e.allowPrivate?`allowed`:`blocked`)]})]})]})})():e.id===`i18n-pair-panel`?(()=>{let e=Ha(n),t=e.report,r=t!==null&&t.missingTotal===0&&t.extraTotal===0,i=e.status.state===`unknown`?I(`数据异常`):e.status.state===`running`?I(`检查中`):e.status.state===`failed`?I(`检查失败`):e.status.state===`cancelled`?I(`已取消`):e.status.state===`completed`?I(`已完成`):I(`等待检查`);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[var(--color-soft)] px-2 py-1 font-semibold text-[var(--color-blue)]`,children:i}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString(L())})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:e.status.error}),e.malformed?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-2 text-[10px] leading-4 text-[var(--color-red)]`,children:I(`面板数据不完整或不可信,未显示语言包统计。`)}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`还没有检查语言包。可让 Agent 调用 i18n_check。`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r?`border-[#b9e6c9] bg-[var(--color-green-soft)] text-[var(--color-green)]`:`border-[#f4caca] bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:r?I(`语言包键完全一致。`):I(`缺失 {missing} 个,额外 {extra} 个。`,{missing:t.missingTotal,extra:t.extraTotal})}),(0,j.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3 font-mono text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:I(`基准`)}),(0,j.jsx)(`span`,{className:`truncate text-[var(--color-ink)]`,title:t.base,children:t.base})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[var(--color-faint)]`,children:I(`目标`)}),(0,j.jsx)(`span`,{className:`truncate text-[var(--color-ink)]`,title:t.target,children:t.target})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`基准键`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t.baseKeys})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:I(`目标键`)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[var(--color-ink)]`,children:t.targetKeys})]})]}),t.missing.length>0||t.extra.length>0?(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[{label:I(`缺失 · {count}`,{count:t.missingTotal}),keys:t.missing,tone:`text-[var(--color-red)]`},{label:I(`额外 · {count}`,{count:t.extraTotal}),keys:t.extra,tone:`text-[var(--color-amber)]`}].map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] p-3`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] ${e.tone}`,children:e.label}),(0,j.jsx)(`ul`,{className:`mt-2 max-h-36 space-y-1 overflow-auto font-mono text-[10px] text-[var(--color-ink)]`,children:e.keys.map((e,t)=>(0,j.jsx)(`li`,{className:`truncate`,title:e,children:e},`${e}-${t}`))})]},e.label))}):null,t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板仅显示有界键列表;完整结果保留在工具调用详情中。`)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`file:`,Math.round(e.limits.fileBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`depth:`,e.limits.depth]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`keys:`,e.limits.keysPerFile]})]})]})})():e.id===`cleaner-panel`?(()=>{let e=Jr(n);if(e.malformed||e.inventory===null)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[var(--color-red-soft)] px-3 py-3 text-[11px] text-[var(--color-red)]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:I(`Cleaner 面板数据异常`)}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:I(`面板数据不完整或不可信,请重新加载后再执行清理。`)})]});let t=e.inventory,r=e.lastCleanup,i=r?.status===`running`?I(`清理中`):r?.status===`completed`?I(`已完成`):r?.status===`cancelled`?I(`已取消`):r?.status===`failed`?I(`清理失败`):I(`尚未清理`);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`Git 胶囊库存`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[12px] text-[var(--color-blue)]`,children:I(`{v0} 个`,{v0:t.total})})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[var(--color-faint)]`,children:I(`仅清理 agent 数据目录中的 .patch 胶囊,必须显式 confirm=true。`)}),(0,j.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 font-mono text-[10px] text-[var(--color-blue)]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`capsules:`,e.limits.capsules]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1`,children:[`scan:`,e.limits.directoryEntries]})]})]}),r===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:r.status===`failed`?`text-[var(--color-red)]`:`text-[var(--color-ink)]`,children:i}),r.at===null?null:(0,j.jsx)(`time`,{className:`font-mono text-[var(--color-faint)]`,children:new Date(r.at).toLocaleString(L())})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[11px] text-[var(--color-faint)]`,children:[(0,j.jsxs)(`span`,{children:[I(`已删`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.removed})]}),(0,j.jsxs)(`span`,{children:[I(`保留`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.kept??`—`})]}),(0,j.jsxs)(`span`,{children:[I(`请求保留`),` `,(0,j.jsx)(`strong`,{className:`font-mono text-[var(--color-ink)]`,children:r.requestedKeep})]})]}),r.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[var(--color-red)]`,children:r.error})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)]`,children:e.capsules.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[var(--color-ink)]`,title:e.name,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[var(--color-faint)]`,children:[e.bytes.toLocaleString(L()),` B`]})]},`${e.name}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-soft)] px-3 py-3 text-[11px] text-[var(--color-faint)]`,children:I(`当前没有可清理的 Git 胶囊。`)}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[var(--color-amber)]`,children:I(`面板显示 {v0} / {v1} 个条目;清理工具仍按完整的有界库存执行。`,{v0:t.shown,v1:t.total})}):null]})})():e.id===`fail-logger-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Wi(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-red-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-red)]`,children:I(`聚合后的失败记录`)}),(0,j.jsx)(`strong`,{className:`font-mono text-[17px] text-[var(--color-red)]`,children:e.total})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3 text-[10px] text-[var(--color-red)]`,children:[(0,j.jsx)(`span`,{children:I(`观测 {v0} 次`,{v0:e.observed})}),(0,j.jsx)(`span`,{children:I(`容量 {v0} / {v1}`,{v0:e.total,v1:e.capacity})}),e.dropped>0?(0,j.jsx)(`span`,{children:I(`已淘汰 {v0} 条旧记录`,{v0:e.dropped})}):null,e.truncated?(0,j.jsx)(`span`,{children:I(`面板明细已截断`)}):null]})]}),(0,j.jsx)(`div`,{className:`max-h-56 overflow-auto rounded-lg border border-[var(--color-line)]`,children:e.failures.length>0?e.failures.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[var(--color-line)] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-red)]`,children:e.source}),(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 font-mono text-[9px] text-[var(--color-faint)]`,children:[e.occurrences>1?(0,j.jsxs)(`strong`,{className:`text-[var(--color-red)]`,children:[`×`,e.occurrences]}):null,e.time===null?I(`时间未知`):`${e.time.slice(11,19)} UTC`]})]}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-[11px] leading-4 text-[var(--color-muted)]`,children:e.message})]},`${e.time??`failure`}-${t}`)):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[var(--color-faint)]`,children:I(`暂无失败记录。`)})})]})})()}):e.id===`context-insight-panel`?(()=>{let e=Zo(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-muted)]`,children:I(`上下文占用`)}),(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[var(--color-blue)]`,children:e.percent===null?`—`:`${e.percent}%`})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[var(--color-blue-soft)]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-[#5d8bea] transition-[width] duration-300`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[var(--color-muted)]`,children:[e.tokens===null?I(`令牌数未知`):`${e.tokens.toLocaleString(L())} tokens`,e.contextWindow===null?``:I(` / {limit} 上限`,{limit:e.contextWindow.toLocaleString(L())})]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[I(`消息`),e.messages],[I(`事件`),e.events],[I(`压缩`),e.compactions]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[var(--color-ink)]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`消息组成`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.messagesTruncated?I(`最近 {scanned} / {total} 条`,{scanned:e.scannedMessages,total:e.messages}):I(`全部 {count} 条`,{count:e.scannedMessages})})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-5 gap-1.5`,children:[[I(`用户`),e.composition.user],[I(`助手`),e.composition.assistant],[I(`工具`),e.composition.toolResult],[I(`系统`),e.composition.system],[I(`其他`),e.composition.other]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded bg-[var(--color-soft)] px-2 py-1.5 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[var(--color-faint)]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-0.5 block font-mono text-[13px] text-[var(--color-ink)]`,children:$(t)})]},$(e)))})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line)] bg-[var(--color-surface)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`最近上下文事件`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:I(`显示 {v0} / 保留 {v1} 条`,{v0:e.limits.displayedEvents,v1:e.limits.retainedEvents})})]}),(0,j.jsx)(`div`,{className:`mt-2 max-h-28 overflow-auto`,children:e.recentEvents.length>0?e.recentEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#f0f2f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--color-muted)]`,children:e.type}),(0,j.jsx)(`span`,{className:`text-[10px] text-[var(--color-faint)]`,children:e.at===null?`—`:new Date(e.at).toLocaleTimeString(L())})]},`${e.type}-${e.at??`unknown`}-${t}`)):(0,j.jsx)(`div`,{className:`py-2 text-[11px] text-[var(--color-faint)]`,children:I(`暂无上下文事件。`)})}),e.recentEventsTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[var(--color-faint)]`,children:I(`更早事件已按浏览器显示上限省略。`)}):null]})]})})():(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-soft)] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:e}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[var(--color-ink)]`,children:Rl(t)})]},e))})]})}function Vl({pluginName:e,busy:t,error:n,onCancel:r,onConfirm:i}){let a=il(!0,r,t);return(0,j.jsx)(`div`,{className:`plugin-confirm-backdrop`,onClick:()=>{t||r()},children:(0,j.jsxs)(`div`,{"aria-label":I(`确认卸载插件`),"aria-modal":`true`,className:`plugin-confirm-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsx)(`header`,{children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`卸载插件?`)}),(0,j.jsx)(`small`,{children:I(`将从运行配置中移除,之后可以从插件市场重新安装。`)})]})}),(0,j.jsx)(`code`,{children:e}),n&&(0,j.jsx)(`p`,{className:`plugin-confirm-error`,role:`alert`,children:fl(n)}),(0,j.jsxs)(`footer`,{children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:t,onClick:r,type:`button`,children:I(`取消`)}),(0,j.jsx)(`button`,{className:`danger`,disabled:t,onClick:i,type:`button`,children:I(t?`卸载中…`:`确认卸载`)})]})]})})}function Hl({label:e,categories:t,activeCategory:n,onChange:r}){let i=(0,o.useRef)(null),[a,s]=(0,o.useState)(!1),[c,l]=(0,o.useState)(!1),u=(0,o.useCallback)(()=>{let e=i.current;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);s(e.scrollLeft>1),l(e.scrollLeft<t-1)},[]);(0,o.useEffect)(()=>{let e=i.current;if(!e)return;u();let t=typeof ResizeObserver>`u`?void 0:new ResizeObserver(u);return t?.observe(e),window.addEventListener(`resize`,u),()=>{t?.disconnect(),window.removeEventListener(`resize`,u)}},[t,u]);let d=e=>{let t=i.current;t&&t.scrollBy({behavior:`smooth`,left:e*Math.max(180,t.clientWidth*.72)})};return(0,j.jsxs)(`div`,{className:`marketplace-categories-shell ${a?`can-scroll-left`:``} ${c?`can-scroll-right`:``}`,children:[a&&(0,j.jsx)(`button`,{"aria-label":I(`向左查看更多分类`),className:`marketplace-category-scroll previous`,onClick:()=>d(-1),type:`button`,children:`‹`}),(0,j.jsx)(`nav`,{"aria-label":e,className:`marketplace-categories`,onScroll:u,ref:i,children:t.map(e=>{let t=n===e.id;return(0,j.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>r(e.id),type:`button`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:t?`font-mono text-[10px] text-[var(--color-blue)]`:`font-mono text-[10px] text-[var(--color-faint)]`,children:e.count})]},e.id||`all`)})}),c&&(0,j.jsx)(`button`,{"aria-label":I(`向右查看更多分类`),className:`marketplace-category-scroll next`,onClick:()=>d(1),type:`button`,children:`›`})]})}function Ul({plugins:e,panels:t,catalog:n,capabilityLabel:r,onMarketplace:i,onOpenDetail:a,onToml:s,onToggle:c,onUninstall:l}){let u=(0,o.useMemo)(()=>new Map(n.map(e=>[e.packageName,e])),[n]),d=(0,o.useMemo)(()=>new Set(t.map(e=>e.pluginId)),[t]),f=(0,o.useMemo)(()=>e.filter(e=>e.removable||d.has(e.name)),[d,e]),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(``),[_,v]=(0,o.useState)(),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(),T=(0,o.useRef)(null),E=(0,o.useMemo)(()=>{let e=new Map;for(let t of f){let n=u.get(t.name)?.category??t.category??{id:`other`,label:I(`其他`)},r=e.get(n.id);e.set(n.id,{...n,count:(r?.count??0)+1})}return Nt([...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label,L())))},[u,f]),D=(0,o.useMemo)(()=>f.filter(e=>{let t=u.get(e.name),n=t?.category??e.category??{id:`other`,label:I(`其他`)};if(h&&n.id!==h)return!1;let i=[e.name,t?.name,Sl(e.name),t?.category.label,...(t?.capabilities??[]).map(r),e.category?.label,cl(e.name)];return Yr(p,i)}),[r,u,h,f,p]);(0,o.useEffect)(()=>{T.current?.scrollTo({top:0})},[h,p]),(0,o.useEffect)(()=>{h&&!E.some(e=>e.id===h)&&g(``)},[h,E]);let ee=async(e,t)=>{b(``),S(``),v(e.id);try{return(await t(e))?.restartRequired===!0&&S(ul()),!0}catch(e){return b(e instanceof Error?e.message:String(e)),!1}finally{v(void 0)}};return(0,j.jsx)(`section`,{className:`view-panel plugins-view`,children:(0,j.jsxs)(`div`,{className:`plugins-page`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":I(`插件目录`),className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:I(`已安装`)}),(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:i,type:`button`,children:I(`插件市场`)})]}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),s()},children:I(`查看运行配置`)})]}),(0,j.jsxs)(`div`,{className:`plugins-toolbar`,children:[(0,j.jsx)(`input`,{"aria-label":I(`搜索已安装插件`),onChange:e=>m(e.target.value),placeholder:I(`搜索名称、包名或能力…`),type:`search`,value:p}),(0,j.jsx)(`span`,{"aria-live":`polite`,children:I(`{v0} 个插件`,{v0:p.trim()||h?`${D.length} / ${f.length}`:`${f.length}`})})]}),(0,j.jsx)(Hl,{activeCategory:h,categories:E,label:I(`已安装插件分类`),onChange:g}),(0,j.jsxs)(`div`,{className:`plugins-scroll`,ref:T,children:[(0,j.jsxs)(`div`,{className:`plugins-list`,children:[D.map(e=>{let t=u.get(e.name),n=t?.category.label??e.category?.label,i=cl(e.name),o=t?.name??Sl(e.name),s=Zr(e,t,r),l=e.state===ll;return(0,j.jsxs)(`article`,{className:`catalog-card plugin-card`,children:[(0,j.jsxs)(`div`,{className:`plugin-card-head`,children:[(0,j.jsx)(`span`,{className:`plugin-icon`,children:`◈`}),(0,j.jsx)(`div`,{className:`plugin-copy`,children:(0,j.jsxs)(`div`,{className:`plugin-heading`,children:[(0,j.jsxs)(`div`,{className:`plugin-title`,children:[(0,j.jsx)(`strong`,{children:o}),(0,j.jsx)(`span`,{className:`plugin-state ${l?``:e.enabled?`active`:``}`,children:l?I(`重启后生效`):e.enabled?I(`运行中`):I(`已停用`)}),n&&(0,j.jsx)(`span`,{className:`capability`,children:n}),n!==i&&(0,j.jsx)(`span`,{className:`capability`,children:i})]}),(0,j.jsx)(`div`,{className:`plugin-actions`,children:e.removable?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":e.enabled?I(`停用 {plugin}`,{plugin:o}):I(`启用 {plugin}`,{plugin:o}),"aria-pressed":e.enabled,className:`plugin-switch-button`,disabled:_!==void 0||l,onClick:()=>void ee(e,e=>c(e)),title:l?I(`插件已安装但还没加载,重启 Pi Harness 后才能停用或启用`):void 0,type:`button`,children:(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})}),(0,j.jsx)(`button`,{className:`plugin-uninstall`,disabled:_!==void 0,onClick:()=>{b(``),w(e)},type:`button`,children:I(`卸载`)})]}):(0,j.jsx)(`span`,{className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})})]})})]}),(0,j.jsxs)(`div`,{className:`plugin-card-body`,children:[(0,j.jsx)(`code`,{className:`plugin-package`,children:s.packageLabel}),(0,j.jsx)(`p`,{className:`plugin-description`,children:s.description}),(0,j.jsx)(`div`,{className:`hook-list`,children:s.tags.map((e,t)=>(0,j.jsx)(`span`,{children:e},`${e}-${t}`))})]}),(0,j.jsxs)(`footer`,{className:`plugin-card-footer`,children:[(0,j.jsx)(`button`,{"aria-label":I(`查看 {plugin} 详情`,{plugin:o}),className:`plugin-detail-link`,onClick:()=>a(e),type:`button`,children:I(`查看详情 →`)}),d.has(e.name)?(0,j.jsx)(`span`,{children:I(`实时面板`)}):null]})]},e.id)}),f.length?D.length?null:(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配当前搜索与分类条件的已安装插件。`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`还没有安装可管理的插件。去插件市场安装一个吧。`)})]}),y&&(0,j.jsx)(`p`,{className:`plugin-action-error`,role:`alert`,children:fl(y)}),x&&(0,j.jsx)(`p`,{"aria-live":`polite`,className:`plugin-action-notice`,children:x}),t.length>f.length&&(0,j.jsxs)(`section`,{className:`mt-4 border-t border-[var(--color-line)] pt-4`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`其他插件面板`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`由已启用插件提供的实时状态。`)})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[var(--color-faint)]`,children:`LIVE`})]}),(0,j.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:t.filter(e=>!f.some(t=>t.name===e.pluginId)).map(e=>(0,j.jsx)(Bl,{panel:e},e.id))})]})]}),C&&(0,j.jsx)(Vl,{busy:_!==void 0,error:y,onCancel:()=>w(void 0),onConfirm:()=>void ee(C,l).then(e=>{e&&w(void 0)}),pluginName:u.get(C.name)?.name??Sl(C.name)})]})})}function Wl({plugin:e,panel:t,metadata:n,capabilityLabel:r,onBack:i,onToggle:a,onUninstall:s}){let[c,l]=(0,o.useState)(),u=e.state===ll,[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),_=n?.name??Sl(e.name),v=async(e,t)=>{f(``),m(``),l(e);try{return(await t())?.restartRequired===!0&&m(ul()),!0}catch(e){return f(e instanceof Error?e.message:String(e)),!1}finally{l(void 0)}};return(0,j.jsxs)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),i()},children:I(`← 已安装插件`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[var(--color-line)] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-2 py-1 font-mono text-[10px] ${e.enabled?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-soft)] text-[var(--color-faint)]`}`,children:e.enabled?I(`运行中`):I(`已停用`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 text-[10px] text-[var(--color-blue)]`,children:n?.category.label??e.category?.label??I(`运行时插件`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:cl(e.name)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--color-faint)]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[var(--color-ink)]`,children:_}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[var(--color-faint)]`,children:[e.name,n?` · v${n.version}`:``]})]}),e.removable?(0,j.jsxs)(`div`,{className:`plugin-detail-actions`,children:[(0,j.jsx)(`button`,{className:`plugin-detail-action`,disabled:c!==void 0||u,onClick:()=>void v(`toggle`,()=>a(e)),title:u?I(`插件已安装但还没加载,重启 Pi Harness 后才能停用或启用`):void 0,type:`button`,children:c===`toggle`?I(`处理中…`):u?I(`等待重启`):e.enabled?I(`停用插件`):I(`启用插件`)}),(0,j.jsx)(`button`,{className:`plugin-detail-action danger`,disabled:c!==void 0,onClick:()=>{f(``),g(!0)},type:`button`,children:I(`卸载插件`)})]}):(0,j.jsx)(`span`,{className:`rounded-full bg-[var(--color-soft)] px-3 py-1.5 text-[11px] text-[var(--color-faint)]`,children:I(`内置组件`)})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[var(--color-muted)]`,children:n?.description??(e.enabled?I(`由当前运行时加载并启用,能力与 hook 已注册。`):I(`插件保留在运行配置中,但当前处于停用状态。`))}),d&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-red)]`,role:`alert`,children:I(`操作失败:{v0}`,{v0:fl(d)})}),p&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-amber)]`,role:`status`,children:p})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`影响范围`)}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(n?.capabilities.length?n.capabilities.map(r):[cl(e.name)]).map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-blue-soft)] px-2 py-1 text-[11px] text-[var(--color-muted)]`,children:e},e))})]}),n?.hooks.length?(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`扩展点`)}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:n.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[var(--color-soft)] px-3 py-2 font-mono text-[11px] text-[var(--color-muted)]`,children:e},e))})]}):null,(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`实时详情`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`当前本机会话中的插件运行状态。`)})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.1em] text-[var(--color-faint)]`,children:`LIVE`})]}),t?(0,j.jsx)(Bl,{inline:!0,panel:t}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`这个插件暂未提供实时面板。`)})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`插件信息`)}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`运行状态`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:u?I(`已安装,重启后生效`):e.state})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`配置标识`)}),(0,j.jsx)(`dd`,{className:`max-w-[150px] break-all text-right font-mono text-[var(--color-ink)]`,children:e.id})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`分类`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.category?.label??I(`运行时插件`)})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`管理方式`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.removable?I(`可配置`):I(`随运行时加载`)})]}),n?(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`版本`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:n.version})]}):null]}),n?(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[var(--color-blue)]`,href:n.repository,rel:`noreferrer`,target:`_blank`,children:I(`查看源码 ↗`)}):null]})]})]})]}),h?(0,j.jsx)(Vl,{busy:c===`uninstall`,error:d,onCancel:()=>g(!1),onConfirm:()=>void v(`uninstall`,()=>s(e)).then(e=>{e&&g(!1)}),pluginName:_}):null]})}function Gl({plugins:e,capabilities:t,categories:n,total:r,page:i,hasNext:a,query:s,capabilityLabel:c,capabilityFilter:l,categoryFilter:u,onQueryChange:d,onCapabilityChange:f,onCategoryChange:p,onPageChange:m,onOpenDetail:h,onBack:g,onToml:_,installedPackages:v,restartPendingPackages:y,onInstall:b}){let[x,S]=(0,o.useState)(),[C,w]=(0,o.useState)(``),[T,E]=(0,o.useState)(!1),D=!T&&y.size>0,ee=(0,o.useMemo)(()=>Nt(n),[n]),O=async e=>{w(``),E(!1),S(e.id);try{await b(e)}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(void 0)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":I(`插件目录`),className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:g,type:`button`,children:I(`已安装`)}),(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:I(`插件市场`)})]}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),_()},children:I(`查看运行配置`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-toolbar`,children:[(0,j.jsx)(`input`,{className:`marketplace-search`,"aria-label":I(`搜索插件`),onChange:e=>d(e.target.value),placeholder:I(`搜索名称、包名、影响范围…`),value:s}),(0,j.jsxs)(`select`,{className:`marketplace-filter`,"aria-label":I(`按影响范围筛选`),onChange:e=>f(e.target.value),value:l,children:[(0,j.jsx)(`option`,{value:``,children:I(`全部影响`)}),t.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.count,`)`]},e.id))]}),(0,j.jsx)(`span`,{className:`marketplace-count`,children:I(`{v0} 个已审核条目 · 推荐排序`,{v0:r})}),(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`marketplace-toolbar-message`,children:[C&&(0,j.jsx)(`p`,{className:`marketplace-message error`,role:`alert`,children:I(`安装失败:{v0}`,{v0:fl(C)})}),D&&(0,j.jsxs)(`p`,{className:`marketplace-message notice`,children:[ul(),(0,j.jsx)(`button`,{className:`marketplace-message-dismiss`,onClick:()=>E(!0),type:`button`,children:I(`知道了`)})]})]})]}),(0,j.jsx)(Hl,{activeCategory:u,categories:ee,label:I(`插件分类`),onChange:p}),(0,j.jsxs)(`div`,{className:`marketplace-scroll`,children:[(0,j.jsxs)(`div`,{className:`marketplace-grid`,children:[e.map(e=>(0,j.jsxs)(`article`,{className:`catalog-card marketplace-card`,children:[(0,j.jsxs)(`header`,{className:`marketplace-card-head`,children:[(0,j.jsx)(`div`,{className:`marketplace-card-mark`,children:`◈`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,j.jsx)(`strong`,{className:`marketplace-title`,children:e.name}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[var(--color-green-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-green)]`:`rounded bg-[var(--color-amber-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-amber)]`,children:e.status===`verified`?I(`已验证`):I(`实验性`)}),(0,j.jsx)(`span`,{className:e.source===`official`?`rounded bg-[var(--color-blue-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-blue)]`:`rounded bg-[var(--color-amber-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-amber)]`,children:e.source===`official`?I(`官方`):I(`社区`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px text-[10px] text-[var(--color-blue)]`,children:e.category.label})]})})]}),(0,j.jsxs)(`div`,{className:`marketplace-card-body`,children:[(0,j.jsxs)(`code`,{className:`marketplace-package`,children:[Sl(e.packageName),` · v`,e.version]}),(0,j.jsx)(`p`,{className:`marketplace-description`,children:e.description}),(0,j.jsxs)(`div`,{className:`marketplace-tags`,children:[e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px text-[10px] text-[var(--color-muted)]`,children:c(e)},e)),e.hooks.map(e=>(0,j.jsxs)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-1.5 py-px font-mono text-[10px] text-[var(--color-muted)]`,children:[`hook:`,e]},`hook:${e}`))]}),e.statistics&&(0,j.jsx)(`div`,{className:`marketplace-statistics mt-3 grid grid-cols-3 divide-x divide-[#e3e7ee] rounded-md border border-[var(--color-line)] bg-[var(--color-soft)]`,children:It(e.statistics).map(e=>(0,j.jsxs)(`span`,{className:`min-w-0 px-2 py-1.5`,title:`${e.label} ${e.value}`,children:[(0,j.jsx)(`small`,{className:`block truncate text-[9px] text-[var(--color-faint)]`,children:e.label}),(0,j.jsx)(`strong`,{className:`mt-0.5 block truncate font-mono text-[10px] font-medium text-[var(--color-ink)]`,children:e.value})]},e.label))})]}),(0,j.jsxs)(`footer`,{className:`marketplace-card-footer`,children:[(0,j.jsxs)(`span`,{children:[e.author,` · `,e.license]}),(0,j.jsx)(`a`,{href:jt(e.id),onClick:t=>{t.preventDefault(),h(e)},children:I(`查看详情 →`)}),(0,j.jsx)(`a`,{href:e.repository,target:`_blank`,rel:`noreferrer`,children:I(`查看源码 ↗`)}),(0,j.jsx)(`button`,{disabled:v.has(e.packageName)||y.has(e.packageName)||x!==void 0,onClick:()=>void O(e),type:`button`,children:v.has(e.packageName)?I(`已安装`):y.has(e.packageName)?I(`重启后生效`):x===e.id?I(`安装中…`):I(`安装`)})]})]},e.id)),!e.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配的插件。`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-pagination`,children:[(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:i===0,onClick:()=>m(i-1),type:`button`,children:I(`上一页`)}),(0,j.jsx)(`span`,{children:I(`第 {v0} 页`,{v0:i+1})}),(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:!a,onClick:()=>m(i+1),type:`button`,children:I(`下一页`)})]}),(0,j.jsxs)(`div`,{className:`marketplace-contribute mt-3 flex items-center gap-2.5 rounded-[10px] border border-dashed border-[#b8ccf5] bg-[var(--color-blue-soft)] p-2.5 text-[11.5px] text-[var(--color-faint)]`,children:[(0,j.jsx)(`strong`,{className:`text-[12px] text-[var(--color-ink)]`,children:I(`你有一个 Pi Harness 插件?`)}),(0,j.jsx)(`span`,{children:I(`在 entries 目录新增一个元数据文件,附测试和 README 后提交 PR;审核通过后会出现在这里。`)}),(0,j.jsx)(`a`,{className:`ml-auto flex-none text-[var(--color-blue)]`,href:`https://github.com/pi-harness/pi-harness/blob/main/docs/plugin-marketplace.md`,target:`_blank`,rel:`noreferrer`,children:I(`查看贡献规范 ↗`)})]})]})]})})}function Kl({plugin:e,installed:t,restartPending:n,capabilityLabel:r,onInstall:i,onBack:a}){let[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(``),p=async()=>{u(``),f(``),c(!0);try{(await i(e)).restartRequired===!0&&f(ul())}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),a()},children:I(`← 插件市场`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[var(--color-line)] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-blue)]`,children:e.source===`official`?I(`官方插件`):I(`社区插件`)}),(0,j.jsx)(`span`,{className:`rounded bg-[var(--color-blue-soft)] px-2 py-1 text-[10px] text-[var(--color-blue)]`,children:e.category.label}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[var(--color-green-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-green)]`:`rounded bg-[var(--color-amber-soft)] px-2 py-1 font-mono text-[10px] text-[var(--color-amber)]`,children:e.status===`verified`?I(`已验证`):I(`实验性`)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--color-faint)]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[var(--color-ink)]`,children:e.name}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[var(--color-faint)]`,children:[e.packageName,` · v`,e.version]})]}),(0,j.jsx)(`div`,{className:`plugin-detail-actions`,children:(0,j.jsx)(`button`,{className:`plugin-detail-action primary`,disabled:t||n||s,onClick:()=>void p(),type:`button`,children:I(t?`已安装`:n?`重启后生效`:s?`安装中…`:`安装插件`)})})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[var(--color-muted)]`,children:e.description}),d&&(0,j.jsx)(`p`,{"aria-live":`polite`,className:`mt-3 text-[12px] text-[var(--color-blue)]`,children:d}),l&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[var(--color-red)]`,role:`alert`,children:I(`安装失败:{v0}`,{v0:fl(l)})})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`影响范围`)}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[var(--color-blue-soft)] px-2 py-1 text-[11px] text-[var(--color-muted)]`,children:r(e)},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`扩展点`)}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[var(--color-soft)] px-3 py-2 font-mono text-[11px] text-[var(--color-muted)]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`运行配置`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-faint)]`,children:I(`安装后会写入当前运行 profile。`)}),(0,j.jsx)(`pre`,{className:`mt-4 overflow-auto rounded-lg bg-[var(--color-soft)] p-4 text-[11px] leading-6 text-[var(--color-ink)]`,children:(0,j.jsx)(`code`,{children:JSON.stringify(e.profile,null,2)})})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[var(--color-line)] bg-[var(--color-surface)] p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-ink)]`,children:I(`插件信息`)}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`作者`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.author})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`许可证`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.license})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`分类`)}),(0,j.jsx)(`dd`,{className:`text-right text-[var(--color-ink)]`,children:e.category.label})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:I(`版本`)}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.version})]}),It(e.statistics).map(e=>(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[var(--color-faint)]`,children:e.label}),(0,j.jsx)(`dd`,{className:`font-mono text-[var(--color-ink)]`,children:e.value})]},e.label))]}),(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[var(--color-blue)]`,href:e.repository,target:`_blank`,rel:`noreferrer`,children:I(`查看源码 ↗`)})]})]})]})]})})}async function ql(e,t){t.busy(!0),t.state({text:I(`重载中…`),kind:`progress`});try{let n=await e.reloadConfig();t.config(n),t.sourceDraft(n.source),t.state({text:I(`已从磁盘重载`),kind:`done`})}catch(e){t.state({text:e instanceof Error?e.message:String(e),kind:`error`})}finally{t.busy(!1)}}function Jl({data:e,api:t,tab:n,onTab:r,onClose:i,onRefresh:a}){let s=e.status,[c,l]=(0,o.useState)({}),[u,d]=(0,o.useState)({}),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),g=at(),[_,v]=(0,o.useState)(),[y,b]=(0,o.useState)(`form`),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(!1),[T,E]=(0,o.useState)(),D=e.plugins.some(e=>e.name.endsWith(`/cli-notifier`)&&e.enabled),ee=il(f,()=>p(!1),u.__add!==void 0);(0,o.useEffect)(()=>{(n===`general`||n===`toml`)&&(E({text:I(`读取中…`),kind:`loading`}),t.getConfig().then(e=>{v(e),S(e.source),E(void 0)}).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})))},[t,n]);let O=(e,n)=>{w(!0),E({text:n,kind:`progress`}),t.updateConfig(e).then(e=>{v(e),S(e.source)}).then(()=>E({text:I(`已保存`),kind:`done`})).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})).finally(()=>w(!1))},te=(e,n)=>{u[e]||(d(t=>({...t,[e]:n})),l(t=>({...t,[e]:I(n===`test`?`测试中…`:`刷新中…`)})),n===`test`?t.testProvider(e).then(t=>{let n=t.auth,r=n&&typeof n==`object`&&`label`in n&&typeof n.label==`string`?n.label:void 0;l(n=>({...n,[e]:t.reachable?I(`连接正常`):r??I(`未检测到认证`)}))}).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:void 0}))):t.refreshProvider(e).then(t=>l(n=>({...n,[e]:I(`{count} 个模型已刷新`,{count:t.models.length})}))).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:void 0}))))};return(0,j.jsx)(`section`,{className:`view-panel settings-page`,children:(0,j.jsxs)(`div`,{className:`settings-dialog`,children:[(0,j.jsx)(`nav`,{"aria-label":I(`设置分类`),className:`settings-top-tabs`,children:[`general`,`providers`,`toml`].map(t=>(0,j.jsx)(`button`,{"aria-pressed":n===t,className:`settings-tab ${n===t?`active`:``}`,onClick:()=>r(t),type:`button`,children:t===`general`?I(`通用`):t===`providers`?I(`提供商 {count}`,{count:e.providers.length}):I(`运行配置`)},t))}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`button`,{className:`settings-back`,onClick:i,type:`button`,children:I(`← 返回会话`)}),(0,j.jsxs)(`div`,{className:`settings-header-copy`,children:[(0,j.jsx)(`strong`,{children:I(n===`general`?`通用`:n===`providers`?`提供商`:`运行配置`)}),(0,j.jsx)(`small`,{children:I(n===`toml`?`配置即代码,改完重载`:`运行时状态与快捷键`)})]})]}),(0,j.jsxs)(`div`,{className:`settings-body`,children:[n===`general`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`界面语言`)}),(0,j.jsx)(`small`,{children:I(`只改控制台自己的文字,你和模型对话用什么语言仍然由你决定。`)})]}),(0,j.jsx)(`select`,{"aria-label":I(`界面语言`),className:`setting-select`,onChange:e=>{let t=e.target.value;Ze(globalThis.localStorage,t),F(t).then(()=>{document.documentElement.lang=t})},value:g,children:Ge.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),[[I(`工作目录`),s?.cwd],[I(`agent 目录`),s?.agentDir],[I(`会话`),s?I(`{session} · {count} 条消息`,{session:s.sessionId,count:s.messages}):`—`],[I(`快捷键`),I(`⌘K 命令 · ⌘, 设置 · ⌃C 中断`)],[I(`权限策略`),I(`当前 API 未提供修改接口`)]].map(([e,t])=>(0,j.jsx)(`div`,{className:`general-row`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:$(t)})]})},e)),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`任务结束提醒插件`)}),(0,j.jsx)(`small`,{children:I(`由 CLI Notifier 提供,具体目标在插件配置中管理`)})]}),(0,j.jsx)(`span`,{className:`setting-status ${D?`on`:``}`,children:I(D?`已加载`:`未加载`)})]}),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`自动压缩上下文`)}),(0,j.jsx)(`small`,{children:I(`接近上下文上限时自动整理历史消息,可在运行配置中修改`)}),!_&&T&&T.kind!==`loading`?(0,j.jsx)(`small`,{className:`setting-error`,role:`alert`,children:I(`配置读取失败:{v0}`,{v0:T.text})}):null]}),(0,j.jsx)(`span`,{className:`setting-status ${_?.settings.compaction.enabled?`on`:``}`,children:_?_.settings.compaction.enabled?I(`已开启`):I(`已关闭`):T?.kind===`loading`?I(`读取中`):I(`不可用`)})]})]}),n===`providers`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`provider-add-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`已启用提供商`)}),(0,j.jsx)(`small`,{children:I(`模型列表只显示当前会话和已配置提供商。`)})]}),(0,j.jsx)(`button`,{className:`primary`,onClick:()=>p(!0),type:`button`,children:I(`添加提供商`)})]}),f&&(0,j.jsx)(`div`,{className:`provider-add-overlay`,onClick:()=>{u.__add||p(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),u.__add||p(!1))},children:(0,j.jsxs)(`div`,{"aria-busy":u.__add!==void 0,"aria-label":I(`添加提供商`),"aria-modal":`true`,className:`provider-add-modal`,onClick:e=>e.stopPropagation(),ref:ee,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`添加自定义提供商`)}),(0,j.jsx)(`small`,{children:I(`注册 OpenAI 兼容接口,凭据只提交到本机 Pi runtime。`)})]}),(0,j.jsx)(`button`,{"aria-label":I(`关闭添加提供商`),disabled:u.__add!==void 0,onClick:()=>p(!1),type:`button`,children:`×`})]}),(0,j.jsxs)(`form`,{className:`provider-add-form`,onSubmit:e=>{e.preventDefault(),!(!m.provider||!m.baseUrl||!m.apiKey||!m.model)&&(d(e=>({...e,__add:`add`})),l(e=>({...e,__add:I(`添加中…`)})),t.addProvider(m).then(async()=>{h({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),l(e=>({...e,__add:I(`已添加`)})),await a(),p(!1)}).catch(e=>l(t=>({...t,__add:e instanceof Error?e.message:String(e)}))).finally(()=>d(e=>({...e,__add:void 0}))))},children:[(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`提供商 ID`)}),(0,j.jsx)(`input`,{"aria-label":I(`提供商 ID`),"data-dialog-initial-focus":!0,maxLength:64,minLength:2,pattern:`[a-z0-9][a-z0-9._-]{1,63}`,placeholder:I(`例如 openrouter`),required:!0,value:m.provider,onChange:e=>h(t=>({...t,provider:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`显示名称`)}),(0,j.jsx)(`input`,{"aria-label":I(`提供商名称`),placeholder:I(`可选`),value:m.name,onChange:e=>h(t=>({...t,name:e.target.value}))})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:I(`接口地址`)}),(0,j.jsx)(`input`,{"aria-label":I(`接口地址`),placeholder:`https://api.example.com/v1`,required:!0,type:`url`,value:m.baseUrl,onChange:e=>h(t=>({...t,baseUrl:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`模型 ID`)}),(0,j.jsx)(`input`,{"aria-label":I(`模型 ID`),placeholder:I(`例如 gpt-4o`),required:!0,value:m.model,onChange:e=>h(t=>({...t,model:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:I(`协议`)}),(0,j.jsxs)(`select`,{"aria-label":I(`协议`),value:m.api,onChange:e=>h(t=>({...t,api:e.target.value})),children:[(0,j.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,j.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`})]})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`API key`}),(0,j.jsx)(`input`,{"aria-label":`API key`,placeholder:I(`只在本机提交,不会回显`),required:!0,type:`password`,value:m.apiKey,onChange:e=>h(t=>({...t,apiKey:e.target.value}))})]}),(0,j.jsxs)(`div`,{className:`provider-add-actions`,children:[(0,j.jsx)(`button`,{className:`primary`,disabled:u.__add!==void 0,type:`submit`,children:u.__add?I(`添加中…`):I(`添加提供商`)}),c.__add&&(0,j.jsx)(`small`,{"aria-live":`polite`,children:c.__add})]})]})]})}),(0,j.jsx)(`small`,{children:I(`已启用提供商 · /api/providers`)}),e.providers.length?e.providers.map(e=>(0,j.jsxs)(`article`,{className:`provider-card`,children:[(0,j.jsxs)(`div`,{className:`provider-head`,children:[(0,j.jsx)(`span`,{className:`provider-dot`,children:`●`}),(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`provider-state`,children:e.active?I(`当前会话`):e.auth?.configured===!0?I(`已配置`):I(`未配置`)})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`provider`}),(0,j.jsx)(`input`,{"aria-label":I(`{provider} 提供商 ID`,{provider:e.name}),disabled:!0,value:e.provider,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`model`}),(0,j.jsxs)(`div`,{className:`provider-model-value`,title:e.models.map(e=>e.id).join(`, `)||I(`暂无模型`),children:[(0,j.jsx)(`span`,{children:e.activeModel?`${e.activeModel.provider}/${e.activeModel.id}`:I(`未选择模型`)}),e.models.length>0&&(0,j.jsxs)(`details`,{className:`provider-models-details`,children:[(0,j.jsx)(`summary`,{children:I(`查看 {v0} 个模型`,{v0:e.models.length})}),(0,j.jsx)(`div`,{className:`model-chips`,children:e.models.map(e=>(0,j.jsx)(`span`,{children:e.id},e.id))})]})]})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`api_key`}),(0,j.jsx)(`input`,{"aria-label":I(`{provider} API key 状态`,{provider:e.name}),disabled:!0,value:I(`不会在浏览器显示`),readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-footer`,children:[(0,j.jsx)(`code`,{children:I(`{v0} 个模型`,{v0:e.models.length})}),(0,j.jsx)(`button`,{disabled:u[e.provider]!==void 0,onClick:()=>te(e.provider,`test`),type:`button`,children:u[e.provider]===`test`?I(`测试中…`):I(`测试连接`)}),(0,j.jsx)(`button`,{className:`link-button`,disabled:u[e.provider]!==void 0,onClick:()=>te(e.provider,`refresh`),type:`button`,children:u[e.provider]===`refresh`?I(`刷新中…`):I(`拉取模型`)})]}),c[e.provider]&&(0,j.jsx)(`small`,{"aria-live":`polite`,className:`provider-result`,children:c[e.provider]})]},e.provider)):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`运行时没有注册提供商。`)})]}),n===`toml`&&(0,j.jsxs)(`div`,{className:`config-editor`,children:[(0,j.jsxs)(`div`,{className:`toml-toolbar`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:I(`运行时配置`)}),(0,j.jsx)(`span`,{children:_?.path??`~/.pi/agent/settings.json`})]}),(0,j.jsx)(`button`,{className:y===`form`?`active`:``,onClick:()=>b(`form`),type:`button`,children:I(`表单`)}),(0,j.jsx)(`button`,{className:y===`source`?`active`:``,onClick:()=>b(`source`),type:`button`,children:I(`源码`)}),(0,j.jsx)(`button`,{className:`primary`,disabled:C,onClick:()=>{ql(t,{config:v,sourceDraft:S,state:E,busy:w})},type:`button`,children:I(`重载`)})]}),T&&(0,j.jsx)(`div`,{"aria-live":`polite`,className:`config-state ${T.kind===`error`?`error`:``}`,children:T.text}),_?y===`source`?(0,j.jsxs)(`div`,{className:`config-source-editor`,children:[(0,j.jsx)(`textarea`,{"aria-label":I(`settings.json 源码`),className:`config-source`,onChange:e=>S(e.target.value),spellCheck:!1,value:x}),(0,j.jsxs)(`div`,{className:`config-source-actions`,children:[(0,j.jsx)(`small`,{children:I(`完整 JSON 配置,可编辑未知字段;保存前会校验语法。`)}),(0,j.jsx)(`button`,{className:`primary`,disabled:C||!x.trim(),onClick:()=>{w(!0),E({text:I(`保存源码…`),kind:`progress`}),t.updateConfigSource(x).then(e=>{v(e),S(e.source),E({text:I(`已保存源码`),kind:`done`})}).catch(e=>E({text:e instanceof Error?e.message:String(e),kind:`error`})).finally(()=>w(!1))},type:`button`,children:I(`保存源码`)})]})]}):(0,j.jsxs)(`div`,{className:`config-sections`,children:[(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`模型默认值`)}),(0,j.jsx)(`small`,{children:I(`新会话启动时使用的模型和思考级别`)})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`提供商`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({defaultProvider:e.target.value},I(`保存提供商…`)),value:_.settings.defaultProvider??``,children:[(0,j.jsx)(`option`,{value:``,children:I(`跟随运行时`)}),e.providers.map(e=>(0,j.jsx)(`option`,{value:e.provider,children:e.name},e.provider))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`模型`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({defaultModel:e.target.value},I(`保存模型…`)),value:_.settings.defaultModel??``,children:[(0,j.jsx)(`option`,{value:``,children:I(`跟随提供商`)}),e.models.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.provider,`/`,e.name]},`${e.provider}/${e.id}`))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`思考级别`)}),(0,j.jsx)(`select`,{disabled:C,onChange:e=>O({defaultThinkingLevel:e.target.value},I(`保存思考级别…`)),value:_.settings.defaultThinkingLevel??`medium`,children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`运行策略`)}),(0,j.jsx)(`small`,{children:I(`消息队列和网络传输行为`)})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`传输方式`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({transport:e.target.value},I(`保存传输方式…`)),value:_.settings.transport,children:[(0,j.jsx)(`option`,{value:`auto`,children:I(`自动`)}),(0,j.jsx)(`option`,{value:`sse`,children:`SSE`}),(0,j.jsx)(`option`,{value:`websocket`,children:`WebSocket`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Steering 消息`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({steeringMode:e.target.value},I(`保存队列策略…`)),value:_.settings.steeringMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:I(`逐条发送`)}),(0,j.jsx)(`option`,{value:`all`,children:I(`一次发送全部`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Follow-up 消息`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({followUpMode:e.target.value},I(`保存跟进策略…`)),value:_.settings.followUpMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:I(`逐条发送`)}),(0,j.jsx)(`option`,{value:`all`,children:I(`一次发送全部`)})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`上下文与显示`)}),(0,j.jsx)(`small`,{children:I(`控制思考内容和自动压缩`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`隐藏思考正文`)}),(0,j.jsx)(`small`,{children:I(`只显示可展开的思考摘要`)})]}),(0,j.jsx)(`input`,{checked:_.settings.hideThinkingBlock,disabled:C,onChange:e=>O({hideThinkingBlock:e.target.checked},I(`保存显示设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`自动压缩上下文`)}),(0,j.jsx)(`small`,{children:I(`接近上下文上限时自动整理历史消息`)})]}),(0,j.jsx)(`input`,{checked:_.settings.compaction.enabled,disabled:C,onChange:e=>O({compaction:{..._.settings.compaction,enabled:e.target.checked}},I(`保存压缩设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`自动重试`)}),(0,j.jsx)(`small`,{children:I(`临时网络错误时自动重试请求`)})]}),(0,j.jsx)(`input`,{checked:_.settings.retry.enabled,disabled:C,onChange:e=>O({retry:{..._.settings.retry,enabled:e.target.checked}},I(`保存重试设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`显示图片`)}),(0,j.jsx)(`small`,{children:I(`允许模型响应中的图片渲染`)})]}),(0,j.jsx)(`input`,{checked:_.settings.terminal.showImages,disabled:C,onChange:e=>O({terminal:{..._.settings.terminal,showImages:e.target.checked}},I(`保存图片设置…`)),type:`checkbox`})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`终端与导航`)}),(0,j.jsx)(`small`,{children:I(`控制命令行界面和消息渲染行为`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`安静启动`)}),(0,j.jsx)(`small`,{children:I(`启动时隐藏版本和更新提示`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.quietStartup,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,quietStartup:e.target.checked}},I(`保存启动设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`项目可信策略`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,projectTrust:e.target.value}},I(`保存信任策略…`)),value:_.settings.advanced.projectTrust,children:[(0,j.jsx)(`option`,{value:`ask`,children:I(`每次询问`)}),(0,j.jsx)(`option`,{value:`always`,children:I(`始终信任`)}),(0,j.jsx)(`option`,{value:`never`,children:I(`从不信任`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`Mermaid 渲染`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,mermaid:e.target.value}},I(`保存 Mermaid 设置…`)),value:_.settings.advanced.mermaid,children:[(0,j.jsx)(`option`,{value:`off`,children:I(`关闭`)}),(0,j.jsx)(`option`,{value:`final`,children:I(`完成后渲染`)}),(0,j.jsx)(`option`,{value:`streaming`,children:I(`流式渲染`)})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:I(`双击 Escape`)}),(0,j.jsxs)(`select`,{disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,doubleEscapeAction:e.target.value}},I(`保存快捷键设置…`)),value:_.settings.advanced.doubleEscapeAction,children:[(0,j.jsx)(`option`,{value:`tree`,children:I(`打开会话树`)}),(0,j.jsx)(`option`,{value:`fork`,children:I(`创建分支`)}),(0,j.jsx)(`option`,{value:`none`,children:I(`不执行`)})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:I(`诊断与隐私`)}),(0,j.jsx)(`small`,{children:I(`控制缓存提示和匿名数据上报`)})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`显示缓存未命中`)}),(0,j.jsx)(`small`,{children:I(`在消息中显示模型缓存诊断`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.showCacheMissNotices,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,showCacheMissNotices:e.target.checked}},I(`保存诊断设置…`)),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`安装遥测`)}),(0,j.jsx)(`small`,{children:I(`发送匿名安装和版本统计`)})]}),(0,j.jsx)(`input`,{checked:_.settings.advanced.enableInstallTelemetry,disabled:C,onChange:e=>O({advanced:{..._.settings.advanced,enableInstallTelemetry:e.target.checked}},I(`保存隐私设置…`)),type:`checkbox`})]})]})]}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`正在读取运行时配置…`)})]})]})]})]})})}var Yl=(e,t)=>{let n=t.trim().toLowerCase();return e.filter(e=>`${e.invocationName} ${e.description??``}`.toLowerCase().includes(n))};function Xl({commands:e,query:t,activeIndex:n,onActiveIndexChange:r,onUse:i}){let a=Yl(e,t),o=e=>{let t=a[e];t&&i(`/${t.invocationName}`)};return(0,j.jsx)(`div`,{"aria-label":I(`命令面板`),className:`command-palette`,id:`command-menu`,role:`listbox`,children:(0,j.jsxs)(`div`,{className:`palette-group`,children:[(0,j.jsxs)(`small`,{children:[`COMMANDS `,(0,j.jsx)(`span`,{children:`· RUNTIME REGISTRY`})]}),a.length?a.map((e,t)=>{let i=`/${e.invocationName}`;return(0,j.jsxs)(`button`,{"aria-selected":t===n,onClick:()=>o(t),onMouseEnter:()=>r(t),role:`option`,type:`button`,children:[(0,j.jsx)(`code`,{children:i}),(0,j.jsx)(`span`,{children:e.description??e.source??I(`由当前运行时注册`)})]},`${e.invocationName}:${e.source??`runtime`}`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:e.length?I(`没有匹配的命令。`):I(`还没有加载任何命令。命令由 pi 扩展注册:把扩展放进 ~/.pi/agent/extensions(或已信任工作区的 .pi/extensions)后重启 Pi Harness。`)})]})})}function Zl({kind:e,commands:t,files:n,query:r,activeIndex:i,onActiveIndexChange:a,onUse:o}){let s=e===`command`?Yl(t,r).slice(0,12):n.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(r.trim().toLowerCase())).slice(0,12);return(0,j.jsxs)(`div`,{"aria-label":I(e===`command`?`命令补全`:`文件补全`),className:`prompt-completion`,"data-prompt-completion":!0,id:`prompt-completion-list`,role:`listbox`,children:[(0,j.jsx)(`small`,{children:I(e===`command`?`命令`:`文件`)}),s.length?s.slice(0,12).map((t,n)=>{let r=e===`command`?`/${t.invocationName}`:`@${t.path}`,s=e===`command`?t.description??t.source??I(`由当前运行时注册`):t.status;return(0,j.jsxs)(`button`,{"aria-selected":n===i,id:`prompt-completion-option-${n}`,onClick:()=>o(r),onMouseEnter:()=>a(n),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:r}),(0,j.jsx)(`span`,{children:s})]},`${e}:${r}`)}):(0,j.jsx)(`span`,{className:`prompt-completion-empty`,children:I(`没有匹配项`)})]})}function Ql({commands:e,sessions:t,files:n,onClose:r,onUse:i,onOpenSession:a,onOpenFile:s}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(0),f=il(!0,r),p=c.trim().toLowerCase(),m=e=>!p||e.toLowerCase().includes(p),h=[...e.filter(e=>m(`${e.invocationName} ${e.description??``}`)).map(e=>({kind:`command`,command:e})),...t.filter(e=>m(`${$(e.name,``)} ${$(e.firstMessage,``)} ${$(e.sessionId,``)}`)).map(e=>({kind:`session`,session:e})),...n.filter(e=>m(`${e.path} ${e.label} ${e.status}`)).map(e=>({kind:`file`,file:e}))],g=h.length?Math.min(u,h.length-1):-1,_=g>=0?`global-search-option-${g}`:void 0;(0,o.useEffect)(()=>d(0),[c]);let v=e=>{e&&(e.kind===`command`?i(`/${e.command.invocationName}`):e.kind===`session`?a(e.session):s(e.file),r())};return(0,j.jsx)(`div`,{className:`global-search`,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,j.jsxs)(`div`,{"aria-label":I(`全局搜索`),"aria-modal":`true`,className:`global-search-dialog`,ref:f,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`global-search-heading`,children:[(0,j.jsx)(`strong`,{children:I(`全局搜索`)}),(0,j.jsx)(`small`,{children:I(`命令 · 会话 · 文件`)}),(0,j.jsx)(`button`,{"aria-label":I(`关闭全局搜索`),onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`input`,{"aria-activedescendant":_,"aria-autocomplete":`list`,"aria-controls":`global-search-results`,"aria-expanded":`true`,"aria-label":I(`全局搜索`),"data-dialog-initial-focus":!0,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):e.key===`ArrowDown`&&h.length?(e.preventDefault(),d(e=>(e+1)%h.length)):e.key===`ArrowUp`&&h.length?(e.preventDefault(),d(e=>(e-1+h.length)%h.length)):e.key===`Enter`&&(e.preventDefault(),v(h[g]))},placeholder:I(`搜索命令、会话或文件`),role:`combobox`,value:c}),(0,j.jsx)(`div`,{className:`global-search-results`,id:`global-search-results`,role:`listbox`,children:h.length?[`command`,`session`,`file`].map(e=>{let t=h.filter(t=>t.kind===e);if(!t.length)return null;let n=I(e===`command`?`命令`:e===`session`?`会话`:`文件`);return(0,j.jsxs)(`section`,{"aria-label":n,className:`global-search-group`,role:`group`,children:[(0,j.jsx)(`small`,{"aria-hidden":`true`,children:n}),t.map(e=>{let t=h.indexOf(e),n=e.kind===`command`?`/${e.command.invocationName}`:e.kind===`session`?$(e.session.name??e.session.firstMessage??e.session.sessionId,I(`未命名会话`)):e.file.label,r=e.kind===`command`?e.command.description??e.command.source??I(`由当前运行时注册`):e.kind===`session`?I(`{count} 条消息`,{count:$(e.session.messageCount,`0`)}):`${e.file.path} · ${e.file.status}`;return(0,j.jsxs)(`button`,{"aria-selected":t===g,id:`global-search-option-${t}`,onClick:()=>v(e),onMouseEnter:()=>d(t),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:n}),(0,j.jsx)(`span`,{children:r})]},`${e.kind}:${n}:${t}`)})]},e)}):(0,j.jsx)(`div`,{className:`empty-state`,children:I(`没有匹配的命令、会话或文件。`)})})]})})}function $l(e){let t=e.event;return typeof t!=`object`||!t||t.type!==`message_update`}function eu(e,t){return e.subscribeEvents(e=>t.current(e))}function tu(e,t,n){if(e===void 0)return{kind:`clear`};let r=t.find(t=>t.id===e);return r===void 0?n===e?{kind:`keep`}:{kind:`fetch`}:{kind:`show`,plugin:r}}function nu(e,t,n=!0){let r=n?e.replace(/\s+/gu,` `).trim():e;return r.length<=t?r:`${r.slice(0,t-1)}…`}var ru=80;function iu(e){return nu(e,ru)}var au=140,ou=4e3;function su(e){return e==null?``:nu(typeof e==`object`?Object.entries(e).filter(([,e])=>e!=null&&e!==``).map(([e,t])=>`${e}=${typeof t==`string`?t:JSON.stringify(t)}`).join(` · `):$(e,``),au)}function cu(e){return e.map(e=>`${e.id}:${e.name}:${+!!e.failed}:${e.result?.length??-1}`).join(`|`)}var lu=(0,o.memo)(function({role:e,text:t,thinking:n,tools:r=[],stopped:i=!1,onMouseUp:a}){return(0,j.jsx)(`article`,{className:`turn ${e===`user`?`user`:`text`}`,children:e===`user`?(0,j.jsx)(Pl,{text:t}):(0,j.jsxs)(j.Fragment,{children:[n.trim()&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,open:!1,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:I(`思考`)}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(xt,{text:n})})]}),r.map((e,t)=>(0,j.jsxs)(`details`,{className:`turn-tool ${e.failed?`failed`:``}`,children:[(0,j.jsxs)(`summary`,{className:`turn-tool-head`,children:[(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`turn-tool-args`,children:su(e.arguments)}),(0,j.jsx)(`span`,{className:`turn-tool-status`,children:e.result===void 0?I(`执行中…`):e.failed?I(`失败`):I(`完成`)})]}),e.result!==void 0&&(0,j.jsx)(`pre`,{className:`turn-tool-output`,children:nu(e.result,ou,!1)})]},e.id||`${e.name}-${t}`)),t&&(0,j.jsx)(xt,{onMouseUp:a,text:t}),i&&(0,j.jsx)(`p`,{className:`turn-stopped`,children:I(`已中断`)})]})})},(e,t)=>e.locale===t.locale&&e.role===t.role&&e.text===t.text&&e.thinking===t.thinking&&e.stopped===t.stopped&&e.onMouseUp===t.onMouseUp&&cu(e.tools??[])===cu(t.tools??[]));function uu({api:e=ze(),appVersion:t}){let n=at(),r=(0,o.useMemo)(Cl,[]),[i,a]=(0,o.useState)({sessions:[],files:[],models:[],providers:[],plugins:[],pluginPanels:[],marketplace:[],marketplaceCapabilities:[],marketplaceCategories:[],marketplaceTotal:0,marketplacePage:0,marketplaceHasNext:!1,commands:[],workspaces:[]}),[s,c]=(0,o.useState)(r.view),[l,u]=(0,o.useState)(r.page),[d,f]=(0,o.useState)(r.settings),[p,m]=(0,o.useState)(),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(0),[C,w]=(0,o.useState)(!1),[T,E]=(0,o.useState)(),[D,ee]=(0,o.useState)(),[O,te]=(0,o.useState)(!1),[ne,re]=(0,o.useState)(),[ie,ae]=(0,o.useState)(!1),[oe,k]=(0,o.useState)(),[se,ce]=(0,o.useState)(),[le,ue]=(0,o.useState)(``),[de,fe]=(0,o.useState)(!1),[pe,me]=(0,o.useState)(``),[he,ge]=(0,o.useState)(),[_e,ve]=(0,o.useState)(r.sessionPath),ye=(0,o.useRef)(r.sessionPath),be=(0,o.useRef)(!1),[A,xe]=(0,o.useState)(``),[Se,Ce]=(0,o.useState)([]),[we,Te]=(0,o.useState)(``),[Ee,De]=(0,o.useState)(``),[Oe,ke]=(0,o.useState)(``),Ae=(0,o.useRef)(null),[je,Me]=(0,o.useState)(r.marketplaceQuery),[Ne,Pe]=(0,o.useState)(r.marketplaceCapability),[Fe,M]=(0,o.useState)(r.marketplaceCategory),[N,He]=(0,o.useState)(r.marketplacePlugin),[Ue,We]=(0,o.useState)(),[Ge,Ke]=(0,o.useState)(r.marketplacePlugin!==void 0),[qe,Je]=(0,o.useState)(``),[Ye,Xe]=(0,o.useState)([]),[P,Ze]=(0,o.useState)(r.installedPlugin),[Qe,$e]=(0,o.useState)(),[et,tt]=(0,o.useState)(r.marketplacePage),[nt,F]=(0,o.useState)(``),[rt,it]=(0,o.useState)(!1),[L,ot]=(0,o.useState)(``),[ct,lt]=(0,o.useState)(!1),[ut,dt]=(0,o.useState)(!1),[ft,pt]=(0,o.useState)(0),[mt,ht]=(0,o.useState)(0),[gt,_t]=(0,o.useState)(!1),[vt,yt]=(0,o.useState)(new Set),bt=(0,o.useRef)(null),Ct=(0,o.useRef)(null),[wt,Et]=(0,o.useState)(),[Dt,Ot]=(0,o.useState)(),[At,jt]=(0,o.useState)(0),Mt=(0,o.useRef)(null),Nt=(0,o.useRef)(null),Ft=(0,o.useRef)(!0),It=(0,o.useRef)(void 0),Rt=(0,o.useRef)(!1),zt=(0,o.useRef)(void 0),[Bt,Vt]=(0,o.useState)(0),[Ht,Ut]=(0,o.useState)(!1),[Wt,Gt]=(0,o.useState)(0),[Kt,qt]=(0,o.useState)(!0),[Jt,Yt]=(0,o.useState)([]);(0,o.useEffect)(()=>{let t=!1;return Lt(e).then(e=>{t||Xe(e)}).catch(()=>{t||Xe([])}),()=>{t=!0}},[e]),(0,o.useEffect)(()=>{!_e&&i.session?.sessionFile&&ve(i.session.sessionFile)},[i.session?.sessionFile,_e]);let R=(0,o.useMemo)(()=>Be(A,Bt),[A,Bt]),Xt=(0,o.useMemo)(()=>R?R.kind===`command`?Yl(i.commands,R.query).slice(0,12):i.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(R.query.trim().toLowerCase())).slice(0,12):[],[i.commands,i.files,R]),Zt=!!(R&&!Ht&&Xt.length),Qt=Math.min(Wt,Math.max(Xt.length-1,0)),$t=(0,o.useMemo)(()=>new Set(i.plugins.filter(e=>e.removable&&e.state!==ll).map(e=>e.name)),[i.plugins]),en=(0,o.useMemo)(()=>new Set(i.plugins.filter(e=>e.state===ll).map(e=>e.name)),[i.plugins]),z=i.status?.processStartedAt??``,tn=(0,o.useMemo)(()=>Pt(i.marketplaceCapabilities),[i.marketplaceCapabilities]),[nn,rn]=(0,o.useState)(()=>_l(xl())),an=e=>{rn(t=>t.process===z&&t.packages.has(e)?t:{packages:new Set([...t.process===z?t.packages:[],e]),process:z})};(0,o.useEffect)(()=>{rn(e=>yl(e,z))},[z]),(0,o.useEffect)(()=>{rn(e=>{let t=bl(e.packages,$t);return t===e.packages?e:{packages:t,process:e.process}})},[$t]),(0,o.useEffect)(()=>{vl(xl(),nn)},[nn]);let on=(0,o.useMemo)(()=>new Set([...en,...nn.packages]),[en,nn]),sn=!de&&!!(he||i.status?.cwd||i.workspaces.find(e=>e.current)?.path||i.session),cn=(0,o.useMemo)(()=>{let e=new Set(i.pluginPanels.map(e=>e.pluginId));return i.plugins.filter(t=>t.removable||e.has(t.name)).length},[i.pluginPanels,i.plugins]);(0,o.useEffect)(()=>{Gt(0)},[R?.kind,R?.query]),(0,o.useEffect)(()=>{if(!C&&!O)return;let e=e=>{e.target instanceof Element&&e.target.closest(`[data-session-popover]`)||(w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0))},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0),Ct.current?.focus())},n=()=>{w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[C,O]),(0,o.useEffect)(()=>{if(!h&&!Zt)return;let e=e=>{let t=e.target instanceof Element?e.target:void 0;h&&!t?.closest(`[data-command-palette]`)&&(g(!1),b(``)),Zt&&!t?.closest(`[data-prompt-completion]`)&&Ut(!0)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[h,Zt]),(0,o.useEffect)(()=>{let e=e=>{if(e instanceof KeyboardEvent&&e.key!==`Escape`)return;let t=e.target instanceof Element?e.target:void 0;document.querySelectorAll(`details.provider-models-details[open]`).forEach(n=>{e instanceof PointerEvent&&t&&n.contains(t)||(n.removeAttribute(`open`),e instanceof KeyboardEvent&&n.querySelector(`summary`)?.focus())})};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]),(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search);e.set(`page`,l),s===`chat`?e.delete(`view`):e.set(`view`,s),d?e.set(`settings`,d):e.delete(`settings`),_e?e.set(`session`,_e):e.delete(`session`),je?e.set(`marketplaceQuery`,je):e.delete(`marketplaceQuery`),Ne?e.set(`capability`,Ne):e.delete(`capability`),Fe?e.set(`category`,Fe):e.delete(`category`),l===`plugins`&&P?e.set(`plugin`,P):l===`marketplace`&&N?e.set(`plugin`,N):e.delete(`plugin`),et>0?e.set(`marketplacePage`,String(et)):e.delete(`marketplacePage`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},[P,Ne,Fe,et,N,je,l,_e,d,s]),(0,o.useEffect)(()=>{let e=()=>{let e=Cl();g(!1),v(!1),w(!1),m(void 0),u(e.page),c(e.view),f(e.settings),ve(e.sessionPath),Me(e.marketplaceQuery),Pe(e.marketplaceCapability),M(e.marketplaceCategory),tt(e.marketplacePage),Ze(e.installedPlugin),He(e.marketplacePlugin)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,o.useEffect)(()=>{let t=tu(N,[...i.marketplace,...Ye],zt.current);if(t.kind===`keep`)return;if(t.kind===`clear`){zt.current=void 0,We(void 0),Ke(!1),Je(``);return}if(t.kind===`show`){zt.current=N,We(t.plugin),Ke(!1),Je(``);return}let n=!1;return We(void 0),Ke(!0),Je(``),e.listMarketplace(``,``,0,100).then(e=>{if(n)return;zt.current=N;let t=e.items.find(e=>e.id===N);t===void 0?Je(I(`没有找到这个市场插件,它可能已下架。`)):We(t)}).catch(e=>{n||Je(e instanceof Error?e.message:String(e))}).finally(()=>{n||Ke(!1)}),()=>{n=!0}},[e,i.marketplace,Ye,N]),(0,o.useEffect)(()=>{if(P===void 0){$e(void 0);return}let t=Ye.find(e=>e.packageName===P);if(t!==void 0){$e(t);return}let n=!1;return $e(void 0),e.listMarketplace(``,``,0,100).then(e=>{n||$e(e.items.find(e=>e.packageName===P))}).catch(()=>{n||$e(void 0)}),()=>{n=!0}},[e,P,Ye]);let B=(0,o.useCallback)(async()=>{let t=await Promise.allSettled([e.getStatus(),e.getSession(),e.listSessions(ft,30,ut),e.getFiles(),e.listModels(),e.listProviders(),e.listPlugins(),e.listPluginPanels(),e.listMarketplace(je,Ne,et,24,Fe),e.listCommands(),e.listWorkspaces()]),[n,r,i,o,s,c,l,u,d,f,p]=t;Yt(Re([I(`运行状态`),I(`当前会话`),I(`会话列表`),I(`文件`),I(`模型`),I(`提供商`),I(`插件`),I(`插件面板`),I(`插件市场`),I(`命令`),I(`工作区`)],t)),qt(!1),a(e=>({status:n.status===`fulfilled`?n.value:e.status,session:r.status===`fulfilled`?r.value:e.session,sessions:i.status===`fulfilled`?i.value.items:e.sessions,files:o.status===`fulfilled`?o.value:e.files,models:s.status===`fulfilled`?s.value:e.models,providers:c.status===`fulfilled`?c.value:e.providers,plugins:l.status===`fulfilled`?l.value:e.plugins,pluginPanels:u.status===`fulfilled`?u.value:e.pluginPanels,marketplace:d.status===`fulfilled`?d.value.items:e.marketplace,marketplaceCapabilities:d.status===`fulfilled`?d.value.capabilities:e.marketplaceCapabilities,marketplaceCategories:d.status===`fulfilled`?d.value.categories:e.marketplaceCategories,marketplaceTotal:d.status===`fulfilled`?d.value.total:e.marketplaceTotal,marketplacePage:d.status===`fulfilled`?d.value.page:e.marketplacePage,marketplaceHasNext:d.status===`fulfilled`?d.value.hasNext:e.marketplaceHasNext,commands:f.status===`fulfilled`?f.value:e.commands,workspaces:p.status===`fulfilled`?p.value:e.workspaces})),i.status===`fulfilled`&&(ht(i.value.total),_t(i.value.hasNext))},[e,ut,Ne,Fe,et,je,ft]),ln=(0,o.useCallback)(()=>{Rt.current=!0,It.current===void 0&&(It.current=window.setTimeout(()=>{It.current=void 0,Rt.current&&(Rt.current=!1,B())},100))},[B]),un=(0,o.useCallback)(e=>{$l(e)&&ln();let t=e.event;if(typeof t!=`object`||!t)return;let n=t;if(n.type===`turn_start`){Et({thinking:``,text:``}),Ot(Date.now());return}if(n.type!==`message_update`||typeof n.assistantMessageEvent!=`object`||n.assistantMessageEvent===null)return;let r=n.assistantMessageEvent,i=r.type;if(i!==`thinking_delta`&&i!==`text_delta`)return;let a=typeof r.delta==`string`?r.delta:``;a&&Et(e=>({thinking:(e?.thinking??``)+(i===`thinking_delta`?a:``),text:(e?.text??``)+(i===`text_delta`?a:``)}))},[ln]),dn=(0,o.useRef)(un),fn=(0,o.useRef)(B),pn=(0,o.useCallback)(async t=>{F(``),me(``);try{let n=await e.createSession(t?.path);n.sessionFile&&ve(n.sessionFile),f(void 0),g(!1),v(!1),m(void 0),fe(!1),ge(t?.path),b(``),u(`session`),c(`chat`),w(!1),await B()}catch(e){let n=e instanceof Error?e.message:String(e);t?me(n):F(n)}},[e,B]),mn=()=>{F(``),me(``),ge(void 0),fe(!0)},hn=(0,o.useCallback)(async()=>{try{let t=await e.pickDirectory(),n=t.split(/[\\/]/).filter(Boolean).pop()??t;await pn({path:t,branch:`directory`,current:!1,name:n})}catch(e){me(e instanceof Error?e.message:String(e))}},[e,pn]),gn=(0,o.useCallback)(async()=>{await hn()},[hn]);(0,o.useEffect)(()=>{dn.current=un,fn.current=B},[un,B]),(0,o.useEffect)(()=>{B()},[B]),(0,o.useEffect)(()=>eu(e,dn),[e]),(0,o.useEffect)(()=>{let e=window.setInterval(()=>void fn.current(),5e3);return()=>{window.clearInterval(e),It.current!==void 0&&(window.clearTimeout(It.current),It.current=void 0)}},[]),(0,o.useEffect)(()=>{i.status?.status!==`running`&&(Et(void 0),Ot(void 0),jt(0))},[i.status?.status]),(0,o.useEffect)(()=>{if(!Dt||i.status?.status!==`running`)return;let e=setInterval(()=>jt(Math.floor((Date.now()-Dt)/1e3)),1e3);return()=>clearInterval(e)},[Dt,i.status?.status]),(0,o.useEffect)(()=>{let t=ye.current;if(!t||be.current||i.sessions.length===0)return;be.current=!0;let n=i.sessions.find(e=>e.path===t);if(!n||typeof n.path!=`string`){ve(void 0);return}i.session?.sessionFile!==n.path&&e.openSession(n.path).then(B).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,i.session?.sessionFile,i.sessions,B]),(0,o.useEffect)(()=>{if(S(0),!h)return;let e=window.requestAnimationFrame(()=>Ae.current?.focus());return()=>window.cancelAnimationFrame(e)},[h,y]);let _n=(0,o.useCallback)(()=>{F(``),e.abort().then(B).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,B]);(0,o.useEffect)(()=>{let e=e=>{if(pl(e,i.status?.status===`running`,window.getSelection()?.toString()??``)){e.preventDefault(),_n();return}if(e.key===`Escape`){if(oe){k(void 0);return}if(_){v(!1);return}if(h){g(!1),b(``);return}if(p!==void 0){m(void 0);return}g(!1),w(!1),te(!1),fe(!1),f(void 0)}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),g(!1),v(!0)),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),g(!1),v(!1),m(void 0),f(`general`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,i.status?.status,p,_,oe,_n]);let vn=i.session?.events??[],yn=(0,o.useMemo)(()=>st(vn),[vn]),bn=(0,o.useMemo)(()=>Tt(i.session?.messages??[]),[i.session?.messages]);(0,o.useEffect)(()=>{if(!Ft.current)return;let e=window.requestAnimationFrame(()=>{let e=Nt.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[i.session?.messages.length,i.status?.events,wt?.text.length,wt?.thinking.length,L,rt]);let xn=i.sessions.filter(e=>!Oe||$(e.name??e.firstMessage,I(`未命名会话`)).toLowerCase().includes(Oe.toLowerCase())),Sn=t=>{t.preventDefault();let n=A.trim(),r=Se.length>0?kt(Se,n):n;!r||rt||(xe(``),F(``),ot(r),Et(void 0),Ft.current=!0,it(!0),e.prompt(r).then(async()=>{Ce([]),await B()}).catch(e=>F(e instanceof Error?e.message:String(e))).finally(()=>ot(``)).finally(()=>it(!1)))},Cn=(0,o.useCallback)(()=>{window.requestAnimationFrame(()=>{let e=window.getSelection()?.toString().trim()??``;e.length>0&&Te(e.slice(0,4e3))})},[]),wn=()=>{let e=we.trim();e&&(Ce(t=>[...t,{id:t.length===0?1:Math.max(...t.map(e=>e.id))+1,quote:e,note:Ee.trim()}]),Te(``),De(``))},Tn=()=>{let e=Mt.current,t=e?.selectionStart??A.length,n=Be(A,t),r=t;if(n?.kind!==`command`){let e=`${t>0&&!/\s/.test(A[t-1]??``)?` `:``}/`,n=`${A.slice(0,t)}${e}${A.slice(t)}`;r=t+e.length,xe(n)}Vt(r),Ut(!1),Gt(0),window.requestAnimationFrame(()=>{e?.focus(),e?.setSelectionRange(r,r)})},En=e=>{xe(e),Vt(e.length),Ut(!1),window.requestAnimationFrame(()=>{let t=Mt.current;t?.focus(),t?.setSelectionRange(e.length,e.length)})},Dn=t=>{let n=typeof t.path==`string`?t.path:``;n&&(f(void 0),g(!1),v(!1),u(`session`),c(`chat`),m(void 0),ve(n),e.openSession(n).then(B).catch(e=>F(e instanceof Error?e.message:String(e))))},On=async e=>{if(!ct){lt(!0),F(``);try{await e(),await B(),yt(new Set),w(!1),E(void 0),ee(void 0),te(!1),re(void 0),ce(void 0),ae(!1),k(void 0)}catch(e){F(e instanceof Error?e.message:String(e))}finally{lt(!1)}}},V=i.session?.sessionFile,kn=e=>{yt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},An=(e,t,n)=>{if(C&&T===e){jn(),ce(void 0);return}te(!1),re(void 0),Ct.current=n,ue(t??``),ce({name:t||I(`未命名会话`),path:e}),E(e),ee(Ml(n,142,190,`beside`)),w(!0)},jn=()=>{w(!1),E(void 0),ee(void 0)},H=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`plugins`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),f(void 0),m(void 0),g(!1),v(!1),w(!1),E(void 0),u(`plugins`),Ze(e),He(void 0)},Mn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`marketplace`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),f(void 0),m(void 0),g(!1),v(!1),w(!1),E(void 0),u(`marketplace`),Ze(void 0),He(e)},Nn=P===void 0?void 0:i.plugins.find(e=>e.name===P),Pn=P===void 0?void 0:i.pluginPanels.find(e=>e.pluginId===P),Fn=d?(0,j.jsx)(Jl,{api:e,data:i,tab:d,onTab:f,onRefresh:B,onClose:()=>{f(void 0),u(`session`),c(`chat`),m(void 0)}}):l===`plugins`&&P&&Nn?(0,j.jsx)(Wl,{metadata:Qe,capabilityLabel:tn,onBack:()=>H(void 0),onToggle:async t=>{let n=await e.togglePlugin(t.id,!t.enabled);return await B(),n},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();a(e=>({...e,plugins:n.filter(e=>e.id!==t.id)})),H(void 0)},panel:Pn,plugin:Nn}):l===`plugins`&&P?(0,j.jsxs)(`section`,{className:`view-panel min-w-0 overflow-auto bg-[var(--color-soft)]`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav bg-[var(--color-surface)]`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),H(void 0)},children:I(`← 已安装插件`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:i.status?I(`没有找到这个已安装插件,它可能已被移除。`):I(`正在读取插件详情…`)})]}):l===`plugins`?(0,j.jsx)(Ul,{capabilityLabel:tn,plugins:i.plugins,panels:i.pluginPanels,catalog:Ye.length?Ye:i.marketplace,onMarketplace:()=>Mn(void 0),onOpenDetail:e=>H(e.name),onToml:()=>{m(void 0),f(`toml`)},onToggle:async t=>{let n=await e.togglePlugin(t.id,!t.enabled);return await B(),n},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();a(e=>({...e,plugins:n.filter(e=>e.id!==t.id)}))}}):l===`marketplace`?N&&Ue?.id===N?(0,j.jsx)(Kl,{plugin:Ue,capabilityLabel:tn,installed:$t.has(Ue.packageName),restartPending:on.has(Ue.packageName),onBack:()=>Mn(void 0),onInstall:async t=>{let n=await e.installMarketplace(t.id);return await B(),n.restartRequired===!0&&an(t.packageName),n}}):N?(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),Mn(void 0)},children:I(`← 插件市场`)}),(0,j.jsx)(`span`,{children:I(`插件详情`)})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:Ge?I(`正在读取插件详情…`):qe||I(`没有找到这个市场插件,它可能已下架。`)})]})}):(0,j.jsx)(Gl,{plugins:i.marketplace,capabilities:i.marketplaceCapabilities,capabilityLabel:tn,categories:i.marketplaceCategories,total:i.marketplaceTotal,page:i.marketplacePage,hasNext:i.marketplaceHasNext,query:je,capabilityFilter:Ne,categoryFilter:Fe,onQueryChange:e=>{Me(e),tt(0)},onCapabilityChange:e=>{Pe(e),tt(0)},onCategoryChange:e=>{M(e),tt(0)},onOpenDetail:e=>Mn(e.id),onPageChange:tt,onBack:()=>H(void 0),onToml:()=>{m(void 0),f(`toml`)},installedPackages:$t,restartPendingPackages:on,onInstall:async t=>{let n=await e.installMarketplace(t.id);return await B(),n.restartRequired===!0&&an(t.packageName),n}}):s===`chat`?(0,j.jsxs)(`section`,{className:`view-panel chat-view`,children:[(0,j.jsxs)(`div`,{className:`chat-scroll ${i.session?.messages.length?``:`is-empty`}`,onScroll:e=>{let t=e.currentTarget;Ft.current=t.scrollHeight-t.scrollTop-t.clientHeight<120},ref:Nt,children:[i.session?.messages.length?bn.map((e,t)=>(0,j.jsx)(lu,{locale:n,onMouseUp:Cn,role:e.role,stopped:e.stopped,text:e.text,thinking:e.thinking,tools:e.tools},t)):(0,j.jsx)(Dl,{status:i.status,workspaces:i.workspaces,onCreate:e=>void pn(e),onStarter:En,onToml:()=>{m(void 0),f(`toml`)}}),wt&&i.status?.status===`running`&&(0,j.jsxs)(`article`,{className:`turn text streaming-turn`,"aria-live":`polite`,children:[wt.thinking&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,open:!1,children:[(0,j.jsxs)(`summary`,{className:`reasoning-head`,children:[I(`思考中…`),At>0&&(0,j.jsxs)(`span`,{className:`streaming-elapsed`,children:[At,`s`]})]}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(xt,{text:wt.thinking})})]}),!wt.thinking&&!wt.text&&(0,j.jsxs)(`div`,{className:`streaming-placeholder`,children:[(0,j.jsx)(`span`,{className:`streaming-spinner`}),I(`正在生成…`),At>0&&(0,j.jsxs)(`span`,{className:`streaming-elapsed`,children:[At,`s`]})]}),wt.text&&(0,j.jsx)(xt,{onMouseUp:Cn,text:wt.text}),At>300&&(0,j.jsxs)(`div`,{className:`streaming-timeout-warning`,children:[(0,j.jsx)(`span`,{children:I(`已运行 {seconds} 秒,模型响应较慢`,{seconds:At})}),(0,j.jsx)(`button`,{onClick:()=>void e.abort(),type:`button`,children:I(`停止`)})]})]}),L&&!i.session?.messages.some(e=>e.role===`user`&&St(e)===L)&&(0,j.jsx)(`article`,{className:`turn user pending-turn`,children:(0,j.jsx)(Pl,{text:L})})]}),(0,j.jsxs)(`div`,{className:`composer-wrap`,children:[(0,j.jsx)(`div`,{className:`context-shell`,children:(0,j.jsxs)(`div`,{className:`context-line`,children:[(0,j.jsx)(`span`,{className:`context-label`,children:I(`实时上下文`)}),(0,j.jsxs)(`div`,{className:`context-metrics`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:i.status?.messages??0}),` `,I(`条消息`)]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:i.status?.events??vn.length}),` `,I(`个事件`)]}),(0,j.jsx)(`span`,{children:(0,j.jsx)(`b`,{children:$(i.status?.model)})})]})]})}),(0,j.jsxs)(`div`,{className:`composer-stack`,children:[nt&&(0,j.jsx)(Nl,{message:nt}),we?(0,j.jsxs)(`div`,{"aria-label":I(`添加批注`),className:`rounded-lg border border-[#cdddf8] bg-[var(--color-blue-soft)] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-[var(--color-blue-soft)] px-1.5 py-0.5 text-[10px] text-[var(--color-blue)]`,children:I(`选中片段`)}),(0,j.jsx)(`p`,{className:`max-h-16 flex-1 overflow-auto whitespace-pre-wrap text-[11px] text-[var(--color-ink)]`,children:we}),(0,j.jsx)(`button`,{"aria-label":I(`取消批注`),className:`text-[12px] text-[var(--color-faint)]`,onClick:()=>Te(``),type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,j.jsx)(`input`,{"aria-label":I(`批注备注`),className:`min-w-0 flex-1 rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1.5 text-[11px] outline-none`,onChange:e=>De(e.target.value),placeholder:I(`备注(可选)`),value:Ee}),(0,j.jsx)(`button`,{className:`rounded-md bg-[#3565c5] px-3 py-1.5 text-[11px] font-medium text-white`,onClick:wn,type:`button`,children:I(`加入批注`)})]})]}):null,Se.length>0?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto text-[10px]`,children:[(0,j.jsx)(`span`,{className:`shrink-0 rounded-md bg-[var(--color-blue-soft)] px-2 py-1 font-medium text-[var(--color-blue)]`,children:I(`批注 ×{v0}`,{v0:Se.length})}),Se.map(e=>(0,j.jsxs)(`button`,{className:`max-w-48 shrink-0 truncate rounded-md border border-[#dce5f5] bg-[var(--color-surface)] px-2 py-1 text-left text-[var(--color-muted)]`,onClick:()=>Ce(t=>t.filter(t=>t.id!==e.id)),title:I(`点击移除批注`),type:`button`,children:[`#`,e.id,` `,e.quote]},e.id)),(0,j.jsx)(`button`,{className:`shrink-0 text-[var(--color-faint)]`,onClick:()=>Ce([]),type:`button`,children:I(`清空`)})]}):null,(0,j.jsxs)(`form`,{className:`composer`,onSubmit:Sn,children:[(0,j.jsx)(`textarea`,{"aria-activedescendant":Zt?`prompt-completion-option-${Qt}`:void 0,"aria-autocomplete":`list`,"aria-controls":Zt?`prompt-completion-list`:void 0,"aria-expanded":Zt,"aria-haspopup":`listbox`,"aria-label":`Prompt`,onChange:e=>{xe(e.target.value),Vt(e.currentTarget.selectionStart??e.target.value.length),Ut(!1),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,180)}px`},onKeyDown:e=>{let t=e.currentTarget.selectionStart??A.length,n=Be(e.currentTarget.value,t),r=n?n.kind===`command`?Yl(i.commands,n.query).slice(0,12):i.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(n.query.trim().toLowerCase())).slice(0,12):[],a=!!(n&&!Ht&&r.length);if(a&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),Gt(t=>(t+(e.key===`ArrowDown`?1:-1)+r.length)%r.length);return}if(a&&(e.key===`Enter`||e.key===`Tab`)){e.preventDefault();let t=r[Math.min(Wt,r.length-1)];if(t&&n){let r=n.kind===`command`?`/${t.invocationName}`:`@${t.path}`,i=Ve(e.currentTarget.value,n,`${r} `);xe(i.text),Vt(i.caret),Ut(!1),requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(i.caret,i.caret)})}return}if(e.key===`Escape`&&n&&!Ht){e.preventDefault(),Ut(!0);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onClick:()=>{sn||fe(!0)},onFocus:e=>{sn||(e.currentTarget.blur(),fe(!0))},placeholder:sn?i.commands.length?I(`描述要做的改动,⌘↵ 发送;@ 引用文件,/ 调用命令`):I(`描述要做的改动,⌘↵ 发送;@ 引用文件`):I(`先选择工作区,再描述要做的改动`),readOnly:!sn,ref:Mt,rows:2,"data-prompt-completion":!0,value:A}),Zt&&R&&(0,j.jsx)(Zl,{activeIndex:Qt,commands:i.commands,files:i.files,kind:R.kind,onActiveIndexChange:Gt,onUse:e=>{let t=Ve(A,R,`${e} `);xe(t.text),Vt(t.caret),Ut(!1),requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(t.caret,t.caret)})},query:R.query}),(0,j.jsxs)(`div`,{className:`composer-tools`,children:[(0,j.jsx)(`select`,{"aria-label":I(`模型`),disabled:!i.models.length||rt,value:i.status?.model??``,onChange:t=>{let[n,...r]=t.target.value.split(`/`),i=r.join(`/`);!n||!i||(F(``),e.selectModel(n,i).then(B).catch(e=>F(e instanceof Error?e.message:String(e))))},children:i.models.length?i.models.map(e=>(0,j.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.name===e.id?`${e.provider}/${e.id}`:`${e.name} (${e.provider})`},`${e.provider}/${e.id}`)):(0,j.jsx)(`option`,{value:``,children:I(`暂无可用模型`)})}),(0,j.jsx)(`span`,{className:`tool-chip-hint`,title:i.commands.length?I(`插入斜杠并列出命令`):I(`当前运行时还没有注册任何命令`),children:(0,j.jsx)(`button`,{className:`tool-chip`,disabled:!i.commands.length,onClick:Tn,type:`button`,children:I(`/ 命令`)})}),(0,j.jsx)(`span`,{className:`composer-hint`,children:I(`⌘↵ 发送 · ⌘K 命令 · ⌃C 中断`)}),(0,j.jsx)(`button`,{"aria-label":I(rt?`发送中`:`发送消息`),className:`send-button`,disabled:rt||!A.trim(),title:I(rt?`正在发送`:`发送消息(⌘↵)`),type:`submit`,children:rt?`…`:`↑`})]})]})]})]})]}):s===`trajectory`?(0,j.jsx)(Il,{events:yn,onSelect:m,sessionMessages:i.status?.messages??0}):(0,j.jsx)(Ll,{api:e,files:i.files,onDiff:async t=>{let n=await e.getFileDiff(t);m({type:`file_diff`,path:n.path,output:n.diff||I(`没有可显示的差异(工作区可能已更新)。`)})},onRefresh:()=>void B()}),In=El(xn),U=!!(i.session&&!Oe&&!xn.some(e=>e.sessionId===i.session?.sessionId)),Ln=Yl(i.commands,y),Rn=i.pluginPanels.find(e=>e.id===`better-sidebar-panel`),zn=Rn?.data!==null&&typeof Rn?.data==`object`&&!Array.isArray(Rn?.data)?Rn.data:void 0,W=i.pluginPanels.find(e=>e.id===`theme-studio-panel`),Bn=(0,o.useMemo)(()=>Ie(W?.data),[W?.data]),Vn=Bn?{...Bn.tokens,color:Bn.tokens[`--color-ink`],colorScheme:Bn.theme===`midnight`?`dark`:`light`}:void 0,Hn=Bn?.theme,Un=(0,o.useCallback)(e=>{let t=Mt.current,n=ml(A,t?.selectionStart??A.length,e);xe(n.text),Vt(n.caret),Ut(!1),g(!1),b(``),requestAnimationFrame(()=>requestAnimationFrame(()=>{let e=Mt.current;e?.focus(),e?.setSelectionRange(n.caret,n.caret)}))},[A]);return(0,j.jsxs)(`div`,{className:`app-frame`,"data-theme":Hn,style:Vn,children:[(0,j.jsxs)(`aside`,{className:`sidebar`,children:[(0,j.jsxs)(`header`,{className:`brand-row`,children:[(0,j.jsx)(`span`,{className:`pi-mark`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsx)(`strong`,{children:`pi harness`}),t?(0,j.jsx)(`span`,{className:`version`,children:t}):null]}),(0,j.jsxs)(`div`,{className:`sidebar-actions`,children:[(0,j.jsx)(`button`,{className:`new-session`,onClick:mn,type:`button`,"aria-expanded":de,children:I(`+ 新建会话`)}),(0,j.jsxs)(`div`,{className:`session-search`,"data-command-palette":!0,children:[(0,j.jsx)(`input`,{"aria-controls":h?`command-menu`:void 0,"aria-expanded":h,"aria-label":I(h?`搜索命令`:`搜索会话`),onChange:e=>{let t=e.target.value;if(!h&&t.startsWith(`/`)){g(!0),b(t.slice(1));return}h?b(t.replace(/^\/\s?/,``)):ke(t)},onKeyDown:e=>{h&&(e.key===`ArrowDown`&&Ln.length?(e.preventDefault(),S(e=>(e+1)%Ln.length)):e.key===`ArrowUp`&&Ln.length?(e.preventDefault(),S(e=>(e-1+Ln.length)%Ln.length)):e.key===`Enter`&&Ln.length&&(e.preventDefault(),Un(`/${Ln[x]?.invocationName??``}`)))},placeholder:I(h?`输入命令名称或描述`:`搜索会话 · ⌘K 命令`),ref:Ae,type:`search`,value:h?`/${y}`:Oe}),h&&(0,j.jsx)(Xl,{activeIndex:x,commands:i.commands,onActiveIndexChange:S,onUse:Un,query:y})]}),(0,j.jsx)(`input`,{accept:`.jsonl,application/json,application/x-ndjson`,"aria-label":I(`导入会话文件`),hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&On(async()=>{let t=await e.importSession(await n.text(),n.name);t.sessionFile&&ve(t.sessionFile)})},ref:bt,type:`file`})]}),(0,j.jsxs)(`div`,{className:`session-list-toolbar`,children:[(0,j.jsxs)(`div`,{className:`session-list-title`,children:[(0,j.jsx)(`strong`,{children:I(`会话`)}),(0,j.jsx)(`span`,{children:mt||i.sessions.length})]}),(0,j.jsxs)(`div`,{className:`session-list-tools`,children:[(0,j.jsx)(`button`,{"aria-pressed":ie,className:`session-tool-button ${ie?`active`:``}`,onClick:()=>{ae(!ie),yt(new Set),te(!1),jn()},type:`button`,children:I(ie?`完成`:`选择`)}),(0,j.jsxs)(`div`,{className:`session-tools-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":O,"aria-haspopup":`menu`,"aria-label":I(`会话工具`),className:`session-tool-button icon`,onClick:e=>{jn(),Ct.current=e.currentTarget,ce(void 0),O?(te(!1),re(void 0)):(re(Ml(e.currentTarget,150,190,`below`)),te(!0))},type:`button`,children:`⋯`}),O&&ne&&(0,Le.createPortal)((0,j.jsxs)(`div`,{className:`session-tools-popover`,"data-session-popover":!0,role:`menu`,style:{...Vn,...ne},children:[(0,j.jsx)(`button`,{autoFocus:!0,onClick:()=>window.location.reload(),role:`menuitem`,type:`button`,children:I(`刷新列表`)}),(0,j.jsx)(`button`,{onClick:()=>{te(!1),re(void 0),bt.current?.click()},role:`menuitem`,type:`button`,children:I(`导入会话`)}),(0,j.jsx)(`button`,{disabled:!V||ct,onClick:()=>{V&&On(async()=>{let t=await e.exportSession(V),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${i.session?.sessionId??`session`}.jsonl`,n.click(),URL.revokeObjectURL(n.href)})},role:`menuitem`,type:`button`,children:I(`导出当前会话`)}),(0,j.jsx)(`button`,{onClick:()=>{dt(e=>!e),te(!1),re(void 0),B()},role:`menuitem`,type:`button`,children:I(ut?`隐藏归档会话`:`显示归档会话`)})]}),document.body)]})]})]}),ie&&vt.size>0&&(0,j.jsxs)(`div`,{className:`session-batch-bar`,children:[(0,j.jsx)(`span`,{children:I(`{v0} 个已选择`,{v0:vt.size})}),(0,j.jsx)(`button`,{onClick:()=>void On(()=>e.batchSessions(`archive`,[...vt]).then(()=>void 0)),type:`button`,children:I(`归档`)}),(0,j.jsx)(`button`,{onClick:()=>void On(()=>e.batchSessions(`pin`,[...vt]).then(()=>void 0)),type:`button`,children:I(`置顶`)}),(0,j.jsx)(`button`,{className:`danger`,onClick:()=>{ce(void 0),k(`batch-delete`)},type:`button`,children:I(`删除`)})]}),(0,j.jsxs)(`div`,{className:`sidebar-scroll`,children:[U&&i.session&&(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:I(`当前`)}),(0,j.jsxs)(`div`,{className:`session-row-wrap current-session-row`,children:[ie&&(0,j.jsx)(`input`,{"aria-label":I(`选择当前会话`),checked:V?vt.has(V):!1,onChange:()=>V&&kn(V),type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row active`,onClick:()=>{f(void 0),g(!1),v(!1),u(`session`),c(`chat`),m(void 0),w(!1),B()},type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:i.session.messages.length?i.session.sessionId.slice(0,12):I(`新会话`)}),(0,j.jsx)(`small`,{children:I(`{v0} 条消息`,{v0:i.session.messages.length})})]})]}),!ie&&V&&(0,j.jsx)(`button`,{"aria-expanded":C&&T===V,"aria-haspopup":`menu`,"aria-label":I(`当前会话操作`),className:`session-row-more`,"data-session-popover":!0,onClick:e=>An(V,i.session?.messages.length?i.session?.sessionId.slice(0,12):I(`新会话`),e.currentTarget),type:`button`,children:`⋯`}),!ie&&V&&T===V&&C&&D&&(0,j.jsx)(jl,{busy:ct,position:D,themeStyle:Vn,onArchive:()=>{jn(),k(`archive`)},onDelete:()=>{jn(),k(`delete`)},onFork:()=>void On(async()=>{let t=await e.forkSession(V);t.sessionFile&&(ve(t.sessionFile),await e.openSession(t.sessionFile))}),onRename:()=>{jn(),k(`rename`)}})]})]}),In.length?In.map(([t,n])=>(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:Tl(t)}),n.map((t,n)=>(0,j.jsxs)(`div`,{className:`session-row-wrap`,children:[ie&&(0,j.jsx)(`input`,{"aria-label":I(`选择会话 {name}`,{name:$(t.name??t.firstMessage,I(`未命名会话`))}),checked:typeof t.path==`string`&&vt.has(t.path),onChange:()=>{typeof t.path==`string`&&kn(t.path)},type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row ${t.sessionId===i.session?.sessionId?`active`:``}`,onClick:()=>Dn(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:$(t.name??(typeof t.firstMessage==`string`?iu(t.firstMessage):``),`未命名会话`)}),(0,j.jsx)(`small`,{children:I(`{v0} 条消息{v1} {v2}`,{v0:$(t.messageCount,`0`),v1:t.pinned===!0?I(` · 已置顶`):``,v2:t.archived===!0?I(` · 已归档`):``})})]})]}),!ie&&typeof t.path==`string`&&(0,j.jsx)(`button`,{"aria-expanded":C&&T===t.path,"aria-haspopup":`menu`,"aria-label":I(`会话操作 {name}`,{name:$(t.name??t.firstMessage,I(`未命名会话`))}),className:`session-row-more`,"data-session-popover":!0,onClick:e=>{e.stopPropagation(),An(t.path,$(t.name??t.firstMessage,``),e.currentTarget)},type:`button`,children:`⋯`}),!ie&&typeof t.path==`string`&&T===t.path&&C&&D&&(0,j.jsx)(jl,{busy:ct,position:D,themeStyle:Vn,onArchive:()=>{jn(),k(`archive`)},onDelete:()=>{jn(),k(`delete`)},onFork:()=>void On(async()=>{let n=await e.forkSession(t.path);n.sessionFile&&(ve(n.sessionFile),await e.openSession(n.sessionFile))}),onRename:()=>{jn(),k(`rename`)}})]},n))]},t)):U?null:(0,j.jsx)(`div`,{className:`empty-state`,children:I(`暂无已保存会话`)}),mt>30&&(0,j.jsxs)(`div`,{className:`session-pagination`,children:[(0,j.jsx)(`button`,{disabled:ft===0,onClick:()=>pt(e=>Math.max(0,e-1)),type:`button`,children:I(`上一页`)}),(0,j.jsxs)(`span`,{children:[ft+1,` / `,Math.max(1,Math.ceil(mt/30))]}),(0,j.jsx)(`button`,{disabled:!gt,onClick:()=>pt(e=>e+1),type:`button`,children:I(`下一页`)})]}),zn&&(0,j.jsxs)(`section`,{"aria-label":I(`工作区概览`),className:`mx-3 mt-3 rounded-lg border border-[#dce5f5] bg-[var(--color-blue-soft)] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[var(--color-ink)]`,children:I(`工作区概览`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[9px] ${zn.clean===!0?`bg-[var(--color-green-soft)] text-[var(--color-green)]`:`bg-[var(--color-red-soft)] text-[var(--color-red)]`}`,children:zn.clean===!0?`clean`:I(`{count} 变更`,{count:$(zn.changedCount??0)})})]}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[10px] text-[var(--color-blue)]`,children:$(zn.cwd??I(`当前工作区`))}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[var(--color-muted)]`,children:$(zn.branch??I(`非 Git 工作区`))}),Array.isArray(zn.changedFiles)&&zn.changedFiles.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1 border-t border-[#dce5f5] pt-2`,children:zn.changedFiles.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[9px] text-[var(--color-muted)]`,children:[$(n.status??`??`),` `,$(n.path??I(`未命名`))]},`${$(n.path??`file`)}-${t}`)})}):null]})]}),(0,j.jsxs)(`footer`,{className:`sidebar-footer`,children:[(0,j.jsxs)(`div`,{className:`runtime-cells`,children:[(0,j.jsxs)(`span`,{children:[`model `,(0,j.jsx)(`b`,{children:$(i.status?.model)})]}),(0,j.jsxs)(`span`,{children:[`msgs `,(0,j.jsx)(`b`,{children:i.status?.messages??0})]}),(0,j.jsxs)(`span`,{children:[`status `,(0,j.jsx)(`b`,{children:$(i.status?.status,`connecting`)})]})]}),(0,j.jsx)(`button`,{"aria-label":I(`搜索会话、文件和命令`),className:`sidebar-link compact-session-search`,onClick:()=>{g(!1),te(!1),jn(),v(!0)},title:I(`搜索会话、文件和命令`),type:`button`,children:`⌕`}),(0,j.jsx)(`button`,{"aria-label":I(`新建会话`),className:`sidebar-link compact-new-session`,onClick:mn,title:I(`新建会话`),type:`button`,children:`+`}),(0,j.jsxs)(`button`,{"aria-label":I(`插件,已安装 {count} 个`,{count:cn}),className:`sidebar-link ${l===`plugins`||l===`marketplace`?`active`:``}`,onClick:()=>H(void 0),title:I(`插件 · {count} 个`,{count:cn}),type:`button`,children:[`◈ `,(0,j.jsx)(`span`,{children:I(`插件`)}),(0,j.jsx)(`b`,{children:cn})]}),(0,j.jsxs)(`button`,{"aria-label":I(`设置`),className:`sidebar-link ${d?`active`:``}`,onClick:()=>{g(!1),v(!1),w(!1),E(void 0),m(void 0),f(`general`)},title:I(`设置`),type:`button`,children:[`⚙ `,(0,j.jsx)(`span`,{children:I(`设置`)})]})]})]}),(0,j.jsxs)(`section`,{className:`main-pane`,children:[(0,j.jsxs)(`header`,{className:`main-header ${!d&&l===`session`?`session-track`:``}`,children:[(0,j.jsxs)(`div`,{className:`active-heading`,children:[(0,j.jsx)(`strong`,{children:d?I(`设置`):l===`plugins`||l===`marketplace`?I(P||N?`插件详情`:`插件`):i.session?.messages.length?i.session.sessionId.slice(0,12):I(`新会话`)}),(0,j.jsx)(`small`,{children:d?I(`运行时状态与配置`):l===`plugins`?P?Qe?.name??Sl(P):I(`安装、启用与卸载`):l===`marketplace`?N?Ue?.name??N:I(`官方与社区 · 已审核目录`):al(i.status,i.session)})]}),(0,j.jsx)(`div`,{className:`header-spacer`}),i.status?.status===`running`&&(0,j.jsxs)(`div`,{className:`run-indicator running`,children:[(0,j.jsx)(`span`,{className:`run-dot`}),(0,j.jsx)(`span`,{children:I(`运行中 · Pi agent`)}),(0,j.jsx)(`button`,{className:`stop-button`,onClick:_n,title:I(`停止当前运行(⌃C)`),type:`button`,children:I(`停止`)})]}),!d&&l===`session`&&(0,j.jsx)(`div`,{"aria-label":I(`会话视图`),className:`view-tabs`,children:[`chat`,`trajectory`,`files`].map(e=>(0,j.jsx)(`button`,{"aria-pressed":s===e,className:`view-tab ${s===e?`active`:``}`,onClick:()=>{c(e),m(void 0)},type:`button`,children:I(e===`chat`?`对话`:e===`trajectory`?`轨迹`:`产出`)},e))}),!d&&l===`session`&&(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`header-divider`}),!d&&l===`session`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`session-menu-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":C&&!T,"aria-haspopup":`menu`,className:`session-menu`,onClick:e=>{let t=C&&!T;E(void 0),ee(void 0),Ct.current=e.currentTarget,ce(!t&&V?{name:i.session?.sessionId?.slice(0,12)||I(`当前会话`),path:V}:void 0),w(!t)},type:`button`,"aria-label":I(`会话操作`),children:`⋯`}),C&&!T&&(0,j.jsxs)(`div`,{className:`session-menu-popover compact-session-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>{ue(i.session?.sessionId?.slice(0,12)??``),k(`rename`),w(!1)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`重命名`)}),(0,j.jsx)(`small`,{children:I(`设置一个容易识别的名称`)})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>void On(async()=>{let t=await e.forkSession(V);t.sessionFile&&(ve(t.sessionFile),await e.openSession(t.sessionFile))}),role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`复制会话`)}),(0,j.jsx)(`small`,{children:I(`复制上下文并打开副本`)})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!V||ct,onClick:()=>{w(!1),k(`archive`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`归档会话`)}),(0,j.jsx)(`small`,{children:I(`从默认列表隐藏`)})]}),(0,j.jsxs)(`button`,{className:`session-action danger`,disabled:!V||ct,onClick:()=>{w(!1),k(`delete`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:I(`删除会话`)}),(0,j.jsx)(`small`,{children:I(`永久删除本地记录`)})]})]})]}),(0,j.jsxs)(`button`,{"aria-label":I(p===void 0?`打开详情`:`关闭详情`),"aria-pressed":p!==void 0,className:`details-toggle`,onClick:()=>m(p?void 0:{}),type:`button`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`◨`}),` `,(0,j.jsx)(`span`,{className:`details-toggle-label`,children:I(`详情`)})]})]})]}),Jt.length>0&&(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`refresh-warning`,role:`status`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:I(`部分数据刷新失败:`)}),I(`{v0} 可能为空或显示上次结果。`,{v0:Jt.join(` · `)})]}),(0,j.jsx)(`button`,{onClick:()=>void B(),type:`button`,children:I(`重试`)})]}),(0,j.jsx)(`div`,{className:`view-host`,children:Kt?(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`initial-loading`,role:`status`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`}),I(`正在连接 Pi runtime…`)]}):Fn})]}),!d&&l===`session`&&p!==void 0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":I(`关闭详情`),className:`details-backdrop`,onClick:()=>m(void 0),type:`button`}),(0,j.jsx)(Fl,{event:Object.keys(p).length?p:void 0,onClose:()=>m(void 0),onCopy:()=>void navigator.clipboard?.writeText(JSON.stringify(p,null,2))})]}),_&&(0,j.jsx)(Ql,{commands:i.commands,files:i.files,onClose:()=>v(!1),onOpenFile:e=>{u(`session`),c(`files`),m({type:`file`,path:e.path,status:e.status})},onOpenSession:Dn,onUse:Un,sessions:i.sessions}),de&&(0,j.jsx)(Ol,{error:pe,onClose:()=>fe(!1),onPickDirectory:gn,onSelect:e=>void pn(e),workspaces:i.workspaces}),oe&&(0,j.jsx)(kl,{busy:ct,count:oe===`batch-delete`?vt.size:void 0,kind:oe,name:oe===`rename`||oe===`batch-delete`?void 0:se?.name??$(i.session?.sessionId,I(`当前会话`)),onChange:ue,onClose:()=>{k(void 0),ce(void 0)},onConfirm:()=>{let t=se?.path??V;oe===`rename`&&t?On(()=>e.renameSession(t,le.trim()).then(()=>void 0)):oe===`archive`&&t?On(async()=>{await e.setSessionMetadata(t,{archived:!0})}):oe===`delete`&&t?On(async()=>{await e.deleteSession(t)}):oe===`batch-delete`&&On(()=>e.batchSessions(`delete`,[...vt]).then(()=>void 0))},value:le})]})}var du=class{context;root;version;#e;constructor(e,t={}){this.root=e,this.version=t.version,this.context=new Ae}async run(){await F(P(globalThis.localStorage)??Xe(navigator.languages)),document.documentElement.lang=nt(),this.context.provide(`clientRoot`,this.root),this.context.provide(`clientApi`,ze()),this.#e=(0,s.createRoot)(this.root),this.#e.render((0,o.createElement)(uu,{api:this.context.clientApi,appVersion:this.version}))}async dispose(){this.#e?.unmount(),await this.context.fiber.dispose()}},fu=document.getElementById(`root`);if(!(fu instanceof HTMLElement))throw Error(`Pi Harness web app is missing #root`);new du(fu,{version:`0.1.41`}).run().catch(e=>{fu.textContent=e instanceof Error?e.message:String(e)});
|