@opencode/console 0.1.3 → 0.1.4
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 +14 -0
- package/{chunk-11wqcgnn.js → chunk-172desm7.js} +2 -2
- package/{chunk-5a8bvcgq.js → chunk-17ek638g.js} +4 -4
- package/{chunk-1z17cm3w.js → chunk-1900gmc1.js} +2 -2
- package/chunk-1ekysq54.js +1 -0
- package/chunk-38wxxryg.js +1 -0
- package/chunk-4hra11sy.js +2 -0
- package/{chunk-z5mqjw9r.js → chunk-6dmhresx.js} +2 -2
- package/{chunk-m3m5harb.js → chunk-81pw2xsw.js} +2 -2
- package/chunk-87hkw75t.js +11 -0
- package/chunk-8stwzw95.js +2 -0
- package/{chunk-b4fde357.js → chunk-93je9v9b.js} +2 -2
- package/chunk-bfd21777.js +2 -0
- package/chunk-c8zgzn9g.js +2 -0
- package/chunk-c94982xf.js +1 -0
- package/{chunk-gcqbk8bn.js → chunk-e219b1sg.js} +67 -67
- package/chunk-eja0bnj7.js +1 -0
- package/chunk-fsg05nff.js +2 -0
- package/chunk-gj3j0mk6.js +1 -0
- package/chunk-hkjjea67.js +3 -0
- package/chunk-httrtddj.js +1 -0
- package/chunk-j6qa0p88.js +1 -0
- package/chunk-ka5nrr3r.js +1 -0
- package/chunk-m711drrn.js +1 -0
- package/chunk-n6fr9p3j.js +254 -0
- package/chunk-qsqer89q.js +1 -0
- package/{chunk-7qa618ad.js → chunk-tzhpc3tb.js} +49 -49
- package/chunk-v67dra35.js +1 -0
- package/chunk-vf7nj8yg.js +32 -0
- package/chunk-vrvsj5aj.js +1 -0
- package/chunk-w7jwta9c.js +1 -0
- package/chunk-wvtbwbxs.js +2 -0
- package/{chunk-6xs4y82y.js → chunk-xsr5jd61.js} +2 -2
- package/chunk-yqbzfq0h.js +1 -0
- package/dsh-plugin.js +1 -1
- package/index.js +60 -51
- package/package.json +1 -1
- package/pi-extension.js +2 -2
- package/chunk-0752rr1w.js +0 -1
- package/chunk-38zs2jre.js +0 -1
- package/chunk-3p7x3f0s.js +0 -1
- package/chunk-6fqhbptf.js +0 -1
- package/chunk-6hmr86q5.js +0 -3
- package/chunk-82p6vmpy.js +0 -1
- package/chunk-9dgq3xc0.js +0 -32
- package/chunk-9zpe1ry1.js +0 -2
- package/chunk-b6azftzw.js +0 -254
- package/chunk-bcmj4f7y.js +0 -2
- package/chunk-cd4h496v.js +0 -2
- package/chunk-g9f1r3v3.js +0 -1
- package/chunk-ghvsrvdw.js +0 -1
- package/chunk-jpqmm6pm.js +0 -2
- package/chunk-jxh84gfh.js +0 -1
- package/chunk-kd1hjfpe.js +0 -1
- package/chunk-mnjk01tj.js +0 -1
- package/chunk-nqk8n93s.js +0 -1
- package/chunk-qp7a49b3.js +0 -1
- package/chunk-r1adn0ka.js +0 -11
- package/chunk-tamzaefd.js +0 -1
- package/chunk-x65p26st.js +0 -2
- package/chunk-yb3fn5r1.js +0 -2
package/chunk-9zpe1ry1.js
DELETED
package/chunk-b6azftzw.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import"./chunk-m3m5harb.js";import"./chunk-qp7a49b3.js";import{_t,uo,_s}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,Xe,fn,wt,_,fr,dn,mn,Tt,mr}from"./chunk-gcqbk8bn.js";import"./chunk-11wqcgnn.js";import{cr,fs,so}from"./chunk-7qa618ad.js";import{gr,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,pt,Ae,I,h,R,W,b,e,V,v,n,x,l,Ze,Z}from"./chunk-9dgq3xc0.js";var me={};k(me,{Codex:()=>me,PROVIDER:()=>Q,hookArgs:()=>ce,manifest:()=>ne,manifestFile:()=>ee,models:()=>Re,paths:()=>kn,refresh:()=>wn,remove:()=>An,rules:()=>Le,trustHash:()=>Je});import{createHash as xe}from"node:crypto";import{existsSync as pe,realpathSync as hn,rmSync as gn}from"node:fs";import yn from"node:os";import S from"node:path";/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/function Ve(r,t){let o=r.slice(0,t).split(/\r?\n/);return[o.length,o.pop().length+1]}function Ke(r,t,o){let s=r.split(/\r?\n/),f="",a=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let u=s[i-1];if(!u)continue;if(f+=i.toString().padEnd(a," "),f+=": ",f+=u,f+=`
|
|
28
|
-
`,i===t)f+=" ".repeat(a+o+2),f+=`^
|
|
29
|
-
`}return f}class m extends Error{line;column;codeblock;constructor(r,t){let[o,s]=Ve(t.toml,t.ptr),f=Ke(t.toml,o,s);super(`Invalid TOML document: ${r}
|
|
30
|
-
|
|
31
|
-
${f}`,t);this.line=o,this.column=s,this.codeblock=f}static x(r,t,o){throw new m(r,{toml:t.s,ptr:o??t.p})}}/*!
|
|
32
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*
|
|
35
|
-
* Redistribution and use in source and binary forms, with or without
|
|
36
|
-
* modification, are permitted provided that the following conditions are met:
|
|
37
|
-
*
|
|
38
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
39
|
-
* list of conditions and the following disclaimer.
|
|
40
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
41
|
-
* this list of conditions and the following disclaimer in the
|
|
42
|
-
* documentation and/or other materials provided with the distribution.
|
|
43
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
44
|
-
* may be used to endorse or promote products derived from this software without
|
|
45
|
-
* specific prior written permission.
|
|
46
|
-
*
|
|
47
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
48
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
49
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
50
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
51
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
52
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
53
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
54
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
55
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
56
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
57
|
-
*/function B(r){let t=r.p,o=r.s.charCodeAt(r.p++),s=o,f=o===39,a=o===r.s.charCodeAt(r.p)&&o===r.s.charCodeAt(r.p+1);if(a){if((o=r.s.charCodeAt(r.p+=2))===10)r.p++;else if(o===13&&r.s.charCodeAt(r.p+1)===10)r.p+=2}let i="",u=r.p,c=0;for(;r.p<r.s.length;r.p++)if(o=r.s.charCodeAt(r.p),a&&(o===10||o===13&&r.s.charCodeAt(r.p+1)===10))c=c&&3;else if(o<32&&o!==9||o===127)m.x("control characters are not allowed in strings",r);else if((!c||c===3)&&o===s&&(!a||r.s.charCodeAt(r.p+1)===s&&r.s.charCodeAt(r.p+2)===s)){if(a){if(r.s.charCodeAt(r.p+3)===s)r.p++;if(r.s.charCodeAt(r.p+3)===s)r.p++}if(!c){let p=r.s.slice(u,r.p);i=i?i+p:p}return r.p+=a?3:1,i}else if(!c){if(!f&&o===92)i+=r.s.slice(u,u=r.p),c=1}else if(c===1)if(o===120||o===117||o===85){let p=r.p++-1,g=0,y=o===120?2:o===117?4:8;for(let O=0;O<y;O++,r.p++){let w=r.s.charCodeAt(r.p),A=w>=48&&w<=57?w-48:w>=65&&w<=70?w-65+10:w>=97&&w<=102?w-97+10:-1;if(A<0)m.x("invalid non-hex character in unicode escape",r);g=g<<4|A}if(g<0||g>1114111||g>=55296&&g<=57343)m.x("invalid unicode escape",r,p);i+=String.fromCodePoint(g),u=r.p--,c=0}else if(a&&(o===32||o===9))c=2;else{if(o===98)i+="\b";else if(o===116)i+="\t";else if(o===110)i+=`
|
|
58
|
-
`;else if(o===102)i+="\f";else if(o===114)i+="\r";else if(o===101)i+="\x1B";else if(o===34)i+='"';else if(o===92)i+="\\";else m.x("unrecognised escape sequence",r);u=r.p+1,c=0}else if(o!==32&&o!==9){if(c===2)m.x("invalid escape: only line-ending whitespace may be escaped",r,u);c=!f&&o===92?1:0,u=r.p}m.x("unfinished string",r,t)}/*!
|
|
59
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
60
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
61
|
-
*
|
|
62
|
-
* Redistribution and use in source and binary forms, with or without
|
|
63
|
-
* modification, are permitted provided that the following conditions are met:
|
|
64
|
-
*
|
|
65
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
66
|
-
* list of conditions and the following disclaimer.
|
|
67
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
68
|
-
* this list of conditions and the following disclaimer in the
|
|
69
|
-
* documentation and/or other materials provided with the distribution.
|
|
70
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
71
|
-
* may be used to endorse or promote products derived from this software without
|
|
72
|
-
* specific prior written permission.
|
|
73
|
-
*
|
|
74
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
75
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
76
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
77
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
78
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
79
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
80
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
81
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
82
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
83
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
84
|
-
*/var Ge=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;class E extends Date{#n=!1;#r=!1;#e=null;constructor(r,t,o){let s=!0,f=!0,a="Z",i;if(typeof r==="string")if(t)e:{if(t<3){if(+r.slice(11,13)>23){r="";break e}if(t===2)a=null,r+="Z";else if((i=r.charCodeAt(r.length-1))!==90&&i!==122)a=r.slice(r.length-6);if(o)r=r.slice(0,10)+"T"+r.slice(11)}else if(t===4)r=+r.slice(0,2)>23?"":`0000-01-01T${r}Z`;s=t!==4,f=t!==3}else{let u=r.match(Ge);if(u){if(!u[1])s=!1,r=`0000-01-01T${r}`;if(f=!!u[2],f&&r[10]===" "&&(r=r.replace(" ","T")),u[2]&&+u[2]>23)r="";else if(a=u[3]||null,!a&&f)r+="Z"}else r=""}super(r);if(!isNaN(this.getTime()))this.#n=s,this.#r=f,this.#e=a}isDateTime(){return this.#n&&this.#r}isLocal(){return!this.#n||!this.#r||!this.#e}isDate(){return this.#n&&!this.#r}isTime(){return this.#r&&!this.#n}isValid(){return this.#n||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z"||this.#e==="z")return r;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*60000).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,t="Z"){let o=new E(r);return o.#e=t,o}static wrapAsLocalDateTime(r){let t=new E(r);return t.#e=null,t}static wrapAsLocalDate(r){let t=new E(r);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(r){let t=new E(r);return t.#n=!1,t.#e=null,t}}/*!
|
|
85
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
86
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
87
|
-
*
|
|
88
|
-
* Redistribution and use in source and binary forms, with or without
|
|
89
|
-
* modification, are permitted provided that the following conditions are met:
|
|
90
|
-
*
|
|
91
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
92
|
-
* list of conditions and the following disclaimer.
|
|
93
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
94
|
-
* this list of conditions and the following disclaimer in the
|
|
95
|
-
* documentation and/or other materials provided with the distribution.
|
|
96
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97
|
-
* may be used to endorse or promote products derived from this software without
|
|
98
|
-
* specific prior written permission.
|
|
99
|
-
*
|
|
100
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
101
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
102
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
103
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
104
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
105
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
106
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
107
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
108
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
109
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
110
|
-
*/function C(r,t=10){return t===16?r>47&&r<58||r>64&&r<71||r>96&&r<103:r>47&&r<48+t}function le(r,t){return r===32||r===9||r===10||r===13||t&&(r===t||r===44)||r===35}function U(r,t){let o=r.p,s=r.s.charCodeAt(r.p);if(s===91||s===123){r.d--||m.x("document contains excessively nested structures. aborting.",r);let f=s===91?ve(r):Oe(r);return r.d++,f}if(s===34||s===39)return B(r);if(s===116){if(r.s.charCodeAt(++r.p)!==114||r.s.charCodeAt(++r.p)!==117||r.s.charCodeAt(++r.p)!==101)m.x("invalid value",r,o);return r.p++,!0}if(s===102){if(r.s.charCodeAt(++r.p)!==97||r.s.charCodeAt(++r.p)!==108||r.s.charCodeAt(++r.p)!==115||r.s.charCodeAt(++r.p)!==101)m.x("invalid value",r,o);return r.p++,!1}if(s===43||s===45)return G(r,r.p,r.s.charCodeAt(++r.p),44-s,t);if(r.s.charCodeAt(r.p+4)===45&&r.s.charCodeAt(r.p+7)===45)return Ye(r,s,t);if(r.s.charCodeAt(r.p+2)===58)return Qe(r,s,t);return G(r,r.p,s,0,t)}function G(r,t,o,s,f){let a=o,i=0,u=!1;if(a===105){if(r.s.charCodeAt(++r.p)!==110||r.s.charCodeAt(++r.p)!==102)m.x("invalid value",r,t);return r.p++,(s||1)/0}if(a===110){if(r.s.charCodeAt(++r.p)!==97||r.s.charCodeAt(++r.p)!==110)m.x("invalid value",r,t);return r.p++,NaN}if(a===48){if(++r.p>=r.s.length||le(a=r.s.charCodeAt(r.p),f))return r.bi===!0?0n:0;if(!s){if(a===120)return ae(r,t,16,f);else if(a===98)return ae(r,t,2,f);else if(a===111)return ae(r,t,8,f)}if(a===46)i=2;else if(a===101||a===69)i=4;else m.x("illegal leading zero",r,t)}else if(!C(a))m.x("invalid value",r,t);while(++r.p<r.s.length&&(a=r.s.charCodeAt(r.p),!le(a,f))){if(!i)i=1;if(a===95){if(!(i&1))m.x("illegal underscore",r);i+=11,u=!0}else if(i===1&&a===46)i=2;else if((i===1||i===3)&&(a===101||a===69))i=4;else if(i===4&&(a===43||a===45))i=6;else if(!C(a))m.x("illegal character in numeric literal",r);else if(i>9)i-=11;else if(!(i&1))i++}if(!i){let p=(o-48)*(s||1);return r.bi===!0?BigInt(p):p}if(!(i&1))m.x("unfinished numeric value",r,t);let c=r.s.slice(t,r.p);if(u)c=c.replaceAll("_","");return i>1?parseFloat(c):Te(r,c,10,t)}function ae(r,t,o,s){let f,a=1;while(++r.p<r.s.length&&(f=r.s.charCodeAt(r.p),!le(f,s)))if(f===95){if(a&1)m.x("illegal underscore",r);a=3}else if(!C(f,o))m.x("illegal character in numeric literal",r);else if(a&1)a--;if(a&1)m.x("unfinished numeric value",r);let i=r.s.slice(t+2,r.p);if(a)i=i.replaceAll("_","");return Te(r,i,o,t)}function Te(r,t,o,s){if(r.bi!==!0)e:{let f=parseInt(t,o);if(!Number.isSafeInteger(f)){if(r.bi)break e;m.x("integer value cannot be represented losslessly",r,s)}return f}return o===10?BigInt(t):BigInt((o===2?"0b":o===8?"0o":"0x")+t)}function Ye(r,t,o){let s=r.p++,f;if(!C(t)||!C(r.s.charCodeAt(r.p++))||!C(r.s.charCodeAt(r.p++))||!C(r.s.charCodeAt(r.p++)))return G(r,r.p=s,t,0,o);if(r.p+=5,!C(r.s.charCodeAt(r.p++)))m.x("invalid date-time: date part is malformed",r,s);if(r.p>=r.s.length||((t=r.s.charCodeAt(r.p))!==32||(f=!0,!C(r.s.charCodeAt(r.p+1))))&&t!==84&&t!==116){let i=r.s.slice(s,r.p);return P(r,i,3,!1,s)}if(r.s.charCodeAt(r.p+=3)!==58)m.x("invalid date-time: time part is malformed",r,s);if(r.s.charCodeAt(r.p+=3)===58)r.p+=3;if(r.s.charCodeAt(r.p)===46)while(C(r.s.charCodeAt(++r.p)));if(t=r.s.charCodeAt(r.p)){if(t===90||t===122){let i=r.s.slice(s,++r.p);return P(r,i,1,f,s,"[+00:00]")}if(t===43||t===45){let i=r.s.slice(s,r.p+=6);return P(r,i,1,f,s,!r.ld&&"["+r.s.slice(r.p-6,r.p)+"]")}}let a=r.s.slice(s,r.p);return P(r,a,2,f,s)}function Qe(r,t,o){let s=r.p;if(!C(t)||!C(r.s.charCodeAt(++r.p)))return G(r,--r.p,t,0,o);if(r.s.charCodeAt(r.p+=4)===58)r.p+=3;if(r.s.charCodeAt(r.p)===46)while(C(r.s.charCodeAt(++r.p)));let f=r.s.slice(s,r.p);return P(r,f,4,!1,s)}function P(r,t,o,s,f,a){if(r.ld){let i=new E(t,o,s);if(!i.isValid())m.x("invalid date",r,f);return i}try{if(a)t+=a;switch(o){case 1:return Temporal.ZonedDateTime.from(t);case 2:return Temporal.PlainDateTime.from(t);case 3:return Temporal.PlainDate.from(t);case 4:return Temporal.PlainTime.from(t)}}catch(i){m.x(i instanceof Error?i.message:""+i,r,f)}}/*!
|
|
111
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
112
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
113
|
-
*
|
|
114
|
-
* Redistribution and use in source and binary forms, with or without
|
|
115
|
-
* modification, are permitted provided that the following conditions are met:
|
|
116
|
-
*
|
|
117
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
118
|
-
* list of conditions and the following disclaimer.
|
|
119
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
120
|
-
* this list of conditions and the following disclaimer in the
|
|
121
|
-
* documentation and/or other materials provided with the distribution.
|
|
122
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
123
|
-
* may be used to endorse or promote products derived from this software without
|
|
124
|
-
* specific prior written permission.
|
|
125
|
-
*
|
|
126
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
127
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
128
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
129
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
130
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
131
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
132
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
133
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
134
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
135
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
136
|
-
*/function en(r){for(;r.p<r.s.length;r.p++){let t=r.s.charCodeAt(r.p);if(t===10)break;if(t===13&&r.s.charCodeAt(r.p+1)===10){r.p++;break}if(t<32&&t!==9||t===127)m.x("control characters are not allowed in comments",r)}}function T(r,t,o){let s;while(r.p<r.s.length){while(r.p<r.s.length&&((s=r.s.charCodeAt(r.p))===32||s===9||!t&&(s===10||s===13&&r.s.charCodeAt(r.p+1)===10)))r.p++;if(o||s!==35)break;en(r)}}/*!
|
|
137
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
138
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
139
|
-
*
|
|
140
|
-
* Redistribution and use in source and binary forms, with or without
|
|
141
|
-
* modification, are permitted provided that the following conditions are met:
|
|
142
|
-
*
|
|
143
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
144
|
-
* list of conditions and the following disclaimer.
|
|
145
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
146
|
-
* this list of conditions and the following disclaimer in the
|
|
147
|
-
* documentation and/or other materials provided with the distribution.
|
|
148
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
149
|
-
* may be used to endorse or promote products derived from this software without
|
|
150
|
-
* specific prior written permission.
|
|
151
|
-
*
|
|
152
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
153
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
154
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
155
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
156
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
157
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
158
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
159
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
160
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
161
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
162
|
-
*/function H(r,t=61){let o,s=0,f=[],a,i=r.s.charCodeAt(o=r.p);do if(i===t){if(!s)m.x("unexpected end of key",r);if(s===1)f.push(r.s.slice(a,r.p));return r.p++,f}else if(i===46){if(!s)m.x("illegal empty bare key",r);if(s===1)f.push(r.s.slice(a,r.p));s=0}else if(!s&&(i===34||i===39)){if(i===r.s.charCodeAt(r.p+1)&&i===r.s.charCodeAt(r.p+2))m.x("illegal quoted key: multiline strings are not allowed",r);f.push(B(r)),s=2,r.p--}else if(i===32||i===9){if(s===1)f.push(r.s.slice(a,r.p)),s=2}else if(s===2||i<48&&i!==45||i>57&&i<65||i>90&&i<97&&i!==95||i>122)m.x("illegal character in key",r);else if(!s)s=1,a=r.p;while(i=r.s.charCodeAt(++r.p));m.x("incomplete key-value: cannot find end of key",r,o)}function Oe(r){let t=r.p++,o=Object.create(null),s=new Set,f;while(r.p<r.s.length){if(T(r),(f=r.s.charCodeAt(r.p))===125)return r.p++,o;let a,i=o,u=!1,c=r.p,p=H(r);for(let y=0;y<p.length;y++){if(y)i=u?i[a]:i[a]=Object.create(null);if(a=p[y],(u=Object.hasOwn(i,a))&&(typeof i[a]!=="object"||s.has(i[a])))m.x("trying to redefine an already defined value",r,c);let O=a==="__proto__";if(r.uk&&(O||a==="constructor")){i=r.uk!==1&&m.x("document contains an unsafe property",r,c);break}if(!u&&O)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,writable:!0})}if(u)m.x("trying to redefine an already defined value",r,c);T(r,!0,!0);let g=U(r,125);if(i&&typeof(i[a]=g)==="object")s.add(g);if(T(r),(f=r.s.charCodeAt(r.p++))===125)return o;if(f!==44)m.x("expected comma or end of structure",r,r.p-1)}m.x("unfinished table",r,t)}function ve(r){let t=r.p++,o=[],s;while(r.p<r.s.length){if(T(r),(s=r.s.charCodeAt(r.p))===93)return r.p++,o;if(o.push(U(r,93)),T(r),(s=r.s.charCodeAt(r.p++))===93)return o;if(s!==44)m.x("expected comma or end of structure",r,r.p-1)}m.x("unfinished array",r,t)}/*!
|
|
163
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
164
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
165
|
-
*
|
|
166
|
-
* Redistribution and use in source and binary forms, with or without
|
|
167
|
-
* modification, are permitted provided that the following conditions are met:
|
|
168
|
-
*
|
|
169
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
170
|
-
* list of conditions and the following disclaimer.
|
|
171
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
172
|
-
* this list of conditions and the following disclaimer in the
|
|
173
|
-
* documentation and/or other materials provided with the distribution.
|
|
174
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
175
|
-
* may be used to endorse or promote products derived from this software without
|
|
176
|
-
* specific prior written permission.
|
|
177
|
-
*
|
|
178
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
179
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
180
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
181
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
182
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
183
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
184
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
185
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
186
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
187
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
188
|
-
*/function $e(r,t,o,s,f){let a=o,i=s,u,c=!1,p;for(let g=0;g<t.length;g++){if(g){if(a=c?a[u]:a[u]=Object.create(null),i=(p=i[u]).c,f===0&&(p.t===1||p.t===2))return null;if(p.t===2){let y=a.length-1;a=a[y],i=i[y].c}}if(u=t[g],(c=Object.hasOwn(a,u))&&i[u]?.t===0&&i[u]?.d)return null;if(!c){let y=u==="__proto__";if(r.uk&&(y||u==="constructor"))return!1;if(y)Object.defineProperty(a,u,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(i,u,{enumerable:!0,configurable:!0,writable:!0});i[u]={t:g<t.length-1&&f===2?3:f,d:!1,i:0,c:Object.create(null)}}}if(p=i[u],p.t!==f&&!(f===1&&p.t===3))return null;if(f===2){if(!p.d)p.d=!0,a[u]=[];a[u].push(a=Object.create(null)),p.c[p.i++]=p={t:1,d:!1,i:0,c:Object.create(null)}}if(p.d)return null;if(p.d=!0,f===1)a=c?a[u]:a[u]=Object.create(null);else if(f===0&&c)return null;return[u,a,p.c]}function je(r,t,o){if(t===null||r.uk===2)m.x(t===null?"trying to redefine an already defined table or value":"document contains an unsafe property",r,o)}function fe(r,t={}){let o={s:r,p:0,d:t.maxDepth??1000,bi:t.integersAsBigInt??!1,ld:t.useLegacyDate??!0,uk:t.unsafeKeyBehaviour==="throw"?2:t.unsafeKeyBehaviour==="drop"?1:0},s=Object.create(null),f=Object.create(null),a,i=!1,u=s,c=f;if(r.charCodeAt(0)===65279)o.p++;T(o);while(o.p<r.length){if(r.charCodeAt(o.p)===91){let p=r.charCodeAt(++o.p)===91;a=o.p+=+p,i=!1;let g=H(o,93);if(p){if(r.charCodeAt(o.p)!==93)m.x("expected end of table array declaration",o);o.p++}let y=$e(o,g,s,f,p?2:1);if(!y)je(o,y,a),i=!0;else c=y[2],u=y[1]}else{a=o.p;let p=H(o),g=$e(o,p,u,c,0);if(!g&&!i)je(o,g,a);T(o,!0,!0);let y=U(o,void 0);if(g&&!i)g[1][g[0]]=y}if(T(o,!0),o.p<r.length&&(a=r.charCodeAt(o.p))!==10&&(a!==13||r.charCodeAt(o.p+1)!==10))m.x("each key-value declaration must be followed by an end-of-line",o);T(o)}return s}/*!
|
|
189
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
190
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
191
|
-
*
|
|
192
|
-
* Redistribution and use in source and binary forms, with or without
|
|
193
|
-
* modification, are permitted provided that the following conditions are met:
|
|
194
|
-
*
|
|
195
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
196
|
-
* list of conditions and the following disclaimer.
|
|
197
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
198
|
-
* this list of conditions and the following disclaimer in the
|
|
199
|
-
* documentation and/or other materials provided with the distribution.
|
|
200
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
201
|
-
* may be used to endorse or promote products derived from this software without
|
|
202
|
-
* specific prior written permission.
|
|
203
|
-
*
|
|
204
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
205
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
206
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
207
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
208
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
209
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
210
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
211
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
212
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
213
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
214
|
-
*/var Yn=!!"".isWellFormed;/*!
|
|
215
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
216
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
217
|
-
*
|
|
218
|
-
* Redistribution and use in source and binary forms, with or without
|
|
219
|
-
* modification, are permitted provided that the following conditions are met:
|
|
220
|
-
*
|
|
221
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
222
|
-
* list of conditions and the following disclaimer.
|
|
223
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
224
|
-
* this list of conditions and the following disclaimer in the
|
|
225
|
-
* documentation and/or other materials provided with the distribution.
|
|
226
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
227
|
-
* may be used to endorse or promote products derived from this software without
|
|
228
|
-
* specific prior written permission.
|
|
229
|
-
*
|
|
230
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
231
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
232
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
233
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
234
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
235
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
236
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
237
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
238
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
239
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
240
|
-
*/function Ee(r){let t=J(r);if(t===void 0||t.trim()==="")return;let o=L(t);if(!o)throw Error(`${r} isn't valid TOML, so it was left alone. Fix it and run setup again.`);return{text:t,value:o}}function Ie(r,t,o){let s=L(t)??{},f=Ne(s),a=o.reduce((c,p)=>{if(p.type==="key"){if(p.value===void 0)delete f[p.key];else f[p.key]=p.value;return rn(c,p.key,p.value)}if(p.type==="remove")return cn(f,p.path),on(c,p.path);return pn(f,p.path,p.entries),sn(c,p.path,p.entries)},t),i=/^\s*\n/.test(t)?a:a.replace(/^\s*\n/,""),u=L(i);if(!u||X(u)!==X(f))throw Error(`${r} couldn't be updated without changing settings setup doesn't own, so it was left alone.`);return i}function z(r,t){return t.reduce((o,s)=>N(o)?o[s]:void 0,r)}function q(r){if(typeof r==="string")return JSON.stringify(r);if(typeof r==="number"||typeof r==="boolean")return String(r);if(Array.isArray(r))return`[${r.map(q).join(", ")}]`;if(N(r))return`{ ${Object.entries(r).filter(([,t])=>t!==void 0).map(([t,o])=>`${Y(t)} = ${q(o)}`).join(", ")} }`;throw Error(`Can't write ${String(r)} as TOML`)}function Y(r){return/^[A-Za-z0-9_-]+$/.test(r)?r:JSON.stringify(r)}function N(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)&&!(r instanceof Date)}function L(r){try{return fe(r)}catch{return}}function rn(r,t,o){let s=r.split(`
|
|
241
|
-
`),f=s.findIndex(de),a=f===-1?s.length:f,i=s.slice(0,a).findIndex((p)=>an(p)===t),u=o===void 0?[]:[`${Y(t)} = ${q(o)}`];if(i!==-1)return[...s.slice(0,i),...u.map((p)=>`${p}${tn(s[i])}`),...s.slice(i+1)].join(`
|
|
242
|
-
`);if(o===void 0)return r;let c=s.slice(0,a).findLastIndex((p)=>p.trim()!==""&&!p.trim().startsWith("#"));return[...s.slice(0,c+1),...u,...s.slice(c+1)].join(`
|
|
243
|
-
`)}function tn(r){let t=[...r.matchAll(/#/g)].map((o)=>o.index).find((o)=>L(r.slice(0,o))!==void 0);return t===void 0?"":r.slice(r.slice(0,t).trimEnd().length)}function on(r,t){let o=r.split(`
|
|
244
|
-
`),s=o.findIndex((c)=>de(c)&&!c.trim().startsWith("[[")&&un(ln(c),t));if(s===-1)return r;let f=o.slice(s+1).findIndex(de),a=f===-1?o.length:s+1+f,i=o.slice(0,a).findLastIndex((c)=>c.trim()!=="")+1,u=o.slice(0,s).findLastIndex((c)=>c.trim()!=="")+1;return[...o.slice(0,u),...o.slice(i)].join(`
|
|
245
|
-
`)}function sn(r,t,o){let s=Object.entries(o).filter(([,a])=>a!==void 0).map(([a,i])=>`${Y(a)} = ${q(i)}`),f=r.replace(/\s*$/,"");return`${f===""?"":`${f}
|
|
246
|
-
|
|
247
|
-
`}[${t.map(Y).join(".")}]
|
|
248
|
-
${s.join(`
|
|
249
|
-
`)}
|
|
250
|
-
`}function de(r){return/^\s*\[/.test(r)}function an(r){let t=r.match(/^\s*(?:([A-Za-z0-9_-]+)|"((?:[^"\\]|\\.)*)"|'([^']*)')\s*=/);if(!t)return;let o=t[2]===void 0?void 0:L(`k = "${t[2]}"`)?.k;return t[1]??t[3]??(typeof o==="string"?o:void 0)}function ln(r){let t=L(`${r}
|
|
251
|
-
`),o=[],s=t;while(N(s)&&Object.keys(s).length===1){let f=Object.keys(s)[0];o.push(f),s=s[f]}return o}function Ne(r){return Object.fromEntries(Object.entries(r).map(([t,o])=>[t,_e(o)]))}function _e(r){if(Array.isArray(r))return r.map(_e);if(N(r))return Ne(r);return r}function un(r,t){return r.length===t.length&&r.every((o,s)=>o===t[s])}function pn(r,t,o){let s=t.slice(0,-1).reduce((f,a)=>{let i=f[a];if(N(i))return i;let u={};return f[a]=u,u},r);s[t.at(-1)]=Object.fromEntries(Object.entries(o).filter(([,f])=>f!==void 0))}function cn(r,t){let o=z(r,t.slice(0,-1));if(N(o))delete o[t.at(-1)]}function X(r){if(Array.isArray(r))return`[${r.map(X).join(",")}]`;if(r instanceof Date)return JSON.stringify(r.toISOString());if(N(r))return`{${Object.keys(r).toSorted().map((t)=>[t,X(r[t])]).filter(([,t])=>t!=="{}").map(([t,o])=>`${JSON.stringify(t)}:${o}`).join(",")}}`;return JSON.stringify(r)}function kn(r=process.env,t=yn.homedir()){let o=r.CODEX_HOME?.trim(),s=o?Me(S.resolve(o)):S.join(t,".codex"),f=S.join(s,"AGENTS.override.md");return{home:s,config:S.join(s,"config.toml"),hooks:S.join(s,"hooks.json"),rules:S.join(s,"rules","opencode-console.rules"),skills:S.join(s,"skills"),memory:(J(f)?.trim()??"")===""?S.join(s,"AGENTS.md"):f}}function Me(r){if(pe(r))return hn(r);let t=S.dirname(r);return t===r?r:S.join(Me(t),S.basename(r))}function Re(r,t,o){let s=mr(Tt(r)),f=t.models[0];if(s===void 0||f===void 0)return;return{baseURL:`${s}/openai/v1`,catalogURL:`${o}${uo}`,model:f.slug,count:t.models.length}}function Le(r){return r.flatMap((t,o)=>{if(t.action!=="tool.use"||t.effect!=="deny"||!t.resource.startsWith("shell:"))return[];let s=t.resource.slice(6).match(/^([^*?]+)\*$/)?.[1]?.trim(),f=s?.split(/\s+/)??[];if(!s||f.some((i)=>!/^[\w@%+=:,./-]+$/.test(i)))return[];if(r.slice(o+1).some((i)=>i.action==="tool.use"&&i.effect==="allow"&&so(i.resource,`shell:${s}`)))return[];let a=[...t.message].map((i)=>i<" "||i===""?" ":i).join("");return[`prefix_rule(pattern = ${JSON.stringify(f)}, decision = "forbidden", justification = ${JSON.stringify(a)})`]})}var bn=n({baseURL:e,catalogURL:e,model:e,count:V}),Pe=n({paths:n({home:e,config:e,hooks:e,rules:e,skills:e,memory:e}),command:l(e),harness:b(e),environment:x(e,e),...ur,tables:l(l(e)),servers:l(e),skills:x(e,e),memoryCreated:v,created:n({config:v,hooks:v}),providers:b(e),models:b(Ze(bn))}),ee=(r)=>S.join(r.data,"codex.json");function ne(r){let t=ee(r),o=J(t);if(o===void 0)return;let s=j(W(Z(Pe))(o));if(!s)throw Error(`${t} can't be read, so Codex was left as it is. Delete it and run setup again.`);return s}var Q="opencode-console",ce=["hook","codex"],wn=R("Codex.refresh")(function*(r,t){let o=ne(r),s=t??o;if(!s)return;let f=yield*He(r),a=f&&qe(r,be(f));if(!f||!a?.config)return;let i=a.config,u=Ot(a),c=xe("sha256").update(JSON.stringify(i.providers??null)).digest("hex"),g=!t&&o?.providers===c&&o.models!==void 0?o.models??void 0:yield*pt([_t(f),_s(f)],{concurrency:2}).pipe(h(([A,D])=>Re(A,D,f.server))),y=yield*dn(f,s.paths.skills,u,o?.skills??{}),O=gr(f,a),w=yield*Ae([{action:"websearch:",resources:["*"],truncated:!0},{action:"websearch.use",resources:["openai"]}],(A)=>cr(O,A));return yield*Ce(r,I(()=>Cn(r,{paths:s.paths,command:s.command,harness:t?t.harness:o?.harness,environment:t?t.environment??{}:o?.environment??{},models:g,servers:Object.fromEntries(Object.entries(et(a)).map(([A,D])=>[A,{url:D.url,gateway:D.headers!==void 0}])),instructions:lt(a),skills:u,bundles:y,rules:Le(fs(O)??[]),searchOff:w.some((A)=>A.effect==="deny"),providers:c,explicit:t!==void 0})))});function An(r){let t=ne(r);if(!t)return!1;let o=Ee(t.paths.config),s=St(t.paths.hooks),f=J(t.paths.memory),a=o&&Ie(t.paths.config,o.text,[...Object.keys(t.originals).flatMap((i)=>{let u={...o.value};return jn(u,i,t),JSON.stringify(u[i])===JSON.stringify(o.value[i])?[]:[{type:"key",key:i,value:u[i]}]}),...t.tables.filter((i)=>z(o.value,i)!==void 0).map((i)=>({type:"remove",path:i}))]);if(o&&a!==void 0){if(a.trim()===""&&t.created.config)K(t.paths.config);else if(a!==o.text)wt(t.paths.config,a)}if(s)if(ze(s),Object.keys(s).length===0&&t.created.hooks)K(t.paths.hooks);else vt(t.paths.hooks,s);return K(t.paths.rules),Object.keys(t.skills).forEach((i)=>gn(S.join(t.paths.skills,i),{recursive:!0,force:!0})),lr(t.paths.memory,f,[],t.memoryCreated),[t.paths.config,t.paths.hooks].forEach((i)=>K(Xe(i))),K(ee(r)),!0}function Cn(r,t){let o=ne(r),s=pe(t.paths.config),f=pe(t.paths.hooks),a=Ee(t.paths.config)??{text:"",value:{}},i=St(t.paths.hooks)??{},u=J(t.paths.memory),c=o?.created??{config:!s,hooks:!f},p=[];ze(i);let g=_(i.hooks),y=[...t.command,...t.harness===void 0?[]:["--harness",t.harness]],O=On(y).map(([d,M])=>{let we=[...Array.isArray(g[d])?g[d]:[],M];return g[d]=we,{event:d,group:M,index:we.length-1}});i.hooks=g;let w={...a.value},{originals:A,written:D}=pr(w,Sn(t),o,t.explicit),We=[...new Set([...Object.keys(o?.originals??{}),...Object.keys(A)])].flatMap((d)=>JSON.stringify(w[d])===JSON.stringify(a.value[d])?[]:[{type:"key",key:d,value:w[d]}]),re=new Map((o?.tables??[]).map((d)=>[JSON.stringify(d),d])),te=(d)=>!re.has(JSON.stringify(d))&&z(a.value,d)!==void 0,he=["model_providers",Q];if(t.models&&te(he))throw Error(`${t.paths.config} already has a model provider named ${Q}, so Codex was left as it is. Rename it and run setup again.`);let oe=Object.entries(t.servers).flatMap(([d,M])=>{if(M.url===void 0||!/^[a-z0-9_-]+$/i.test(d))return[];if(te(["mcp_servers",d]))return p.push(d),[];return[{name:d,url:M.url,gateway:M.gateway}]}),ge=O.map((d)=>({path:["hooks","state",`${t.paths.hooks}:${Ue(d.event)}:${d.index}:0`],hash:Je(d.event,d.group)})),ie=[...t.models?[{path:[...he],entries:Tn(t)}]:[],...oe.map((d)=>({path:["mcp_servers",d.name],entries:{url:d.url,...d.gateway?{http_headers_helper:fr([...$n(t.environment),...y,"mcp-headers",d.name])}:{}}})),...ge.map((d)=>({path:d.path,entries:{trusted_hash:d.hash}}))],Fe=(d)=>re.has(JSON.stringify(d.path))&&F(z(a.value,d.path))===F(d.entries),ye=new Set(ie.filter(Fe).map((d)=>JSON.stringify(d.path))),ke=Ie(t.paths.config,a.text,[...We,...[...re].filter(([d])=>!ye.has(d)).map(([,d])=>d).filter((d)=>z(a.value,d)!==void 0).map((d)=>({type:"remove",path:d})),...ge.filter((d)=>te(d.path)).map((d)=>({type:"remove",path:d.path})),...ie.filter((d)=>!ye.has(JSON.stringify(d.path))).map((d)=>({type:"table",path:d.path,entries:d.entries}))]);if(!o)[t.paths.config,t.paths.hooks].forEach(fn);if(ke!==a.text)wt(t.paths.config,ke,384);if(vt(t.paths.hooks,i,384),t.rules.length>0)En(t.paths.rules,`# Written by OpenCode Console from the workspace's policies; \`npx @opencode/console sync\` rewrites it.
|
|
252
|
-
${t.rules.join(`
|
|
253
|
-
`)}
|
|
254
|
-
`);else K(t.paths.rules);let se=mn(t.paths.skills,t.skills,t.bundles,o?.skills??{});p.push(...se.skipped);let Be=lr(t.paths.memory,u,t.instructions,o?.memoryCreated??!1);return Se(ee(r),JSON.stringify(Pe.make({paths:t.paths,command:[...t.command],...t.harness===void 0?{}:{harness:t.harness},environment:{...t.environment},originals:A,written:D,tables:ie.map((d)=>d.path),servers:oe.map((d)=>d.name),skills:se.skills,memoryCreated:Be,created:c,providers:t.providers,models:t.models??null}))),{models:t.models,servers:oe.map((d)=>d.name),skills:Object.keys(se.skills),instructions:t.instructions.length,rules:t.rules.length,searchOff:t.searchOff,skipped:p}}function Sn(r){return{...r.models?{model_provider:Q,model:r.models.model}:{},...r.searchOff?{web_search:"disabled"}:{}}}function Tn(r){let t=r.models;return{name:"OpenCode Console",base_url:t.baseURL,wire_api:"responses",model_catalog_url:t.catalogURL,http_headers:{"x-opencode-plugin":`opencode-console/${ue}`},auth:{command:r.command[0],args:[...r.command.slice(1),"token"],refresh_interval_ms:240000,timeout_ms:15000}}}function On(r){let t=fr([...r,...ce]);return[["PreToolUse",{matcher:"*",hooks:[{type:"command",command:t,timeout:30}]}],["UserPromptSubmit",{hooks:[{type:"command",command:t,timeout:30}]}],["SessionStart",{hooks:[{type:"command",command:t,timeout:10}]}]]}function Je(r,t){let o=t.hooks[0],s={event_name:Ue(r),..."matcher"in t?{matcher:t.matcher}:{},hooks:[{type:o.type,command:o.command,timeout:o.timeout,async:!1}]};return`sha256:${xe("sha256").update(F(s)).digest("hex")}`}function Ue(r){return r.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function F(r){if(Array.isArray(r))return`[${r.map(F).join(",")}]`;if(N(r))return`{${Object.keys(r).toSorted().map((t)=>`${JSON.stringify(t)}:${F(r[t])}`).join(",")}}`;return JSON.stringify(r)}function ze(r){let t=_(r.hooks);if(Object.entries(t).forEach(([o,s])=>{if(!Array.isArray(s))return;let f=s.flatMap((a)=>{let i=_(a).hooks;if(!Array.isArray(i))return[a];let u=i.filter((c)=>!vn(c));if(u.length===i.length)return[a];return u.length===0?[]:[{..._(a),hooks:u}]});if(f.length===0)delete t[o];else t[o]=f}),Object.keys(t).length===0)delete r.hooks;else r.hooks=t}function vn(r){let t=_(r).command;return typeof t==="string"&&t.endsWith(` ${ce.join(" ")}`)}function $n(r){let t=Object.entries(r);if(t.length===0||process.platform==="win32")return[];return["env",...t.map(([o,s])=>`${o}=${s}`)]}function En(r,t){if(J(r)!==t)wt(r,t)}export{me as Codex,Q as PROVIDER,ce as hookArgs,ne as manifest,ee as manifestFile,Re as models,kn as paths,wn as refresh,An as remove,Le as rules,Je as trustHash};
|
package/chunk-bcmj4f7y.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{hn,Re,Ri}from"./chunk-qp7a49b3.js";import{br,Hn,Os,Ps,Rs}from"./chunk-jpqmm6pm.js";import{Ce}from"./chunk-6xs4y82y.js";import{ke,be,Bn,He}from"./chunk-x65p26st.js";import{Ss,vs,ws,hr}from"./chunk-yb3fn5r1.js";import{k,P,se,Ct,pt,r,I,u,ko,h,Ie,R}from"./chunk-9dgq3xc0.js";var bs={};k(bs,{WorkspaceSync:()=>bs,current:()=>qe,identify:()=>xs,sync:()=>ys,userAgent:()=>Si});function xs(n){return se(Re,h(Re,(s)=>Ri(s,hn({"user-agent":Si(n),"x-opencode-plugin":`opencode-console/${n.version}`}))))}function Si(n){return[n.harness?.replace(/[\r\n]/g,"").trim(),`opencode-console/${n.version}`].filter(Boolean).join(" ")}var ys=R("WorkspaceSync.sync")(function*(n,s={}){let o=ke(n);if(!o)return yield*Ce(n,I(()=>ws(n))),{snapshot:void 0};let i=yield*Ct,l=be(o),t=qe(n,l);if(t&&!s.force&&!hr(t,i))return{snapshot:t};let c=yield*He(n).pipe(u((e)=>e?pt({config:Os(e),instructions:Ps(e).pipe(h((f)=>f.instructions),Ie(()=>t?.instructions)),skills:Rs(e).pipe(h((f)=>f.skills),Ie(()=>t?.skills))},{concurrency:"unbounded"}).pipe(h((f)=>({credential:e,...f}))):r(void 0)),ko);if(P(c)){if(!c.success)return{snapshot:void 0};let e=c.success;return{snapshot:yield*d(n,l,{owner:l,organization:Bn(e.credential),fetched:i,config:e.config,...e.instructions===void 0?{}:{instructions:e.instructions},...e.skills===void 0?{}:{skills:e.skills}})}}let a=m(c.failure);if(!a)return{snapshot:t,error:c.failure};let p=t??{owner:l,organization:Bn(o)};return{snapshot:yield*d(n,l,{...p,fetched:i,status:a}),error:c.failure}});function qe(n,s){let o=Ss(n);return o?.owner===s?o:void 0}function d(n,s,o){return Ce(n,I(()=>{let i=ke(n);if(!i||be(i)!==s)return;return vs(n,o),o}))}function m(n){if(n instanceof br)return{message:n.message,url:n.url};if(n instanceof Hn)return{message:n.message};return}
|
|
2
|
-
export{xs,Si,ys,qe,bs};
|
package/chunk-cd4h496v.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Pt,ho}from"./chunk-qp7a49b3.js";import{Er,Ls,js,Se}from"./chunk-6xs4y82y.js";import{ke,be}from"./chunk-x65p26st.js";import{cr}from"./chunk-7qa618ad.js";import{hr,gr}from"./chunk-yb3fn5r1.js";import{xs,ys,qe}from"./chunk-bcmj4f7y.js";import{ue}from"./chunk-9zpe1ry1.js";import{k,wn,Ae,Nr,Te,On}from"./chunk-9dgq3xc0.js";var ps={};k(ps,{InProcess:()=>ps,config:()=>Be,decide:()=>bt,decisions:()=>ar,refresh:()=>us,refreshStale:()=>yi,session:()=>ir});function ir(e={}){let r=xs({version:ue,harness:e.harness}).pipe(wn(ho)),o=e.fetch;return{store:e.store??Er(),run:(n)=>On(o?n.pipe(Nr(r),Te(Pt,o)):n.pipe(Nr(r)))}}var i=new WeakMap;function us(e){let r=i.get(e);if(r)return r;let o=e.run(ys(e.store)).finally(()=>i.delete(e));return i.set(e,o),o}async function bt(e,r){return(await ar(e,r)).find((o)=>o.effect==="deny")}async function ar(e,r){let o=ke(e.store),n=gr(o,o&&await Be(e));return On(Ae(r,(t)=>cr(n,t)))}async function Be(e){let r=ke(e.store);if(!r)return;let o=be(r),n=qe(e.store,o);if(!n)await new Promise((t)=>{let s=setTimeout(t,3000);s.unref?.(),us(e).catch(()=>{return}).finally(()=>{clearTimeout(s),t()})});else if(hr(n,Date.now()))yi(e);return qe(e.store,o)}function yi(e){let r=Ls(e.store),o=js(r);if(o!==void 0&&Date.now()-o<30000)return!1;return Se(r,""),us(e).catch(()=>{return}),!0}
|
|
2
|
-
export{ir,us,bt,ar,Be,yi,ps};
|
package/chunk-g9f1r3v3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cr,fs,so,ds}from"./chunk-7qa618ad.js";import"./chunk-11wqcgnn.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{ds as PolicyEvaluator,cr as check,so as couldMatch,fs as statements};
|
package/chunk-ghvsrvdw.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{vi,wi,Ss,vs,ws,hr,Ei,gr,lt,Ot,et,Ea,Es}from"./chunk-yb3fn5r1.js";import"./chunk-x65p26st.js";import"./chunk-11wqcgnn.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{wi as Info,vi as MAX_AGE_MS,Es as WorkspaceSnapshot,ws as clear,lt as instructions,Ea as models,Ei as policies,Ss as read,et as servers,Ot as skills,hr as stale,gr as workspace,vs as write};
|
package/chunk-jpqmm6pm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ae,Us,Ii,hn,Ti,wr,Oi,tt,gn,Re,_i,Mi,mo}from"./chunk-qp7a49b3.js";import{k,U,we,So,F,Ct,pt,r,G,u,Co,h,je,Mr,$t,Te,ti,de,R,b,d,B,e,V,n,x,l,w,Ze}from"./chunk-9dgq3xc0.js";var Ds={};k(Ds,{ConsoleClient:()=>Ds,DeviceSignInFailed:()=>Sr,OAuth:()=>yr,SignedOut:()=>Hn,SsoRequired:()=>br,authorize:()=>Is,clientID:()=>xr,codexModelsPath:()=>uo,defaultServer:()=>As,fetchCodexModels:()=>_s,fetchConfig:()=>Os,fetchInstructions:()=>Ps,fetchModels:()=>_t,fetchSkill:()=>Ms,fetchSkillBlob:()=>Ns,fetchSkills:()=>Rs,headers:()=>Ai,normalizeServer:()=>Fs,refresh:()=>Ts,revoke:()=>lo,signedOutMessage:()=>ki,ssoMessage:()=>Ci});var As="https://opencode.ai/console",xr="opencode-console-cli",yr=n({type:d("oauth"),server:e,access:e,refresh:e,expires:V,accountID:e,email:b(e),orgID:b(e),orgName:b(e)}),ki="Signed out of OpenCode Console. Run `npx @opencode/console login` to sign in again",Ci=(t)=>`Sign in with SSO again to use ${t??"your OpenCode Console workspace"}`;class br extends F("ConsoleClient.SsoRequired"){get message(){return Ci(this.organization)}}class Hn extends F("ConsoleClient.SignedOut"){get message(){return ki}}class Sr extends F("ConsoleClient.DeviceSignInFailed"){}function Ai(t){return{authorization:`Bearer ${t.type==="oauth"?t.access:t.key}`,...t.type==="oauth"&&t.orgID?{"x-org-id":t.orgID}:{}}}var M=n({device_code:e,user_code:e,verification_uri:e,verification_uri_complete:e,expires_in:V,interval:V}),y=n({access_token:e,refresh_token:e,expires_in:V,org_id:b(Ze(e))}),m=n({error:e}),I=n({id:e,email:e}),T=n({id:e,name:e}),O=n({_tag:d("SsoRequired"),connectionId:b(e)}),H=n({_tag:d("Unauthorized")}),D=x(e,B),E={access_denied:"The sign-in was denied in the browser",expired_token:"The code expired before it was approved. Start the sign-in again"},Is=R("ConsoleClient.authorize")(function*(t){let o=yield*Re,i=yield*g(`${t}/auth/device/code`,{client_id:xr,supports_org_scope:!0}).pipe(u(gn),u(tt(M))),c=new URL(t).origin,s=URL.parse(i.verification_uri_complete,`${t}/`);if(!s||s.origin!==c||URL.parse(i.verification_uri,`${t}/`)?.origin!==c)return yield*new Sr({message:`${t} sent a sign-in link to another site (${i.verification_uri_complete}), so the sign-in stopped`});return{url:s.href,code:i.user_code,callback:f(t,i.device_code,we(i.interval)).pipe(Te(Re,o))}}),Ts=R("ConsoleClient.refresh")(function*(t){let o=yield*g(`${t.server}/auth/device/token`,{grant_type:"refresh_token",refresh_token:t.refresh,client_id:xr});if(o.status===400){let a=yield*tt(m)(o).pipe(Co);if(U(a)&&a.value.error==="invalid_grant")return yield*new Hn}let i=yield*gn(o).pipe(u(tt(y))),c=yield*Ct,s=i.org_id??t.orgID;return yr.make({...t,access:i.access_token,refresh:i.refresh_token,expires:c+i.expires_in*1000,...s===void 0?{}:{orgID:s}})}),lo=R("ConsoleClient.revoke")(function*(t){let o=yield*g(`${t.server}/auth/oauth/revoke`,{token:t.refresh,token_type_hint:"refresh_token",client_id:xr}).pipe(Mr(we(5)));yield*gn(o)}),Os=R("ConsoleClient.fetchConfig")(function*(t){return yield*p(t,"/api/v2/config",D)}),_t=R("ConsoleClient.fetchModels")(function*(t){return yield*p(t,"/api/v1/models",A)}),uo="/api/v2/codex/models",_s=R("ConsoleClient.fetchCodexModels")(function*(t){return yield*p(t,uo,J)}),Ps=R("ConsoleClient.fetchInstructions")(function*(t){return yield*p(t,"/api/v2/instructions",z).pipe(je(C,()=>r({instructions:[]})))}),Rs=R("ConsoleClient.fetchSkills")(function*(t){return yield*p(t,"/api/v2/skills",L).pipe(je(C,()=>r({skills:[]})))}),Ms=R("ConsoleClient.fetchSkill")(function*(t,o){return yield*p(t,`/api/v2/skills/${encodeURIComponent(o)}?format=v2`,N)}),Ns=R("ConsoleClient.fetchSkillBlob")(function*(t,o,i){return yield*_(t,`/api/v2/skills/${encodeURIComponent(o)}/blobs/${encodeURIComponent(i)}`,(c)=>c.arrayBuffer.pipe(h((s)=>new Uint8Array(s))))}),A=x(e,n({name:b(e),models:x(e,x(e,B))})),J=n({models:l(n({slug:e,display_name:b(e)}))}),z=n({instructions:l(n({name:e,content:e}))}),L=n({skills:l(n({slug:e,version:e}))}),N=n({slug:e,version:e,files:l(w([n({kind:d("text"),path:e,content:e}),n({kind:d("blob"),path:e,sha256:e})]))});function p(t,o,i){return _(t,o,tt(i))}function C(t){return t instanceof ae&&t.response?.status===404}function _(t,o,i){return u(Re,(c)=>Mi(c).execute(Us(`${t.server}${o}`).pipe(wr,hn(Ai(t)))).pipe(u((s)=>G(function*(){if(s.status===401){let a=yield*tt(H)(s).pipe(Co);if(U(a))return yield*new Hn}if(s.status===403){let a=yield*tt(O)(s).pipe(Co);if(U(a))return yield*new br({organization:t.type==="oauth"?t.orgName:void 0,url:q(t.server,a.value.connectionId)})}return yield*i(yield*gn(s))})),ti,Mr(we(10))))}function Fs(t){let o=URL.parse(t);if(!o)return;let i=["localhost","127.0.0.1","[::1]"].includes(o.hostname);if(o.protocol!=="https:"&&!(o.protocol==="http:"&&i))return;return`${o.origin}${o.pathname.replace(/\/+$/,"")}`}function q(t,o){let i=encodeURIComponent(`${new URL(t).pathname.replace(/\/+$/,"")}/`);if(!o)return`${t}/login?next=${i}`;return`${t}/auth/sso/${encodeURIComponent(o)}/start?redirectTo=${i}`}function f(t,o,i){return G(function*(){yield*$t(i);let c=yield*g(`${t}/auth/device/token`,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:o,client_id:xr}),s=yield*tt(w([y,m]))(c);if("access_token"in s)return yield*K(t,s);if(s.error==="authorization_pending")return yield*f(t,o,i);if(s.error==="slow_down")return yield*f(t,o,So(i,we(5)));return yield*new Sr({message:E[s.error]??`The Console refused the sign-in (${s.error})`})})}var K=de(function*(t,o){let[i,c]=yield*pt([S(`${t}/api/user`,o.access_token,I),S(`${t}/api/orgs`,o.access_token,l(T))],{concurrency:2}),s=o.org_id==null?void 0:c.find((v)=>v.id===o.org_id);if(o.org_id!=null&&!s)return yield*new Sr({message:`The workspace ${o.org_id} wasn't found after signing in`});let a=yield*Ct;return yr.make({type:"oauth",server:t,access:o.access_token,refresh:o.refresh_token,expires:a+o.expires_in*1000,accountID:i.id,email:i.email,...s?{orgID:s.id,orgName:s.name}:{}})});function S(t,o,i){return u(Re,(c)=>_i(c).execute(Us(t).pipe(wr,Ti(o)))).pipe(u(tt(i)))}function g(t,o){return u(Re,(i)=>i.execute(Ii(t).pipe(wr,Oi(o)))).pipe(Te(mo,{redirect:"manual"}))}
|
|
2
|
-
export{As,xr,yr,ki,Ci,br,Hn,Sr,Ai,Is,Ts,lo,Os,_t,uo,_s,Ps,Rs,Ms,Ns,Fs,Ds};
|
package/chunk-jxh84gfh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{va,no,rs,ro,$n,gi,os,xi,ss,Ln,is,as,oo,pn,cs,wa,ls}from"./chunk-r1adn0ka.js";import"./chunk-gcqbk8bn.js";import"./chunk-bcmj4f7y.js";import"./chunk-yb3fn5r1.js";import"./chunk-x65p26st.js";import"./chunk-11wqcgnn.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{ls as DeepSeekHarness,$n as MCP_SERVICE,rs as REALM,gi as Route,ro as SERVICE,no as TOKEN,Ln as Unreadable,is as checks,xi as defaultModel,as as invokedSkills,pn as manifest,oo as manifestFile,ss as mcpConfig,va as paths,cs as refresh,wa as remove,os as routes};
|
package/chunk-kd1hjfpe.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ke,co,be,Bn,ka,He,Ca,ks}from"./chunk-x65p26st.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{ks as ConsoleCredentials,He as fresh,ka as login,Ca as logout,Bn as organization,be as owner,ke as read,co as stored};
|
package/chunk-mnjk01tj.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ir,us,bt,ar,Be,yi,ps}from"./chunk-cd4h496v.js";import"./chunk-7qa618ad.js";import"./chunk-bcmj4f7y.js";import"./chunk-yb3fn5r1.js";import"./chunk-x65p26st.js";import"./chunk-11wqcgnn.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{ps as InProcess,Be as config,bt as decide,ar as decisions,us as refresh,yi as refreshStale,ir as session};
|
package/chunk-nqk8n93s.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ya,Go,Vo,Xr,Zo,Yo,Qo,eo,Un,to,Xo,ba,Sa,es,ts,ns}from"./chunk-b4fde357.js";import"./chunk-cd4h496v.js";import"./chunk-7qa618ad.js";import"./chunk-gcqbk8bn.js";import"./chunk-bcmj4f7y.js";import"./chunk-yb3fn5r1.js";import"./chunk-x65p26st.js";import"./chunk-11wqcgnn.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{ns as Pi,Xr as Unreadable,Zo as checks,Vo as defaultModel,Un as directory,Xo as manifest,eo as manifestFile,es as models,to as modelsFile,ya as paths,Go as providers,Sa as remove,ba as setup,Qo as skillCommand,ts as skills,Yo as userBash};
|
package/chunk-qp7a49b3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k,C,t,c,ee,$e,Jt,yo,s,Li,Me,f,M,te,Hs,Ne,oe,ve,i,a,A,U,H,Fe,kr,j,N,pe,yn,Zt,T,y,Ke,E,P,z,bn,ge,we,Ee,Nt,Cr,Jn,F,Gn,Sn,vo,wo,Gs,vn,Dt,fe,Bi,se,Ir,Tr,En,kn,Or,ft,xe,r,O,I,Ut,o,dt,L,_r,An,u,In,Ge,h,mt,ot,Pr,Zs,st,Rr,Ao,Ys,Io,$t,Qs,Xs,tn,Qn,Xn,ei,ri,rn,It,To,Oo,_o,Lt,oi,si,ii,Oe,de,Dr,$r,Ji,Br,ht,No,Gi,Vi,Fo,Do,Pn,Zi,on,Yi,Qi,jt,Uo,ui,$o,Xi,sn,ea,it,zr,ta,na,ra,oa,sa,an,Lo,Bt,nr,cn,b,B,D,g,Ye,Zr,Z,mi,zo,un,ct,da,Yr,Ko,Dn,ma,Wo,ha,Jo,ga,xa,yt}from"./chunk-9dgq3xc0.js";var Ni={};k(Ni,{Fetch:()=>Pt,RequestInit:()=>mo,StreamBodyFallback:()=>Hn,layer:()=>ho});var $s={};k($s,{HttpClient:()=>Re,SpanNameGenerator:()=>dn,TracerDisabledWhen:()=>nn,TracerHeaderFilter:()=>pn,TracerPropagationEnabled:()=>fn,catch:()=>Ls,catchTag:()=>vs,catchTags:()=>qs,circuitBreakerClassifier:()=>Yo,del:()=>Fs,execute:()=>Os,filterOrElse:()=>Js,filterOrFail:()=>Ws,filterStatus:()=>js,filterStatusOk:()=>_i,followRedirects:()=>Oa,get:()=>Bs,head:()=>Ds,isHttpClient:()=>Qo,isTransientError:()=>mr,isTransientResponse:()=>Er,layerMergedContext:()=>gr,make:()=>hr,makeWith:()=>rt,mapRequest:()=>Ri,mapRequestEffect:()=>Ks,mapRequestInput:()=>aa,mapRequestInputEffect:()=>ia,options:()=>Ns,patch:()=>ks,post:()=>Ms,put:()=>_s,query:()=>As,retry:()=>ca,retryTransient:()=>pa,tap:()=>wa,tapError:()=>Ua,tapRequest:()=>Pa,timeout:()=>fa,transform:()=>ce,transformResponse:()=>Ue,withCircuitBreaker:()=>la,withCookiesRef:()=>Ia,withRateLimiter:()=>ua,withScope:()=>Mi});var vr={};k(vr,{DecodeError:()=>xt,EmptyBodyError:()=>Ce,EncodeError:()=>Xt,HttpClientError:()=>ae,HttpClientErrorSchema:()=>Ze,InvalidUrlError:()=>He,StatusCodeError:()=>Et,TransportError:()=>Ct,isHttpClientError:()=>_t});var po={};k(po,{accept:()=>sr,acceptJson:()=>wr,appendUrl:()=>es,appendUrlParam:()=>ns,appendUrlParams:()=>ss,basicAuth:()=>Zn,bearerToken:()=>Ti,bodyFile:()=>gs,bodyFormData:()=>ms,bodyFormDataRecord:()=>ls,bodyJson:()=>fs,bodyJsonUnsafe:()=>Oi,bodyStream:()=>hs,bodyText:()=>ps,bodyUint8Array:()=>cs,bodyUrlParams:()=>ds,compressBody:()=>is,delete:()=>jn,empty:()=>lo,fromWeb:()=>Es,get:()=>Us,head:()=>zn,isHttpClientRequest:()=>zt,make:()=>K,makeWith:()=>v,modify:()=>or,options:()=>Vn,patch:()=>Wn,post:()=>Ii,prependUrl:()=>ts,put:()=>$n,query:()=>qn,removeHash:()=>as,removeHeader:()=>St,schemaBodyJson:()=>us,setBody:()=>G,setHash:()=>bo,setHeader:()=>Gt,setHeaders:()=>hn,setMethod:()=>Ie,setUrl:()=>Eo,setUrlParam:()=>os,setUrlParams:()=>So,toUrl:()=>ne,toWeb:()=>Ss,toWebResult:()=>Ho,trace:()=>Yn,updateHeaders:()=>go,updateUrl:()=>rs,upgrade:()=>Kn});var fo={};k(fo,{TypeId:()=>bt,filterStatus:()=>cr,filterStatusOk:()=>gn,fromWeb:()=>ir,matchStatus:()=>ws,schemaBodyJson:()=>tt,schemaBodyUrlParams:()=>Co,schemaHeaders:()=>Ro,schemaJson:()=>Cs,schemaNoBody:()=>Rs,stream:()=>Ts,toWeb:()=>bs});var Rn="~effect/Ref",Na={[Rn]:{_A:c},...ve,toJSON(){return{_id:"Ref",ref:this.ref}}};var Hr=(e)=>I(()=>e.ref.current);var Ur=t(2,(e,n)=>I(()=>{e.ref.current=n(e.ref.current)}));var Je="~effect/http/HttpBody";var Ar="~effect/http/HttpBody/HttpBodyError";class ze extends F("HttpBodyError"){[Ar]=Ar}class Mt{[Je];constructor(){this[Je]=Je}[M](){return this.toJSON()}toString(){return f(this,{ignoreToString:!0})}}class Lr extends Mt{_tag="Empty";toJSON(){return{_id:"effect/HttpBody",_tag:"Empty"}}}var kt=new Lr;class qr extends Mt{_tag="Raw";body;contentType;contentLength;constructor(e,n,p){super();this.body=e,this.contentType=n,this.contentLength=p}toJSON(){return{_id:"effect/HttpBody",_tag:"Raw",body:this.body,contentType:this.contentType,contentLength:this.contentLength}}}var Jr=(e,n)=>new qr(e,n?.contentType,n?.contentLength);class me extends Mt{_tag="Uint8Array";contentType;contentLength;text;_body;constructor(e,n,p,d){super();this._body=e,this.text=d,this.contentType=n,this.contentLength=p}get body(){return this._body??=wn(this.text)}toJSON(){return{_id:"effect/HttpBody",_tag:"Uint8Array",body:this.contentType.startsWith("text/")||this.contentType.endsWith("json")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}}var ye=(e,n)=>new me(e,n??"application/octet-stream",e.length),Wr=new TextEncoder,le=globalThis.Buffer,wn=le!==void 0?(e)=>le.from(e,"utf8"):(e)=>Wr.encode(e),Yt=(e,n)=>{if(typeof e!=="string")e=e===void 0?"":String(e);if(le!==void 0)return new me(void 0,n??"text/plain",le.byteLength(e,"utf8"),e);let p=Wr.encode(e);return new me(p,n??"text/plain",p.length,e)},jr=(e,n)=>Yt(JSON.stringify(e),n??"application/json"),Ve=(e,n)=>L({try:()=>Yt(JSON.stringify(e),n??"application/json"),catch:(p)=>new ze({reason:{_tag:"JsonError"},cause:p})}),Gr=(e,n)=>{let p=Bt(un(e));return(d,m)=>p(d,n).pipe(st((l)=>new ze({reason:{_tag:"SchemaError",issue:l},cause:l})),u((l)=>Ve(l,m)))},Vr=(e,n)=>Yt(sa(it(e)),n??"application/x-www-form-urlencoded");class Qr extends Mt{_tag="FormData";contentType=void 0;contentLength=void 0;formData;constructor(e){super();this.formData=e}toJSON(){return{_id:"effect/HttpBody",_tag:"FormData",formData:this.formData}}}var Qe=(e)=>new Qr(e),Mr=(e,n,p)=>{if(p==null)return;if(typeof p==="object"){e.append(n,p);return}e.append(n,String(p))},Kr=(e)=>{let n=new globalThis.FormData;for(let[p,d]of Object.entries(e))if(Array.isArray(d))for(let m of d)Mr(n,p,m);else Mr(n,p,d);return Qe(n)};class Xr extends Mt{_tag="Stream";stream;contentType;contentLength;constructor(e,n,p){super();this.stream=e,this.contentType=n,this.contentLength=p}toJSON(){return{_id:"effect/HttpBody",_tag:"Stream",contentType:this.contentType,contentLength:this.contentLength}}}var Kt=(e,n,p)=>new Xr(e,n??"application/octet-stream",p),Fr=(e,n,p)=>{let d=Br(e);return U(d)?r(d.value):o(ct({module:"HttpBody",method:p,description:`Invalid ${n}: ${e}`}))},Un=de(function*(e,n,p){let d=p?.offset===void 0?Ji:yield*Fr(p.offset,"offset",n),m=p?.bytesToRead===void 0?void 0:yield*Fr(p.bytesToRead,"bytesToRead",n),l=d>=e?BigInt("0"):e-d,x=m===void 0||m>l?l:m;if(x>BigInt(Number.MAX_SAFE_INTEGER))return yield*o(ct({module:"HttpBody",method:n,description:`Content length exceeds Number.MAX_SAFE_INTEGER: ${x}`}));return Number(x)}),to=(e,n)=>u(yt,(p)=>u(p.stat(e),(d)=>h(Un(d.size,"file",n),(m)=>Kt(p.stream(e,n),n?.contentType,m))));var be="~effect/http/HttpClientError",_t=(e)=>s(e,be);class ae extends F("HttpClientError"){constructor(e){if("cause"in e.reason)super({...e,cause:e.reason.cause});else super(e)}[be]=be;get request(){return this.reason.request}get response(){return"response"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}}var Ft=(e)=>e.endsWith("Error")?e.slice(0,-5):e,vt=(e,n,p)=>n?`${e}: ${n} (${p})`:`${e} error (${p})`,qt=(e)=>`${e.method} ${an(e.url)}`,Wt=(e,n)=>({...n,request:{_id:"HttpClientRequest",method:e.request.method,url:an(e.request.url)},..."response"in e?{response:{_id:"HttpClientResponse",status:e.response.status}}:void 0});class Ct extends F("TransportError"){get methodAndUrl(){return qt(this.request)}get message(){return vt(Ft(this._tag),this.description,this.methodAndUrl)}toJSON(){return Wt(this,super.toJSON())}}class Xt extends F("EncodeError"){get methodAndUrl(){return qt(this.request)}get message(){return vt(Ft(this._tag),this.description,this.methodAndUrl)}toJSON(){return Wt(this,super.toJSON())}}class He extends F("InvalidUrlError"){get methodAndUrl(){return qt(this.request)}get message(){return vt(Ft(this._tag),this.description,this.methodAndUrl)}toJSON(){return Wt(this,super.toJSON())}}class Et extends F("StatusCodeError"){get methodAndUrl(){return qt(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return vt(Ft(this._tag),this.description,e)}toJSON(){return Wt(this,super.toJSON())}}class xt extends F("DecodeError"){get methodAndUrl(){return qt(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return vt(Ft(this._tag),this.description,e)}toJSON(){return Wt(this,super.toJSON())}}class Ce extends F("EmptyBodyError"){get methodAndUrl(){return qt(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return vt(Ft(this._tag),this.description,e)}toJSON(){return Wt(this,super.toJSON())}}class Ze extends zo(be)({_tag:Ye("HttpError"),kind:D(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:b(Zr())}){static fromHttpClientError(e){return new Ze({_tag:"HttpError",kind:e.reason._tag,cause:e.reason})}}function Xe(e){return e!=="GET"&&e!=="HEAD"&&e!=="OPTIONS"&&e!=="TRACE"}var eo=[["GET","get"],["POST","post"],["PUT","put"],["DELETE","del"],["PATCH","patch"],["HEAD","head"],["OPTIONS","options"],["TRACE","trace"],["QUERY","query"]];var oo=(e)=>(n)=>n.pipeThrough(new CompressionStream(e)),On=(e)=>new ReadableStream({start(n){n.enqueue(e),n.close()}}),no=(e,n,p)=>{if(e._tag!=="Uint8Array"&&e._tag!=="Stream")return r(e);if(e.contentLength!==void 0&&e.contentLength<(p?.minSize??1024))return r(e);if(e._tag==="Uint8Array")return h(ft(()=>new globalThis.Response(oo(n)(On(e.body))).arrayBuffer()),(d)=>ye(new Uint8Array(d),e.contentType));return r(Kt(Ko({evaluate:()=>oo(n)(ga(e.stream)),onError:c}),e.contentType))};var so=(e,n)=>{if(n._tag==="Empty"||n._tag==="FormData")return jt(jt(e,"content-type"),"content-length");return e=n.contentType===void 0?jt(e,"content-type"):on(e,"content-type",n.contentType),tr(e,n)},tr=(e,n)=>{let p=n._tag==="Empty"||n._tag==="FormData"?void 0:n.contentLength;return p===void 0?jt(e,"content-length"):on(e,"content-length",p.toString())},ao=(e)=>{if(e===null||e===void 0||!/^\d+$/.test(e))return;let n=Number(e);return Number.isSafeInteger(n)?n:void 0};class Pe extends F("UrlError"){}var re=(e,n,p)=>Ke({try:()=>{let d=new URL(e,Nn());for(let m=0;m<n.params.length;m++){let[l,x]=n.params[m];if(x!==void 0)d.searchParams.append(l,sn(x))}if(p!==void 0)d.hash=p;return d},catch:(d)=>new Pe({cause:d})}),Nn=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0){let e=location.origin+location.pathname;try{return new URL(e).href}catch{return}}return},co=(e,n)=>Ke({try:()=>new URL(e,n),catch:()=>new vn(`Invalid URL: "${e}"${n!==void 0?` with base "${n}"`:""}`)});var rr="~effect/http/HttpClientRequest",zt=(e)=>s(e,rr),Ln={[rr]:rr,...te,toJSON(){return{_id:"HttpClientRequest",method:this.method,url:an(this.url),urlParams:this.urlParams,hash:this.hash,headers:Me(this.headers),body:this.body.toJSON()}},pipe(){return C(this,arguments)}};function v(e,n,p,d,m,l){let x=Object.create(Ln);return x.method=e,x.url=n,x.urlParams=p,x.hash=d,x.headers=m,x.body=l,x}var lo=v("GET","",zr,i(),Do,kt),K=(e)=>(n,p)=>or(lo,{method:e,url:n,...p??void 0}),Us=K("GET"),qn=K("QUERY"),Ii=K("POST"),Wn=K("PATCH"),$n=K("PUT"),jn=K("DELETE");var zn=K("HEAD"),Vn=K("OPTIONS"),Yn=K("TRACE"),or=t(2,(e,n)=>{let p=e;if(n.method)p=Ie(p,n.method);if(n.url)p=Eo(p,n.url);if(n.headers)p=hn(p,n.headers);if(n.urlParams)p=So(p,n.urlParams);if(n.hash)p=bo(p,n.hash);if(n.body)p=G(p,n.body);if(n.accept)p=sr(p,n.accept);if(n.acceptJson)p=wr(p);return p}),Ie=t(2,(e,n)=>v(n,e.url,e.urlParams,e.hash,e.headers,e.body)),Gt=t(3,(e,n,p)=>v(e.method,e.url,e.urlParams,e.hash,on(e.headers,n,p),e.body)),hn=t(2,(e,n)=>v(e.method,e.url,e.urlParams,e.hash,Yi(e.headers,n),e.body)),go=t(2,(e,n)=>v(e.method,e.url,e.urlParams,e.hash,n(e.headers),e.body)),St=t(2,(e,n)=>go(e,jt(n))),Zn=t(3,(e,n,p)=>Gt(e,"Authorization",`Basic ${ht(`${Fo(n)}:${Fo(p)}`)}`)),Ti=t(2,(e,n)=>Gt(e,"Authorization",`Bearer ${Fo(n)}`)),sr=t(2,(e,n)=>Gt(e,"Accept",n)),wr=sr("application/json"),Kn=t(2,(e,n)=>v(e.method,e.url,e.urlParams,e.hash,on(on(e.headers,"connection","Upgrade"),"upgrade",n),e.body)),Eo=t(2,(e,n)=>{if(typeof n==="string")return v(e.method,n,e.urlParams,e.hash,e.headers,e.body);let p=new URL(n.toString()),d=it(p.searchParams),m=Fe(p.hash===""?void 0:p.hash.slice(1));return p.search="",p.hash="",v(e.method,p.toString(),d,m,e.headers,e.body)}),ts=t(2,(e,n)=>{if(n==="")return e;return v(e.method,xo(n,e.url),e.urlParams,e.hash,e.headers,e.body)}),es=t(2,(e,n)=>{if(n==="")return e;return v(e.method,xo(e.url,n),e.urlParams,e.hash,e.headers,e.body)}),xo=(e,n)=>{let p=e.endsWith("/"),d=n.startsWith("/");return p&&d?e+n.slice(1):!p&&!d?e+"/"+n:e+n},rs=t(2,(e,n)=>v(e.method,n(e.url),e.urlParams,e.hash,e.headers,e.body)),os=t(3,(e,n,p)=>v(e.method,e.url,ta(e.urlParams,n,p),e.hash,e.headers,e.body)),So=t(2,(e,n)=>v(e.method,e.url,na(e.urlParams,n),e.hash,e.headers,e.body)),ns=t(3,(e,n,p)=>v(e.method,e.url,ra(e.urlParams,n,p),e.hash,e.headers,e.body)),ss=t(2,(e,n)=>v(e.method,e.url,oa(e.urlParams,n),e.hash,e.headers,e.body)),bo=t(2,(e,n)=>v(e.method,e.url,e.urlParams,a(n),e.headers,e.body)),as=(e)=>v(e.method,e.url,e.urlParams,i(),e.headers,e.body),G=t(2,(e,n)=>v(e.method,e.url,e.urlParams,e.hash,so(e.headers,n),n)),is=t((e)=>zt(e[0]),(e,n,p)=>{if(e.headers["content-encoding"]!==void 0)return r(e);return h(no(e.body,n,p),(d)=>d===e.body?e:v(e.method,e.url,e.urlParams,e.hash,on(tr(e.headers,d),"content-encoding",n),d))}),cs=t((e)=>zt(e[0]),(e,n,p)=>G(e,ye(n,p))),ps=t((e)=>zt(e[0]),(e,n,p)=>G(e,Yt(n,p))),fs=t(2,(e,n)=>h(Ve(n),(p)=>G(e,p))),Oi=t(2,(e,n)=>G(e,jr(n))),us=(e,n)=>{let p=Gr(e,n);return t(2,(d,m)=>h(p(m),(l)=>G(d,l)))},ds=t(2,(e,n)=>G(e,Vr(it(n)))),ms=t(2,(e,n)=>G(e,Qe(n))),ls=t(2,(e,n)=>G(e,Kr(n))),hs=t((e)=>zt(e[0]),(e,n,p)=>G(e,Kt(n,p?.contentType,p?.contentLength))),gs=t((e)=>zt(e[0]),(e,n,p)=>h(to(n,p),(d)=>G(e,d)));function ne(e){let n=re(e.url,e.urlParams,j(e.hash));if(P(n))return a(n.success);return i()}var Es=(e)=>{let n=e.method.toUpperCase();return or(v(n,"",zr,i(),Do,kt),{url:new URL(e.url),headers:e.headers,body:ys(e,n)})},ys=(e,n)=>{if(!Xe(n)||e.body===null)return kt;return Jr(e.body,{contentType:e.headers.get("content-type")??void 0,contentLength:ao(e.headers.get("content-length"))})},Ho=(e,n)=>{let p=re(e.url,e.urlParams,j(e.hash));if(E(p))return y(p.failure);let d={method:e.method,headers:e.headers};if(n?.signal)d.signal=n.signal;if(Xe(e.method))switch(e.body._tag){case"Empty":break;case"Raw":{if(d.body=e.body.body,xs(e.body.body))d.duplex="half";break}case"Uint8Array":{d.body=e.body.body;break}case"FormData":{d.body=e.body.formData;break}case"Stream":{d.body=Jo(e.body.stream,n?.context??pe()),d.duplex="half";break}}return Ke({try:()=>new Request(p.success,d),catch:(m)=>new Pe({cause:m})})},xs=(e)=>typeof ReadableStream<"u"&&e instanceof ReadableStream,Ss=(e,n)=>Xn((p)=>An(Ho(e,{context:p,signal:n?.signal})));var Tt="~effect/http/HttpIncomingMessage";var tt=(e,n)=>{let p=cn(un(e)),d=n?.reviver===void 0?void 0:cn(Z(un(e),n));return(m)=>d===void 0?u(m.json,(l)=>p(l,n)):u(m.text,(l)=>l===""?u(m.json,(x)=>p(x,n)):d(l,n))},Co=(e,n)=>{let p=mi.pipe(g(e),cn);return(d)=>u(d.urlParamsBody,(m)=>p(m,n))},Ro=(e,n)=>{let p=nr(e);return(d)=>p(d.headers,n)};var Po=(e,n)=>({...n,headers:Me(e.headers),remoteAddress:e.remoteAddress});var Be="~effect/http/HttpClientResponse/WebSource",Ae=(e)=>e["~effect/http/HttpClientResponse/WebSource"]?.();var bt="~effect/http/HttpClientResponse",ir=(e,n)=>new Mo(e,n),bs=(e)=>kr(Ae(e)),Cs=(e,n)=>{let p=cn(un(e),n),d=tt(B,n);return(m)=>u(d(m),(l)=>p({status:m.status,headers:m.headers,body:l}))},Rs=(e,n)=>{let p=cn(e,n);return(d)=>p({status:d.status,headers:d.headers})},Ts=(e)=>Dn(h(e,(n)=>n.stream)),ws=t(2,(e,n)=>{let p=e.status;if(n[p])return n[p](e);else if(p>=200&&p<300&&n["2xx"])return n["2xx"](e);else if(p>=300&&p<400&&n["3xx"])return n["3xx"](e);else if(p>=400&&p<500&&n["4xx"])return n["4xx"](e);else if(p>=500&&p<600&&n["5xx"])return n["5xx"](e);return n.orElse(e)}),cr=t(2,(e,n)=>O(()=>n(e.status)?r(e):o(new ae({reason:new Et({response:e,request:e.request,description:"invalid status code"})})))),gn=(e)=>e.status>=200&&e.status<300?r(e):o(new ae({reason:new Et({response:e,request:e.request,description:"non 2xx status code"})}));class Mo extends Hs{[Tt];[bt];request;source;constructor(e,n){super();this.request=e,this.source=n,this[Tt]=Tt,this[bt]=bt}toJSON(){return Po(this,{_id:"HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split("#")[0];let e=ne(this.request);if(A(e))return"";return e.value.hash="",e.value.href}get headers(){return Pn(this.source.headers)}cachedCookies;get cookies(){if(this.cachedCookies)return this.cachedCookies;return this.cachedCookies=No(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return i()}[Be](){return this.source}get stream(){return this.source.body?Ko({evaluate:()=>this.source.body,onError:(e)=>new ae({reason:new xt({request:this.request,response:this,cause:e})})}):Yr(new ae({reason:new Ce({request:this.request,response:this,description:"can not create stream from empty body"})}))}get json(){return u(this.text,(e)=>L({try:()=>e===""?null:JSON.parse(e),catch:(n)=>new ae({reason:new xt({request:this.request,response:this,cause:n})})}))}textBody;get text(){return this.textBody??=h(this.arrayBuffer,(e)=>new TextDecoder().decode(e))}get urlParamsBody(){return u(this.arrayBuffer,(e)=>L({try:()=>it(ea(e)),catch:(n)=>new ae({reason:new xt({request:this.request,response:this,cause:n})})}))}formDataBody;get formData(){return this.formDataBody??=xe({try:()=>this.source.formData(),catch:(e)=>new ae({reason:new xt({request:this.request,response:this,cause:e})})}).pipe(To,Oe)}arrayBufferBody;get arrayBuffer(){if(this.arrayBufferBody)return this.arrayBufferBody;return this.arrayBufferBody=xe({try:()=>this.source.arrayBuffer(),catch:(e)=>new ae({reason:new xt({request:this.request,response:this,cause:e})})}).pipe(To,Oe),this.arrayBufferBody}get upgrade(){return o(new ae({reason:new Et({request:this.request,response:this,description:"fetch cannot hand over the connection of an HTTP upgrade"})}))}pipe(){return C(this,arguments)}}var ko=(e)=>Zi({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${H(e.parent,{onNone:()=>"",onSome:(n)=>`-${n.spanId}`})}`,traceparent:`00-${e.traceId.padStart(32,"0")}-${e.spanId}-${e.sampled?"01":"00"}`});var Ps={"http:":80,"https:":443,"ws:":80,"wss:":443},jo=(e,n,p)=>{let d=an(n.search,p).slice(1);if(e.attribute("url.full",an(n.href,p)),e.attribute("url.path",n.pathname),d!=="")e.attribute("url.query",d);if(e.attribute("url.scheme",n.protocol.slice(0,-1)),n.hostname!==""){e.attribute("server.address",n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname);let m=n.port===""?Ps[n.protocol]:Number(n.port);if(m!==void 0)e.attribute("server.port",m)}},Go=(e,n)=>{let p=e.params.filter(([,d])=>typeof d!=="string").map(([d])=>d);return p.length===0?n:[...n,...new URLSearchParams(p.map((d)=>[d,""])).keys()]},pr=(e,n,p,d,m)=>{for(let l in p){if(!d(l,n))continue;e.attribute(`http.${n}.header.${l}`,Uo(l,m)?"<redacted>":p[l])}};var ur="~effect/http/HttpClient",Qo=(e)=>s(e,ur),Re=N("effect/HttpClient"),ut=(e)=>(...n)=>u(Re,(p)=>p[e](...n)),Os=ut("execute"),Bs=ut("get"),As=ut("query"),Ds=ut("head"),Ms=ut("post"),ks=ut("patch"),_s=ut("put"),Fs=ut("del"),Ns=ut("options"),ce=t(2,(e,n)=>rt(u((p)=>n(e.postprocess(r(p)),p)),e.preprocess)),Ue=t(2,(e,n)=>rt((p)=>n(e.postprocess(p)),e.preprocess)),Ls=t(2,(e,n)=>Ue(e,ot(n)));var vs=t(3,(e,n,p)=>Ue(e,(d)=>Pr(d,n,p))),qs=t(2,(e,n)=>Ue(e,Zs(n))),Js=t(3,(e,n,p)=>Ue(e,Qs(n,p))),Ws=t(3,(e,n,p)=>Ue(e,Xs(n,p))),js=t(2,(e,n)=>Ue(e,u(cr(n)))),_i=Ue(u(gn)),rt=(e,n)=>{let p=Object.create(zs);return p.preprocess=n,p.postprocess=e,p.execute=function(d){return e(n(d))},p},zs={[ur]:ur,pipe(){return C(this,arguments)},...te,toJSON(){return{_id:"effect/HttpClient"}},...Object.fromEntries(eo.map(([e,n])=>[n,function(p,d){return this.execute(K(e)(p,d))}]))},hr=(e)=>rt((n)=>u(n,(p)=>_r((d)=>{let m=ke.get(p),l=m??new AbortController,x=re(p.url,p.urlParams,j(p.hash));if(E(x))return o(new ae({reason:new He({request:p,cause:x.failure})}));let R=x.success;if(d.getRef(Gn)||d.getRef(nn)(p)){let w=e(p,R,l.signal,d);if(m)return h(w,(_)=>fr(_,l,!0));return Lt((_)=>tn(_(w),{onSuccess(S){return r(fr(S,l,!1))},onFailure(S){if(vo(S))l.abort();return dt(S)}}))}return si(d.getRef(dn)(p),{kind:"client"},(w)=>{w.attribute("http.request.method",p.method);let _=d.getRef(ui);jo(w,R,Go(p.urlParams,d.getRef(Lo)));let S=d.getRef(pn);return pr(w,"request",p.headers,S,_),p=d.getRef(fn)?hn(p,ko(w)):p,Lt((V)=>V(e(p,R,l.signal,d)).pipe(ii(w,{captureStackTrace:!1}),tn({onSuccess:(q)=>{if(w.attribute("http.response.status_code",q.status),pr(w,"response",q.headers,S,_),q.status>=400&&q.status<600)w.attribute("error.type",String(q.status)),Vs(d,w,p,q);return r(fr(q,l,m!==void 0))},onFailure(q){if(!m&&vo(q))l.abort();return dt(q)}})))})})),r),Vs=(e,n,p,d)=>{let m=Ne();oe(0);let l;try{l=Dt(new ae({reason:new Et({request:p,response:d})}))}finally{oe(m)}n.end(e.getRef(Bi)?e.getRef(Ir).currentTimeNanosUnsafe():BigInt(0),l)},Ri=t(2,(e,n)=>rt(e.postprocess,(p)=>h(e.preprocess(p),n))),Ks=t(2,(e,n)=>rt(e.postprocess,(p)=>u(e.preprocess(p),n))),aa=t(2,(e,n)=>rt(e.postprocess,(p)=>e.preprocess(n(p)))),ia=t(2,(e,n)=>rt(e.postprocess,(p)=>u(n(p),e.preprocess))),ca=t(2,(e,n)=>Ue(e,Ao(n))),pa=t(2,(e,n)=>{let p=Tr(n),d=p?"errors-and-responses":n.retryOn??"errors-and-responses",m=Aa(p?n:n.schedule??Or),l=p?void 0:n.times;return Ue(e,yo(d==="errors-only"?c:oi({schedule:m,times:l,while:Er}),d==="response-only"?c:Ao({while:p||n.while===void 0?mr:Li(mr,n.while),schedule:m,times:l})))}),fa=t(2,(e,n)=>{let p=z(n),d=`timed out after ${Jn(p)}`;return ce(e,(m,l)=>Ys(m,{duration:p,orElse:()=>o(new ae({reason:new Ct({request:l,cause:new Gs(`Operation ${d}`),description:d})}))}))}),ua=t(2,(e,n)=>{let p={initial:!0,limit:n.limit,window:Nt(z(n.window),ge(1))},d=new Map,m=n.key,l=typeof m==="function"?m:ee(m),x=n.tokens,R=typeof x==="function"?x:ee(x??1),Y=!n.disableAdaptiveLearning,w=ba(n.responseHeaders),_=(Q)=>{let J=d.get(Q);if(J!==void 0)return J;return d.set(Q,p),p},S=new Map,V=(Q)=>{let J=S.get(Q);if(J===void 0)J={sent:0,observed:0,remaining:0,resetAt:0},S.set(Q,J);return J},q=n.disableResponseInspection?void 0:(Q,J,at,wt,Le)=>{let lt=_(J),nt=Ha(lt,Q,at,wt,w);if(nt.limit!==lt.limit||!Cr(nt.window,lt.window))d.set(J,nt);let pt=Xo(at,w),X=V(J);if(pt===void 0||Le<=X.observed)return;let Vt=dr(Q,at,w);if(X.observed=Le,X.remaining=pt,Vt!==void 0)X.resetAt=Q.currentTimeMillisUnsafe()+Ee(Vt)};return ce(e,function Q(J,at,wt=0){let lt=$r().getRef(Ir),nt=l(at),pt=Math.max(R(at),1),X=V(nt),Vt=lt.currentTimeMillisUnsafe();if(X.resetAt>Vt&&X.remaining-(X.sent-X.observed)<pt)return u($t(X.resetAt-Vt),()=>Q(J,at,wt));let Cn=X.sent+=pt,ue=_(nt),yr=n.times===void 0||wt<n.times;function xr(et){return et?u($t(et),()=>Q(J,at,wt+1)):Q(J,at,wt+1)}let Sr=(et,Ot)=>{if(q?.(lt,nt,et.headers,pt,Cn),n.disableResponseInspection||et.status!==429)return r(void 0);let Qt=en(lt.currentTimeMillisUnsafe(),ie(et.headers,...w.retryAfter));if(Qt===void 0)return r(void 0);let W=dr(lt,et.headers,w)??Qt;if(Ot===void 0)return r(W);return mt(n.limiter.adaptiveFeedback({key:nt,epoch:Ot.epoch,tokens:pt,status:et.status,retryAfter:W}),W)};return u(n.limiter.consume({algorithm:n.algorithm,onExceeded:"delay",key:nt,limit:ue.limit,window:ue.window,tokens:pt}),({delay:et})=>{let Ot=()=>{let Qt=(W)=>{let br=Qn(J,{onSuccess(gt){return u(Sr(gt,W),(qe)=>{if(gt.status!==429||!yr)return r(gt);return xr(qe)})},onFailure(gt){if(Da(gt))return u(Sr(gt.reason.response,W),(qe)=>yr?xr(qe):o(gt));return o(gt)}});return W===void 0||bn(W.delay)?br:Io(br,W.delay)};if(!Y)return Qt(void 0);return u(n.limiter.adaptiveConsume({key:nt,tokens:pt,fallbackLimit:ue.limit,fallbackWindow:ue.window}),(W)=>{if(!bn(W.delay)&&W.phase==="cooldown")return u($t(W.delay),Ot);return Qt(W)})};return bn(et)?Ot():u($t(et),Ot)})})}),la=t(2,(e,n)=>{let p=n.key,d=typeof p==="function"?p:p===void 0?Ea:ee(p),m=n.classify??Yo;return ce(e,(l,x)=>n.breaker.execute(l,{key:d(x),classify:m}))}),Ea=(e)=>H(ne(e),{onNone:()=>e.url,onSome:(n)=>n.origin}),Yo=(e)=>Dr((n)=>r(ya(e,n.currentTimeMillisUnsafe()))),ya=(e,n)=>{if(fe(e)){let l=Zo(e.value.status);return l==="Failure"?Vo(lr(e.value,n)):{_tag:l}}let p=!1,d=!1,m;for(let l of e.cause.reasons){if(!Sn(l))continue;let x=Sa(l.error);if(x==="Failure"){p=!0;let R=lr(l.error,n);if(R!==void 0)m=m===void 0?R:Nt(m,R)}else if(x==="Success")d=!0}return p?Vo(m):{_tag:d?"Success":"Ignored"}},Vo=(e)=>({_tag:"Failure",retryAfter:e}),Sa=(e)=>{if(wo(e))return"Failure";if(!_t(e))return"Ignored";switch(e.reason._tag){case"TransportError":return"Failure";case"StatusCodeError":return Zo(e.reason.response.status);default:return"Ignored"}},Zo=(e)=>e===429?"Ignored":e===408||e===500||e===502||e===503||e===504?"Failure":"Success",ba=(e)=>({limit:e?.limit===void 0?["ratelimit-limit","x-ratelimit-limit"]:[e.limit.toLowerCase()],remaining:e?.remaining===void 0?["ratelimit-remaining","x-ratelimit-remaining"]:[e.remaining.toLowerCase()],reset:e?.reset===void 0?["ratelimit-reset","x-ratelimit-reset"]:[e.reset.toLowerCase()],resetAfter:e?.resetAfter===void 0?["ratelimit-reset-after","x-ratelimit-reset-after"]:[e.resetAfter.toLowerCase()],retryAfter:e?.retryAfter===void 0?["retry-after"]:[e.retryAfter.toLowerCase()]}),Ha=(e,n,p,d,m)=>{let l=Ca(e,p,d,m)??e.limit,x=dr(n,p,m)??e.window;if(l===e.limit&&Cr(x,e.window))return e;return{limit:l,window:x,initial:!1}},Ca=(e,n,p,d)=>{let m=ie(n,...d.limit),l=_e(m);if(l!==void 0&&l>0)return l;let x=Xo(n,d);if(x===void 0)return;return e.initial?x+p:Math.max(x+p,e.limit)},Xo=(e,n)=>{let p=ie(e,...n.remaining),d=_e(p);return d!==void 0&&d>=0?d:void 0},dr=(e,n,p)=>{let d=Ra(ie(n,...p.resetAfter));if(d!==void 0)return d;return Ta(e,ie(n,...p.reset))},en=(e,n)=>{if(n===void 0)return;let p=$o(n);return P(p)?Nt(Xi(p.success,e),ge(1)):void 0},Ra=(e)=>{let n=_e(e);if(n===void 0||n<=0)return;return Nt(we(n),ge(1))},Ta=(e,n)=>{let p=_e(n);if(p===void 0||p<=0)return;let d=e.currentTimeMillisUnsafe();if(p>1000000000000)return ge(Math.max(p-d,1));if(p>1e9)return ge(Math.max(p*1000-d,1));return Nt(we(p),ge(1))},_e=(e)=>{if(e===void 0)return;let n=/-?\d+(?:\.\d+)?/.exec(e);if(n===null)return;let p=Number(n[0]);return Number.isFinite(p)?p:void 0},ie=(e,...n)=>{for(let p=0;p<n.length;p++){let d=e[n[p]];if(d!==void 0)return d}return},wa=t(2,(e,n)=>Ue(e,Ge(n))),Ua=t(2,(e,n)=>Ue(e,Rr(n))),Pa=t(2,(e,n)=>rt(e.postprocess,(p)=>Ge(e.preprocess(p),n))),Ia=t(2,(e,n)=>{let p=()=>$r().getRef(Ir).currentTimeMillisUnsafe(),d=(m)=>h(Hr(n),(l)=>{let x=Vi(l,m.url,p());if(x===void 0)return m;let R=Gt(m,"cookie",x),Y=ke.get(m);if(Y!==void 0)ke.set(R,Y);return R});return rt((m)=>Ge(e.postprocess(u(m,d)),(l)=>Ur(n,Gi(l.url,l.cookies,p()))),e.preprocess)}),Mi=(e)=>ce(e,(n,p)=>{let d=new AbortController;return ke.set(p,d),In(ri(()=>I(()=>d.abort())),n)}),Oa=t((e)=>Qo(e[0]),(e,n)=>rt((p)=>{let d=(m,l)=>O(()=>{let x;return u(e.postprocess(h(m,(R)=>(x=R,R))),(R)=>{if(R.status<300||R.status>=400||!R.headers.location||l>=(n??10))return r(R);let Y=co(R.headers.location,R.request.url);if(E(Y))return r(R);let w=Y.success,_=x??R.request,S=_;if((R.status===301||R.status===302)&&_.method==="POST"||R.status===303&&_.method!=="GET"&&_.method!=="HEAD")S=Ie(S,"GET"),S=G(S,kt),S=St(S,"content-encoding"),S=St(S,"content-language"),S=St(S,"content-location");if(w.origin!==new URL(R.request.url).origin)S=St(S,"authorization"),S=St(S,"proxy-authorization"),S=St(S,"cookie");let V=w.hash===""?i():a(w.hash.slice(1));return w.hash="",S=v(S.method,w.href,zr,V,S.headers,S.body),In(I(()=>mn.get(R)?.abort()),d(r(S),l+1))})});return d(p,0)},e.preprocess)),nn=T("effect/http/HttpClient/TracerDisabledWhen",{defaultValue:()=>Jt}),pn=T("effect/http/HttpClient/TracerHeaderFilter",{defaultValue:()=>Jt}),fn=T("effect/http/HttpClient/TracerPropagationEnabled",{defaultValue:$e}),dn=T("effect/http/HttpClient/SpanNameGenerator",{defaultValue:()=>(e)=>e.method}),gr=(e)=>se(Re)(Xn((n)=>h(e,(p)=>Ue(p,ei((d)=>Zt(n,d)))))),De=(()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let n=new FinalizationRegistry((p)=>{try{p.abort()}catch{}});return{register(p,d){n.register(p,d,p)},unregister(p){n.unregister(p)}}}let e=new WeakMap;return{register(n,p){e.set(n,setTimeout(()=>p.abort(),5000))},unregister(n){let p=e.get(n);if(p===void 0)return;clearTimeout(p),e.delete(n)}}})(),ke=new WeakMap,mn=new WeakMap,fr=(e,n,p)=>{if(!p)De.register(e,n),e=new ln(e,n);return mn.set(e,n),e};class ln{original;controller;constructor(e,n){this.original=e,this.controller=n}[bt]=bt;[Tt]=Tt;applyInterrupt(e){return O(()=>(De.unregister(this.original),_o(e,()=>I(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get upgrade(){return this.applyInterrupt(this.original.upgrade)}[Be](){let e=Ae(this.original);if(e!==void 0)De.unregister(this.original);return e}get stream(){return da(()=>(De.unregister(this.original),Wo(this.original.stream,I(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[M](){return this.original[M]()}pipe(){return C(this,arguments)}}var mr=(e)=>wo(e)||Ba(e),Ba=(e)=>_t(e)&&(e.reason._tag==="TransportError"||e.reason._tag==="StatusCodeError"&&Er(e.reason.response)),lr=(e,n)=>{let p=_t(e)?e.response:s(e,bt)?e:void 0;return en(n,p?.headers["retry-after"])},Aa=(e)=>En(h(kn(e),(n)=>(p,d)=>{let m=lr(d,p);if(m===void 0)return n(p,d);return h(n(p,d),([l,x])=>[l,Nt(x,m)])})),Da=(e)=>_t(e)&&e.reason._tag==="StatusCodeError"&&e.reason.response.status===429,Er=(e)=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504;var Pt=T("effect/http/FetchHttpClient/Fetch",{defaultValue:()=>globalThis.fetch}),Hn=T("effect/http/FetchHttpClient/StreamBodyFallback",{defaultValue:()=>"error"});class mo extends N()("effect/http/FetchHttpClient/RequestInit"){}var xn,Ma=()=>{try{let e=!1,n=new ReadableStream,p=new Request("https://example.com",{method:"POST",body:n,get duplex(){return e=!0,"half"}});return(e||p.body===n)&&!p.headers.has("Content-Type")}catch{return!1}},ka=hr((e,n,p,d)=>{if(e.headers.upgrade!==void 0)return o(new ae({reason:new Ct({request:e,description:"fetch cannot send an HTTP upgrade request"})}));let m=d.getRef(Pt),l=yn(d.context,mo)??{},x=l.headers?Qi(Pn(l.headers),e.headers):e.headers;if(x["content-length"])x=jt(x,"content-length");let R,Y=I(()=>R?.abort()),w=(_)=>h(xe({try:()=>m(n,{...l,method:e.method,headers:x,body:_,duplex:typeof ReadableStream<"u"&&_ instanceof ReadableStream?"half":void 0,signal:R?AbortSignal.any([p,R.signal]):p}),catch:(S)=>new ae({reason:new Ct({request:e,cause:S})})}),(S)=>{let V=ir(e,S);if(!R)return V;if(S.body===null)R.abort();return Object.create(V,{...Object.fromEntries(["arrayBuffer","text","json","formData","urlParamsBody"].map((q)=>[q,{get:()=>rn(V[q],Y)}])),stream:{get:()=>Wo(V.stream,Y)}})}).pipe(It(()=>Y));switch(e.body._tag){case"Raw":case"Uint8Array":return w(e.body.body);case"FormData":return w(e.body.formData);case"Stream":{if(xn??=Ma(),xn){R=new AbortController;let _=AbortSignal.any([p,R.signal]),S=Ut((V)=>{let q=()=>V(Oo);if(_.aborted){q();return}return _.addEventListener("abort",q,{once:!0}),I(()=>_.removeEventListener("abort",q))});return u(xa(ma(e.body.stream,S)),w)}if(d.getRef(Hn)==="error")return o(new ae({reason:new Xt({request:e,description:"Streaming request bodies are not supported in this runtime"})}));return ha(e.body.stream).pipe(st((_)=>new ae({reason:new Xt({request:e,cause:_})})),u(w))}}return w(void 0)}),ho=gr(r(ka));export{ae,vr,Us,Ii,hn,Ti,wr,Oi,po,tt,gn,fo,Re,Ue,_i,Ri,Mi,$s,Pt,mo,ho,Ni};
|
package/chunk-r1adn0ka.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{Xe,fn,wt,_,Et,gs,ao,dn,mn,Tt,dr,mr}from"./chunk-gcqbk8bn.js";import{_t}from"./chunk-jpqmm6pm.js";import{Ce,J,Se,K}from"./chunk-6xs4y82y.js";import{be,He}from"./chunk-x65p26st.js";import{lt,Ot,et}from"./chunk-yb3fn5r1.js";import{qe}from"./chunk-bcmj4f7y.js";import{ue}from"./chunk-9zpe1ry1.js";import{k,j,I,L,Ie,Oe,R,W,b,e,V,v,n,x,l,D,Ze,Z}from"./chunk-9dgq3xc0.js";var ls={};k(ls,{DeepSeekHarness:()=>ls,MCP_SERVICE:()=>$n,REALM:()=>rs,Route:()=>gi,SERVICE:()=>ro,TOKEN:()=>no,Unreadable:()=>Ln,checks:()=>is,defaultModel:()=>xi,invokedSkills:()=>as,manifest:()=>pn,manifestFile:()=>oo,mcpConfig:()=>ss,paths:()=>va,refresh:()=>cs,remove:()=>wa,routes:()=>os});import{createHash as z}from"node:crypto";import{existsSync as B,readdirSync as U,rmSync as Y}from"node:fs";import G from"node:os";import y from"node:path";function va(s=process.env,t=G.homedir(),o=process.platform){let r=s.DSH_HOME?.trim(),i=r!==void 0&&(r.startsWith("~/")||o==="win32"&&r.startsWith("~\\")),a=y.resolve(r?r==="~"?t:i?y.join(t,r.slice(2)):r:t,r?"":".dsh");return{home:a,patch:y.join(a,"cordis.patch.yml"),skills:y.join(a,"skills")}}var no="OPENCODE_CONSOLE_TOKEN",rs="opencode-console",ro="opencodeConsole",$n="opencodeConsoleMcp",gi=n({displayName:e,api:D(["anthropic-messages","openai-responses","openai-completions"]),baseURL:e,apiKeyEnv:e,headers:x(e,e),compat:b(n({supportsDeveloperRole:v,maxTokensField:e})),models:l(n({id:e,name:e,contextWindow:b(V),maxTokens:b(V),input:l(D(["text","image"]))}))}),P={messages:"anthropic-messages",responses:"openai-responses","chat-completions":"openai-completions"};function os(s){let t=Tt(s),o=mr(t),r=Map.groupBy(t,(i)=>i.provider);return Object.fromEntries([...r].flatMap(([i,a])=>{let p=a.map(Q),u=p[0],g=u!==void 0&&p.every((m)=>m?.api===u.api&&m.url===u.url);if(!g&&o===void 0)return[];let w=g?u.api:"anthropic-messages",f={displayName:s[i]?.name??i,api:w,baseURL:g?w==="anthropic-messages"?u.url.replace(/\/v1\/?$/,""):u.url:`${o}/anthropic`,apiKeyEnv:no,headers:{"x-opencode-plugin":`opencode-console/${ue}`},...w==="openai-completions"?{compat:{supportsDeveloperRole:!1,maxTokensField:"max_tokens"}}:{},models:a.map((m)=>X(m,g||i==="opencode"?m.id:`${i}/${m.id}`))};return[[i,f]]}))}function xi(s){let t=Tt(s),o=dr(t,"sonnet","opus","haiku");if(!o)return;let i=os(s)[o.provider]?.models.find((a)=>a.id===o.id||a.id===`${o.provider}/${o.id}`)?.id;return i===void 0?void 0:{provider:o.provider,model:i}}function Q(s){let t=_(s.entry.api),o=Object.keys(P).find((i)=>(i in t)),r=o&&Et(_(t[o]).base_url);return o&&r?{api:P[o],url:r}:void 0}function X(s,t){let o=_(s.entry.limit),r=_(s.entry.modalities).input;return{id:t,name:Et(s.entry.name)??s.id,...C(o.context)===void 0?{}:{contextWindow:C(o.context)},...C(o.output)===void 0?{}:{maxTokens:C(o.output)},input:Array.isArray(r)&&r.some((i)=>typeof i==="string"&&i.startsWith("image"))?["text","image"]:["text"]}}function C(s){return typeof s==="number"&&Number.isFinite(s)&&s>0?s:void 0}function ss(s,t){if(!t)throw Error(`The workspace doesn't offer the MCP server ${s} anymore`);return{serverName:s,transport:"streamable-http",url:t.url,...t.headers?{headers:{...t.headers}}:{}}}class Ln extends Error{}async function is(s,t){let o=_(s.input),r=s.name,i=(c,d,S={})=>({action:c,resources:d,directory:t.directory,...S}),a=(c)=>{let d=o[c];return typeof d==="string"&&d!==""?d:void 0},p=(c)=>{let d=a(c);if(d===void 0)throw new Ln(`${r}'s input has no ${c}`);return d},u=(c)=>t.resolve(p(c)),g=(c)=>{let d=t.skills&&ee(t.skills,c);return d?i("skill",[d]):i("read",[c])},w=async(c)=>{let d=a(c);return d===void 0?{}:{directories:[await t.resolve(d)]}},f=(c,d={})=>i("shell",[c??""],{opaque:!0,...d}),m=async()=>i("subagent",[(a("agent_preset")??a("name")??a("runtime")??"general").toLowerCase()],await w("cwd"));if(r.startsWith("mcp__"))return ne(r,t.servers??[]).map((c)=>i(c.action,c.resources,c));switch(r){case"bash":case"pwsh":{let c=a("workdir");return[i("shell",[p("command")],{shell:r==="pwsh"?"pwsh":"bash",path:c===void 0?t.cwd:await t.resolve(c)})]}case"read":case"read_image":case"lsp":return[g(await u("file_path"))];case"write":case"edit":return[i("edit",[await u("file_path")])];case"apply_patch":{let c=te(p("input"));if(c.length===0)throw new Ln("apply_patch's input names no file");return[i("edit",await Promise.all(c.map(t.resolve)))]}case"str_replace_editor":return p("command")==="view"?[g(await u("path"))]:[i("edit",[await u("path")])];case"glob":case"grep":{let c=a("path");return[i(r,[p("pattern")],{path:c===void 0?t.cwd:await t.resolve(c)})]}case"web_fetch":return[i("webfetch",[p("url")])];case"web_search":{let c=Array.isArray(o.queries)?o.queries.filter((S)=>typeof S==="string"&&S!==""):[],d=c.length>0?c:[a("query")].flatMap((S)=>S??[]);if(d.length===0)throw new Ln("web_search's input has no queries");return[i("websearch",d)]}case"subagent":case"subagent_fork":case"spawn_teammate":case"ralph":return[await m()];case"subagent_oar":return[await m(),f(a("prompt"))];case"workflow":return[f(a("script")),i("subagent:",["*"],{truncated:!0})];case"run_code":return[f(a("code"))];case"terminal_send":return[f(a("text"))];case"terminal_open":{let c=a("cwd");return[f(a("type"),c===void 0?{}:{path:await t.resolve(c)})]}case"ask_user_question":return[i("question",["*"])];case"working_directory":return a("cd")===void 0?[]:[i("working_directory",["*"],await w("cd"))];case"skill":return[i("skill",[p("name")])];case"read_mcp_resource":case"list_mcp_resources":case"list_mcp_resource_templates":return[i("mcp.use",[p("server")])];default:return[i(r.toLowerCase(),["*"])]}}function ee(s,t){let o=y.relative(s,t);if(o===""||o.startsWith("..")||y.isAbsolute(o))return;return o.split(y.sep)[0]}function ne(s,t){let r=t.filter((a)=>s.startsWith(`mcp__${a}__`)).toSorted((a,p)=>p.length-a.length)[0]??s.match(/^mcp__(.+?)__./)?.[1];if(!r)throw new Ln(`Can't tell which MCP server ${s} belongs to`);let i=s.slice(`mcp__${r}__`.length);return[{action:"mcp.use",resources:[r]},/_[0-9a-f]{12}$/.test(s)?{action:`${r}_`,resources:["*"],truncated:!0}:{action:`${r}_${i}`,resources:["*"]}]}function te(s){return s.split(/\r?\n/).flatMap((t)=>{let o=t.trim().match(/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/)?.[1]?.trim();return o?[o]:[]})}function as(s){let t=s.flatMap((o)=>_(o.source).kind!=="user"||!Array.isArray(o.content)?[]:o.content.flatMap((r)=>{let i=_(r);return i.type==="text"&&typeof i.text==="string"?Array.from(i.text.matchAll(/(^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)(?=\s|$)/g),(a)=>a[2]):[]}));return[...new Set(t)]}var N="# opencode-console:start",T="# opencode-console:end",re=n({provider:e,model:e}),F=n({paths:n({home:e,patch:e,skills:e}),plugin:e,harness:b(e),created:v,skills:x(e,e),providers:b(e),routes:b(x(e,gi)),model:b(Ze(re))}),oo=(s)=>y.join(s.data,"deepseek-harness.json");function pn(s){let t=oo(s),o=J(t);if(o===void 0)return;let r=j(W(Z(F))(o));if(!r)throw Error(`${t} can't be read, so DeepSeek Harness was left as it is. Delete it and run setup again.`);return r}var cs=R("DeepSeekHarness.refresh")(function*(s,t){let o=pn(s),r=t??o;if(!r)return;let i=yield*He(s),a=i&&qe(s,be(i));if(!i||!a?.config)return;let p=a.config,u=Ot(a),g=z("sha256").update(JSON.stringify(p.providers??null)).digest("hex"),f=!t&&o?.providers===g&&o.routes!==void 0?void 0:yield*_t(i),m=yield*dn(i,r.paths.skills,u,o?.skills??{});return yield*Ce(s,I(()=>oe(s,{paths:r.paths,plugin:r.plugin,harness:t?t.harness:o?.harness,routes:f?os(f):o?.routes??{},model:f?xi(f):o?.model??void 0,servers:et(a),instructions:lt(a).length,skills:u,bundles:m,providers:g})))});function wa(s){let t=pn(s);if(!t)return!1;let o=J(t.paths.patch);if(o!==void 0){let r=H(o),i=r.after===""?r.before.replace(/\n+$/,`
|
|
2
|
-
`):`${r.before}${r.after}`,a=i.split(`
|
|
3
|
-
`).every((p)=>p.trim()===""||p.trimStart().startsWith("#"));if(a&&t.created)K(t.paths.patch);else if(r.marked)wt(t.paths.patch,a?`${i.trimEnd()}${i.trim()===""?"":`
|
|
4
|
-
`}[]
|
|
5
|
-
`:i)}return Object.keys(t.skills).forEach((r)=>Y(y.join(t.paths.skills,r),{recursive:!0,force:!0})),K(Xe(t.paths.patch)),K(oo(s)),!0}function oe(s,t){let o=pn(s),r=J(t.paths.patch),i=H(r??""),a=se(t.paths.patch,i),p=o?.created??r===void 0,u=[],g=(h)=>{let A=a.rows.some((E)=>E.id===h&&E.insert===void 0&&E.config!==void 0);if(A)u.push(`the ${h} row in ${t.paths.patch}`);return!A},w=Object.entries(t.servers).filter(([h])=>/^[A-Za-z0-9_-]{1,32}$/.test(h)),f=Object.keys(t.routes).length>0&&g("llm-pi-ai"),m=f&&t.model&&g("agent-default-model")?t.model:void 0,c=[{insert:[{id:"opencode-console",name:t.plugin,isolate:{credentials:rs}},...w.map(([h])=>({id:`opencode-console-mcp-${h}`,name:"@deepseek-ai/dsh-mcp-client",inject:[$n],config:`__opencode_console_mcp__:${h}`}))]},{id:"agent-loop",inject:ie(a.rows)},...f?[{id:"llm-pi-ai",isolate:{credentials:rs},config:{providers:t.routes}}]:[],...m?[{id:"agent-default-model",config:m}]:[]],d=[`${N} (written by \`npx @opencode/console setup deepseek-harness\`, which replaces this block on every sync; --remove takes it out)`,...c.map((h)=>`- ${JSON.stringify(h).replace(/"config":"__opencode_console_mcp__:([A-Za-z0-9_-]+)"/g,(A,E)=>`"config": !!js "ctx.${$n}.server('${E}')"`)}`),T].join(`
|
|
6
|
-
`),S=i.marked?`${a.before}${d}
|
|
7
|
-
${i.after}`:`${[a.before.trimEnd(),d].filter((h)=>h!=="").join(`
|
|
8
|
-
|
|
9
|
-
`)}
|
|
10
|
-
`;if(O(t.paths.patch,S).length!==a.rows.length+c.length)throw Error(`${t.paths.patch} couldn't take setup's rows, so it was left alone. Fix it and run setup again.`);if(!o)fn(t.paths.patch);if(S!==r)wt(t.paths.patch,S,384);let M=mn(t.paths.skills,t.skills,t.bundles,o?.skills??{},{named:!0});return u.push(...M.skipped),Se(oo(s),JSON.stringify(F.make({paths:t.paths,plugin:t.plugin,...t.harness===void 0?{}:{harness:t.harness},created:p,skills:M.skills,providers:t.providers,routes:{...t.routes},model:t.model??null}))),{routes:f?t.routes:{},model:m,servers:w.map(([h])=>h),skills:Object.keys(M.skills),instructions:t.instructions,skipped:u,shadowed:f?ae(t.paths.home):[]}}var q={tag:"tag:yaml.org,2002:js",resolve:(s)=>s};function H(s){let t=s.match(new RegExp(`^${N}[^\\n]*\\n[\\s\\S]*?^${T}[^\\n]*(?:\\n|$)`,"m"));if(!t||t.index===void 0)return{before:s,after:"",marked:!1};return{before:s.slice(0,t.index),after:s.slice(t.index+t[0].length),marked:!0}}function O(s,t){let o=ao(t,{customTags:[q]});if(o.errors.length>0||o.warnings.length>0)throw Error(`${s} isn't YAML DeepSeek Harness reads, so it was left alone. Fix it and run setup again.`);let r=o.toJS();if(r===null||r===void 0)return[];if(!Array.isArray(r))throw Error(`${s} isn't a YAML list of patch rows, so it was left alone. Fix it and run setup again.`);return r.map((i)=>_(i))}function se(s,t){let o=`${t.before}${t.after}`,r=O(s,o),i=ao(o,{customTags:[q]}).contents;if(!gs(i)||!i.flow)return{rows:r,before:t.before};if(r.length>0)throw Error(`${s} lists its rows in flow style ([...]), so it was left alone. Write them as a block list.`);return{rows:r,before:t.before.replace(/^\s*\[\s*\][ \t]*\n?/m,"")}}function ie(s){let o=s.filter((r)=>r.id==="agent-loop"&&r.insert===void 0).map((r)=>r.inject).flatMap((r)=>Array.isArray(r)?r.filter((i)=>typeof i==="string"):Object.keys(_(r)));return[...new Set([...o,ro])]}function ae(s){let t=y.join(s,"profiles");if(!B(t))return[];return U(t,{withFileTypes:!0}).filter((o)=>o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules").map((o)=>o.name).filter((o)=>{let r=y.join(t,o,"cordis.patch.yml");return Oe(L(()=>O(r,J(r)??"").some((i)=>i.id==="llm-pi-ai"&&i.insert===void 0&&i.config!==void 0)).pipe(Ie(()=>!1)))})}
|
|
11
|
-
export{va,no,rs,ro,$n,gi,os,xi,ss,Ln,is,as,oo,pn,cs,wa,ls};
|
package/chunk-tamzaefd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{xs,Si,ys,qe,bs}from"./chunk-bcmj4f7y.js";import"./chunk-yb3fn5r1.js";import"./chunk-x65p26st.js";import"./chunk-11wqcgnn.js";import"./chunk-jpqmm6pm.js";import"./chunk-qp7a49b3.js";import"./chunk-6xs4y82y.js";import"./chunk-m3m5harb.js";export{bs as WorkspaceSync,qe as current,xs as identify,ys as sync,Si as userAgent};
|
package/chunk-x65p26st.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{As,yr,Is,Ts,lo,Fs}from"./chunk-jpqmm6pm.js";import{xn,Kt,Ce,J,Se,K}from"./chunk-6xs4y82y.js";import{k,j,we,Ct,I,G,h,en,Mr,Wi,R,Ur,W,Z}from"./chunk-9dgq3xc0.js";var ks={};k(ks,{ConsoleCredentials:()=>ks,fresh:()=>He,login:()=>ka,logout:()=>Ca,organization:()=>Bn,owner:()=>be,read:()=>ke,stored:()=>co});import{createHash as c}from"node:crypto";var d=W(Z(yr)),f=300000;function ke(e){let n=e.env.OPENCODE_API_KEY;if(!n)return co(e);let o=e.env.OPENCODE_CONSOLE_SERVER?.trim();if(!o)return{type:"key",server:As,key:n};let r=Fs(o);if(!r)throw Error(`OPENCODE_CONSOLE_SERVER isn't a Console URL: ${o}. Use an https:// URL, or http:// only for localhost.`);return{type:"key",server:r,key:n}}function co(e){let n=i(e);if(n.corrupt)throw Error(`The sign-in in ${xn(e)} can't be read. Run \`npx @opencode/console login\` to replace it or \`npx @opencode/console logout\` to remove it.`);return n.credential}function be(e){return JSON.stringify([e.server,e.type==="key"?c("sha256").update(e.key).digest("hex").slice(0,16):e.accountID,e.type==="oauth"?e.orgID:void 0])}function Bn(e){return e.type==="oauth"?e.orgName:void 0}var ka=R("ConsoleCredentials.login")(function*(e,n){let o=yield*Is(n.server);yield*n.prompt(o);let r=yield*o.callback,t=yield*Ce(e,I(()=>{let l=i(e).credential;if(Se(xn(e),JSON.stringify(r)),!l||be(l)!==be(r))K(Kt(e));return l}));if(t)yield*lo(t).pipe(en);return r}),He=R("ConsoleCredentials.fresh")(function*(e){let n=ke(e);if(!n||n.type==="key"||!(yield*s(n)))return n;let o=yield*Ce(e,G(function*(){let r=co(e);if(!r||!(yield*s(r)))return r;let t=yield*Ts(r).pipe(Mr(we(30)));if(i(e).credential?.refresh!==r.refresh)return co(e);return Se(xn(e),JSON.stringify(t)),t})).pipe(Wi);return yield*Ur(o)}),Ca=R("ConsoleCredentials.logout")(function*(e){let n=yield*Ce(e,I(()=>{let o=i(e).credential;return K(xn(e)),K(Kt(e)),o}));if(!n)return!1;return yield*lo(n).pipe(en),!0});function s(e){return Ct.pipe(h((n)=>e.expires-f<=n))}function i(e){let n=J(xn(e));if(n===void 0)return{};let o=j(d(n));return o?{credential:o}:{corrupt:!0}}
|
|
2
|
-
export{ke,co,be,Bn,ka,He,Ca,ks};
|
package/chunk-yb3fn5r1.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{zt}from"./chunk-11wqcgnn.js";import{Kt,J,Se,K}from"./chunk-6xs4y82y.js";import{Bn}from"./chunk-x65p26st.js";import{k,rt,j,W,b,B,e,V,n,x,l,Z}from"./chunk-9dgq3xc0.js";var Es={};k(Es,{Info:()=>wi,MAX_AGE_MS:()=>vi,WorkspaceSnapshot:()=>Es,clear:()=>ws,instructions:()=>lt,models:()=>Ea,policies:()=>Ei,read:()=>Ss,servers:()=>et,skills:()=>Ot,stale:()=>hr,workspace:()=>gr,write:()=>vs});var vi=60000,wi=n({owner:e,organization:b(e),fetched:V,config:b(x(e,B)),instructions:b(l(n({name:e,content:e}))),skills:b(l(n({slug:e,version:e}))),status:b(n({message:e,url:b(e)}))}),s=W(Z(wi)),c=x(e,n({models:b(x(e,B))})),f=n({servers:x(e,n({type:e,url:b(e),headers:b(x(e,e))}))});function Ss(o){return j(s(J(Kt(o))??""))}function vs(o,t){Se(Kt(o),JSON.stringify(t))}function ws(o){K(Kt(o))}function hr(o,t){return t-o.fetched>=vi}function Ei(o){if(!o)return;let t=o.config;if(!t)return o.status?void 0:[];if(t.policies===void 0)return[];return j(W(zt.Policies)(t.policies))}function gr(o,t){if(!o)return{policies:[]};return{organization:t?.organization??Bn(o),policies:Ei(t),status:t?.status}}function lt(o){return o?.instructions??[]}function Ot(o){return(o?.skills??[]).filter((t)=>/^[a-z0-9][a-z0-9._-]*$/i.test(t.slug)&&t.slug.toLowerCase()!=="synced")}function et(o){let t=rt(W(f)(o?.config?.mcp),()=>({servers:{}})).servers;return Object.fromEntries(Object.entries(t).flatMap(([i,r])=>r.type==="remote"&&r.url!==void 0?[[i,{url:r.url,headers:r.headers}]]:[]))}function Ea(o){let t=o?.config?.providers;if(t===void 0)return 0;return Object.values(rt(W(c)(t),()=>({}))).reduce((i,r)=>i+Object.keys(r.models??{}).length,0)}
|
|
2
|
-
export{vi,wi,Ss,vs,ws,hr,Ei,gr,lt,Ot,et,Ea,Es};
|