@inkeep/open-knowledge 0.20.0-beta.6 → 0.20.0-beta.8
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/cli.mjs +9 -9
- package/dist/constants-guHl6645.mjs +2 -0
- package/dist/{dist-4Ump46HS.mjs → dist-CX2NKvL3.mjs} +3 -3
- package/dist/{dist-DWj46ioV.mjs → dist-n9uYOrGl.mjs} +1 -1
- package/dist/{gh-detect-BDIdc7oG.mjs → gh-detect-D4j_2KZA.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-CTWS3YAh.mjs → init-CMfDQGkl.mjs} +4 -4
- package/dist/init-xPihugg8.mjs +1 -0
- package/dist/loader-C8nqTo1Q.mjs +1 -0
- package/dist/{loader-DfAj3I6y.mjs → loader-C9FLjkmp.mjs} +2 -2
- package/dist/{preview-BqvkYsAn.mjs → preview-D2CQ6yHX.mjs} +2 -2
- package/dist/preview-DVTHD8sU.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Bw1oRtQH.js → ActivityModeContent-DbFWb8AO.js} +1 -1
- package/dist/public/assets/{DocumentContext-o-LUu0wz.js → DocumentContext-B2qgy31k.js} +2 -2
- package/dist/public/assets/{GraphPanel-BVt0SfrM.js → GraphPanel-sDi-_TRH.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-D-xwymUR.js → ManagedArtifactProperties-D40g_fzP.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CeeQNbcR.js → PropertyPanel-Ca0E5GKl.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-wC0Rm8N5.js → SettingsDialogBody-DAgimxsR.js} +2 -2
- package/dist/public/assets/{SkillEditorActions-Y_e1zC_b.js → SkillEditorActions-DKVNhzBj.js} +1 -1
- package/dist/public/assets/{SourceEditor-4ljQqBHw.js → SourceEditor-DxmNPlc5.js} +2 -2
- package/dist/public/assets/{TerminalPanel-C9rmhBG2.js → TerminalPanel-DIRUaDNy.js} +1 -1
- package/dist/public/assets/{config-validation-events-mtT7Nmop.js → config-validation-events-Ct_n4YVx.js} +4 -4
- package/dist/public/assets/dist-BrFh1X3E.js +524 -0
- package/dist/public/assets/{documents-events-DMS5a4By.js → documents-events-keB3Tua2.js} +1 -1
- package/dist/public/assets/index-JZXtAkn1.js +2004 -0
- package/dist/public/assets/{keyboard-shortcuts-DGu1nhPQ.js → keyboard-shortcuts-DWO3dbNP.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-Bvt3X7yV.js → open-managed-artifact-tab-BpWVbrq3.js} +1 -1
- package/dist/public/assets/{prop-types-Cf7ylXsu.js → prop-types-DAdpyyQb.js} +1 -1
- package/dist/public/assets/{selection-context-CFA_dZau.js → selection-context-CvCY4HqN.js} +1 -1
- package/dist/public/assets/{skill-actions-CQ-n4sOB.js → skill-actions-IJVLen8G.js} +1 -1
- package/dist/public/assets/{skills-api-q4V5pwth.js → skills-api-BNk9GDF4.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-CCRb_XMp.js → target-navigation-intent-UQ8it6hJ.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BfS-xBMY.js → typing-burst-detector-DunF9z9v.js} +2 -2
- package/dist/public/index.html +14 -14
- package/dist/{repair-launch-json-CB3RaqvZ.mjs → repair-launch-json-C9KJ4bPN.mjs} +2 -2
- package/dist/{repair-mcp-configs-ChsIYMUP.mjs → repair-mcp-configs-BtoZ6M_S.mjs} +2 -2
- package/dist/{repair-skills-CiDVwcih.mjs → repair-skills-B98v58k0.mjs} +2 -2
- package/dist/repair-skills-BnIHtXhN.mjs +1 -0
- package/dist/server-lock-8Lv6A-Xa-Cwb8QI-d.mjs +1 -0
- package/dist/{server-lock-CN2YHwpP-COM23IWb.mjs → server-lock-CN2YHwpP-BhBKViGp.mjs} +114 -114
- package/dist/{src-65pJ6529.mjs → src-CThY_5pJ.mjs} +2 -2
- package/dist/{start-DP8kaNsQ.mjs → start-Bc4ER1Ku.mjs} +2 -2
- package/dist/start-D8Ns1Flr.mjs +1 -0
- package/dist/{write-project-skill-jB0r_q3O.mjs → write-project-skill-C4u_YHBP.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-GNu6fJQT.mjs +0 -2
- package/dist/init-BbqHeUlA.mjs +0 -1
- package/dist/loader-C7xkHjNn.mjs +0 -1
- package/dist/preview-IS_QJ2xL.mjs +0 -1
- package/dist/public/assets/dist-Dst_hB5H.js +0 -524
- package/dist/public/assets/index-BZo7KSQC.js +0 -2004
- package/dist/repair-skills-BBBQJfX6.mjs +0 -1
- package/dist/server-lock-8Lv6A-Xa-iDqi_bbE.mjs +0 -1
- package/dist/start-DJl3ovqu.mjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Yt as e}from"./dist-
|
|
1
|
+
import{Yt as e}from"./dist-CX2NKvL3.mjs";import"./constants-guHl6645.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-D2CQ6yHX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-D2CQ6yHX.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/public/assets/{ActivityModeContent-Bw1oRtQH.js → ActivityModeContent-DbFWb8AO.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-BXoGtJMu.js","./chunk-CFjPhJqf.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.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{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Dr as a,n as o,pt as s,r as c}from"./DocumentContext-o-LUu0wz.js";import{n as l,r as u}from"./dist-CQw2y-s3.js";import{lt as d,o as f,s as p}from"./dist-Dst_hB5H.js";import{t as m,u as h}from"./button-DGf25ccp.js";import{c as g,i as _,l as v,r as y,t as b}from"./agent-presence-CPRnxEOl.js";import{a as x,c as S,i as C,o as w,s as T,t as E}from"./dialog-Bt8vN5IM.js";import{t as ee}from"./chevron-down-BaPMAfbX.js";import{t as te}from"./chevron-right-jyIhGBkw.js";import{i as D,l as O}from"./prop-types-Cf7ylXsu.js";import{d as k}from"./config-context-DhhN0rlf.js";import{n as A}from"./dist-BLu8fLv5.js";import{o as j,u as M}from"./documents-events-DMS5a4By.js";import{i as ne,n as re,t as ie}from"./tooltip-D-omjYEX.js";var ae=h(`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`}]]),N=i(),P=e(n(),1),oe=500,F=64;async function se(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new s(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=d.safeParse(r);throw e.success?Error(e.data.title):new s(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=f.safeParse(r);if(!i.success)throw new s(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function ce(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 s(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=d.safeParse(a);throw e.success?Error(e.data.title):new s(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=p.safeParse(a);if(!o.success)throw new s(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function le(e){let t=(0,N.c)(23),{systemProvider:n}=o(),[r,i]=(0,P.useState)(null),[a,s]=(0,P.useState)(`idle`),[c,l]=(0,P.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new _(F),t[0]=u):u=t[0];let d=(0,P.useRef)(u),f=(0,P.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;s(`loading`),l(null),se(e).then(r=>{if(f.current!==t)return;let a=de(n,e);i({...r,writingDocs:a}),s(`ready`)}).catch(e=>{f.current===t&&(l(e instanceof Error?e.message:String(e)),s(`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),s(`idle`),l(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=j(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},oe))});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,P.useEffect)(h,g);let v,y;t[8]!==e||t[9]!==n?(v=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=de(n,e);i(e=>!e||ue(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)}},y=[e,n],t[8]=e,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,P.useEffect)(v,y);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await ce(e,t,n);return d.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]!==c||t[19]!==x||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:c,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=c,t[19]=x,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function ue(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function de(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!b(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 I=r(),fe=(0,P.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-BXoGtJMu.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).ActivityPanelDiffView}));function pe(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 me(e){let t=(0,N.c)(42),{burst:n,docName:r,fetchBurstDiff:i}=e,{_:a}=u(),[o,s]=(0,P.useState)(!1),[c,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)(L),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{let e=setInterval(()=>_(Date.now()),3e4);return()=>clearInterval(e)},y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,P.useEffect)(v,y);let b;t[2]!==n.stackIndex||t[3]!==c||t[4]!==r||t[5]!==o||t[6]!==i||t[7]!==m?(b=()=>{let e=!o;s(e),e&&c===null&&!m&&(h(!0),p(null),i(r,n.stackIndex).then(e=>{d(e),h(!1)}).catch(e=>{p(e instanceof Error?e.message:String(e)),h(!1)}))},t[2]=n.stackIndex,t[3]=c,t[4]=r,t[5]=o,t[6]=i,t[7]=m,t[8]=b):b=t[8];let x=b,S=n.stackIndex+1,C;t[9]!==a||t[10]!==S||t[11]!==o?(C=a(o?{id:`-i7ik4`,values:{burstNumber:S}}:{id:`EeRZnZ`,values:{burstNumber:S}}),t[9]=a,t[10]=S,t[11]=o,t[12]=C):C=t[12];let w;t[13]===o?w=t[14]:(w=o?(0,I.jsx)(ee,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,I.jsx)(te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=o,t[14]=w);let T;t[15]!==n.ts||t[16]!==g?(T=pe(n.ts,g),t[15]=n.ts,t[16]=g,t[17]=T):T=t[17];let E;t[18]===T?E=t[19]:(E=(0,I.jsx)(`span`,{className:`font-mono`,children:T}),t[18]=T,t[19]=E);let D;t[20]===n.additions?D=t[21]:(D=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=D);let O;t[22]===n.deletions?O=t[23]:(O=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=O);let k;t[24]!==D||t[25]!==O?(k=(0,I.jsxs)(`span`,{className:`ml-auto font-mono`,children:[D,` `,O]}),t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==k||t[29]!==C||t[30]!==w||t[31]!==E||t[32]!==x?(A=(0,I.jsxs)(`button`,{type:`button`,onClick:x,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":o,"aria-label":C,children:[w,E,k]}),t[27]=o,t[28]=k,t[29]=C,t[30]=w,t[31]=E,t[32]=x,t[33]=A):A=t[33];let j;t[34]!==c||t[35]!==o||t[36]!==f||t[37]!==m?(j=o?(0,I.jsx)(`div`,{className:`bg-muted/20`,children:m?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`38foVZ`})}):f?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,I.jsx)(l,{id:`pmKdif`,values:{loadError:f}})}):c===null?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`iNFKkm`})}):(0,I.jsx)(P.Suspense,{fallback:(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`38foVZ`})}),children:(0,I.jsx)(fe,{diff:c})})}):null,t[34]=c,t[35]=o,t[36]=f,t[37]=m,t[38]=j):j=t[38];let M;return t[39]!==A||t[40]!==j?(M=(0,I.jsxs)(`div`,{className:`border-t border-border/50`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41],M}function L(){return Date.now()}function he(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 R(e){let t=(0,N.c)(118),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:o,onUndoAll:s,fetchBurstDiff:c}=e,{_:d}=u(),{docName:f}=n,[p,h]=(0,P.useState)(!1),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(!1),[D,O]=(0,P.useState)(_e),k,A;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=setInterval(()=>O(Date.now()),3e4);return()=>clearInterval(e)},A=[],t[0]=k,t[1]=A):(k=t[0],A=t[1]),(0,P.useEffect)(k,A),n.bursts.length===0)return null;let j=!r||n.bursts.length===0||y,M=n.bursts.length,oe;t[2]!==d||t[3]!==n.bursts.length||t[4]!==r?(oe=r?n.bursts.length===0?d({id:`2fkdnR`}):null:d({id:`NzFvyK`}),t[2]=d,t[3]=n.bursts.length,t[4]=r,t[5]=oe):oe=t[5];let F=oe,se;t[6]!==j||t[7]!==n.docName||t[8]!==o?(se=e=>{e.stopPropagation(),!j&&(b(!0),Promise.resolve(o(n.docName)).finally(()=>b(!1)))},t[6]=j,t[7]=n.docName,t[8]=o,t[9]=se):se=t[9];let ce=se,le;t[10]===j?le=t[11]:(le=e=>{e.stopPropagation(),!j&&v(!0)},t[10]=j,t[11]=le);let ue=le,de;t[12]!==j||t[13]!==n.docName||t[14]!==s?(de=()=>{v(!1),!j&&(b(!0),Promise.resolve(s(n.docName)).finally(()=>b(!1)))},t[12]=j,t[13]=n.docName,t[14]=s,t[15]=de):de=t[15];let fe=de,pe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>h(ge),t[16]=pe):pe=t[16];let L;t[17]!==d||t[18]!==f||t[19]!==p?(L=d(p?{id:`rVgSRB`,values:{docName:f}}:{id:`tW_yvQ`,values:{docName:f}}),t[17]=d,t[18]=f,t[19]=p,t[20]=L):L=t[20];let R;t[21]===p?R=t[22]:(R=p?(0,I.jsx)(ee,{className:`size-4`,"aria-hidden":`true`}):(0,I.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),t[21]=p,t[22]=R);let z;t[23]!==p||t[24]!==L||t[25]!==R?(z=(0,I.jsx)(`button`,{type:`button`,onClick:pe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":p,"aria-label":L,"data-testid":`activity-panel-file-row-carrot`,children:R}),t[23]=p,t[24]=L,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==n.docName||t[28]!==a?(B=()=>a(n.docName),t[27]=n.docName,t[28]=a,t[29]=B):B=t[29];let V;t[30]!==d||t[31]!==f?(V=d({id:`QcpeeE`,values:{docName:f}}),t[30]=d,t[31]=f,t[32]=V):V=t[32];let H;t[33]!==n.docName||t[34]!==B||t[35]!==V?(H=(0,I.jsx)(`button`,{type:`button`,onClick:B,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":V,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==d||t[38]!==f?(U=d({id:`m4v3XT`,values:{docName:f}}),t[37]=d,t[38]=f,t[39]=U):U=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,I.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=W):W=t[40];let G;t[41]!==j||t[42]!==ce||t[43]!==U?(G=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:j,"aria-label":U,"data-testid":`activity-panel-undo-last`,children:W})}),t[41]=j,t[42]=ce,t[43]=U,t[44]=G):G=t[44];let K;t[45]!==d||t[46]!==F?(K=F??d({id:`ArBWJf`}),t[45]=d,t[46]=F,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,I.jsx)(re,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,I.jsxs)(ie,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==d||t[54]!==f?(Y=d({id:`J2MgzQ`,values:{docName:f}}),t[53]=d,t[54]=f,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,I.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==j||t[58]!==ue||t[59]!==Y?(X=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ue,disabled:j,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=j,t[58]=ue,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==d||t[62]!==F?(Z=F??d({id:`mNY1G6`}),t[61]=d,t[62]=F,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,I.jsx)(re,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,I.jsxs)(ie,{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,I.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,I.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,I.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]!==D?(we=he(n.lastTs,D),t[76]=n.lastTs,t[77]=D,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,I.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===i?Te=t[82]:(Te=i?(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,I.jsx)(l,{id:`6q0rnH`})}):null,t[81]=i,t[82]=Te);let Ee;t[83]!==z||t[84]!==H||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[z,H,J,be,Ce,Q,Te]}),t[83]=z,t[84]=H,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]!==p||t[92]!==c||t[93]!==n.bursts||t[94]!==n.docName?(De=p?(0,I.jsx)(`div`,{children:n.bursts.map(e=>(0,I.jsx)(me,{burst:e,docName:n.docName,fetchBurstDiff:c},`${n.docName}:${e.stackIndex}`))}):null,t[91]=p,t[92]=c,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,I.jsx)(S,{children:(0,I.jsx)(l,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==M||t[98]!==f?(ke={docName:f,burstCount:M},t[97]=M,t[98]=f,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,I.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,I.jsxs)(T,{children:[Oe,(0,I.jsx)(x,{children:(0,I.jsx)(l,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>v(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,I.jsx)(m,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,I.jsx)(l,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,I.jsx)(l,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===fe?Fe=t[107]:(Fe=(0,I.jsxs)(w,{children:[Ne,(0,I.jsx)(m,{type:`button`,variant:`destructive`,onClick:fe,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=fe,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,I.jsxs)(C,{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,I.jsx)(E,{open:_,onOpenChange:v,children:Ie}),t[111]=_,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,I.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 ge(e){return!e}function _e(){return Date.now()}async function z(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 B(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e){typeof window>`u`||(window.location.hash=B(e))}function H(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(k,{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,I.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,I.jsx)(`span`,{className:`text-sm`,children:(0,I.jsx)(l,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function U(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,I.jsx)(a,{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,I.jsx)(`p`,{className:`text-sm font-medium`,children:(0,I.jsx)(l,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,I.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,I.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,I.jsx)(l,{id:`6gRgw8`}),t[4]=c):c=t[4];let u;t[5]===r?u=t[6]:(u=(0,I.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function W(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,I.jsx)(`p`,{className:`text-sm italic`,children:(0,I.jsx)(l,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=u(),a;t[0]===i?a=t[1]:(a=i({id:`kYL1lH`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=r?(0,I.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(l,{id:`kYL1lH`})}),t[5]=s):s=t[5];let c;t[6]===o?c=t[7]:(c=(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[o,s]}),t[6]=o,t[7]=c);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,I.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,I.jsx)(l,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==a||t[10]!==c?(f=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":a,children:[c,d]}),t[9]=a,t[10]=c,t[11]=f):f=t[11],f}function K(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=u(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,I.jsx)(v,{}),t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==i?(o=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:a})}),t[3]=n,t[4]=i,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(re,{side:`bottom`,children:(0,I.jsx)(l,{id:`ogAuyr`})}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,I.jsxs)(ie,{children:[o,s]}),t[7]=o,t[8]=c),c}function q(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.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 a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,I.jsx)(`span`,{className:`font-medium`,children:(0,I.jsx)(l,{id:`LCUy_N`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,I.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,I.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,I.jsx)(l,{id:`GK-IRZ`})}),t[6]=c):c=t[6];let u;return t[7]===s?u=t[8]:(u=(0,I.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:[o,s,c]}),t[7]=s,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,N.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,I.jsx)(y,{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,I.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,N.c)(26),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=u(),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]!==s||t[3]!==p?(v=p?(0,I.jsx)(K,{onClick:s}):null,t[2]=s,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ve,{agent:n.agent}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,I.jsx)(l,{id:`F6pfE9`}):h===null?(0,I.jsx)(l,{id:`PMyJ9C`}):(0,I.jsx)(l,{id:`237hSL`}),n.files.length>0?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(l,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(l,{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,I.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]!==i||t[14]!==o||t[15]!==h||t[16]!==c||t[17]!==f||t[18]!==d||t[19]!==a||t[20]!==r?(x=(0,I.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,I.jsx)(H,{}):r===`error`&&i?(0,I.jsx)(U,{error:i,onRetry:a}):n===null?(0,I.jsx)(W,{}):(0,I.jsxs)(I.Fragment,{children:[!n.sessionAlive&&h!==null?(0,I.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,I.jsx)(W,{}):n.files.map(e=>(0,I.jsx)(R,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:d,onUndoAll:f,fetchBurstDiff:o},e.docName))]})}),t[12]=n,t[13]=i,t[14]=o,t[15]=h,t[16]=c,t[17]=f,t[18]=d,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,I.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,N.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:r}=n,i=r===void 0?!0:r,{_:a}=u(),{docPanelAgentId:s,closeActivityPanel:l}=o(),{openTargetTransition:d}=c(),{pageMeta:f}=D(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=le(s);if(s===null){let e;return t[2]!==l||t[3]!==i?(e=(0,I.jsx)(G,{onExit:l,showBackButton:i}),t[2]=l,t[3]=i,t[4]=e):e=t[4],e}let v;t[5]!==d||t[6]!==f?(v=e=>{d(O({kind:`doc`,target:e,docName:e},f)),V(e)},t[5]=d,t[6]=f,t[7]=v):v=t[7];let y=v,b;t[8]!==a||t[9]!==p||t[10]!==s||t[11]!==g?(b=async e=>{try{await z({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);A.error(a({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=a,t[9]=p,t[10]=s,t[11]=g,t[12]=b):b=t[12];let x=b,S;t[13]!==a||t[14]!==p||t[15]!==s||t[16]!==g?(S=async e=>{try{await z({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),A.success(a({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);A.error(a({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=a,t[14]=p,t[15]=s,t[16]=g,t[17]=S):S=t[17];let C=S,w;return t[18]!==l||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==C||t[24]!==x||t[25]!==g||t[26]!==i||t[27]!==m?(w=(0,I.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:l,onNavigate:y,onUndoLast:x,onUndoAll:C,showBackButton:i}),t[18]=l,t[19]=p,t[20]=h,t[21]=_,t[22]=y,t[23]=C,t[24]=x,t[25]=g,t[26]=i,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{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Or as a,n as o,pt as s,r as c}from"./DocumentContext-B2qgy31k.js";import{n as l,r as u}from"./dist-CQw2y-s3.js";import{lt as d,o as f,s as p}from"./dist-BrFh1X3E.js";import{t as m,u as h}from"./button-DGf25ccp.js";import{c as g,i as _,l as v,r as y,t as b}from"./agent-presence-CPRnxEOl.js";import{a as x,c as S,i as C,o as w,s as T,t as E}from"./dialog-Bt8vN5IM.js";import{t as ee}from"./chevron-down-BaPMAfbX.js";import{t as te}from"./chevron-right-jyIhGBkw.js";import{i as D,l as O}from"./prop-types-DAdpyyQb.js";import{d as k}from"./config-context-DhhN0rlf.js";import{n as A}from"./dist-BLu8fLv5.js";import{o as j,u as M}from"./documents-events-keB3Tua2.js";import{i as ne,n as re,t as ie}from"./tooltip-D-omjYEX.js";var ae=h(`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`}]]),N=i(),P=e(n(),1),oe=500,F=64;async function se(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new s(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=d.safeParse(r);throw e.success?Error(e.data.title):new s(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=f.safeParse(r);if(!i.success)throw new s(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function ce(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 s(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=d.safeParse(a);throw e.success?Error(e.data.title):new s(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=p.safeParse(a);if(!o.success)throw new s(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function le(e){let t=(0,N.c)(23),{systemProvider:n}=o(),[r,i]=(0,P.useState)(null),[a,s]=(0,P.useState)(`idle`),[c,l]=(0,P.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new _(F),t[0]=u):u=t[0];let d=(0,P.useRef)(u),f=(0,P.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;s(`loading`),l(null),se(e).then(r=>{if(f.current!==t)return;let a=de(n,e);i({...r,writingDocs:a}),s(`ready`)}).catch(e=>{f.current===t&&(l(e instanceof Error?e.message:String(e)),s(`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),s(`idle`),l(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=j(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},oe))});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,P.useEffect)(h,g);let v,y;t[8]!==e||t[9]!==n?(v=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=de(n,e);i(e=>!e||ue(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)}},y=[e,n],t[8]=e,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,P.useEffect)(v,y);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await ce(e,t,n);return d.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]!==c||t[19]!==x||t[20]!==C||t[21]!==a?(w={data:r,status:a,error:c,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=c,t[19]=x,t[20]=C,t[21]=a,t[22]=w):w=t[22],w}function ue(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function de(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!b(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 I=r(),fe=(0,P.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-BXoGtJMu.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).ActivityPanelDiffView}));function pe(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 me(e){let t=(0,N.c)(42),{burst:n,docName:r,fetchBurstDiff:i}=e,{_:a}=u(),[o,s]=(0,P.useState)(!1),[c,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)(L),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{let e=setInterval(()=>_(Date.now()),3e4);return()=>clearInterval(e)},y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,P.useEffect)(v,y);let b;t[2]!==n.stackIndex||t[3]!==c||t[4]!==r||t[5]!==o||t[6]!==i||t[7]!==m?(b=()=>{let e=!o;s(e),e&&c===null&&!m&&(h(!0),p(null),i(r,n.stackIndex).then(e=>{d(e),h(!1)}).catch(e=>{p(e instanceof Error?e.message:String(e)),h(!1)}))},t[2]=n.stackIndex,t[3]=c,t[4]=r,t[5]=o,t[6]=i,t[7]=m,t[8]=b):b=t[8];let x=b,S=n.stackIndex+1,C;t[9]!==a||t[10]!==S||t[11]!==o?(C=a(o?{id:`-i7ik4`,values:{burstNumber:S}}:{id:`EeRZnZ`,values:{burstNumber:S}}),t[9]=a,t[10]=S,t[11]=o,t[12]=C):C=t[12];let w;t[13]===o?w=t[14]:(w=o?(0,I.jsx)(ee,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,I.jsx)(te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=o,t[14]=w);let T;t[15]!==n.ts||t[16]!==g?(T=pe(n.ts,g),t[15]=n.ts,t[16]=g,t[17]=T):T=t[17];let E;t[18]===T?E=t[19]:(E=(0,I.jsx)(`span`,{className:`font-mono`,children:T}),t[18]=T,t[19]=E);let D;t[20]===n.additions?D=t[21]:(D=(0,I.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=D);let O;t[22]===n.deletions?O=t[23]:(O=(0,I.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=O);let k;t[24]!==D||t[25]!==O?(k=(0,I.jsxs)(`span`,{className:`ml-auto font-mono`,children:[D,` `,O]}),t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==k||t[29]!==C||t[30]!==w||t[31]!==E||t[32]!==x?(A=(0,I.jsxs)(`button`,{type:`button`,onClick:x,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":o,"aria-label":C,children:[w,E,k]}),t[27]=o,t[28]=k,t[29]=C,t[30]=w,t[31]=E,t[32]=x,t[33]=A):A=t[33];let j;t[34]!==c||t[35]!==o||t[36]!==f||t[37]!==m?(j=o?(0,I.jsx)(`div`,{className:`bg-muted/20`,children:m?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`38foVZ`})}):f?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,I.jsx)(l,{id:`pmKdif`,values:{loadError:f}})}):c===null?(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`iNFKkm`})}):(0,I.jsx)(P.Suspense,{fallback:(0,I.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,I.jsx)(l,{id:`38foVZ`})}),children:(0,I.jsx)(fe,{diff:c})})}):null,t[34]=c,t[35]=o,t[36]=f,t[37]=m,t[38]=j):j=t[38];let M;return t[39]!==A||t[40]!==j?(M=(0,I.jsxs)(`div`,{className:`border-t border-border/50`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41],M}function L(){return Date.now()}function he(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 R(e){let t=(0,N.c)(118),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:o,onUndoAll:s,fetchBurstDiff:c}=e,{_:d}=u(),{docName:f}=n,[p,h]=(0,P.useState)(!1),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(!1),[D,O]=(0,P.useState)(_e),k,A;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=setInterval(()=>O(Date.now()),3e4);return()=>clearInterval(e)},A=[],t[0]=k,t[1]=A):(k=t[0],A=t[1]),(0,P.useEffect)(k,A),n.bursts.length===0)return null;let j=!r||n.bursts.length===0||y,M=n.bursts.length,oe;t[2]!==d||t[3]!==n.bursts.length||t[4]!==r?(oe=r?n.bursts.length===0?d({id:`2fkdnR`}):null:d({id:`NzFvyK`}),t[2]=d,t[3]=n.bursts.length,t[4]=r,t[5]=oe):oe=t[5];let F=oe,se;t[6]!==j||t[7]!==n.docName||t[8]!==o?(se=e=>{e.stopPropagation(),!j&&(b(!0),Promise.resolve(o(n.docName)).finally(()=>b(!1)))},t[6]=j,t[7]=n.docName,t[8]=o,t[9]=se):se=t[9];let ce=se,le;t[10]===j?le=t[11]:(le=e=>{e.stopPropagation(),!j&&v(!0)},t[10]=j,t[11]=le);let ue=le,de;t[12]!==j||t[13]!==n.docName||t[14]!==s?(de=()=>{v(!1),!j&&(b(!0),Promise.resolve(s(n.docName)).finally(()=>b(!1)))},t[12]=j,t[13]=n.docName,t[14]=s,t[15]=de):de=t[15];let fe=de,pe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>h(ge),t[16]=pe):pe=t[16];let L;t[17]!==d||t[18]!==f||t[19]!==p?(L=d(p?{id:`rVgSRB`,values:{docName:f}}:{id:`tW_yvQ`,values:{docName:f}}),t[17]=d,t[18]=f,t[19]=p,t[20]=L):L=t[20];let R;t[21]===p?R=t[22]:(R=p?(0,I.jsx)(ee,{className:`size-4`,"aria-hidden":`true`}):(0,I.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),t[21]=p,t[22]=R);let z;t[23]!==p||t[24]!==L||t[25]!==R?(z=(0,I.jsx)(`button`,{type:`button`,onClick:pe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":p,"aria-label":L,"data-testid":`activity-panel-file-row-carrot`,children:R}),t[23]=p,t[24]=L,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==n.docName||t[28]!==a?(B=()=>a(n.docName),t[27]=n.docName,t[28]=a,t[29]=B):B=t[29];let V;t[30]!==d||t[31]!==f?(V=d({id:`QcpeeE`,values:{docName:f}}),t[30]=d,t[31]=f,t[32]=V):V=t[32];let H;t[33]!==n.docName||t[34]!==B||t[35]!==V?(H=(0,I.jsx)(`button`,{type:`button`,onClick:B,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":V,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==d||t[38]!==f?(U=d({id:`m4v3XT`,values:{docName:f}}),t[37]=d,t[38]=f,t[39]=U):U=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,I.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=W):W=t[40];let G;t[41]!==j||t[42]!==ce||t[43]!==U?(G=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:j,"aria-label":U,"data-testid":`activity-panel-undo-last`,children:W})}),t[41]=j,t[42]=ce,t[43]=U,t[44]=G):G=t[44];let K;t[45]!==d||t[46]!==F?(K=F??d({id:`ArBWJf`}),t[45]=d,t[46]=F,t[47]=K):K=t[47];let q;t[48]===K?q=t[49]:(q=(0,I.jsx)(re,{side:`bottom`,children:K}),t[48]=K,t[49]=q);let J;t[50]!==G||t[51]!==q?(J=(0,I.jsxs)(ie,{children:[G,q]}),t[50]=G,t[51]=q,t[52]=J):J=t[52];let Y;t[53]!==d||t[54]!==f?(Y=d({id:`J2MgzQ`,values:{docName:f}}),t[53]=d,t[54]=f,t[55]=Y):Y=t[55];let ve;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,I.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ve):ve=t[56];let X;t[57]!==j||t[58]!==ue||t[59]!==Y?(X=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ue,disabled:j,"aria-label":Y,"data-testid":`activity-panel-undo-all`,children:ve})}),t[57]=j,t[58]=ue,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==d||t[62]!==F?(Z=F??d({id:`mNY1G6`}),t[61]=d,t[62]=F,t[63]=Z):Z=t[63];let ye;t[64]===Z?ye=t[65]:(ye=(0,I.jsx)(re,{side:`bottom`,children:Z}),t[64]=Z,t[65]=ye);let be;t[66]!==X||t[67]!==ye?(be=(0,I.jsxs)(ie,{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,I.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,I.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,I.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]!==D?(we=he(n.lastTs,D),t[76]=n.lastTs,t[77]=D,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,I.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===i?Te=t[82]:(Te=i?(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,I.jsx)(l,{id:`6q0rnH`})}):null,t[81]=i,t[82]=Te);let Ee;t[83]!==z||t[84]!==H||t[85]!==J||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[z,H,J,be,Ce,Q,Te]}),t[83]=z,t[84]=H,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]!==p||t[92]!==c||t[93]!==n.bursts||t[94]!==n.docName?(De=p?(0,I.jsx)(`div`,{children:n.bursts.map(e=>(0,I.jsx)(me,{burst:e,docName:n.docName,fetchBurstDiff:c},`${n.docName}:${e.stackIndex}`))}):null,t[91]=p,t[92]=c,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,I.jsx)(S,{children:(0,I.jsx)(l,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==M||t[98]!==f?(ke={docName:f,burstCount:M},t[97]=M,t[98]=f,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,I.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,I.jsxs)(T,{children:[Oe,(0,I.jsx)(x,{children:(0,I.jsx)(l,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>v(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,I.jsx)(m,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,I.jsx)(l,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,I.jsx)(l,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===fe?Fe=t[107]:(Fe=(0,I.jsxs)(w,{children:[Ne,(0,I.jsx)(m,{type:`button`,variant:`destructive`,onClick:fe,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=fe,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,I.jsxs)(C,{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,I.jsx)(E,{open:_,onOpenChange:v,children:Ie}),t[111]=_,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,I.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 ge(e){return!e}function _e(){return Date.now()}async function z(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 B(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e){typeof window>`u`||(window.location.hash=B(e))}function H(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(k,{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,I.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,I.jsx)(`span`,{className:`text-sm`,children:(0,I.jsx)(l,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function U(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,I.jsx)(a,{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,I.jsx)(`p`,{className:`text-sm font-medium`,children:(0,I.jsx)(l,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,I.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,I.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,I.jsx)(l,{id:`6gRgw8`}),t[4]=c):c=t[4];let u;t[5]===r?u=t[6]:(u=(0,I.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:c}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function W(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,I.jsx)(`p`,{className:`text-sm italic`,children:(0,I.jsx)(l,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function G(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=u(),a;t[0]===i?a=t[1]:(a=i({id:`kYL1lH`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=r?(0,I.jsx)(K,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(l,{id:`kYL1lH`})}),t[5]=s):s=t[5];let c;t[6]===o?c=t[7]:(c=(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[o,s]}),t[6]=o,t[7]=c);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,I.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,I.jsx)(l,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==a||t[10]!==c?(f=(0,I.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":a,children:[c,d]}),t[9]=a,t[10]=c,t[11]=f):f=t[11],f}function K(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=u(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,I.jsx)(v,{}),t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==i?(o=(0,I.jsx)(ne,{asChild:!0,children:(0,I.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:a})}),t[3]=n,t[4]=i,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(re,{side:`bottom`,children:(0,I.jsx)(l,{id:`ogAuyr`})}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,I.jsxs)(ie,{children:[o,s]}),t[7]=o,t[8]=c),c}function q(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.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 a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,I.jsx)(`span`,{className:`font-medium`,children:(0,I.jsx)(l,{id:`LCUy_N`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,I.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,I.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,I.jsx)(l,{id:`GK-IRZ`})}),t[6]=c):c=t[6];let u;return t[7]===s?u=t[8]:(u=(0,I.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:[o,s,c]}),t[7]=s,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,N.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,I.jsx)(y,{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,I.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,N.c)(26),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=u(),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]!==s||t[3]!==p?(v=p?(0,I.jsx)(K,{onClick:s}):null,t[2]=s,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ve,{agent:n.agent}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,I.jsx)(l,{id:`F6pfE9`}):h===null?(0,I.jsx)(l,{id:`PMyJ9C`}):(0,I.jsx)(l,{id:`237hSL`}),n.files.length>0?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(l,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,I.jsx)(l,{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,I.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]!==i||t[14]!==o||t[15]!==h||t[16]!==c||t[17]!==f||t[18]!==d||t[19]!==a||t[20]!==r?(x=(0,I.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,I.jsx)(H,{}):r===`error`&&i?(0,I.jsx)(U,{error:i,onRetry:a}):n===null?(0,I.jsx)(W,{}):(0,I.jsxs)(I.Fragment,{children:[!n.sessionAlive&&h!==null?(0,I.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,I.jsx)(W,{}):n.files.map(e=>(0,I.jsx)(R,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:d,onUndoAll:f,fetchBurstDiff:o},e.docName))]})}),t[12]=n,t[13]=i,t[14]=o,t[15]=h,t[16]=c,t[17]=f,t[18]=d,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,I.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,N.c)(29),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:r}=n,i=r===void 0?!0:r,{_:a}=u(),{docPanelAgentId:s,closeActivityPanel:l}=o(),{openTargetTransition:d}=c(),{pageMeta:f}=D(),{data:p,status:m,error:h,reload:g,fetchBurstDiff:_}=le(s);if(s===null){let e;return t[2]!==l||t[3]!==i?(e=(0,I.jsx)(G,{onExit:l,showBackButton:i}),t[2]=l,t[3]=i,t[4]=e):e=t[4],e}let v;t[5]!==d||t[6]!==f?(v=e=>{d(O({kind:`doc`,target:e,docName:e},f)),V(e)},t[5]=d,t[6]=f,t[7]=v):v=t[7];let y=v,b;t[8]!==a||t[9]!==p||t[10]!==s||t[11]!==g?(b=async e=>{try{await z({connectionId:s,docName:e,scope:`last`,agentName:p?.agent?.displayName}),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);A.error(a({id:`EqrC_R`,values:{message:n}})),g()}},t[8]=a,t[9]=p,t[10]=s,t[11]=g,t[12]=b):b=t[12];let x=b,S;t[13]!==a||t[14]!==p||t[15]!==s||t[16]!==g?(S=async e=>{try{await z({connectionId:s,docName:e,scope:`file`,agentName:p?.agent?.displayName}),A.success(a({id:`pRc-Im`,values:{docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);A.error(a({id:`7KeV5F`,values:{message:n}})),g()}},t[13]=a,t[14]=p,t[15]=s,t[16]=g,t[17]=S):S=t[17];let C=S,w;return t[18]!==l||t[19]!==p||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==C||t[24]!==x||t[25]!==g||t[26]!==i||t[27]!==m?(w=(0,I.jsx)(X,{data:p,status:m,error:h,reload:g,fetchBurstDiff:_,onExit:l,onNavigate:y,onUndoLast:x,onUndoAll:C,showBackButton:i}),t[18]=l,t[19]=p,t[20]=h,t[21]=_,t[22]=y,t[23]=C,t[24]=x,t[25]=g,t[26]=i,t[27]=m,t[28]=w):w=t[28],w}export{Z as ActivityModeContent};
|