@opencode/console 0.1.1 → 0.1.3
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/README.md +13 -1
- package/THIRD_PARTY_LICENSES.md +16 -0
- package/chunk-0752rr1w.js +1 -0
- package/chunk-11wqcgnn.js +2 -0
- package/{chunk-c16zjbe1.js → chunk-1z17cm3w.js} +2 -2
- package/chunk-38zs2jre.js +1 -0
- package/chunk-3p7x3f0s.js +1 -0
- package/chunk-5a8bvcgq.js +15 -0
- package/chunk-6fqhbptf.js +1 -0
- package/chunk-6hmr86q5.js +3 -0
- package/chunk-6xs4y82y.js +2 -0
- package/chunk-7qa618ad.js +63 -0
- package/chunk-82p6vmpy.js +1 -0
- package/chunk-9dgq3xc0.js +32 -0
- package/chunk-9zpe1ry1.js +2 -0
- package/chunk-b4fde357.js +2 -0
- package/chunk-b6azftzw.js +254 -0
- package/chunk-bcmj4f7y.js +2 -0
- package/chunk-cd4h496v.js +2 -0
- package/chunk-g9f1r3v3.js +1 -0
- package/chunk-gcqbk8bn.js +149 -0
- package/chunk-ghvsrvdw.js +1 -0
- package/chunk-jpqmm6pm.js +2 -0
- package/chunk-jxh84gfh.js +1 -0
- package/chunk-kd1hjfpe.js +1 -0
- package/{chunk-zdf3mvav.js → chunk-m3m5harb.js} +2 -2
- package/chunk-mnjk01tj.js +1 -0
- package/chunk-nqk8n93s.js +1 -0
- package/chunk-qp7a49b3.js +1 -0
- package/chunk-r1adn0ka.js +11 -0
- package/chunk-tamzaefd.js +1 -0
- package/chunk-x65p26st.js +2 -0
- package/chunk-yb3fn5r1.js +2 -0
- package/{chunk-kdkxhbxc.js → chunk-z5mqjw9r.js} +2 -2
- package/dsh-plugin.js +1 -0
- package/index.js +59 -47
- package/package.json +3 -2
- package/pi-extension.js +2 -2
- package/chunk-03p95nje.js +0 -6
- package/chunk-2ktsq2gj.js +0 -3
- package/chunk-2y9vn023.js +0 -1
- package/chunk-5q7mrvv1.js +0 -2
- package/chunk-5w6hy202.js +0 -1
- package/chunk-6mydq7cv.js +0 -2
- package/chunk-6rpbc10h.js +0 -2
- package/chunk-81fv1abj.js +0 -2
- package/chunk-aym5xapq.js +0 -1
- package/chunk-bkr0zk6g.js +0 -32
- package/chunk-c9kvdzct.js +0 -1
- package/chunk-eyf3z07t.js +0 -1
- package/chunk-frqdgjbd.js +0 -17
- package/chunk-fzckrdm3.js +0 -2
- package/chunk-hpy9mszv.js +0 -1
- package/chunk-jh21wbwd.js +0 -2
- package/chunk-kvqewrn5.js +0 -1
- package/chunk-mpmqsnkz.js +0 -1
- package/chunk-mzpdnb17.js +0 -1
- package/chunk-nvh2a5rc.js +0 -254
- package/chunk-p59r4b0j.js +0 -2
- package/chunk-p7wsm5k0.js +0 -1
- package/chunk-sn451nak.js +0 -2
- package/chunk-vqmbpbbm.js +0 -1
- package/chunk-wjghq897.js +0 -63
- package/chunk-xeq3evq0.js +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @opencode/console
|
|
2
2
|
|
|
3
|
-
Connects Claude Code, Pi and
|
|
3
|
+
Connects Claude Code, Pi, Codex and DeepSeek Harness to an OpenCode Console workspace. They then use the workspace's models, MCP servers,
|
|
4
4
|
skills and instructions, and their tool calls follow the workspace's policies. OpenCode connects to Console on its own,
|
|
5
5
|
so OpenCode users don't need this package.
|
|
6
6
|
|
|
@@ -31,6 +31,17 @@ npx @opencode/console setup codex
|
|
|
31
31
|
Setup writes Codex's `~/.codex/config.toml` and `hooks.json` (or those in `CODEX_HOME`) and approves its policy hooks,
|
|
32
32
|
so Codex runs them without asking in `/hooks`.
|
|
33
33
|
|
|
34
|
+
## Set up DeepSeek Harness
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npx @opencode/console setup deepseek-harness
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Setup adds a plugin to DeepSeek Harness's `~/.dsh/cordis.patch.yml` (or the one in `DSH_HOME`), so `dsh web`,
|
|
41
|
+
`dsh headless` and every other profile use the workspace. While it's set up, the workspace's models replace the model
|
|
42
|
+
providers you added to DeepSeek Harness, and new sessions start on the workspace's default model. Restart a running
|
|
43
|
+
`dsh` after setup.
|
|
44
|
+
|
|
34
45
|
## Other commands
|
|
35
46
|
|
|
36
47
|
```sh
|
|
@@ -38,6 +49,7 @@ npx @opencode/console status # Show the sign-in, workspace
|
|
|
38
49
|
npx @opencode/console setup claude-code --remove # Undo the Claude Code setup and keep the sign-in
|
|
39
50
|
npx @opencode/console setup pi --remove # Undo the Pi setup and keep the sign-in
|
|
40
51
|
npx @opencode/console setup codex --remove # Undo the Codex setup and keep the sign-in
|
|
52
|
+
npx @opencode/console setup deepseek-harness --remove # Undo the DeepSeek Harness setup and keep the sign-in
|
|
41
53
|
npx @opencode/console logout # Sign out
|
|
42
54
|
```
|
|
43
55
|
|
package/THIRD_PARTY_LICENSES.md
CHANGED
|
@@ -572,3 +572,19 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
572
572
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
573
573
|
|
|
574
574
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
575
|
+
|
|
576
|
+
## yaml@2.9.0
|
|
577
|
+
|
|
578
|
+
Copyright Eemeli Aro <eemeli@gmail.com>
|
|
579
|
+
|
|
580
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
581
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
582
|
+
and this permission notice appear in all copies.
|
|
583
|
+
|
|
584
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
585
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
586
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
587
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
588
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
589
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
590
|
+
THIS SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{vr,po,fo,$s,Ni}from"./chunk-qp7a49b3.js";export{Ni as FetchHttpClient,$s as HttpClient,vr as HttpClientError,po as HttpClientRequest,fo as HttpClientResponse};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A,U,Vt,Wn,r,Cn,_n,er,ye,S,at,Wr,qt,me,Jr,W,Ve,b,_e,d,ia,ln,B,e,V,v,n,x,Rn,l,Gr,w,D,Ze,rr,aa,re,ca,g,fi,Ye,Qe,Pe,or,gt,la,Vr,Ht,Q,di,ua,Mn,Ho,q,Nn}from"./chunk-9dgq3xc0.js";var wo=Object.defineProperty,Ro=(o)=>o;function Lo(o,i){this[o]=Ro.bind(null,i)}var De=(o,i)=>{for(var p in i)wo(o,p,{get:i[p],enumerable:!0,configurable:!0,set:Lo.bind(i,p)})};var f=Q.check(la(0)),h=Q.check(Vr(0)),bn=e.pipe(re("RelativePath"),me({identifier:"RelativePath"})),P=e.pipe(re("AbsolutePath"),me({identifier:"AbsolutePath"})),t=(o)=>Ve(o).pipe(g(b(_e(o)),{decode:ye({strict:!1}),encode:at(Vt((i)=>i!==void 0))})),Uo=(o,i)=>Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)),s=(o)=>(i)=>Uo(i,o(i)),vn=gt.pipe(g(Mn,{decode:S((o)=>_n(o)),encode:S((o)=>er(o))}));var To=26,Fo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",qe=0,pe=0;function y(){return $e(!1)}function je(){return $e(!0)}function $e(o,i=Date.now()){if(i!==qe)qe=i,pe=0;pe++;let p=BigInt(i)*0x1000n+BigInt(pe),u=o?~p:p,k=Array.from({length:6},(I,Po)=>Number(u>>BigInt(40-8*Po)&0xffn).toString(16).padStart(2,"0")).join(""),M=crypto.getRandomValues(new Uint8Array(To-12));return k+Array.from(M,(I)=>Fo[I%62]).join("")}var Ke=e.pipe(re("Project.ID"),me({identifier:"Project.ID"}),s((o)=>({global:o.make("global")})));var ce=e.check(or("wrk")).pipe(re("Workspace.ID"),me({identifier:"Workspace.ID"}),s((o)=>{let i=()=>o.make("wrk_"+y());return{ascending:(p)=>{if(!p)return i();return o.make(p)},create:i}}));var Ge=n({directory:P,workspaceID:t(ce)}).annotate({identifier:"Location.Ref"}),zn=n(qt(Ge.fields,["workspaceID"])).annotate({identifier:"Location.PublicRef"});class Je extends q("Location.Info")({directory:P,workspaceID:t(ce),project:n({id:Ke,directory:P,canonical:P})}){}var jn=n(qt(Je.fields,["workspaceID"])).annotate({identifier:"Location.PublicInfo"});var _o=e.check(or("evt_")).pipe(re("Event.ID"),me({identifier:"Event.ID"}),s((o)=>({create:()=>o.make("evt_"+y())}))),Bo=Q.check(Vr(0)).pipe(re("Event.Seq"),me({identifier:"Event.Seq"})),Oo=Q.check(Vr(1)).pipe(re("Event.Version"),me({identifier:"Event.Version"})),Hn=n({aggregateID:e,seq:Bo,version:Oo});function c(o){let i=n(o.schema);return n({id:_o,created:gt,metadata:t(x(e,B)),type:d(o.type),location:t(Ge),data:i}).annotate({identifier:o.identifier??o.type}).pipe(s(()=>({type:o.type,durability:"ephemeral",durable:void 0,data:i})))}function m(...o){return Object.freeze(o)}var de=e.check(or("ses")).pipe(re("SessionID"),me({identifier:"Session.ID"}),s((o)=>({create:()=>o.make("ses_"+je())})));var tt=e.check(or("per")).pipe(re("Permission.ID"),me({identifier:"Permission.ID"}),s((o)=>({create:(i)=>o.make(i??"per_"+y())}))),No=w([n({type:d("tool"),messageID:e,id:e})]).annotate({identifier:"Permission.Source"}),qo={sessionID:de,action:e,resources:l(e),save:l(e).pipe(t),metadata:x(e,B).pipe(t),source:No.pipe(t),message:e.pipe(t)},zo=n({id:tt,...qo}).annotate({identifier:"Permission.Request"}),jo=D(["once","always","reject"]).annotate({identifier:"Permission.Reply"}),Xe=c({type:"permission.asked",schema:zo.fields}),et=c({type:"permission.replied",schema:{sessionID:de,requestID:tt,reply:jo}}),lr={Asked:Xe,Replied:et,Definitions:m(Xe,et)},Vo=D(["allow","deny","ask"]).annotate({identifier:"Permission.Effect"}),$o=n({action:e,resource:e,effect:Vo}).annotate({identifier:"Permission.Rule"}),ot=l($o).annotate({identifier:"Permission.Ruleset"});var ze=e.pipe(re("Integration.ID"),me({identifier:"Integration.ID"})),_=e.pipe(re("Integration.MethodID"),me({identifier:"Integration.MethodID"}));var j=e.pipe(re("Credential.ID"),me({identifier:"Credential.ID"}),s((o)=>({create:()=>o.make("cred_"+y())}))),it=c({type:"credential.updated",schema:{}}),nt=c({type:"credential.switched",schema:{integrationID:ze,credentialID:Ze(j)}}),yr={Updated:it,Switched:nt,Definitions:m(it,nt)},Ko=n({type:d("oauth"),methodID:_,refresh:e,access:e,expires:h,metadata:t(x(e,B))}).annotate({identifier:"Credential.OAuth"}),Go=n({type:d("key"),key:e,metadata:t(x(e,B))}).annotate({identifier:"Credential.Key"}),Yo=n({type:d("external"),methodID:_,metadata:t(x(e,B))}).annotate({identifier:"Credential.External"}),rt=w([Ko,Go,Yo]).pipe(Qe("type")).annotate({identifier:"Credential.Value"}),Ir=n({id:j,integrationID:ze,label:e,active:v,value:rt}).annotate({identifier:"Credential.Entry"}),br=n({id:t(j),integrationID:ze,label:t(e),value:rt,activate:t(v)}).annotate({identifier:"Credential.CreateInput"});var pt=n({status:D(["needs_auth"]),message:e,url:t(e)}).annotate({identifier:"Connection.Status"}),Jo=n({type:d("credential"),id:j,label:e,method:D(["key","oauth","external"]),status:t(pt)}).annotate({identifier:"Connection.CredentialInfo"}),Qo=n({type:d("env"),name:e,status:t(pt)}).annotate({identifier:"Connection.EnvInfo"}),ct=w([Jo,Qo]).pipe(Qe("type")).annotate({identifier:"Connection.Info"});var Xo=e.check(or("frm_")).pipe(re("Form.ID"),me({identifier:"Form.ID"})),ge=Xo.pipe(s((o)=>({create:(i)=>o.make(i??"frm_"+y())}))),Zo=x(e,B).annotate({identifier:"Form.Metadata"}),ft=n({value:e,label:e,description:e.pipe(t)}).annotate({identifier:"Form.Option"}),ei=n({key:e,op:D(["eq","neq"]),value:w([e,V,v])}).annotate({identifier:"Form.When"}),O={key:e,title:e.pipe(t),description:e.pipe(t),required:v.pipe(t),hidden:v.pipe(t).annotate({description:"Skip the interactive authentication prompt and use the default unless an answer is supplied"}),when:l(ei).pipe(t)},ti=n({...O,type:d("string"),format:D(["email","uri","date","date-time"]).pipe(t),minLength:h.pipe(t),maxLength:h.pipe(t),pattern:e.pipe(t),placeholder:e.pipe(t),default:e.pipe(t),options:l(ft).pipe(t),custom:v.pipe(t)}).annotate({identifier:"Form.StringField"}),oi=n({...O,type:d("number"),minimum:V.pipe(t),maximum:V.pipe(t),default:V.pipe(t)}).annotate({identifier:"Form.NumberField"}),ii=n({...O,type:d("integer"),minimum:V.pipe(t),maximum:V.pipe(t),default:V.pipe(t)}).annotate({identifier:"Form.IntegerField"}),ni=n({...O,type:d("boolean"),default:v.pipe(t)}).annotate({identifier:"Form.BooleanField"}),ri=n({...O,type:d("multiselect"),options:l(ft),minItems:h.pipe(t),maxItems:h.pipe(t),custom:v.pipe(t),default:l(e).pipe(t)}).annotate({identifier:"Form.MultiselectField"}),ai=n({key:e,type:d("external"),url:e,title:e.pipe(t),description:e.pipe(t)}).annotate({identifier:"Form.ExternalField"}),si=w([ti,oi,ii,ni,ri,ai]).pipe(Qe("type"),me({identifier:"Form.Field"})),K=Gr(si).annotate({identifier:"Form.Fields"}),pi={id:ge,sessionID:e,title:e,metadata:Zo.pipe(t)},ut=n({...pi,fields:K}).annotate({identifier:"Form.Info"}),ci=w([e,V,v,l(e)]).annotate({identifier:"Form.Value"}),Se=x(e,ci).annotate({identifier:"Form.Answer"}),li=w([n({status:d("pending")}),n({status:d("answered"),answer:Se}),n({status:d("cancelled"),message:e.pipe(t)})]).pipe(Qe("status")).annotate({identifier:"Form.State"}),Rr=n({...ut.fields,state:li}).annotate({identifier:"Form.Detail"}),Lr=n({answer:Se}).annotate({identifier:"Form.Reply"}),lt=c({type:"form.created",schema:{form:ut}}),dt=c({type:"form.replied",schema:{id:ge,sessionID:e,answer:Se}}),mt=c({type:"form.cancelled",schema:{id:ge,sessionID:e}}),Ar={Created:lt,Replied:dt,Cancelled:mt,Definitions:m(lt,dt,mt)};var he=ze,xe=_,mi=n({id:xe,type:d("oauth"),label:e,form:t(K)}).annotate({identifier:"Integration.OAuthMethod"}),ui=n({id:xe,type:d("command"),label:e,command:l(e)}).annotate({identifier:"Integration.CommandMethod"}),gi=n({type:d("key"),label:t(e),form:t(K)}).annotate({identifier:"Integration.KeyMethod"}),Si=n({id:xe,type:d("external"),label:e,form:t(K)}).annotate({identifier:"Integration.ExternalMethod"}),hi=n({type:d("env"),names:l(e)}).annotate({identifier:"Integration.EnvMethod"}),xi=w([mi,ui,gi,Si,hi]).pipe(Qe("type")).annotate({identifier:"Integration.Method"}),ht=c({type:"integration.updated",schema:{}}),qr={Updated:ht,Definitions:m(ht)},zr=n({id:he,name:e,metadata:t(x(e,ln))}).annotate({identifier:"Integration.Ref"}),jr=n({id:he,name:e,metadata:t(x(e,ln)),methods:l(xi),connections:l(ct)}).annotate({identifier:"Integration.Info"}),xt=e.pipe(re("Integration.AttemptID"),me({identifier:"Integration.AttemptID"}),s((o)=>({create:()=>o.make("con_"+y())}))),C=n({created:V,expires:V});class yi extends q("Integration.Attempt")({attemptID:xt,url:e,instructions:e,mode:D(["auto","code"]),paste:Ve(d(!0)),time:C}){}var $r=w([n({status:d("pending"),time:C}),n({status:d("complete"),time:C}),n({status:d("failed"),message:e,time:C}),n({status:d("expired"),time:C})]).pipe(Qe("status")).annotate({identifier:"Integration.AttemptStatus"}),Kr=n({attemptID:xt,time:C}).annotate({identifier:"Integration.CommandAttempt"}),Yr=w([n({status:d("pending"),message:t(e),time:C}),n({status:d("complete"),time:C}),n({status:d("failed"),message:e,time:C}),n({status:d("expired"),time:C})]).pipe(Qe("status")).annotate({identifier:"Integration.CommandAttemptStatus"});var It=w([D(["reasoning","reasoning_content","reasoning_text"]),e]).annotate({identifier:"Model.ReasoningField"}),bt=D(["max_completion_tokens","max_tokens"]).annotate({identifier:"Model.MaxTokensField"}),vt=D(["assets","state","root"]).annotate({identifier:"Model.MediaInput"}),Ii=D(["anthropic","alibaba"]).annotate({identifier:"Model.CacheFormat"}),N=n({reasoningField:It.pipe(t),requireReasoning:v.pipe(t),maxTokensField:bt.pipe(t),requireFinishReason:v.pipe(t),requireAssistantAfterTool:v.pipe(t),supportsPromptCacheKey:v.pipe(t),streamUsage:v.pipe(t),cacheFormat:Ii.pipe(t),supportsThinkingBlockBinding:v.pipe(t),supportsEffortUpdates:v.pipe(t),mediaInput:vt.pipe(t)}).annotate({identifier:"Model.Compatibility"}),G=n(qt(N.fields,["supportsThinkingBlockBinding","supportsEffortUpdates"])).annotate({identifier:"Provider.Compatibility"});var R=e.pipe(re("Provider.ID"),me({identifier:"Provider.ID"}),s((o)=>({opencode:o.make("opencode"),anthropic:o.make("anthropic"),openai:o.make("openai"),google:o.make("google"),googleVertex:o.make("google-vertex"),githubCopilot:o.make("github-copilot"),claudeAgent:o.make("claude-agent"),amazonBedrock:o.make("amazon-bedrock"),azure:o.make("azure"),openrouter:o.make("openrouter"),mistral:o.make("mistral"),gitlab:o.make("gitlab")}))),Ct=c({type:"provider.updated",schema:{}}),ra={Updated:Ct,Definitions:m(Ct)},Dt=e,vi=D(["auto","enabled","disabled"]),Ci=w([n({type:d("summary")}),n({type:d("native")})]).pipe(Qe("type")).annotate({identifier:"Provider.Compaction"}),Di=D(["http","websocket"]).annotate({identifier:"Provider.Transport"}),ki=ia([V,D(["ms","s","m","h","d"])]).check(Pe(/^\d+(ms|s|m|h|d)$/)).annotate({identifier:"Provider.CacheTTL"}),Mi=w([v,n({interval:w([d("auto"),e]).pipe(t).annotate({description:`Duration such as "4 minutes", or "auto" for 90% of the model's cache.ttl`}),duration:e.pipe(t).annotate({description:'Duration such as "30 minutes"'})})]).annotate({identifier:"Provider.CacheWarming"}),Pi=n({ttl:ki.pipe(t),warming:Mi.pipe(t)}).annotate({identifier:"Provider.Cache"}),wi=D(["zstd","gzip","none"]).annotate({identifier:"Provider.Encoding"}),Ie=w([gt,d(!1)]).pipe(t),Y=Rn(n({timeout:Ie,headerTimeout:Ie,chunkTimeout:Ie,compaction:Ci.pipe(t),cache:Pi.pipe(t),transport:Di.pipe(t),encoding:wi.pipe(t)}),[x(e,ln)]).annotate({identifier:"Provider.Settings"}),Ri={settings:Y.pipe(t),headers:x(e,e).pipe(t),body:x(e,ln).pipe(t)},sa=n({settings:Y.pipe(fi(r({}))),headers:x(e,e),body:x(e,ln)}).annotate({identifier:"Provider.Request"}),pa=n({id:R,canonical:R.pipe(t),integrationID:he.pipe(t),name:e,activation:vi,package:Dt,compatibility:G.pipe(t),...Ri}).annotate({identifier:"Provider.Info"}).pipe(s(()=>({empty:(o)=>({id:o,name:o,activation:"auto",package:""})})));var fa=gt.pipe(re("Money.USD"),me({identifier:"Money.USD"}),s((o)=>({zero:o.make(0)}))),L=gt.pipe(re("Money.USDPerMillionTokens"),me({identifier:"Money.USDPerMillionTokens"}),s((o)=>({zero:o.make(0)})));var T=e.pipe(re("Model.ID")),kt=c({type:"model.updated",schema:{}}),ba={Updated:kt,Definitions:m(kt)},F=e.pipe(re("Model.VariantID")),Li=n({id:T,providerID:R,variant:F.pipe(t)}).annotate({identifier:"Model.Ref"}).pipe(s((o)=>({parse:(i)=>{let p=i.indexOf("/");if(p<=0)throw Error(`Invalid model reference: ${i}`);let u=i.slice(0,p),k=i.indexOf("#",p+1),M=i.slice(p+1,k===-1?void 0:k),I=k===-1?void 0:i.slice(k+1);if(!M||u.includes("#")||I!==void 0&&(!I||I.includes("#")))throw Error(`Invalid model reference: ${i}`);return o.make({providerID:R.make(u),id:T.make(M),...I?{variant:F.make(I)}:{}})}})));var ve=e.pipe(re("Model.Family")),Ce=w([D(["chat","decision","image"]),e]).annotate({identifier:"Model.Type"}),H=Rn(n(Wr(Y.schema.fields,["compaction","cache","encoding"])),[x(e,ln)]).annotate({identifier:"Model.Settings"}),Ai=Rn(n(qt(H.schema.fields,["cache"])),H.records).annotate({identifier:"Model.VariantSettings"}),Mt={settings:H.pipe(t),headers:x(e,e).pipe(t),body:x(e,ln).pipe(t)},X=n({tools:v,input:l(e),output:l(e),temperature:v.pipe(t)}).annotate({identifier:"Model.Capabilities"}).pipe(s(()=>({default:()=>({tools:!0,input:["text","image"],output:["text"]})}))),Ui=n({tier:n({type:Ye("context"),size:Q}).pipe(t),input:L,output:L,cache:n({read:L,write:L})}).annotate({identifier:"Model.Cost"}),Ti=n({id:F,...Mt,settings:Ai.pipe(t)}).annotate({identifier:"Model.Variant"}),va=n({id:T,modelID:T,providerID:R,canonical:R.pipe(t),type:Ce.pipe(t),family:ve.pipe(t),name:e,compatibility:N.pipe(t),package:Dt.pipe(t),...Mt,capabilities:X,variants:l(Ti),time:n({released:gt}),cost:l(Ui),status:D(["alpha","beta","deprecated","active"]),enabled:v,limit:n({context:Q,input:Q.pipe(t),output:Q})}).annotate({identifier:"Model.Info"}).pipe(s(()=>({default:(o,i)=>({id:i,modelID:i,providerID:o,name:i,capabilities:X.default(),variants:[],time:{released:0},cost:[],status:"active",enabled:!0,limit:{context:200000,output:32000}})})));var Fi=R.check(Pe(/^[^/#]+$/u)),Ei=T.check(Pe(/^[^#]+$/u)),_i=F.check(Pe(/^[^#]+$/u)),Pt=n({providerID:Fi,model:Ei,variant:_i.pipe(t)}),Bi=e.check(Pe(/^[^/#]+\/[^#]+(?:#[^#]+)?$/u)),Z=w([Bi,Pt]).pipe(g(Pt,{decode:S((o)=>typeof o==="string"?Oi(o):o),encode:ye({strict:!1})})).annotate({identifier:"Config.ModelSelection"});function Oi(o){let i=Li.parse(o);return{providerID:i.providerID,model:i.id,...i.variant?{variant:i.variant}:{}}}var Wi=Rn(n(Y.schema.fields),[x(e,rr(Nn))]).annotate({identifier:"Config.Provider.Settings"}),Me=Rn(n(H.schema.fields),[x(e,rr(Nn))]).annotate({identifier:"Config.Model.Settings"}),Rt=x(e,Nn),we={settings:Wi.pipe(t),headers:x(e,e).pipe(t),body:Rt.pipe(t)},wt={settings:Me.pipe(t),headers:x(e,e).pipe(t),body:Rt.pipe(t)};class Lt extends q("Config.Provider.Request")({headers:we.headers,body:we.body}){}class At extends q("Config.Model.Cost.Cache")({read:L.pipe(t),write:L.pipe(t)}){}class Re extends q("Config.Model.Cost")({tier:n({type:d("context"),size:Q}).pipe(t),input:L,output:L,cache:At.pipe(t)}){}class Ut extends q("Config.Model.Limit")({context:Q.pipe(t),input:Q.pipe(t),output:Q.pipe(t)}){}var Ni=w([n({supported:d(!1)}),n({supported:d(!0),toggle:v.pipe(t),effort:e.pipe(l,t),budget:n({min:Q.pipe(t),max:Q.pipe(t)}).pipe(t)})]).annotate({identifier:"Config.Model.Reasoning"});class Tt extends q("Config.Model")({modelID:T.pipe(t),type:Ce.pipe(t),family:ve.pipe(t),name:e.pipe(t),releaseDate:e.check(Pe(/^\d{4}-\d{2}(-\d{2})?$/u)).annotate({description:"Release date as YYYY-MM-DD or YYYY-MM"}).pipe(t),compatibility:N.pipe(t),package:e.pipe(t),...wt,capabilities:X.mapFields((o)=>({tools:t(o.tools),input:t(o.input),output:t(o.output),temperature:o.temperature,reasoning:Ni.pipe(t)})).annotate({identifier:"Config.Model.Capabilities"}).pipe(t),variants:n({id:F,...wt,settings:Rn(n(qt(Me.schema.fields,["cache"])),Me.records).annotate({identifier:"Config.Model.VariantSettings"}).pipe(t)}).pipe(l,t),cost:w([Re,Re.pipe(l)]).pipe(t),disabled:v.pipe(t),limit:Ut.pipe(t)}){}class Le extends q("Config.Provider")({canonical:R.pipe(t),name:e.pipe(t),env:e.pipe(l,t),package:e.pipe(t),compatibility:G.pipe(t),...we,models:x(e,Tt).pipe(t)}){}var qi=e.check(Pe(/^#[0-9a-fA-F]{6}$/u));class Ft extends q("Config.Agent")({model:Z.pipe(t),request:Lt.pipe(t),system:e.pipe(t),description:e.pipe(t),mode:D(["subagent","primary","all"]).pipe(t),hidden:v.pipe(t),color:qi.pipe(ca(()=>Cn),t),steps:f.pipe(t),disabled:v.pipe(t),permissions:ot.pipe(t)}){}class _t extends q("Config.Media.Image")({auto_resize:v.pipe(t),max_width:f.pipe(t),max_height:f.pipe(t),max_base64_bytes:f.pipe(t)}){}class Bt extends q("Config.Media")({image:_t.pipe(t)}){}class Wt extends q("Config.Compaction.Keep")({tokens:h.pipe(t)}){}var zi=e.check(Pe(/^([1-9]\d?(\.\d+)?)%$/u)).annotate({identifier:"Config.Compaction.Percent"});class Nt extends q("Config.Compaction")({auto:v.pipe(t),keep:Wt.pipe(t),buffer:w([zi,h]).pipe(t).annotate({description:`Room kept free below the model's context window before automatic compaction, as a share of the window from "1%" to "99%", such as "20%" to compact at 80% full. A token count is also accepted.`})}){}class $t extends q("Config.Command")({template:e,description:e.pipe(t),agent:e.pipe(t),model:Z.pipe(t),subagent:v.pipe(t),subtask:v.annotate({description:"Deprecated alias for subagent."}).pipe(t)}){}var ji={todo:"Enable the experimental todowrite tool.",background_compaction:"Enable experimental background compaction: summarize the conversation in the background as it nears the compaction threshold, so automatic compaction does not wait for the summary. Background summaries that are never used still cost tokens.",media_blob:"Store new session media once in a deduplicated blob table instead of inline in every message row.",schedules:"Enable experimental scheduled tasks that wake a session with a prompt.",artifacts:"Enable experimental artifacts backed by pluggable providers."};var Jt=D(["allow","deny"]),Cs=D(["provider.use","tool.use","integration.connect","integration.use","mcp.use","skill.use","plugin.use","websearch.use"]),Yt=n({action:Cs,resource:e,effect:Jt}),Vi=new Map([["mcp","mcp.use"],["skill","skill.use"],["plugin","plugin.use"]]),Ae=Yt.pipe(g(_e(Yt),{decode:S((o)=>{if(o.action!=="integration.use")return o;let i=o.resource.indexOf(":"),p=i===-1?void 0:Vi.get(o.resource.slice(0,i));if(!p)return o;return{...o,action:p,resource:o.resource.slice(i+1)}}),encode:ye()}));class Qt extends q("ConfigExperimental.Info")({portable_shell_scanner:v.pipe(t).annotate({description:"Deprecated: the built-in shell permission scanner is now always enabled."}),all_flags:v.pipe(t).annotate({description:"Turn every feature flag on regardless of the build channel, like OPENCODE_FLAGS=all; explicit per-flag settings still win, and false is not a kill switch."}),...Wn(ji,(o)=>v.pipe(t).annotate({description:`${o} Defaults to on in local and dev builds and off in releases.`})),part_rows:v.pipe(t).annotate({description:"Write each assistant part as its own session_part row instead of rewriting the whole message on every event. Defaults to false."}),image_generate:w([v,n({model:Z.pipe(t).annotate({description:"Default model for the experimental_image_generate tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available."})})]).pipe(t).annotate({description:"Settings for the experimental_image_generate tool, which is offered while a connected provider has an image model."}),subagent_depth:h.pipe(t).annotate({description:"Maximum subagent nesting depth. Defaults to 1."}),location_idle_timeout:w([Ho,d(!1)]).pipe(t).annotate({description:'How long a location can go without session activity before its services are unloaded. Running sessions and background jobs keep a location loaded. Set to false to never unload (default: "60 minutes")'}),policies:Ae.pipe(l,t).annotate({description:"Deprecated: use top-level policies. Ordered policies controlling access to configured resources"})}){}class Zt extends q("Config.Formatter.Entry")({disabled:v.pipe(t),command:e.pipe(l,t),environment:x(e,e).pipe(t),extensions:e.pipe(l,t)}){}var $i=w([v,x(e,Zt)]);var Ki=n({disabled:d(!0)});class to extends q("Config.LSP.Server")({command:e.pipe(l),extensions:e.pipe(l,t),disabled:v.pipe(t),env:x(e,e).pipe(t),initialization:x(e,B).pipe(t)}){}var Gi=w([Ki,to]),Yi=w([v,x(e,Gi)]);class oe extends q("Mcp.TimeoutConfig")({startup:f.pipe(t).annotate({description:"Maximum time in milliseconds to establish and initialize the MCP server."}),catalog:f.pipe(t).annotate({description:"Maximum time in milliseconds to wait for MCP discovery requests such as tools/list and prompts/list."}),execution:f.pipe(t).annotate({description:"Maximum time in milliseconds to wait for MCP tool and prompt execution."})}){}var Ue=D(["legacy","auto","2026-07-28"]).annotate({identifier:"Mcp.Protocol",description:'MCP protocol negotiation. "legacy" (default) opens with the initialize handshake and speaks protocol revisions up to 2025-11-25. "auto" probes for the 2026-07-28 revision and falls back to legacy when the server does not support it. "2026-07-28" requires that revision and fails otherwise.'});class Te extends q("Mcp.LocalConfig")({type:d("local"),command:e.pipe(l),cwd:e.pipe(t).annotate({description:"Working directory for the MCP server process. Relative paths resolve from the workspace directory."}),environment:x(e,e).pipe(t),disabled:v.pipe(t),codemode:v.pipe(t).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:oe.pipe(t),protocol:Ue.pipe(t),pool:v.pipe(t).annotate({description:'Share one connection to this server across every directory that configures it identically, instead of one per directory. Only connections that negotiate the 2026-07-28 revision are shared; an unset "protocol" becomes "auto", and "legacy" never shares. Defaults to false.'})}){}class Fe extends q("Mcp.OAuthConfig")({client_id:e.pipe(t),client_secret:e.pipe(t),scope:e.pipe(t),callback_port:Q.check(Ht({minimum:1,maximum:65535})).pipe(t),redirect_uri:e.pipe(t),auth_server_metadata_url:e.pipe(t).annotate({description:"URL of the OAuth or OpenID Connect authorization server metadata document. Set when the MCP server does not publish protected resource metadata that names its authorization server."})}){}class Ee extends q("Mcp.RemoteConfig")({type:d("remote"),url:e,headers:x(e,e).pipe(t),oauth:w([Fe,d(!1)]).pipe(t),disabled:v.pipe(t),codemode:v.pipe(t).annotate({description:"Expose this server's tools through Code Mode. Defaults to true."}),timeout:oe.pipe(t),protocol:Ue.pipe(t),pool:v.pipe(t).annotate({description:'Share one connection to this server across every directory that configures it identically, instead of one per directory. Only connections that negotiate the 2026-07-28 revision are shared; an unset "protocol" becomes "auto", and "legacy" never shares. Defaults to false.'})}){}var Ji=w([Te,Ee]).pipe(Qe("type")),Hi=n({status:d("connected")}).annotate({identifier:"Mcp.Status.Connected"}),Qi=n({status:d("pending")}).annotate({identifier:"Mcp.Status.Pending"}),Xi=n({status:d("disabled")}).annotate({identifier:"Mcp.Status.Disabled"}),Zi=n({status:d("failed"),error:e}).annotate({identifier:"Mcp.Status.Failed"}),en=n({status:d("needs_auth"),error:e}).annotate({identifier:"Mcp.Status.NeedsAuth"}),tn=w([Hi,Qi,Xi,Zi,en]).pipe(Qe("status")),rs=n({name:e,status:tn,title:t(e),integrationID:t(ze)}).annotate({identifier:"Mcp.Server"}),on=n({server:e,name:e,uri:e,description:t(e),mimeType:t(e)}).annotate({identifier:"Mcp.Resource"}),nn=n({server:e,name:e,uriTemplate:e,description:t(e),mimeType:t(e)}).annotate({identifier:"Mcp.ResourceTemplate"}),as=n({resources:l(on),templates:l(nn)}).annotate({identifier:"Mcp.ResourceCatalog"}),rn=w([n({type:d("text"),uri:e,text:e,mimeType:t(e)}),n({type:d("blob"),uri:e,blob:e,mimeType:t(e)})]).pipe(Qe("type"),me({identifier:"Mcp.ResourceContentPart"})),ss=n({server:e,uri:e,contents:l(rn)}).annotate({identifier:"Mcp.ResourceContent"});var an=oe,ds=Te,ms=Fe,fs=Ee,sn=Ji,us=Ue;class Be extends q("Config.MCP")({timeout:an.pipe(t),servers:x(e,sn).pipe(t)}){}class no extends q("Config.Plugin.Entry")({package:e,options:x(e,B).pipe(t)}){}var pn=w([e,no]),cn=pn.pipe(l);class ao extends q("Config.Reference.Git")({repository:e,branch:e.pipe(t),description:e.pipe(t),hidden:v.pipe(t)}){}class so extends q("Config.Reference.Local")({path:e,description:e.pipe(t),hidden:v.pipe(t)}){}var dn=w([e,ao,so]),mn=x(e,dn);var ie=e.pipe(re("WebSearch.ID"),me({identifier:"WebSearch.ID"})),vs=n({id:ie,name:e}).annotate({identifier:"WebSearch.Provider"}),Ds=n({query:e,providerID:ie.pipe(t)}).annotate({identifier:"WebSearch.Input"}),fn=n({url:e,title:e.pipe(t),content:e.pipe(t),time:n({published:gt.pipe(t).annotate({description:"Publication time in milliseconds since the Unix epoch"})})}).annotate({identifier:"WebSearch.Result"});class un extends q("WebSearch.Response")({providerID:ie,results:l(fn)}){}var co=c({type:"websearch.updated",schema:{}}),ks={Updated:co,Definitions:m(co)};class mo extends q("ConfigWebSearch.Info")({provider:w([d("random").annotate({description:"Reuse a randomly selected provider until it is rate limited, then switch to another available provider."}),ie])}){}var gn=w([d(!1),mo]);class uo extends q("Config.ToolOutput")({max_lines:f.pipe(t),max_bytes:f.pipe(t)}){}class So extends q("Config.Watcher")({ignore:e.pipe(l,t)}){}class xo extends q("Config.Warming")({prompt:e.pipe(t).annotate({description:"Prompt sent for keep-alive requests"}),interval:w([d("auto"),Ho]).pipe(t).annotate({description:`Idle time between keep-alive requests (default: "4 minutes"). "auto" uses 90% of the model's cache.ttl and skips models without one.`}),duration:Ho.pipe(t).annotate({description:'Time after the last active request to keep a session warm (default: "30 minutes")'})}){}var Sn=w([v,xo]);var hn=n({directory:ua.pipe(aa(di())).annotate({description:"Parent directory for new worktrees, relative to the project's primary checkout when not absolute"})}).annotate({identifier:"Config.Worktree"});class E extends q("Config.Info")({$schema:t(e).annotate({description:"JSON schema reference for configuration validation"}),shell:e.pipe(t).annotate({description:"Default shell to use for terminal and shell tool execution"}),model:Z.pipe(t).annotate({description:"Default model to use when no session or agent model is selected"}),default_agent:e.pipe(t).annotate({description:"Default primary agent to use when no session agent is selected"}),update:D(["disable","notify","auto"]).pipe(t).annotate({description:"Disable updates, notify when one is available, or install updates automatically"}),share:D(["manual","auto","disabled"]).pipe(t).annotate({description:"Control whether sessions may be shared manually, automatically, or not at all"}),enterprise:n({url:e.pipe(t)}).pipe(t).annotate({description:"Enterprise sharing service configuration"}),username:e.pipe(t).annotate({description:"Username displayed in conversations and used for telemetry identity"}),timezone:e.pipe(t).annotate({description:"IANA time zone for schedules, e.g. America/Los_Angeles. Defaults to the server's local zone"}),permissions:ot.pipe(t).annotate({description:"Ordered tool permission rules applied to agent tool use"}),policies:Ae.pipe(l,t).annotate({description:"Ordered policies controlling access to providers, tools, and integrations"}),agents:x(e,Ft).pipe(t).annotate({description:"Named built-in agent overrides and custom agent definitions"}),snapshots:v.pipe(t).annotate({description:"Enable snapshots used for undo and revert behavior"}),watcher:So.pipe(t).annotate({description:"Filesystem watcher configuration"}),formatter:$i.pipe(t).annotate({description:"Enable built-in formatters or configure formatter overrides"}),lsp:Yi.pipe(t).annotate({description:"Enable built-in language servers or configure server overrides"}),media:Bt.pipe(t).annotate({description:"Media processing configuration"}),tool_output:uo.pipe(t).annotate({description:"Tool output truncation thresholds"}),mcp:Be.pipe(t).annotate({description:"MCP server configuration"}),compaction:Nt.pipe(t).annotate({description:"Conversation compaction behavior"}),skills:e.pipe(l,t).annotate({description:"Additional paths or URLs to discover skills from"}),commands:x(e,$t).pipe(t).annotate({description:"Named slash command definitions"}),instructions:e.pipe(l,t).annotate({description:"Additional paths or URLs supplying ambient instructions"}),references:mn.pipe(t).annotate({description:"Named local directories or Git repositories available as external context"}),websearch:gn.pipe(t).annotate({description:"Web search provider selection"}),plugins:cn.pipe(t).annotate({description:"Ordered plugin enablement directives and external package declarations"}),worktree:hn.pipe(t).annotate({description:"Directory defaults for local worktree creation"}),warming:Sn.pipe(t).annotate({description:"Keep recently active sessions warm with transient model requests (default: false)"}),providers:x(e,Le).pipe(t),experimental:Qt.pipe(t)}){}var ip=n({shell:Ze(e)}).annotate({identifier:"Config.Patch"});class ne extends q("Config.Document")({type:d("document"),path:P.pipe(t),info:E}){}class vo extends q("Config.Directory")({type:d("directory"),path:P}){}var np=w([ne,vo]).annotate({identifier:"Config.Entry"}),bo=c({type:"config.updated",schema:{}}),rp={Updated:bo,Definitions:m(bo)};var zt={};De(zt,{ConfigIntegration:()=>zt,Document:()=>qn,Policies:()=>Ne,Remote:()=>Do,WellKnownDocument:()=>ae,make:()=>Mo,suppliers:()=>ko});var Ne=l(B).pipe(g(B,{decode:S((o)=>o.filter((i)=>{let p=W(n({action:e}))(i);if(U(p)&&!Jr(Cs)(p.value.action))return!1;let u=W(n({effect:e}))(i);return A(u)||Jr(Jt)(u.value.effect)})),encode:ye({strict:!1})}),g(l(Ae))),Do=n({providers:E.fields.providers,mcp:E.fields.mcp,policies:Ne.pipe(b),websearch:E.fields.websearch});class qn extends ne.extend("Config.IntegrationDocument")({integrationID:ze,connection:ct,organization:b(e)}){}class ae extends ne.extend("Config.WellKnownDocument")({integrationID:ze}){}function ko(o){return new Map(o.filter((i)=>i instanceof ae).flatMap((i)=>Object.keys(i.info.providers??{}).map((p)=>[p,i.integrationID])))}function Mo(o){let i=o.info.mcp?.servers;return new qn({type:"document",integrationID:o.integrationID,connection:o.connection,organization:o.organization,info:new E({providers:o.info.providers&&Object.fromEntries(Object.entries(o.info.providers).map(([p,u])=>[p,new Le({...u,env:void 0,settings:We(u.settings),models:u.models&&Object.fromEntries(Object.entries(u.models).map(([k,M])=>[k,{...M,settings:We(M.settings),variants:M.variants?.map((I)=>({...I,settings:We(I.settings)}))}]))})])),mcp:i&&new Be({servers:Object.fromEntries(Object.entries(i).filter(([,p])=>p.type==="remote"))}),policies:o.info.policies,websearch:o.info.websearch})})}function We(o){return o&&Object.fromEntries(Object.entries(o).filter(([i])=>!["apiKey","authToken","accessToken"].includes(i)))}
|
|
2
|
+
export{De,ze,Cs,zt,qn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-
|
|
2
|
-
`).flatMap((i)=>{let r=i.trim(),c=o.find((a)=>r.startsWith(a)),p=c&&r.slice(c.length).trim();return p?[f.resolve(l,p)]:[]}))]}function
|
|
1
|
+
import"./chunk-m3m5harb.js";import{k,W,b,B,e,n,Z}from"./chunk-9dgq3xc0.js";var g={};k(g,{CodexHook:()=>g,Unreadable:()=>d,checks:()=>E,decode:()=>S,mentions:()=>y,patchFiles:()=>m});import f from"node:path";var w=n({hook_event_name:e,cwd:b(e),tool_name:b(e),tool_input:b(B),prompt:b(e)}),S=W(Z(w));class d extends Error{}function E(s,l){let o=(t,u,v={})=>({action:t,resources:u,directory:l.directory,...v});if(s.hook_event_name==="UserPromptSubmit"){let t=y(s.prompt??"");return[...t.skills.length===0?[]:[o("skill",t.skills)],...t.servers.length===0?[]:[o("mcp.use",t.servers)],...t.plugins.length===0?[]:[o("plugin.use",t.plugins)]]}if(s.hook_event_name!=="PreToolUse")return[];let i=s.tool_name;if(!i)throw new d("The hook input names no tool");let r=s.cwd?f.resolve(l.directory,s.cwd):l.directory;if(i.startsWith("mcp__"))return P(i,l.servers).map((t)=>o(t.action,t.resources,t));let c=s.tool_input,p=(t)=>{let u=typeof c==="object"&&c!==null&&t in c?Reflect.get(c,t):void 0;return typeof u==="string"&&u!==""?u:void 0},a=(t)=>{let u=p(t);if(u===void 0)throw new d(`${i}'s input has no ${t}`);return u},_=l.platform==="win32"?{shell:"pwsh"}:{};switch(i){case"Bash":{let t=a("command"),u=t.includes("*** Begin Patch")?m(t,r):[];return[o("shell",[t],{..._,...r===l.directory?{}:{path:r}}),...u.length===0?[]:[o("edit",u)]]}case"apply_patch":{let t=m(a("command"),r);if(t.length===0)throw new d("The patch names no file");return[o("edit",t)]}case"view_image":return[o("read",[f.resolve(r,a("path"))])];case"request_user_input":case"request_user_input_async":return[o("question",["*"])];case"read_mcp_resource":return[o("mcp.use",[a("server")])];case"list_mcp_resources":case"list_mcp_resource_templates":{let t=p("server");return[o("mcp.use",t?[t]:[...l.servers,"*"])]}case"request_plugin_install":{let t=a(p("tool_id")===void 0?"plugin_id":"tool_id");return[o(p("tool_type")==="connector"?"mcp.use":"plugin.use",[t])]}default:if(i==="spawn_agent"||i.endsWith(".spawn_agent")){let t=p("agent_type")?.trim().toLowerCase()||void 0;return[o("subagent",[t===void 0||t==="default"?"general":t])]}return[o(i.toLowerCase(),["*"])]}}function m(s,l){let o=["*** Add File: ","*** Update File: ","*** Delete File: ","*** Move to: "];return[...new Set(s.split(`
|
|
2
|
+
`).flatMap((i)=>{let r=i.trim(),c=o.find((a)=>r.startsWith(a)),p=c&&r.slice(c.length).trim();return p?[f.resolve(l,p)]:[]}))]}function P(s,l){let o=l.filter((a)=>s.startsWith(`mcp__${h(a)}__`)).toSorted((a,_)=>_.length-a.length)[0],i=s.match(/^mcp__(.+?)__(.+)$/),r=o??i?.[1]?.replace(/_[0-9a-f]{12}$/,"");if(!r)throw new d(`Can't tell which MCP server ${s} belongs to`);let c=o?s.slice(`mcp__${h(o)}__`.length):i?.[2],p=c===void 0||/_[0-9a-f]{12}$/.test(s);return[{action:"mcp.use",resources:[r],...o?{}:{folded:!0}},p?{action:`${r}_`,resources:["*"],truncated:!0,folded:!0}:{action:`${r}_${c}`,resources:["*"],folded:!0}]}function h(s){return s.replace(/[^A-Za-z0-9_]/g,"_")}var M=new Set(["PATH","HOME","USER","SHELL","PWD","TMPDIR","TEMP","TMP","LANG","TERM","XDG_CONFIG_HOME"]);function y(s){let l=Array.from(s.matchAll(/(?:\[\$([A-Za-z0-9_:-]+)\]\(([^)]*)\))|\$([A-Za-z0-9_:-]+)/g),(r)=>({name:r[1]??r[3],link:r[1]===void 0?void 0:r[2].trim()})).filter((r)=>!M.has(r.name.toUpperCase())),o=(r)=>l.flatMap((c)=>c.link?.startsWith(r)?[c.link.slice(r.length).split(/[/?]/)[0]].filter(Boolean):[]),i=l.flatMap((r)=>r.link===void 0?/^[A-Z0-9_]+$/.test(r.name)?[]:[r.name]:/(?:^skill:\/\/|SKILL\.md$)/i.test(r.link)?[r.name]:[]);return{skills:[...new Set(i)],servers:[...new Set(o("mcp://"))],plugins:[...new Set(o("plugin://"))]}}export{g as CodexHook,d as Unreadable,E as checks,S as decode,y as mentions,m as patchFiles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fi,Di}from"./chunk-m3m5harb.js";import{Y,ce,X,bo,ut,Ft,Je,Qt,Vs,Xt,qi,le,ci,Hr,Kr,Bo,pi,Ia,Ta}from"./chunk-9dgq3xc0.js";export{Fi as Brand,Je as Cause,qi as Clock,ce as Context,Ft as Data,Hr as DateTime,ut as Duration,le as Effect,Qt as Exit,ci as Fiber,Ta as FileSystem,Xt as Layer,Y as Option,Di as Path,bo as Record,X as Result,Ia as Schema,Kr as SchemaGetter,Bo as SchemaTransformation,Vs as Scope,pi as Struct};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{As,xr,yr,ki,Ci,br,Hn,Sr,Ai,Is,Ts,lo,Os,_t,uo,_s,Ps,Rs,Ms,Ns,Fs,Ds}from"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-m3m5harb.js";export{Ds as ConsoleClient,Sr as DeviceSignInFailed,yr as OAuth,Hn as SignedOut,br as SsoRequired,Is as authorize,xr as clientID,uo as codexModelsPath,As as defaultServer,_s as fetchCodexModels,Os as fetchConfig,Ps as fetchInstructions,_t as fetchModels,Ms as fetchSkill,Ns as fetchSkillBlob,Rs as fetchSkills,Ai as headers,Fs as normalizeServer,Ts as refresh,lo as revoke,ki as signedOutMessage,Ci as ssoMessage};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{K}from"./chunk-6xs4y82y.js";import{wt}from"./chunk-gcqbk8bn.js";function ms(o){if(o.length===0)return;return o.map((n)=>`## ${n.name}
|
|
2
|
+
|
|
3
|
+
${n.content.trim()}`).join(`
|
|
4
|
+
|
|
5
|
+
`)}var t="<!-- opencode-console:start -->",c="<!-- opencode-console:end -->";function lr(o,n,r,s){if(r.length===0&&!n?.includes(t))return s;let i=(n??"").replace(new RegExp(`\\n*${t}[\\s\\S]*?${c}\\n?`),`
|
|
6
|
+
`).trim(),p=(e)=>e.replaceAll(t,"<!-- opencode-console start -->").replaceAll(c,"<!-- opencode-console end -->"),a=r.length===0?"":[t,"# Workspace instructions from OpenCode Console",...r.map((e)=>`## ${p(e.name)}
|
|
7
|
+
|
|
8
|
+
${p(e.content.trim())}`),c].join(`
|
|
9
|
+
|
|
10
|
+
`),l=[i,a].filter((e)=>e!=="").join(`
|
|
11
|
+
|
|
12
|
+
`),d=s||n===void 0&&a!=="";if(l===""&&d)return K(o),!1;if(`${l}
|
|
13
|
+
`!==n)wt(o,`${l}
|
|
14
|
+
`);return d}
|
|
15
|
+
export{ms,lr};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Er,xn,Kt,Ls,Ce,J,js,Se,K,xo,Rt,Bs}from"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{Bs as ConsoleStore,xn as credentialFile,Rt as ensureDir,Ce as locked,Er as make,js as modified,J as read,K as remove,Kt as snapshotFile,Ls as syncClaimFile,xo as unreachable,Se as write};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"./chunk-m3m5harb.js";import"./chunk-qp7a49b3.js";import{_t}from"./chunk-jpqmm6pm.js";import{Ce,J,Se,K}from"./chunk-6xs4y82y.js";import{be,He}from"./chunk-x65p26st.js";import{ur,St,vt,pr,jn,io,hs,bi,Xe,fn,_,Et,fr,dn,mn,Tt,dr,mr}from"./chunk-gcqbk8bn.js";import"./chunk-11wqcgnn.js";import{lt,Ot,et}from"./chunk-yb3fn5r1.js";import{qe}from"./chunk-bcmj4f7y.js";import{lr}from"./chunk-5a8bvcgq.js";import{ue}from"./chunk-9zpe1ry1.js";import{k,j,I,R,W,b,e,v,n,x,l,Ze,Z}from"./chunk-9dgq3xc0.js";var U={};k(U,{ClaudeCode:()=>U,hookArgs:()=>O,manifest:()=>E,manifestFile:()=>C,models:()=>L,paths:()=>X,refresh:()=>ee,remove:()=>ne});import{createHash as V}from"node:crypto";import{existsSync as S,rmSync as q}from"node:fs";import Q from"node:os";import f from"node:path";function X(t=process.env,o=Q.homedir()){let s=t.CLAUDE_CONFIG_DIR?.trim(),i=s?f.resolve(s):f.join(o,".claude");return{config:i,settings:f.join(i,"settings.json"),global:s?f.join(i,".claude.json"):f.join(o,".claude.json"),skills:f.join(i,"skills"),memory:f.join(i,"CLAUDE.md")}}function L(t){let o=Tt(t),s=mr(o);if(o.length===0||s===void 0)return;let i=(r)=>r.provider==="opencode"?r.id:`${r.provider}/${r.id}`,c=(...r)=>i(dr(o,...r));return{baseURL:`${s}/anthropic`,options:o.map((r)=>({model:i(r),label:Et(r.entry.name)??r.id,...r.provider==="opencode"||r.providerName===void 0?{}:{description:r.providerName}})),tiers:{opus:c("opus","sonnet","haiku"),sonnet:c("sonnet","opus","haiku"),haiku:c("haiku","sonnet","opus")}}}var Y=n({baseURL:e,options:l(n({model:e,label:e,description:b(e)})),tiers:n({opus:e,sonnet:e,haiku:e})}),T=n({paths:n({config:e,settings:e,global:e,skills:e,memory:e}),command:l(e),harness:b(e),...ur,servers:l(e),skills:x(e,e),memoryCreated:v,created:b(n({settings:v,global:v})),providers:b(e),models:b(Ze(Y))}),C=(t)=>f.join(t.data,"claude-code.json");function E(t){let o=C(t),s=J(o);if(s===void 0)return;let i=j(W(Z(T))(s));if(!i)throw Error(`${o} can't be read, so Claude Code was left as it is. Delete it and run setup again.`);return i}var ee=R("ClaudeCode.refresh")(function*(t,o){let s=E(t),i=o??s;if(!i)return;let c=yield*He(t),r=c&&qe(t,be(c));if(!c||!r?.config)return;let a=r.config,p=Ot(r),h=V("sha256").update(JSON.stringify(a.providers??null)).digest("hex"),m=!o&&s?.providers===h&&s.models!==void 0?s.models??void 0:L(yield*_t(c)),A=yield*dn(c,i.paths.skills,p,s?.skills??{});return yield*Ce(t,I(()=>oe(t,{paths:i.paths,command:i.command,harness:o?o.harness:s?.harness,models:m,servers:Object.fromEntries(Object.entries(et(r)).map(([w,u])=>[w,{url:u.url,gateway:u.headers!==void 0}])),instructions:lt(r),skills:p,bundles:A,providers:h,explicit:o!==void 0})))});function ne(t){let o=E(t);if(!o)return!1;let s=St(o.paths.settings),i=St(o.paths.global),c=J(o.paths.memory),r=o.created??{settings:!S(Xe(o.paths.settings)),global:!S(Xe(o.paths.global))};if(s)if(Object.keys(o.originals).forEach((a)=>jn(s,a,o)),B(s,void 0),G(s),Object.keys(s).length===0&&r.settings)K(o.paths.settings);else vt(o.paths.settings,s);if(i){let a=_(i.mcpServers);if(o.servers.forEach((p)=>delete a[p]),Object.keys(a).length===0)delete i.mcpServers;else i.mcpServers=a;if(Object.keys(i).length===0&&r.global)K(o.paths.global);else vt(o.paths.global,i,384)}return Object.keys(o.skills).forEach((a)=>q(f.join(o.paths.skills,a),{recursive:!0,force:!0})),lr(o.paths.memory,c,[],o.memoryCreated),[o.paths.settings,o.paths.global].forEach((a)=>K(Xe(a))),K(C(t)),!0}var O=["hook","claude-code"],F="x-opencode-plugin";function oe(t,o){let s=E(t),i=s===void 0,c=S(o.paths.settings),r=S(o.paths.global),a=St(o.paths.settings)??{},p=St(o.paths.global)??{},h=J(o.paths.memory),D=s?.created??{settings:!c,global:!r},m=[];if(i)[o.paths.settings,o.paths.global].forEach(fn);let{originals:A,written:w}=pr(a,te(o),s,o.explicit);B(a,o.models?`${F}: opencode-console/${ue}`:void 0),G(a);let u=_(a.hooks);se(o.command).forEach(([d,y])=>{u[d]=[...Array.isArray(u[d])?u[d]:[],y]}),a.hooks=u;let N=new Set(s?.servers??[]),g=_(p.mcpServers);N.forEach((d)=>{if(!(d in o.servers))delete g[d]});let M=Object.entries(o.servers).flatMap(([d,y])=>{if(y.url===void 0||!/^[a-z0-9_-]+$/i.test(d))return[];if(d in g&&!N.has(d))return m.push(d),[];return g[d]={type:"http",url:y.url,...y.gateway?{headersHelper:fr([...o.command,"mcp-headers",d])}:{}},[d]});if(Object.keys(g).length>0)p.mcpServers=g;else delete p.mcpServers;if(vt(o.paths.settings,a,384),r||M.length>0)vt(o.paths.global,p,384);let H=mn(o.paths.skills,o.skills,o.bundles,s?.skills??{});m.push(...H.skipped);let P=H.skills,z=lr(o.paths.memory,h,o.instructions,s?.memoryCreated??!1);return Se(C(t),JSON.stringify(T.make({paths:o.paths,command:[...o.command],...o.harness===void 0?{}:{harness:o.harness},originals:A,written:w,servers:M,skills:P,memoryCreated:z,created:D,providers:o.providers,models:o.models??null}))),{models:o.models,servers:M,skills:Object.keys(P),instructions:o.instructions.length,skipped:m}}function te(t){let o=t.harness===void 0?{}:{"env.OPENCODE_CONSOLE_HARNESS":t.harness};if(!t.models)return o;return{...o,apiKeyHelper:fr([...t.command,"token"]),"env.ANTHROPIC_BASE_URL":t.models.baseURL,"env.ANTHROPIC_DEFAULT_OPUS_MODEL":t.models.tiers.opus,"env.ANTHROPIC_DEFAULT_SONNET_MODEL":t.models.tiers.sonnet,"env.ANTHROPIC_DEFAULT_HAIKU_MODEL":t.models.tiers.haiku,modelPicker:{options:t.models.options,replaceBuiltInOptions:!0}}}function B(t,o){let s=io(t,"env.ANTHROPIC_CUSTOM_HEADERS"),c=[...(typeof s==="string"?s:"").split(`
|
|
2
|
+
`).filter((r)=>r.trim()!==""&&!r.toLowerCase().startsWith(`${F}:`)),...o===void 0?[]:[o]];if(c.length>0)hs(t,"env.ANTHROPIC_CUSTOM_HEADERS",c.join(`
|
|
3
|
+
`));else if(s!==void 0)bi(t,"env.ANTHROPIC_CUSTOM_HEADERS")}function se(t){let o={type:"command",command:t[0],args:[...t.slice(1),...O]},s={...o,timeout:30,onFailure:"block"};return[["PreToolUse",{matcher:"*",hooks:[s]}],["UserPromptSubmit",{hooks:[s]}],["UserPromptExpansion",{hooks:[s]}],["SessionStart",{hooks:[{...o,timeout:10}]}]]}function G(t){let o=_(t.hooks);if(Object.entries(o).forEach(([s,i])=>{if(!Array.isArray(i))return;let c=i.flatMap((r)=>{let a=_(r).hooks;if(!Array.isArray(a))return[r];let p=a.filter((h)=>!re(h));if(p.length===a.length)return[r];return p.length===0?[]:[{..._(r),hooks:p}]});if(c.length===0)delete o[s];else o[s]=c}),Object.keys(o).length===0)delete t.hooks;else t.hooks=o}function re(t){let o=_(t).args;return Array.isArray(o)&&o.slice(-O.length).join(" ")===O.join(" ")}export{U as ClaudeCode,O as hookArgs,E as manifest,C as manifestFile,L as models,X as paths,ee as refresh,ne as remove};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{k,Ui,$i,xe,en,ni}from"./chunk-9dgq3xc0.js";var Bs={};k(Bs,{ConsoleStore:()=>Bs,credentialFile:()=>xn,ensureDir:()=>Rt,locked:()=>Ce,make:()=>Er,modified:()=>js,read:()=>J,remove:()=>K,snapshotFile:()=>Kt,syncClaimFile:()=>Ls,unreachable:()=>xo,write:()=>Se});import{randomUUID as oe}from"node:crypto";import{chmodSync as ne,mkdirSync as ae,readFileSync as ie,renameSync as se,rmSync as q,statSync as ce,writeFileSync as fe}from"node:fs";import E from"node:path";import _ from"path";import W from"os";import{randomBytes as Y,randomUUID as V}from"crypto";import{mkdir as S,readFile as B,rm as M,stat as z,utimes as Q,writeFile as A}from"fs/promises";import{createHash as C}from"crypto";var x;(function(e){function i(w){return C("sha1").update(w).digest("hex")}e.fast=i;function s(w){return C("sha256").update(w).digest("hex")}e.sha256=s})(x||(x={}));var zn;(function(e){let i;function s(r){i=r}e.setGlobal=s;let w=()=>{if(!i)throw Error("Flock global not set");return _.join(i.state,"locks")},b={staleMs:60000,timeoutMs:300000,baseDelayMs:100,maxDelayMs:2000};function g(r){if(typeof r!=="object"||r===null||!("code"in r))return;let t=r.code;if(typeof t!=="string")return;return t}function H(r,t){return new Promise((n,c)=>{if(t?.aborted){c(t.reason??Error("Aborted"));return}let a,f=()=>{t?.removeEventListener("abort",o),n()},o=()=>{if(a)clearTimeout(a);t?.removeEventListener("abort",o),c(t?.reason??Error("Aborted"))};t?.addEventListener("abort",o,{once:!0}),a=setTimeout(f,r)})}function F(r){let t=Math.floor(r*0.3),n=Math.floor(Math.random()*(2*t+1))-t;return Math.max(0,r+n)}function N(){return performance.now()}function j(){return performance.timeOrigin+N()}async function v(r){try{return await z(r)}catch(t){let n=g(t);if(n==="ENOENT"||n==="ENOTDIR")return;throw t}}async function I(r,t,n,c){let a=j(),f=await v(t);if(f)return a-f.mtimeMs>c;let o=await v(n);if(o)return a-o.mtimeMs>c;let l=await v(r);if(!l)return!1;return a-l.mtimeMs>c}async function G(r,t){let n=V?.()??Y(16).toString("hex"),c=_.join(r,"meta.json"),a=_.join(r,"heartbeat");try{await S(r,{mode:448})}catch(O){if(g(O)!=="EEXIST")throw O;if(!await I(r,a,c,t.staleMs))return{acquired:!1};let d=r+".breaker";try{await S(d,{mode:448})}catch(u){let p=g(u);if(p==="EEXIST"){let D=await v(d);if(D&&j()-D.mtimeMs>t.staleMs)await M(d,{recursive:!0,force:!0}).catch(()=>{return});return{acquired:!1}}if(p==="ENOENT"||p==="ENOTDIR")return{acquired:!1};throw u}try{if(!await I(r,a,c,t.staleMs))return{acquired:!1};await M(r,{recursive:!0,force:!0});try{await S(r,{mode:448})}catch(u){let p=g(u);if(p==="EEXIST"||p==="ENOTEMPTY")return{acquired:!1};throw u}}finally{await M(d,{recursive:!0,force:!0}).catch(()=>{return})}}let f={token:n,pid:process.pid,hostname:W.hostname(),createdAt:new Date().toISOString()};await A(a,"",{flag:"wx"}).catch(async()=>{throw await M(r,{recursive:!0,force:!0}),Error("Lock acquired but heartbeat already existed (possible compromise).")}),await A(c,JSON.stringify(f,null,2),{flag:"wx"}).catch(async()=>{throw await M(r,{recursive:!0,force:!0}),Error("Lock acquired but meta.json already existed (possible compromise).")});let o;return{acquired:!0,startHeartbeat:(O=Math.max(100,Math.floor(t.staleMs/3)))=>{if(o)return;o=setInterval(()=>{let d=new Date;Q(a,d,d).catch(()=>{return})},O),o.unref?.()},release:async()=>{if(o)clearInterval(o),o=void 0;if((await B(c,"utf8").then((d)=>{let u=JSON.parse(d);if(!u||typeof u!=="object")return{};return{token:"token"in u&&typeof u.token==="string"?u.token:void 0}}).catch((d)=>{let u=g(d);if(u==="ENOENT"||u==="ENOTDIR")throw Error("Refusing to release: lock is compromised (metadata missing).");if(d instanceof SyntaxError)throw Error("Refusing to release: lock is compromised (metadata invalid).");throw d})).token!==n)throw Error("Refusing to release: lock token mismatch (not the owner).");await M(r,{recursive:!0,force:!0})}}}async function X(r,t,n){let c=N()+n.timeoutMs,a=0,f=0,o=n.baseDelayMs;while(!0){t.signal?.throwIfAborted();let l=await G(r,n);if(l.acquired)return l;if(N()>c)throw Error(`Timed out waiting for lock: ${t.key}`);a+=1;let y=F(o);await t.onWait?.({key:t.key,attempt:a,delay:y,waited:f}),await H(y,t.signal),f+=y,o=Math.min(n.maxDelayMs,Math.floor(o*1.7))}}async function T(r,t={}){t.signal?.throwIfAborted();let n={staleMs:t.staleMs??b.staleMs,timeoutMs:t.timeoutMs??b.timeoutMs,baseDelayMs:t.baseDelayMs??b.baseDelayMs,maxDelayMs:t.maxDelayMs??b.maxDelayMs},c=t.dir??w();await S(c,{recursive:!0});let a=_.join(c,x.fast(r)+".lock"),f=await X(a,{key:r,onWait:t.onWait,signal:t.signal},n);f.startHeartbeat();let o=()=>f.release();return{release:o,[Symbol.asyncDispose](){return o()}}}e.acquire=T;async function U(r,t,n={}){let a=[];try{const c=Ui(a,await T(r,n),1);n.signal?.throwIfAborted();return await t()}catch(f){var o=f,l=1}finally{var y=$i(a,o,l);y&&await y}}e.withLock=U})(zn||(zn={}));import P from"os";import m from"path";var h=P.homedir(),Z=process.env.XDG_DATA_HOME||(h?m.join(h,".local","share"):void 0),ee=process.env.XDG_CACHE_HOME||(h?m.join(h,".cache"):void 0),te=process.env.XDG_CONFIG_HOME||(h?m.join(h,".config"):void 0),re=process.env.XDG_STATE_HOME||(h?m.join(h,".local","state"):void 0);function go(e){return{data:m.join(Z,e),cache:m.join(ee,e),config:m.join(te,e),state:m.join(re,e),tmp:m.join(P.tmpdir(),e)}}function Er(e={}){let i=e.env??{OPENCODE_API_KEY:process.env.OPENCODE_API_KEY,OPENCODE_CONSOLE_SERVER:process.env.OPENCODE_CONSOLE_SERVER};if(e.root)return{data:E.join(e.root,"data"),cache:E.join(e.root,"cache"),env:i};let s=go("opencode-console");return{data:s.data,cache:s.cache,env:i}}var xn=(e)=>E.join(e.data,"credential.json"),Kt=(e)=>E.join(e.cache,"config.json"),Ls=(e)=>E.join(e.cache,"sync.claim"),ue=30000,R=35000;function Ce(e,i){return ni(xe({try:()=>(Rt(e.data),Rt(E.join(e.data,"locks")),zn.acquire("credential",{dir:E.join(e.data,"locks"),staleMs:ue,timeoutMs:R})),catch:(s)=>s instanceof Error&&s.message.startsWith("Timed out waiting for lock")?Error(`Timed out after ${R/1000}s waiting for another opencode-console process to update the sign-in`,{cause:s}):s}),()=>i,(s)=>xe(()=>s.release()).pipe(en))}function J(e){try{return ie(e,"utf8")}catch(i){if(L(i)==="ENOENT")return;throw i}}function js(e){try{return ce(e,{throwIfNoEntry:!1})?.mtimeMs}catch(i){if(xo(i))return;throw i}}function Se(e,i){Rt(E.dirname(e));let s=`${e}.${oe()}.tmp`;fe(s,i,{mode:384,flag:"wx"});try{se(s,e)}catch(w){throw q(s,{force:!0}),w}}function K(e){q(e,{force:!0})}function xo(e){return["ENOENT","ENOTDIR","EACCES","EPERM"].includes(L(e)??"")}function Rt(e){if(ae(e,{recursive:!0,mode:448}),process.platform!=="win32")ne(e,448)}function L(e){return e instanceof Error&&"code"in e&&typeof e.code==="string"?e.code:void 0}
|
|
2
|
+
export{zn,go,Er,xn,Kt,Ls,Ce,J,js,Se,K,xo,Rt,Bs};
|