opencode-plugin-hub 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gui-experimental.cjs +26 -16
- package/package.json +1 -1
- package/src/gui/admin.ts +19 -6
- package/src/gui/page.tsx +20 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("solid-js/web"),Ue=require("@opencode/plugin/gui"),c=require("effect"),Ge=require("node:child_process"),Me=require("node:os"),
|
|
2
|
-
`;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:const v=
|
|
3
|
-
`),
|
|
4
|
-
`+" ".repeat(r)),"\r":new Array(
|
|
5
|
-
`+" ".repeat(r))}," ":{"\n":new Array(
|
|
6
|
-
`+" ".repeat(r)),"\r":new Array(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("solid-js/web"),Ue=require("@opencode/plugin/gui"),c=require("effect"),Ge=require("node:child_process"),Me=require("node:os"),U=require("node:path"),W=require("node:fs/promises"),l=require("solid-js"),Dn=c.Schema.Struct({spec:c.Schema.String,name:c.Schema.String,kind:c.Schema.String,version:c.Schema.String,removable:c.Schema.Boolean}),rn=c.Schema.Struct({configPath:c.Schema.String,configKey:c.Schema.String,plugins:c.Schema.Array(Dn),error:c.Schema.String}),Nn=c.Schema.Struct({name:c.Schema.String,version:c.Schema.String,description:c.Schema.String,published:c.Schema.String,updated:c.Schema.String,installed:c.Schema.Boolean,current:c.Schema.String,hasUpdate:c.Schema.Boolean,weekly:c.Schema.Number,monthly:c.Schema.Number,publisher:c.Schema.String,license:c.Schema.String,keywords:c.Schema.Array(c.Schema.String),homepage:c.Schema.String,repo:c.Schema.String,npm:c.Schema.String}),Un=c.Schema.Struct({name:c.Schema.String,version:c.Schema.String,description:c.Schema.String,homepage:c.Schema.String,repo:c.Schema.String,repoDir:c.Schema.String,npm:c.Schema.String,bugs:c.Schema.String,license:c.Schema.String,keywords:c.Schema.Array(c.Schema.String),maintainers:c.Schema.Array(c.Schema.String),weekly:c.Schema.Number,monthly:c.Schema.Number,published:c.Schema.String,created:c.Schema.String,versions:c.Schema.Number,unpacked:c.Schema.Number,files:c.Schema.Number,dependencies:c.Schema.Array(c.Schema.String),deprecated:c.Schema.String,readme:c.Schema.String,readmeTruncated:c.Schema.Boolean,installed:c.Schema.Boolean,current:c.Schema.String,hasUpdate:c.Schema.Boolean,error:c.Schema.String}),Rn=c.Schema.Struct({spec:c.Schema.String,name:c.Schema.String,kind:c.Schema.String,current:c.Schema.String,latest:c.Schema.String,hasUpdate:c.Schema.Boolean,managed:c.Schema.Boolean,error:c.Schema.String}),Gn=c.Schema.Struct({items:c.Schema.Array(Rn),error:c.Schema.String}),Fn=c.Schema.Struct({hits:c.Schema.Array(Nn),error:c.Schema.String}),qn=c.Schema.Struct({name:c.Schema.String,pkg:c.Schema.String,version:c.Schema.String,type:c.Schema.String,desc:c.Schema.String,long:c.Schema.String,repo:c.Schema.String,tags:c.Schema.Array(c.Schema.String),installed:c.Schema.Boolean}),Hn=c.Schema.Struct({entries:c.Schema.Array(qn),source:c.Schema.String,registry:c.Schema.optional(c.Schema.String),fetchedAt:c.Schema.Number,error:c.Schema.String}),Vn=c.Schema.Struct({force:c.Schema.Boolean}),Wn=c.Schema.Struct({url:c.Schema.String}),ut=c.Schema.Struct({ok:c.Schema.Boolean}),gt=c.Schema.Struct({ok:c.Schema.Boolean,message:c.Schema.String,state:rn}),Jn=c.Schema.Struct({spec:c.Schema.String,name:c.Schema.String,status:c.Schema.Union([c.Schema.Literal("loaded"),c.Schema.Literal("failed"),c.Schema.Literal("unknown")]),runtimeVersion:c.Schema.String,error:c.Schema.String,available:c.Schema.Boolean}),Qn=c.Schema.Struct({items:c.Schema.Array(Jn),error:c.Schema.String}),Bt=c.Schema.Struct({spec:c.Schema.String,version:c.Schema.String}),Xn=c.Schema.Struct({query:c.Schema.String}),Yn=c.Schema.Struct({name:c.Schema.String}),Dt=Ue.Ipc.define({id:"plugin-hub.admin",methods:{snapshot:{output:rn},updates:{output:Gn},search:{input:Xn,output:Fn},detail:{input:Yn,output:Un},browse:{input:Vn,output:Hn},openUrl:{input:Wn,output:ut},openConfig:{output:ut},install:{input:Bt,output:gt},remove:{input:Bt,output:gt},reload:{output:gt},restart:{output:ut},runtime:{output:Qn}}});function on(e,r=!1){const o=e.length;let n=0,i="",s=0,d=16,p=0,u=0,f=0,h=0,x=0;function S(g,b){let C=0,w=0;for(;C<g;){let v=e.charCodeAt(n);if(v>=48&&v<=57)w=w*16+v-48;else if(v>=65&&v<=70)w=w*16+v-65+10;else if(v>=97&&v<=102)w=w*16+v-97+10;else break;n++,C++}return C<g&&(w=-1),w}function T(g){n=g,i="",s=0,d=16,x=0}function M(){let g=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Oe(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Oe(e.charCodeAt(n)))for(n++;n<e.length&&Oe(e.charCodeAt(n));)n++;else return x=3,e.substring(g,n);let b=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Oe(e.charCodeAt(n))){for(n++;n<e.length&&Oe(e.charCodeAt(n));)n++;b=n}else x=3;return e.substring(g,b)}function q(){let g="",b=n;for(;;){if(n>=o){g+=e.substring(b,n),x=2;break}const C=e.charCodeAt(n);if(C===34){g+=e.substring(b,n),n++;break}if(C===92){if(g+=e.substring(b,n),n++,n>=o){x=2;break}switch(e.charCodeAt(n++)){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
|
|
2
|
+
`;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:const v=S(4);v>=0?g+=String.fromCharCode(v):x=4;break;default:x=5}b=n;continue}if(C>=0&&C<=31)if(De(C)){g+=e.substring(b,n),x=2;break}else x=6;n++}return g}function z(){if(i="",x=0,s=n,u=p,h=f,n>=o)return s=o,d=17;let g=e.charCodeAt(n);if(ht(g)){do n++,i+=String.fromCharCode(g),g=e.charCodeAt(n);while(ht(g));return d=15}if(De(g))return n++,i+=String.fromCharCode(g),g===13&&e.charCodeAt(n)===10&&(n++,i+=`
|
|
3
|
+
`),p++,f=n,d=14;switch(g){case 123:return n++,d=1;case 125:return n++,d=2;case 91:return n++,d=3;case 93:return n++,d=4;case 58:return n++,d=6;case 44:return n++,d=5;case 34:return n++,i=q(),d=10;case 47:const b=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<o&&!De(e.charCodeAt(n));)n++;return i=e.substring(b,n),d=12}if(e.charCodeAt(n+1)===42){n+=2;const C=o-1;let w=!1;for(;n<C;){const v=e.charCodeAt(n);if(v===42&&e.charCodeAt(n+1)===47){n+=2,w=!0;break}n++,De(v)&&(v===13&&e.charCodeAt(n)===10&&n++,p++,f=n)}return w||(n++,x=1),i=e.substring(b,n),d=13}return i+=String.fromCharCode(g),n++,d=16;case 45:if(i+=String.fromCharCode(g),n++,n===o||!Oe(e.charCodeAt(n)))return d=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=M(),d=11;default:for(;n<o&&Q(g);)n++,g=e.charCodeAt(n);if(s!==n){switch(i=e.substring(s,n),i){case"true":return d=8;case"false":return d=9;case"null":return d=7}return d=16}return i+=String.fromCharCode(g),n++,d=16}}function Q(g){if(ht(g)||De(g))return!1;switch(g){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function j(){let g;do g=z();while(g>=12&&g<=15);return g}return{setPosition:T,getPosition:()=>n,scan:r?j:z,getToken:()=>d,getTokenValue:()=>i,getTokenOffset:()=>s,getTokenLength:()=>n-s,getTokenStartLine:()=>u,getTokenStartCharacter:()=>s-h,getTokenError:()=>x}}function ht(e){return e===32||e===9}function De(e){return e===10||e===13}function Oe(e){return e>=48&&e<=57}var Nt;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Nt||(Nt={}));const le=new Array(20).fill(0).map((e,r)=>" ".repeat(r)),Ie=200,Ut={" ":{"\n":new Array(Ie).fill(0).map((e,r)=>`
|
|
4
|
+
`+" ".repeat(r)),"\r":new Array(Ie).fill(0).map((e,r)=>"\r"+" ".repeat(r)),"\r\n":new Array(Ie).fill(0).map((e,r)=>`\r
|
|
5
|
+
`+" ".repeat(r))}," ":{"\n":new Array(Ie).fill(0).map((e,r)=>`
|
|
6
|
+
`+" ".repeat(r)),"\r":new Array(Ie).fill(0).map((e,r)=>"\r"+" ".repeat(r)),"\r\n":new Array(Ie).fill(0).map((e,r)=>`\r
|
|
7
7
|
`+" ".repeat(r))}},Zn=[`
|
|
8
8
|
`,"\r",`\r
|
|
9
|
-
`];function Kn(e,r,o){let n,
|
|
9
|
+
`];function Kn(e,r,o){let n,i,s,d,p;if(r){for(d=r.offset,p=d+r.length,s=d;s>0&&!Ze(e,s-1);)s--;let C=p;for(;C<e.length&&!Ze(e,C);)C++;i=e.substring(s,C),n=er(i,o)}else i=e,n=0,s=0,d=0,p=e.length;const u=tr(o,e),f=Zn.includes(u);let h=0,x=0,S;o.insertSpaces?S=le[o.tabSize||4]??Te(le[1],o.tabSize||4):S=" ";const T=S===" "?" ":" ";let M=on(i,!1),q=!1;function z(){if(h>1)return Te(u,h)+Te(S,n+x);const C=S.length*(n+x);return!f||C>Ut[T][u].length?u+Te(S,n+x):C<=0?u:Ut[T][u][C]}function Q(){let C=M.scan();for(h=0;C===15||C===14;)C===14&&o.keepLines?h+=1:C===14&&(h=1),C=M.scan();return q=C===16||M.getTokenError()!==0,C}const j=[];function g(C,w,v){!q&&(!r||w<p&&v>d)&&e.substring(w,v)!==C&&j.push({offset:w,length:v-w,content:C})}let b=Q();if(o.keepLines&&h>0&&g(Te(u,h),0,0),b!==17){let C=M.getTokenOffset()+s,w=S.length*n<20&&o.insertSpaces?le[S.length*n]:Te(S,n);g(w,s,C)}for(;b!==17;){let C=M.getTokenOffset()+M.getTokenLength()+s,w=Q(),v="",Y=!1;for(;h===0&&(w===12||w===13);){let de=M.getTokenOffset()+s;g(le[1],C,de),C=M.getTokenOffset()+M.getTokenLength()+s,Y=w===12,v=Y?z():"",w=Q()}if(w===2)b!==1&&x--,o.keepLines&&h>0||!o.keepLines&&b!==1?v=z():o.keepLines&&(v=le[1]);else if(w===4)b!==3&&x--,o.keepLines&&h>0||!o.keepLines&&b!==3?v=z():o.keepLines&&(v=le[1]);else{switch(b){case 3:case 1:x++,o.keepLines&&h>0||!o.keepLines?v=z():v=le[1];break;case 5:o.keepLines&&h>0||!o.keepLines?v=z():v=le[1];break;case 12:v=z();break;case 13:h>0?v=z():Y||(v=le[1]);break;case 6:o.keepLines&&h>0?v=z():Y||(v=le[1]);break;case 10:o.keepLines&&h>0?v=z():w===6&&!Y&&(v="");break;case 7:case 8:case 9:case 11:case 2:case 4:o.keepLines&&h>0?v=z():(w===12||w===13)&&!Y?v=le[1]:w!==5&&w!==17&&(q=!0);break;case 16:q=!0;break}h>0&&(w===12||w===13)&&(v=z())}w===17&&(o.keepLines&&h>0?v=z():v=o.insertFinalNewline?u:"");const pe=M.getTokenOffset()+s;g(v,C,pe),b=w}return j}function Te(e,r){let o="";for(let n=0;n<r;n++)o+=e;return o}function er(e,r){let o=0,n=0;const i=r.tabSize||4;for(;o<e.length;){let s=e.charAt(o);if(s===le[1])n++;else if(s===" ")n+=i;else break;o++}return Math.floor(n/i)}function tr(e,r){for(let o=0;o<r.length;o++){const n=r.charAt(o);if(n==="\r")return o+1<r.length&&r.charAt(o+1)===`
|
|
10
10
|
`?`\r
|
|
11
11
|
`:"\r";if(n===`
|
|
12
12
|
`)return`
|
|
13
13
|
`}return e&&e.eol||`
|
|
14
|
-
`}function
|
|
15
|
-
`.indexOf(e.charAt(r))!==-1}var Re;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Re||(Re={}));function nr(e,r=[],o=Re.DEFAULT){let n=null,a=[];const s=[];function p(d){Array.isArray(a)?a.push(d):n!==null&&(a[n]=d)}return on(e,{onObjectBegin:()=>{const d={};p(d),s.push(a),a=d,n=null},onObjectProperty:d=>{n=d},onObjectEnd:()=>{a=s.pop()},onArrayBegin:()=>{const d=[];p(d),s.push(a),a=d,n=null},onArrayEnd:()=>{a=s.pop()},onLiteralValue:p,onError:(d,f,m)=>{r.push({error:d,offset:f,length:m})}},o),a[0]}function rr(e,r=[],o=Re.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function a(d){n.type==="property"&&(n.length=d-n.offset,n=n.parent)}function s(d){return n.children.push(d),d}on(e,{onObjectBegin:d=>{n=s({type:"object",offset:d,length:-1,parent:n,children:[]})},onObjectProperty:(d,f,m)=>{n=s({type:"property",offset:f,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:d,offset:f,length:m,parent:n})},onObjectEnd:(d,f)=>{a(d+f),n.length=d+f-n.offset,n=n.parent,a(d+f)},onArrayBegin:(d,f)=>{n=s({type:"array",offset:d,length:-1,parent:n,children:[]})},onArrayEnd:(d,f)=>{n.length=d+f-n.offset,n=n.parent,a(d+f)},onLiteralValue:(d,f,m)=>{s({type:or(d),offset:f,length:m,parent:n,value:d}),a(f+m)},onSeparator:(d,f,m)=>{n.type==="property"&&(d===":"?n.colonOffset=f:d===","&&a(f))},onError:(d,f,m)=>{r.push({error:d,offset:f,length:m})}},o);const u=n.children[0];return u&&delete u.parent,u}function Ut(e,r){if(!e)return;let o=e;for(let n of r)if(typeof n=="string"){if(o.type!=="object"||!Array.isArray(o.children))return;let a=!1;for(const s of o.children)if(Array.isArray(s.children)&&s.children[0].value===n&&s.children.length===2){o=s.children[1],a=!0;break}if(!a)return}else{const a=n;if(o.type!=="array"||a<0||!Array.isArray(o.children)||a>=o.children.length)return;o=o.children[a]}return o}function on(e,r,o=Re.DEFAULT){const n=rn(e,!1),a=[];let s=0;function p(T){return T?()=>s===0&&T(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function u(T){return T?U=>s===0&&T(U,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function d(T){return T?U=>s===0&&T(U,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice()):()=>!0}function f(T){return T?()=>{s>0?s++:T(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice())===!1&&(s=1)}:()=>!0}function m(T){return T?()=>{s>0&&s--,s===0&&T(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const k=f(r.onObjectBegin),C=d(r.onObjectProperty),I=m(r.onObjectEnd),M=f(r.onArrayBegin),q=m(r.onArrayEnd),j=d(r.onLiteralValue),J=u(r.onSeparator),z=p(r.onComment),g=u(r.onError),b=o&&o.disallowComments,S=o&&o.allowTrailingComma;function w(){for(;;){const T=n.scan();switch(n.getTokenError()){case 4:v(14);break;case 5:v(15);break;case 3:v(13);break;case 1:b||v(11);break;case 2:v(12);break;case 6:v(16);break}switch(T){case 12:case 13:b?v(10):z();break;case 16:v(1);break;case 15:case 14:break;default:return T}}}function v(T,U=[],Ce=[]){if(g(T),U.length+Ce.length>0){let xe=n.getToken();for(;xe!==17;){if(U.indexOf(xe)!==-1){w();break}else if(Ce.indexOf(xe)!==-1)break;xe=w()}}}function Y(T){const U=n.getTokenValue();return T?j(U):(C(U),a.push(U)),w(),!0}function pe(){switch(n.getToken()){case 11:const T=n.getTokenValue();let U=Number(T);isNaN(U)&&(v(2),U=0),j(U);break;case 7:j(null);break;case 8:j(!0);break;case 9:j(!1);break;default:return!1}return w(),!0}function de(){return n.getToken()!==10?(v(3,[],[2,5]),!1):(Y(!1),n.getToken()===6?(J(":"),w(),K()||v(4,[],[2,5])):v(5,[],[2,5]),a.pop(),!0)}function ke(){k(),w();let T=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(T||v(4,[],[]),J(","),w(),n.getToken()===2&&S)break}else T&&v(6,[],[]);de()||v(4,[],[2,5]),T=!0}return I(),n.getToken()!==2?v(7,[2],[]):w(),!0}function $e(){M(),w();let T=!0,U=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(U||v(4,[],[]),J(","),w(),n.getToken()===4&&S)break}else U&&v(6,[],[]);T?(a.push(0),T=!1):a[a.length-1]++,K()||v(4,[],[4,5]),U=!0}return q(),T||a.pop(),n.getToken()!==4?v(8,[4],[]):w(),!0}function K(){switch(n.getToken()){case 3:return $e();case 1:return ke();case 10:return Y(!0);default:return pe()}}return w(),n.getToken()===17?o.allowEmptyContent?!0:(v(4,[],[]),!1):K()?(n.getToken()!==17&&v(9,[],[]),!0):(v(4,[],[]),!1)}function or(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function ir(e,r,o,n){const a=r.slice(),p=rr(e,[]);let u,d;for(;a.length>0&&(d=a.pop(),u=Ut(p,a),u===void 0&&o!==void 0);)typeof d=="string"?o={[d]:o}:o=[o];if(u)if(u.type==="object"&&typeof d=="string"&&Array.isArray(u.children)){const f=Ut(u,[d]);if(f!==void 0)if(o===void 0){if(!f.parent)throw new Error("Malformed AST");const m=u.children.indexOf(f.parent);let k,C=f.parent.offset+f.parent.length;if(m>0){let I=u.children[m-1];k=I.offset+I.length}else k=u.offset+1,u.children.length>1&&(C=u.children[1].offset);return Se(e,{offset:k,length:C-k,content:""},n)}else return Se(e,{offset:f.offset,length:f.length,content:JSON.stringify(o)},n);else{if(o===void 0)return[];const m=`${JSON.stringify(d)}: ${JSON.stringify(o)}`,k=n.getInsertionIndex?n.getInsertionIndex(u.children.map(I=>I.children[0].value)):u.children.length;let C;if(k>0){let I=u.children[k-1];C={offset:I.offset+I.length,length:0,content:","+m}}else u.children.length===0?C={offset:u.offset+1,length:0,content:m}:C={offset:u.offset+1,length:0,content:m+","};return Se(e,C,n)}}else if(u.type==="array"&&typeof d=="number"&&Array.isArray(u.children)){const f=d;if(f===-1){const m=`${JSON.stringify(o)}`;let k;if(u.children.length===0)k={offset:u.offset+1,length:0,content:m};else{const C=u.children[u.children.length-1];k={offset:C.offset+C.length,length:0,content:","+m}}return Se(e,k,n)}else if(o===void 0&&u.children.length>=0){const m=d,k=u.children[m];let C;if(u.children.length===1)C={offset:u.offset+1,length:u.length-2,content:""};else if(u.children.length-1===m){let I=u.children[m-1],M=I.offset+I.length,q=u.offset+u.length;C={offset:M,length:q-2-M,content:""}}else C={offset:k.offset,length:u.children[m+1].offset-k.offset,content:""};return Se(e,C,n)}else if(o!==void 0){let m;const k=`${JSON.stringify(o)}`;if(!n.isArrayInsertion&&u.children.length>d){const C=u.children[d];m={offset:C.offset,length:C.length,content:k}}else if(u.children.length===0||d===0)m={offset:u.offset+1,length:0,content:u.children.length===0?k:k+","};else{const C=d>u.children.length?u.children.length:d,I=u.children[C-1];m={offset:I.offset+I.length,length:0,content:","+k}}return Se(e,m,n)}else throw new Error(`Can not ${o===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${f} as length is not sufficient`)}else throw new Error(`Can not add ${typeof d!="number"?"index":"property"} to parent of type ${u.type}`);else{if(o===void 0)throw new Error("Can not delete in empty document");return Se(e,{offset:p?p.offset:0,length:p?p.length:0,content:JSON.stringify(o)},n)}}function Se(e,r,o){if(!o.formattingOptions)return[r];let n=bt(e,r),a=r.offset,s=r.offset+r.content.length;if(r.length===0||r.content.length===0){for(;a>0&&!Xe(n,a-1);)a--;for(;s<n.length&&!Xe(n,s);)s++}const p=Kn(n,{offset:a,length:s-a},{...o.formattingOptions,keepLines:!1});for(let d=p.length-1;d>=0;d--){const f=p[d];n=bt(n,f),a=Math.min(a,f.offset),s=Math.max(s,f.offset+f.length),s+=f.content.length-f.length}const u=e.length-(n.length-s)-a;return[{offset:a,length:u,content:n.substring(a,s)}]}function bt(e,r){return e.substring(0,r.offset)+r.content+e.substring(r.offset+r.length)}var Rt;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Rt||(Rt={}));var Gt;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Gt||(Gt={}));const ar=nr;var Ft;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Ft||(Ft={}));function sr(e,r,o,n){return ir(e,r,o,n)}function lr(e,r){let o=r.slice(0).sort((a,s)=>{const p=a.offset-s.offset;return p===0?a.length-s.length:p}),n=e.length;for(let a=o.length-1;a>=0;a--){let s=o[a];if(s.offset+s.length<=n)e=bt(e,s);else throw new Error("Overlapping edit");n=s.offset}return e}const an="opencode-plugin-hub",qt="opencode-plugin",cr=300*1e3;function sn(){const e=process.env.XDG_CONFIG_HOME;return e?R.join(e,"opencode"):R.join(Me.homedir(),".config","opencode")}function pr(){const e=process.env.XDG_CACHE_HOME;return e?R.join(e,"opencode","npm"):R.join(Me.homedir(),".cache","opencode","npm")}async function we(){const e=sn(),r=[R.join(e,"opencode.json"),R.join(e,"opencode.jsonc")];let o;for(const n of r){let a;try{a=await V.readFile(n,"utf8")}catch{continue}const p=ar(a,[],{allowTrailingComma:!0,disallowComments:!1}),u=p&&typeof p=="object"?p:{},d=Array.isArray(u.plugins)?"plugins":Array.isArray(u.plugin)?"plugin":"plugins",f=Array.isArray(u[d])?u[d].filter(k=>typeof k=="string"):[],m={path:n,text:a,key:d,plugins:f};if(m.plugins.length>0)return m;o||(o=m)}return o||{path:R.join(e,"opencode.json"),text:`{}
|
|
16
|
-
`,key:"plugins",plugins:[]}}function
|
|
17
|
-
`,
|
|
18
|
-
`}});return await mr(n.path,lr(
|
|
19
|
-
`);return{text:`${o>
|
|
14
|
+
`}function Ze(e,r){return`\r
|
|
15
|
+
`.indexOf(e.charAt(r))!==-1}var Re;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Re||(Re={}));function nr(e,r=[],o=Re.DEFAULT){let n=null,i=[];const s=[];function d(u){Array.isArray(i)?i.push(u):n!==null&&(i[n]=u)}return an(e,{onObjectBegin:()=>{const u={};d(u),s.push(i),i=u,n=null},onObjectProperty:u=>{n=u},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{const u=[];d(u),s.push(i),i=u,n=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:d,onError:(u,f,h)=>{r.push({error:u,offset:f,length:h})}},o),i[0]}function rr(e,r=[],o=Re.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(u){n.type==="property"&&(n.length=u-n.offset,n=n.parent)}function s(u){return n.children.push(u),u}an(e,{onObjectBegin:u=>{n=s({type:"object",offset:u,length:-1,parent:n,children:[]})},onObjectProperty:(u,f,h)=>{n=s({type:"property",offset:f,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:u,offset:f,length:h,parent:n})},onObjectEnd:(u,f)=>{i(u+f),n.length=u+f-n.offset,n=n.parent,i(u+f)},onArrayBegin:(u,f)=>{n=s({type:"array",offset:u,length:-1,parent:n,children:[]})},onArrayEnd:(u,f)=>{n.length=u+f-n.offset,n=n.parent,i(u+f)},onLiteralValue:(u,f,h)=>{s({type:or(u),offset:f,length:h,parent:n,value:u}),i(f+h)},onSeparator:(u,f,h)=>{n.type==="property"&&(u===":"?n.colonOffset=f:u===","&&i(f))},onError:(u,f,h)=>{r.push({error:u,offset:f,length:h})}},o);const p=n.children[0];return p&&delete p.parent,p}function Rt(e,r){if(!e)return;let o=e;for(let n of r)if(typeof n=="string"){if(o.type!=="object"||!Array.isArray(o.children))return;let i=!1;for(const s of o.children)if(Array.isArray(s.children)&&s.children[0].value===n&&s.children.length===2){o=s.children[1],i=!0;break}if(!i)return}else{const i=n;if(o.type!=="array"||i<0||!Array.isArray(o.children)||i>=o.children.length)return;o=o.children[i]}return o}function an(e,r,o=Re.DEFAULT){const n=on(e,!1),i=[];let s=0;function d(I){return I?()=>s===0&&I(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function p(I){return I?R=>s===0&&I(R,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function u(I){return I?R=>s===0&&I(R,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice()):()=>!0}function f(I){return I?()=>{s>0?s++:I(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice())===!1&&(s=1)}:()=>!0}function h(I){return I?()=>{s>0&&s--,s===0&&I(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const x=f(r.onObjectBegin),S=u(r.onObjectProperty),T=h(r.onObjectEnd),M=f(r.onArrayBegin),q=h(r.onArrayEnd),z=u(r.onLiteralValue),Q=p(r.onSeparator),j=d(r.onComment),g=p(r.onError),b=o&&o.disallowComments,C=o&&o.allowTrailingComma;function w(){for(;;){const I=n.scan();switch(n.getTokenError()){case 4:v(14);break;case 5:v(15);break;case 3:v(13);break;case 1:b||v(11);break;case 2:v(12);break;case 6:v(16);break}switch(I){case 12:case 13:b?v(10):j();break;case 16:v(1);break;case 15:case 14:break;default:return I}}}function v(I,R=[],Ce=[]){if(g(I),R.length+Ce.length>0){let xe=n.getToken();for(;xe!==17;){if(R.indexOf(xe)!==-1){w();break}else if(Ce.indexOf(xe)!==-1)break;xe=w()}}}function Y(I){const R=n.getTokenValue();return I?z(R):(S(R),i.push(R)),w(),!0}function pe(){switch(n.getToken()){case 11:const I=n.getTokenValue();let R=Number(I);isNaN(R)&&(v(2),R=0),z(R);break;case 7:z(null);break;case 8:z(!0);break;case 9:z(!1);break;default:return!1}return w(),!0}function de(){return n.getToken()!==10?(v(3,[],[2,5]),!1):(Y(!1),n.getToken()===6?(Q(":"),w(),K()||v(4,[],[2,5])):v(5,[],[2,5]),i.pop(),!0)}function ke(){x(),w();let I=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(I||v(4,[],[]),Q(","),w(),n.getToken()===2&&C)break}else I&&v(6,[],[]);de()||v(4,[],[2,5]),I=!0}return T(),n.getToken()!==2?v(7,[2],[]):w(),!0}function $e(){M(),w();let I=!0,R=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(R||v(4,[],[]),Q(","),w(),n.getToken()===4&&C)break}else R&&v(6,[],[]);I?(i.push(0),I=!1):i[i.length-1]++,K()||v(4,[],[4,5]),R=!0}return q(),I||i.pop(),n.getToken()!==4?v(8,[4],[]):w(),!0}function K(){switch(n.getToken()){case 3:return $e();case 1:return ke();case 10:return Y(!0);default:return pe()}}return w(),n.getToken()===17?o.allowEmptyContent?!0:(v(4,[],[]),!1):K()?(n.getToken()!==17&&v(9,[],[]),!0):(v(4,[],[]),!1)}function or(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function ir(e,r,o,n){const i=r.slice(),d=rr(e,[]);let p,u;for(;i.length>0&&(u=i.pop(),p=Rt(d,i),p===void 0&&o!==void 0);)typeof u=="string"?o={[u]:o}:o=[o];if(p)if(p.type==="object"&&typeof u=="string"&&Array.isArray(p.children)){const f=Rt(p,[u]);if(f!==void 0)if(o===void 0){if(!f.parent)throw new Error("Malformed AST");const h=p.children.indexOf(f.parent);let x,S=f.parent.offset+f.parent.length;if(h>0){let T=p.children[h-1];x=T.offset+T.length}else x=p.offset+1,p.children.length>1&&(S=p.children[1].offset);return Se(e,{offset:x,length:S-x,content:""},n)}else return Se(e,{offset:f.offset,length:f.length,content:JSON.stringify(o)},n);else{if(o===void 0)return[];const h=`${JSON.stringify(u)}: ${JSON.stringify(o)}`,x=n.getInsertionIndex?n.getInsertionIndex(p.children.map(T=>T.children[0].value)):p.children.length;let S;if(x>0){let T=p.children[x-1];S={offset:T.offset+T.length,length:0,content:","+h}}else p.children.length===0?S={offset:p.offset+1,length:0,content:h}:S={offset:p.offset+1,length:0,content:h+","};return Se(e,S,n)}}else if(p.type==="array"&&typeof u=="number"&&Array.isArray(p.children)){const f=u;if(f===-1){const h=`${JSON.stringify(o)}`;let x;if(p.children.length===0)x={offset:p.offset+1,length:0,content:h};else{const S=p.children[p.children.length-1];x={offset:S.offset+S.length,length:0,content:","+h}}return Se(e,x,n)}else if(o===void 0&&p.children.length>=0){const h=u,x=p.children[h];let S;if(p.children.length===1)S={offset:p.offset+1,length:p.length-2,content:""};else if(p.children.length-1===h){let T=p.children[h-1],M=T.offset+T.length,q=p.offset+p.length;S={offset:M,length:q-2-M,content:""}}else S={offset:x.offset,length:p.children[h+1].offset-x.offset,content:""};return Se(e,S,n)}else if(o!==void 0){let h;const x=`${JSON.stringify(o)}`;if(!n.isArrayInsertion&&p.children.length>u){const S=p.children[u];h={offset:S.offset,length:S.length,content:x}}else if(p.children.length===0||u===0)h={offset:p.offset+1,length:0,content:p.children.length===0?x:x+","};else{const S=u>p.children.length?p.children.length:u,T=p.children[S-1];h={offset:T.offset+T.length,length:0,content:","+x}}return Se(e,h,n)}else throw new Error(`Can not ${o===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${f} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${p.type}`);else{if(o===void 0)throw new Error("Can not delete in empty document");return Se(e,{offset:d?d.offset:0,length:d?d.length:0,content:JSON.stringify(o)},n)}}function Se(e,r,o){if(!o.formattingOptions)return[r];let n=bt(e,r),i=r.offset,s=r.offset+r.content.length;if(r.length===0||r.content.length===0){for(;i>0&&!Ze(n,i-1);)i--;for(;s<n.length&&!Ze(n,s);)s++}const d=Kn(n,{offset:i,length:s-i},{...o.formattingOptions,keepLines:!1});for(let u=d.length-1;u>=0;u--){const f=d[u];n=bt(n,f),i=Math.min(i,f.offset),s=Math.max(s,f.offset+f.length),s+=f.content.length-f.length}const p=e.length-(n.length-s)-i;return[{offset:i,length:p,content:n.substring(i,s)}]}function bt(e,r){return e.substring(0,r.offset)+r.content+e.substring(r.offset+r.length)}var Gt;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Gt||(Gt={}));var Ft;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ft||(Ft={}));const ar=nr;var qt;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(qt||(qt={}));function sr(e,r,o,n){return ir(e,r,o,n)}function lr(e,r){let o=r.slice(0).sort((i,s)=>{const d=i.offset-s.offset;return d===0?i.length-s.length:d}),n=e.length;for(let i=o.length-1;i>=0;i--){let s=o[i];if(s.offset+s.length<=n)e=bt(e,s);else throw new Error("Overlapping edit");n=s.offset}return e}const sn="opencode-plugin-hub",Ht="opencode-plugin",cr=300*1e3;function $t(){const e=process.env.XDG_CONFIG_HOME;return e?U.join(e,"opencode"):U.join(Me.homedir(),".config","opencode")}function pr(){const e=process.env.XDG_CACHE_HOME;return e?U.join(e,"opencode","npm"):U.join(Me.homedir(),".cache","opencode","npm")}async function we(){const e=$t(),r=[U.join(e,"opencode.json"),U.join(e,"opencode.jsonc")];let o;for(const n of r){let i;try{i=await W.readFile(n,"utf8")}catch{continue}const d=ar(i,[],{allowTrailingComma:!0,disallowComments:!1}),p=d&&typeof d=="object"?d:{},u=Array.isArray(p.plugins)?"plugins":Array.isArray(p.plugin)?"plugin":"plugins",f=Array.isArray(p[u])?p[u].filter(x=>typeof x=="string"):[],h={path:n,text:i,key:u,plugins:f};if(h.plugins.length>0)return h;o||(o=h)}return o||{path:U.join(e,"opencode.json"),text:`{}
|
|
16
|
+
`,key:"plugins",plugins:[]}}function rt(e){if(!/^(@[a-z0-9-_.]+\/)?[a-z0-9-_.]+$/i.test(e)||e.includes(".."))return!1;const r=e.split("/").pop()??e;return r.length>0&&!r.startsWith(".")}function ye(e){const r=e.trim();if(r.startsWith("/")||r.startsWith(".")||r.startsWith("~/"))return{name:r.replace(/\/+$/,"").split("/").pop()??r,range:"",kind:"path"};const o=r.startsWith("@"),n=r.indexOf("@",o?1:0);return n>0?{name:r.slice(0,n),range:r.slice(n+1),kind:"package"}:{name:r,range:"",kind:"package"}}function ot(e){const r=e.trim();return r==="~"?Me.homedir():r.startsWith("~/")?U.join(Me.homedir(),r.slice(2)):U.isAbsolute(r)?r:U.resolve($t(),r)}async function Ke(e){try{const r=await W.readFile(U.join(e,"package.json"),"utf8"),o=JSON.parse(r);return typeof o=="object"&&o!==null?o:void 0}catch{return}}async function dr(e,r){const o=r&&r!=="latest"?r:"latest",n=Array.from(new Set([`${e}@${o}`,`${e}@latest`]));for(const i of n){const s=U.join(pr(),i);let d;try{d=await W.readdir(s)}catch{continue}for(const p of d.reverse())try{const u=U.join(s,p,"node_modules",e,"package.json"),f=await W.readFile(u,"utf8"),h=JSON.parse(f);if(h.version)return h.version}catch{}}return""}function ur(e){const r=e.trim().replace(/^[\^~=v]+/,"").replace(/^>\=?|^<\=?/,"");return/^\d+(\.\d+)*([-+][\w.-]+)?$/.test(r)?r:""}function Vt(e){return e.split("-")[0].split(".").map(r=>Number.parseInt(r,10)||0)}function Ct(e,r){if(!e)return!1;if(!r)return!0;const o=Vt(e),n=Vt(r);for(let i=0;i<Math.max(o.length,n.length);i+=1){const s=o[i]??0,d=n[i]??0;if(s!==d)return s>d}return!1}const Wt=new Map;async function gr(e,r=!1){const o=Wt.get(e);if(!r&&o&&Date.now()-o.at<cr)return o.value;const n=`https://registry.npmjs.org/${e.replace("/","%2f")}`;let i;try{i=await fetch(n,{signal:AbortSignal.timeout(1e4),headers:{accept:"application/vnd.npm.install-v1+json"}})}catch{return{version:"",ok:!1}}if(i.status===404)return{version:"",ok:!0};if(!i.ok)return{version:"",ok:!1};try{const s=await i.json(),d=Object.keys(s.versions??{});if(d.length===0)return{version:"",ok:!0};const p=s["dist-tags"]?.latest,u={version:p&&d.includes(p)?p:d[d.length-1]??"",ok:!0};return Wt.set(e,{at:Date.now(),value:u}),u}catch{return{version:"",ok:!1}}}async function ln(e){const r=ye(e);if(r.kind!=="path"){const n=ur(r.range)||await dr(r.name,r.range);return{spec:e,name:r.name,kind:r.kind,version:n}}const o=await Ke(ot(e));return{spec:e,name:o?.name&&rt(o.name)?o.name:r.name,kind:"path",version:o?.version??""}}async function it(e){return Promise.all(e.plugins.map(r=>ln(r)))}async function ge(){try{const e=await we(),o=(await it(e)).map(n=>({spec:n.spec,name:n.name,kind:n.kind,version:n.version,removable:n.name!==sn}));return{configPath:e.path,configKey:e.key,plugins:o,error:""}}catch(e){return{configPath:U.join($t(),"opencode.json"),configKey:"plugins",plugins:[],error:ce(e)}}}async function hr(){try{const e=await we(),r=await it(e);return{items:await Promise.all(r.map(async n=>{const i=rt(n.name),s=i?await gr(n.name):{version:"",ok:!1};return{spec:n.spec,name:n.name,kind:n.kind,current:n.version,latest:s.version,hasUpdate:s.ok&&Ct(s.version,n.version),managed:n.kind!=="path",error:i?s.ok?"":"无法连接 npm registry,本次未检查":"不是 npm 包名,无法查询版本"}})),error:""}}catch(e){return{items:[],error:ce(e)}}}let Jt=Promise.resolve();function cn(e){const r=Jt.then(e,e);return Jt=r.catch(()=>{}),r}async function yt(e,r,o){return cn(async()=>{const n=await we(),i=n.text.trim().length>0?n.text:`{}
|
|
17
|
+
`,d=sr(i,r,o,{formattingOptions:{insertSpaces:!0,tabSize:2,eol:`
|
|
18
|
+
`}});return await mr(n.path,lr(i,d)),ge()})}async function mr(e,r){const o=`${e}.plugin-hub-${process.pid}-${Date.now()}.tmp`;try{await W.writeFile(o,r,"utf8"),await W.rename(o,e)}finally{await W.rm(o,{force:!0}).catch(()=>{})}}async function fr(e,r){for(const[o,n]of e.plugins.entries())if(ye(n).name===r)return o;for(const[o,n]of e.plugins.entries()){if(ye(n).kind!=="path")continue;if((await Ke(ot(n)))?.name===r)return o}return-1}async function vr(e,r){const o=`https://registry.npmjs.org/${e.replace("/","%2f")}`;try{const n=await fetch(o,{signal:AbortSignal.timeout(15e3),headers:{accept:"application/vnd.npm.install-v1+json"}});if(!n.ok)return;const i=await n.json(),s=r||i["dist-tags"]?.latest||"",p=(s?i.versions?.[s]:void 0)?.dist?.tarball;return p?{tarball:p,version:s}:void 0}catch{return}}async function _t(e,r){const o=await W.readdir(e,{withFileTypes:!0});await W.mkdir(r,{recursive:!0});for(const n of o){const i=U.join(e,n.name),s=U.join(r,n.name);n.isDirectory()?await _t(i,s):n.isFile()&&await W.copyFile(i,s)}}async function br(e,r){const o=new Set(await W.readdir(e));for(const n of await W.readdir(r,{withFileTypes:!0}))o.has(n.name)||await W.rm(U.join(r,n.name),{recursive:!0,force:!0});await _t(e,r)}function Qt(e,r,o){return new Promise(n=>{const i=Ge.spawn(e,r,{cwd:o,stdio:["ignore","pipe","pipe"]});let s="";i.stdout?.on("data",d=>s+=String(d)),i.stderr?.on("data",d=>s+=String(d)),i.on("error",d=>n({code:-1,output:ce(d)})),i.on("close",d=>n({code:d??-1,output:s}))})}async function yr(e,r,o){const n=await vr(r,o);if(!n)return{ok:!1,message:"在 npm 上找不到这个版本"};let i="";try{i=await W.mkdtemp(U.join(Me.tmpdir(),"plugin-hub-"));const s=U.join(i,"package.tgz"),d=await fetch(n.tarball,{signal:AbortSignal.timeout(6e4)});if(!d.ok)return{ok:!1,message:`下载失败:${d.status}`};await W.writeFile(s,Buffer.from(await d.arrayBuffer()));const p=U.join(i,"unpacked");await W.mkdir(p,{recursive:!0});const u=await Qt("tar",["-xzf",s,"-C",p],i);if(u.code!==0)return{ok:!1,message:`解包失败:${u.output.slice(0,160)}`};const f=U.join(p,"package");if(!await Ke(f))return{ok:!1,message:"下载的包里没有 package.json"};const x=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),S=`${e}.backup-${x}`;await W.cp(e,S,{recursive:!0});try{await _t(f,e);const T=U.join(e,"scripts","repatch.mjs"),M=await W.stat(T).then(()=>!0,()=>!1);let q="";if(M){const Q=await Qt(process.execPath,[T,"--from",f],e);if(Q.code!==0)throw new Error(`重打补丁失败:${Q.output.slice(0,160)}`);q=",已自动重打补丁"}return{ok:!0,message:`已更新到 ${(await Ke(e))?.version??n.version}${q};旧版本备份在 ${U.basename(S)}`}}catch(T){return await br(S,e).catch(()=>{}),{ok:!1,message:`更新中断,已从备份还原:${ce(T)}`}}}catch(s){return{ok:!1,message:ce(s)}}finally{i&&await W.rm(i,{recursive:!0,force:!0}).catch(()=>{})}}async function wr(e,r){try{const o=await we(),n=ye(e);if(n.kind!=="package"||!rt(n.name))return{ok:!1,message:"只能按 npm 包名安装",state:await ge()};const i=n.name,s=r.trim()?`${i}@${r.trim()}`:i,d=await fr(o,i);if(d>=0&&ye(o.plugins[d]).kind==="path"){const u=ot(o.plugins[d]),f=await cn(()=>yr(u,i,r.trim()));return{ok:f.ok,message:f.message,state:await ge()}}const p=d>=0?await yt(o,[o.key,d],s):await yt(o,[o.key,o.plugins.length],s);return{ok:!0,message:d>=0?`已更新 ${s}`:`已添加 ${s}`,state:p}}catch(o){return{ok:!1,message:ce(o),state:await ge()}}}async function kr(e){try{const r=await we(),{name:o}=ye(e),n=r.plugins.findIndex(d=>d.trim()===e.trim());if(n<0)return{ok:!1,message:"配置中没有这一项",state:await ge()};const i=await ln(r.plugins[n]);if(i.name===sn)return{ok:!1,message:"不能移除正在运行的插件中心自身",state:await ge()};const s=await yt(r,[r.key,n],void 0);return{ok:!0,message:`已移除 ${i.name||o}`,state:s}}catch(r){return{ok:!1,message:ce(r),state:await ge()}}}const xr=new Set(["opencode","opencode-plugin","opencode-plugins","plugin","plugins","ai"]);function pn(e){const r=new Set,o=[];for(const n of e??[]){const i=n.trim();if(!i)continue;const s=i.toLowerCase();if(!(xr.has(s)||r.has(s))&&(r.add(s),o.push(i),o.length>=8))break}return o}function At(e){const r=(e??"").trim();return r?r.startsWith("//")?`https:${r}`:/^https?:\/\//i.test(r)?r:"":""}function dn(e){const r=typeof e=="string"?e:e?.url??"",o=typeof e=="object"&&e?e.directory??"":"",n=r.trim().replace(/^git\+/i,"").replace(/^github:/i,"https://github.com/").replace(/^git:\/\//i,"https://").replace(/^ssh:\/\/git@/i,"https://").replace(/^git@([^:]+):/i,"https://$1/").replace(/#.*$/,"").replace(/\.git\/?$/i,"").replace(/\/+$/,"");return/^https?:\/\//i.test(n)?{url:n,directory:o}:{url:"",directory:""}}function un(e){return typeof e=="string"?e:e?.type??""}function Sr(e){const r=typeof e=="string"?e:e?.url??"";return At(r)}const $r=600*1e3,mt=3e4,Cr="https://api.npmjs.org",gn="https://registry.npmjs.org",Xt=new Map;function _r(e){if(e.length<=mt)return{text:e,truncated:!1};const r=e.slice(0,mt),o=r.lastIndexOf(`
|
|
19
|
+
`);return{text:`${o>mt*.75?r.slice(0,o):r}
|
|
20
20
|
|
|
21
|
-
…`,truncated:!0}}async function
|
|
21
|
+
…`,truncated:!0}}async function Yt(e,r){try{const o=await fetch(`${Cr}/downloads/point/${r}/${encodeURIComponent(e)}`,{signal:AbortSignal.timeout(8e3),headers:{accept:"application/json"}});if(!o.ok)return-1;const n=await o.json();return Number(n.downloads??0)||0}catch{return-1}}async function Ar(e){try{const r=await fetch(`${gn}/${encodeURIComponent(e)}`,{signal:AbortSignal.timeout(2e4),headers:{accept:"application/json"}});if(r.status===404)return{error:"npm 上找不到这个包"};if(!r.ok)return{error:`npm registry 返回 ${r.status}`};if(Number(r.headers.get("content-length")??0)>12*1024*1024)return Zt(e,"包元数据过大,只读取了最新版本");let n;try{n=await r.json()}catch{return Zt(e,"npm 返回的数据无法解析")}return!n||typeof n!="object"?{error:"npm 返回的数据不完整"}:{body:n,error:""}}catch(r){return{error:ce(r)}}}async function Zt(e,r){try{const o=await fetch(`${gn}/${encodeURIComponent(e)}/latest`,{signal:AbortSignal.timeout(1e4),headers:{accept:"application/json"}});if(!o.ok)return{error:r||`npm registry 返回 ${o.status}`};const n=await o.json();return n?.version?{body:{...n,readme:typeof n.readme=="string"?n.readme:"","dist-tags":{latest:n.version},versions:{[n.version]:n},time:n.time},error:""}:{error:r||"npm 返回的数据不完整"}}catch(o){return{error:r||ce(o)}}}async function Or(e){const r=await Ar(e);if(!r.body)return{error:r.error};const o=r.body,n=o.versions??{},i=Object.keys(n);if(i.length===0)return{error:"npm 上只有占位条目,还没有发布过版本"};const s=o["dist-tags"]?.latest??"",d=s&&n[s]?s:i[i.length-1]??o.version??"",p=d?n[d]??{}:o,u=dn(p.repository??o.repository),f=_r(typeof o.readme=="string"?o.readme:""),[h,x]=await Promise.all([Yt(e,"last-week"),Yt(e,"last-month")]),S=(o.maintainers??[]).map(M=>M.name??M.username??"").filter(M=>M!==""),T=Object.entries(p.dependencies??{}).map(([M,q])=>q?`${M}@${q}`:M);return{name:e,version:d,description:p.description??o.description??"",homepage:At(p.homepage??o.homepage)||u.url,repo:u.url,repoDir:u.directory,bugs:Sr(p.bugs??o.bugs),license:un(p.license??o.license),keywords:pn(p.keywords??o.keywords),maintainers:S,weekly:h,monthly:x,published:o.time?.[d]??"",created:o.time?.created??"",versions:Object.keys(n).length,unpacked:p.dist?.unpackedSize??0,files:p.dist?.fileCount??0,dependencies:T,deprecated:typeof p.deprecated=="string"?p.deprecated:"",readme:f.text,readmeTruncated:f.truncated}}async function Ir(e){const r=Xt.get(e);if(r&&Date.now()-r.at<$r)return r.value;const o=await Or(e);return"error"in o||Xt.set(e,{at:Date.now(),value:o}),o}async function Tr(e){const r=()=>({name:e,version:"",description:"",homepage:"",repo:"",repoDir:"",npm:`https://www.npmjs.com/package/${e}`,bugs:"",license:"",keywords:[],maintainers:[],weekly:0,monthly:0,published:"",created:"",versions:0,unpacked:0,files:0,dependencies:[],deprecated:"",readme:"",readmeTruncated:!1,installed:!1,current:"",hasUpdate:!1,error:""});if(!rt(e))return{...r(),error:"不是 npm 包名,无法查询详情"};let o=!1,n="";try{const s=await we(),p=(await it(s)).find(u=>u.name===e);o=p!==void 0,n=p?.version??""}catch{}const i=await Ir(e);return"error"in i?{...r(),installed:o,current:n,error:i.error}:{...i,npm:r().npm,installed:o,current:n,hasUpdate:o&&Ct(i.version,n),error:""}}async function Lr(e){const r=e.trim(),o=r?`${r} keywords:${Ht}`:`keywords:${Ht}`;try{const n=await fetch(`https://registry.npmjs.org/-/v1/search?size=50&text=${encodeURIComponent(o)}`,{signal:AbortSignal.timeout(12e3),headers:{accept:"application/json"}});if(!n.ok)return{hits:[],error:`npm registry 返回 ${n.status}`};const i=await n.json(),s=await we(),d=await it(s),p=new Map(d.map(f=>[f.name,f.version])),u=[];for(const f of i.objects??[]){const h=f.package;if(!h?.name)continue;const x=h.name,S=p.has(x),T=S?p.get(x)??"":"",M=dn(h.links?.repository);u.push({name:x,version:h.version??"",description:h.description??"",published:h.date??"",updated:h.date??"",installed:S,current:T,hasUpdate:S&&Ct(h.version??"",T),weekly:Number(f.downloads?.weekly??0)||0,monthly:Number(f.downloads?.monthly??0)||0,publisher:h.maintainers?.[0]?.username??h.publisher?.username??"",license:un(h.license),keywords:pn(h.keywords),homepage:At(h.links?.homepage),repo:M.url,npm:h.links?.npm||`https://www.npmjs.com/package/${x}`})}return{hits:u,error:""}}catch(n){return{hits:[],error:ce(n)}}}function hn(){return process.platform==="darwin"?"open":process.platform==="win32"?"explorer":"xdg-open"}function Mr(e){if(!/^https?:\/\//i.test(e))return!1;try{return Ge.spawn(hn(),[e],{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}async function zr(){try{const e=await we();return Ge.spawn(hn(),[e.path],{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}function jr(){if(process.platform!=="darwin")return!1;const e=`
|
|
22
22
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|
23
23
|
log="$HOME/.cache/opencode/plugin-hub/restart.log"
|
|
24
24
|
mkdir -p "$HOME/.cache/opencode/plugin-hub" 2>/dev/null
|
|
@@ -52,7 +52,7 @@ done
|
|
|
52
52
|
sleep 1
|
|
53
53
|
say "opening app"
|
|
54
54
|
open -b ai.opencode.desktop 2>/dev/null || open -a OpenCode
|
|
55
|
-
`;try{return Ge.spawn("/bin/sh",["-c",e],{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}async function Pr(e){const r=await ge();try{return e.length===0?{ok:!1,message:"找不到 opencode CLI",state:r}:(Ge.spawn(e[0],[...e.slice(1),"reload"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"已请求重载配置;插件列表变化建议完全退出应用再打开",state:r})}catch(o){return{ok:!1,message:ce(o),state:r}}}async function Er(e){const r=await ge();if(!e)return{items:r.plugins.map(mt),error:"无法连接后台服务,运行状态未知"};try{const o=await fetch(`${e.url.replace(/\/$/,"")}/plugin`,{signal:AbortSignal.timeout(8e3),headers:{accept:"application/json",...e.headers}});if(!o.ok)return{items:r.plugins.map(mt),error:`后台服务返回 ${o.status},运行状态未知`};const n=await o.json(),a=Array.isArray(n)?n:n.data??[];return{items:r.plugins.map(p=>{const u=ye(p.spec).name,d=a.find(m=>{const k=m.source;return k?k.type==="package"&&typeof k.target=="string"?ye(k.target).name===u:k.type==="local"&&p.kind==="path"?k.path===nt(p.spec):!1:!1}),f={spec:p.spec,name:p.name};return d?d.state?.status==="failed"?{...f,status:"failed",runtimeVersion:"",error:d.state.error??"加载失败",available:!0}:{...f,status:"loaded",runtimeVersion:d.source?.type==="package"?d.source.version??"":p.version,error:"",available:!0}:{...f,status:"unknown",runtimeVersion:"",error:"",available:!0}}),error:""}}catch(o){return{items:r.plugins.map(mt),error:`无法读取运行状态:${ce(o)}`}}}function mt(e){return{spec:e.spec,name:e.name,status:"unknown",runtimeVersion:"",error:"",available:!1}}function ce(e){return e instanceof Error?e.message:String(e)}const Br=JSON.parse(`[{"name":"@aerovato/operator-memory","pkg":"","ver":"","type":"plugins","desc":"Durable context for agent-driven development","long":"Operator Memory gives the agent durable memory made of ordinary Markdown: specs, decisions, standards, and research, kept across private, shared, and user partitions. Every file is yours to read, correct, or remove, and new sessions start from that knowledge. No embeddings, no vector database, no ho","repo":"https://github.com/aerovato/operator-memory","tags":["memory","context","documentation","markdown"]},{"name":"Agent Memory","pkg":"opencode-agent-memory","ver":"0.3.1","type":"plugins","desc":"Letta-inspired memory","long":"Gives the agent persistent, self-editable memory blocks inspired by Letta agents.","repo":"https://github.com/joshuadavidthomas/opencode-agent-memory","tags":[]},{"name":"Agent Notifications","pkg":"","ver":"","type":"plugins","desc":"Desktop and webhook alerts for OpenCode sessions","long":"Desktop and optional webhook notifications for OpenCode root-session completion, questions, permissions, and errors on macOS, Linux, and Windows.","repo":"https://github.com/777genius/agent-notifications","tags":[]},{"name":"Agent Skills (JDT)","pkg":"opencode-agent-skills","ver":"0.7.0","type":"plugins","desc":"Dynamic skills loader","long":"Dynamic skills loader that discovers skills from project, user, and plugin directories.","repo":"https://github.com/joshuadavidthomas/opencode-agent-skills","tags":[]},{"name":"OpenCode Antigravity CLI Auth","pkg":"opencode-agy-auth","ver":"2.1.1","type":"plugins","desc":"Google Antigravity account auth","long":"Authenticate the Opencode CLI with your Google account so you can use your existing Antigravity plan.","repo":"https://github.com/anthonyhaussman/opencode-agy-auth","tags":[]},{"name":"AIDevOps","pkg":"aidevops","ver":"3.39.125","type":"plugins","desc":"AI DevOps framework and OpenCode plugin","long":"OpenCode-first AI DevOps framework with agents, skills, workflows, safety hooks, memory, GitHub worker dispatch, and integrations for code, infrastructure, content, SEO, and operations.","repo":"https://github.com/marcusquinn/aidevops","tags":[]},{"name":"Antigravity Auth","pkg":"opencode-antigravity-auth","ver":"2.1.2","type":"plugins","desc":"Google Antigravity models","long":"Use Gemini and Anthropic models for free via Google Antigravity IDE authentication.","repo":"https://github.com/NoeFabris/opencode-antigravity-auth","tags":[]},{"name":"basemind","pkg":"basemind","ver":"0.31.1","type":"plugins","desc":"Full AI context layer over MCP — code-map, document RAG, agent memory, web crawl, git history","long":"Full AI context layer over MCP — tree-sitter code-map, document RAG, shared agent memory, web crawl, and git history. 300+ languages. Published to npm as basemind-opencode (https://www.npmjs.com/package/basemind-opencode).","repo":"https://github.com/Goldziher/basemind","tags":[]},{"name":"Beads Plugin","pkg":"opencode-beads","ver":"0.9.0","type":"plugins","desc":"Beads issue tracker integration","long":"Integration for Steve Yegge's beads issue tracker with /bd-* commands.","repo":"https://github.com/joshuadavidthomas/opencode-beads","tags":[]},{"name":"BRHP","pkg":"","ver":"","type":"plugins","desc":"Persistent planning state","long":"Structured, persistent planning for OpenCode with local session state, /brhp commands, bounded planner history, and a TUI sidebar.","repo":"https://github.com/ZanzyTHEbar/brhp","tags":[]},{"name":"bro","pkg":"bro","ver":"1.0.7","type":"plugins","desc":"Re-explains the last reply in plain language","long":"One-file Agent Skill that re-explains the assistant's last reply (or pasted text) in plain language when it was too dense. The installer adds a \`/bro\` command for OpenCode (\`~/.config/opencode/skills/bro/SKILL.md\` plus a command wrapper); also works in Claude Code, Codex, Cursor and Hermes.","repo":"https://github.com/luchasarie/bro-skill","tags":[]},{"name":"cache-stats","pkg":"","ver":"","type":"plugins","desc":"Showing the active session's cache hit rate in a popup dialog","long":"This plugin shows the overall cache hit rate, a per-model breakdown, a per subagent breakdown and the associated cost, making it easy to understand cache performance at a glance.","repo":"https://github.com/nmdra/opencode-cache-stats","tags":[]},{"name":"Caspian","pkg":"caspian-opencode-plugin","ver":"0.1.7","type":"plugins","desc":"Give your OpenCode agent an inbox — email, Telegram, and Discord","long":"Official Caspian plugin for OpenCode. Gives the agent a bidirectional inbox — email, Telegram, and Discord — with slash commands, session threading back to Gmail, and desktop notifications. No Caspian account required; on first start the plugin mints a sandbox project and provisions an agent email. ","repo":"https://github.com/TryCaspian/caspian-sdk/tree/main/packages/opencode","tags":["email","telegram","discord","inbox","messaging","notifications"]},{"name":"CC Safety Net","pkg":"","ver":"","type":"plugins","desc":"Safety net catching destructive commands","long":"A Claude Code plugin that acts as a safety net, catching destructive git and filesystem commands before they execute.","repo":"https://github.com/kenryu42/claude-code-safety-net","tags":[]},{"name":"Chisle","pkg":"chisle","ver":"3.8.1","type":"plugins","desc":"Cuts token use with terse answers, smallest-code-that-works rules and tool-output compression","long":"Installs a ruleset for terse answers that keep every decisive fact and a \\"smallest code that works\\" ladder, Chisle skills, and a compression plugin that trims oversized tool output before it re-enters the context. The same ruleset ships for Claude Code, Cursor, Codex and Gemini CLI. Install with \`np","repo":"https://github.com/JayPokale/Chisle","tags":["tokens","cost","context","productivity"]},{"name":"Subagent Reporter","pkg":"","ver":"","type":"plugins","desc":"See exactly what your subagents are up to (in the terminal) when invoked during an \`opencode run _____\` session.","long":"When opencode run <prompt> is invoked normally, the actions of the primary agent are visible in the terminal, but subagent actions are not. This makes it difficult to follow progress on the prompt, and makes it very difficult to use \`opencode run\` as part of an unattended process or script. This plu","repo":"https://github.com/raisbecka/opencode-subagent-output","tags":[]},{"name":"codemem","pkg":"codemem","ver":"0.47.3","type":"plugins","desc":"Persistent coding memory across sessions, machines, and teammates","long":"Captures coding decisions, discoveries, and fixes, with automatic context injection in OpenCode, Claude Code, and Codex. Includes MCP tools for searching and managing memories, a viewer, optional cross-machine sync, and sharing of selected projects with teammates.","repo":"https://github.com/kunickiaj/codemem","tags":[]},{"name":"Command Inject","pkg":"opencode-command-inject","ver":"1.3.1","type":"plugins","desc":"Auto-inject project commands into OpenCode","long":"Automatically discovers and injects Makefile targets, npm/pnpm/yarn/bun scripts, and local skills at startup. Type / to see and run all project commands.","repo":"https://github.com/shihyuho/opencode-command-inject","tags":[]},{"name":"ContextStream","pkg":"mcp-server","ver":"0.0.9","type":"plugins","desc":"Shared project context for OpenCode, Cursor, Claude Code, Codex, and Grok via MCP","long":"Hosted MCP server that keeps coding agents on shared project context across sessions and teammates. Works with OpenCode and other MCP-compatible clients. Endpoint https://mcp.contextstream.io/mcp — Intelligence isn’t the bottleneck. Context is.","repo":"https://github.com/contextstream/mcp-server","tags":["mcp","context","productivity","collaboration"]},{"name":"deja","pkg":"opencode-deja","ver":"0.23.5","type":"plugins","desc":"Recall what you already did in your other coding agents","long":"opencode remembers its own sessions. deja answers the other question: what you did in Claude Code, Codex, Cursor, Gemini CLI, Zed and fifteen more agents on this machine — including the months before you installed anything.\\n\\nA local Go binary indexes the transcripts those agents already wrote to dis","repo":"https://github.com/vshulcz/deja-vu","tags":["memory","recall","search","cross-agent","session-history"]},{"name":"Ditto","pkg":"ditto","ver":"0.0.11","type":"plugins","desc":"Mines your local AI coding session logs into a personal profile your agent loads before every task","long":"Mines local AI coding session logs (OpenCode, Claude Code, Codex, Copilot CLI) into a personal working profile. The OpenCode adapter reads OpenCode's SQLite session store and installs the profile into OpenCode's global rules so the agent loads it before every task. Single stdlib-only Python file, ru","repo":"https://github.com/ohad6k/ditto","tags":[]},{"name":"Dodo Payments","pkg":"dodo-agent-plugin","ver":"0.0.1","type":"plugins","desc":"Payments, subscriptions, webhooks, and billing for OpenCode agents","long":"Official Dodo Payments plugin for OpenCode (also Claude Code, Codex, Cursor). Bundles eight integration skills (checkout, subscriptions, webhooks, usage-based billing, credits, license keys, BillingSDK, best practices) plus two MCP servers — a live API server with browser OAuth and a documentation s","repo":"https://github.com/dodopayments/dodo-agent-plugin","tags":[]},{"name":"Dynamic Context Pruning","pkg":"","ver":"","type":"plugins","desc":"Optimize token usage","long":"Plugin that optimises token usage by pruning obsolete tool outputs from conversation context.","repo":"https://github.com/Tarquinen/opencode-dynamic-context-pruning","tags":[]},{"name":"Envsitter Guard","pkg":"envsitter-guard","ver":"0.1.1","type":"plugins","desc":"Prevent .env leaks","long":"OpenCode plugin that prevents agents/tools from reading or editing sensitive .env* files, while still allowing safe inspection via EnvSitter (keys + deterministic fingerprints; never values).","repo":"https://github.com/boxpositron/envsitter-guard","tags":[]},{"name":"FlowDeck","pkg":"flowdeck","ver":"0.16.1","type":"plugins","desc":"AI-powered multi-agent workflow orchestration with built-in safety intelligence","long":"FlowDeck adds a structured, multi-agent development workflow to OpenCode. It coordinates 25 specialist agents through a four-phase cycle — discuss, plan, execute, review — with persistent state that survives session restarts.\\n\\nKey features:\\n- 25 specialist agents (architect, planner, coder, reviewer","repo":"https://github.com/DVNghiem/FlowDeck","tags":["workflow","orchestration","multi-agent","planning","security","TDD"]},{"name":"ForLoop Planner","pkg":"@forloop-cc/forloop-opencode-plugin-planner","ver":"2.2.25","type":"plugins","desc":"Autopilot development. Plan with ForLoop agent. Build, Test, Deploy on cloud in one go.","long":"ForLoop offers an all-in-one platform that covers the entire development lifecycle, from initial planning and coding to automated testing and cloud deployment.","repo":"https://github.com/forloop-cc/forloop-opencode-plugin-planner","tags":[]},{"name":"Froggy","pkg":"froggy","ver":"1.1.6","type":"plugins","desc":"Hooks and specialized agents","long":"Plugin providing Claude Code-style hooks, specialized agents, and tools like gitingest.","repo":"https://github.com/smartfrog/opencode-froggy","tags":[]},{"name":"Gemini Auth","pkg":"opencode-gemini-auth","ver":"2.0.1","type":"plugins","desc":"Google account auth","long":"Authenticate the Opencode CLI with your Google account so you can use your existing Gemini plan.","repo":"https://github.com/jenslys/opencode-gemini-auth","tags":[]},{"name":"Godmode","pkg":"godmode","ver":"0.0.3","type":"plugins","desc":"Discipline layer: measure → modify → verify → keep/revert","long":"Skill plugin with 135 skills and 7 subagents that adds a measure → modify → verify → keep/revert discipline loop to AI coding agents. Works with OpenCode alongside Claude Code, Codex, Cursor, and Gemini CLI.","repo":"https://github.com/arbazkhan971/godmode","tags":[]},{"name":"Handoff","pkg":"handoff","ver":"1.3.2","type":"plugins","desc":"Session handoff prompts","long":"Creates focused handoff prompts for continuing work in a new session.","repo":"https://github.com/joshuadavidthomas/opencode-handoff","tags":[]},{"name":"Honcho","pkg":"honcho","ver":"0.4.13","type":"plugins","desc":"AI-native long-term memory for OpenCode","long":"Give OpenCode persistent memory that survives context wipes, session restarts, and fresh chats. Honcho remembers what you're working on, durable preferences, and prior context across projects. Supports cloud and self-hosted deployments with configurable session strategies.","repo":"https://github.com/plastic-labs/opencode-honcho","tags":[]},{"name":"Internet Court","pkg":"","ver":"","type":"plugins","desc":"Trust layer for agent-to-agent commerce: mandates, payments, escrow, dispute resolution.","long":"The trust layer for agent-to-agent commerce — natural-language mandates, delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all skill. By the Internet Court Consortium (internetcourt.org). MIT licensed.","repo":"https://github.com/internet-court/internet-court-skill","tags":["agent-payments","x402","erc-7710","erc-8004","escrow","genlayer"]},{"name":"kibi-opencode","pkg":"kibi-opencode","ver":"3.2.0","type":"plugins","desc":"Repo-local, branch-scoped knowledge and traceability for OpenCode","long":"Plugin-first entry point into the Kibi stack for OpenCode users. It adds context-aware\\nguidance, routes durable code comments toward Kibi artifacts, runs non-blocking background\\nsync and targeted validation checks, and helps keep repo knowledge branch-local and queryable.","repo":"https://github.com/Looted/kibi","tags":["opencode","plugin","mcp","traceability"]},{"name":"Kilo Gateway Auth","pkg":"opencode-kilo-auth","ver":"1.1.4","type":"plugins","desc":"Kilo Gateway provider","long":"Adds Kilo Gateway provider support to OpenCode.","repo":"https://github.com/JungHoonGhae/opencode-kilo-auth","tags":[]},{"name":"Lemma","pkg":"lemma","ver":"0.10.2","type":"plugins","desc":"Persistent memory layer for LLMs via MCP - local, zero-dependency, works on all clients","long":"Biological memory model for AI coding agents. Features confidence decay/boost, Fuse.js fuzzy dedup, guide system with usage tracking, cross-references, cumulative backup, virtual session tracking, and universal memory injection via tool descriptions (works on Claude Desktop, Cursor, VS Code, Gemini ","repo":"https://github.com/xenitV1/lemma","tags":["memory","mcp","persistence","context","claude","cursor"]},{"name":"opencode-llm-proxy","pkg":"opencode-llm-proxy","ver":"1.11.2","type":"plugins","desc":"OpenCode-backed API gateway with tool calling","long":"Local OpenCode plugin that exposes OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini-compatible endpoints for any model configured in OpenCode. Supports streaming, model listing, and real tool/function calling including parallel tool calls, so tools like n8n, Open WebUI, Lang","repo":"https://github.com/KochC/opencode-llm-proxy","tags":["openai","anthropic","gemini","responses-api","llm-gateway","tool-calling"]},{"name":"Magic Context","pkg":"@cortexkit/opencode-magic-context","ver":"0.49.35","type":"plugins","desc":"Lossless context management with background compression","long":"Cache-aware context management that keeps long sessions productive. Background historian compresses old conversation into structured compartments while you keep working. Includes cross-session project memory, unified search across history/memories/facts, overnight dreamer for memory maintenance, and","repo":"https://github.com/cortexkit/opencode-magic-context","tags":[]},{"name":"Mem0 OpenCode Plugin","pkg":"","ver":"","type":"plugins","desc":"Persistent memory plugin so your agent remembers across sessions","long":"OpenCode plugin that gives your agent persistent memory powered by Mem0. Includes 9 MCP memory tools, 16 slash commands, and lifecycle hooks that auto-capture decisions, search prior context at session start, and pre-fetch error memories on failures. Install with \`opencode plugin @mem0/opencode-plug","repo":"https://github.com/mem0ai/mem0","tags":[]},{"name":"Micode","pkg":"micode","ver":"0.11.0","type":"plugins","desc":"Brainstorm-Plan-Implement workflow","long":"Structured workflow with session continuity, subagent orchestration, git worktree isolation, and AST-aware tools.","repo":"https://github.com/vtemian/micode","tags":[]},{"name":"Morph Fast Apply","pkg":"","ver":"","type":"plugins","desc":"10,500+ tokens/sec code editing","long":"Integrates Morph's Fast Apply API for faster code editing with lazy edit markers and unified diff output.","repo":"https://github.com/JRedeker/opencode-morph-fast-apply","tags":[]},{"name":"Neuralyzer","pkg":"neuralyzer","ver":"1.1.5","type":"plugins","desc":"Easier Ralph loop inside harness","long":"Allow agent to wipe its own session context and re-run the first message. This allows easier and more ergonomic Ralph loop engineering.","repo":"https://github.com/gintasz/neuralyzer","tags":[]},{"name":"Oh My Cassette","pkg":"","ver":"","type":"plugins","desc":"Chat your raw clips into a finished cut","long":"Adds a local stdio MCP server that turns a chat message into an edited video: beat-synced cuts, auto-matched background music, subtitles, transitions, and picture-in-picture. Ingest local clips, then drive a persistent multi-turn editing thread — every turn returns a timeline delta and a contact-she","repo":"https://github.com/Cassette-Editor/oh-my-cassette","tags":["mcp","video","video-editing","media"]},{"name":"Oh My Opencode","pkg":"oh-my-opencode","ver":"5.1.60","type":"plugins","desc":"Agents & Pre-built tools","long":"Background agents, pre-built tools (LSP/AST/MCP), curated agents, and a Claude Code compatible layer.","repo":"https://github.com/code-yeongyu/oh-my-opencode","tags":[]},{"name":"Oh My Opencode Slim","pkg":"oh-my-opencode-slim","ver":"3.0.7","type":"plugins","desc":"Lightweight agent orchestration with reduced token usage","long":"Slimmed-down fork of oh-my-opencode focused on core agent orchestration. Features specialized sub-agents (Explorer, Oracle, Librarian, Designer, etc.), background task management, LSP/AST tools, tmux integration for live agent visibility, and MCP servers. Optimized to consume significantly fewer tok","repo":"https://github.com/alvinunreal/oh-my-opencode-slim","tags":["agents","orchestration","background-tasks","lsp","mcp"]},{"name":"open-plan-annotator","pkg":"open-plan-annotator","ver":"1.13.2","type":"plugins","desc":"Annotate LLM plans like a Google Doc!","long":"A fully local agentic coding plugin that intercepts plan mode and opens an annotation UI in your browser. Select text to strikethrough, replace, insert, or comment — then approve the plan or request changes","repo":"https://github.com/ndom91/open-plan-annotator","tags":[]},{"name":"Opencode Agents Sidebar","pkg":"opencode-agents-sidebar","ver":"3.1.0","type":"plugins","desc":"Browse configured OhMyOpenAgent agents in the TUI","long":"OpenCode sidebar plugin that displays configured OhMyOpenAgent agents with lifecycle-based categories, collapsible sections, descriptions, and model information.","repo":"https://github.com/Mark1708/opencode-agents-sidebar","tags":[]},{"name":"Boffin","pkg":"","ver":"","type":"plugins","desc":"Routed architectural guardrails for AI coding agents in OpenCode","long":"Staff-engineer layer for AI coding agents: routes per-edit architectural constraints and requires verification. Not another AGENTS.md.","repo":"https://github.com/MicSm/boffin","tags":["opencode","architecture","guardrails","code-review","cplusplus","python"]},{"name":"OpenCode Claude Code Plugin","pkg":"opencode-claude-code-plugin","ver":"0.1.2","type":"plugins","desc":"Claude models through the official Claude Code CLI, using the login you already have","long":"Runs Anthropic's Claude models in opencode through the official claude CLI as a subprocess, so opencode uses whatever the CLI is logged in as and no token is ever read or replayed. Bash, Edit and Write are proxied back to opencode's own permissions, with several accounts, per-subagent models, and on","repo":"https://github.com/khalilgharbaoui/opencode-claude-code-plugin","tags":[]},{"name":"OpenCode Claude Memory","pkg":"opencode-claude-memory","ver":"2.3.0","type":"plugins","desc":"Claude Code-compatible memory","long":"Share persistent Markdown memory between OpenCode and Claude Code using Claude Code-compatible paths and file formats.","repo":"https://github.com/kuitos/opencode-claude-memory","tags":[]},{"name":"Opencode CMD Provider","pkg":"opencode-cmd-provider","ver":"2.3.4","type":"plugins","desc":"Use CommandCode plans (Go, GOAT, Pro, Max) as an OpenCode provider.","long":"OpenCode provider plugin for the CommandCode Provider API. Authenticate via\\n/connect browser flow or COMMANDCODE_API_KEY, auto-registers all CommandCode\\nmodels ([CMD] prefix) with offline snapshot, pricing display, and per-plan\\ndeals/allowance intelligence in the sidebar and cmd_plan_summary tool.","repo":"https://github.com/rashidrazak/opencode-cmd-provider","tags":["provider","commandcode","model-discovery","auth"]},{"name":"Cursor Auth","pkg":"opencode-cursor","ver":"0.0.1","type":"plugins","desc":"Use your Cursor subscription models in OpenCode via OAuth","long":"Connects Cursor's API to OpenCode via OAuth login, automatic model discovery, and a local OpenAI-compatible proxy — use the models included in your Cursor subscription directly from OpenCode.","repo":"https://github.com/ephraimduncan/opencode-cursor","tags":[]},{"name":"opencode-dir-tree-tui","pkg":"opencode-dir-tree-tui","ver":"1.0.6","type":"plugins","desc":"File tree sidebar with Git status and quick file actions","long":"Browse project files in the OpenCode V2 sidebar with Git status indicators, custom ignore rules, path copying, and quick file and folder opening.","repo":"https://github.com/aihaipeng/opencode-dir-tree-tui","tags":[]},{"name":"OpenCode Ensemble","pkg":"@hueyexe/opencode-ensemble","ver":"0.20.0","type":"plugins","desc":"Parallel agent teams for OpenCode","long":"Coordinate parallel OpenCode agents with peer messaging, a shared task board, git worktree isolation, and a live dashboard.","repo":"https://github.com/hueyexe/opencode-ensemble","tags":["agents","multi-agent","orchestration","worktrees","dashboard"]},{"name":"opencode-failover","pkg":"opencode-failover","ver":"2.0.7","type":"plugins","desc":"Automatic API-key failover and rotation across multiple provider keys","long":"OpenCode plugin that automatically rotates API keys across multiple provider credentials. When a key hits a rate limit, the plugin quarantines it and switches to the next available key with zero downtime. Features weighted round-robin distribution, exponential backoff quarantine, retry-after header ","repo":"https://github.com/bulutmuf/opencode-failover","tags":[]},{"name":"GitHub Release","pkg":"opencode-github-release","ver":"0.6.0","type":"plugins","desc":"Automated GitHub releases","long":"Create and publish GitHub releases with semantic versioning, tag management, and auto-generated release notes.","repo":"https://github.com/amestsantim/opencode-github-release","tags":[]},{"name":"GoopSpec","pkg":"goopspec","ver":"0.2.9","type":"plugins","desc":"Spec-driven development workflow","long":"Transforms AI-assisted coding with spec-driven workflows. Features 5-phase workflow (Plan, Research, Specify, Execute, Accept), contract gates for user confirmation, 12 specialized subagents, persistent memory system, wave-based execution with atomic commits, and deviation rules for handling unexpec","repo":"https://github.com/hffmnnj/opencode-goopspec","tags":[]},{"name":"GPT Imagegen","pkg":"opencode-gpt-imagegen","ver":"1.2.2","type":"plugins","desc":"gpt-image-2 in OpenCode — no API cost when using your ChatGPT subscription","long":"Brings gpt-image-2 (ChatGPT Images 2) image generation to OpenCode. When you sign into OpenCode with your ChatGPT account, generations are billed against your existing Plus / Pro / Business plan — no per-image API cost. An OpenAI API key path is also planned. Supports reference images for style guid","repo":"https://github.com/yuji-hatakeyama/opencode-gpt-imagegen","tags":["openai","gpt-image-2","gpt-image","image-generation","image-editing","text-to-image"]},{"name":"Opencode LiteLLM","pkg":"opencode-litellm","ver":"0.1.0","type":"plugins","desc":"Auto-discover models from a LiteLLM proxy","long":"Drop-in LiteLLM provider for OpenCode with zero configuration. Auto-detects a running\\nLiteLLM proxy on common ports (4000, 8000, 8080), pulls every model from /v1/models,\\nand registers them in OpenCode automatically — no model lists to hand-maintain. Smart\\nname formatting, modality categorization (c","repo":"https://github.com/yuseferi/opencode-litellm","tags":["litellm","provider","openai-compatible","llm-proxy","model-discovery"]},{"name":"Opencode Mem","pkg":"opencode-mem","ver":"2.41.0","type":"plugins","desc":"Persistent memory with vector database","long":"A persistent memory system for AI coding agents that enables long-term context retention across sessions using local vector database technology. Features dual memory scopes, web interface, auto-capture system, and multi-provider AI support.","repo":"https://github.com/tickernelz/opencode-mem","tags":[]},{"name":"OpenCode Mission Control","pkg":"opencode-mission-control","ver":"1.6.0","type":"plugins","desc":"Command center for parallel agents — worktree isolation, DAG plans, merge train, PRs","long":"Orchestrates parallel OpenCode agents in tmux-isolated git worktrees with live inspection (capture/attach/diff), a dashboard overview, agent status reporting, and in-chat notifications. Supports DAG-based plans with autopilot/copilot/supervisor modes and a merge train with test gating and automatic ","repo":"https://github.com/nigel-dev/opencode-mission-control","tags":[]},{"name":"Opencode Models Discovery","pkg":"opencode-models-discovery","ver":"2.1.1","type":"plugins","desc":"Configurable model discovery and filtering without long manual config","long":"OpenCode plugin for discovering models from OpenAI-compatible providers and API gateways, with provider and model filtering so users can avoid maintaining large configs or loading every model at once.","repo":"https://github.com/yuhp/opencode-models-discovery","tags":[]},{"name":"OpenCode ntfy.sh","pkg":"opencode-ntfy.sh","ver":"1.1.0","type":"plugins","desc":"Push notifications to keep you in the know, even when you're on the go.","long":"An OpenCode plugin that adds push notifications through ntfy.sh.","repo":"https://github.com/lannuttia/opencode-ntfy.sh","tags":[]},{"name":"OpenAI Native Compaction","pkg":"opencode-openai-compact","ver":"1.4.0","type":"plugins","desc":"Use OpenAI's official Responses API compaction in OpenCode","long":"Routes OpenCode session compaction for OpenAI providers through \`/responses/compact\`, stores the returned compacted output locally, and injects it into the next Responses request so long sessions use OpenAI's native compaction instead of a prompt-written summary.","repo":"https://github.com/partment/opencode-openai-compact","tags":[]},{"name":"OpenWork for OpenCode","pkg":"","ver":"","type":"plugins","desc":"Official OpenWork plugin to deploy AI models, skills, and MCPs to your team's OpenCode","long":"The official plugin from OpenWork. Centrally deploy AI models, skills, and MCP servers to your whole team. Admins add a model provider, skill, or MCP connection once and choose who gets it; everyone receives it in OpenCode after a single sign-in. No shared API keys, no copying MCP configs between ma","repo":"https://github.com/different-ai/openwork/tree/dev/packages/opencode-plugin","tags":[]},{"name":"opencode-plugin-otel","pkg":"@devtheops/opencode-plugin-otel","ver":"2.0.1","type":"plugins","desc":"OpenTelemetry telemetry exporter for opencode sessions, mirroring Claude Code monitoring signals","long":"Exports metrics, logs, and traces from opencode sessions via OTLP/gRPC to any OpenTelemetry-compatible backend (Datadog, Honeycomb, Grafana Cloud, etc.). Instruments session lifecycle, token usage, cost, tool durations, and git commits — mirroring the same signals as Claude Code's monitoring.","repo":"https://github.com/DEVtheOPS/opencode-plugin-otel","tags":[]},{"name":"OpenCode Pollinations Plugin","pkg":"opencode-pollinations-plugin","ver":"6.5.5","type":"plugins","desc":"Full Pollinations.ai integration — free unlimited AI models, 17+ multimodal tools, hourly free tiers & Safety Net.","long":"The ultimate bridge between OpenCode and the Pollinations.ai ecosystem. Access 30+ free and enterprise AI models (OpenAI, Gemini, Mistral, Claude...) with hourly Pollen resets. Includes 17+ agent tools (image, video, audio, music generation, background removal, web search, transcription, QR codes, d","repo":"https://github.com/fkom13/opencode-pollinations-plugin","tags":[]},{"name":"PR Auto-Signature","pkg":"opencode-pr-signature","ver":"1.2.2","type":"plugins","desc":"Automatically adds AI model signature to PRs, Issues, and Commits","long":"Plugin that automatically appends AI model signature to Pull Requests, Issues, and git commit messages. Supports GitHub MCP tools, git CLI, and gh CLI. Recognizes 90+ AI models including Claude, GPT, Gemini, DeepSeek, Llama, Mistral, and more.","repo":"https://github.com/arttttt/opencode-pr-signature","tags":[]},{"name":"Opencode Quota","pkg":"opencode-quota","ver":"0.0.1-dev","type":"plugins","desc":"Quota toasts and token tracking","long":"Track quota and token usage across providers via automatic toasts and slash commands.","repo":"https://github.com/slkiser/opencode-quota","tags":[]},{"name":"OpenCodeRAG","pkg":"","ver":"","type":"plugins","desc":"Local-first RAG plugin for semantic code search with tree-sitter chunking and LanceDB","long":"A local-first Retrieval-Augmented Generation plugin for OpenCode that enables semantic code\\nsearch across your workspace. Features AST-aware chunking via tree-sitter (19 languages),\\nincremental indexing with file-change detection, watch mode for live re-indexing, and\\nconfigurable embeddings via Olla","repo":"https://github.com/MrDoe/OpenCodeRAG","tags":[]},{"name":"opencode-review","pkg":"","ver":"","type":"plugins","desc":"Automatic structured code review with configurable dimensions and auto-fix","long":"An automatic code review plugin for OpenCode CLI. Reviews staged changes when session goes idle, with configurable cooldown, multi-dimension analysis (code quality, security, performance, testing, documentation), severity levels, and auto-fix chain support.","repo":"https://github.com/sun-praise/opencode-review","tags":[]},{"name":"opencode-short-term-memory","pkg":"","ver":"","type":"plugins","desc":"Maintain user instructions and preferences throughout long sessions. No more repeating yourself.","long":"Automatically summarizes conversation context into structured session memory and injects it back into the system prompt every few turns — preserving user instructions, project context, decisions, and active references across long chats and compactions.","repo":"https://github.com/andrejtonev/opencode-short-term-memory","tags":[]},{"name":"opencode-skills-tui","pkg":"opencode-skills-tui","ver":"1.2.3","type":"plugins","desc":"Browse skills, track loaded state, and preview SKILL.md","long":"OpenCode V2 skills sidebar with loaded-state tracking, SKILL.md previews, token estimates, and skill mentions in prompts.","repo":"https://github.com/aihaipeng/opencode-skills-tui","tags":[]},{"name":"opencode-snip","pkg":"opencode-snip","ver":"3.0.0","type":"plugins","desc":"OpenCode plugin that prefixes shell commands with snip to reduce LLM token consumption by 60-90%","long":"Automatically prefixes supported shell commands (git, go, cargo, npm, docker, etc.) with snip to filter output before it reaches your LLM context window.","repo":"https://github.com/VincentHardouin/opencode-snip","tags":[]},{"name":"Opencode Snippets","pkg":"opencode-snippets","ver":"3.4.0","type":"plugins","desc":"Instant inline text expansion","long":"Instant inline text expansion for OpenCode. Type #snippet anywhere in your message and watch it transform. Brings DRY principles to prompt engineering with composable, shell-enabled snippets.","repo":"https://github.com/JosXa/opencode-snippets","tags":[]},{"name":"OpenCode Swarm","pkg":"opencode-swarm","ver":"7.201.2","type":"plugins","desc":"Verification-gated swarm with architect, review, test, and security agents","long":"Verification-gated OpenCode swarm with architect planning, independent review, test engineering, security checks, and resumable evidence.","repo":"https://github.com/zaxbysauce/opencode-swarm","tags":[]},{"name":"Opencode Synced","pkg":"opencode-synced","ver":"0.11.0","type":"plugins","desc":"Sync configs across machines","long":"Enables syncing global opencode configurations across machines with public/private visibility options.","repo":"https://github.com/iHildy/opencode-synced","tags":[]},{"name":"System Prompt Logger","pkg":"opencode-system-prompt-logger","ver":"1.0.0","type":"plugins","desc":"System prompt logger","long":"OpenCode plugin that intercepts the system prompt before it's sent to the LLM and logs it.","repo":"https://github.com/tlinhart/opencode-system-prompt-logger","tags":[]},{"name":"Opencode Telemetry","pkg":"opencode-telemetry","ver":"0.3.4","type":"plugins","desc":"Passive cross-session telemetry to local SQLite; cost rollups across agent orchestration chains","long":"Logs every opencode session to a local SQLite database automatically — tokens, tool calls, skills, per-turn cost. Aggregates costs across orchestration chains (conductor + child sessions), offers turn-by-turn forensic inspection, and ships an \`octm\` CLI for reports without spending model tokens. Zer","repo":"https://github.com/agostinilabsrl/opencode-telemetry","tags":["telemetry","observability","cost-tracking","sqlite","local-first","orchestration"]},{"name":"Opencode update notifier","pkg":"opencode-update-notifier","ver":"0.4.0","type":"plugins","desc":"Notify about plugin updates.","long":"Checks if your pinned plugins have newer versions available and shows a notification.","repo":"https://github.com/tim-hilde/opencode-update-notifier","tags":[]},{"name":"Opencode Usage Monitor","pkg":"opencode-usage-monitor","ver":"3.1.0","type":"plugins","desc":"Monitor OpenAI and Z.AI usage quotas in the TUI","long":"OpenCode sidebar plugin that displays API usage quotas for OpenAI and Z.AI providers with per-model breakdowns, spend tracking, and configurable refresh controls.","repo":"https://github.com/Mark1708/opencode-usage-monitor","tags":[]},{"name":"Opencode Visualizer","pkg":"","ver":"","type":"plugins","desc":"2D pixel-art office for AI agents","long":"Turning raw OpenCode terminal logs into cozy 2D pixel office chaos. Watch your agents work, idle, and celebrate success in a bustling virtual office.","repo":"https://github.com/psinetron/opencode-visualiser","tags":[]},{"name":"OrgX OpenCode Plugin","pkg":"@useorgx/orgx-opencode-plugin","ver":"0.1.0-alpha.7","type":"plugins","desc":"OrgX Work Graph peer for task dispatch, receipts, deviations, and passive reconciliation","long":"OrgX OpenCode Plugin connects OpenCode sessions to the OrgX execution control plane. It receives OrgX task dispatches, drives the user's local OpenCode session, posts execution receipts and deviations back to OrgX, and writes compact Work Graph events for later audit-first reconciliation.","repo":"https://github.com/useorgx/orgx-opencode-plugin","tags":["agent-orchestration","work-graph","task-dispatch","receipts","mcp"]},{"name":"Plannotator","pkg":"","ver":"","type":"plugins","desc":"Interactive plan review UI","long":"Plan review UI with visual annotation, private/offline sharing, and Obsidian/Bear integration.","repo":"https://github.com/backnotprop/plannotator","tags":[]},{"name":"Rehydra","pkg":"rehydra","ver":"0.16.5","type":"plugins","desc":"Prevent your coding agent from leaking secrets to LLM providers","long":"Intercepts the conversation between OpenCode and the LLM, replacing secrets from .env files and detected API keys, tokens, and credentials with placeholders before they leave your machine. Secrets are transparently restored before any tool executes locally. Supports pattern-based detection for Strip","repo":"https://github.com/rehydra-ai/rehydra-sdk","tags":[]},{"name":"Ring a Bell Example","pkg":"","ver":"","type":"plugins","desc":"Simple terminal bell plugin","long":"A simple plugin to ring the terminal bell once a request is complete.","repo":"https://gist.github.com/ahosker/267f375a65378bcb9a867fd9a195db1e","tags":[]},{"name":"Simple Memory","pkg":"","ver":"","type":"plugins","desc":"Git-based memory","long":"Simple plugin to manage memory inside a git repo that can be committed and reviewed by team members.","repo":"https://github.com/cnicolov/opencode-plugin-simple-memory","tags":[]},{"name":"SonarQube","pkg":"sonarqube","ver":"0.0.1","type":"plugins","desc":"Automatically enforce SonarQube code quality and security in the agent coding loop","long":"SonarQube is the AI code quality and security verification platform used by millions of developers to catch bugs, vulnerabilities, and leaked secrets. This plugin enforces those standards in the agent coding loop: 7,500+ distinct issue types, secrets scanning, agentic analysis, and quality gates acr","repo":"https://github.com/SonarSource/sonarqube-agent-plugins","tags":["sonarqube","code-quality","static-analysis","security","secrets"]},{"name":"Superpowers","pkg":"superpowers","ver":"0.0.2","type":"plugins","desc":"Complete software development methodology with composable skills for coding agents","long":"Gives your coding agent a structured methodology - brainstorm specs, write plans, run TDD, dispatch subagents, and review work. Skills trigger automatically across Claude Code, OpenCode, Codex, Gemini CLI, Cursor, and GitHub Copilot CLI.","repo":"https://github.com/obra/superpowers","tags":[]},{"name":"Systematic","pkg":"systematic","ver":"3.1.1","type":"plugins","desc":"Compound-engineering workflows for OpenCode, Pi, and Claude Code","long":"Provides brainstorm, plan, work, and review workflows as bundled skills and agents for OpenCode, Pi, and Claude Code.","repo":"https://github.com/marcusrbrown/systematic","tags":[]},{"name":"@telemetry-dev/opencode","pkg":"@telemetry-dev/opencode","ver":"0.2.4","type":"plugins","desc":"OpenTelemetry traces for OpenCode agent turns, model calls, and tools","long":"Records OpenCode agent turns, model calls, tool executions, and session events with OpenTelemetry for telemetry.dev. Available as the @telemetry-dev/opencode npm package; source and setup instructions are in packages/opencode of the linked SDK repository.","repo":"https://github.com/telemetry-dev/telemetry","tags":[]},{"name":"toon-config","pkg":"toon-config","ver":"1.0.2","type":"plugins","desc":"Loads TOON based, AGENTS.toon rather than Markdown","long":"Use TOON based agent instructions. Command to analyize and improve agent instructions.","repo":"https://github.com/mmynsted/opencode-toon-config-plugin","tags":[]},{"name":"TypeUI","pkg":"","ver":"","type":"plugins","desc":"Design systems, UI prompts, and layout variation guidance","long":"Open-source design layer for OpenCode that provides curated design skills, UI prompts, and layout variation guidance so agents can generate more consistent interfaces. Includes an <a href=\\"https://www.typeui.sh/docs/guides/opencode\\">OpenCode setup guide</a>.","repo":"https://github.com/bergside/typeui","tags":[]},{"name":"ul-opencode-event","pkg":"@ulthon/ul-opencode-event","ver":"0.1.58","type":"plugins","desc":"Multi-channel notifications (SMTP, DingTalk, Feishu) and token usage analytics","long":"Get notified when OpenCode sessions complete, error, or need your attention - via SMTP email, DingTalk robot, or Feishu robot.\\n- Multi-channel: SMTP, DingTalk, Feishu, local JSONL file\\n- Multi-level token analytics: message / session / total / project scopes\\n- 74+ template variables with i18n suppor","repo":"https://gitee.com/ulthon/ul-opencode-event","tags":["notifications","email","dingtalk","feishu","token-tracking","usage-analytics"]},{"name":"UNMOJI","pkg":"@bastiangx/opencode-unmoji","ver":"1.0.0","type":"plugins","desc":"Strip emojis from output","long":"A simple plugin that strips ALL emojis from agent outputs in Opencode.","repo":"https://codeberg.org/bastiangx/opencode-unmoji","tags":[]},{"name":"WakaTime","pkg":"wakatime","ver":"1.2.0","type":"plugins","desc":"WakaTime integration","long":"WakaTime integration plugin for tracking coding activity in opencode sessions.","repo":"https://github.com/angristan/opencode-wakatime","tags":[]},{"name":"Xquik","pkg":"x-twitter-scraper","ver":"0.20.0","type":"plugins","desc":"X/Twitter data skill & MCP server","long":"X/Twitter data skill — MCP server, REST API, 20 extraction tools. Works with Claude Code, Cursor, Codex, and 40+ agents.","repo":"https://github.com/Xquik-dev/x-twitter-scraper","tags":[]},{"name":"OpenCode Light Themes","pkg":"","ver":"","type":"themes","desc":"A curated collection of 21 light color themes for OpenCode","long":"The largest collection of light themes for OpenCode. Includes 21 carefully crafted light themes converted from popular VS Code themes — scaefy-light (Atom One Light), Solarized Light, Vivid Light, Coffee Cream, GitHub Light, Quiet Light, Bluloco Light, Brackets Light Pro, NetBeans Light, Ysgrifennwr","repo":"https://github.com/fatihtoprakk/opencode-light-themes","tags":[]}]`),mn=[{url:"https://raw.githubusercontent.com/awesome-opencode/awesome-opencode/main/dist/registry.json"},{url:"https://api.github.com/repos/awesome-opencode/awesome-opencode/contents/dist/registry.json?ref=main",accept:"application/vnd.github.raw+json"},{url:"https://raw.githubusercontent.com/Gracdjd/awesome-opencode/main/dist/registry.json"},{url:"https://api.github.com/repos/Gracdjd/awesome-opencode/contents/dist/registry.json?ref=main",accept:"application/vnd.github.raw+json"}],Dr=720*60*1e3,fn=Br;function vn(){const e=process.env.XDG_CACHE_HOME;return e?R.join(e,"opencode","plugin-hub"):R.join(Me.homedir(),".cache","opencode","plugin-hub")}function bn(){return R.join(vn(),"registry.json")}const Nr=/"plugin"\s*:\s*\[\s*"([^"]+)"/,Zt=/^(@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i;function Kt(e){const r=Nr.exec(e.installation??"");if(r?.[1])return r[1];const o=(e.displayName??"").trim();if(Zt.test(o)&&!o.includes(" "))return o;const a=(e.repoUrl??"").replace(/\/+$/,"").split("/").pop()?.replace(".git","")??"";return Zt.test(a)?a:""}const Ze=new Map;for(const e of fn)Ze.set(e.repo,e),e.pkg&&Ze.set(`pkg:${e.pkg}`,e);function Ur(e){return e.replace(/\/+$/,"").replace(/\.git$/,"")}function Je(e,r){const o=[],n=new Set;for(const a of e){const s=a.type??"plugins";if(s!=="plugins"&&s!=="mcp"&&s!=="themes")continue;const p=Ur(a.repoUrl??"");if(!p||n.has(p))continue;n.add(p);const u=Ze.get(p)??Ze.get(`pkg:${Kt(a)}`),d=u?.pkg??Kt(a);o.push({name:a.displayName??d??p,pkg:d,version:u?.ver??"",type:s,desc:(a.tagline??"").trim(),long:(a.description??"").trim().slice(0,300),repo:p,tags:(a.tags??[]).slice(0,6),installed:d?r.has(d):!1})}return o}async function Rr(){let e="";for(const r of mn)try{const o={accept:r.accept??"application/json"},n=await fetch(r.url,{signal:AbortSignal.timeout(12e3),headers:o});if(!n.ok){e=`${new URL(r.url).host} 返回 ${n.status}`;continue}const a=await n.json();if(!Array.isArray(a)){e="registry 格式不是数组";continue}return{entries:a,url:r.url}}catch(o){e=wt(o)}throw new Error(e||"无法连接插件目录")}async function Gr(){try{const e=await V.readFile(bn(),"utf8"),r=JSON.parse(e);return Array.isArray(r.entries)?r:void 0}catch{return}}async function Fr(e,r){const o=Date.now();try{await V.mkdir(vn(),{recursive:!0}),await V.writeFile(bn(),JSON.stringify({fetchedAt:o,url:r,entries:e}),"utf8")}catch{}return o}const ft=mn[0].url;async function qr(e,r){const o=await Gr(),n=o!==void 0&&Date.now()-o.fetchedAt<Dr;if(o&&n&&!r)return{entries:Je(o.entries,e),source:"cache",registry:o.url??ft,fetchedAt:o.fetchedAt,error:""};try{const a=await Rr(),s=await Fr(a.entries,a.url);return{entries:Je(a.entries,e),source:"network",registry:a.url,fetchedAt:s,error:""}}catch(a){return o?{entries:Je(o.entries,e),source:"cache",registry:o.url??ft,fetchedAt:o.fetchedAt,error:wt(a)}:{entries:Je(fn.map(Hr),e),source:"builtin",registry:ft,fetchedAt:0,error:wt(a)}}}function Hr(e){return{displayName:e.name,type:e.type,tagline:e.desc,description:e.long,repoUrl:e.repo,tags:e.tags}}function wt(e){const r=e instanceof Error?e.message:String(e);return/fetch failed|network|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up/i.test(r)?"无法连接插件目录(网络受限或连接被重置),已改用本地缓存":/aborted|timeout/i.test(r)?"连接插件目录超时,已改用本地缓存":r}var Vr=t.template("<div class=ph-detail-loading><span>正在读取 npm 上的 README 与统计…"),Wr=t.template("<span class=ph-badge data-tone=accent>v"),kt=t.template("<span class=ph-badge data-tone=success>已安装"),Jr=t.template("<span class=ph-badge data-tone=warning>可更新"),Qr=t.template("<span class=ph-badge data-tone=danger>已废弃"),Xr=t.template("<div class=ph-detail-head><div class=ph-name-row></div><div class=ph-detail-desc>"),Yr=t.template("<div class=ph-detail-stats><div class=ph-detail-stat><b></b><span>周下载</span></div><div class=ph-detail-stat><b></b><span>月下载</span></div><div class=ph-detail-stat><b></b><span>已发布版本</span></div><div class=ph-detail-stat><b></b><span>"),Zr=t.template("<div class=ph-warning><span>"),Kr=t.template("<div class=ph-warning data-tone=danger><span>"),eo=t.template("<span class=ph-chip>许可证 "),to=t.template("<span class=ph-chip>发布于 "),no=t.template("<span class=ph-chip>首次发布 "),ro=t.template("<span class=ph-chip>维护者 "),oo=t.template("<div class=ph-detail-meta>"),yn=t.template("<div class=ph-chips>"),io=t.template("<div class=ph-detail-links>"),ao=t.template("<details class=ph-details><summary>依赖 <!> 个</summary><div class=ph-chips>"),so=t.template("<div class=ph-readme-note>README 较长,这里只显示前一部分。完整内容见 npm 页面。"),lo=t.template("<section class=ph-section><div class=ph-section-title>README"),co=t.template("<div class=ph-readme-empty>"),po=t.template("<div class=ph-detail>"),uo=t.template("<span class=ph-detail-error>"),go=t.template("<div class=ph-dialog-footer><span class=ph-spacer>"),xt=t.template("<span class=ph-chip>"),ho=t.template("<div class=ph-readme-empty>这个包没有附带 README。可以打开 npm 页面或项目主页进一步了解。"),mo=t.template("<span class=ph-count>"),fo=t.template('<span class="ph-count ph-count-alert"> 可更新'),vo=t.template("<button class=ph-tab role=tab aria-controls=ph-tabpanel>"),bo=t.template("<span class=ph-version-arrow> → v"),yo=t.template("<span class=ph-version>"),wo=t.template("<span class=ph-pkg>"),vt=t.template("<span class=ph-badge data-tone=accent>可更新 → v"),Le=t.template("<span class=ph-dot>"),ko=t.template("<span>v"),xo=t.template("<span>仅 GitHub 发布"),So=t.template("<span>"),$o=t.template("<span class=ph-badge>需手动"),Co=t.template('<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div></div><div class=ph-chips></div></div><div class=ph-card-body role=button tabindex=0><div class="ph-desc ph-clamp"></div><div class=ph-meta><span class=ph-type></span></div></div></div><div class=ph-actions>'),_o=t.template("<span>by "),Ao=t.template("<span>更新"),Oo=t.template('<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div><span class=ph-pkg>v</span></div><div class=ph-chips></div></div><div class=ph-card-body role=button tabindex=0><div class="ph-desc ph-clamp"></div><div class=ph-meta><span>/周</span><span class=ph-dot></span><span>/月</span></div></div></div><div class=ph-actions>'),To=t.template("<span class=ph-badge data-tone=warning>未能检查"),Io=t.template("<span class=ph-badge>本地目录"),Lo=t.template("<span>更新会覆盖目录内容,原文件自动备份"),Mo=t.template("<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div><span class=ph-pkg></span></div><div class=ph-chips><span class=ph-badge></span></div></div><div class=ph-card-body><div class=ph-meta></div></div></div><div class=ph-actions>"),jo=t.template("<h2 class=ph-title>插件中心"),zo=t.template("<div class=ph-notice><span></span><button type=button class=ph-notice-close aria-label=关闭提示>"),Po=t.template("<div class=ph-notice data-tone=error><span>"),Eo=t.template("<div class=ph-notice data-tone=warning><span>。重启后重新打开插件中心会再读取。"),Bo=t.template("<div class=ph-notice data-tone=info><span>有 <!> 项配置变更待重启生效。插件在应用启动时加载,重启后才能运行新配置。"),Ne=t.template("<div class=ph-list>"),Do=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-filters><div class=ph-filter-row><div class=ph-grow></div><div class=ph-chips>"),No=t.template("<div class=ph-empty><strong>搜索 npm 上的 OpenCode 插件</strong><span>按名称或用途搜索,例如 auth、notify、memory。点开任意结果可以看 README、下载量和主页。</span><div class=ph-chips>"),Uo=t.template("<div class=ph-resultbar><h3 class=ph-h3>搜索结果 <span class=ph-count></span></h3><div class=ph-sort>"),Ro=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-searchbar><div class=ph-grow></div></div><div class=ph-meta><span>直查 npm 上带 opencode-plugin 标签的包,覆盖精选目录之外的长尾;结果未经人工筛选。"),Go=t.template("<span class=ph-meta>"),Fo=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-resultbar><h3 class=ph-h3>已安装 <span class=ph-count></span></h3><div class=ph-chips><button class=ph-chip>可更新<span class=ph-chip-count></span></button></div><span class=ph-spacer>"),qo=t.template(`<div class=ph-root><style>
|
|
55
|
+
`;try{return Ge.spawn("/bin/sh",["-c",e],{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}async function Pr(e){const r=await ge();try{return e.length===0?{ok:!1,message:"找不到 opencode CLI",state:r}:(Ge.spawn(e[0],[...e.slice(1),"reload"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"已请求重载配置;插件列表变化建议完全退出应用再打开",state:r})}catch(o){return{ok:!1,message:ce(o),state:r}}}async function Er(e){const r=await ge();if(!e)return{items:r.plugins.map(Qe),error:"无法连接后台服务,运行状态未知"};try{const o=await fetch(`${e.url.replace(/\/+$/,"")}/api/plugin`,{signal:AbortSignal.timeout(8e3),headers:{accept:"application/json",...e.headers}});if(!o.ok)return{items:r.plugins.map(Qe),error:`后台服务返回 ${o.status},运行状态未知`};const n=await o.text();let i;try{i=JSON.parse(n)}catch{return{items:r.plugins.map(Qe),error:"后台返回的不是 JSON,运行状态未知"}}const s=Array.isArray(i)?i:i.data??[];return{items:r.plugins.map(p=>{const u=ye(p.spec).name,f=s.find(x=>{const S=x.source;return S?S.type==="package"&&typeof S.target=="string"?ye(S.target).name===u:S.type==="local"&&p.kind==="path"&&typeof S.path=="string"?U.resolve(S.path)===U.resolve(ot(p.spec)):!1:!1}),h={spec:p.spec,name:p.name};return f?f.state?.status==="failed"?{...h,status:"failed",runtimeVersion:"",error:f.state.error??"加载失败",available:!0}:{...h,status:"loaded",runtimeVersion:f.source?.type==="package"?f.source.version??"":p.version,error:"",available:!0}:{...h,status:"unknown",runtimeVersion:"",error:"",available:!0}}),error:""}}catch(o){return{items:r.plugins.map(Qe),error:`无法读取运行状态:${ce(o)}`}}}function Qe(e){return{spec:e.spec,name:e.name,status:"unknown",runtimeVersion:"",error:"",available:!1}}function ce(e){return e instanceof Error?e.message:String(e)}const Br=JSON.parse(`[{"name":"@aerovato/operator-memory","pkg":"","ver":"","type":"plugins","desc":"Durable context for agent-driven development","long":"Operator Memory gives the agent durable memory made of ordinary Markdown: specs, decisions, standards, and research, kept across private, shared, and user partitions. Every file is yours to read, correct, or remove, and new sessions start from that knowledge. No embeddings, no vector database, no ho","repo":"https://github.com/aerovato/operator-memory","tags":["memory","context","documentation","markdown"]},{"name":"Agent Memory","pkg":"opencode-agent-memory","ver":"0.3.1","type":"plugins","desc":"Letta-inspired memory","long":"Gives the agent persistent, self-editable memory blocks inspired by Letta agents.","repo":"https://github.com/joshuadavidthomas/opencode-agent-memory","tags":[]},{"name":"Agent Notifications","pkg":"","ver":"","type":"plugins","desc":"Desktop and webhook alerts for OpenCode sessions","long":"Desktop and optional webhook notifications for OpenCode root-session completion, questions, permissions, and errors on macOS, Linux, and Windows.","repo":"https://github.com/777genius/agent-notifications","tags":[]},{"name":"Agent Skills (JDT)","pkg":"opencode-agent-skills","ver":"0.7.0","type":"plugins","desc":"Dynamic skills loader","long":"Dynamic skills loader that discovers skills from project, user, and plugin directories.","repo":"https://github.com/joshuadavidthomas/opencode-agent-skills","tags":[]},{"name":"OpenCode Antigravity CLI Auth","pkg":"opencode-agy-auth","ver":"2.1.1","type":"plugins","desc":"Google Antigravity account auth","long":"Authenticate the Opencode CLI with your Google account so you can use your existing Antigravity plan.","repo":"https://github.com/anthonyhaussman/opencode-agy-auth","tags":[]},{"name":"AIDevOps","pkg":"aidevops","ver":"3.39.125","type":"plugins","desc":"AI DevOps framework and OpenCode plugin","long":"OpenCode-first AI DevOps framework with agents, skills, workflows, safety hooks, memory, GitHub worker dispatch, and integrations for code, infrastructure, content, SEO, and operations.","repo":"https://github.com/marcusquinn/aidevops","tags":[]},{"name":"Antigravity Auth","pkg":"opencode-antigravity-auth","ver":"2.1.2","type":"plugins","desc":"Google Antigravity models","long":"Use Gemini and Anthropic models for free via Google Antigravity IDE authentication.","repo":"https://github.com/NoeFabris/opencode-antigravity-auth","tags":[]},{"name":"basemind","pkg":"basemind","ver":"0.31.1","type":"plugins","desc":"Full AI context layer over MCP — code-map, document RAG, agent memory, web crawl, git history","long":"Full AI context layer over MCP — tree-sitter code-map, document RAG, shared agent memory, web crawl, and git history. 300+ languages. Published to npm as basemind-opencode (https://www.npmjs.com/package/basemind-opencode).","repo":"https://github.com/Goldziher/basemind","tags":[]},{"name":"Beads Plugin","pkg":"opencode-beads","ver":"0.9.0","type":"plugins","desc":"Beads issue tracker integration","long":"Integration for Steve Yegge's beads issue tracker with /bd-* commands.","repo":"https://github.com/joshuadavidthomas/opencode-beads","tags":[]},{"name":"BRHP","pkg":"","ver":"","type":"plugins","desc":"Persistent planning state","long":"Structured, persistent planning for OpenCode with local session state, /brhp commands, bounded planner history, and a TUI sidebar.","repo":"https://github.com/ZanzyTHEbar/brhp","tags":[]},{"name":"bro","pkg":"bro","ver":"1.0.7","type":"plugins","desc":"Re-explains the last reply in plain language","long":"One-file Agent Skill that re-explains the assistant's last reply (or pasted text) in plain language when it was too dense. The installer adds a \`/bro\` command for OpenCode (\`~/.config/opencode/skills/bro/SKILL.md\` plus a command wrapper); also works in Claude Code, Codex, Cursor and Hermes.","repo":"https://github.com/luchasarie/bro-skill","tags":[]},{"name":"cache-stats","pkg":"","ver":"","type":"plugins","desc":"Showing the active session's cache hit rate in a popup dialog","long":"This plugin shows the overall cache hit rate, a per-model breakdown, a per subagent breakdown and the associated cost, making it easy to understand cache performance at a glance.","repo":"https://github.com/nmdra/opencode-cache-stats","tags":[]},{"name":"Caspian","pkg":"caspian-opencode-plugin","ver":"0.1.7","type":"plugins","desc":"Give your OpenCode agent an inbox — email, Telegram, and Discord","long":"Official Caspian plugin for OpenCode. Gives the agent a bidirectional inbox — email, Telegram, and Discord — with slash commands, session threading back to Gmail, and desktop notifications. No Caspian account required; on first start the plugin mints a sandbox project and provisions an agent email. ","repo":"https://github.com/TryCaspian/caspian-sdk/tree/main/packages/opencode","tags":["email","telegram","discord","inbox","messaging","notifications"]},{"name":"CC Safety Net","pkg":"","ver":"","type":"plugins","desc":"Safety net catching destructive commands","long":"A Claude Code plugin that acts as a safety net, catching destructive git and filesystem commands before they execute.","repo":"https://github.com/kenryu42/claude-code-safety-net","tags":[]},{"name":"Chisle","pkg":"chisle","ver":"3.8.1","type":"plugins","desc":"Cuts token use with terse answers, smallest-code-that-works rules and tool-output compression","long":"Installs a ruleset for terse answers that keep every decisive fact and a \\"smallest code that works\\" ladder, Chisle skills, and a compression plugin that trims oversized tool output before it re-enters the context. The same ruleset ships for Claude Code, Cursor, Codex and Gemini CLI. Install with \`np","repo":"https://github.com/JayPokale/Chisle","tags":["tokens","cost","context","productivity"]},{"name":"Subagent Reporter","pkg":"","ver":"","type":"plugins","desc":"See exactly what your subagents are up to (in the terminal) when invoked during an \`opencode run _____\` session.","long":"When opencode run <prompt> is invoked normally, the actions of the primary agent are visible in the terminal, but subagent actions are not. This makes it difficult to follow progress on the prompt, and makes it very difficult to use \`opencode run\` as part of an unattended process or script. This plu","repo":"https://github.com/raisbecka/opencode-subagent-output","tags":[]},{"name":"codemem","pkg":"codemem","ver":"0.47.3","type":"plugins","desc":"Persistent coding memory across sessions, machines, and teammates","long":"Captures coding decisions, discoveries, and fixes, with automatic context injection in OpenCode, Claude Code, and Codex. Includes MCP tools for searching and managing memories, a viewer, optional cross-machine sync, and sharing of selected projects with teammates.","repo":"https://github.com/kunickiaj/codemem","tags":[]},{"name":"Command Inject","pkg":"opencode-command-inject","ver":"1.3.1","type":"plugins","desc":"Auto-inject project commands into OpenCode","long":"Automatically discovers and injects Makefile targets, npm/pnpm/yarn/bun scripts, and local skills at startup. Type / to see and run all project commands.","repo":"https://github.com/shihyuho/opencode-command-inject","tags":[]},{"name":"ContextStream","pkg":"mcp-server","ver":"0.0.9","type":"plugins","desc":"Shared project context for OpenCode, Cursor, Claude Code, Codex, and Grok via MCP","long":"Hosted MCP server that keeps coding agents on shared project context across sessions and teammates. Works with OpenCode and other MCP-compatible clients. Endpoint https://mcp.contextstream.io/mcp — Intelligence isn’t the bottleneck. Context is.","repo":"https://github.com/contextstream/mcp-server","tags":["mcp","context","productivity","collaboration"]},{"name":"deja","pkg":"opencode-deja","ver":"0.23.5","type":"plugins","desc":"Recall what you already did in your other coding agents","long":"opencode remembers its own sessions. deja answers the other question: what you did in Claude Code, Codex, Cursor, Gemini CLI, Zed and fifteen more agents on this machine — including the months before you installed anything.\\n\\nA local Go binary indexes the transcripts those agents already wrote to dis","repo":"https://github.com/vshulcz/deja-vu","tags":["memory","recall","search","cross-agent","session-history"]},{"name":"Ditto","pkg":"ditto","ver":"0.0.11","type":"plugins","desc":"Mines your local AI coding session logs into a personal profile your agent loads before every task","long":"Mines local AI coding session logs (OpenCode, Claude Code, Codex, Copilot CLI) into a personal working profile. The OpenCode adapter reads OpenCode's SQLite session store and installs the profile into OpenCode's global rules so the agent loads it before every task. Single stdlib-only Python file, ru","repo":"https://github.com/ohad6k/ditto","tags":[]},{"name":"Dodo Payments","pkg":"dodo-agent-plugin","ver":"0.0.1","type":"plugins","desc":"Payments, subscriptions, webhooks, and billing for OpenCode agents","long":"Official Dodo Payments plugin for OpenCode (also Claude Code, Codex, Cursor). Bundles eight integration skills (checkout, subscriptions, webhooks, usage-based billing, credits, license keys, BillingSDK, best practices) plus two MCP servers — a live API server with browser OAuth and a documentation s","repo":"https://github.com/dodopayments/dodo-agent-plugin","tags":[]},{"name":"Dynamic Context Pruning","pkg":"","ver":"","type":"plugins","desc":"Optimize token usage","long":"Plugin that optimises token usage by pruning obsolete tool outputs from conversation context.","repo":"https://github.com/Tarquinen/opencode-dynamic-context-pruning","tags":[]},{"name":"Envsitter Guard","pkg":"envsitter-guard","ver":"0.1.1","type":"plugins","desc":"Prevent .env leaks","long":"OpenCode plugin that prevents agents/tools from reading or editing sensitive .env* files, while still allowing safe inspection via EnvSitter (keys + deterministic fingerprints; never values).","repo":"https://github.com/boxpositron/envsitter-guard","tags":[]},{"name":"FlowDeck","pkg":"flowdeck","ver":"0.16.1","type":"plugins","desc":"AI-powered multi-agent workflow orchestration with built-in safety intelligence","long":"FlowDeck adds a structured, multi-agent development workflow to OpenCode. It coordinates 25 specialist agents through a four-phase cycle — discuss, plan, execute, review — with persistent state that survives session restarts.\\n\\nKey features:\\n- 25 specialist agents (architect, planner, coder, reviewer","repo":"https://github.com/DVNghiem/FlowDeck","tags":["workflow","orchestration","multi-agent","planning","security","TDD"]},{"name":"ForLoop Planner","pkg":"@forloop-cc/forloop-opencode-plugin-planner","ver":"2.2.25","type":"plugins","desc":"Autopilot development. Plan with ForLoop agent. Build, Test, Deploy on cloud in one go.","long":"ForLoop offers an all-in-one platform that covers the entire development lifecycle, from initial planning and coding to automated testing and cloud deployment.","repo":"https://github.com/forloop-cc/forloop-opencode-plugin-planner","tags":[]},{"name":"Froggy","pkg":"froggy","ver":"1.1.6","type":"plugins","desc":"Hooks and specialized agents","long":"Plugin providing Claude Code-style hooks, specialized agents, and tools like gitingest.","repo":"https://github.com/smartfrog/opencode-froggy","tags":[]},{"name":"Gemini Auth","pkg":"opencode-gemini-auth","ver":"2.0.1","type":"plugins","desc":"Google account auth","long":"Authenticate the Opencode CLI with your Google account so you can use your existing Gemini plan.","repo":"https://github.com/jenslys/opencode-gemini-auth","tags":[]},{"name":"Godmode","pkg":"godmode","ver":"0.0.3","type":"plugins","desc":"Discipline layer: measure → modify → verify → keep/revert","long":"Skill plugin with 135 skills and 7 subagents that adds a measure → modify → verify → keep/revert discipline loop to AI coding agents. Works with OpenCode alongside Claude Code, Codex, Cursor, and Gemini CLI.","repo":"https://github.com/arbazkhan971/godmode","tags":[]},{"name":"Handoff","pkg":"handoff","ver":"1.3.2","type":"plugins","desc":"Session handoff prompts","long":"Creates focused handoff prompts for continuing work in a new session.","repo":"https://github.com/joshuadavidthomas/opencode-handoff","tags":[]},{"name":"Honcho","pkg":"honcho","ver":"0.4.13","type":"plugins","desc":"AI-native long-term memory for OpenCode","long":"Give OpenCode persistent memory that survives context wipes, session restarts, and fresh chats. Honcho remembers what you're working on, durable preferences, and prior context across projects. Supports cloud and self-hosted deployments with configurable session strategies.","repo":"https://github.com/plastic-labs/opencode-honcho","tags":[]},{"name":"Internet Court","pkg":"","ver":"","type":"plugins","desc":"Trust layer for agent-to-agent commerce: mandates, payments, escrow, dispute resolution.","long":"The trust layer for agent-to-agent commerce — natural-language mandates, delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all skill. By the Internet Court Consortium (internetcourt.org). MIT licensed.","repo":"https://github.com/internet-court/internet-court-skill","tags":["agent-payments","x402","erc-7710","erc-8004","escrow","genlayer"]},{"name":"kibi-opencode","pkg":"kibi-opencode","ver":"3.2.0","type":"plugins","desc":"Repo-local, branch-scoped knowledge and traceability for OpenCode","long":"Plugin-first entry point into the Kibi stack for OpenCode users. It adds context-aware\\nguidance, routes durable code comments toward Kibi artifacts, runs non-blocking background\\nsync and targeted validation checks, and helps keep repo knowledge branch-local and queryable.","repo":"https://github.com/Looted/kibi","tags":["opencode","plugin","mcp","traceability"]},{"name":"Kilo Gateway Auth","pkg":"opencode-kilo-auth","ver":"1.1.4","type":"plugins","desc":"Kilo Gateway provider","long":"Adds Kilo Gateway provider support to OpenCode.","repo":"https://github.com/JungHoonGhae/opencode-kilo-auth","tags":[]},{"name":"Lemma","pkg":"lemma","ver":"0.10.2","type":"plugins","desc":"Persistent memory layer for LLMs via MCP - local, zero-dependency, works on all clients","long":"Biological memory model for AI coding agents. Features confidence decay/boost, Fuse.js fuzzy dedup, guide system with usage tracking, cross-references, cumulative backup, virtual session tracking, and universal memory injection via tool descriptions (works on Claude Desktop, Cursor, VS Code, Gemini ","repo":"https://github.com/xenitV1/lemma","tags":["memory","mcp","persistence","context","claude","cursor"]},{"name":"opencode-llm-proxy","pkg":"opencode-llm-proxy","ver":"1.11.2","type":"plugins","desc":"OpenCode-backed API gateway with tool calling","long":"Local OpenCode plugin that exposes OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini-compatible endpoints for any model configured in OpenCode. Supports streaming, model listing, and real tool/function calling including parallel tool calls, so tools like n8n, Open WebUI, Lang","repo":"https://github.com/KochC/opencode-llm-proxy","tags":["openai","anthropic","gemini","responses-api","llm-gateway","tool-calling"]},{"name":"Magic Context","pkg":"@cortexkit/opencode-magic-context","ver":"0.49.35","type":"plugins","desc":"Lossless context management with background compression","long":"Cache-aware context management that keeps long sessions productive. Background historian compresses old conversation into structured compartments while you keep working. Includes cross-session project memory, unified search across history/memories/facts, overnight dreamer for memory maintenance, and","repo":"https://github.com/cortexkit/opencode-magic-context","tags":[]},{"name":"Mem0 OpenCode Plugin","pkg":"","ver":"","type":"plugins","desc":"Persistent memory plugin so your agent remembers across sessions","long":"OpenCode plugin that gives your agent persistent memory powered by Mem0. Includes 9 MCP memory tools, 16 slash commands, and lifecycle hooks that auto-capture decisions, search prior context at session start, and pre-fetch error memories on failures. Install with \`opencode plugin @mem0/opencode-plug","repo":"https://github.com/mem0ai/mem0","tags":[]},{"name":"Micode","pkg":"micode","ver":"0.11.0","type":"plugins","desc":"Brainstorm-Plan-Implement workflow","long":"Structured workflow with session continuity, subagent orchestration, git worktree isolation, and AST-aware tools.","repo":"https://github.com/vtemian/micode","tags":[]},{"name":"Morph Fast Apply","pkg":"","ver":"","type":"plugins","desc":"10,500+ tokens/sec code editing","long":"Integrates Morph's Fast Apply API for faster code editing with lazy edit markers and unified diff output.","repo":"https://github.com/JRedeker/opencode-morph-fast-apply","tags":[]},{"name":"Neuralyzer","pkg":"neuralyzer","ver":"1.1.5","type":"plugins","desc":"Easier Ralph loop inside harness","long":"Allow agent to wipe its own session context and re-run the first message. This allows easier and more ergonomic Ralph loop engineering.","repo":"https://github.com/gintasz/neuralyzer","tags":[]},{"name":"Oh My Cassette","pkg":"","ver":"","type":"plugins","desc":"Chat your raw clips into a finished cut","long":"Adds a local stdio MCP server that turns a chat message into an edited video: beat-synced cuts, auto-matched background music, subtitles, transitions, and picture-in-picture. Ingest local clips, then drive a persistent multi-turn editing thread — every turn returns a timeline delta and a contact-she","repo":"https://github.com/Cassette-Editor/oh-my-cassette","tags":["mcp","video","video-editing","media"]},{"name":"Oh My Opencode","pkg":"oh-my-opencode","ver":"5.1.60","type":"plugins","desc":"Agents & Pre-built tools","long":"Background agents, pre-built tools (LSP/AST/MCP), curated agents, and a Claude Code compatible layer.","repo":"https://github.com/code-yeongyu/oh-my-opencode","tags":[]},{"name":"Oh My Opencode Slim","pkg":"oh-my-opencode-slim","ver":"3.0.7","type":"plugins","desc":"Lightweight agent orchestration with reduced token usage","long":"Slimmed-down fork of oh-my-opencode focused on core agent orchestration. Features specialized sub-agents (Explorer, Oracle, Librarian, Designer, etc.), background task management, LSP/AST tools, tmux integration for live agent visibility, and MCP servers. Optimized to consume significantly fewer tok","repo":"https://github.com/alvinunreal/oh-my-opencode-slim","tags":["agents","orchestration","background-tasks","lsp","mcp"]},{"name":"open-plan-annotator","pkg":"open-plan-annotator","ver":"1.13.2","type":"plugins","desc":"Annotate LLM plans like a Google Doc!","long":"A fully local agentic coding plugin that intercepts plan mode and opens an annotation UI in your browser. Select text to strikethrough, replace, insert, or comment — then approve the plan or request changes","repo":"https://github.com/ndom91/open-plan-annotator","tags":[]},{"name":"Opencode Agents Sidebar","pkg":"opencode-agents-sidebar","ver":"3.1.0","type":"plugins","desc":"Browse configured OhMyOpenAgent agents in the TUI","long":"OpenCode sidebar plugin that displays configured OhMyOpenAgent agents with lifecycle-based categories, collapsible sections, descriptions, and model information.","repo":"https://github.com/Mark1708/opencode-agents-sidebar","tags":[]},{"name":"Boffin","pkg":"","ver":"","type":"plugins","desc":"Routed architectural guardrails for AI coding agents in OpenCode","long":"Staff-engineer layer for AI coding agents: routes per-edit architectural constraints and requires verification. Not another AGENTS.md.","repo":"https://github.com/MicSm/boffin","tags":["opencode","architecture","guardrails","code-review","cplusplus","python"]},{"name":"OpenCode Claude Code Plugin","pkg":"opencode-claude-code-plugin","ver":"0.1.2","type":"plugins","desc":"Claude models through the official Claude Code CLI, using the login you already have","long":"Runs Anthropic's Claude models in opencode through the official claude CLI as a subprocess, so opencode uses whatever the CLI is logged in as and no token is ever read or replayed. Bash, Edit and Write are proxied back to opencode's own permissions, with several accounts, per-subagent models, and on","repo":"https://github.com/khalilgharbaoui/opencode-claude-code-plugin","tags":[]},{"name":"OpenCode Claude Memory","pkg":"opencode-claude-memory","ver":"2.3.0","type":"plugins","desc":"Claude Code-compatible memory","long":"Share persistent Markdown memory between OpenCode and Claude Code using Claude Code-compatible paths and file formats.","repo":"https://github.com/kuitos/opencode-claude-memory","tags":[]},{"name":"Opencode CMD Provider","pkg":"opencode-cmd-provider","ver":"2.3.4","type":"plugins","desc":"Use CommandCode plans (Go, GOAT, Pro, Max) as an OpenCode provider.","long":"OpenCode provider plugin for the CommandCode Provider API. Authenticate via\\n/connect browser flow or COMMANDCODE_API_KEY, auto-registers all CommandCode\\nmodels ([CMD] prefix) with offline snapshot, pricing display, and per-plan\\ndeals/allowance intelligence in the sidebar and cmd_plan_summary tool.","repo":"https://github.com/rashidrazak/opencode-cmd-provider","tags":["provider","commandcode","model-discovery","auth"]},{"name":"Cursor Auth","pkg":"opencode-cursor","ver":"0.0.1","type":"plugins","desc":"Use your Cursor subscription models in OpenCode via OAuth","long":"Connects Cursor's API to OpenCode via OAuth login, automatic model discovery, and a local OpenAI-compatible proxy — use the models included in your Cursor subscription directly from OpenCode.","repo":"https://github.com/ephraimduncan/opencode-cursor","tags":[]},{"name":"opencode-dir-tree-tui","pkg":"opencode-dir-tree-tui","ver":"1.0.6","type":"plugins","desc":"File tree sidebar with Git status and quick file actions","long":"Browse project files in the OpenCode V2 sidebar with Git status indicators, custom ignore rules, path copying, and quick file and folder opening.","repo":"https://github.com/aihaipeng/opencode-dir-tree-tui","tags":[]},{"name":"OpenCode Ensemble","pkg":"@hueyexe/opencode-ensemble","ver":"0.20.0","type":"plugins","desc":"Parallel agent teams for OpenCode","long":"Coordinate parallel OpenCode agents with peer messaging, a shared task board, git worktree isolation, and a live dashboard.","repo":"https://github.com/hueyexe/opencode-ensemble","tags":["agents","multi-agent","orchestration","worktrees","dashboard"]},{"name":"opencode-failover","pkg":"opencode-failover","ver":"2.0.7","type":"plugins","desc":"Automatic API-key failover and rotation across multiple provider keys","long":"OpenCode plugin that automatically rotates API keys across multiple provider credentials. When a key hits a rate limit, the plugin quarantines it and switches to the next available key with zero downtime. Features weighted round-robin distribution, exponential backoff quarantine, retry-after header ","repo":"https://github.com/bulutmuf/opencode-failover","tags":[]},{"name":"GitHub Release","pkg":"opencode-github-release","ver":"0.6.0","type":"plugins","desc":"Automated GitHub releases","long":"Create and publish GitHub releases with semantic versioning, tag management, and auto-generated release notes.","repo":"https://github.com/amestsantim/opencode-github-release","tags":[]},{"name":"GoopSpec","pkg":"goopspec","ver":"0.2.9","type":"plugins","desc":"Spec-driven development workflow","long":"Transforms AI-assisted coding with spec-driven workflows. Features 5-phase workflow (Plan, Research, Specify, Execute, Accept), contract gates for user confirmation, 12 specialized subagents, persistent memory system, wave-based execution with atomic commits, and deviation rules for handling unexpec","repo":"https://github.com/hffmnnj/opencode-goopspec","tags":[]},{"name":"GPT Imagegen","pkg":"opencode-gpt-imagegen","ver":"1.2.2","type":"plugins","desc":"gpt-image-2 in OpenCode — no API cost when using your ChatGPT subscription","long":"Brings gpt-image-2 (ChatGPT Images 2) image generation to OpenCode. When you sign into OpenCode with your ChatGPT account, generations are billed against your existing Plus / Pro / Business plan — no per-image API cost. An OpenAI API key path is also planned. Supports reference images for style guid","repo":"https://github.com/yuji-hatakeyama/opencode-gpt-imagegen","tags":["openai","gpt-image-2","gpt-image","image-generation","image-editing","text-to-image"]},{"name":"Opencode LiteLLM","pkg":"opencode-litellm","ver":"0.1.0","type":"plugins","desc":"Auto-discover models from a LiteLLM proxy","long":"Drop-in LiteLLM provider for OpenCode with zero configuration. Auto-detects a running\\nLiteLLM proxy on common ports (4000, 8000, 8080), pulls every model from /v1/models,\\nand registers them in OpenCode automatically — no model lists to hand-maintain. Smart\\nname formatting, modality categorization (c","repo":"https://github.com/yuseferi/opencode-litellm","tags":["litellm","provider","openai-compatible","llm-proxy","model-discovery"]},{"name":"Opencode Mem","pkg":"opencode-mem","ver":"2.41.0","type":"plugins","desc":"Persistent memory with vector database","long":"A persistent memory system for AI coding agents that enables long-term context retention across sessions using local vector database technology. Features dual memory scopes, web interface, auto-capture system, and multi-provider AI support.","repo":"https://github.com/tickernelz/opencode-mem","tags":[]},{"name":"OpenCode Mission Control","pkg":"opencode-mission-control","ver":"1.6.0","type":"plugins","desc":"Command center for parallel agents — worktree isolation, DAG plans, merge train, PRs","long":"Orchestrates parallel OpenCode agents in tmux-isolated git worktrees with live inspection (capture/attach/diff), a dashboard overview, agent status reporting, and in-chat notifications. Supports DAG-based plans with autopilot/copilot/supervisor modes and a merge train with test gating and automatic ","repo":"https://github.com/nigel-dev/opencode-mission-control","tags":[]},{"name":"Opencode Models Discovery","pkg":"opencode-models-discovery","ver":"2.1.1","type":"plugins","desc":"Configurable model discovery and filtering without long manual config","long":"OpenCode plugin for discovering models from OpenAI-compatible providers and API gateways, with provider and model filtering so users can avoid maintaining large configs or loading every model at once.","repo":"https://github.com/yuhp/opencode-models-discovery","tags":[]},{"name":"OpenCode ntfy.sh","pkg":"opencode-ntfy.sh","ver":"1.1.0","type":"plugins","desc":"Push notifications to keep you in the know, even when you're on the go.","long":"An OpenCode plugin that adds push notifications through ntfy.sh.","repo":"https://github.com/lannuttia/opencode-ntfy.sh","tags":[]},{"name":"OpenAI Native Compaction","pkg":"opencode-openai-compact","ver":"1.4.0","type":"plugins","desc":"Use OpenAI's official Responses API compaction in OpenCode","long":"Routes OpenCode session compaction for OpenAI providers through \`/responses/compact\`, stores the returned compacted output locally, and injects it into the next Responses request so long sessions use OpenAI's native compaction instead of a prompt-written summary.","repo":"https://github.com/partment/opencode-openai-compact","tags":[]},{"name":"OpenWork for OpenCode","pkg":"","ver":"","type":"plugins","desc":"Official OpenWork plugin to deploy AI models, skills, and MCPs to your team's OpenCode","long":"The official plugin from OpenWork. Centrally deploy AI models, skills, and MCP servers to your whole team. Admins add a model provider, skill, or MCP connection once and choose who gets it; everyone receives it in OpenCode after a single sign-in. No shared API keys, no copying MCP configs between ma","repo":"https://github.com/different-ai/openwork/tree/dev/packages/opencode-plugin","tags":[]},{"name":"opencode-plugin-otel","pkg":"@devtheops/opencode-plugin-otel","ver":"2.0.1","type":"plugins","desc":"OpenTelemetry telemetry exporter for opencode sessions, mirroring Claude Code monitoring signals","long":"Exports metrics, logs, and traces from opencode sessions via OTLP/gRPC to any OpenTelemetry-compatible backend (Datadog, Honeycomb, Grafana Cloud, etc.). Instruments session lifecycle, token usage, cost, tool durations, and git commits — mirroring the same signals as Claude Code's monitoring.","repo":"https://github.com/DEVtheOPS/opencode-plugin-otel","tags":[]},{"name":"OpenCode Pollinations Plugin","pkg":"opencode-pollinations-plugin","ver":"6.5.5","type":"plugins","desc":"Full Pollinations.ai integration — free unlimited AI models, 17+ multimodal tools, hourly free tiers & Safety Net.","long":"The ultimate bridge between OpenCode and the Pollinations.ai ecosystem. Access 30+ free and enterprise AI models (OpenAI, Gemini, Mistral, Claude...) with hourly Pollen resets. Includes 17+ agent tools (image, video, audio, music generation, background removal, web search, transcription, QR codes, d","repo":"https://github.com/fkom13/opencode-pollinations-plugin","tags":[]},{"name":"PR Auto-Signature","pkg":"opencode-pr-signature","ver":"1.2.2","type":"plugins","desc":"Automatically adds AI model signature to PRs, Issues, and Commits","long":"Plugin that automatically appends AI model signature to Pull Requests, Issues, and git commit messages. Supports GitHub MCP tools, git CLI, and gh CLI. Recognizes 90+ AI models including Claude, GPT, Gemini, DeepSeek, Llama, Mistral, and more.","repo":"https://github.com/arttttt/opencode-pr-signature","tags":[]},{"name":"Opencode Quota","pkg":"opencode-quota","ver":"0.0.1-dev","type":"plugins","desc":"Quota toasts and token tracking","long":"Track quota and token usage across providers via automatic toasts and slash commands.","repo":"https://github.com/slkiser/opencode-quota","tags":[]},{"name":"OpenCodeRAG","pkg":"","ver":"","type":"plugins","desc":"Local-first RAG plugin for semantic code search with tree-sitter chunking and LanceDB","long":"A local-first Retrieval-Augmented Generation plugin for OpenCode that enables semantic code\\nsearch across your workspace. Features AST-aware chunking via tree-sitter (19 languages),\\nincremental indexing with file-change detection, watch mode for live re-indexing, and\\nconfigurable embeddings via Olla","repo":"https://github.com/MrDoe/OpenCodeRAG","tags":[]},{"name":"opencode-review","pkg":"","ver":"","type":"plugins","desc":"Automatic structured code review with configurable dimensions and auto-fix","long":"An automatic code review plugin for OpenCode CLI. Reviews staged changes when session goes idle, with configurable cooldown, multi-dimension analysis (code quality, security, performance, testing, documentation), severity levels, and auto-fix chain support.","repo":"https://github.com/sun-praise/opencode-review","tags":[]},{"name":"opencode-short-term-memory","pkg":"","ver":"","type":"plugins","desc":"Maintain user instructions and preferences throughout long sessions. No more repeating yourself.","long":"Automatically summarizes conversation context into structured session memory and injects it back into the system prompt every few turns — preserving user instructions, project context, decisions, and active references across long chats and compactions.","repo":"https://github.com/andrejtonev/opencode-short-term-memory","tags":[]},{"name":"opencode-skills-tui","pkg":"opencode-skills-tui","ver":"1.2.3","type":"plugins","desc":"Browse skills, track loaded state, and preview SKILL.md","long":"OpenCode V2 skills sidebar with loaded-state tracking, SKILL.md previews, token estimates, and skill mentions in prompts.","repo":"https://github.com/aihaipeng/opencode-skills-tui","tags":[]},{"name":"opencode-snip","pkg":"opencode-snip","ver":"3.0.0","type":"plugins","desc":"OpenCode plugin that prefixes shell commands with snip to reduce LLM token consumption by 60-90%","long":"Automatically prefixes supported shell commands (git, go, cargo, npm, docker, etc.) with snip to filter output before it reaches your LLM context window.","repo":"https://github.com/VincentHardouin/opencode-snip","tags":[]},{"name":"Opencode Snippets","pkg":"opencode-snippets","ver":"3.4.0","type":"plugins","desc":"Instant inline text expansion","long":"Instant inline text expansion for OpenCode. Type #snippet anywhere in your message and watch it transform. Brings DRY principles to prompt engineering with composable, shell-enabled snippets.","repo":"https://github.com/JosXa/opencode-snippets","tags":[]},{"name":"OpenCode Swarm","pkg":"opencode-swarm","ver":"7.201.2","type":"plugins","desc":"Verification-gated swarm with architect, review, test, and security agents","long":"Verification-gated OpenCode swarm with architect planning, independent review, test engineering, security checks, and resumable evidence.","repo":"https://github.com/zaxbysauce/opencode-swarm","tags":[]},{"name":"Opencode Synced","pkg":"opencode-synced","ver":"0.11.0","type":"plugins","desc":"Sync configs across machines","long":"Enables syncing global opencode configurations across machines with public/private visibility options.","repo":"https://github.com/iHildy/opencode-synced","tags":[]},{"name":"System Prompt Logger","pkg":"opencode-system-prompt-logger","ver":"1.0.0","type":"plugins","desc":"System prompt logger","long":"OpenCode plugin that intercepts the system prompt before it's sent to the LLM and logs it.","repo":"https://github.com/tlinhart/opencode-system-prompt-logger","tags":[]},{"name":"Opencode Telemetry","pkg":"opencode-telemetry","ver":"0.3.4","type":"plugins","desc":"Passive cross-session telemetry to local SQLite; cost rollups across agent orchestration chains","long":"Logs every opencode session to a local SQLite database automatically — tokens, tool calls, skills, per-turn cost. Aggregates costs across orchestration chains (conductor + child sessions), offers turn-by-turn forensic inspection, and ships an \`octm\` CLI for reports without spending model tokens. Zer","repo":"https://github.com/agostinilabsrl/opencode-telemetry","tags":["telemetry","observability","cost-tracking","sqlite","local-first","orchestration"]},{"name":"Opencode update notifier","pkg":"opencode-update-notifier","ver":"0.4.0","type":"plugins","desc":"Notify about plugin updates.","long":"Checks if your pinned plugins have newer versions available and shows a notification.","repo":"https://github.com/tim-hilde/opencode-update-notifier","tags":[]},{"name":"Opencode Usage Monitor","pkg":"opencode-usage-monitor","ver":"3.1.0","type":"plugins","desc":"Monitor OpenAI and Z.AI usage quotas in the TUI","long":"OpenCode sidebar plugin that displays API usage quotas for OpenAI and Z.AI providers with per-model breakdowns, spend tracking, and configurable refresh controls.","repo":"https://github.com/Mark1708/opencode-usage-monitor","tags":[]},{"name":"Opencode Visualizer","pkg":"","ver":"","type":"plugins","desc":"2D pixel-art office for AI agents","long":"Turning raw OpenCode terminal logs into cozy 2D pixel office chaos. Watch your agents work, idle, and celebrate success in a bustling virtual office.","repo":"https://github.com/psinetron/opencode-visualiser","tags":[]},{"name":"OrgX OpenCode Plugin","pkg":"@useorgx/orgx-opencode-plugin","ver":"0.1.0-alpha.7","type":"plugins","desc":"OrgX Work Graph peer for task dispatch, receipts, deviations, and passive reconciliation","long":"OrgX OpenCode Plugin connects OpenCode sessions to the OrgX execution control plane. It receives OrgX task dispatches, drives the user's local OpenCode session, posts execution receipts and deviations back to OrgX, and writes compact Work Graph events for later audit-first reconciliation.","repo":"https://github.com/useorgx/orgx-opencode-plugin","tags":["agent-orchestration","work-graph","task-dispatch","receipts","mcp"]},{"name":"Plannotator","pkg":"","ver":"","type":"plugins","desc":"Interactive plan review UI","long":"Plan review UI with visual annotation, private/offline sharing, and Obsidian/Bear integration.","repo":"https://github.com/backnotprop/plannotator","tags":[]},{"name":"Rehydra","pkg":"rehydra","ver":"0.16.5","type":"plugins","desc":"Prevent your coding agent from leaking secrets to LLM providers","long":"Intercepts the conversation between OpenCode and the LLM, replacing secrets from .env files and detected API keys, tokens, and credentials with placeholders before they leave your machine. Secrets are transparently restored before any tool executes locally. Supports pattern-based detection for Strip","repo":"https://github.com/rehydra-ai/rehydra-sdk","tags":[]},{"name":"Ring a Bell Example","pkg":"","ver":"","type":"plugins","desc":"Simple terminal bell plugin","long":"A simple plugin to ring the terminal bell once a request is complete.","repo":"https://gist.github.com/ahosker/267f375a65378bcb9a867fd9a195db1e","tags":[]},{"name":"Simple Memory","pkg":"","ver":"","type":"plugins","desc":"Git-based memory","long":"Simple plugin to manage memory inside a git repo that can be committed and reviewed by team members.","repo":"https://github.com/cnicolov/opencode-plugin-simple-memory","tags":[]},{"name":"SonarQube","pkg":"sonarqube","ver":"0.0.1","type":"plugins","desc":"Automatically enforce SonarQube code quality and security in the agent coding loop","long":"SonarQube is the AI code quality and security verification platform used by millions of developers to catch bugs, vulnerabilities, and leaked secrets. This plugin enforces those standards in the agent coding loop: 7,500+ distinct issue types, secrets scanning, agentic analysis, and quality gates acr","repo":"https://github.com/SonarSource/sonarqube-agent-plugins","tags":["sonarqube","code-quality","static-analysis","security","secrets"]},{"name":"Superpowers","pkg":"superpowers","ver":"0.0.2","type":"plugins","desc":"Complete software development methodology with composable skills for coding agents","long":"Gives your coding agent a structured methodology - brainstorm specs, write plans, run TDD, dispatch subagents, and review work. Skills trigger automatically across Claude Code, OpenCode, Codex, Gemini CLI, Cursor, and GitHub Copilot CLI.","repo":"https://github.com/obra/superpowers","tags":[]},{"name":"Systematic","pkg":"systematic","ver":"3.1.1","type":"plugins","desc":"Compound-engineering workflows for OpenCode, Pi, and Claude Code","long":"Provides brainstorm, plan, work, and review workflows as bundled skills and agents for OpenCode, Pi, and Claude Code.","repo":"https://github.com/marcusrbrown/systematic","tags":[]},{"name":"@telemetry-dev/opencode","pkg":"@telemetry-dev/opencode","ver":"0.2.4","type":"plugins","desc":"OpenTelemetry traces for OpenCode agent turns, model calls, and tools","long":"Records OpenCode agent turns, model calls, tool executions, and session events with OpenTelemetry for telemetry.dev. Available as the @telemetry-dev/opencode npm package; source and setup instructions are in packages/opencode of the linked SDK repository.","repo":"https://github.com/telemetry-dev/telemetry","tags":[]},{"name":"toon-config","pkg":"toon-config","ver":"1.0.2","type":"plugins","desc":"Loads TOON based, AGENTS.toon rather than Markdown","long":"Use TOON based agent instructions. Command to analyize and improve agent instructions.","repo":"https://github.com/mmynsted/opencode-toon-config-plugin","tags":[]},{"name":"TypeUI","pkg":"","ver":"","type":"plugins","desc":"Design systems, UI prompts, and layout variation guidance","long":"Open-source design layer for OpenCode that provides curated design skills, UI prompts, and layout variation guidance so agents can generate more consistent interfaces. Includes an <a href=\\"https://www.typeui.sh/docs/guides/opencode\\">OpenCode setup guide</a>.","repo":"https://github.com/bergside/typeui","tags":[]},{"name":"ul-opencode-event","pkg":"@ulthon/ul-opencode-event","ver":"0.1.58","type":"plugins","desc":"Multi-channel notifications (SMTP, DingTalk, Feishu) and token usage analytics","long":"Get notified when OpenCode sessions complete, error, or need your attention - via SMTP email, DingTalk robot, or Feishu robot.\\n- Multi-channel: SMTP, DingTalk, Feishu, local JSONL file\\n- Multi-level token analytics: message / session / total / project scopes\\n- 74+ template variables with i18n suppor","repo":"https://gitee.com/ulthon/ul-opencode-event","tags":["notifications","email","dingtalk","feishu","token-tracking","usage-analytics"]},{"name":"UNMOJI","pkg":"@bastiangx/opencode-unmoji","ver":"1.0.0","type":"plugins","desc":"Strip emojis from output","long":"A simple plugin that strips ALL emojis from agent outputs in Opencode.","repo":"https://codeberg.org/bastiangx/opencode-unmoji","tags":[]},{"name":"WakaTime","pkg":"wakatime","ver":"1.2.0","type":"plugins","desc":"WakaTime integration","long":"WakaTime integration plugin for tracking coding activity in opencode sessions.","repo":"https://github.com/angristan/opencode-wakatime","tags":[]},{"name":"Xquik","pkg":"x-twitter-scraper","ver":"0.20.0","type":"plugins","desc":"X/Twitter data skill & MCP server","long":"X/Twitter data skill — MCP server, REST API, 20 extraction tools. Works with Claude Code, Cursor, Codex, and 40+ agents.","repo":"https://github.com/Xquik-dev/x-twitter-scraper","tags":[]},{"name":"OpenCode Light Themes","pkg":"","ver":"","type":"themes","desc":"A curated collection of 21 light color themes for OpenCode","long":"The largest collection of light themes for OpenCode. Includes 21 carefully crafted light themes converted from popular VS Code themes — scaefy-light (Atom One Light), Solarized Light, Vivid Light, Coffee Cream, GitHub Light, Quiet Light, Bluloco Light, Brackets Light Pro, NetBeans Light, Ysgrifennwr","repo":"https://github.com/fatihtoprakk/opencode-light-themes","tags":[]}]`),mn=[{url:"https://raw.githubusercontent.com/awesome-opencode/awesome-opencode/main/dist/registry.json"},{url:"https://api.github.com/repos/awesome-opencode/awesome-opencode/contents/dist/registry.json?ref=main",accept:"application/vnd.github.raw+json"},{url:"https://raw.githubusercontent.com/Gracdjd/awesome-opencode/main/dist/registry.json"},{url:"https://api.github.com/repos/Gracdjd/awesome-opencode/contents/dist/registry.json?ref=main",accept:"application/vnd.github.raw+json"}],Dr=720*60*1e3,fn=Br;function vn(){const e=process.env.XDG_CACHE_HOME;return e?U.join(e,"opencode","plugin-hub"):U.join(Me.homedir(),".cache","opencode","plugin-hub")}function bn(){return U.join(vn(),"registry.json")}const Nr=/"plugin"\s*:\s*\[\s*"([^"]+)"/,Kt=/^(@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i;function en(e){const r=Nr.exec(e.installation??"");if(r?.[1])return r[1];const o=(e.displayName??"").trim();if(Kt.test(o)&&!o.includes(" "))return o;const i=(e.repoUrl??"").replace(/\/+$/,"").split("/").pop()?.replace(".git","")??"";return Kt.test(i)?i:""}const et=new Map;for(const e of fn)et.set(e.repo,e),e.pkg&&et.set(`pkg:${e.pkg}`,e);function Ur(e){return e.replace(/\/+$/,"").replace(/\.git$/,"")}function Xe(e,r){const o=[],n=new Set;for(const i of e){const s=i.type??"plugins";if(s!=="plugins"&&s!=="mcp"&&s!=="themes")continue;const d=Ur(i.repoUrl??"");if(!d||n.has(d))continue;n.add(d);const p=et.get(d)??et.get(`pkg:${en(i)}`),u=p?.pkg??en(i);o.push({name:i.displayName??u??d,pkg:u,version:p?.ver??"",type:s,desc:(i.tagline??"").trim(),long:(i.description??"").trim().slice(0,300),repo:d,tags:(i.tags??[]).slice(0,6),installed:u?r.has(u):!1})}return o}async function Rr(){let e="";for(const r of mn)try{const o={accept:r.accept??"application/json"},n=await fetch(r.url,{signal:AbortSignal.timeout(12e3),headers:o});if(!n.ok){e=`${new URL(r.url).host} 返回 ${n.status}`;continue}const i=await n.json();if(!Array.isArray(i)){e="registry 格式不是数组";continue}return{entries:i,url:r.url}}catch(o){e=wt(o)}throw new Error(e||"无法连接插件目录")}async function Gr(){try{const e=await W.readFile(bn(),"utf8"),r=JSON.parse(e);return Array.isArray(r.entries)?r:void 0}catch{return}}async function Fr(e,r){const o=Date.now();try{await W.mkdir(vn(),{recursive:!0}),await W.writeFile(bn(),JSON.stringify({fetchedAt:o,url:r,entries:e}),"utf8")}catch{}return o}const ft=mn[0].url;async function qr(e,r){const o=await Gr(),n=o!==void 0&&Date.now()-o.fetchedAt<Dr;if(o&&n&&!r)return{entries:Xe(o.entries,e),source:"cache",registry:o.url??ft,fetchedAt:o.fetchedAt,error:""};try{const i=await Rr(),s=await Fr(i.entries,i.url);return{entries:Xe(i.entries,e),source:"network",registry:i.url,fetchedAt:s,error:""}}catch(i){return o?{entries:Xe(o.entries,e),source:"cache",registry:o.url??ft,fetchedAt:o.fetchedAt,error:wt(i)}:{entries:Xe(fn.map(Hr),e),source:"builtin",registry:ft,fetchedAt:0,error:wt(i)}}}function Hr(e){return{displayName:e.name,type:e.type,tagline:e.desc,description:e.long,repoUrl:e.repo,tags:e.tags}}function wt(e){const r=e instanceof Error?e.message:String(e);return/fetch failed|network|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up/i.test(r)?"无法连接插件目录(网络受限或连接被重置),已改用本地缓存":/aborted|timeout/i.test(r)?"连接插件目录超时,已改用本地缓存":r}var Vr=t.template("<div class=ph-detail-loading><span>正在读取 npm 上的 README 与统计…"),Wr=t.template("<span class=ph-badge data-tone=accent>v"),kt=t.template("<span class=ph-badge data-tone=success>已安装"),Jr=t.template("<span class=ph-badge data-tone=warning>可更新"),Qr=t.template("<span class=ph-badge data-tone=danger>已废弃"),Xr=t.template("<div class=ph-detail-head><div class=ph-name-row></div><div class=ph-detail-desc>"),Yr=t.template("<div class=ph-detail-stats><div class=ph-detail-stat><b></b><span>周下载</span></div><div class=ph-detail-stat><b></b><span>月下载</span></div><div class=ph-detail-stat><b></b><span>已发布版本</span></div><div class=ph-detail-stat><b></b><span>"),Zr=t.template("<div class=ph-warning><span>"),Kr=t.template("<div class=ph-warning data-tone=danger><span>"),eo=t.template("<span class=ph-chip>许可证 "),to=t.template("<span class=ph-chip>发布于 "),no=t.template("<span class=ph-chip>首次发布 "),ro=t.template("<span class=ph-chip>维护者 "),oo=t.template("<div class=ph-detail-meta>"),yn=t.template("<div class=ph-chips>"),io=t.template("<div class=ph-detail-links>"),ao=t.template("<details class=ph-details><summary>依赖 <!> 个</summary><div class=ph-chips>"),so=t.template("<div class=ph-readme-note>README 较长,这里只显示前一部分。完整内容见 npm 页面。"),lo=t.template("<section class=ph-section><div class=ph-section-title>README"),co=t.template("<div class=ph-readme-empty>"),po=t.template("<div class=ph-detail>"),uo=t.template("<span class=ph-detail-error>"),go=t.template("<div class=ph-dialog-footer><span class=ph-spacer>"),xt=t.template("<span class=ph-chip>"),ho=t.template("<div class=ph-readme-empty>这个包没有附带 README。可以打开 npm 页面或项目主页进一步了解。"),mo=t.template("<span class=ph-count>"),fo=t.template('<span class="ph-count ph-count-alert"> 可更新'),vo=t.template("<button class=ph-tab role=tab aria-controls=ph-tabpanel>"),bo=t.template("<span class=ph-version-arrow> → v"),yo=t.template("<span class=ph-version>"),wo=t.template("<span class=ph-pkg>"),vt=t.template("<span class=ph-badge data-tone=accent>可更新 → v"),Le=t.template("<span class=ph-dot>"),ko=t.template("<span>v"),xo=t.template("<span>仅 GitHub 发布"),So=t.template("<span>"),$o=t.template("<span class=ph-badge>需手动"),Co=t.template('<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div></div><div class=ph-chips></div></div><div class=ph-card-body role=button tabindex=0><div class="ph-desc ph-clamp"></div><div class=ph-meta><span class=ph-type></span></div></div></div><div class=ph-actions>'),_o=t.template("<span>by "),Ao=t.template("<span>更新"),Oo=t.template('<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div><span class=ph-pkg>v</span></div><div class=ph-chips></div></div><div class=ph-card-body role=button tabindex=0><div class="ph-desc ph-clamp"></div><div class=ph-meta><span>/周</span><span class=ph-dot></span><span>/月</span></div></div></div><div class=ph-actions>'),Io=t.template("<span class=ph-badge data-tone=warning>未能检查"),To=t.template("<span class=ph-badge>本地目录"),Lo=t.template("<span>更新会覆盖目录内容,原文件自动备份"),Mo=t.template("<div class=ph-runtime-error><span>"),zo=t.template("<article class=ph-card><div class=ph-card-main><div class=ph-card-head><div class=ph-tile></div><div class=ph-card-titles><div class=ph-name-row><span class=ph-name></span></div><span class=ph-pkg></span></div><div class=ph-chips><span class=ph-badge></span></div></div><div class=ph-card-body><div class=ph-meta></div></div></div><div class=ph-actions>"),jo=t.template("<h2 class=ph-title>插件中心"),Po=t.template("<div class=ph-notice><span></span><button type=button class=ph-notice-close aria-label=关闭提示>"),Eo=t.template("<div class=ph-notice data-tone=error><span>"),Bo=t.template("<div class=ph-notice data-tone=warning><span>。配置操作不受影响,可重试读取。"),Do=t.template("<div class=ph-notice data-tone=info><span>有 <!> 项配置变更待重启生效。插件在应用启动时加载,重启后才能运行新配置。"),Ne=t.template("<div class=ph-list>"),No=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-filters><div class=ph-filter-row><div class=ph-grow></div><div class=ph-chips>"),Uo=t.template("<div class=ph-empty><strong>搜索 npm 上的 OpenCode 插件</strong><span>按名称或用途搜索,例如 auth、notify、memory。点开任意结果可以看 README、下载量和主页。</span><div class=ph-chips>"),Ro=t.template("<div class=ph-resultbar><h3 class=ph-h3>搜索结果 <span class=ph-count></span></h3><div class=ph-sort>"),Go=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-searchbar><div class=ph-grow></div></div><div class=ph-meta><span>直查 npm 上带 opencode-plugin 标签的包,覆盖精选目录之外的长尾;结果未经人工筛选。"),Fo=t.template("<span class=ph-meta>"),qo=t.template("<section class=ph-panel role=tabpanel id=ph-tabpanel><div class=ph-resultbar><h3 class=ph-h3>已安装 <span class=ph-count></span></h3><div class=ph-chips><button class=ph-chip>可更新<span class=ph-chip-count></span></button></div><span class=ph-spacer>"),Ho=t.template(`<div class=ph-root><style>
|
|
56
56
|
:root {
|
|
57
57
|
--ph-strong: var(--color-v2-text-text-contrast, var(--color-text-strong, currentColor));
|
|
58
58
|
--ph-muted: var(--color-v2-text-text-muted, var(--color-text-weak, color-mix(in srgb, currentColor 58%, transparent)));
|
|
@@ -354,6 +354,16 @@ open -b ai.opencode.desktop 2>/dev/null || open -a OpenCode
|
|
|
354
354
|
.ph-card-main { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }
|
|
355
355
|
.ph-card-body { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
|
|
356
356
|
.ph-card-body[role="button"] { cursor: pointer; border-radius: 6px; }
|
|
357
|
+
/* 加载失败时把服务端给出的原因放在卡片里,而不是只留一个徽章。 */
|
|
358
|
+
.ph-runtime-error {
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: flex-start;
|
|
361
|
+
gap: 4px;
|
|
362
|
+
color: var(--ph-danger);
|
|
363
|
+
font-size: 10.5px;
|
|
364
|
+
line-height: 1.45;
|
|
365
|
+
overflow-wrap: anywhere;
|
|
366
|
+
}
|
|
357
367
|
.ph-card-head { display: flex; align-items: flex-start; gap: 9px; }
|
|
358
368
|
.ph-card-titles { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
|
|
359
369
|
.ph-tile {
|
|
@@ -660,4 +670,4 @@ button.ph-chip:focus-visible,
|
|
|
660
670
|
.ph-list { grid-template-columns: 1fr; }
|
|
661
671
|
.ph-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
662
672
|
}
|
|
663
|
-
</style><section class=ph-hero><div class=ph-hero-copy><div class=ph-kicker>PLUGIN HUB</div><p class=ph-sub>浏览 <button type=button class=ph-inline-source title="精选目录来自 awesome-opencode 社区维护的 registry.json,不是 OpenCode 官方推荐">awesome-opencode</button> 社区维护的精选目录、搜索 npm 上的 OpenCode 插件。安装前先看下载量、README 和主页,确认它到底能做什么。</p><div class=ph-path>配置:<code></code> · <code>[]</code></div></div></section><div class=ph-head><div class=ph-toolbar><div class=ph-tabs role=tablist></div><span class=ph-spacer></span></div></div><footer class=ph-footer><div class=ph-footer-note>安装和移除只改配置,不会立即生效:插件与模型目录都是启动时快照的。改完点右上角「更多操作 → 彻底重启 OpenCode」,应用会自动退出并重新打开。`),Ho=t.template("<button class=ph-chip><span class=ph-chip-count>"),en=t.template("<div class=ph-skeleton>"),Vo=t.template("<div class=ph-empty><strong>没有匹配的插件</strong><span>试试别的关键词,或者清除筛选条件。"),Wo=t.template("<button class=ph-chip>"),Jo=t.template("<button>"),Qo=t.template("<div class=ph-empty><strong>没有找到匹配的插件</strong><span>换个关键词试试,或者清空搜索查看建议。"),Xo=t.template("<div class=ph-empty><strong>还没有安装插件</strong><span>去「精选目录」看看 awesome-opencode 的推荐,或者在「npm 搜索」里找长尾插件。"),Yo=t.template("<strong>有 <!> 个插件未能检查"),Zo=t.template("<span>部分插件没能连上 npm registry,不能当作“已是最新”。点工具栏的「检查更新」重试。"),Ko=t.template("<div class=ph-empty>"),ei=t.template("<strong>没有可更新的插件"),ti=t.template("<span>已检查的插件都已是最新版本。点工具栏的「检查更新」可以再查一次。"),ni=t.template("<div class=ph-dialog-footer><span class=ph-footer-note>拖动右下角可调整大小");const Qe=24,ri="https://github.com/awesome-opencode/awesome-opencode",oi={plugins:"插件",mcp:"MCP",themes:"主题"},ii=[{value:"all",label:"全部"},{value:"plugins",label:"插件"},{value:"mcp",label:"MCP"},{value:"themes",label:"主题"}],ai=[{value:"relevance",label:"相关度"},{value:"downloads",label:"周下载"},{value:"recent",label:"最近发布"}],si=["qoder","notify","memory","auth","usage","theme","mcp"],li=new Intl.NumberFormat("zh-CN",{notation:"compact",maximumFractionDigits:1});function Ke(e){return e<0?"—":!Number.isFinite(e)||e<=0?"0":li.format(e)}function et(e,r){return e<0?`${r}暂不可用`:`${r} ${e.toLocaleString()} 次`}function ci(e){return!Number.isFinite(e)||e<=0?"—":e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}function St(e){if(!e)return"";const r=Date.parse(e);if(!Number.isFinite(r))return e.slice(0,10);const o=Math.floor((Date.now()-r)/864e5);return o<=0?"今天":o===1?"昨天":o<30?`${o} 天前`:o<365?`${Math.floor(o/30)} 个月前`:`${Math.floor(o/365)} 年前`}function tn(e){const r=e.replace(/^@/,"").split("/").pop()??e;return(r.replace(/^opencode[-_]?/i,"")||r).slice(0,1).toUpperCase()}function pi(e){return e==="mcp"?"mcp":e==="themes"?"appearance":"extensions"}function di(e,r){return!e||!r||!/^https:\/\/github\.com\//i.test(e)?e:`${e}/tree/HEAD/${r.replace(/^\/+/,"")}`}function ui(e){return e==="error"?"circle-exclamation":e==="success"?"circle-check":e==="warning"?"warning":"info"}function ue(e){const r=e instanceof Error?e.message:String(e);return/SchemaError|Missing key at/i.test(r)?"插件窗口与后台服务版本不一致。点工具栏的「彻底重启」让两边换成同一版本。":/unknown method|not implemented|no such method|method.*not.*found/i.test(r)?"后台服务还是旧版本,暂时没有「彻底重启」能力。请先手动完全退出 OpenCode(并结束 serve --service)再打开一次。":r}const gi=/^(@[a-z0-9-_.]+\/)?[a-z0-9-_.]+$/i;function hi(e){const r=e.ctx.ui,[o,n]=l.createSignal(),[a,s]=l.createSignal(""),[p,u]=l.createSignal(!0),d=async()=>{try{const z=await e.admin.detail({name:e.name});n(z),z.error&&s(z.error)}catch(z){s(ue(z))}finally{u(!1)}};l.onMount(()=>{d()});const f=z=>{z&&e.admin.openUrl({url:z})},m=()=>o()?.version||e.fallback?.version||"",k=()=>o()?.description||e.fallback?.description||"",C=()=>o()?.homepage||e.fallback?.homepage||"",I=()=>o()?.repo||e.fallback?.repo||"",M=()=>o()?.npm||e.fallback?.npm||`https://www.npmjs.com/package/${e.name}`,q=()=>!p()&&o()!==void 0&&!a()&&(o()?.version??"")!=="",j=()=>o()?.hasUpdate===!0,J=()=>o()?.installed===!0;return t.createComponent(r.Dialog,{get title(){return e.name},size:"x-large",get footer(){return(()=>{var z=go(),g=z.firstChild;return t.insert(z,t.createComponent(l.Show,{get when(){return C()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"globe",onClick:()=>f(C()),children:"主页"})}}),g),t.insert(z,t.createComponent(l.Show,{get when(){return I()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"github",onClick:()=>f(di(I(),o()?.repoDir??"")),children:"源码"})}}),g),t.insert(z,t.createComponent(l.Show,{get when(){return M()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"cube",onClick:()=>f(M()),children:"npm"})}}),g),t.insert(z,t.createComponent(l.Show,{get when(){return a()},get children(){var b=uo();return t.insert(b,a),t.effect(()=>t.setAttribute(b,"title",a())),b}}),null),t.insert(z,t.createComponent(r.Button,{size:"small",get onClick(){return e.onClose},children:"关闭"}),null),t.insert(z,t.createComponent(l.Show,{get when(){return q()},get children(){return t.createComponent(l.Show,{get when(){return j()||!J()},get fallback(){return t.createComponent(r.Button,{size:"small",disabled:!0,children:"已安装"})},get children(){return t.createComponent(r.Button,{variant:"contrast",size:"small",icon:"download",get busy(){return e.busy},onClick:()=>e.onInstall(o().version),get children(){return t.memo(()=>!!j())()?`更新到 v${m()}`:`安装 v${m()}`}})}})}}),null),z})()},get children(){var z=po();return t.insert(z,t.createComponent(l.Show,{get when(){return p()},get children(){var g=Vr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Loader,{size:"large"}),b),g}}),null),t.insert(z,t.createComponent(l.Show,{get when(){return t.memo(()=>!p())()&&o()},get children(){return[(()=>{var g=Xr(),b=g.firstChild,S=b.nextSibling;return t.insert(b,t.createComponent(l.Show,{get when(){return m()},get children(){var w=Wr();return w.firstChild,t.insert(w,m,null),w}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return J()},get children(){var w=kt();return w.firstChild,t.insert(w,(()=>{var v=t.memo(()=>!!o().current);return()=>v()?` v${o().current}`:""})(),null),w}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return j()},get children(){return Jr()}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return o().deprecated},get children(){return Qr()}}),null),t.insert(S,()=>k()||"这个包没有提供描述。"),g})(),t.createComponent(l.Show,{get when(){return o().version},get children(){var g=Yr(),b=g.firstChild,S=b.firstChild,w=b.nextSibling,v=w.firstChild,Y=w.nextSibling,pe=Y.firstChild,de=Y.nextSibling,ke=de.firstChild,$e=ke.nextSibling;return t.insert(S,()=>Ke(o().weekly)),t.insert(v,()=>Ke(o().monthly)),t.insert(pe,()=>o().versions||"—"),t.insert(ke,(()=>{var K=t.memo(()=>!!o().unpacked);return()=>K()?ci(o().unpacked):"—"})()),t.insert($e,(()=>{var K=t.memo(()=>!!o().files);return()=>K()?`解包体积 · ${o().files} 文件`:"解包体积"})()),t.effect(K=>{var T=et(o().weekly,"周下载"),U=et(o().monthly,"月下载");return T!==K.e&&t.setAttribute(S,"title",K.e=T),U!==K.t&&t.setAttribute(v,"title",K.t=U),K},{e:void 0,t:void 0}),g}}),t.createComponent(l.Show,{get when(){return o().deprecated},get children(){var g=Zr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Icon,{name:"warning",size:"small"}),b),t.insert(b,()=>o().deprecated),g}}),t.createComponent(l.Show,{get when(){return a()},get children(){var g=Kr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),b),t.insert(b,a),g}}),(()=>{var g=oo();return t.insert(g,t.createComponent(l.Show,{get when(){return o().license},get children(){var b=eo();return b.firstChild,t.insert(b,()=>o().license,null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().published},get children(){var b=to();return b.firstChild,t.insert(b,()=>St(o().published),null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().created},get children(){var b=no();return b.firstChild,t.insert(b,()=>St(o().created),null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().maintainers.length>0},get children(){var b=ro();return b.firstChild,t.insert(b,()=>o().maintainers.join(", "),null),b}}),null),g})(),t.createComponent(l.Show,{get when(){return o().keywords.length>0},get children(){var g=yn();return t.insert(g,t.createComponent(l.For,{get each(){return o().keywords},children:b=>(()=>{var S=xt();return t.insert(S,b),S})()})),g}}),t.createComponent(l.Show,{get when(){return o().bugs},get children(){var g=io();return t.insert(g,t.createComponent(r.Button,{size:"small",variant:"ghost-muted",icon:"bubble-5",onClick:()=>f(o().bugs),children:"问题反馈"})),g}}),t.createComponent(l.Show,{get when(){return o().dependencies.length>0},get children(){var g=ao(),b=g.firstChild,S=b.firstChild,w=S.nextSibling;w.nextSibling;var v=b.nextSibling;return t.insert(b,()=>o().dependencies.length,w),t.insert(v,t.createComponent(l.For,{get each(){return o().dependencies},children:Y=>(()=>{var pe=xt();return t.insert(pe,Y),pe})()})),g}}),(()=>{var g=lo();return g.firstChild,t.insert(g,t.createComponent(l.Show,{get when(){return o().readme},get fallback(){return ho()},get children(){return[t.createComponent(r.Markdown,{get text(){return o().readme},class:"ph-readme"}),t.createComponent(l.Show,{get when(){return o().readmeTruncated},get children(){return so()}})]}}),null),g})()]}}),null),t.insert(z,t.createComponent(l.Show,{get when(){return t.memo(()=>!p())()&&!o()},get children(){var g=co();return t.insert(g,()=>a()||"未能读取这个包的详情。"),g}}),null),z}})}function wn(e){const r=e.ctx.ui,[o,n]=l.createSignal(),[a,s]=l.createSignal("catalog"),[p,u]=l.createSignal([]),[d,f]=l.createSignal(),[m,k]=l.createSignal(""),[C,I]=l.createSignal("all"),[M,q]=l.createSignal(Qe),[j,J]=l.createSignal([]),[z,g]=l.createSignal(""),[b,S]=l.createSignal(!1),[w,v]=l.createSignal("relevance"),[Y,pe]=l.createSignal(12),[de,ke]=l.createSignal(new Map),[$e,K]=l.createSignal(!1),[T,U]=l.createSignal(!1),[Ce,xe]=l.createSignal(new Map),[ot,At]=l.createSignal(""),Ot=l.createMemo(()=>{const i=Ce();return i.size===0?0:(o()?.plugins??[]).filter(h=>{const y=i.get(h.spec);return!y||y.status==="unknown"}).length}),kn=()=>Ce().size>0&&Ot()>0,xn=()=>Ot(),[Sn,Tt]=l.createSignal(new Set),[Fe,it]=l.createSignal(),ne=i=>Sn().has(i),$n=i=>Tt(h=>{const y=new Set(h);return y.add(i),y}),Cn=i=>Tt(h=>{const y=new Set(h);return y.delete(i),y}),be=async(i,h)=>{$n(i);try{return await h()}finally{Cn(i)}},H=(i,h="info")=>it(i?{text:i,tone:h}:void 0),It=async()=>{try{n(await e.admin.snapshot())}catch(i){H(ue(i),"error")}},at=async()=>{try{const i=await e.admin.runtime(),h=new Map;for(const y of i.items)h.set(y.spec,y);xe(h),At(i.error)}catch(i){xe(new Map),At(o()?ue(i):"")}},qe=async(i=!1)=>{await be("updates",async()=>{try{const h=await e.admin.updates(),y=new Map;for(const O of h.items)y.set(O.spec,O);if(ke(y),K(h.error===""&&h.items.length>0),i)return;const L=h.items.filter(O=>O.hasUpdate).length,A=h.items.filter(O=>O.error).length,P=h.error?h.error:A>0?`${A} 个插件未能检查(registry 连接失败)${L>0?`,其余 ${L} 个可更新`:""}`:L>0?`发现 ${L} 个可更新的插件`:"已检查的插件均为最新版本";H(P,h.error?"error":A>0?"warning":L>0?"info":"success")}catch(h){i||H(ue(h),"error")}})},Lt=async i=>{await be("catalog",async()=>{try{const h=await e.admin.browse({force:i});u([...h.entries]),f(h),h.error&&H(h.error,h.source==="builtin"?"warning":"info"),await It()}catch(h){H(ue(h),"error")}})},He=async i=>{g(i);const h=++ze;await be("search",async()=>{try{const y=await e.admin.search({query:i});if(h!==ze)return;J(y.hits),S(!0),y.error&&H(y.error,"error")}catch(y){if(h!==ze)return;H(ue(y),"error")}})};let je,st="",ze=0;const _n=i=>{g(i),je&&window.clearTimeout(je);const h=i.trim();if(!h){ze+=1;return}je=window.setTimeout(()=>{h!==st&&(st=h,He(h))},450)},_e=async(i,h="")=>{await be(`install:${i}`,async()=>{try{const y=await e.admin.install({spec:i,version:h});if(n(y.state),!y.ok){H(y.message,"error");return}H(`${y.message}。配置需重启后生效:点「彻底重启 OpenCode」完成加载`,"success");const L=h||j().find(A=>A.name===i)?.version||"";u(A=>A.map(P=>P.pkg===i?{...P,installed:!0}:P)),J(A=>A.map(P=>P.name===i?{...P,installed:!0,current:L,hasUpdate:!1}:P)),await qe(!0),at()}catch(y){H(ue(y),"error")}})},An=async i=>{await e.ctx.dialogs.confirm({title:`移除 ${i.name}?`,description:"只从 opencode.json 里删掉这一项,已安装的文件不会删除。",confirm:"移除",danger:!0})&&await be(`install:${i.name}`,async()=>{try{const y=await e.admin.remove({spec:i.spec,version:""});if(n(y.state),!y.ok){H(y.message,"error");return}H(`${y.message}。配置需重启后生效:点「彻底重启 OpenCode」完成移除`,"success"),u(L=>L.map(A=>A.pkg===i.name?{...A,installed:!1}:A)),J(L=>L.map(A=>A.name===i.name?{...A,installed:!1,current:"",hasUpdate:!1}:A)),ke(L=>{const A=new Map(L);return A.delete(i.spec),A}),at()}catch(y){H(ue(y),"error")}})},On=async()=>{await be("reload",async()=>{try{const i=await e.admin.reload();n(i.state),H(i.message,i.ok?"success":"error")}catch(i){H(ue(i),"error")}})},Mt=async()=>{await e.ctx.dialogs.confirm({title:"彻底重启 OpenCode?",description:"应用会退出并自动重新打开,让插件代码和后台 serve --service 一起换成最新版本。当前会话通常会自动恢复。",confirm:"重启"})&&await be("restart",async()=>{try{if(!(await e.admin.restart()).ok){H("无法自动重启,请手动完全退出 OpenCode 再打开。","error");return}H("正在重启 OpenCode…如果没有自动打开,请手动启动。","info")}catch{H("自动重启调用失败,后台服务可能还是旧版本。请先手动完全退出 OpenCode(并结束 serve --service)再打开一次。","error")}})},Ae=async i=>{if(i)try{(await e.admin.openUrl({url:i})).ok||H(`无法打开链接:${i}`,"error")}catch(h){H(ue(h),"error")}},Tn=async()=>{await be("config",async()=>{try{(await e.admin.openConfig()).ok||H("无法打开配置文件","error")}catch(i){H(ue(i),"error")}})},lt=(i,h)=>{e.ctx.dialogs.open(y=>t.createComponent(hi,{get ctx(){return e.ctx},get admin(){return e.admin},name:i,fallback:h,get busy(){return ne(`install:${i}`)},onInstall:L=>{y.close(),_e(i,L)},onClose:()=>y.close()}))},Ve=l.createMemo(()=>{const i=m().trim().toLowerCase(),h=C();return p().filter(y=>h!=="all"&&y.type!==h?!1:i?[y.name,y.pkg,y.desc,y.long,...y.tags].join(" ").toLowerCase().includes(i):!0)}),In=l.createMemo(()=>{const i=p();return{all:i.length,plugins:i.filter(h=>h.type==="plugins").length,mcp:i.filter(h=>h.type==="mcp").length,themes:i.filter(h=>h.type==="themes").length}}),Pe=l.createMemo(()=>{const i=[...j()];return w()==="downloads"?i.sort((h,y)=>y.weekly-h.weekly):w()==="recent"&&i.sort((h,y)=>(y.published||"").localeCompare(h.published||"")),i}),ct=l.createMemo(()=>Pe().slice(0,Y()));l.createEffect(()=>{j(),pe(12)});const Ln=()=>d()?.registry||ri,me=l.createMemo(()=>[...de().values()].filter(i=>i.hasUpdate).length),Ee=l.createMemo(()=>[...de().values()].filter(i=>i.error).length),jt=l.createMemo(()=>{const i=o()?.plugins??[];return T()?i.filter(h=>de().get(h.spec)?.hasUpdate===!0):i}),Mn=i=>de().get(i),jn=l.createMemo(()=>{const i=new Map;for(const h of de().values())i.set(h.name,h);return i}),zt=i=>{s(i),i!=="installed"&&U(!1),i!=="catalog"&&!$e()&&!ne("updates")&&qe(!0)};l.onMount(()=>{It(),Lt(!1),qe(!0),at()});const pt=(i,h,y,L,A)=>(()=>{var P=vo();return P.$$keydown=O=>{if(O.key!=="ArrowLeft"&&O.key!=="ArrowRight")return;O.preventDefault();const G=["catalog","search","installed"],ee=G.indexOf(a()),W=O.key==="ArrowRight"?(ee+1)%G.length:(ee+G.length-1)%G.length;zt(G[W])},P.$$click=()=>zt(i),t.setAttribute(P,"id",`ph-tab-${i}`),t.insert(P,t.createComponent(r.Icon,{name:y,size:"small"}),null),t.insert(P,h,null),t.insert(P,t.createComponent(l.Show,{when:L!==void 0&&L!=="",get children(){var O=mo();return t.insert(O,L),O}}),null),t.insert(P,t.createComponent(l.Show,{when:A!==void 0&&A>0,get children(){var O=fo(),G=O.firstChild;return t.setAttribute(O,"title",`${A} 个可更新`),t.insert(O,A,G),O}}),null),t.effect(O=>{var G=a()===i,ee=a()===i;return G!==O.e&&t.setAttribute(P,"aria-selected",O.e=G),ee!==O.t&&t.setAttribute(P,"data-active",O.t=ee),O},{e:void 0,t:void 0}),P})(),zn=(i,h,y)=>(()=>{var L=yo();return t.insert(L,i?`v${i}`:"",null),t.insert(L,t.createComponent(l.Show,{when:y&&h,get children(){var A=bo();return A.firstChild,t.insert(A,h,null),A}}),null),L})(),Pn=i=>{const h=()=>jn().get(i.pkg),y=()=>h()?.hasUpdate===!0,L=()=>ne(`install:${i.pkg}`),A=()=>lt(i.pkg,{version:i.version,description:i.desc||i.long,repo:i.repo});return(()=>{var P=Co(),O=P.firstChild,G=O.firstChild,ee=G.firstChild,W=ee.nextSibling,fe=W.firstChild,ie=fe.firstChild,he=W.nextSibling,re=G.nextSibling,oe=re.firstChild,Z=oe.nextSibling,te=Z.firstChild,Q=O.nextSibling;return t.insert(ee,t.createComponent(r.Icon,{get name(){return pi(i.type)},size:"normal"})),t.insert(ie,()=>i.name),t.insert(W,t.createComponent(l.Show,{get when(){return i.pkg},get children(){var E=wo();return t.insert(E,()=>i.pkg),E}}),null),t.insert(he,t.createComponent(l.Show,{get when(){return i.installed},get children(){return kt()}}),null),t.insert(he,t.createComponent(l.Show,{get when(){return y()},get children(){var E=vt();return E.firstChild,t.insert(E,()=>h().latest,null),E}}),null),re.$$keydown=E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),i.pkg?A():Ae(i.repo))},re.$$click=()=>i.pkg?A():void Ae(i.repo),t.insert(oe,()=>i.desc||i.long||"—"),t.insert(te,()=>oi[i.type]??i.type),t.insert(Z,t.createComponent(l.Show,{get when(){return i.version},get children(){return[Le(),(()=>{var E=ko();return E.firstChild,t.insert(E,()=>i.version,null),E})()]}}),null),t.insert(Z,t.createComponent(l.Show,{get when(){return!i.pkg},get children(){return[Le(),xo()]}}),null),t.insert(Z,t.createComponent(l.Show,{get when(){return i.tags.length>0},get children(){return[Le(),(()=>{var E=So();return t.insert(E,()=>i.tags.slice(0,4).join(" / ")),E})()]}}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return i.pkg},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:A,children:"详情"})}}),null),t.insert(Q,t.createComponent(r.Button,{variant:"ghost-muted",size:"small",icon:"square-arrow-top-right",onClick:()=>{Ae(i.repo)},children:"源码"}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return y()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(i.pkg,h().latest)},children:"更新"})}}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return t.memo(()=>!y()&&!i.installed)()&&i.pkg},get children(){return t.createComponent(r.Button,{variant:"neutral",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(i.pkg)},children:"安装"})}}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return t.memo(()=>!y()&&!i.installed)()&&!i.pkg},get children(){return $o()}}),null),t.effect(E=>{var $=y()?"true":void 0,x=L()?"true":void 0;return $!==E.e&&t.setAttribute(P,"data-stale",E.e=$),x!==E.t&&t.setAttribute(P,"data-busy",E.t=x),E},{e:void 0,t:void 0}),P})()},En=i=>{const h=()=>lt(i.name,{version:i.version,description:i.description,homepage:i.homepage,repo:i.repo,npm:i.npm});return(()=>{var y=Oo(),L=y.firstChild,A=L.firstChild,P=A.firstChild,O=P.nextSibling,G=O.firstChild,ee=G.firstChild,W=G.nextSibling;W.firstChild;var fe=O.nextSibling,ie=A.nextSibling,he=ie.firstChild,re=he.nextSibling,oe=re.firstChild,Z=oe.firstChild,te=oe.nextSibling,Q=te.nextSibling,E=Q.firstChild,$=L.nextSibling;return t.insert(P,()=>tn(i.name)),t.insert(ee,()=>i.name),t.insert(W,()=>i.version,null),t.insert(fe,t.createComponent(l.Show,{get when(){return i.installed},get children(){var x=kt();return x.firstChild,t.insert(x,(()=>{var B=t.memo(()=>!!i.current);return()=>B()?` v${i.current}`:""})(),null),x}}),null),t.insert(fe,t.createComponent(l.Show,{get when(){return i.hasUpdate},get children(){var x=vt();return x.firstChild,t.insert(x,()=>i.version,null),x}}),null),ie.$$keydown=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),h())},ie.$$click=h,t.insert(he,()=>i.description||"—"),t.insert(oe,t.createComponent(r.Icon,{name:"download",size:"small"}),Z),t.insert(oe,()=>Ke(i.weekly),Z),t.insert(Q,()=>Ke(i.monthly),E),t.insert(re,t.createComponent(l.Show,{get when(){return i.publisher},get children(){return[Le(),(()=>{var x=_o();return x.firstChild,t.insert(x,()=>i.publisher,null),x})()]}}),null),t.insert(re,t.createComponent(l.Show,{get when(){return i.published},get children(){return[Le(),(()=>{var x=Ao(),B=x.firstChild;return t.insert(x,()=>St(i.published),B),x})()]}}),null),t.insert(ie,t.createComponent(l.Show,{get when(){return i.keywords.length>0},get children(){var x=yn();return t.insert(x,t.createComponent(l.For,{get each(){return i.keywords.slice(0,3)},children:B=>(()=>{var _=xt();return t.insert(_,B),_})()})),x}}),null),t.insert($,t.createComponent(l.Show,{get when(){return i.homepage},get children(){return t.createComponent(r.Tooltip,{value:"主页",get children(){return t.createComponent(r.IconButton,{icon:"globe",size:"small",label:"主页",onClick:()=>{Ae(i.homepage)}})}})}}),null),t.insert($,t.createComponent(l.Show,{get when(){return i.repo},get children(){return t.createComponent(r.Tooltip,{value:"源码仓库",get children(){return t.createComponent(r.IconButton,{icon:"github",size:"small",label:"源码仓库",onClick:()=>{Ae(i.repo)}})}})}}),null),t.insert($,t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:h,children:"详情"}),null),t.insert($,t.createComponent(l.Show,{get when(){return i.hasUpdate},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return ne(`install:${i.name}`)},onClick:()=>{_e(i.name,i.version)},children:"更新"})}}),null),t.insert($,t.createComponent(l.Show,{get when(){return t.memo(()=>!i.hasUpdate)()&&!i.installed},get children(){return t.createComponent(r.Button,{variant:"neutral",size:"small",icon:"download",get busy(){return ne(`install:${i.name}`)},onClick:()=>{_e(i.name)},children:"安装"})}}),null),t.effect(x=>{var B=ne(`install:${i.name}`)?"true":void 0,_=et(i.weekly,"周下载"),X=et(i.monthly,"月下载");return B!==x.e&&t.setAttribute(y,"data-busy",x.e=B),_!==x.t&&t.setAttribute(oe,"title",x.t=_),X!==x.a&&t.setAttribute(Q,"title",x.a=X),x},{e:void 0,t:void 0,a:void 0}),y})()},Bn=i=>{const h=()=>Mn(i.spec),y=()=>h()?.hasUpdate===!0,L=()=>ne(`install:${i.name}`),A=()=>h()?.current||i.version,P=()=>(h()?.error??"")!=="",O=()=>Ce().get(i.spec),G=()=>{const W=O();return W?W.status==="failed"?"failed":W.status==="loaded"?"loaded":W.available?"pending":"unknown":ot()?"unknown":"pending"},ee=()=>G()==="loaded"?O().runtimeVersion?`运行中 v${O().runtimeVersion}`:"运行中":G()==="failed"?"加载失败":G()==="pending"?"待重启生效":"运行状态未验证";return(()=>{var W=Mo(),fe=W.firstChild,ie=fe.firstChild,he=ie.firstChild,re=he.nextSibling,oe=re.firstChild,Z=oe.firstChild,te=oe.nextSibling,Q=re.nextSibling,E=Q.firstChild,$=ie.nextSibling,x=$.firstChild,B=fe.nextSibling;return t.insert(he,()=>tn(i.name)),t.insert(Z,()=>i.name),t.insert(te,()=>i.spec),t.insert(E,ee),t.insert(Q,t.createComponent(l.Show,{get when(){return y()},get children(){var _=vt();return _.firstChild,t.insert(_,()=>h().latest,null),_}}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return P()},get children(){return To()}}),null),t.insert(Q,t.createComponent(l.Show,{get when(){return i.kind==="path"},get children(){return Io()}}),null),t.insert(x,()=>zn(A(),h()?.latest??"",y()),null),t.insert(x,t.createComponent(l.Show,{get when(){return t.memo(()=>!!y())()&&i.kind==="path"},get children(){return[Le(),Lo()]}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return gi.test(i.name)},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:()=>lt(i.name,{version:A()}),children:"详情"})}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return y()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(h().name,h().latest)},children:"更新"})}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return i.removable},get children(){return t.createComponent(r.Button,{variant:"ghost-muted",size:"small",icon:"trash",get busy(){return L()},onClick:()=>{An(i)},children:"移除"})}}),null),t.effect(_=>{var X=y()?"true":void 0,D=L()?"true":void 0,F=G(),ae=ee();return X!==_.e&&t.setAttribute(W,"data-stale",_.e=X),D!==_.t&&t.setAttribute(W,"data-busy",_.t=D),F!==_.a&&t.setAttribute(E,"data-runtime",_.a=F),ae!==_.o&&t.setAttribute(E,"title",_.o=ae),_},{e:void 0,t:void 0,a:void 0,o:void 0}),W})()};return(()=>{var i=qo(),h=i.firstChild,y=h.nextSibling,L=y.firstChild,A=L.firstChild,P=A.firstChild,O=A.nextSibling,G=O.firstChild,ee=G.nextSibling,W=O.nextSibling,fe=W.firstChild,ie=fe.nextSibling,he=ie.nextSibling,re=he.nextSibling,oe=re.firstChild,Z=y.nextSibling,te=Z.firstChild,Q=te.firstChild;Q.nextSibling;var E=Z.nextSibling;return t.insert(A,t.createComponent(r.Icon,{name:"extensions",size:"small"}),P),t.insert(L,t.createComponent(l.Show,{get when(){return!e.embedded},get children(){return jo()}}),O),ee.$$click=()=>{Ae(Ln())},t.insert(ie,()=>o()?.configPath??"读取中…"),t.insert(re,()=>o()?.configKey??"plugins",oe),t.insert(Z,t.createComponent(l.Show,{get when(){return Fe()},get children(){var $=zo(),x=$.firstChild,B=x.nextSibling;return t.insert($,t.createComponent(r.Icon,{get name(){return ui(Fe().tone)},size:"small"}),x),t.insert(x,()=>Fe().text),B.$$click=()=>it(void 0),t.insert(B,t.createComponent(r.Icon,{name:"close",size:"small"})),t.effect(()=>t.setAttribute($,"data-tone",Fe().tone)),$}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return o()?.error},get children(){var $=Po(),x=$.firstChild;return t.insert($,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),x),t.insert(x,()=>o().error),$}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return ot()},get children(){var $=Eo(),x=$.firstChild,B=x.firstChild;return t.insert($,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),x),t.insert(x,ot,B),$}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return kn()},get children(){var $=Bo(),x=$.firstChild,B=x.firstChild,_=B.nextSibling;return _.nextSibling,t.insert($,t.createComponent(r.Icon,{name:"outline-rotate-clockwise",size:"small"}),x),t.insert(x,xn,_),t.insert($,t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"outline-rotate-clockwise",onClick:()=>{Mt()},children:"彻底重启 OpenCode"}),null),$}}),te),t.insert(Q,()=>pt("catalog","精选目录","extensions",d()?p().length:void 0),null),t.insert(Q,()=>pt("search","npm 搜索","magnifying-glass",b()?j().length:void 0),null),t.insert(Q,()=>pt("installed","已安装","checklist",o()?.plugins.length??0,me()),null),t.insert(te,t.createComponent(l.Show,{get when(){return a()==="catalog"},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"refresh",get busy(){return ne("catalog")},onClick:()=>{Lt(!0)},children:"更新目录"})}}),null),t.insert(te,t.createComponent(l.Show,{get when(){return a()==="search"},get children(){return t.createComponent(l.Show,{get when(){return b()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"close",onClick:()=>{J([]),S(!1),g(""),it(void 0),ze+=1},children:"清空"})}})}}),null),t.insert(te,t.createComponent(l.Show,{get when(){return a()==="installed"},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"refresh",get busy(){return ne("updates")},onClick:()=>{qe()},children:"检查更新"})}}),null),t.insert(te,t.createComponent(r.Menu,{label:"更多操作",icon:"outline-dots",placement:"bottom-end",items:[{type:"group",label:"配置",items:[{label:"打开配置文件",icon:"open-file",onSelect:()=>{Tn()}},{label:"重载配置",icon:"refresh",onSelect:()=>{On()}}]},{type:"separator"},{label:"彻底重启 OpenCode…",icon:"outline-rotate-clockwise",onSelect:()=>{Mt()}}]}),null),t.insert(i,t.createComponent(l.Switch,{get children(){return[t.createComponent(l.Match,{get when(){return a()==="catalog"},get children(){var $=Do(),x=$.firstChild,B=x.firstChild,_=B.firstChild,X=_.nextSibling;return t.insert(_,t.createComponent(r.TextInput,{label:"筛选 awesome-opencode 精选插件",placeholder:"按名称、描述或标签筛选,例如 memory / auth / token",type:"search",get value(){return m()},onInput:D=>{k(D),q(Qe)}})),t.insert(X,t.createComponent(l.For,{each:ii,children:D=>(()=>{var F=Ho(),ae=F.firstChild;return F.$$click=()=>{I(D.value),q(Qe)},t.insert(F,()=>D.label,ae),t.insert(ae,()=>In()[D.value]),t.effect(()=>t.setAttribute(F,"data-active",C()===D.value)),F})()})),t.insert($,t.createComponent(l.Show,{get when(){return t.memo(()=>!!ne("catalog"))()&&p().length===0},get children(){var D=Ne();return t.insert(D,t.createComponent(l.For,{each:[0,1,2,3],children:()=>en()})),D}}),null),t.insert($,t.createComponent(l.Show,{get when(){return!ne("catalog")||p().length>0},get children(){return t.createComponent(l.Show,{get when(){return Ve().length>0},get fallback(){return(()=>{var D=Vo(),F=D.firstChild;return F.nextSibling,t.insert(D,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),F),t.insert(D,t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>{k(""),I("all")},children:"清除筛选"}),null),D})()},get children(){return[(()=>{var D=Ne();return t.insert(D,t.createComponent(l.For,{get each(){return Ve().slice(0,M())},children:F=>Pn(F)})),D})(),t.createComponent(l.Show,{get when(){return Ve().length>M()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>q(D=>D+Qe),get children(){return["显示更多(还有 ",t.memo(()=>Ve().length-M())," 个)"]}})}})]}})}}),null),t.effect(()=>t.setAttribute($,"aria-labelledby",`ph-tab-${a()}`)),$}}),t.createComponent(l.Match,{get when(){return a()==="search"},get children(){var $=Ro(),x=$.firstChild,B=x.firstChild;return x.nextSibling,t.insert(B,t.createComponent(r.TextInput,{label:"搜索 npm 上的 OpenCode 插件",placeholder:"搜索插件,例如 qoder / notify / usage(输入后自动搜索)",type:"search",get value(){return z()},onInput:_n,onSubmit:_=>{je&&window.clearTimeout(je),st=_.trim(),He(_)}})),t.insert(x,t.createComponent(r.Button,{variant:"contrast",icon:"magnifying-glass",get busy(){return ne("search")},onClick:()=>{He(z())},children:"搜索"}),null),t.insert($,t.createComponent(l.Show,{get when(){return!b()},get children(){var _=No(),X=_.firstChild,D=X.nextSibling,F=D.nextSibling;return t.insert(_,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),X),t.insert(F,t.createComponent(l.For,{each:si,children:ae=>(()=>{var ve=Wo();return ve.$$click=()=>{He(ae)},t.insert(ve,ae),ve})()})),_}}),null),t.insert($,t.createComponent(l.Show,{get when(){return b()},get children(){return[(()=>{var _=Uo(),X=_.firstChild,D=X.firstChild,F=D.nextSibling,ae=X.nextSibling;return t.insert(F,()=>Pe().length),t.insert(ae,t.createComponent(l.For,{each:ai,children:ve=>(()=>{var N=Jo();return N.$$click=()=>v(ve.value),t.insert(N,()=>ve.label),t.effect(()=>t.setAttribute(N,"data-active",w()===ve.value)),N})()})),_})(),t.createComponent(l.Show,{get when(){return t.memo(()=>!!ne("search"))()&&j().length===0},get children(){var _=Ne();return t.insert(_,t.createComponent(l.For,{each:[0,1,2,3],children:()=>en()})),_}}),t.createComponent(l.Show,{get when(){return!ne("search")||j().length>0},get children(){return t.createComponent(l.Show,{get when(){return Pe().length>0},get fallback(){return(()=>{var _=Qo(),X=_.firstChild;return t.insert(_,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),X),_})()},get children(){return[(()=>{var _=Ne();return t.insert(_,t.createComponent(l.For,{get each(){return ct()},children:X=>En(X)})),_})(),t.createComponent(l.Show,{get when(){return Pe().length>ct().length},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>pe(_=>_+12),get children(){return["显示更多(还有 ",t.memo(()=>Pe().length-ct().length)," 个)"]}})}})]}})}})]}}),null),t.effect(()=>t.setAttribute($,"aria-labelledby",`ph-tab-${a()}`)),$}}),t.createComponent(l.Match,{get when(){return a()==="installed"},get children(){var $=Fo(),x=$.firstChild,B=x.firstChild,_=B.firstChild,X=_.nextSibling,D=B.nextSibling,F=D.firstChild,ae=F.firstChild,ve=ae.nextSibling;return D.nextSibling,t.insert(X,()=>o()?.plugins.length??0),F.$$click=()=>{me()>0&&U(!T())},t.insert(ve,me),t.insert(x,t.createComponent(l.Show,{get when(){return $e()},get children(){var N=Go();return t.insert(N,(()=>{var se=t.memo(()=>Ee()>0);return()=>se()?`已检查 ${Math.max(0,(o()?.plugins.length??0)-Ee())} 个 · ${Ee()} 个未能检查${me()>0?` · ${me()} 个可更新`:""}`:t.memo(()=>me()>0)()?`检查过 npm registry · ${me()} 个可更新`:"检查过 npm registry · 已检查的插件均为最新"})()),N}}),null),t.insert($,t.createComponent(l.Show,{get when(){return(o()?.plugins.length??0)>0},get fallback(){return(()=>{var N=Xo(),se=N.firstChild;return t.insert(N,t.createComponent(r.Icon,{name:"extensions",size:"large"}),se),N})()},get children(){return t.createComponent(l.Show,{get when(){return jt().length>0},get fallback(){return(()=>{var N=Ko();return t.insert(N,t.createComponent(r.Icon,{name:"checklist",size:"large"}),null),t.insert(N,t.createComponent(l.Show,{get when(){return Ee()>0},get fallback(){return[ei(),ti()]},get children(){return[(()=>{var se=Yo(),We=se.firstChild,Be=We.nextSibling;return Be.nextSibling,t.insert(se,Ee,Be),se})(),Zo()]}}),null),t.insert(N,t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>U(!1),children:"显示全部"}),null),N})()},get children(){var N=Ne();return t.insert(N,t.createComponent(l.For,{get each(){return jt()},children:se=>Bn(se)})),N}})}}),null),t.effect(N=>{var se=`ph-tab-${a()}`,We=T(),Be=me()===0?"true":void 0,Pt=me()===0?"检查更新后再来看可更新的插件":"只显示有新版本的插件";return se!==N.e&&t.setAttribute($,"aria-labelledby",N.e=se),We!==N.t&&t.setAttribute(F,"data-active",N.t=We),Be!==N.a&&t.setAttribute(F,"data-disabled",N.a=Be),Pt!==N.o&&t.setAttribute(F,"title",N.o=Pt),N},{e:void 0,t:void 0,a:void 0,o:void 0}),$}})]}}),E),t.effect($=>{var x=e.embedded?"true":void 0,B=o()?.configPath;return x!==$.e&&t.setAttribute(i,"data-embedded",$.e=x),B!==$.t&&t.setAttribute(W,"title",$.t=B),$},{e:void 0,t:void 0}),i})()}function mi(e){const r=e.ctx.ui,o=()=>{e.onClose(),setTimeout(()=>e.ctx.layout.settings("hub"),0)};return t.createComponent(r.Dialog,{title:"插件中心",size:"x-large",get footer(){return(()=>{var n=ni();return n.firstChild,t.insert(n,t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"settings-gear",onClick:o,children:"在设置中打开"}),null),t.insert(n,t.createComponent(r.Button,{size:"small",get onClick(){return e.onClose},children:"关闭"}),null),n})()},get children(){return t.createComponent(wn,{get ctx(){return e.ctx},get admin(){return e.admin},embedded:!0})}})}t.delegateEvents(["click","keydown"]);const fi=Ue.Plugin.define({setup(e){const r=e.main(Bt),o=()=>{e.dialogs.active()||e.dialogs.open(n=>t.createComponent(mi,{ctx:e,admin:r,onClose:()=>n.close()}))};e.add(Ue.SettingsPage,{id:"hub",title:"插件中心",icon:"extensions",entries:[{id:"hub",title:"插件中心",description:"浏览社区精选插件,按 npm 搜索,安装或移除",keywords:"plugin npm install remove hub catalog marketplace"}],render:()=>t.createComponent(wn,{ctx:e,admin:r})}),e.add(Ue.TitlebarItem,()=>({id:"hub",label:"插件中心",title:"打开插件中心",icon:"extensions",run:o})),e.add(Ue.Command,()=>({id:"open",title:"插件中心",description:"浏览、搜索、安装与更新 OpenCode 插件",keywords:"plugin hub install browse npm catalog marketplace",group:"设置",section:"navigation",bind:"mod+alt+p",featured:!0,run:o}))},main(e){e.provide(Bt,{snapshot:()=>ge(),updates:()=>hr(),search:r=>Lr(r.query),browse:async r=>{const o=await ge();return qr(new Set(o.plugins.map(n=>n.name)),r.force)},detail:r=>Ir(r.name),openUrl:r=>({ok:Mr(r.url)}),openConfig:async()=>({ok:await jr()}),install:r=>wr(r.spec,r.version),remove:r=>kr(r.spec),reload:()=>Pr(e.cli.command),restart:()=>({ok:zr()}),runtime:()=>Er(e.serverEndpoints.get("sidecar"))})}});exports.default=fi;
|
|
673
|
+
</style><section class=ph-hero><div class=ph-hero-copy><div class=ph-kicker>PLUGIN HUB</div><p class=ph-sub>浏览 <button type=button class=ph-inline-source title="精选目录来自 awesome-opencode 社区维护的 registry.json,不是 OpenCode 官方推荐">awesome-opencode</button> 社区维护的精选目录、搜索 npm 上的 OpenCode 插件。安装前先看下载量、README 和主页,确认它到底能做什么。</p><div class=ph-path>配置:<code></code> · <code>[]</code></div></div></section><div class=ph-head><div class=ph-toolbar><div class=ph-tabs role=tablist></div><span class=ph-spacer></span></div></div><footer class=ph-footer><div class=ph-footer-note>安装和移除只改配置,不会立即生效:插件与模型目录都是启动时快照的。改完点右上角「更多操作 → 彻底重启 OpenCode」,应用会自动退出并重新打开。`),Vo=t.template("<button class=ph-chip><span class=ph-chip-count>"),tn=t.template("<div class=ph-skeleton>"),Wo=t.template("<div class=ph-empty><strong>没有匹配的插件</strong><span>试试别的关键词,或者清除筛选条件。"),Jo=t.template("<button class=ph-chip>"),Qo=t.template("<button>"),Xo=t.template("<div class=ph-empty><strong>没有找到匹配的插件</strong><span>换个关键词试试,或者清空搜索查看建议。"),Yo=t.template("<div class=ph-empty><strong>还没有安装插件</strong><span>去「精选目录」看看 awesome-opencode 的推荐,或者在「npm 搜索」里找长尾插件。"),Zo=t.template("<strong>有 <!> 个插件未能检查"),Ko=t.template("<span>部分插件没能连上 npm registry,不能当作“已是最新”。点工具栏的「检查更新」重试。"),ei=t.template("<div class=ph-empty>"),ti=t.template("<strong>没有可更新的插件"),ni=t.template("<span>已检查的插件都已是最新版本。点工具栏的「检查更新」可以再查一次。"),ri=t.template("<div class=ph-dialog-footer><span class=ph-footer-note>拖动右下角可调整大小");const Ye=24,oi="https://github.com/awesome-opencode/awesome-opencode",ii={plugins:"插件",mcp:"MCP",themes:"主题"},ai=[{value:"all",label:"全部"},{value:"plugins",label:"插件"},{value:"mcp",label:"MCP"},{value:"themes",label:"主题"}],si=[{value:"relevance",label:"相关度"},{value:"downloads",label:"周下载"},{value:"recent",label:"最近发布"}],li=["qoder","notify","memory","auth","usage","theme","mcp"],ci=new Intl.NumberFormat("zh-CN",{notation:"compact",maximumFractionDigits:1});function tt(e){return e<0?"—":!Number.isFinite(e)||e<=0?"0":ci.format(e)}function nt(e,r){return e<0?`${r}暂不可用`:`${r} ${e.toLocaleString()} 次`}function pi(e){return!Number.isFinite(e)||e<=0?"—":e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}function St(e){if(!e)return"";const r=Date.parse(e);if(!Number.isFinite(r))return e.slice(0,10);const o=Math.floor((Date.now()-r)/864e5);return o<=0?"今天":o===1?"昨天":o<30?`${o} 天前`:o<365?`${Math.floor(o/30)} 个月前`:`${Math.floor(o/365)} 年前`}function nn(e){const r=e.replace(/^@/,"").split("/").pop()??e;return(r.replace(/^opencode[-_]?/i,"")||r).slice(0,1).toUpperCase()}function di(e){return e==="mcp"?"mcp":e==="themes"?"appearance":"extensions"}function ui(e,r){return!e||!r||!/^https:\/\/github\.com\//i.test(e)?e:`${e}/tree/HEAD/${r.replace(/^\/+/,"")}`}function gi(e){return e==="error"?"circle-exclamation":e==="success"?"circle-check":e==="warning"?"warning":"info"}function ue(e){const r=e instanceof Error?e.message:String(e);return/SchemaError|Missing key at/i.test(r)?"插件窗口与后台服务版本不一致。点工具栏的「彻底重启」让两边换成同一版本。":/unknown method|not implemented|no such method|method.*not.*found/i.test(r)?"后台服务还是旧版本,暂时没有「彻底重启」能力。请先手动完全退出 OpenCode(并结束 serve --service)再打开一次。":r}const hi=/^(@[a-z0-9-_.]+\/)?[a-z0-9-_.]+$/i;function mi(e){const r=e.ctx.ui,[o,n]=l.createSignal(),[i,s]=l.createSignal(""),[d,p]=l.createSignal(!0),u=async()=>{try{const j=await e.admin.detail({name:e.name});n(j),j.error&&s(j.error)}catch(j){s(ue(j))}finally{p(!1)}};l.onMount(()=>{u()});const f=j=>{j&&e.admin.openUrl({url:j})},h=()=>o()?.version||e.fallback?.version||"",x=()=>o()?.description||e.fallback?.description||"",S=()=>o()?.homepage||e.fallback?.homepage||"",T=()=>o()?.repo||e.fallback?.repo||"",M=()=>o()?.npm||e.fallback?.npm||`https://www.npmjs.com/package/${e.name}`,q=()=>!d()&&o()!==void 0&&!i()&&(o()?.version??"")!=="",z=()=>o()?.hasUpdate===!0,Q=()=>o()?.installed===!0;return t.createComponent(r.Dialog,{get title(){return e.name},size:"x-large",get footer(){return(()=>{var j=go(),g=j.firstChild;return t.insert(j,t.createComponent(l.Show,{get when(){return S()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"globe",onClick:()=>f(S()),children:"主页"})}}),g),t.insert(j,t.createComponent(l.Show,{get when(){return T()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"github",onClick:()=>f(ui(T(),o()?.repoDir??"")),children:"源码"})}}),g),t.insert(j,t.createComponent(l.Show,{get when(){return M()},get children(){return t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"cube",onClick:()=>f(M()),children:"npm"})}}),g),t.insert(j,t.createComponent(l.Show,{get when(){return i()},get children(){var b=uo();return t.insert(b,i),t.effect(()=>t.setAttribute(b,"title",i())),b}}),null),t.insert(j,t.createComponent(r.Button,{size:"small",get onClick(){return e.onClose},children:"关闭"}),null),t.insert(j,t.createComponent(l.Show,{get when(){return q()},get children(){return t.createComponent(l.Show,{get when(){return z()||!Q()},get fallback(){return t.createComponent(r.Button,{size:"small",disabled:!0,children:"已安装"})},get children(){return t.createComponent(r.Button,{variant:"contrast",size:"small",icon:"download",get busy(){return e.busy},onClick:()=>e.onInstall(o().version),get children(){return t.memo(()=>!!z())()?`更新到 v${h()}`:`安装 v${h()}`}})}})}}),null),j})()},get children(){var j=po();return t.insert(j,t.createComponent(l.Show,{get when(){return d()},get children(){var g=Vr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Loader,{size:"large"}),b),g}}),null),t.insert(j,t.createComponent(l.Show,{get when(){return t.memo(()=>!d())()&&o()},get children(){return[(()=>{var g=Xr(),b=g.firstChild,C=b.nextSibling;return t.insert(b,t.createComponent(l.Show,{get when(){return h()},get children(){var w=Wr();return w.firstChild,t.insert(w,h,null),w}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return Q()},get children(){var w=kt();return w.firstChild,t.insert(w,(()=>{var v=t.memo(()=>!!o().current);return()=>v()?` v${o().current}`:""})(),null),w}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return z()},get children(){return Jr()}}),null),t.insert(b,t.createComponent(l.Show,{get when(){return o().deprecated},get children(){return Qr()}}),null),t.insert(C,()=>x()||"这个包没有提供描述。"),g})(),t.createComponent(l.Show,{get when(){return o().version},get children(){var g=Yr(),b=g.firstChild,C=b.firstChild,w=b.nextSibling,v=w.firstChild,Y=w.nextSibling,pe=Y.firstChild,de=Y.nextSibling,ke=de.firstChild,$e=ke.nextSibling;return t.insert(C,()=>tt(o().weekly)),t.insert(v,()=>tt(o().monthly)),t.insert(pe,()=>o().versions||"—"),t.insert(ke,(()=>{var K=t.memo(()=>!!o().unpacked);return()=>K()?pi(o().unpacked):"—"})()),t.insert($e,(()=>{var K=t.memo(()=>!!o().files);return()=>K()?`解包体积 · ${o().files} 文件`:"解包体积"})()),t.effect(K=>{var I=nt(o().weekly,"周下载"),R=nt(o().monthly,"月下载");return I!==K.e&&t.setAttribute(C,"title",K.e=I),R!==K.t&&t.setAttribute(v,"title",K.t=R),K},{e:void 0,t:void 0}),g}}),t.createComponent(l.Show,{get when(){return o().deprecated},get children(){var g=Zr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Icon,{name:"warning",size:"small"}),b),t.insert(b,()=>o().deprecated),g}}),t.createComponent(l.Show,{get when(){return i()},get children(){var g=Kr(),b=g.firstChild;return t.insert(g,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),b),t.insert(b,i),g}}),(()=>{var g=oo();return t.insert(g,t.createComponent(l.Show,{get when(){return o().license},get children(){var b=eo();return b.firstChild,t.insert(b,()=>o().license,null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().published},get children(){var b=to();return b.firstChild,t.insert(b,()=>St(o().published),null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().created},get children(){var b=no();return b.firstChild,t.insert(b,()=>St(o().created),null),b}}),null),t.insert(g,t.createComponent(l.Show,{get when(){return o().maintainers.length>0},get children(){var b=ro();return b.firstChild,t.insert(b,()=>o().maintainers.join(", "),null),b}}),null),g})(),t.createComponent(l.Show,{get when(){return o().keywords.length>0},get children(){var g=yn();return t.insert(g,t.createComponent(l.For,{get each(){return o().keywords},children:b=>(()=>{var C=xt();return t.insert(C,b),C})()})),g}}),t.createComponent(l.Show,{get when(){return o().bugs},get children(){var g=io();return t.insert(g,t.createComponent(r.Button,{size:"small",variant:"ghost-muted",icon:"bubble-5",onClick:()=>f(o().bugs),children:"问题反馈"})),g}}),t.createComponent(l.Show,{get when(){return o().dependencies.length>0},get children(){var g=ao(),b=g.firstChild,C=b.firstChild,w=C.nextSibling;w.nextSibling;var v=b.nextSibling;return t.insert(b,()=>o().dependencies.length,w),t.insert(v,t.createComponent(l.For,{get each(){return o().dependencies},children:Y=>(()=>{var pe=xt();return t.insert(pe,Y),pe})()})),g}}),(()=>{var g=lo();return g.firstChild,t.insert(g,t.createComponent(l.Show,{get when(){return o().readme},get fallback(){return ho()},get children(){return[t.createComponent(r.Markdown,{get text(){return o().readme},class:"ph-readme"}),t.createComponent(l.Show,{get when(){return o().readmeTruncated},get children(){return so()}})]}}),null),g})()]}}),null),t.insert(j,t.createComponent(l.Show,{get when(){return t.memo(()=>!d())()&&!o()},get children(){var g=co();return t.insert(g,()=>i()||"未能读取这个包的详情。"),g}}),null),j}})}function wn(e){const r=e.ctx.ui,[o,n]=l.createSignal(),[i,s]=l.createSignal("catalog"),[d,p]=l.createSignal([]),[u,f]=l.createSignal(),[h,x]=l.createSignal(""),[S,T]=l.createSignal("all"),[M,q]=l.createSignal(Ye),[z,Q]=l.createSignal([]),[j,g]=l.createSignal(""),[b,C]=l.createSignal(!1),[w,v]=l.createSignal("relevance"),[Y,pe]=l.createSignal(12),[de,ke]=l.createSignal(new Map),[$e,K]=l.createSignal(!1),[I,R]=l.createSignal(!1),[Ce,xe]=l.createSignal(new Map),[at,Ot]=l.createSignal(""),It=l.createMemo(()=>{const a=Ce();return a.size===0?0:(o()?.plugins??[]).filter(m=>{const y=a.get(m.spec);return!y||y.status==="unknown"}).length}),kn=()=>Ce().size>0&&It()>0,xn=()=>It(),[Sn,Tt]=l.createSignal(new Set),[Fe,st]=l.createSignal(),ne=a=>Sn().has(a),$n=a=>Tt(m=>{const y=new Set(m);return y.add(a),y}),Cn=a=>Tt(m=>{const y=new Set(m);return y.delete(a),y}),be=async(a,m)=>{$n(a);try{return await m()}finally{Cn(a)}},H=(a,m="info")=>st(a?{text:a,tone:m}:void 0),Lt=async()=>{try{n(await e.admin.snapshot())}catch(a){H(ue(a),"error")}},qe=async()=>{try{const a=await e.admin.runtime(),m=new Map;for(const y of a.items)m.set(y.spec,y);xe(m),Ot(a.error)}catch(a){xe(new Map),Ot(o()?ue(a):"")}},He=async(a=!1)=>{await be("updates",async()=>{try{const m=await e.admin.updates(),y=new Map;for(const O of m.items)y.set(O.spec,O);if(ke(y),K(m.error===""&&m.items.length>0),a)return;const L=m.items.filter(O=>O.hasUpdate).length,A=m.items.filter(O=>O.error).length,P=m.error?m.error:A>0?`${A} 个插件未能检查(registry 连接失败)${L>0?`,其余 ${L} 个可更新`:""}`:L>0?`发现 ${L} 个可更新的插件`:"已检查的插件均为最新版本";H(P,m.error?"error":A>0?"warning":L>0?"info":"success")}catch(m){a||H(ue(m),"error")}})},Mt=async a=>{await be("catalog",async()=>{try{const m=await e.admin.browse({force:a});p([...m.entries]),f(m),m.error&&H(m.error,m.source==="builtin"?"warning":"info"),await Lt()}catch(m){H(ue(m),"error")}})},Ve=async a=>{g(a);const m=++je;await be("search",async()=>{try{const y=await e.admin.search({query:a});if(m!==je)return;Q(y.hits),C(!0),y.error&&H(y.error,"error")}catch(y){if(m!==je)return;H(ue(y),"error")}})};let ze,lt="",je=0;const _n=a=>{g(a),ze&&window.clearTimeout(ze);const m=a.trim();if(!m){je+=1;return}ze=window.setTimeout(()=>{m!==lt&&(lt=m,Ve(m))},450)},_e=async(a,m="")=>{await be(`install:${a}`,async()=>{try{const y=await e.admin.install({spec:a,version:m});if(n(y.state),!y.ok){H(y.message,"error");return}H(`${y.message}。配置需重启后生效:点「彻底重启 OpenCode」完成加载`,"success");const L=m||z().find(A=>A.name===a)?.version||"";p(A=>A.map(P=>P.pkg===a?{...P,installed:!0}:P)),Q(A=>A.map(P=>P.name===a?{...P,installed:!0,current:L,hasUpdate:!1}:P)),await He(!0),qe()}catch(y){H(ue(y),"error")}})},An=async a=>{await e.ctx.dialogs.confirm({title:`移除 ${a.name}?`,description:"只从 opencode.json 里删掉这一项,已安装的文件不会删除。",confirm:"移除",danger:!0})&&await be(`install:${a.name}`,async()=>{try{const y=await e.admin.remove({spec:a.spec,version:""});if(n(y.state),!y.ok){H(y.message,"error");return}H(`${y.message}。配置需重启后生效:点「彻底重启 OpenCode」完成移除`,"success"),p(L=>L.map(A=>A.pkg===a.name?{...A,installed:!1}:A)),Q(L=>L.map(A=>A.name===a.name?{...A,installed:!1,current:"",hasUpdate:!1}:A)),ke(L=>{const A=new Map(L);return A.delete(a.spec),A}),qe()}catch(y){H(ue(y),"error")}})},On=async()=>{await be("reload",async()=>{try{const a=await e.admin.reload();n(a.state),H(a.message,a.ok?"success":"error")}catch(a){H(ue(a),"error")}})},zt=async()=>{await e.ctx.dialogs.confirm({title:"彻底重启 OpenCode?",description:"应用会退出并自动重新打开,让插件代码和后台 serve --service 一起换成最新版本。当前会话通常会自动恢复。",confirm:"重启"})&&await be("restart",async()=>{try{if(!(await e.admin.restart()).ok){H("无法自动重启,请手动完全退出 OpenCode 再打开。","error");return}H("正在重启 OpenCode…如果没有自动打开,请手动启动。","info")}catch{H("自动重启调用失败,后台服务可能还是旧版本。请先手动完全退出 OpenCode(并结束 serve --service)再打开一次。","error")}})},Ae=async a=>{if(a)try{(await e.admin.openUrl({url:a})).ok||H(`无法打开链接:${a}`,"error")}catch(m){H(ue(m),"error")}},In=async()=>{await be("config",async()=>{try{(await e.admin.openConfig()).ok||H("无法打开配置文件","error")}catch(a){H(ue(a),"error")}})},ct=(a,m)=>{e.ctx.dialogs.open(y=>t.createComponent(mi,{get ctx(){return e.ctx},get admin(){return e.admin},name:a,fallback:m,get busy(){return ne(`install:${a}`)},onInstall:L=>{y.close(),_e(a,L)},onClose:()=>y.close()}))},We=l.createMemo(()=>{const a=h().trim().toLowerCase(),m=S();return d().filter(y=>m!=="all"&&y.type!==m?!1:a?[y.name,y.pkg,y.desc,y.long,...y.tags].join(" ").toLowerCase().includes(a):!0)}),Tn=l.createMemo(()=>{const a=d();return{all:a.length,plugins:a.filter(m=>m.type==="plugins").length,mcp:a.filter(m=>m.type==="mcp").length,themes:a.filter(m=>m.type==="themes").length}}),Pe=l.createMemo(()=>{const a=[...z()];return w()==="downloads"?a.sort((m,y)=>y.weekly-m.weekly):w()==="recent"&&a.sort((m,y)=>(y.published||"").localeCompare(m.published||"")),a}),pt=l.createMemo(()=>Pe().slice(0,Y()));l.createEffect(()=>{z(),pe(12)});const Ln=()=>u()?.registry||oi,me=l.createMemo(()=>[...de().values()].filter(a=>a.hasUpdate).length),Ee=l.createMemo(()=>[...de().values()].filter(a=>a.error).length),jt=l.createMemo(()=>{const a=o()?.plugins??[];return I()?a.filter(m=>de().get(m.spec)?.hasUpdate===!0):a}),Mn=a=>de().get(a),zn=l.createMemo(()=>{const a=new Map;for(const m of de().values())a.set(m.name,m);return a}),Pt=a=>{s(a),a!=="installed"&&R(!1),a!=="catalog"&&!$e()&&!ne("updates")&&He(!0)};l.onMount(()=>{Lt(),Mt(!1),He(!0),qe()});const dt=(a,m,y,L,A)=>(()=>{var P=vo();return P.$$keydown=O=>{if(O.key!=="ArrowLeft"&&O.key!=="ArrowRight")return;O.preventDefault();const G=["catalog","search","installed"],ee=G.indexOf(i()),J=O.key==="ArrowRight"?(ee+1)%G.length:(ee+G.length-1)%G.length;Pt(G[J])},P.$$click=()=>Pt(a),t.setAttribute(P,"id",`ph-tab-${a}`),t.insert(P,t.createComponent(r.Icon,{name:y,size:"small"}),null),t.insert(P,m,null),t.insert(P,t.createComponent(l.Show,{when:L!==void 0&&L!=="",get children(){var O=mo();return t.insert(O,L),O}}),null),t.insert(P,t.createComponent(l.Show,{when:A!==void 0&&A>0,get children(){var O=fo(),G=O.firstChild;return t.setAttribute(O,"title",`${A} 个可更新`),t.insert(O,A,G),O}}),null),t.effect(O=>{var G=i()===a,ee=i()===a;return G!==O.e&&t.setAttribute(P,"aria-selected",O.e=G),ee!==O.t&&t.setAttribute(P,"data-active",O.t=ee),O},{e:void 0,t:void 0}),P})(),jn=(a,m,y)=>(()=>{var L=yo();return t.insert(L,a?`v${a}`:"",null),t.insert(L,t.createComponent(l.Show,{when:y&&m,get children(){var A=bo();return A.firstChild,t.insert(A,m,null),A}}),null),L})(),Pn=a=>{const m=()=>zn().get(a.pkg),y=()=>m()?.hasUpdate===!0,L=()=>ne(`install:${a.pkg}`),A=()=>ct(a.pkg,{version:a.version,description:a.desc||a.long,repo:a.repo});return(()=>{var P=Co(),O=P.firstChild,G=O.firstChild,ee=G.firstChild,J=ee.nextSibling,fe=J.firstChild,ie=fe.firstChild,he=J.nextSibling,re=G.nextSibling,oe=re.firstChild,Z=oe.nextSibling,te=Z.firstChild,X=O.nextSibling;return t.insert(ee,t.createComponent(r.Icon,{get name(){return di(a.type)},size:"normal"})),t.insert(ie,()=>a.name),t.insert(J,t.createComponent(l.Show,{get when(){return a.pkg},get children(){var E=wo();return t.insert(E,()=>a.pkg),E}}),null),t.insert(he,t.createComponent(l.Show,{get when(){return a.installed},get children(){return kt()}}),null),t.insert(he,t.createComponent(l.Show,{get when(){return y()},get children(){var E=vt();return E.firstChild,t.insert(E,()=>m().latest,null),E}}),null),re.$$keydown=E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),a.pkg?A():Ae(a.repo))},re.$$click=()=>a.pkg?A():void Ae(a.repo),t.insert(oe,()=>a.desc||a.long||"—"),t.insert(te,()=>ii[a.type]??a.type),t.insert(Z,t.createComponent(l.Show,{get when(){return a.version},get children(){return[Le(),(()=>{var E=ko();return E.firstChild,t.insert(E,()=>a.version,null),E})()]}}),null),t.insert(Z,t.createComponent(l.Show,{get when(){return!a.pkg},get children(){return[Le(),xo()]}}),null),t.insert(Z,t.createComponent(l.Show,{get when(){return a.tags.length>0},get children(){return[Le(),(()=>{var E=So();return t.insert(E,()=>a.tags.slice(0,4).join(" / ")),E})()]}}),null),t.insert(X,t.createComponent(l.Show,{get when(){return a.pkg},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:A,children:"详情"})}}),null),t.insert(X,t.createComponent(r.Button,{variant:"ghost-muted",size:"small",icon:"square-arrow-top-right",onClick:()=>{Ae(a.repo)},children:"源码"}),null),t.insert(X,t.createComponent(l.Show,{get when(){return y()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(a.pkg,m().latest)},children:"更新"})}}),null),t.insert(X,t.createComponent(l.Show,{get when(){return t.memo(()=>!y()&&!a.installed)()&&a.pkg},get children(){return t.createComponent(r.Button,{variant:"neutral",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(a.pkg)},children:"安装"})}}),null),t.insert(X,t.createComponent(l.Show,{get when(){return t.memo(()=>!y()&&!a.installed)()&&!a.pkg},get children(){return $o()}}),null),t.effect(E=>{var _=y()?"true":void 0,k=L()?"true":void 0;return _!==E.e&&t.setAttribute(P,"data-stale",E.e=_),k!==E.t&&t.setAttribute(P,"data-busy",E.t=k),E},{e:void 0,t:void 0}),P})()},En=a=>{const m=()=>ct(a.name,{version:a.version,description:a.description,homepage:a.homepage,repo:a.repo,npm:a.npm});return(()=>{var y=Oo(),L=y.firstChild,A=L.firstChild,P=A.firstChild,O=P.nextSibling,G=O.firstChild,ee=G.firstChild,J=G.nextSibling;J.firstChild;var fe=O.nextSibling,ie=A.nextSibling,he=ie.firstChild,re=he.nextSibling,oe=re.firstChild,Z=oe.firstChild,te=oe.nextSibling,X=te.nextSibling,E=X.firstChild,_=L.nextSibling;return t.insert(P,()=>nn(a.name)),t.insert(ee,()=>a.name),t.insert(J,()=>a.version,null),t.insert(fe,t.createComponent(l.Show,{get when(){return a.installed},get children(){var k=kt();return k.firstChild,t.insert(k,(()=>{var B=t.memo(()=>!!a.current);return()=>B()?` v${a.current}`:""})(),null),k}}),null),t.insert(fe,t.createComponent(l.Show,{get when(){return a.hasUpdate},get children(){var k=vt();return k.firstChild,t.insert(k,()=>a.version,null),k}}),null),ie.$$keydown=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),m())},ie.$$click=m,t.insert(he,()=>a.description||"—"),t.insert(oe,t.createComponent(r.Icon,{name:"download",size:"small"}),Z),t.insert(oe,()=>tt(a.weekly),Z),t.insert(X,()=>tt(a.monthly),E),t.insert(re,t.createComponent(l.Show,{get when(){return a.publisher},get children(){return[Le(),(()=>{var k=_o();return k.firstChild,t.insert(k,()=>a.publisher,null),k})()]}}),null),t.insert(re,t.createComponent(l.Show,{get when(){return a.published},get children(){return[Le(),(()=>{var k=Ao(),B=k.firstChild;return t.insert(k,()=>St(a.published),B),k})()]}}),null),t.insert(ie,t.createComponent(l.Show,{get when(){return a.keywords.length>0},get children(){var k=yn();return t.insert(k,t.createComponent(l.For,{get each(){return a.keywords.slice(0,3)},children:B=>(()=>{var $=xt();return t.insert($,B),$})()})),k}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return a.homepage},get children(){return t.createComponent(r.Tooltip,{value:"主页",get children(){return t.createComponent(r.IconButton,{icon:"globe",size:"small",label:"主页",onClick:()=>{Ae(a.homepage)}})}})}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return a.repo},get children(){return t.createComponent(r.Tooltip,{value:"源码仓库",get children(){return t.createComponent(r.IconButton,{icon:"github",size:"small",label:"源码仓库",onClick:()=>{Ae(a.repo)}})}})}}),null),t.insert(_,t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:m,children:"详情"}),null),t.insert(_,t.createComponent(l.Show,{get when(){return a.hasUpdate},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return ne(`install:${a.name}`)},onClick:()=>{_e(a.name,a.version)},children:"更新"})}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return t.memo(()=>!a.hasUpdate)()&&!a.installed},get children(){return t.createComponent(r.Button,{variant:"neutral",size:"small",icon:"download",get busy(){return ne(`install:${a.name}`)},onClick:()=>{_e(a.name)},children:"安装"})}}),null),t.effect(k=>{var B=ne(`install:${a.name}`)?"true":void 0,$=nt(a.weekly,"周下载"),V=nt(a.monthly,"月下载");return B!==k.e&&t.setAttribute(y,"data-busy",k.e=B),$!==k.t&&t.setAttribute(oe,"title",k.t=$),V!==k.a&&t.setAttribute(X,"title",k.a=V),k},{e:void 0,t:void 0,a:void 0}),y})()},Bn=a=>{const m=()=>Mn(a.spec),y=()=>m()?.hasUpdate===!0,L=()=>ne(`install:${a.name}`),A=()=>m()?.current||a.version,P=()=>(m()?.error??"")!=="",O=()=>Ce().get(a.spec),G=()=>{const J=O();return J?J.status==="failed"?"failed":J.status==="loaded"?"loaded":J.available?"pending":"unknown":at()?"unknown":"pending"},ee=()=>G()==="loaded"?O().runtimeVersion?`运行中 v${O().runtimeVersion}`:"运行中":G()==="failed"?"加载失败":G()==="pending"?"待重启生效":"运行状态未验证";return(()=>{var J=zo(),fe=J.firstChild,ie=fe.firstChild,he=ie.firstChild,re=he.nextSibling,oe=re.firstChild,Z=oe.firstChild,te=oe.nextSibling,X=re.nextSibling,E=X.firstChild,_=ie.nextSibling,k=_.firstChild,B=fe.nextSibling;return t.insert(he,()=>nn(a.name)),t.insert(Z,()=>a.name),t.insert(te,()=>a.spec),t.insert(E,ee),t.insert(X,t.createComponent(l.Show,{get when(){return y()},get children(){var $=vt();return $.firstChild,t.insert($,()=>m().latest,null),$}}),null),t.insert(X,t.createComponent(l.Show,{get when(){return P()},get children(){return Io()}}),null),t.insert(X,t.createComponent(l.Show,{get when(){return a.kind==="path"},get children(){return To()}}),null),t.insert(k,()=>jn(A(),m()?.latest??"",y()),null),t.insert(k,t.createComponent(l.Show,{get when(){return t.memo(()=>!!y())()&&a.kind==="path"},get children(){return[Le(),Lo()]}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return O()?.error},get children(){var $=Mo(),V=$.firstChild;return t.insert($,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),V),t.insert(V,()=>O().error),t.effect(()=>t.setAttribute($,"title",O().error)),$}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return hi.test(a.name)},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"eye",onClick:()=>ct(a.name,{version:A()}),children:"详情"})}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return y()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"download",get busy(){return L()},onClick:()=>{_e(m().name,m().latest)},children:"更新"})}}),null),t.insert(B,t.createComponent(l.Show,{get when(){return a.removable},get children(){return t.createComponent(r.Button,{variant:"ghost-muted",size:"small",icon:"trash",get busy(){return L()},onClick:()=>{An(a)},children:"移除"})}}),null),t.effect($=>{var V=y()?"true":void 0,D=L()?"true":void 0,F=G(),ae=ee();return V!==$.e&&t.setAttribute(J,"data-stale",$.e=V),D!==$.t&&t.setAttribute(J,"data-busy",$.t=D),F!==$.a&&t.setAttribute(E,"data-runtime",$.a=F),ae!==$.o&&t.setAttribute(E,"title",$.o=ae),$},{e:void 0,t:void 0,a:void 0,o:void 0}),J})()};return(()=>{var a=Ho(),m=a.firstChild,y=m.nextSibling,L=y.firstChild,A=L.firstChild,P=A.firstChild,O=A.nextSibling,G=O.firstChild,ee=G.nextSibling,J=O.nextSibling,fe=J.firstChild,ie=fe.nextSibling,he=ie.nextSibling,re=he.nextSibling,oe=re.firstChild,Z=y.nextSibling,te=Z.firstChild,X=te.firstChild;X.nextSibling;var E=Z.nextSibling;return t.insert(A,t.createComponent(r.Icon,{name:"extensions",size:"small"}),P),t.insert(L,t.createComponent(l.Show,{get when(){return!e.embedded},get children(){return jo()}}),O),ee.$$click=()=>{Ae(Ln())},t.insert(ie,()=>o()?.configPath??"读取中…"),t.insert(re,()=>o()?.configKey??"plugins",oe),t.insert(Z,t.createComponent(l.Show,{get when(){return Fe()},get children(){var _=Po(),k=_.firstChild,B=k.nextSibling;return t.insert(_,t.createComponent(r.Icon,{get name(){return gi(Fe().tone)},size:"small"}),k),t.insert(k,()=>Fe().text),B.$$click=()=>st(void 0),t.insert(B,t.createComponent(r.Icon,{name:"close",size:"small"})),t.effect(()=>t.setAttribute(_,"data-tone",Fe().tone)),_}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return o()?.error},get children(){var _=Eo(),k=_.firstChild;return t.insert(_,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),k),t.insert(k,()=>o().error),_}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return at()},get children(){var _=Bo(),k=_.firstChild,B=k.firstChild;return t.insert(_,t.createComponent(r.Icon,{name:"circle-exclamation",size:"small"}),k),t.insert(k,at,B),t.insert(_,t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"outline-rotate-clockwise",onClick:()=>{qe()},children:"重试"}),null),_}}),te),t.insert(Z,t.createComponent(l.Show,{get when(){return kn()},get children(){var _=Do(),k=_.firstChild,B=k.firstChild,$=B.nextSibling;return $.nextSibling,t.insert(_,t.createComponent(r.Icon,{name:"outline-rotate-clockwise",size:"small"}),k),t.insert(k,xn,$),t.insert(_,t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"outline-rotate-clockwise",onClick:()=>{zt()},children:"彻底重启 OpenCode"}),null),_}}),te),t.insert(X,()=>dt("catalog","精选目录","extensions",u()?d().length:void 0),null),t.insert(X,()=>dt("search","npm 搜索","magnifying-glass",b()?z().length:void 0),null),t.insert(X,()=>dt("installed","已安装","checklist",o()?.plugins.length??0,me()),null),t.insert(te,t.createComponent(l.Show,{get when(){return i()==="catalog"},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"refresh",get busy(){return ne("catalog")},onClick:()=>{Mt(!0)},children:"更新目录"})}}),null),t.insert(te,t.createComponent(l.Show,{get when(){return i()==="search"},get children(){return t.createComponent(l.Show,{get when(){return b()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"close",onClick:()=>{Q([]),C(!1),g(""),st(void 0),je+=1},children:"清空"})}})}}),null),t.insert(te,t.createComponent(l.Show,{get when(){return i()==="installed"},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",icon:"refresh",get busy(){return ne("updates")},onClick:()=>{He()},children:"检查更新"})}}),null),t.insert(te,t.createComponent(r.Menu,{label:"更多操作",icon:"outline-dots",placement:"bottom-end",items:[{type:"group",label:"配置",items:[{label:"打开配置文件",icon:"open-file",onSelect:()=>{In()}},{label:"重载配置",icon:"refresh",onSelect:()=>{On()}}]},{type:"separator"},{label:"彻底重启 OpenCode…",icon:"outline-rotate-clockwise",onSelect:()=>{zt()}}]}),null),t.insert(a,t.createComponent(l.Switch,{get children(){return[t.createComponent(l.Match,{get when(){return i()==="catalog"},get children(){var _=No(),k=_.firstChild,B=k.firstChild,$=B.firstChild,V=$.nextSibling;return t.insert($,t.createComponent(r.TextInput,{label:"筛选 awesome-opencode 精选插件",placeholder:"按名称、描述或标签筛选,例如 memory / auth / token",type:"search",get value(){return h()},onInput:D=>{x(D),q(Ye)}})),t.insert(V,t.createComponent(l.For,{each:ai,children:D=>(()=>{var F=Vo(),ae=F.firstChild;return F.$$click=()=>{T(D.value),q(Ye)},t.insert(F,()=>D.label,ae),t.insert(ae,()=>Tn()[D.value]),t.effect(()=>t.setAttribute(F,"data-active",S()===D.value)),F})()})),t.insert(_,t.createComponent(l.Show,{get when(){return t.memo(()=>!!ne("catalog"))()&&d().length===0},get children(){var D=Ne();return t.insert(D,t.createComponent(l.For,{each:[0,1,2,3],children:()=>tn()})),D}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return!ne("catalog")||d().length>0},get children(){return t.createComponent(l.Show,{get when(){return We().length>0},get fallback(){return(()=>{var D=Wo(),F=D.firstChild;return F.nextSibling,t.insert(D,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),F),t.insert(D,t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>{x(""),T("all")},children:"清除筛选"}),null),D})()},get children(){return[(()=>{var D=Ne();return t.insert(D,t.createComponent(l.For,{get each(){return We().slice(0,M())},children:F=>Pn(F)})),D})(),t.createComponent(l.Show,{get when(){return We().length>M()},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>q(D=>D+Ye),get children(){return["显示更多(还有 ",t.memo(()=>We().length-M())," 个)"]}})}})]}})}}),null),t.effect(()=>t.setAttribute(_,"aria-labelledby",`ph-tab-${i()}`)),_}}),t.createComponent(l.Match,{get when(){return i()==="search"},get children(){var _=Go(),k=_.firstChild,B=k.firstChild;return k.nextSibling,t.insert(B,t.createComponent(r.TextInput,{label:"搜索 npm 上的 OpenCode 插件",placeholder:"搜索插件,例如 qoder / notify / usage(输入后自动搜索)",type:"search",get value(){return j()},onInput:_n,onSubmit:$=>{ze&&window.clearTimeout(ze),lt=$.trim(),Ve($)}})),t.insert(k,t.createComponent(r.Button,{variant:"contrast",icon:"magnifying-glass",get busy(){return ne("search")},onClick:()=>{Ve(j())},children:"搜索"}),null),t.insert(_,t.createComponent(l.Show,{get when(){return!b()},get children(){var $=Uo(),V=$.firstChild,D=V.nextSibling,F=D.nextSibling;return t.insert($,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),V),t.insert(F,t.createComponent(l.For,{each:li,children:ae=>(()=>{var ve=Jo();return ve.$$click=()=>{Ve(ae)},t.insert(ve,ae),ve})()})),$}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return b()},get children(){return[(()=>{var $=Ro(),V=$.firstChild,D=V.firstChild,F=D.nextSibling,ae=V.nextSibling;return t.insert(F,()=>Pe().length),t.insert(ae,t.createComponent(l.For,{each:si,children:ve=>(()=>{var N=Qo();return N.$$click=()=>v(ve.value),t.insert(N,()=>ve.label),t.effect(()=>t.setAttribute(N,"data-active",w()===ve.value)),N})()})),$})(),t.createComponent(l.Show,{get when(){return t.memo(()=>!!ne("search"))()&&z().length===0},get children(){var $=Ne();return t.insert($,t.createComponent(l.For,{each:[0,1,2,3],children:()=>tn()})),$}}),t.createComponent(l.Show,{get when(){return!ne("search")||z().length>0},get children(){return t.createComponent(l.Show,{get when(){return Pe().length>0},get fallback(){return(()=>{var $=Xo(),V=$.firstChild;return t.insert($,t.createComponent(r.Icon,{name:"magnifying-glass",size:"large"}),V),$})()},get children(){return[(()=>{var $=Ne();return t.insert($,t.createComponent(l.For,{get each(){return pt()},children:V=>En(V)})),$})(),t.createComponent(l.Show,{get when(){return Pe().length>pt().length},get children(){return t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>pe($=>$+12),get children(){return["显示更多(还有 ",t.memo(()=>Pe().length-pt().length)," 个)"]}})}})]}})}})]}}),null),t.effect(()=>t.setAttribute(_,"aria-labelledby",`ph-tab-${i()}`)),_}}),t.createComponent(l.Match,{get when(){return i()==="installed"},get children(){var _=qo(),k=_.firstChild,B=k.firstChild,$=B.firstChild,V=$.nextSibling,D=B.nextSibling,F=D.firstChild,ae=F.firstChild,ve=ae.nextSibling;return D.nextSibling,t.insert(V,()=>o()?.plugins.length??0),F.$$click=()=>{me()>0&&R(!I())},t.insert(ve,me),t.insert(k,t.createComponent(l.Show,{get when(){return $e()},get children(){var N=Fo();return t.insert(N,(()=>{var se=t.memo(()=>Ee()>0);return()=>se()?`已检查 ${Math.max(0,(o()?.plugins.length??0)-Ee())} 个 · ${Ee()} 个未能检查${me()>0?` · ${me()} 个可更新`:""}`:t.memo(()=>me()>0)()?`检查过 npm registry · ${me()} 个可更新`:"检查过 npm registry · 已检查的插件均为最新"})()),N}}),null),t.insert(_,t.createComponent(l.Show,{get when(){return(o()?.plugins.length??0)>0},get fallback(){return(()=>{var N=Yo(),se=N.firstChild;return t.insert(N,t.createComponent(r.Icon,{name:"extensions",size:"large"}),se),N})()},get children(){return t.createComponent(l.Show,{get when(){return jt().length>0},get fallback(){return(()=>{var N=ei();return t.insert(N,t.createComponent(r.Icon,{name:"checklist",size:"large"}),null),t.insert(N,t.createComponent(l.Show,{get when(){return Ee()>0},get fallback(){return[ti(),ni()]},get children(){return[(()=>{var se=Zo(),Je=se.firstChild,Be=Je.nextSibling;return Be.nextSibling,t.insert(se,Ee,Be),se})(),Ko()]}}),null),t.insert(N,t.createComponent(r.Button,{variant:"ghost",size:"small",onClick:()=>R(!1),children:"显示全部"}),null),N})()},get children(){var N=Ne();return t.insert(N,t.createComponent(l.For,{get each(){return jt()},children:se=>Bn(se)})),N}})}}),null),t.effect(N=>{var se=`ph-tab-${i()}`,Je=I(),Be=me()===0?"true":void 0,Et=me()===0?"检查更新后再来看可更新的插件":"只显示有新版本的插件";return se!==N.e&&t.setAttribute(_,"aria-labelledby",N.e=se),Je!==N.t&&t.setAttribute(F,"data-active",N.t=Je),Be!==N.a&&t.setAttribute(F,"data-disabled",N.a=Be),Et!==N.o&&t.setAttribute(F,"title",N.o=Et),N},{e:void 0,t:void 0,a:void 0,o:void 0}),_}})]}}),E),t.effect(_=>{var k=e.embedded?"true":void 0,B=o()?.configPath;return k!==_.e&&t.setAttribute(a,"data-embedded",_.e=k),B!==_.t&&t.setAttribute(J,"title",_.t=B),_},{e:void 0,t:void 0}),a})()}function fi(e){const r=e.ctx.ui,o=()=>{e.onClose(),setTimeout(()=>e.ctx.layout.settings("hub"),0)};return t.createComponent(r.Dialog,{title:"插件中心",size:"x-large",get footer(){return(()=>{var n=ri();return n.firstChild,t.insert(n,t.createComponent(r.Button,{size:"small",variant:"ghost",icon:"settings-gear",onClick:o,children:"在设置中打开"}),null),t.insert(n,t.createComponent(r.Button,{size:"small",get onClick(){return e.onClose},children:"关闭"}),null),n})()},get children(){return t.createComponent(wn,{get ctx(){return e.ctx},get admin(){return e.admin},embedded:!0})}})}t.delegateEvents(["click","keydown"]);const vi=Ue.Plugin.define({setup(e){const r=e.main(Dt),o=()=>{e.dialogs.active()||e.dialogs.open(n=>t.createComponent(fi,{ctx:e,admin:r,onClose:()=>n.close()}))};e.add(Ue.SettingsPage,{id:"hub",title:"插件中心",icon:"extensions",entries:[{id:"hub",title:"插件中心",description:"浏览社区精选插件,按 npm 搜索,安装或移除",keywords:"plugin npm install remove hub catalog marketplace"}],render:()=>t.createComponent(wn,{ctx:e,admin:r})}),e.add(Ue.TitlebarItem,()=>({id:"hub",label:"插件中心",title:"打开插件中心",icon:"extensions",run:o})),e.add(Ue.Command,()=>({id:"open",title:"插件中心",description:"浏览、搜索、安装与更新 OpenCode 插件",keywords:"plugin hub install browse npm catalog marketplace",group:"设置",section:"navigation",bind:"mod+alt+p",featured:!0,run:o}))},main(e){e.provide(Dt,{snapshot:()=>ge(),updates:()=>hr(),search:r=>Lr(r.query),browse:async r=>{const o=await ge();return qr(new Set(o.plugins.map(n=>n.name)),r.force)},detail:r=>Tr(r.name),openUrl:r=>({ok:Mr(r.url)}),openConfig:async()=>({ok:await zr()}),install:r=>wr(r.spec,r.version),remove:r=>kr(r.spec),reload:()=>Pr(e.cli.command),restart:()=>({ok:jr()}),runtime:()=>Er(e.serverEndpoints.get("sidecar"))})}});exports.default=vi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-plugin-hub",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Plugin manager for OpenCode Desktop: browse community plugins, search npm, inspect README and downloads, install and update without editing JSON.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/gui/admin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process"
|
|
2
2
|
import { homedir, tmpdir } from "node:os"
|
|
3
|
-
import { basename, join } from "node:path"
|
|
3
|
+
import { basename, isAbsolute, join, resolve } from "node:path"
|
|
4
4
|
import { copyFile, cp, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises"
|
|
5
5
|
import { applyEdits, modify, parse, type ParseError } from "jsonc-parser"
|
|
6
6
|
|
|
@@ -179,7 +179,10 @@ function expandPath(spec: string): string {
|
|
|
179
179
|
const trimmed = spec.trim()
|
|
180
180
|
if (trimmed === "~") return homedir()
|
|
181
181
|
if (trimmed.startsWith("~/")) return join(homedir(), trimmed.slice(2))
|
|
182
|
-
|
|
182
|
+
// The server resolves relative plugin paths against the opencode config
|
|
183
|
+
// directory (e.g. "./local-plugins/x" -> ~/.config/opencode/local-plugins/x),
|
|
184
|
+
// not the process cwd. Resolve the same way so identity comparisons match.
|
|
185
|
+
return isAbsolute(trimmed) ? trimmed : resolve(configDir(), trimmed)
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
interface Manifest {
|
|
@@ -1063,14 +1066,24 @@ export async function runtime(endpoint: { url: string; headers: Readonly<Record<
|
|
|
1063
1066
|
const state = await snapshot()
|
|
1064
1067
|
if (!endpoint) return { items: state.plugins.map(toUnknown), error: "无法连接后台服务,运行状态未知" }
|
|
1065
1068
|
try {
|
|
1066
|
-
|
|
1069
|
+
// The sidecar serves its web UI at `/`, so `/plugin` is an HTML page. The
|
|
1070
|
+
// JSON API lives under `/api`; asking the wrong path yields 200 HTML and a
|
|
1071
|
+
// confusing parse error.
|
|
1072
|
+
const response = await fetch(`${endpoint.url.replace(/\/+$/, "")}/api/plugin`, {
|
|
1067
1073
|
signal: AbortSignal.timeout(8_000),
|
|
1068
1074
|
headers: { accept: "application/json", ...endpoint.headers },
|
|
1069
1075
|
})
|
|
1070
1076
|
if (!response.ok) {
|
|
1071
1077
|
return { items: state.plugins.map(toUnknown), error: `后台服务返回 ${response.status},运行状态未知` }
|
|
1072
1078
|
}
|
|
1073
|
-
|
|
1079
|
+
// Do not assume JSON: a misrouted request can return an HTML page with 200.
|
|
1080
|
+
const text = await response.text()
|
|
1081
|
+
let body: { data?: PluginListInfo[] } | PluginListInfo[]
|
|
1082
|
+
try {
|
|
1083
|
+
body = JSON.parse(text) as { data?: PluginListInfo[] } | PluginListInfo[]
|
|
1084
|
+
} catch {
|
|
1085
|
+
return { items: state.plugins.map(toUnknown), error: "后台返回的不是 JSON,运行状态未知" }
|
|
1086
|
+
}
|
|
1074
1087
|
const list = Array.isArray(body) ? body : body.data ?? []
|
|
1075
1088
|
const items = state.plugins.map((entry) => {
|
|
1076
1089
|
// The server reports the source target; the config holds the spec (name, name@range or a path).
|
|
@@ -1081,8 +1094,8 @@ export async function runtime(endpoint: { url: string; headers: Readonly<Record<
|
|
|
1081
1094
|
if (source.type === "package" && typeof source.target === "string") {
|
|
1082
1095
|
return splitSpec(source.target).name === name
|
|
1083
1096
|
}
|
|
1084
|
-
if (source.type === "local" && entry.kind === "path") {
|
|
1085
|
-
return source.path === expandPath(entry.spec)
|
|
1097
|
+
if (source.type === "local" && entry.kind === "path" && typeof source.path === "string") {
|
|
1098
|
+
return resolve(source.path) === resolve(expandPath(entry.spec))
|
|
1086
1099
|
}
|
|
1087
1100
|
return false
|
|
1088
1101
|
})
|
package/src/gui/page.tsx
CHANGED
|
@@ -431,6 +431,16 @@ const CSS = `
|
|
|
431
431
|
.ph-card-main { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }
|
|
432
432
|
.ph-card-body { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
|
|
433
433
|
.ph-card-body[role="button"] { cursor: pointer; border-radius: 6px; }
|
|
434
|
+
/* 加载失败时把服务端给出的原因放在卡片里,而不是只留一个徽章。 */
|
|
435
|
+
.ph-runtime-error {
|
|
436
|
+
display: flex;
|
|
437
|
+
align-items: flex-start;
|
|
438
|
+
gap: 4px;
|
|
439
|
+
color: var(--ph-danger);
|
|
440
|
+
font-size: 10.5px;
|
|
441
|
+
line-height: 1.45;
|
|
442
|
+
overflow-wrap: anywhere;
|
|
443
|
+
}
|
|
434
444
|
.ph-card-head { display: flex; align-items: flex-start; gap: 9px; }
|
|
435
445
|
.ph-card-titles { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
|
|
436
446
|
.ph-tile {
|
|
@@ -1700,6 +1710,12 @@ export function PluginHubPage(props: { ctx: Context; admin: AdminClient; embedde
|
|
|
1700
1710
|
<span>更新会覆盖目录内容,原文件自动备份</span>
|
|
1701
1711
|
</Show>
|
|
1702
1712
|
</div>
|
|
1713
|
+
<Show when={runtimeInfo()?.error}>
|
|
1714
|
+
<div class="ph-runtime-error" title={runtimeInfo()!.error}>
|
|
1715
|
+
<ui.Icon name="circle-exclamation" size="small" />
|
|
1716
|
+
<span>{runtimeInfo()!.error}</span>
|
|
1717
|
+
</div>
|
|
1718
|
+
</Show>
|
|
1703
1719
|
</div>
|
|
1704
1720
|
</div>
|
|
1705
1721
|
<div class="ph-actions">
|
|
@@ -1793,7 +1809,10 @@ export function PluginHubPage(props: { ctx: Context; admin: AdminClient; embedde
|
|
|
1793
1809
|
<Show when={runtimeError()}>
|
|
1794
1810
|
<div class="ph-notice" data-tone="warning">
|
|
1795
1811
|
<ui.Icon name="circle-exclamation" size="small" />
|
|
1796
|
-
<span>{runtimeError()}
|
|
1812
|
+
<span>{runtimeError()}。配置操作不受影响,可重试读取。</span>
|
|
1813
|
+
<ui.Button size="small" variant="ghost" icon="outline-rotate-clockwise" onClick={() => void loadRuntime()}>
|
|
1814
|
+
重试
|
|
1815
|
+
</ui.Button>
|
|
1797
1816
|
</div>
|
|
1798
1817
|
</Show>
|
|
1799
1818
|
<Show when={hasPendingChanges()}>
|