@nockdev/hsa 1.4.12 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hsa-cli.bundle.js +2 -2
- package/dist/hsa-http.bundle.js +2 -2
- package/dist/hsa-lib.bundle.js +19 -19
- package/dist/integrity.json +7 -7
- package/package.json +1 -1
package/dist/hsa-cli.bundle.js
CHANGED
|
@@ -34,7 +34,7 @@ var Lq=Object.create;var Pu=Object.defineProperty;var kq=Object.getOwnPropertyDe
|
|
|
34
34
|
depsCount: ${I},
|
|
35
35
|
deps: ${G}}`};var ibI={keyword:"dependencies",type:"object",schemaType:"object",error:rb.error,code(l){let[I,G]=QbI(l);Og(l,I),Mg(l,G)}};function QbI({schema:l}){let I={},G={};for(let c in l){if(c==="__proto__")continue;let b=Array.isArray(l[c])?I:G;b[c]=l[c]}return[I,G]}function Og(l,I=l.schema){let{gen:G,data:c,it:b}=l;if(Object.keys(I).length===0)return;let d=G.let("missing");for(let Z in I){let a=I[Z];if(a.length===0)continue;let e=(0,Wt.propertyInData)(G,c,Z,b.opts.ownProperties);l.setParams({property:Z,depsCount:a.length,deps:a.join(", ")}),b.allErrors?G.if(e,()=>{for(let m of a)(0,Wt.checkReportMissingProp)(l,m)}):(G.if((0,YX._)`${e} && (${(0,Wt.checkMissingProp)(l,a,d)})`),(0,Wt.reportMissingProp)(l,d),G.else())}}rb.validatePropertyDeps=Og;function Mg(l,I=l.schema){let{gen:G,data:c,keyword:b,it:d}=l,Z=G.name("valid");for(let a in I)(0,obI.alwaysValidSchema)(d,I[a])||(G.if((0,Wt.propertyInData)(G,c,a,d.opts.ownProperties),()=>{let e=l.subschema({keyword:b,schemaProp:a},Z);l.mergeValidEvaluated(e,Z)},()=>G.var(Z,!0)),l.ok(Z))}rb.validateSchemaDeps=Mg;rb.default=ibI});var Kg=R(sX=>{"use strict";Object.defineProperty(sX,"__esModule",{value:!0});var fg=QI(),HbI=fI(),rbI={message:"property name must be valid",params:({params:l})=>(0,fg._)`{propertyName: ${l.propertyName}}`},vbI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rbI,code(l){let{gen:I,schema:G,data:c,it:b}=l;if((0,HbI.alwaysValidSchema)(b,G))return;let d=I.name("valid");I.forIn("key",c,Z=>{l.setParams({propertyName:Z}),l.subschema({keyword:"propertyNames",data:Z,dataTypes:["string"],propertyName:Z,compositeRule:!0},d),I.if((0,fg.not)(d),()=>{l.error(!0),b.allErrors||I.break()})}),l.ok(d)}};sX.default=vbI});var VX=R(hX=>{"use strict";Object.defineProperty(hX,"__esModule",{value:!0});var Zs=vc(),$c=QI(),wbI=pd(),as=fI(),ybI={message:"must NOT have additional properties",params:({params:l})=>(0,$c._)`{additionalProperty: ${l.additionalProperty}}`},EbI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ybI,code(l){let{gen:I,schema:G,parentSchema:c,data:b,errsCount:d,it:Z}=l;if(!d)throw new Error("ajv implementation error");let{allErrors:a,opts:e}=Z;if(Z.props=!0,e.removeAdditional!=="all"&&(0,as.alwaysValidSchema)(Z,G))return;let m=(0,Zs.allSchemaProperties)(c.properties),W=(0,Zs.allSchemaProperties)(c.patternProperties);n(),l.ok((0,$c._)`${d} === ${wbI.default.errors}`);function n(){I.forIn("key",b,s=>{!m.length&&!W.length?p(s):I.if(t(s),()=>p(s))})}function t(s){let h;if(m.length>8){let V=(0,as.schemaRefOrVal)(Z,c.properties,"properties");h=(0,Zs.isOwnProperty)(I,V,s)}else m.length?h=(0,$c.or)(...m.map(V=>(0,$c._)`${s} === ${V}`)):h=$c.nil;return W.length&&(h=(0,$c.or)(h,...W.map(V=>(0,$c._)`${(0,Zs.usePattern)(l,V)}.test(${s})`))),(0,$c.not)(h)}function N(s){I.code((0,$c._)`delete ${b}[${s}]`)}function p(s){if(e.removeAdditional==="all"||e.removeAdditional&&G===!1){N(s);return}if(G===!1){l.setParams({additionalProperty:s}),l.error(),a||I.break();return}if(typeof G=="object"&&!(0,as.alwaysValidSchema)(Z,G)){let h=I.name("valid");e.removeAdditional==="failing"?(Y(s,h,!1),I.if((0,$c.not)(h),()=>{l.reset(),N(s)})):(Y(s,h),a||I.if((0,$c.not)(h),()=>I.break()))}}function Y(s,h,V){let u={keyword:"additionalProperties",dataProp:s,dataPropType:as.Type.Str};V===!1&&Object.assign(u,{compositeRule:!0,createErrors:!1,allErrors:!1}),l.subschema(u,h)}}};hX.default=EbI});var Dg=R(RX=>{"use strict";Object.defineProperty(RX,"__esModule",{value:!0});var JbI=qn(),Sg=vc(),uX=fI(),Tg=VX(),gbI={keyword:"properties",type:"object",schemaType:"object",code(l){let{gen:I,schema:G,parentSchema:c,data:b,it:d}=l;d.opts.removeAdditional==="all"&&c.additionalProperties===void 0&&Tg.default.code(new JbI.KeywordCxt(d,Tg.default,"additionalProperties"));let Z=(0,Sg.allSchemaProperties)(G);for(let n of Z)d.definedProperties.add(n);d.opts.unevaluated&&Z.length&&d.props!==!0&&(d.props=uX.mergeEvaluated.props(I,(0,uX.toHash)(Z),d.props));let a=Z.filter(n=>!(0,uX.alwaysValidSchema)(d,G[n]));if(a.length===0)return;let e=I.name("valid");for(let n of a)m(n)?W(n):(I.if((0,Sg.propertyInData)(I,b,n,d.opts.ownProperties)),W(n),d.allErrors||I.else().var(e,!0),I.endIf()),l.it.definedProperties.add(n),l.ok(e);function m(n){return d.opts.useDefaults&&!d.compositeRule&&G[n].default!==void 0}function W(n){l.subschema({keyword:"properties",schemaProp:n,dataProp:n},e)}}};RX.default=gbI});var $g=R(FX=>{"use strict";Object.defineProperty(FX,"__esModule",{value:!0});var qg=vc(),es=QI(),Pg=fI(),_g=fI(),CbI={keyword:"patternProperties",type:"object",schemaType:"object",code(l){let{gen:I,schema:G,data:c,parentSchema:b,it:d}=l,{opts:Z}=d,a=(0,qg.allSchemaProperties)(G),e=a.filter(Y=>(0,Pg.alwaysValidSchema)(d,G[Y]));if(a.length===0||e.length===a.length&&(!d.opts.unevaluated||d.props===!0))return;let m=Z.strictSchema&&!Z.allowMatchingProperties&&b.properties,W=I.name("valid");d.props!==!0&&!(d.props instanceof es.Name)&&(d.props=(0,_g.evaluatedPropsToName)(I,d.props));let{props:n}=d;t();function t(){for(let Y of a)m&&N(Y),d.allErrors?p(Y):(I.var(W,!0),p(Y),I.if(W))}function N(Y){for(let s in m)new RegExp(Y).test(s)&&(0,Pg.checkStrictMode)(d,`property ${s} matches pattern ${Y} (use allowMatchingProperties)`)}function p(Y){I.forIn("key",c,s=>{I.if((0,es._)`${(0,qg.usePattern)(l,Y)}.test(${s})`,()=>{let h=e.includes(Y);h||l.subschema({keyword:"patternProperties",schemaProp:Y,dataProp:s,dataPropType:_g.Type.Str},W),d.opts.unevaluated&&n!==!0?I.assign((0,es._)`${n}[${s}]`,!0):!h&&!d.allErrors&&I.if((0,es.not)(W),()=>I.break())})})}}};FX.default=CbI});var IC=R(XX=>{"use strict";Object.defineProperty(XX,"__esModule",{value:!0});var AbI=fI(),LbI={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(l){let{gen:I,schema:G,it:c}=l;if((0,AbI.alwaysValidSchema)(c,G)){l.fail();return}let b=I.name("valid");l.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},b),l.failResult(b,()=>l.reset(),()=>l.error())},error:{message:"must NOT be valid"}};XX.default=LbI});var lC=R(oX=>{"use strict";Object.defineProperty(oX,"__esModule",{value:!0});var kbI=vc(),zbI={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kbI.validateUnion,error:{message:"must match a schema in anyOf"}};oX.default=zbI});var GC=R(iX=>{"use strict";Object.defineProperty(iX,"__esModule",{value:!0});var ms=QI(),xbI=fI(),UbI={message:"must match exactly one schema in oneOf",params:({params:l})=>(0,ms._)`{passingSchemas: ${l.passing}}`},BbI={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:UbI,code(l){let{gen:I,schema:G,parentSchema:c,it:b}=l;if(!Array.isArray(G))throw new Error("ajv implementation error");if(b.opts.discriminator&&c.discriminator)return;let d=G,Z=I.let("valid",!1),a=I.let("passing",null),e=I.name("_valid");l.setParams({passing:a}),I.block(m),l.result(Z,()=>l.reset(),()=>l.error(!0));function m(){d.forEach((W,n)=>{let t;(0,xbI.alwaysValidSchema)(b,W)?I.var(e,!0):t=l.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},e),n>0&&I.if((0,ms._)`${e} && ${Z}`).assign(Z,!1).assign(a,(0,ms._)`[${a}, ${n}]`).else(),I.if(e,()=>{I.assign(Z,!0),I.assign(a,n),t&&l.mergeEvaluated(t,ms.Name)})})}}};iX.default=BbI});var cC=R(QX=>{"use strict";Object.defineProperty(QX,"__esModule",{value:!0});var ObI=fI(),MbI={keyword:"allOf",schemaType:"array",code(l){let{gen:I,schema:G,it:c}=l;if(!Array.isArray(G))throw new Error("ajv implementation error");let b=I.name("valid");G.forEach((d,Z)=>{if((0,ObI.alwaysValidSchema)(c,d))return;let a=l.subschema({keyword:"allOf",schemaProp:Z},b);l.ok(b),l.mergeEvaluated(a)})}};QX.default=MbI});var ZC=R(HX=>{"use strict";Object.defineProperty(HX,"__esModule",{value:!0});var Ws=QI(),dC=fI(),jbI={message:({params:l})=>(0,Ws.str)`must match "${l.ifClause}" schema`,params:({params:l})=>(0,Ws._)`{failingKeyword: ${l.ifClause}}`},fbI={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:jbI,code(l){let{gen:I,parentSchema:G,it:c}=l;G.then===void 0&&G.else===void 0&&(0,dC.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let b=bC(c,"then"),d=bC(c,"else");if(!b&&!d)return;let Z=I.let("valid",!0),a=I.name("_valid");if(e(),l.reset(),b&&d){let W=I.let("ifClause");l.setParams({ifClause:W}),I.if(a,m("then",W),m("else",W))}else b?I.if(a,m("then")):I.if((0,Ws.not)(a),m("else"));l.pass(Z,()=>l.error(!0));function e(){let W=l.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);l.mergeEvaluated(W)}function m(W,n){return()=>{let t=l.subschema({keyword:W},a);I.assign(Z,a),l.mergeValidEvaluated(t,Z),n?I.assign(n,(0,Ws._)`${W}`):l.setParams({ifClause:W})}}}};function bC(l,I){let G=l.schema[I];return G!==void 0&&!(0,dC.alwaysValidSchema)(l,G)}HX.default=fbI});var aC=R(rX=>{"use strict";Object.defineProperty(rX,"__esModule",{value:!0});var KbI=fI(),SbI={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:l,parentSchema:I,it:G}){I.if===void 0&&(0,KbI.checkStrictMode)(G,`"${l}" without "if" is ignored`)}};rX.default=SbI});var eC=R(vX=>{"use strict";Object.defineProperty(vX,"__esModule",{value:!0});var TbI=WX(),DbI=zg(),qbI=nX(),PbI=Ug(),_bI=Bg(),$bI=jg(),IdI=Kg(),ldI=VX(),GdI=Dg(),cdI=$g(),bdI=IC(),ddI=lC(),ZdI=GC(),adI=cC(),edI=ZC(),mdI=aC();function WdI(l=!1){let I=[bdI.default,ddI.default,ZdI.default,adI.default,edI.default,mdI.default,IdI.default,ldI.default,$bI.default,GdI.default,cdI.default];return l?I.push(DbI.default,PbI.default):I.push(TbI.default,qbI.default),I.push(_bI.default),I}vX.default=WdI});var mC=R(wX=>{"use strict";Object.defineProperty(wX,"__esModule",{value:!0});var Al=QI(),ndI={message:({schemaCode:l})=>(0,Al.str)`must match format "${l}"`,params:({schemaCode:l})=>(0,Al._)`{format: ${l}}`},tdI={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ndI,code(l,I){let{gen:G,data:c,$data:b,schema:d,schemaCode:Z,it:a}=l,{opts:e,errSchemaPath:m,schemaEnv:W,self:n}=a;if(!e.validateFormats)return;b?t():N();function t(){let p=G.scopeValue("formats",{ref:n.formats,code:e.code.formats}),Y=G.const("fDef",(0,Al._)`${p}[${Z}]`),s=G.let("fType"),h=G.let("format");G.if((0,Al._)`typeof ${Y} == "object" && !(${Y} instanceof RegExp)`,()=>G.assign(s,(0,Al._)`${Y}.type || "string"`).assign(h,(0,Al._)`${Y}.validate`),()=>G.assign(s,(0,Al._)`"string"`).assign(h,Y)),l.fail$data((0,Al.or)(V(),u()));function V(){return e.strictSchema===!1?Al.nil:(0,Al._)`${Z} && !${h}`}function u(){let X=W.$async?(0,Al._)`(${Y}.async ? await ${h}(${c}) : ${h}(${c}))`:(0,Al._)`${h}(${c})`,o=(0,Al._)`(typeof ${h} == "function" ? ${X} : ${h}.test(${c}))`;return(0,Al._)`${h} && ${h} !== true && ${s} === ${I} && !${o}`}}function N(){let p=n.formats[d];if(!p){V();return}if(p===!0)return;let[Y,s,h]=u(p);Y===I&&l.pass(X());function V(){if(e.strictSchema===!1){n.logger.warn(o());return}throw new Error(o());function o(){return`unknown format "${d}" ignored in schema at path "${m}"`}}function u(o){let w=o instanceof RegExp?(0,Al.regexpCode)(o):e.code.formats?(0,Al._)`${e.code.formats}${(0,Al.getProperty)(d)}`:void 0,g=G.scopeValue("formats",{key:d,ref:o,code:w});return typeof o=="object"&&!(o instanceof RegExp)?[o.type||"string",o.validate,(0,Al._)`${g}.validate`]:["string",o,g]}function X(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!W.$async)throw new Error("async format in sync schema");return(0,Al._)`await ${h}(${c})`}return typeof s=="function"?(0,Al._)`${h}(${c})`:(0,Al._)`${h}.test(${c})`}}}};wX.default=tdI});var WC=R(yX=>{"use strict";Object.defineProperty(yX,"__esModule",{value:!0});var NdI=mC(),pdI=[NdI.default];yX.default=pdI});var nC=R(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.contentVocabulary=Zm.metadataVocabulary=void 0;Zm.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Zm.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var NC=R(EX=>{"use strict";Object.defineProperty(EX,"__esModule",{value:!0});var YdI=Rg(),sdI=Cg(),hdI=eC(),VdI=WC(),tC=nC(),udI=[YdI.default,sdI.default,(0,hdI.default)(),VdI.default,tC.metadataVocabulary,tC.contentVocabulary];EX.default=udI});var YC=R(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.DiscrError=void 0;var pC;(function(l){l.Tag="tag",l.Mapping="mapping"})(pC||(ns.DiscrError=pC={}))});var hC=R(gX=>{"use strict";Object.defineProperty(gX,"__esModule",{value:!0});var am=QI(),JX=YC(),sC=KY(),RdI=Pn(),FdI=fI(),XdI={message:({params:{discrError:l,tagName:I}})=>l===JX.DiscrError.Tag?`tag "${I}" must be string`:`value of tag "${I}" must be in oneOf`,params:({params:{discrError:l,tag:I,tagName:G}})=>(0,am._)`{error: ${l}, tag: ${G}, tagValue: ${I}}`},odI={keyword:"discriminator",type:"object",schemaType:"object",error:XdI,code(l){let{gen:I,data:G,schema:c,parentSchema:b,it:d}=l,{oneOf:Z}=b;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=c.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!Z)throw new Error("discriminator: requires oneOf keyword");let e=I.let("valid",!1),m=I.const("tag",(0,am._)`${G}${(0,am.getProperty)(a)}`);I.if((0,am._)`typeof ${m} == "string"`,()=>W(),()=>l.error(!1,{discrError:JX.DiscrError.Tag,tag:m,tagName:a})),l.ok(e);function W(){let N=t();I.if(!1);for(let p in N)I.elseIf((0,am._)`${m} === ${p}`),I.assign(e,n(N[p]));I.else(),l.error(!1,{discrError:JX.DiscrError.Mapping,tag:m,tagName:a}),I.endIf()}function n(N){let p=I.name("valid"),Y=l.subschema({keyword:"oneOf",schemaProp:N},p);return l.mergeEvaluated(Y,am.Name),p}function t(){var N;let p={},Y=h(b),s=!0;for(let X=0;X<Z.length;X++){let o=Z[X];if(o?.$ref&&!(0,FdI.schemaHasRulesButRef)(o,d.self.RULES)){let g=o.$ref;if(o=sC.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,g),o instanceof sC.SchemaEnv&&(o=o.schema),o===void 0)throw new RdI.default(d.opts.uriResolver,d.baseId,g)}let w=(N=o?.properties)===null||N===void 0?void 0:N[a];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);s=s&&(Y||h(o)),V(w,X)}if(!s)throw new Error(`discriminator: "${a}" must be required`);return p;function h({required:X}){return Array.isArray(X)&&X.includes(a)}function V(X,o){if(X.const)u(X.const,o);else if(X.enum)for(let w of X.enum)u(w,o);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function u(X,o){if(typeof X!="string"||X in p)throw new Error(`discriminator: "${a}" values must be unique strings`);p[X]=o}}}};gX.default=odI});var VC=R((dCI,idI)=>{idI.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var AX=R((Rl,CX)=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.MissingRefError=Rl.ValidationError=Rl.CodeGen=Rl.Name=Rl.nil=Rl.stringify=Rl.str=Rl._=Rl.KeywordCxt=Rl.Ajv=void 0;var QdI=pg(),HdI=NC(),rdI=hC(),uC=VC(),vdI=["/properties"],ts="http://json-schema.org/draft-07/schema",em=class extends QdI.default{_addVocabularies(){super._addVocabularies(),HdI.default.forEach(I=>this.addVocabulary(I)),this.opts.discriminator&&this.addKeyword(rdI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(uC,vdI):uC;this.addMetaSchema(I,ts,!1),this.refs["http://json-schema.org/schema"]=ts}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ts)?ts:void 0)}};Rl.Ajv=em;CX.exports=Rl=em;CX.exports.Ajv=em;Object.defineProperty(Rl,"__esModule",{value:!0});Rl.default=em;var wdI=qn();Object.defineProperty(Rl,"KeywordCxt",{enumerable:!0,get:function(){return wdI.KeywordCxt}});var mm=QI();Object.defineProperty(Rl,"_",{enumerable:!0,get:function(){return mm._}});Object.defineProperty(Rl,"str",{enumerable:!0,get:function(){return mm.str}});Object.defineProperty(Rl,"stringify",{enumerable:!0,get:function(){return mm.stringify}});Object.defineProperty(Rl,"nil",{enumerable:!0,get:function(){return mm.nil}});Object.defineProperty(Rl,"Name",{enumerable:!0,get:function(){return mm.Name}});Object.defineProperty(Rl,"CodeGen",{enumerable:!0,get:function(){return mm.CodeGen}});var ydI=jY();Object.defineProperty(Rl,"ValidationError",{enumerable:!0,get:function(){return ydI.default}});var EdI=Pn();Object.defineProperty(Rl,"MissingRefError",{enumerable:!0,get:function(){return EdI.default}})});var rC=R(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});wb.formatNames=wb.fastFormats=wb.fullFormats=void 0;function vb(l,I){return{validate:l,compare:I}}wb.fullFormats={date:vb(oC,xX),time:vb(kX(!0),UX),"date-time":vb(RC(!0),QC),"iso-time":vb(kX(),iC),"iso-date-time":vb(RC(),HC),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:kdI,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:jdI,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:zdI,int32:{type:"number",validate:BdI},int64:{type:"number",validate:OdI},float:{type:"number",validate:XC},double:{type:"number",validate:XC},password:!0,binary:!0};wb.fastFormats={...wb.fullFormats,date:vb(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,xX),time:vb(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,UX),"date-time":vb(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,QC),"iso-time":vb(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,iC),"iso-date-time":vb(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,HC),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};wb.formatNames=Object.keys(wb.fullFormats);function JdI(l){return l%4===0&&(l%100!==0||l%400===0)}var gdI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,CdI=[0,31,28,31,30,31,30,31,31,30,31,30,31];function oC(l){let I=gdI.exec(l);if(!I)return!1;let G=+I[1],c=+I[2],b=+I[3];return c>=1&&c<=12&&b>=1&&b<=(c===2&&JdI(G)?29:CdI[c])}function xX(l,I){if(l&&I)return l>I?1:l<I?-1:0}var LX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function kX(l){return function(G){let c=LX.exec(G);if(!c)return!1;let b=+c[1],d=+c[2],Z=+c[3],a=c[4],e=c[5]==="-"?-1:1,m=+(c[6]||0),W=+(c[7]||0);if(m>23||W>59||l&&!a)return!1;if(b<=23&&d<=59&&Z<60)return!0;let n=d-W*e,t=b-m*e-(n<0?1:0);return(t===23||t===-1)&&(n===59||n===-1)&&Z<61}}function UX(l,I){if(!(l&&I))return;let G=new Date("2020-01-01T"+l).valueOf(),c=new Date("2020-01-01T"+I).valueOf();if(G&&c)return G-c}function iC(l,I){if(!(l&&I))return;let G=LX.exec(l),c=LX.exec(I);if(G&&c)return l=G[1]+G[2]+G[3],I=c[1]+c[2]+c[3],l>I?1:l<I?-1:0}var zX=/t|\s/i;function RC(l){let I=kX(l);return function(c){let b=c.split(zX);return b.length===2&&oC(b[0])&&I(b[1])}}function QC(l,I){if(!(l&&I))return;let G=new Date(l).valueOf(),c=new Date(I).valueOf();if(G&&c)return G-c}function HC(l,I){if(!(l&&I))return;let[G,c]=l.split(zX),[b,d]=I.split(zX),Z=xX(G,b);if(Z!==void 0)return Z||UX(c,d)}var AdI=/\/|:/,LdI=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function kdI(l){return AdI.test(l)&&LdI.test(l)}var FC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zdI(l){return FC.lastIndex=0,FC.test(l)}var xdI=-(2**31),UdI=2**31-1;function BdI(l){return Number.isInteger(l)&&l<=UdI&&l>=xdI}function OdI(l){return Number.isInteger(l)}function XC(){return!0}var MdI=/[^\\]\\Z/;function jdI(l){if(MdI.test(l))return!1;try{return new RegExp(l),!0}catch{return!1}}});var vC=R(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});Wm.formatLimitDefinition=void 0;var fdI=AX(),Ib=QI(),bZ=Ib.operators,Ns={formatMaximum:{okStr:"<=",ok:bZ.LTE,fail:bZ.GT},formatMinimum:{okStr:">=",ok:bZ.GTE,fail:bZ.LT},formatExclusiveMaximum:{okStr:"<",ok:bZ.LT,fail:bZ.GTE},formatExclusiveMinimum:{okStr:">",ok:bZ.GT,fail:bZ.LTE}},KdI={message:({keyword:l,schemaCode:I})=>(0,Ib.str)`should be ${Ns[l].okStr} ${I}`,params:({keyword:l,schemaCode:I})=>(0,Ib._)`{comparison: ${Ns[l].okStr}, limit: ${I}}`};Wm.formatLimitDefinition={keyword:Object.keys(Ns),type:"string",schemaType:"string",$data:!0,error:KdI,code(l){let{gen:I,data:G,schemaCode:c,keyword:b,it:d}=l,{opts:Z,self:a}=d;if(!Z.validateFormats)return;let e=new fdI.KeywordCxt(d,a.RULES.all.format.definition,"format");e.$data?m():W();function m(){let t=I.scopeValue("formats",{ref:a.formats,code:Z.code.formats}),N=I.const("fmt",(0,Ib._)`${t}[${e.schemaCode}]`);l.fail$data((0,Ib.or)((0,Ib._)`typeof ${N} != "object"`,(0,Ib._)`${N} instanceof RegExp`,(0,Ib._)`typeof ${N}.compare != "function"`,n(N)))}function W(){let t=e.schema,N=a.formats[t];if(!N||N===!0)return;if(typeof N!="object"||N instanceof RegExp||typeof N.compare!="function")throw new Error(`"${b}": format "${t}" does not define "compare" function`);let p=I.scopeValue("formats",{key:t,ref:N,code:Z.code.formats?(0,Ib._)`${Z.code.formats}${(0,Ib.getProperty)(t)}`:void 0});l.fail$data(n(p))}function n(t){return(0,Ib._)`${t}.compare(${G}, ${c}) ${Ns[b].fail} 0`}},dependencies:["format"]};var SdI=l=>(l.addKeyword(Wm.formatLimitDefinition),l);Wm.default=SdI});var JC=R((nt,EC)=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});var nm=rC(),TdI=vC(),BX=QI(),wC=new BX.Name("fullFormats"),DdI=new BX.Name("fastFormats"),OX=(l,I={keywords:!0})=>{if(Array.isArray(I))return yC(l,I,nm.fullFormats,wC),l;let[G,c]=I.mode==="fast"?[nm.fastFormats,DdI]:[nm.fullFormats,wC],b=I.formats||nm.formatNames;return yC(l,b,G,c),I.keywords&&(0,TdI.default)(l),l};OX.get=(l,I="full")=>{let c=(I==="fast"?nm.fastFormats:nm.fullFormats)[l];if(!c)throw new Error(`Unknown format "${l}"`);return c};function yC(l,I,G,c){var b,d;(b=(d=l.opts.code).formats)!==null&&b!==void 0||(d.formats=(0,BX._)`require("ajv-formats/dist/formats").${c}`);for(let Z of I)l.addFormat(Z,G[Z])}EC.exports=nt=OX;Object.defineProperty(nt,"__esModule",{value:!0});nt.default=OX});function qdI(){let l=new gC.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,CC.default)(l),l}var gC,CC,ps,AC=F(()=>{gC=Vc(AX(),1),CC=Vc(JC(),1);ps=class{constructor(I){this._ajv=I??qdI()}getValidator(I){let G="$id"in I&&typeof I.$id=="string"?this._ajv.getSchema(I.$id)??this._ajv.compile(I):this._ajv.compile(I);return c=>G(c)?{valid:!0,data:c,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(G.errors)}}}});var Ys,LC=F(()=>{Ys=class{constructor(I){this._server=I}requestStream(I,G,c){return this._server.requestStream(I,G,c)}async getTask(I,G){return this._server.getTask({taskId:I},G)}async getTaskResult(I,G,c){return this._server.getTaskResult({taskId:I},G,c)}async listTasks(I,G){return this._server.listTasks(I?{cursor:I}:void 0,G)}async cancelTask(I,G){return this._server.cancelTask({taskId:I},G)}}});function kC(l,I,G){if(!l)throw new Error(`${G} does not support task creation (required for ${I})`);switch(I){case"tools/call":if(!l.tools?.call)throw new Error(`${G} does not support task creation for tools/call (required for ${I})`);break;default:break}}function zC(l,I,G){if(!l)throw new Error(`${G} does not support task creation (required for ${I})`);switch(I){case"sampling/createMessage":if(!l.sampling?.createMessage)throw new Error(`${G} does not support task creation for sampling/createMessage (required for ${I})`);break;case"elicitation/create":if(!l.elicitation?.create)throw new Error(`${G} does not support task creation for elicitation/create (required for ${I})`);break;default:break}}var xC=F(()=>{});var tm,MX=F(()=>{SJ();De();AC();aY();LC();xC();tm=class extends EY{constructor(I,G){super(G),this._serverInfo=I,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(An.options.map((c,b)=>[c,b])),this.isMessageIgnored=(c,b)=>{let d=this._loggingLevels.get(b);return d?this.LOG_LEVEL_SEVERITY.get(c)<this.LOG_LEVEL_SEVERITY.get(d):!1},this._capabilities=G?.capabilities??{},this._instructions=G?.instructions,this._jsonSchemaValidator=G?.jsonSchemaValidator??new ps,this.setRequestHandler(mR,c=>this._oninitialize(c)),this.setNotificationHandler(WR,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(hR,async(c,b)=>{let d=b.sessionId||b.requestInfo?.headers["mcp-session-id"]||void 0,{level:Z}=c.params,a=An.safeParse(Z);return a.success&&this._loggingLevels.set(d,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Ys(this)}),this._experimental}registerCapabilities(I){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=KJ(this._capabilities,I)}setRequestHandler(I,G){let b=ZY(I)?.method;if(!b)throw new Error("Schema is missing a method literal");let d;if(fe(b)){let a=b;d=a._zod?.def?.value??a.value}else{let a=b;d=a._def?.value??a.value}if(typeof d!="string")throw new Error("Schema method literal must be a string");if(d==="tools/call"){let a=async(e,m)=>{let W=Sd(oa,e);if(!W.success){let p=W.error instanceof Error?W.error.message:String(W.error);throw new XI(CI.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:n}=W.data,t=await Promise.resolve(G(e,m));if(n.task){let p=Sd(Se,t);if(!p.success){let Y=p.error instanceof Error?p.error.message:String(p.error);throw new XI(CI.InvalidParams,`Invalid task creation result: ${Y}`)}return p.data}let N=Sd(oY,t);if(!N.success){let p=N.error instanceof Error?N.error.message:String(N.error);throw new XI(CI.InvalidParams,`Invalid tools/call result: ${p}`)}return N.data};return super.setRequestHandler(I,a)}return super.setRequestHandler(I,G)}assertCapabilityForMethod(I){switch(I){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${I})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${I})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${I})`);break;case"ping":break}}assertNotificationCapability(I){switch(I){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${I})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${I})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${I})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${I})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${I})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(I){if(this._capabilities)switch(I){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${I})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${I})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${I})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${I})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${I})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${I})`);break;case"ping":case"initialize":break}}assertTaskCapability(I){zC(this._clientCapabilities?.tasks?.requests,I,"Client")}assertTaskHandlerCapability(I){this._capabilities&&kC(this._capabilities.tasks?.requests,I,"Server")}async _oninitialize(I){let G=I.params.protocolVersion;return this._clientCapabilities=I.params.capabilities,this._clientVersion=I.params.clientInfo,{protocolVersion:QJ.includes(G)?G:bR,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},NY)}async createMessage(I,G){if((I.tools||I.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(I.messages.length>0){let c=I.messages[I.messages.length-1],b=Array.isArray(c.content)?c.content:[c.content],d=b.some(m=>m.type==="tool_result"),Z=I.messages.length>1?I.messages[I.messages.length-2]:void 0,a=Z?Array.isArray(Z.content)?Z.content:[Z.content]:[],e=a.some(m=>m.type==="tool_use");if(d){if(b.some(m=>m.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!e)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(e){let m=new Set(a.filter(n=>n.type==="tool_use").map(n=>n.id)),W=new Set(b.filter(n=>n.type==="tool_result").map(n=>n.toolUseId));if(m.size!==W.size||![...m].every(n=>W.has(n)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return I.tools?this.request({method:"sampling/createMessage",params:I},uR,G):this.request({method:"sampling/createMessage",params:I},VR,G)}async elicitInput(I,G){switch(I.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let b=I;return this.request({method:"elicitation/create",params:b},iY,G)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let b=I.mode==="form"?I:{...I,mode:"form"},d=await this.request({method:"elicitation/create",params:b},iY,G);if(d.action==="accept"&&d.content&&b.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(b.requestedSchema)(d.content);if(!a.valid)throw new XI(CI.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(Z){throw Z instanceof XI?Z:new XI(CI.InternalError,`Error validating elicitation response: ${Z instanceof Error?Z.message:String(Z)}`)}return d}}}createElicitationCompletionNotifier(I,G){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:I}},G)}async listRoots(I,G){return this.request({method:"roots/list",params:I},RR,G)}async sendLoggingMessage(I,G){if(this._capabilities.logging&&!this.isMessageIgnored(I.level,G))return this.notification({method:"notifications/message",params:I})}async sendResourceUpdated(I){return this.notification({method:"notifications/resources/updated",params:I})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function PdI(l){return gJ.parse(JSON.parse(l))}function UC(l){return JSON.stringify(l)+`
|
|
36
36
|
`}var ss,BC=F(()=>{De();ss=class{append(I){this._buffer=this._buffer?Buffer.concat([this._buffer,I]):I}readMessage(){if(!this._buffer)return null;let I=this._buffer.indexOf(`
|
|
37
|
-
`);if(I===-1)return null;let G=this._buffer.toString("utf8",0,I).replace(/\r$/,"");return this._buffer=this._buffer.subarray(I+1),PdI(G)}clear(){this._buffer=void 0}}});import OC from"node:process";var Nm,jX=F(()=>{BC();Nm=class{constructor(I=OC.stdin,G=OC.stdout){this._stdin=I,this._stdout=G,this._readBuffer=new ss,this._started=!1,this._ondata=c=>{this._readBuffer.append(c),this.processReadBuffer()},this._onerror=c=>{this.onerror?.(c)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let I=this._readBuffer.readMessage();if(I===null)break;this.onmessage?.(I)}catch(I){this.onerror?.(I)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(I){return new Promise(G=>{let c=UC(I);this._stdout.write(c)?G():this._stdout.once("drain",G)})}}});var ec,hs,tt,Nt,MC,jC,fC,KC,SC,TC,DC,qC,PC,_C,fX,KX,$C,I3,l3,_G,dZ,al,G3,rl=F(()=>{"use strict";ec={DEFAULT:8e3,MAX:128e3,MIN:100,PROFILES:{MVP:2e3,PRODUCTION:8e3,ENTERPRISE:16e3},TOOLS:{REPO_MAP:2e3,REPO_MAP_MAX:16e3,HANDOFF:1500,HANDOFF_MAX:5e3,HANDOFF_MIN:500}},hs=ec.DEFAULT,tt=ec.MAX,Nt=ec.MIN,MC=256,jC=300*1e3,fC=50*1024*1024,KC=1.5,SC=.75,TC=.1,DC=50,qC=10*1024*1024,PC="merkle.json",_C={system:.05,skills:.05,context:.65,stack:.05,changes:.1,prefetch:.05,reserve:.05},fX=.3,KX=20,$C=25,I3=2e5,l3=3600,_G=13100,dZ="domyh-hsa",al="1.4.
|
|
37
|
+
`);if(I===-1)return null;let G=this._buffer.toString("utf8",0,I).replace(/\r$/,"");return this._buffer=this._buffer.subarray(I+1),PdI(G)}clear(){this._buffer=void 0}}});import OC from"node:process";var Nm,jX=F(()=>{BC();Nm=class{constructor(I=OC.stdin,G=OC.stdout){this._stdin=I,this._stdout=G,this._readBuffer=new ss,this._started=!1,this._ondata=c=>{this._readBuffer.append(c),this.processReadBuffer()},this._onerror=c=>{this.onerror?.(c)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let I=this._readBuffer.readMessage();if(I===null)break;this.onmessage?.(I)}catch(I){this.onerror?.(I)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(I){return new Promise(G=>{let c=UC(I);this._stdout.write(c)?G():this._stdout.once("drain",G)})}}});var ec,hs,tt,Nt,MC,jC,fC,KC,SC,TC,DC,qC,PC,_C,fX,KX,$C,I3,l3,_G,dZ,al,G3,rl=F(()=>{"use strict";ec={DEFAULT:8e3,MAX:128e3,MIN:100,PROFILES:{MVP:2e3,PRODUCTION:8e3,ENTERPRISE:16e3},TOOLS:{REPO_MAP:2e3,REPO_MAP_MAX:16e3,HANDOFF:1500,HANDOFF_MAX:5e3,HANDOFF_MIN:500}},hs=ec.DEFAULT,tt=ec.MAX,Nt=ec.MIN,MC=256,jC=300*1e3,fC=50*1024*1024,KC=1.5,SC=.75,TC=.1,DC=50,qC=10*1024*1024,PC="merkle.json",_C={system:.05,skills:.05,context:.65,stack:.05,changes:.1,prefetch:.05,reserve:.05},fX=.3,KX=20,$C=25,I3=2e5,l3=3600,_G=13100,dZ="domyh-hsa",al="1.4.13",G3=".agent/hsa"});function d3(l){b3=l}function A(l){function I(c){return c3[c]>=c3[b3]}function G(c,b,d){let a=`[${new Date().toISOString()}] [${c.toUpperCase()}] [${l}]`;return d&&Object.keys(d).length>0?`${a} ${b} ${JSON.stringify(d)}`:`${a} ${b}`}return{debug(c,b){I("debug")&&console.error(G("debug",c,b))},info(c,b){I("info")&&console.error(G("info",c,b))},warn(c,b){I("warn")&&console.error(G("warn",c,b))},error(c,b,d){if(I("error")){let Z={...d,...b instanceof Error?{error:b.message,stack:b.stack}:{error:String(b)}};console.error(G("error",c,Z))}},child(c){return A(`${l}:${c}`)}}}var c3,b3,_=F(()=>{"use strict";c3={debug:0,info:1,warn:2,error:3},b3="info"});var pm=F(()=>{c0();c0()});var a3={};ll(a3,{envSchema:()=>TX,getEnvConfig:()=>OI,resetEnvCache:()=>_dI,validateEnv:()=>Z3});function Z3(l=!1){try{let I=TX.parse(process.env);return SX.info("Environment variables validated successfully"),I}catch(I){if(I instanceof L.ZodError){let G=I.errors.map(c=>`${c.path.join(".")}: ${c.message}`).join(`
|
|
38
38
|
`);if(l)throw SX.error("Environment validation failed (strict mode)",{errors:G}),new Error(`Environment validation failed:
|
|
39
39
|
${G}`);return SX.warn("Environment validation failed, using defaults",{errors:G}),TX.parse({})}throw I}}function OI(l=!1){return Vs===null&&(Vs=Z3(l)),Vs}function _dI(){Vs=null}var SX,TX,Vs,AG=F(()=>{"use strict";pm();_();SX=A("config:env"),TX=L.object({AUTH_REQUIRED:L.enum(["true","false"]).transform(l=>l==="true").default("false"),AUTH_SECRET:L.string().min(32,"AUTH_SECRET must be at least 32 characters").optional(),AUTH_ISSUER:L.string().min(1).optional().default("nock-hsa"),AUTH_AUDIENCE:L.string().min(1).optional().default("hsa-mcp"),AUTH_JWKS_URL:L.string().url("AUTH_JWKS_URL must be a valid URL").optional(),API_KEYS:L.string().optional().transform(l=>l?l.split(",").map(I=>I.trim()).filter(Boolean):[]).default(""),API_KEY_SCOPES:L.string().default("read").transform(l=>l.split(",").map(I=>I.trim()).filter(Boolean)).pipe(L.array(L.enum(["read","write","admin"])).min(1,"At least one scope required")),HSA_DAEMON_PORT:L.coerce.number().int("Port must be an integer").min(1,"Port must be >= 1").max(65535,"Port must be <= 65535").optional(),PORT:L.coerce.number().int("Port must be an integer").min(1,"Port must be >= 1").max(65535,"Port must be <= 65535").optional(),HSA_DAEMON_MODE:L.enum(["true","false"]).transform(l=>l==="true").default("false"),HSA_NO_PROXY:L.enum(["true","false"]).transform(l=>l==="true").default("false"),HSA_DASHBOARD:L.enum(["true","false"]).transform(l=>l==="true").default("false"),HSA_DASHBOARD_PORT:L.coerce.number().int("Port must be an integer").min(1,"Port must be >= 1").max(65535,"Port must be <= 65535").optional(),ALLOWED_ORIGINS:L.string().optional().transform(l=>l?l.split(",").map(I=>I.trim()).filter(Boolean):[]),HSA_MAX_TOKENS:L.coerce.number().int("Token budget must be an integer").min(100,"Token budget must be >= 100").max(128e3,"Token budget must be <= 128000").optional(),HSA_ENCODING:L.enum(["cl100k_base","p50k_base","r50k_base"]).default("cl100k_base"),HSA_MAX_ENGINES:L.coerce.number().int("Max engines must be an integer").min(1,"Max engines must be >= 1").max(5,"Max engines must be <= 5").optional(),HSA_ENGINE_IDLE_MS:L.coerce.number().int("Idle timeout must be an integer").min(1e3,"Idle timeout must be >= 1000ms").optional(),HSA_IDLE_TIMEOUT_MS:L.coerce.number().int("Idle timeout must be an integer").min(1e3,"Idle timeout must be >= 1000ms").optional(),HSA_STRICT_INTEGRITY:L.enum(["true","false"]).transform(l=>l==="true").default("false"),HSA_PROJECT_PATH:L.string().min(1).optional(),HSA_RUN_DIR:L.string().min(1).optional(),HSA_AUTH_TOKEN:L.string().min(16,"HSA_AUTH_TOKEN must be >= 16 chars").optional(),HSA_SHUTDOWN_NONCE:L.string().optional(),HSA_IDE_NAME:L.string().optional(),HSA_IDE_VERSION:L.string().optional(),HSA_WINDOW_ID:L.string().optional()});Vs=null});import e3 from"node:path";import{mkdir as $dI}from"node:fs/promises";import{existsSync as IZI}from"node:fs";async function m3(l,I="pure-ts"){let G=e3.join(l,G3);try{await $dI(G,{recursive:!0}),DX.info("Ensured HSA index directory",{indexDir:G})}catch(Z){DX.warn("Could not create index directory",{indexDir:G,error:String(Z)})}let c=OI(),b=c.HSA_MAX_TOKENS??hs,d={projectPath:l,indexDir:G,maxTokens:b,engineTier:I,encoding:c.HSA_ENCODING};return DX.info("Configuration built",{projectPath:d.projectPath,indexDir:d.indexDir,maxTokens:d.maxTokens,engineTier:d.engineTier}),d}function W3(l){let I=[],G=[];return l.projectPath||I.push("projectPath is required"),e3.isAbsolute(l.projectPath)||I.push("projectPath must be an absolute path"),l.maxTokens<Nt&&G.push(`maxTokens (${l.maxTokens}) is very low, minimum is ${Nt}`),l.maxTokens>tt&&G.push(`maxTokens (${l.maxTokens}) exceeds recommended maximum of ${tt}`),IZI(l.projectPath)||G.push(`projectPath does not exist: ${l.projectPath}`),{valid:I.length===0,errors:I,warnings:G}}var DX,n3=F(()=>{"use strict";rl();AG();_();DX=A("config")});import lG from"node:path";import t3 from"node:os";import{existsSync as Ca,statSync as lZI,readFileSync as GZI,readdirSync as cZI}from"node:fs";function bZI(){let l=process.env.HSA_RUN_DIR||lG.join(process.env.HOME||process.env.USERPROFILE||t3.homedir(),".hsa");return lG.join(l,"workspace")}function sm(){let I=OI().HSA_PROJECT_PATH;if(I&&!I.includes("${")){let Z=lG.resolve(I);if(ZZ(Z))mc.warn("HSA_PROJECT_PATH points to dangerous dir, ignoring",{path:Z});else return mc.info("Using HSA_PROJECT_PATH env var",{path:Z}),Ym(Z)}else I?.includes("${")&&mc.warn("HSA_PROJECT_PATH contains unresolved variable, falling through",{raw:I});let G=process.argv.indexOf("--project-path");if(G!==-1&&process.argv[G+1]){let Z=lG.resolve(process.argv[G+1]);if(ZZ(Z))mc.warn("--project-path points to dangerous dir, ignoring",{path:Z});else return mc.info("Using --project-path CLI argument",{path:Z}),Ym(Z)}let c=dZI();if(c)return mc.info("Using cached project root from .domyh/",{path:c}),Ym(c);let b=process.cwd(),d=ZZI(b);if(d!==b&&!ZZ(d))return mc.info("Found workspace root via upward traversal",{path:d,cwd:b}),Ym(d);if(ZZ(b)){let Z=bZI();return mc.warn("cwd is a dangerous root \u2014 falling back to safe workspace",{cwd:b,fallback:Z,reason:"Scanning home/system/IDE dirs causes JavaScript heap OOM"}),Ym(Z)}return mc.info("Using cwd as project path",{path:b}),Ym(b)}function dZI(){try{let l=[process.cwd()],I=process.cwd(),G=lG.parse(I).root,c=0;for(;I!==G&&c<10&&!ZZ(I);){if(Ca(lG.join(I,".domyh"))){I!==process.cwd()&&l.unshift(I);break}I=lG.dirname(I),c++}for(let b of l){let d=lG.join(b,".domyh","mcp-context.json");if(!Ca(d))continue;let Z=GZI(d,"utf-8"),a=JSON.parse(Z);if(a?.version!==1||!a?.project?.root)continue;let e=lG.resolve(a.project.root);if(Ca(e)){if(ZZ(e)){mc.warn("Cached project root is dangerous \u2014 ignoring",{cached:e,cacheFile:d});continue}return e}}return null}catch{return null}}function ZZI(l){let I=[".git","rush.json","nx.json","turbo.json","lerna.json","pnpm-workspace.yaml",".domyh","deno.json","Cargo.toml"],G=l,c=lG.parse(G).root,b=0,d=10;for(;G!==c&&b<d&&!ZZ(G);){for(let Z of I)if(Ca(lG.join(G,Z)))return G;try{if(cZI(G).some(a=>a.endsWith(".sln")||a.endsWith(".slnx")||a.endsWith(".code-workspace")))return G}catch(Z){if(Z.code!=="EACCES")break}G=lG.dirname(G),b++}return l}function Ym(l){if(!Ca(l))return mc.warn("Project path does not exist, using anyway",{path:l}),l;try{if(!lZI(l).isDirectory())return mc.warn("Project path is not a directory, using parent",{path:l}),lG.dirname(l)}catch{}return aZI(l)||mc.warn("No project markers found in resolved root \u2014 may be wrong directory",{path:l,hint:"Expected .git, package.json, Cargo.toml, go.mod, etc."}),l}function ZZ(l){let I=lG.resolve(l),G=I.toLowerCase().replace(/\\/g,"/");if(I===lG.parse(I).root)return!0;let c=t3.homedir();return!!(I===lG.resolve(c)||["windows/system32","windows/syswow64","program files","program files (x86)","programdata","appdata/local","appdata/roaming","appdata/locallow","anthropicclaude","claude-desktop","programs/antigravity","programs/cursor","programs/windsurf","programs/microsoft vs code","programs/zed",".vscode-server/","/applications/","/library/","/system/","/usr/","/var/","/etc/","/tmp/"].some(Z=>G.includes(Z))||["resources.pak","icudtl.dat","chrome_100_percent.pak","vk_swiftshader_icd.json"].some(Z=>Ca(lG.join(l,Z))))}function aZI(l){let I=[".git","package.json","Cargo.toml","go.mod","pyproject.toml","setup.py","requirements.txt","pom.xml","build.gradle","build.gradle.kts","CMakeLists.txt","Makefile",".agent","composer.json","Gemfile","mix.exs","stack.yaml","deno.json","bun.lockb"];try{return I.some(G=>Ca(lG.join(l,G)))}catch{return!1}}var mc,qX,pt=F(()=>{"use strict";_();AG();mc=A("config:resolver");qX=ZZ});var p3=R((OCI,N3)=>{var aZ=$("constants"),eZI=process.cwd,us=null,mZI=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return us||(us=eZI.call(process)),us};try{process.cwd()}catch{}typeof process.chdir=="function"&&(PX=process.chdir,process.chdir=function(l){us=null,PX.call(process,l)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,PX));var PX;N3.exports=WZI;function WZI(l){aZ.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&I(l),l.lutimes||G(l),l.chown=d(l.chown),l.fchown=d(l.fchown),l.lchown=d(l.lchown),l.chmod=c(l.chmod),l.fchmod=c(l.fchmod),l.lchmod=c(l.lchmod),l.chownSync=Z(l.chownSync),l.fchownSync=Z(l.fchownSync),l.lchownSync=Z(l.lchownSync),l.chmodSync=b(l.chmodSync),l.fchmodSync=b(l.fchmodSync),l.lchmodSync=b(l.lchmodSync),l.stat=a(l.stat),l.fstat=a(l.fstat),l.lstat=a(l.lstat),l.statSync=e(l.statSync),l.fstatSync=e(l.fstatSync),l.lstatSync=e(l.lstatSync),l.chmod&&!l.lchmod&&(l.lchmod=function(W,n,t){t&&process.nextTick(t)},l.lchmodSync=function(){}),l.chown&&!l.lchown&&(l.lchown=function(W,n,t,N){N&&process.nextTick(N)},l.lchownSync=function(){}),mZI==="win32"&&(l.rename=typeof l.rename!="function"?l.rename:(function(W){function n(t,N,p){var Y=Date.now(),s=0;W(t,N,function h(V){if(V&&(V.code==="EACCES"||V.code==="EPERM"||V.code==="EBUSY")&&Date.now()-Y<6e4){setTimeout(function(){l.stat(N,function(u,X){u&&u.code==="ENOENT"?W(t,N,h):p(V)})},s),s<100&&(s+=10);return}p&&p(V)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,W),n})(l.rename)),l.read=typeof l.read!="function"?l.read:(function(W){function n(t,N,p,Y,s,h){var V;if(h&&typeof h=="function"){var u=0;V=function(X,o,w){if(X&&X.code==="EAGAIN"&&u<10)return u++,W.call(l,t,N,p,Y,s,V);h.apply(this,arguments)}}return W.call(l,t,N,p,Y,s,V)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,W),n})(l.read),l.readSync=typeof l.readSync!="function"?l.readSync:(function(W){return function(n,t,N,p,Y){for(var s=0;;)try{return W.call(l,n,t,N,p,Y)}catch(h){if(h.code==="EAGAIN"&&s<10){s++;continue}throw h}}})(l.readSync);function I(W){W.lchmod=function(n,t,N){W.open(n,aZ.O_WRONLY|aZ.O_SYMLINK,t,function(p,Y){if(p){N&&N(p);return}W.fchmod(Y,t,function(s){W.close(Y,function(h){N&&N(s||h)})})})},W.lchmodSync=function(n,t){var N=W.openSync(n,aZ.O_WRONLY|aZ.O_SYMLINK,t),p=!0,Y;try{Y=W.fchmodSync(N,t),p=!1}finally{if(p)try{W.closeSync(N)}catch{}else W.closeSync(N)}return Y}}function G(W){aZ.hasOwnProperty("O_SYMLINK")&&W.futimes?(W.lutimes=function(n,t,N,p){W.open(n,aZ.O_SYMLINK,function(Y,s){if(Y){p&&p(Y);return}W.futimes(s,t,N,function(h){W.close(s,function(V){p&&p(h||V)})})})},W.lutimesSync=function(n,t,N){var p=W.openSync(n,aZ.O_SYMLINK),Y,s=!0;try{Y=W.futimesSync(p,t,N),s=!1}finally{if(s)try{W.closeSync(p)}catch{}else W.closeSync(p)}return Y}):W.futimes&&(W.lutimes=function(n,t,N,p){p&&process.nextTick(p)},W.lutimesSync=function(){})}function c(W){return W&&function(n,t,N){return W.call(l,n,t,function(p){m(p)&&(p=null),N&&N.apply(this,arguments)})}}function b(W){return W&&function(n,t){try{return W.call(l,n,t)}catch(N){if(!m(N))throw N}}}function d(W){return W&&function(n,t,N,p){return W.call(l,n,t,N,function(Y){m(Y)&&(Y=null),p&&p.apply(this,arguments)})}}function Z(W){return W&&function(n,t,N){try{return W.call(l,n,t,N)}catch(p){if(!m(p))throw p}}}function a(W){return W&&function(n,t,N){typeof t=="function"&&(N=t,t=null);function p(Y,s){s&&(s.uid<0&&(s.uid+=4294967296),s.gid<0&&(s.gid+=4294967296)),N&&N.apply(this,arguments)}return t?W.call(l,n,t,p):W.call(l,n,p)}}function e(W){return W&&function(n,t){var N=t?W.call(l,n,t):W.call(l,n);return N&&(N.uid<0&&(N.uid+=4294967296),N.gid<0&&(N.gid+=4294967296)),N}}function m(W){if(!W||W.code==="ENOSYS")return!0;var n=!process.getuid||process.getuid()!==0;return!!(n&&(W.code==="EINVAL"||W.code==="EPERM"))}}});var h3=R((MCI,s3)=>{var Y3=$("stream").Stream;s3.exports=nZI;function nZI(l){return{ReadStream:I,WriteStream:G};function I(c,b){if(!(this instanceof I))return new I(c,b);Y3.call(this);var d=this;this.path=c,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,b=b||{};for(var Z=Object.keys(b),a=0,e=Z.length;a<e;a++){var m=Z[a];this[m]=b[m]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){d._read()});return}l.open(this.path,this.flags,this.mode,function(W,n){if(W){d.emit("error",W),d.readable=!1;return}d.fd=n,d.emit("open",n),d._read()})}function G(c,b){if(!(this instanceof G))return new G(c,b);Y3.call(this),this.path=c,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,b=b||{};for(var d=Object.keys(b),Z=0,a=d.length;Z<a;Z++){var e=d[Z];this[e]=b[e]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=l.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var u3=R((jCI,V3)=>{"use strict";V3.exports=NZI;var tZI=Object.getPrototypeOf||function(l){return l.__proto__};function NZI(l){if(l===null||typeof l!="object")return l;if(l instanceof Object)var I={__proto__:tZI(l)};else var I=Object.create(null);return Object.getOwnPropertyNames(l).forEach(function(G){Object.defineProperty(I,G,Object.getOwnPropertyDescriptor(l,G))}),I}});var lo=R((fCI,Io)=>{var vl=$("fs"),pZI=p3(),YZI=h3(),sZI=u3(),Rs=$("util"),FG,Xs;typeof Symbol=="function"&&typeof Symbol.for=="function"?(FG=Symbol.for("graceful-fs.queue"),Xs=Symbol.for("graceful-fs.previous")):(FG="___graceful-fs.queue",Xs="___graceful-fs.previous");function hZI(){}function X3(l,I){Object.defineProperty(l,FG,{get:function(){return I}})}var Aa=hZI;Rs.debuglog?Aa=Rs.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Aa=function(){var l=Rs.format.apply(Rs,arguments);l="GFS4: "+l.split(/\n/).join(`
|
|
40
40
|
GFS4: `),console.error(l)});vl[FG]||(R3=global[FG]||[],X3(vl,R3),vl.close=(function(l){function I(G,c){return l.call(vl,G,function(b){b||F3(),typeof c=="function"&&c.apply(this,arguments)})}return Object.defineProperty(I,Xs,{value:l}),I})(vl.close),vl.closeSync=(function(l){function I(G){l.apply(vl,arguments),F3()}return Object.defineProperty(I,Xs,{value:l}),I})(vl.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Aa(vl[FG]),$("assert").equal(vl[FG].length,0)}));var R3;global[FG]||X3(global,vl[FG]);Io.exports=_X(sZI(vl));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!vl.__patched&&(Io.exports=_X(vl),vl.__patched=!0);function _X(l){pZI(l),l.gracefulify=_X,l.createReadStream=o,l.createWriteStream=w;var I=l.readFile;l.readFile=G;function G(H,Q,k){return typeof Q=="function"&&(k=Q,Q=null),U(H,Q,k);function U(M,J,B,j){return I(M,J,function(K){K&&(K.code==="EMFILE"||K.code==="ENFILE")?hm([U,[M,J,B],K,j||Date.now(),Date.now()]):typeof B=="function"&&B.apply(this,arguments)})}}var c=l.writeFile;l.writeFile=b;function b(H,Q,k,U){return typeof k=="function"&&(U=k,k=null),M(H,Q,k,U);function M(J,B,j,K,f){return c(J,B,j,function(bI){bI&&(bI.code==="EMFILE"||bI.code==="ENFILE")?hm([M,[J,B,j,K],bI,f||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var d=l.appendFile;d&&(l.appendFile=Z);function Z(H,Q,k,U){return typeof k=="function"&&(U=k,k=null),M(H,Q,k,U);function M(J,B,j,K,f){return d(J,B,j,function(bI){bI&&(bI.code==="EMFILE"||bI.code==="ENFILE")?hm([M,[J,B,j,K],bI,f||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var a=l.copyFile;a&&(l.copyFile=e);function e(H,Q,k,U){return typeof k=="function"&&(U=k,k=0),M(H,Q,k,U);function M(J,B,j,K,f){return a(J,B,j,function(bI){bI&&(bI.code==="EMFILE"||bI.code==="ENFILE")?hm([M,[J,B,j,K],bI,f||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var m=l.readdir;l.readdir=n;var W=/^v[0-5]\./;function n(H,Q,k){typeof Q=="function"&&(k=Q,Q=null);var U=W.test(process.version)?function(B,j,K,f){return m(B,M(B,j,K,f))}:function(B,j,K,f){return m(B,j,M(B,j,K,f))};return U(H,Q,k);function M(J,B,j,K){return function(f,bI){f&&(f.code==="EMFILE"||f.code==="ENFILE")?hm([U,[J,B,j],f,K||Date.now(),Date.now()]):(bI&&bI.sort&&bI.sort(),typeof j=="function"&&j.call(this,f,bI))}}}if(process.version.substr(0,4)==="v0.8"){var t=YZI(l);h=t.ReadStream,u=t.WriteStream}var N=l.ReadStream;N&&(h.prototype=Object.create(N.prototype),h.prototype.open=V);var p=l.WriteStream;p&&(u.prototype=Object.create(p.prototype),u.prototype.open=X),Object.defineProperty(l,"ReadStream",{get:function(){return h},set:function(H){h=H},enumerable:!0,configurable:!0}),Object.defineProperty(l,"WriteStream",{get:function(){return u},set:function(H){u=H},enumerable:!0,configurable:!0});var Y=h;Object.defineProperty(l,"FileReadStream",{get:function(){return Y},set:function(H){Y=H},enumerable:!0,configurable:!0});var s=u;Object.defineProperty(l,"FileWriteStream",{get:function(){return s},set:function(H){s=H},enumerable:!0,configurable:!0});function h(H,Q){return this instanceof h?(N.apply(this,arguments),this):h.apply(Object.create(h.prototype),arguments)}function V(){var H=this;E(H.path,H.flags,H.mode,function(Q,k){Q?(H.autoClose&&H.destroy(),H.emit("error",Q)):(H.fd=k,H.emit("open",k),H.read())})}function u(H,Q){return this instanceof u?(p.apply(this,arguments),this):u.apply(Object.create(u.prototype),arguments)}function X(){var H=this;E(H.path,H.flags,H.mode,function(Q,k){Q?(H.destroy(),H.emit("error",Q)):(H.fd=k,H.emit("open",k))})}function o(H,Q){return new l.ReadStream(H,Q)}function w(H,Q){return new l.WriteStream(H,Q)}var g=l.open;l.open=E;function E(H,Q,k,U){return typeof k=="function"&&(U=k,k=null),M(H,Q,k,U);function M(J,B,j,K,f){return g(J,B,j,function(bI,O){bI&&(bI.code==="EMFILE"||bI.code==="ENFILE")?hm([M,[J,B,j,K],bI,f||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}return l}function hm(l){Aa("ENQUEUE",l[0].name,l[1]),vl[FG].push(l),$X()}var Fs;function F3(){for(var l=Date.now(),I=0;I<vl[FG].length;++I)vl[FG][I].length>2&&(vl[FG][I][3]=l,vl[FG][I][4]=l);$X()}function $X(){if(clearTimeout(Fs),Fs=void 0,vl[FG].length!==0){var l=vl[FG].shift(),I=l[0],G=l[1],c=l[2],b=l[3],d=l[4];if(b===void 0)Aa("RETRY",I.name,G),I.apply(null,G);else if(Date.now()-b>=6e4){Aa("TIMEOUT",I.name,G);var Z=G.pop();typeof Z=="function"&&Z.call(null,c)}else{var a=Date.now()-d,e=Math.max(d-b,1),m=Math.min(e*1.2,100);a>=m?(Aa("RETRY",I.name,G),I.apply(null,G.concat([b]))):vl[FG].push(l)}Fs===void 0&&(Fs=setTimeout($X,0))}}});var i3=R((KCI,o3)=>{function Ec(l,I){typeof I=="boolean"&&(I={forever:I}),this._originalTimeouts=JSON.parse(JSON.stringify(l)),this._timeouts=l,this._options=I||{},this._maxRetryTime=I&&I.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o3.exports=Ec;Ec.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Ec.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Ec.prototype.retry=function(l){if(this._timeout&&clearTimeout(this._timeout),!l)return!1;var I=new Date().getTime();if(l&&I-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(l);var G=this._timeouts.shift();if(G===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),G=this._timeouts.shift();else return!1;var c=this,b=setTimeout(function(){c._attempts++,c._operationTimeoutCb&&(c._timeout=setTimeout(function(){c._operationTimeoutCb(c._attempts)},c._operationTimeout),c._options.unref&&c._timeout.unref()),c._fn(c._attempts)},G);return this._options.unref&&b.unref(),!0};Ec.prototype.attempt=function(l,I){this._fn=l,I&&(I.timeout&&(this._operationTimeout=I.timeout),I.cb&&(this._operationTimeoutCb=I.cb));var G=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){G._operationTimeoutCb()},G._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ec.prototype.try=function(l){console.log("Using RetryOperation.try() is deprecated"),this.attempt(l)};Ec.prototype.start=function(l){console.log("Using RetryOperation.start() is deprecated"),this.attempt(l)};Ec.prototype.start=Ec.prototype.try;Ec.prototype.errors=function(){return this._errors};Ec.prototype.attempts=function(){return this._attempts};Ec.prototype.mainError=function(){if(this._errors.length===0)return null;for(var l={},I=null,G=0,c=0;c<this._errors.length;c++){var b=this._errors[c],d=b.message,Z=(l[d]||0)+1;l[d]=Z,Z>=G&&(I=b,G=Z)}return I}});var Q3=R(La=>{var VZI=i3();La.operation=function(l){var I=La.timeouts(l);return new VZI(I,{forever:l&&l.forever,unref:l&&l.unref,maxRetryTime:l&&l.maxRetryTime})};La.timeouts=function(l){if(l instanceof Array)return[].concat(l);var I={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var G in l)I[G]=l[G];if(I.minTimeout>I.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var c=[],b=0;b<I.retries;b++)c.push(this.createTimeout(b,I));return l&&l.forever&&!c.length&&c.push(this.createTimeout(b,I)),c.sort(function(d,Z){return d-Z}),c};La.createTimeout=function(l,I){var G=I.randomize?Math.random()+1:1,c=Math.round(G*I.minTimeout*Math.pow(I.factor,l));return c=Math.min(c,I.maxTimeout),c};La.wrap=function(l,I,G){if(I instanceof Array&&(G=I,I=null),!G){G=[];for(var c in l)typeof l[c]=="function"&&G.push(c)}for(var b=0;b<G.length;b++){var d=G[b],Z=l[d];l[d]=function(e){var m=La.operation(I),W=Array.prototype.slice.call(arguments,1),n=W.pop();W.push(function(t){m.retry(t)||(t&&(arguments[0]=m.mainError()),n.apply(this,arguments))}),m.attempt(function(){e.apply(l,W)})}.bind(l,Z),l[d].options=I}}});var r3=R((TCI,H3)=>{H3.exports=Q3()});var v3=R((DCI,os)=>{os.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&os.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&os.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var g3=R((qCI,Rm)=>{var il=global.process,ka=function(l){return l&&typeof l=="object"&&typeof l.removeListener=="function"&&typeof l.emit=="function"&&typeof l.reallyExit=="function"&&typeof l.listeners=="function"&&typeof l.kill=="function"&&typeof l.pid=="number"&&typeof l.on=="function"};ka(il)?(w3=$("assert"),Vm=v3(),y3=/^win/i.test(il.platform),Yt=$("events"),typeof Yt!="function"&&(Yt=Yt.EventEmitter),il.__signal_exit_emitter__?GG=il.__signal_exit_emitter__:(GG=il.__signal_exit_emitter__=new Yt,GG.count=0,GG.emitted={}),GG.infinite||(GG.setMaxListeners(1/0),GG.infinite=!0),Rm.exports=function(l,I){if(!ka(global.process))return function(){};w3.equal(typeof l,"function","a callback must be provided for exit handler"),um===!1&&Go();var G="exit";I&&I.alwaysLast&&(G="afterexit");var c=function(){GG.removeListener(G,l),GG.listeners("exit").length===0&&GG.listeners("afterexit").length===0&&is()};return GG.on(G,l),c},is=function(){!um||!ka(global.process)||(um=!1,Vm.forEach(function(I){try{il.removeListener(I,Qs[I])}catch{}}),il.emit=Hs,il.reallyExit=co,GG.count-=1)},Rm.exports.unload=is,za=function(I,G,c){GG.emitted[I]||(GG.emitted[I]=!0,GG.emit(I,G,c))},Qs={},Vm.forEach(function(l){Qs[l]=function(){if(ka(global.process)){var G=il.listeners(l);G.length===GG.count&&(is(),za("exit",null,l),za("afterexit",null,l),y3&&l==="SIGHUP"&&(l="SIGINT"),il.kill(il.pid,l))}}}),Rm.exports.signals=function(){return Vm},um=!1,Go=function(){um||!ka(global.process)||(um=!0,GG.count+=1,Vm=Vm.filter(function(I){try{return il.on(I,Qs[I]),!0}catch{return!1}}),il.emit=J3,il.reallyExit=E3)},Rm.exports.load=Go,co=il.reallyExit,E3=function(I){ka(global.process)&&(il.exitCode=I||0,za("exit",il.exitCode,null),za("afterexit",il.exitCode,null),co.call(il,il.exitCode))},Hs=il.emit,J3=function(I,G){if(I==="exit"&&ka(global.process)){G!==void 0&&(il.exitCode=G);var c=Hs.apply(this,arguments);return za("exit",il.exitCode,null),za("afterexit",il.exitCode,null),c}else return Hs.apply(this,arguments)}):Rm.exports=function(){return function(){}};var w3,Vm,y3,Yt,GG,is,za,Qs,um,Go,co,E3,Hs,J3});var A3=R((PCI,bo)=>{"use strict";var C3=Symbol();function uZI(l,I,G){let c=I[C3];if(c)return I.stat(l,(d,Z)=>{if(d)return G(d);G(null,Z.mtime,c)});let b=new Date(Math.ceil(Date.now()/1e3)*1e3+5);I.utimes(l,b,b,d=>{if(d)return G(d);I.stat(l,(Z,a)=>{if(Z)return G(Z);let e=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(I,C3,{value:e}),G(null,a.mtime,e)})})}function RZI(l){let I=Date.now();return l==="s"&&(I=Math.ceil(I/1e3)*1e3),new Date(I)}bo.exports.probe=uZI;bo.exports.getMtime=RZI});var U3=R((_CI,ht)=>{"use strict";var FZI=$("path"),eo=lo(),XZI=r3(),oZI=g3(),L3=A3(),hd={};function st(l,I){return I.lockfilePath||`${l}.lock`}function mo(l,I,G){if(!I.realpath)return G(null,FZI.resolve(l));I.fs.realpath(l,G)}function ao(l,I,G){let c=st(l,I);I.fs.mkdir(c,b=>{if(!b)return L3.probe(c,I.fs,(d,Z,a)=>{if(d)return I.fs.rmdir(c,()=>{}),G(d);G(null,Z,a)});if(b.code!=="EEXIST")return G(b);if(I.stale<=0)return G(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:l}));I.fs.stat(c,(d,Z)=>{if(d)return d.code==="ENOENT"?ao(l,{...I,stale:0},G):G(d);if(!k3(Z,I))return G(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:l}));z3(l,I,a=>{if(a)return G(a);ao(l,{...I,stale:0},G)})})})}function k3(l,I){return l.mtime.getTime()<Date.now()-I.stale}function z3(l,I,G){I.fs.rmdir(st(l,I),c=>{if(c&&c.code!=="ENOENT")return G(c);G()})}function rs(l,I){let G=hd[l];G.updateTimeout||(G.updateDelay=G.updateDelay||I.update,G.updateTimeout=setTimeout(()=>{G.updateTimeout=null,I.fs.stat(G.lockfilePath,(c,b)=>{let d=G.lastUpdate+I.stale<Date.now();if(c)return c.code==="ENOENT"||d?Zo(l,G,Object.assign(c,{code:"ECOMPROMISED"})):(G.updateDelay=1e3,rs(l,I));if(!(G.mtime.getTime()===b.mtime.getTime()))return Zo(l,G,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=L3.getMtime(G.mtimePrecision);I.fs.utimes(G.lockfilePath,a,a,e=>{let m=G.lastUpdate+I.stale<Date.now();if(!G.released){if(e)return e.code==="ENOENT"||m?Zo(l,G,Object.assign(e,{code:"ECOMPROMISED"})):(G.updateDelay=1e3,rs(l,I));G.mtime=a,G.lastUpdate=Date.now(),G.updateDelay=null,rs(l,I)}})})},G.updateDelay),G.updateTimeout.unref&&G.updateTimeout.unref())}function Zo(l,I,G){I.released=!0,I.updateTimeout&&clearTimeout(I.updateTimeout),hd[l]===I&&delete hd[l],I.options.onCompromised(G)}function iZI(l,I,G){I={stale:1e4,update:null,realpath:!0,retries:0,fs:eo,onCompromised:c=>{throw c},...I},I.retries=I.retries||0,I.retries=typeof I.retries=="number"?{retries:I.retries}:I.retries,I.stale=Math.max(I.stale||0,2e3),I.update=I.update==null?I.stale/2:I.update||0,I.update=Math.max(Math.min(I.update,I.stale/2),1e3),mo(l,I,(c,b)=>{if(c)return G(c);let d=XZI.operation(I.retries);d.attempt(()=>{ao(b,I,(Z,a,e)=>{if(d.retry(Z))return;if(Z)return G(d.mainError());let m=hd[b]={lockfilePath:st(b,I),mtime:a,mtimePrecision:e,options:I,lastUpdate:Date.now()};rs(b,I),G(null,W=>{if(m.released)return W&&W(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));x3(b,{...I,realpath:!1},W)})})})})}function x3(l,I,G){I={fs:eo,realpath:!0,...I},mo(l,I,(c,b)=>{if(c)return G(c);let d=hd[b];if(!d)return G(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));d.updateTimeout&&clearTimeout(d.updateTimeout),d.released=!0,delete hd[b],z3(b,I,G)})}function QZI(l,I,G){I={stale:1e4,realpath:!0,fs:eo,...I},I.stale=Math.max(I.stale||0,2e3),mo(l,I,(c,b)=>{if(c)return G(c);I.fs.stat(st(b,I),(d,Z)=>d?d.code==="ENOENT"?G(null,!1):G(d):G(null,!k3(Z,I)))})}function HZI(){return hd}oZI(()=>{for(let l in hd){let I=hd[l].options;try{I.fs.rmdirSync(st(l,I))}catch{}}});ht.exports.lock=iZI;ht.exports.unlock=x3;ht.exports.check=QZI;ht.exports.getLocks=HZI});var O3=R(($CI,B3)=>{"use strict";var rZI=lo();function vZI(l){let I=["mkdir","realpath","stat","rmdir","utimes"],G={...l};return I.forEach(c=>{G[c]=(...b)=>{let d=b.pop(),Z;try{Z=l[`${c}Sync`](...b)}catch(a){return d(a)}d(null,Z)}}),G}function wZI(l){return(...I)=>new Promise((G,c)=>{I.push((b,d)=>{b?c(b):G(d)}),l(...I)})}function yZI(l){return(...I)=>{let G,c;if(I.push((b,d)=>{G=b,c=d}),l(...I),G)throw G;return c}}function EZI(l){if(l={...l},l.fs=vZI(l.fs||rZI),typeof l.retries=="number"&&l.retries>0||l.retries&&typeof l.retries.retries=="number"&&l.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return l}B3.exports={toPromise:wZI,toSync:yZI,toSyncOptions:EZI}});var j3=R((I3I,eZ)=>{"use strict";var Fm=U3(),{toPromise:vs,toSync:ws,toSyncOptions:Wo}=O3();async function M3(l,I){let G=await vs(Fm.lock)(l,I);return vs(G)}function JZI(l,I){let G=ws(Fm.lock)(l,Wo(I));return ws(G)}function gZI(l,I){return vs(Fm.unlock)(l,I)}function CZI(l,I){return ws(Fm.unlock)(l,Wo(I))}function AZI(l,I){return vs(Fm.check)(l,I)}function LZI(l,I){return ws(Fm.check)(l,Wo(I))}eZ.exports=M3;eZ.exports.lock=M3;eZ.exports.unlock=gZI;eZ.exports.lockSync=JZI;eZ.exports.unlockSync=CZI;eZ.exports.check=AZI;eZ.exports.checkSync=LZI});import{readFile as kZI,writeFile as zZI,rename as xZI,unlink as UZI,mkdir as BZI,stat as f3}from"node:fs/promises";import{existsSync as K3}from"node:fs";import Xm from"node:path";async function S3(l){let I=T3(l);try{if(!K3(I))return Vd.info("No .domyh cache found \u2014 will detect fresh"),null;let G=await kZI(I,"utf-8"),c=JSON.parse(G);return c.version!==no?(Vd.info("Cache version mismatch",{cached:c.version,current:no}),null):Date.now()>c._meta.expiresAt?(Vd.info("Cache TTL expired \u2014 re-detecting"),null):await KZI(l,c._validation.watchedFiles)?(Vd.info("Using cached project context",{project:c.project.name,type:c.project.type,stack:c.stack.primary,age:`${Math.round((Date.now()-new Date(c._meta.createdAt).getTime())/1e3)}s`}),c):(Vd.info("Stack indicator files changed \u2014 re-detecting"),null)}catch(G){return Vd.warn("Failed to load cache \u2014 will detect fresh",{error:G instanceof Error?G.message:String(G)}),null}}async function ys(l,I){let G=T3(l),c=`${G}.${process.pid}.tmp`;try{await fZI(l);let b;try{b=await(await Promise.resolve().then(()=>Vc(j3(),1))).lock(Xm.dirname(G),MZI)}catch(d){Vd.warn("Could not acquire lock \u2014 writing without lock",{error:d instanceof Error?d.message:String(d)})}try{let d=JSON.stringify(I,null,2);await zZI(c,d,"utf-8"),await xZI(c,G),Vd.info("Saved project context cache",{path:G})}finally{if(b)try{await b()}catch{}}}catch(b){Vd.warn("Failed to save cache \u2014 continuing without cache",{error:b instanceof Error?b.message:String(b)});try{await UZI(c)}catch{}}}async function Es(l,I,G="single",c="unknown"){let b=await SZI(l);return{version:no,project:{name:Xm.basename(l),root:l.replace(/\\/g,"/"),type:G},stack:I,_validation:{watchedFiles:b},_meta:{createdAt:new Date().toISOString(),expiresAt:Date.now()+OZI,lastIDE:c}}}function T3(l){return Xm.join(l,".domyh","mcp-context.json")}async function fZI(l){let I=Xm.join(l,".domyh");K3(I)||await BZI(I,{recursive:!0})}async function KZI(l,I){for(let[G,c]of Object.entries(I)){let b=Xm.join(l,G);try{let d=await f3(b);if(Math.abs(d.mtimeMs-c.mtimeMs)>1e3||d.size!==c.size)return!1}catch{return!1}}return!0}async function SZI(l){let I={};for(let G of jZI){let c=Xm.join(l,G);try{let b=await f3(c);b.isFile()&&(I[G]={mtimeMs:b.mtimeMs,size:b.size})}catch{}}return I}var Vd,no,OZI,MZI,jZI,Js=F(()=>{"use strict";_();Vd=A("config:project-context"),no=1,OZI=1440*60*1e3,MZI={retries:{retries:3,minTimeout:100,maxTimeout:1e3},stale:5e3},jZI=["package.json","go.mod","Cargo.toml","pyproject.toml","setup.py","requirements.txt","pom.xml","build.gradle","build.gradle.kts","CMakeLists.txt","Makefile","nuxt.config.ts","nuxt.config.js","next.config.js","next.config.ts","vite.config.ts","angular.json","pubspec.yaml","composer.json","Gemfile","deno.json","bun.lockb","nx.json","turbo.json","lerna.json","pnpm-workspace.yaml","Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]});var D3={};ll(D3,{NativeEngine:()=>to});var to,q3=F(()=>{"use strict";to=class{tier="native";native;constructor(I){this.native=I}sha256(I){return this.native.sha256(typeof I=="string"?Buffer.from(I):I)}async fileHash(I){return this.native.fileHash(I)}async batchFileHash(I){let G=await this.native.batchFileHash([...I]);return new Map(G)}countTokens(I,G){return this.native.countTokens(I)}truncateToTokens(I,G,c){return this.native.truncateToTokens(I,G)}merkleRoot(I){let G=[...I.entries()];return this.native.merkleRoot(G)}merkleDiff(I,G){return this.native.merkleDiff([...I.entries()],[...G.entries()])}}});import{createHash as TZI}from"node:crypto";import{readFile as DZI}from"node:fs/promises";function qZI(l){let I=TZI("sha256");return I.update(l),I.digest("hex")}async function PZI(l){let I=await DZI(l);return qZI(I)}async function P3(l,I=32){let G=new Map;for(let c=0;c<l.length;c+=I){let b=l.slice(c,c+I),d=await Promise.all(b.map(async Z=>{try{return[Z,await PZI(Z)]}catch{return[Z,""]}}));for(let[Z,a]of d)a&&G.set(Z,a)}return G}var _3=F(()=>{"use strict"});var $3={};ll($3,{PureTSEngine:()=>Vt});import{createHash as _ZI}from"node:crypto";import{readFile as $ZI}from"node:fs/promises";var Vt,No=F(()=>{"use strict";_3();Vt=class{tier="pure-ts";sha256(I){let G=_ZI("sha256");return G.update(I),G.digest("hex")}async fileHash(I){let G=await $ZI(I);return this.sha256(G)}async batchFileHash(I){return P3(I)}countTokens(I,G){if(I.length===0)return 0;let c=0,b=!1;for(let d=0;d<I.length;d++){let Z=I.charCodeAt(d);Z>=65&&Z<=90||Z>=97&&Z<=122||Z>=48&&Z<=57||Z===95?b||(c++,b=!0):(b=!1,Z!==32&&Z!==10&&Z!==13&&Z!==9&&c++)}return c}truncateToTokens(I,G,c){if(I.length===0||G<=0)return"";if(this.countTokens(I)<=G)return I;let d=0,Z=!1,a=0;for(let e=0;e<I.length;e++){let m=I.charCodeAt(e);if(m>=65&&m<=90||m>=97&&m<=122||m>=48&&m<=57||m===95){if(!Z&&(d++,Z=!0,d>G))return I.slice(0,a)}else if(Z=!1,m!==32&&m!==10&&m!==13&&m!==9&&(d++,d>G))return I.slice(0,a);a=e+1}return I.slice(0,a)}merkleRoot(I){if(I.size===0)return this.sha256("");let c=[...I.entries()].sort(([b],[d])=>b.localeCompare(d)).map(([b,d])=>this.sha256(`${b}:${d}`));for(;c.length>1;){let b=[];for(let d=0;d<c.length;d+=2)d+1<c.length?b.push(this.sha256(c[d]+c[d+1])):b.push(c[d]);c=b}return c[0]}merkleDiff(I,G){let c=[],b=[],d=[];for(let[Z,a]of G){let e=I.get(Z);e===void 0?c.push(Z):e!==a&&b.push(Z)}for(let Z of I.keys())G.has(Z)||d.push(Z);return{added:c,modified:b,deleted:d}}}});var IA={};ll(IA,{WasmEngine:()=>po});var IaI,po,lA=F(()=>{"use strict";No();_();IaI=A("engine:wasm"),po=class{tier="wasm";fallback=new Vt;wasm;fallbackWarned=new Set;constructor(I){this.wasm=I}sha256(I){return typeof this.wasm.sha256=="function"?this.wasm.sha256(I):this.fallback.sha256(I)}async fileHash(I){return this.warnFallback("fileHash"),this.fallback.fileHash(I)}async batchFileHash(I){return this.warnFallback("batchFileHash"),this.fallback.batchFileHash(I)}countTokens(I,G){return typeof this.wasm.countTokens=="function"?this.wasm.countTokens(I,G):this.fallback.countTokens(I,G)}truncateToTokens(I,G,c){return this.warnFallback("truncateToTokens"),this.fallback.truncateToTokens(I,G,c)}merkleRoot(I){return this.warnFallback("merkleRoot"),this.fallback.merkleRoot(I)}merkleDiff(I,G){return this.warnFallback("merkleDiff"),this.fallback.merkleDiff(I,G)}warnFallback(I){this.fallbackWarned.has(I)||(this.fallbackWarned.add(I),IaI.debug(`WASM: ${I}() not available, using PureTS fallback`))}}});import{createRequire as laI}from"node:module";import{fileURLToPath as GaI}from"node:url";import*as lb from"node:fs";import*as om from"node:path";import*as GA from"node:os";import*as cA from"node:crypto";function bA(l){return caI.every(I=>typeof l[I]=="function")}async function dA(){return yb||(yb=await daI(),yb)||(yb=await ZaI(),yb)||(yb=await aaI()),yb}async function baI(l){if(process.platform!=="win32"||!lb.existsSync(l))return l;try{let I=om.join(GA.tmpdir(),"hsa-native");lb.mkdirSync(I,{recursive:!0});let G=await new Promise((b,d)=>{let Z=cA.createHash("md5"),a=lb.createReadStream(l);a.on("data",e=>Z.update(e)),a.on("end",()=>b(Z.digest("hex").slice(0,8))),a.on("error",d)}),c=om.join(I,`hsa-engine-${G}.node`);return lb.existsSync(c)||(lb.copyFileSync(l,c),xa.debug(`Copied native addon to temp: ${c}`)),Yo=c,c}catch(I){return xa.debug(`Failed to copy native addon to temp, using source directly: ${I}`),l}}async function daI(){try{let l=laI(import.meta.url),I=om.dirname(GaI(import.meta.url)),G=om.join(I,"hsa-engine.node"),c=await baI(G),b=l(c);if(b&&bA(b)){let{NativeEngine:d}=await Promise.resolve().then(()=>(q3(),D3)),Z=new d(b);return xa.info(`\u26A1 Native engine loaded (${process.platform}-${process.arch})`),Z}}catch{xa.debug("Native engine not available, trying WASM")}return null}async function ZaI(){try{let l=await import("@domyh/hsa-wasm"),I=l.default||l;if(I&&bA(I)){let{WasmEngine:G}=await Promise.resolve().then(()=>(lA(),IA)),c=new G(I);return xa.info("\u{1F504} WASM engine loaded"),c}}catch{xa.debug("WASM engine not available, falling back to pure TS")}return null}async function aaI(){let{PureTSEngine:l}=await Promise.resolve().then(()=>(No(),$3)),I=new l;return xa.info("\u{1F4CB} Pure TS engine loaded (fallback)"),I}var xa,yb,Yo,caI,ZA=F(()=>{"use strict";_();xa=A("engine:loader"),yb=null,Yo=null,caI=["sha256","fileHash","batchFileHash","countTokens","truncateToTokens","merkleRoot","merkleDiff"];process.on("exit",()=>{if(Yo)try{lb.unlinkSync(Yo)}catch{}})});var aA={};ll(aA,{SimpleTokenizer:()=>gs});var gs,so=F(()=>{"use strict";gs=class{name="simple-heuristic";countTokens(I){if(I.length===0)return 0;let G=0,c=!1;for(let d=0;d<I.length;d++){let Z=I.charCodeAt(d);Z>=65&&Z<=90||Z>=97&&Z<=122||Z>=48&&Z<=57||Z===95?c||(G++,c=!0):(c=!1,Z!==32&&Z!==10&&Z!==13&&Z!==9&&G++)}let b=this.detectContentScale(I);return Math.ceil(G*b)}detectContentScale(I){let G=I.slice(0,500),c=0;for(let Z of G)"{}();=<>[]|&!".includes(Z)&&c++;let b=G.split(/\s+/).length,d=c/Math.max(G.length,1);return d>.05?1.15:b>30&&d<.02?.85:1}truncateToFit(I,G){if(I.length===0||G<=0)return"";if(this.countTokens(I)<=G)return I;let b=this.detectContentScale(I),d=Math.floor(G/b),Z=0,a=!1,e=0;for(let m=0;m<I.length;m++){let W=I.charCodeAt(m);if(W>=65&&W<=90||W>=97&&W<=122||W>=48&&W<=57||W===95){if(!a&&(Z++,a=!0,Z>d))return I.slice(0,e)}else if(a=!1,W!==32&&W!==10&&W!==13&&W!==9&&(Z++,Z>d))return I.slice(0,e);e=m+1}return I.slice(0,e)}encode(I){return Array.from(I).map(G=>G.charCodeAt(0))}decode(I){return I.map(G=>String.fromCharCode(G)).join("")}}});var WA=R(Cs=>{"use strict";Cs.byteLength=maI;Cs.toByteArray=naI;Cs.fromByteArray=paI;var Eb=[],Jc=[],eaI=typeof Uint8Array<"u"?Uint8Array:Array,ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ua=0,eA=ho.length;Ua<eA;++Ua)Eb[Ua]=ho[Ua],Jc[ho.charCodeAt(Ua)]=Ua;var Ua,eA;Jc[45]=62;Jc[95]=63;function mA(l){var I=l.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var G=l.indexOf("=");G===-1&&(G=I);var c=G===I?0:4-G%4;return[G,c]}function maI(l){var I=mA(l),G=I[0],c=I[1];return(G+c)*3/4-c}function WaI(l,I,G){return(I+G)*3/4-G}function naI(l){var I,G=mA(l),c=G[0],b=G[1],d=new eaI(WaI(l,c,b)),Z=0,a=b>0?c-4:c,e;for(e=0;e<a;e+=4)I=Jc[l.charCodeAt(e)]<<18|Jc[l.charCodeAt(e+1)]<<12|Jc[l.charCodeAt(e+2)]<<6|Jc[l.charCodeAt(e+3)],d[Z++]=I>>16&255,d[Z++]=I>>8&255,d[Z++]=I&255;return b===2&&(I=Jc[l.charCodeAt(e)]<<2|Jc[l.charCodeAt(e+1)]>>4,d[Z++]=I&255),b===1&&(I=Jc[l.charCodeAt(e)]<<10|Jc[l.charCodeAt(e+1)]<<4|Jc[l.charCodeAt(e+2)]>>2,d[Z++]=I>>8&255,d[Z++]=I&255),d}function taI(l){return Eb[l>>18&63]+Eb[l>>12&63]+Eb[l>>6&63]+Eb[l&63]}function NaI(l,I,G){for(var c,b=[],d=I;d<G;d+=3)c=(l[d]<<16&16711680)+(l[d+1]<<8&65280)+(l[d+2]&255),b.push(taI(c));return b.join("")}function paI(l){for(var I,G=l.length,c=G%3,b=[],d=16383,Z=0,a=G-c;Z<a;Z+=d)b.push(NaI(l,Z,Z+d>a?a:Z+d));return c===1?(I=l[G-1],b.push(Eb[I>>2]+Eb[I<<4&63]+"==")):c===2&&(I=(l[G-2]<<8)+l[G-1],b.push(Eb[I>>10]+Eb[I>>4&63]+Eb[I<<2&63]+"=")),b.join("")}});function VaI(l,I){let G=Array.from({length:l.length},(c,b)=>({start:b,end:b+1}));for(;G.length>1;){let c=null;for(let b=0;b<G.length-1;b++){let d=l.slice(G[b].start,G[b+1].end),Z=I.get(d.join(","));Z!=null&&(c==null||Z<c[0])&&(c=[Z,b])}if(c!=null){let b=c[1];G[b]={start:G[b].start,end:G[b+1].end},G.splice(b+1,1)}else break}return G}function uaI(l,I){return l.length===1?[I.get(l.join(","))]:VaI(l,I).map(G=>I.get(l.slice(G.start,G.end).join(","))).filter(G=>G!=null)}function RaI(l){return l.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function As(l){switch(l){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var nA,YaI,saI,haI,Vo,Jb,uo=F(()=>{nA=Vc(WA(),1),YaI=Object.defineProperty,saI=(l,I,G)=>I in l?YaI(l,I,{enumerable:!0,configurable:!0,writable:!0,value:G}):l[I]=G,haI=(l,I,G)=>(saI(l,typeof I!="symbol"?I+"":I,G),G);Vo=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(l,I){this.patStr=l.pat_str;let G=l.bpe_ranks.split(`
|
|
@@ -339,7 +339,7 @@ ${a}`}var IH,IM=F(()=>{"use strict";Oa();Km();_O();_();pZ();Ss();IH=A("tool:get-
|
|
|
339
339
|
`),Z.push(`**Indexed skills**: ${I.skillRegistry.indexedCount}`),Z.push(`**Total skills discovered**: ${I.skillRegistry.totalSkills}`),Z.push(""),Z.push("### \u{1F4A1} Try these alternatives:"),Z.push('- `hsa_search_skills` with `skill` filter (e.g. `skill: "tailwind"`, `skill: "vue"`)'),Z.push("- Browse `.agent/skills/` \u2014 7 categories, 85+ skills:"),Z.push(" - `core/` (security, api-design, error-handling, logging, observability, authentication)"),Z.push(" - `languages/` (python, typescript, go, rust, java, kotlin, ...)"),Z.push(" - `frameworks/` (react, vue, nuxt, nextjs, angular, svelte, flutter)"),Z.push(" - `devops/` (docker, kubernetes, aws, ci-cd, terraform)"),Z.push(" - `cross-cutting/` (tailwind, testing, database, electron, playwright)"),Z.push(" - `tooling/` (mcp, api-protocols, browser-agent)"),Z.push(" - `ai-ml/` (ai-agents, prompt-engineering, rag-patterns, vector-search)"),Z.push("- \u26D4 Direct read: `.agent/skills/{category}/{name}/SKILL.md` \u2014 MUST read before implementing"),Z.join(`
|
|
340
340
|
`);let a=I.skillRegistry.getAllMeta();for(let n=0;n<c.length;n++){let t=c[n],N=a.get(t.skill),Y=`.agent/skills/${N?.category??"unknown"}/${t.skill}/SKILL.md`;Z.push(`### ${n+1}. ${t.pattern.title}`),Z.push(`- **Skill**: ${t.skill} | **Domain**: ${t.domain}`),Z.push(`- **Score**: ${t.score.toFixed(3)} | **Tokens**: ${t.pattern.tokenCost}`),N?Z.push(`- **\u{1F4D6} SKILL.md**: \`${Y}\``):Z.push(`- **\u26A0\uFE0F SKILL.md**: \`${Y}\` (not verified \u2014 skill from indexed cache)`);let s=t.pattern.data,h=Object.keys(s).filter(V=>!V.startsWith("_"));if(h.length>0&&h.length<=8){Z.push("```yaml");for(let V of h.slice(0,6)){let u=s[V];typeof u=="string"&&u.length<=200?Z.push(`${V}: ${u}`):typeof u=="number"||typeof u=="boolean"?Z.push(`${V}: ${String(u)}`):Array.isArray(u)&&u.length<=5&&Z.push(`${V}: [${u.map(X=>typeof X=="string"?X:JSON.stringify(X)).join(", ")}]`)}Z.push("```")}Z.push("")}Z.push("---"),Z.push(`**Search duration**: ${b}ms`),Z.push(`**Indexed skills**: ${I.skillRegistry.indexedCount}/${I.skillRegistry.totalSkills}`),Z.push(`**Total indexed patterns**: ${I.skillRegistry.totalPatterns}`),Z.push(`**Token usage**: ${d}`),[...new Set(c.map(n=>n.skill))].length>0&&(Z.push(""),Z.push("> \u26D4 **MUST**: Read `.agent/skills/{category}/{skill}/SKILL.md` before implementing. Apply patterns from skill to your code."));let m=Z.join(`
|
|
341
341
|
`),W=8e3;return m.length>W?m.slice(0,W)+"\n\n---\n*Output truncated. Use `skill` or `domain` filters to narrow results.*":m}var rVI,GM=F(()=>{"use strict";_();rVI=A("tool:search-skills")});function lH(l){return!l||l.length===0?cM:cM.filter(I=>l.includes(I.category))}var cM,bM,dM=F(()=>{"use strict";cM=[{name:"node",category:"runtime",displayName:"Node.js",commands:{win32:"node -v",darwin:"node -v",linux:"node -v"},versionRegex:/v?(\d+\.\d+\.\d+)/},{name:"python",category:"runtime",displayName:"Python",commands:{win32:"python --version",darwin:"python3 --version",linux:"python3 --version"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"go",category:"runtime",displayName:"Go",commands:{win32:"go version",darwin:"go version",linux:"go version"},versionRegex:/go(\d+\.\d+(?:\.\d+)?)/},{name:"rust",category:"runtime",displayName:"Rust",commands:{win32:"rustc --version",darwin:"rustc --version",linux:"rustc --version"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"dotnet",category:"runtime",displayName:".NET SDK",commands:{win32:"dotnet --version",darwin:"dotnet --version",linux:"dotnet --version"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"java",category:"runtime",displayName:"Java",commands:{win32:"java -version 2>&1",darwin:"java -version 2>&1",linux:"java -version 2>&1"},versionRegex:/(?:version\s+)?"?(\d+[\.\d]*)/},{name:"ruby",category:"runtime",displayName:"Ruby",commands:{win32:"ruby --version",darwin:"ruby --version",linux:"ruby --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"php",category:"runtime",displayName:"PHP",commands:{win32:"php --version",darwin:"php --version",linux:"php --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"bun",category:"runtime",displayName:"Bun",commands:{win32:"bun -v",darwin:"bun -v",linux:"bun -v"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"deno",category:"runtime",displayName:"Deno",commands:{win32:"deno --version",darwin:"deno --version",linux:"deno --version"},versionRegex:/deno\s+(\d+\.\d+\.\d+)/},{name:"npm",category:"package_manager",displayName:"npm",commands:{win32:"npm -v",darwin:"npm -v",linux:"npm -v"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"pnpm",category:"package_manager",displayName:"pnpm",commands:{win32:"pnpm -v",darwin:"pnpm -v",linux:"pnpm -v"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"yarn",category:"package_manager",displayName:"Yarn",commands:{win32:"yarn -v",darwin:"yarn -v",linux:"yarn -v"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"pip",category:"package_manager",displayName:"pip",commands:{win32:"pip --version",darwin:"pip3 --version",linux:"pip3 --version"},versionRegex:/pip\s+(\d+\.\d+(?:\.\d+)?)/},{name:"uv",category:"package_manager",displayName:"uv",commands:{win32:"uv --version",darwin:"uv --version",linux:"uv --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"cargo",category:"package_manager",displayName:"Cargo",commands:{win32:"cargo --version",darwin:"cargo --version",linux:"cargo --version"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"composer",category:"package_manager",displayName:"Composer",commands:{win32:"composer --version",darwin:"composer --version",linux:"composer --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"psql",category:"database",displayName:"PostgreSQL",commands:{win32:"psql --version",darwin:"psql --version",linux:"psql --version"},versionRegex:/(\d+\.\d+(?:\.\d+)?)/,optional:!0},{name:"mysql",category:"database",displayName:"MySQL",commands:{win32:"mysql --version",darwin:"mysql --version",linux:"mysql --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"redis",category:"database",displayName:"Redis",commands:{win32:"redis-cli --version",darwin:"redis-cli --version",linux:"redis-cli --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"mongosh",category:"database",displayName:"MongoDB Shell",commands:{win32:"mongosh --version",darwin:"mongosh --version",linux:"mongosh --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"sqlite3",category:"database",displayName:"SQLite",commands:{win32:"sqlite3 --version",darwin:"sqlite3 --version",linux:"sqlite3 --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"docker",category:"devops",displayName:"Docker",commands:{win32:"docker -v",darwin:"docker -v",linux:"docker -v"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"kubectl",category:"devops",displayName:"kubectl",commands:{win32:"kubectl version --client --short 2>&1",darwin:"kubectl version --client --short 2>&1",linux:"kubectl version --client --short 2>&1"},versionRegex:/v?(\d+\.\d+\.\d+)/,optional:!0},{name:"terraform",category:"devops",displayName:"Terraform",commands:{win32:"terraform --version",darwin:"terraform --version",linux:"terraform --version"},versionRegex:/v?(\d+\.\d+\.\d+)/,optional:!0},{name:"git",category:"devops",displayName:"Git",commands:{win32:"git --version",darwin:"git --version",linux:"git --version"},versionRegex:/(\d+\.\d+\.\d+)/},{name:"gh",category:"devops",displayName:"GitHub CLI",commands:{win32:"gh --version",darwin:"gh --version",linux:"gh --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0},{name:"make",category:"devops",displayName:"Make",commands:{win32:"make --version",darwin:"make --version",linux:"make --version"},versionRegex:/(\d+\.\d+(?:\.\d+)?)/,optional:!0},{name:"cmake",category:"devops",displayName:"CMake",commands:{win32:"cmake --version",darwin:"cmake --version",linux:"cmake --version"},versionRegex:/(\d+\.\d+\.\d+)/,optional:!0}];bM={runtime:"\u{1F527} Runtimes",package_manager:"\u{1F4E6} Package Managers",ide:"\u{1F4BB} IDEs / Editors",database:"\u{1F5C4}\uFE0F Databases",devops:"\u{1F680} DevOps / Tooling"}});import{exec as vVI}from"node:child_process";import{promisify as wVI}from"node:util";import{readFileSync as qh,existsSync as gN,readdirSync as yVI,statSync as EVI}from"node:fs";import Ph from"node:os";import Gc from"node:path";async function AVI(l,I){let G=l.commands[I]??null;if(!G)return null;try{let{stdout:c,stderr:b}=await JVI(G,{timeout:gVI,windowsHide:!0,env:{...process.env,NODE_NO_WARNINGS:"1"},maxBuffer:262144}),Z=(c||b||"").trim().match(l.versionRegex);return Z?.[1]?{name:l.name,displayName:l.displayName,version:Z[1],category:l.category}:null}catch{return null}}async function eM(l,I){let G=l.verbose??!1,c=cH.get(I.projectRoot);if(c&&Date.now()-c.timestamp<CVI){let p=c.result;if(GH.debug("Returning cached environment detection",{project:I.projectRoot}),l.categories&&l.categories.length>0){let Y=ZM(p,l.categories);return Dh(Y,G)}return Dh({...p,cached:!0},G)}c&&cH.delete(I.projectRoot);let b=Date.now(),d=Ph.platform(),Z=lH();GH.info(`Scanning ${Z.length} tools on ${d}...`);let a=5,e=[];for(let p=0;p<Z.length;p+=a){let Y=Z.slice(p,p+a),s=await Promise.allSettled(Y.map(h=>AVI(h,d)));e.push(...s)}let m=[],W=[];e.forEach((p,Y)=>{p.status==="fulfilled"&&p.value?m.push(p.value):W.push(Z[Y].displayName)});let n=Date.now()-b,t=LVI(),N={installed:m,notFound:W,scanDurationMs:n,platform:d,cached:!1,ideShell:t};if(cH.set(I.projectRoot,{result:N,timestamp:Date.now()}),GH.info(`Detection complete: ${m.length} installed, ${W.length} not found (${n}ms)`),l.categories&&l.categories.length>0){let p=ZM(N,l.categories);return Dh(p,G)}return Dh(N,G)}function ZM(l,I){let G=lH(I),c=new Set(G.map(b=>b.displayName));return{...l,installed:l.installed.filter(b=>I.includes(b.category)),notFound:l.notFound.filter(b=>c.has(b)),cached:!0}}function Dh(l,I){let G=[];if(G.push("# \u{1F5A5}\uFE0F System Environment Detection"),G.push(""),l.ideShell){let Z={bash:"Use `&&` for chaining, `/` paths, `$VAR` env vars",cmd:"Use `&` for chaining, `\\\\` paths, `%VAR%` env vars. Wrap with `cmd /c`",powershell:"Use `;` for chaining (PS5) or `&&` (PS7+), `$env:VAR` env vars",zsh:"Use `&&` for chaining, `/` paths, `$VAR` env vars",fish:"Use `; and` for chaining, `/` paths, `$VAR` env vars"}[l.ideShell]??"";G.push(`> **Shell**: \`${l.ideShell}\`${Z?` \u2014 ${Z}`:""}`),G.push("")}G.push(`**Platform**: ${l.platform} | **Found**: ${l.installed.length} tools | **Scan**: ${l.scanDurationMs}ms${l.cached?" (cached)":""}`),G.push("");let c=new Map;for(let d of l.installed){let Z=c.get(d.category)??[];Z.push(d),c.set(d.category,Z)}let b=["runtime","package_manager","ide","database","devops"];for(let d of b){let Z=c.get(d);if(!Z||Z.length===0)continue;let a=bM[d]??d;G.push(`## ${a}`),G.push(""),G.push("| Tool | Version |"),G.push("|------|---------|");for(let e of Z)G.push(`| ${e.displayName} | ${e.version} |`);G.push("")}return I&&l.notFound.length>0&&(G.push("---"),G.push(""),G.push(`**Not found** (${l.notFound.length}): ${l.notFound.join(", ")}`),G.push("")),G.join(`
|
|
342
|
-
`)}function LVI(){try{let l=Wc(),I=Ph.homedir(),G=Ph.platform(),c={vscode:Gc.join(I,G==="win32"?"AppData/Roaming/Code/User/settings.json":".config/Code/User/settings.json"),cursor:Gc.join(I,".cursor","User","settings.json"),windsurf:Gc.join(I,".codeium","windsurf","User","settings.json"),antigravity:Gc.join(I,".gemini","antigravity","settings.json"),trae:Gc.join(I,".trae","User","settings.json"),kiro:Gc.join(I,".kiro","User","settings.json")},b=c[l.name];if(b&&gN(b)){let a=JSON.parse(qh(b,"utf-8"))[`terminal.integrated.defaultProfile.${G==="win32"?"windows":G==="darwin"?"osx":"linux"}`];if(a&&typeof a=="string")return aM(a)}if(l.name==="jetbrains"){let d=kVI(I,G);if(d)return d}if(l.name==="zed"){let d=Gc.join(I,".config","zed","settings.json");if(gN(d)){let a=JSON.parse(qh(d,"utf-8"))?.terminal?.shell?.program;if(a&&typeof a=="string")return mM(a)}}if(["cline","roo","amazon-q","tabnine"].includes(l.name)){let d=c.vscode;if(d&&gN(d)){let e=JSON.parse(qh(d,"utf-8"))[`terminal.integrated.defaultProfile.${G==="win32"?"windows":G==="darwin"?"osx":"linux"}`];if(e&&typeof e=="string")return aM(e)}}}catch{}if(Ph.platform()==="win32"){let l=(process.env.COMSPEC||"").toLowerCase();return l.includes("powershell")||l.includes("pwsh")?"powershell":"cmd"}return process.env.SHELL?.split("/").pop()||"bash"}function aM(l){let I=l.toLowerCase();return I.includes("bash")||I.includes("git bash")?"bash":I.includes("pwsh")||I.includes("powershell")?"powershell":I.includes("cmd")||I.includes("command prompt")?"cmd":I.includes("zsh")?"zsh":I.includes("fish")?"fish":I}function mM(l){let I=Gc.basename(l).toLowerCase().replace(/\.exe$/i,"");return I.includes("bash")?"bash":I.includes("pwsh")||I.includes("powershell")?"powershell":I.includes("cmd")?"cmd":I.includes("zsh")?"zsh":I.includes("fish")?"fish":I}function kVI(l,I){try{let G=I==="win32"?process.env.APPDATA||Gc.join(l,"AppData","Roaming"):I==="darwin"?Gc.join(l,"Library","Application Support"):Gc.join(l,".config"),c=Gc.join(G,"JetBrains");if(!gN(c))return null;let b=yVI(c).filter(d=>{try{return EVI(Gc.join(c,d)).isDirectory()}catch{return!1}}).sort().reverse();for(let d of b){let Z=Gc.join(c,d,"options","terminal.xml");if(gN(Z)){let e=qh(Z,"utf-8").match(/name="myShellPath"\s+value="([^"]+)"/);if(e?.[1])return mM(e[1])}}}catch{}return null}var GH,JVI,gVI,CVI,cH,WM=F(()=>{"use strict";dM();_();Lb();GH=A("tool:detect-environment"),JVI=wVI(vVI),gVI=3e3,CVI=600*1e3,cH=new Map});var YW,bH=F(()=>{"use strict";YW={code:{include:["read_file","write_file","view_file","view_file_outline","view_code_item","replace_file_content","multi_replace_file_content","write_to_file","grep_search","find_by_name","list_dir","run_command","command_status","send_command_input"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web","read_url_content"],rationale:"Full file manipulation + search + terminal. No browser or web tools."},test:{include:["read_file","write_file","view_file","view_file_outline","view_code_item","replace_file_content","write_to_file","grep_search","find_by_name","list_dir","run_command","command_status"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web","read_url_content"],rationale:"File read/write + search + test runner. No browser or web tools."},review:{include:["read_file","view_file","view_file_outline","view_code_item","grep_search","find_by_name","list_dir"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","send_command_input","browser_*","mcp_playwright_*","deploy_*","generate_image"],rationale:"Read-only file access + search. No write, terminal, or browser tools."},debug:{include:["read_file","view_file","view_file_outline","view_code_item","replace_file_content","multi_replace_file_content","grep_search","find_by_name","list_dir","run_command","command_status","send_command_input"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web"],rationale:"File read + limited edit + full terminal for debugging. No browser or deploy."},browser:{include:["mcp_playwright_browser_navigate","mcp_playwright_browser_snapshot","mcp_playwright_browser_click","mcp_playwright_browser_type","mcp_playwright_browser_take_screenshot","mcp_playwright_browser_wait_for","mcp_playwright_browser_evaluate","mcp_playwright_browser_press_key","mcp_playwright_browser_hover","mcp_playwright_browser_select_option","read_file","view_file"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","deploy_*"],rationale:"Full Playwright browser control + limited file read. No file write or terminal."},research:{include:["read_url_content","search_web","view_content_chunk","read_file","view_file","view_file_outline","grep_search","find_by_name","list_dir"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","send_command_input","browser_*","mcp_playwright_*","deploy_*"],rationale:"Web + file read for research. No write, terminal, or browser tools."}}});function zVI(l,I){let G=[],c=I?.skills?.map(b=>b.name.toLowerCase())??[];switch(c.includes("typescript")&&(G.push("Use TypeScript strict mode"),G.push("Add proper type annotations")),c.includes("react")&&G.push("Follow React functional component patterns with hooks"),(c.includes("vue")||c.includes("nuxt"))&&G.push("Follow Vue 3 Composition API patterns"),l){case"code":G.push("Follow existing code conventions in the project"),I?.buildSystem?.testCommand&&G.push(`Run tests after changes: \`${I.buildSystem.testCommand}\``);break;case"test":G.push("Follow AAA pattern (Arrange, Act, Assert)"),G.push("Write descriptive test names"),(c.includes("vitest")||c.includes("jest"))&&G.push("Use describe/it blocks with clear grouping");break;case"review":G.push("Check for security vulnerabilities"),G.push("Evaluate error handling completeness"),G.push("Verify type safety and edge cases");break;case"debug":G.push("Reproduce the issue first, then fix"),G.push("Add regression test for the bug");break;case"browser":G.push("Take screenshots for verification"),G.push("Use accessibility snapshots for element interaction");break;case"research":G.push("Cite sources with URLs"),G.push("Verify information from multiple sources");break}return I?.buildSystem?.buildCommand&&G.push(`Build: \`${I.buildSystem.buildCommand}\``),G}async function nM(l,I){CN.info("hsa_prepare_handoff called",{taskType:l.task_type,hasFocusFiles:!!l.focus_files?.length,maxTokens:l.max_tokens}),zI.increment("handoff.calls");let G=l.max_tokens,b=(I.cachedDetection?.skills?.map(p=>p.name)??[]).join(", ")||"unknown",d=[];if(l.focus_files?.length)for(let p of l.focus_files)d.push({path:p,role:"primary"});if(l.task_description&&I.contextManager)try{let p=await I.contextManager.getContext({query:l.task_description,maxTokens:Math.min(G,2e3),strategy:"code-aware",includeFiles:l.focus_files});for(let Y of p.sources){let s=Y.file.replace(/\\/g,"/");!d.some(h=>h.path===s)&&d.length<10&&d.push({path:s,role:"related"})}}catch(p){CN.debug("Context retrieval for handoff failed",{error:String(p)})}if(I.codeGraph&&l.focus_files?.length)try{for(let p of l.focus_files.slice(0,3)){let Y=I.codeGraph.findDependencies(p);for(let s of Y.slice(0,3))!d.some(h=>h.path===s)&&d.length<15&&d.push({path:s,role:"dependency"})}}catch(p){CN.debug("CodeGraph dependency lookup failed",{error:String(p)})}let Z=[];try{let p=I.merkle.currentHashesView;if(p.size>0)for(let s of l.focus_files??[]){let h=s.replace(/\\/g,"/");p.has(h)&&Z.push(`${h} (tracked, hash: ${p.get(h).slice(0,8)}...)`)}}catch(p){CN.debug("Merkle state export failed",{error:String(p)})}let a=zVI(l.task_type,I.cachedDetection),e=YW[l.task_type]?.include??YW.code.include,m=I.projectRoot.split(/[/\\]/).pop()??"project",W=[];if(W.push(`<!-- HSA Handoff v1.1.0 | type:${l.task_type} | stack:${b} | files:${d.length} -->`),W.push(""),W.push(`## Project: ${m}`),W.push(`- **Stack**: ${b}`),W.push(`- **Root**: \`${I.projectRoot}\``),I.cachedDetection?.buildSystem){let p=I.cachedDetection.buildSystem,Y=[];p.buildCommand&&Y.push(`**Build**: \`${p.buildCommand}\``),p.testCommand&&Y.push(`**Test**: \`${p.testCommand}\``),p.devCommand&&Y.push(`**Dev**: \`${p.devCommand}\``),Y.length>0&&W.push(`- ${Y.join(" | ")}`)}if(I.cachedDetection?.monorepo&&W.push("- \u{1F4E6} **Monorepo** detected"),W.push(""),d.length>0){W.push("## Relevant Files"),W.push(""),W.push("| File | Role |"),W.push("|------|------|");for(let p of d.slice(0,10))W.push(`| \`${p.path}\` | ${p.role} |`);if(d.length>10&&W.push(`| ... | +${d.length-10} more |`),W.push(""),I.codeGraph){let p=d.filter(Y=>Y.role==="primary").slice(0,5);for(let Y of p){let h=I.codeGraph.getFileSymbols(Y.path).filter(V=>V.exported).slice(0,8);h.length>0&&W.push(`**\`${Y.path}\`**: ${h.map(V=>`${V.kind} \`${V.name}\``).join(", ")}`)}p.length>0&&W.push("")}}if(Z.length>0){W.push("## Tracked Files");for(let p of Z.slice(0,5))W.push(`- ${p}`);W.push("")}if(l.task_description&&(W.push("## Task"),W.push(l.task_description),W.push("")),a.length>0){W.push("## Constraints");for(let p of a)W.push(`- ${p}`);W.push("")}if(I.session){let p=I.session.getRecentQueries(3),Y=I.session.getRecentEdits(5);(p.length>0||Y.length>0)&&(W.push("## Session Context"),p.length>0&&W.push("**Recent queries**: "+p.map(s=>`\`${s.slice(0,60)}\``).join(" \u2192 ")),Y.length>0&&W.push("**Recently edited**: "+Y.map(s=>`\`${s}\``).join(", ")),W.push(""))}W.push("## Suggested Tools"),W.push(e.map(p=>`\`${p}\``).join(", ")),W.push("");let n=W.join(`
|
|
342
|
+
`)}function LVI(){try{let l=Wc(),I=Ph.homedir(),G=Ph.platform(),c={vscode:Gc.join(I,G==="win32"?"AppData/Roaming/Code/User/settings.json":".config/Code/User/settings.json"),cursor:Gc.join(I,G==="win32"?"AppData/Roaming/Cursor/User/settings.json":".config/Cursor/User/settings.json"),windsurf:Gc.join(I,G==="win32"?"AppData/Roaming/Windsurf/User/settings.json":".config/Windsurf/User/settings.json"),antigravity:Gc.join(I,G==="win32"?"AppData/Roaming/Antigravity/User/settings.json":".config/Antigravity/User/settings.json"),trae:Gc.join(I,G==="win32"?"AppData/Roaming/Trae/User/settings.json":".config/Trae/User/settings.json"),kiro:Gc.join(I,".kiro","settings","settings.json")},b=c[l.name];if(b&&gN(b)){let a=JSON.parse(qh(b,"utf-8"))[`terminal.integrated.defaultProfile.${G==="win32"?"windows":G==="darwin"?"osx":"linux"}`];if(a&&typeof a=="string")return aM(a)}if(l.name==="jetbrains"){let d=kVI(I,G);if(d)return d}if(l.name==="zed"){let d=Gc.join(I,".config","zed","settings.json");if(gN(d)){let a=JSON.parse(qh(d,"utf-8"))?.terminal?.shell?.program;if(a&&typeof a=="string")return mM(a)}}if(["cline","roo","amazon-q","tabnine"].includes(l.name)){let d=c.vscode;if(d&&gN(d)){let e=JSON.parse(qh(d,"utf-8"))[`terminal.integrated.defaultProfile.${G==="win32"?"windows":G==="darwin"?"osx":"linux"}`];if(e&&typeof e=="string")return aM(e)}}}catch{}if(Ph.platform()==="win32"){let l=(process.env.SHELL||"").toLowerCase();if(l.includes("bash")||l.includes("zsh"))return l.split("/").pop()||"bash";if(process.env.MSYSTEM)return"bash";let I=(process.env.TERM_PROGRAM||"").toLowerCase();if(I.includes("bash")||I.includes("mintty"))return"bash";let G=(process.env.COMSPEC||"").toLowerCase();return G.includes("powershell")||G.includes("pwsh")?"powershell":"cmd"}return process.env.SHELL?.split("/").pop()||"bash"}function aM(l){let I=l.toLowerCase();return I.includes("bash")||I.includes("git bash")?"bash":I.includes("pwsh")||I.includes("powershell")?"powershell":I.includes("cmd")||I.includes("command prompt")?"cmd":I.includes("zsh")?"zsh":I.includes("fish")?"fish":I}function mM(l){let I=Gc.basename(l).toLowerCase().replace(/\.exe$/i,"");return I.includes("bash")?"bash":I.includes("pwsh")||I.includes("powershell")?"powershell":I.includes("cmd")?"cmd":I.includes("zsh")?"zsh":I.includes("fish")?"fish":I}function kVI(l,I){try{let G=I==="win32"?process.env.APPDATA||Gc.join(l,"AppData","Roaming"):I==="darwin"?Gc.join(l,"Library","Application Support"):Gc.join(l,".config"),c=Gc.join(G,"JetBrains");if(!gN(c))return null;let b=yVI(c).filter(d=>{try{return EVI(Gc.join(c,d)).isDirectory()}catch{return!1}}).sort().reverse();for(let d of b){let Z=Gc.join(c,d,"options","terminal.xml");if(gN(Z)){let e=qh(Z,"utf-8").match(/name="myShellPath"\s+value="([^"]+)"/);if(e?.[1])return mM(e[1])}}}catch{}return null}var GH,JVI,gVI,CVI,cH,WM=F(()=>{"use strict";dM();_();Lb();GH=A("tool:detect-environment"),JVI=wVI(vVI),gVI=3e3,CVI=600*1e3,cH=new Map});var YW,bH=F(()=>{"use strict";YW={code:{include:["read_file","write_file","view_file","view_file_outline","view_code_item","replace_file_content","multi_replace_file_content","write_to_file","grep_search","find_by_name","list_dir","run_command","command_status","send_command_input"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web","read_url_content"],rationale:"Full file manipulation + search + terminal. No browser or web tools."},test:{include:["read_file","write_file","view_file","view_file_outline","view_code_item","replace_file_content","write_to_file","grep_search","find_by_name","list_dir","run_command","command_status"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web","read_url_content"],rationale:"File read/write + search + test runner. No browser or web tools."},review:{include:["read_file","view_file","view_file_outline","view_code_item","grep_search","find_by_name","list_dir"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","send_command_input","browser_*","mcp_playwright_*","deploy_*","generate_image"],rationale:"Read-only file access + search. No write, terminal, or browser tools."},debug:{include:["read_file","view_file","view_file_outline","view_code_item","replace_file_content","multi_replace_file_content","grep_search","find_by_name","list_dir","run_command","command_status","send_command_input"],exclude:["browser_*","mcp_playwright_*","deploy_*","generate_image","search_web"],rationale:"File read + limited edit + full terminal for debugging. No browser or deploy."},browser:{include:["mcp_playwright_browser_navigate","mcp_playwright_browser_snapshot","mcp_playwright_browser_click","mcp_playwright_browser_type","mcp_playwright_browser_take_screenshot","mcp_playwright_browser_wait_for","mcp_playwright_browser_evaluate","mcp_playwright_browser_press_key","mcp_playwright_browser_hover","mcp_playwright_browser_select_option","read_file","view_file"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","deploy_*"],rationale:"Full Playwright browser control + limited file read. No file write or terminal."},research:{include:["read_url_content","search_web","view_content_chunk","read_file","view_file","view_file_outline","grep_search","find_by_name","list_dir"],exclude:["write_file","write_to_file","replace_file_content","multi_replace_file_content","run_command","send_command_input","browser_*","mcp_playwright_*","deploy_*"],rationale:"Web + file read for research. No write, terminal, or browser tools."}}});function zVI(l,I){let G=[],c=I?.skills?.map(b=>b.name.toLowerCase())??[];switch(c.includes("typescript")&&(G.push("Use TypeScript strict mode"),G.push("Add proper type annotations")),c.includes("react")&&G.push("Follow React functional component patterns with hooks"),(c.includes("vue")||c.includes("nuxt"))&&G.push("Follow Vue 3 Composition API patterns"),l){case"code":G.push("Follow existing code conventions in the project"),I?.buildSystem?.testCommand&&G.push(`Run tests after changes: \`${I.buildSystem.testCommand}\``);break;case"test":G.push("Follow AAA pattern (Arrange, Act, Assert)"),G.push("Write descriptive test names"),(c.includes("vitest")||c.includes("jest"))&&G.push("Use describe/it blocks with clear grouping");break;case"review":G.push("Check for security vulnerabilities"),G.push("Evaluate error handling completeness"),G.push("Verify type safety and edge cases");break;case"debug":G.push("Reproduce the issue first, then fix"),G.push("Add regression test for the bug");break;case"browser":G.push("Take screenshots for verification"),G.push("Use accessibility snapshots for element interaction");break;case"research":G.push("Cite sources with URLs"),G.push("Verify information from multiple sources");break}return I?.buildSystem?.buildCommand&&G.push(`Build: \`${I.buildSystem.buildCommand}\``),G}async function nM(l,I){CN.info("hsa_prepare_handoff called",{taskType:l.task_type,hasFocusFiles:!!l.focus_files?.length,maxTokens:l.max_tokens}),zI.increment("handoff.calls");let G=l.max_tokens,b=(I.cachedDetection?.skills?.map(p=>p.name)??[]).join(", ")||"unknown",d=[];if(l.focus_files?.length)for(let p of l.focus_files)d.push({path:p,role:"primary"});if(l.task_description&&I.contextManager)try{let p=await I.contextManager.getContext({query:l.task_description,maxTokens:Math.min(G,2e3),strategy:"code-aware",includeFiles:l.focus_files});for(let Y of p.sources){let s=Y.file.replace(/\\/g,"/");!d.some(h=>h.path===s)&&d.length<10&&d.push({path:s,role:"related"})}}catch(p){CN.debug("Context retrieval for handoff failed",{error:String(p)})}if(I.codeGraph&&l.focus_files?.length)try{for(let p of l.focus_files.slice(0,3)){let Y=I.codeGraph.findDependencies(p);for(let s of Y.slice(0,3))!d.some(h=>h.path===s)&&d.length<15&&d.push({path:s,role:"dependency"})}}catch(p){CN.debug("CodeGraph dependency lookup failed",{error:String(p)})}let Z=[];try{let p=I.merkle.currentHashesView;if(p.size>0)for(let s of l.focus_files??[]){let h=s.replace(/\\/g,"/");p.has(h)&&Z.push(`${h} (tracked, hash: ${p.get(h).slice(0,8)}...)`)}}catch(p){CN.debug("Merkle state export failed",{error:String(p)})}let a=zVI(l.task_type,I.cachedDetection),e=YW[l.task_type]?.include??YW.code.include,m=I.projectRoot.split(/[/\\]/).pop()??"project",W=[];if(W.push(`<!-- HSA Handoff v1.1.0 | type:${l.task_type} | stack:${b} | files:${d.length} -->`),W.push(""),W.push(`## Project: ${m}`),W.push(`- **Stack**: ${b}`),W.push(`- **Root**: \`${I.projectRoot}\``),I.cachedDetection?.buildSystem){let p=I.cachedDetection.buildSystem,Y=[];p.buildCommand&&Y.push(`**Build**: \`${p.buildCommand}\``),p.testCommand&&Y.push(`**Test**: \`${p.testCommand}\``),p.devCommand&&Y.push(`**Dev**: \`${p.devCommand}\``),Y.length>0&&W.push(`- ${Y.join(" | ")}`)}if(I.cachedDetection?.monorepo&&W.push("- \u{1F4E6} **Monorepo** detected"),W.push(""),d.length>0){W.push("## Relevant Files"),W.push(""),W.push("| File | Role |"),W.push("|------|------|");for(let p of d.slice(0,10))W.push(`| \`${p.path}\` | ${p.role} |`);if(d.length>10&&W.push(`| ... | +${d.length-10} more |`),W.push(""),I.codeGraph){let p=d.filter(Y=>Y.role==="primary").slice(0,5);for(let Y of p){let h=I.codeGraph.getFileSymbols(Y.path).filter(V=>V.exported).slice(0,8);h.length>0&&W.push(`**\`${Y.path}\`**: ${h.map(V=>`${V.kind} \`${V.name}\``).join(", ")}`)}p.length>0&&W.push("")}}if(Z.length>0){W.push("## Tracked Files");for(let p of Z.slice(0,5))W.push(`- ${p}`);W.push("")}if(l.task_description&&(W.push("## Task"),W.push(l.task_description),W.push("")),a.length>0){W.push("## Constraints");for(let p of a)W.push(`- ${p}`);W.push("")}if(I.session){let p=I.session.getRecentQueries(3),Y=I.session.getRecentEdits(5);(p.length>0||Y.length>0)&&(W.push("## Session Context"),p.length>0&&W.push("**Recent queries**: "+p.map(s=>`\`${s.slice(0,60)}\``).join(" \u2192 ")),Y.length>0&&W.push("**Recently edited**: "+Y.map(s=>`\`${s}\``).join(", ")),W.push(""))}W.push("## Suggested Tools"),W.push(e.map(p=>`\`${p}\``).join(", ")),W.push("");let n=W.join(`
|
|
343
343
|
`),t=I.tokenizer.countTokens(n),N=`${n}
|
|
344
344
|
<!-- tokens: ${t} -->`;return zI.increment("handoff.tokens",I.tokenizer.countTokens(N)),CN.info("Handoff packet generated",{taskType:l.task_type,files:d.length,constraints:a.length,tokens:I.tokenizer.countTokens(N)}),N}var CN,tM=F(()=>{"use strict";bH();_();pZ();CN=A("tool:prepare-handoff")});function NM(l){xVI.info("hsa_filter_tools called",{taskType:l.task_type});let I=YW[l.task_type];if(!I)return`Unknown task type: ${l.task_type}. Supported: ${Object.keys(YW).join(", ")}`;let G=[];G.push(`## Tool Filter: ${l.task_type}`),G.push(""),G.push(`**Rationale**: ${I.rationale}`),G.push(""),G.push("### \u2705 Include (expose to sub-agent)"),G.push("");for(let c of I.include)G.push(`- \`${c}\``);G.push(""),G.push("### \u274C Exclude (hide from sub-agent)"),G.push("");for(let c of I.exclude)G.push(`- \`${c}\``);return G.push(""),G.push("### \u{1F4CA} Impact"),G.push(`- **Included tools**: ${I.include.length}`),G.push(`- **Estimated token savings**: ~${UVI(I.include.length)}`),G.push(""),G.join(`
|
|
345
345
|
`)}function UVI(l){return`~${l*300} tokens (${l} tools \xD7 ~300 tok each). Exclude the rest to save context.`}var xVI,pM=F(()=>{"use strict";bH();_();xVI=A("tool:filter-tools")});async function YM(l,I){dH.info("hsa_trace_flow called",{entry:l.entry_point,depth:l.depth});let{codeGraph:G}=I;if(G.fileCount===0)return dH.warn("Trace flow unavailable \u2014 CodeGraph has 0 indexed files"),Tl({level:"warning",tool:"hsa_trace_flow",message:"CodeGraph has 0 indexed files. Background indexing may not have completed yet.",suggestion:"Run `hsa_check_changes` first, then retry."});let c=Math.min(l.depth??3,5),b=l.direction??"downstream",d=G.getTagIndex(),Z=[...d.findDefinitions(l.entry_point)];if(Z.length===0){let t=G.getAllFiles();for(let N of t)G.getFileSymbols(N).some(Y=>Y.name===l.entry_point)&&Z.push(N)}if(Z.length===0)return Tl({level:"error",tool:"hsa_trace_flow",message:`Symbol "${l.entry_point}" not found in the codebase.`,suggestion:"Use exact symbol name (case sensitive). Ensure the file has been indexed via `hsa_check_changes`."});let a=[],e=0,m=new Set;for(let t of Z.slice(0,3)){let N=new Set,Y=G.getFileSymbols(t).find(o=>o.name===l.entry_point),V=d.getFileDefinitions(t).find(o=>o.name===l.entry_point)?.signature?.split(`
|