claude-code-session-manager 0.133.0 → 0.134.0

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.
Files changed (93) hide show
  1. package/dist/assets/AgentLibrary-C9KFGJQq.js +2 -0
  2. package/dist/assets/{AppSettings-BHKM_AKh.js → AppSettings-CvVQ6ot5.js} +2 -2
  3. package/dist/assets/{Button-CmO1wmPw.js → Button-BHvploNk.js} +1 -1
  4. package/dist/assets/DocumentEditorPane-DaX4xag_.js +1 -0
  5. package/dist/assets/{Extensions-Boo21B3b.js → Extensions-DbRY-KEz.js} +2 -2
  6. package/dist/assets/{History-C4epd1hp.js → History-BE_mjM24.js} +2 -2
  7. package/dist/assets/{Library-CrgzRQzL.js → Library-I37dQ6pB.js} +1 -1
  8. package/dist/assets/{ListDetail-DA7y1DQ-.js → ListDetail-DJYMWYQd.js} +1 -1
  9. package/dist/assets/{Panel-D-WMBhKH.js → Panel-DP8eSKSs.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-CuUADpIu.js → ProjectClaudeConfig-Cw8lc3Qi.js} +5 -5
  11. package/dist/assets/{ProvenanceBadge-B7AsoRk6.js → ProvenanceBadge-DUwhsmdA.js} +1 -1
  12. package/dist/assets/Scheduler-B9D2gZqs.js +16 -0
  13. package/dist/assets/Settings-DSk7bn-1.js +2 -0
  14. package/dist/assets/{SkillReferenceGraph-DX4ZgvlY.js → SkillReferenceGraph-DtJcJJHR.js} +1 -1
  15. package/dist/assets/{Skills-DqKI37yi.js → Skills-BPZnSjsB.js} +10 -10
  16. package/dist/assets/{SourceChip-C974LROr.js → SourceChip-DUxulNOp.js} +1 -1
  17. package/dist/assets/{SystemPrompt-C502jIwO.js → SystemPrompt-BXAugVle.js} +1 -1
  18. package/dist/assets/{TiptapBody-DwNXN6Ki.js → TiptapBody-CDC1vrOo.js} +28 -28
  19. package/dist/assets/{Toggle-C2OsxnPK.js → Toggle-CrgM7OTR.js} +1 -1
  20. package/dist/assets/{ViewTabs-DBxKGbAK.js → ViewTabs-DLwaU9RB.js} +1 -1
  21. package/dist/assets/{VoiceButton-C680wpmX.js → VoiceButton-C4hIBxIP.js} +1 -1
  22. package/dist/assets/geist-sans-latin-300-normal-C3kkMBb6.woff2 +0 -0
  23. package/dist/assets/geist-sans-latin-400-normal-gapTbOY8.woff2 +0 -0
  24. package/dist/assets/geist-sans-latin-500-normal-uokXdC-Q.woff2 +0 -0
  25. package/dist/assets/geist-sans-latin-600-normal-DFOURf8L.woff2 +0 -0
  26. package/dist/assets/geist-sans-latin-700-normal-BmN9tIp5.woff2 +0 -0
  27. package/dist/assets/{historyTotals-Cz-VYPEc.js → historyTotals-itA00dXm.js} +1 -1
  28. package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  29. package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  30. package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  31. package/dist/assets/{index-CMwAikUb.css → index-Cjt8B7H9.css} +1 -1
  32. package/dist/assets/index-Cznhnxhq.js +3116 -0
  33. package/dist/assets/newsreader-latin-400-italic-CEihAR-f.woff2 +0 -0
  34. package/dist/assets/newsreader-latin-400-normal-BFBkh4jY.woff2 +0 -0
  35. package/dist/assets/newsreader-latin-500-normal-B66TYsaK.woff2 +0 -0
  36. package/dist/assets/newsreader-latin-600-normal-30OJ_TG_.woff2 +0 -0
  37. package/dist/assets/newsreader-latin-700-normal-rIgV_oaK.woff2 +0 -0
  38. package/dist/index.html +2 -5
  39. package/dist-web/app.css +1 -1
  40. package/dist-web/app.js +413 -408
  41. package/dist-web/index.html +0 -3
  42. package/package.json +4 -2
  43. package/scripts/README.md +1 -0
  44. package/scripts/scheduler-mcp-server.cjs +31 -0
  45. package/src/main/agentLibrary.cjs +27 -4
  46. package/src/main/build-info.json +4 -4
  47. package/src/main/chatRunner.cjs +9 -0
  48. package/src/main/config.cjs +22 -0
  49. package/src/main/crashDiagnostics.cjs +10 -2
  50. package/src/main/index.cjs +34 -25
  51. package/src/main/ipcSchemas.cjs +6 -0
  52. package/src/main/lib/agent-cli/agentCliEvents.cjs +8 -0
  53. package/src/main/lib/demo-video-kit/capture.cjs +4 -37
  54. package/src/main/lib/demo-video-kit/character.cjs +20 -2
  55. package/src/main/lib/demo-video-kit/checks.cjs +82 -1
  56. package/src/main/lib/demo-video-kit/frames.cjs +3 -28
  57. package/src/main/lib/demo-video-kit/playwrightLoader.cjs +67 -0
  58. package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
  59. package/src/main/lib/demo-video-kit/sound.cjs +5 -2
  60. package/src/main/lib/epic/epicMint.cjs +1 -3
  61. package/src/main/lib/epic/promptSessionsCreateEpic.cjs +37 -4
  62. package/src/main/lib/epic/restorableSessions.cjs +88 -0
  63. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +56 -1
  64. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +21 -3
  65. package/src/main/lib/feedback-remote/remoteAssets.cjs +25 -1
  66. package/src/main/lib/mcpToolCatalog.cjs +15 -0
  67. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +10 -1
  68. package/src/main/lib/persona-macro/builtinMacros.cjs +3 -2
  69. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  70. package/src/main/lib/prd/listPrdsSingleFlight.cjs +79 -0
  71. package/src/main/lib/prd/prdAgentType.cjs +17 -7
  72. package/src/main/lib/telemetry/crashTelemetry.cjs +10 -5
  73. package/src/main/lib/telemetry/telemetryBoot.cjs +77 -4
  74. package/src/main/lib/telemetry/telemetryClient.cjs +54 -9
  75. package/src/main/lib/telemetry/telemetryConsent.cjs +3 -0
  76. package/src/main/lib/telemetry/telemetryCounters.cjs +7 -2
  77. package/src/main/lib/telemetry/telemetrySettings.cjs +5 -0
  78. package/src/main/pty.cjs +2 -2
  79. package/src/main/scheduler/prdParser.cjs +1 -1
  80. package/src/main/scheduler.cjs +19 -3
  81. package/src/main/seedAgentPersonas.cjs +24 -0
  82. package/src/main/seedStatus.cjs +5 -2
  83. package/src/main/telemetryIpc.cjs +1 -5
  84. package/src/preload/api.d.ts +29 -14
  85. package/src/preload/apiSurface.json +7 -0
  86. package/src/preload/index.cjs +3 -1
  87. package/src/seed/agents/demo-video-builder.md +7 -2
  88. package/dist/assets/AgentLibrary-DOAG-mcG.js +0 -2
  89. package/dist/assets/DocumentEditorPane-8QMNrNRt.js +0 -1
  90. package/dist/assets/Scheduler-C86gRh51.js +0 -16
  91. package/dist/assets/Settings-B4Q9DwVS.js +0 -2
  92. package/dist/assets/index-Dh5geJe3.js +0 -3111
  93. package/src/main/lib/telemetry/telemetryBacklog.cjs +0 -607
@@ -1,13 +1,13 @@
1
- import{aN as o,b4 as E,ax as e,a6 as W,aj as Lt,aR as Dt,ai as Tt,L as Rt,be as Je,b5 as et,l as ve,bj as It,C as _t,H as Ot,b8 as J}from"./index-Dh5geJe3.js";import{V as Se}from"./ViewTabs-DBxKGbAK.js";import{S as de}from"./SourceChip-C974LROr.js";import{S as tt,M as Pt}from"./Library-CrgzRQzL.js";import{D as Ft}from"./DocumentEditorPane-8QMNrNRt.js";import{V as Bt}from"./VoiceButton-C680wpmX.js";import{Settings as Wt}from"./Settings-B4Q9DwVS.js";import{a as Kt,S as Ut}from"./Skills-DqKI37yi.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-CmO1wmPw.js";import"./Panel-D-WMBhKH.js";import"./claude-settings-schema-COigsajx.js";import"./ListDetail-DA7y1DQ-.js";import"./ProvenanceBadge-B7AsoRk6.js";import"./Toggle-C2OsxnPK.js";function st(s){return!s||!s.trim()?"default":s.replace(/[^a-zA-Z0-9]/g,"-")}const Oe=["bg-accent","bg-sage-dark","bg-honey","bg-fg-dim","bg-fg-faint","bg-hive-teal","bg-butter","bg-delta-bad"],nt=864e5,Vt="MEMORY.md",Pe=2e3,$e=s=>s.replace(/\.md$/,"");function Ht(s,t,n,l){var b,j,h;const m=new Map(((t==null?void 0:t.entries)??[]).map(a=>[a.name,a])),r=new Set(((b=t==null?void 0:t.index)==null?void 0:b.orphans)??[]),p=new Map;for(const a of(n==null?void 0:n.clusters)??[])for(const d of a.memberSlugs)p.has(d)||p.set(d,a.id);const f=s.filter(a=>a.name!==Vt),c=new Map;for(const a of f){const d=$e(a.name),u=((j=m.get(a.name))==null?void 0:j.outLinks)??((h=m.get(d))==null?void 0:h.outLinks)??[];for(const N of u){const C=$e(N),v=c.get(C)??[];v.includes(d)||v.push(d),c.set(C,v)}}return f.map(a=>{const d=$e(a.name),u=m.get(a.name)??m.get(d),N=(u==null?void 0:u.deadRefs)??[],C=(u==null?void 0:u.danglingLinks)??[],v=(u==null?void 0:u.stale)??!1;return{name:a.name,slug:d,path:a.path,description:(u==null?void 0:u.description)??"",bytes:a.bytes,mtimeMs:a.mtimeMs,ageDays:Math.floor((l-a.mtimeMs)/nt),stale:v,staleReasons:(u==null?void 0:u.reasons)??[],ageOnlyStale:v&&N.length===0,deadRefs:N,broken:N.length>0||C.length>0,danglingLinks:C,outLinks:(u==null?void 0:u.outLinks)??[],inLinks:c.get(d)??[],notIndexed:r.has(a.name)||r.has(d),clusterId:p.get(d)??null,type:(u==null?void 0:u.type)??null,originSessionId:(u==null?void 0:u.originSessionId)??null}})}function zt(s,t){const n=new Set(t.filter(l=>l.stale).map(l=>l.slug));return((s==null?void 0:s.clusters)??[]).map((l,m)=>({id:l.id,name:l.name,summary:l.summary,memberSlugs:l.memberSlugs,linkCount:l.links.length,retireCount:l.links.filter(r=>/retire/i.test(r.label??"")).length,staleCount:l.memberSlugs.filter(r=>n.has(r)).length,dotClass:Oe[m%Oe.length]}))}function at(s,t,n){const l=t.trim().toLowerCase(),m=l?s.filter(r=>r.slug.toLowerCase().includes(l)||r.description.toLowerCase().includes(l)):s;return n===void 0?m:m.slice(0,n)}function xe(s,t,n){let l;return t==="ask"||t==="clusters"||t==="archived"?[]:(t==="all"?l=s:t==="stale"?l=s.filter(m=>m.stale):t==="broken"?l=s.filter(m=>m.broken):t==="recent"?l=s.filter(m=>Date.now()-m.mtimeMs<=7*nt):t==="unindexed"?l=s.filter(m=>m.notIndexed):t==="cluster:unclustered"?l=s.filter(m=>m.clusterId===null):t.startsWith("cluster:")?l=s.filter(m=>m.clusterId===t.slice(8)):l=s,at(l,n))}function rt(s,t){const n=[...s];return t==="recent"?n.sort((l,m)=>m.mtimeMs-l.mtimeMs):t==="name"?n.sort((l,m)=>l.slug<m.slug?-1:l.slug>m.slug?1:0):n.sort((l,m)=>m.bytes-l.bytes),n}function Gt(s){return{all:s.length,stale:xe(s,"stale","").length,broken:xe(s,"broken","").length,recent:xe(s,"recent","").length,unindexed:xe(s,"unindexed","").length}}function ot(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"untitled_memory"}function Yt(s,t){const n=s===""?[]:s.split(`
1
+ import{aO as o,b7 as E,ay as e,a7 as W,ak as Lt,aS as Dt,aj as Tt,L as Rt,bh as Je,b8 as et,m as ve,bm as It,C as Ot,H as _t,bb as J}from"./index-Cznhnxhq.js";import{V as Se}from"./ViewTabs-DLwaU9RB.js";import{S as de}from"./SourceChip-DUxulNOp.js";import{S as tt,M as Pt}from"./Library-I37dQ6pB.js";import{D as Ft}from"./DocumentEditorPane-DaX4xag_.js";import{V as Bt}from"./VoiceButton-C4hIBxIP.js";import{Settings as Wt}from"./Settings-DSk7bn-1.js";import{a as Kt,S as Ut}from"./Skills-BPZnSjsB.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BHvploNk.js";import"./Panel-DP8eSKSs.js";import"./claude-settings-schema-COigsajx.js";import"./ListDetail-DJYMWYQd.js";import"./ProvenanceBadge-DUwhsmdA.js";import"./Toggle-CrgM7OTR.js";function st(s){return!s||!s.trim()?"default":s.replace(/[^a-zA-Z0-9]/g,"-")}const _e=["bg-accent","bg-sage-dark","bg-honey","bg-fg-dim","bg-fg-faint","bg-hive-teal","bg-butter","bg-delta-bad"],nt=864e5,Vt="MEMORY.md",Pe=2e3,$e=s=>s.replace(/\.md$/,"");function Ht(s,t,n,l){var b,j,h;const m=new Map(((t==null?void 0:t.entries)??[]).map(a=>[a.name,a])),r=new Set(((b=t==null?void 0:t.index)==null?void 0:b.orphans)??[]),p=new Map;for(const a of(n==null?void 0:n.clusters)??[])for(const d of a.memberSlugs)p.has(d)||p.set(d,a.id);const f=s.filter(a=>a.name!==Vt),c=new Map;for(const a of f){const d=$e(a.name),u=((j=m.get(a.name))==null?void 0:j.outLinks)??((h=m.get(d))==null?void 0:h.outLinks)??[];for(const N of u){const C=$e(N),v=c.get(C)??[];v.includes(d)||v.push(d),c.set(C,v)}}return f.map(a=>{const d=$e(a.name),u=m.get(a.name)??m.get(d),N=(u==null?void 0:u.deadRefs)??[],C=(u==null?void 0:u.danglingLinks)??[],v=(u==null?void 0:u.stale)??!1;return{name:a.name,slug:d,path:a.path,description:(u==null?void 0:u.description)??"",bytes:a.bytes,mtimeMs:a.mtimeMs,ageDays:Math.floor((l-a.mtimeMs)/nt),stale:v,staleReasons:(u==null?void 0:u.reasons)??[],ageOnlyStale:v&&N.length===0,deadRefs:N,broken:N.length>0||C.length>0,danglingLinks:C,outLinks:(u==null?void 0:u.outLinks)??[],inLinks:c.get(d)??[],notIndexed:r.has(a.name)||r.has(d),clusterId:p.get(d)??null,type:(u==null?void 0:u.type)??null,originSessionId:(u==null?void 0:u.originSessionId)??null}})}function zt(s,t){const n=new Set(t.filter(l=>l.stale).map(l=>l.slug));return((s==null?void 0:s.clusters)??[]).map((l,m)=>({id:l.id,name:l.name,summary:l.summary,memberSlugs:l.memberSlugs,linkCount:l.links.length,retireCount:l.links.filter(r=>/retire/i.test(r.label??"")).length,staleCount:l.memberSlugs.filter(r=>n.has(r)).length,dotClass:_e[m%_e.length]}))}function at(s,t,n){const l=t.trim().toLowerCase(),m=l?s.filter(r=>r.slug.toLowerCase().includes(l)||r.description.toLowerCase().includes(l)):s;return n===void 0?m:m.slice(0,n)}function xe(s,t,n){let l;return t==="ask"||t==="clusters"||t==="archived"?[]:(t==="all"?l=s:t==="stale"?l=s.filter(m=>m.stale):t==="broken"?l=s.filter(m=>m.broken):t==="recent"?l=s.filter(m=>Date.now()-m.mtimeMs<=7*nt):t==="unindexed"?l=s.filter(m=>m.notIndexed):t==="cluster:unclustered"?l=s.filter(m=>m.clusterId===null):t.startsWith("cluster:")?l=s.filter(m=>m.clusterId===t.slice(8)):l=s,at(l,n))}function rt(s,t){const n=[...s];return t==="recent"?n.sort((l,m)=>m.mtimeMs-l.mtimeMs):t==="name"?n.sort((l,m)=>l.slug<m.slug?-1:l.slug>m.slug?1:0):n.sort((l,m)=>m.bytes-l.bytes),n}function Gt(s){return{all:s.length,stale:xe(s,"stale","").length,broken:xe(s,"broken","").length,recent:xe(s,"recent","").length,unindexed:xe(s,"unindexed","").length}}function ot(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"untitled_memory"}function Yt(s,t){const n=s===""?[]:s.split(`
2
2
  `),l=t===""?[]:t.split(`
3
3
  `);if(n.length>Pe||l.length>Pe)return[...n.map(j=>({sign:"−",text:j})),...l.map(j=>({sign:"+",text:j}))];const m=n.length,r=l.length,p=Array.from({length:m+1},()=>new Array(r+1).fill(0));for(let j=m-1;j>=0;j--)for(let h=r-1;h>=0;h--)p[j][h]=n[j]===l[h]?p[j+1][h+1]+1:Math.max(p[j+1][h],p[j][h+1]);const f=[];let c=0,b=0;for(;c<m&&b<r;)n[c]===l[b]?(c++,b++):p[c+1][b]>=p[c][b+1]?f.push({sign:"−",text:n[c++]}):f.push({sign:"+",text:l[b++]});for(;c<m;)f.push({sign:"−",text:n[c++]});for(;b<r;)f.push({sign:"+",text:l[b++]});return f}const P=s=>s instanceof Error?s.message:String(s);function Fe(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return t?{front:t[0],body:s.slice(t[0].length)}:{front:"",body:s}}function qt(s){return s.split(`
4
- `).map(t=>t.trim()).find(t=>t.length>0)??""}function Xt(s,t){const n=s.kind==="agent"?s.agent:null,l=n?`${n.name}|${n.memoryScope??""}`:"",m=n!==null&&n.memoryScope===null,r=o.useMemo(()=>m?null:n&&n.memoryScope?{agent:{name:n.name,scope:n.memoryScope},...t?{cwd:t}:{}}:{workspace:st(t),...t?{cwd:t}:{}},[l,m,t]),p=n===null,[f,c]=o.useState(!0),[b,j]=o.useState([]),[h,a]=o.useState(null),[d,u]=o.useState(null),[N,C]=o.useState(!1),[v,S]=o.useState(""),[R,K]=o.useState(!0),[te,ue]=o.useState([]),[q,A]=o.useState([]),[U,L]=o.useState({}),[pe,ke]=o.useState(()=>Date.now()),X=o.useRef(r);X.current=r;const I=o.useCallback(async()=>{if(!r){j([]),a(null),u(null),ue([]),S(""),c(!1);return}try{const g=await window.api.memory.list(r);if(X.current!==r)return;j(g.entries??[]),S(g.dir??""),K(g.autoMemoryEnabled!==!1),g.error&&E.error(`Memory list failed: ${g.error}`);const[x,k]=await Promise.all([window.api.memory.stale(r).catch(w=>(E.error(`Memory staleness check failed: ${P(w)}`),null)),window.api.memory.listArchived(r).catch(()=>({names:[],error:null}))]);if(X.current!==r)return;a(x),ue(k.names??[]),ke(Date.now())}catch(g){E.error(`Memory list failed: ${P(g)}`)}finally{c(!1)}},[r]);o.useEffect(()=>{c(!0),u(null),I(),r&&p&&r.workspace&&window.api.memory.aggregate(r.workspace,!1,t??void 0).then(g=>{X.current===r&&u(g)}).catch(g=>E.error(`Memory clusters failed: ${P(g)}`))},[I]),o.useEffect(()=>{let g=!1;return(async()=>{try{const{agents:x}=await window.api.memory.agents(t??void 0);if(g)return;A(x);const k={};await Promise.all(x.filter(w=>w.memoryScope).map(async w=>{const G=await window.api.memory.list({agent:{name:w.name,scope:w.memoryScope},...t?{cwd:t}:{}});k[w.name]=(G.entries??[]).filter(O=>O.name!=="MEMORY.md").length})),g||L(k)}catch(x){g||E.error(`Memory agents failed: ${P(x)}`)}})(),()=>{g=!0}},[t]),o.useEffect(()=>{if(!v)return;const g=v;window.api.config.watch([g]);const x=window.api.config.onChanged(({path:k})=>{(k===g||k.startsWith(g+"/"))&&I()});return()=>{x(),window.api.config.unwatch([g])}},[v,I]);const _=o.useMemo(()=>Ht(b,h,d,pe),[b,h,d,pe]),se=o.useMemo(()=>zt(d,_),[d,_]),Ne=o.useMemo(()=>({generatedAt:(d==null?void 0:d.generatedAt)??null,running:N}),[d,N]),D=o.useCallback(async g=>{if(!r)return null;try{const x=await window.api.memory.read(g,r);return x.error?(E.error(`Memory read failed: ${x.error}`),null):x.content}catch(x){return E.error(`Memory read failed: ${P(x)}`),null}},[r]),M=o.useCallback(async(g,x)=>{try{const k=await x();return k.ok?(await I(),!0):(E.error(`${g} failed: ${k.error??"unknown error"}`),!1)}catch(k){return E.error(`${g} failed: ${P(k)}`),!1}},[I]),Q=o.useCallback(async(g,x)=>{if(!r)return!1;const k=await D(g);if(k===null)return!1;const{front:w}=Fe(k);return M("Memory save",()=>window.api.memory.write(g,w+x,r))},[r,D,M]),V=o.useCallback(async(g,x)=>{if(!r)return null;const k=ot(g),w=qt(x);if(!await M("Memory create",()=>window.api.memory.create(k,w,r)))return null;const O=`---
4
+ `).map(t=>t.trim()).find(t=>t.length>0)??""}function Xt(s,t){const n=s.kind==="agent"?s.agent:null,l=n?`${n.name}|${n.memoryScope??""}`:"",m=n!==null&&n.memoryScope===null,r=o.useMemo(()=>m?null:n&&n.memoryScope?{agent:{name:n.name,scope:n.memoryScope},...t?{cwd:t}:{}}:{workspace:st(t),...t?{cwd:t}:{}},[l,m,t]),p=n===null,[f,c]=o.useState(!0),[b,j]=o.useState([]),[h,a]=o.useState(null),[d,u]=o.useState(null),[N,C]=o.useState(!1),[v,S]=o.useState(""),[R,K]=o.useState(!0),[te,ue]=o.useState([]),[q,A]=o.useState([]),[U,L]=o.useState({}),[pe,ke]=o.useState(()=>Date.now()),X=o.useRef(r);X.current=r;const I=o.useCallback(async()=>{if(!r){j([]),a(null),u(null),ue([]),S(""),c(!1);return}try{const g=await window.api.memory.list(r);if(X.current!==r)return;j(g.entries??[]),S(g.dir??""),K(g.autoMemoryEnabled!==!1),g.error&&E.error(`Memory list failed: ${g.error}`);const[x,k]=await Promise.all([window.api.memory.stale(r).catch(w=>(E.error(`Memory staleness check failed: ${P(w)}`),null)),window.api.memory.listArchived(r).catch(()=>({names:[],error:null}))]);if(X.current!==r)return;a(x),ue(k.names??[]),ke(Date.now())}catch(g){E.error(`Memory list failed: ${P(g)}`)}finally{c(!1)}},[r]);o.useEffect(()=>{c(!0),u(null),I(),r&&p&&r.workspace&&window.api.memory.aggregate(r.workspace,!1,t??void 0).then(g=>{X.current===r&&u(g)}).catch(g=>E.error(`Memory clusters failed: ${P(g)}`))},[I]),o.useEffect(()=>{let g=!1;return(async()=>{try{const{agents:x}=await window.api.memory.agents(t??void 0);if(g)return;A(x);const k={};await Promise.all(x.filter(w=>w.memoryScope).map(async w=>{const G=await window.api.memory.list({agent:{name:w.name,scope:w.memoryScope},...t?{cwd:t}:{}});k[w.name]=(G.entries??[]).filter(_=>_.name!=="MEMORY.md").length})),g||L(k)}catch(x){g||E.error(`Memory agents failed: ${P(x)}`)}})(),()=>{g=!0}},[t]),o.useEffect(()=>{if(!v)return;const g=v;window.api.config.watch([g]);const x=window.api.config.onChanged(({path:k})=>{(k===g||k.startsWith(g+"/"))&&I()});return()=>{x(),window.api.config.unwatch([g])}},[v,I]);const O=o.useMemo(()=>Ht(b,h,d,pe),[b,h,d,pe]),se=o.useMemo(()=>zt(d,O),[d,O]),Ne=o.useMemo(()=>({generatedAt:(d==null?void 0:d.generatedAt)??null,running:N}),[d,N]),D=o.useCallback(async g=>{if(!r)return null;try{const x=await window.api.memory.read(g,r);return x.error?(E.error(`Memory read failed: ${x.error}`),null):x.content}catch(x){return E.error(`Memory read failed: ${P(x)}`),null}},[r]),M=o.useCallback(async(g,x)=>{try{const k=await x();return k.ok?(await I(),!0):(E.error(`${g} failed: ${k.error??"unknown error"}`),!1)}catch(k){return E.error(`${g} failed: ${P(k)}`),!1}},[I]),Q=o.useCallback(async(g,x)=>{if(!r)return!1;const k=await D(g);if(k===null)return!1;const{front:w}=Fe(k);return M("Memory save",()=>window.api.memory.write(g,w+x,r))},[r,D,M]),V=o.useCallback(async(g,x)=>{if(!r)return null;const k=ot(g),w=qt(x);if(!await M("Memory create",()=>window.api.memory.create(k,w,r)))return null;const _=`---
5
5
  name: ${k}
6
6
  description: ${w}
7
7
  ---
8
8
 
9
9
  ${x}
10
- `;return await M("Memory create",()=>window.api.memory.write(k,O,r))?k:null},[r,M]),H=o.useCallback(async g=>{var G,O;if(!r)return null;const x=await D(g);if(x===null||!await M("Memory delete",()=>window.api.memory.delete(g,r)))return null;const w=((O=(G=Fe(x).front.match(/^description:\s*(.*)$/m))==null?void 0:G[1])==null?void 0:O.trim())??"";return async()=>{await M("Memory undo",()=>window.api.memory.create(g,w,r))&&await M("Memory undo",()=>window.api.memory.write(g,x,r))}},[r,D,M]),fe=o.useCallback(g=>r?M("Memory archive",()=>window.api.memory.archive(g,r)):Promise.resolve(!1),[r,M]),ne=o.useCallback(g=>r?M("Memory restore",()=>window.api.memory.restore(g,r)):Promise.resolve(!1),[r,M]),ae=o.useCallback(g=>r?M("Memory verify",()=>window.api.memory.verify(g,r)):Promise.resolve(!1),[r,M]),re=o.useCallback(async(g,x)=>{if(!r)return!1;const k=await D(g);if(k===null)return!1;const w=k.split(`[[${x}]]`).join(x);return M("Memory link removal",()=>window.api.memory.write(g,w,r))},[r,D,M]),Z=o.useCallback(async()=>{if(!(!r||!p||!r.workspace)){C(!0);try{const g=await window.api.memory.aggregate(r.workspace,!0,t??void 0);g.error?E.error(`Memory clustering failed: ${g.error}`):u(g)}catch(g){E.error(`Memory clustering failed: ${P(g)}`)}finally{C(!1)}}},[r,p,t]),he=o.useCallback(async(g,x)=>{const k=w=>({ok:!1,answer:"",citations:[],error:w});if(!r)return k("no memory store");try{const w=await window.api.memory.ask({question:g,target:r,contextName:x});return w.ok||E.error(`Memory ask failed: ${w.error??"unknown error"}`),w}catch(w){return E.error(`Memory ask failed: ${P(w)}`),k(P(w))}},[r]),z=o.useCallback(async g=>{const x=k=>({ok:!1,action:"keep",summary:"",reason:"",content:"",fold:null,error:k});if(!r)return x("no memory store");try{const k=await window.api.memory.proposeFix({name:g,target:r});return k.ok||E.error(`Memory fix failed: ${k.error??"unknown error"}`),k}catch(k){return E.error(`Memory fix failed: ${P(k)}`),x(P(k))}},[r]),oe=o.useMemo(()=>({refresh:I,read:D,saveBody:Q,create:V,remove:H,archive:fe,restore:ne,verify:ae,removeLink:re,regenerateClusters:Z,ask:he,proposeFix:z}),[I,D,Q,V,H,fe,ne,ae,re,Z,he,z]);return{loading:f,target:r,dir:v,autoMemoryEnabled:R,rows:_,clusters:se,clustersMeta:Ne,index:h==null?void 0:h.index,archived:te,agents:q,agentCounts:U,actions:oe}}const Qt={user:"user — all projects",project:"project — shared via git",local:"local — this machine only"},ee="text-[10px] tracking-[.08em] font-semibold text-fg-faint",lt="flex items-center gap-2 h-7 px-2.5 rounded-[5px] text-[13px] cursor-pointer hover:bg-muteband text-left w-full";function Be(s,t){return s.memoryScope===null?"off":String(t[s.name]??0)}function Me({id:s,label:t,count:n,dot:l,active:m,mono:r,onClick:p,check:f}){return e.jsxs("button",{type:"button","data-testid":`mx-nav-${s}`,onClick:p,className:`${lt} ${m?"bg-bg font-semibold text-fg":"text-fg-dim"}`,children:[e.jsx("span",{className:`w-[7px] h-[7px] rounded-sm shrink-0 ${l||"bg-transparent"}`}),e.jsx("span",{className:`flex-1 min-w-0 truncate ${r?"font-mono text-xs":""}`,children:t}),n!==void 0&&e.jsx("span",{className:`font-mono text-[11px] ${f&&n===0?"text-sage-dark":m?"text-fg":"text-fg-faint"}`,children:f&&n===0?"✓":n})]})}function We({label:s,value:t,max:n,tone:l}){const m=Math.min(100,Math.round(t/Math.max(1,n)*100));return e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"font-mono text-[10px] text-fg-faint",children:[s," ",t,"/",n]}),e.jsx("div",{className:"h-1 rounded-full bg-bg-muteband overflow-hidden",children:e.jsx("div",{className:`h-full ${l}`,style:{width:`${m}%`}})})]})}const Zt=o.memo(function(t){var j,h;const[n,l]=o.useState(!1),m=o.useRef(null),r=t.scope.kind==="agent";o.useEffect(()=>{if(!n)return;const a=u=>{u.key==="Escape"&&l(!1)},d=u=>{m.current&&!m.current.contains(u.target)&&l(!1)};return document.addEventListener("keydown",a),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",d)}},[n]);const p=a=>{l(!1),t.onScope(a)},f=(a,d,u,N,C)=>e.jsx(Me,{id:a,label:d,dot:u,count:N,check:C,active:t.view===a,onClick:()=>t.onView(a)}),c=t.scope.kind==="agent"?t.scope.agent:null,b=(j=t.index)!=null&&j.overBudget?"bg-accent":(h=t.index)!=null&&h.nearBudget?"bg-honey":"bg-sage-dark";return e.jsxs("nav",{"data-testid":"mx-nav",className:"w-[232px] shrink-0 flex flex-col gap-4 bg-bg-elev border-r border-rule-structural px-2.5 py-3.5 overflow-y-auto",children:[e.jsxs("div",{ref:m,className:"relative",children:[e.jsxs("button",{type:"button","data-testid":"mx-scope-card",onClick:()=>l(a=>!a),className:"w-full flex flex-col gap-0.5 px-2.5 py-2 border border-rule-structural rounded-md bg-bg cursor-pointer text-left hover:border-fg-faint",children:[e.jsx("span",{className:ee,children:c?"SUBAGENT":"WORKSPACE"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-mono text-xs text-fg flex-1 min-w-0 truncate",children:c?c.name:t.workspaceName}),e.jsx("span",{className:"text-[10px] text-fg-faint",children:"▾"})]}),e.jsx("span",{className:"font-mono text-[10px] text-fg-faint truncate",children:c?c.agentFile:t.workspacePath}),c&&c.memoryScope&&e.jsx("span",{className:"text-[10.5px] text-fg-faint",children:Qt[c.memoryScope]})]}),n&&e.jsxs("div",{"data-testid":"mx-scope-menu",className:`absolute left-0 right-0 top-full mt-1 ${W.dialog} bg-bg-hi border border-rule-structural rounded-[7px] shadow-lg p-1 flex flex-col`,children:[e.jsxs("button",{type:"button",onClick:()=>p({kind:"workspace"}),className:"flex items-center gap-2 px-2 py-1.5 rounded-[5px] text-left hover:bg-bg-elev",children:[e.jsx("span",{className:"w-3 text-[11px] text-sage-dark",children:c?"":"✓"}),e.jsxs("span",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-fg truncate",children:t.workspaceName}),e.jsx("span",{className:"text-[10.5px] text-fg-faint",children:"workspace"})]}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:t.workspaceCount})]}),t.agents.map(a=>e.jsxs("button",{type:"button",onClick:()=>p({kind:"agent",agent:a}),className:"flex items-center gap-2 px-2 py-1.5 rounded-[5px] text-left hover:bg-bg-elev",children:[e.jsx("span",{className:"w-3 text-[11px] text-sage-dark",children:(c==null?void 0:c.name)===a.name?"✓":""}),e.jsxs("span",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-fg truncate",children:a.name}),e.jsxs("span",{className:"text-[10.5px] text-fg-faint",children:["subagent",a.memoryScope?` · ${a.memoryScope}`:""]})]}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:Be(a,t.agentCounts)})]},a.name))]})]}),e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"BROWSE"}),f("all","All memories","",t.counts.all),f("ask","Ask",""),f("clusters","Clusters","",t.clusters.length)]}),e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"REVIEW"}),f("stale","Stale","bg-honey",t.counts.stale,!0),f("broken","Broken references","bg-accent",t.counts.broken,!0),f("recent","Changed this week","",t.counts.recent),f("unindexed","Not in index","",t.counts.unindexed,!0),t.archivedCount>0&&f("archived","Archived","",t.archivedCount)]}),!r&&e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"CLUSTERS"}),t.clusters.map(a=>e.jsx(Me,{id:`cluster:${a.id}`,label:a.name,dot:a.dotClass,count:t.clusterCounts[a.id]??0,active:t.view===`cluster:${a.id}`,onClick:()=>t.onView(`cluster:${a.id}`)},a.id)),t.unclusteredCount>0&&e.jsx(Me,{id:"cluster:unclustered",label:"Unclustered",dot:"bg-rule",count:t.unclusteredCount,active:t.view==="cluster:unclustered",onClick:()=>t.onView("cluster:unclustered")})]}),t.agents.length>0&&e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"SUBAGENT SCOPES"}),t.agents.map(a=>e.jsxs("button",{type:"button","data-testid":`mx-nav-agent:${a.name}`,onClick:()=>t.onScope({kind:"agent",agent:a}),className:`${lt} text-fg-dim ${(c==null?void 0:c.name)===a.name?"bg-bg font-semibold":""}`,children:[e.jsx("span",{className:"font-mono text-xs flex-1 truncate",children:a.name}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:Be(a,t.agentCounts)})]},a.name))]}),t.index&&e.jsxs("div",{"data-testid":"mx-index-footer",className:"mt-auto flex flex-col gap-1.5 pt-3 border-t border-rule-inner",children:[e.jsx("span",{className:ee,children:"MEMORY.md"}),e.jsx(We,{label:"lines",value:t.index.lines,max:t.index.maxLines,tone:b}),e.jsx(We,{label:"KB",value:Math.round(t.index.bytes/1024),max:Math.round(t.index.maxBytes/1024),tone:b}),t.index.dangling.length>0&&e.jsxs("span",{className:"text-[10.5px] text-accent-dark",children:[t.index.dangling.length," index lines point at missing files"]})]})]})}),Jt={recent:"name",name:"size",size:"recent"},es={recent:"Recent",name:"Name",size:"Size"},Ee="text-[9.5px] font-semibold tracking-[.06em] px-[5px] py-px rounded-[3px]";function ts(s){return`${Lt(s.bytes)} · ${s.ageDays>0?`${s.ageDays}d ago`:"just now"}`}const ss=o.memo(function(t){return e.jsxs("div",{"data-testid":"mx-list",className:"flex flex-col min-h-0 border-r border-rule-structural",children:[e.jsxs("div",{className:"flex flex-col gap-[10px] px-[14px] pt-[14px] pb-[10px] border-b border-rule-structural",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-serif text-lg min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:t.title}),e.jsx("span",{className:"text-[12px] text-fg-dim",children:t.rows.length}),e.jsx("span",{className:"flex-1"}),e.jsx("button",{type:"button","data-testid":"mx-list-new",onClick:t.onNew,className:"text-[12px] font-medium h-[26px] px-[10px] border border-rule-structural rounded-[5px] bg-bg-hi text-fg flex-none hover:border-fg",children:"+ New"})]}),e.jsxs("div",{className:"flex gap-[6px] items-center",children:[e.jsx("input",{"data-testid":"mx-list-filter",value:t.query,onChange:n=>t.onQuery(n.target.value),placeholder:"Filter by name or content…",className:"flex-1 min-w-0 h-7 border border-rule-structural rounded-[5px] px-[9px] text-[12px] text-fg bg-bg-hi outline-none"}),e.jsx("button",{type:"button","data-testid":"mx-list-sort",onClick:()=>t.onSort(Jt[t.sort]),className:"h-7 px-[9px] border border-rule-structural rounded-[5px] flex items-center text-[12px] text-fg whitespace-nowrap hover:border-fg-faint",children:`${es[t.sort]} ⇅`})]})]}),e.jsxs("div",{className:"overflow-auto flex-1 p-[6px]",children:[t.rows.map(n=>e.jsxs("div",{"data-testid":`mx-list-row-${n.name}`,onClick:()=>t.onSelect(n.name),className:`px-[10px] py-2 rounded-md cursor-pointer flex flex-col gap-[3px] hover:bg-bg-elev ${t.selected===n.name?"bg-muteband":""}`,children:[e.jsxs("div",{className:"flex items-center gap-[7px]",children:[e.jsx("span",{className:`w-[7px] h-[7px] rounded-[2px] flex-none ${t.clusterDot(n.clusterId)}`}),e.jsx("span",{className:"text-[13px] font-medium flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:n.slug}),n.stale&&e.jsx("span",{className:`${Ee} bg-butter/40 text-honey-dark`,children:"STALE"}),n.broken&&!n.stale&&e.jsx("span",{className:`${Ee} bg-accent-muted/30 text-accent-dark`,children:"BROKEN"}),n.notIndexed&&e.jsx("span",{className:`${Ee} bg-rule-inner text-fg-dim`,children:"NOT INDEXED"})]}),e.jsx("div",{className:"text-[11.5px] text-fg-dim pl-[14px] overflow-hidden text-ellipsis whitespace-nowrap",children:n.description}),e.jsx("div",{className:"font-mono text-[10.5px] text-fg-dim pl-[14px]",children:ts(n)})]},n.name)),t.empty&&t.rows.length===0&&e.jsxs("div",{"data-testid":"mx-list-empty",className:"px-[18px] py-10 flex flex-col gap-2 items-start",children:[e.jsx("span",{className:"font-serif text-[17px] text-fg",children:t.empty.title}),e.jsx("span",{className:"text-[12.5px] leading-normal text-fg-dim",children:t.empty.body}),e.jsx("button",{type:"button",onClick:t.empty.onAction,className:"mt-[6px] text-[12px] font-medium h-7 px-3 border border-rule-structural rounded-[5px] bg-bg-hi text-fg",children:t.empty.action})]})]})]})}),Ae="text-xs font-medium h-[26px] px-2.5 border border-rule-structural rounded-[5px] bg-bg text-fg hover:border-fg",ye="px-[7px] py-0.5 rounded bg-bg-elev",je="px-2.5 py-[7px] rounded-[5px] text-left text-[12.5px] hover:bg-bg-elev",ns="max-w-[640px] text-sm leading-[1.65] text-fg flex flex-col gap-3 [&_p]:m-0 [&_h4]:mt-1.5 [&_h4]:mb-0 [&_h4]:text-[11px] [&_h4]:tracking-[.08em] [&_h4]:font-semibold [&_h4]:text-accent [&_code]:font-mono [&_code]:text-[12.5px] [&_code]:bg-bg-elev [&_code]:px-1 [&_code]:rounded-[3px] [&_ul]:m-0 [&_ul]:pl-5 [&_ul]:list-disc [&_ol]:m-0 [&_ol]:pl-5 [&_ol]:list-decimal",Ke={update:{apply:"Apply",hint:"Writes the file"},delete:{apply:"Archive",hint:"Moves to .archive — undoable"},keep:{apply:"Mark verified",hint:"Touches the file, clears age staleness"},fold:{apply:"Copy for an Epic",hint:"Memory stays until the doc change lands"}};function as(s){var t;return s.action==="delete"?"Suggested: archive this memory":s.action==="fold"?`Suggested: move into ${((t=s.fold)==null?void 0:t.target)??"a doc"}`:s.action==="keep"?"Looks accurate — keep":"Suggested update"}function rs(s){return s<1024?`${s} B`:`${(s/1024).toFixed(1)} KB`}function os(s){return s<=0?"just now":`${s}d ago`}function ls(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return(t?s.slice(t[0].length):s).trim()}function is(s){return s.replace(/^\*\*Why:\*\*[ \t]*/gim,`#### WHY
10
+ `;return await M("Memory create",()=>window.api.memory.write(k,_,r))?k:null},[r,M]),H=o.useCallback(async g=>{var G,_;if(!r)return null;const x=await D(g);if(x===null||!await M("Memory delete",()=>window.api.memory.delete(g,r)))return null;const w=((_=(G=Fe(x).front.match(/^description:\s*(.*)$/m))==null?void 0:G[1])==null?void 0:_.trim())??"";return async()=>{await M("Memory undo",()=>window.api.memory.create(g,w,r))&&await M("Memory undo",()=>window.api.memory.write(g,x,r))}},[r,D,M]),fe=o.useCallback(g=>r?M("Memory archive",()=>window.api.memory.archive(g,r)):Promise.resolve(!1),[r,M]),ne=o.useCallback(g=>r?M("Memory restore",()=>window.api.memory.restore(g,r)):Promise.resolve(!1),[r,M]),ae=o.useCallback(g=>r?M("Memory verify",()=>window.api.memory.verify(g,r)):Promise.resolve(!1),[r,M]),re=o.useCallback(async(g,x)=>{if(!r)return!1;const k=await D(g);if(k===null)return!1;const w=k.split(`[[${x}]]`).join(x);return M("Memory link removal",()=>window.api.memory.write(g,w,r))},[r,D,M]),Z=o.useCallback(async()=>{if(!(!r||!p||!r.workspace)){C(!0);try{const g=await window.api.memory.aggregate(r.workspace,!0,t??void 0);g.error?E.error(`Memory clustering failed: ${g.error}`):u(g)}catch(g){E.error(`Memory clustering failed: ${P(g)}`)}finally{C(!1)}}},[r,p,t]),he=o.useCallback(async(g,x)=>{const k=w=>({ok:!1,answer:"",citations:[],error:w});if(!r)return k("no memory store");try{const w=await window.api.memory.ask({question:g,target:r,contextName:x});return w.ok||E.error(`Memory ask failed: ${w.error??"unknown error"}`),w}catch(w){return E.error(`Memory ask failed: ${P(w)}`),k(P(w))}},[r]),z=o.useCallback(async g=>{const x=k=>({ok:!1,action:"keep",summary:"",reason:"",content:"",fold:null,error:k});if(!r)return x("no memory store");try{const k=await window.api.memory.proposeFix({name:g,target:r});return k.ok||E.error(`Memory fix failed: ${k.error??"unknown error"}`),k}catch(k){return E.error(`Memory fix failed: ${P(k)}`),x(P(k))}},[r]),oe=o.useMemo(()=>({refresh:I,read:D,saveBody:Q,create:V,remove:H,archive:fe,restore:ne,verify:ae,removeLink:re,regenerateClusters:Z,ask:he,proposeFix:z}),[I,D,Q,V,H,fe,ne,ae,re,Z,he,z]);return{loading:f,target:r,dir:v,autoMemoryEnabled:R,rows:O,clusters:se,clustersMeta:Ne,index:h==null?void 0:h.index,archived:te,agents:q,agentCounts:U,actions:oe}}const Qt={user:"user — all projects",project:"project — shared via git",local:"local — this machine only"},ee="text-[10px] tracking-[.08em] font-semibold text-fg-faint",lt="flex items-center gap-2 h-7 px-2.5 rounded-[5px] text-[13px] cursor-pointer hover:bg-muteband text-left w-full";function Be(s,t){return s.memoryScope===null?"off":String(t[s.name]??0)}function Me({id:s,label:t,count:n,dot:l,active:m,mono:r,onClick:p,check:f}){return e.jsxs("button",{type:"button","data-testid":`mx-nav-${s}`,onClick:p,className:`${lt} ${m?"bg-bg font-semibold text-fg":"text-fg-dim"}`,children:[e.jsx("span",{className:`w-[7px] h-[7px] rounded-sm shrink-0 ${l||"bg-transparent"}`}),e.jsx("span",{className:`flex-1 min-w-0 truncate ${r?"font-mono text-xs":""}`,children:t}),n!==void 0&&e.jsx("span",{className:`font-mono text-[11px] ${f&&n===0?"text-sage-dark":m?"text-fg":"text-fg-faint"}`,children:f&&n===0?"✓":n})]})}function We({label:s,value:t,max:n,tone:l}){const m=Math.min(100,Math.round(t/Math.max(1,n)*100));return e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"font-mono text-[10px] text-fg-faint",children:[s," ",t,"/",n]}),e.jsx("div",{className:"h-1 rounded-full bg-bg-muteband overflow-hidden",children:e.jsx("div",{className:`h-full ${l}`,style:{width:`${m}%`}})})]})}const Zt=o.memo(function(t){var j,h;const[n,l]=o.useState(!1),m=o.useRef(null),r=t.scope.kind==="agent";o.useEffect(()=>{if(!n)return;const a=u=>{u.key==="Escape"&&l(!1)},d=u=>{m.current&&!m.current.contains(u.target)&&l(!1)};return document.addEventListener("keydown",a),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",d)}},[n]);const p=a=>{l(!1),t.onScope(a)},f=(a,d,u,N,C)=>e.jsx(Me,{id:a,label:d,dot:u,count:N,check:C,active:t.view===a,onClick:()=>t.onView(a)}),c=t.scope.kind==="agent"?t.scope.agent:null,b=(j=t.index)!=null&&j.overBudget?"bg-accent":(h=t.index)!=null&&h.nearBudget?"bg-honey":"bg-sage-dark";return e.jsxs("nav",{"data-testid":"mx-nav",className:"w-[232px] shrink-0 flex flex-col gap-4 bg-bg-elev border-r border-rule-structural px-2.5 py-3.5 overflow-y-auto",children:[e.jsxs("div",{ref:m,className:"relative",children:[e.jsxs("button",{type:"button","data-testid":"mx-scope-card",onClick:()=>l(a=>!a),className:"w-full flex flex-col gap-0.5 px-2.5 py-2 border border-rule-structural rounded-md bg-bg cursor-pointer text-left hover:border-fg-faint",children:[e.jsx("span",{className:ee,children:c?"SUBAGENT":"WORKSPACE"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-mono text-xs text-fg flex-1 min-w-0 truncate",children:c?c.name:t.workspaceName}),e.jsx("span",{className:"text-[10px] text-fg-faint",children:"▾"})]}),e.jsx("span",{className:"font-mono text-[10px] text-fg-faint truncate",children:c?c.agentFile:t.workspacePath}),c&&c.memoryScope&&e.jsx("span",{className:"text-[10.5px] text-fg-faint",children:Qt[c.memoryScope]})]}),n&&e.jsxs("div",{"data-testid":"mx-scope-menu",className:`absolute left-0 right-0 top-full mt-1 ${W.dialog} bg-bg-hi border border-rule-structural rounded-[7px] shadow-lg p-1 flex flex-col`,children:[e.jsxs("button",{type:"button",onClick:()=>p({kind:"workspace"}),className:"flex items-center gap-2 px-2 py-1.5 rounded-[5px] text-left hover:bg-bg-elev",children:[e.jsx("span",{className:"w-3 text-[11px] text-sage-dark",children:c?"":"✓"}),e.jsxs("span",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-fg truncate",children:t.workspaceName}),e.jsx("span",{className:"text-[10.5px] text-fg-faint",children:"workspace"})]}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:t.workspaceCount})]}),t.agents.map(a=>e.jsxs("button",{type:"button",onClick:()=>p({kind:"agent",agent:a}),className:"flex items-center gap-2 px-2 py-1.5 rounded-[5px] text-left hover:bg-bg-elev",children:[e.jsx("span",{className:"w-3 text-[11px] text-sage-dark",children:(c==null?void 0:c.name)===a.name?"✓":""}),e.jsxs("span",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-fg truncate",children:a.name}),e.jsxs("span",{className:"text-[10.5px] text-fg-faint",children:["subagent",a.memoryScope?` · ${a.memoryScope}`:""]})]}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:Be(a,t.agentCounts)})]},a.name))]})]}),e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"BROWSE"}),f("all","All memories","",t.counts.all),f("ask","Ask",""),f("clusters","Clusters","",t.clusters.length)]}),e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"REVIEW"}),f("stale","Stale","bg-honey",t.counts.stale,!0),f("broken","Broken references","bg-accent",t.counts.broken,!0),f("recent","Changed this week","",t.counts.recent),f("unindexed","Not in index","",t.counts.unindexed,!0),t.archivedCount>0&&f("archived","Archived","",t.archivedCount)]}),!r&&e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"CLUSTERS"}),t.clusters.map(a=>e.jsx(Me,{id:`cluster:${a.id}`,label:a.name,dot:a.dotClass,count:t.clusterCounts[a.id]??0,active:t.view===`cluster:${a.id}`,onClick:()=>t.onView(`cluster:${a.id}`)},a.id)),t.unclusteredCount>0&&e.jsx(Me,{id:"cluster:unclustered",label:"Unclustered",dot:"bg-rule",count:t.unclusteredCount,active:t.view==="cluster:unclustered",onClick:()=>t.onView("cluster:unclustered")})]}),t.agents.length>0&&e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:`px-2.5 pb-1.5 ${ee}`,children:"SUBAGENT SCOPES"}),t.agents.map(a=>e.jsxs("button",{type:"button","data-testid":`mx-nav-agent:${a.name}`,onClick:()=>t.onScope({kind:"agent",agent:a}),className:`${lt} text-fg-dim ${(c==null?void 0:c.name)===a.name?"bg-bg font-semibold":""}`,children:[e.jsx("span",{className:"font-mono text-xs flex-1 truncate",children:a.name}),e.jsx("span",{className:"font-mono text-[11px] text-fg-faint",children:Be(a,t.agentCounts)})]},a.name))]}),t.index&&e.jsxs("div",{"data-testid":"mx-index-footer",className:"mt-auto flex flex-col gap-1.5 pt-3 border-t border-rule-inner",children:[e.jsx("span",{className:ee,children:"MEMORY.md"}),e.jsx(We,{label:"lines",value:t.index.lines,max:t.index.maxLines,tone:b}),e.jsx(We,{label:"KB",value:Math.round(t.index.bytes/1024),max:Math.round(t.index.maxBytes/1024),tone:b}),t.index.dangling.length>0&&e.jsxs("span",{className:"text-[10.5px] text-accent-dark",children:[t.index.dangling.length," index lines point at missing files"]})]})]})}),Jt={recent:"name",name:"size",size:"recent"},es={recent:"Recent",name:"Name",size:"Size"},Ee="text-[9.5px] font-semibold tracking-[.06em] px-[5px] py-px rounded-[3px]";function ts(s){return`${Lt(s.bytes)} · ${s.ageDays>0?`${s.ageDays}d ago`:"just now"}`}const ss=o.memo(function(t){return e.jsxs("div",{"data-testid":"mx-list",className:"flex flex-col min-h-0 border-r border-rule-structural",children:[e.jsxs("div",{className:"flex flex-col gap-[10px] px-[14px] pt-[14px] pb-[10px] border-b border-rule-structural",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-serif text-lg min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:t.title}),e.jsx("span",{className:"text-[12px] text-fg-dim",children:t.rows.length}),e.jsx("span",{className:"flex-1"}),e.jsx("button",{type:"button","data-testid":"mx-list-new",onClick:t.onNew,className:"text-[12px] font-medium h-[26px] px-[10px] border border-rule-structural rounded-[5px] bg-bg-hi text-fg flex-none hover:border-fg",children:"+ New"})]}),e.jsxs("div",{className:"flex gap-[6px] items-center",children:[e.jsx("input",{"data-testid":"mx-list-filter",value:t.query,onChange:n=>t.onQuery(n.target.value),placeholder:"Filter by name or content…",className:"flex-1 min-w-0 h-7 border border-rule-structural rounded-[5px] px-[9px] text-[12px] text-fg bg-bg-hi outline-none"}),e.jsx("button",{type:"button","data-testid":"mx-list-sort",onClick:()=>t.onSort(Jt[t.sort]),className:"h-7 px-[9px] border border-rule-structural rounded-[5px] flex items-center text-[12px] text-fg whitespace-nowrap hover:border-fg-faint",children:`${es[t.sort]} ⇅`})]})]}),e.jsxs("div",{className:"overflow-auto flex-1 p-[6px]",children:[t.rows.map(n=>e.jsxs("div",{"data-testid":`mx-list-row-${n.name}`,onClick:()=>t.onSelect(n.name),className:`px-[10px] py-2 rounded-md cursor-pointer flex flex-col gap-[3px] hover:bg-bg-elev ${t.selected===n.name?"bg-muteband":""}`,children:[e.jsxs("div",{className:"flex items-center gap-[7px]",children:[e.jsx("span",{className:`w-[7px] h-[7px] rounded-[2px] flex-none ${t.clusterDot(n.clusterId)}`}),e.jsx("span",{className:"text-[13px] font-medium flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:n.slug}),n.stale&&e.jsx("span",{className:`${Ee} bg-butter/40 text-honey-dark`,children:"STALE"}),n.broken&&!n.stale&&e.jsx("span",{className:`${Ee} bg-accent-muted/30 text-accent-dark`,children:"BROKEN"}),n.notIndexed&&e.jsx("span",{className:`${Ee} bg-rule-inner text-fg-dim`,children:"NOT INDEXED"})]}),e.jsx("div",{className:"text-[11.5px] text-fg-dim pl-[14px] overflow-hidden text-ellipsis whitespace-nowrap",children:n.description}),e.jsx("div",{className:"font-mono text-[10.5px] text-fg-dim pl-[14px]",children:ts(n)})]},n.name)),t.empty&&t.rows.length===0&&e.jsxs("div",{"data-testid":"mx-list-empty",className:"px-[18px] py-10 flex flex-col gap-2 items-start",children:[e.jsx("span",{className:"font-serif text-[17px] text-fg",children:t.empty.title}),e.jsx("span",{className:"text-[12.5px] leading-normal text-fg-dim",children:t.empty.body}),e.jsx("button",{type:"button",onClick:t.empty.onAction,className:"mt-[6px] text-[12px] font-medium h-7 px-3 border border-rule-structural rounded-[5px] bg-bg-hi text-fg",children:t.empty.action})]})]})]})}),Ae="text-xs font-medium h-[26px] px-2.5 border border-rule-structural rounded-[5px] bg-bg text-fg hover:border-fg",ye="px-[7px] py-0.5 rounded bg-bg-elev",je="px-2.5 py-[7px] rounded-[5px] text-left text-[12.5px] hover:bg-bg-elev",ns="max-w-[640px] text-sm leading-[1.65] text-fg flex flex-col gap-3 [&_p]:m-0 [&_h4]:mt-1.5 [&_h4]:mb-0 [&_h4]:text-[11px] [&_h4]:tracking-[.08em] [&_h4]:font-semibold [&_h4]:text-accent [&_code]:font-mono [&_code]:text-[12.5px] [&_code]:bg-bg-elev [&_code]:px-1 [&_code]:rounded-[3px] [&_ul]:m-0 [&_ul]:pl-5 [&_ul]:list-disc [&_ol]:m-0 [&_ol]:pl-5 [&_ol]:list-decimal",Ke={update:{apply:"Apply",hint:"Writes the file"},delete:{apply:"Archive",hint:"Moves to .archive — undoable"},keep:{apply:"Mark verified",hint:"Touches the file, clears age staleness"},fold:{apply:"Copy for an Epic",hint:"Memory stays until the doc change lands"}};function as(s){var t;return s.action==="delete"?"Suggested: archive this memory":s.action==="fold"?`Suggested: move into ${((t=s.fold)==null?void 0:t.target)??"a doc"}`:s.action==="keep"?"Looks accurate — keep":"Suggested update"}function rs(s){return s<1024?`${s} B`:`${(s/1024).toFixed(1)} KB`}function os(s){return s<=0?"just now":`${s}d ago`}function ls(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return(t?s.slice(t[0].length):s).trim()}function is(s){return s.replace(/^\*\*Why:\*\*[ \t]*/gim,`#### WHY
11
11
 
12
12
  `).replace(/^\*\*How to apply:\*\*[ \t]*/gim,`#### HOW TO APPLY
13
13
 
@@ -16,10 +16,10 @@ ${x}
16
16
 
17
17
  **Why:**
18
18
 
19
- **How to apply:**`,F={state:"idle",diff:[],summary:"",action:"update",reason:"",fold:null},qe=s=>s.replace(/\.md$/,""),Xe=s=>s?s.split(/[\\/]/).filter(Boolean).pop()??s:"workspace";function Te(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return(t?s.slice(t[0].length):s).replace(/^\s*\n/,"")}function Ns(){try{const s=localStorage.getItem(it);return s&&s.startsWith(me)?s:"workspace"}catch{return"workspace"}}function ws({cwd:s}){const[t,n]=o.useState(Ns),[l,m]=o.useState([]),[r,p]=o.useState(0),f=o.useMemo(()=>{if(!t.startsWith(me))return"workspace";const h=t.slice(me.length);return l.some(a=>a.name===h)?t:"workspace"},[t,l]),c=o.useMemo(()=>{if(f==="workspace")return{kind:"workspace"};const h=l.find(a=>a.name===f.slice(me.length));return h?{kind:"agent",agent:h}:{kind:"workspace"}},[f]),b=o.useCallback(h=>{const a=h.kind==="agent"?`${me}${h.agent.name}`:"workspace";try{localStorage.setItem(it,a)}catch{}n(a)},[]),j=o.useCallback(h=>{h.length>0&&m(h)},[]);return e.jsx(Cs,{scope:c,cwd:s,onScope:b,onAgents:j,wsCount:r,onWsCount:p},f)}function Cs({scope:s,cwd:t,onScope:n,onAgents:l,wsCount:m,onWsCount:r}){var _e;const p=Xt(s,t),{actions:f,rows:c,clusters:b}=p,j=s.kind==="agent"?s.agent:null,h=j!==null&&j.memoryScope===null,a=j?j.name:Xe(t),[d,u]=o.useState("all"),[N,C]=o.useState(null),[v,S]=o.useState("read"),[R,K]=o.useState(""),[te,ue]=o.useState("recent"),[q,A]=o.useState(null),[U,L]=o.useState(F),[pe,ke]=o.useState(""),[X,I]=o.useState(null),[_,se]=o.useState(null),[Ne,D]=o.useState(null),[M,Q]=o.useState(""),[V,H]=o.useState(""),[fe,ne]=o.useState(""),[ae,re]=o.useState(!1),[Z,he]=o.useState(null);o.useEffect(()=>{l(p.agents)},[p.agents,l]),o.useEffect(()=>{!j&&!p.loading&&r(c.length)},[j,p.loading,c.length,r]);const z=o.useMemo(()=>p.archived.map(i=>({name:i,slug:qe(i),path:`${p.dir}/${i}`,description:"",bytes:0,mtimeMs:0,ageDays:0,stale:!1,staleReasons:[],ageOnlyStale:!1,deadRefs:[],broken:!1,danglingLinks:[],outLinks:[],inLinks:[],notIndexed:!1,clusterId:null,type:null,originSessionId:null})),[p.archived,p.dir]),oe=d!=="ask"&&d!=="clusters",g=o.useMemo(()=>{if(d==="archived"){const i=R.trim().toLowerCase();return z.filter(y=>!i||y.slug.toLowerCase().includes(i))}return rt(xe(c,d,R),te)},[d,c,z,R,te]),x=o.useMemo(()=>c.find(i=>i.name===N)??z.find(i=>i.name===N)??null,[c,z,N]),k=x!==null&&!c.some(i=>i.name===x.name),w=o.useCallback(i=>{var y;return((y=b.find($=>$.id===i))==null?void 0:y.dotClass)??"bg-rule"},[b]),G=i=>{var y;return((y=b.find($=>$.id===i))==null?void 0:y.name)??"Unclustered"},O=o.useCallback(i=>{C(i),S("read"),L(F),I(null),A(null)},[]),B=o.useCallback(i=>{u(i),K(""),A(null),L(F),S(y=>y==="edit"||y==="new"?"read":y)},[]);o.useEffect(()=>{var i;p.loading||!oe||v==="new"||x&&g.some(y=>y.name===x.name)||C(((i=g[0])==null?void 0:i.name)??null)},[p.loading,oe,v,x,g]);const le=x&&!k?x.name:null,dt=x==null?void 0:x.mtimeMs;o.useEffect(()=>{if(!le)return;let i=!0;return f.read(le).then(y=>{i&&he({name:le,text:y})}),()=>{i=!1}},[le,dt,f.read]);const Y=k?"":Z&&Z.name===le?Z.text:null;o.useEffect(()=>{const i=y=>{var be,ce;if(y.key!=="/"||y.metaKey||y.ctrlKey||y.altKey)return;const $=y.target,ge=((be=$==null?void 0:$.tagName)==null?void 0:be.toLowerCase())??"";ge==="input"||ge==="textarea"||$!=null&&$.isContentEditable||(ce=$==null?void 0:$.closest)!=null&&ce.call($,".monaco-editor")||(y.preventDefault(),A("palette"))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[]);const T=(i,y)=>se({message:i,undo:y}),we=(i="")=>{h||((d==="ask"||d==="clusters")&&u("all"),C(null),Q(""),H(i),ne(""),L(F),A(null),S("new"))},Ce=i=>{B("all"),O(i)},xt=i=>{const y=c.find($=>$.slug===i);y?O(y.name):E.error(`${i} is not in this scope`)},mt=()=>{if(Y===null)return;const i=Te(Y);H(i),ne(i),S("edit")},ut=async()=>{if(!ae){re(!0);try{if(v==="new"){const i=await f.create(M,V);if(!i)return;const y=i.endsWith(".md")?i:`${i}.md`;B("all"),O(y),T(`Created ${qe(y)}`)}else if(v==="edit"&&x){if(!await f.saveBody(x.name,V))return;S("read"),T(`Saved ${x.slug}`)}}finally{re(!1)}}},pt=()=>{S("read"),x||C(null)},ft=async()=>{if(!x||Y===null)return;const i=x;L({...F,state:"checking"});const y=await f.proposeFix(i.name);if(!y.ok){L(F);return}ke(y.content),L({state:"proposed",diff:y.action==="update"?Yt(Y,y.content):[],summary:y.summary,action:y.action,reason:y.reason,fold:y.fold})},ht=async()=>{if(!x||Y===null)return;const i=x;if(U.action==="delete"){if(!await f.archive(i.name))return;L(F),T(`Archived ${i.slug}`,()=>{f.restore(i.name)})}else if(U.action==="keep"){if(!await f.verify(i.name))return;L(F),T(`Marked ${i.slug} verified`)}else if(U.action==="fold"){if(!U.fold)return;const{target:y,anchor:$,insert:ge}=U.fold,be=`Fold memory ${i.slug} into ${y}.
19
+ **How to apply:**`,F={state:"idle",diff:[],summary:"",action:"update",reason:"",fold:null},qe=s=>s.replace(/\.md$/,""),Xe=s=>s?s.split(/[\\/]/).filter(Boolean).pop()??s:"workspace";function Te(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return(t?s.slice(t[0].length):s).replace(/^\s*\n/,"")}function Ns(){try{const s=localStorage.getItem(it);return s&&s.startsWith(me)?s:"workspace"}catch{return"workspace"}}function ws({cwd:s}){const[t,n]=o.useState(Ns),[l,m]=o.useState([]),[r,p]=o.useState(0),f=o.useMemo(()=>{if(!t.startsWith(me))return"workspace";const h=t.slice(me.length);return l.some(a=>a.name===h)?t:"workspace"},[t,l]),c=o.useMemo(()=>{if(f==="workspace")return{kind:"workspace"};const h=l.find(a=>a.name===f.slice(me.length));return h?{kind:"agent",agent:h}:{kind:"workspace"}},[f]),b=o.useCallback(h=>{const a=h.kind==="agent"?`${me}${h.agent.name}`:"workspace";try{localStorage.setItem(it,a)}catch{}n(a)},[]),j=o.useCallback(h=>{h.length>0&&m(h)},[]);return e.jsx(Cs,{scope:c,cwd:s,onScope:b,onAgents:j,wsCount:r,onWsCount:p},f)}function Cs({scope:s,cwd:t,onScope:n,onAgents:l,wsCount:m,onWsCount:r}){var Oe;const p=Xt(s,t),{actions:f,rows:c,clusters:b}=p,j=s.kind==="agent"?s.agent:null,h=j!==null&&j.memoryScope===null,a=j?j.name:Xe(t),[d,u]=o.useState("all"),[N,C]=o.useState(null),[v,S]=o.useState("read"),[R,K]=o.useState(""),[te,ue]=o.useState("recent"),[q,A]=o.useState(null),[U,L]=o.useState(F),[pe,ke]=o.useState(""),[X,I]=o.useState(null),[O,se]=o.useState(null),[Ne,D]=o.useState(null),[M,Q]=o.useState(""),[V,H]=o.useState(""),[fe,ne]=o.useState(""),[ae,re]=o.useState(!1),[Z,he]=o.useState(null);o.useEffect(()=>{l(p.agents)},[p.agents,l]),o.useEffect(()=>{!j&&!p.loading&&r(c.length)},[j,p.loading,c.length,r]);const z=o.useMemo(()=>p.archived.map(i=>({name:i,slug:qe(i),path:`${p.dir}/${i}`,description:"",bytes:0,mtimeMs:0,ageDays:0,stale:!1,staleReasons:[],ageOnlyStale:!1,deadRefs:[],broken:!1,danglingLinks:[],outLinks:[],inLinks:[],notIndexed:!1,clusterId:null,type:null,originSessionId:null})),[p.archived,p.dir]),oe=d!=="ask"&&d!=="clusters",g=o.useMemo(()=>{if(d==="archived"){const i=R.trim().toLowerCase();return z.filter(y=>!i||y.slug.toLowerCase().includes(i))}return rt(xe(c,d,R),te)},[d,c,z,R,te]),x=o.useMemo(()=>c.find(i=>i.name===N)??z.find(i=>i.name===N)??null,[c,z,N]),k=x!==null&&!c.some(i=>i.name===x.name),w=o.useCallback(i=>{var y;return((y=b.find($=>$.id===i))==null?void 0:y.dotClass)??"bg-rule"},[b]),G=i=>{var y;return((y=b.find($=>$.id===i))==null?void 0:y.name)??"Unclustered"},_=o.useCallback(i=>{C(i),S("read"),L(F),I(null),A(null)},[]),B=o.useCallback(i=>{u(i),K(""),A(null),L(F),S(y=>y==="edit"||y==="new"?"read":y)},[]);o.useEffect(()=>{var i;p.loading||!oe||v==="new"||x&&g.some(y=>y.name===x.name)||C(((i=g[0])==null?void 0:i.name)??null)},[p.loading,oe,v,x,g]);const le=x&&!k?x.name:null,dt=x==null?void 0:x.mtimeMs;o.useEffect(()=>{if(!le)return;let i=!0;return f.read(le).then(y=>{i&&he({name:le,text:y})}),()=>{i=!1}},[le,dt,f.read]);const Y=k?"":Z&&Z.name===le?Z.text:null;o.useEffect(()=>{const i=y=>{var be,ce;if(y.key!=="/"||y.metaKey||y.ctrlKey||y.altKey)return;const $=y.target,ge=((be=$==null?void 0:$.tagName)==null?void 0:be.toLowerCase())??"";ge==="input"||ge==="textarea"||$!=null&&$.isContentEditable||(ce=$==null?void 0:$.closest)!=null&&ce.call($,".monaco-editor")||(y.preventDefault(),A("palette"))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[]);const T=(i,y)=>se({message:i,undo:y}),we=(i="")=>{h||((d==="ask"||d==="clusters")&&u("all"),C(null),Q(""),H(i),ne(""),L(F),A(null),S("new"))},Ce=i=>{B("all"),_(i)},xt=i=>{const y=c.find($=>$.slug===i);y?_(y.name):E.error(`${i} is not in this scope`)},mt=()=>{if(Y===null)return;const i=Te(Y);H(i),ne(i),S("edit")},ut=async()=>{if(!ae){re(!0);try{if(v==="new"){const i=await f.create(M,V);if(!i)return;const y=i.endsWith(".md")?i:`${i}.md`;B("all"),_(y),T(`Created ${qe(y)}`)}else if(v==="edit"&&x){if(!await f.saveBody(x.name,V))return;S("read"),T(`Saved ${x.slug}`)}}finally{re(!1)}}},pt=()=>{S("read"),x||C(null)},ft=async()=>{if(!x||Y===null)return;const i=x;L({...F,state:"checking"});const y=await f.proposeFix(i.name);if(!y.ok){L(F);return}ke(y.content),L({state:"proposed",diff:y.action==="update"?Yt(Y,y.content):[],summary:y.summary,action:y.action,reason:y.reason,fold:y.fold})},ht=async()=>{if(!x||Y===null)return;const i=x;if(U.action==="delete"){if(!await f.archive(i.name))return;L(F),T(`Archived ${i.slug}`,()=>{f.restore(i.name)})}else if(U.action==="keep"){if(!await f.verify(i.name))return;L(F),T(`Marked ${i.slug} verified`)}else if(U.action==="fold"){if(!U.fold)return;const{target:y,anchor:$,insert:ge}=U.fold,be=`Fold memory ${i.slug} into ${y}.
20
20
  Insert after the line: ${$||"(append at end)"}
21
21
  ---
22
22
  ${ge}
23
23
  ---
24
24
  Tread lightly: add only these lines, do not restructure the doc. Once committed, archive the memory ${i.slug} from the Memory page.
25
- Memory file: ${i.path}`,ce=await window.api.clipboard.writeText(be);if(!ce.ok){E.error(`Copy failed: ${ce.error??"unknown error"}`);return}L(F),T("Fold copied — paste it into a New Epic")}else{const y=Te(Y);if(!await f.saveBody(i.name,Te(pe)))return;L(F),I(i.slug),T(`Applied fix to ${i.slug}`,()=>{f.saveBody(i.name,y)})}},gt=async()=>{if(!x)return;const i=x;await f.verify(i.name)&&T(`Marked ${i.slug} verified`)},Re=async()=>{if(!x)return;const i=x;A(null),await f.archive(i.name)&&T(`Archived ${i.slug}`,()=>{f.restore(i.name)})},bt=async()=>{if(!x)return;const i=x;await f.restore(i.name)&&T(`Restored ${i.slug}`)},yt=async()=>{if(!x)return;const i=x;A(null);const y=await f.remove(i.name);if(!y)return;const $=i.inLinks.length;T(`Deleted ${i.slug}${$>0?` · ${$} inbound links now broken`:""}`,()=>{y()})},jt=async()=>{if(!x)return;const i=await window.api.clipboard.writeText(x.path);i.ok?T("Path copied"):E.error(`Copy failed: ${i.error??"unknown error"}`)},vt=()=>{x&&window.api.shell.open({as:"revealPath",path:x.path})},kt=async i=>{if(!x)return;const y=x;await f.removeLink(y.name,i)&&T(`Dead link removed from ${y.slug}`)},Nt=()=>{x&&(D(x.slug),B("ask"))},wt=i=>{var y;return i?((y=c.find($=>$.slug===i))==null?void 0:y.name)??`${i}.md`:void 0},Ct=o.useMemo(()=>Gt(c),[c]),St=o.useMemo(()=>{const i={};for(const y of c)y.clusterId&&(i[y.clusterId]=(i[y.clusterId]??0)+1);return i},[c]),Ie=o.useMemo(()=>c.filter(i=>i.clusterId===null).length,[c]),$t=o.useMemo(()=>new Set(c.map(i=>i.slug)),[c]),Mt=d.startsWith("cluster:")?d==="cluster:unclustered"?"Unclustered":((_e=b.find(i=>i.id===d.slice(8)))==null?void 0:_e.name)??"Cluster":{all:"All memories",stale:"Stale",broken:"Broken references",recent:"Changed this week",unindexed:"Not in index",archived:"Archived"}[d]??"All memories";let ie=null;g.length===0&&(h?ie={title:`${a} has no persistent memory`,body:"Add `memory: project` (or user/local) to its frontmatter in the Agent Library to turn it on.",action:"Back to workspace",onAction:()=>n({kind:"workspace"})}:R.trim()?ie={title:`No memories match “${R}”`,body:"Filter checks names and descriptions in this view.",action:"Clear filter",onAction:()=>K("")}:c.length===0&&d==="all"?ie={title:`${a} has no memories yet`,body:"They appear when this subagent saves one, or add one now.",action:"+ New memory",onAction:()=>we(De)}:ie={title:"All clear",body:d==="stale"?"Nothing is stale in this scope.":"Nothing in this view.",action:"Back to all memories",onAction:()=>B("all")});const Et=!p.autoMemoryEnabled,At=Rt.memory;return e.jsxs("div",{"data-testid":"mx-shell",className:"relative h-full flex flex-col bg-bg text-fg leading-[normal]",children:[e.jsxs("div",{className:"relative shrink-0 flex items-center gap-3 px-6 py-4 border-b border-rule-structural",children:[e.jsxs("div",{className:"flex items-baseline gap-3 pt-1",children:[e.jsx("span",{className:"text-[11px] tracking-[.08em] font-medium text-fg-dim",children:"CONFIGURE"}),e.jsx("span",{className:"font-serif text-[28px] leading-none",children:"Memory"}),e.jsx("span",{className:"text-xs text-fg-dim",children:"Claude Code's own memory files · stored on this machine"})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button","data-testid":"mx-search-trigger",onClick:()=>A("palette"),className:"flex items-center gap-2 h-[30px] px-2.5 border border-rule-structural rounded-md bg-bg-elev w-[300px] text-xs text-fg-dim hover:border-fg-faint",children:[e.jsx("span",{children:"Search all memories, or ask a question…"}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"font-mono text-[10px] px-[5px] py-px border border-rule-structural rounded-[3px] text-fg-dim",children:"/"})]}),e.jsx("button",{type:"button","data-testid":"mx-learn",onClick:()=>A(i=>i==="learn"?null:"learn"),className:`text-[11px] tracking-[.08em] font-semibold px-1 py-1.5 hover:text-fg ${q==="learn"?"text-fg":"text-accent"}`,children:"LEARN"}),q==="learn"&&e.jsxs("div",{"data-testid":"mx-learn-popover",className:`absolute right-5 top-[58px] w-[360px] ${W.dialog} bg-bg-hi border border-rule-structural rounded-lg shadow-2xl p-4 flex flex-col gap-2.5 text-[13px] leading-[1.55] text-fg`,children:[e.jsx("span",{className:"font-serif text-[17px]",children:"How memory works"}),e.jsx("span",{children:At.intro}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-testid":"mx-learn-close",onClick:()=>A(null),className:"text-xs font-medium h-7 px-3 rounded-[5px] bg-fg text-bg",children:"Got it"})})]})]}),Et&&e.jsx("div",{"data-testid":"mx-auto-off",className:"shrink-0 w-full px-6 py-2 bg-butter/40 text-honey-dark text-[12.5px]",children:"Auto memory is off — Claude Code is not reading or writing any of these files."}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(Zt,{scope:s,agents:p.agents,agentCounts:p.agentCounts,workspaceName:Xe(t),workspacePath:t??"",workspaceCount:j?m:c.length,onScope:n,view:d,onView:B,counts:Ct,clusters:b,clusterCounts:St,unclusteredCount:Ie,archivedCount:p.archived.length,index:p.index}),e.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex",children:[d==="ask"&&e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(gs,{rows:c,context:Ne,onClearContext:()=>D(null),onAsk:(i,y)=>f.ask(i,wt(y)),onOpen:Ce,onReverify:()=>B("stale"),onDraft:i=>we(i)})}),d==="clusters"&&e.jsx(bs,{clusters:b,rows:c,generatedAt:p.clustersMeta.generatedAt,running:p.clustersMeta.running,unclusteredCount:Ie,available:!j,onRegenerate:()=>{f.regenerateClusters()},onOpenCluster:i=>B(`cluster:${i}`),onOpen:Ce}),oe&&e.jsxs("div",{className:"flex-1 min-w-0 min-h-0 grid grid-cols-[316px_minmax(0,1fr)_236px]",children:[e.jsx(ss,{title:Mt,rows:g,clusterDot:w,selected:N,onSelect:O,query:R,onQuery:K,sort:te,onSort:ue,onNew:()=>we(De),empty:ie}),e.jsx("div",{className:"flex flex-col min-w-0 min-h-0",children:v==="edit"||v==="new"?e.jsx(Ue,{mode:v,name:(x==null?void 0:x.slug)??null,title:M,onTitle:Q,body:V,onBody:H,onSave:()=>{ut()},onCancel:pt,saving:ae,dirty:v==="new"?M.trim()!==""||V!==De:V!==fe}):x?e.jsx(cs,{row:x,content:Y,clusterName:G(x.clusterId),clusterDot:w(x.clusterId),archived:k,mode:v,onMode:S,onEdit:mt,onCopyPath:()=>{jt()},onReveal:vt,onArchive:()=>{Re()},onRestore:()=>{bt()},onAskDelete:()=>A("delete"),fix:U,appliedStill:X===x.slug&&x.stale,onFix:()=>{ft()},onApplyFix:()=>{ht()},onDiscardFix:()=>L(F),onVerify:()=>{gt()}}):e.jsx(Ue,{mode:"none",name:null,title:"",onTitle:Q,body:"",onBody:H,onSave:()=>{},onCancel:()=>{},saving:!1,dirty:!1})}),e.jsx(ms,{row:k||v==="new"?null:x,known:$t,onOpen:xt,onRemoveLink:i=>{kt(i)},onAskAbout:Nt})]})]})]}),e.jsx(ys,{open:q==="palette",rows:c,clusterDot:w,onPick:Ce,onAsk:()=>{D(null),B("ask")},onClose:()=>A(null)}),e.jsx(js,{open:q==="delete"&&x!==null,name:(x==null?void 0:x.slug)??"",inbound:(x==null?void 0:x.inLinks.length)??0,onArchive:()=>{Re()},onCancel:()=>A(null),onConfirm:()=>{yt()}}),e.jsx(ks,{message:(_==null?void 0:_.message)??null,onUndo:_!=null&&_.undo?()=>{const i=_.undo;se(null),i==null||i()}:void 0,onClose:()=>se(null)})]})}function Ss(){const s=Je(),t=et();return s?e.jsx(ws,{cwd:(t==null?void 0:t.cwd)??null}):e.jsx(ve,{title:"loading…"})}const $s=o.memo(Ss);function Ms({cwd:s}){const[t,n]=o.useState(!1),[l,m]=o.useState(!1),[r,p]=o.useState(!1),[f,c]=o.useState(!1);o.useEffect(()=>{var d,u;let a=!1;return n(!1),Promise.resolve((u=(d=window.api.promptSessions)==null?void 0:d.getWorktreeDisabled)==null?void 0:u.call(d,{cwd:s})).then(N=>{a||(m((N==null?void 0:N.disabled)??!1),p((N==null?void 0:N.disabled)??!1),n(!0))},()=>{a||n(!0)}),()=>{a=!0}},[s]);const b=t&&r!==l,j=()=>{var a,d;c(!0),Promise.resolve((d=(a=window.api.promptSessions)==null?void 0:a.setWorktreeDisabled)==null?void 0:d.call(a,{cwd:s,disabled:r})).then(u=>{m((u==null?void 0:u.disabled)??r),p((u==null?void 0:u.disabled)??r)}).catch(u=>E.error(u instanceof Error?u.message:String(u))).finally(()=>c(!1))},h=()=>p(l);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!t||f,onChange:a=>p(a.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),b&&e.jsx(tt,{dirty:b,busy:f,onSave:j,onRevert:h})]})}const ct=[{key:"memory",label:"Memory"},{key:"claude-md",label:"CLAUDE.md"},{key:"settings",label:"Settings"},{key:"mcp",label:"MCP"},{key:"skills",label:"Skills"}],Qe=[{key:"project",label:"Project"},{key:"local",label:"Local"}],Es=s=>ct.some(t=>t.key===s),As=s=>`${s}/session-manager-operations/prompt-sessions/epic-worktree-config.json`,Ls={project:{title:"Project instructions",body:"This is the real <project>/CLAUDE.md on disk, normally checked into git. The claude CLI loads it into every session started in this project, for anyone who clones it."},local:{title:"Local instructions",body:"This is the real <project>/CLAUDE.local.md on disk: your own notes for this project on this machine, kept out of git. The claude CLI loads it alongside CLAUDE.md."}},Ds="changed on disk since it was loaded. Revert reloads it",Ze=s=>s instanceof Error?s.message:String(s);function Ts(s){const[t,n]=o.useState(null);return o.useEffect(()=>{if(!s)return;let l=!0;return Promise.resolve().then(()=>window.api.memory.list({workspace:st(s),cwd:s})).then(m=>{l&&m.dir&&n({cwd:s,dir:m.dir})}).catch(()=>{}),()=>{l=!1}},[s]),t&&t.cwd===s?t.dir:null}function Rs({path:s,scope:t}){const n=J(d=>d.files[s]),l=J(d=>d.loadText),m=J(d=>d.setDraft),r=J(d=>d.saveText),p=J(d=>d.watchFile),f=J(d=>d.unwatchFile),[c,b]=o.useState(null);o.useEffect(()=>(l(s,!0).catch(d=>E.error(`Couldn't read ${s}: ${Ze(d)}`)),p(s),()=>{f(s)}),[s,l,p,f]);const j=o.useCallback(async()=>{b(null);const d=await r(s);d.ok||b(d.error==="conflict"?Ds:d.error??"save failed")},[s,r]),h=o.useCallback(()=>{b(null),l(s).catch(d=>E.error(`Couldn't read ${s}: ${Ze(d)}`))},[s,l]);if(!n)return e.jsx(ve,{title:"loading…"});const a=Ls[t];return e.jsxs("div",{"data-testid":"project-claude-md",className:"flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:a.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:a.body})]}),n.loadError&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-line px-3 py-1.5 text-[11px] text-red-400",children:n.loadError}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Ft,{path:s,value:n.draftRaw,defaultMode:"split",onChange:d=>{b(null),m(s,d)},onSave:()=>{j()}})}),e.jsx("div",{className:"shrink-0 border-t border-line",children:e.jsx(tt,{dirty:n.dirty,busy:n.busy,parseError:c,lastSavedAt:n.lastSavedAt,leading:n.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:()=>{j()},onRevert:h})})]})}function Is({cwd:s,scope:t}){return e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsxs("div",{"data-testid":"project-claude-config-epic-isolation",className:"shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-bg-elev px-3 pt-2 pb-1.5 text-[11px] text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg",children:"Epic isolation"}),e.jsx("span",{className:"truncate",children:"Session Manager's own setting for this project, not a settings.json key"}),e.jsx(de,{path:As(s)})]}),e.jsx(Ms,{cwd:s})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Wt,{scope:t})})]})}function _s(){var N;const s=Je(),t=((N=et())==null?void 0:N.cwd)??null,[n,l]=o.useState("memory"),[m,r]=o.useState("project"),[p,f]=o.useState("project"),[c,b]=o.useState(null),j=Ts(t),h=o.useCallback(C=>{l(C),b(null)},[]);It("memory",C=>{Es(C)&&h(C)});const a=o.useCallback(C=>b(C),[]),d=o.useCallback(()=>b(null),[]);if(!s)return e.jsx(ve,{title:"loading…"});if(!t)return e.jsx(ve,{title:"no active project",hint:"open a project tab to edit its CLAUDE.md, settings, MCP servers, skills and memory"});const u=_t.resolve(m,s,t);return e.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"project-claude-config",children:[e.jsxs("div",{"data-testid":"project-claude-config-toolbar",className:"shrink-0 flex items-center gap-3 min-w-0 px-3 py-1.5 border-b border-line",children:[e.jsx(Se,{options:ct,active:n,onChange:h}),n==="claude-md"&&e.jsx(Se,{options:Qe,active:m,onChange:r}),n==="settings"&&e.jsx(Se,{options:Qe,active:p,onChange:f}),n==="memory"&&j&&e.jsx(de,{path:j,note:"Open this project's memory folder"}),n==="claude-md"&&u&&e.jsx(de,{path:u}),n==="mcp"&&e.jsx(de,{path:`${t}/.mcp.json`,keyPath:["mcpServers"]}),n==="skills"&&e.jsx(de,{path:`${t}/.claude/skills`,note:`Open ${t}/.claude/skills/`})]}),e.jsxs("div",{className:"flex-1 min-h-0",children:[n==="memory"&&e.jsx($s,{}),n==="claude-md"&&u&&e.jsx(Rs,{path:u,scope:m},u),n==="settings"&&e.jsx(Is,{cwd:t,scope:p}),n==="mcp"&&e.jsx(Kt,{scope:"project",onAdd:a}),n==="skills"&&e.jsx(Ut,{scope:"project"})]}),e.jsx(Ot,{open:c!==null,onClose:d,title:"Add MCP server",keyVals:[],children:c&&e.jsx(Pt,{scope:c.scope,cwd:c.cwd})})]})}const Zs=o.memo(_s);export{Zs as ProjectClaudeConfig};
25
+ Memory file: ${i.path}`,ce=await window.api.clipboard.writeText(be);if(!ce.ok){E.error(`Copy failed: ${ce.error??"unknown error"}`);return}L(F),T("Fold copied — paste it into a New Epic")}else{const y=Te(Y);if(!await f.saveBody(i.name,Te(pe)))return;L(F),I(i.slug),T(`Applied fix to ${i.slug}`,()=>{f.saveBody(i.name,y)})}},gt=async()=>{if(!x)return;const i=x;await f.verify(i.name)&&T(`Marked ${i.slug} verified`)},Re=async()=>{if(!x)return;const i=x;A(null),await f.archive(i.name)&&T(`Archived ${i.slug}`,()=>{f.restore(i.name)})},bt=async()=>{if(!x)return;const i=x;await f.restore(i.name)&&T(`Restored ${i.slug}`)},yt=async()=>{if(!x)return;const i=x;A(null);const y=await f.remove(i.name);if(!y)return;const $=i.inLinks.length;T(`Deleted ${i.slug}${$>0?` · ${$} inbound links now broken`:""}`,()=>{y()})},jt=async()=>{if(!x)return;const i=await window.api.clipboard.writeText(x.path);i.ok?T("Path copied"):E.error(`Copy failed: ${i.error??"unknown error"}`)},vt=()=>{x&&window.api.shell.open({as:"revealPath",path:x.path})},kt=async i=>{if(!x)return;const y=x;await f.removeLink(y.name,i)&&T(`Dead link removed from ${y.slug}`)},Nt=()=>{x&&(D(x.slug),B("ask"))},wt=i=>{var y;return i?((y=c.find($=>$.slug===i))==null?void 0:y.name)??`${i}.md`:void 0},Ct=o.useMemo(()=>Gt(c),[c]),St=o.useMemo(()=>{const i={};for(const y of c)y.clusterId&&(i[y.clusterId]=(i[y.clusterId]??0)+1);return i},[c]),Ie=o.useMemo(()=>c.filter(i=>i.clusterId===null).length,[c]),$t=o.useMemo(()=>new Set(c.map(i=>i.slug)),[c]),Mt=d.startsWith("cluster:")?d==="cluster:unclustered"?"Unclustered":((Oe=b.find(i=>i.id===d.slice(8)))==null?void 0:Oe.name)??"Cluster":{all:"All memories",stale:"Stale",broken:"Broken references",recent:"Changed this week",unindexed:"Not in index",archived:"Archived"}[d]??"All memories";let ie=null;g.length===0&&(h?ie={title:`${a} has no persistent memory`,body:"Add `memory: project` (or user/local) to its frontmatter in the Agent Library to turn it on.",action:"Back to workspace",onAction:()=>n({kind:"workspace"})}:R.trim()?ie={title:`No memories match “${R}”`,body:"Filter checks names and descriptions in this view.",action:"Clear filter",onAction:()=>K("")}:c.length===0&&d==="all"?ie={title:`${a} has no memories yet`,body:"They appear when this subagent saves one, or add one now.",action:"+ New memory",onAction:()=>we(De)}:ie={title:"All clear",body:d==="stale"?"Nothing is stale in this scope.":"Nothing in this view.",action:"Back to all memories",onAction:()=>B("all")});const Et=!p.autoMemoryEnabled,At=Rt.memory;return e.jsxs("div",{"data-testid":"mx-shell",className:"relative h-full flex flex-col bg-bg text-fg leading-[normal]",children:[e.jsxs("div",{className:"relative shrink-0 flex items-center gap-3 px-6 py-4 border-b border-rule-structural",children:[e.jsxs("div",{className:"flex items-baseline gap-3 pt-1",children:[e.jsx("span",{className:"text-[11px] tracking-[.08em] font-medium text-fg-dim",children:"CONFIGURE"}),e.jsx("span",{className:"font-serif text-[28px] leading-none",children:"Memory"}),e.jsx("span",{className:"text-xs text-fg-dim",children:"Claude Code's own memory files · stored on this machine"})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button","data-testid":"mx-search-trigger",onClick:()=>A("palette"),className:"flex items-center gap-2 h-[30px] px-2.5 border border-rule-structural rounded-md bg-bg-elev w-[300px] text-xs text-fg-dim hover:border-fg-faint",children:[e.jsx("span",{children:"Search all memories, or ask a question…"}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"font-mono text-[10px] px-[5px] py-px border border-rule-structural rounded-[3px] text-fg-dim",children:"/"})]}),e.jsx("button",{type:"button","data-testid":"mx-learn",onClick:()=>A(i=>i==="learn"?null:"learn"),className:`text-[11px] tracking-[.08em] font-semibold px-1 py-1.5 hover:text-fg ${q==="learn"?"text-fg":"text-accent"}`,children:"LEARN"}),q==="learn"&&e.jsxs("div",{"data-testid":"mx-learn-popover",className:`absolute right-5 top-[58px] w-[360px] ${W.dialog} bg-bg-hi border border-rule-structural rounded-lg shadow-2xl p-4 flex flex-col gap-2.5 text-[13px] leading-[1.55] text-fg`,children:[e.jsx("span",{className:"font-serif text-[17px]",children:"How memory works"}),e.jsx("span",{children:At.intro}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-testid":"mx-learn-close",onClick:()=>A(null),className:"text-xs font-medium h-7 px-3 rounded-[5px] bg-fg text-bg",children:"Got it"})})]})]}),Et&&e.jsx("div",{"data-testid":"mx-auto-off",className:"shrink-0 w-full px-6 py-2 bg-butter/40 text-honey-dark text-[12.5px]",children:"Auto memory is off — Claude Code is not reading or writing any of these files."}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(Zt,{scope:s,agents:p.agents,agentCounts:p.agentCounts,workspaceName:Xe(t),workspacePath:t??"",workspaceCount:j?m:c.length,onScope:n,view:d,onView:B,counts:Ct,clusters:b,clusterCounts:St,unclusteredCount:Ie,archivedCount:p.archived.length,index:p.index}),e.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex",children:[d==="ask"&&e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(gs,{rows:c,context:Ne,onClearContext:()=>D(null),onAsk:(i,y)=>f.ask(i,wt(y)),onOpen:Ce,onReverify:()=>B("stale"),onDraft:i=>we(i)})}),d==="clusters"&&e.jsx(bs,{clusters:b,rows:c,generatedAt:p.clustersMeta.generatedAt,running:p.clustersMeta.running,unclusteredCount:Ie,available:!j,onRegenerate:()=>{f.regenerateClusters()},onOpenCluster:i=>B(`cluster:${i}`),onOpen:Ce}),oe&&e.jsxs("div",{className:"flex-1 min-w-0 min-h-0 grid grid-cols-[316px_minmax(0,1fr)_236px]",children:[e.jsx(ss,{title:Mt,rows:g,clusterDot:w,selected:N,onSelect:_,query:R,onQuery:K,sort:te,onSort:ue,onNew:()=>we(De),empty:ie}),e.jsx("div",{className:"flex flex-col min-w-0 min-h-0",children:v==="edit"||v==="new"?e.jsx(Ue,{mode:v,name:(x==null?void 0:x.slug)??null,title:M,onTitle:Q,body:V,onBody:H,onSave:()=>{ut()},onCancel:pt,saving:ae,dirty:v==="new"?M.trim()!==""||V!==De:V!==fe}):x?e.jsx(cs,{row:x,content:Y,clusterName:G(x.clusterId),clusterDot:w(x.clusterId),archived:k,mode:v,onMode:S,onEdit:mt,onCopyPath:()=>{jt()},onReveal:vt,onArchive:()=>{Re()},onRestore:()=>{bt()},onAskDelete:()=>A("delete"),fix:U,appliedStill:X===x.slug&&x.stale,onFix:()=>{ft()},onApplyFix:()=>{ht()},onDiscardFix:()=>L(F),onVerify:()=>{gt()}}):e.jsx(Ue,{mode:"none",name:null,title:"",onTitle:Q,body:"",onBody:H,onSave:()=>{},onCancel:()=>{},saving:!1,dirty:!1})}),e.jsx(ms,{row:k||v==="new"?null:x,known:$t,onOpen:xt,onRemoveLink:i=>{kt(i)},onAskAbout:Nt})]})]})]}),e.jsx(ys,{open:q==="palette",rows:c,clusterDot:w,onPick:Ce,onAsk:()=>{D(null),B("ask")},onClose:()=>A(null)}),e.jsx(js,{open:q==="delete"&&x!==null,name:(x==null?void 0:x.slug)??"",inbound:(x==null?void 0:x.inLinks.length)??0,onArchive:()=>{Re()},onCancel:()=>A(null),onConfirm:()=>{yt()}}),e.jsx(ks,{message:(O==null?void 0:O.message)??null,onUndo:O!=null&&O.undo?()=>{const i=O.undo;se(null),i==null||i()}:void 0,onClose:()=>se(null)})]})}function Ss(){const s=Je(),t=et();return s?e.jsx(ws,{cwd:(t==null?void 0:t.cwd)??null}):e.jsx(ve,{title:"loading…"})}const $s=o.memo(Ss);function Ms({cwd:s}){const[t,n]=o.useState(!1),[l,m]=o.useState(!1),[r,p]=o.useState(!1),[f,c]=o.useState(!1);o.useEffect(()=>{var d,u;let a=!1;return n(!1),Promise.resolve((u=(d=window.api.promptSessions)==null?void 0:d.getWorktreeDisabled)==null?void 0:u.call(d,{cwd:s})).then(N=>{a||(m((N==null?void 0:N.disabled)??!1),p((N==null?void 0:N.disabled)??!1),n(!0))},()=>{a||n(!0)}),()=>{a=!0}},[s]);const b=t&&r!==l,j=()=>{var a,d;c(!0),Promise.resolve((d=(a=window.api.promptSessions)==null?void 0:a.setWorktreeDisabled)==null?void 0:d.call(a,{cwd:s,disabled:r})).then(u=>{m((u==null?void 0:u.disabled)??r),p((u==null?void 0:u.disabled)??r)}).catch(u=>E.error(u instanceof Error?u.message:String(u))).finally(()=>c(!1))},h=()=>p(l);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!t||f,onChange:a=>p(a.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),b&&e.jsx(tt,{dirty:b,busy:f,onSave:j,onRevert:h})]})}const ct=[{key:"memory",label:"Memory"},{key:"claude-md",label:"CLAUDE.md"},{key:"settings",label:"Settings"},{key:"mcp",label:"MCP"},{key:"skills",label:"Skills"}],Qe=[{key:"project",label:"Project"},{key:"local",label:"Local"}],Es=s=>ct.some(t=>t.key===s),As=s=>`${s}/session-manager-operations/prompt-sessions/epic-worktree-config.json`,Ls={project:{title:"Project instructions",body:"This is the real <project>/CLAUDE.md on disk, normally checked into git. The claude CLI loads it into every session started in this project, for anyone who clones it."},local:{title:"Local instructions",body:"This is the real <project>/CLAUDE.local.md on disk: your own notes for this project on this machine, kept out of git. The claude CLI loads it alongside CLAUDE.md."}},Ds="changed on disk since it was loaded. Revert reloads it",Ze=s=>s instanceof Error?s.message:String(s);function Ts(s){const[t,n]=o.useState(null);return o.useEffect(()=>{if(!s)return;let l=!0;return Promise.resolve().then(()=>window.api.memory.list({workspace:st(s),cwd:s})).then(m=>{l&&m.dir&&n({cwd:s,dir:m.dir})}).catch(()=>{}),()=>{l=!1}},[s]),t&&t.cwd===s?t.dir:null}function Rs({path:s,scope:t}){const n=J(d=>d.files[s]),l=J(d=>d.loadText),m=J(d=>d.setDraft),r=J(d=>d.saveText),p=J(d=>d.watchFile),f=J(d=>d.unwatchFile),[c,b]=o.useState(null);o.useEffect(()=>(l(s,!0).catch(d=>E.error(`Couldn't read ${s}: ${Ze(d)}`)),p(s),()=>{f(s)}),[s,l,p,f]);const j=o.useCallback(async()=>{b(null);const d=await r(s);d.ok||b(d.error==="conflict"?Ds:d.error??"save failed")},[s,r]),h=o.useCallback(()=>{b(null),l(s).catch(d=>E.error(`Couldn't read ${s}: ${Ze(d)}`))},[s,l]);if(!n)return e.jsx(ve,{title:"loading…"});const a=Ls[t];return e.jsxs("div",{"data-testid":"project-claude-md",className:"flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:a.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:a.body})]}),n.loadError&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-line px-3 py-1.5 text-[11px] text-red-400",children:n.loadError}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Ft,{path:s,value:n.draftRaw,defaultMode:"split",onChange:d=>{b(null),m(s,d)},onSave:()=>{j()}})}),e.jsx("div",{className:"shrink-0 border-t border-line",children:e.jsx(tt,{dirty:n.dirty,busy:n.busy,parseError:c,lastSavedAt:n.lastSavedAt,leading:n.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:()=>{j()},onRevert:h})})]})}function Is({cwd:s,scope:t}){return e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsxs("div",{"data-testid":"project-claude-config-epic-isolation",className:"shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-bg-elev px-3 pt-2 pb-1.5 text-[11px] text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg",children:"Epic isolation"}),e.jsx("span",{className:"truncate",children:"Session Manager's own setting for this project, not a settings.json key"}),e.jsx(de,{path:As(s)})]}),e.jsx(Ms,{cwd:s})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Wt,{scope:t})})]})}function Os(){var N;const s=Je(),t=((N=et())==null?void 0:N.cwd)??null,[n,l]=o.useState("memory"),[m,r]=o.useState("project"),[p,f]=o.useState("project"),[c,b]=o.useState(null),j=Ts(t),h=o.useCallback(C=>{l(C),b(null)},[]);It("memory",C=>{Es(C)&&h(C)});const a=o.useCallback(C=>b(C),[]),d=o.useCallback(()=>b(null),[]);if(!s)return e.jsx(ve,{title:"loading…"});if(!t)return e.jsx(ve,{title:"no active project",hint:"open a project tab to edit its CLAUDE.md, settings, MCP servers, skills and memory"});const u=Ot.resolve(m,s,t);return e.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"project-claude-config",children:[e.jsxs("div",{"data-testid":"project-claude-config-toolbar",className:"shrink-0 flex items-center gap-3 min-w-0 px-3 py-1.5 border-b border-line",children:[e.jsx(Se,{options:ct,active:n,onChange:h}),n==="claude-md"&&e.jsx(Se,{options:Qe,active:m,onChange:r}),n==="settings"&&e.jsx(Se,{options:Qe,active:p,onChange:f}),n==="memory"&&j&&e.jsx(de,{path:j,note:"Open this project's memory folder"}),n==="claude-md"&&u&&e.jsx(de,{path:u}),n==="mcp"&&e.jsx(de,{path:`${t}/.mcp.json`,keyPath:["mcpServers"]}),n==="skills"&&e.jsx(de,{path:`${t}/.claude/skills`,note:`Open ${t}/.claude/skills/`})]}),e.jsxs("div",{className:"flex-1 min-h-0",children:[n==="memory"&&e.jsx($s,{}),n==="claude-md"&&u&&e.jsx(Rs,{path:u,scope:m},u),n==="settings"&&e.jsx(Is,{cwd:t,scope:p}),n==="mcp"&&e.jsx(Kt,{scope:"project",onAdd:a}),n==="skills"&&e.jsx(Ut,{scope:"project"})]}),e.jsx(_t,{open:c!==null,onClose:d,title:"Add MCP server",keyVals:[],children:c&&e.jsx(Pt,{scope:c.scope,cwd:c.cwd})})]})}const Zs=o.memo(Os);export{Zs as ProjectClaudeConfig};
@@ -1 +1 @@
1
- import{ac as P,be as M,aN as x,ax as s,a6 as R,B as G,b as T}from"./index-Dh5geJe3.js";import{a as E,C as _,c as j,b as B}from"./Library-CrgzRQzL.js";const N=e=>`${e}/.claude/session-manager/provenance.json`;function I(e){if(!e||typeof e!="object")return{};const t={};for(const[n,o]of Object.entries(e))(o==="anthropic"||o==="community"||o==="local")&&(t[n]=o);return t}const D=P((e,t)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=t();if(!(o.home===n&&(o.loaded||o.loading))){e({home:n,loading:!0});try{const a=await window.api.config.readJson(N(n)),d=a.exists?I(a.data):{};e(h=>({overrides:{...d,...h.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const a={...t().overrides};o===null?delete a[n]:a[n]=o,e({overrides:a});const d=t().home;if(d)try{await window.api.config.writeJson(N(d),a)}catch{}}})),i=e=>(e??"").toLowerCase().trim(),$=new Set,L=new Set;for(const e of B){const t=e.official?$:L;t.add(i(e.id)),t.add(i(e.name))}const K=new Set(j.filter(e=>e.official).flatMap(e=>[i(e.id),i(e.name)])),H=new Set(j.filter(e=>!e.official).flatMap(e=>[i(e.id),i(e.name)])),J=new Set(_.flatMap(e=>[i(e.id),i(e.name)])),V=new Set(E.flatMap(e=>[i(e.id),i(e.name)])),z=new Set(E.map(e=>e.command.trim())),U=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Z=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,q=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function F(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),C=e=>({provenance:"community",reason:e});function Q(e,t,n){switch(e){case"mcp":return $.has(t)?l("official MCP server (catalog)"):L.has(t)?C("third-party server (catalog)"):null;case"skill":case"command":return K.has(t)?l("official Anthropic skill (catalog)"):H.has(t)?C("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return J.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return V.has(t)||n&&z.has(n.trim())?l("bundled hook (catalog)"):null}}function W(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":q.test(t)?"installed from a package registry":null}function X(e){const t=i(e.name),n=F(e),o=Q(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&U.has(t))return l("built-in Claude Code command");if(Z.test(n))return l("Anthropic package or repo");const a=W(e,n);return a?C(a):{provenance:"local",reason:"no external source — assumed self-created"}}function Y(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},O={anthropic:"accent",community:"warn",local:"dim"},ee=["anthropic","community","local"];function oe({input:e,scope:t,interactive:n=!0,className:o=""}){const a=M(),{overrides:d,load:h,setOverride:k}=D(),[b,m]=x.useState(!1),v=x.useRef(null);x.useEffect(()=>{a&&h(a)},[a,h]),x.useEffect(()=>{if(!b)return;const r=w=>{v.current&&!v.current.contains(w.target)&&m(!1)},g=w=>{w.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",g)}},[b]);const y=Y(e.type,t??null,e.name),u=X(e),p=d[y],f=p??u.provenance,S=p?`Origin manually set to ${c[f]} — auto-detected ${c[u.provenance]} (${u.reason})`:`Auto-detected ${c[f]}: ${u.reason}`,A=s.jsxs(T,{tone:O[f],title:S,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[f],p&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?s.jsxs("span",{ref:v,className:"relative inline-flex",children:[s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),m(g=>!g)},className:"inline-flex","aria-label":`Origin: ${c[f]}. Click to change.`,children:A}),b&&s.jsxs("span",{className:`absolute ${R.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:r=>r.stopPropagation(),children:[s.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),ee.map(r=>s.jsxs("button",{type:"button",onClick:()=>{k(y,r),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===r?"text-fg":"text-fg-dim"}`,children:[s.jsx("span",{className:`w-2 h-2 rounded-full border ${G[O[r]]}`,"aria-hidden":!0}),c[r],p===r&&s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},r)),s.jsx("div",{className:"my-1 border-t border-line"}),s.jsxs("button",{type:"button",onClick:()=>{k(y,null),m(!1)},disabled:!p,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${c[u.provenance]})`,children:["Auto-detect",s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[u.provenance]})]})]})]}):A}export{c as P,oe as a,X as c,Y as p,D as u};
1
+ import{ad as P,bh as M,aO as x,ay as s,a7 as R,B as G,c as T}from"./index-Cznhnxhq.js";import{a as E,C as _,c as j,b as B}from"./Library-I37dQ6pB.js";const O=e=>`${e}/.claude/session-manager/provenance.json`;function I(e){if(!e||typeof e!="object")return{};const t={};for(const[n,o]of Object.entries(e))(o==="anthropic"||o==="community"||o==="local")&&(t[n]=o);return t}const D=P((e,t)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=t();if(!(o.home===n&&(o.loaded||o.loading))){e({home:n,loading:!0});try{const a=await window.api.config.readJson(O(n)),d=a.exists?I(a.data):{};e(h=>({overrides:{...d,...h.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const a={...t().overrides};o===null?delete a[n]:a[n]=o,e({overrides:a});const d=t().home;if(d)try{await window.api.config.writeJson(O(d),a)}catch{}}})),i=e=>(e??"").toLowerCase().trim(),$=new Set,L=new Set;for(const e of B){const t=e.official?$:L;t.add(i(e.id)),t.add(i(e.name))}const K=new Set(j.filter(e=>e.official).flatMap(e=>[i(e.id),i(e.name)])),H=new Set(j.filter(e=>!e.official).flatMap(e=>[i(e.id),i(e.name)])),J=new Set(_.flatMap(e=>[i(e.id),i(e.name)])),V=new Set(E.flatMap(e=>[i(e.id),i(e.name)])),z=new Set(E.map(e=>e.command.trim())),U=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Z=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,q=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function F(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),C=e=>({provenance:"community",reason:e});function Q(e,t,n){switch(e){case"mcp":return $.has(t)?l("official MCP server (catalog)"):L.has(t)?C("third-party server (catalog)"):null;case"skill":case"command":return K.has(t)?l("official Anthropic skill (catalog)"):H.has(t)?C("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return J.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return V.has(t)||n&&z.has(n.trim())?l("bundled hook (catalog)"):null}}function W(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":q.test(t)?"installed from a package registry":null}function X(e){const t=i(e.name),n=F(e),o=Q(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&U.has(t))return l("built-in Claude Code command");if(Z.test(n))return l("Anthropic package or repo");const a=W(e,n);return a?C(a):{provenance:"local",reason:"no external source — assumed self-created"}}function Y(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},N={anthropic:"accent",community:"warn",local:"dim"},ee=["anthropic","community","local"];function oe({input:e,scope:t,interactive:n=!0,className:o=""}){const a=M(),{overrides:d,load:h,setOverride:k}=D(),[b,m]=x.useState(!1),v=x.useRef(null);x.useEffect(()=>{a&&h(a)},[a,h]),x.useEffect(()=>{if(!b)return;const r=w=>{v.current&&!v.current.contains(w.target)&&m(!1)},g=w=>{w.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",g)}},[b]);const y=Y(e.type,t??null,e.name),u=X(e),p=d[y],f=p??u.provenance,S=p?`Origin manually set to ${c[f]} — auto-detected ${c[u.provenance]} (${u.reason})`:`Auto-detected ${c[f]}: ${u.reason}`,A=s.jsxs(T,{tone:N[f],title:S,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[f],p&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?s.jsxs("span",{ref:v,className:"relative inline-flex",children:[s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),m(g=>!g)},className:"inline-flex","aria-label":`Origin: ${c[f]}. Click to change.`,children:A}),b&&s.jsxs("span",{className:`absolute ${R.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:r=>r.stopPropagation(),children:[s.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),ee.map(r=>s.jsxs("button",{type:"button",onClick:()=>{k(y,r),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===r?"text-fg":"text-fg-dim"}`,children:[s.jsx("span",{className:`w-2 h-2 rounded-full border ${G[N[r]]}`,"aria-hidden":!0}),c[r],p===r&&s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},r)),s.jsx("div",{className:"my-1 border-t border-line"}),s.jsxs("button",{type:"button",onClick:()=>{k(y,null),m(!1)},disabled:!p,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${c[u.provenance]})`,children:["Auto-detect",s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[u.provenance]})]})]})]}):A}export{c as P,oe as a,X as c,Y as p,D as u};