@augmentcode/onison 1.1.0-prerelease.202608120229 → 1.1.0-prerelease.202608120522
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/auggie-v2.mjs +2 -2
- package/package.json +1 -1
package/auggie-v2.mjs
CHANGED
|
@@ -613,7 +613,7 @@ GFS4: `),console.error(t)});cg[by]||(sXr=global[by]||[],aXr(cg,sXr),cg.close=(fu
|
|
|
613
613
|
`)return`
|
|
614
614
|
`}return t&&t.eol||`
|
|
615
615
|
`}function $ve(t,e){return`\r
|
|
616
|
-
`.indexOf(t.charAt(e))!==-1}var e$t=b(()=>{"use strict";zKe();DXr()});function QXr(t,e=[],n=Kve.DEFAULT){let r=null,i=[],s=[];function o(l){Array.isArray(i)?i.push(l):r!==null&&(i[r]=l)}return XKe(t,{onObjectBegin:()=>{let l={};o(l),s.push(i),i=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let l=[];o(l),s.push(i),i=l,r=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:o,onError:(l,c,u)=>{e.push({error:l,offset:c,length:u})}},n),i[0]}function t$t(t,e=[],n=Kve.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){r.type==="property"&&(r.length=l-r.offset,r=r.parent)}function s(l){return r.children.push(l),l}XKe(t,{onObjectBegin:l=>{r=s({type:"object",offset:l,length:-1,parent:r,children:[]})},onObjectProperty:(l,c,u)=>{r=s({type:"property",offset:c,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:l,offset:c,length:u,parent:r})},onObjectEnd:(l,c)=>{i(l+c),r.length=l+c-r.offset,r=r.parent,i(l+c)},onArrayBegin:(l,c)=>{r=s({type:"array",offset:l,length:-1,parent:r,children:[]})},onArrayEnd:(l,c)=>{r.length=l+c-r.offset,r=r.parent,i(l+c)},onLiteralValue:(l,c,u)=>{s({type:gpa(l),offset:c,length:u,parent:r,value:l}),i(c+u)},onSeparator:(l,c,u)=>{r.type==="property"&&(l===":"?r.colonOffset=c:l===","&&i(c))},onError:(l,c,u)=>{e.push({error:l,offset:c,length:u})}},n);let a=r.children[0];return a&&delete a.parent,a}function JKe(t,e){if(!t)return;let n=t;for(let r of e)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let i=!1;for(let s of n.children)if(Array.isArray(s.children)&&s.children[0].value===r&&s.children.length===2){n=s.children[1],i=!0;break}if(!i)return}else{let i=r;if(n.type!=="array"||i<0||!Array.isArray(n.children)||i>=n.children.length)return;n=n.children[i]}return n}function XKe(t,e,n=Kve.DEFAULT){let r=Zve(t,!1),i=[],s=0;function o(M){return M?()=>s===0&&M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(M){return M?H=>s===0&&M(H,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(M){return M?H=>s===0&&M(H,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function c(M){return M?()=>{s>0?s++:M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(s=1)}:()=>!0}function u(M){return M?()=>{s>0&&s--,s===0&&M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=c(e.onObjectBegin),p=l(e.onObjectProperty),A=u(e.onObjectEnd),g=c(e.onArrayBegin),m=u(e.onArrayEnd),f=l(e.onLiteralValue),h=a(e.onSeparator),E=o(e.onComment),y=a(e.onError),C=n&&n.disallowComments,S=n&&n.allowTrailingComma;function v(){for(;;){let M=r.scan();switch(r.getTokenError()){case 4:_(14);break;case 5:_(15);break;case 3:_(13);break;case 1:C||_(11);break;case 2:_(12);break;case 6:_(16);break}switch(M){case 12:case 13:C?_(10):E();break;case 16:_(1);break;case 15:case 14:break;default:return M}}}function _(M,H=[],X=[]){if(y(M),H.length+X.length>0){let $=r.getToken();for(;$!==17;){if(H.indexOf($)!==-1){v();break}else if(X.indexOf($)!==-1)break;$=v()}}}function R(M){let H=r.getTokenValue();return M?f(H):(p(H),i.push(H)),v(),!0}function B(){switch(r.getToken()){case 11:let M=r.getTokenValue(),H=Number(M);isNaN(H)&&(_(2),H=0),f(H);break;case 7:f(null);break;case 8:f(!0);break;case 9:f(!1);break;default:return!1}return v(),!0}function F(){return r.getToken()!==10?(_(3,[],[2,5]),!1):(R(!1),r.getToken()===6?(h(":"),v(),D()||_(4,[],[2,5])):_(5,[],[2,5]),i.pop(),!0)}function Q(){d(),v();let M=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(M||_(4,[],[]),h(","),v(),r.getToken()===2&&S)break}else M&&_(6,[],[]);F()||_(4,[],[2,5]),M=!0}return A(),r.getToken()!==2?_(7,[2],[]):v(),!0}function P(){g(),v();let M=!0,H=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(H||_(4,[],[]),h(","),v(),r.getToken()===4&&S)break}else H&&_(6,[],[]);M?(i.push(0),M=!1):i[i.length-1]++,D()||_(4,[],[4,5]),H=!0}return m(),M||i.pop(),r.getToken()!==4?_(8,[4],[]):v(),!0}function D(){switch(r.getToken()){case 3:return P();case 1:return Q();case 10:return R(!0);default:return B()}}return v(),r.getToken()===17?n.allowEmptyContent?!0:(_(4,[],[]),!1):D()?(r.getToken()!==17&&_(9,[],[]),!0):(_(4,[],[]),!1)}function gpa(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}var Kve,n$t=b(()=>{"use strict";zKe();(function(t){t.DEFAULT={allowTrailingComma:!1}})(Kve||(Kve={}))});function MXr(t,e,n,r){let i=e.slice(),o=t$t(t,[]),a,l;for(;i.length>0&&(l=i.pop(),a=JKe(o,i),a===void 0&&n!==void 0);)typeof l=="string"?n={[l]:n}:n=[n];if(a)if(a.type==="object"&&typeof l=="string"&&Array.isArray(a.children)){let c=JKe(a,[l]);if(c!==void 0)if(n===void 0){if(!c.parent)throw new Error("Malformed AST");let u=a.children.indexOf(c.parent),d,p=c.parent.offset+c.parent.length;if(u>0){let A=a.children[u-1];d=A.offset+A.length}else d=a.offset+1,a.children.length>1&&(p=a.children[1].offset);return vX(t,{offset:d,length:p-d,content:""},r)}else return vX(t,{offset:c.offset,length:c.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let u=`${JSON.stringify(l)}: ${JSON.stringify(n)}`,d=r.getInsertionIndex?r.getInsertionIndex(a.children.map(A=>A.children[0].value)):a.children.length,p;if(d>0){let A=a.children[d-1];p={offset:A.offset+A.length,length:0,content:","+u}}else a.children.length===0?p={offset:a.offset+1,length:0,content:u}:p={offset:a.offset+1,length:0,content:u+","};return vX(t,p,r)}}else if(a.type==="array"&&typeof l=="number"&&Array.isArray(a.children)){let c=l;if(c===-1){let u=`${JSON.stringify(n)}`,d;if(a.children.length===0)d={offset:a.offset+1,length:0,content:u};else{let p=a.children[a.children.length-1];d={offset:p.offset+p.length,length:0,content:","+u}}return vX(t,d,r)}else if(n===void 0&&a.children.length>=0){let u=l,d=a.children[u],p;if(a.children.length===1)p={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===u){let A=a.children[u-1],g=A.offset+A.length,m=a.offset+a.length;p={offset:g,length:m-2-g,content:""}}else p={offset:d.offset,length:a.children[u+1].offset-d.offset,content:""};return vX(t,p,r)}else if(n!==void 0){let u,d=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>l){let p=a.children[l];u={offset:p.offset,length:p.length,content:d}}else if(a.children.length===0||l===0)u={offset:a.offset+1,length:0,content:a.children.length===0?d:d+","};else{let p=l>a.children.length?a.children.length:l,A=a.children[p-1];u={offset:A.offset+A.length,length:0,content:","+d}}return vX(t,u,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${c} as length is not sufficient`)}else throw new Error(`Can not add ${typeof l!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return vX(t,{offset:o?o.offset:0,length:o?o.length:0,content:JSON.stringify(n)},r)}}function vX(t,e,n){if(!n.formattingOptions)return[e];let r=ZKe(t,e),i=e.offset,s=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!$ve(r,i-1);)i--;for(;s<r.length&&!$ve(r,s);)s++}let o=qZt(r,{offset:i,length:s-i},{...n.formattingOptions,keepLines:!1});for(let l=o.length-1;l>=0;l--){let c=o[l];r=ZKe(r,c),i=Math.min(i,c.offset),s=Math.max(s,c.offset+c.length),s+=c.content.length-c.length}let a=t.length-(r.length-s)-i;return[{offset:i,length:a,content:r.substring(i,s)}]}function ZKe(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var FXr=b(()=>{"use strict";e$t();n$t()});function VXr(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function WXr(t,e,n,r){return MXr(t,e,n,r)}function YXr(t,e){let n=e.slice(0).sort((i,s)=>{let o=i.offset-s.offset;return o===0?i.length-s.length:o}),r=t.length;for(let i=n.length-1;i>=0;i--){let s=n[i];if(s.offset+s.length<=r)t=ZKe(t,s);else throw new Error("Overlapping edit");r=s.offset}return t}var OXr,PXr,UXr,GXr,LXr,HXr=b(()=>{"use strict";e$t();FXr();zKe();n$t();(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(OXr||(OXr={}));(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(PXr||(PXr={}));UXr=QXr,GXr=XKe;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(LXr||(LXr={}))});var Iy=b(()=>{Qbe();Qbe()});var zXr,hpa,Epa,ypa,Cpa,bpa,Ipa,Spa,JXr,XXr=b(()=>{"use strict";Iy();zXr=t=>t===null?"null":Array.isArray(t)?"an array":`a ${typeof t}`,hpa=t=>{try{return new RegExp(t),!0}catch{return!1}},Epa=Rn.discriminatedUnion("type",[Rn.object({type:Rn.enum(["allow","deny","ask-user"])}),Rn.object({type:Rn.literal("webhook-policy"),webhookUrl:Rn.url({error:'"permission.webhookUrl" must be a valid URL for a "webhook-policy".'})}),Rn.object({type:Rn.literal("script-policy"),script:Rn.string({error:'"permission.script" must be a non-empty string for a "script-policy".'}).min(1,{error:'"permission.script" must be a non-empty string for a "script-policy".'})})],{error:'unknown or invalid "permission".'}),ypa=Rn.object({toolName:Rn.string({error:'"toolName" must be a non-empty string.'}).min(1,{error:'"toolName" must be a non-empty string.'}),permission:Epa,eventType:Rn.enum(["tool-call","tool-response"],{error:'"eventType" must be "tool-call" or "tool-response" when present.'}).optional(),shellInputRegex:Rn.string({error:'"shellInputRegex" must be a string when present.'}).refine(hpa,{error:'"shellInputRegex" must be a valid regular expression when present.'}).optional()},{error:t=>`rule must be an object, got ${zXr(t.input)}.`}),Cpa=t=>{let e=t.issues[0];if(e===void 0)return"invalid rule.";let n=e.message.endsWith(".")?e.message:`${e.message}.`;return e.path.length===0||n.startsWith('"')?n:`"${e.path.join(".")}": ${n}`},bpa='Expected { "toolName": string, "permission": { "type": "allow" | "deny" | "ask-user" } | { "type": "webhook-policy", "webhookUrl": string } | { "type": "script-policy", "script": string }, "eventType"?: "tool-call" | "tool-response", "shellInputRegex"?: string }.',Ipa=t=>{let e=t.toolPermissions;if(e===void 0)return[];if(!Array.isArray(e))return t.toolPermissions=void 0,[`Ignoring "toolPermissions": expected an array of rules, got ${zXr(e)}.`];let n=[],r=[];for(let i=0;i<e.length;i++){let s=ypa.safeParse(e[i]);s.success?r.push(e[i]):n.push(`Dropping invalid "toolPermissions" rule at index ${i}: ${Cpa(s.error)} ${bpa}`)}return n.length>0&&(t.toolPermissions=r),n},Spa=t=>{if("queueMode"in t&&!("steeringMode"in t)&&(t.steeringMode=t.queueMode,t.queueMode=void 0),!("transport"in t)&&typeof t.websockets=="boolean"&&(t.transport=t.websockets?"websocket":"sse",t.websockets=void 0),"skills"in t&&typeof t.skills=="object"&&t.skills!==null&&!Array.isArray(t.skills)){let e=t.skills;e.enableSkillCommands!==void 0&&t.enableSkillCommands===void 0&&(t.enableSkillCommands=e.enableSkillCommands),Array.isArray(e.customDirectories)&&e.customDirectories.length>0?t.skills=e.customDirectories:t.skills=void 0}return t},JXr=t=>{let e=Spa(t),n=Ipa(e);return{settings:e,warnings:n}}});var _pa,vpa,r$t,wpa,_3,Rpa,ZXr,wX,Qle=b(()=>{"use strict";HXr();XXr();_pa=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),vpa=t=>{GXr(t,{onObjectProperty:e=>{if(_3.has(e))throw new Error(`Settings document contains reserved key "${e}".`)}})},r$t=t=>{vpa(t);let e=[],n=UXr(t,e,{allowTrailingComma:!0});if(e.length>0){let r=e.map(i=>VXr(i.error)).join(", ");throw new Error(`Failed to parse settings JSON: ${r}`)}if(n===void 0)return{};if(!_pa(n))throw new Error("Settings document is not a valid object. Expected a JSON object but found a different type (e.g., array).");return n},wpa={tabSize:2,insertSpaces:!0},_3=new Set(["__proto__","constructor","prototype"]),Rpa=t=>{let e=typeof t=="string"?t.split("."):[...t],n=typeof t=="string"?t:t.join(".");for(let r of e){if(r==="")throw new Error(`Invalid settings path "${n}": empty segment.`);if(_3.has(r))throw new Error(`Invalid settings path "${n}": "${r}" is a reserved key.`)}return e},ZXr=(t,e,n)=>{let r=WXr(t,Rpa(e),n,{formattingOptions:wpa});return YXr(t,r)},wX=class{constructor(e){this.settings={};this.warnings=[];this.store=e}drainWarnings(){let e=this.warnings;return this.warnings=[],e}getSettings(){return structuredClone(this.settings)}publish(e){let n=r$t(e),{settings:r,warnings:i}=JXr(n);this.warnings.push(...i),this.settings=r}reload(){let e=this.store.read();if(e===void 0||e.trim()===""){this.settings={};return}this.publish(e)}remove(e){let n={persisted:!1,effectiveChange:!1};return this.store.modify(r=>{if(r===void 0||r.trim()==="")return;r$t(r);let i=r;for(let s of e.paths)i=ZXr(i,s,void 0);if(i!==r)return this.publish(i),n={persisted:!0,effectiveChange:!0},i}),n}update(e){return this.updateAll([e])}updateAll(e){let n={persisted:!1,effectiveChange:!1};return this.store.modify(r=>{let i=r===void 0||r.trim()===""?"{}":r;r$t(i);let s=e.reduce((o,a)=>ZXr(o,a.path,a.value),i);if(s!==i)return this.publish(s),n={persisted:!0,effectiveChange:!0},s}),n}}});var i$t,jve,$Xr,Bpa,xpa,Tpa,kpa,RX,$Ke=b(()=>{"use strict";vr();Qle();i$t=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),jve=t=>Array.isArray(t)?t.map(jve):i$t(t)?Object.fromEntries(Object.entries(t).filter(([e])=>!_3.has(e)).map(([e,n])=>[e,jve(n)])):structuredClone(t),$Xr=(t,e,n=!1)=>{for(let[r,i]of Object.entries(e)){if(_3.has(r)||i===void 0)continue;let s=t[r];n&&r==="toolPermissions"&&Array.isArray(i)?t[r]=[...jve(i),...Array.isArray(s)?s:[]]:i$t(s)&&i$t(i)?t[r]={...s,...jve(i)}:t[r]=jve(i)}},Bpa="managed",xpa="global",Tpa="project",kpa="local",RX=class{constructor(e,n={},r={}){this.errors=[];this.locals=e,this.overrides=n,this.vfs=r}drainErrors(){let e=this.errors;return this.errors=[],e}getSettings(){return this.mergeLayers([xpa,Tpa,kpa,Bpa])}getGlobalSettings(){return this.locals.global.getSettings()}getManagedSettings(){return this.locals.managed.getSettings()}getLocalSettings(){return this.locals.local.getSettings()}getProjectSettings(){return this.locals.project.getSettings()}getVfsUserSettings(){return this.vfs.vfsUser?.getSettings()??{}}getVfsSpaceSettings(){return this.vfs.vfsSpace?.getSettings()??{}}getVfsOrgSettings(){return this.vfs.vfsOrg?.getSettings()??{}}mergeLayers(e){let n={},r=e.map(i=>this.locals[i].getSettings());for(let i of r)$Xr(n,i,!0);return $Xr(n,this.overrides),n}reload(){let e=[...Object.entries(this.locals),...Object.entries(this.vfs)];for(let[n,r]of e)if(r){try{r.reload()}catch(i){let s=i instanceof Error?i:new Error(String(i));on.error("settings reload failed",{scope:n,error:s}),this.errors.push({scope:n,error:s})}for(let i of r.drainWarnings())this.errors.push({scope:n,error:new Error(i)})}}remove(e,n){return this.routeWrite(e,r=>r.remove(n))}update(e,n){return this.routeWrite(e,r=>r.update(n))}updateAll(e,n){return this.routeWrite(e,r=>r.updateAll(n))}routeWrite(e,n){if(e==="managed")throw new Error('Refusing to write read-only settings scope "managed"');let r=this.getSettings(),i=n(this.locals[e]);for(let a of this.locals[e].drainWarnings())this.errors.push({scope:e,error:new Error(a)});if(!i.persisted)return i;let s=this.getSettings(),o=JSON.stringify(r)!==JSON.stringify(s);return{persisted:i.persisted,effectiveChange:o}}}});var s$t,o$t=b(()=>{"use strict";TXr();$Ke();Qle();s$t=(t,e)=>{let n=i=>new wX(new HKe(i)),r=new RX({managed:n(t.managedPath),global:n(t.globalPath),project:n(t.projectPath),local:n(t.localPath)},e,{vfsUser:t.vfsUserPath?n(t.vfsUserPath):void 0,vfsSpace:t.vfsSpacePath?n(t.vfsSpacePath):void 0,vfsOrg:t.vfsOrgPath?n(t.vfsOrgPath):void 0});return r.reload(),r}});var a$t,l$t,KXr,BX,KKe=b(()=>{"use strict";Qle();a$t=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),l$t=t=>{if(Array.isArray(t))return t.map(l$t);if(!a$t(t))return structuredClone(t);let e={};for(let[n,r]of Object.entries(t))_3.has(n)||(e[n]=l$t(r));return e},KXr=(t,e)=>{let n=structuredClone(t);for(let r of Object.keys(e)){let i=e[r];if(i===void 0||_3.has(r))continue;let s=n[r],o=l$t(i);a$t(s)&&a$t(o)?n[r]={...s,...o}:n[r]=o}return n},BX=class{constructor(e){this.errors=[];this.manager=e}get settings(){let e=this.manager.getSettings();return this.dynamicOverrides?KXr(e,this.dynamicOverrides):e}update(e,n,r){if(this.dynamicOverrides=void 0,typeof n=="object"&&"path"in n)return this.manager.update(e,n);try{this.manager.update(e,{path:n,value:r})}catch(i){let s=i instanceof Error?i:new Error(String(i));this.errors.push({scope:e,error:s})}}updateAll(e,n){return this.dynamicOverrides=void 0,this.manager.updateAll(e,n)}remove(e,n){return this.dynamicOverrides=void 0,this.manager.remove(e,n)}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.manager.getGlobalSettings())}getProjectSettings(){return structuredClone(this.manager.getProjectSettings())}getLocalSettings(){return structuredClone(this.manager.getLocalSettings())}getManagedSettings(){return structuredClone(this.manager.getManagedSettings())}getVfsUserSettings(){return structuredClone(this.manager.getVfsUserSettings())}getVfsSpaceSettings(){return structuredClone(this.manager.getVfsSpaceSettings())}getVfsOrgSettings(){return structuredClone(this.manager.getVfsOrgSettings())}reload(){this.manager.reload(),this.dynamicOverrides=void 0}applyOverrides(e){this.dynamicOverrides=KXr(this.dynamicOverrides??{},e)}flush(){}drainErrors(){let e=[...this.manager.drainErrors(),...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.update("global","lastChangelogVersion",e)}getSessionDir(){return this.settings.sessionDir}getWorktreeDir(){return this.settings.worktreeDir}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.update("global","defaultProvider",e)}setDefaultModel(e){this.update("global","defaultModel",e)}setDefaultModelAndProvider(e,n){this.dynamicOverrides=void 0;try{this.manager.updateAll("global",[{path:"defaultProvider",value:e},{path:"defaultModel",value:n}])}catch(r){let i=r instanceof Error?r:new Error(String(r));this.errors.push({scope:"global",error:i})}}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.update("global","steeringMode",e)}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.update("global","followUpMode",e)}getTheme(){return this.settings.theme}setTheme(e){this.update("global","theme",e)}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.update("global","defaultThinkingLevel",e)}getTransport(){return this.settings.transport??"sse"}setTransport(e){this.update("global","transport",e)}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.update("global","compaction.enabled",e)}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionProtectedHeadTokens(){return this.settings.compaction?.protectedHeadTokens??2e4}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSummarizationModel(){return this.settings.compaction?.summarizationModel}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),protectedHeadTokens:this.getCompactionProtectedHeadTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens(),summarizationModel:this.getCompactionSummarizationModel(),useReserveTrigger:this.settings.compaction?.useReserveTrigger??!1,inputBudgetTriggerRatio:this.settings.compaction?.inputBudgetTriggerRatio,fallbackInputBudgetRatio:this.settings.compaction?.fallbackInputBudgetRatio,maxMessageTokens:this.settings.compaction?.maxMessageTokens}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.update("global","retry.enabled",e)}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxDelayMs:this.settings.retry?.maxDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.update("global","hideThinkingBlock",e)}getCollapsePromptCommands(){return this.settings.collapsePromptCommands??!1}setCollapsePromptCommands(e){this.update("global","collapsePromptCommands",e)}getShellPath(){return this.settings.shellPath}setShellPath(e){this.update("global","shellPath",e)}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.update("global","quietStartup",e)}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.update("global","shellCommandPrefix",e)}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.update("global","npmCommand",e?[...e]:void 0)}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.update("global","collapseChangelog",e)}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.update("global","packages",e)}setProjectPackages(e){this.update("project","packages",e)}setLocalPackages(e){this.update("local","packages",e)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.update("global","extensions",e)}setProjectExtensionPaths(e){this.update("project","extensions",e)}setLocalExtensionPaths(e){this.update("local","extensions",e)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.update("global","skills",e)}setProjectSkillPaths(e){this.update("project","skills",e)}setLocalSkillPaths(e){this.update("local","skills",e)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.update("global","prompts",e)}setProjectPromptTemplatePaths(e){this.update("project","prompts",e)}setLocalPromptTemplatePaths(e){this.update("local","prompts",e)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.update("global","themes",e)}setProjectThemePaths(e){this.update("project","themes",e)}setLocalThemePaths(e){this.update("local","themes",e)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.update("global","enableSkillCommands",e)}getEnableHashline(){return this.settings.enableHashline??!1}setEnableHashline(e){this.update("global","enableHashline",e)}getEnabledPlugins(){let e={};for(let[n,r]of Object.entries(this.settings.enabledPlugins??{}))typeof r=="boolean"&&(e[n]=r);return e}getToolPermissions(){let e=this.settings.toolPermissions;return Array.isArray(e)?structuredClone(e):[]}getToolPermissionScopeRuleSets(){let e=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=[];for(let r of e){let i=r.toolPermissions;Array.isArray(i)&&i.length>0&&n.push(structuredClone(i))}return n}setPluginEnabled(e,n){this.update("global",["enabledPlugins",e],n)}getEnableToolSearch(){return this.settings.enableToolSearch??!1}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.update("global","terminal.showImages",e)}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.update("global","terminal.clearOnShrink",e)}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.update("global","images.autoResize",e)}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.update("global","images.blockImages",e)}getEnabledModels(){return this.settings.enabledModels?[...this.settings.enabledModels]:void 0}setEnabledModels(e){this.update("global","enabledModels",e)}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.update("global","doubleEscapeAction",e)}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.update("global","treeFilterMode",e)}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.update("global","showHardwareCursor",e)}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.update("global","editorPaddingX",Math.max(0,Math.min(3,Math.floor(e))))}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.update("global","autocompleteMaxVisible",Math.max(3,Math.min(20,Math.floor(e))))}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getHooks(){return this.settings.hooks}getTelemetrySettings(){return this.settings.telemetry}getEnvInjection(){let e=this.settings.env;if(!e||typeof e!="object")return{};let n={};for(let[r,i]of Object.entries(e))typeof i=="string"&&(n[r]=i);return n}getFeatureFlagOverrides(){return this.settings.featureFlagOverrides}getIndexingDirsUnion(){let e=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=r=>{let i=new Set,s=[];for(let o of e){let a=o[r];if(Array.isArray(a))for(let l of a)typeof l!="string"||i.has(l)||(i.add(l),s.push(l))}return s};return{allowDirs:n("indexingAllowDirs"),denyDirs:n("indexingDenyDirs")}}}});var c$t,u$t=b(()=>{"use strict";o$t();KKe();c$t=(t,e)=>new BX(s$t(t,e))});var qve,d$t=b(()=>{"use strict";qve=class{constructor(e){this.content=e}read(){return this.content}modify(e){let n=e(this.content);n!==void 0&&(this.content=n)}}});import{homedir as jXr}from"node:os";import{join as xX}from"node:path";var Npa,Dpa,p$t,ba,qXr=b(()=>{"use strict";d$t();$Ke();Qle();u$t();KKe();Npa="AUGGIE-V2_CODING_AGENT_DIR",Dpa=()=>{let t=process.env[`${Npa}_MANAGED`];if(t)return t==="~"?xX(jXr(),"settings.json"):t.startsWith("~/")?jXr()+t.slice(1):t;if(process.platform==="win32"){let e=process.env.ProgramData||"C:\\ProgramData";return xX(e,"augment","settings.json")}return xX("/etc","augment","settings.json")},p$t=t=>t?xX(t,".augment","settings.json"):void 0,ba={create(t,e,n){return c$t({globalPath:xX(e,"settings.json"),projectPath:xX(t,".augment","settings.json"),localPath:xX(t,".augment","settings.local.json"),managedPath:Dpa(),vfsUserPath:p$t(n?.user),vfsSpacePath:p$t(n?.space),vfsOrgPath:p$t(n?.org)})},inMemory(t={}){let e=r=>new wX(new qve(r===void 0?void 0:JSON.stringify(r))),n=new RX({managed:e(),local:e(),project:e(),global:e(t)});return n.reload(),new BX(n)}}});var lh=b(()=>{"use strict";u$t();KKe();qXr();o$t();d$t();$Ke();Qle()});var v3,A$t=b(()=>{v3={name:"@augmentcode/auggie-v2",version:"1.1.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie-v2",configDir:".augment"},bin:{pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",dev:"pnpm run bake:export-html && tsx src/cli.ts","dev:debug":"pnpm run bake:export-html && node --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/","assemble-changelog":"tsx scripts/assemble-changelog.ts",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.3.0","@augmentcode/api-client":"0.0.13-20260806T062724Z","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/cloud":"workspace:*","@hermes/daemon":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as Mpa}from"node:fs";import{homedir as ewe}from"node:os";import{dirname as g$t,join as g1,resolve as eZr}from"node:path";import{fileURLToPath as Fpa}from"node:url";function Ppa(){let t=`${m$t}\0${process.execPath||""}`.toLowerCase();return t.includes("/pnpm/")||t.includes("/.pnpm/")||t.includes("\\pnpm\\")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")||t.includes("\\yarn\\")?"yarn":t.includes("/npm/")||t.includes("/node_modules/")||t.includes("\\npm\\")?"npm":"unknown"}function tZr(t,e){switch(Ppa()){case"pnpm":return`Run: pnpm install -g ${t}`;case"yarn":return`Run: yarn global add ${t}`;case"npm":return`Run: npm install -g ${t}`;default:return`Run: npm install -g ${t}`}}function nZr(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?ewe():t.startsWith("~/")?ewe()+t.slice(1):t;let e=m$t;for(;e!==g$t(e);){if(Mpa(g1(e,"package.json")))return e;e=g$t(e)}return m$t}function Mle(){return eZr(g1(nZr(),"docs"))}function jKe(){return eZr(g1(nZr(),"CHANGELOG.md"))}function oZr(t){return`${process.env.PI_SHARE_VIEWER_URL||Upa}#${t}`}function aZr(t){return t==="~"?ewe():t.startsWith("~/")?ewe()+t.slice(1):t}function XP(){let t=process.env.AUGMENT_CACHE_DIR;return t?aZr(t):g1(ewe(),".augment")}function Hs(){let t=process.env[rwe];return t?aZr(t):XP()}function iwe(){return g1(Hs(),"themes")}function lZr(){return g1(Hs(),"models.json")}function f$t(){return g1(Hs(),"auth.json")}function cZr(){return g1(Hs(),"settings.json")}function TX(){return XP()}function Fle(){return g1(Hs(),"bin")}function uZr(){return g1(Hs(),"prompts")}function dZr(){return g1(Hs(),twe)}function pZr(){return g1(Hs(),`${co}-debug.log`)}var Opa,m$t,co,il,twe,nwe,rZr,Lpa,GA,iZr,sZr,rwe,Upa,wu=b(()=>{"use strict";A$t();Opa=Fpa(import.meta.url),m$t=g$t(Opa);co=v3.piConfig?.name||"pi",il=v3.piConfig?.configDir||".augment",twe="sessions-v2",nwe="auggie",rZr="Auggie Coding Agent",Lpa="1.1.0-prerelease.202608120229",GA=Lpa??v3.version,iZr="efda5a6e3bd00b13423c254fbfaa91194c152e50",sZr="2026-08-12T09:29:48Z",rwe=`${co.toUpperCase()}_CODING_AGENT_DIR`,Upa="https://pi.dev/session/"});function AZr(...t){return new globalThis.Function(...t)}var gZr=b(()=>{});var h$t,E$t,mZr,fZr=b(()=>{I8();qhe();ks();EA();h$t=class extends Qo{constructor(e){super(`Duplicate type kind '${e}' detected`)}},E$t=class extends Qo{constructor(e){super(`Duplicate string format '${e}' detected`)}};(function(t){function e(r,i){if(Uf.Has(r))throw new h$t(r);return Uf.Set(r,i),(s={})=>L8({...s,[gr]:r})}t.Type=e;function n(r,i){if(Qb.Has(r))throw new E$t(r);return Qb.Set(r,i),r}t.Format=n})(mZr||(mZr={}))});var qKe=b(()=>{gZr();ehe();fZr()});function Gpa(t){switch(t.errorType){case br.ArrayContains:return"Expected array to contain at least one matching value";case br.ArrayMaxContains:return`Expected array to contain no more than ${t.schema.maxContains} matching values`;case br.ArrayMinContains:return`Expected array to contain at least ${t.schema.minContains} matching values`;case br.ArrayMaxItems:return`Expected array length to be less or equal to ${t.schema.maxItems}`;case br.ArrayMinItems:return`Expected array length to be greater or equal to ${t.schema.minItems}`;case br.ArrayUniqueItems:return"Expected array elements to be unique";case br.Array:return"Expected array";case br.AsyncIterator:return"Expected AsyncIterator";case br.BigIntExclusiveMaximum:return`Expected bigint to be less than ${t.schema.exclusiveMaximum}`;case br.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${t.schema.exclusiveMinimum}`;case br.BigIntMaximum:return`Expected bigint to be less or equal to ${t.schema.maximum}`;case br.BigIntMinimum:return`Expected bigint to be greater or equal to ${t.schema.minimum}`;case br.BigIntMultipleOf:return`Expected bigint to be a multiple of ${t.schema.multipleOf}`;case br.BigInt:return"Expected bigint";case br.Boolean:return"Expected boolean";case br.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${t.schema.exclusiveMinimumTimestamp}`;case br.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${t.schema.exclusiveMaximumTimestamp}`;case br.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${t.schema.minimumTimestamp}`;case br.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${t.schema.maximumTimestamp}`;case br.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${t.schema.multipleOfTimestamp}`;case br.Date:return"Expected Date";case br.Function:return"Expected function";case br.IntegerExclusiveMaximum:return`Expected integer to be less than ${t.schema.exclusiveMaximum}`;case br.IntegerExclusiveMinimum:return`Expected integer to be greater than ${t.schema.exclusiveMinimum}`;case br.IntegerMaximum:return`Expected integer to be less or equal to ${t.schema.maximum}`;case br.IntegerMinimum:return`Expected integer to be greater or equal to ${t.schema.minimum}`;case br.IntegerMultipleOf:return`Expected integer to be a multiple of ${t.schema.multipleOf}`;case br.Integer:return"Expected integer";case br.IntersectUnevaluatedProperties:return"Unexpected property";case br.Intersect:return"Expected all values to match";case br.Iterator:return"Expected Iterator";case br.Literal:return`Expected ${typeof t.schema.const=="string"?`'${t.schema.const}'`:t.schema.const}`;case br.Never:return"Never";case br.Not:return"Value should not match";case br.Null:return"Expected null";case br.NumberExclusiveMaximum:return`Expected number to be less than ${t.schema.exclusiveMaximum}`;case br.NumberExclusiveMinimum:return`Expected number to be greater than ${t.schema.exclusiveMinimum}`;case br.NumberMaximum:return`Expected number to be less or equal to ${t.schema.maximum}`;case br.NumberMinimum:return`Expected number to be greater or equal to ${t.schema.minimum}`;case br.NumberMultipleOf:return`Expected number to be a multiple of ${t.schema.multipleOf}`;case br.Number:return"Expected number";case br.Object:return"Expected object";case br.ObjectAdditionalProperties:return"Unexpected property";case br.ObjectMaxProperties:return`Expected object to have no more than ${t.schema.maxProperties} properties`;case br.ObjectMinProperties:return`Expected object to have at least ${t.schema.minProperties} properties`;case br.ObjectRequiredProperty:return"Expected required property";case br.Promise:return"Expected Promise";case br.RegExp:return"Expected string to match regular expression";case br.StringFormatUnknown:return`Unknown format '${t.schema.format}'`;case br.StringFormat:return`Expected string to match '${t.schema.format}' format`;case br.StringMaxLength:return`Expected string length less or equal to ${t.schema.maxLength}`;case br.StringMinLength:return`Expected string length greater or equal to ${t.schema.minLength}`;case br.StringPattern:return`Expected string to match '${t.schema.pattern}'`;case br.String:return"Expected string";case br.Symbol:return"Expected symbol";case br.TupleLength:return`Expected tuple to have ${t.schema.maxItems||0} elements`;case br.Tuple:return"Expected tuple";case br.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${t.schema.maxByteLength}`;case br.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${t.schema.minByteLength}`;case br.Uint8Array:return"Expected Uint8Array";case br.Undefined:return"Expected undefined";case br.Union:return"Expected union value";case br.Void:return"Expected void";case br.Kind:return`Expected kind '${t.schema[gr]}'`;default:return"Unknown error type"}}function hZr(){return Vpa}var Vpa,y$t=b(()=>{ks();C$t();Vpa=Gpa});function Wpa(t,e){let n=e.find(r=>r.$id===t.$ref);if(n===void 0)throw new b$t(t);return Hc(n,e)}function uE(t,e){return!bc(t.$id)||e.some(n=>n.$id===t.$id)||e.push(t),e}function Hc(t,e){return t[gr]==="This"||t[gr]==="Ref"?Wpa(t,e):t}var b$t,EZr=b(()=>{EA();ks();aOe();b$t=class extends Qo{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`),this.schema=e}}});var m1=b(()=>{EZr()});function*Jpa(t){let e=t===0?1:Math.ceil(Math.floor(Math.log2(t)+1)/8);for(let n=0;n<e;n++)yield t>>8*(e-1-n)&255}function Xpa(t){VC(rv.Array);for(let e of t)Ple(e)}function Zpa(t){VC(rv.Boolean),VC(t?1:0)}function $pa(t){VC(rv.BigInt),CZr.setBigInt64(0,t);for(let e of bZr)VC(e)}function Kpa(t){VC(rv.Date),Ple(t.getTime())}function jpa(t){VC(rv.Null)}function qpa(t){VC(rv.Number),CZr.setFloat64(0,t);for(let e of bZr)VC(e)}function eAa(t){VC(rv.Object);for(let e of globalThis.Object.getOwnPropertyNames(t).sort())Ple(e),Ple(t[e])}function tAa(t){VC(rv.String);for(let e=0;e<t.length;e++)for(let n of Jpa(t.charCodeAt(e)))VC(n)}function nAa(t){VC(rv.Symbol),Ple(t.description)}function rAa(t){VC(rv.Uint8Array);for(let e=0;e<t.length;e++)VC(t[e])}function iAa(t){return VC(rv.Undefined)}function Ple(t){if(Yo(t))return Xpa(t);if(MN(t))return Zpa(t);if(JE(t))return $pa(t);if(kb(t))return Kpa(t);if(TF(t))return jpa(t);if(ho(t))return qpa(t);if($a(t))return eAa(t);if(bc(t))return tAa(t);if(kF(t))return nAa(t);if(ree(t))return rAa(t);if(Vp(t))return iAa(t);throw new I$t(t)}function VC(t){Ole=Ole^zpa[t],Ole=Ole*Ypa%Hpa}function w3(t){return Ole=BigInt("14695981039346656037"),Ple(t),Ole}var I$t,rv,Ole,Ypa,Hpa,zpa,yZr,CZr,bZr,IZr=b(()=>{ef();EA();I$t=class extends Qo{constructor(e){super("Unable to hash value"),this.value=e}};(function(t){t[t.Undefined=0]="Undefined",t[t.Null=1]="Null",t[t.Boolean=2]="Boolean",t[t.Number=3]="Number",t[t.String=4]="String",t[t.Object=5]="Object",t[t.Array=6]="Array",t[t.Date=7]="Date",t[t.Uint8Array=8]="Uint8Array",t[t.Symbol=9]="Symbol",t[t.BigInt=10]="BigInt"})(rv||(rv={}));Ole=BigInt("14695981039346656037"),[Ypa,Hpa]=[BigInt("1099511628211"),BigInt("18446744073709551616")],zpa=Array.from({length:256}).map((t,e)=>BigInt(e)),yZr=new Float64Array(1),CZr=new DataView(yZr.buffer),bZr=new Uint8Array(yZr.buffer)});var Lle=b(()=>{IZr()});function sAa(t){return t[gr]==="Any"||t[gr]==="Unknown"}function lc(t){return t!==void 0}function oAa(t,e,n){return!0}function aAa(t,e,n){return!0}function lAa(t,e,n){if(!Yo(n)||lc(t.minItems)&&!(n.length>=t.minItems)||lc(t.maxItems)&&!(n.length<=t.maxItems))return!1;for(let s of n)if(!dE(t.items,e,s))return!1;if(t.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=w3(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(lc(t.contains)||ho(t.minContains)||ho(t.maxContains)))return!0;let r=lc(t.contains)?t.contains:Ka(),i=n.reduce((s,o)=>dE(r,e,o)?s+1:s,0);return!(i===0||ho(t.minContains)&&i<t.minContains||ho(t.maxContains)&&i>t.maxContains)}function cAa(t,e,n){return rOe(n)}function uAa(t,e,n){return!(!JE(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.multipleOf)&&n%t.multipleOf!==BigInt(0))}function dAa(t,e,n){return MN(n)}function pAa(t,e,n){return dE(t.returns,e,n.prototype)}function AAa(t,e,n){return!(!kb(n)||lc(t.exclusiveMaximumTimestamp)&&!(n.getTime()<t.exclusiveMaximumTimestamp)||lc(t.exclusiveMinimumTimestamp)&&!(n.getTime()>t.exclusiveMinimumTimestamp)||lc(t.maximumTimestamp)&&!(n.getTime()<=t.maximumTimestamp)||lc(t.minimumTimestamp)&&!(n.getTime()>=t.minimumTimestamp)||lc(t.multipleOfTimestamp)&&n.getTime()%t.multipleOfTimestamp!==0)}function gAa(t,e,n){return LG(n)}function mAa(t,e,n){let r=globalThis.Object.values(t.$defs),i=t.$defs[t.$ref];return dE(i,[...e,...r],n)}function fAa(t,e,n){return!(!oOe(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.multipleOf)&&n%t.multipleOf!==0)}function hAa(t,e,n){let r=t.allOf.every(i=>dE(i,e,n));if(t.unevaluatedProperties===!1){let i=new RegExp(UN(t)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if(Yp(t.unevaluatedProperties)){let i=new RegExp(UN(t)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||dE(t.unevaluatedProperties,e,n[o]));return r&&s}else return r}function EAa(t,e,n){return iOe(n)}function yAa(t,e,n){return n===t.const}function CAa(t,e,n){return!1}function bAa(t,e,n){return!dE(t.not,e,n)}function IAa(t,e,n){return TF(n)}function SAa(t,e,n){return!(!bp.IsNumberLike(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.multipleOf)&&n%t.multipleOf!==0)}function _Aa(t,e,n){if(!bp.IsObjectLike(n)||lc(t.minProperties)&&!(Object.getOwnPropertyNames(n).length>=t.minProperties)||lc(t.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=t.maxProperties))return!1;let r=Object.getOwnPropertyNames(t.properties);for(let i of r){let s=t.properties[i];if(t.required&&t.required.includes(i)){if(!dE(s,e,n[i])||(GN(s)||sAa(s))&&!(i in n))return!1}else if(bp.IsExactOptionalProperty(n,i)&&!dE(s,e,n[i]))return!1}if(t.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return t.required&&t.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof t.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||dE(t.additionalProperties,e,n[s])):!0}function vAa(t,e,n){return sOe(n)}function wAa(t,e,n){if(!bp.IsRecordLike(n)||lc(t.minProperties)&&!(Object.getOwnPropertyNames(n).length>=t.minProperties)||lc(t.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=t.maxProperties))return!1;let[r,i]=Object.entries(t.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([c,u])=>s.test(c)?dE(i,e,u):!0),a=typeof t.additionalProperties=="object"?Object.entries(n).every(([c,u])=>s.test(c)?!0:dE(t.additionalProperties,e,u)):!0,l=t.additionalProperties===!1?Object.getOwnPropertyNames(n).every(c=>s.test(c)):!0;return o&&a&&l}function RAa(t,e,n){return dE(Hc(t,e),e,n)}function BAa(t,e,n){let r=new RegExp(t.source,t.flags);return lc(t.minLength)&&!(n.length>=t.minLength)||lc(t.maxLength)&&!(n.length<=t.maxLength)?!1:r.test(n)}function xAa(t,e,n){return!bc(n)||lc(t.minLength)&&!(n.length>=t.minLength)||lc(t.maxLength)&&!(n.length<=t.maxLength)||lc(t.pattern)&&!new RegExp(t.pattern).test(n)?!1:lc(t.format)?Qb.Has(t.format)?Qb.Get(t.format)(n):!1:!0}function TAa(t,e,n){return kF(n)}function kAa(t,e,n){return bc(n)&&new RegExp(t.pattern).test(n)}function NAa(t,e,n){return dE(Hc(t,e),e,n)}function DAa(t,e,n){if(!Yo(n)||t.items===void 0&&n.length!==0||n.length!==t.maxItems)return!1;if(!t.items)return!0;for(let r=0;r<t.items.length;r++)if(!dE(t.items[r],e,n[r]))return!1;return!0}function QAa(t,e,n){return Vp(n)}function MAa(t,e,n){return t.anyOf.some(r=>dE(r,e,n))}function FAa(t,e,n){return!(!ree(n)||lc(t.maxByteLength)&&!(n.length<=t.maxByteLength)||lc(t.minByteLength)&&!(n.length>=t.minByteLength))}function OAa(t,e,n){return!0}function PAa(t,e,n){return bp.IsVoidLike(n)}function LAa(t,e,n){return Uf.Has(t[gr])?Uf.Get(t[gr])(t,n):!1}function dE(t,e,n){let r=lc(t.$id)?uE(t,e):e,i=t;switch(i[gr]){case"Any":return oAa(i,r,n);case"Argument":return aAa(i,r,n);case"Array":return lAa(i,r,n);case"AsyncIterator":return cAa(i,r,n);case"BigInt":return uAa(i,r,n);case"Boolean":return dAa(i,r,n);case"Constructor":return pAa(i,r,n);case"Date":return AAa(i,r,n);case"Function":return gAa(i,r,n);case"Import":return mAa(i,r,n);case"Integer":return fAa(i,r,n);case"Intersect":return hAa(i,r,n);case"Iterator":return EAa(i,r,n);case"Literal":return yAa(i,r,n);case"Never":return CAa(i,r,n);case"Not":return bAa(i,r,n);case"Null":return IAa(i,r,n);case"Number":return SAa(i,r,n);case"Object":return _Aa(i,r,n);case"Promise":return vAa(i,r,n);case"Record":return wAa(i,r,n);case"Ref":return RAa(i,r,n);case"RegExp":return BAa(i,r,n);case"String":return xAa(i,r,n);case"Symbol":return TAa(i,r,n);case"TemplateLiteral":return kAa(i,r,n);case"This":return NAa(i,r,n);case"Tuple":return DAa(i,r,n);case"Undefined":return QAa(i,r,n);case"Union":return MAa(i,r,n);case"Uint8Array":return FAa(i,r,n);case"Unknown":return OAa(i,r,n);case"Void":return PAa(i,r,n);default:if(!Uf.Has(i[gr]))throw new S$t(i);return LAa(i,r,n)}}function El(...t){return t.length===3?dE(t[0],t[1],t[2]):dE(t[0],[],t[1])}var S$t,_$t=b(()=>{qKe();m1();Lle();ks();Qw();Q8();I8();EA();Bm();ef();Il();S$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}}});var iv=b(()=>{_$t()});function ZP(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function cc(t){return t!==void 0}function ns(t,e,n,r,i=[]){return{type:t,schema:e,path:n,value:r,message:hZr()({errorType:t,path:n,schema:e,value:r,errors:i}),errors:i}}function*UAa(t,e,n,r){}function*GAa(t,e,n,r){}function*VAa(t,e,n,r){if(!Yo(r))return yield ns(br.Array,t,n,r);cc(t.minItems)&&!(r.length>=t.minItems)&&(yield ns(br.ArrayMinItems,t,n,r)),cc(t.maxItems)&&!(r.length<=t.maxItems)&&(yield ns(br.ArrayMaxItems,t,n,r));for(let o=0;o<r.length;o++)yield*pE(t.items,e,`${n}/${o}`,r[o]);if(t.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=w3(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield ns(br.ArrayUniqueItems,t,n,r)),!(cc(t.contains)||cc(t.minContains)||cc(t.maxContains)))return;let i=cc(t.contains)?t.contains:Ka(),s=r.reduce((o,a,l)=>pE(i,e,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield ns(br.ArrayContains,t,n,r)),ho(t.minContains)&&s<t.minContains&&(yield ns(br.ArrayMinContains,t,n,r)),ho(t.maxContains)&&s>t.maxContains&&(yield ns(br.ArrayMaxContains,t,n,r))}function*WAa(t,e,n,r){rOe(r)||(yield ns(br.AsyncIterator,t,n,r))}function*YAa(t,e,n,r){if(!JE(r))return yield ns(br.BigInt,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.BigIntExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.BigIntExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.BigIntMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.BigIntMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==BigInt(0)&&(yield ns(br.BigIntMultipleOf,t,n,r))}function*HAa(t,e,n,r){MN(r)||(yield ns(br.Boolean,t,n,r))}function*zAa(t,e,n,r){yield*pE(t.returns,e,n,r.prototype)}function*JAa(t,e,n,r){if(!kb(r))return yield ns(br.Date,t,n,r);cc(t.exclusiveMaximumTimestamp)&&!(r.getTime()<t.exclusiveMaximumTimestamp)&&(yield ns(br.DateExclusiveMaximumTimestamp,t,n,r)),cc(t.exclusiveMinimumTimestamp)&&!(r.getTime()>t.exclusiveMinimumTimestamp)&&(yield ns(br.DateExclusiveMinimumTimestamp,t,n,r)),cc(t.maximumTimestamp)&&!(r.getTime()<=t.maximumTimestamp)&&(yield ns(br.DateMaximumTimestamp,t,n,r)),cc(t.minimumTimestamp)&&!(r.getTime()>=t.minimumTimestamp)&&(yield ns(br.DateMinimumTimestamp,t,n,r)),cc(t.multipleOfTimestamp)&&r.getTime()%t.multipleOfTimestamp!==0&&(yield ns(br.DateMultipleOfTimestamp,t,n,r))}function*XAa(t,e,n,r){LG(r)||(yield ns(br.Function,t,n,r))}function*ZAa(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref];yield*pE(s,[...e,...i],n,r)}function*$Aa(t,e,n,r){if(!oOe(r))return yield ns(br.Integer,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.IntegerExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.IntegerExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.IntegerMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.IntegerMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==0&&(yield ns(br.IntegerMultipleOf,t,n,r))}function*KAa(t,e,n,r){let i=!1;for(let s of t.allOf)for(let o of pE(s,e,n,r))i=!0,yield o;if(i)return yield ns(br.Intersect,t,n,r);if(t.unevaluatedProperties===!1){let s=new RegExp(UN(t));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield ns(br.IntersectUnevaluatedProperties,t,`${n}/${o}`,r))}if(typeof t.unevaluatedProperties=="object"){let s=new RegExp(UN(t));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=pE(t.unevaluatedProperties,e,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*jAa(t,e,n,r){iOe(r)||(yield ns(br.Iterator,t,n,r))}function*qAa(t,e,n,r){r!==t.const&&(yield ns(br.Literal,t,n,r))}function*ega(t,e,n,r){yield ns(br.Never,t,n,r)}function*tga(t,e,n,r){pE(t.not,e,n,r).next().done===!0&&(yield ns(br.Not,t,n,r))}function*nga(t,e,n,r){TF(r)||(yield ns(br.Null,t,n,r))}function*rga(t,e,n,r){if(!bp.IsNumberLike(r))return yield ns(br.Number,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.NumberExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.NumberExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.NumberMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.NumberMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==0&&(yield ns(br.NumberMultipleOf,t,n,r))}function*iga(t,e,n,r){if(!bp.IsObjectLike(r))return yield ns(br.Object,t,n,r);cc(t.minProperties)&&!(Object.getOwnPropertyNames(r).length>=t.minProperties)&&(yield ns(br.ObjectMinProperties,t,n,r)),cc(t.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=t.maxProperties)&&(yield ns(br.ObjectMaxProperties,t,n,r));let i=Array.isArray(t.required)?t.required:[],s=Object.getOwnPropertyNames(t.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield ns(br.ObjectRequiredProperty,t.properties[a],`${n}/${ZP(a)}`,void 0));if(t.additionalProperties===!1)for(let a of o)s.includes(a)||(yield ns(br.ObjectAdditionalProperties,t,`${n}/${ZP(a)}`,r[a]));if(typeof t.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*pE(t.additionalProperties,e,`${n}/${ZP(a)}`,r[a]));for(let a of s){let l=t.properties[a];t.required&&t.required.includes(a)?(yield*pE(l,e,`${n}/${ZP(a)}`,r[a]),GN(t)&&!(a in r)&&(yield ns(br.ObjectRequiredProperty,l,`${n}/${ZP(a)}`,void 0))):bp.IsExactOptionalProperty(r,a)&&(yield*pE(l,e,`${n}/${ZP(a)}`,r[a]))}}function*sga(t,e,n,r){sOe(r)||(yield ns(br.Promise,t,n,r))}function*oga(t,e,n,r){if(!bp.IsRecordLike(r))return yield ns(br.Object,t,n,r);cc(t.minProperties)&&!(Object.getOwnPropertyNames(r).length>=t.minProperties)&&(yield ns(br.ObjectMinProperties,t,n,r)),cc(t.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=t.maxProperties)&&(yield ns(br.ObjectMaxProperties,t,n,r));let[i,s]=Object.entries(t.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*pE(s,e,`${n}/${ZP(a)}`,l));if(typeof t.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*pE(t.additionalProperties,e,`${n}/${ZP(a)}`,l));if(t.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield ns(br.ObjectAdditionalProperties,t,`${n}/${ZP(a)}`,l)}}function*aga(t,e,n,r){yield*pE(Hc(t,e),e,n,r)}function*lga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);if(cc(t.minLength)&&!(r.length>=t.minLength)&&(yield ns(br.StringMinLength,t,n,r)),cc(t.maxLength)&&!(r.length<=t.maxLength)&&(yield ns(br.StringMaxLength,t,n,r)),!new RegExp(t.source,t.flags).test(r))return yield ns(br.RegExp,t,n,r)}function*cga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);cc(t.minLength)&&!(r.length>=t.minLength)&&(yield ns(br.StringMinLength,t,n,r)),cc(t.maxLength)&&!(r.length<=t.maxLength)&&(yield ns(br.StringMaxLength,t,n,r)),bc(t.pattern)&&(new RegExp(t.pattern).test(r)||(yield ns(br.StringPattern,t,n,r))),bc(t.format)&&(Qb.Has(t.format)?Qb.Get(t.format)(r)||(yield ns(br.StringFormat,t,n,r)):yield ns(br.StringFormatUnknown,t,n,r))}function*uga(t,e,n,r){kF(r)||(yield ns(br.Symbol,t,n,r))}function*dga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);new RegExp(t.pattern).test(r)||(yield ns(br.StringPattern,t,n,r))}function*pga(t,e,n,r){yield*pE(Hc(t,e),e,n,r)}function*Aga(t,e,n,r){if(!Yo(r))return yield ns(br.Tuple,t,n,r);if(t.items===void 0&&r.length!==0)return yield ns(br.TupleLength,t,n,r);if(r.length!==t.maxItems)return yield ns(br.TupleLength,t,n,r);if(t.items)for(let i=0;i<t.items.length;i++)yield*pE(t.items[i],e,`${n}/${i}`,r[i])}function*gga(t,e,n,r){Vp(r)||(yield ns(br.Undefined,t,n,r))}function*mga(t,e,n,r){if(El(t,e,r))return;let i=t.anyOf.map(s=>new R3(pE(s,e,n,r)));yield ns(br.Union,t,n,r,i)}function*fga(t,e,n,r){if(!ree(r))return yield ns(br.Uint8Array,t,n,r);cc(t.maxByteLength)&&!(r.length<=t.maxByteLength)&&(yield ns(br.Uint8ArrayMaxByteLength,t,n,r)),cc(t.minByteLength)&&!(r.length>=t.minByteLength)&&(yield ns(br.Uint8ArrayMinByteLength,t,n,r))}function*hga(t,e,n,r){}function*Ega(t,e,n,r){bp.IsVoidLike(r)||(yield ns(br.Void,t,n,r))}function*yga(t,e,n,r){Uf.Get(t[gr])(t,r)||(yield ns(br.Kind,t,n,r))}function*pE(t,e,n,r){let i=cc(t.$id)?[...e,t]:e,s=t;switch(s[gr]){case"Any":return yield*UAa(s,i,n,r);case"Argument":return yield*GAa(s,i,n,r);case"Array":return yield*VAa(s,i,n,r);case"AsyncIterator":return yield*WAa(s,i,n,r);case"BigInt":return yield*YAa(s,i,n,r);case"Boolean":return yield*HAa(s,i,n,r);case"Constructor":return yield*zAa(s,i,n,r);case"Date":return yield*JAa(s,i,n,r);case"Function":return yield*XAa(s,i,n,r);case"Import":return yield*ZAa(s,i,n,r);case"Integer":return yield*$Aa(s,i,n,r);case"Intersect":return yield*KAa(s,i,n,r);case"Iterator":return yield*jAa(s,i,n,r);case"Literal":return yield*qAa(s,i,n,r);case"Never":return yield*ega(s,i,n,r);case"Not":return yield*tga(s,i,n,r);case"Null":return yield*nga(s,i,n,r);case"Number":return yield*rga(s,i,n,r);case"Object":return yield*iga(s,i,n,r);case"Promise":return yield*sga(s,i,n,r);case"Record":return yield*oga(s,i,n,r);case"Ref":return yield*aga(s,i,n,r);case"RegExp":return yield*lga(s,i,n,r);case"String":return yield*cga(s,i,n,r);case"Symbol":return yield*uga(s,i,n,r);case"TemplateLiteral":return yield*dga(s,i,n,r);case"This":return yield*pga(s,i,n,r);case"Tuple":return yield*Aga(s,i,n,r);case"Undefined":return yield*gga(s,i,n,r);case"Union":return yield*mga(s,i,n,r);case"Uint8Array":return yield*fga(s,i,n,r);case"Unknown":return yield*hga(s,i,n,r);case"Void":return yield*Ega(s,i,n,r);default:if(!Uf.Has(s[gr]))throw new v$t(t);return yield*yga(s,i,n,r)}}function ZQ(...t){let e=t.length===3?pE(t[0],t[1],"",t[2]):pE(t[0],[],"",t[1]);return new R3(e)}var br,v$t,R3,C$t=b(()=>{qKe();Qw();I8();QOe();y$t();EA();m1();Lle();iv();ks();Bm();ef();(function(t){t[t.ArrayContains=0]="ArrayContains",t[t.ArrayMaxContains=1]="ArrayMaxContains",t[t.ArrayMaxItems=2]="ArrayMaxItems",t[t.ArrayMinContains=3]="ArrayMinContains",t[t.ArrayMinItems=4]="ArrayMinItems",t[t.ArrayUniqueItems=5]="ArrayUniqueItems",t[t.Array=6]="Array",t[t.AsyncIterator=7]="AsyncIterator",t[t.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",t[t.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",t[t.BigIntMaximum=10]="BigIntMaximum",t[t.BigIntMinimum=11]="BigIntMinimum",t[t.BigIntMultipleOf=12]="BigIntMultipleOf",t[t.BigInt=13]="BigInt",t[t.Boolean=14]="Boolean",t[t.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",t[t.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",t[t.DateMaximumTimestamp=17]="DateMaximumTimestamp",t[t.DateMinimumTimestamp=18]="DateMinimumTimestamp",t[t.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",t[t.Date=20]="Date",t[t.Function=21]="Function",t[t.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",t[t.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",t[t.IntegerMaximum=24]="IntegerMaximum",t[t.IntegerMinimum=25]="IntegerMinimum",t[t.IntegerMultipleOf=26]="IntegerMultipleOf",t[t.Integer=27]="Integer",t[t.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",t[t.Intersect=29]="Intersect",t[t.Iterator=30]="Iterator",t[t.Kind=31]="Kind",t[t.Literal=32]="Literal",t[t.Never=33]="Never",t[t.Not=34]="Not",t[t.Null=35]="Null",t[t.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",t[t.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",t[t.NumberMaximum=38]="NumberMaximum",t[t.NumberMinimum=39]="NumberMinimum",t[t.NumberMultipleOf=40]="NumberMultipleOf",t[t.Number=41]="Number",t[t.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",t[t.ObjectMaxProperties=43]="ObjectMaxProperties",t[t.ObjectMinProperties=44]="ObjectMinProperties",t[t.ObjectRequiredProperty=45]="ObjectRequiredProperty",t[t.Object=46]="Object",t[t.Promise=47]="Promise",t[t.RegExp=48]="RegExp",t[t.StringFormatUnknown=49]="StringFormatUnknown",t[t.StringFormat=50]="StringFormat",t[t.StringMaxLength=51]="StringMaxLength",t[t.StringMinLength=52]="StringMinLength",t[t.StringPattern=53]="StringPattern",t[t.String=54]="String",t[t.Symbol=55]="Symbol",t[t.TupleLength=56]="TupleLength",t[t.Tuple=57]="Tuple",t[t.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",t[t.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",t[t.Uint8Array=60]="Uint8Array",t[t.Undefined=61]="Undefined",t[t.Union=62]="Union",t[t.Void=63]="Void"})(br||(br={}));v$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}};R3=class{constructor(e){this.iterator=e}[Symbol.iterator](){return this.iterator}First(){let e=this.iterator.next();return e.done?void 0:e.value}}});var Ule=b(()=>{C$t();y$t()});function VA(t,e,n){try{return tu(t)?t[Wp].Decode(n):n}catch(r){throw new w$t(t,e,n,r)}}function Cga(t,e,n,r){return Yo(r)?VA(t,n,r.map((i,s)=>ZT(t.items,e,`${n}/${s}`,i))):VA(t,n,r)}function bga(t,e,n,r){if(!$a(r)||l_(r))return VA(t,n,r);let i=Che(t),s=i.map(u=>u[0]),o={...r};for(let[u,d]of i)u in o&&(o[u]=ZT(d,e,`${n}/${u}`,o[u]));if(!tu(t.unevaluatedProperties))return VA(t,n,o);let a=Object.getOwnPropertyNames(o),l=t.unevaluatedProperties,c={...o};for(let u of a)s.includes(u)||(c[u]=VA(l,`${n}/${u}`,c[u]));return VA(t,n,c)}function Iga(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref],o=ZT(s,[...e,...i],n,r);return VA(t,n,o)}function Sga(t,e,n,r){return VA(t,n,ZT(t.not,e,n,r))}function _ga(t,e,n,r){if(!$a(r))return VA(t,n,r);let i=Ub(t),s={...r};for(let c of i)na(s,c)&&(Vp(s[c])&&(!PN(t.properties[c])||bp.IsExactOptionalProperty(s,c))||(s[c]=ZT(t.properties[c],e,`${n}/${c}`,s[c])));if(!Yp(t.additionalProperties))return VA(t,n,s);let o=Object.getOwnPropertyNames(s),a=t.additionalProperties,l={...s};for(let c of o)i.includes(c)||(l[c]=VA(a,`${n}/${c}`,l[c]));return VA(t,n,l)}function vga(t,e,n,r){if(!$a(r))return VA(t,n,r);let i=Object.getOwnPropertyNames(t.patternProperties)[0],s=new RegExp(i),o={...r};for(let u of Object.getOwnPropertyNames(r))s.test(u)&&(o[u]=ZT(t.patternProperties[i],e,`${n}/${u}`,o[u]));if(!Yp(t.additionalProperties))return VA(t,n,o);let a=Object.getOwnPropertyNames(o),l=t.additionalProperties,c={...o};for(let u of a)s.test(u)||(c[u]=VA(l,`${n}/${u}`,c[u]));return VA(t,n,c)}function wga(t,e,n,r){let i=Hc(t,e);return VA(t,n,ZT(i,e,n,r))}function Rga(t,e,n,r){let i=Hc(t,e);return VA(t,n,ZT(i,e,n,r))}function Bga(t,e,n,r){return Yo(r)&&Yo(t.items)?VA(t,n,t.items.map((i,s)=>ZT(i,e,`${n}/${s}`,r[s]))):VA(t,n,r)}function xga(t,e,n,r){for(let i of t.anyOf){if(!El(i,e,r))continue;let s=ZT(i,e,n,r);return VA(t,n,s)}return VA(t,n,r)}function ZT(t,e,n,r){let i=uE(t,e),s=t;switch(t[gr]){case"Array":return Cga(s,i,n,r);case"Import":return Iga(s,i,n,r);case"Intersect":return bga(s,i,n,r);case"Not":return Sga(s,i,n,r);case"Object":return _ga(s,i,n,r);case"Record":return vga(s,i,n,r);case"Ref":return wga(s,i,n,r);case"Symbol":return VA(s,n,r);case"This":return Rga(s,i,n,r);case"Tuple":return Bga(s,i,n,r);case"Union":return xga(s,i,n,r);default:return VA(s,n,r)}}function Vle(t,e,n){return ZT(t,e,"",n)}var Gle,w$t,SZr=b(()=>{ehe();ks();EA();Qw();m1();iv();ef();Il();Gle=class extends Qo{constructor(e,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=e,this.value=n,this.error=r}},w$t=class extends Qo{constructor(e,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=e,this.path=n,this.value=r,this.error=i}}});function Sy(t,e,n){try{return tu(t)?t[Wp].Encode(n):n}catch(r){throw new R$t(t,e,n,r)}}function Tga(t,e,n,r){let i=Sy(t,n,r);return Yo(i)?i.map((s,o)=>$T(t.items,e,`${n}/${o}`,s)):i}function kga(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref],o=Sy(t,n,r);return $T(s,[...e,...i],n,o)}function Nga(t,e,n,r){let i=Sy(t,n,r);if(!$a(r)||l_(r))return i;let s=Che(t),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=$T(p,e,`${n}/${d}`,a[d]));if(!tu(t.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),c=t.unevaluatedProperties,u={...a};for(let d of l)o.includes(d)||(u[d]=Sy(c,`${n}/${d}`,u[d]));return u}function Dga(t,e,n,r){return Sy(t.not,n,Sy(t,n,r))}function Qga(t,e,n,r){let i=Sy(t,n,r);if(!$a(i))return i;let s=Ub(t),o={...i};for(let u of s)na(o,u)&&(Vp(o[u])&&(!PN(t.properties[u])||bp.IsExactOptionalProperty(o,u))||(o[u]=$T(t.properties[u],e,`${n}/${u}`,o[u])));if(!Yp(t.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=t.additionalProperties,c={...o};for(let u of a)s.includes(u)||(c[u]=Sy(l,`${n}/${u}`,c[u]));return c}function Mga(t,e,n,r){let i=Sy(t,n,r);if(!$a(r))return i;let s=Object.getOwnPropertyNames(t.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=$T(t.patternProperties[s],e,`${n}/${d}`,a[d]));if(!Yp(t.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),c=t.additionalProperties,u={...a};for(let d of l)o.test(d)||(u[d]=Sy(c,`${n}/${d}`,u[d]));return u}function Fga(t,e,n,r){let i=Hc(t,e),s=$T(i,e,n,r);return Sy(t,n,s)}function Oga(t,e,n,r){let i=Hc(t,e),s=$T(i,e,n,r);return Sy(t,n,s)}function Pga(t,e,n,r){let i=Sy(t,n,r);return Yo(t.items)?t.items.map((s,o)=>$T(s,e,`${n}/${o}`,i[o])):[]}function Lga(t,e,n,r){for(let i of t.anyOf){if(!El(i,e,r))continue;let s=$T(i,e,n,r);return Sy(t,n,s)}for(let i of t.anyOf){let s=$T(i,e,n,r);if(El(t,e,s))return Sy(t,n,s)}return Sy(t,n,r)}function $T(t,e,n,r){let i=uE(t,e),s=t;switch(t[gr]){case"Array":return Tga(s,i,n,r);case"Import":return kga(s,i,n,r);case"Intersect":return Nga(s,i,n,r);case"Not":return Dga(s,i,n,r);case"Object":return Qga(s,i,n,r);case"Record":return Mga(s,i,n,r);case"Ref":return Fga(s,i,n,r);case"This":return Oga(s,i,n,r);case"Tuple":return Pga(s,i,n,r);case"Union":return Lga(s,i,n,r);default:return Sy(s,n,r)}}function Yle(t,e,n){return $T(t,e,"",n)}var Wle,R$t,_Zr=b(()=>{ehe();ks();EA();Qw();m1();iv();ef();Il();Wle=class extends Qo{constructor(e,n,r){super("The encoded value does not match the expected schema"),this.schema=e,this.value=n,this.error=r}},R$t=class extends Qo{constructor(e,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=e,this.path=n,this.value=r,this.error=i}}});function Uga(t,e){return tu(t)||ch(t.items,e)}function Gga(t,e){return tu(t)||ch(t.items,e)}function Vga(t,e){return tu(t)||ch(t.returns,e)||t.parameters.some(n=>ch(n,e))}function Wga(t,e){return tu(t)||ch(t.returns,e)||t.parameters.some(n=>ch(n,e))}function Yga(t,e){return tu(t)||tu(t.unevaluatedProperties)||t.allOf.some(n=>ch(n,e))}function Hga(t,e){let n=globalThis.Object.getOwnPropertyNames(t.$defs).reduce((i,s)=>[...i,t.$defs[s]],[]),r=t.$defs[t.$ref];return tu(t)||ch(r,[...n,...e])}function zga(t,e){return tu(t)||ch(t.items,e)}function Jga(t,e){return tu(t)||ch(t.not,e)}function Xga(t,e){return tu(t)||Object.values(t.properties).some(n=>ch(n,e))||Yp(t.additionalProperties)&&ch(t.additionalProperties,e)}function Zga(t,e){return tu(t)||ch(t.item,e)}function $ga(t,e){let n=Object.getOwnPropertyNames(t.patternProperties)[0],r=t.patternProperties[n];return tu(t)||ch(r,e)||Yp(t.additionalProperties)&&tu(t.additionalProperties)}function Kga(t,e){return tu(t)?!0:ch(Hc(t,e),e)}function jga(t,e){return tu(t)?!0:ch(Hc(t,e),e)}function qga(t,e){return tu(t)||!Vp(t.items)&&t.items.some(n=>ch(n,e))}function ema(t,e){return tu(t)||t.anyOf.some(n=>ch(n,e))}function ch(t,e){let n=uE(t,e),r=t;if(t.$id&&B$t.has(t.$id))return!1;switch(t.$id&&B$t.add(t.$id),t[gr]){case"Array":return Uga(r,n);case"AsyncIterator":return Gga(r,n);case"Constructor":return Vga(r,n);case"Function":return Wga(r,n);case"Import":return Hga(r,n);case"Intersect":return Yga(r,n);case"Iterator":return zga(r,n);case"Not":return Jga(r,n);case"Object":return Xga(r,n);case"Promise":return Zga(r,n);case"Record":return $ga(r,n);case"Ref":return Kga(r,n);case"This":return jga(r,n);case"Tuple":return qga(r,n);case"Union":return ema(r,n);default:return tu(t)}}function $P(t,e){return B$t.clear(),ch(t,e)}var B$t,vZr=b(()=>{m1();ks();Il();ef();B$t=new Set});var Hle=b(()=>{SZr();_Zr();vZr()});function B3(t){if(!bc(t))throw Error("ConstantString: Not a String");return`'${JSON.stringify(t).slice(1,-1).replace(/'/g,"\\'")}'`}function wZr(t,e){return`${t}[${B3(e)}]`}var x$t,eje,T$t,k$t,tje,kX,zle,RZr=b(()=>{Hle();Ule();qKe();EA();m1();Lle();ks();I8();Qw();QOe();Bm();HF();ef();qbt();x$t=class{constructor(e,n,r,i){this.schema=e,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=$P(e,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(e){return ZQ(this.schema,this.references,e)}Check(e){return this.checkFunc(e)}Decode(e){if(!this.checkFunc(e))throw new Gle(this.schema,e,this.Errors(e).First());return this.hasTransform?Vle(this.schema,this.references,e):e}Encode(e){let n=this.hasTransform?Yle(this.schema,this.references,e):e;if(!this.checkFunc(n))throw new Wle(this.schema,e,this.Errors(e).First());return n}};(function(t){function e(s){return s===36}t.DollarSign=e;function n(s){return s===95}t.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}t.IsAlpha=r;function i(s){return s>=48&&s<=57}t.IsNumeric=i})(eje||(eje={}));(function(t){function e(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);eje.IsNumeric(s)||eje.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}t.Encode=e})(T$t||(T$t={}));k$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}},tje=class extends Qo{constructor(e){super("Preflight validation check failed to guard for the given schema"),this.schema=e}};(function(t){function e(o,a,l){return bp.ExactOptionalPropertyTypes?`(${B3(a)} in ${o} ? ${l} : true)`:`(${wZr(o,a)} !== undefined ? ${l} : true)`}t.IsExactOptionalProperty=e;function n(o){return bp.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}t.IsObjectLike=n;function r(o){return bp.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}t.IsRecordLike=r;function i(o){return bp.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}t.IsNumberLike=i;function s(o){return bp.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}t.IsVoidLike=s})(kX||(kX={}));(function(t){function e(oe){return oe[gr]==="Any"||oe[gr]==="Unknown"}function*n(oe,De,_e){yield"true"}function*r(oe,De,_e){yield"true"}function*i(oe,De,_e){yield`Array.isArray(${_e})`;let[Z,de]=[ue("value","any"),ue("acc","number")];ho(oe.maxItems)&&(yield`${_e}.length <= ${oe.maxItems}`),ho(oe.minItems)&&(yield`${_e}.length >= ${oe.minItems}`);let ve=he(oe.items,De,"value");if(yield`((array) => { for(const ${Z} of array) if(!(${ve})) { return false }; return true; })(${_e})`,Hp(oe.contains)||ho(oe.minContains)||ho(oe.maxContains)){let Ne=Hp(oe.contains)?oe.contains:Ka(),Le=he(Ne,De,"value"),K=ho(oe.minContains)?[`(count >= ${oe.minContains})`]:[],Ge=ho(oe.maxContains)?[`(count <= ${oe.maxContains})`]:[],ht=`const count = value.reduce((${de}, ${Z}) => ${Le} ? acc + 1 : acc, 0)`,Et=["(count > 0)",...K,...Ge].join(" && ");yield`((${Z}) => { ${ht}; return ${Et}})(${_e})`}oe.uniqueItems===!0&&(yield`((${Z}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${_e})`)}function*s(oe,De,_e){yield`(typeof value === 'object' && Symbol.asyncIterator in ${_e})`}function*o(oe,De,_e){yield`(typeof ${_e} === 'bigint')`,JE(oe.exclusiveMaximum)&&(yield`${_e} < BigInt(${oe.exclusiveMaximum})`),JE(oe.exclusiveMinimum)&&(yield`${_e} > BigInt(${oe.exclusiveMinimum})`),JE(oe.maximum)&&(yield`${_e} <= BigInt(${oe.maximum})`),JE(oe.minimum)&&(yield`${_e} >= BigInt(${oe.minimum})`),JE(oe.multipleOf)&&(yield`(${_e} % BigInt(${oe.multipleOf})) === 0`)}function*a(oe,De,_e){yield`(typeof ${_e} === 'boolean')`}function*l(oe,De,_e){yield*V(oe.returns,De,`${_e}.prototype`)}function*c(oe,De,_e){yield`(${_e} instanceof Date) && Number.isFinite(${_e}.getTime())`,ho(oe.exclusiveMaximumTimestamp)&&(yield`${_e}.getTime() < ${oe.exclusiveMaximumTimestamp}`),ho(oe.exclusiveMinimumTimestamp)&&(yield`${_e}.getTime() > ${oe.exclusiveMinimumTimestamp}`),ho(oe.maximumTimestamp)&&(yield`${_e}.getTime() <= ${oe.maximumTimestamp}`),ho(oe.minimumTimestamp)&&(yield`${_e}.getTime() >= ${oe.minimumTimestamp}`),ho(oe.multipleOfTimestamp)&&(yield`(${_e}.getTime() % ${oe.multipleOfTimestamp}) === 0`)}function*u(oe,De,_e){yield`(typeof ${_e} === 'function')`}function*d(oe,De,_e){let Z=globalThis.Object.getOwnPropertyNames(oe.$defs).reduce((de,ve)=>[...de,oe.$defs[ve]],[]);yield*V(Lb(oe.$ref),[...De,...Z],_e)}function*p(oe,De,_e){yield`Number.isInteger(${_e})`,ho(oe.exclusiveMaximum)&&(yield`${_e} < ${oe.exclusiveMaximum}`),ho(oe.exclusiveMinimum)&&(yield`${_e} > ${oe.exclusiveMinimum}`),ho(oe.maximum)&&(yield`${_e} <= ${oe.maximum}`),ho(oe.minimum)&&(yield`${_e} >= ${oe.minimum}`),ho(oe.multipleOf)&&(yield`(${_e} % ${oe.multipleOf}) === 0`)}function*A(oe,De,_e){let Z=oe.allOf.map(de=>he(de,De,_e)).join(" && ");if(oe.unevaluatedProperties===!1){let de=j(`${new RegExp(UN(oe))};`),ve=`Object.getOwnPropertyNames(${_e}).every(key => ${de}.test(key))`;yield`(${Z} && ${ve})`}else if(Hp(oe.unevaluatedProperties)){let de=j(`${new RegExp(UN(oe))};`),ve=`Object.getOwnPropertyNames(${_e}).every(key => ${de}.test(key) || ${he(oe.unevaluatedProperties,De,`${_e}[key]`)})`;yield`(${Z} && ${ve})`}else yield`(${Z})`}function*g(oe,De,_e){yield`(typeof value === 'object' && Symbol.iterator in ${_e})`}function*m(oe,De,_e){if(typeof oe.const=="number"||typeof oe.const=="boolean")yield`(${_e} === ${oe.const})`;else if(typeof oe.const=="string")yield`(${_e} === ${B3(oe.const)})`;else throw Error("Invalid Literal Value")}function*f(oe,De,_e){yield"false"}function*h(oe,De,_e){yield`(!${he(oe.not,De,_e)})`}function*E(oe,De,_e){yield`(${_e} === null)`}function*y(oe,De,_e){yield kX.IsNumberLike(_e),ho(oe.exclusiveMaximum)&&(yield`${_e} < ${oe.exclusiveMaximum}`),ho(oe.exclusiveMinimum)&&(yield`${_e} > ${oe.exclusiveMinimum}`),ho(oe.maximum)&&(yield`${_e} <= ${oe.maximum}`),ho(oe.minimum)&&(yield`${_e} >= ${oe.minimum}`),ho(oe.multipleOf)&&(yield`(${_e} % ${oe.multipleOf}) === 0`)}function*C(oe,De,_e){yield kX.IsObjectLike(_e),ho(oe.minProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length >= ${oe.minProperties}`),ho(oe.maxProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length <= ${oe.maxProperties}`);let Z=Object.getOwnPropertyNames(oe.properties);for(let de of Z){let ve=wZr(_e,de),Ne=oe.properties[de];if(oe.required&&oe.required.includes(de))yield*V(Ne,De,ve),(GN(Ne)||e(Ne))&&(yield`(${B3(de)} in ${_e})`);else{let Le=he(Ne,De,ve);yield kX.IsExactOptionalProperty(_e,de,Le)}}if(oe.additionalProperties===!1)if(oe.required&&oe.required.length===Z.length)yield`Object.getOwnPropertyNames(${_e}).length === ${Z.length}`;else{let de=`[${Z.map(ve=>`${B3(ve)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${_e}).every(key => ${de}.includes(key))`}if(typeof oe.additionalProperties=="object"){let de=he(oe.additionalProperties,De,`${_e}[key]`),ve=`[${Z.map(Ne=>`${B3(Ne)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${_e}).every(key => ${ve}.includes(key) || ${de}))`}}function*S(oe,De,_e){yield`${_e} instanceof Promise`}function*v(oe,De,_e){yield kX.IsRecordLike(_e),ho(oe.minProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length >= ${oe.minProperties}`),ho(oe.maxProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length <= ${oe.maxProperties}`);let[Z,de]=Object.entries(oe.patternProperties)[0],ve=j(`${new RegExp(Z)}`),Ne=he(de,De,"value"),Le=Hp(oe.additionalProperties)?he(oe.additionalProperties,De,_e):oe.additionalProperties===!1?"false":"true",K=`(${ve}.test(key) ? ${Ne} : ${Le})`;yield`(Object.entries(${_e}).every(([key, value]) => ${K}))`}function*_(oe,De,_e){let Z=Hc(oe,De);if(ae.functions.has(oe.$ref))return yield`${Ee(oe.$ref)}(${_e})`;yield*V(Z,De,_e)}function*R(oe,De,_e){let Z=j(`${new RegExp(oe.source,oe.flags)};`);yield`(typeof ${_e} === 'string')`,ho(oe.maxLength)&&(yield`${_e}.length <= ${oe.maxLength}`),ho(oe.minLength)&&(yield`${_e}.length >= ${oe.minLength}`),yield`${Z}.test(${_e})`}function*B(oe,De,_e){yield`(typeof ${_e} === 'string')`,ho(oe.maxLength)&&(yield`${_e}.length <= ${oe.maxLength}`),ho(oe.minLength)&&(yield`${_e}.length >= ${oe.minLength}`),oe.pattern!==void 0&&(yield`${j(`${new RegExp(oe.pattern)};`)}.test(${_e})`),oe.format!==void 0&&(yield`format(${B3(oe.format)}, ${_e})`)}function*F(oe,De,_e){yield`(typeof ${_e} === 'symbol')`}function*Q(oe,De,_e){yield`(typeof ${_e} === 'string')`,yield`${j(`${new RegExp(oe.pattern)};`)}.test(${_e})`}function*P(oe,De,_e){yield`${Ee(oe.$ref)}(${_e})`}function*D(oe,De,_e){if(yield`Array.isArray(${_e})`,oe.items===void 0)return yield`${_e}.length === 0`;yield`(${_e}.length === ${oe.maxItems})`;for(let Z=0;Z<oe.items.length;Z++)yield`${he(oe.items[Z],De,`${_e}[${Z}]`)}`}function*M(oe,De,_e){yield`${_e} === undefined`}function*H(oe,De,_e){yield`(${oe.anyOf.map(de=>he(de,De,_e)).join(" || ")})`}function*X(oe,De,_e){yield`${_e} instanceof Uint8Array`,ho(oe.maxByteLength)&&(yield`(${_e}.length <= ${oe.maxByteLength})`),ho(oe.minByteLength)&&(yield`(${_e}.length >= ${oe.minByteLength})`)}function*$(oe,De,_e){yield"true"}function*Y(oe,De,_e){yield kX.IsVoidLike(_e)}function*ee(oe,De,_e){let Z=ae.instances.size;ae.instances.set(Z,oe),yield`kind(${B3(oe[gr])}, ${Z}, ${_e})`}function*V(oe,De,_e,Z=!0){let de=bc(oe.$id)?[...De,oe]:De,ve=oe;if(Z&&bc(oe.$id)){let Ne=Ee(oe.$id);if(ae.functions.has(Ne))return yield`${Ne}(${_e})`;{ae.functions.set(Ne,"<deferred>");let Le=ge(Ne,oe,De,"value",!1);return ae.functions.set(Ne,Le),yield`${Ne}(${_e})`}}switch(ve[gr]){case"Any":return yield*n(ve,de,_e);case"Argument":return yield*r(ve,de,_e);case"Array":return yield*i(ve,de,_e);case"AsyncIterator":return yield*s(ve,de,_e);case"BigInt":return yield*o(ve,de,_e);case"Boolean":return yield*a(ve,de,_e);case"Constructor":return yield*l(ve,de,_e);case"Date":return yield*c(ve,de,_e);case"Function":return yield*u(ve,de,_e);case"Import":return yield*d(ve,de,_e);case"Integer":return yield*p(ve,de,_e);case"Intersect":return yield*A(ve,de,_e);case"Iterator":return yield*g(ve,de,_e);case"Literal":return yield*m(ve,de,_e);case"Never":return yield*f(ve,de,_e);case"Not":return yield*h(ve,de,_e);case"Null":return yield*E(ve,de,_e);case"Number":return yield*y(ve,de,_e);case"Object":return yield*C(ve,de,_e);case"Promise":return yield*S(ve,de,_e);case"Record":return yield*v(ve,de,_e);case"Ref":return yield*_(ve,de,_e);case"RegExp":return yield*R(ve,de,_e);case"String":return yield*B(ve,de,_e);case"Symbol":return yield*F(ve,de,_e);case"TemplateLiteral":return yield*Q(ve,de,_e);case"This":return yield*P(ve,de,_e);case"Tuple":return yield*D(ve,de,_e);case"Undefined":return yield*M(ve,de,_e);case"Union":return yield*H(ve,de,_e);case"Uint8Array":return yield*X(ve,de,_e);case"Unknown":return yield*$(ve,de,_e);case"Void":return yield*Y(ve,de,_e);default:if(!Uf.Has(ve[gr]))throw new k$t(oe);return yield*ee(ve,de,_e)}}let ae={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function he(oe,De,_e,Z=!0){return`(${[...V(oe,De,_e,Z)].join(" && ")})`}function Ee(oe){return`check_${T$t.Encode(oe)}`}function j(oe){let De=`local_${ae.variables.size}`;return ae.variables.set(De,`const ${De} = ${oe}`),De}function ge(oe,De,_e,Z,de=!0){let[ve,Ne]=[`
|
|
616
|
+
`.indexOf(t.charAt(e))!==-1}var e$t=b(()=>{"use strict";zKe();DXr()});function QXr(t,e=[],n=Kve.DEFAULT){let r=null,i=[],s=[];function o(l){Array.isArray(i)?i.push(l):r!==null&&(i[r]=l)}return XKe(t,{onObjectBegin:()=>{let l={};o(l),s.push(i),i=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let l=[];o(l),s.push(i),i=l,r=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:o,onError:(l,c,u)=>{e.push({error:l,offset:c,length:u})}},n),i[0]}function t$t(t,e=[],n=Kve.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){r.type==="property"&&(r.length=l-r.offset,r=r.parent)}function s(l){return r.children.push(l),l}XKe(t,{onObjectBegin:l=>{r=s({type:"object",offset:l,length:-1,parent:r,children:[]})},onObjectProperty:(l,c,u)=>{r=s({type:"property",offset:c,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:l,offset:c,length:u,parent:r})},onObjectEnd:(l,c)=>{i(l+c),r.length=l+c-r.offset,r=r.parent,i(l+c)},onArrayBegin:(l,c)=>{r=s({type:"array",offset:l,length:-1,parent:r,children:[]})},onArrayEnd:(l,c)=>{r.length=l+c-r.offset,r=r.parent,i(l+c)},onLiteralValue:(l,c,u)=>{s({type:gpa(l),offset:c,length:u,parent:r,value:l}),i(c+u)},onSeparator:(l,c,u)=>{r.type==="property"&&(l===":"?r.colonOffset=c:l===","&&i(c))},onError:(l,c,u)=>{e.push({error:l,offset:c,length:u})}},n);let a=r.children[0];return a&&delete a.parent,a}function JKe(t,e){if(!t)return;let n=t;for(let r of e)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let i=!1;for(let s of n.children)if(Array.isArray(s.children)&&s.children[0].value===r&&s.children.length===2){n=s.children[1],i=!0;break}if(!i)return}else{let i=r;if(n.type!=="array"||i<0||!Array.isArray(n.children)||i>=n.children.length)return;n=n.children[i]}return n}function XKe(t,e,n=Kve.DEFAULT){let r=Zve(t,!1),i=[],s=0;function o(M){return M?()=>s===0&&M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(M){return M?H=>s===0&&M(H,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(M){return M?H=>s===0&&M(H,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function c(M){return M?()=>{s>0?s++:M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(s=1)}:()=>!0}function u(M){return M?()=>{s>0&&s--,s===0&&M(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=c(e.onObjectBegin),p=l(e.onObjectProperty),A=u(e.onObjectEnd),g=c(e.onArrayBegin),m=u(e.onArrayEnd),f=l(e.onLiteralValue),h=a(e.onSeparator),E=o(e.onComment),y=a(e.onError),C=n&&n.disallowComments,S=n&&n.allowTrailingComma;function v(){for(;;){let M=r.scan();switch(r.getTokenError()){case 4:_(14);break;case 5:_(15);break;case 3:_(13);break;case 1:C||_(11);break;case 2:_(12);break;case 6:_(16);break}switch(M){case 12:case 13:C?_(10):E();break;case 16:_(1);break;case 15:case 14:break;default:return M}}}function _(M,H=[],X=[]){if(y(M),H.length+X.length>0){let $=r.getToken();for(;$!==17;){if(H.indexOf($)!==-1){v();break}else if(X.indexOf($)!==-1)break;$=v()}}}function R(M){let H=r.getTokenValue();return M?f(H):(p(H),i.push(H)),v(),!0}function B(){switch(r.getToken()){case 11:let M=r.getTokenValue(),H=Number(M);isNaN(H)&&(_(2),H=0),f(H);break;case 7:f(null);break;case 8:f(!0);break;case 9:f(!1);break;default:return!1}return v(),!0}function F(){return r.getToken()!==10?(_(3,[],[2,5]),!1):(R(!1),r.getToken()===6?(h(":"),v(),D()||_(4,[],[2,5])):_(5,[],[2,5]),i.pop(),!0)}function Q(){d(),v();let M=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(M||_(4,[],[]),h(","),v(),r.getToken()===2&&S)break}else M&&_(6,[],[]);F()||_(4,[],[2,5]),M=!0}return A(),r.getToken()!==2?_(7,[2],[]):v(),!0}function P(){g(),v();let M=!0,H=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(H||_(4,[],[]),h(","),v(),r.getToken()===4&&S)break}else H&&_(6,[],[]);M?(i.push(0),M=!1):i[i.length-1]++,D()||_(4,[],[4,5]),H=!0}return m(),M||i.pop(),r.getToken()!==4?_(8,[4],[]):v(),!0}function D(){switch(r.getToken()){case 3:return P();case 1:return Q();case 10:return R(!0);default:return B()}}return v(),r.getToken()===17?n.allowEmptyContent?!0:(_(4,[],[]),!1):D()?(r.getToken()!==17&&_(9,[],[]),!0):(_(4,[],[]),!1)}function gpa(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}var Kve,n$t=b(()=>{"use strict";zKe();(function(t){t.DEFAULT={allowTrailingComma:!1}})(Kve||(Kve={}))});function MXr(t,e,n,r){let i=e.slice(),o=t$t(t,[]),a,l;for(;i.length>0&&(l=i.pop(),a=JKe(o,i),a===void 0&&n!==void 0);)typeof l=="string"?n={[l]:n}:n=[n];if(a)if(a.type==="object"&&typeof l=="string"&&Array.isArray(a.children)){let c=JKe(a,[l]);if(c!==void 0)if(n===void 0){if(!c.parent)throw new Error("Malformed AST");let u=a.children.indexOf(c.parent),d,p=c.parent.offset+c.parent.length;if(u>0){let A=a.children[u-1];d=A.offset+A.length}else d=a.offset+1,a.children.length>1&&(p=a.children[1].offset);return vX(t,{offset:d,length:p-d,content:""},r)}else return vX(t,{offset:c.offset,length:c.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let u=`${JSON.stringify(l)}: ${JSON.stringify(n)}`,d=r.getInsertionIndex?r.getInsertionIndex(a.children.map(A=>A.children[0].value)):a.children.length,p;if(d>0){let A=a.children[d-1];p={offset:A.offset+A.length,length:0,content:","+u}}else a.children.length===0?p={offset:a.offset+1,length:0,content:u}:p={offset:a.offset+1,length:0,content:u+","};return vX(t,p,r)}}else if(a.type==="array"&&typeof l=="number"&&Array.isArray(a.children)){let c=l;if(c===-1){let u=`${JSON.stringify(n)}`,d;if(a.children.length===0)d={offset:a.offset+1,length:0,content:u};else{let p=a.children[a.children.length-1];d={offset:p.offset+p.length,length:0,content:","+u}}return vX(t,d,r)}else if(n===void 0&&a.children.length>=0){let u=l,d=a.children[u],p;if(a.children.length===1)p={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===u){let A=a.children[u-1],g=A.offset+A.length,m=a.offset+a.length;p={offset:g,length:m-2-g,content:""}}else p={offset:d.offset,length:a.children[u+1].offset-d.offset,content:""};return vX(t,p,r)}else if(n!==void 0){let u,d=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>l){let p=a.children[l];u={offset:p.offset,length:p.length,content:d}}else if(a.children.length===0||l===0)u={offset:a.offset+1,length:0,content:a.children.length===0?d:d+","};else{let p=l>a.children.length?a.children.length:l,A=a.children[p-1];u={offset:A.offset+A.length,length:0,content:","+d}}return vX(t,u,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${c} as length is not sufficient`)}else throw new Error(`Can not add ${typeof l!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return vX(t,{offset:o?o.offset:0,length:o?o.length:0,content:JSON.stringify(n)},r)}}function vX(t,e,n){if(!n.formattingOptions)return[e];let r=ZKe(t,e),i=e.offset,s=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!$ve(r,i-1);)i--;for(;s<r.length&&!$ve(r,s);)s++}let o=qZt(r,{offset:i,length:s-i},{...n.formattingOptions,keepLines:!1});for(let l=o.length-1;l>=0;l--){let c=o[l];r=ZKe(r,c),i=Math.min(i,c.offset),s=Math.max(s,c.offset+c.length),s+=c.content.length-c.length}let a=t.length-(r.length-s)-i;return[{offset:i,length:a,content:r.substring(i,s)}]}function ZKe(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var FXr=b(()=>{"use strict";e$t();n$t()});function VXr(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function WXr(t,e,n,r){return MXr(t,e,n,r)}function YXr(t,e){let n=e.slice(0).sort((i,s)=>{let o=i.offset-s.offset;return o===0?i.length-s.length:o}),r=t.length;for(let i=n.length-1;i>=0;i--){let s=n[i];if(s.offset+s.length<=r)t=ZKe(t,s);else throw new Error("Overlapping edit");r=s.offset}return t}var OXr,PXr,UXr,GXr,LXr,HXr=b(()=>{"use strict";e$t();FXr();zKe();n$t();(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(OXr||(OXr={}));(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(PXr||(PXr={}));UXr=QXr,GXr=XKe;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(LXr||(LXr={}))});var Iy=b(()=>{Qbe();Qbe()});var zXr,hpa,Epa,ypa,Cpa,bpa,Ipa,Spa,JXr,XXr=b(()=>{"use strict";Iy();zXr=t=>t===null?"null":Array.isArray(t)?"an array":`a ${typeof t}`,hpa=t=>{try{return new RegExp(t),!0}catch{return!1}},Epa=Rn.discriminatedUnion("type",[Rn.object({type:Rn.enum(["allow","deny","ask-user"])}),Rn.object({type:Rn.literal("webhook-policy"),webhookUrl:Rn.url({error:'"permission.webhookUrl" must be a valid URL for a "webhook-policy".'})}),Rn.object({type:Rn.literal("script-policy"),script:Rn.string({error:'"permission.script" must be a non-empty string for a "script-policy".'}).min(1,{error:'"permission.script" must be a non-empty string for a "script-policy".'})})],{error:'unknown or invalid "permission".'}),ypa=Rn.object({toolName:Rn.string({error:'"toolName" must be a non-empty string.'}).min(1,{error:'"toolName" must be a non-empty string.'}),permission:Epa,eventType:Rn.enum(["tool-call","tool-response"],{error:'"eventType" must be "tool-call" or "tool-response" when present.'}).optional(),shellInputRegex:Rn.string({error:'"shellInputRegex" must be a string when present.'}).refine(hpa,{error:'"shellInputRegex" must be a valid regular expression when present.'}).optional()},{error:t=>`rule must be an object, got ${zXr(t.input)}.`}),Cpa=t=>{let e=t.issues[0];if(e===void 0)return"invalid rule.";let n=e.message.endsWith(".")?e.message:`${e.message}.`;return e.path.length===0||n.startsWith('"')?n:`"${e.path.join(".")}": ${n}`},bpa='Expected { "toolName": string, "permission": { "type": "allow" | "deny" | "ask-user" } | { "type": "webhook-policy", "webhookUrl": string } | { "type": "script-policy", "script": string }, "eventType"?: "tool-call" | "tool-response", "shellInputRegex"?: string }.',Ipa=t=>{let e=t.toolPermissions;if(e===void 0)return[];if(!Array.isArray(e))return t.toolPermissions=void 0,[`Ignoring "toolPermissions": expected an array of rules, got ${zXr(e)}.`];let n=[],r=[];for(let i=0;i<e.length;i++){let s=ypa.safeParse(e[i]);s.success?r.push(e[i]):n.push(`Dropping invalid "toolPermissions" rule at index ${i}: ${Cpa(s.error)} ${bpa}`)}return n.length>0&&(t.toolPermissions=r),n},Spa=t=>{if("queueMode"in t&&!("steeringMode"in t)&&(t.steeringMode=t.queueMode,t.queueMode=void 0),!("transport"in t)&&typeof t.websockets=="boolean"&&(t.transport=t.websockets?"websocket":"sse",t.websockets=void 0),"skills"in t&&typeof t.skills=="object"&&t.skills!==null&&!Array.isArray(t.skills)){let e=t.skills;e.enableSkillCommands!==void 0&&t.enableSkillCommands===void 0&&(t.enableSkillCommands=e.enableSkillCommands),Array.isArray(e.customDirectories)&&e.customDirectories.length>0?t.skills=e.customDirectories:t.skills=void 0}return t},JXr=t=>{let e=Spa(t),n=Ipa(e);return{settings:e,warnings:n}}});var _pa,vpa,r$t,wpa,_3,Rpa,ZXr,wX,Qle=b(()=>{"use strict";HXr();XXr();_pa=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),vpa=t=>{GXr(t,{onObjectProperty:e=>{if(_3.has(e))throw new Error(`Settings document contains reserved key "${e}".`)}})},r$t=t=>{vpa(t);let e=[],n=UXr(t,e,{allowTrailingComma:!0});if(e.length>0){let r=e.map(i=>VXr(i.error)).join(", ");throw new Error(`Failed to parse settings JSON: ${r}`)}if(n===void 0)return{};if(!_pa(n))throw new Error("Settings document is not a valid object. Expected a JSON object but found a different type (e.g., array).");return n},wpa={tabSize:2,insertSpaces:!0},_3=new Set(["__proto__","constructor","prototype"]),Rpa=t=>{let e=typeof t=="string"?t.split("."):[...t],n=typeof t=="string"?t:t.join(".");for(let r of e){if(r==="")throw new Error(`Invalid settings path "${n}": empty segment.`);if(_3.has(r))throw new Error(`Invalid settings path "${n}": "${r}" is a reserved key.`)}return e},ZXr=(t,e,n)=>{let r=WXr(t,Rpa(e),n,{formattingOptions:wpa});return YXr(t,r)},wX=class{constructor(e){this.settings={};this.warnings=[];this.store=e}drainWarnings(){let e=this.warnings;return this.warnings=[],e}getSettings(){return structuredClone(this.settings)}publish(e){let n=r$t(e),{settings:r,warnings:i}=JXr(n);this.warnings.push(...i),this.settings=r}reload(){let e=this.store.read();if(e===void 0||e.trim()===""){this.settings={};return}this.publish(e)}remove(e){let n={persisted:!1,effectiveChange:!1};return this.store.modify(r=>{if(r===void 0||r.trim()==="")return;r$t(r);let i=r;for(let s of e.paths)i=ZXr(i,s,void 0);if(i!==r)return this.publish(i),n={persisted:!0,effectiveChange:!0},i}),n}update(e){return this.updateAll([e])}updateAll(e){let n={persisted:!1,effectiveChange:!1};return this.store.modify(r=>{let i=r===void 0||r.trim()===""?"{}":r;r$t(i);let s=e.reduce((o,a)=>ZXr(o,a.path,a.value),i);if(s!==i)return this.publish(s),n={persisted:!0,effectiveChange:!0},s}),n}}});var i$t,jve,$Xr,Bpa,xpa,Tpa,kpa,RX,$Ke=b(()=>{"use strict";vr();Qle();i$t=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),jve=t=>Array.isArray(t)?t.map(jve):i$t(t)?Object.fromEntries(Object.entries(t).filter(([e])=>!_3.has(e)).map(([e,n])=>[e,jve(n)])):structuredClone(t),$Xr=(t,e,n=!1)=>{for(let[r,i]of Object.entries(e)){if(_3.has(r)||i===void 0)continue;let s=t[r];n&&r==="toolPermissions"&&Array.isArray(i)?t[r]=[...jve(i),...Array.isArray(s)?s:[]]:i$t(s)&&i$t(i)?t[r]={...s,...jve(i)}:t[r]=jve(i)}},Bpa="managed",xpa="global",Tpa="project",kpa="local",RX=class{constructor(e,n={},r={}){this.errors=[];this.locals=e,this.overrides=n,this.vfs=r}drainErrors(){let e=this.errors;return this.errors=[],e}getSettings(){return this.mergeLayers([xpa,Tpa,kpa,Bpa])}getGlobalSettings(){return this.locals.global.getSettings()}getManagedSettings(){return this.locals.managed.getSettings()}getLocalSettings(){return this.locals.local.getSettings()}getProjectSettings(){return this.locals.project.getSettings()}getVfsUserSettings(){return this.vfs.vfsUser?.getSettings()??{}}getVfsSpaceSettings(){return this.vfs.vfsSpace?.getSettings()??{}}getVfsOrgSettings(){return this.vfs.vfsOrg?.getSettings()??{}}mergeLayers(e){let n={},r=e.map(i=>this.locals[i].getSettings());for(let i of r)$Xr(n,i,!0);return $Xr(n,this.overrides),n}reload(){let e=[...Object.entries(this.locals),...Object.entries(this.vfs)];for(let[n,r]of e)if(r){try{r.reload()}catch(i){let s=i instanceof Error?i:new Error(String(i));on.error("settings reload failed",{scope:n,error:s}),this.errors.push({scope:n,error:s})}for(let i of r.drainWarnings())this.errors.push({scope:n,error:new Error(i)})}}remove(e,n){return this.routeWrite(e,r=>r.remove(n))}update(e,n){return this.routeWrite(e,r=>r.update(n))}updateAll(e,n){return this.routeWrite(e,r=>r.updateAll(n))}routeWrite(e,n){if(e==="managed")throw new Error('Refusing to write read-only settings scope "managed"');let r=this.getSettings(),i=n(this.locals[e]);for(let a of this.locals[e].drainWarnings())this.errors.push({scope:e,error:new Error(a)});if(!i.persisted)return i;let s=this.getSettings(),o=JSON.stringify(r)!==JSON.stringify(s);return{persisted:i.persisted,effectiveChange:o}}}});var s$t,o$t=b(()=>{"use strict";TXr();$Ke();Qle();s$t=(t,e)=>{let n=i=>new wX(new HKe(i)),r=new RX({managed:n(t.managedPath),global:n(t.globalPath),project:n(t.projectPath),local:n(t.localPath)},e,{vfsUser:t.vfsUserPath?n(t.vfsUserPath):void 0,vfsSpace:t.vfsSpacePath?n(t.vfsSpacePath):void 0,vfsOrg:t.vfsOrgPath?n(t.vfsOrgPath):void 0});return r.reload(),r}});var a$t,l$t,KXr,BX,KKe=b(()=>{"use strict";Qle();a$t=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),l$t=t=>{if(Array.isArray(t))return t.map(l$t);if(!a$t(t))return structuredClone(t);let e={};for(let[n,r]of Object.entries(t))_3.has(n)||(e[n]=l$t(r));return e},KXr=(t,e)=>{let n=structuredClone(t);for(let r of Object.keys(e)){let i=e[r];if(i===void 0||_3.has(r))continue;let s=n[r],o=l$t(i);a$t(s)&&a$t(o)?n[r]={...s,...o}:n[r]=o}return n},BX=class{constructor(e){this.errors=[];this.manager=e}get settings(){let e=this.manager.getSettings();return this.dynamicOverrides?KXr(e,this.dynamicOverrides):e}update(e,n,r){if(this.dynamicOverrides=void 0,typeof n=="object"&&"path"in n)return this.manager.update(e,n);try{this.manager.update(e,{path:n,value:r})}catch(i){let s=i instanceof Error?i:new Error(String(i));this.errors.push({scope:e,error:s})}}updateAll(e,n){return this.dynamicOverrides=void 0,this.manager.updateAll(e,n)}remove(e,n){return this.dynamicOverrides=void 0,this.manager.remove(e,n)}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.manager.getGlobalSettings())}getProjectSettings(){return structuredClone(this.manager.getProjectSettings())}getLocalSettings(){return structuredClone(this.manager.getLocalSettings())}getManagedSettings(){return structuredClone(this.manager.getManagedSettings())}getVfsUserSettings(){return structuredClone(this.manager.getVfsUserSettings())}getVfsSpaceSettings(){return structuredClone(this.manager.getVfsSpaceSettings())}getVfsOrgSettings(){return structuredClone(this.manager.getVfsOrgSettings())}reload(){this.manager.reload(),this.dynamicOverrides=void 0}applyOverrides(e){this.dynamicOverrides=KXr(this.dynamicOverrides??{},e)}flush(){}drainErrors(){let e=[...this.manager.drainErrors(),...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.update("global","lastChangelogVersion",e)}getSessionDir(){return this.settings.sessionDir}getWorktreeDir(){return this.settings.worktreeDir}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.update("global","defaultProvider",e)}setDefaultModel(e){this.update("global","defaultModel",e)}setDefaultModelAndProvider(e,n){this.dynamicOverrides=void 0;try{this.manager.updateAll("global",[{path:"defaultProvider",value:e},{path:"defaultModel",value:n}])}catch(r){let i=r instanceof Error?r:new Error(String(r));this.errors.push({scope:"global",error:i})}}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.update("global","steeringMode",e)}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.update("global","followUpMode",e)}getTheme(){return this.settings.theme}setTheme(e){this.update("global","theme",e)}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.update("global","defaultThinkingLevel",e)}getTransport(){return this.settings.transport??"sse"}setTransport(e){this.update("global","transport",e)}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.update("global","compaction.enabled",e)}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionProtectedHeadTokens(){return this.settings.compaction?.protectedHeadTokens??2e4}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSummarizationModel(){return this.settings.compaction?.summarizationModel}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),protectedHeadTokens:this.getCompactionProtectedHeadTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens(),summarizationModel:this.getCompactionSummarizationModel(),useReserveTrigger:this.settings.compaction?.useReserveTrigger??!1,inputBudgetTriggerRatio:this.settings.compaction?.inputBudgetTriggerRatio,fallbackInputBudgetRatio:this.settings.compaction?.fallbackInputBudgetRatio,maxMessageTokens:this.settings.compaction?.maxMessageTokens}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.update("global","retry.enabled",e)}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxDelayMs:this.settings.retry?.maxDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.update("global","hideThinkingBlock",e)}getCollapsePromptCommands(){return this.settings.collapsePromptCommands??!1}setCollapsePromptCommands(e){this.update("global","collapsePromptCommands",e)}getShellPath(){return this.settings.shellPath}setShellPath(e){this.update("global","shellPath",e)}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.update("global","quietStartup",e)}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.update("global","shellCommandPrefix",e)}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.update("global","npmCommand",e?[...e]:void 0)}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.update("global","collapseChangelog",e)}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.update("global","packages",e)}setProjectPackages(e){this.update("project","packages",e)}setLocalPackages(e){this.update("local","packages",e)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.update("global","extensions",e)}setProjectExtensionPaths(e){this.update("project","extensions",e)}setLocalExtensionPaths(e){this.update("local","extensions",e)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.update("global","skills",e)}setProjectSkillPaths(e){this.update("project","skills",e)}setLocalSkillPaths(e){this.update("local","skills",e)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.update("global","prompts",e)}setProjectPromptTemplatePaths(e){this.update("project","prompts",e)}setLocalPromptTemplatePaths(e){this.update("local","prompts",e)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.update("global","themes",e)}setProjectThemePaths(e){this.update("project","themes",e)}setLocalThemePaths(e){this.update("local","themes",e)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.update("global","enableSkillCommands",e)}getEnableHashline(){return this.settings.enableHashline??!1}setEnableHashline(e){this.update("global","enableHashline",e)}getEnabledPlugins(){let e={};for(let[n,r]of Object.entries(this.settings.enabledPlugins??{}))typeof r=="boolean"&&(e[n]=r);return e}getToolPermissions(){let e=this.settings.toolPermissions;return Array.isArray(e)?structuredClone(e):[]}getToolPermissionScopeRuleSets(){let e=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=[];for(let r of e){let i=r.toolPermissions;Array.isArray(i)&&i.length>0&&n.push(structuredClone(i))}return n}setPluginEnabled(e,n){this.update("global",["enabledPlugins",e],n)}getEnableToolSearch(){return this.settings.enableToolSearch??!1}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.update("global","terminal.showImages",e)}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.update("global","terminal.clearOnShrink",e)}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.update("global","images.autoResize",e)}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.update("global","images.blockImages",e)}getEnabledModels(){return this.settings.enabledModels?[...this.settings.enabledModels]:void 0}setEnabledModels(e){this.update("global","enabledModels",e)}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.update("global","doubleEscapeAction",e)}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.update("global","treeFilterMode",e)}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.update("global","showHardwareCursor",e)}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.update("global","editorPaddingX",Math.max(0,Math.min(3,Math.floor(e))))}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.update("global","autocompleteMaxVisible",Math.max(3,Math.min(20,Math.floor(e))))}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getHooks(){return this.settings.hooks}getTelemetrySettings(){return this.settings.telemetry}getEnvInjection(){let e=this.settings.env;if(!e||typeof e!="object")return{};let n={};for(let[r,i]of Object.entries(e))typeof i=="string"&&(n[r]=i);return n}getFeatureFlagOverrides(){return this.settings.featureFlagOverrides}getIndexingDirsUnion(){let e=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=r=>{let i=new Set,s=[];for(let o of e){let a=o[r];if(Array.isArray(a))for(let l of a)typeof l!="string"||i.has(l)||(i.add(l),s.push(l))}return s};return{allowDirs:n("indexingAllowDirs"),denyDirs:n("indexingDenyDirs")}}}});var c$t,u$t=b(()=>{"use strict";o$t();KKe();c$t=(t,e)=>new BX(s$t(t,e))});var qve,d$t=b(()=>{"use strict";qve=class{constructor(e){this.content=e}read(){return this.content}modify(e){let n=e(this.content);n!==void 0&&(this.content=n)}}});import{homedir as jXr}from"node:os";import{join as xX}from"node:path";var Npa,Dpa,p$t,ba,qXr=b(()=>{"use strict";d$t();$Ke();Qle();u$t();KKe();Npa="AUGGIE-V2_CODING_AGENT_DIR",Dpa=()=>{let t=process.env[`${Npa}_MANAGED`];if(t)return t==="~"?xX(jXr(),"settings.json"):t.startsWith("~/")?jXr()+t.slice(1):t;if(process.platform==="win32"){let e=process.env.ProgramData||"C:\\ProgramData";return xX(e,"augment","settings.json")}return xX("/etc","augment","settings.json")},p$t=t=>t?xX(t,".augment","settings.json"):void 0,ba={create(t,e,n){return c$t({globalPath:xX(e,"settings.json"),projectPath:xX(t,".augment","settings.json"),localPath:xX(t,".augment","settings.local.json"),managedPath:Dpa(),vfsUserPath:p$t(n?.user),vfsSpacePath:p$t(n?.space),vfsOrgPath:p$t(n?.org)})},inMemory(t={}){let e=r=>new wX(new qve(r===void 0?void 0:JSON.stringify(r))),n=new RX({managed:e(),local:e(),project:e(),global:e(t)});return n.reload(),new BX(n)}}});var lh=b(()=>{"use strict";u$t();KKe();qXr();o$t();d$t();$Ke();Qle()});var v3,A$t=b(()=>{v3={name:"@augmentcode/auggie-v2",version:"1.1.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie-v2",configDir:".augment"},bin:{pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",dev:"pnpm run bake:export-html && tsx src/cli.ts","dev:debug":"pnpm run bake:export-html && node --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/","assemble-changelog":"tsx scripts/assemble-changelog.ts",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.3.0","@augmentcode/api-client":"0.0.13-20260806T062724Z","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/cloud":"workspace:*","@hermes/daemon":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as Mpa}from"node:fs";import{homedir as ewe}from"node:os";import{dirname as g$t,join as g1,resolve as eZr}from"node:path";import{fileURLToPath as Fpa}from"node:url";function Ppa(){let t=`${m$t}\0${process.execPath||""}`.toLowerCase();return t.includes("/pnpm/")||t.includes("/.pnpm/")||t.includes("\\pnpm\\")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")||t.includes("\\yarn\\")?"yarn":t.includes("/npm/")||t.includes("/node_modules/")||t.includes("\\npm\\")?"npm":"unknown"}function tZr(t,e){switch(Ppa()){case"pnpm":return`Run: pnpm install -g ${t}`;case"yarn":return`Run: yarn global add ${t}`;case"npm":return`Run: npm install -g ${t}`;default:return`Run: npm install -g ${t}`}}function nZr(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?ewe():t.startsWith("~/")?ewe()+t.slice(1):t;let e=m$t;for(;e!==g$t(e);){if(Mpa(g1(e,"package.json")))return e;e=g$t(e)}return m$t}function Mle(){return eZr(g1(nZr(),"docs"))}function jKe(){return eZr(g1(nZr(),"CHANGELOG.md"))}function oZr(t){return`${process.env.PI_SHARE_VIEWER_URL||Upa}#${t}`}function aZr(t){return t==="~"?ewe():t.startsWith("~/")?ewe()+t.slice(1):t}function XP(){let t=process.env.AUGMENT_CACHE_DIR;return t?aZr(t):g1(ewe(),".augment")}function Hs(){let t=process.env[rwe];return t?aZr(t):XP()}function iwe(){return g1(Hs(),"themes")}function lZr(){return g1(Hs(),"models.json")}function f$t(){return g1(Hs(),"auth.json")}function cZr(){return g1(Hs(),"settings.json")}function TX(){return XP()}function Fle(){return g1(Hs(),"bin")}function uZr(){return g1(Hs(),"prompts")}function dZr(){return g1(Hs(),twe)}function pZr(){return g1(Hs(),`${co}-debug.log`)}var Opa,m$t,co,il,twe,nwe,rZr,Lpa,GA,iZr,sZr,rwe,Upa,wu=b(()=>{"use strict";A$t();Opa=Fpa(import.meta.url),m$t=g$t(Opa);co=v3.piConfig?.name||"pi",il=v3.piConfig?.configDir||".augment",twe="sessions-v2",nwe="auggie",rZr="Auggie Coding Agent",Lpa="1.1.0-prerelease.202608120522",GA=Lpa??v3.version,iZr="efda5a6e3bd00b13423c254fbfaa91194c152e50",sZr="2026-08-12T12:22:57Z",rwe=`${co.toUpperCase()}_CODING_AGENT_DIR`,Upa="https://pi.dev/session/"});function AZr(...t){return new globalThis.Function(...t)}var gZr=b(()=>{});var h$t,E$t,mZr,fZr=b(()=>{I8();qhe();ks();EA();h$t=class extends Qo{constructor(e){super(`Duplicate type kind '${e}' detected`)}},E$t=class extends Qo{constructor(e){super(`Duplicate string format '${e}' detected`)}};(function(t){function e(r,i){if(Uf.Has(r))throw new h$t(r);return Uf.Set(r,i),(s={})=>L8({...s,[gr]:r})}t.Type=e;function n(r,i){if(Qb.Has(r))throw new E$t(r);return Qb.Set(r,i),r}t.Format=n})(mZr||(mZr={}))});var qKe=b(()=>{gZr();ehe();fZr()});function Gpa(t){switch(t.errorType){case br.ArrayContains:return"Expected array to contain at least one matching value";case br.ArrayMaxContains:return`Expected array to contain no more than ${t.schema.maxContains} matching values`;case br.ArrayMinContains:return`Expected array to contain at least ${t.schema.minContains} matching values`;case br.ArrayMaxItems:return`Expected array length to be less or equal to ${t.schema.maxItems}`;case br.ArrayMinItems:return`Expected array length to be greater or equal to ${t.schema.minItems}`;case br.ArrayUniqueItems:return"Expected array elements to be unique";case br.Array:return"Expected array";case br.AsyncIterator:return"Expected AsyncIterator";case br.BigIntExclusiveMaximum:return`Expected bigint to be less than ${t.schema.exclusiveMaximum}`;case br.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${t.schema.exclusiveMinimum}`;case br.BigIntMaximum:return`Expected bigint to be less or equal to ${t.schema.maximum}`;case br.BigIntMinimum:return`Expected bigint to be greater or equal to ${t.schema.minimum}`;case br.BigIntMultipleOf:return`Expected bigint to be a multiple of ${t.schema.multipleOf}`;case br.BigInt:return"Expected bigint";case br.Boolean:return"Expected boolean";case br.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${t.schema.exclusiveMinimumTimestamp}`;case br.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${t.schema.exclusiveMaximumTimestamp}`;case br.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${t.schema.minimumTimestamp}`;case br.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${t.schema.maximumTimestamp}`;case br.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${t.schema.multipleOfTimestamp}`;case br.Date:return"Expected Date";case br.Function:return"Expected function";case br.IntegerExclusiveMaximum:return`Expected integer to be less than ${t.schema.exclusiveMaximum}`;case br.IntegerExclusiveMinimum:return`Expected integer to be greater than ${t.schema.exclusiveMinimum}`;case br.IntegerMaximum:return`Expected integer to be less or equal to ${t.schema.maximum}`;case br.IntegerMinimum:return`Expected integer to be greater or equal to ${t.schema.minimum}`;case br.IntegerMultipleOf:return`Expected integer to be a multiple of ${t.schema.multipleOf}`;case br.Integer:return"Expected integer";case br.IntersectUnevaluatedProperties:return"Unexpected property";case br.Intersect:return"Expected all values to match";case br.Iterator:return"Expected Iterator";case br.Literal:return`Expected ${typeof t.schema.const=="string"?`'${t.schema.const}'`:t.schema.const}`;case br.Never:return"Never";case br.Not:return"Value should not match";case br.Null:return"Expected null";case br.NumberExclusiveMaximum:return`Expected number to be less than ${t.schema.exclusiveMaximum}`;case br.NumberExclusiveMinimum:return`Expected number to be greater than ${t.schema.exclusiveMinimum}`;case br.NumberMaximum:return`Expected number to be less or equal to ${t.schema.maximum}`;case br.NumberMinimum:return`Expected number to be greater or equal to ${t.schema.minimum}`;case br.NumberMultipleOf:return`Expected number to be a multiple of ${t.schema.multipleOf}`;case br.Number:return"Expected number";case br.Object:return"Expected object";case br.ObjectAdditionalProperties:return"Unexpected property";case br.ObjectMaxProperties:return`Expected object to have no more than ${t.schema.maxProperties} properties`;case br.ObjectMinProperties:return`Expected object to have at least ${t.schema.minProperties} properties`;case br.ObjectRequiredProperty:return"Expected required property";case br.Promise:return"Expected Promise";case br.RegExp:return"Expected string to match regular expression";case br.StringFormatUnknown:return`Unknown format '${t.schema.format}'`;case br.StringFormat:return`Expected string to match '${t.schema.format}' format`;case br.StringMaxLength:return`Expected string length less or equal to ${t.schema.maxLength}`;case br.StringMinLength:return`Expected string length greater or equal to ${t.schema.minLength}`;case br.StringPattern:return`Expected string to match '${t.schema.pattern}'`;case br.String:return"Expected string";case br.Symbol:return"Expected symbol";case br.TupleLength:return`Expected tuple to have ${t.schema.maxItems||0} elements`;case br.Tuple:return"Expected tuple";case br.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${t.schema.maxByteLength}`;case br.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${t.schema.minByteLength}`;case br.Uint8Array:return"Expected Uint8Array";case br.Undefined:return"Expected undefined";case br.Union:return"Expected union value";case br.Void:return"Expected void";case br.Kind:return`Expected kind '${t.schema[gr]}'`;default:return"Unknown error type"}}function hZr(){return Vpa}var Vpa,y$t=b(()=>{ks();C$t();Vpa=Gpa});function Wpa(t,e){let n=e.find(r=>r.$id===t.$ref);if(n===void 0)throw new b$t(t);return Hc(n,e)}function uE(t,e){return!bc(t.$id)||e.some(n=>n.$id===t.$id)||e.push(t),e}function Hc(t,e){return t[gr]==="This"||t[gr]==="Ref"?Wpa(t,e):t}var b$t,EZr=b(()=>{EA();ks();aOe();b$t=class extends Qo{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`),this.schema=e}}});var m1=b(()=>{EZr()});function*Jpa(t){let e=t===0?1:Math.ceil(Math.floor(Math.log2(t)+1)/8);for(let n=0;n<e;n++)yield t>>8*(e-1-n)&255}function Xpa(t){VC(rv.Array);for(let e of t)Ple(e)}function Zpa(t){VC(rv.Boolean),VC(t?1:0)}function $pa(t){VC(rv.BigInt),CZr.setBigInt64(0,t);for(let e of bZr)VC(e)}function Kpa(t){VC(rv.Date),Ple(t.getTime())}function jpa(t){VC(rv.Null)}function qpa(t){VC(rv.Number),CZr.setFloat64(0,t);for(let e of bZr)VC(e)}function eAa(t){VC(rv.Object);for(let e of globalThis.Object.getOwnPropertyNames(t).sort())Ple(e),Ple(t[e])}function tAa(t){VC(rv.String);for(let e=0;e<t.length;e++)for(let n of Jpa(t.charCodeAt(e)))VC(n)}function nAa(t){VC(rv.Symbol),Ple(t.description)}function rAa(t){VC(rv.Uint8Array);for(let e=0;e<t.length;e++)VC(t[e])}function iAa(t){return VC(rv.Undefined)}function Ple(t){if(Yo(t))return Xpa(t);if(MN(t))return Zpa(t);if(JE(t))return $pa(t);if(kb(t))return Kpa(t);if(TF(t))return jpa(t);if(ho(t))return qpa(t);if($a(t))return eAa(t);if(bc(t))return tAa(t);if(kF(t))return nAa(t);if(ree(t))return rAa(t);if(Vp(t))return iAa(t);throw new I$t(t)}function VC(t){Ole=Ole^zpa[t],Ole=Ole*Ypa%Hpa}function w3(t){return Ole=BigInt("14695981039346656037"),Ple(t),Ole}var I$t,rv,Ole,Ypa,Hpa,zpa,yZr,CZr,bZr,IZr=b(()=>{ef();EA();I$t=class extends Qo{constructor(e){super("Unable to hash value"),this.value=e}};(function(t){t[t.Undefined=0]="Undefined",t[t.Null=1]="Null",t[t.Boolean=2]="Boolean",t[t.Number=3]="Number",t[t.String=4]="String",t[t.Object=5]="Object",t[t.Array=6]="Array",t[t.Date=7]="Date",t[t.Uint8Array=8]="Uint8Array",t[t.Symbol=9]="Symbol",t[t.BigInt=10]="BigInt"})(rv||(rv={}));Ole=BigInt("14695981039346656037"),[Ypa,Hpa]=[BigInt("1099511628211"),BigInt("18446744073709551616")],zpa=Array.from({length:256}).map((t,e)=>BigInt(e)),yZr=new Float64Array(1),CZr=new DataView(yZr.buffer),bZr=new Uint8Array(yZr.buffer)});var Lle=b(()=>{IZr()});function sAa(t){return t[gr]==="Any"||t[gr]==="Unknown"}function lc(t){return t!==void 0}function oAa(t,e,n){return!0}function aAa(t,e,n){return!0}function lAa(t,e,n){if(!Yo(n)||lc(t.minItems)&&!(n.length>=t.minItems)||lc(t.maxItems)&&!(n.length<=t.maxItems))return!1;for(let s of n)if(!dE(t.items,e,s))return!1;if(t.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=w3(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(lc(t.contains)||ho(t.minContains)||ho(t.maxContains)))return!0;let r=lc(t.contains)?t.contains:Ka(),i=n.reduce((s,o)=>dE(r,e,o)?s+1:s,0);return!(i===0||ho(t.minContains)&&i<t.minContains||ho(t.maxContains)&&i>t.maxContains)}function cAa(t,e,n){return rOe(n)}function uAa(t,e,n){return!(!JE(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.multipleOf)&&n%t.multipleOf!==BigInt(0))}function dAa(t,e,n){return MN(n)}function pAa(t,e,n){return dE(t.returns,e,n.prototype)}function AAa(t,e,n){return!(!kb(n)||lc(t.exclusiveMaximumTimestamp)&&!(n.getTime()<t.exclusiveMaximumTimestamp)||lc(t.exclusiveMinimumTimestamp)&&!(n.getTime()>t.exclusiveMinimumTimestamp)||lc(t.maximumTimestamp)&&!(n.getTime()<=t.maximumTimestamp)||lc(t.minimumTimestamp)&&!(n.getTime()>=t.minimumTimestamp)||lc(t.multipleOfTimestamp)&&n.getTime()%t.multipleOfTimestamp!==0)}function gAa(t,e,n){return LG(n)}function mAa(t,e,n){let r=globalThis.Object.values(t.$defs),i=t.$defs[t.$ref];return dE(i,[...e,...r],n)}function fAa(t,e,n){return!(!oOe(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.multipleOf)&&n%t.multipleOf!==0)}function hAa(t,e,n){let r=t.allOf.every(i=>dE(i,e,n));if(t.unevaluatedProperties===!1){let i=new RegExp(UN(t)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if(Yp(t.unevaluatedProperties)){let i=new RegExp(UN(t)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||dE(t.unevaluatedProperties,e,n[o]));return r&&s}else return r}function EAa(t,e,n){return iOe(n)}function yAa(t,e,n){return n===t.const}function CAa(t,e,n){return!1}function bAa(t,e,n){return!dE(t.not,e,n)}function IAa(t,e,n){return TF(n)}function SAa(t,e,n){return!(!bp.IsNumberLike(n)||lc(t.exclusiveMaximum)&&!(n<t.exclusiveMaximum)||lc(t.exclusiveMinimum)&&!(n>t.exclusiveMinimum)||lc(t.minimum)&&!(n>=t.minimum)||lc(t.maximum)&&!(n<=t.maximum)||lc(t.multipleOf)&&n%t.multipleOf!==0)}function _Aa(t,e,n){if(!bp.IsObjectLike(n)||lc(t.minProperties)&&!(Object.getOwnPropertyNames(n).length>=t.minProperties)||lc(t.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=t.maxProperties))return!1;let r=Object.getOwnPropertyNames(t.properties);for(let i of r){let s=t.properties[i];if(t.required&&t.required.includes(i)){if(!dE(s,e,n[i])||(GN(s)||sAa(s))&&!(i in n))return!1}else if(bp.IsExactOptionalProperty(n,i)&&!dE(s,e,n[i]))return!1}if(t.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return t.required&&t.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof t.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||dE(t.additionalProperties,e,n[s])):!0}function vAa(t,e,n){return sOe(n)}function wAa(t,e,n){if(!bp.IsRecordLike(n)||lc(t.minProperties)&&!(Object.getOwnPropertyNames(n).length>=t.minProperties)||lc(t.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=t.maxProperties))return!1;let[r,i]=Object.entries(t.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([c,u])=>s.test(c)?dE(i,e,u):!0),a=typeof t.additionalProperties=="object"?Object.entries(n).every(([c,u])=>s.test(c)?!0:dE(t.additionalProperties,e,u)):!0,l=t.additionalProperties===!1?Object.getOwnPropertyNames(n).every(c=>s.test(c)):!0;return o&&a&&l}function RAa(t,e,n){return dE(Hc(t,e),e,n)}function BAa(t,e,n){let r=new RegExp(t.source,t.flags);return lc(t.minLength)&&!(n.length>=t.minLength)||lc(t.maxLength)&&!(n.length<=t.maxLength)?!1:r.test(n)}function xAa(t,e,n){return!bc(n)||lc(t.minLength)&&!(n.length>=t.minLength)||lc(t.maxLength)&&!(n.length<=t.maxLength)||lc(t.pattern)&&!new RegExp(t.pattern).test(n)?!1:lc(t.format)?Qb.Has(t.format)?Qb.Get(t.format)(n):!1:!0}function TAa(t,e,n){return kF(n)}function kAa(t,e,n){return bc(n)&&new RegExp(t.pattern).test(n)}function NAa(t,e,n){return dE(Hc(t,e),e,n)}function DAa(t,e,n){if(!Yo(n)||t.items===void 0&&n.length!==0||n.length!==t.maxItems)return!1;if(!t.items)return!0;for(let r=0;r<t.items.length;r++)if(!dE(t.items[r],e,n[r]))return!1;return!0}function QAa(t,e,n){return Vp(n)}function MAa(t,e,n){return t.anyOf.some(r=>dE(r,e,n))}function FAa(t,e,n){return!(!ree(n)||lc(t.maxByteLength)&&!(n.length<=t.maxByteLength)||lc(t.minByteLength)&&!(n.length>=t.minByteLength))}function OAa(t,e,n){return!0}function PAa(t,e,n){return bp.IsVoidLike(n)}function LAa(t,e,n){return Uf.Has(t[gr])?Uf.Get(t[gr])(t,n):!1}function dE(t,e,n){let r=lc(t.$id)?uE(t,e):e,i=t;switch(i[gr]){case"Any":return oAa(i,r,n);case"Argument":return aAa(i,r,n);case"Array":return lAa(i,r,n);case"AsyncIterator":return cAa(i,r,n);case"BigInt":return uAa(i,r,n);case"Boolean":return dAa(i,r,n);case"Constructor":return pAa(i,r,n);case"Date":return AAa(i,r,n);case"Function":return gAa(i,r,n);case"Import":return mAa(i,r,n);case"Integer":return fAa(i,r,n);case"Intersect":return hAa(i,r,n);case"Iterator":return EAa(i,r,n);case"Literal":return yAa(i,r,n);case"Never":return CAa(i,r,n);case"Not":return bAa(i,r,n);case"Null":return IAa(i,r,n);case"Number":return SAa(i,r,n);case"Object":return _Aa(i,r,n);case"Promise":return vAa(i,r,n);case"Record":return wAa(i,r,n);case"Ref":return RAa(i,r,n);case"RegExp":return BAa(i,r,n);case"String":return xAa(i,r,n);case"Symbol":return TAa(i,r,n);case"TemplateLiteral":return kAa(i,r,n);case"This":return NAa(i,r,n);case"Tuple":return DAa(i,r,n);case"Undefined":return QAa(i,r,n);case"Union":return MAa(i,r,n);case"Uint8Array":return FAa(i,r,n);case"Unknown":return OAa(i,r,n);case"Void":return PAa(i,r,n);default:if(!Uf.Has(i[gr]))throw new S$t(i);return LAa(i,r,n)}}function El(...t){return t.length===3?dE(t[0],t[1],t[2]):dE(t[0],[],t[1])}var S$t,_$t=b(()=>{qKe();m1();Lle();ks();Qw();Q8();I8();EA();Bm();ef();Il();S$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}}});var iv=b(()=>{_$t()});function ZP(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function cc(t){return t!==void 0}function ns(t,e,n,r,i=[]){return{type:t,schema:e,path:n,value:r,message:hZr()({errorType:t,path:n,schema:e,value:r,errors:i}),errors:i}}function*UAa(t,e,n,r){}function*GAa(t,e,n,r){}function*VAa(t,e,n,r){if(!Yo(r))return yield ns(br.Array,t,n,r);cc(t.minItems)&&!(r.length>=t.minItems)&&(yield ns(br.ArrayMinItems,t,n,r)),cc(t.maxItems)&&!(r.length<=t.maxItems)&&(yield ns(br.ArrayMaxItems,t,n,r));for(let o=0;o<r.length;o++)yield*pE(t.items,e,`${n}/${o}`,r[o]);if(t.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=w3(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield ns(br.ArrayUniqueItems,t,n,r)),!(cc(t.contains)||cc(t.minContains)||cc(t.maxContains)))return;let i=cc(t.contains)?t.contains:Ka(),s=r.reduce((o,a,l)=>pE(i,e,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield ns(br.ArrayContains,t,n,r)),ho(t.minContains)&&s<t.minContains&&(yield ns(br.ArrayMinContains,t,n,r)),ho(t.maxContains)&&s>t.maxContains&&(yield ns(br.ArrayMaxContains,t,n,r))}function*WAa(t,e,n,r){rOe(r)||(yield ns(br.AsyncIterator,t,n,r))}function*YAa(t,e,n,r){if(!JE(r))return yield ns(br.BigInt,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.BigIntExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.BigIntExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.BigIntMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.BigIntMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==BigInt(0)&&(yield ns(br.BigIntMultipleOf,t,n,r))}function*HAa(t,e,n,r){MN(r)||(yield ns(br.Boolean,t,n,r))}function*zAa(t,e,n,r){yield*pE(t.returns,e,n,r.prototype)}function*JAa(t,e,n,r){if(!kb(r))return yield ns(br.Date,t,n,r);cc(t.exclusiveMaximumTimestamp)&&!(r.getTime()<t.exclusiveMaximumTimestamp)&&(yield ns(br.DateExclusiveMaximumTimestamp,t,n,r)),cc(t.exclusiveMinimumTimestamp)&&!(r.getTime()>t.exclusiveMinimumTimestamp)&&(yield ns(br.DateExclusiveMinimumTimestamp,t,n,r)),cc(t.maximumTimestamp)&&!(r.getTime()<=t.maximumTimestamp)&&(yield ns(br.DateMaximumTimestamp,t,n,r)),cc(t.minimumTimestamp)&&!(r.getTime()>=t.minimumTimestamp)&&(yield ns(br.DateMinimumTimestamp,t,n,r)),cc(t.multipleOfTimestamp)&&r.getTime()%t.multipleOfTimestamp!==0&&(yield ns(br.DateMultipleOfTimestamp,t,n,r))}function*XAa(t,e,n,r){LG(r)||(yield ns(br.Function,t,n,r))}function*ZAa(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref];yield*pE(s,[...e,...i],n,r)}function*$Aa(t,e,n,r){if(!oOe(r))return yield ns(br.Integer,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.IntegerExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.IntegerExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.IntegerMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.IntegerMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==0&&(yield ns(br.IntegerMultipleOf,t,n,r))}function*KAa(t,e,n,r){let i=!1;for(let s of t.allOf)for(let o of pE(s,e,n,r))i=!0,yield o;if(i)return yield ns(br.Intersect,t,n,r);if(t.unevaluatedProperties===!1){let s=new RegExp(UN(t));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield ns(br.IntersectUnevaluatedProperties,t,`${n}/${o}`,r))}if(typeof t.unevaluatedProperties=="object"){let s=new RegExp(UN(t));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=pE(t.unevaluatedProperties,e,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*jAa(t,e,n,r){iOe(r)||(yield ns(br.Iterator,t,n,r))}function*qAa(t,e,n,r){r!==t.const&&(yield ns(br.Literal,t,n,r))}function*ega(t,e,n,r){yield ns(br.Never,t,n,r)}function*tga(t,e,n,r){pE(t.not,e,n,r).next().done===!0&&(yield ns(br.Not,t,n,r))}function*nga(t,e,n,r){TF(r)||(yield ns(br.Null,t,n,r))}function*rga(t,e,n,r){if(!bp.IsNumberLike(r))return yield ns(br.Number,t,n,r);cc(t.exclusiveMaximum)&&!(r<t.exclusiveMaximum)&&(yield ns(br.NumberExclusiveMaximum,t,n,r)),cc(t.exclusiveMinimum)&&!(r>t.exclusiveMinimum)&&(yield ns(br.NumberExclusiveMinimum,t,n,r)),cc(t.maximum)&&!(r<=t.maximum)&&(yield ns(br.NumberMaximum,t,n,r)),cc(t.minimum)&&!(r>=t.minimum)&&(yield ns(br.NumberMinimum,t,n,r)),cc(t.multipleOf)&&r%t.multipleOf!==0&&(yield ns(br.NumberMultipleOf,t,n,r))}function*iga(t,e,n,r){if(!bp.IsObjectLike(r))return yield ns(br.Object,t,n,r);cc(t.minProperties)&&!(Object.getOwnPropertyNames(r).length>=t.minProperties)&&(yield ns(br.ObjectMinProperties,t,n,r)),cc(t.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=t.maxProperties)&&(yield ns(br.ObjectMaxProperties,t,n,r));let i=Array.isArray(t.required)?t.required:[],s=Object.getOwnPropertyNames(t.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield ns(br.ObjectRequiredProperty,t.properties[a],`${n}/${ZP(a)}`,void 0));if(t.additionalProperties===!1)for(let a of o)s.includes(a)||(yield ns(br.ObjectAdditionalProperties,t,`${n}/${ZP(a)}`,r[a]));if(typeof t.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*pE(t.additionalProperties,e,`${n}/${ZP(a)}`,r[a]));for(let a of s){let l=t.properties[a];t.required&&t.required.includes(a)?(yield*pE(l,e,`${n}/${ZP(a)}`,r[a]),GN(t)&&!(a in r)&&(yield ns(br.ObjectRequiredProperty,l,`${n}/${ZP(a)}`,void 0))):bp.IsExactOptionalProperty(r,a)&&(yield*pE(l,e,`${n}/${ZP(a)}`,r[a]))}}function*sga(t,e,n,r){sOe(r)||(yield ns(br.Promise,t,n,r))}function*oga(t,e,n,r){if(!bp.IsRecordLike(r))return yield ns(br.Object,t,n,r);cc(t.minProperties)&&!(Object.getOwnPropertyNames(r).length>=t.minProperties)&&(yield ns(br.ObjectMinProperties,t,n,r)),cc(t.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=t.maxProperties)&&(yield ns(br.ObjectMaxProperties,t,n,r));let[i,s]=Object.entries(t.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*pE(s,e,`${n}/${ZP(a)}`,l));if(typeof t.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*pE(t.additionalProperties,e,`${n}/${ZP(a)}`,l));if(t.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield ns(br.ObjectAdditionalProperties,t,`${n}/${ZP(a)}`,l)}}function*aga(t,e,n,r){yield*pE(Hc(t,e),e,n,r)}function*lga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);if(cc(t.minLength)&&!(r.length>=t.minLength)&&(yield ns(br.StringMinLength,t,n,r)),cc(t.maxLength)&&!(r.length<=t.maxLength)&&(yield ns(br.StringMaxLength,t,n,r)),!new RegExp(t.source,t.flags).test(r))return yield ns(br.RegExp,t,n,r)}function*cga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);cc(t.minLength)&&!(r.length>=t.minLength)&&(yield ns(br.StringMinLength,t,n,r)),cc(t.maxLength)&&!(r.length<=t.maxLength)&&(yield ns(br.StringMaxLength,t,n,r)),bc(t.pattern)&&(new RegExp(t.pattern).test(r)||(yield ns(br.StringPattern,t,n,r))),bc(t.format)&&(Qb.Has(t.format)?Qb.Get(t.format)(r)||(yield ns(br.StringFormat,t,n,r)):yield ns(br.StringFormatUnknown,t,n,r))}function*uga(t,e,n,r){kF(r)||(yield ns(br.Symbol,t,n,r))}function*dga(t,e,n,r){if(!bc(r))return yield ns(br.String,t,n,r);new RegExp(t.pattern).test(r)||(yield ns(br.StringPattern,t,n,r))}function*pga(t,e,n,r){yield*pE(Hc(t,e),e,n,r)}function*Aga(t,e,n,r){if(!Yo(r))return yield ns(br.Tuple,t,n,r);if(t.items===void 0&&r.length!==0)return yield ns(br.TupleLength,t,n,r);if(r.length!==t.maxItems)return yield ns(br.TupleLength,t,n,r);if(t.items)for(let i=0;i<t.items.length;i++)yield*pE(t.items[i],e,`${n}/${i}`,r[i])}function*gga(t,e,n,r){Vp(r)||(yield ns(br.Undefined,t,n,r))}function*mga(t,e,n,r){if(El(t,e,r))return;let i=t.anyOf.map(s=>new R3(pE(s,e,n,r)));yield ns(br.Union,t,n,r,i)}function*fga(t,e,n,r){if(!ree(r))return yield ns(br.Uint8Array,t,n,r);cc(t.maxByteLength)&&!(r.length<=t.maxByteLength)&&(yield ns(br.Uint8ArrayMaxByteLength,t,n,r)),cc(t.minByteLength)&&!(r.length>=t.minByteLength)&&(yield ns(br.Uint8ArrayMinByteLength,t,n,r))}function*hga(t,e,n,r){}function*Ega(t,e,n,r){bp.IsVoidLike(r)||(yield ns(br.Void,t,n,r))}function*yga(t,e,n,r){Uf.Get(t[gr])(t,r)||(yield ns(br.Kind,t,n,r))}function*pE(t,e,n,r){let i=cc(t.$id)?[...e,t]:e,s=t;switch(s[gr]){case"Any":return yield*UAa(s,i,n,r);case"Argument":return yield*GAa(s,i,n,r);case"Array":return yield*VAa(s,i,n,r);case"AsyncIterator":return yield*WAa(s,i,n,r);case"BigInt":return yield*YAa(s,i,n,r);case"Boolean":return yield*HAa(s,i,n,r);case"Constructor":return yield*zAa(s,i,n,r);case"Date":return yield*JAa(s,i,n,r);case"Function":return yield*XAa(s,i,n,r);case"Import":return yield*ZAa(s,i,n,r);case"Integer":return yield*$Aa(s,i,n,r);case"Intersect":return yield*KAa(s,i,n,r);case"Iterator":return yield*jAa(s,i,n,r);case"Literal":return yield*qAa(s,i,n,r);case"Never":return yield*ega(s,i,n,r);case"Not":return yield*tga(s,i,n,r);case"Null":return yield*nga(s,i,n,r);case"Number":return yield*rga(s,i,n,r);case"Object":return yield*iga(s,i,n,r);case"Promise":return yield*sga(s,i,n,r);case"Record":return yield*oga(s,i,n,r);case"Ref":return yield*aga(s,i,n,r);case"RegExp":return yield*lga(s,i,n,r);case"String":return yield*cga(s,i,n,r);case"Symbol":return yield*uga(s,i,n,r);case"TemplateLiteral":return yield*dga(s,i,n,r);case"This":return yield*pga(s,i,n,r);case"Tuple":return yield*Aga(s,i,n,r);case"Undefined":return yield*gga(s,i,n,r);case"Union":return yield*mga(s,i,n,r);case"Uint8Array":return yield*fga(s,i,n,r);case"Unknown":return yield*hga(s,i,n,r);case"Void":return yield*Ega(s,i,n,r);default:if(!Uf.Has(s[gr]))throw new v$t(t);return yield*yga(s,i,n,r)}}function ZQ(...t){let e=t.length===3?pE(t[0],t[1],"",t[2]):pE(t[0],[],"",t[1]);return new R3(e)}var br,v$t,R3,C$t=b(()=>{qKe();Qw();I8();QOe();y$t();EA();m1();Lle();iv();ks();Bm();ef();(function(t){t[t.ArrayContains=0]="ArrayContains",t[t.ArrayMaxContains=1]="ArrayMaxContains",t[t.ArrayMaxItems=2]="ArrayMaxItems",t[t.ArrayMinContains=3]="ArrayMinContains",t[t.ArrayMinItems=4]="ArrayMinItems",t[t.ArrayUniqueItems=5]="ArrayUniqueItems",t[t.Array=6]="Array",t[t.AsyncIterator=7]="AsyncIterator",t[t.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",t[t.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",t[t.BigIntMaximum=10]="BigIntMaximum",t[t.BigIntMinimum=11]="BigIntMinimum",t[t.BigIntMultipleOf=12]="BigIntMultipleOf",t[t.BigInt=13]="BigInt",t[t.Boolean=14]="Boolean",t[t.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",t[t.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",t[t.DateMaximumTimestamp=17]="DateMaximumTimestamp",t[t.DateMinimumTimestamp=18]="DateMinimumTimestamp",t[t.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",t[t.Date=20]="Date",t[t.Function=21]="Function",t[t.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",t[t.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",t[t.IntegerMaximum=24]="IntegerMaximum",t[t.IntegerMinimum=25]="IntegerMinimum",t[t.IntegerMultipleOf=26]="IntegerMultipleOf",t[t.Integer=27]="Integer",t[t.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",t[t.Intersect=29]="Intersect",t[t.Iterator=30]="Iterator",t[t.Kind=31]="Kind",t[t.Literal=32]="Literal",t[t.Never=33]="Never",t[t.Not=34]="Not",t[t.Null=35]="Null",t[t.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",t[t.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",t[t.NumberMaximum=38]="NumberMaximum",t[t.NumberMinimum=39]="NumberMinimum",t[t.NumberMultipleOf=40]="NumberMultipleOf",t[t.Number=41]="Number",t[t.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",t[t.ObjectMaxProperties=43]="ObjectMaxProperties",t[t.ObjectMinProperties=44]="ObjectMinProperties",t[t.ObjectRequiredProperty=45]="ObjectRequiredProperty",t[t.Object=46]="Object",t[t.Promise=47]="Promise",t[t.RegExp=48]="RegExp",t[t.StringFormatUnknown=49]="StringFormatUnknown",t[t.StringFormat=50]="StringFormat",t[t.StringMaxLength=51]="StringMaxLength",t[t.StringMinLength=52]="StringMinLength",t[t.StringPattern=53]="StringPattern",t[t.String=54]="String",t[t.Symbol=55]="Symbol",t[t.TupleLength=56]="TupleLength",t[t.Tuple=57]="Tuple",t[t.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",t[t.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",t[t.Uint8Array=60]="Uint8Array",t[t.Undefined=61]="Undefined",t[t.Union=62]="Union",t[t.Void=63]="Void"})(br||(br={}));v$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}};R3=class{constructor(e){this.iterator=e}[Symbol.iterator](){return this.iterator}First(){let e=this.iterator.next();return e.done?void 0:e.value}}});var Ule=b(()=>{C$t();y$t()});function VA(t,e,n){try{return tu(t)?t[Wp].Decode(n):n}catch(r){throw new w$t(t,e,n,r)}}function Cga(t,e,n,r){return Yo(r)?VA(t,n,r.map((i,s)=>ZT(t.items,e,`${n}/${s}`,i))):VA(t,n,r)}function bga(t,e,n,r){if(!$a(r)||l_(r))return VA(t,n,r);let i=Che(t),s=i.map(u=>u[0]),o={...r};for(let[u,d]of i)u in o&&(o[u]=ZT(d,e,`${n}/${u}`,o[u]));if(!tu(t.unevaluatedProperties))return VA(t,n,o);let a=Object.getOwnPropertyNames(o),l=t.unevaluatedProperties,c={...o};for(let u of a)s.includes(u)||(c[u]=VA(l,`${n}/${u}`,c[u]));return VA(t,n,c)}function Iga(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref],o=ZT(s,[...e,...i],n,r);return VA(t,n,o)}function Sga(t,e,n,r){return VA(t,n,ZT(t.not,e,n,r))}function _ga(t,e,n,r){if(!$a(r))return VA(t,n,r);let i=Ub(t),s={...r};for(let c of i)na(s,c)&&(Vp(s[c])&&(!PN(t.properties[c])||bp.IsExactOptionalProperty(s,c))||(s[c]=ZT(t.properties[c],e,`${n}/${c}`,s[c])));if(!Yp(t.additionalProperties))return VA(t,n,s);let o=Object.getOwnPropertyNames(s),a=t.additionalProperties,l={...s};for(let c of o)i.includes(c)||(l[c]=VA(a,`${n}/${c}`,l[c]));return VA(t,n,l)}function vga(t,e,n,r){if(!$a(r))return VA(t,n,r);let i=Object.getOwnPropertyNames(t.patternProperties)[0],s=new RegExp(i),o={...r};for(let u of Object.getOwnPropertyNames(r))s.test(u)&&(o[u]=ZT(t.patternProperties[i],e,`${n}/${u}`,o[u]));if(!Yp(t.additionalProperties))return VA(t,n,o);let a=Object.getOwnPropertyNames(o),l=t.additionalProperties,c={...o};for(let u of a)s.test(u)||(c[u]=VA(l,`${n}/${u}`,c[u]));return VA(t,n,c)}function wga(t,e,n,r){let i=Hc(t,e);return VA(t,n,ZT(i,e,n,r))}function Rga(t,e,n,r){let i=Hc(t,e);return VA(t,n,ZT(i,e,n,r))}function Bga(t,e,n,r){return Yo(r)&&Yo(t.items)?VA(t,n,t.items.map((i,s)=>ZT(i,e,`${n}/${s}`,r[s]))):VA(t,n,r)}function xga(t,e,n,r){for(let i of t.anyOf){if(!El(i,e,r))continue;let s=ZT(i,e,n,r);return VA(t,n,s)}return VA(t,n,r)}function ZT(t,e,n,r){let i=uE(t,e),s=t;switch(t[gr]){case"Array":return Cga(s,i,n,r);case"Import":return Iga(s,i,n,r);case"Intersect":return bga(s,i,n,r);case"Not":return Sga(s,i,n,r);case"Object":return _ga(s,i,n,r);case"Record":return vga(s,i,n,r);case"Ref":return wga(s,i,n,r);case"Symbol":return VA(s,n,r);case"This":return Rga(s,i,n,r);case"Tuple":return Bga(s,i,n,r);case"Union":return xga(s,i,n,r);default:return VA(s,n,r)}}function Vle(t,e,n){return ZT(t,e,"",n)}var Gle,w$t,SZr=b(()=>{ehe();ks();EA();Qw();m1();iv();ef();Il();Gle=class extends Qo{constructor(e,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=e,this.value=n,this.error=r}},w$t=class extends Qo{constructor(e,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=e,this.path=n,this.value=r,this.error=i}}});function Sy(t,e,n){try{return tu(t)?t[Wp].Encode(n):n}catch(r){throw new R$t(t,e,n,r)}}function Tga(t,e,n,r){let i=Sy(t,n,r);return Yo(i)?i.map((s,o)=>$T(t.items,e,`${n}/${o}`,s)):i}function kga(t,e,n,r){let i=globalThis.Object.values(t.$defs),s=t.$defs[t.$ref],o=Sy(t,n,r);return $T(s,[...e,...i],n,o)}function Nga(t,e,n,r){let i=Sy(t,n,r);if(!$a(r)||l_(r))return i;let s=Che(t),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=$T(p,e,`${n}/${d}`,a[d]));if(!tu(t.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),c=t.unevaluatedProperties,u={...a};for(let d of l)o.includes(d)||(u[d]=Sy(c,`${n}/${d}`,u[d]));return u}function Dga(t,e,n,r){return Sy(t.not,n,Sy(t,n,r))}function Qga(t,e,n,r){let i=Sy(t,n,r);if(!$a(i))return i;let s=Ub(t),o={...i};for(let u of s)na(o,u)&&(Vp(o[u])&&(!PN(t.properties[u])||bp.IsExactOptionalProperty(o,u))||(o[u]=$T(t.properties[u],e,`${n}/${u}`,o[u])));if(!Yp(t.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=t.additionalProperties,c={...o};for(let u of a)s.includes(u)||(c[u]=Sy(l,`${n}/${u}`,c[u]));return c}function Mga(t,e,n,r){let i=Sy(t,n,r);if(!$a(r))return i;let s=Object.getOwnPropertyNames(t.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=$T(t.patternProperties[s],e,`${n}/${d}`,a[d]));if(!Yp(t.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),c=t.additionalProperties,u={...a};for(let d of l)o.test(d)||(u[d]=Sy(c,`${n}/${d}`,u[d]));return u}function Fga(t,e,n,r){let i=Hc(t,e),s=$T(i,e,n,r);return Sy(t,n,s)}function Oga(t,e,n,r){let i=Hc(t,e),s=$T(i,e,n,r);return Sy(t,n,s)}function Pga(t,e,n,r){let i=Sy(t,n,r);return Yo(t.items)?t.items.map((s,o)=>$T(s,e,`${n}/${o}`,i[o])):[]}function Lga(t,e,n,r){for(let i of t.anyOf){if(!El(i,e,r))continue;let s=$T(i,e,n,r);return Sy(t,n,s)}for(let i of t.anyOf){let s=$T(i,e,n,r);if(El(t,e,s))return Sy(t,n,s)}return Sy(t,n,r)}function $T(t,e,n,r){let i=uE(t,e),s=t;switch(t[gr]){case"Array":return Tga(s,i,n,r);case"Import":return kga(s,i,n,r);case"Intersect":return Nga(s,i,n,r);case"Not":return Dga(s,i,n,r);case"Object":return Qga(s,i,n,r);case"Record":return Mga(s,i,n,r);case"Ref":return Fga(s,i,n,r);case"This":return Oga(s,i,n,r);case"Tuple":return Pga(s,i,n,r);case"Union":return Lga(s,i,n,r);default:return Sy(s,n,r)}}function Yle(t,e,n){return $T(t,e,"",n)}var Wle,R$t,_Zr=b(()=>{ehe();ks();EA();Qw();m1();iv();ef();Il();Wle=class extends Qo{constructor(e,n,r){super("The encoded value does not match the expected schema"),this.schema=e,this.value=n,this.error=r}},R$t=class extends Qo{constructor(e,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=e,this.path=n,this.value=r,this.error=i}}});function Uga(t,e){return tu(t)||ch(t.items,e)}function Gga(t,e){return tu(t)||ch(t.items,e)}function Vga(t,e){return tu(t)||ch(t.returns,e)||t.parameters.some(n=>ch(n,e))}function Wga(t,e){return tu(t)||ch(t.returns,e)||t.parameters.some(n=>ch(n,e))}function Yga(t,e){return tu(t)||tu(t.unevaluatedProperties)||t.allOf.some(n=>ch(n,e))}function Hga(t,e){let n=globalThis.Object.getOwnPropertyNames(t.$defs).reduce((i,s)=>[...i,t.$defs[s]],[]),r=t.$defs[t.$ref];return tu(t)||ch(r,[...n,...e])}function zga(t,e){return tu(t)||ch(t.items,e)}function Jga(t,e){return tu(t)||ch(t.not,e)}function Xga(t,e){return tu(t)||Object.values(t.properties).some(n=>ch(n,e))||Yp(t.additionalProperties)&&ch(t.additionalProperties,e)}function Zga(t,e){return tu(t)||ch(t.item,e)}function $ga(t,e){let n=Object.getOwnPropertyNames(t.patternProperties)[0],r=t.patternProperties[n];return tu(t)||ch(r,e)||Yp(t.additionalProperties)&&tu(t.additionalProperties)}function Kga(t,e){return tu(t)?!0:ch(Hc(t,e),e)}function jga(t,e){return tu(t)?!0:ch(Hc(t,e),e)}function qga(t,e){return tu(t)||!Vp(t.items)&&t.items.some(n=>ch(n,e))}function ema(t,e){return tu(t)||t.anyOf.some(n=>ch(n,e))}function ch(t,e){let n=uE(t,e),r=t;if(t.$id&&B$t.has(t.$id))return!1;switch(t.$id&&B$t.add(t.$id),t[gr]){case"Array":return Uga(r,n);case"AsyncIterator":return Gga(r,n);case"Constructor":return Vga(r,n);case"Function":return Wga(r,n);case"Import":return Hga(r,n);case"Intersect":return Yga(r,n);case"Iterator":return zga(r,n);case"Not":return Jga(r,n);case"Object":return Xga(r,n);case"Promise":return Zga(r,n);case"Record":return $ga(r,n);case"Ref":return Kga(r,n);case"This":return jga(r,n);case"Tuple":return qga(r,n);case"Union":return ema(r,n);default:return tu(t)}}function $P(t,e){return B$t.clear(),ch(t,e)}var B$t,vZr=b(()=>{m1();ks();Il();ef();B$t=new Set});var Hle=b(()=>{SZr();_Zr();vZr()});function B3(t){if(!bc(t))throw Error("ConstantString: Not a String");return`'${JSON.stringify(t).slice(1,-1).replace(/'/g,"\\'")}'`}function wZr(t,e){return`${t}[${B3(e)}]`}var x$t,eje,T$t,k$t,tje,kX,zle,RZr=b(()=>{Hle();Ule();qKe();EA();m1();Lle();ks();I8();Qw();QOe();Bm();HF();ef();qbt();x$t=class{constructor(e,n,r,i){this.schema=e,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=$P(e,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(e){return ZQ(this.schema,this.references,e)}Check(e){return this.checkFunc(e)}Decode(e){if(!this.checkFunc(e))throw new Gle(this.schema,e,this.Errors(e).First());return this.hasTransform?Vle(this.schema,this.references,e):e}Encode(e){let n=this.hasTransform?Yle(this.schema,this.references,e):e;if(!this.checkFunc(n))throw new Wle(this.schema,e,this.Errors(e).First());return n}};(function(t){function e(s){return s===36}t.DollarSign=e;function n(s){return s===95}t.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}t.IsAlpha=r;function i(s){return s>=48&&s<=57}t.IsNumeric=i})(eje||(eje={}));(function(t){function e(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);eje.IsNumeric(s)||eje.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}t.Encode=e})(T$t||(T$t={}));k$t=class extends Qo{constructor(e){super("Unknown type"),this.schema=e}},tje=class extends Qo{constructor(e){super("Preflight validation check failed to guard for the given schema"),this.schema=e}};(function(t){function e(o,a,l){return bp.ExactOptionalPropertyTypes?`(${B3(a)} in ${o} ? ${l} : true)`:`(${wZr(o,a)} !== undefined ? ${l} : true)`}t.IsExactOptionalProperty=e;function n(o){return bp.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}t.IsObjectLike=n;function r(o){return bp.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}t.IsRecordLike=r;function i(o){return bp.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}t.IsNumberLike=i;function s(o){return bp.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}t.IsVoidLike=s})(kX||(kX={}));(function(t){function e(oe){return oe[gr]==="Any"||oe[gr]==="Unknown"}function*n(oe,De,_e){yield"true"}function*r(oe,De,_e){yield"true"}function*i(oe,De,_e){yield`Array.isArray(${_e})`;let[Z,de]=[ue("value","any"),ue("acc","number")];ho(oe.maxItems)&&(yield`${_e}.length <= ${oe.maxItems}`),ho(oe.minItems)&&(yield`${_e}.length >= ${oe.minItems}`);let ve=he(oe.items,De,"value");if(yield`((array) => { for(const ${Z} of array) if(!(${ve})) { return false }; return true; })(${_e})`,Hp(oe.contains)||ho(oe.minContains)||ho(oe.maxContains)){let Ne=Hp(oe.contains)?oe.contains:Ka(),Le=he(Ne,De,"value"),K=ho(oe.minContains)?[`(count >= ${oe.minContains})`]:[],Ge=ho(oe.maxContains)?[`(count <= ${oe.maxContains})`]:[],ht=`const count = value.reduce((${de}, ${Z}) => ${Le} ? acc + 1 : acc, 0)`,Et=["(count > 0)",...K,...Ge].join(" && ");yield`((${Z}) => { ${ht}; return ${Et}})(${_e})`}oe.uniqueItems===!0&&(yield`((${Z}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${_e})`)}function*s(oe,De,_e){yield`(typeof value === 'object' && Symbol.asyncIterator in ${_e})`}function*o(oe,De,_e){yield`(typeof ${_e} === 'bigint')`,JE(oe.exclusiveMaximum)&&(yield`${_e} < BigInt(${oe.exclusiveMaximum})`),JE(oe.exclusiveMinimum)&&(yield`${_e} > BigInt(${oe.exclusiveMinimum})`),JE(oe.maximum)&&(yield`${_e} <= BigInt(${oe.maximum})`),JE(oe.minimum)&&(yield`${_e} >= BigInt(${oe.minimum})`),JE(oe.multipleOf)&&(yield`(${_e} % BigInt(${oe.multipleOf})) === 0`)}function*a(oe,De,_e){yield`(typeof ${_e} === 'boolean')`}function*l(oe,De,_e){yield*V(oe.returns,De,`${_e}.prototype`)}function*c(oe,De,_e){yield`(${_e} instanceof Date) && Number.isFinite(${_e}.getTime())`,ho(oe.exclusiveMaximumTimestamp)&&(yield`${_e}.getTime() < ${oe.exclusiveMaximumTimestamp}`),ho(oe.exclusiveMinimumTimestamp)&&(yield`${_e}.getTime() > ${oe.exclusiveMinimumTimestamp}`),ho(oe.maximumTimestamp)&&(yield`${_e}.getTime() <= ${oe.maximumTimestamp}`),ho(oe.minimumTimestamp)&&(yield`${_e}.getTime() >= ${oe.minimumTimestamp}`),ho(oe.multipleOfTimestamp)&&(yield`(${_e}.getTime() % ${oe.multipleOfTimestamp}) === 0`)}function*u(oe,De,_e){yield`(typeof ${_e} === 'function')`}function*d(oe,De,_e){let Z=globalThis.Object.getOwnPropertyNames(oe.$defs).reduce((de,ve)=>[...de,oe.$defs[ve]],[]);yield*V(Lb(oe.$ref),[...De,...Z],_e)}function*p(oe,De,_e){yield`Number.isInteger(${_e})`,ho(oe.exclusiveMaximum)&&(yield`${_e} < ${oe.exclusiveMaximum}`),ho(oe.exclusiveMinimum)&&(yield`${_e} > ${oe.exclusiveMinimum}`),ho(oe.maximum)&&(yield`${_e} <= ${oe.maximum}`),ho(oe.minimum)&&(yield`${_e} >= ${oe.minimum}`),ho(oe.multipleOf)&&(yield`(${_e} % ${oe.multipleOf}) === 0`)}function*A(oe,De,_e){let Z=oe.allOf.map(de=>he(de,De,_e)).join(" && ");if(oe.unevaluatedProperties===!1){let de=j(`${new RegExp(UN(oe))};`),ve=`Object.getOwnPropertyNames(${_e}).every(key => ${de}.test(key))`;yield`(${Z} && ${ve})`}else if(Hp(oe.unevaluatedProperties)){let de=j(`${new RegExp(UN(oe))};`),ve=`Object.getOwnPropertyNames(${_e}).every(key => ${de}.test(key) || ${he(oe.unevaluatedProperties,De,`${_e}[key]`)})`;yield`(${Z} && ${ve})`}else yield`(${Z})`}function*g(oe,De,_e){yield`(typeof value === 'object' && Symbol.iterator in ${_e})`}function*m(oe,De,_e){if(typeof oe.const=="number"||typeof oe.const=="boolean")yield`(${_e} === ${oe.const})`;else if(typeof oe.const=="string")yield`(${_e} === ${B3(oe.const)})`;else throw Error("Invalid Literal Value")}function*f(oe,De,_e){yield"false"}function*h(oe,De,_e){yield`(!${he(oe.not,De,_e)})`}function*E(oe,De,_e){yield`(${_e} === null)`}function*y(oe,De,_e){yield kX.IsNumberLike(_e),ho(oe.exclusiveMaximum)&&(yield`${_e} < ${oe.exclusiveMaximum}`),ho(oe.exclusiveMinimum)&&(yield`${_e} > ${oe.exclusiveMinimum}`),ho(oe.maximum)&&(yield`${_e} <= ${oe.maximum}`),ho(oe.minimum)&&(yield`${_e} >= ${oe.minimum}`),ho(oe.multipleOf)&&(yield`(${_e} % ${oe.multipleOf}) === 0`)}function*C(oe,De,_e){yield kX.IsObjectLike(_e),ho(oe.minProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length >= ${oe.minProperties}`),ho(oe.maxProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length <= ${oe.maxProperties}`);let Z=Object.getOwnPropertyNames(oe.properties);for(let de of Z){let ve=wZr(_e,de),Ne=oe.properties[de];if(oe.required&&oe.required.includes(de))yield*V(Ne,De,ve),(GN(Ne)||e(Ne))&&(yield`(${B3(de)} in ${_e})`);else{let Le=he(Ne,De,ve);yield kX.IsExactOptionalProperty(_e,de,Le)}}if(oe.additionalProperties===!1)if(oe.required&&oe.required.length===Z.length)yield`Object.getOwnPropertyNames(${_e}).length === ${Z.length}`;else{let de=`[${Z.map(ve=>`${B3(ve)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${_e}).every(key => ${de}.includes(key))`}if(typeof oe.additionalProperties=="object"){let de=he(oe.additionalProperties,De,`${_e}[key]`),ve=`[${Z.map(Ne=>`${B3(Ne)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${_e}).every(key => ${ve}.includes(key) || ${de}))`}}function*S(oe,De,_e){yield`${_e} instanceof Promise`}function*v(oe,De,_e){yield kX.IsRecordLike(_e),ho(oe.minProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length >= ${oe.minProperties}`),ho(oe.maxProperties)&&(yield`Object.getOwnPropertyNames(${_e}).length <= ${oe.maxProperties}`);let[Z,de]=Object.entries(oe.patternProperties)[0],ve=j(`${new RegExp(Z)}`),Ne=he(de,De,"value"),Le=Hp(oe.additionalProperties)?he(oe.additionalProperties,De,_e):oe.additionalProperties===!1?"false":"true",K=`(${ve}.test(key) ? ${Ne} : ${Le})`;yield`(Object.entries(${_e}).every(([key, value]) => ${K}))`}function*_(oe,De,_e){let Z=Hc(oe,De);if(ae.functions.has(oe.$ref))return yield`${Ee(oe.$ref)}(${_e})`;yield*V(Z,De,_e)}function*R(oe,De,_e){let Z=j(`${new RegExp(oe.source,oe.flags)};`);yield`(typeof ${_e} === 'string')`,ho(oe.maxLength)&&(yield`${_e}.length <= ${oe.maxLength}`),ho(oe.minLength)&&(yield`${_e}.length >= ${oe.minLength}`),yield`${Z}.test(${_e})`}function*B(oe,De,_e){yield`(typeof ${_e} === 'string')`,ho(oe.maxLength)&&(yield`${_e}.length <= ${oe.maxLength}`),ho(oe.minLength)&&(yield`${_e}.length >= ${oe.minLength}`),oe.pattern!==void 0&&(yield`${j(`${new RegExp(oe.pattern)};`)}.test(${_e})`),oe.format!==void 0&&(yield`format(${B3(oe.format)}, ${_e})`)}function*F(oe,De,_e){yield`(typeof ${_e} === 'symbol')`}function*Q(oe,De,_e){yield`(typeof ${_e} === 'string')`,yield`${j(`${new RegExp(oe.pattern)};`)}.test(${_e})`}function*P(oe,De,_e){yield`${Ee(oe.$ref)}(${_e})`}function*D(oe,De,_e){if(yield`Array.isArray(${_e})`,oe.items===void 0)return yield`${_e}.length === 0`;yield`(${_e}.length === ${oe.maxItems})`;for(let Z=0;Z<oe.items.length;Z++)yield`${he(oe.items[Z],De,`${_e}[${Z}]`)}`}function*M(oe,De,_e){yield`${_e} === undefined`}function*H(oe,De,_e){yield`(${oe.anyOf.map(de=>he(de,De,_e)).join(" || ")})`}function*X(oe,De,_e){yield`${_e} instanceof Uint8Array`,ho(oe.maxByteLength)&&(yield`(${_e}.length <= ${oe.maxByteLength})`),ho(oe.minByteLength)&&(yield`(${_e}.length >= ${oe.minByteLength})`)}function*$(oe,De,_e){yield"true"}function*Y(oe,De,_e){yield kX.IsVoidLike(_e)}function*ee(oe,De,_e){let Z=ae.instances.size;ae.instances.set(Z,oe),yield`kind(${B3(oe[gr])}, ${Z}, ${_e})`}function*V(oe,De,_e,Z=!0){let de=bc(oe.$id)?[...De,oe]:De,ve=oe;if(Z&&bc(oe.$id)){let Ne=Ee(oe.$id);if(ae.functions.has(Ne))return yield`${Ne}(${_e})`;{ae.functions.set(Ne,"<deferred>");let Le=ge(Ne,oe,De,"value",!1);return ae.functions.set(Ne,Le),yield`${Ne}(${_e})`}}switch(ve[gr]){case"Any":return yield*n(ve,de,_e);case"Argument":return yield*r(ve,de,_e);case"Array":return yield*i(ve,de,_e);case"AsyncIterator":return yield*s(ve,de,_e);case"BigInt":return yield*o(ve,de,_e);case"Boolean":return yield*a(ve,de,_e);case"Constructor":return yield*l(ve,de,_e);case"Date":return yield*c(ve,de,_e);case"Function":return yield*u(ve,de,_e);case"Import":return yield*d(ve,de,_e);case"Integer":return yield*p(ve,de,_e);case"Intersect":return yield*A(ve,de,_e);case"Iterator":return yield*g(ve,de,_e);case"Literal":return yield*m(ve,de,_e);case"Never":return yield*f(ve,de,_e);case"Not":return yield*h(ve,de,_e);case"Null":return yield*E(ve,de,_e);case"Number":return yield*y(ve,de,_e);case"Object":return yield*C(ve,de,_e);case"Promise":return yield*S(ve,de,_e);case"Record":return yield*v(ve,de,_e);case"Ref":return yield*_(ve,de,_e);case"RegExp":return yield*R(ve,de,_e);case"String":return yield*B(ve,de,_e);case"Symbol":return yield*F(ve,de,_e);case"TemplateLiteral":return yield*Q(ve,de,_e);case"This":return yield*P(ve,de,_e);case"Tuple":return yield*D(ve,de,_e);case"Undefined":return yield*M(ve,de,_e);case"Union":return yield*H(ve,de,_e);case"Uint8Array":return yield*X(ve,de,_e);case"Unknown":return yield*$(ve,de,_e);case"Void":return yield*Y(ve,de,_e);default:if(!Uf.Has(ve[gr]))throw new k$t(oe);return yield*ee(ve,de,_e)}}let ae={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function he(oe,De,_e,Z=!0){return`(${[...V(oe,De,_e,Z)].join(" && ")})`}function Ee(oe){return`check_${T$t.Encode(oe)}`}function j(oe){let De=`local_${ae.variables.size}`;return ae.variables.set(De,`const ${De} = ${oe}`),De}function ge(oe,De,_e,Z,de=!0){let[ve,Ne]=[`
|
|
617
617
|
`,ht=>"".padStart(ht," ")],Le=ue("value","any"),K=ie("boolean"),Ge=[...V(De,_e,Z,de)].map(ht=>`${Ne(4)}${ht}`).join(` &&${ve}`);return`function ${oe}(${Le})${K} {${ve}${Ne(2)}return (${ve}${Ge}${ve}${Ne(2)})
|
|
618
618
|
}`}function ue(oe,De){let _e=ae.language==="typescript"?`: ${De}`:"";return`${oe}${_e}`}function ie(oe){return ae.language==="typescript"?`: ${oe}`:""}function ne(oe,De,_e){let Z=ge("check",oe,De,"value"),de=ue("value","any"),ve=ie("boolean"),Ne=[...ae.functions.values()],Le=[...ae.variables.values()],K=bc(oe.$id)?`return function check(${de})${ve} {
|
|
619
619
|
return ${Ee(oe.$id)}(value)
|
|
@@ -6716,7 +6716,7 @@ Current working directory: ${t.fallbackCwd}`}function Vct(t){return`cwd from ses
|
|
|
6716
6716
|
${t.sessionCwd}
|
|
6717
6717
|
|
|
6718
6718
|
continue in current cwd
|
|
6719
|
-
${t.fallbackCwd}`}function WK(t,e){let n=vmn(t,e);if(n)throw new H4(n)}var H4,ZTe=b(()=>{"use strict";H4=class extends Error{constructor(e){super(B_l(e)),this.name="MissingSessionCwdError",this.issue=e}}});function OHi(t){let{reporter:e,sessionId:n,getRequestId:r}=t;return i=>{if(i.type==="tool_execution_start"){e.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&e.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var PHi=b(()=>{"use strict"});function LHi(t){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:t.summaryCharCount,summarization_duration_ms:t.durationMs??0,is_cache_about_to_expire:!1,is_aborted:t.aborted??!1,total_history_token_count:t.tokensBefore,head_token_count:t.tokensBefore,tail_token_count:t.tokensAfter??0,tokens_from_backend:!1}}function UHi(t,e){if(t.truncated)return{original_char_count:t.totalBytes,original_line_count:t.totalLines,truncated_char_count:t.outputBytes,truncated_line_count:t.outputLines,tool_type:e}}function GHi(t){let{source:e,scope:n}=t.sourceInfo;return n==="user"||n==="project"?n:e}function VHi(t){let e=t.filter(n=>!n.disableModelInvocation);if(e.length!==0)return{skills:e.map(n=>({skill_name:n.name,skill_source:GHi(n)})),skill_count:e.length}}function WHi(t,e,n){return{skill_name:t.name,skill_source:GHi(t),content_length:e,source_tool:n}}function YHi(t,e){return{retrieval_mode:e?.retrievalMode??"codebase_only",total_elapsed_ms:Tf(t.totalElapsedMs),codebase_retrieval_elapsed_ms:Tf(t.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:Tf(t.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:Tf(t.conversationInitialRetrievalMs),conversation_query_rewriting_ms:Tf(t.conversationQueryRewritingMs),conversation_followup_retrieval_ms:Tf(t.conversationFollowupRetrievalMs),blob_name_lookup_ms:Tf(t.blobNameLookupMs),codebase_chunks_retrieved:Tf(t.codebaseChunksRetrieved),conversation_chunks_initial:Tf(t.conversationChunksInitial),conversation_queries_generated:Tf(t.conversationQueriesGenerated),conversation_chunks_followup:Tf(t.conversationChunksFollowup),conversation_chunks_combined:Tf(t.conversationChunksCombined),codebase_result_len_pre_truncation:Tf(t.codebaseResultLenPreTruncation),codebase_result_len:Tf(t.codebaseResultLen),conversation_result_len_pre_truncation:Tf(t.conversationResultLenPreTruncation),conversation_result_len:Tf(t.conversationResultLen),combined_result_len:Tf(t.combinedResultLen),total_budget:Tf(t.totalBudget),codebase_budget:Tf(t.codebaseBudget),conversation_budget:Tf(t.conversationBudget),codebase_truncated:Wct(t.codebaseTruncated),conversation_truncated:Wct(t.conversationTruncated),final_truncated:Wct(t.finalTruncated),is_sub_agent:Wct(e?.isSubAgent)}}var Tf,Wct,HHi=b(()=>{"use strict";Tf=t=>t??0,Wct=t=>t??!1});import{randomUUID as x_l}from"node:crypto";function N_l(t){if(typeof t!="object"||t===null)return;let e=t.details;if(!(typeof e!="object"||e===null))return e}function D_l(t,e){if(t===e)return!0;if(!([...e].some(i=>zHi.has(i))&&t.endsWith(e)))return!1;let r=t.at(-e.length-1);return r!==void 0&&zHi.has(r)}function Q_l(t,e){return e.find(n=>D_l(n.filePath,t))}function JHi(t){let e=new wmn(t);return n=>e.handle(n)}function M_l(t){if(typeof t!="object"||t===null)return 0;let e=t.content;if(!Array.isArray(e))return 0;let n=0;for(let r of e)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function XHi(t){let e=VHi(t.skills);e&&t.reporter.skillsIncludedInChat(t.sessionId,e)}var T_l,k_l,zHi,wmn,ZHi=b(()=>{"use strict";HHi();T_l={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},k_l={read:"read","web-fetch":"web-fetch",bash:"bash"};zHi=new Set(["/","\\"]);wmn=class{constructor(e){this.readPathsByCallId=new Map,this.options=e}handle(e){if(e.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(e.type==="compaction_end"){this.emitCompaction(e);return}if(e.type==="tool_execution_start"){this.rememberReadPath(e);return}if(e.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(e.toolCallId);if(this.readPathsByCallId.delete(e.toolCallId),e.isError)return;let r=N_l(e.result);this.emitTruncation(e.toolName,r),this.emitRetrieval(e.toolName,r),this.emitSkillContent(e.toolName,n,e.result)}emitCompaction(e){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(e.aborted||!e.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,x_l(),n,LHi({summaryCharCount:e.result.summary.length,tokensBefore:e.result.tokensBefore,tokensAfter:e.tokensAfter,durationMs:e.durationMs,aborted:!1}))}rememberReadPath(e){if(e.toolName!=="read")return;let n=e.args?.path;typeof n=="string"&&this.readPathsByCallId.set(e.toolCallId,n)}emitTruncation(e,n){let r=k_l[e];if(!(r&&n?.truncation))return;let i=UHi(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(e,n){let r=T_l[e];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,YHi(n.analytics,{retrievalMode:r}))}emitSkillContent(e,n,r){if(e!=="read"||!n)return;let i=Q_l(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,WHi(i,M_l(r),"read"))}}});function $Hi(t){return t==="8"?{kind:"mode-disabled",message:F_l}:{kind:"generic"}}var F_l,Rmn=b(()=>{"use strict";F_l="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});import e8i from"node:v8";function Wpe(t){if(Gpe){Zy.debug("initSentryForCloudService: skipped (already initialized)");return}try{let e=Z_l();if(!e){Zy.info("initSentryForCloudService: skipped (AUGGIE_V2_SENTRY_DSN is empty, Sentry disabled)"),Gpe=!0;return}let n=$_l(),r=q_l(),i=evl();G1e({dsn:e,release:t.cliVersion,environment:r,sendDefaultPii:!1,sampleRate:1,tracesSampleRate:n,integrations:s=>s.filter(o=>o.name!=="Modules"&&o.name!=="Http"&&o.name!=="Undici")}),EE("app_mode",t.appMode??"cloud-service"),EE("cli_version",t.cliVersion),i&&(EE("tenant",i),Smn({agentId:"",vmId:"",tenant:i})),t.cloudId&&n8i(t.cloudId,""),Gpe=!0,Zy.info(`Sentry initialized: app_mode=${t.appMode??"cloud-service"}, env=${r}, release=${t.cliVersion}, tenant=${i??"<unknown>"}, tracesSampleRate=${n}`)}catch(e){Zy.warn(`initSentryForCloudService: failed: ${e}`),Gpe=!0}}function t8i(t){if(Gpe&&(t.id||t.email))try{Gce({id:t.id,email:t.email})}catch(e){Zy.warn(`setSentryUserContext: failed: ${e}`)}}function n8i(t,e){EE("cloud.id",t),EE("session_id",t),EE("conversation_id",t),e&&EE("vm_id",e),Vce(t),Smn({agentId:t,vmId:e})}function r8i(t){if(Gpe)try{n8i(t.agentId,t.vmId)}catch(e){Zy.warn(`setSentryCloudSessionContext: failed: ${e}`)}}function Ype(){if(KHi){Zy.debug("installCloudServiceProcessHandlers: skipped (already installed)");return}KHi=!0,process.on("uncaughtException",P_l),process.on("unhandledRejection",L_l),z_l(),Zy.info(`Sentry process handlers installed (flush timeout ${Hct}ms)`)}function V_l(t,e,n){return e<=0?!1:t/e>=n}function i8i(t){return Number.isFinite(t)&&t>=G_l}function W_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_CONSECUTIVE;if(!t)return xmn;let e=Number.parseInt(t,10);return!Number.isFinite(e)||e<1?xmn:e}function Y_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_THRESHOLD;if(!t)return Bmn;let e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?Bmn:e>1?1:e}function H_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_INTERVAL_MS;if(t===void 0)return jHi;let e=Number.parseInt(t,10);return Number.isFinite(e)?e<=0?0:e:jHi}function z_l(){if(Vpe)return;let t=H_l();if(t<=0){Zy.info("Heap-OOM watchdog disabled (AUGGIE_V2_SENTRY_HEAP_OOM_INTERVAL_MS <= 0)");return}let e=e8i.getHeapStatistics().heap_size_limit;if(!i8i(e)){Zy.info(`Heap-OOM watchdog disabled (v8 heap_size_limit not meaningful: ${e} bytes)`);return}let n=Y_l(),r=W_l();Vpe=setInterval(()=>{try{J_l(n,r)}catch(i){Zy.warn(`heap-OOM watchdog tick failed: ${i}`)}},t),Vpe.unref?.(),Zy.info(`Heap-OOM watchdog started (threshold=${n}, consecutive=${r}, interval=${t}ms)`)}function J_l(t,e){if(qHi)return;let n=process.memoryUsage().heapUsed,r=e8i.getHeapStatistics().heap_size_limit;if(!i8i(r)||!V_l(n,r,t)){Yct=0;return}if(Yct+=1,Yct<e){Zy.warn(`Heap-OOM watchdog: usage above threshold (${Yct}/${e} consecutive ticks)`);return}qHi=!0,X_l(n,r,t)}function X_l(t,e,n){let r=Math.round(t/1024/1024),i=Math.round(e/1024/1024),s=Math.round(t/e*100);Zy.error(`Heap-OOM watchdog tripped: heapUsed=${r}MiB / limit=${i}MiB (${s}%), threshold=${Math.round(n*100)}%. Reporting to Sentry and exiting.`),Vpe&&(clearInterval(Vpe),Vpe=void 0);try{Sa(o=>{o.setTag("crash.kind","heap_oom"),o.setFingerprint(["heap-oom"]),o.setContext("heap",{heap_used_mb:r,heap_size_limit_mb:i,used_fraction:t/e,threshold:n}),Ui(new Error(`JavaScript heap approaching limit: ${r}MiB / ${i}MiB (${s}%)`))})}catch(o){Zy.warn(`heap-OOM captureException failed: ${o}`)}g2(Hct).finally(()=>{process.exit(U_l)})}function Z_l(){let t=process.env.AUGGIE_V2_SENTRY_DSN;return t===void 0?O_l:t}function $_l(){let t=process.env.AUGGIE_V2_SENTRY_TRACES_SAMPLE_RATE;if(!t)return 1;let e=Number.parseFloat(t);return Number.isFinite(e)?e<0?0:e>1?1:e:1}function q_l(){let t=s8i();if(!t)return"unknown";let e;try{e=new URL(t).hostname}catch{return"unknown"}if(e.startsWith("localhost")||e.startsWith("127."))return"local";let n=e.split(".")[0]??"";return n.startsWith("test-")||n==="test"?"test":n.includes("staging")?"staging":e.endsWith(j_l)||n.startsWith("dev-")||n==="dev"?"dev":e==="api.augmentcode.com"||e.endsWith(K_l)?"production":"unknown"}function evl(){let t=s8i();if(!t)return;let e;try{e=new URL(t).hostname}catch{return}let n=e.split(".");if(!(n.length<2))return n[0]}function s8i(){let t=process.env.AUGMENT_SESSION_AUTH;if(t)try{let e=JSON.parse(t);if(typeof e.tenantURL=="string"&&e.tenantURL.length>0)return e.tenantURL}catch{}}var Zy,O_l,Gpe,Hct,KHi,P_l,L_l,Bmn,jHi,U_l,xmn,G_l,qHi,Vpe,Yct,K_l,j_l,Hpe=b(()=>{"use strict";vr();Ly();Gct();Zy=on.child({prefix:"sentry-init"}),O_l="https://cf0b4ce9e43e297fcf7328555628364a@o4509262619082752.ingest.us.sentry.io/4510925971914752",Gpe=!1;Hct=2e3,KHi=!1,P_l=t=>{Zy.error(`uncaughtException: ${t}`);try{Ui(t)}catch{}g2(Hct).finally(()=>{process.exit(1)})},L_l=t=>{Zy.error(`unhandledRejection: ${t}`);try{let e=t instanceof Error?t:new Error(String(t));Ui(e)}catch{}g2(Hct).finally(()=>{process.exit(1)})};Bmn=.9,jHi=2e3,U_l=12,xmn=3,G_l=64*1024*1024,qHi=!1,Yct=0;K_l=".api.augmentcode.com",j_l=".us-central.api.augmentcode.com"});function Tmn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zct(t,...e){for(let n of e){let r=t[n];if(Tmn(r))return r}}function YK(t,...e){for(let n of e){let r=t[n];if(typeof r=="string")return r}}function rvl(t){if(typeof t=="string")return t.trim().length>0?{kind:"text",text:t}:null;if(!Tmn(t))return null;let e=Tmn(t.block)?t.block:t,n=zct(e,"text","Text");if(n){let o=YK(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=zct(e,"tool_use","toolUse","ToolUse");if(r){let o=YK(r,"id"),a=YK(r,"name");if(!o||!a)return null;let l=YK(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=zct(e,"tool_result","toolResult","ToolResult");if(i){let o=YK(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:YK(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=zct(e,"thinking","Thinking");if(s){let o=YK(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function o8i(t){if(!Array.isArray(t.content))return[];let e=[];for(let n of t.content){let r=rvl(n);r!==null&&e.push(r)}return e}function ivl(t){let e=[],n=[];for(let r of t)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),e.push({type:Clt,text_node:{content:r.text}})}else r.kind==="tool_result"&&e.push({type:mpn,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:e,requestText:n.join("")}}function svl(t){let e=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&e.push({type:blt,content:s})};for(let s of t)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),e.push({type:fpn,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),e.push({type:hpn,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:e,responseText:n.join("")}}function ovl(t){let e=[];for(let n of t)if(n.role==="user")e.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=e.at(-1);r?r.assistants.push(n):e.push({assistants:[n]})}return e.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=ivl(n?o8i(n):[]),{responseNodes:o,responseText:a}=svl(r.flatMap(o8i));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function avl(t){let e=await t.fetchImpl(`${t.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.apiKey}`,...t.userAgent?{"User-Agent":t.userAgent}:{}},body:JSON.stringify({agent_id:t.agentId,limit:tvl,...t.beforeTimestamp?{before_timestamp:t.beforeTimestamp}:{}})});if(!e.ok)throw new Error(`Fetching cloud-agent chat history failed: ${e.status} ${e.statusText}`);return await e.json()}async function lvl(t){let e=new Set,n=[],r;for(let o=0;o<nvl;o++){let a=await avl({...t,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let c=cvl(l,e),u=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!u||c===0)break;r=u}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function cvl(t,e){let n=0;for(let r of t)(r.id===void 0||!e.has(r.id))&&n++,r.id!==void 0&&e.add(r.id);return n}function kmn(t){let e=t.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await t.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await lvl({fetchImpl:e,baseUrl:i,apiKey:r.apiKey,userAgent:t.userAgent,agentId:n});return ovl(s)}}var tvl,nvl,a8i=b(()=>{"use strict";_lt();tvl=400,nvl=200});import{join as dvl}from"node:path";function pvl(t){return t.map(e=>{if(e.type!=="message")return{type:e.type,id:e.id,parentId:e.parentId};let n=e.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:e.type,id:e.id,parentId:e.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function Avl(t){if(t instanceof Error){let e=t;return typeof e.status=="number"?String(e.status):typeof e.httpStatus=="number"?String(e.httpStatus):t.message}return String(t)}function gvl(t,e){let n=Avl(t);if(n!=="8"){let r=t instanceof Error?t.message:String(t);e.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:Rd(void 0),errorStatus:n}}function mvl(t,e,n){if(t.allowClientFeatureFlagOverrides!==!0)return t;let r=e.getFeatureFlagOverrides();if(!r)return t;try{let i=tFi(r);return nFi(t,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),t}}function fvl(t){return t.cosmosMultiRepoContextEnabled===!0}function hvl(t){return t.cosmosNestedAgentsMdEnabled===!0}function Evl(t,e){let{allowDirs:n,denyDirs:r}=t.getIndexingDirsUnion(),i=e?.get("parent-daemon-id"),s=typeof i=="string"&&i.length>0,o=e?.get("cloud-agent"),a=typeof o=="string"&&o.length>0;return{allowDirs:n,denyDirs:r,daemonChild:s&&a,allowIndexingFlag:e?.get("allow-indexing")===!0}}function yvl(t,e){if(!e)return[];let n=[],r=t.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of e){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}async function $Te(t){let e=t.cwd,n=t.agentDir??Hs(),r=t.authStorage??gM.create(dvl(n,"auth.json")),i=t.settingsManager??ba.create(e,n),s=t.modelRegistry??V4.empty(r),o=t.augmentUserAgent??Xy();await s.discoverAugmentModels(o);let a=await Ch(),l=o4();JOi(l);let c=[],u,d={flags:Rd(void 0)},p,A;if(a){u=await Jp(a.apiKey,a.apiUrl,o);try{let f=await u.getModelConfig();p=f.user?.id,A=f.user?.email,t8i({id:p,email:A});let h=Rd(f.featureFlagsV2);d={flags:mvl(h,i,c)}}catch(f){d=gvl(f,c)}}let g=new b4({...t.resourceLoaderOptions??{},cwd:e,agentDir:n,settingsManager:i,eventBus:l,multiRepoContextEnabled:fvl(d.flags),nestedContextDescentEnabled:hvl(d.flags)});await g.reload(),a&&u&&(l.emit("augment:api",u),l.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:p,email:A,cliVersion:GA}));let m=g.getExtensions();for(let{name:f,config:h,extensionPath:E}of m.runtime.pendingProviderRegistrations)try{s.registerProvider(f,h)}catch(y){let C=y instanceof Error?y.message:String(y);c.push({type:"error",message:`Extension "${E}" error: ${C}`})}return m.runtime.pendingProviderRegistrations=[],c.push(...yvl(g,t.extensionFlagValues)),l.emit("augment:indexing-policy",Evl(i,t.extensionFlagValues)),l.emit("augment:feature-flags",d),l.emit("augment:feature-flags-startup-complete",void 0),{cwd:e,agentDir:n,mcpConfigOverride:t.mcpConfigOverride,permissionOverride:t.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:g,diagnostics:c,augmentApi:u,featureFlags:d}}function KTe(t){let e=t.services.augmentApi,n=e?{webSearch:{operations:{runRemoteTool:e.runRemoteTool.bind(e)}},viewSession:{operations:{fetchChatHistory:Epn({readCredentials:Ch,userAgent:Xy()}),fetchCloudAgentChatHistory:kmn({readCredentials:Ch,userAgent:Xy()})}},sessionRetrieval:{operations:{createRequestId:e.createRequestId.bind(e),agentCodebaseRetrieval:e.agentCodebaseRetrieval.bind(e),fetchCloudAgentChatHistory:kmn({readCredentials:Ch,userAgent:Xy()}),fetchChatHistory:Epn({readCredentials:Ch,userAgent:Xy()}),getBranch:()=>pvl(t.sessionManager.getBranch())}}}:void 0;return Jct({cwd:t.services.cwd,agentDir:t.services.agentDir,authStorage:t.services.authStorage,settingsManager:t.services.settingsManager,modelRegistry:t.services.modelRegistry,resourceLoader:t.services.resourceLoader,sessionManager:t.sessionManager,model:t.model,thinkingLevel:t.thinkingLevel,scopedModels:t.scopedModels,tools:t.tools,customTools:t.customTools,sessionStartEvent:t.sessionStartEvent,toolsOptions:n,featureFlags:t.services.featureFlags.flags,mcpConfigOverride:t.services.mcpConfigOverride,permissionOverride:t.services.permissionOverride})}var Nmn=b(()=>{"use strict";tl();lh();Rmn();wu();Hpe();G4();OTe();ZBe();_de();mxe();Mv();Ixe();Dmn();a8i();ypn()});import{copyFileSync as Cvl,existsSync as l8i,mkdirSync as bvl}from"node:fs";import{basename as Ivl,join as Svl,resolve as c8i}from"node:path";function _vl(t){return typeof t=="string"?t:t.filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}async function Xct(t,e){WK(e.sessionManager,e.cwd);let n=await t(e);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new jTe(n.session,n.services,t,n.diagnostics,n.modelFallbackMessage,e.usageReporter,e.toolUseReporter,e.enableSentrySummarizationSpans)}var jTe,Qmn=b(()=>{"use strict";Gct();Fst();L1();ZTe();_v();PHi();ZHi();Nmn();jTe=class{constructor(e,n,r,i=[],s,o,a,l=!1){this._session=e,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let e=this._usageReporter,n=this._toolUseReporter;if(!(e||n))return;let r=this._session,i=r.sessionId,s=e?JHi({reporter:e,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;e&&(e.sessionStarted(i),XHi({reporter:e,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?OHi({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{e&&a.type==="message_start"&&P1(a.message.role)&&e.userMessageSent(i),s?.(a),o?.(a)})}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let e=FHi();this._summarizationSubscriber=e,this._summarizationUnsubscribe=this._session.subscribe(e.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let e=this._usageReporter,n=this._toolUseReporter;(e||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,e?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(e,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:e,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(e){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:e}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.detachUsageReporter(),this.detachSummarizationTracer(),await jBe(this.session.extensionRunner),this.session.dispose()}apply(e){process.cwd()!==e.services.cwd&&process.chdir(e.services.cwd),this._session=e.session,this._services=e.services,this._diagnostics=e.diagnostics,this._modelFallbackMessage=e.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer()}async switchSession(e,n){let r=await this.emitBeforeSwitch("resume",e);if(r.cancelled)return r;let i=this.session.sessionFile,s=Ha.open(e,void 0,n);return WK(s,this.cwd),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}async newSession(e){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=e?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=Ha.create(r,s);return e?.parentSession&&o.newSession({parentSession:e.parentSession}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),e?.setup&&(await e.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}async fork(e){if((await this.emitBeforeFork(e)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(e);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=_vl(i.content);else if(i.role==="promptCommandInvocation")s=Vy(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let c=this.session.sessionManager.getSessionDir();if(!r.parentId){let A=Ha.create(this.cwd,c);return A.newSession({parentSession:l}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:A,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=Ha.open(l,c).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=Ha.open(d,c);return await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}async importFromJsonl(e,n){let r=c8i(e);if(!l8i(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();l8i(i)||bvl(i,{recursive:!0});let s=Svl(i,Ivl(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;c8i(s)!==r&&Cvl(r,s);let l=Ha.open(s,i,n);return WK(l,this.cwd),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.detachUsageReporter(),this.detachSummarizationTracer(),await jBe(this.session.extensionRunner),this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as Mmn}from"node:path";function vvl(){return Hs()}async function Jct(t={}){let e=t.cwd??process.cwd(),n=t.agentDir??vvl(),r=t.resourceLoader,i=t.agentDir?Mmn(n,"auth.json"):void 0,s=t.agentDir?Mmn(n,"models.json"):void 0,o=t.authStorage??gM.create(i),a=t.modelRegistry??V4.create(o,s),l=t.settingsManager??ba.create(e,n),c=t.sessionManager??Ha.create(e,ES(e,n));r||(r=new b4({cwd:e,agentDir:n,settingsManager:l}),await r.reload(),Fv("resourceLoader.reload"));let u=c.buildSessionContext(),d=u.messages.length>0,p=c.getBranch().some(R=>R.type==="thinking_level_change"),A=t.model,g;if(!A&&d&&u.model){let R=a.find(u.model.provider,u.model.modelId);R&&a.hasConfiguredAuth(R)&&(A=R),A||(g=`Could not restore model ${u.model.provider}/${u.model.modelId}`)}A||(A=(await NHi({scopedModels:[],isContinuing:d,defaultProvider:l.getDefaultProvider(),defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,A?g&&(g+=`. Using ${A.provider}/${A.id}`):g=`No models available. Use /login or set an API key environment variable. See ${Mmn(Mle(),"providers.md")}. Then use /model to select a model.`);let m=t.thinkingLevel;m===void 0&&d&&(m=p?u.thinkingLevel:l.getDefaultThinkingLevel()??bk),m===void 0&&(m=l.getDefaultThinkingLevel()??bk),A?.reasoning||(m="off");let h=["read",process.env.AUGGIE_ENABLE_TERMINAL==="1"?"terminal":"bash","edit","write","web-fetch","web-search","view-session"],E=t.tools?t.tools.map(R=>R.name).filter(R=>R in pM):h,y,C=R=>{let B=z2(R);return l.getBlockImages()?B.map(F=>{if(F.role==="user"||F.role==="toolResult"){let Q=F.content;if(Array.isArray(Q)&&Q.some(D=>D.type==="image")){let D=Q.map(M=>M.type==="image"?{type:"text",text:"Image reading is disabled."}:M).filter((M,H,X)=>!(M.type==="text"&&M.text==="Image reading is disabled."&&H>0&&X[H-1].type==="text"&&X[H-1].text==="Image reading is disabled."));return{...F,content:D}}}return F}):B},S={};y=new _$({initialState:{systemPrompt:"",model:A,thinkingLevel:m,tools:[]},convertToLlm:C,streamFn:async(R,B,F)=>{let Q=await a.getApiKeyAndHeaders(R);if(!Q.ok)throw new Error(Q.error);return ND(R,B,{...F,apiKey:Q.apiKey,headers:Q.headers||F?.headers?{...Q.headers,...F?.headers}:void 0})},onPayload:(R,B)=>{let F=S.current;return F?.hasHandlers("before_provider_request")?F.emitBeforeProviderRequest(R):R},sessionId:c.getSessionId(),transformContext:R=>{let B=S.current;return B?B.emitContext(R):Promise.resolve(R)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),transport:l.getTransport(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(y.state.messages=u.messages,p||c.appendThinkingLevelChange(m)):(A&&c.appendModelChange(A.provider,A.id),c.appendThinkingLevelChange(m));let v=new kpe({agent:y,sessionManager:c,settingsManager:l,cwd:e,agentDir:n,mcpConfigOverride:t.mcpConfigOverride,permissionOverride:t.permissionOverride,scopedModels:t.scopedModels,resourceLoader:r,customTools:t.customTools,toolsOptions:t.toolsOptions,modelRegistry:a,initialActiveToolNames:E,extensionRunnerRef:S,sessionStartEvent:t.sessionStartEvent,featureFlags:t.featureFlags,role:t.role}),_=r.getExtensions();return{session:v,extensionsResult:_,modelFallbackMessage:g}}var Dmn=b(()=>{"use strict";OBe();tl();lh();wu();mct();OTe();gst();L1();Mv();JTe();Ixe();_v();Imn();P4();Qmn();P4()});function Omn(t){return Fmn[t]}function $ct(t){return t==="user"?"global":t}function Kct(t){return t==="global"?"user":t}function Pmn(t){let{files:e,alwaysShowPicker:n}=t;if(n&&e.length>=2)return{files:e};let r=e.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:e}}var Zct,Fmn,u8i=b(()=>{"use strict";Zct=["local","project","user"],Fmn={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});var D6A,qTe=b(()=>{"use strict";D6A=new TextDecoder("utf-8",{fatal:!0})});var Lmn=b(()=>{"use strict"});var Umn=b(()=>{"use strict"});var Gmn=b(()=>{"use strict";vr();Umn()});var d8i=b(()=>{"use strict"});var eke=b(()=>{"use strict";vr();XT();Lmn();Gmn();d8i()});import{execFile as xvl}from"node:child_process";import{promisify as Tvl}from"node:util";var q6A,Vmn=b(()=>{"use strict";vr();q6A=Tvl(xvl)});import{exec as Nvl}from"node:child_process";import{promisify as Dvl}from"node:util";var sJA,Wmn=b(()=>{"use strict";vr();Vmn();sJA=Dvl(Nvl)});var tke=b(()=>{"use strict"});var nke=b(()=>{"use strict";vr();XT()});var Qvl,pJA,AJA,jct=b(()=>{"use strict";vr();Qvl=Qr(UL(),1),pJA=1024*1024,AJA=on.child({prefix:"HierarchicalIgnoreFilter"})});var rke=b(()=>{"use strict";vr();XT()});import{execFile as Mvl,spawn as yJA}from"node:child_process";import{promisify as Fvl}from"node:util";var SJA,_JA,vJA,qct=b(()=>{"use strict";vr();tke();SJA=Fvl(Mvl),_JA=1024*1024,vJA=on.child({prefix:"git-tree-walker"})});import{execFile as Ovl}from"node:child_process";import{promisify as Pvl}from"node:util";var xJA,Hmn=b(()=>{"use strict";xJA=Pvl(Ovl)});var Lvl,NJA,zmn=b(()=>{"use strict";vr();Lvl=Qr(UL(),1),NJA=1024*1024});import{execFile as Yvl}from"node:child_process";import{promisify as Hvl}from"node:util";var OJA,Kmn=b(()=>{"use strict";qct();vr();qTe();eke();XT();Hmn();tke();qct();nke();zmn();rke();OJA=Hvl(Yvl)});var $JA,jmn=b(()=>{"use strict";vr();$JA=on.child({prefix:"FileWalker"})});var qmn=b(()=>{"use strict";vr();qTe();eke();XT();nke();jmn();jct();rke()});var cXA,efn=b(()=>{"use strict";vr();XT();cXA=on.child({prefix:"FileWatcher"})});var AXA,tfn=b(()=>{"use strict";vr();XT();AXA=on.child({prefix:"WatcherProcessor"})});var g8i=b(()=>{"use strict";vr();qTe();eke();Wmn();XT();tke();nke();jct();rke();Kmn();qmn();efn();tfn()});import{Worker as qvl}from"node:worker_threads";async function ike(){let t=Date.now(),e=new URL("./indexing-worker.mjs",import.meta.url),n;try{n=new qvl(e)}catch(r){return{ok:!1,error:`Worker construction threw: ${r instanceof Error?r.message:String(r)}`,durationMs:Date.now()-t}}return await new Promise(r=>{let i=!1,s=a=>{i||(i=!0,clearTimeout(o),n.terminate().catch(()=>{}),r(a))},o=setTimeout(()=>{s({ok:!1,error:`Worker did not report ready within ${m8i}ms`,durationMs:Date.now()-t})},m8i);o.unref(),n.on("message",a=>{a&&a.type==="ready"&&s({ok:!0,durationMs:Date.now()-t})}),n.on("error",a=>{s({ok:!1,error:`Worker error event: ${a.message}`,durationMs:Date.now()-t})}),n.on("exit",a=>{a!==0&&s({ok:!1,error:`Worker exited with code ${a} before ready`,durationMs:Date.now()-t})})})}var m8i,f8i=b(()=>{"use strict";m8i=1e4});var NXA,h8i=b(()=>{"use strict";vr();NXA=on.child({prefix:"AugmentApiAdapter"})});var nfn=b(()=>{"use strict";g8i();f8i();RZt();h8i();Hmn();Vmn();tke();qct();Wmn();nke();jmn();jct();zmn();rke();Kmn();qmn();qTe();eke();Lmn();Umn();Gmn();XT();efn();tfn()});var ewl,twl,nwl,C8i,rwl,iwl,swl,E8i,y8i,zpe,eut,rfn,ifn,owl,tut,afn,HK,lfn,awl,ske,lwl,sfn,ofn,cwl,nut,rut=b(()=>{"use strict";ewl="http/protobuf",twl="delta",nwl="hmac",C8i=new Set(["1","true","yes","on"]),rwl=new Set(["0","false","no","off"]),iwl={metrics:"METRICS",logs:"LOGS",traces:"TRACES"},swl={metrics:"/v1/metrics",logs:"/v1/logs",traces:"/v1/traces"},E8i=(t,e,n)=>{if(n==="grpc")return t;let r=swl[e],i=t.endsWith("/")?t.slice(0,-1):t;return i.endsWith(r)?i:i+r},y8i=t=>C8i.has(t.trim().toLowerCase()),zpe=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();return C8i.has(e)?!0:rwl.has(e)?!1:void 0},eut=(t,e)=>{if(t===void 0)return e;let n=Number.parseInt(t.trim(),10);return Number.isNaN(n)?e:n},rfn=(t,e)=>{let n=eut(t,e);return n>0?n:e},ifn=(t,e)=>t&&t>0?t:e,owl=t=>t==="grpc"||t==="http/protobuf"||t==="http/json",tut=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();return owl(e)?e:void 0},afn=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();if(e==="delta"||e==="cumulative")return e},HK=t=>{if(t===void 0)return;let e=t.trim();return e.length>0?e:void 0},lfn=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();if(e==="hmac"||e==="raw"||e==="off")return e},awl=(t,e)=>(t??"").split(",").map(n=>n.trim().toLowerCase()).includes(e),ske=t=>{let e={};if(!t)return e;for(let n of t.split(",")){let r=n.trim(),i=r.indexOf("=");if(i<=0)continue;let s=r.slice(0,i).trim();s&&(e[s]=r.slice(i+1).trim())}return e},lwl=(t,e,n)=>{if(n.enabled!==void 0)return n.enabled;let r=t.AUGGIE_ENABLE_TELEMETRY;if(r!==void 0)return y8i(r);let i=t.CLAUDE_CODE_ENABLE_TELEMETRY;return i!==void 0?y8i(i):e.enabled??!1},sfn=(t,e,n,r)=>{let i=iwl[e],s=r.protocol??tut(t[`OTEL_EXPORTER_OTLP_${i}_PROTOCOL`])??tut(t.OTEL_EXPORTER_OTLP_PROTOCOL)??n.protocol??ewl,o=HK(r.endpoint),a=HK(t[`OTEL_EXPORTER_OTLP_${i}_ENDPOINT`]),l=HK(t.OTEL_EXPORTER_OTLP_ENDPOINT)??HK(n.endpoint),c;o!==void 0?c=E8i(o,e,s):a!==void 0?c=a:l!==void 0&&(c=E8i(l,e,s));let u={...n.headers,...ske(t.OTEL_EXPORTER_OTLP_HEADERS),...ske(t[`OTEL_EXPORTER_OTLP_${i}_HEADERS`]),...r.headers};return{endpoint:c,headers:u,protocol:s}},ofn=t=>t!==void 0&&t>0?t:void 0,cwl=(t,e,n)=>({bufferDir:HK(n.bufferDir)??HK(t.AUGGIE_TELEMETRY_BUFFER_DIR)??HK(e.bufferDir),bufferMaxBytes:ofn(n.bufferMaxBytes)??rfn(t.AUGGIE_TELEMETRY_BUFFER_MAX_BYTES,ifn(e.bufferMaxBytes,52428800)),breakerFailureThreshold:ofn(n.breakerFailureThreshold)??rfn(t.AUGGIE_TELEMETRY_BREAKER_FAILURE_THRESHOLD,ifn(e.breakerFailureThreshold,3)),breakerBackoffMs:ofn(n.breakerBackoffMs)??rfn(t.AUGGIE_TELEMETRY_BREAKER_BACKOFF_MS,ifn(e.breakerBackoffMs,3e4))}),nut=(t={})=>{let e=t.env??process.env,n={...t.envInjection,...e},r=t.telemetry??{},i=t.managed??{},s={metrics:sfn(n,"metrics",r,i),logs:sfn(n,"logs",r,i),traces:sfn(n,"traces",r,i)},o=s.metrics.endpoint!==void 0||s.logs.endpoint!==void 0||s.traces.endpoint!==void 0;return{enabled:lwl(n,r,i)&&o,exporter:s,metricExportIntervalMs:i.metricExportIntervalMs??eut(n.OTEL_METRIC_EXPORT_INTERVAL,r.metricExportIntervalMs??2e4),logsExportIntervalMs:i.logsExportIntervalMs??eut(n.OTEL_LOGS_EXPORT_INTERVAL,r.logsExportIntervalMs??5e3),metricsTemporalityPreference:i.metricsTemporalityPreference??afn(n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE)??r.metricsTemporalityPreference??twl,resourceAttributes:{...r.resourceAttributes,...ske(n.OTEL_RESOURCE_ATTRIBUTES),...i.resourceAttributes},includeVersion:i.includeVersion??zpe(n.OTEL_METRICS_INCLUDE_VERSION)??r.includeVersion??!1,includeAccountUuid:i.includeAccountUuid??zpe(n.OTEL_METRICS_INCLUDE_ACCOUNT_UUID)??r.includeAccountUuid??!0,identity:{mode:i.identityMode??lfn(n.AUGGIE_TELEMETRY_IDENTITY_MODE)??r.identityMode??nwl,secret:i.identitySecret??n.AUGGIE_TELEMETRY_IDENTITY_SECRET??r.identitySecret},shutdownTimeoutMs:i.shutdownTimeoutMs??eut(n.AUGGIE_TELEMETRY_SHUTDOWN_TIMEOUT_MS,r.shutdownTimeoutMs??2e3),...cwl(n,r,i),genAiCaptureMessageContent:i.captureMessageContent??zpe(n.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT)??r.captureMessageContent??!1,genAiLatestExperimental:awl(n.OTEL_SEMCONV_STABILITY_OPT_IN,"gen_ai_latest_experimental"),logUserPrompts:i.logUserPrompts??zpe(n.OTEL_LOG_USER_PROMPTS)??r.logUserPrompts??!1,logToolDetails:i.logToolDetails??zpe(n.OTEL_LOG_TOOL_DETAILS)??r.logToolDetails??!1,langsmithCompat:i.langsmithCompat??zpe(n.AUGGIE_TELEMETRY_LANGSMITH_COMPAT)??r.langsmithCompat??!1}}});import{execFileSync as uwl}from"node:child_process";import{existsSync as dwl,readFileSync as pwl}from"node:fs";var b8i,Awl,gwl,I8i,S8i,mwl,dfn,_8i,fwl,hwl,Ewl,ywl,Cwl,cfn,bwl,Iwl,zK,Jpe,ufn,v8i,Swl,iut,pfn=b(()=>{"use strict";rut();b8i="/Library/Managed Preferences/com.augmentcode.auggie.plist",Awl="HKLM\\SOFTWARE\\Policies\\AugmentCode\\Auggie\\Telemetry",gwl="/etc/augment/auggie-managed-settings.json",I8i="/usr/bin/plutil",S8i="C:\\Windows\\System32\\reg.exe",mwl=2e3,dfn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),_8i=t=>dfn(t)?t.telemetry:void 0,fwl=(t,e)=>uwl(t,e,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:mwl,windowsHide:!0}),hwl=/^ {4}(.+?) {4}(REG_[A-Z_]+) {4}(.*)$/,Ewl=t=>{let e={};for(let n of t.split(/\r?\n/)){let r=hwl.exec(n);if(!r)continue;let[,i,s,o]=r;if(s==="REG_DWORD"||s==="REG_QWORD"){let a=Number(o.trim());Number.isFinite(a)&&(e[i]=a)}else(s==="REG_SZ"||s==="REG_EXPAND_SZ")&&(e[i]=o)}return Object.keys(e).length>0?e:void 0},ywl=(t={})=>{let e=t.execRead??fwl,n=t.fileExists??dwl;return{darwin:()=>{if(!(n(b8i)&&n(I8i)))return;let r=e(I8i,["-convert","json","-o","-",b8i]);return _8i(JSON.parse(r))},linux:()=>_8i(JSON.parse(pwl(gwl,"utf-8"))),win32:()=>{if(n(S8i))return Ewl(e(S8i,["query",Awl]))}}},Cwl=ywl(),cfn=t=>typeof t=="string"?t:void 0,bwl=new Set(["1","true","yes","on"]),Iwl=new Set(["0","false","no","off"]),zK=t=>{if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let e=t.trim().toLowerCase();if(bwl.has(e))return!0;if(Iwl.has(e))return!1}},Jpe=t=>{if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"){let e=t.trim();if(e.length===0)return;let n=Number(e);return Number.isFinite(n)?n:void 0}},ufn=t=>{if(typeof t!="string")return;let e=t.trim();return e.length>0?e:void 0},v8i=t=>{if(typeof t=="string"){let n=ske(t);return Object.keys(n).length>0?n:void 0}if(!dfn(t))return;let e={};for(let[n,r]of Object.entries(t))typeof r=="string"&&(e[n]=r);return Object.keys(e).length>0?e:void 0},Swl=t=>{if(!dfn(t))return;let e={breakerBackoffMs:Jpe(t.breakerBackoffMs),breakerFailureThreshold:Jpe(t.breakerFailureThreshold),bufferDir:ufn(t.bufferDir),bufferMaxBytes:Jpe(t.bufferMaxBytes),captureMessageContent:zK(t.captureMessageContent),enabled:zK(t.enabled),endpoint:ufn(t.endpoint),headers:v8i(t.headers),identityMode:lfn(cfn(t.identityMode)),identitySecret:ufn(t.identitySecret),includeAccountUuid:zK(t.includeAccountUuid),includeVersion:zK(t.includeVersion),logsExportIntervalMs:Jpe(t.logsExportIntervalMs),langsmithCompat:zK(t.langsmithCompat),logToolDetails:zK(t.logToolDetails),logUserPrompts:zK(t.logUserPrompts),metricExportIntervalMs:Jpe(t.metricExportIntervalMs),metricsTemporalityPreference:afn(cfn(t.metricsTemporalityPreference)),protocol:tut(cfn(t.protocol)),resourceAttributes:v8i(t.resourceAttributes),shutdownTimeoutMs:Jpe(t.shutdownTimeoutMs)};return Object.values(e).some(r=>r!==void 0)?e:void 0},iut=(t={})=>{let e=t.platform??process.platform;if(e!=="darwin"&&e!=="win32"&&e!=="linux")return;let n=t.readers?.[e]??Cwl[e];try{return Swl(n())}catch{return}}});function BS(t,e){if(typeof t=="string"){if(!e)throw new Error(`registerBuiltinExtension("${t}", factory) called without a factory`);sut.push({name:t,factory:e,kind:"bundled"});return}if((t.kind??"bundled")==="prebundled"){if(t.factory!==void 0)throw new Error(`registerBuiltinExtension("${t.name}"): prebundled extensions must not be registered with a factory (the static factory import would inline the extension into the SEA, see apps/auggie-v2/docs/prebundled-extensions.md).`);sut.push({name:t.name,kind:"prebundled"});return}if(!t.factory)throw new Error(`registerBuiltinExtension({ name: "${t.name}" }) called without a factory for kind="bundled"`);sut.push({name:t.name,factory:t.factory,kind:"bundled"})}function w8i(){return sut}function R8i(t,e){return t.filter(n=>!e.has(n.name))}var sut,Afn=b(()=>{"use strict";sut=[]});import{statSync as _wl}from"node:fs";import{resolve as vwl}from"node:path";function B8i(t,e,n){let r=[],i=[];if(!t||t.length===0)return{resolved:r,errors:i};let s=new Set([e]);for(let o of t){let a=LA(o),l=vwl(n,a);if(s.has(l))continue;let c;try{c=_wl(l)}catch(u){let d=u instanceof Error?u.message:String(u);i.push(`--add-workspace "${o}": ${d}`);continue}if(!c.isDirectory()){i.push(`--add-workspace "${o}": not a directory (${l})`);continue}s.add(l),r.push(l)}return{resolved:r,errors:i}}function x8i(t){return t.isCloudService?{kind:"tolerate",warnings:t.errors}:{kind:"fatal",fatalErrors:t.errors}}var T8i=b(()=>{"use strict";ih()});import{execFile as wwl}from"node:child_process";import{existsSync as Rwl,rmSync as Bwl}from"node:fs";import{promisify as xwl}from"node:util";function gfn(t){let e=t.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(e){let[,r,i]=e;return{sshUrl:t.endsWith(".git")?t:`${t}.git`,httpsUrl:`https://${r}/${i}.git`}}let n=t.match(/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(n){let[,r,i]=n;return{sshUrl:`git@${r}:${i}.git`,httpsUrl:t.endsWith(".git")?t:`${t}.git`}}return{sshUrl:t,httpsUrl:t}}function Q8i(t){return t instanceof Error?t.message:String(t)}async function mfn({sshUrl:t,httpsUrl:e,targetDir:n,extraArgs:r=[]}){let i;for(let s of[{url:t,env:Twl},{url:e,env:D8i}])try{return await N8i("git",["clone","--depth","1",...r,s.url,n],{env:s.env}),{success:!0}}catch(o){i=o,Rwl(n)&&Bwl(n,{recursive:!0,force:!0})}return{success:!1,error:Q8i(i)}}function k8i(t,e){return N8i("git",t,{cwd:e,env:D8i})}async function M8i(t,e){try{return await k8i(["fetch","--depth","1","origin",e],t),await k8i(["checkout","FETCH_HEAD"],t),{success:!0}}catch(n){return{success:!1,error:Q8i(n)}}}var N8i,Twl,D8i,F8i=b(()=>{"use strict";N8i=xwl(wwl),Twl={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:"ssh -o BatchMode=yes"},D8i={...process.env,GIT_TERMINAL_PROMPT:"0"}});import{existsSync as kwl,readFileSync as Nwl}from"node:fs";import{join as Xpe}from"node:path";function L8i(t){for(let e of P8i)if(kwl(Xpe(t,e)))return!0;return!1}function JK(t){let e=Dwl(t,O8i);return e.manifest||e.diagnostics.length>0?e:{diagnostics:[`no marketplace manifest found (looked for ${O8i.join(", ")})`]}}function Dwl(t,e){let n=[];for(let r of e){let i=Xpe(t,r),s;try{s=Nwl(i,"utf-8")}catch{continue}try{let o=JSON.parse(s);if(o&&typeof o=="object"&&!Array.isArray(o))return{manifest:o,manifestPath:i,diagnostics:n};n.push(`manifest at ${r} is not a JSON object; ignoring`)}catch(o){n.push(`failed to parse manifest at ${r}: ${o.message}`)}}return{diagnostics:n}}var P8i,O8i,U8i,out=b(()=>{"use strict";P8i=[Xpe(".augment-plugin","plugin.json"),Xpe(".claude-plugin","plugin.json")],O8i=[Xpe(".augment-plugin","marketplace.json"),Xpe(".claude-plugin","marketplace.json")];U8i=`no plugin manifest found (looked for ${P8i.join(", ")})`});import{execFile as Qwl}from"node:child_process";import{existsSync as AU,mkdirSync as V8i,readdirSync as Mwl,renameSync as Fwl,rmSync as Owl,statSync as Pwl}from"node:fs";import{dirname as Lwl,isAbsolute as W8i,join as gU,relative as Y8i,resolve as ffn}from"node:path";import{promisify as Uwl}from"node:util";function z8i(t){let e=t.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!e||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e)?null:e}function G8i(t){let e=t.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!e||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e)?null:e}function Vwl(t){let e=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:@(.+))?$/);if(e?.[1]&&e[2])return{owner:e[1],repo:e[2].replace(/\.git$/,""),...e[3]?{ref:e[3]}:{}};let n=t.match(/^https?:\/\/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(?:#(.+))?$/);if(n?.[1]&&n[2])return{owner:n[1],repo:n[2],...n[4]?{ref:n[4]}:{}};let r=t.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(?:#(.+))?$/);return r?.[1]&&r[2]?{owner:r[1],repo:r[2],...r[4]?{ref:r[4]}:{}}:null}function hM(t){return typeof t=="string"&&t.length>0?t:void 0}function Wwl(t,e){let n=hM(t.repo);return n?{kind:"github",url:`https://github.com/${n.replace(/\.git$/,"")}.git`,...e?{ref:e}:{},...hM(t.path)?{subdir:hM(t.path)}:{}}:null}function Ywl(t,e){let n=hM(t.url);return n?{kind:"url",url:n,...e?{ref:e}:{},...hM(t.path)?{subdir:hM(t.path)}:{}}:null}function Hwl(t,e){let n=hM(t.url),r=hM(t.path);return n&&r?{kind:"git-subdir",url:n,subdir:r,...e?{ref:e}:{}}:null}function hfn(t){if(!t||typeof t!="object")return null;let e=t,n=hM(e.sha)??hM(e.ref);switch(e.source){case"github":return Wwl(e,n);case"url":return Ywl(e,n);case"git-subdir":return Hwl(e,n);default:return null}}function J8i(t,e,n){let r=z8i(e);if(!r)return;let i=gU(t,H8i,r);if(!AU(gU(i,".git")))return;if(!n)return i;let s=ffn(i,n),o=Y8i(i,s);if(!(o.startsWith("..")||W8i(o)))return AU(s)?s:void 0}async function zwl(t,e){let n=typeof e.name=="string"?e.name:"",r=hfn(e.source);if(!r)return;let i=z8i(n);if(!i)return{name:n,status:"failed",error:"invalid plugin cache name"};let s=gU(t,H8i,i);if(AU(gU(s,".git")))return{name:n,status:"skipped"};let o=Lwl(s);AU(o)||V8i(o,{recursive:!0});let{sshUrl:a,httpsUrl:l}=gfn(r.url),c=r.kind==="git-subdir",u=await mfn({sshUrl:a,httpsUrl:l,targetDir:s,extraArgs:c?["--filter=blob:none","--sparse"]:[]});if(!u.success)return{name:n,status:"failed",error:u.error};if(r.ref){let d=await M8i(s,r.ref);if(!d.success)return{name:n,status:"failed",error:d.error}}if(c&&r.kind==="git-subdir")try{await Gwl("git",["sparse-checkout","set",r.subdir],{cwd:s,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(d){return{name:n,status:"failed",error:d instanceof Error?d.message:String(d)}}return{name:n,status:"cloned"}}async function X8i(t){let{manifest:e}=JK(t),n=e?.plugins;if(!n||n.length===0)return[];let r=[];for(let i of n){let s=await zwl(t,i);s&&r.push(s)}return r}function Jwl(t){try{return Pwl(t).isDirectory()}catch{return!1}}function Xwl(t,e){let n=Y8i(ffn(t),ffn(e));return n!==""&&!n.startsWith("..")&&!W8i(n)}async function oke(t,e){let n=Vwl(e);if(!n)return{success:!1,error:`Invalid GitHub repository: ${e}. Expected owner/repo or a github.com URL.`};let{owner:r,repo:i,ref:s}=n;AU(t)||V8i(t,{recursive:!0});let o=G8i(i);if(!o)return{success:!1,error:`Invalid repository name for marketplace directory: "${i}".`};let a=gU(t,o);if(AU(a))return{success:!1,alreadyInstalled:!0,marketplaceId:o,error:`Marketplace '${o}' is already installed.`};let{sshUrl:l,httpsUrl:c}=gfn(`https://github.com/${r}/${i}`),u=await mfn({sshUrl:l,httpsUrl:c,targetDir:a,extraArgs:s?["--branch",s]:[]});if(!u.success)return{success:!1,error:`Failed to clone '${r}/${i}' (SSH and HTTPS both failed): ${u.error}`};let{manifest:d}=JK(a),p=o,A=typeof d?.name=="string"?G8i(d.name):null;if(A&&A!==o){let g=gU(t,A);if(!AU(g))try{Fwl(a,g),p=A}catch{}}return await X8i(gU(t,p)),{success:!0,marketplaceId:p}}function ake(t,e){let n=gU(t,e);if(!Xwl(t,n))return{success:!1,error:`Refusing to remove '${e}': path is outside the marketplaces directory.`};if(!AU(n))return{success:!1,error:`Marketplace '${e}' not found.`};try{return Owl(n,{recursive:!0,force:!0}),{success:!0}}catch(r){return{success:!1,error:`Failed to remove '${e}': ${r instanceof Error?r.message:String(r)}`}}}async function Z8i(t){let e=!1;for(let n of t){if(!AU(n))continue;let r;try{r=Mwl(n)}catch{continue}for(let i of r){let s=gU(n,i);if(!Jwl(s))continue;(await X8i(s)).some(a=>a.status==="cloned")&&(e=!0)}}return e}var Gwl,H8i,aut=b(()=>{"use strict";F8i();out();Gwl=Uwl(Qwl),H8i=".plugin-cache"});import{readFileSync as Zwl}from"node:fs";import{join as $wl}from"node:path";function $8i(t){let e=$wl(t,"hooks","hooks.json"),n;try{n=Zwl(e,"utf-8")}catch{return{diagnostics:[]}}let r;try{r=JSON.parse(n)}catch(s){return{diagnostics:[`failed to parse hooks/hooks.json: ${s.message}`]}}return!r||typeof r!="object"||Array.isArray(r)?{diagnostics:["hooks/hooks.json must be a JSON object"]}:{config:lxe(r),diagnostics:[]}}var K8i=b(()=>{"use strict";k$()});import{existsSync as Kwl,lstatSync as jwl,readdirSync as q8i,statSync as qwl}from"node:fs";import{isAbsolute as j8i,join as lke,relative as eRl,resolve as ezi}from"node:path";function tzi(t,e){let n=[],r=[],i=[],s=new Map;for(let o of t)for(let a of tRl(o,e,r)){let l=s.get(a.id);if(l!==void 0){i.push({id:a.id,shadowedRoot:o,winnerRoot:l});continue}s.set(a.id,o),n.push(a)}for(let[o,a]of Object.entries(e))a&&!s.has(o)&&r.push(`enabledPlugins["${o}"] = true but no plugin with that id was found in any marketplace root`);return{plugins:n,globalDiagnostics:r,shadowedPlugins:i}}function tRl(t,e,n){let r=[];if(!Kwl(t))return r;let i;try{i=q8i(t)}catch(s){return n.push(`failed to read marketplaces directory ${t}: ${s.message}`),r}for(let s of i){let o=lke(t,s);cke(o)&&nRl(o,s,e,r,n)}return r}function nRl(t,e,n,r,i){let s=JK(t);if(!s.manifest){for(let c of s.diagnostics)i.push(`[${e}] ${c}`);return}let o=cRl(s.manifest.name,e),a=lRl(t,s.manifest.metadata?.pluginRoot),l=Array.isArray(s.manifest.plugins)?s.manifest.plugins:[];l.length===0&&i.push(`[${o}] marketplace.json has no plugins[] entries`);for(let c of l){let u=rRl(c,t,a,o,n);u&&r.push(u)}for(let c of s.diagnostics)i.push(`[${o}] ${c}`)}function rRl(t,e,n,r,i){let s=typeof t.name=="string"?Zpe(t.name):void 0;if(!s)return;let o=`${s}@${r}`,a=i[o]===!0,l=[],c=aRl(t.source,s,e,n,l);return c?sRl(o,r,s,c,a,l):{id:o,marketplace:r,name:s,root:e,enabled:a,commandsDir:void 0,skillsDir:void 0,hooksConfig:void 0,agentsDirPresent:!1,diagnostics:l}}function iRl(t,e){let n=[],r;try{r=q8i(t).sort()}catch(s){return e.push(`failed to read agents directory: ${s.message}`),n}let i=[];for(let s of r){if(!s.endsWith(".md"))continue;let o=lke(t,s);try{if(!jwl(o).isFile()){i.push(s);continue}}catch(a){e.push(`failed to stat agent file ${s}: ${a.message}`);continue}n.push(o)}return i.length>0&&e.push(`ignoring non-regular agent file(s) under agents/ (symlinks / dirs / devices are not followed): ${i.join(", ")}`),n}function sRl(t,e,n,r,i,s){L8i(r)||s.push(U8i);let o=lke(r,"commands"),a=lke(r,"skills"),l=lke(r,"agents"),c=cke(o)?o:void 0,u=cke(a)?a:void 0,d=cke(l),p=d&&i?iRl(l,s):void 0,A=$8i(r);for(let g of A.diagnostics)s.push(g);return{id:t,marketplace:e,name:n,root:r,enabled:i,commandsDir:c,skillsDir:u,hooksConfig:A.config,agentsDirPresent:d,agentFiles:p,diagnostics:s}}function oRl(t,e,n,r){let i=hfn(t);if(!i){let o=t.source;r.push(`source kind "${typeof o=="string"?o:"object"}" is not supported; install the plugin manually as a relative directory`);return}let s=J8i(n,e,i.subdir);if(s)return s;r.push(`source kind "${i.kind}" not fetched yet; run /plugins to clone it (or marketplace update)`)}function aRl(t,e,n,r,i){if(typeof t!="string"){if(t&&typeof t=="object")return oRl(t,e,n,i);i.push("plugin entry has no source field; skipping");return}if(j8i(t)){i.push(`absolute source "${t}" is not allowed; skipping`);return}let s=t.startsWith("./")?n:r,o=ezi(s,t),a=eRl(n,o);if(a.startsWith("..")||j8i(a)){i.push(`source "${t}" resolves outside the marketplace root; skipping`);return}if(!cke(o)){i.push(`source "${t}" does not point to an existing directory (looked at ${o})`);return}return o}function lRl(t,e){return typeof e!="string"||e.length===0?t:ezi(t,e)}function cRl(t,e){if(typeof t=="string"&&t.length>0){let n=Zpe(t);if(n.length>0)return n}return e}function Zpe(t){let e="";for(let n of t){let r=n.codePointAt(0);if(r===void 0)continue;let i=r<=31,s=r>=127&&r<=159;i||s||(e+=n)}return e}function cke(t){try{return qwl(t).isDirectory()}catch{return!1}}var lut=b(()=>{"use strict";aut();K8i();out()});import{readFileSync as uRl}from"node:fs";import{basename as dRl}from"node:path";function cut(t){return typeof t=="string"?t:void 0}function ARl(t){if(typeof t=="string")return rzi.includes(t)?t:void 0}function gRl(t){return typeof t=="number"&&t>=0?t:void 0}function szi(t){if(t==null)return;let e=String(t).trim();if(!e||e==="none")return;let n=e.split(",").map(r=>r.trim()).filter(Boolean);return n.length>0?n:void 0}function ozi(t,e){return t==null?[...e]:szi(t)??[]}function mRl(t){return szi(t)}function fRl(t){if(t==="user"||t==="project"||t==="local")return t}function nzi(t){if(t==null||t===!0)return!0;if(t===!1||t==="none")return!1;let e=ozi(t,[]);return e.length>0?e:!1}function hRl(t,e){let n=Zpe(dRl(t,".md")),r;try{r=uRl(t,"utf-8")}catch(u){let d=u instanceof Error?u.message:String(u);return{ok:!1,diagnostic:`failed to read agent file ${t}: ${d}`}}let i,s;try{let u=Ek(r);i=u.frontmatter??{},s=u.body}catch(u){let d=u instanceof Error?u.message:String(u);return{ok:!1,diagnostic:`invalid frontmatter in agent file ${t}: ${d}`}}let o=cut(i.thinking),a=ARl(i.thinking),l=[];o!==void 0&&a===void 0&&l.push(`agent file ${t} declares thinking: "${o}", which is not a recognised level (expected one of: ${rzi.join(", ")}); falling back to the model's default`);let c={name:n,displayName:cut(i.display_name),description:cut(i.description)??n,builtinToolNames:ozi(i.tools,pRl),disallowedTools:mRl(i.disallowed_tools),extensions:nzi(i.extensions??i.inherit_extensions),skills:nzi(i.skills??i.inherit_skills),model:cut(i.model),thinking:a,maxTurns:gRl(i.max_turns),systemPrompt:s.trim(),promptMode:i.prompt_mode==="append"?"append":"replace",inheritContext:i.inherit_context==null?void 0:i.inherit_context===!0,runInBackground:i.run_in_background==null?void 0:i.run_in_background===!0,isolated:i.isolated==null?void 0:i.isolated===!0,memory:fRl(i.memory),isolation:i.isolation==="worktree"?"worktree":void 0,enabled:i.enabled!==!1,source:"plugin",pluginId:e};return l.length>0?{ok:!0,config:c,warnings:l}:{ok:!0,config:c}}function azi(t){let e=new Map,n=[];if(!t.agentFiles||t.agentFiles.length===0)return{agents:e,diagnostics:n};let r=new Map;for(let i of t.agentFiles){let s=hRl(i,t.id);if(!s.ok){n.push(s.diagnostic);continue}if(s.warnings)for(let l of s.warnings)n.push(l);let{config:o}=s,a=o.name.toLowerCase();if(r.has(a)){let l=r.get(a)??o.name,c=l===o.name?`"${o.name}"`:`"${o.name}" (case-insensitive collision with "${l}")`;n.push(`duplicate agent name ${c} in plugin ${t.id}; ignoring ${i}`);continue}e.set(o.name,o),r.set(a,o.name)}return{agents:e,diagnostics:n}}var pRl,rzi,izi,lzi=b(()=>{"use strict";xu();lut();pRl=["read","bash","edit","write","grep","find","ls"],rzi=["off","minimal","low","medium","high","xhigh"],izi=["general-purpose","explore","plan"]});import{lstatSync as ERl,readFileSync as yRl,realpathSync as czi}from"node:fs";import{isAbsolute as CRl,join as bRl,relative as IRl}from"node:path";function uke(t,e){let n=t;for(let r of SRl){let i=`\${${r}}`;n.includes(i)&&(n=n.split(i).join(e))}return n}function Efn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function uzi(t){if(!t)return;let e={};for(let[n,r]of Object.entries(t))r!=null&&(e[n]=String(r));return Object.keys(e).length>0?e:void 0}function _Rl(t){if(t.type==="stdio"||t.type==="http"||t.type==="sse")return t.type;if(t.url)return"http";if(t.command)return"stdio"}function vRl(t,e,n){let r=_Rl(e);if(!r)throw new Error(`MCP server "${t}" must declare a 'command' (stdio) or 'url' (http/sse) property`);if(r==="http"||r==="sse"){if(!e.url)throw new Error(`MCP server "${t}" has type "${r}" but no 'url' property`);return{type:r,name:t,disabled:e.disabled,url:e.url,headers:uzi(e.headers),auth:e.auth==="oauth"?"oauth":void 0,cwd:e.cwd,timeoutMs:e.timeoutMs}}let i=e.command;if(!i)throw new Error(`MCP server "${t}" has type "stdio" but no 'command' property`);let s=Array.isArray(e.args)?e.args.map(a=>String(a)):[],o=s.length>0?`${i} ${s.join(" ")}`:i;return e.useShellInterpolation===!1&&n.push(`MCP server "${t}": useShellInterpolation:false is ignored; plugin stdio servers always shell-wrap (V2 parity)`),{type:"stdio",name:t,disabled:e.disabled,command:o,args:[],env:uzi(e.env),cwd:e.cwd,timeoutMs:e.timeoutMs,useShellInterpolation:!0}}function dzi(t,e){if(!t)return;let n={};for(let[r,i]of Object.entries(t))n[r]=uke(i,e);return n}function wRl(t,e){return t.type==="stdio"?{...t,command:uke(t.command,e),env:dzi(t.env,e),cwd:t.cwd?uke(t.cwd,e):void 0}:{...t,url:uke(t.url,e),headers:dzi(t.headers,e),cwd:t.cwd?uke(t.cwd,e):void 0}}function RRl(t,e){let n=bRl(t,".mcp.json"),r;try{r=ERl(n)}catch(i){if(i?.code==="ENOENT")return;e.push(`failed to stat .mcp.json: ${i.message}`);return}if(r.isSymbolicLink()){e.push(".mcp.json is a symlink; refusing to follow it out of the plugin root");return}if(!r.isFile()){e.push(".mcp.json is not a regular file; skipping");return}try{let i=czi(t),s=czi(n),o=IRl(i,s);if(o.startsWith("..")||CRl(o)){e.push(".mcp.json resolves outside the plugin root; skipping");return}}catch(i){e.push(`failed to resolve .mcp.json real path: ${i.message}`);return}try{return yRl(n,"utf-8")}catch(i){e.push(`failed to read .mcp.json: ${i.message}`);return}}function pzi(t){let e=[],n=RRl(t.root,e);if(n===void 0)return{servers:[],diagnostics:e};let r;try{r=JSON.parse(n)}catch(o){return e.push(`failed to parse .mcp.json: ${o.message}`),{servers:[],diagnostics:e}}if(!Efn(r))return e.push(".mcp.json must be a JSON object"),{servers:[],diagnostics:e};let i=r.mcpServers;if(!Efn(i))return e.push('.mcp.json must contain an "mcpServers" object'),{servers:[],diagnostics:e};let s=[];for(let[o,a]of Object.entries(i)){let l=`${t.id}/${Zpe(o)}`;if(!Efn(a)){e.push(`MCP server "${l}" must be a JSON object`);continue}try{let c=vRl(l,a,e);s.push(wRl(c,t.root))}catch(c){e.push(c instanceof Error?c.message:String(c))}}return{servers:s,diagnostics:e}}var SRl,Azi,gzi=b(()=>{"use strict";lut();SRl=["CLAUDE_PLUGIN_ROOT","AUGMENT_PLUGIN_ROOT","AUGGIE_PLUGIN_ROOT"];Azi="hermes:mcp:register-server-source"});function mzi(t,e){let n=ba.create(t,e),r=n.getEnabledPlugins(),i=n.drainErrors().map(({scope:s,error:o})=>`failed to load ${s} settings: ${o.message}; enabledPlugins entries from this scope will be ignored`);return{enabled:r,diagnostics:i}}var fzi=b(()=>{"use strict";xu()});var hzi,Ezi=b(()=>{"use strict";hzi="hermes:subagents:register-agent-source"});import{join as $pe}from"node:path";import{existsSync as BRl,readdirSync as xRl,statSync as TRl}from"node:fs";function bfn(t){Vk=[],Cfn=[],uut=[],yfn=[],dke=[];let e=!1,n,r=new Map,i,s,o=new Map,a;t.events.on(Iot,R=>{n=R.register}),t.events.on(hzi,R=>{i=R.register}),t.events.on(Azi,R=>{a=R.registerServerSource});function l(R,B){let{enabled:F,diagnostics:Q}=mzi(R,B),P=$pe(TX(),"plugins","marketplaces"),D=$pe(B,"plugins","marketplaces"),M=tzi([P,D],F);for(let H of M.shadowedPlugins)Ov.debug(`plugin "${H.id}" from ${H.shadowedRoot} is shadowed by the higher-precedence root ${H.winnerRoot}`);return M.globalDiagnostics=[...Q,...M.globalDiagnostics],Vk=M.plugins,Cfn=M.globalDiagnostics,e=!0,M}function c(R,B){e||l(R,B)}function u(){let R=new Map,B=new Map;uut=[];let F=[...Vk.filter(Q=>Q.enabled)].sort((Q,P)=>Q.id.localeCompare(P.id));for(let Q of F){let{agents:P,diagnostics:D}=azi(Q);for(let M of D)Ov.warn(`[${Q.id}] ${M}`),uut.push({type:"warning",message:`[${Q.id}] ${M}`,path:Q.root});for(let[M,H]of P)d(Q.id,M,H,R,B)}o=R}function d(R,B,F,Q,P){let D=B.toLowerCase(),M=P.get(D);if(M){let H=M.name===B?`"${B}"`:`"${B}" (case-insensitive collision with "${M.name}")`;Ov.warn(`[${R}] plugin-contributed agent ${H} shadowed by earlier plugin ${M.pluginId}; ignoring`);return}izi.includes(D)&&Ov.warn(`[${R}] plugin-contributed agent "${B}" shadows the built-in default agent of the same name; the plugin's definition will be used for every Agent-tool invocation across this session`),Q.set(B,F),P.set(D,{pluginId:R,name:B})}function p(){if(!i)return;s?.(),s=i({getAgents:()=>o,getDiagnostics:()=>uut})}function A(){let R=[];dke=[];let B=[...Vk.filter(F=>F.enabled)].sort((F,Q)=>F.id.localeCompare(Q.id));for(let F of B){let{servers:Q,diagnostics:P}=pzi(F);for(let D of P)Ov.warn(`[${F.id}] ${D}`),dke.push({type:"warning",message:`[${F.id}] ${D}`,path:F.root});for(let D of Q)R.push(D)}yfn=R}function g(){if(!a)return;a({source:"plugin",getServers:()=>yfn,getDiagnostics:()=>dke})}function m(){if(n){for(let R of r.values())R();r.clear();for(let R of Vk){if(!R.enabled)continue;let B=kRl(R);r.set(R.id,n(B))}}}function f(){for(let R of r.values())R();r.clear()}function h(){let R=[],B=[];for(let F of Vk){if(!F.enabled){for(let Q of F.diagnostics)Ov.debug(`[${F.id}] ${Q}`);continue}F.commandsDir&&B.push(F.commandsDir),F.skillsDir&&R.push(F.skillsDir);for(let Q of F.diagnostics)Ov.warn(`[${F.id}] ${Q}`)}return{skillPaths:R,promptPaths:B}}t.on("resources_discover",R=>{e=!1;let B=l(R.cwd,R.agentDir),{skillPaths:F,promptPaths:Q}=h();for(let D of B.globalDiagnostics)Ov.warn(D);let P=Vk.filter(D=>D.enabled).length;return Vk.length>0&&Ov.info(`Discovered ${Vk.length} plugin(s); ${P} enabled`),m(),u(),p(),v(),A(),g(),_(),{skillPaths:F,promptPaths:Q}}),t.on("session_start",(R,B)=>{c(B.cwd,B.agentDir),m(),u(),p(),S(),A(),g();let F=$pe(TX(),"plugins","marketplaces"),Q=$pe(B.agentDir,"plugins","marketplaces");Z8i([F,Q]).then(P=>{P&&(e=!1,l(B.cwd,B.agentDir),m(),u(),p(),A(),g())}).catch(P=>{Ov.debug(`background plugin source fetch failed: ${P instanceof Error?P.message:String(P)}`)})}),t.on("session_shutdown",()=>{f(),s?.(),s=void 0,o=new Map});let E=!1,y=!1,C=!1;function S(){!n&&!E&&(E=!0,Ov.warn("@hermes/hooks did not register a hook listener; plugin hooks will not run. This usually means @hermes/hooks was removed from the built-in extension list."))}function v(){!i&&!y&&(y=!0,Ov.debug("@hermes/subagents did not register an agent source; plugin-contributed subagents will not be available (expected when --disable-subagents is set)."))}function _(){!a&&!C&&(C=!0,Ov.debug("@hermes/mcp did not register a server source; plugin-contributed MCP servers will not be loaded."))}}function kRl(t){return{source:t.id,isEnabled:()=>t.enabled,getConfig:()=>t.hooksConfig,env:NRl(t.root),postToolUsePrefix:`Plugin ${t.id} hook`,backgroundLabel:e=>`[${t.id}] ${e} hook`,blockedFallbackReason:"Blocked by plugin hook"}}function NRl(t){return{PLUGIN_ROOT:t,CLAUDE_PLUGIN_ROOT:t}}function z4(){return Vk}function pke(t){return $pe(t,"plugins","marketplaces")}function dut(t){let e=pke(t);if(!BRl(e))return[];let n;try{n=xRl(e)}catch{return[]}let r=[];for(let i of n){let s=$pe(e,i);try{if(!TRl(s).isDirectory())continue}catch{continue}let{manifest:o}=JK(s);if(!o)continue;let a=typeof o.name=="string"&&o.name.length>0?o.name:i;r.push({dir:i,name:a,path:s})}return r}function EM(){let t=[];for(let e of Vk)for(let n of e.diagnostics)t.push({type:"warning",message:`[${e.id}] ${n}`,path:e.root});for(let e of Cfn)t.push({type:"warning",message:e});for(let e of dke)t.push(e);return t}var Ov,Vk,Cfn,uut,yfn,dke,Kpe=b(()=>{"use strict";xu();k$();vr();lzi();lut();aut();out();gzi();fzi();Ezi();aut();Ov=on.child({prefix:"pi-plugins"}),Vk=[],Cfn=[],uut=[],yfn=[],dke=[]});import{existsSync as DRl}from"node:fs";import{homedir as Ake}from"node:os";import{dirname as Ifn,join as nB,resolve as yzi}from"node:path";import{fileURLToPath as QRl}from"node:url";function FRl(){let t=`${Sfn}\0${process.execPath||""}`.toLowerCase();return t.includes("/pnpm/")||t.includes("/.pnpm/")||t.includes("\\pnpm\\")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")||t.includes("\\yarn\\")?"yarn":t.includes("/npm/")||t.includes("/node_modules/")||t.includes("\\npm\\")?"npm":"unknown"}function Czi(t,e){switch(FRl()){case"pnpm":return`Run: pnpm install -g ${t}`;case"yarn":return`Run: yarn global add ${t}`;case"npm":return`Run: npm install -g ${t}`;default:return`Run: npm install -g ${t}`}}function bzi(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?Ake():t.startsWith("~/")?Ake()+t.slice(1):t;let e=Sfn;for(;e!==Ifn(e);){if(DRl(nB(e,"package.json")))return e;e=Ifn(e)}return Sfn}function jpe(){return yzi(nB(bzi(),"docs"))}function put(){return yzi(nB(bzi(),"CHANGELOG.md"))}function vzi(t){return`${process.env.PI_SHARE_VIEWER_URL||PRl}#${t}`}function wzi(t){return t==="~"?Ake():t.startsWith("~/")?Ake()+t.slice(1):t}function mU(){let t=process.env.AUGMENT_CACHE_DIR;return t?wzi(t):nB(Ake(),".augment")}function Gi(){let t=process.env[fke];return t?wzi(t):mU()}function hke(){return nB(Gi(),"themes")}function Rzi(){return nB(Gi(),"models.json")}function _fn(){return nB(Gi(),"auth.json")}function Bzi(){return nB(Gi(),"settings.json")}function Aut(){return mU()}function qpe(){return nB(Gi(),"bin")}function xzi(){return nB(Gi(),"prompts")}function Tzi(){return nB(Gi(),gke)}function kzi(){return nB(Gi(),`${uo}-debug.log`)}var MRl,Sfn,uo,al,gke,mke,Izi,ORl,rm,Szi,_zi,fke,PRl,ku=b(()=>{"use strict";A$t();MRl=QRl(import.meta.url),Sfn=Ifn(MRl);uo=v3.piConfig?.name||"pi",al=v3.piConfig?.configDir||".augment",gke="sessions-v2",mke="auggie",Izi="Auggie Coding Agent",ORl="1.1.0-prerelease.202608120229",rm=ORl??v3.version,Szi="efda5a6e3bd00b13423c254fbfaa91194c152e50",_zi="2026-08-12T09:29:48Z",fke=`${uo.toUpperCase()}_CODING_AGENT_DIR`,PRl="https://pi.dev/session/"});var Dzi,Nzi=b(()=>{Dzi={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var Mzi,Qzi=b(()=>{Mzi={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as UI from"node:fs";import*as mut from"node:path";function VRl(){let t=process.env.COLORTERM;if(t==="truecolor"||t==="24bit"||process.env.WT_SESSION)return"truecolor";let e=process.env.TERM||"";return e==="dumb"||e===""||e==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||e==="screen"||e.startsWith("screen-")||e.startsWith("screen.")?"256color":"truecolor"}function Bfn(t){let e=t.replace("#","");if(e.length!==6)throw new Error(`Invalid hex color: ${t}`);let n=Number.parseInt(e.slice(0,2),16),r=Number.parseInt(e.slice(2,4),16),i=Number.parseInt(e.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${t}`);return{r:n,g:r,b:i}}function vfn(t){let e=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of gut.entries()){let s=Math.abs(t-i);s<e&&(e=s,n=r)}return n}function WRl(t){let e=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of Lzi.entries()){let s=Math.abs(t-i);s<e&&(e=s,n=r)}return n}function Ozi(t,e,n,r,i,s){let o=t-r,a=e-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function YRl(t,e,n){let r=vfn(t),i=vfn(e),s=vfn(n),o=gut[r]??0,a=gut[i]??0,l=gut[s]??0,c=16+36*r+6*i+s,u=Ozi(t,e,n,o,a,l),d=Math.round(.299*t+.587*e+.114*n),p=WRl(d),A=Lzi[p]??0,g=232+p,m=Ozi(t,e,n,A,A,A),f=Math.max(t,e,n),h=Math.min(t,e,n);return f-h<10&&m<u?g:c}function Uzi(t){let{r:e,g:n,b:r}=Bfn(t);return YRl(e,n,r)}function HRl(t,e){if(t==="")return"\x1B[39m";if(typeof t=="number")return`\x1B[38;5;${t}m`;if(t.startsWith("#")){if(e==="truecolor"){let{r,g:i,b:s}=Bfn(t);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${Uzi(t)}m`}throw new Error(`Invalid color value: ${t}`)}function zRl(t,e){if(t==="")return"\x1B[49m";if(typeof t=="number")return`\x1B[48;5;${t}m`;if(t.startsWith("#")){if(e==="truecolor"){let{r,g:i,b:s}=Bfn(t);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${Uzi(t)}m`}throw new Error(`Invalid color value: ${t}`)}function xfn(t,e,n=new Set){if(typeof t=="number"||t===""||t.startsWith("#"))return t;if(n.has(t))throw new Error(`Circular variable reference detected: ${t}`);if(!(t in e))throw new Error(`Variable reference not found: ${t}`);n.add(t);let r=e[t];if(r===void 0)throw new Error(`Variable reference not found: ${t}`);return xfn(r,e,n)}function Gzi(t,e={}){let n={};for(let[r,i]of Object.entries(t))n[r]=xfn(i,e);return n}function fut(){let t=new Set(Object.keys(Tfn)),e=hke();if(UI.existsSync(e)){let n=UI.readdirSync(e);for(let r of n)r.endsWith(".json")&&t.add(r.slice(0,-5))}for(let n of jK.keys())t.add(n);return Array.from(t).sort()}function Vzi(){let t=hke(),e=[];for(let n of Object.keys(Tfn))e.push({name:n,path:void 0});if(UI.existsSync(t)){for(let n of UI.readdirSync(t))if(n.endsWith(".json")){let r=n.slice(0,-5);e.some(i=>i.name===r)||e.push({name:r,path:mut.join(t,n)})}}for(let[n,r]of jK.entries())e.some(i=>i.name===n)||e.push({name:n,path:r.sourcePath});return e.sort((n,r)=>n.name.localeCompare(r.name))}function JRl(t,e){if(!Fzi.Check(e)){let n=Array.from(Fzi.Errors(e)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${t}":
|
|
6719
|
+
${t.fallbackCwd}`}function WK(t,e){let n=vmn(t,e);if(n)throw new H4(n)}var H4,ZTe=b(()=>{"use strict";H4=class extends Error{constructor(e){super(B_l(e)),this.name="MissingSessionCwdError",this.issue=e}}});function OHi(t){let{reporter:e,sessionId:n,getRequestId:r}=t;return i=>{if(i.type==="tool_execution_start"){e.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&e.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var PHi=b(()=>{"use strict"});function LHi(t){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:t.summaryCharCount,summarization_duration_ms:t.durationMs??0,is_cache_about_to_expire:!1,is_aborted:t.aborted??!1,total_history_token_count:t.tokensBefore,head_token_count:t.tokensBefore,tail_token_count:t.tokensAfter??0,tokens_from_backend:!1}}function UHi(t,e){if(t.truncated)return{original_char_count:t.totalBytes,original_line_count:t.totalLines,truncated_char_count:t.outputBytes,truncated_line_count:t.outputLines,tool_type:e}}function GHi(t){let{source:e,scope:n}=t.sourceInfo;return n==="user"||n==="project"?n:e}function VHi(t){let e=t.filter(n=>!n.disableModelInvocation);if(e.length!==0)return{skills:e.map(n=>({skill_name:n.name,skill_source:GHi(n)})),skill_count:e.length}}function WHi(t,e,n){return{skill_name:t.name,skill_source:GHi(t),content_length:e,source_tool:n}}function YHi(t,e){return{retrieval_mode:e?.retrievalMode??"codebase_only",total_elapsed_ms:Tf(t.totalElapsedMs),codebase_retrieval_elapsed_ms:Tf(t.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:Tf(t.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:Tf(t.conversationInitialRetrievalMs),conversation_query_rewriting_ms:Tf(t.conversationQueryRewritingMs),conversation_followup_retrieval_ms:Tf(t.conversationFollowupRetrievalMs),blob_name_lookup_ms:Tf(t.blobNameLookupMs),codebase_chunks_retrieved:Tf(t.codebaseChunksRetrieved),conversation_chunks_initial:Tf(t.conversationChunksInitial),conversation_queries_generated:Tf(t.conversationQueriesGenerated),conversation_chunks_followup:Tf(t.conversationChunksFollowup),conversation_chunks_combined:Tf(t.conversationChunksCombined),codebase_result_len_pre_truncation:Tf(t.codebaseResultLenPreTruncation),codebase_result_len:Tf(t.codebaseResultLen),conversation_result_len_pre_truncation:Tf(t.conversationResultLenPreTruncation),conversation_result_len:Tf(t.conversationResultLen),combined_result_len:Tf(t.combinedResultLen),total_budget:Tf(t.totalBudget),codebase_budget:Tf(t.codebaseBudget),conversation_budget:Tf(t.conversationBudget),codebase_truncated:Wct(t.codebaseTruncated),conversation_truncated:Wct(t.conversationTruncated),final_truncated:Wct(t.finalTruncated),is_sub_agent:Wct(e?.isSubAgent)}}var Tf,Wct,HHi=b(()=>{"use strict";Tf=t=>t??0,Wct=t=>t??!1});import{randomUUID as x_l}from"node:crypto";function N_l(t){if(typeof t!="object"||t===null)return;let e=t.details;if(!(typeof e!="object"||e===null))return e}function D_l(t,e){if(t===e)return!0;if(!([...e].some(i=>zHi.has(i))&&t.endsWith(e)))return!1;let r=t.at(-e.length-1);return r!==void 0&&zHi.has(r)}function Q_l(t,e){return e.find(n=>D_l(n.filePath,t))}function JHi(t){let e=new wmn(t);return n=>e.handle(n)}function M_l(t){if(typeof t!="object"||t===null)return 0;let e=t.content;if(!Array.isArray(e))return 0;let n=0;for(let r of e)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function XHi(t){let e=VHi(t.skills);e&&t.reporter.skillsIncludedInChat(t.sessionId,e)}var T_l,k_l,zHi,wmn,ZHi=b(()=>{"use strict";HHi();T_l={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},k_l={read:"read","web-fetch":"web-fetch",bash:"bash"};zHi=new Set(["/","\\"]);wmn=class{constructor(e){this.readPathsByCallId=new Map,this.options=e}handle(e){if(e.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(e.type==="compaction_end"){this.emitCompaction(e);return}if(e.type==="tool_execution_start"){this.rememberReadPath(e);return}if(e.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(e.toolCallId);if(this.readPathsByCallId.delete(e.toolCallId),e.isError)return;let r=N_l(e.result);this.emitTruncation(e.toolName,r),this.emitRetrieval(e.toolName,r),this.emitSkillContent(e.toolName,n,e.result)}emitCompaction(e){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(e.aborted||!e.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,x_l(),n,LHi({summaryCharCount:e.result.summary.length,tokensBefore:e.result.tokensBefore,tokensAfter:e.tokensAfter,durationMs:e.durationMs,aborted:!1}))}rememberReadPath(e){if(e.toolName!=="read")return;let n=e.args?.path;typeof n=="string"&&this.readPathsByCallId.set(e.toolCallId,n)}emitTruncation(e,n){let r=k_l[e];if(!(r&&n?.truncation))return;let i=UHi(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(e,n){let r=T_l[e];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,YHi(n.analytics,{retrievalMode:r}))}emitSkillContent(e,n,r){if(e!=="read"||!n)return;let i=Q_l(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,WHi(i,M_l(r),"read"))}}});function $Hi(t){return t==="8"?{kind:"mode-disabled",message:F_l}:{kind:"generic"}}var F_l,Rmn=b(()=>{"use strict";F_l="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});import e8i from"node:v8";function Wpe(t){if(Gpe){Zy.debug("initSentryForCloudService: skipped (already initialized)");return}try{let e=Z_l();if(!e){Zy.info("initSentryForCloudService: skipped (AUGGIE_V2_SENTRY_DSN is empty, Sentry disabled)"),Gpe=!0;return}let n=$_l(),r=q_l(),i=evl();G1e({dsn:e,release:t.cliVersion,environment:r,sendDefaultPii:!1,sampleRate:1,tracesSampleRate:n,integrations:s=>s.filter(o=>o.name!=="Modules"&&o.name!=="Http"&&o.name!=="Undici")}),EE("app_mode",t.appMode??"cloud-service"),EE("cli_version",t.cliVersion),i&&(EE("tenant",i),Smn({agentId:"",vmId:"",tenant:i})),t.cloudId&&n8i(t.cloudId,""),Gpe=!0,Zy.info(`Sentry initialized: app_mode=${t.appMode??"cloud-service"}, env=${r}, release=${t.cliVersion}, tenant=${i??"<unknown>"}, tracesSampleRate=${n}`)}catch(e){Zy.warn(`initSentryForCloudService: failed: ${e}`),Gpe=!0}}function t8i(t){if(Gpe&&(t.id||t.email))try{Gce({id:t.id,email:t.email})}catch(e){Zy.warn(`setSentryUserContext: failed: ${e}`)}}function n8i(t,e){EE("cloud.id",t),EE("session_id",t),EE("conversation_id",t),e&&EE("vm_id",e),Vce(t),Smn({agentId:t,vmId:e})}function r8i(t){if(Gpe)try{n8i(t.agentId,t.vmId)}catch(e){Zy.warn(`setSentryCloudSessionContext: failed: ${e}`)}}function Ype(){if(KHi){Zy.debug("installCloudServiceProcessHandlers: skipped (already installed)");return}KHi=!0,process.on("uncaughtException",P_l),process.on("unhandledRejection",L_l),z_l(),Zy.info(`Sentry process handlers installed (flush timeout ${Hct}ms)`)}function V_l(t,e,n){return e<=0?!1:t/e>=n}function i8i(t){return Number.isFinite(t)&&t>=G_l}function W_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_CONSECUTIVE;if(!t)return xmn;let e=Number.parseInt(t,10);return!Number.isFinite(e)||e<1?xmn:e}function Y_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_THRESHOLD;if(!t)return Bmn;let e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?Bmn:e>1?1:e}function H_l(){let t=process.env.AUGGIE_V2_SENTRY_HEAP_OOM_INTERVAL_MS;if(t===void 0)return jHi;let e=Number.parseInt(t,10);return Number.isFinite(e)?e<=0?0:e:jHi}function z_l(){if(Vpe)return;let t=H_l();if(t<=0){Zy.info("Heap-OOM watchdog disabled (AUGGIE_V2_SENTRY_HEAP_OOM_INTERVAL_MS <= 0)");return}let e=e8i.getHeapStatistics().heap_size_limit;if(!i8i(e)){Zy.info(`Heap-OOM watchdog disabled (v8 heap_size_limit not meaningful: ${e} bytes)`);return}let n=Y_l(),r=W_l();Vpe=setInterval(()=>{try{J_l(n,r)}catch(i){Zy.warn(`heap-OOM watchdog tick failed: ${i}`)}},t),Vpe.unref?.(),Zy.info(`Heap-OOM watchdog started (threshold=${n}, consecutive=${r}, interval=${t}ms)`)}function J_l(t,e){if(qHi)return;let n=process.memoryUsage().heapUsed,r=e8i.getHeapStatistics().heap_size_limit;if(!i8i(r)||!V_l(n,r,t)){Yct=0;return}if(Yct+=1,Yct<e){Zy.warn(`Heap-OOM watchdog: usage above threshold (${Yct}/${e} consecutive ticks)`);return}qHi=!0,X_l(n,r,t)}function X_l(t,e,n){let r=Math.round(t/1024/1024),i=Math.round(e/1024/1024),s=Math.round(t/e*100);Zy.error(`Heap-OOM watchdog tripped: heapUsed=${r}MiB / limit=${i}MiB (${s}%), threshold=${Math.round(n*100)}%. Reporting to Sentry and exiting.`),Vpe&&(clearInterval(Vpe),Vpe=void 0);try{Sa(o=>{o.setTag("crash.kind","heap_oom"),o.setFingerprint(["heap-oom"]),o.setContext("heap",{heap_used_mb:r,heap_size_limit_mb:i,used_fraction:t/e,threshold:n}),Ui(new Error(`JavaScript heap approaching limit: ${r}MiB / ${i}MiB (${s}%)`))})}catch(o){Zy.warn(`heap-OOM captureException failed: ${o}`)}g2(Hct).finally(()=>{process.exit(U_l)})}function Z_l(){let t=process.env.AUGGIE_V2_SENTRY_DSN;return t===void 0?O_l:t}function $_l(){let t=process.env.AUGGIE_V2_SENTRY_TRACES_SAMPLE_RATE;if(!t)return 1;let e=Number.parseFloat(t);return Number.isFinite(e)?e<0?0:e>1?1:e:1}function q_l(){let t=s8i();if(!t)return"unknown";let e;try{e=new URL(t).hostname}catch{return"unknown"}if(e.startsWith("localhost")||e.startsWith("127."))return"local";let n=e.split(".")[0]??"";return n.startsWith("test-")||n==="test"?"test":n.includes("staging")?"staging":e.endsWith(j_l)||n.startsWith("dev-")||n==="dev"?"dev":e==="api.augmentcode.com"||e.endsWith(K_l)?"production":"unknown"}function evl(){let t=s8i();if(!t)return;let e;try{e=new URL(t).hostname}catch{return}let n=e.split(".");if(!(n.length<2))return n[0]}function s8i(){let t=process.env.AUGMENT_SESSION_AUTH;if(t)try{let e=JSON.parse(t);if(typeof e.tenantURL=="string"&&e.tenantURL.length>0)return e.tenantURL}catch{}}var Zy,O_l,Gpe,Hct,KHi,P_l,L_l,Bmn,jHi,U_l,xmn,G_l,qHi,Vpe,Yct,K_l,j_l,Hpe=b(()=>{"use strict";vr();Ly();Gct();Zy=on.child({prefix:"sentry-init"}),O_l="https://cf0b4ce9e43e297fcf7328555628364a@o4509262619082752.ingest.us.sentry.io/4510925971914752",Gpe=!1;Hct=2e3,KHi=!1,P_l=t=>{Zy.error(`uncaughtException: ${t}`);try{Ui(t)}catch{}g2(Hct).finally(()=>{process.exit(1)})},L_l=t=>{Zy.error(`unhandledRejection: ${t}`);try{let e=t instanceof Error?t:new Error(String(t));Ui(e)}catch{}g2(Hct).finally(()=>{process.exit(1)})};Bmn=.9,jHi=2e3,U_l=12,xmn=3,G_l=64*1024*1024,qHi=!1,Yct=0;K_l=".api.augmentcode.com",j_l=".us-central.api.augmentcode.com"});function Tmn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zct(t,...e){for(let n of e){let r=t[n];if(Tmn(r))return r}}function YK(t,...e){for(let n of e){let r=t[n];if(typeof r=="string")return r}}function rvl(t){if(typeof t=="string")return t.trim().length>0?{kind:"text",text:t}:null;if(!Tmn(t))return null;let e=Tmn(t.block)?t.block:t,n=zct(e,"text","Text");if(n){let o=YK(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=zct(e,"tool_use","toolUse","ToolUse");if(r){let o=YK(r,"id"),a=YK(r,"name");if(!o||!a)return null;let l=YK(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=zct(e,"tool_result","toolResult","ToolResult");if(i){let o=YK(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:YK(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=zct(e,"thinking","Thinking");if(s){let o=YK(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function o8i(t){if(!Array.isArray(t.content))return[];let e=[];for(let n of t.content){let r=rvl(n);r!==null&&e.push(r)}return e}function ivl(t){let e=[],n=[];for(let r of t)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),e.push({type:Clt,text_node:{content:r.text}})}else r.kind==="tool_result"&&e.push({type:mpn,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:e,requestText:n.join("")}}function svl(t){let e=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&e.push({type:blt,content:s})};for(let s of t)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),e.push({type:fpn,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),e.push({type:hpn,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:e,responseText:n.join("")}}function ovl(t){let e=[];for(let n of t)if(n.role==="user")e.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=e.at(-1);r?r.assistants.push(n):e.push({assistants:[n]})}return e.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=ivl(n?o8i(n):[]),{responseNodes:o,responseText:a}=svl(r.flatMap(o8i));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function avl(t){let e=await t.fetchImpl(`${t.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.apiKey}`,...t.userAgent?{"User-Agent":t.userAgent}:{}},body:JSON.stringify({agent_id:t.agentId,limit:tvl,...t.beforeTimestamp?{before_timestamp:t.beforeTimestamp}:{}})});if(!e.ok)throw new Error(`Fetching cloud-agent chat history failed: ${e.status} ${e.statusText}`);return await e.json()}async function lvl(t){let e=new Set,n=[],r;for(let o=0;o<nvl;o++){let a=await avl({...t,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let c=cvl(l,e),u=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!u||c===0)break;r=u}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function cvl(t,e){let n=0;for(let r of t)(r.id===void 0||!e.has(r.id))&&n++,r.id!==void 0&&e.add(r.id);return n}function kmn(t){let e=t.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await t.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await lvl({fetchImpl:e,baseUrl:i,apiKey:r.apiKey,userAgent:t.userAgent,agentId:n});return ovl(s)}}var tvl,nvl,a8i=b(()=>{"use strict";_lt();tvl=400,nvl=200});import{join as dvl}from"node:path";function pvl(t){return t.map(e=>{if(e.type!=="message")return{type:e.type,id:e.id,parentId:e.parentId};let n=e.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:e.type,id:e.id,parentId:e.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function Avl(t){if(t instanceof Error){let e=t;return typeof e.status=="number"?String(e.status):typeof e.httpStatus=="number"?String(e.httpStatus):t.message}return String(t)}function gvl(t,e){let n=Avl(t);if(n!=="8"){let r=t instanceof Error?t.message:String(t);e.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:Rd(void 0),errorStatus:n}}function mvl(t,e,n){if(t.allowClientFeatureFlagOverrides!==!0)return t;let r=e.getFeatureFlagOverrides();if(!r)return t;try{let i=tFi(r);return nFi(t,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),t}}function fvl(t){return t.cosmosMultiRepoContextEnabled===!0}function hvl(t){return t.cosmosNestedAgentsMdEnabled===!0}function Evl(t,e){let{allowDirs:n,denyDirs:r}=t.getIndexingDirsUnion(),i=e?.get("parent-daemon-id"),s=typeof i=="string"&&i.length>0,o=e?.get("cloud-agent"),a=typeof o=="string"&&o.length>0;return{allowDirs:n,denyDirs:r,daemonChild:s&&a,allowIndexingFlag:e?.get("allow-indexing")===!0}}function yvl(t,e){if(!e)return[];let n=[],r=t.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of e){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}async function $Te(t){let e=t.cwd,n=t.agentDir??Hs(),r=t.authStorage??gM.create(dvl(n,"auth.json")),i=t.settingsManager??ba.create(e,n),s=t.modelRegistry??V4.empty(r),o=t.augmentUserAgent??Xy();await s.discoverAugmentModels(o);let a=await Ch(),l=o4();JOi(l);let c=[],u,d={flags:Rd(void 0)},p,A;if(a){u=await Jp(a.apiKey,a.apiUrl,o);try{let f=await u.getModelConfig();p=f.user?.id,A=f.user?.email,t8i({id:p,email:A});let h=Rd(f.featureFlagsV2);d={flags:mvl(h,i,c)}}catch(f){d=gvl(f,c)}}let g=new b4({...t.resourceLoaderOptions??{},cwd:e,agentDir:n,settingsManager:i,eventBus:l,multiRepoContextEnabled:fvl(d.flags),nestedContextDescentEnabled:hvl(d.flags)});await g.reload(),a&&u&&(l.emit("augment:api",u),l.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:p,email:A,cliVersion:GA}));let m=g.getExtensions();for(let{name:f,config:h,extensionPath:E}of m.runtime.pendingProviderRegistrations)try{s.registerProvider(f,h)}catch(y){let C=y instanceof Error?y.message:String(y);c.push({type:"error",message:`Extension "${E}" error: ${C}`})}return m.runtime.pendingProviderRegistrations=[],c.push(...yvl(g,t.extensionFlagValues)),l.emit("augment:indexing-policy",Evl(i,t.extensionFlagValues)),l.emit("augment:feature-flags",d),l.emit("augment:feature-flags-startup-complete",void 0),{cwd:e,agentDir:n,mcpConfigOverride:t.mcpConfigOverride,permissionOverride:t.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:g,diagnostics:c,augmentApi:u,featureFlags:d}}function KTe(t){let e=t.services.augmentApi,n=e?{webSearch:{operations:{runRemoteTool:e.runRemoteTool.bind(e)}},viewSession:{operations:{fetchChatHistory:Epn({readCredentials:Ch,userAgent:Xy()}),fetchCloudAgentChatHistory:kmn({readCredentials:Ch,userAgent:Xy()})}},sessionRetrieval:{operations:{createRequestId:e.createRequestId.bind(e),agentCodebaseRetrieval:e.agentCodebaseRetrieval.bind(e),fetchCloudAgentChatHistory:kmn({readCredentials:Ch,userAgent:Xy()}),fetchChatHistory:Epn({readCredentials:Ch,userAgent:Xy()}),getBranch:()=>pvl(t.sessionManager.getBranch())}}}:void 0;return Jct({cwd:t.services.cwd,agentDir:t.services.agentDir,authStorage:t.services.authStorage,settingsManager:t.services.settingsManager,modelRegistry:t.services.modelRegistry,resourceLoader:t.services.resourceLoader,sessionManager:t.sessionManager,model:t.model,thinkingLevel:t.thinkingLevel,scopedModels:t.scopedModels,tools:t.tools,customTools:t.customTools,sessionStartEvent:t.sessionStartEvent,toolsOptions:n,featureFlags:t.services.featureFlags.flags,mcpConfigOverride:t.services.mcpConfigOverride,permissionOverride:t.services.permissionOverride})}var Nmn=b(()=>{"use strict";tl();lh();Rmn();wu();Hpe();G4();OTe();ZBe();_de();mxe();Mv();Ixe();Dmn();a8i();ypn()});import{copyFileSync as Cvl,existsSync as l8i,mkdirSync as bvl}from"node:fs";import{basename as Ivl,join as Svl,resolve as c8i}from"node:path";function _vl(t){return typeof t=="string"?t:t.filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}async function Xct(t,e){WK(e.sessionManager,e.cwd);let n=await t(e);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new jTe(n.session,n.services,t,n.diagnostics,n.modelFallbackMessage,e.usageReporter,e.toolUseReporter,e.enableSentrySummarizationSpans)}var jTe,Qmn=b(()=>{"use strict";Gct();Fst();L1();ZTe();_v();PHi();ZHi();Nmn();jTe=class{constructor(e,n,r,i=[],s,o,a,l=!1){this._session=e,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let e=this._usageReporter,n=this._toolUseReporter;if(!(e||n))return;let r=this._session,i=r.sessionId,s=e?JHi({reporter:e,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;e&&(e.sessionStarted(i),XHi({reporter:e,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?OHi({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{e&&a.type==="message_start"&&P1(a.message.role)&&e.userMessageSent(i),s?.(a),o?.(a)})}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let e=FHi();this._summarizationSubscriber=e,this._summarizationUnsubscribe=this._session.subscribe(e.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let e=this._usageReporter,n=this._toolUseReporter;(e||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,e?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(e,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:e,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(e){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:e}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.detachUsageReporter(),this.detachSummarizationTracer(),await jBe(this.session.extensionRunner),this.session.dispose()}apply(e){process.cwd()!==e.services.cwd&&process.chdir(e.services.cwd),this._session=e.session,this._services=e.services,this._diagnostics=e.diagnostics,this._modelFallbackMessage=e.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer()}async switchSession(e,n){let r=await this.emitBeforeSwitch("resume",e);if(r.cancelled)return r;let i=this.session.sessionFile,s=Ha.open(e,void 0,n);return WK(s,this.cwd),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}async newSession(e){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=e?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=Ha.create(r,s);return e?.parentSession&&o.newSession({parentSession:e.parentSession}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),e?.setup&&(await e.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}async fork(e){if((await this.emitBeforeFork(e)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(e);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=_vl(i.content);else if(i.role==="promptCommandInvocation")s=Vy(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let c=this.session.sessionManager.getSessionDir();if(!r.parentId){let A=Ha.create(this.cwd,c);return A.newSession({parentSession:l}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:A,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=Ha.open(l,c).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=Ha.open(d,c);return await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}async importFromJsonl(e,n){let r=c8i(e);if(!l8i(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();l8i(i)||bvl(i,{recursive:!0});let s=Svl(i,Ivl(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;c8i(s)!==r&&Cvl(r,s);let l=Ha.open(s,i,n);return WK(l,this.cwd),await this.teardownCurrent(),this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.detachUsageReporter(),this.detachSummarizationTracer(),await jBe(this.session.extensionRunner),this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as Mmn}from"node:path";function vvl(){return Hs()}async function Jct(t={}){let e=t.cwd??process.cwd(),n=t.agentDir??vvl(),r=t.resourceLoader,i=t.agentDir?Mmn(n,"auth.json"):void 0,s=t.agentDir?Mmn(n,"models.json"):void 0,o=t.authStorage??gM.create(i),a=t.modelRegistry??V4.create(o,s),l=t.settingsManager??ba.create(e,n),c=t.sessionManager??Ha.create(e,ES(e,n));r||(r=new b4({cwd:e,agentDir:n,settingsManager:l}),await r.reload(),Fv("resourceLoader.reload"));let u=c.buildSessionContext(),d=u.messages.length>0,p=c.getBranch().some(R=>R.type==="thinking_level_change"),A=t.model,g;if(!A&&d&&u.model){let R=a.find(u.model.provider,u.model.modelId);R&&a.hasConfiguredAuth(R)&&(A=R),A||(g=`Could not restore model ${u.model.provider}/${u.model.modelId}`)}A||(A=(await NHi({scopedModels:[],isContinuing:d,defaultProvider:l.getDefaultProvider(),defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,A?g&&(g+=`. Using ${A.provider}/${A.id}`):g=`No models available. Use /login or set an API key environment variable. See ${Mmn(Mle(),"providers.md")}. Then use /model to select a model.`);let m=t.thinkingLevel;m===void 0&&d&&(m=p?u.thinkingLevel:l.getDefaultThinkingLevel()??bk),m===void 0&&(m=l.getDefaultThinkingLevel()??bk),A?.reasoning||(m="off");let h=["read",process.env.AUGGIE_ENABLE_TERMINAL==="1"?"terminal":"bash","edit","write","web-fetch","web-search","view-session"],E=t.tools?t.tools.map(R=>R.name).filter(R=>R in pM):h,y,C=R=>{let B=z2(R);return l.getBlockImages()?B.map(F=>{if(F.role==="user"||F.role==="toolResult"){let Q=F.content;if(Array.isArray(Q)&&Q.some(D=>D.type==="image")){let D=Q.map(M=>M.type==="image"?{type:"text",text:"Image reading is disabled."}:M).filter((M,H,X)=>!(M.type==="text"&&M.text==="Image reading is disabled."&&H>0&&X[H-1].type==="text"&&X[H-1].text==="Image reading is disabled."));return{...F,content:D}}}return F}):B},S={};y=new _$({initialState:{systemPrompt:"",model:A,thinkingLevel:m,tools:[]},convertToLlm:C,streamFn:async(R,B,F)=>{let Q=await a.getApiKeyAndHeaders(R);if(!Q.ok)throw new Error(Q.error);return ND(R,B,{...F,apiKey:Q.apiKey,headers:Q.headers||F?.headers?{...Q.headers,...F?.headers}:void 0})},onPayload:(R,B)=>{let F=S.current;return F?.hasHandlers("before_provider_request")?F.emitBeforeProviderRequest(R):R},sessionId:c.getSessionId(),transformContext:R=>{let B=S.current;return B?B.emitContext(R):Promise.resolve(R)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),transport:l.getTransport(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(y.state.messages=u.messages,p||c.appendThinkingLevelChange(m)):(A&&c.appendModelChange(A.provider,A.id),c.appendThinkingLevelChange(m));let v=new kpe({agent:y,sessionManager:c,settingsManager:l,cwd:e,agentDir:n,mcpConfigOverride:t.mcpConfigOverride,permissionOverride:t.permissionOverride,scopedModels:t.scopedModels,resourceLoader:r,customTools:t.customTools,toolsOptions:t.toolsOptions,modelRegistry:a,initialActiveToolNames:E,extensionRunnerRef:S,sessionStartEvent:t.sessionStartEvent,featureFlags:t.featureFlags,role:t.role}),_=r.getExtensions();return{session:v,extensionsResult:_,modelFallbackMessage:g}}var Dmn=b(()=>{"use strict";OBe();tl();lh();wu();mct();OTe();gst();L1();Mv();JTe();Ixe();_v();Imn();P4();Qmn();P4()});function Omn(t){return Fmn[t]}function $ct(t){return t==="user"?"global":t}function Kct(t){return t==="global"?"user":t}function Pmn(t){let{files:e,alwaysShowPicker:n}=t;if(n&&e.length>=2)return{files:e};let r=e.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:e}}var Zct,Fmn,u8i=b(()=>{"use strict";Zct=["local","project","user"],Fmn={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});var D6A,qTe=b(()=>{"use strict";D6A=new TextDecoder("utf-8",{fatal:!0})});var Lmn=b(()=>{"use strict"});var Umn=b(()=>{"use strict"});var Gmn=b(()=>{"use strict";vr();Umn()});var d8i=b(()=>{"use strict"});var eke=b(()=>{"use strict";vr();XT();Lmn();Gmn();d8i()});import{execFile as xvl}from"node:child_process";import{promisify as Tvl}from"node:util";var q6A,Vmn=b(()=>{"use strict";vr();q6A=Tvl(xvl)});import{exec as Nvl}from"node:child_process";import{promisify as Dvl}from"node:util";var sJA,Wmn=b(()=>{"use strict";vr();Vmn();sJA=Dvl(Nvl)});var tke=b(()=>{"use strict"});var nke=b(()=>{"use strict";vr();XT()});var Qvl,pJA,AJA,jct=b(()=>{"use strict";vr();Qvl=Qr(UL(),1),pJA=1024*1024,AJA=on.child({prefix:"HierarchicalIgnoreFilter"})});var rke=b(()=>{"use strict";vr();XT()});import{execFile as Mvl,spawn as yJA}from"node:child_process";import{promisify as Fvl}from"node:util";var SJA,_JA,vJA,qct=b(()=>{"use strict";vr();tke();SJA=Fvl(Mvl),_JA=1024*1024,vJA=on.child({prefix:"git-tree-walker"})});import{execFile as Ovl}from"node:child_process";import{promisify as Pvl}from"node:util";var xJA,Hmn=b(()=>{"use strict";xJA=Pvl(Ovl)});var Lvl,NJA,zmn=b(()=>{"use strict";vr();Lvl=Qr(UL(),1),NJA=1024*1024});import{execFile as Yvl}from"node:child_process";import{promisify as Hvl}from"node:util";var OJA,Kmn=b(()=>{"use strict";qct();vr();qTe();eke();XT();Hmn();tke();qct();nke();zmn();rke();OJA=Hvl(Yvl)});var $JA,jmn=b(()=>{"use strict";vr();$JA=on.child({prefix:"FileWalker"})});var qmn=b(()=>{"use strict";vr();qTe();eke();XT();nke();jmn();jct();rke()});var cXA,efn=b(()=>{"use strict";vr();XT();cXA=on.child({prefix:"FileWatcher"})});var AXA,tfn=b(()=>{"use strict";vr();XT();AXA=on.child({prefix:"WatcherProcessor"})});var g8i=b(()=>{"use strict";vr();qTe();eke();Wmn();XT();tke();nke();jct();rke();Kmn();qmn();efn();tfn()});import{Worker as qvl}from"node:worker_threads";async function ike(){let t=Date.now(),e=new URL("./indexing-worker.mjs",import.meta.url),n;try{n=new qvl(e)}catch(r){return{ok:!1,error:`Worker construction threw: ${r instanceof Error?r.message:String(r)}`,durationMs:Date.now()-t}}return await new Promise(r=>{let i=!1,s=a=>{i||(i=!0,clearTimeout(o),n.terminate().catch(()=>{}),r(a))},o=setTimeout(()=>{s({ok:!1,error:`Worker did not report ready within ${m8i}ms`,durationMs:Date.now()-t})},m8i);o.unref(),n.on("message",a=>{a&&a.type==="ready"&&s({ok:!0,durationMs:Date.now()-t})}),n.on("error",a=>{s({ok:!1,error:`Worker error event: ${a.message}`,durationMs:Date.now()-t})}),n.on("exit",a=>{a!==0&&s({ok:!1,error:`Worker exited with code ${a} before ready`,durationMs:Date.now()-t})})})}var m8i,f8i=b(()=>{"use strict";m8i=1e4});var NXA,h8i=b(()=>{"use strict";vr();NXA=on.child({prefix:"AugmentApiAdapter"})});var nfn=b(()=>{"use strict";g8i();f8i();RZt();h8i();Hmn();Vmn();tke();qct();Wmn();nke();jmn();jct();zmn();rke();Kmn();qmn();qTe();eke();Lmn();Umn();Gmn();XT();efn();tfn()});var ewl,twl,nwl,C8i,rwl,iwl,swl,E8i,y8i,zpe,eut,rfn,ifn,owl,tut,afn,HK,lfn,awl,ske,lwl,sfn,ofn,cwl,nut,rut=b(()=>{"use strict";ewl="http/protobuf",twl="delta",nwl="hmac",C8i=new Set(["1","true","yes","on"]),rwl=new Set(["0","false","no","off"]),iwl={metrics:"METRICS",logs:"LOGS",traces:"TRACES"},swl={metrics:"/v1/metrics",logs:"/v1/logs",traces:"/v1/traces"},E8i=(t,e,n)=>{if(n==="grpc")return t;let r=swl[e],i=t.endsWith("/")?t.slice(0,-1):t;return i.endsWith(r)?i:i+r},y8i=t=>C8i.has(t.trim().toLowerCase()),zpe=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();return C8i.has(e)?!0:rwl.has(e)?!1:void 0},eut=(t,e)=>{if(t===void 0)return e;let n=Number.parseInt(t.trim(),10);return Number.isNaN(n)?e:n},rfn=(t,e)=>{let n=eut(t,e);return n>0?n:e},ifn=(t,e)=>t&&t>0?t:e,owl=t=>t==="grpc"||t==="http/protobuf"||t==="http/json",tut=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();return owl(e)?e:void 0},afn=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();if(e==="delta"||e==="cumulative")return e},HK=t=>{if(t===void 0)return;let e=t.trim();return e.length>0?e:void 0},lfn=t=>{if(t===void 0)return;let e=t.trim().toLowerCase();if(e==="hmac"||e==="raw"||e==="off")return e},awl=(t,e)=>(t??"").split(",").map(n=>n.trim().toLowerCase()).includes(e),ske=t=>{let e={};if(!t)return e;for(let n of t.split(",")){let r=n.trim(),i=r.indexOf("=");if(i<=0)continue;let s=r.slice(0,i).trim();s&&(e[s]=r.slice(i+1).trim())}return e},lwl=(t,e,n)=>{if(n.enabled!==void 0)return n.enabled;let r=t.AUGGIE_ENABLE_TELEMETRY;if(r!==void 0)return y8i(r);let i=t.CLAUDE_CODE_ENABLE_TELEMETRY;return i!==void 0?y8i(i):e.enabled??!1},sfn=(t,e,n,r)=>{let i=iwl[e],s=r.protocol??tut(t[`OTEL_EXPORTER_OTLP_${i}_PROTOCOL`])??tut(t.OTEL_EXPORTER_OTLP_PROTOCOL)??n.protocol??ewl,o=HK(r.endpoint),a=HK(t[`OTEL_EXPORTER_OTLP_${i}_ENDPOINT`]),l=HK(t.OTEL_EXPORTER_OTLP_ENDPOINT)??HK(n.endpoint),c;o!==void 0?c=E8i(o,e,s):a!==void 0?c=a:l!==void 0&&(c=E8i(l,e,s));let u={...n.headers,...ske(t.OTEL_EXPORTER_OTLP_HEADERS),...ske(t[`OTEL_EXPORTER_OTLP_${i}_HEADERS`]),...r.headers};return{endpoint:c,headers:u,protocol:s}},ofn=t=>t!==void 0&&t>0?t:void 0,cwl=(t,e,n)=>({bufferDir:HK(n.bufferDir)??HK(t.AUGGIE_TELEMETRY_BUFFER_DIR)??HK(e.bufferDir),bufferMaxBytes:ofn(n.bufferMaxBytes)??rfn(t.AUGGIE_TELEMETRY_BUFFER_MAX_BYTES,ifn(e.bufferMaxBytes,52428800)),breakerFailureThreshold:ofn(n.breakerFailureThreshold)??rfn(t.AUGGIE_TELEMETRY_BREAKER_FAILURE_THRESHOLD,ifn(e.breakerFailureThreshold,3)),breakerBackoffMs:ofn(n.breakerBackoffMs)??rfn(t.AUGGIE_TELEMETRY_BREAKER_BACKOFF_MS,ifn(e.breakerBackoffMs,3e4))}),nut=(t={})=>{let e=t.env??process.env,n={...t.envInjection,...e},r=t.telemetry??{},i=t.managed??{},s={metrics:sfn(n,"metrics",r,i),logs:sfn(n,"logs",r,i),traces:sfn(n,"traces",r,i)},o=s.metrics.endpoint!==void 0||s.logs.endpoint!==void 0||s.traces.endpoint!==void 0;return{enabled:lwl(n,r,i)&&o,exporter:s,metricExportIntervalMs:i.metricExportIntervalMs??eut(n.OTEL_METRIC_EXPORT_INTERVAL,r.metricExportIntervalMs??2e4),logsExportIntervalMs:i.logsExportIntervalMs??eut(n.OTEL_LOGS_EXPORT_INTERVAL,r.logsExportIntervalMs??5e3),metricsTemporalityPreference:i.metricsTemporalityPreference??afn(n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE)??r.metricsTemporalityPreference??twl,resourceAttributes:{...r.resourceAttributes,...ske(n.OTEL_RESOURCE_ATTRIBUTES),...i.resourceAttributes},includeVersion:i.includeVersion??zpe(n.OTEL_METRICS_INCLUDE_VERSION)??r.includeVersion??!1,includeAccountUuid:i.includeAccountUuid??zpe(n.OTEL_METRICS_INCLUDE_ACCOUNT_UUID)??r.includeAccountUuid??!0,identity:{mode:i.identityMode??lfn(n.AUGGIE_TELEMETRY_IDENTITY_MODE)??r.identityMode??nwl,secret:i.identitySecret??n.AUGGIE_TELEMETRY_IDENTITY_SECRET??r.identitySecret},shutdownTimeoutMs:i.shutdownTimeoutMs??eut(n.AUGGIE_TELEMETRY_SHUTDOWN_TIMEOUT_MS,r.shutdownTimeoutMs??2e3),...cwl(n,r,i),genAiCaptureMessageContent:i.captureMessageContent??zpe(n.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT)??r.captureMessageContent??!1,genAiLatestExperimental:awl(n.OTEL_SEMCONV_STABILITY_OPT_IN,"gen_ai_latest_experimental"),logUserPrompts:i.logUserPrompts??zpe(n.OTEL_LOG_USER_PROMPTS)??r.logUserPrompts??!1,logToolDetails:i.logToolDetails??zpe(n.OTEL_LOG_TOOL_DETAILS)??r.logToolDetails??!1,langsmithCompat:i.langsmithCompat??zpe(n.AUGGIE_TELEMETRY_LANGSMITH_COMPAT)??r.langsmithCompat??!1}}});import{execFileSync as uwl}from"node:child_process";import{existsSync as dwl,readFileSync as pwl}from"node:fs";var b8i,Awl,gwl,I8i,S8i,mwl,dfn,_8i,fwl,hwl,Ewl,ywl,Cwl,cfn,bwl,Iwl,zK,Jpe,ufn,v8i,Swl,iut,pfn=b(()=>{"use strict";rut();b8i="/Library/Managed Preferences/com.augmentcode.auggie.plist",Awl="HKLM\\SOFTWARE\\Policies\\AugmentCode\\Auggie\\Telemetry",gwl="/etc/augment/auggie-managed-settings.json",I8i="/usr/bin/plutil",S8i="C:\\Windows\\System32\\reg.exe",mwl=2e3,dfn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),_8i=t=>dfn(t)?t.telemetry:void 0,fwl=(t,e)=>uwl(t,e,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:mwl,windowsHide:!0}),hwl=/^ {4}(.+?) {4}(REG_[A-Z_]+) {4}(.*)$/,Ewl=t=>{let e={};for(let n of t.split(/\r?\n/)){let r=hwl.exec(n);if(!r)continue;let[,i,s,o]=r;if(s==="REG_DWORD"||s==="REG_QWORD"){let a=Number(o.trim());Number.isFinite(a)&&(e[i]=a)}else(s==="REG_SZ"||s==="REG_EXPAND_SZ")&&(e[i]=o)}return Object.keys(e).length>0?e:void 0},ywl=(t={})=>{let e=t.execRead??fwl,n=t.fileExists??dwl;return{darwin:()=>{if(!(n(b8i)&&n(I8i)))return;let r=e(I8i,["-convert","json","-o","-",b8i]);return _8i(JSON.parse(r))},linux:()=>_8i(JSON.parse(pwl(gwl,"utf-8"))),win32:()=>{if(n(S8i))return Ewl(e(S8i,["query",Awl]))}}},Cwl=ywl(),cfn=t=>typeof t=="string"?t:void 0,bwl=new Set(["1","true","yes","on"]),Iwl=new Set(["0","false","no","off"]),zK=t=>{if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let e=t.trim().toLowerCase();if(bwl.has(e))return!0;if(Iwl.has(e))return!1}},Jpe=t=>{if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"){let e=t.trim();if(e.length===0)return;let n=Number(e);return Number.isFinite(n)?n:void 0}},ufn=t=>{if(typeof t!="string")return;let e=t.trim();return e.length>0?e:void 0},v8i=t=>{if(typeof t=="string"){let n=ske(t);return Object.keys(n).length>0?n:void 0}if(!dfn(t))return;let e={};for(let[n,r]of Object.entries(t))typeof r=="string"&&(e[n]=r);return Object.keys(e).length>0?e:void 0},Swl=t=>{if(!dfn(t))return;let e={breakerBackoffMs:Jpe(t.breakerBackoffMs),breakerFailureThreshold:Jpe(t.breakerFailureThreshold),bufferDir:ufn(t.bufferDir),bufferMaxBytes:Jpe(t.bufferMaxBytes),captureMessageContent:zK(t.captureMessageContent),enabled:zK(t.enabled),endpoint:ufn(t.endpoint),headers:v8i(t.headers),identityMode:lfn(cfn(t.identityMode)),identitySecret:ufn(t.identitySecret),includeAccountUuid:zK(t.includeAccountUuid),includeVersion:zK(t.includeVersion),logsExportIntervalMs:Jpe(t.logsExportIntervalMs),langsmithCompat:zK(t.langsmithCompat),logToolDetails:zK(t.logToolDetails),logUserPrompts:zK(t.logUserPrompts),metricExportIntervalMs:Jpe(t.metricExportIntervalMs),metricsTemporalityPreference:afn(cfn(t.metricsTemporalityPreference)),protocol:tut(cfn(t.protocol)),resourceAttributes:v8i(t.resourceAttributes),shutdownTimeoutMs:Jpe(t.shutdownTimeoutMs)};return Object.values(e).some(r=>r!==void 0)?e:void 0},iut=(t={})=>{let e=t.platform??process.platform;if(e!=="darwin"&&e!=="win32"&&e!=="linux")return;let n=t.readers?.[e]??Cwl[e];try{return Swl(n())}catch{return}}});function BS(t,e){if(typeof t=="string"){if(!e)throw new Error(`registerBuiltinExtension("${t}", factory) called without a factory`);sut.push({name:t,factory:e,kind:"bundled"});return}if((t.kind??"bundled")==="prebundled"){if(t.factory!==void 0)throw new Error(`registerBuiltinExtension("${t.name}"): prebundled extensions must not be registered with a factory (the static factory import would inline the extension into the SEA, see apps/auggie-v2/docs/prebundled-extensions.md).`);sut.push({name:t.name,kind:"prebundled"});return}if(!t.factory)throw new Error(`registerBuiltinExtension({ name: "${t.name}" }) called without a factory for kind="bundled"`);sut.push({name:t.name,factory:t.factory,kind:"bundled"})}function w8i(){return sut}function R8i(t,e){return t.filter(n=>!e.has(n.name))}var sut,Afn=b(()=>{"use strict";sut=[]});import{statSync as _wl}from"node:fs";import{resolve as vwl}from"node:path";function B8i(t,e,n){let r=[],i=[];if(!t||t.length===0)return{resolved:r,errors:i};let s=new Set([e]);for(let o of t){let a=LA(o),l=vwl(n,a);if(s.has(l))continue;let c;try{c=_wl(l)}catch(u){let d=u instanceof Error?u.message:String(u);i.push(`--add-workspace "${o}": ${d}`);continue}if(!c.isDirectory()){i.push(`--add-workspace "${o}": not a directory (${l})`);continue}s.add(l),r.push(l)}return{resolved:r,errors:i}}function x8i(t){return t.isCloudService?{kind:"tolerate",warnings:t.errors}:{kind:"fatal",fatalErrors:t.errors}}var T8i=b(()=>{"use strict";ih()});import{execFile as wwl}from"node:child_process";import{existsSync as Rwl,rmSync as Bwl}from"node:fs";import{promisify as xwl}from"node:util";function gfn(t){let e=t.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(e){let[,r,i]=e;return{sshUrl:t.endsWith(".git")?t:`${t}.git`,httpsUrl:`https://${r}/${i}.git`}}let n=t.match(/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(n){let[,r,i]=n;return{sshUrl:`git@${r}:${i}.git`,httpsUrl:t.endsWith(".git")?t:`${t}.git`}}return{sshUrl:t,httpsUrl:t}}function Q8i(t){return t instanceof Error?t.message:String(t)}async function mfn({sshUrl:t,httpsUrl:e,targetDir:n,extraArgs:r=[]}){let i;for(let s of[{url:t,env:Twl},{url:e,env:D8i}])try{return await N8i("git",["clone","--depth","1",...r,s.url,n],{env:s.env}),{success:!0}}catch(o){i=o,Rwl(n)&&Bwl(n,{recursive:!0,force:!0})}return{success:!1,error:Q8i(i)}}function k8i(t,e){return N8i("git",t,{cwd:e,env:D8i})}async function M8i(t,e){try{return await k8i(["fetch","--depth","1","origin",e],t),await k8i(["checkout","FETCH_HEAD"],t),{success:!0}}catch(n){return{success:!1,error:Q8i(n)}}}var N8i,Twl,D8i,F8i=b(()=>{"use strict";N8i=xwl(wwl),Twl={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:"ssh -o BatchMode=yes"},D8i={...process.env,GIT_TERMINAL_PROMPT:"0"}});import{existsSync as kwl,readFileSync as Nwl}from"node:fs";import{join as Xpe}from"node:path";function L8i(t){for(let e of P8i)if(kwl(Xpe(t,e)))return!0;return!1}function JK(t){let e=Dwl(t,O8i);return e.manifest||e.diagnostics.length>0?e:{diagnostics:[`no marketplace manifest found (looked for ${O8i.join(", ")})`]}}function Dwl(t,e){let n=[];for(let r of e){let i=Xpe(t,r),s;try{s=Nwl(i,"utf-8")}catch{continue}try{let o=JSON.parse(s);if(o&&typeof o=="object"&&!Array.isArray(o))return{manifest:o,manifestPath:i,diagnostics:n};n.push(`manifest at ${r} is not a JSON object; ignoring`)}catch(o){n.push(`failed to parse manifest at ${r}: ${o.message}`)}}return{diagnostics:n}}var P8i,O8i,U8i,out=b(()=>{"use strict";P8i=[Xpe(".augment-plugin","plugin.json"),Xpe(".claude-plugin","plugin.json")],O8i=[Xpe(".augment-plugin","marketplace.json"),Xpe(".claude-plugin","marketplace.json")];U8i=`no plugin manifest found (looked for ${P8i.join(", ")})`});import{execFile as Qwl}from"node:child_process";import{existsSync as AU,mkdirSync as V8i,readdirSync as Mwl,renameSync as Fwl,rmSync as Owl,statSync as Pwl}from"node:fs";import{dirname as Lwl,isAbsolute as W8i,join as gU,relative as Y8i,resolve as ffn}from"node:path";import{promisify as Uwl}from"node:util";function z8i(t){let e=t.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!e||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e)?null:e}function G8i(t){let e=t.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!e||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e)?null:e}function Vwl(t){let e=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:@(.+))?$/);if(e?.[1]&&e[2])return{owner:e[1],repo:e[2].replace(/\.git$/,""),...e[3]?{ref:e[3]}:{}};let n=t.match(/^https?:\/\/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(?:#(.+))?$/);if(n?.[1]&&n[2])return{owner:n[1],repo:n[2],...n[4]?{ref:n[4]}:{}};let r=t.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(\.git)?(?:#(.+))?$/);return r?.[1]&&r[2]?{owner:r[1],repo:r[2],...r[4]?{ref:r[4]}:{}}:null}function hM(t){return typeof t=="string"&&t.length>0?t:void 0}function Wwl(t,e){let n=hM(t.repo);return n?{kind:"github",url:`https://github.com/${n.replace(/\.git$/,"")}.git`,...e?{ref:e}:{},...hM(t.path)?{subdir:hM(t.path)}:{}}:null}function Ywl(t,e){let n=hM(t.url);return n?{kind:"url",url:n,...e?{ref:e}:{},...hM(t.path)?{subdir:hM(t.path)}:{}}:null}function Hwl(t,e){let n=hM(t.url),r=hM(t.path);return n&&r?{kind:"git-subdir",url:n,subdir:r,...e?{ref:e}:{}}:null}function hfn(t){if(!t||typeof t!="object")return null;let e=t,n=hM(e.sha)??hM(e.ref);switch(e.source){case"github":return Wwl(e,n);case"url":return Ywl(e,n);case"git-subdir":return Hwl(e,n);default:return null}}function J8i(t,e,n){let r=z8i(e);if(!r)return;let i=gU(t,H8i,r);if(!AU(gU(i,".git")))return;if(!n)return i;let s=ffn(i,n),o=Y8i(i,s);if(!(o.startsWith("..")||W8i(o)))return AU(s)?s:void 0}async function zwl(t,e){let n=typeof e.name=="string"?e.name:"",r=hfn(e.source);if(!r)return;let i=z8i(n);if(!i)return{name:n,status:"failed",error:"invalid plugin cache name"};let s=gU(t,H8i,i);if(AU(gU(s,".git")))return{name:n,status:"skipped"};let o=Lwl(s);AU(o)||V8i(o,{recursive:!0});let{sshUrl:a,httpsUrl:l}=gfn(r.url),c=r.kind==="git-subdir",u=await mfn({sshUrl:a,httpsUrl:l,targetDir:s,extraArgs:c?["--filter=blob:none","--sparse"]:[]});if(!u.success)return{name:n,status:"failed",error:u.error};if(r.ref){let d=await M8i(s,r.ref);if(!d.success)return{name:n,status:"failed",error:d.error}}if(c&&r.kind==="git-subdir")try{await Gwl("git",["sparse-checkout","set",r.subdir],{cwd:s,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(d){return{name:n,status:"failed",error:d instanceof Error?d.message:String(d)}}return{name:n,status:"cloned"}}async function X8i(t){let{manifest:e}=JK(t),n=e?.plugins;if(!n||n.length===0)return[];let r=[];for(let i of n){let s=await zwl(t,i);s&&r.push(s)}return r}function Jwl(t){try{return Pwl(t).isDirectory()}catch{return!1}}function Xwl(t,e){let n=Y8i(ffn(t),ffn(e));return n!==""&&!n.startsWith("..")&&!W8i(n)}async function oke(t,e){let n=Vwl(e);if(!n)return{success:!1,error:`Invalid GitHub repository: ${e}. Expected owner/repo or a github.com URL.`};let{owner:r,repo:i,ref:s}=n;AU(t)||V8i(t,{recursive:!0});let o=G8i(i);if(!o)return{success:!1,error:`Invalid repository name for marketplace directory: "${i}".`};let a=gU(t,o);if(AU(a))return{success:!1,alreadyInstalled:!0,marketplaceId:o,error:`Marketplace '${o}' is already installed.`};let{sshUrl:l,httpsUrl:c}=gfn(`https://github.com/${r}/${i}`),u=await mfn({sshUrl:l,httpsUrl:c,targetDir:a,extraArgs:s?["--branch",s]:[]});if(!u.success)return{success:!1,error:`Failed to clone '${r}/${i}' (SSH and HTTPS both failed): ${u.error}`};let{manifest:d}=JK(a),p=o,A=typeof d?.name=="string"?G8i(d.name):null;if(A&&A!==o){let g=gU(t,A);if(!AU(g))try{Fwl(a,g),p=A}catch{}}return await X8i(gU(t,p)),{success:!0,marketplaceId:p}}function ake(t,e){let n=gU(t,e);if(!Xwl(t,n))return{success:!1,error:`Refusing to remove '${e}': path is outside the marketplaces directory.`};if(!AU(n))return{success:!1,error:`Marketplace '${e}' not found.`};try{return Owl(n,{recursive:!0,force:!0}),{success:!0}}catch(r){return{success:!1,error:`Failed to remove '${e}': ${r instanceof Error?r.message:String(r)}`}}}async function Z8i(t){let e=!1;for(let n of t){if(!AU(n))continue;let r;try{r=Mwl(n)}catch{continue}for(let i of r){let s=gU(n,i);if(!Jwl(s))continue;(await X8i(s)).some(a=>a.status==="cloned")&&(e=!0)}}return e}var Gwl,H8i,aut=b(()=>{"use strict";F8i();out();Gwl=Uwl(Qwl),H8i=".plugin-cache"});import{readFileSync as Zwl}from"node:fs";import{join as $wl}from"node:path";function $8i(t){let e=$wl(t,"hooks","hooks.json"),n;try{n=Zwl(e,"utf-8")}catch{return{diagnostics:[]}}let r;try{r=JSON.parse(n)}catch(s){return{diagnostics:[`failed to parse hooks/hooks.json: ${s.message}`]}}return!r||typeof r!="object"||Array.isArray(r)?{diagnostics:["hooks/hooks.json must be a JSON object"]}:{config:lxe(r),diagnostics:[]}}var K8i=b(()=>{"use strict";k$()});import{existsSync as Kwl,lstatSync as jwl,readdirSync as q8i,statSync as qwl}from"node:fs";import{isAbsolute as j8i,join as lke,relative as eRl,resolve as ezi}from"node:path";function tzi(t,e){let n=[],r=[],i=[],s=new Map;for(let o of t)for(let a of tRl(o,e,r)){let l=s.get(a.id);if(l!==void 0){i.push({id:a.id,shadowedRoot:o,winnerRoot:l});continue}s.set(a.id,o),n.push(a)}for(let[o,a]of Object.entries(e))a&&!s.has(o)&&r.push(`enabledPlugins["${o}"] = true but no plugin with that id was found in any marketplace root`);return{plugins:n,globalDiagnostics:r,shadowedPlugins:i}}function tRl(t,e,n){let r=[];if(!Kwl(t))return r;let i;try{i=q8i(t)}catch(s){return n.push(`failed to read marketplaces directory ${t}: ${s.message}`),r}for(let s of i){let o=lke(t,s);cke(o)&&nRl(o,s,e,r,n)}return r}function nRl(t,e,n,r,i){let s=JK(t);if(!s.manifest){for(let c of s.diagnostics)i.push(`[${e}] ${c}`);return}let o=cRl(s.manifest.name,e),a=lRl(t,s.manifest.metadata?.pluginRoot),l=Array.isArray(s.manifest.plugins)?s.manifest.plugins:[];l.length===0&&i.push(`[${o}] marketplace.json has no plugins[] entries`);for(let c of l){let u=rRl(c,t,a,o,n);u&&r.push(u)}for(let c of s.diagnostics)i.push(`[${o}] ${c}`)}function rRl(t,e,n,r,i){let s=typeof t.name=="string"?Zpe(t.name):void 0;if(!s)return;let o=`${s}@${r}`,a=i[o]===!0,l=[],c=aRl(t.source,s,e,n,l);return c?sRl(o,r,s,c,a,l):{id:o,marketplace:r,name:s,root:e,enabled:a,commandsDir:void 0,skillsDir:void 0,hooksConfig:void 0,agentsDirPresent:!1,diagnostics:l}}function iRl(t,e){let n=[],r;try{r=q8i(t).sort()}catch(s){return e.push(`failed to read agents directory: ${s.message}`),n}let i=[];for(let s of r){if(!s.endsWith(".md"))continue;let o=lke(t,s);try{if(!jwl(o).isFile()){i.push(s);continue}}catch(a){e.push(`failed to stat agent file ${s}: ${a.message}`);continue}n.push(o)}return i.length>0&&e.push(`ignoring non-regular agent file(s) under agents/ (symlinks / dirs / devices are not followed): ${i.join(", ")}`),n}function sRl(t,e,n,r,i,s){L8i(r)||s.push(U8i);let o=lke(r,"commands"),a=lke(r,"skills"),l=lke(r,"agents"),c=cke(o)?o:void 0,u=cke(a)?a:void 0,d=cke(l),p=d&&i?iRl(l,s):void 0,A=$8i(r);for(let g of A.diagnostics)s.push(g);return{id:t,marketplace:e,name:n,root:r,enabled:i,commandsDir:c,skillsDir:u,hooksConfig:A.config,agentsDirPresent:d,agentFiles:p,diagnostics:s}}function oRl(t,e,n,r){let i=hfn(t);if(!i){let o=t.source;r.push(`source kind "${typeof o=="string"?o:"object"}" is not supported; install the plugin manually as a relative directory`);return}let s=J8i(n,e,i.subdir);if(s)return s;r.push(`source kind "${i.kind}" not fetched yet; run /plugins to clone it (or marketplace update)`)}function aRl(t,e,n,r,i){if(typeof t!="string"){if(t&&typeof t=="object")return oRl(t,e,n,i);i.push("plugin entry has no source field; skipping");return}if(j8i(t)){i.push(`absolute source "${t}" is not allowed; skipping`);return}let s=t.startsWith("./")?n:r,o=ezi(s,t),a=eRl(n,o);if(a.startsWith("..")||j8i(a)){i.push(`source "${t}" resolves outside the marketplace root; skipping`);return}if(!cke(o)){i.push(`source "${t}" does not point to an existing directory (looked at ${o})`);return}return o}function lRl(t,e){return typeof e!="string"||e.length===0?t:ezi(t,e)}function cRl(t,e){if(typeof t=="string"&&t.length>0){let n=Zpe(t);if(n.length>0)return n}return e}function Zpe(t){let e="";for(let n of t){let r=n.codePointAt(0);if(r===void 0)continue;let i=r<=31,s=r>=127&&r<=159;i||s||(e+=n)}return e}function cke(t){try{return qwl(t).isDirectory()}catch{return!1}}var lut=b(()=>{"use strict";aut();K8i();out()});import{readFileSync as uRl}from"node:fs";import{basename as dRl}from"node:path";function cut(t){return typeof t=="string"?t:void 0}function ARl(t){if(typeof t=="string")return rzi.includes(t)?t:void 0}function gRl(t){return typeof t=="number"&&t>=0?t:void 0}function szi(t){if(t==null)return;let e=String(t).trim();if(!e||e==="none")return;let n=e.split(",").map(r=>r.trim()).filter(Boolean);return n.length>0?n:void 0}function ozi(t,e){return t==null?[...e]:szi(t)??[]}function mRl(t){return szi(t)}function fRl(t){if(t==="user"||t==="project"||t==="local")return t}function nzi(t){if(t==null||t===!0)return!0;if(t===!1||t==="none")return!1;let e=ozi(t,[]);return e.length>0?e:!1}function hRl(t,e){let n=Zpe(dRl(t,".md")),r;try{r=uRl(t,"utf-8")}catch(u){let d=u instanceof Error?u.message:String(u);return{ok:!1,diagnostic:`failed to read agent file ${t}: ${d}`}}let i,s;try{let u=Ek(r);i=u.frontmatter??{},s=u.body}catch(u){let d=u instanceof Error?u.message:String(u);return{ok:!1,diagnostic:`invalid frontmatter in agent file ${t}: ${d}`}}let o=cut(i.thinking),a=ARl(i.thinking),l=[];o!==void 0&&a===void 0&&l.push(`agent file ${t} declares thinking: "${o}", which is not a recognised level (expected one of: ${rzi.join(", ")}); falling back to the model's default`);let c={name:n,displayName:cut(i.display_name),description:cut(i.description)??n,builtinToolNames:ozi(i.tools,pRl),disallowedTools:mRl(i.disallowed_tools),extensions:nzi(i.extensions??i.inherit_extensions),skills:nzi(i.skills??i.inherit_skills),model:cut(i.model),thinking:a,maxTurns:gRl(i.max_turns),systemPrompt:s.trim(),promptMode:i.prompt_mode==="append"?"append":"replace",inheritContext:i.inherit_context==null?void 0:i.inherit_context===!0,runInBackground:i.run_in_background==null?void 0:i.run_in_background===!0,isolated:i.isolated==null?void 0:i.isolated===!0,memory:fRl(i.memory),isolation:i.isolation==="worktree"?"worktree":void 0,enabled:i.enabled!==!1,source:"plugin",pluginId:e};return l.length>0?{ok:!0,config:c,warnings:l}:{ok:!0,config:c}}function azi(t){let e=new Map,n=[];if(!t.agentFiles||t.agentFiles.length===0)return{agents:e,diagnostics:n};let r=new Map;for(let i of t.agentFiles){let s=hRl(i,t.id);if(!s.ok){n.push(s.diagnostic);continue}if(s.warnings)for(let l of s.warnings)n.push(l);let{config:o}=s,a=o.name.toLowerCase();if(r.has(a)){let l=r.get(a)??o.name,c=l===o.name?`"${o.name}"`:`"${o.name}" (case-insensitive collision with "${l}")`;n.push(`duplicate agent name ${c} in plugin ${t.id}; ignoring ${i}`);continue}e.set(o.name,o),r.set(a,o.name)}return{agents:e,diagnostics:n}}var pRl,rzi,izi,lzi=b(()=>{"use strict";xu();lut();pRl=["read","bash","edit","write","grep","find","ls"],rzi=["off","minimal","low","medium","high","xhigh"],izi=["general-purpose","explore","plan"]});import{lstatSync as ERl,readFileSync as yRl,realpathSync as czi}from"node:fs";import{isAbsolute as CRl,join as bRl,relative as IRl}from"node:path";function uke(t,e){let n=t;for(let r of SRl){let i=`\${${r}}`;n.includes(i)&&(n=n.split(i).join(e))}return n}function Efn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function uzi(t){if(!t)return;let e={};for(let[n,r]of Object.entries(t))r!=null&&(e[n]=String(r));return Object.keys(e).length>0?e:void 0}function _Rl(t){if(t.type==="stdio"||t.type==="http"||t.type==="sse")return t.type;if(t.url)return"http";if(t.command)return"stdio"}function vRl(t,e,n){let r=_Rl(e);if(!r)throw new Error(`MCP server "${t}" must declare a 'command' (stdio) or 'url' (http/sse) property`);if(r==="http"||r==="sse"){if(!e.url)throw new Error(`MCP server "${t}" has type "${r}" but no 'url' property`);return{type:r,name:t,disabled:e.disabled,url:e.url,headers:uzi(e.headers),auth:e.auth==="oauth"?"oauth":void 0,cwd:e.cwd,timeoutMs:e.timeoutMs}}let i=e.command;if(!i)throw new Error(`MCP server "${t}" has type "stdio" but no 'command' property`);let s=Array.isArray(e.args)?e.args.map(a=>String(a)):[],o=s.length>0?`${i} ${s.join(" ")}`:i;return e.useShellInterpolation===!1&&n.push(`MCP server "${t}": useShellInterpolation:false is ignored; plugin stdio servers always shell-wrap (V2 parity)`),{type:"stdio",name:t,disabled:e.disabled,command:o,args:[],env:uzi(e.env),cwd:e.cwd,timeoutMs:e.timeoutMs,useShellInterpolation:!0}}function dzi(t,e){if(!t)return;let n={};for(let[r,i]of Object.entries(t))n[r]=uke(i,e);return n}function wRl(t,e){return t.type==="stdio"?{...t,command:uke(t.command,e),env:dzi(t.env,e),cwd:t.cwd?uke(t.cwd,e):void 0}:{...t,url:uke(t.url,e),headers:dzi(t.headers,e),cwd:t.cwd?uke(t.cwd,e):void 0}}function RRl(t,e){let n=bRl(t,".mcp.json"),r;try{r=ERl(n)}catch(i){if(i?.code==="ENOENT")return;e.push(`failed to stat .mcp.json: ${i.message}`);return}if(r.isSymbolicLink()){e.push(".mcp.json is a symlink; refusing to follow it out of the plugin root");return}if(!r.isFile()){e.push(".mcp.json is not a regular file; skipping");return}try{let i=czi(t),s=czi(n),o=IRl(i,s);if(o.startsWith("..")||CRl(o)){e.push(".mcp.json resolves outside the plugin root; skipping");return}}catch(i){e.push(`failed to resolve .mcp.json real path: ${i.message}`);return}try{return yRl(n,"utf-8")}catch(i){e.push(`failed to read .mcp.json: ${i.message}`);return}}function pzi(t){let e=[],n=RRl(t.root,e);if(n===void 0)return{servers:[],diagnostics:e};let r;try{r=JSON.parse(n)}catch(o){return e.push(`failed to parse .mcp.json: ${o.message}`),{servers:[],diagnostics:e}}if(!Efn(r))return e.push(".mcp.json must be a JSON object"),{servers:[],diagnostics:e};let i=r.mcpServers;if(!Efn(i))return e.push('.mcp.json must contain an "mcpServers" object'),{servers:[],diagnostics:e};let s=[];for(let[o,a]of Object.entries(i)){let l=`${t.id}/${Zpe(o)}`;if(!Efn(a)){e.push(`MCP server "${l}" must be a JSON object`);continue}try{let c=vRl(l,a,e);s.push(wRl(c,t.root))}catch(c){e.push(c instanceof Error?c.message:String(c))}}return{servers:s,diagnostics:e}}var SRl,Azi,gzi=b(()=>{"use strict";lut();SRl=["CLAUDE_PLUGIN_ROOT","AUGMENT_PLUGIN_ROOT","AUGGIE_PLUGIN_ROOT"];Azi="hermes:mcp:register-server-source"});function mzi(t,e){let n=ba.create(t,e),r=n.getEnabledPlugins(),i=n.drainErrors().map(({scope:s,error:o})=>`failed to load ${s} settings: ${o.message}; enabledPlugins entries from this scope will be ignored`);return{enabled:r,diagnostics:i}}var fzi=b(()=>{"use strict";xu()});var hzi,Ezi=b(()=>{"use strict";hzi="hermes:subagents:register-agent-source"});import{join as $pe}from"node:path";import{existsSync as BRl,readdirSync as xRl,statSync as TRl}from"node:fs";function bfn(t){Vk=[],Cfn=[],uut=[],yfn=[],dke=[];let e=!1,n,r=new Map,i,s,o=new Map,a;t.events.on(Iot,R=>{n=R.register}),t.events.on(hzi,R=>{i=R.register}),t.events.on(Azi,R=>{a=R.registerServerSource});function l(R,B){let{enabled:F,diagnostics:Q}=mzi(R,B),P=$pe(TX(),"plugins","marketplaces"),D=$pe(B,"plugins","marketplaces"),M=tzi([P,D],F);for(let H of M.shadowedPlugins)Ov.debug(`plugin "${H.id}" from ${H.shadowedRoot} is shadowed by the higher-precedence root ${H.winnerRoot}`);return M.globalDiagnostics=[...Q,...M.globalDiagnostics],Vk=M.plugins,Cfn=M.globalDiagnostics,e=!0,M}function c(R,B){e||l(R,B)}function u(){let R=new Map,B=new Map;uut=[];let F=[...Vk.filter(Q=>Q.enabled)].sort((Q,P)=>Q.id.localeCompare(P.id));for(let Q of F){let{agents:P,diagnostics:D}=azi(Q);for(let M of D)Ov.warn(`[${Q.id}] ${M}`),uut.push({type:"warning",message:`[${Q.id}] ${M}`,path:Q.root});for(let[M,H]of P)d(Q.id,M,H,R,B)}o=R}function d(R,B,F,Q,P){let D=B.toLowerCase(),M=P.get(D);if(M){let H=M.name===B?`"${B}"`:`"${B}" (case-insensitive collision with "${M.name}")`;Ov.warn(`[${R}] plugin-contributed agent ${H} shadowed by earlier plugin ${M.pluginId}; ignoring`);return}izi.includes(D)&&Ov.warn(`[${R}] plugin-contributed agent "${B}" shadows the built-in default agent of the same name; the plugin's definition will be used for every Agent-tool invocation across this session`),Q.set(B,F),P.set(D,{pluginId:R,name:B})}function p(){if(!i)return;s?.(),s=i({getAgents:()=>o,getDiagnostics:()=>uut})}function A(){let R=[];dke=[];let B=[...Vk.filter(F=>F.enabled)].sort((F,Q)=>F.id.localeCompare(Q.id));for(let F of B){let{servers:Q,diagnostics:P}=pzi(F);for(let D of P)Ov.warn(`[${F.id}] ${D}`),dke.push({type:"warning",message:`[${F.id}] ${D}`,path:F.root});for(let D of Q)R.push(D)}yfn=R}function g(){if(!a)return;a({source:"plugin",getServers:()=>yfn,getDiagnostics:()=>dke})}function m(){if(n){for(let R of r.values())R();r.clear();for(let R of Vk){if(!R.enabled)continue;let B=kRl(R);r.set(R.id,n(B))}}}function f(){for(let R of r.values())R();r.clear()}function h(){let R=[],B=[];for(let F of Vk){if(!F.enabled){for(let Q of F.diagnostics)Ov.debug(`[${F.id}] ${Q}`);continue}F.commandsDir&&B.push(F.commandsDir),F.skillsDir&&R.push(F.skillsDir);for(let Q of F.diagnostics)Ov.warn(`[${F.id}] ${Q}`)}return{skillPaths:R,promptPaths:B}}t.on("resources_discover",R=>{e=!1;let B=l(R.cwd,R.agentDir),{skillPaths:F,promptPaths:Q}=h();for(let D of B.globalDiagnostics)Ov.warn(D);let P=Vk.filter(D=>D.enabled).length;return Vk.length>0&&Ov.info(`Discovered ${Vk.length} plugin(s); ${P} enabled`),m(),u(),p(),v(),A(),g(),_(),{skillPaths:F,promptPaths:Q}}),t.on("session_start",(R,B)=>{c(B.cwd,B.agentDir),m(),u(),p(),S(),A(),g();let F=$pe(TX(),"plugins","marketplaces"),Q=$pe(B.agentDir,"plugins","marketplaces");Z8i([F,Q]).then(P=>{P&&(e=!1,l(B.cwd,B.agentDir),m(),u(),p(),A(),g())}).catch(P=>{Ov.debug(`background plugin source fetch failed: ${P instanceof Error?P.message:String(P)}`)})}),t.on("session_shutdown",()=>{f(),s?.(),s=void 0,o=new Map});let E=!1,y=!1,C=!1;function S(){!n&&!E&&(E=!0,Ov.warn("@hermes/hooks did not register a hook listener; plugin hooks will not run. This usually means @hermes/hooks was removed from the built-in extension list."))}function v(){!i&&!y&&(y=!0,Ov.debug("@hermes/subagents did not register an agent source; plugin-contributed subagents will not be available (expected when --disable-subagents is set)."))}function _(){!a&&!C&&(C=!0,Ov.debug("@hermes/mcp did not register a server source; plugin-contributed MCP servers will not be loaded."))}}function kRl(t){return{source:t.id,isEnabled:()=>t.enabled,getConfig:()=>t.hooksConfig,env:NRl(t.root),postToolUsePrefix:`Plugin ${t.id} hook`,backgroundLabel:e=>`[${t.id}] ${e} hook`,blockedFallbackReason:"Blocked by plugin hook"}}function NRl(t){return{PLUGIN_ROOT:t,CLAUDE_PLUGIN_ROOT:t}}function z4(){return Vk}function pke(t){return $pe(t,"plugins","marketplaces")}function dut(t){let e=pke(t);if(!BRl(e))return[];let n;try{n=xRl(e)}catch{return[]}let r=[];for(let i of n){let s=$pe(e,i);try{if(!TRl(s).isDirectory())continue}catch{continue}let{manifest:o}=JK(s);if(!o)continue;let a=typeof o.name=="string"&&o.name.length>0?o.name:i;r.push({dir:i,name:a,path:s})}return r}function EM(){let t=[];for(let e of Vk)for(let n of e.diagnostics)t.push({type:"warning",message:`[${e.id}] ${n}`,path:e.root});for(let e of Cfn)t.push({type:"warning",message:e});for(let e of dke)t.push(e);return t}var Ov,Vk,Cfn,uut,yfn,dke,Kpe=b(()=>{"use strict";xu();k$();vr();lzi();lut();aut();out();gzi();fzi();Ezi();aut();Ov=on.child({prefix:"pi-plugins"}),Vk=[],Cfn=[],uut=[],yfn=[],dke=[]});import{existsSync as DRl}from"node:fs";import{homedir as Ake}from"node:os";import{dirname as Ifn,join as nB,resolve as yzi}from"node:path";import{fileURLToPath as QRl}from"node:url";function FRl(){let t=`${Sfn}\0${process.execPath||""}`.toLowerCase();return t.includes("/pnpm/")||t.includes("/.pnpm/")||t.includes("\\pnpm\\")?"pnpm":t.includes("/yarn/")||t.includes("/.yarn/")||t.includes("\\yarn\\")?"yarn":t.includes("/npm/")||t.includes("/node_modules/")||t.includes("\\npm\\")?"npm":"unknown"}function Czi(t,e){switch(FRl()){case"pnpm":return`Run: pnpm install -g ${t}`;case"yarn":return`Run: yarn global add ${t}`;case"npm":return`Run: npm install -g ${t}`;default:return`Run: npm install -g ${t}`}}function bzi(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?Ake():t.startsWith("~/")?Ake()+t.slice(1):t;let e=Sfn;for(;e!==Ifn(e);){if(DRl(nB(e,"package.json")))return e;e=Ifn(e)}return Sfn}function jpe(){return yzi(nB(bzi(),"docs"))}function put(){return yzi(nB(bzi(),"CHANGELOG.md"))}function vzi(t){return`${process.env.PI_SHARE_VIEWER_URL||PRl}#${t}`}function wzi(t){return t==="~"?Ake():t.startsWith("~/")?Ake()+t.slice(1):t}function mU(){let t=process.env.AUGMENT_CACHE_DIR;return t?wzi(t):nB(Ake(),".augment")}function Gi(){let t=process.env[fke];return t?wzi(t):mU()}function hke(){return nB(Gi(),"themes")}function Rzi(){return nB(Gi(),"models.json")}function _fn(){return nB(Gi(),"auth.json")}function Bzi(){return nB(Gi(),"settings.json")}function Aut(){return mU()}function qpe(){return nB(Gi(),"bin")}function xzi(){return nB(Gi(),"prompts")}function Tzi(){return nB(Gi(),gke)}function kzi(){return nB(Gi(),`${uo}-debug.log`)}var MRl,Sfn,uo,al,gke,mke,Izi,ORl,rm,Szi,_zi,fke,PRl,ku=b(()=>{"use strict";A$t();MRl=QRl(import.meta.url),Sfn=Ifn(MRl);uo=v3.piConfig?.name||"pi",al=v3.piConfig?.configDir||".augment",gke="sessions-v2",mke="auggie",Izi="Auggie Coding Agent",ORl="1.1.0-prerelease.202608120522",rm=ORl??v3.version,Szi="efda5a6e3bd00b13423c254fbfaa91194c152e50",_zi="2026-08-12T12:22:57Z",fke=`${uo.toUpperCase()}_CODING_AGENT_DIR`,PRl="https://pi.dev/session/"});var Dzi,Nzi=b(()=>{Dzi={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var Mzi,Qzi=b(()=>{Mzi={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as UI from"node:fs";import*as mut from"node:path";function VRl(){let t=process.env.COLORTERM;if(t==="truecolor"||t==="24bit"||process.env.WT_SESSION)return"truecolor";let e=process.env.TERM||"";return e==="dumb"||e===""||e==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||e==="screen"||e.startsWith("screen-")||e.startsWith("screen.")?"256color":"truecolor"}function Bfn(t){let e=t.replace("#","");if(e.length!==6)throw new Error(`Invalid hex color: ${t}`);let n=Number.parseInt(e.slice(0,2),16),r=Number.parseInt(e.slice(2,4),16),i=Number.parseInt(e.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${t}`);return{r:n,g:r,b:i}}function vfn(t){let e=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of gut.entries()){let s=Math.abs(t-i);s<e&&(e=s,n=r)}return n}function WRl(t){let e=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of Lzi.entries()){let s=Math.abs(t-i);s<e&&(e=s,n=r)}return n}function Ozi(t,e,n,r,i,s){let o=t-r,a=e-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function YRl(t,e,n){let r=vfn(t),i=vfn(e),s=vfn(n),o=gut[r]??0,a=gut[i]??0,l=gut[s]??0,c=16+36*r+6*i+s,u=Ozi(t,e,n,o,a,l),d=Math.round(.299*t+.587*e+.114*n),p=WRl(d),A=Lzi[p]??0,g=232+p,m=Ozi(t,e,n,A,A,A),f=Math.max(t,e,n),h=Math.min(t,e,n);return f-h<10&&m<u?g:c}function Uzi(t){let{r:e,g:n,b:r}=Bfn(t);return YRl(e,n,r)}function HRl(t,e){if(t==="")return"\x1B[39m";if(typeof t=="number")return`\x1B[38;5;${t}m`;if(t.startsWith("#")){if(e==="truecolor"){let{r,g:i,b:s}=Bfn(t);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${Uzi(t)}m`}throw new Error(`Invalid color value: ${t}`)}function zRl(t,e){if(t==="")return"\x1B[49m";if(typeof t=="number")return`\x1B[48;5;${t}m`;if(t.startsWith("#")){if(e==="truecolor"){let{r,g:i,b:s}=Bfn(t);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${Uzi(t)}m`}throw new Error(`Invalid color value: ${t}`)}function xfn(t,e,n=new Set){if(typeof t=="number"||t===""||t.startsWith("#"))return t;if(n.has(t))throw new Error(`Circular variable reference detected: ${t}`);if(!(t in e))throw new Error(`Variable reference not found: ${t}`);n.add(t);let r=e[t];if(r===void 0)throw new Error(`Variable reference not found: ${t}`);return xfn(r,e,n)}function Gzi(t,e={}){let n={};for(let[r,i]of Object.entries(t))n[r]=xfn(i,e);return n}function fut(){let t=new Set(Object.keys(Tfn)),e=hke();if(UI.existsSync(e)){let n=UI.readdirSync(e);for(let r of n)r.endsWith(".json")&&t.add(r.slice(0,-5))}for(let n of jK.keys())t.add(n);return Array.from(t).sort()}function Vzi(){let t=hke(),e=[];for(let n of Object.keys(Tfn))e.push({name:n,path:void 0});if(UI.existsSync(t)){for(let n of UI.readdirSync(t))if(n.endsWith(".json")){let r=n.slice(0,-5);e.some(i=>i.name===r)||e.push({name:r,path:mut.join(t,n)})}}for(let[n,r]of jK.entries())e.some(i=>i.name===n)||e.push({name:n,path:r.sourcePath});return e.sort((n,r)=>n.name.localeCompare(r.name))}function JRl(t,e){if(!Fzi.Check(e)){let n=Array.from(Fzi.Errors(e)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${t}":
|
|
6720
6720
|
`;throw r.length>0&&(s+=`
|
|
6721
6721
|
Missing required color tokens:
|
|
6722
6722
|
`,s+=r.map(o=>` - ${o}`).join(`
|
package/package.json
CHANGED