@inkeep/open-knowledge 0.16.0-beta.3 → 0.16.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/{banner-BxCFCyu8.mjs → banner-DBiyrzNA.mjs} +2 -2
- package/dist/cli.mjs +54 -52
- package/dist/colors-BktTaA1t.mjs +1 -0
- package/dist/{colors-8SzMRIVy.mjs → colors-CBY1ibtz.mjs} +1 -1
- package/dist/constants-DpFTxgLd.mjs +2 -0
- package/dist/dist-BM2Pz5lP.mjs +1 -0
- package/dist/{dist-wZSZMIoi.mjs → dist-BpcqX30a.mjs} +10 -10
- package/dist/{gh-detect-atRB6-LM.mjs → gh-detect-B9lBhz5O.mjs} +2 -2
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +1 -1
- package/dist/init-BprAJf9V.mjs +1 -0
- package/dist/init-Cd8LxZ6v.mjs +305 -0
- package/dist/{is-object-Cie0xXKD.mjs → is-object-Cg453afR.mjs} +1 -1
- package/dist/loader-BKOnziDn.mjs +1 -0
- package/dist/{loader-CeZuzoj9.mjs → loader-CP2zxNwo.mjs} +3 -3
- package/dist/{preview-0zWEGOpg.mjs → preview-7XNCI_uT.mjs} +2 -2
- package/dist/preview-CktZpuwe.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Bvn7Dxuo.js → ActivityModeContent-CSyKy_Uj.js} +1 -1
- package/dist/public/assets/{DocumentContext-BK44vUOF.js → DocumentContext-Db8zz1C8.js} +16 -16
- package/dist/public/assets/{GraphPanel-Bk3Uhgmb.js → GraphPanel-B3ncVCcl.js} +3 -3
- package/dist/public/assets/{OpenInAgentMenuRequestContext-Dn-T6fee.js → OpenInAgentMenuRequestContext-DTXpMpI9.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-B_f7ik71.js → SettingsDialogBody-DuNjQ0k0.js} +2 -2
- package/dist/public/assets/{SourceEditor-B0xjus9Q.js → SourceEditor-BtpDdgxb.js} +1 -1
- package/dist/public/assets/config-validation-events-CJxHy5ln.js +12 -0
- package/dist/public/assets/{index-Cb45dDN8.js → index-BqbmV5y6.js} +108 -125
- package/dist/public/assets/{prop-types-CqTEMXrE.js → prop-types-BovHZ4kt.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DkDGdaxv.js → target-navigation-intent-ck2sTXFV.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/{repair-launch-json-D2xWr0yE.mjs → repair-launch-json-B-dpVcye.mjs} +2 -2
- package/dist/repair-mcp-configs-D80wng8R.mjs +2 -0
- package/dist/repair-skills-BeneyVMe.mjs +1 -0
- package/dist/repair-skills-Dz7t_0qc.mjs +3 -0
- package/dist/{server-lock-BpjJj3OD-Cia38KR1.mjs → server-lock-BpjJj3OD-BTq99pJy.mjs} +24 -24
- package/dist/server-lock-CyhBidkz-DfwkCIUm.mjs +1 -0
- package/dist/{src-DPU6_Fcs.mjs → src-8qa_xxK5.mjs} +4 -4
- package/dist/start-C2uF4y8f.mjs +1 -0
- package/dist/{start-DbXSdBjV.mjs → start-DBSNaSRx.mjs} +2 -2
- package/dist/write-project-skill-BgQMKWNq.mjs +12 -0
- package/package.json +1 -1
- package/dist/colors-CkPULM8m.mjs +0 -1
- package/dist/constants-CRYjinaK.mjs +0 -2
- package/dist/dist-LI_R8UvH.mjs +0 -1
- package/dist/init-6ubtN129.mjs +0 -1
- package/dist/init-cCb4BV-1.mjs +0 -315
- package/dist/loader-D_kZv5X6.mjs +0 -1
- package/dist/preview-Dvm4NRoB.mjs +0 -1
- package/dist/public/assets/config-validation-events-BFEw_0e9.js +0 -12
- package/dist/repair-mcp-configs-ovMudNql.mjs +0 -2
- package/dist/repair-skills-DN4CoxxN.mjs +0 -1
- package/dist/repair-skills-DzMAdfno.mjs +0 -3
- package/dist/server-lock-CyhBidkz-tjTa2PuV.mjs +0 -1
- package/dist/start-DqRZ-r6P.mjs +0 -1
- package/dist/write-project-skill-DcTlTtX0.mjs +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Gt as e}from"./dist-
|
|
1
|
+
import{Gt as e}from"./dist-BpcqX30a.mjs";import"./constants-DpFTxgLd.mjs";import{existsSync as t,lstatSync as n,readdirSync as r,realpathSync as i,statSync as a}from"node:fs";import{join as o,relative as s}from"node:path";function c(t){let{projectDir:c,contentDir:l,sampleCap:u=5}=t,d=[],f=[];try{n(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let t;try{t=r(e,{withFileTypes:!0})}catch(t){let n=t instanceof Error?t.message:String(t);d.push(`could not read directory ${s(l,e)||`.`}: ${n}`);return}for(let n of t){let t=o(e,n.name);if(n.isSymbolicLink()){let e;try{e=i(t)}catch(e){let n=e.code;n===`ENOENT`||n===`ELOOP`?d.push(`broken or cyclic symlink: ${s(l,t)}`):d.push(`cannot resolve symlink ${s(l,t)}: ${n??`unknown error`}`);continue}let n;try{n=a(e)}catch{continue}if(n.isDirectory()){let e=s(l,t);if(p.isDirExcluded(e))continue;m(t)}else if(n.isFile()){let e=s(l,t);if(p.isExcluded(e))continue;f.push(e)}}else if(n.isDirectory()){let e=s(l,t);if(p.isDirExcluded(e))continue;m(t)}else if(n.isFile()){let e=s(l,t);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,n){let r=[],i=s(n,e.contentDir),a=i===``?`./`:`./${i}`;if(r.push(`Content:`),r.push(` Found ${e.totalCount} markdown files in ${a}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;r.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)r.push(` Warning: ${t}`);return r.push(``),t(o(n,`.ok`,`config.yml`))?(r.push(` To adjust scope, add patterns to .okignore at the project root.`),r.push(` To change the content root, edit .ok/config.yml → content.dir.`)):r.push(" Run `open-knowledge init` to scaffold config + .okignore."),r.push(``),r.push(` Re-check anytime: open-knowledge preview`),r.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-7XNCI_uT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-7XNCI_uT.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/public/assets/{ActivityModeContent-Bvn7Dxuo.js → ActivityModeContent-CSyKy_Uj.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-InYkbArk.js","./chunk-CFjPhJqf.js","./compiler-runtime-Cs91PcD2.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{Bn as s,at as c,dr as l,lr as u,n as d,r as f}from"./DocumentContext-BK44vUOF.js";import{at as p,o as m,s as h}from"./dist-CkyAinZx.js";import{t as g,u as _}from"./button-CNAPefQE.js";import{f as v,i as y,m as b,r as x,t as S}from"./agent-presence-CarzuseD.js";import{a as C,c as w,i as T,o as E,s as D,t as O}from"./dialog-CtMCOb1V.js";import{o as ee}from"./collapsible-CiYR1NR5.js";import{R as k,_ as A,i as j,l as M}from"./prop-types-CqTEMXrE.js";import{n as N}from"./dist-rFfpDyC7.js";import{i as te,n as ne,t as re}from"./tooltip-Bp4cM4E8.js";var ie=_(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),P=o(),F=e(n(),1),ae=500,I=64;async function oe(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new c(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=p.safeParse(r);throw e.success?Error(e.data.title):new c(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=m.safeParse(r);if(!i.success)throw new c(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function se(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new c(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=p.safeParse(a);throw e.success?Error(e.data.title):new c(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=h.safeParse(a);if(!o.success)throw new c(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ce(e){let t=(0,P.c)(23),{systemProvider:n}=d(),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(`idle`),[s,c]=(0,F.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new y(I),t[0]=l):l=t[0];let u=(0,F.useRef)(l),f=(0,F.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),oe(e).then(r=>{if(f.current!==t)return;let a=ue(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),u.current.clear();return}u.current.clear(),m(e);let t=null,n=A(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},ae))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,F.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ue(n,e);i(e=>!e||le(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,F.useEffect)(_,v);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=u.current.get(r);if(i!==void 0)return i;let a=await se(e,t,n);return u.current.set(r,a),a},t[12]=e,t[13]=b);let x=b,S;t[14]!==e||t[15]!==m?(S=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=S):S=t[16];let C=S,w;return t[17]!==r||t[18]!==s||t[19]!==x||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:s,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=s,t[19]=x,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!S(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var L=i(),de=(0,F.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function fe(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return k._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return k._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function pe(e){let t=(0,P.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(R),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,F.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==d||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;u(e),e&&d===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{f(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=d,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,L.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,L.jsx)(ee,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=fe(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,L.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,L.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,L.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,L.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,L.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==d||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,L.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`38foVZ`})}):p?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,L.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):d===null?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`iNFKkm`})}):(0,L.jsx)(F.Suspense,{fallback:(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`38foVZ`})}),children:(0,L.jsx)(de,{diff:d})})}):null,t[34]=d,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let N;return t[39]!==j||t[40]!==M?(N=(0,L.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=N):N=t[41],N}function R(){return Date.now()}function me(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return k._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return k._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return k._({id:`nYeBmY`,values:{hours:r}})}function z(e){let t=(0,P.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:u,fetchBurstDiff:d}=e,{_:f}=r(),{docName:p}=n,[m,h]=(0,F.useState)(!1),[_,y]=(0,F.useState)(!1),[b,x]=(0,F.useState)(!1),[S,k]=(0,F.useState)(ge),A,j;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=setInterval(()=>k(Date.now()),3e4);return()=>clearInterval(e)},j=[],t[0]=A,t[1]=j):(A=t[0],j=t[1]),(0,F.useEffect)(A,j),n.bursts.length===0)return null;let M=!i||n.bursts.length===0||b,N=n.bursts.length,ae;t[2]!==f||t[3]!==n.bursts.length||t[4]!==i?(ae=i?n.bursts.length===0?f({id:`2fkdnR`}):null:f({id:`NzFvyK`}),t[2]=f,t[3]=n.bursts.length,t[4]=i,t[5]=ae):ae=t[5];let I=ae,oe;t[6]!==M||t[7]!==n.docName||t[8]!==c?(oe=e=>{e.stopPropagation(),!M&&(x(!0),Promise.resolve(c(n.docName)).finally(()=>x(!1)))},t[6]=M,t[7]=n.docName,t[8]=c,t[9]=oe):oe=t[9];let se=oe,ce;t[10]===M?ce=t[11]:(ce=e=>{e.stopPropagation(),!M&&y(!0)},t[10]=M,t[11]=ce);let le=ce,ue;t[12]!==M||t[13]!==n.docName||t[14]!==u?(ue=()=>{y(!1),!M&&(x(!0),Promise.resolve(u(n.docName)).finally(()=>x(!1)))},t[12]=M,t[13]=n.docName,t[14]=u,t[15]=ue):ue=t[15];let de=ue,fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>h(he),t[16]=fe):fe=t[16];let R;t[17]!==f||t[18]!==p||t[19]!==m?(R=f(m?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=f,t[18]=p,t[19]=m,t[20]=R):R=t[20];let z;t[21]===m?z=t[22]:(z=m?(0,L.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,L.jsx)(ee,{className:`size-4`,"aria-hidden":`true`}),t[21]=m,t[22]=z);let B;t[23]!==m||t[24]!==R||t[25]!==z?(B=(0,L.jsx)(`button`,{type:`button`,onClick:fe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":m,"aria-label":R,"data-testid":`activity-panel-file-row-carrot`,children:z}),t[23]=m,t[24]=R,t[25]=z,t[26]=B):B=t[26];let V;t[27]!==n.docName||t[28]!==s?(V=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=V):V=t[29];let H;t[30]!==f||t[31]!==p?(H=f({id:`QcpeeE`,values:{docName:p}}),t[30]=f,t[31]=p,t[32]=H):H=t[32];let U;t[33]!==n.docName||t[34]!==V||t[35]!==H?(U=(0,L.jsx)(`button`,{type:`button`,onClick:V,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":H,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=V,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==f||t[38]!==p?(W=f({id:`m4v3XT`,values:{docName:p}}),t[37]=f,t[38]=p,t[39]=W):W=t[39];let _e;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,L.jsx)(v,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=_e):_e=t[40];let G;t[41]!==M||t[42]!==se||t[43]!==W?(G=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:se,disabled:M,"aria-label":W,"data-testid":`activity-panel-undo-last`,children:_e})}),t[41]=M,t[42]=se,t[43]=W,t[44]=G):G=t[44];let K;t[45]!==f||t[46]!==I?(K=I??f({id:`ArBWJf`}),t[45]=f,t[46]=I,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,L.jsx)(ne,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,L.jsxs)(re,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==f||t[54]!==p?(Y=f({id:`J2MgzQ`,values:{docName:p}}),t[53]=f,t[54]=p,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==M||t[58]!==le||t[59]!==Y?(X=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:le,disabled:M,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=M,t[58]=le,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==f||t[62]!==I?(Z=I??f({id:`mNY1G6`}),t[61]=f,t[62]=I,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,L.jsx)(ne,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,L.jsxs)(re,{children:[X,ye]}),t[66]=X,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,L.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,L.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,L.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==S?(we=me(n.lastTs,S),t[76]=n.lastTs,t[77]=S,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,L.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,L.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==B||t[84]!==U||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[B,U,J,be,Ce,Q,Te]}),t[83]=B,t[84]=U,t[85]=J,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==m||t[92]!==d||t[93]!==n.bursts||t[94]!==n.docName?(De=m?(0,L.jsx)(`div`,{children:n.bursts.map(e=>(0,L.jsx)(pe,{burst:e,docName:n.docName,fetchBurstDiff:d},`${n.docName}:${e.stackIndex}`))}):null,t[91]=m,t[92]=d,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,L.jsx)(w,{children:(0,L.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==N||t[98]!==p?(ke={docName:p,burstCount:N},t[97]=N,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,L.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,L.jsxs)(D,{children:[Oe,(0,L.jsx)(C,{children:(0,L.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>y(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,L.jsx)(g,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,L.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,L.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===de?Fe=t[107]:(Fe=(0,L.jsxs)(E,{children:[Ne,(0,L.jsx)(g,{type:`button`,variant:`destructive`,onClick:de,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=de,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,L.jsxs)(T,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==_||t[112]!==Ie?($=(0,L.jsx)(O,{open:_,onOpenChange:y,children:Ie}),t[111]=_,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,L.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function he(e){return!e}function ge(){return Date.now()}async function B(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function V(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function H(e){typeof window>`u`||(window.location.hash=V(e))}function U(){let e=(0,P.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,L.jsx)(`span`,{className:`text-sm`,children:(0,L.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function W(e){let t=(0,P.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(u,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:(0,L.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsx)(a,{id:`6gRgw8`}),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,L.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=l);let d;return t[7]!==s||t[8]!==l?(d=(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[7]=s,t[8]=l,t[9]=d):d=t[9],d}function _e(){let e=(0,P.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,L.jsx)(`p`,{className:`text-sm italic`,children:(0,L.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,P.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,L.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,L.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,L.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,L.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,L.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function K(e){let t=(0,P.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(b,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(ne,{side:`bottom`,children:(0,L.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,L.jsxs)(re,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,P.c)(9),{lastTs:n}=e,[r]=(0,F.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(`span`,{className:`font-medium`,children:(0,L.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,L.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,L.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,L.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return k._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return k._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return k._({id:`nYeBmY`,values:{hours:n}})}function ve(e){let t=(0,P.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,L.jsx)(x,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,L.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,P.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,L.jsx)(K,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ve,{agent:n.agent}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,L.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,L.jsx)(a,{id:`F6pfE9`}):h===null?(0,L.jsx)(a,{id:`PMyJ9C`}):(0,L.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,L.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,L.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,L.jsx)(U,{}):i===`error`&&o?(0,L.jsx)(W,{error:o,onRetry:s}):n===null?(0,L.jsx)(_e,{}):(0,L.jsxs)(L.Fragment,{children:[!n.sessionAlive&&h!==null?(0,L.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,L.jsx)(_e,{}):n.files.map(e=>(0,L.jsx)(z,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,L.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function Z(e){let t=(0,P.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=d(),{openTargetTransition:l}=f(),{pageMeta:u}=j(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=ce(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,L.jsx)(G,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let v;t[5]!==l||t[6]!==u?(v=e=>{l(M({kind:`doc`,target:e,docName:e},u)),H(e)},t[5]=l,t[6]=u,t[7]=v):v=t[7];let y=v,b;t[8]!==o||t[9]!==p||t[10]!==s||t[11]!==g?(b=async e=>{try{await B({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=o,t[9]=p,t[10]=s,t[11]=g,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==p||t[15]!==s||t[16]!==g?(S=async e=>{try{await B({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),N.success(o({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=o,t[14]=p,t[15]=s,t[16]=g,t[17]=S):S=t[17];let C=S,w;return t[18]!==c||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==C||t[24]!==x||t[25]!==g||t[26]!==a||t[27]!==m?(w=(0,L.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:c,onNavigate:y,onUndoLast:x,onUndoAll:C,showBackButton:a}),t[18]=c,t[19]=p,t[20]=h,t[21]=_,t[22]=y,t[23]=C,t[24]=x,t[25]=g,t[26]=a,t[27]=m,t[28]=w):w=t[28],w}export{Z as ActivityModeContent};
|
|
2
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{Bn as s,at as c,dr as l,lr as u,n as d,r as f}from"./DocumentContext-Db8zz1C8.js";import{at as p,o as m,s as h}from"./dist-CkyAinZx.js";import{t as g,u as _}from"./button-CNAPefQE.js";import{f as v,i as y,m as b,r as x,t as S}from"./agent-presence-CarzuseD.js";import{a as C,c as w,i as T,o as E,s as D,t as O}from"./dialog-CtMCOb1V.js";import{o as ee}from"./collapsible-CiYR1NR5.js";import{_ as k,i as A,l as j,z as M}from"./prop-types-BovHZ4kt.js";import{n as N}from"./dist-rFfpDyC7.js";import{i as te,n as ne,t as re}from"./tooltip-Bp4cM4E8.js";var ie=_(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),P=o(),F=e(n(),1),ae=500,I=64;async function oe(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new c(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=p.safeParse(r);throw e.success?Error(e.data.title):new c(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=m.safeParse(r);if(!i.success)throw new c(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function se(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new c(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=p.safeParse(a);throw e.success?Error(e.data.title):new c(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=h.safeParse(a);if(!o.success)throw new c(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ce(e){let t=(0,P.c)(23),{systemProvider:n}=d(),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(`idle`),[s,c]=(0,F.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new y(I),t[0]=l):l=t[0];let u=(0,F.useRef)(l),f=(0,F.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),oe(e).then(r=>{if(f.current!==t)return;let a=ue(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),u.current.clear();return}u.current.clear(),m(e);let t=null,n=k(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},ae))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,F.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ue(n,e);i(e=>!e||le(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,F.useEffect)(_,v);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=u.current.get(r);if(i!==void 0)return i;let a=await se(e,t,n);return u.current.set(r,a),a},t[12]=e,t[13]=b);let x=b,S;t[14]!==e||t[15]!==m?(S=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=S):S=t[16];let C=S,w;return t[17]!==r||t[18]!==s||t[19]!==x||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:s,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=s,t[19]=x,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!S(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var L=i(),de=(0,F.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function fe(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return M._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return M._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function pe(e){let t=(0,P.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(R),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,F.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==d||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;u(e),e&&d===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{f(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=d,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,L.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,L.jsx)(ee,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=fe(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,L.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,L.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,L.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,L.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,L.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==d||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,L.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`38foVZ`})}):p?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,L.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):d===null?(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`iNFKkm`})}):(0,L.jsx)(F.Suspense,{fallback:(0,L.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,L.jsx)(a,{id:`38foVZ`})}),children:(0,L.jsx)(de,{diff:d})})}):null,t[34]=d,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let N;return t[39]!==j||t[40]!==M?(N=(0,L.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=N):N=t[41],N}function R(){return Date.now()}function me(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return M._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return M._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return M._({id:`nYeBmY`,values:{hours:r}})}function z(e){let t=(0,P.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:u,fetchBurstDiff:d}=e,{_:f}=r(),{docName:p}=n,[m,h]=(0,F.useState)(!1),[_,y]=(0,F.useState)(!1),[b,x]=(0,F.useState)(!1),[S,k]=(0,F.useState)(ge),A,j;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=setInterval(()=>k(Date.now()),3e4);return()=>clearInterval(e)},j=[],t[0]=A,t[1]=j):(A=t[0],j=t[1]),(0,F.useEffect)(A,j),n.bursts.length===0)return null;let M=!i||n.bursts.length===0||b,N=n.bursts.length,ae;t[2]!==f||t[3]!==n.bursts.length||t[4]!==i?(ae=i?n.bursts.length===0?f({id:`2fkdnR`}):null:f({id:`NzFvyK`}),t[2]=f,t[3]=n.bursts.length,t[4]=i,t[5]=ae):ae=t[5];let I=ae,oe;t[6]!==M||t[7]!==n.docName||t[8]!==c?(oe=e=>{e.stopPropagation(),!M&&(x(!0),Promise.resolve(c(n.docName)).finally(()=>x(!1)))},t[6]=M,t[7]=n.docName,t[8]=c,t[9]=oe):oe=t[9];let se=oe,ce;t[10]===M?ce=t[11]:(ce=e=>{e.stopPropagation(),!M&&y(!0)},t[10]=M,t[11]=ce);let le=ce,ue;t[12]!==M||t[13]!==n.docName||t[14]!==u?(ue=()=>{y(!1),!M&&(x(!0),Promise.resolve(u(n.docName)).finally(()=>x(!1)))},t[12]=M,t[13]=n.docName,t[14]=u,t[15]=ue):ue=t[15];let de=ue,fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>h(he),t[16]=fe):fe=t[16];let R;t[17]!==f||t[18]!==p||t[19]!==m?(R=f(m?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=f,t[18]=p,t[19]=m,t[20]=R):R=t[20];let z;t[21]===m?z=t[22]:(z=m?(0,L.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,L.jsx)(ee,{className:`size-4`,"aria-hidden":`true`}),t[21]=m,t[22]=z);let B;t[23]!==m||t[24]!==R||t[25]!==z?(B=(0,L.jsx)(`button`,{type:`button`,onClick:fe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":m,"aria-label":R,"data-testid":`activity-panel-file-row-carrot`,children:z}),t[23]=m,t[24]=R,t[25]=z,t[26]=B):B=t[26];let V;t[27]!==n.docName||t[28]!==s?(V=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=V):V=t[29];let H;t[30]!==f||t[31]!==p?(H=f({id:`QcpeeE`,values:{docName:p}}),t[30]=f,t[31]=p,t[32]=H):H=t[32];let U;t[33]!==n.docName||t[34]!==V||t[35]!==H?(U=(0,L.jsx)(`button`,{type:`button`,onClick:V,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":H,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=V,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==f||t[38]!==p?(W=f({id:`m4v3XT`,values:{docName:p}}),t[37]=f,t[38]=p,t[39]=W):W=t[39];let _e;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,L.jsx)(v,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=_e):_e=t[40];let G;t[41]!==M||t[42]!==se||t[43]!==W?(G=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:se,disabled:M,"aria-label":W,"data-testid":`activity-panel-undo-last`,children:_e})}),t[41]=M,t[42]=se,t[43]=W,t[44]=G):G=t[44];let K;t[45]!==f||t[46]!==I?(K=I??f({id:`ArBWJf`}),t[45]=f,t[46]=I,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,L.jsx)(ne,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,L.jsxs)(re,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==f||t[54]!==p?(Y=f({id:`J2MgzQ`,values:{docName:p}}),t[53]=f,t[54]=p,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==M||t[58]!==le||t[59]!==Y?(X=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:le,disabled:M,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=M,t[58]=le,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==f||t[62]!==I?(Z=I??f({id:`mNY1G6`}),t[61]=f,t[62]=I,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,L.jsx)(ne,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,L.jsxs)(re,{children:[X,ye]}),t[66]=X,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,L.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,L.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,L.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==S?(we=me(n.lastTs,S),t[76]=n.lastTs,t[77]=S,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,L.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,L.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==B||t[84]!==U||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[B,U,J,be,Ce,Q,Te]}),t[83]=B,t[84]=U,t[85]=J,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==m||t[92]!==d||t[93]!==n.bursts||t[94]!==n.docName?(De=m?(0,L.jsx)(`div`,{children:n.bursts.map(e=>(0,L.jsx)(pe,{burst:e,docName:n.docName,fetchBurstDiff:d},`${n.docName}:${e.stackIndex}`))}):null,t[91]=m,t[92]=d,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,L.jsx)(w,{children:(0,L.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==N||t[98]!==p?(ke={docName:p,burstCount:N},t[97]=N,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,L.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,L.jsxs)(D,{children:[Oe,(0,L.jsx)(C,{children:(0,L.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>y(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,L.jsx)(g,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,L.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,L.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===de?Fe=t[107]:(Fe=(0,L.jsxs)(E,{children:[Ne,(0,L.jsx)(g,{type:`button`,variant:`destructive`,onClick:de,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=de,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,L.jsxs)(T,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==_||t[112]!==Ie?($=(0,L.jsx)(O,{open:_,onOpenChange:y,children:Ie}),t[111]=_,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,L.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function he(e){return!e}function ge(){return Date.now()}async function B(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function V(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function H(e){typeof window>`u`||(window.location.hash=V(e))}function U(){let e=(0,P.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,L.jsx)(`span`,{className:`text-sm`,children:(0,L.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function W(e){let t=(0,P.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(u,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:(0,L.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsx)(a,{id:`6gRgw8`}),t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,L.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=l);let d;return t[7]!==s||t[8]!==l?(d=(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[7]=s,t[8]=l,t[9]=d):d=t[9],d}function _e(){let e=(0,P.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,L.jsx)(`p`,{className:`text-sm italic`,children:(0,L.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,P.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,L.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,L.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,L.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,L.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,L.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function K(e){let t=(0,P.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(b,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,L.jsx)(te,{asChild:!0,children:(0,L.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(ne,{side:`bottom`,children:(0,L.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,L.jsxs)(re,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,P.c)(9),{lastTs:n}=e,[r]=(0,F.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(`span`,{className:`font-medium`,children:(0,L.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,L.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,L.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,L.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return M._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return M._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return M._({id:`nYeBmY`,values:{hours:n}})}function ve(e){let t=(0,P.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,L.jsx)(x,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,L.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,P.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,L.jsx)(K,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ve,{agent:n.agent}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,L.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,L.jsx)(a,{id:`F6pfE9`}):h===null?(0,L.jsx)(a,{id:`PMyJ9C`}):(0,L.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,L.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,L.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,L.jsx)(U,{}):i===`error`&&o?(0,L.jsx)(W,{error:o,onRetry:s}):n===null?(0,L.jsx)(_e,{}):(0,L.jsxs)(L.Fragment,{children:[!n.sessionAlive&&h!==null?(0,L.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,L.jsx)(_e,{}):n.files.map(e=>(0,L.jsx)(z,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,L.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function Z(e){let t=(0,P.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=d(),{openTargetTransition:l}=f(),{pageMeta:u}=A(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=ce(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,L.jsx)(G,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let v;t[5]!==l||t[6]!==u?(v=e=>{l(j({kind:`doc`,target:e,docName:e},u)),H(e)},t[5]=l,t[6]=u,t[7]=v):v=t[7];let y=v,b;t[8]!==o||t[9]!==p||t[10]!==s||t[11]!==g?(b=async e=>{try{await B({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=o,t[9]=p,t[10]=s,t[11]=g,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==p||t[15]!==s||t[16]!==g?(S=async e=>{try{await B({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),N.success(o({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=o,t[14]=p,t[15]=s,t[16]=g,t[17]=S):S=t[17];let C=S,w;return t[18]!==c||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==C||t[24]!==x||t[25]!==g||t[26]!==a||t[27]!==m?(w=(0,L.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:c,onNavigate:y,onUndoLast:x,onUndoAll:C,showBackButton:a}),t[18]=c,t[19]=p,t[20]=h,t[21]=_,t[22]=y,t[23]=C,t[24]=x,t[25]=g,t[26]=a,t[27]=m,t[28]=w):w=t[28],w}export{Z as ActivityModeContent};
|