@plannotator/opencode 0.4.7-beta.0 → 0.4.7

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 (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -571,7 +571,7 @@ https://github.com/highlightjs/highlight.js/issues/2277\`),vt=de,_e=Ce),Fe===voi
571
571
  created: \${new Date().toISOString().slice(0,19)}Z
572
572
  source: plannotator
573
573
  tags: [plan, ...]
574
- ---\`})]})]})]}),S.jsx("div",{className:"border-t border-border"}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-sm font-medium",children:"Bear Notes"}),S.jsx("div",{className:"text-xs text-muted-foreground",children:"Auto-save approved plans to Bear"})]}),S.jsx("button",{role:"switch","aria-checked":O.enabled,onClick:()=>C(!O.enabled),className:\`relative inline-flex h-6 w-11 items-center rounded-full transition-colors \${O.enabled?"bg-primary":"bg-muted"}\`,children:S.jsx("span",{className:\`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform \${O.enabled?"translate-x-6":"translate-x-1"}\`})})]})]})]})}),document.body)]})};async function LA(o){const i=JSON.stringify(o),c=new TextEncoder().encode(i),s=new CompressionStream("deflate-raw"),d=s.writable.getWriter();d.write(c),d.close();const u=await new Response(s.readable).arrayBuffer(),f=new Uint8Array(u);return btoa(String.fromCharCode(...f)).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}async function wA(o){const i=o.replace(/-/g,"+").replace(/_/g,"/"),c=atob(i),s=Uint8Array.from(c,E=>E.charCodeAt(0)),d=new DecompressionStream("deflate-raw"),u=d.writable.getWriter();u.write(s),u.close();const f=await new Response(d.readable).arrayBuffer(),p=new TextDecoder().decode(f);return JSON.parse(p)}function kA(o){return o.map(i=>{const c=i.author||null,s=i.imagePaths?.length?i.imagePaths:void 0;if(i.type===Ze.GLOBAL_COMMENT)return["G",i.text||"",c,s];const d=i.type[0];return d==="D"?["D",i.originalText,c,s]:[d,i.originalText,i.text||"",c,s]})}function PA(o){const i={D:Ze.DELETION,R:Ze.REPLACEMENT,C:Ze.COMMENT,I:Ze.INSERTION,G:Ze.GLOBAL_COMMENT};return o.map((c,s)=>{const d=c[0];if(d==="G"){const m=c[1],b=c[2],v=c[3];return{id:\`shared-\${s}-\${Date.now()}\`,blockId:"",startOffset:0,endOffset:0,type:Ze.GLOBAL_COMMENT,text:m||void 0,originalText:"",createdA:Date.now()+s,author:b||void 0,imagePaths:v?.length?v:void 0}}const u=c[1],f=d==="D"?void 0:c[2],p=d==="D"?c[2]:c[3],E=d==="D"?c[3]:c[4];return{id:\`shared-\${s}-\${Date.now()}\`,blockId:"",startOffset:0,endOffset:0,type:i[d],text:f||void 0,originalText:u,createdA:Date.now()+s,author:p||void 0,imagePaths:E?.length?E:void 0}})}const UA="https://share.plannotator.ai";async function zA(o,i,c){const s={p:o,a:kA(i),g:c?.length?c:void 0},d=await LA(s);return\`\${UA}/#\${d}\`}async function FA(){const o=window.location.hash.slice(1);if(!o)return null;try{return await wA(o)}catch(i){return console.warn("Failed to parse share hash:",i),null}}function BA(o){const i=new Blob([o]).size;return i<1024?\`\${i} B\`:\`\${(i/1024).toFixed(1)} KB\`}function GA(o,i,c,s,d,u,f){const[p,E]=Z.useState(!1),[m,b]=Z.useState(!0),[v,T]=Z.useState(""),[O,h]=Z.useState(""),[y,C]=Z.useState(null),[I,N]=Z.useState(null),x=Z.useCallback(()=>{C(null),N(null)},[]),V=Z.useCallback(async()=>{try{const U=await FA();if(U){s(U.p);const q=PA(U.a);return d(q),U.g?.length&&(u(U.g),N(U.g)),C(q),E(!0),f?.(),window.history.replaceState({},"",window.location.pathname),!0}return!1}catch(U){return console.error("Failed to load from share hash:",U),!1}},[s,d,u,f]);Z.useEffect(()=>{V().finally(()=>b(!1))},[]),Z.useEffect(()=>{const U=()=>{window.location.hash.length>1&&V()};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[V]);const z=Z.useCallback(async()=>{try{const U=await zA(o,i,c);T(U),h(BA(U))}catch(U){console.error("Failed to generate share URL:",U),T(""),h("")}},[o,i,c]);return Z.useEffect(()=>{z()},[z]),{isSharedSession:p,isLoadingShared:m,shareUrl:v,shareUrlSize:O,pendingSharedAnnotations:y,sharedGlobalAttachments:I,clearPendingSharedAnnotations:x,refreshShareUrl:z}}const YA="https://api.github.com/repos/backnotprop/plannotator/releases/latest";function KA(o,i){const c=u=>u.replace(/^v/,""),s=c(o).split(".").map(Number),d=c(i).split(".").map(Number);for(let u=0;u<Math.max(s.length,d.length);u++){const f=s[u]||0,p=d[u]||0;if(p>f)return!0;if(p<f)return!1}return!1}function qA(){const[o,i]=Z.useState(null);return Z.useEffect(()=>{(async()=>{try{const s="0.4.6",d=await fetch(YA);if(!d.ok)return;const u=await d.json(),f=u.tag_name,p=KA(s,f);i({currentVersion:s,latestVersion:f,updateAvailable:p,releaseUrl:u.html_url})}catch(s){console.debug("Update check failed:",s)}})()},[]),o}const QA="curl -fsSL https://plannotator.ai/install.sh | bash",HA=()=>{const o=qA(),[i,c]=Z.useState(!1),[s,d]=Z.useState(!1);if(!o?.updateAvailable||s)return null;const u=async()=>{try{await navigator.clipboard.writeText(QA),c(!0),setTimeout(()=>c(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return S.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:S.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:S.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center justify-between gap-2",children:[S.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),S.jsx("button",{onClick:()=>d(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:S.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),S.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[o.latestVersion," is available (you have ",o.currentVersion,")"]}),S.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[S.jsx("button",{onClick:u,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:i?"Copied!":"Copy install command"}),S.jsx("a",{href:o.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},VA=\`# Implementation Plan: Real-time Collaboration
574
+ ---\`})]})]})]}),S.jsx("div",{className:"border-t border-border"}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-sm font-medium",children:"Bear Notes"}),S.jsx("div",{className:"text-xs text-muted-foreground",children:"Auto-save approved plans to Bear"})]}),S.jsx("button",{role:"switch","aria-checked":O.enabled,onClick:()=>C(!O.enabled),className:\`relative inline-flex h-6 w-11 items-center rounded-full transition-colors \${O.enabled?"bg-primary":"bg-muted"}\`,children:S.jsx("span",{className:\`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform \${O.enabled?"translate-x-6":"translate-x-1"}\`})})]})]})]})}),document.body)]})};async function LA(o){const i=JSON.stringify(o),c=new TextEncoder().encode(i),s=new CompressionStream("deflate-raw"),d=s.writable.getWriter();d.write(c),d.close();const u=await new Response(s.readable).arrayBuffer(),f=new Uint8Array(u);return btoa(String.fromCharCode(...f)).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}async function wA(o){const i=o.replace(/-/g,"+").replace(/_/g,"/"),c=atob(i),s=Uint8Array.from(c,E=>E.charCodeAt(0)),d=new DecompressionStream("deflate-raw"),u=d.writable.getWriter();u.write(s),u.close();const f=await new Response(d.readable).arrayBuffer(),p=new TextDecoder().decode(f);return JSON.parse(p)}function kA(o){return o.map(i=>{const c=i.author||null,s=i.imagePaths?.length?i.imagePaths:void 0;if(i.type===Ze.GLOBAL_COMMENT)return["G",i.text||"",c,s];const d=i.type[0];return d==="D"?["D",i.originalText,c,s]:[d,i.originalText,i.text||"",c,s]})}function PA(o){const i={D:Ze.DELETION,R:Ze.REPLACEMENT,C:Ze.COMMENT,I:Ze.INSERTION,G:Ze.GLOBAL_COMMENT};return o.map((c,s)=>{const d=c[0];if(d==="G"){const m=c[1],b=c[2],v=c[3];return{id:\`shared-\${s}-\${Date.now()}\`,blockId:"",startOffset:0,endOffset:0,type:Ze.GLOBAL_COMMENT,text:m||void 0,originalText:"",createdA:Date.now()+s,author:b||void 0,imagePaths:v?.length?v:void 0}}const u=c[1],f=d==="D"?void 0:c[2],p=d==="D"?c[2]:c[3],E=d==="D"?c[3]:c[4];return{id:\`shared-\${s}-\${Date.now()}\`,blockId:"",startOffset:0,endOffset:0,type:i[d],text:f||void 0,originalText:u,createdA:Date.now()+s,author:p||void 0,imagePaths:E?.length?E:void 0}})}const UA="https://share.plannotator.ai";async function zA(o,i,c){const s={p:o,a:kA(i),g:c?.length?c:void 0},d=await LA(s);return\`\${UA}/#\${d}\`}async function FA(){const o=window.location.hash.slice(1);if(!o)return null;try{return await wA(o)}catch(i){return console.warn("Failed to parse share hash:",i),null}}function BA(o){const i=new Blob([o]).size;return i<1024?\`\${i} B\`:\`\${(i/1024).toFixed(1)} KB\`}function GA(o,i,c,s,d,u,f){const[p,E]=Z.useState(!1),[m,b]=Z.useState(!0),[v,T]=Z.useState(""),[O,h]=Z.useState(""),[y,C]=Z.useState(null),[I,N]=Z.useState(null),x=Z.useCallback(()=>{C(null),N(null)},[]),V=Z.useCallback(async()=>{try{const U=await FA();if(U){s(U.p);const q=PA(U.a);return d(q),U.g?.length&&(u(U.g),N(U.g)),C(q),E(!0),f?.(),window.history.replaceState({},"",window.location.pathname),!0}return!1}catch(U){return console.error("Failed to load from share hash:",U),!1}},[s,d,u,f]);Z.useEffect(()=>{V().finally(()=>b(!1))},[]),Z.useEffect(()=>{const U=()=>{window.location.hash.length>1&&V()};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[V]);const z=Z.useCallback(async()=>{try{const U=await zA(o,i,c);T(U),h(BA(U))}catch(U){console.error("Failed to generate share URL:",U),T(""),h("")}},[o,i,c]);return Z.useEffect(()=>{z()},[z]),{isSharedSession:p,isLoadingShared:m,shareUrl:v,shareUrlSize:O,pendingSharedAnnotations:y,sharedGlobalAttachments:I,clearPendingSharedAnnotations:x,refreshShareUrl:z}}const YA="https://api.github.com/repos/backnotprop/plannotator/releases/latest";function KA(o,i){const c=u=>u.replace(/^v/,""),s=c(o).split(".").map(Number),d=c(i).split(".").map(Number);for(let u=0;u<Math.max(s.length,d.length);u++){const f=s[u]||0,p=d[u]||0;if(p>f)return!0;if(p<f)return!1}return!1}function qA(){const[o,i]=Z.useState(null);return Z.useEffect(()=>{(async()=>{try{const s="0.4.7",d=await fetch(YA);if(!d.ok)return;const u=await d.json(),f=u.tag_name,p=KA(s,f);i({currentVersion:s,latestVersion:f,updateAvailable:p,releaseUrl:u.html_url})}catch(s){console.debug("Update check failed:",s)}})()},[]),o}const QA="curl -fsSL https://plannotator.ai/install.sh | bash",HA=()=>{const o=qA(),[i,c]=Z.useState(!1),[s,d]=Z.useState(!1);if(!o?.updateAvailable||s)return null;const u=async()=>{try{await navigator.clipboard.writeText(QA),c(!0),setTimeout(()=>c(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return S.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:S.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:S.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center justify-between gap-2",children:[S.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),S.jsx("button",{onClick:()=>d(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:S.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),S.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[o.latestVersion," is available (you have ",o.currentVersion,")"]}),S.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[S.jsx("button",{onClick:u,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:i?"Copied!":"Copy install command"}),S.jsx("a",{href:o.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},VA=\`# Implementation Plan: Real-time Collaboration
575
575
 
576
576
  ## Overview
577
577
  Add real-time collaboration features to the editor using WebSocket connections and operational transforms.
@@ -845,7 +845,7 @@ export const CursorOverlay: React.FC<CursorOverlayProps> = ({
845
845
  ---
846
846
 
847
847
  **Target:** Ship MVP in next sprint
848
- \`,jA=()=>{const[o,i]=Z.useState(VA),[c,s]=Z.useState([]),[d,u]=Z.useState(null),[f,p]=Z.useState([]),[E,m]=Z.useState(!1),[b,v]=Z.useState(!1),[T,O]=Z.useState(!0),[h,y]=Z.useState("selection"),[C,I]=Z.useState(()=>Xt.getItem("plannotator-tater-mode")==="true"),[N,x]=Z.useState(!1),[V,z]=Z.useState(null),[U,q]=Z.useState([]),[A,G]=Z.useState(!0),[F,k]=Z.useState(!1),[K,ie]=Z.useState(null),[se,le]=Z.useState(null),w=Z.useRef(null),{isSharedSession:Y,isLoadingShared:J,shareUrl:ce,shareUrlSize:ue,pendingSharedAnnotations:D,clearPendingSharedAnnotations:W}=GA(o,c,U,i,s,q,()=>{G(!1)});Z.useEffect(()=>{if(D&&D.length>0){const he=setTimeout(()=>{w.current?.clearAllHighlights(),w.current?.applySharedAnnotations(D),W()},100);return()=>clearTimeout(he)}},[D,W]);const re=he=>{I(he),Xt.setItem("plannotator-tater-mode",String(he))};Z.useEffect(()=>{J||Y||fetch("/api/plan").then(he=>{if(!he.ok)throw new Error("Not in API mode");return he.json()}).then(he=>{i(he.plan),x(!0),he.origin&&z(he.origin)}).catch(()=>{x(!1)}).finally(()=>G(!1))},[J,Y]),Z.useEffect(()=>{p(PO(o))},[o]),Z.useEffect(()=>{const he=De=>{const Qe=De.clipboardData?.items;if(Qe){for(const tt of Qe)if(tt.type.startsWith("image/")){De.preventDefault();const dt=tt.getAsFile();if(dt){const ft=URL.createObjectURL(dt);le({file:dt,blobUrl:ft})}break}}};return document.addEventListener("paste",he),()=>document.removeEventListener("paste",he)},[]);const me=async(he,De)=>{if(se)try{const Qe=new FormData,tt=De?new File([he],"annotated.png",{type:"image/png"}):se.file;Qe.append("file",tt);const dt=await fetch("/api/upload",{method:"POST",body:Qe});if(dt.ok){const{path:ft}=await dt.json();q(yn=>[...yn,ft])}}catch{}finally{URL.revokeObjectURL(se.blobUrl),le(null)}},_=()=>{se&&(URL.revokeObjectURL(se.blobUrl),le(null))},oe=async()=>{k(!0);try{const he=bT(),De=hT(),Qe={};he.enabled&&he.vaultPath&&(Qe.obsidian={vaultPath:he.vaultPath,folder:he.folder||"plannotator",plan:o}),De.enabled&&(Qe.bear={plan:o}),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qe)}),ie("approved")}catch{k(!1)}},ne=async()=>{k(!0);try{await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Ue})}),ie("denied")}catch{k(!1)}},Ee=he=>{s(De=>[...De,he]),u(he.id),O(!0)},ve=he=>{w.current?.removeHighlight(he),s(De=>De.filter(Qe=>Qe.id!==he)),d===he&&u(null)},Oe=(he,De)=>{s(Qe=>Qe.map(tt=>tt.author===he?{...tt,author:De}:tt))},xe=he=>{q(De=>[...De,he])},ke=he=>{q(De=>De.filter(Qe=>Qe!==he))},Ue=Z.useMemo(()=>UO(f,c,U),[f,c,U]);return S.jsx(fA,{defaultTheme:"dark",children:S.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[C&&S.jsx(NA,{}),S.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl z-50",children:[S.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[S.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:S.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),S.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.4.6"]}),V&&S.jsx("span",{className:\`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline \${V==="claude-code"?"bg-orange-500/15 text-orange-400":"bg-zinc-500/20 text-zinc-400"}\`,children:V==="claude-code"?"Claude Code":"OpenCode"})]}),S.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[N&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:()=>{c.length===0?v(!0):ne()},disabled:F,className:\`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all \${F?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}\`,title:"Deny with Feedback",children:[S.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),S.jsx("span",{className:"hidden md:inline",children:F?"Sending...":"Deny with Feedback"})]}),S.jsxs("div",{className:"relative group/approve",children:[S.jsxs("button",{onClick:oe,disabled:F,className:\`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all \${F?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":V==="claude-code"&&c.length>0?"bg-green-600/50 text-white/70 hover:bg-green-600 hover:text-white":"bg-green-600 text-white hover:bg-green-500"}\`,children:[S.jsx("span",{className:"md:hidden",children:F?"...":"OK"}),S.jsx("span",{className:"hidden md:inline",children:F?"Approving...":"Approve"})]}),V==="claude-code"&&c.length>0&&S.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[S.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),S.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),"Claude Code doesn't support feedback on approval. Your annotations won't be seen."]})]}),S.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),S.jsx(bA,{}),S.jsx(MA,{taterMode:C,onTaterModeChange:re,onIdentityChange:Oe}),S.jsx("button",{onClick:()=>O(!T),className:\`p-1.5 rounded-md text-xs font-medium transition-all \${T?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}\`,children:S.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),S.jsxs("button",{onClick:()=>m(!0),className:"p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[S.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),S.jsx("span",{className:"hidden md:inline",children:"Export"})]})]})]}),S.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[S.jsx("main",{className:"flex-1 overflow-y-auto bg-grid",children:S.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[S.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:S.jsx(RA,{mode:h,onChange:y,taterMode:C})}),S.jsx(lA,{ref:w,blocks:f,markdown:o,annotations:c,onAddAnnotation:Ee,onSelectAnnotation:u,selectedAnnotationId:d,mode:h,taterMode:C,globalAttachments:U,onAddGlobalAttachment:xe,onRemoveGlobalAttachment:ke})]})}),S.jsx(mA,{isOpen:T,blocks:f,annotations:c,selectedId:d,onSelect:u,onDelete:ve,shareUrl:ce})]}),S.jsx(EA,{isOpen:E,onClose:()=>m(!1),shareUrl:ce,shareUrlSize:ue,diffOutput:Ue,annotationCount:c.length,taterSprite:C?S.jsx(Ep,{}):void 0}),b&&S.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:S.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-sm shadow-2xl p-6",children:[S.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[S.jsx("div",{className:"w-10 h-10 rounded-full bg-accent/20 flex items-center justify-center",children:S.jsx("svg",{className:"w-5 h-5 text-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),S.jsx("h3",{className:"font-semibold",children:"Add Annotations First"})]}),S.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"To provide feedback, select text in the plan and add annotations. Claude will use your annotations to revise the plan."}),S.jsx("div",{className:"flex justify-end",children:S.jsx("button",{onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Got it"})})]})}),K&&S.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:S.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[S.jsx("div",{className:\`mx-auto w-16 h-16 rounded-full flex items-center justify-center \${K==="approved"?"bg-green-500/20 text-green-500":"bg-accent/20 text-accent"}\`,children:K==="approved"?S.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):S.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("h2",{className:"text-xl font-semibold text-foreground",children:K==="approved"?"Plan Approved":"Feedback Sent"}),S.jsx("p",{className:"text-muted-foreground",children:K==="approved"?"Claude will proceed with the implementation.":"Claude will revise the plan based on your annotations."})]}),S.jsx("div",{className:"pt-4 border-t border-border",children:S.jsxs("p",{className:"text-sm text-muted-foreground",children:["Return to your ",S.jsx("span",{className:"text-foreground font-medium",children:"Claude Code terminal"})," to continue."]})})]})}),S.jsx(HA,{}),S.jsx(rT,{isOpen:!!se,imageSrc:se?.blobUrl??"",onAccept:me,onClose:_})]})})},TT=document.getElementById("root");if(!TT)throw new Error("Could not find root element to mount to");const WA=kO.createRoot(TT);WA.render(S.jsx(NO.StrictMode,{children:S.jsx(jA,{})}));</script>
848
+ \`,jA=()=>{const[o,i]=Z.useState(VA),[c,s]=Z.useState([]),[d,u]=Z.useState(null),[f,p]=Z.useState([]),[E,m]=Z.useState(!1),[b,v]=Z.useState(!1),[T,O]=Z.useState(!0),[h,y]=Z.useState("selection"),[C,I]=Z.useState(()=>Xt.getItem("plannotator-tater-mode")==="true"),[N,x]=Z.useState(!1),[V,z]=Z.useState(null),[U,q]=Z.useState([]),[A,G]=Z.useState(!0),[F,k]=Z.useState(!1),[K,ie]=Z.useState(null),[se,le]=Z.useState(null),w=Z.useRef(null),{isSharedSession:Y,isLoadingShared:J,shareUrl:ce,shareUrlSize:ue,pendingSharedAnnotations:D,clearPendingSharedAnnotations:W}=GA(o,c,U,i,s,q,()=>{G(!1)});Z.useEffect(()=>{if(D&&D.length>0){const he=setTimeout(()=>{w.current?.clearAllHighlights(),w.current?.applySharedAnnotations(D),W()},100);return()=>clearTimeout(he)}},[D,W]);const re=he=>{I(he),Xt.setItem("plannotator-tater-mode",String(he))};Z.useEffect(()=>{J||Y||fetch("/api/plan").then(he=>{if(!he.ok)throw new Error("Not in API mode");return he.json()}).then(he=>{i(he.plan),x(!0),he.origin&&z(he.origin)}).catch(()=>{x(!1)}).finally(()=>G(!1))},[J,Y]),Z.useEffect(()=>{p(PO(o))},[o]),Z.useEffect(()=>{const he=De=>{const Qe=De.clipboardData?.items;if(Qe){for(const tt of Qe)if(tt.type.startsWith("image/")){De.preventDefault();const dt=tt.getAsFile();if(dt){const ft=URL.createObjectURL(dt);le({file:dt,blobUrl:ft})}break}}};return document.addEventListener("paste",he),()=>document.removeEventListener("paste",he)},[]);const me=async(he,De)=>{if(se)try{const Qe=new FormData,tt=De?new File([he],"annotated.png",{type:"image/png"}):se.file;Qe.append("file",tt);const dt=await fetch("/api/upload",{method:"POST",body:Qe});if(dt.ok){const{path:ft}=await dt.json();q(yn=>[...yn,ft])}}catch{}finally{URL.revokeObjectURL(se.blobUrl),le(null)}},_=()=>{se&&(URL.revokeObjectURL(se.blobUrl),le(null))},oe=async()=>{k(!0);try{const he=bT(),De=hT(),Qe={};he.enabled&&he.vaultPath&&(Qe.obsidian={vaultPath:he.vaultPath,folder:he.folder||"plannotator",plan:o}),De.enabled&&(Qe.bear={plan:o}),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qe)}),ie("approved")}catch{k(!1)}},ne=async()=>{k(!0);try{await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Ue})}),ie("denied")}catch{k(!1)}},Ee=he=>{s(De=>[...De,he]),u(he.id),O(!0)},ve=he=>{w.current?.removeHighlight(he),s(De=>De.filter(Qe=>Qe.id!==he)),d===he&&u(null)},Oe=(he,De)=>{s(Qe=>Qe.map(tt=>tt.author===he?{...tt,author:De}:tt))},xe=he=>{q(De=>[...De,he])},ke=he=>{q(De=>De.filter(Qe=>Qe!==he))},Ue=Z.useMemo(()=>UO(f,c,U),[f,c,U]);return S.jsx(fA,{defaultTheme:"dark",children:S.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[C&&S.jsx(NA,{}),S.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl z-50",children:[S.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[S.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:S.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),S.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.4.7"]}),V&&S.jsx("span",{className:\`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline \${V==="claude-code"?"bg-orange-500/15 text-orange-400":"bg-zinc-500/20 text-zinc-400"}\`,children:V==="claude-code"?"Claude Code":"OpenCode"})]}),S.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[N&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:()=>{c.length===0?v(!0):ne()},disabled:F,className:\`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all \${F?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}\`,title:"Deny with Feedback",children:[S.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),S.jsx("span",{className:"hidden md:inline",children:F?"Sending...":"Deny with Feedback"})]}),S.jsxs("div",{className:"relative group/approve",children:[S.jsxs("button",{onClick:oe,disabled:F,className:\`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all \${F?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":V==="claude-code"&&c.length>0?"bg-green-600/50 text-white/70 hover:bg-green-600 hover:text-white":"bg-green-600 text-white hover:bg-green-500"}\`,children:[S.jsx("span",{className:"md:hidden",children:F?"...":"OK"}),S.jsx("span",{className:"hidden md:inline",children:F?"Approving...":"Approve"})]}),V==="claude-code"&&c.length>0&&S.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[S.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),S.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),"Claude Code doesn't support feedback on approval. Your annotations won't be seen."]})]}),S.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),S.jsx(bA,{}),S.jsx(MA,{taterMode:C,onTaterModeChange:re,onIdentityChange:Oe}),S.jsx("button",{onClick:()=>O(!T),className:\`p-1.5 rounded-md text-xs font-medium transition-all \${T?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}\`,children:S.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),S.jsxs("button",{onClick:()=>m(!0),className:"p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[S.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),S.jsx("span",{className:"hidden md:inline",children:"Export"})]})]})]}),S.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[S.jsx("main",{className:"flex-1 overflow-y-auto bg-grid",children:S.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[S.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:S.jsx(RA,{mode:h,onChange:y,taterMode:C})}),S.jsx(lA,{ref:w,blocks:f,markdown:o,annotations:c,onAddAnnotation:Ee,onSelectAnnotation:u,selectedAnnotationId:d,mode:h,taterMode:C,globalAttachments:U,onAddGlobalAttachment:xe,onRemoveGlobalAttachment:ke})]})}),S.jsx(mA,{isOpen:T,blocks:f,annotations:c,selectedId:d,onSelect:u,onDelete:ve,shareUrl:ce})]}),S.jsx(EA,{isOpen:E,onClose:()=>m(!1),shareUrl:ce,shareUrlSize:ue,diffOutput:Ue,annotationCount:c.length,taterSprite:C?S.jsx(Ep,{}):void 0}),b&&S.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm p-4",children:S.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-sm shadow-2xl p-6",children:[S.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[S.jsx("div",{className:"w-10 h-10 rounded-full bg-accent/20 flex items-center justify-center",children:S.jsx("svg",{className:"w-5 h-5 text-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),S.jsx("h3",{className:"font-semibold",children:"Add Annotations First"})]}),S.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"To provide feedback, select text in the plan and add annotations. Claude will use your annotations to revise the plan."}),S.jsx("div",{className:"flex justify-end",children:S.jsx("button",{onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Got it"})})]})}),K&&S.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:S.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[S.jsx("div",{className:\`mx-auto w-16 h-16 rounded-full flex items-center justify-center \${K==="approved"?"bg-green-500/20 text-green-500":"bg-accent/20 text-accent"}\`,children:K==="approved"?S.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):S.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("h2",{className:"text-xl font-semibold text-foreground",children:K==="approved"?"Plan Approved":"Feedback Sent"}),S.jsx("p",{className:"text-muted-foreground",children:K==="approved"?"Claude will proceed with the implementation.":"Claude will revise the plan based on your annotations."})]}),S.jsx("div",{className:"pt-4 border-t border-border",children:S.jsxs("p",{className:"text-sm text-muted-foreground",children:["Return to your ",S.jsx("span",{className:"text-foreground font-medium",children:"Claude Code terminal"})," to continue."]})})]})}),S.jsx(HA,{}),S.jsx(rT,{isOpen:!!se,imageSrc:se?.blobUrl??"",onAccept:me,onClose:_})]})})},TT=document.getElementById("root");if(!TT)throw new Error("Could not find root element to mount to");const WA=kO.createRoot(TT);WA.render(S.jsx(NO.StrictMode,{children:S.jsx(jA,{})}));</script>
849
849
  <style rel="stylesheet" crossorigin>pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
850
850
  Theme: GitHub Dark
851
851
  Description: Dark theme as seen on github.com
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plannotator/opencode",
3
- "version": "0.4.7-beta.0",
3
+ "version": "0.4.7",
4
4
  "description": "Plannotator plugin for OpenCode - interactive plan review with visual annotation",
5
5
  "author": "backnotprop",
6
6
  "license": "BSL-1.1",