@anthropic-ai/claude-agent-sdk 0.3.219 → 0.3.220

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/sdk.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
3
3
 
4
- // Version: 0.3.219
4
+ // Version: 0.3.220
5
5
 
6
6
  // Want to see the unminified source? We're hiring!
7
7
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
@@ -133,7 +133,7 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
133
133
  `+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
134
134
  `+" ".repeat(t))},"\t":{"\n":Array(200).fill(0).map((e,t)=>`
135
135
  `+"\t".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
136
- `+"\t".repeat(t))}};var Eq;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Eq||(Eq={}));var wq;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(wq||(wq={}));var Tq;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Tq||(Tq={}));var Aq;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Aq||(Aq={}));function my(e){return e.startsWith("\uFEFF")?e.slice(1):e}var Lc=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Oq=new Set,Ik=typeof process==="object"&&!!process?process:{},Cq=(e,t,r,n)=>{typeof Ik.emitWarning==="function"?Ik.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},gy=globalThis.AbortController,kq=globalThis.AbortSignal;if(typeof gy>"u"){kq=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,o){this._onabort.push(o)}},gy=class{constructor(){t()}signal=new kq;abort(n){if(this.signal.aborted)return;this.signal.reason=n,this.signal.aborted=!0;for(let o of this.signal._onabort)o(n);this.signal.onabort?.(n)}};let e=Ik.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,Cq("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t)}}var N0e=(e)=>!Oq.has(e),Rxt=Symbol("type"),ui=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Rq=(e)=>!ui(e)?null:e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Od:null;class Od extends Array{constructor(e){super(e);this.fill(0)}}class Nc{heap;length;static#n=!1;static create(e){let t=Rq(e);if(!t)return[];Nc.#n=!0;let r=new Nc(e,t);return Nc.#n=!1,r}constructor(e,t){if(!Nc.#n)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class hy{#n;#p;#g;#h;#R;#I;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#_;#o;#r;#e;#l;#d;#c;#s;#y;#a;#b;#x;#f;#v;#A;#u;static unsafeExposeInternals(e){return{starts:e.#x,ttls:e.#f,sizes:e.#b,keyMap:e.#o,keyList:e.#r,valList:e.#e,next:e.#l,prev:e.#d,get head(){return e.#c},get tail(){return e.#s},free:e.#y,isBackgroundFetch:(t)=>e.#t(t),backgroundFetch:(t,r,n,o)=>e.#L(t,r,n,o),moveToTail:(t)=>e.#C(t),indexes:(t)=>e.#S(t),rindexes:(t)=>e.#E(t),isStale:(t)=>e.#m(t)}}get max(){return this.#n}get maxSize(){return this.#p}get calculatedSize(){return this.#_}get size(){return this.#i}get fetchMethod(){return this.#R}get memoMethod(){return this.#I}get dispose(){return this.#g}get disposeAfter(){return this.#h}constructor(e){let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:i,updateAgeOnHas:s,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:m=0,maxEntrySize:g=0,sizeCalculation:h,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:k,ignoreFetchAbort:P}=e;if(t!==0&&!ui(t))throw TypeError("max option must be a nonnegative integer");let te=t?Rq(t):Array;if(!te)throw Error("invalid max value: "+t);if(this.#n=t,this.#p=m,this.maxEntrySize=g||this.#p,this.sizeCalculation=h,this.sizeCalculation){if(!this.#p&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#I=y,_!==void 0&&typeof _!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#R=_,this.#A=!!_,this.#o=new Map,this.#r=Array(t).fill(void 0),this.#e=Array(t).fill(void 0),this.#l=new te(t),this.#d=new te(t),this.#c=0,this.#s=0,this.#y=Nc.create(t),this.#i=0,this.#_=0,typeof c==="function")this.#g=c;if(typeof u==="function")this.#h=u,this.#a=[];else this.#h=void 0,this.#a=void 0;if(this.#v=!!this.#g,this.#u=!!this.#h,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#p!==0){if(!ui(this.#p))throw TypeError("maxSize must be a positive integer if specified")}if(!ui(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!s,this.ttlResolution=ui(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ui(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#n===0&&this.ttl===0&&this.#p===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#n&&!this.#p){if(N0e("LRU_CACHE_UNBOUNDED"))Oq.add("LRU_CACHE_UNBOUNDED"),Cq("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",hy)}}getRemainingTTL(e){return this.#o.has(e)?1/0:0}#N(){let e=new Od(this.#n),t=new Od(this.#n);this.#f=e,this.#x=t,this.#M=(o,i,s=Lc.now())=>{if(t[o]=i!==0?s:0,e[o]=i,i!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#m(o))this.#w(this.#r[o],"expire")},i+1);if(a.unref)a.unref()}},this.#k=(o)=>{t[o]=e[o]!==0?Lc.now():0},this.#T=(o,i)=>{if(e[i]){let s=e[i],a=t[i];if(!s||!a)return;o.ttl=s,o.start=a,o.now=r||n();let c=o.now-a;o.remainingTTL=s-c}};let r=0,n=()=>{let o=Lc.now();if(this.ttlResolution>0){r=o;let i=setTimeout(()=>r=0,this.ttlResolution);if(i.unref)i.unref()}return o};this.getRemainingTTL=(o)=>{let i=this.#o.get(o);if(i===void 0)return 0;let s=e[i],a=t[i];if(!s||!a)return 1/0;let c=(r||n())-a;return s-c},this.#m=(o)=>{let i=t[o],s=e[o];return!!s&&!!i&&(r||n())-i>s}}#k=()=>{};#T=()=>{};#M=()=>{};#m=()=>!1;#z(){let e=new Od(this.#n);this.#_=0,this.#b=e,this.#O=(t)=>{this.#_-=e[t],e[t]=0},this.#U=(t,r,n,o)=>{if(this.#t(r))return 0;if(!ui(n))if(o){if(typeof o!=="function")throw TypeError("sizeCalculation must be a function");if(n=o(r,t),!ui(n))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#P=(t,r,n)=>{if(e[t]=r,this.#p){let o=this.#p-e[t];while(this.#_>o)this.#D(!0)}if(this.#_+=e[t],n)n.entrySize=r,n.totalCalculatedSize=this.#_}}#O=(e)=>{};#P=(e,t,r)=>{};#U=(e,t,r,n)=>{if(r||n)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#s;;){if(!this.#$(t))break;if(e||!this.#m(t))yield t;if(t===this.#c)break;else t=this.#d[t]}}*#E({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#c;;){if(!this.#$(t))break;if(e||!this.#m(t))yield t;if(t===this.#s)break;else t=this.#l[t]}}#$(e){return e!==void 0&&this.#o.get(this.#r[e])===e}*entries(){for(let e of this.#S())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*rentries(){for(let e of this.#E())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*keys(){for(let e of this.#S()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*rkeys(){for(let e of this.#E()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*values(){for(let e of this.#S())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}*rvalues(){for(let e of this.#E())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#S()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;if(e(o,this.#r[r],this))return this.get(this.#r[r],t)}}forEach(e,t=this){for(let r of this.#S()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;e.call(t,o,this.#r[r],this)}}rforEach(e,t=this){for(let r of this.#E()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;e.call(t,o,this.#r[r],this)}}purgeStale(){let e=!1;for(let t of this.#E({allowStale:!0}))if(this.#m(t))this.#w(this.#r[t],"expire"),e=!0;return e}info(e){let t=this.#o.get(e);if(t===void 0)return;let r=this.#e[t],n=this.#t(r)?r.__staleWhileFetching:r;if(n===void 0)return;let o={value:n};if(this.#f&&this.#x){let i=this.#f[t],s=this.#x[t];if(i&&s){let a=i-(Lc.now()-s);o.ttl=a,o.start=Date.now()}}if(this.#b)o.size=this.#b[t];return o}dump(){let e=[];for(let t of this.#S({allowStale:!0})){let r=this.#r[t],n=this.#e[t],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||r===void 0)continue;let i={value:o};if(this.#f&&this.#x){i.ttl=this.#f[t];let s=Lc.now()-this.#x[t];i.start=Math.floor(Date.now()-s)}if(this.#b)i.size=this.#b[t];e.unshift([r,i])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=Lc.now()-n}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r,{noUpdateTTL:c=this.noUpdateTTL}=r,u=this.#U(e,t,r.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#w(e,"set"),this}let d=this.#i===0?void 0:this.#o.get(e);if(d===void 0){if(d=this.#i===0?this.#s:this.#y.length!==0?this.#y.pop():this.#i===this.#n?this.#D(!1):this.#i,this.#r[d]=e,this.#e[d]=t,this.#o.set(e,d),this.#l[this.#s]=d,this.#d[d]=this.#s,this.#s=d,this.#i++,this.#P(d,u,a),a)a.set="add";c=!1}else{this.#C(d);let f=this.#e[d];if(t!==f){if(this.#A&&this.#t(f)){f.__abortController.abort(Error("replaced"));let{__staleWhileFetching:m}=f;if(m!==void 0&&!i){if(this.#v)this.#g?.(m,e,"set");if(this.#u)this.#a?.push([m,e,"set"])}}else if(!i){if(this.#v)this.#g?.(f,e,"set");if(this.#u)this.#a?.push([f,e,"set"])}if(this.#O(d),this.#P(d,u,a),this.#e[d]=t,a){a.set="replace";let m=f&&this.#t(f)?f.__staleWhileFetching:f;if(m!==void 0)a.oldValue=m}}else if(a)a.set="update"}if(n!==0&&!this.#f)this.#N();if(this.#f){if(!c)this.#M(d,n,o);if(a)this.#T(a,d)}if(!i&&this.#u&&this.#a){let f=this.#a,m;while(m=f?.shift())this.#h?.(...m)}return this}pop(){try{while(this.#i){let e=this.#e[this.#c];if(this.#D(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#u&&this.#a){let e=this.#a,t;while(t=e?.shift())this.#h?.(...t)}}}#D(e){let t=this.#c,r=this.#r[t],n=this.#e[t];if(this.#A&&this.#t(n))n.__abortController.abort(Error("evicted"));else if(this.#v||this.#u){if(this.#v)this.#g?.(n,r,"evict");if(this.#u)this.#a?.push([n,r,"evict"])}if(this.#O(t),e)this.#r[t]=void 0,this.#e[t]=void 0,this.#y.push(t);if(this.#i===1)this.#c=this.#s=0,this.#y.length=0;else this.#c=this.#l[t];return this.#o.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,o=this.#o.get(e);if(o!==void 0){let i=this.#e[o];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(!this.#m(o)){if(r)this.#k(o);if(n)n.has="hit",this.#T(n,o);return!0}else if(n)n.has="stale",this.#T(n,o)}else if(n)n.has="miss";return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,n=this.#o.get(e);if(n===void 0||!r&&this.#m(n))return;let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}#L(e,t,r,n){let o=t===void 0?void 0:this.#e[t];if(this.#t(o))return o;let i=new gy,{signal:s}=r;s?.addEventListener("abort",()=>i.abort(s.reason),{signal:i.signal});let a={signal:i.signal,options:r,context:n},c=(h,_=!1)=>{let{aborted:y}=i.signal,b=r.ignoreFetchAbort&&h!==void 0;if(r.status)if(y&&!_){if(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,b)r.status.fetchAbortIgnored=!0}else r.status.fetchResolved=!0;if(y&&!b&&!_)return d(i.signal.reason);let T=m;if(this.#e[t]===m)if(h===void 0)if(T.__staleWhileFetching)this.#e[t]=T.__staleWhileFetching;else this.#w(e,"fetch");else{if(r.status)r.status.fetchUpdated=!0;this.set(e,h,a.options)}return h},u=(h)=>{if(r.status)r.status.fetchRejected=!0,r.status.fetchError=h;return d(h)},d=(h)=>{let{aborted:_}=i.signal,y=_&&r.allowStaleOnFetchAbort,b=y||r.allowStaleOnFetchRejection,T=b||r.noDeleteOnFetchRejection,w=m;if(this.#e[t]===m){if(!T||w.__staleWhileFetching===void 0)this.#w(e,"fetch");else if(!y)this.#e[t]=w.__staleWhileFetching}if(b){if(r.status&&w.__staleWhileFetching!==void 0)r.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw h},f=(h,_)=>{let y=this.#R?.(e,o,a);if(y&&y instanceof Promise)y.then((b)=>h(b===void 0?void 0:b),_);i.signal.addEventListener("abort",()=>{if(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort){if(h(void 0),r.allowStaleOnFetchAbort)h=(b)=>c(b,!0)}})};if(r.status)r.status.fetchDispatched=!0;let m=new Promise(f).then(c,u),g=Object.assign(m,{__abortController:i,__staleWhileFetching:o,__returned:void 0});if(t===void 0)this.set(e,g,{...a.options,status:void 0}),t=this.#o.get(e);else this.#e[t]=g;return g}#t(e){if(!this.#A)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gy}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:h,forceRefresh:_=!1,status:y,signal:b}=t;if(!this.#A){if(y)y.fetch="get";return this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:y})}let T={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:m,status:y,signal:b},w=this.#o.get(e);if(w===void 0){if(y)y.fetch="miss";let k=this.#L(e,w,T,h);return k.__returned=k}else{let k=this.#e[w];if(this.#t(k)){let ke=r&&k.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",ke)y.returnedStale=!0}return ke?k.__staleWhileFetching:k.__returned=k}let P=this.#m(w);if(!_&&!P){if(y)y.fetch="hit";if(this.#C(w),n)this.#k(w);if(y)this.#T(y,w);return k}let te=this.#L(e,w,T,h),Oe=te.__staleWhileFetching!==void 0&&r;if(y){if(y.fetch=P?"stale":"refresh",Oe&&P)y.returnedStale=!0}return Oe?te.__staleWhileFetching:te.__returned=te}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#I;if(!r)throw Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...i}=t,s=this.get(e,i);if(!o&&s!==void 0)return s;let a=r(e,s,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=t,s=this.#o.get(e);if(s!==void 0){let a=this.#e[s],c=this.#t(a);if(i)this.#T(i,s);if(this.#m(s)){if(i)i.get="stale";if(!c){if(!o)this.#w(e,"expire");if(i&&r)i.returnedStale=!0;return r?a:void 0}else{if(i&&r&&a.__staleWhileFetching!==void 0)i.returnedStale=!0;return r?a.__staleWhileFetching:void 0}}else{if(i)i.get="hit";if(c)return a.__staleWhileFetching;if(this.#C(s),n)this.#k(s);return a}}else if(i)i.get="miss"}#j(e,t){this.#d[t]=e,this.#l[e]=t}#C(e){if(e!==this.#s){if(e===this.#c)this.#c=this.#l[e];else this.#j(this.#d[e],this.#l[e]);this.#j(this.#s,e),this.#s=e}}delete(e){return this.#w(e,"delete")}#w(e,t){let r=!1;if(this.#i!==0){let n=this.#o.get(e);if(n!==void 0)if(r=!0,this.#i===1)this.#F(t);else{this.#O(n);let o=this.#e[n];if(this.#t(o))o.__abortController.abort(Error("deleted"));else if(this.#v||this.#u){if(this.#v)this.#g?.(o,e,t);if(this.#u)this.#a?.push([o,e,t])}if(this.#o.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#s)this.#s=this.#d[n];else if(n===this.#c)this.#c=this.#l[n];else{let i=this.#d[n];this.#l[i]=this.#l[n];let s=this.#l[n];this.#d[s]=this.#d[n]}this.#i--,this.#y.push(n)}}if(this.#u&&this.#a?.length){let n=this.#a,o;while(o=n?.shift())this.#h?.(...o)}return r}clear(){return this.#F("delete")}#F(e){for(let t of this.#E({allowStale:!0})){let r=this.#e[t];if(this.#t(r))r.__abortController.abort(Error("deleted"));else{let n=this.#r[t];if(this.#v)this.#g?.(r,n,e);if(this.#u)this.#a?.push([r,n,e])}}if(this.#o.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#f&&this.#x)this.#f.fill(0),this.#x.fill(0);if(this.#b)this.#b.fill(0);if(this.#c=0,this.#s=0,this.#y.length=0,this.#_=0,this.#i=0,this.#u&&this.#a){let t=this.#a,r;while(r=t?.shift())this.#h?.(...r)}}}function Iq(e,t,r=100){let n=new hy({max:r}),o=(...i)=>{let s=t(...i),a=n.get(s);if(a!==void 0)return a;let c=e(...i);return n.set(s,c),c};return o.cache={clear:()=>n.clear(),size:()=>n.size,delete:(i)=>n.delete(i),get:(i)=>n.peek(i),has:(i)=>n.has(i)},o}var M0e=8192;function Dq(e,t){try{return{ok:!0,value:JSON.parse(my(e))}}catch(r){if(t)sh(FI(r,`safeParseJSON: invalid JSON (${r instanceof Error?r.constructor.name:typeof r}, ${e.length} bytes)`));return{ok:!1}}}var Pq=Iq(Dq,(e)=>e,50);var Mc=Object.assign(function(t,r=!0){if(!t)return null;let n=t.length>M0e?Dq(t,r):Pq(t,r);return n.ok?n.value:null},{cache:Pq.cache});import{join as U0e}from"path";var xs=re(function(){switch(no()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),Qxt=re(function(){return U0e(xs(),"managed-settings.d")});var $0e=function(){try{var e=or(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Uc=$0e;function j0e(e,t,r){if(t=="__proto__"&&Uc)Uc(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var $c=j0e;function F0e(e,t,r){if(r!==void 0&&!An(e[t],r)||r===void 0&&!(t in e))$c(e,t,r)}var Cd=F0e;function z0e(e){return function(t,r,n){var o=-1,i=Object(t),s=n(t),a=s.length;while(a--){var c=s[e?a:++o];if(r(i[c],c,i)===!1)break}return t}}var Lq=z0e;var B0e=Lq(),Nq=B0e;var yy={};lt(yy,{default:()=>Pk});var jq=typeof yy=="object"&&yy&&!yy.nodeType&&yy,Mq=jq&&typeof _y=="object"&&_y&&!_y.nodeType&&_y,H0e=Mq&&Mq.exports===jq,Uq=H0e?gt.Buffer:void 0,$q=Uq?Uq.allocUnsafe:void 0;function q0e(e,t){if(t)return e.slice();var r=e.length,n=$q?$q(r):new e.constructor(r);return e.copy(n),n}var Pk=q0e;function G0e(e){var t=new e.constructor(e.byteLength);return new Pa(t).set(new Pa(e)),t}var Fq=G0e;function W0e(e,t){var r=t?Fq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var zq=W0e;function V0e(e,t){var r=-1,n=e.length;t||(t=Array(n));while(++r<n)t[r]=e[r];return t}var Bq=V0e;var Hq=Object.create,K0e=function(){function e(){}return function(t){if(!Et(t))return{};if(Hq)return Hq(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),qq=K0e;var Z0e=Hg(Object.getPrototypeOf,Object),jc=Z0e;function J0e(e){return typeof e.constructor=="function"&&!Ma(e)?qq(jc(e)):{}}var Gq=J0e;function Y0e(e){return Qt(e)&&zo(e)}var Wq=Y0e;var X0e="[object Object]",Q0e=Function.prototype,eLe=Object.prototype,Vq=Q0e.toString,tLe=eLe.hasOwnProperty,rLe=Vq.call(Object);function nLe(e){if(!Qt(e)||vr(e)!=X0e)return!1;var t=jc(e);if(t===null)return!0;var r=tLe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Vq.call(r)==rLe}var Kq=nLe;function oLe(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var Rd=oLe;var iLe=Object.prototype,sLe=iLe.hasOwnProperty;function aLe(e,t,r){var n=e[t];if(!(sLe.call(e,t)&&An(n,r))||r===void 0&&!(t in e))$c(e,t,r)}var by=aLe;function cLe(e,t,r,n){var o=!r;r||(r={});var i=-1,s=t.length;while(++i<s){var a=t[i],c=n?n(r[a],e[a],a,r,e):void 0;if(c===void 0)c=e[a];if(o)$c(r,a,c);else by(r,a,c)}return r}var Zq=cLe;function lLe(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Jq=lLe;var uLe=Object.prototype,pLe=uLe.hasOwnProperty;function dLe(e){if(!Et(e))return Jq(e);var t=Ma(e),r=[];for(var n in e)if(!(n=="constructor"&&(t||!pLe.call(e,n))))r.push(n);return r}var Yq=dLe;function fLe(e){return zo(e)?Bg(e,!0):Yq(e)}var Fc=fLe;function mLe(e){return Zq(e,Fc(e))}var Xq=mLe;function gLe(e,t,r,n,o,i,s){var a=Rd(e,r),c=Rd(t,r),u=s.get(c);if(u){Cd(e,r,u);return}var d=i?i(a,c,r+"",e,t,s):void 0,f=d===void 0;if(f){var m=at(c),g=!m&&jo(c),h=!m&&!g&&Na(c);if(d=c,m||g||h)if(at(a))d=a;else if(Wq(a))d=Bq(a);else if(g)f=!1,d=Pk(c,!0);else if(h)f=!1,d=zq(c,!0);else d=[];else if(Kq(c)||ro(c)){if(d=a,ro(a))d=Xq(a);else if(!Et(a)||Rs(a))d=Gq(c)}else f=!1}if(f)s.set(c,d),o(d,c,n,i,s),s.delete(c);Cd(e,r,d)}var Qq=gLe;function eG(e,t,r,n,o){if(e===t)return;Nq(t,function(i,s){if(o||(o=new $o),Et(i))Qq(e,t,s,r,eG,n,o);else{var a=n?n(Rd(e,s),i,s+"",e,t,o):void 0;if(a===void 0)a=i;Cd(e,s,a)}},Fc)}var tG=eG;function hLe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var rG=hLe;var nG=Math.max;function _Le(e,t,r){return t=nG(t===void 0?e.length-1:t,0),function(){var n=arguments,o=-1,i=nG(n.length-t,0),s=Array(i);while(++o<i)s[o]=n[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=n[o];return a[t]=r(s),rG(e,this,a)}}var xy=_Le;function yLe(e){return function(){return e}}var oG=yLe;var bLe=!Uc?Fa:function(e,t){return Uc(e,"toString",{configurable:!0,enumerable:!1,value:oG(t),writable:!0})},iG=bLe;var xLe=800,vLe=16,SLe=Date.now;function ELe(e){var t=0,r=0;return function(){var n=SLe(),o=vLe-(n-r);if(r=n,o>0){if(++t>=xLe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var sG=ELe;var wLe=sG(iG),vy=wLe;function TLe(e,t){return vy(xy(e,t,Fa),e+"")}var aG=TLe;function ALe(e,t,r){if(!Et(r))return!1;var n=typeof t;if(n=="number"?zo(r)&&Fo(t,r.length):n=="string"&&(t in r))return An(r[t],e);return!1}var cG=ALe;function kLe(e){return aG(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;if(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&cG(r[0],r[1],s))i=o<3?void 0:i,o=1;t=Object(t);while(++n<o){var a=r[n];if(a)e(t,a,n,i)}return t})}var lG=kLe;var OLe=lG(function(e,t,r,n){tG(e,t,r,n)}),En=OLe;function CLe(e,t,r,n){if(!Et(e))return e;t=Bo(t,e);var o=-1,i=t.length,s=i-1,a=e;while(a!=null&&++o<i){var c=Pn(t[o]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var d=a[c];if(u=n?n(d,c,a):void 0,u===void 0)u=Et(d)?d:Fo(t[o+1])?[]:{}}by(a,c,u),a=a[c]}return e}var uG=CLe;function RLe(e,t,r){var n=-1,o=t.length,i={};while(++n<o){var s=t[n],a=ja(e,s);if(r(a,s))uG(i,Bo(s,e),a)}return i}var Sy=RLe;function ILe(e,t){return Sy(e,t,function(r,n){return eh(e,n)})}var pG=ILe;var dG=Zt?Zt.isConcatSpreadable:void 0;function PLe(e){return at(e)||ro(e)||!!(dG&&e&&e[dG])}var fG=PLe;function mG(e,t,r,n,o){var i=-1,s=e.length;r||(r=fG),o||(o=[]);while(++i<s){var a=e[i];if(t>0&&r(a))if(t>1)mG(a,t-1,r,n,o);else Da(o,a);else if(!n)o[o.length]=a}return o}var gG=mG;function DLe(e){var t=e==null?0:e.length;return t?gG(e,1):[]}var hG=DLe;function LLe(e){return vy(xy(e,void 0,hG),e+"")}var _G=LLe;var NLe=_G(function(e,t){return e==null?{}:pG(e,t)}),Ey=NLe;import{homedir as kMe}from"os";import{dirname as OMe,join as Tn,resolve as Zr}from"path";var MLe="Expected a function";function ULe(e){if(typeof e!="function")throw TypeError(MLe);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var yG=ULe;var $Le=Object.getOwnPropertySymbols,jLe=!$Le?Ng:function(e){var t=[];while(e)Da(t,Mg(e)),e=jc(e);return t},bG=jLe;function FLe(e){return Lg(e,Fc,bG)}var xG=FLe;function zLe(e,t){if(e==null)return{};var r=Qg(xG(e),function(n){return[n]});return t=th(t),Sy(e,r,function(n,o){return t(n,o[0])})}var vG=zLe;function BLe(e,t){return vG(e,yG(th(t)))}var SG=BLe;import{join as VLe}from"path";var Dk=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","ANTHROPIC_GOOGLE_CLOUD_PROJECT","ANTHROPIC_GOOGLE_CLOUD_LOCATION","ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID","CLOUD_ML_REGION"];var Lk=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL"];var Nk=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_FOUNDRY_AUTH_TOKEN","ANTHROPIC_AWS_API_KEY"],HLe=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],qLe=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT","CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT"];var GLe=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"],WLe=[...GLe,"AWS_PROFILE","AWS_CONFIG_FILE","AWS_SHARED_CREDENTIALS_FILE","GOOGLE_APPLICATION_CREDENTIALS","GOOGLE_CLOUD_PROJECT"];var qEt=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...Dk,...Lk,...Nk,...HLe,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...WLe,"GCLOUD_PROJECT","GOOGLE_CLOUD_QUOTA_PROJECT","GCE_METADATA_HOST","GCE_METADATA_IP","METADATA_SERVER_DETECTION","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","AWS_EC2_METADATA_SERVICE_ENDPOINT","AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE","AWS_REGION","AWS_DEFAULT_REGION",...qLe,"ANTHROPIC_BEDROCK_SERVICE_TIER","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK"]);var KLe="remote-settings.json",Mk=null,ZLe;var JLe=null,YLe=null;function Uk(){return}function XLe(){return Uk()??VLe(Yt(),KLe)}function QLe(){try{let e=bs(XLe()),t=yt(my(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return t}catch{return null}}var eNe=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...Dk,...Lk,"CLAUDE_CODE_CUSTOM_OAUTH_URL",...Nk,"ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE"].map((e)=>e.toUpperCase()));function tNe(e){if(!e?.env)return e;let t=SG(e.env,(r,n)=>eNe.has(n.toUpperCase()));return{...e,env:t}}function rNe(){if(!Uk()&&ZLe!==!0)return null;if(Mk)return Mk;let e=QLe();if(e)return Mk=e,YLe??=e,qi(),e;return null}function EG(){let e=rNe();if(e===JLe||Uk())return e;return tNe(e)}var wG=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];import{userInfo as nNe}from"os";var TG="com.anthropic.claudecode",Id="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Pd="HKCU\\SOFTWARE\\Policies\\ClaudeCode",pi="Settings",AG="/usr/bin/plutil",kG=["-convert","json","-o","-","--"],OG=5000,$k="/mnt/c/Windows/System32/reg.exe",zc="/mnt/c/Program Files/ClaudeCode";function wy(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=be("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function CG(){let e="";try{e=nNe().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${TG}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${TG}.plist`,label:"device-level managed preferences"}),t}import{isAbsolute as RG}from"path";var oNe=C(()=>l.object({allowedDomains:l.array(l.string()).optional(),deniedDomains:l.array(l.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),strictAllowlist:l.boolean().optional().describe("When true, the sandbox runtime deterministically denies hosts not in allowedDomains instead of prompting. "+"Enforced for sandboxed commands only — in-process tools such as WebFetch are not gated by this setting. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),allowManagedDomainsOnly:l.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:l.array(l.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:l.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:l.boolean().optional(),allowMachLookup:l.array(l.string().refine((e)=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:l.number().optional(),socksProxyPort:l.number().optional(),tlsTerminate:l.object({caCertPath:l.string().min(1).optional(),caKeyPath:l.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — project settings "+"(.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),iNe=C(()=>l.object({allowWrite:l.array(l.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:l.array(l.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:l.array(l.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:l.array(l.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:l.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used."),disabled:l.boolean().optional().describe("macOS and Linux/WSL only: skip filesystem isolation entirely while keeping network and seccomp isolation. Ignored on native Windows, where the sandboxed process runs as a separate user with no inherent rights, so skipping the filesystem rules would "+"withhold every access grant rather than loosen them — filesystem isolation stays on there. "+"Sandboxed commands get unrestricted read/write access to the host filesystem; network egress is still confined to network.allowedDomains. Intended for deployments whose goal is egress control rather than filesystem containment. Does not change Bash prompting: sandbox.autoAllowBashIfSandboxed is independent and still defaults to true, so set it to false to keep prompting for sandboxed commands. Drops the read protection from filesystem.denyRead and credentials.files for sandboxed commands, since both are enforced by the filesystem layer this turns off; credentials.envVars deny/mask is unaffected. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. If managed settings configure sandbox.filesystem at all, or list any sandbox.credentials.files entry, only managed settings can set this: an admin who deployed filesystem restrictions must not have them switched off by a user-writable "+"file. (sandbox.credentials.envVars does not pin it — env scrubbing is independent of "+"the filesystem layer and survives this setting.) When unset, filesystem isolation stays on.")}).optional()),jk=C(()=>l.object({path:l.string().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:l.literal("deny").describe("Access mode for this path. Only `deny` is supported.")})),Fk=C(()=>l.object({name:l.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores").describe("Environment variable name."),mode:l.enum(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the "+"host proxy swaps sentinel→real on egress to `injectHosts`."),injectHosts:l.array(l.string()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")})),sNe=C(()=>l.object({files:l.array(jk()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox."),envVars:l.array(Fk()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:l.boolean().optional().describe("Allow sentinel→real substitution on the plain-HTTP proxy path. "+"Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored.")}).optional()),zk=C(()=>l.object({enabled:l.boolean().optional(),failIfUnavailable:l.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:l.boolean().optional(),allowUnsandboxedCommands:l.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:oNe(),filesystem:iNe(),credentials:sNe(),ignoreViolations:l.record(l.string(),l.array(l.string())).optional(),enableWeakerNestedSandbox:l.boolean().optional(),enableWeakerNetworkIsolation:l.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:l.boolean().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. "+"**Removes code-execution isolation** — sandboxed commands can launch other applications "+"unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:l.array(l.string()).optional(),ripgrep:l.object({command:l.string(),args:l.array(l.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:l.preprocess((e)=>typeof e==="string"&&RG(e)?e:void 0,l.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:l.preprocess((e)=>typeof e==="string"&&RG(e)?e:void 0,l.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var Dd=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],IG=[...Dd],PG=IG;function Ld(e){return e==="manual"?"default":e}var pwt=`Cannot set permission mode: must be one of ${IG.join(", ")}`;var DG=["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"],LG=["normal","vim"],NG=["auto","tmux","iterm2","in-process"],aNe=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],MG=["auto",...aNe];var gwt=no()==="macos"?"⏺":"●";var Ewt=C(()=>ru.preprocess(Ld,ru.enum(PG))),wwt=C(()=>ru.preprocess(Ld,ru.enum(Dd)));var UG=["bash","powershell"];var Nd=C(()=>l.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function cNe(){let e=l.object({type:l.literal("command").describe("Shell command hook type"),command:l.string().describe("Shell command to execute"),args:l.array(l.string()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:Nd(),shell:l.enum(UG).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:l.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:l.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:l.string().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:l.string().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".')}),t=l.object({type:l.literal("prompt").describe("LLM prompt hook type"),prompt:l.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:l.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:l.boolean().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),r=l.object({type:l.literal("mcp_tool").describe("MCP tool hook type"),server:l.string().describe("Name of an already-configured MCP server to invoke"),tool:l.string().describe("Name of the tool on that server to call"),input:l.record(l.string(),l.unknown()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),n=l.object({type:l.literal("http").describe("HTTP hook type"),url:l.string().url().describe("URL to POST the hook input JSON to"),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:l.record(l.string(),l.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:l.array(l.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),o=l.object({type:l.literal("agent").describe("Agentic verifier hook type"),prompt:l.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:l.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:n,AgentHookSchema:o,McpToolHookSchema:r}}var $G=C(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:r,HttpHookSchema:n,McpToolHookSchema:o}=cNe();return l.discriminatedUnion("type",[e,t,r,n,o])}),jG=C(()=>l.object({matcher:l.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:l.array($G()).describe("List of hooks to execute when the matcher matches")})),vs=C(()=>l.partialRecord(l.enum(Os),l.array(jG())));var Lwt=C(()=>l.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),Nwt=C(()=>l.enum(["stdio","sse","sse-ide","http","ws","sdk"])),Bc=C(()=>l.literal("comms").optional().catch(void 0)),di=C(()=>l.number().int().positive()),lNe=300000,FG=C(()=>l.number().int().positive().optional().catch(void 0).describe("@internal CCR backend wire hint; folded into timeout at parse."));function zG({request_timeout_ms:e,...t}){return{...t,...t.timeout===void 0&&e!==void 0&&{timeout:Math.min(e,lNe)}}}var uNe=C(()=>l.object({type:l.literal("stdio").optional(),command:l.string().min(1,"Command cannot be empty"),args:l.array(l.string()).default([]),env:l.record(l.string(),l.string()).optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),pNe=C(()=>l.boolean()),BG=C(()=>l.object({clientId:l.string().optional(),callbackPort:l.number().int().positive().optional(),authServerMetadataUrl:l.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:l.string().min(1).optional(),xaa:pNe().optional()})),HG=C(()=>l.object({name:l.string(),permission_policy:l.enum(["always_allow","always_ask","always_deny"]).optional()})),dNe=C(()=>l.object({type:l.literal("sse"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:BG().optional(),timeout:di().optional(),request_timeout_ms:FG(),tools:l.array(HG()).optional(),alwaysLoad:l.boolean().optional(),role:Bc(),toolPermissions:l.record(l.string(),Bk()).optional(),discoveryCache:l.boolean().optional()}).transform(zG)),fNe=C(()=>l.object({type:l.literal("sse-ide"),url:l.string(),ideName:l.string(),ideRunningInWindows:l.boolean().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),mNe=C(()=>l.object({type:l.literal("ws-ide"),url:l.string(),ideName:l.string(),authToken:l.string().optional(),ideRunningInWindows:l.boolean().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),gNe=C(()=>l.object({type:l.enum(["http","streamable-http"]).transform(()=>"http"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:BG().optional(),timeout:di().optional(),request_timeout_ms:FG(),tools:l.array(HG()).optional(),alwaysLoad:l.boolean().optional(),role:Bc(),toolPermissions:l.record(l.string(),Bk()).optional(),discoveryCache:l.boolean().optional()}).transform(zG)),hNe=C(()=>l.object({type:l.literal("ws"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),_Ne=C(()=>l.object({type:l.literal("sdk"),name:l.string(),timeout:di().optional(),alwaysLoad:l.boolean().optional()})),Bk=C(()=>l.enum(["allow","ask","blocked"])),yNe=C(()=>l.object({type:l.literal("claudeai-proxy"),url:l.string(),id:l.string(),displayName:l.string().optional(),iconUrl:l.string().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),toolPermissions:l.record(l.string(),Bk()).optional(),stateless:l.boolean().optional(),cachedInitResponse:l.record(l.string(),l.unknown()).nullish(),eligible:l.boolean().nullish(),ineligibleReason:l.string().nullish()})),Ty=C(()=>l.union([uNe(),dNe(),fNe(),mNe(),gNe(),hNe(),_Ne(),yNe()]));var Mwt=C(()=>l.object({mcpServers:l.record(l.string(),Ty())}));var bNe=new Set(["claude-community","claude-plugins-community","healthcare"]),xNe=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins","first-party-plugins"]),VG=new Set([...xNe,...bNe]);var vNe=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,SNe=/[^\u0020-\u007E]/;function ENe(e){if(VG.has(e.toLowerCase()))return!1;if(SNe.test(e))return!0;return vNe.test(e)}var wn=C(()=>l.string().startsWith("./")),Ss=C(()=>wn().endsWith(".json")),qG=C(()=>l.union([wn().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),l.string().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),qk=C(()=>wn().endsWith(".md")),Gk=C(()=>l.union([qk(),wn()])),KG=C(()=>l.string().min(1,"Marketplace must have a name").refine((e)=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine((e)=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine((e)=>!ENe(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine((e)=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine((e)=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine((e)=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Wk=C(()=>l.object({name:l.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:l.string().optional().describe("Contact email for support or feedback"),url:l.string().optional().describe("Website, GitHub profile, or organization URL")})),wNe=C(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:l.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:l.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:l.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Wk().optional().describe("Information about the plugin creator or maintainer"),homepage:l.string().url().optional().describe("Plugin homepage or documentation URL"),repository:l.string().optional().describe("Source code repository URL"),license:l.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:l.array(l.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:l.boolean().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:l.array(oMe()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),Kwt=C(()=>l.object({description:l.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:l.lazy(()=>vs()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),TNe=C(()=>l.object({hooks:l.union([Ss().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>vs()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),l.array(l.union([Ss().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>vs()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),ANe=C(()=>l.object({source:Gk().optional().describe("Path to command markdown file, relative to plugin root"),content:l.string().optional().describe("Inline markdown content for the command"),description:l.string().optional().describe("Command description override"),argumentHint:l.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:l.string().optional().describe("Default model for this command"),allowedTools:l.array(l.string()).optional().describe("Tools allowed when command runs")}).refine((e)=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),kNe=C(()=>l.object({commands:l.union([Gk().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),l.array(Gk().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),l.record(l.string(),ANe()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),ONe=C(()=>l.object({agents:l.union([qk().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),l.array(qk().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),CNe=C(()=>l.object({skills:l.union([wn().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan)."),l.array(wn().describe("Path to a skill directory, relative to the plugin root.")).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),ZG=C(()=>l.object({outputStyles:l.union([wn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),l.array(wn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),RNe=C(()=>l.string().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),INe=16,PNe=C(()=>l.object({id:RNe(),remote:l.string().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:l.string().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),DNe=C(()=>l.object({syntaxHighlighting:l.object({hljsLanguages:l.array(PNe()).max(INe)}).strict()})),JG=C(()=>l.object({themes:l.union([wn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),l.array(wn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),LNe=C(()=>l.object({})),GG=C(()=>l.string().min(1)),NNe=C(()=>l.string().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),MNe=C(()=>l.object({mcpServers:l.union([Ss().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),qG().describe("Path or URL to MCPB file containing MCP server configuration"),l.record(l.string(),Ty()).describe("MCP server configurations keyed by server name"),l.array(l.union([Ss().describe("Path to MCP servers configuration file"),qG().describe("Path or URL to MCPB file"),l.record(l.string(),Ty()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),YG=C(()=>l.object({type:l.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:l.string().describe("Human-readable label shown in the config dialog"),description:l.string().describe("Help text shown beneath the field in the config dialog"),required:l.boolean().optional().describe("If true, validation fails when this field is empty"),default:l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]).optional().describe("Default value used when the user provides nothing"),multiple:l.boolean().optional().describe("For string type: allow an array of strings"),sensitive:l.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:l.number().optional().describe("Minimum value (number type only)"),max:l.number().optional().describe("Maximum value (number type only)")}).strict()),UNe=C(()=>l.object({userConfig:l.record(l.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),YG()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),$Ne=C(()=>l.object({channels:l.array(l.object({server:l.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:l.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:l.record(l.string(),YG()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),WG=C(()=>l.strictObject({command:l.string().min(1).refine((e)=>{if(e.includes(" ")&&!e.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:l.array(GG()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:l.record(NNe(),GG()).refine((e)=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:l.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:l.record(l.string(),l.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:l.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:l.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:l.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:l.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:l.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:l.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:l.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:l.boolean().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),jNe=C(()=>l.strictObject({name:l.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:l.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:l.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:l.union([l.literal("always"),l.string().startsWith("on-skill-invoke:").refine((e)=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),FNe=C(()=>l.array(jNe()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),XG=C(()=>l.object({monitors:l.union([Ss().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),FNe()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),zNe=C(()=>l.object({lspServers:l.union([Ss().describe("Path to .lsp.json configuration file relative to plugin root"),l.record(l.string(),WG()).describe("LSP server configurations keyed by server name"),l.array(l.union([Ss().describe("Path to LSP configuration file"),l.record(l.string(),WG()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),QG=C(()=>l.string().refine((e)=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine((e)=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,r=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||r.test(e)},"Invalid npm package name format")),BNe=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,HNe=/^[0-9a-f]{64}$/;var qNe=64;var GNe=C(()=>l.object({sha256:l.string().regex(HNe)}));function WNe(e){let t=l.record(l.string(),l.unknown()).safeParse(e);if(!t.success)return;let r=Object.create(null),n=0;for(let[o,i]of Object.entries(t.data)){if(n>=qNe)break;let s=GNe().safeParse(i);if(BNe.test(o)&&s.success)r[o]=s.data,n++}return n>0?r:void 0}var VNe=C(()=>l.object({binaries:l.unknown().transform(WNe).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),KNe=C(()=>l.object({settings:l.record(l.string(),l.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),ZNe=C(()=>l.object({experimental:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,l.object({...JG().partial().shape,...DNe().partial().shape,...XG().partial().shape,...ZG().partial().shape,evals:l.union([l.string(),l.array(l.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))}));var JNe=C(()=>l.object({...wNe().shape,...TNe().partial().shape,...kNe().partial().shape,...ONe().partial().shape,...CNe().partial().shape,...ZG().partial().shape,...JG().partial().shape,...LNe().shape,...$Ne().partial().shape,...MNe().partial().shape,...zNe().partial().shape,...XG().partial().shape,...KNe().partial().shape,...UNe().partial().shape,...VNe().partial().shape,...ZNe().partial().shape})),Md=C(()=>l.discriminatedUnion("source",[l.object({source:l.literal("url"),url:l.string().url().describe("Direct URL to marketplace.json file"),headers:l.record(l.string(),l.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:l.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),l.object({source:l.literal("git"),url:l.string().describe("Full git repository URL"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:l.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),l.object({source:l.literal("npm"),package:QG().describe("NPM package containing marketplace.json")}),l.object({source:l.literal("file"),path:l.string().describe("Local file path to marketplace.json")}),l.object({source:l.literal("directory"),path:l.string().describe("Local directory containing .claude-plugin/marketplace.json")}),l.object({source:l.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),l.object({source:l.literal("hostPattern"),hostPattern:l.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),l.object({source:l.literal("pathPattern"),pathPattern:l.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),l.object({source:l.literal("settings"),name:KG().refine((e)=>!VG.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:l.array(YNe()).describe("Plugin entries declared inline in settings.json"),owner:Wk().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Hk=C(()=>l.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),e6=C(()=>l.union([l.preprocess((e)=>e==="."?"./":e,wn()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),l.object({source:l.literal("npm"),package:QG().or(l.string().refine((e)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:l.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:l.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),l.object({source:l.literal("url"),url:l.string().describe("Full git repository URL (https:// or git@)"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("git-subdir"),url:l.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:l.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),l.object({source:l.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. Never authored by hand — PluginMarketplaceSchema rewrites "+'unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),YNe=C(()=>l.object({name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:e6().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:l.string().optional(),version:l.string().optional(),strict:l.boolean().optional()}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine((e)=>typeof e.source==="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."}));var XNe=C(()=>l.object({cli:l.array(l.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:l.array(l.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filesRead:l.array(l.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) — the plugin is relevant when a file Claude has read '+"this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive."),manifestDeps:l.array(l.object({file:l.string().max(256),pattern:l.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:l.array(l.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) — the plugin is relevant when the '+`session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),QNe=C(()=>l.object({topic:l.string().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:XNe().optional().describe("Matchers that determine when the plugin is relevant.")})),eMe=C(()=>JNe().partial().extend({name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:e6().describe("Where to fetch the plugin from"),category:l.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:l.array(l.string()).optional().describe("Tags for searchability and discovery"),strict:l.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,QNe().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),tMe=C(()=>l.object({name:l.string().min(1).refine((e)=>!e.includes(" "))}));function rMe(e){let t=eMe();return e.flatMap((r,n)=>{let o=t.safeParse(r);if(o.success)return[o.data];let i=tMe().safeParse(r).data?.name,s=o.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(i)return ce(`Stubbing unparseable marketplace plugin entry (${i}): ${s}`,{level:"warn"}),[{name:i,source:{source:"unsupported"},strict:!0}];return ce(`Dropping unparseable marketplace plugin entry (index ${n}): ${s}`,{level:"warn"}),[]})}var Zwt=C(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:KG(),version:l.string().optional().describe("Marketplace manifest version"),description:l.string().optional().describe("Human-readable description of this marketplace"),owner:Wk().describe("Marketplace maintainer or curator information"),plugins:l.array(l.unknown()).transform(rMe).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:l.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:l.object({pluginRoot:l.string().optional().describe("Base path for relative plugin sources"),version:l.string().optional().describe("Marketplace version"),description:l.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:l.array(l.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust."),renames:l.record(l.string(),l.string().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name → current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),t6=C(()=>l.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),nMe=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,oMe=C(()=>l.union([l.string().regex(nMe,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),l.object({name:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),iMe=C(()=>l.object({version:l.string().describe("Currently installed version"),installedAt:l.string().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),installPath:l.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:l.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),Jwt=C(()=>l.object({version:l.literal(1).describe("Schema version 1"),plugins:l.record(t6(),iMe()).describe("Map of plugin IDs to their installation metadata")})),sMe=C(()=>l.enum(["managed","user","project","local"])),aMe=C(()=>l.object({scope:sMe().describe("Installation scope"),projectPath:l.string().optional().describe("Project path (required for project/local scopes)"),installPath:l.string().describe("Absolute path to the versioned plugin directory"),version:l.string().optional().describe("Currently installed version"),installedAt:l.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to"),auto:l.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),Ywt=C(()=>l.object({version:l.literal(2).describe("Schema version 2"),plugins:l.record(t6(),l.array(aMe())).describe("Map of plugin IDs to arrays of installation entries")})),cMe=C(()=>l.object({source:Md().describe("Where to fetch the marketplace from"),installLocation:l.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:l.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Xwt=C(()=>l.record(l.string(),cMe()));var lMe=["autoMode","deepLink","voice","briefView","screenReader"],Vk={},Ay={autoMode:{buildGate:()=>!1,shape:()=>Vk,permissionsShape:()=>Vk,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:l.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!0,shape:()=>({voiceEnabled:l.boolean().optional().describe("Enable voice mode (hold-to-talk dictation)")})},briefView:{buildGate:()=>!0,shape:()=>({defaultView:l.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>Vk}};function Kk(){return lMe.filter((e)=>Ay[e].buildGate())}function r6(e){let t={};for(let r of e)t={...t,...Ay[r].shape()};return t}function n6(e){let t={};for(let r of e)t={...t,...Ay[r].permissionsShape?.()};return t}function o6(e){let t=[];for(let r of e)t.push(...Ay[r].permissionModes?.()??[]);return t}function Zk(e){let t=e.split("__"),[r,n,...o]=t;if(r!=="mcp"||!n)return null;let i=o.length>0?o.join("__"):void 0;return{serverName:n,toolName:i}}var i6={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};function Hc(e){return Object.hasOwn(i6,e)?i6[e]:e}var s6="workspace",lTt=`mcp__${s6}__bash`,uTt=`mcp__${s6}__web_fetch`;function Jk(e){return e.includes("*")}function uMe(e){return e.replaceAll("\\","\\\\").replaceAll("(","\\(").replaceAll(")","\\)")}function pMe(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function a6(e){let t=dMe(e,"(");if(t===-1)return{toolName:Hc(e)};let r=fMe(e,")");if(r===-1||r<=t)return{toolName:Hc(e)};if(r!==e.length-1)return{toolName:Hc(e)};let n=e.substring(0,t),o=e.substring(t+1,r);if(!n)return{toolName:Hc(e)};if(o===""||o==="*")return{toolName:Hc(n)};let i=pMe(o);return{toolName:Hc(n),ruleContent:i}}function Yk(e){if(!e.ruleContent)return e.toolName;let t=uMe(e.ruleContent);return`${e.toolName}(${t})`}function dMe(e,t){for(let r=0;r<e.length;r++)if(e[r]===t){let n=0,o=r-1;while(o>=0&&e[o]==="\\")n++,o--;if(n%2===0)return r}return-1}function fMe(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){let n=0,o=r-1;while(o>=0&&e[o]==="\\")n++,o--;if(n%2===0)return r}return-1}var ky={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:(e)=>{if(e.includes("*")||e.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:(e)=>{if(e.includes("://")||e.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!e.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function c6(e){return ky.filePatternTools.includes(e)}function l6(e){return ky.bashPrefixTools.includes(e)}function u6(e){return Object.hasOwn(ky.customValidation,e)?ky.customValidation[e]:void 0}function d6(e,t){let r=0,n=t-1;while(n>=0&&e[n]==="\\")r++,n--;return r%2!==0}function Xk(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t&&!d6(e,n))r++;return r}function mMe(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!d6(e,t))return!0}return!1}function p6(e){if(!Jk(e))return null;let t=Zk(e);if(t&&!Jk(t.serverName))return null;return{valid:!1,error:`Wildcard tool name "${e}" is not supported in allow rules`,suggestion:"An allow pattern must name the scope it widens — globs are permitted only in the tool position after a literal mcp__<server>__ prefix. Deny and ask rules accept wildcards anywhere",examples:["mcp__puppeteer__*","mcp__github__get_*"]}}function Qk(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let r=Xk(e,"("),n=Xk(e,")");if(r!==n)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(mMe(e)){let a=e.substring(0,e.indexOf("("));if(!a)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${a}" without parentheses`,examples:[`${a}`,`${a}(some-pattern)`]}}let o=a6(e),i=Zk(o.toolName);if(i){if(o.ruleContent!==void 0||Xk(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${o.toolName}" without parentheses, or use "mcp__${i.serverName}__*" for all tools`,examples:[`mcp__${i.serverName}`,`mcp__${i.serverName}__*`,i.toolName&&i.toolName!=="*"?`mcp__${i.serverName}__${i.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let a=p6(o.toolName);if(a)return a}return{valid:!0}}if(!o.toolName||o.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let a=p6(o.toolName);if(a)return a}if(!o.toolName.includes("_")&&o.toolName[0]!==o.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${qy(String(o.toolName))}"`};let s=u6(o.toolName);if(s&&o.ruleContent!==void 0){let a=s(o.ruleContent);if(!a.valid)return a}if(l6(o.toolName)&&o.ruleContent!==void 0){let a=o.ruleContent;if(a.includes(":*")&&!a.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(a===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}if(c6(o.toolName)&&o.ruleContent!==void 0){if(o.ruleContent.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${o.toolName}(*.ts) - matches .ts files`,`${o.toolName}(src/**) - matches all files in src`,`${o.toolName}(**/*.test.ts) - matches test files`]}}if(o.ruleContent!==void 0){let a=o.toolName==="Write"||o.toolName==="NotebookEdit"||o.toolName==="MultiEdit"?"Edit":o.toolName==="Glob"?"Read":void 0;if(a!==void 0&&!o.ruleContent.includes(":*"))return{valid:!0,warning:`${Yk(o)} is not matched by file permission checks — only ${a}(path) rules are. Use ${Yk({toolName:a,ruleContent:o.ruleContent})} instead (${a} rules cover all file-${a==="Edit"?"editing":"reading"} tools).`}}return{valid:!0}}var eO=C(()=>m6()),f6=C(()=>m6("allow"));function m6(e){return l.string().superRefine((t,r)=>{let n=Qk(t,e);if(!n.valid){let o=n.error;if(n.suggestion)o+=`. ${n.suggestion}`;if(n.examples&&n.examples.length>0)o+=`. Examples: ${n.examples.join(", ")}`;r.addIssue({code:l.ZodIssueCode.custom,message:o,params:{received:t}})}})}var gMe=C(()=>l.record(l.string(),l.coerce.string()));function b6(e){return l.object({allow:l.array(f6()).optional().describe("List of permission rules for allowed operations"),deny:l.array(eO()).optional().describe("List of permission rules for denied operations"),ask:l.array(eO()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:l.preprocess(Ld,l.enum([...Dd,...o6(e)])).optional().describe("Default permission mode when Claude Code needs access ('manual' is accepted as an alias for 'default')"),disableBypassPermissionsMode:l.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...n6(e),additionalDirectories:l.array(l.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var PTt=C(()=>b6(Kk())),hMe=C(()=>l.object({source:Md().describe("Where to fetch the marketplace from"),installLocation:l.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Oy=C(()=>l.object({serverName:l.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:l.array(l.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>jS([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),Cy=C(()=>l.object({serverName:l.string().min(1,"Server name must be non-empty").refine((e)=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine((e)=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:l.array(l.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>jS([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),_Me=C(()=>l.object({path:l.string().describe("Absolute path to the helper executable"),timeoutMs:l.number().int().min(1000).optional(),refreshIntervalMs:l.union([l.literal(0),l.number().int().min(60000)]).optional()})),g6=["skills","agents","hooks","mcp"],h6=Object.freeze({type:"invalid-entry-stripped"}),yMe=C(()=>l.union([l.object({type:l.literal("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:l.string().describe("Regex matched against turn output (tool results and assistant text)"),url:l.string().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:l.string().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),l.object({type:l.string().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));function x6(e){return l.object({$schema:l.string().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:l.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:l.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:l.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:l.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:l.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),processWrapper:l.string().optional().describe("Corporate launcher argv prefix for the background-agent supervisor, the sessions and workers it hosts, and the other covered background processes listed in the Claude Code corporate-launcher documentation. Equivalent to the CLAUDE_CODE_PROCESS_WRAPPER environment variable, which takes precedence when set. Honored from managed settings, a --settings/SDK-supplied settings file, and user settings, in that precedence order; project and local settings are ignored."),policyHelper:_Me().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...Hr.CLAUDE_CODE_ENABLE_XAA&&{xaaIdp:l.object({issuer:l.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:l.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:l.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:l.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:l.object({enabled:l.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:l.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 30). Re-fires every interval until you take a break."),breakThresholdMinutes:l.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 10)"),message:l.string().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:l.object({enabled:l.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:l.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:l.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:l.number().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),skillListingMaxDescChars:l.number().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:l.number().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:l.boolean().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:gMe().optional().describe("Environment variables to set for Claude Code sessions"),attribution:l.object({commit:l.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:l.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:l.boolean().optional().describe("Whether to append the claude.ai session link to commits and PRs created from web or Remote Control sessions (default: true). Set to false to omit the Claude-Session trailer and PR-body link.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:l.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,includeGitInstructions:l.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:b6(e).optional().describe("Tool usage permissions configuration"),model:l.string().optional().describe("Override the default model used by Claude Code"),fallbackModel:l.array(l.string()).optional().describe('Fallback model(s) tried in order when the primary model is overloaded or unavailable. Each element accepts a model name or alias; "default" expands to the default model. CLI --fallback-model takes precedence.'),availableModels:l.array(l.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),enforceAvailableModels:l.boolean().optional().describe("When true and availableModels is a non-empty array, the Default model selection is also constrained: if the default model for the user tier is not in availableModels, Default resolves to the first allowed availableModels entry instead. Has no effect when availableModels is unset or an empty array. Typically set in managed settings by enterprise administrators."),modelOverrides:l.record(l.string(),l.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:l.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:l.array(l.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:l.array(l.string()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:l.boolean().optional().describe("When true in any settings source, claude.ai MCP cloud connectors are not auto-fetched or connected. "+"Only gates auto-fetched connectors — a claudeai-proxy server passed explicitly "+"(e.g. via --mcp-config or the SDK mcpServers option) still follows the normal MCP config trust flow. Any-source-true wins: a project can opt out, but a project-level false cannot override a user-level true."),skillOverrides:l.record(l.string(),l.enum(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),disableBundledSkills:l.boolean().optional().describe("Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely; built-in slash commands stay typable but are hidden from the model. Plugins, .claude/skills/, and .claude/commands/ are unaffected. Equivalent to CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1."),allowedMcpServers:l.array(Oy()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:l.array(Cy()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:vs().optional().describe("Custom commands to run before/after tool executions"),worktree:l.object({symlinkDirectories:l.array(l.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:l.array(l.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:l.enum(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:l.enum(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:l.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:l.boolean().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:l.boolean().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:l.boolean().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:l.boolean().optional().describe("Disable the Artifact tool (also via CLAUDE_CODE_DISABLE_ARTIFACT)."),enableArtifact:l.boolean().optional().describe("Enable or disable the Artifact tool for this user. Unset defaults to enabled once the feature is available."),enableWorkflows:l.boolean().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowSizeGuideline:l.enum(["unrestricted","small","medium","large"]).optional().describe('Advisory size guideline for the dynamic workflows Claude writes: "small" aims for fewer than 5 agents, "medium" (the default) fewer than 15, "large" fewer than 50, and "unrestricted" sends no guideline. A value here — including from managed settings — takes precedence over the "Dynamic workflow size" choice in /config, and that /config row is hidden while a settings file provides the key. This is a guideline, not an enforced limit.'),workflowKeywordTriggerEnabled:l.boolean().optional().describe('Enable the "ultracode" keyword trigger: including the keyword in a prompt opts that turn into the Workflow tool. Set to false to disable the trigger. Default: true.'),disableSkillShellExecution:l.boolean().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:l.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),respondToBashCommands:l.boolean().optional().describe("Whether Claude responds after an input-box ! bash command runs. Set to false to add the command output to context without a response. Default: true."),allowManagedHooksOnly:l.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:l.array(l.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:l.array(l.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:l.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:l.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:l.boolean().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:l.preprocess((t)=>Array.isArray(t)?t.filter((r)=>g6.includes(r)):t,l.union([l.boolean(),l.array(l.enum(g6))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:l.object({type:l.literal("command"),command:l.string(),padding:l.number().optional(),refreshInterval:l.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:l.boolean().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:l.string().optional().describe('URL template for PR links in the footer link badges and inline messages. The detected git PR is rendered as the first footer-link badge. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),footerLinksRegexes:l.array(yMe().catch(h6)).transform((t)=>t.filter((r)=>r!==h6)).optional().catch(void 0).describe("Extra clickable footer badges that appear when a regex matches turn output (tool results and assistant responses). Read from user, flag, and managed settings only; ignored in project .claude/settings.json and local .claude/settings.local.json. At most 5 badges render; the oldest is displaced by newer matches and /clear removes them. Use to surface IDs printed by project CLIs as session links."),subagentStatusLine:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:l.record(l.string(),l.union([l.array(l.string()),l.boolean(),l.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:l.record(l.string(),hMe()).check((t)=>{for(let[r,n]of Object.entries(t.value))if(n.source.source==="settings"&&n.source.name!==r)t.issues.push({code:"custom",input:n.source.name,path:[r,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${r}" but source.name "${n.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:l.array(Md()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. "+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:l.array(Md()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),disableSideloadFlags:l.boolean().optional().describe("When true (and set in managed settings), rejects the --plugin-dir, --plugin-url, --agents, and non-sdk --mcp-config CLI flags at startup. Closes the CLI-flag bypass of strictKnownMarketplaces. Pair with allowedMcpServers for per-server MCP control; this setting does not gate other MCP entry points (SDK setMcpServers, claude mcp add, .mcp.json). Also blocks surfaces that spawn the CLI with these flags internally (see settings documentation). Only honored from managed settings; ignored in user/project/local settings."),pluginSuggestionMarketplaces:l.array(l.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips). No marketplace-declared suggestions surface without this allowlist; the built-in first-party frontend-design tip is unaffected. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored. The official marketplace is exempt from the source requirement: allowlisting its name alone suffices, since that name can only register from the official Anthropic source."),forceLoginMethod:l.enum(["claudeai","console","gateway"]).optional().catch(void 0).describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing, "gateway" for the Cloud gateway OIDC device flow'),forceLoginGatewayUrl:l.string().url().optional().catch(void 0).describe('@internal Cloud gateway URL to pre-fill and auto-connect to during login. Typically set in local managed settings alongside forceLoginMethod: "gateway" so users never type the URL. Hidden from public SDK types until Cloud gateway is documented.'),parentSettingsBehavior:l.enum(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),forceLoginOrgUUID:l.union([l.string(),l.array(l.string())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:l.boolean().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:l.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:l.string().optional().describe("Controls the output style for assistant responses"),viewMode:l.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:l.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:l.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:zk().optional(),feedbackSurveyRate:l.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),feedbackDrafts:l.enum(["notify","quiet","off"]).optional().describe('Model-drafted feedback (the SendFeedback tool). "notify" (default) shows a one-line notice when a draft is queued; "quiet" shows only the footer counter; "off" disables the tool entirely so drafts are never queued.'),spinnerTipsEnabled:l.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:l.object({mode:l.enum(["append","replace"]),verbs:l.array(l.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:l.object({excludeDefault:l.boolean().optional(),tips:l.array(l.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:l.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:l.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:l.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:l.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),ultracode:l.boolean().optional().catch(void 0).describe("Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. "+"Session-scoped — typically provided via --settings or the apply_flag_settings control request; "+"interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model."),autoCompactWindow:l.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:l.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:l.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:l.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:l.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),emojiCompletionEnabled:l.boolean().optional().describe("When false, the :emoji: shortcode typeahead (the suggestion popup and the :name: inline replacement) is disabled. When absent or true, it is enabled."),awaySummaryEnabled:l.boolean().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:l.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),askUserQuestionTimeout:l.enum(["60s","5m","10m","never"]).optional().catch(void 0).describe("Idle time before Claude's questions auto-continue with any answers "+"selected so far. Defaults to never — auto-continue only runs "+"when explicitly set to 60s/5m/10m."),agent:l.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:l.array(l.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:l.record(l.string(),l.object({mcpServers:l.record(l.string(),l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(l.undefined())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:l.object({defaultEnvironmentId:l.string().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:l.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:l.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:l.string().optional().describe("Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup with instructions to update. Only enforced from managed (policy) settings."),requiredMaximumVersion:l.string().optional().describe("Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. Only enforced from managed (policy) settings."),plansDirectory:l.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:l.enum(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:l.object({enabled:l.boolean().optional(),mode:l.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:l.boolean().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:l.boolean().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:l.array(l.object({marketplace:l.string(),plugin:l.string()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:l.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:l.boolean().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),totalTokensReminder:l.enum(["off","infinite","fixed","countdown","padded-countdown"]).optional().describe("@internal Emit a <total_tokens>N tokens left</total_tokens> block in the system prompt, after each tool result, and (when totalTokensReminderAfterUserTurn is on) after each regular user prompt. 'infinite' uses the literal value Infinite, 'fixed' uses 5000000, 'countdown' uses the live remaining context-window tokens, 'padded-countdown' counts down from totalTokensReminderBudget (re-anchoring to the full budget on each regular user prompt when totalTokensReminderAfterUserTurn "+"is on — task-budget semantics). Defaults to off. Env var "+"CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:l.number().int().positive().optional().describe("@internal Starting budget (tokens) for totalTokensReminder 'padded-countdown' mode. Defaults to 15000000. Server-controlled via GrowthBook; env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET overrides."),totalTokensReminderAfterUserTurn:l.boolean().optional().describe("@internal When true, emit the totalTokensReminder block after each regular user prompt and (for 'padded-countdown') re-anchor the task budget to the full configured value at the start of each user turn. When false, the reminder appears only in the system prompt and after each tool-result batch, and 'padded-countdown' counts down over the whole session. Defaults to off. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN overrides; server-controlled via GrowthBook tengu_lapis_anchor_user_turn."),autoMemoryEnabled:l.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:l.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:l.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:l.boolean().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:l.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:l.boolean().optional().describe("@internal Whether the user has accepted the multi-agent workflow usage warning. Until set, auto permission mode prompts before running a workflow."),disableAutoMode:l.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:l.array(l.object({id:l.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:l.string().describe("Display name for the SSH connection"),sshHost:l.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:l.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:l.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:l.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:l.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:l.array(l.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:l.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:l.union([l.enum(MG),l.string().startsWith("custom:").transform((t)=>t)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:l.enum(LG).optional().catch(void 0).describe("Key binding mode for the prompt input"),vimInsertModeRemaps:l.record(l.string(),l.unknown()).optional().catch(void 0).describe('Vim INSERT-mode key-sequence remaps, e.g. {"jj": "<Esc>"}. Each key is exactly two printable characters typed in sequence; "<Esc>" (return to NORMAL mode) is the only supported target. Applies when editorMode is "vim".'),verbose:l.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:l.enum(DG).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:l.boolean().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:l.boolean().optional().describe("Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:l.boolean().optional().describe("When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoScrollEnabled:l.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:l.boolean().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:l.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:l.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:l.boolean().optional().describe("Stamp each message with its arrival time"),terminalProgressBarEnabled:l.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:l.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:l.enum(NG).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:l.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:l.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:l.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:l.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:l.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:l.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...r6(e)}).passthrough()}var Es=C(()=>x6(Kk())),_6=Object.freeze({serverName:"invalid-entry-stripped"});function y6(e,t,r){return l.array(t.catch((n)=>(r({path:`${e}[]`,message:`Invalid entry was ignored: ${n.issues[0]?.message??"failed validation"}`}),_6))).transform((n)=>n.filter((o)=>o!==_6)).optional()}function tO(e){let t=Es(),r={};for(let[s,a]of Object.entries(t.shape))r[s]=a.catch((c)=>{e({path:s,message:`${c.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});r.allowedMcpServers=y6("allowedMcpServers",Oy(),e).catch(()=>(e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[])),r.deniedMcpServers=y6("deniedMcpServers",Cy(),e).catch(()=>{e({path:"deniedMcpServers",message:'"deniedMcpServers" was present but invalid and was dropped; its entries cannot be enforced until it is fixed.'});return}),r.allowManagedMcpServersOnly=t.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),r.enforceAvailableModels=t.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),r.availableModels=l.array(l.unknown()).transform((s,a)=>{let c=[];for(let u of s)if(typeof u==="string")c.push(u);else e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(u)}); the entry was ignored.`});return c}).optional().catch(()=>(e({path:"availableModels",message:'"availableModels" was present but invalid; enforcing an empty allowlist (only the default model is available) until it is fixed.'}),[])),r.forceLoginOrgUUID=t.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let n=Object.freeze({mode:"deny"}),o=(s,a)=>l.array(a.catch((c)=>(e({path:`sandbox.credentials.${s}[]`,message:`Invalid entry was ignored: ${c.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),n))).transform((c)=>c.filter((u)=>u!==n)).optional();return r.sandbox=zk().extend({credentials:l.object({files:o("files",jk()),envVars:o("envVars",Fk()),allowPlaintextInject:l.boolean().optional().catch((s)=>{e({path:"sandbox.credentials.allowPlaintextInject",message:`${s.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was ignored; plaintext credential injection stays disabled until it is fixed.`});return})}).optional().catch((s)=>{e({path:"sandbox.credentials",message:`${s.issues[0]?.message??"Failed schema validation"}. The credentials block was dropped; no credential protection is applied until it is fixed.`});return})}).optional().catch((s)=>{e({path:"sandbox",message:`${s.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return}),l.object(r).passthrough().transform((s)=>{for(let a of Object.keys(s))if(s[a]===void 0)delete s[a];return s})}var fo="https://code.claude.com/docs/en",bMe=[{matches:(e)=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${fo}/iam#permission-modes`}},{matches:(e)=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:(e)=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:(e)=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${fo}/settings#environment-variables`}},{matches:(e)=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:(e)=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${fo}/hooks`}},{matches:(e)=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${fo}/hooks#exec-form-and-shell-form`}},{matches:(e)=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:(e)=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${fo}/settings`}},{matches:(e)=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:(e)=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${fo}/iam#working-directories`}}],xMe={permissions:`${fo}/iam#configuring-permissions`,env:`${fo}/settings#environment-variables`,hooks:`${fo}/hooks`};function v6(e){let t=bMe.find((n)=>n.matches(e));if(!t)return null;let r={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!r.suggestion)r.suggestion=`Valid values: ${e.enumValues.map((n)=>`"${n}"`).join(", ")}`;if(!r.docLink&&e.path)r.docLink=xMe[Wy(e.path,".")];return r}var YTt=C(()=>Es().strict());function S6(e){return e.code==="invalid_type"}function E6(e){return e.code==="invalid_value"}function vMe(e){return e.code==="unrecognized_keys"}function w6(e){return e.code==="too_small"}function qc(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function T6(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function $d(e,t){return e.issues.map((r)=>{let n=r.path.map(String).join("."),o=r.message,i,s,a,c,u;if(E6(r))s=r.values.map((f)=>String(f)),a=s.join(" | "),c=void 0,u=void 0;else if(S6(r)){a=r.expected;let f=T6(r.message);c=f??qc(r.input),u=f??qc(r.input)}else if(w6(r))a=String(r.minimum);else if(r.code==="custom"&&"params"in r)c=r.params.received,u=c;let d=v6({path:n,code:r.code,expected:a,received:c,enumValues:s,message:r.message,value:c});if(E6(r))i=s?.map((f)=>`"${f}"`).join(", "),o=`Invalid value. Expected one of: ${i}`;else if(S6(r)){let f=T6(r.message)??qc(r.input);if(r.expected==="object"&&f==="null"&&n==="")o="Invalid or malformed JSON";else o=`Expected ${r.expected}, but received ${f}`}else if(vMe(r)){let f=r.keys.join(", ");o=`Unrecognized ${jO(r.keys.length,"field")}: ${f}`}else if(w6(r))o=`Number must be greater than or equal to ${r.minimum}`,i=String(r.minimum);return{file:t,path:n,message:o,expected:i,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}function SMe(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!r.permissions||typeof r.permissions!=="object")return[];let n=r.permissions,o=[];for(let i of["allow","deny","ask"]){let s=n[i];if(!Array.isArray(s))continue;n[i]=s.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${i}`,message:`Non-string value in ${i} array was removed`,severity:"warning",invalidValue:a}),!1;let c=Qk(a,i);if(!c.valid){let u=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)u+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${i}`,message:u,severity:"warning",invalidValue:a}),!1}return!0})}return o}var EMe=new Set(Os);function wMe(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!("hooks"in r))return[];if(r.hooks===null||typeof r.hooks!=="object"||Array.isArray(r.hooks)){let i=qc(r.hooks);return delete r.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${i}. This field was ignored.`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"}]}let n=r.hooks,o=[];for(let i of Object.keys(n)){if(!EMe.has(i)){delete n[i],o.push({file:t,path:`hooks.${i}`,message:`Unknown hook event "${i}" was ignored. Valid events: ${Os.join(", ")}`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(n[i])){let s=qc(n[i]);delete n[i],o.push({file:t,path:`hooks.${i}`,message:`Hook event "${i}" must be an array of matchers; received ${s}. This entry was ignored.`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"})}}if(o.length>0&&Object.keys(n).length===0)delete r.hooks;return o}var TMe=[{key:"allowedMcpServers",schema:Oy},{key:"deniedMcpServers",schema:Cy}];function AMe(e,t){if(!e||typeof e!=="object")return[];let r=e,n=[];for(let{key:o,schema:i}of TMe){if(!(o in r))continue;if(!Array.isArray(r[o])){let c=r[o];delete r[o],n.push({file:t,path:o,message:`"${o}" must be an array; received ${qc(c)}. This field was ignored.`,severity:"warning",invalidValue:c});continue}let s=r[o],a=[];for(let c=0;c<s.length;c++){let u=i().safeParse(s[c]);if(u.success)a.push(s[c]);else n.push({file:t,path:`${o}[${c}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:s[c]})}if(a.length<s.length)r[o]=a}return n}function ws(e,t,r){return[...SMe(e,t),...wMe(e,t),...r?.skipMcpServerEntryFilter?[]:AMe(e,t)]}function oO(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),wG.filter((r)=>t.has(r))}function CMe(){return Tn(xs(),"managed-settings.json")}function k6(e){if(no()==="wsl"&&e.wslInherits?.()){let t=rO(zc);if(t.settings)return t;let r=rO(xs());return{settings:r.settings,errors:[...t.errors,...r.errors]}}return rO(xs())}function rO(e){let t=[],r={},n=!1,{settings:o,errors:i}=Gc(Tn(e,"managed-settings.json"),void 0,!0);if(t.push(...i),o&&Object.keys(o).length>0)r=En(r,o,Un),n=!0;let s=Tn(e,"managed-settings.d");try{let u=Fe().readdirSync(s).filter((d)=>(d.isFile()||d.isSymbolicLink())&&d.name.endsWith(".json")&&!d.name.startsWith(".")).map((d)=>d.name).sort();for(let d of u){let{settings:f,errors:m}=Gc(Tn(s,d),void 0,!0);if(t.push(...m),f&&Object.keys(f).length>0)r=En(r,f,Un),n=!0}}catch(u){let d=dt(u);if(d!=="ENOENT"&&d!=="ENOTDIR")ce(`managed-settings.d read failed: ${u}`,{level:"error"})}let{wslInheritsWindowsSettings:a,...c}=r;return{settings:n&&Object.keys(c).length>0?r:null,errors:t}}function RMe(e,t){if(On(e))ce(`Broken symlink or missing file encountered for settings.json at path: ${t}`);else ce(`settings file read failed at ${t}: ${e}`,{level:"error"})}function Gc(e,t,r){let n=xD(e);if(n)return{settings:n.settings?Ho(n.settings):null,errors:n.errors};let o=DMe(e,t,r);return vD(e,o),{settings:o.settings?Ho(o.settings):null,errors:o.errors}}function O6(e){if(!e.mdm)return{settings:null,errors:[]};let t=e.mdm();return{settings:Object.keys(t.settings).length>0?t.settings:null,errors:t.errors}}function Ry(e,t){let r=Ho(e),n=ws(r,t,{skipMcpServerEntryFilter:!0}),o=[],i=tO((s)=>o.push({file:t,path:s.path,message:s.message,severity:"warning"})).safeParse(r);if(!i.success)return{settings:null,errors:[...n,...$d(i.error,t)]};return{settings:Object.keys(i.data).length>0?i.data:null,errors:[...n,...o]}}function C6(e){let t=e?.remote?e.remote():EG();if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return Ry(t,"remote managed settings")}function IMe(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return Ry(t,"parent managed settings")}function R6(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let r=Ho(t),n=ws(r,"SDK inline settings"),o=Es().safeParse(r);if(!o.success)return{settings:null,errors:[...n,...$d(o.error,"SDK inline settings")]};return{settings:o.data,errors:n}}var PMe=2097152;function DMe(e,t,r){try{let n;if(t!==void 0)n=t;else{let{resolvedPath:a}=ih(Fe(),e);n=bs(a,PMe)}if(n.trim()==="")return{settings:{},errors:[]};let o=Ho(Mc(n,!1));if(r){let a=ws(o,e,{skipMcpServerEntryFilter:!0}),c=[],u=tO((d)=>c.push({file:e,path:d.path,message:d.message,severity:"warning"})).safeParse(o);if(!u.success)return{settings:null,errors:[...a,...$d(u.error,e)]};return{settings:u.data,errors:[...a,...c]}}let i=ws(o,e),s=Es().safeParse(o);if(!s.success){let a=$d(s.error,e);return{settings:null,errors:[...i,...a]}}return{settings:s.data,errors:i}}catch(n){if(RMe(n,e),On(n))return{settings:null,errors:[]};return{settings:null,errors:[{file:e,path:"",message:`Settings file could not be read: ${n instanceof Error?n.message:String(n)}`,severity:"fatal"}]}}}function A6(e,t){switch(e){case"userSettings":return Zr(Yt());case"policySettings":case"projectSettings":return Zr(t.cwd);case"localSettings":return I6(t.cwd,t.canonicalGitRoot);case"flagSettings":return t.flagPath?OMe(Zr(t.flagPath)):Zr(t.cwd)}}function I6(e,t){let r=t?.(e);if(!r)return Zr(e);let n=Zr(r),o=Zr(e);if(n===o)return n;let i;try{i=MMe()}catch{return o}if(n===i)return o;if(!NMe(n))return o;return n}var LMe=re((e)=>{let t=Fe(),r=null;try{r=t.lstatSync(Tn(e,".claude")).uid}catch(n){if(!On(n))throw n}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(Tn(e,".git")).uid,claudeEntryUid:r}});function NMe(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return ce(`localSettings: not canonicalizing the consent store to ${e} — this platform has no uid semantics to verify directory ownership with, so the store stays at the session cwd (canonicalization is POSIX-only)`,{level:"warn"}),!1;let t=typeof process.geteuid==="function"?process.geteuid():process.getuid?.();try{let{rootUid:r,gitEntryUid:n,claudeEntryUid:o}=LMe(e);if(r===t&&n===t&&(o===null||o===t))return!0;return ce(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${r}), its .git entry (uid ${n}), or its .claude entry (uid ${o??"absent"}) is not owned by the current user (uid ${t}); the store stays at the session cwd (the pre-canonicalization behavior). If you own this repo, chown it (including .git and .claude) or run from a directory you own.`,{level:"warn"}),!1}catch(r){return ce(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${r instanceof Error?r.message:String(r)}); the store stays at the session cwd`,{level:"warn"}),!1}}var MMe=re(()=>{let e=Hy(kMe());if(e===null)throw Error("home directory realpath unavailable");return xr(e)});function UMe(e){if(e.coworkPlugins||Hr.CLAUDE_CODE_USE_COWORK_PLUGINS)return"cowork_settings.json";return"settings.json"}function jd(e,t){switch(e){case"userSettings":return Tn(A6(e,t),UMe(t));case"projectSettings":case"localSettings":return Tn(A6(e,t),P6(e));case"policySettings":return CMe();case"flagSettings":return t.flagPath}}function P6(e){switch(e){case"projectSettings":return Tn(".claude","settings.json");case"localSettings":return Tn(".claude","settings.local.json")}}function D6(e){if(I6(e.cwd,e.canonicalGitRoot)===Zr(e.cwd))return;return Tn(Zr(e.cwd),P6("localSettings"))}function L6(e,t){let r=yD(e);if(r!==void 0)return r;let n=FMe(e,t);return bD(e,n),n}function $Me(e){return!e||e.parentSettingsBehavior==="merge"}function jMe(e,t){let r={};if(e.allowManagedHooksOnly===!0)r.allowManagedHooksOnly=!0;if(e.allowManagedMcpServersOnly===!0)r.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)r.disableClaudeAiConnectors=!0;if(e.allowManagedPermissionRulesOnly===!0)r.allowManagedPermissionRulesOnly=!0;let n=e.strictPluginOnlyCustomization;if(n===!0||Array.isArray(n)&&n.length>0)r.strictPluginOnlyCustomization=n;if(e.deniedMcpServers)r.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)r.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)r.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)r.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)r.enforceAvailableModels=!0;if(e.permissions){let o=Ey(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")o.disableBypassPermissionsMode="disable";if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:s}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)o.allow=i;if(s)o.additionalDirectories=s}if(Object.keys(o).length>0)r.permissions=o}if(e.sandbox){let{network:o,filesystem:i,credentials:s}=e.sandbox,a={};if(e.sandbox.enabled===!0)a.enabled=!0;if(e.sandbox.failIfUnavailable===!0)a.failIfUnavailable=!0;if(e.sandbox.allowUnsandboxedCommands===!1)a.allowUnsandboxedCommands=!1;if(e.sandbox.autoAllowBashIfSandboxed===!1)a.autoAllowBashIfSandboxed=!1;if(o){let c=Ey(o,["deniedDomains"]);if(o.allowManagedDomainsOnly===!0)c.allowManagedDomainsOnly=!0;if(o.strictAllowlist===!0)c.strictAllowlist=!0;if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&o.allowedDomains)c.allowedDomains=o.allowedDomains;if(Object.keys(c).length>0)a.network=c}if(i){let c=Ey(i,["denyRead","denyWrite"]);if(i.allowManagedReadPathsOnly===!0)c.allowManagedReadPathsOnly=!0;if(i.disabled===!1)c.disabled=!1;if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)c.allowRead=i.allowRead;if(Object.keys(c).length>0)a.filesystem=c}if(s){let c=(s.files??[]).filter((f)=>f.mode==="deny"),u=(s.envVars??[]).filter((f)=>f.mode==="deny"),d={...c.length>0&&{files:c},...u.length>0&&{envVars:u}};if(s.allowPlaintextInject===!1)d.allowPlaintextInject=!1;if(Object.keys(d).length>0)a.credentials=d}if(Object.keys(a).length>0)r.sandbox=a}return r}function N6(e){if(e.helper?.())return"helper";if(C6(e).settings)return"remote";if(O6(e).settings)return no()==="macos"?"plist":"hklm";if((e.file?.()??k6(e)).settings)return"file";if(M6(e).parentSlice)return"parent";let t=e.hkcu?.();return t&&Object.keys(t.settings).length>0?"hkcu":null}function M6(e){let t=[],{settings:r,errors:n}=C6(e);t.push(...n);let{settings:o,errors:i}=O6(e);t.push(...i);let{settings:s,errors:a}=e.file?.()??k6(e);t.push(...a);let{settings:c,errors:u}=IMe(e);t.push(...u);let d=[r,o,s].filter((_)=>_!==null),f=d[0]??null,m={allowManagedPermissionRulesOnly:d.some((_)=>_.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:d.find((_)=>_.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:d.find((_)=>_.allowedMcpServers!==void 0)?.allowedMcpServers,availableModels:d[0]?.availableModels,sandbox:{network:{allowManagedDomainsOnly:d.some((_)=>_.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:d.some((_)=>_.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},g=c&&$Me(f)?jMe(c,m):null,h=g&&Object.keys(g).length>0?g:null;return{tiers:d,admin:f,parentSlice:h,errors:t}}function U6(e){let t=e.helper?.();if(t)return{settings:t,errors:e.helperWarnings?.()??[]};let{tiers:r,admin:n,parentSlice:o,errors:i}=M6(e);if(!n&&!o){let a=e.hkcu?.();if(a&&Object.keys(a.settings).length>0)return{settings:a.settings,errors:[...i,...a.errors]};return{settings:null,errors:[...i,...a?.errors??[]]}}let s=En({},o??{},n??{},Un);if(r.some((a)=>a.forceRemoteSettingsRefresh===!0))s.forceRemoteSettingsRefresh=!0;return{settings:s,errors:i}}function FMe(e,t,{includeLegacyLocalSettings:r=!0}={}){if(e==="policySettings")return U6(t).settings;let n=jd(e,t),{settings:o}=n?Gc(n,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:i}=R6(t);if(i)return En(o||{},i,Un)}if(e==="localSettings"&&r){let i=D6(t);if(i){let{settings:s}=Gc(i);if(s)return En(s,o||{},Un)}}return o}function Un(e,t,r){if(Array.isArray(e)&&Array.isArray(t)){if(r==="fallbackModel")return t;return Ra([...e,...t])}return}var nO=!1;function zMe(e){if(nO)return{settings:{},errors:[]};let t=Date.now();kd("info","settings_load_started"),nO=!0;try{let r=SD(),n={};if(r)n=En(n,r,Un);let o=[],i=new Set,s=new Set,a=(u)=>{for(let d of u){let f=`${d.file}:${d.path}:${d.message}`;if(!i.has(f))i.add(f),o.push(d)}},c=null;for(let u of oO(e)){if(u==="policySettings"){let{settings:f,errors:m}=U6(e);if(c=f,f)n=En(n,f,Un);a(m);continue}if(u==="localSettings"){let f=D6(e);if(f&&!s.has(Zr(f))){s.add(Zr(f));let{settings:m,errors:g}=Gc(f);if(a(g),m)n=En(n,m,Un)}}let d=jd(u,e);if(d){let f=Zr(d);if(!s.has(f)){s.add(f);let{settings:m,errors:g}=Gc(d,u==="flagSettings"?e.flagExpectedContent:void 0);if(a(g),m)n=En(n,m,Un)}}if(u==="flagSettings"){let{settings:f,errors:m}=R6(e);if(a(m),f)n=En(n,f,Un)}}if(c){if(c.availableModels!==void 0)n.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)n.enforceAvailableModels=c.enforceAvailableModels}return kd("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:s.size,error_count:o.length}),{settings:n,errors:o}}finally{nO=!1}}function BMe(e){let t=hD();if(t!==null)return t;let r=zMe(e);return _D(r),r}function HMe(e){let{settings:t}=BMe(e);return t||{}}function $6(e){qi();let t=[];for(let r of oO(e)){let n=L6(r,e);if(n&&Object.keys(n).length>0)t.push({source:r,settings:n})}return{effective:HMe(e),sources:t}}function j6(e,t){let r=oO(t);for(let n=r.length-1;n>=0;n--){let o=r[n];if(L6(o,t)?.[e]!==void 0)return o}return null}import{execFile as qMe}from"child_process";import{existsSync as GMe}from"fs";var WMe=null;function Fd(e,t){return new Promise((r)=>{try{qMe(e,t,{encoding:"utf-8",timeout:OG,windowsHide:!0},(n,o)=>{r({stdout:o??"",code:n?1:0})})}catch{r({stdout:"",code:1})}})}function F6(){return(async()=>{if(process.platform==="darwin"){let e=CG(),r=(await Promise.all(e.map(async({path:n,label:o})=>{if(!GMe(n))return{stdout:"",label:o,ok:!1};let{stdout:i,code:s}=await Fd(AG,[...kG,n]);return{stdout:i,label:o,ok:s===0&&!!i}}))).find((n)=>n.ok);return{plistStdouts:r?[{stdout:r.stdout,label:r.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[r,n]=await Promise.all([Fd(t,["query",Id,"/v",pi]),Fd(t,["query",Pd,"/v",pi])]);return{plistStdouts:null,hklmStdout:r.code===0?r.stdout:null,hkcuStdout:n.code===0?n.stdout:null}}if(wy()){let[e,t]=await Promise.all([Fd($k,["query",Id,"/v",pi]),Fd($k,["query",Pd,"/v",pi])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function z6(){return WMe}var fi=Object.freeze({settings:{},errors:[]}),G6=null,W6=null,V6=!1,Iy=null;function VMe(){if(Iy)return;Iy=(async()=>{let e=Date.now(),t=z6()??F6(),{mdm:r,hkcu:n,wslInherits:o}=KMe(await t);G6=r,W6=n,V6=o;let i=Date.now()-e;if(ce(`MDM settings load completed in ${i}ms`),Object.keys(r.settings).length>0){ce(`MDM settings found: ${Object.keys(r.settings).join(", ")}`);try{kd("info","mdm_settings_loaded",{duration_ms:i,key_count:Object.keys(r.settings).length,error_count:r.errors.length})}catch{}}})()}async function K6(){if(!Iy)VMe();await Iy}function Z6(){return G6??fi}function J6(){return W6??fi}function Y6(){return V6}function iO(e,t){let r=Mc(e,!1);if(!r||typeof r!=="object")return{settings:{},errors:[]};let{settings:n,errors:o}=Ry(r,t);return{settings:n??{},errors:o}}function B6(e,t="Settings"){let r=e.split(/\r?\n/),n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^\\s+${n}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let i of r){let s=i.match(o);if(s&&s[1])return s[1].trimEnd()}return null}function KMe(e){let t=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:s,label:a}=e.plistStdouts[0],c=iO(s,a),{wslInheritsWindowsSettings:u,...d}=c.settings;if(Object.keys(d).length>0)return{mdm:c,hkcu:fi,wslInherits:!1};t.push(...c.errors)}let r=null;if(e.hklmStdout){let s=B6(e.hklmStdout);if(s)r=iO(s,`Registry: ${Id}\\${pi}`)}if(r)t.push(...r.errors);let n=t.length>0?{settings:{},errors:t}:fi,o=wy(),i=!1;if(o){if(i=r?.settings.wslInheritsWindowsSettings===!0||JMe(),!i)return{mdm:n,hkcu:fi,wslInherits:!1}}if(r){let{wslInheritsWindowsSettings:s,...a}=r.settings;if(Object.keys(a).length>0)return{mdm:r,hkcu:fi,wslInherits:i}}if(ZMe(i))return{mdm:n,hkcu:fi,wslInherits:i};if(e.hkcuStdout){let s=B6(e.hkcuStdout);if(s){let a=iO(s,`Registry: ${Pd}\\${pi}`);if(!o||a.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:c,...u}=a.settings;return{mdm:n,hkcu:{settings:u,errors:a.errors},wslInherits:i}}if(a.errors.length>0)return{mdm:n,hkcu:{settings:{},errors:a.errors},wslInherits:i}}}return{mdm:n,hkcu:fi,wslInherits:i}}function ZMe(e){if(e&&q6(zc))return!0;return q6(xs())}function H6(e){let t=Ho(Mc(bs(e),!1));if(!t||typeof t!=="object")return!1;ws(t,e);let{wslInheritsWindowsSettings:r,...n}=t;return Object.keys(n).length>0}function JMe(){function e(t){try{let r=Mc(bs(t),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(e(Wc(zc,"managed-settings.json")))return!0;try{let t=Wc(zc,"managed-settings.d");for(let r of Fe().readdirSync(t))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&e(Wc(t,r.name)))return!0}catch{}return!1}function q6(e){try{if(H6(Wc(e,"managed-settings.json")))return!0}catch{}try{let t=Wc(e,"managed-settings.d"),r=Fe().readdirSync(t);for(let n of r){if(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(".json")||n.name.startsWith("."))continue;try{if(H6(Wc(t,n.name)))return!0}catch{}}}catch{}return!1}var XMe={user:"userSettings",project:"projectSettings",local:"localSettings"},X6={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},QMe=["user","project","local"],eUe=new Set(["bypassPermissions","auto","acceptEdits"]),tUe=new Set(["project"]);function rUe(e){let t=e.effective.permissions?.defaultMode;if(!t||!eUe.has(t))return e.effective;for(let r=e.sources.length-1;r>=0;r--){let n=e.sources[r];if(n.settings.permissions?.defaultMode!==void 0){if(tUe.has(n.source)){let{defaultMode:o,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Q6(e={}){await K6();let t={cwd:YMe(e.cwd??Fe().cwd()),allowedSources:(e.settingSources??QMe).map((r)=>XMe[r]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Z6,hkcu:J6,wslInherits:Y6,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}};try{let{effective:r,sources:n}=$6(t),o=N6(t)??void 0,i=n.map(({source:a,settings:c})=>({source:X6[a],settings:c,path:a==="policySettings"?void 0:jd(a,t),...a==="policySettings"&&{policyOrigin:o}})),s={};for(let a of Object.keys(r)){let c=j6(a,t);if(c)s[a]={source:X6[c],path:c==="policySettings"?void 0:jd(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:r,provenance:s,sources:i}}finally{qi()}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function kkt(e){return Q6(e)}async function fUe(e,t){try{await sUe(e,t)}catch(r){if(!On(r))throw r}}async function mUe(e,t){if(!e)return;let r=e;try{let n=yt(e);if(n?.claudeAiOauth?.refreshToken)delete n.claudeAiOauth.refreshToken,r=Re(n)}catch{}await oW(t,r,{mode:384})}function gUe(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=vF(xF);return new Promise((t)=>{nUe("security",["find-generic-password","-a",SF(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(r,n)=>t(r?void 0:n.trim()||void 0))})}async function aW(e,t,r,n,o=60000){if(!ze(t))return;let i=Jr(r),s=await Mr(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!s||s.length===0)return;let a=Dr(uUe(),`claude-resume-${lO()}`);try{let c=Dr(a,"projects",i);await sO(c,{recursive:!0});let u=Dr(c,`${t}.jsonl`);await qp(u,s);let d=n?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=d??Dr(aO(),".claude"),m;try{m=await nW(Dr(f,".credentials.json"),"utf-8")}catch(g){if(!On(g))throw g}if(!d&&!(n??process.env).ANTHROPIC_API_KEY&&!(n??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await gUe()??m;if(await mUe(m,Dr(a,".credentials.json")),await fUe(Dr(d??aO(),".claude.json"),Dr(a,".claude.json")),e.listSubkeys)await hUe(e,{projectKey:i,sessionId:t},Dr(c,t),o);return a}catch(c){throw await Py(a),c}}async function hUe(e,t,r,n){let o=await Mr(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),n,`SessionStore.listSubkeys() timed out after ${n}ms for session ${t.sessionId}`);for(let i of o){let s=zd(r,i+".jsonl");if(!i||iW(i)||i.split(/[\\/]/).includes("..")||!s.startsWith(r+uO)){ce(`[SessionStore] skipping unsafe subpath from listSubkeys: ${i}`,{level:"warn"});continue}let a=await Mr(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:i}),n,`SessionStore.load() timed out after ${n}ms for session ${t.sessionId} subpath ${i}`);if(!a||a.length===0)continue;let c=[],u=[];for(let d of a)if(cO(d))c.push(d);else u.push(d);if(u.length>0)await sO(eW(s),{recursive:!0}),await qp(s,u);if(c.length>0){let d=c.at(-1),f=zd(r,i+".meta.json");await sO(eW(f),{recursive:!0});let{type:m,...g}=d;await oW(f,Re(g),{mode:384})}}}function pO(e,t){let{isSingleUserTurn:r,resumeConfigDir:n,deferSpawn:o}=t,{systemPrompt:i,settings:s,managedSettings:a,settingSources:c,sandbox:u,...d}=e??{},f,m,g;if(i===void 0)f="";else if(typeof i==="string")f=i;else if(Array.isArray(i))f=i;else if(i.type==="preset")m=i.append,g=i.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.219";let{abortController:h=Jc(),additionalDirectories:_=[],agent:y,agents:b,allowedTools:T=[],betas:w,canUseTool:k,continue:P,cwd:te,debug:oe,debugFile:Oe,disallowedTools:ke=[],tools:jt,env:xt,executable:Ft=Cs()?"bun":"node",executableArgs:vt=[],extraArgs:St={},fallbackModel:Lr,enableFileCheckpointing:H,toolConfig:Nr,forkSession:Vt,hooks:Ye,includeHookEvents:yr,includePartialMessages:nt,forwardSubagentText:W,onElicitation:q,onUserDialog:V,supportedDialogKinds:ve,persistSession:me,sessionStore:He,sessionStoreFlush:Yr,thinking:qe,effort:mo,maxThinkingTokens:$n,maxTurns:mt,maxBudgetUsd:Bd,taskBudget:mW,mcpServers:fO,model:gW,outputFormat:mO,permissionMode:gO="default",allowDangerouslySkipPermissions:hW=!1,permissionPromptToolName:_W,plugins:yW,getOAuthToken:hO,getHostAuthToken:_O,workload:yO,resume:bO,resumeSessionAt:bW,sessionId:xW,skills:xO,stderr:vW,strictMcpConfig:SW}=d;if(He&&me===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(ve!==void 0&&ve.length>0&&!V)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");if(He&&P&&!bO&&!He.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(He&&H)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(He&&d.spawnClaudeCodeProcess)ce("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});EF(!!k,gO,T);let Ly=d.pathToClaudeCodeExecutable;if(!Ly){let br=dUe(import.meta.url),Xr=lUe(br),mi=FU((Ts)=>Xr.resolve(Ts));if(!mi)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);Ly=mi}let vO=mO?.type==="json_schema"?mO.schema:void 0,Kt=xt?{...xt}:{...process.env};if(!Kt.CLAUDE_CODE_ENTRYPOINT)Kt.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!Kt.CLAUDE_AGENT_SDK_VERSION)Kt.CLAUDE_AGENT_SDK_VERSION="0.3.219";if(H)Kt.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(hO)Kt.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(_O)Kt.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(Nr?.askUserQuestion?.previewFormat)Kt.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=Nr.askUserQuestion.previewFormat;let Ny={};if(Dy.propagation.inject(Dy.context.active(),Ny),"traceparent"in Ny){for(let br of["TRACEPARENT","TRACESTATE"])if(!(br in(xt??{})))delete Kt[br]}for(let[br,Xr]of Object.entries(Ny)){let mi=br.toUpperCase();if(!(mi in(xt??{})))Kt[mi]=Xr}let SO={},EO=new Map;if(fO)for(let[br,Xr]of Object.entries(fO))if(Xr.type==="sdk"&&Xr.instance)EO.set(br,Xr.instance);else SO[br]=Xr;let Vc;if(qe)switch(qe.type){case"adaptive":Vc={type:"adaptive",display:qe.display};break;case"enabled":Vc={type:"enabled",budgetTokens:qe.budgetTokens,display:qe.display};break;case"disabled":Vc={type:"disabled"};break}else if($n!==void 0)Vc=$n===0?{type:"disabled"}:{type:"enabled",budgetTokens:$n};if(n){if(Kt.CLAUDE_CONFIG_DIR=n,process.platform==="win32")Kt.CLAUDE_SECURESTORAGE_CONFIG_DIR=xt?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??xt?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let wO=new Uw({abortController:h,additionalDirectories:_,agent:y,betas:w,cwd:te,debug:oe,debugFile:Oe,executable:Ft,executableArgs:vt,extraArgs:yO?{...St,workload:yO}:St,pathToClaudeCodeExecutable:Ly,env:Kt,forkSession:Vt,stderr:vW,thinkingConfig:Vc,effort:mo,maxTurns:mt,maxBudgetUsd:Bd,taskBudget:mW,model:gW,fallbackModel:Lr,jsonSchema:vO,permissionMode:gO,allowDangerouslySkipPermissions:hW,permissionPromptToolName:_W,continueConversation:He?void 0:P,resume:bO,resumeSessionAt:bW,sessionId:xW,settings:typeof s==="object"?Re(s):s,managedSettings:a?Re(a):void 0,settingSources:c,skills:xO,allowedTools:T,disallowedTools:ke,tools:jt,mcpServers:SO,strictMcpConfig:SW,canUseTool:!!k,hooks:!!Ye,includeHookEvents:yr,includePartialMessages:nt,persistSession:me,sessionMirror:!!He,plugins:yW,sandbox:u,spawnClaudeCodeProcess:d.spawnClaudeCodeProcess,deferSpawn:o}),EW={systemPrompt:f,appendSystemPrompt:m,planModeInstructions:d.planModeInstructions,appendSubagentSystemPrompt:d.appendSubagentSystemPrompt,toolAliases:d.toolAliases,excludeDynamicSections:g,agents:b,title:d.title,skills:xO,webSearchIsolationExemptMcpServers:d.webSearchIsolationExemptMcpServers,promptSuggestions:d.promptSuggestions,agentProgressSummaries:d.agentProgressSummaries,forwardSubagentText:W,supportedDialogKinds:ve},My=new Hh(wO,r,k,Ye,h,EO,vO,EW,q,hO,_O,V);if(He){let br=()=>Dr(Kt.CLAUDE_CONFIG_DIR??Dr(aO(),".claude"),"projects"),Xr=Yr==="eager",mi=new Bw(async(Ts,Uy)=>{let Kc=rW(Ts,br());if(Kc)await He.append(Kc,Uy);else ce(`[SessionStore] dropping mirror frame: filePath ${Ts} is not under ${br()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(Ts,Uy)=>{let Kc=rW(Ts,br());if(Kc)My.reportMirrorError(Kc,Uy.message)},maxPendingEntries:Xr?0:qh,maxPendingBytes:Xr?0:Gh});My.setTranscriptMirrorBatcher(mi)}return{queryInstance:My,transport:wO,abortController:h,processEnv:Kt}}function dO(e,t,r,n){if(typeof r==="string")t.write(Re({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+`
136
+ `+"\t".repeat(t))}};var Eq;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Eq||(Eq={}));var wq;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(wq||(wq={}));var Tq;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Tq||(Tq={}));var Aq;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Aq||(Aq={}));function my(e){return e.startsWith("\uFEFF")?e.slice(1):e}var Lc=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Oq=new Set,Ik=typeof process==="object"&&!!process?process:{},Cq=(e,t,r,n)=>{typeof Ik.emitWarning==="function"?Ik.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},gy=globalThis.AbortController,kq=globalThis.AbortSignal;if(typeof gy>"u"){kq=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,o){this._onabort.push(o)}},gy=class{constructor(){t()}signal=new kq;abort(n){if(this.signal.aborted)return;this.signal.reason=n,this.signal.aborted=!0;for(let o of this.signal._onabort)o(n);this.signal.onabort?.(n)}};let e=Ik.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,Cq("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t)}}var N0e=(e)=>!Oq.has(e),Rxt=Symbol("type"),ui=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Rq=(e)=>!ui(e)?null:e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Od:null;class Od extends Array{constructor(e){super(e);this.fill(0)}}class Nc{heap;length;static#n=!1;static create(e){let t=Rq(e);if(!t)return[];Nc.#n=!0;let r=new Nc(e,t);return Nc.#n=!1,r}constructor(e,t){if(!Nc.#n)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class hy{#n;#p;#g;#h;#R;#I;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#_;#o;#r;#e;#l;#d;#c;#s;#y;#a;#b;#x;#f;#v;#A;#u;static unsafeExposeInternals(e){return{starts:e.#x,ttls:e.#f,sizes:e.#b,keyMap:e.#o,keyList:e.#r,valList:e.#e,next:e.#l,prev:e.#d,get head(){return e.#c},get tail(){return e.#s},free:e.#y,isBackgroundFetch:(t)=>e.#t(t),backgroundFetch:(t,r,n,o)=>e.#L(t,r,n,o),moveToTail:(t)=>e.#C(t),indexes:(t)=>e.#S(t),rindexes:(t)=>e.#E(t),isStale:(t)=>e.#m(t)}}get max(){return this.#n}get maxSize(){return this.#p}get calculatedSize(){return this.#_}get size(){return this.#i}get fetchMethod(){return this.#R}get memoMethod(){return this.#I}get dispose(){return this.#g}get disposeAfter(){return this.#h}constructor(e){let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:i,updateAgeOnHas:s,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:m=0,maxEntrySize:g=0,sizeCalculation:h,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:k,ignoreFetchAbort:P}=e;if(t!==0&&!ui(t))throw TypeError("max option must be a nonnegative integer");let te=t?Rq(t):Array;if(!te)throw Error("invalid max value: "+t);if(this.#n=t,this.#p=m,this.maxEntrySize=g||this.#p,this.sizeCalculation=h,this.sizeCalculation){if(!this.#p&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#I=y,_!==void 0&&typeof _!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#R=_,this.#A=!!_,this.#o=new Map,this.#r=Array(t).fill(void 0),this.#e=Array(t).fill(void 0),this.#l=new te(t),this.#d=new te(t),this.#c=0,this.#s=0,this.#y=Nc.create(t),this.#i=0,this.#_=0,typeof c==="function")this.#g=c;if(typeof u==="function")this.#h=u,this.#a=[];else this.#h=void 0,this.#a=void 0;if(this.#v=!!this.#g,this.#u=!!this.#h,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#p!==0){if(!ui(this.#p))throw TypeError("maxSize must be a positive integer if specified")}if(!ui(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!s,this.ttlResolution=ui(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ui(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#n===0&&this.ttl===0&&this.#p===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#n&&!this.#p){if(N0e("LRU_CACHE_UNBOUNDED"))Oq.add("LRU_CACHE_UNBOUNDED"),Cq("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",hy)}}getRemainingTTL(e){return this.#o.has(e)?1/0:0}#N(){let e=new Od(this.#n),t=new Od(this.#n);this.#f=e,this.#x=t,this.#M=(o,i,s=Lc.now())=>{if(t[o]=i!==0?s:0,e[o]=i,i!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#m(o))this.#w(this.#r[o],"expire")},i+1);if(a.unref)a.unref()}},this.#k=(o)=>{t[o]=e[o]!==0?Lc.now():0},this.#T=(o,i)=>{if(e[i]){let s=e[i],a=t[i];if(!s||!a)return;o.ttl=s,o.start=a,o.now=r||n();let c=o.now-a;o.remainingTTL=s-c}};let r=0,n=()=>{let o=Lc.now();if(this.ttlResolution>0){r=o;let i=setTimeout(()=>r=0,this.ttlResolution);if(i.unref)i.unref()}return o};this.getRemainingTTL=(o)=>{let i=this.#o.get(o);if(i===void 0)return 0;let s=e[i],a=t[i];if(!s||!a)return 1/0;let c=(r||n())-a;return s-c},this.#m=(o)=>{let i=t[o],s=e[o];return!!s&&!!i&&(r||n())-i>s}}#k=()=>{};#T=()=>{};#M=()=>{};#m=()=>!1;#z(){let e=new Od(this.#n);this.#_=0,this.#b=e,this.#O=(t)=>{this.#_-=e[t],e[t]=0},this.#U=(t,r,n,o)=>{if(this.#t(r))return 0;if(!ui(n))if(o){if(typeof o!=="function")throw TypeError("sizeCalculation must be a function");if(n=o(r,t),!ui(n))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#P=(t,r,n)=>{if(e[t]=r,this.#p){let o=this.#p-e[t];while(this.#_>o)this.#D(!0)}if(this.#_+=e[t],n)n.entrySize=r,n.totalCalculatedSize=this.#_}}#O=(e)=>{};#P=(e,t,r)=>{};#U=(e,t,r,n)=>{if(r||n)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#s;;){if(!this.#$(t))break;if(e||!this.#m(t))yield t;if(t===this.#c)break;else t=this.#d[t]}}*#E({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#c;;){if(!this.#$(t))break;if(e||!this.#m(t))yield t;if(t===this.#s)break;else t=this.#l[t]}}#$(e){return e!==void 0&&this.#o.get(this.#r[e])===e}*entries(){for(let e of this.#S())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*rentries(){for(let e of this.#E())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*keys(){for(let e of this.#S()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*rkeys(){for(let e of this.#E()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*values(){for(let e of this.#S())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}*rvalues(){for(let e of this.#E())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#S()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;if(e(o,this.#r[r],this))return this.get(this.#r[r],t)}}forEach(e,t=this){for(let r of this.#S()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;e.call(t,o,this.#r[r],this)}}rforEach(e,t=this){for(let r of this.#E()){let n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0)continue;e.call(t,o,this.#r[r],this)}}purgeStale(){let e=!1;for(let t of this.#E({allowStale:!0}))if(this.#m(t))this.#w(this.#r[t],"expire"),e=!0;return e}info(e){let t=this.#o.get(e);if(t===void 0)return;let r=this.#e[t],n=this.#t(r)?r.__staleWhileFetching:r;if(n===void 0)return;let o={value:n};if(this.#f&&this.#x){let i=this.#f[t],s=this.#x[t];if(i&&s){let a=i-(Lc.now()-s);o.ttl=a,o.start=Date.now()}}if(this.#b)o.size=this.#b[t];return o}dump(){let e=[];for(let t of this.#S({allowStale:!0})){let r=this.#r[t],n=this.#e[t],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||r===void 0)continue;let i={value:o};if(this.#f&&this.#x){i.ttl=this.#f[t];let s=Lc.now()-this.#x[t];i.start=Math.floor(Date.now()-s)}if(this.#b)i.size=this.#b[t];e.unshift([r,i])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=Lc.now()-n}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r,{noUpdateTTL:c=this.noUpdateTTL}=r,u=this.#U(e,t,r.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#w(e,"set"),this}let d=this.#i===0?void 0:this.#o.get(e);if(d===void 0){if(d=this.#i===0?this.#s:this.#y.length!==0?this.#y.pop():this.#i===this.#n?this.#D(!1):this.#i,this.#r[d]=e,this.#e[d]=t,this.#o.set(e,d),this.#l[this.#s]=d,this.#d[d]=this.#s,this.#s=d,this.#i++,this.#P(d,u,a),a)a.set="add";c=!1}else{this.#C(d);let f=this.#e[d];if(t!==f){if(this.#A&&this.#t(f)){f.__abortController.abort(Error("replaced"));let{__staleWhileFetching:m}=f;if(m!==void 0&&!i){if(this.#v)this.#g?.(m,e,"set");if(this.#u)this.#a?.push([m,e,"set"])}}else if(!i){if(this.#v)this.#g?.(f,e,"set");if(this.#u)this.#a?.push([f,e,"set"])}if(this.#O(d),this.#P(d,u,a),this.#e[d]=t,a){a.set="replace";let m=f&&this.#t(f)?f.__staleWhileFetching:f;if(m!==void 0)a.oldValue=m}}else if(a)a.set="update"}if(n!==0&&!this.#f)this.#N();if(this.#f){if(!c)this.#M(d,n,o);if(a)this.#T(a,d)}if(!i&&this.#u&&this.#a){let f=this.#a,m;while(m=f?.shift())this.#h?.(...m)}return this}pop(){try{while(this.#i){let e=this.#e[this.#c];if(this.#D(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#u&&this.#a){let e=this.#a,t;while(t=e?.shift())this.#h?.(...t)}}}#D(e){let t=this.#c,r=this.#r[t],n=this.#e[t];if(this.#A&&this.#t(n))n.__abortController.abort(Error("evicted"));else if(this.#v||this.#u){if(this.#v)this.#g?.(n,r,"evict");if(this.#u)this.#a?.push([n,r,"evict"])}if(this.#O(t),e)this.#r[t]=void 0,this.#e[t]=void 0,this.#y.push(t);if(this.#i===1)this.#c=this.#s=0,this.#y.length=0;else this.#c=this.#l[t];return this.#o.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,o=this.#o.get(e);if(o!==void 0){let i=this.#e[o];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(!this.#m(o)){if(r)this.#k(o);if(n)n.has="hit",this.#T(n,o);return!0}else if(n)n.has="stale",this.#T(n,o)}else if(n)n.has="miss";return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,n=this.#o.get(e);if(n===void 0||!r&&this.#m(n))return;let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}#L(e,t,r,n){let o=t===void 0?void 0:this.#e[t];if(this.#t(o))return o;let i=new gy,{signal:s}=r;s?.addEventListener("abort",()=>i.abort(s.reason),{signal:i.signal});let a={signal:i.signal,options:r,context:n},c=(h,_=!1)=>{let{aborted:y}=i.signal,b=r.ignoreFetchAbort&&h!==void 0;if(r.status)if(y&&!_){if(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,b)r.status.fetchAbortIgnored=!0}else r.status.fetchResolved=!0;if(y&&!b&&!_)return d(i.signal.reason);let T=m;if(this.#e[t]===m)if(h===void 0)if(T.__staleWhileFetching)this.#e[t]=T.__staleWhileFetching;else this.#w(e,"fetch");else{if(r.status)r.status.fetchUpdated=!0;this.set(e,h,a.options)}return h},u=(h)=>{if(r.status)r.status.fetchRejected=!0,r.status.fetchError=h;return d(h)},d=(h)=>{let{aborted:_}=i.signal,y=_&&r.allowStaleOnFetchAbort,b=y||r.allowStaleOnFetchRejection,T=b||r.noDeleteOnFetchRejection,w=m;if(this.#e[t]===m){if(!T||w.__staleWhileFetching===void 0)this.#w(e,"fetch");else if(!y)this.#e[t]=w.__staleWhileFetching}if(b){if(r.status&&w.__staleWhileFetching!==void 0)r.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw h},f=(h,_)=>{let y=this.#R?.(e,o,a);if(y&&y instanceof Promise)y.then((b)=>h(b===void 0?void 0:b),_);i.signal.addEventListener("abort",()=>{if(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort){if(h(void 0),r.allowStaleOnFetchAbort)h=(b)=>c(b,!0)}})};if(r.status)r.status.fetchDispatched=!0;let m=new Promise(f).then(c,u),g=Object.assign(m,{__abortController:i,__staleWhileFetching:o,__returned:void 0});if(t===void 0)this.set(e,g,{...a.options,status:void 0}),t=this.#o.get(e);else this.#e[t]=g;return g}#t(e){if(!this.#A)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gy}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:h,forceRefresh:_=!1,status:y,signal:b}=t;if(!this.#A){if(y)y.fetch="get";return this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:y})}let T={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:m,status:y,signal:b},w=this.#o.get(e);if(w===void 0){if(y)y.fetch="miss";let k=this.#L(e,w,T,h);return k.__returned=k}else{let k=this.#e[w];if(this.#t(k)){let ke=r&&k.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",ke)y.returnedStale=!0}return ke?k.__staleWhileFetching:k.__returned=k}let P=this.#m(w);if(!_&&!P){if(y)y.fetch="hit";if(this.#C(w),n)this.#k(w);if(y)this.#T(y,w);return k}let te=this.#L(e,w,T,h),Oe=te.__staleWhileFetching!==void 0&&r;if(y){if(y.fetch=P?"stale":"refresh",Oe&&P)y.returnedStale=!0}return Oe?te.__staleWhileFetching:te.__returned=te}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#I;if(!r)throw Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...i}=t,s=this.get(e,i);if(!o&&s!==void 0)return s;let a=r(e,s,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=t,s=this.#o.get(e);if(s!==void 0){let a=this.#e[s],c=this.#t(a);if(i)this.#T(i,s);if(this.#m(s)){if(i)i.get="stale";if(!c){if(!o)this.#w(e,"expire");if(i&&r)i.returnedStale=!0;return r?a:void 0}else{if(i&&r&&a.__staleWhileFetching!==void 0)i.returnedStale=!0;return r?a.__staleWhileFetching:void 0}}else{if(i)i.get="hit";if(c)return a.__staleWhileFetching;if(this.#C(s),n)this.#k(s);return a}}else if(i)i.get="miss"}#j(e,t){this.#d[t]=e,this.#l[e]=t}#C(e){if(e!==this.#s){if(e===this.#c)this.#c=this.#l[e];else this.#j(this.#d[e],this.#l[e]);this.#j(this.#s,e),this.#s=e}}delete(e){return this.#w(e,"delete")}#w(e,t){let r=!1;if(this.#i!==0){let n=this.#o.get(e);if(n!==void 0)if(r=!0,this.#i===1)this.#F(t);else{this.#O(n);let o=this.#e[n];if(this.#t(o))o.__abortController.abort(Error("deleted"));else if(this.#v||this.#u){if(this.#v)this.#g?.(o,e,t);if(this.#u)this.#a?.push([o,e,t])}if(this.#o.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#s)this.#s=this.#d[n];else if(n===this.#c)this.#c=this.#l[n];else{let i=this.#d[n];this.#l[i]=this.#l[n];let s=this.#l[n];this.#d[s]=this.#d[n]}this.#i--,this.#y.push(n)}}if(this.#u&&this.#a?.length){let n=this.#a,o;while(o=n?.shift())this.#h?.(...o)}return r}clear(){return this.#F("delete")}#F(e){for(let t of this.#E({allowStale:!0})){let r=this.#e[t];if(this.#t(r))r.__abortController.abort(Error("deleted"));else{let n=this.#r[t];if(this.#v)this.#g?.(r,n,e);if(this.#u)this.#a?.push([r,n,e])}}if(this.#o.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#f&&this.#x)this.#f.fill(0),this.#x.fill(0);if(this.#b)this.#b.fill(0);if(this.#c=0,this.#s=0,this.#y.length=0,this.#_=0,this.#i=0,this.#u&&this.#a){let t=this.#a,r;while(r=t?.shift())this.#h?.(...r)}}}function Iq(e,t,r=100){let n=new hy({max:r}),o=(...i)=>{let s=t(...i),a=n.get(s);if(a!==void 0)return a;let c=e(...i);return n.set(s,c),c};return o.cache={clear:()=>n.clear(),size:()=>n.size,delete:(i)=>n.delete(i),get:(i)=>n.peek(i),has:(i)=>n.has(i)},o}var M0e=8192;function Dq(e,t){try{return{ok:!0,value:JSON.parse(my(e))}}catch(r){if(t)sh(FI(r,`safeParseJSON: invalid JSON (${r instanceof Error?r.constructor.name:typeof r}, ${e.length} bytes)`));return{ok:!1}}}var Pq=Iq(Dq,(e)=>e,50);var Mc=Object.assign(function(t,r=!0){if(!t)return null;let n=t.length>M0e?Dq(t,r):Pq(t,r);return n.ok?n.value:null},{cache:Pq.cache});import{join as U0e}from"path";var xs=re(function(){switch(no()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),Qxt=re(function(){return U0e(xs(),"managed-settings.d")});var $0e=function(){try{var e=or(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Uc=$0e;function j0e(e,t,r){if(t=="__proto__"&&Uc)Uc(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var $c=j0e;function F0e(e,t,r){if(r!==void 0&&!An(e[t],r)||r===void 0&&!(t in e))$c(e,t,r)}var Cd=F0e;function z0e(e){return function(t,r,n){var o=-1,i=Object(t),s=n(t),a=s.length;while(a--){var c=s[e?a:++o];if(r(i[c],c,i)===!1)break}return t}}var Lq=z0e;var B0e=Lq(),Nq=B0e;var yy={};lt(yy,{default:()=>Pk});var jq=typeof yy=="object"&&yy&&!yy.nodeType&&yy,Mq=jq&&typeof _y=="object"&&_y&&!_y.nodeType&&_y,H0e=Mq&&Mq.exports===jq,Uq=H0e?gt.Buffer:void 0,$q=Uq?Uq.allocUnsafe:void 0;function q0e(e,t){if(t)return e.slice();var r=e.length,n=$q?$q(r):new e.constructor(r);return e.copy(n),n}var Pk=q0e;function G0e(e){var t=new e.constructor(e.byteLength);return new Pa(t).set(new Pa(e)),t}var Fq=G0e;function W0e(e,t){var r=t?Fq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var zq=W0e;function V0e(e,t){var r=-1,n=e.length;t||(t=Array(n));while(++r<n)t[r]=e[r];return t}var Bq=V0e;var Hq=Object.create,K0e=function(){function e(){}return function(t){if(!Et(t))return{};if(Hq)return Hq(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),qq=K0e;var Z0e=Hg(Object.getPrototypeOf,Object),jc=Z0e;function J0e(e){return typeof e.constructor=="function"&&!Ma(e)?qq(jc(e)):{}}var Gq=J0e;function Y0e(e){return Qt(e)&&zo(e)}var Wq=Y0e;var X0e="[object Object]",Q0e=Function.prototype,eLe=Object.prototype,Vq=Q0e.toString,tLe=eLe.hasOwnProperty,rLe=Vq.call(Object);function nLe(e){if(!Qt(e)||vr(e)!=X0e)return!1;var t=jc(e);if(t===null)return!0;var r=tLe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Vq.call(r)==rLe}var Kq=nLe;function oLe(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var Rd=oLe;var iLe=Object.prototype,sLe=iLe.hasOwnProperty;function aLe(e,t,r){var n=e[t];if(!(sLe.call(e,t)&&An(n,r))||r===void 0&&!(t in e))$c(e,t,r)}var by=aLe;function cLe(e,t,r,n){var o=!r;r||(r={});var i=-1,s=t.length;while(++i<s){var a=t[i],c=n?n(r[a],e[a],a,r,e):void 0;if(c===void 0)c=e[a];if(o)$c(r,a,c);else by(r,a,c)}return r}var Zq=cLe;function lLe(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Jq=lLe;var uLe=Object.prototype,pLe=uLe.hasOwnProperty;function dLe(e){if(!Et(e))return Jq(e);var t=Ma(e),r=[];for(var n in e)if(!(n=="constructor"&&(t||!pLe.call(e,n))))r.push(n);return r}var Yq=dLe;function fLe(e){return zo(e)?Bg(e,!0):Yq(e)}var Fc=fLe;function mLe(e){return Zq(e,Fc(e))}var Xq=mLe;function gLe(e,t,r,n,o,i,s){var a=Rd(e,r),c=Rd(t,r),u=s.get(c);if(u){Cd(e,r,u);return}var d=i?i(a,c,r+"",e,t,s):void 0,f=d===void 0;if(f){var m=at(c),g=!m&&jo(c),h=!m&&!g&&Na(c);if(d=c,m||g||h)if(at(a))d=a;else if(Wq(a))d=Bq(a);else if(g)f=!1,d=Pk(c,!0);else if(h)f=!1,d=zq(c,!0);else d=[];else if(Kq(c)||ro(c)){if(d=a,ro(a))d=Xq(a);else if(!Et(a)||Rs(a))d=Gq(c)}else f=!1}if(f)s.set(c,d),o(d,c,n,i,s),s.delete(c);Cd(e,r,d)}var Qq=gLe;function eG(e,t,r,n,o){if(e===t)return;Nq(t,function(i,s){if(o||(o=new $o),Et(i))Qq(e,t,s,r,eG,n,o);else{var a=n?n(Rd(e,s),i,s+"",e,t,o):void 0;if(a===void 0)a=i;Cd(e,s,a)}},Fc)}var tG=eG;function hLe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var rG=hLe;var nG=Math.max;function _Le(e,t,r){return t=nG(t===void 0?e.length-1:t,0),function(){var n=arguments,o=-1,i=nG(n.length-t,0),s=Array(i);while(++o<i)s[o]=n[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=n[o];return a[t]=r(s),rG(e,this,a)}}var xy=_Le;function yLe(e){return function(){return e}}var oG=yLe;var bLe=!Uc?Fa:function(e,t){return Uc(e,"toString",{configurable:!0,enumerable:!1,value:oG(t),writable:!0})},iG=bLe;var xLe=800,vLe=16,SLe=Date.now;function ELe(e){var t=0,r=0;return function(){var n=SLe(),o=vLe-(n-r);if(r=n,o>0){if(++t>=xLe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var sG=ELe;var wLe=sG(iG),vy=wLe;function TLe(e,t){return vy(xy(e,t,Fa),e+"")}var aG=TLe;function ALe(e,t,r){if(!Et(r))return!1;var n=typeof t;if(n=="number"?zo(r)&&Fo(t,r.length):n=="string"&&(t in r))return An(r[t],e);return!1}var cG=ALe;function kLe(e){return aG(function(t,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;if(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&cG(r[0],r[1],s))i=o<3?void 0:i,o=1;t=Object(t);while(++n<o){var a=r[n];if(a)e(t,a,n,i)}return t})}var lG=kLe;var OLe=lG(function(e,t,r,n){tG(e,t,r,n)}),En=OLe;function CLe(e,t,r,n){if(!Et(e))return e;t=Bo(t,e);var o=-1,i=t.length,s=i-1,a=e;while(a!=null&&++o<i){var c=Pn(t[o]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var d=a[c];if(u=n?n(d,c,a):void 0,u===void 0)u=Et(d)?d:Fo(t[o+1])?[]:{}}by(a,c,u),a=a[c]}return e}var uG=CLe;function RLe(e,t,r){var n=-1,o=t.length,i={};while(++n<o){var s=t[n],a=ja(e,s);if(r(a,s))uG(i,Bo(s,e),a)}return i}var Sy=RLe;function ILe(e,t){return Sy(e,t,function(r,n){return eh(e,n)})}var pG=ILe;var dG=Zt?Zt.isConcatSpreadable:void 0;function PLe(e){return at(e)||ro(e)||!!(dG&&e&&e[dG])}var fG=PLe;function mG(e,t,r,n,o){var i=-1,s=e.length;r||(r=fG),o||(o=[]);while(++i<s){var a=e[i];if(t>0&&r(a))if(t>1)mG(a,t-1,r,n,o);else Da(o,a);else if(!n)o[o.length]=a}return o}var gG=mG;function DLe(e){var t=e==null?0:e.length;return t?gG(e,1):[]}var hG=DLe;function LLe(e){return vy(xy(e,void 0,hG),e+"")}var _G=LLe;var NLe=_G(function(e,t){return e==null?{}:pG(e,t)}),Ey=NLe;import{homedir as kMe}from"os";import{dirname as OMe,join as Tn,resolve as Zr}from"path";var MLe="Expected a function";function ULe(e){if(typeof e!="function")throw TypeError(MLe);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var yG=ULe;var $Le=Object.getOwnPropertySymbols,jLe=!$Le?Ng:function(e){var t=[];while(e)Da(t,Mg(e)),e=jc(e);return t},bG=jLe;function FLe(e){return Lg(e,Fc,bG)}var xG=FLe;function zLe(e,t){if(e==null)return{};var r=Qg(xG(e),function(n){return[n]});return t=th(t),Sy(e,r,function(n,o){return t(n,o[0])})}var vG=zLe;function BLe(e,t){return vG(e,yG(th(t)))}var SG=BLe;import{join as VLe}from"path";var Dk=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","ANTHROPIC_GOOGLE_CLOUD_PROJECT","ANTHROPIC_GOOGLE_CLOUD_LOCATION","ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID","CLOUD_ML_REGION"];var Lk=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL"];var Nk=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_FOUNDRY_AUTH_TOKEN","ANTHROPIC_AWS_API_KEY"],HLe=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],qLe=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT","CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT"];var GLe=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"],WLe=[...GLe,"AWS_PROFILE","AWS_CONFIG_FILE","AWS_SHARED_CREDENTIALS_FILE","GOOGLE_APPLICATION_CREDENTIALS","GOOGLE_CLOUD_PROJECT"];var qEt=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...Dk,...Lk,...Nk,...HLe,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...WLe,"GCLOUD_PROJECT","GOOGLE_CLOUD_QUOTA_PROJECT","GCE_METADATA_HOST","GCE_METADATA_IP","METADATA_SERVER_DETECTION","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","AWS_EC2_METADATA_SERVICE_ENDPOINT","AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE","AWS_REGION","AWS_DEFAULT_REGION",...qLe,"ANTHROPIC_BEDROCK_SERVICE_TIER","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK"]);var KLe="remote-settings.json",Mk=null,ZLe;var JLe=null,YLe=null;function Uk(){return}function XLe(){return Uk()??VLe(Yt(),KLe)}function QLe(){try{let e=bs(XLe()),t=yt(my(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return t}catch{return null}}var eNe=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...Dk,...Lk,"CLAUDE_CODE_CUSTOM_OAUTH_URL",...Nk,"ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE"].map((e)=>e.toUpperCase()));function tNe(e){if(!e?.env)return e;let t=SG(e.env,(r,n)=>eNe.has(n.toUpperCase()));return{...e,env:t}}function rNe(){if(!Uk()&&ZLe!==!0)return null;if(Mk)return Mk;let e=QLe();if(e)return Mk=e,YLe??=e,qi(),e;return null}function EG(){let e=rNe();if(e===JLe||Uk())return e;return tNe(e)}var wG=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];import{userInfo as nNe}from"os";var TG="com.anthropic.claudecode",Id="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Pd="HKCU\\SOFTWARE\\Policies\\ClaudeCode",pi="Settings",AG="/usr/bin/plutil",kG=["-convert","json","-o","-","--"],OG=5000,$k="/mnt/c/Windows/System32/reg.exe",zc="/mnt/c/Program Files/ClaudeCode";function wy(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=be("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function CG(){let e="";try{e=nNe().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${TG}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${TG}.plist`,label:"device-level managed preferences"}),t}import{isAbsolute as RG}from"path";var oNe=C(()=>l.object({allowedDomains:l.array(l.string()).optional(),deniedDomains:l.array(l.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),strictAllowlist:l.boolean().optional().describe("When true, the sandbox runtime deterministically denies hosts not in allowedDomains instead of prompting. "+"Enforced for sandboxed commands only — in-process tools such as WebFetch are not gated by this setting. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),allowManagedDomainsOnly:l.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:l.array(l.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:l.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:l.boolean().optional(),allowMachLookup:l.array(l.string().refine((e)=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:l.number().optional(),socksProxyPort:l.number().optional(),tlsTerminate:l.object({caCertPath:l.string().min(1).optional(),caKeyPath:l.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — project settings "+"(.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),iNe=C(()=>l.object({allowWrite:l.array(l.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:l.array(l.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:l.array(l.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:l.array(l.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:l.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used."),disabled:l.boolean().optional().describe("macOS and Linux/WSL only: skip filesystem isolation entirely while keeping network and seccomp isolation. Ignored on native Windows, where the sandboxed process runs as a separate user with no inherent rights, so skipping the filesystem rules would "+"withhold every access grant rather than loosen them — filesystem isolation stays on there. "+"Sandboxed commands get unrestricted read/write access to the host filesystem; network egress is still confined to network.allowedDomains. Intended for deployments whose goal is egress control rather than filesystem containment. Does not change Bash prompting: sandbox.autoAllowBashIfSandboxed is independent and still defaults to true, so set it to false to keep prompting for sandboxed commands. Drops the read protection from filesystem.denyRead and credentials.files for sandboxed commands, since both are enforced by the filesystem layer this turns off; credentials.envVars deny/mask is unaffected. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. If managed settings configure sandbox.filesystem at all, or list any sandbox.credentials.files entry, only managed settings can set this: an admin who deployed filesystem restrictions must not have them switched off by a user-writable "+"file. (sandbox.credentials.envVars does not pin it — env scrubbing is independent of "+"the filesystem layer and survives this setting.) When unset, filesystem isolation stays on.")}).optional()),jk=C(()=>l.object({path:l.string().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:l.literal("deny").describe("Access mode for this path. Only `deny` is supported.")})),Fk=C(()=>l.object({name:l.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores").describe("Environment variable name."),mode:l.enum(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the "+"host proxy swaps sentinel→real on egress to `injectHosts`."),injectHosts:l.array(l.string()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")})),sNe=C(()=>l.object({files:l.array(jk()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox."),envVars:l.array(Fk()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:l.boolean().optional().describe("Allow sentinel→real substitution on the plain-HTTP proxy path. "+"Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored.")}).optional()),zk=C(()=>l.object({enabled:l.boolean().optional(),failIfUnavailable:l.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:l.boolean().optional(),allowUnsandboxedCommands:l.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:oNe(),filesystem:iNe(),credentials:sNe(),ignoreViolations:l.record(l.string(),l.array(l.string())).optional(),enableWeakerNestedSandbox:l.boolean().optional(),enableWeakerNetworkIsolation:l.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:l.boolean().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. "+"**Removes code-execution isolation** — sandboxed commands can launch other applications "+"unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:l.array(l.string()).optional(),ripgrep:l.object({command:l.string(),args:l.array(l.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:l.preprocess((e)=>typeof e==="string"&&RG(e)?e:void 0,l.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:l.preprocess((e)=>typeof e==="string"&&RG(e)?e:void 0,l.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var Dd=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],IG=[...Dd],PG=IG;function Ld(e){return e==="manual"?"default":e}var pwt=`Cannot set permission mode: must be one of ${IG.join(", ")}`;var DG=["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"],LG=["normal","vim"],NG=["auto","tmux","iterm2","in-process"],aNe=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],MG=["auto",...aNe];var gwt=no()==="macos"?"⏺":"●";var Ewt=C(()=>ru.preprocess(Ld,ru.enum(PG))),wwt=C(()=>ru.preprocess(Ld,ru.enum(Dd)));var UG=["bash","powershell"];var Nd=C(()=>l.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function cNe(){let e=l.object({type:l.literal("command").describe("Shell command hook type"),command:l.string().describe("Shell command to execute"),args:l.array(l.string()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:Nd(),shell:l.enum(UG).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:l.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:l.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:l.string().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:l.string().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".')}),t=l.object({type:l.literal("prompt").describe("LLM prompt hook type"),prompt:l.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:l.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:l.boolean().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),r=l.object({type:l.literal("mcp_tool").describe("MCP tool hook type"),server:l.string().describe("Name of an already-configured MCP server to invoke"),tool:l.string().describe("Name of the tool on that server to call"),input:l.record(l.string(),l.unknown()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),n=l.object({type:l.literal("http").describe("HTTP hook type"),url:l.string().url().describe("URL to POST the hook input JSON to"),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:l.record(l.string(),l.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:l.array(l.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),o=l.object({type:l.literal("agent").describe("Agentic verifier hook type"),prompt:l.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Nd(),timeout:l.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:l.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:n,AgentHookSchema:o,McpToolHookSchema:r}}var $G=C(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:r,HttpHookSchema:n,McpToolHookSchema:o}=cNe();return l.discriminatedUnion("type",[e,t,r,n,o])}),jG=C(()=>l.object({matcher:l.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:l.array($G()).describe("List of hooks to execute when the matcher matches")})),vs=C(()=>l.partialRecord(l.enum(Os),l.array(jG())));var Lwt=C(()=>l.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),Nwt=C(()=>l.enum(["stdio","sse","sse-ide","http","ws","sdk"])),Bc=C(()=>l.literal("comms").optional().catch(void 0)),di=C(()=>l.number().int().positive()),lNe=300000,FG=C(()=>l.number().int().positive().optional().catch(void 0).describe("@internal CCR backend wire hint; folded into timeout at parse."));function zG({request_timeout_ms:e,...t}){return{...t,...t.timeout===void 0&&e!==void 0&&{timeout:Math.min(e,lNe)}}}var uNe=C(()=>l.object({type:l.literal("stdio").optional(),command:l.string().min(1,"Command cannot be empty"),args:l.array(l.string()).default([]),env:l.record(l.string(),l.string()).optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),pNe=C(()=>l.boolean()),BG=C(()=>l.object({clientId:l.string().optional(),callbackPort:l.number().int().positive().optional(),authServerMetadataUrl:l.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:l.string().min(1).optional(),xaa:pNe().optional()})),HG=C(()=>l.object({name:l.string(),permission_policy:l.enum(["always_allow","always_ask","always_deny"]).optional()})),dNe=C(()=>l.object({type:l.literal("sse"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:BG().optional(),timeout:di().optional(),request_timeout_ms:FG(),tools:l.array(HG()).optional(),alwaysLoad:l.boolean().optional(),role:Bc(),toolPermissions:l.record(l.string(),Bk()).optional(),discoveryCache:l.boolean().optional()}).transform(zG)),fNe=C(()=>l.object({type:l.literal("sse-ide"),url:l.string(),ideName:l.string(),ideRunningInWindows:l.boolean().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),mNe=C(()=>l.object({type:l.literal("ws-ide"),url:l.string(),ideName:l.string(),authToken:l.string().optional(),ideRunningInWindows:l.boolean().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),gNe=C(()=>l.object({type:l.enum(["http","streamable-http"]).transform(()=>"http"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:BG().optional(),timeout:di().optional(),request_timeout_ms:FG(),tools:l.array(HG()).optional(),alwaysLoad:l.boolean().optional(),role:Bc(),toolPermissions:l.record(l.string(),Bk()).optional(),discoveryCache:l.boolean().optional()}).transform(zG)),hNe=C(()=>l.object({type:l.literal("ws"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),role:Bc()})),_Ne=C(()=>l.object({type:l.literal("sdk"),name:l.string(),timeout:di().optional(),alwaysLoad:l.boolean().optional()})),Bk=C(()=>l.enum(["allow","ask","blocked"])),yNe=C(()=>l.object({type:l.literal("claudeai-proxy"),url:l.string(),id:l.string(),displayName:l.string().optional(),iconUrl:l.string().optional(),timeout:di().optional(),alwaysLoad:l.boolean().optional(),toolPermissions:l.record(l.string(),Bk()).optional(),stateless:l.boolean().optional(),cachedInitResponse:l.record(l.string(),l.unknown()).nullish(),eligible:l.boolean().nullish(),ineligibleReason:l.string().nullish()})),Ty=C(()=>l.union([uNe(),dNe(),fNe(),mNe(),gNe(),hNe(),_Ne(),yNe()]));var Mwt=C(()=>l.object({mcpServers:l.record(l.string(),Ty())}));var bNe=new Set(["claude-community","claude-plugins-community","healthcare"]),xNe=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins","first-party-plugins"]),VG=new Set([...xNe,...bNe]);var vNe=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,SNe=/[^\u0020-\u007E]/;function ENe(e){if(VG.has(e.toLowerCase()))return!1;if(SNe.test(e))return!0;return vNe.test(e)}var wn=C(()=>l.string().startsWith("./")),Ss=C(()=>wn().endsWith(".json")),qG=C(()=>l.union([wn().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),l.string().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),qk=C(()=>wn().endsWith(".md")),Gk=C(()=>l.union([qk(),wn()])),KG=C(()=>l.string().min(1,"Marketplace must have a name").refine((e)=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine((e)=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine((e)=>!ENe(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine((e)=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine((e)=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine((e)=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Wk=C(()=>l.object({name:l.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:l.string().optional().describe("Contact email for support or feedback"),url:l.string().optional().describe("Website, GitHub profile, or organization URL")})),wNe=C(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:l.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:l.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:l.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Wk().optional().describe("Information about the plugin creator or maintainer"),homepage:l.string().url().optional().describe("Plugin homepage or documentation URL"),repository:l.string().optional().describe("Source code repository URL"),license:l.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:l.array(l.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:l.boolean().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:l.array(oMe()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),Kwt=C(()=>l.object({description:l.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:l.lazy(()=>vs()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),TNe=C(()=>l.object({hooks:l.union([Ss().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>vs()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),l.array(l.union([Ss().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>vs()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),ANe=C(()=>l.object({source:Gk().optional().describe("Path to command markdown file, relative to plugin root"),content:l.string().optional().describe("Inline markdown content for the command"),description:l.string().optional().describe("Command description override"),argumentHint:l.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:l.string().optional().describe("Default model for this command"),allowedTools:l.array(l.string()).optional().describe("Tools allowed when command runs")}).refine((e)=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),kNe=C(()=>l.object({commands:l.union([Gk().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),l.array(Gk().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),l.record(l.string(),ANe()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),ONe=C(()=>l.object({agents:l.union([qk().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),l.array(qk().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),CNe=C(()=>l.object({skills:l.union([wn().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan)."),l.array(wn().describe("Path to a skill directory, relative to the plugin root.")).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),ZG=C(()=>l.object({outputStyles:l.union([wn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),l.array(wn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),RNe=C(()=>l.string().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),INe=16,PNe=C(()=>l.object({id:RNe(),remote:l.string().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:l.string().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),DNe=C(()=>l.object({syntaxHighlighting:l.object({hljsLanguages:l.array(PNe()).max(INe)}).strict()})),JG=C(()=>l.object({themes:l.union([wn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),l.array(wn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),LNe=C(()=>l.object({})),GG=C(()=>l.string().min(1)),NNe=C(()=>l.string().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),MNe=C(()=>l.object({mcpServers:l.union([Ss().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),qG().describe("Path or URL to MCPB file containing MCP server configuration"),l.record(l.string(),Ty()).describe("MCP server configurations keyed by server name"),l.array(l.union([Ss().describe("Path to MCP servers configuration file"),qG().describe("Path or URL to MCPB file"),l.record(l.string(),Ty()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),YG=C(()=>l.object({type:l.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:l.string().describe("Human-readable label shown in the config dialog"),description:l.string().describe("Help text shown beneath the field in the config dialog"),required:l.boolean().optional().describe("If true, validation fails when this field is empty"),default:l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]).optional().describe("Default value used when the user provides nothing"),multiple:l.boolean().optional().describe("For string type: allow an array of strings"),sensitive:l.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:l.number().optional().describe("Minimum value (number type only)"),max:l.number().optional().describe("Maximum value (number type only)")}).strict()),UNe=C(()=>l.object({userConfig:l.record(l.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),YG()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),$Ne=C(()=>l.object({channels:l.array(l.object({server:l.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:l.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:l.record(l.string(),YG()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),WG=C(()=>l.strictObject({command:l.string().min(1).refine((e)=>{if(e.includes(" ")&&!e.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:l.array(GG()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:l.record(NNe(),GG()).refine((e)=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:l.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:l.record(l.string(),l.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:l.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:l.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:l.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:l.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:l.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:l.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:l.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:l.boolean().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),jNe=C(()=>l.strictObject({name:l.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:l.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:l.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:l.union([l.literal("always"),l.string().startsWith("on-skill-invoke:").refine((e)=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),FNe=C(()=>l.array(jNe()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),XG=C(()=>l.object({monitors:l.union([Ss().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),FNe()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),zNe=C(()=>l.object({lspServers:l.union([Ss().describe("Path to .lsp.json configuration file relative to plugin root"),l.record(l.string(),WG()).describe("LSP server configurations keyed by server name"),l.array(l.union([Ss().describe("Path to LSP configuration file"),l.record(l.string(),WG()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),QG=C(()=>l.string().refine((e)=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine((e)=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,r=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||r.test(e)},"Invalid npm package name format")),BNe=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,HNe=/^[0-9a-f]{64}$/;var qNe=64;var GNe=C(()=>l.object({sha256:l.string().regex(HNe)}));function WNe(e){let t=l.record(l.string(),l.unknown()).safeParse(e);if(!t.success)return;let r=Object.create(null),n=0;for(let[o,i]of Object.entries(t.data)){if(n>=qNe)break;let s=GNe().safeParse(i);if(BNe.test(o)&&s.success)r[o]=s.data,n++}return n>0?r:void 0}var VNe=C(()=>l.object({binaries:l.unknown().transform(WNe).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),KNe=C(()=>l.object({settings:l.record(l.string(),l.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),ZNe=C(()=>l.object({experimental:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,l.object({...JG().partial().shape,...DNe().partial().shape,...XG().partial().shape,...ZG().partial().shape,evals:l.union([l.string(),l.array(l.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))}));var JNe=C(()=>l.object({...wNe().shape,...TNe().partial().shape,...kNe().partial().shape,...ONe().partial().shape,...CNe().partial().shape,...ZG().partial().shape,...JG().partial().shape,...LNe().shape,...$Ne().partial().shape,...MNe().partial().shape,...zNe().partial().shape,...XG().partial().shape,...KNe().partial().shape,...UNe().partial().shape,...VNe().partial().shape,...ZNe().partial().shape})),Md=C(()=>l.discriminatedUnion("source",[l.object({source:l.literal("url"),url:l.string().url().describe("Direct URL to marketplace.json file"),headers:l.record(l.string(),l.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:l.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),l.object({source:l.literal("git"),url:l.string().describe("Full git repository URL"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:l.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),l.object({source:l.literal("npm"),package:QG().describe("NPM package containing marketplace.json")}),l.object({source:l.literal("file"),path:l.string().describe("Local file path to marketplace.json")}),l.object({source:l.literal("directory"),path:l.string().describe("Local directory containing .claude-plugin/marketplace.json")}),l.object({source:l.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),l.object({source:l.literal("hostPattern"),hostPattern:l.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),l.object({source:l.literal("pathPattern"),pathPattern:l.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),l.object({source:l.literal("settings"),name:KG().refine((e)=>!VG.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:l.array(YNe()).describe("Plugin entries declared inline in settings.json"),owner:Wk().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Hk=C(()=>l.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),e6=C(()=>l.union([l.preprocess((e)=>e==="."?"./":e,wn()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),l.object({source:l.literal("npm"),package:QG().or(l.string().refine((e)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:l.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:l.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),l.object({source:l.literal("url"),url:l.string().describe("Full git repository URL (https:// or git@)"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("git-subdir"),url:l.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:l.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Hk().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),l.object({source:l.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. Never authored by hand — PluginMarketplaceSchema rewrites "+'unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),YNe=C(()=>l.object({name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:e6().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:l.string().optional(),version:l.string().optional(),strict:l.boolean().optional()}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine((e)=>typeof e.source==="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."}));var XNe=C(()=>l.object({cli:l.array(l.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:l.array(l.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filesRead:l.array(l.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) — the plugin is relevant when a file Claude has read '+"this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive."),manifestDeps:l.array(l.object({file:l.string().max(256),pattern:l.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:l.array(l.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) — the plugin is relevant when the '+`session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),QNe=C(()=>l.object({topic:l.string().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:XNe().optional().describe("Matchers that determine when the plugin is relevant.")})),eMe=C(()=>JNe().partial().extend({name:l.string().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:e6().describe("Where to fetch the plugin from"),category:l.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:l.array(l.string()).optional().describe("Tags for searchability and discovery"),strict:l.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,QNe().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),tMe=C(()=>l.object({name:l.string().min(1).refine((e)=>!e.includes(" "))}));function rMe(e){let t=eMe();return e.flatMap((r,n)=>{let o=t.safeParse(r);if(o.success)return[o.data];let i=tMe().safeParse(r).data?.name,s=o.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(i)return ce(`Stubbing unparseable marketplace plugin entry (${i}): ${s}`,{level:"warn"}),[{name:i,source:{source:"unsupported"},strict:!0}];return ce(`Dropping unparseable marketplace plugin entry (index ${n}): ${s}`,{level:"warn"}),[]})}var Zwt=C(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:KG(),version:l.string().optional().describe("Marketplace manifest version"),description:l.string().optional().describe("Human-readable description of this marketplace"),owner:Wk().describe("Marketplace maintainer or curator information"),plugins:l.array(l.unknown()).transform(rMe).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:l.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:l.object({pluginRoot:l.string().optional().describe("Base path for relative plugin sources"),version:l.string().optional().describe("Marketplace version"),description:l.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:l.array(l.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust."),renames:l.record(l.string(),l.string().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name → current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),t6=C(()=>l.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),nMe=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,oMe=C(()=>l.union([l.string().regex(nMe,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),l.object({name:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),iMe=C(()=>l.object({version:l.string().describe("Currently installed version"),installedAt:l.string().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),installPath:l.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:l.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),Jwt=C(()=>l.object({version:l.literal(1).describe("Schema version 1"),plugins:l.record(t6(),iMe()).describe("Map of plugin IDs to their installation metadata")})),sMe=C(()=>l.enum(["managed","user","project","local"])),aMe=C(()=>l.object({scope:sMe().describe("Installation scope"),projectPath:l.string().optional().describe("Project path (required for project/local scopes)"),installPath:l.string().describe("Absolute path to the versioned plugin directory"),version:l.string().optional().describe("Currently installed version"),installedAt:l.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to"),auto:l.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),Ywt=C(()=>l.object({version:l.literal(2).describe("Schema version 2"),plugins:l.record(t6(),l.array(aMe())).describe("Map of plugin IDs to arrays of installation entries")})),cMe=C(()=>l.object({source:Md().describe("Where to fetch the marketplace from"),installLocation:l.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:l.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Xwt=C(()=>l.record(l.string(),cMe()));var lMe=["autoMode","deepLink","voice","briefView","screenReader"],Vk={},Ay={autoMode:{buildGate:()=>!1,shape:()=>Vk,permissionsShape:()=>Vk,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:l.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!0,shape:()=>({voiceEnabled:l.boolean().optional().describe("Enable voice mode (hold-to-talk dictation)")})},briefView:{buildGate:()=>!0,shape:()=>({defaultView:l.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>Vk}};function Kk(){return lMe.filter((e)=>Ay[e].buildGate())}function r6(e){let t={};for(let r of e)t={...t,...Ay[r].shape()};return t}function n6(e){let t={};for(let r of e)t={...t,...Ay[r].permissionsShape?.()};return t}function o6(e){let t=[];for(let r of e)t.push(...Ay[r].permissionModes?.()??[]);return t}function Zk(e){let t=e.split("__"),[r,n,...o]=t;if(r!=="mcp"||!n)return null;let i=o.length>0?o.join("__"):void 0;return{serverName:n,toolName:i}}var i6={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};function Hc(e){return Object.hasOwn(i6,e)?i6[e]:e}var s6="workspace",lTt=`mcp__${s6}__bash`,uTt=`mcp__${s6}__web_fetch`;function Jk(e){return e.includes("*")}function uMe(e){return e.replaceAll("\\","\\\\").replaceAll("(","\\(").replaceAll(")","\\)")}function pMe(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function a6(e){let t=dMe(e,"(");if(t===-1)return{toolName:Hc(e)};let r=fMe(e,")");if(r===-1||r<=t)return{toolName:Hc(e)};if(r!==e.length-1)return{toolName:Hc(e)};let n=e.substring(0,t),o=e.substring(t+1,r);if(!n)return{toolName:Hc(e)};if(o===""||o==="*")return{toolName:Hc(n)};let i=pMe(o);return{toolName:Hc(n),ruleContent:i}}function Yk(e){if(!e.ruleContent)return e.toolName;let t=uMe(e.ruleContent);return`${e.toolName}(${t})`}function dMe(e,t){for(let r=0;r<e.length;r++)if(e[r]===t){let n=0,o=r-1;while(o>=0&&e[o]==="\\")n++,o--;if(n%2===0)return r}return-1}function fMe(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){let n=0,o=r-1;while(o>=0&&e[o]==="\\")n++,o--;if(n%2===0)return r}return-1}var ky={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:(e)=>{if(e.includes("*")||e.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:(e)=>{if(e.includes("://")||e.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!e.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function c6(e){return ky.filePatternTools.includes(e)}function l6(e){return ky.bashPrefixTools.includes(e)}function u6(e){return Object.hasOwn(ky.customValidation,e)?ky.customValidation[e]:void 0}function d6(e,t){let r=0,n=t-1;while(n>=0&&e[n]==="\\")r++,n--;return r%2!==0}function Xk(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t&&!d6(e,n))r++;return r}function mMe(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!d6(e,t))return!0}return!1}function p6(e){if(!Jk(e))return null;let t=Zk(e);if(t&&!Jk(t.serverName))return null;return{valid:!1,error:`Wildcard tool name "${e}" is not supported in allow rules`,suggestion:"An allow pattern must name the scope it widens — globs are permitted only in the tool position after a literal mcp__<server>__ prefix. Deny and ask rules accept wildcards anywhere",examples:["mcp__puppeteer__*","mcp__github__get_*"]}}function Qk(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let r=Xk(e,"("),n=Xk(e,")");if(r!==n)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(mMe(e)){let a=e.substring(0,e.indexOf("("));if(!a)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${a}" without parentheses`,examples:[`${a}`,`${a}(some-pattern)`]}}let o=a6(e),i=Zk(o.toolName);if(i){if(o.ruleContent!==void 0||Xk(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${o.toolName}" without parentheses, or use "mcp__${i.serverName}__*" for all tools`,examples:[`mcp__${i.serverName}`,`mcp__${i.serverName}__*`,i.toolName&&i.toolName!=="*"?`mcp__${i.serverName}__${i.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let a=p6(o.toolName);if(a)return a}return{valid:!0}}if(!o.toolName||o.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let a=p6(o.toolName);if(a)return a}if(!o.toolName.includes("_")&&o.toolName[0]!==o.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${qy(String(o.toolName))}"`};let s=u6(o.toolName);if(s&&o.ruleContent!==void 0){let a=s(o.ruleContent);if(!a.valid)return a}if(l6(o.toolName)&&o.ruleContent!==void 0){let a=o.ruleContent;if(a.includes(":*")&&!a.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(a===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}if(c6(o.toolName)&&o.ruleContent!==void 0){if(o.ruleContent.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${o.toolName}(*.ts) - matches .ts files`,`${o.toolName}(src/**) - matches all files in src`,`${o.toolName}(**/*.test.ts) - matches test files`]}}if(o.ruleContent!==void 0){let a=o.toolName==="Write"||o.toolName==="NotebookEdit"||o.toolName==="MultiEdit"?"Edit":o.toolName==="Glob"?"Read":void 0;if(a!==void 0&&!o.ruleContent.includes(":*"))return{valid:!0,warning:`${Yk(o)} is not matched by file permission checks — only ${a}(path) rules are. Use ${Yk({toolName:a,ruleContent:o.ruleContent})} instead (${a} rules cover all file-${a==="Edit"?"editing":"reading"} tools).`}}return{valid:!0}}var eO=C(()=>m6()),f6=C(()=>m6("allow"));function m6(e){return l.string().superRefine((t,r)=>{let n=Qk(t,e);if(!n.valid){let o=n.error;if(n.suggestion)o+=`. ${n.suggestion}`;if(n.examples&&n.examples.length>0)o+=`. Examples: ${n.examples.join(", ")}`;r.addIssue({code:l.ZodIssueCode.custom,message:o,params:{received:t}})}})}var gMe=C(()=>l.record(l.string(),l.coerce.string()));function b6(e){return l.object({allow:l.array(f6()).optional().describe("List of permission rules for allowed operations"),deny:l.array(eO()).optional().describe("List of permission rules for denied operations"),ask:l.array(eO()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:l.preprocess(Ld,l.enum([...Dd,...o6(e)])).optional().describe("Default permission mode when Claude Code needs access ('manual' is accepted as an alias for 'default')"),disableBypassPermissionsMode:l.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...n6(e),additionalDirectories:l.array(l.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var PTt=C(()=>b6(Kk())),hMe=C(()=>l.object({source:Md().describe("Where to fetch the marketplace from"),installLocation:l.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Oy=C(()=>l.object({serverName:l.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:l.array(l.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>jS([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),Cy=C(()=>l.object({serverName:l.string().min(1,"Server name must be non-empty").refine((e)=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine((e)=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:l.array(l.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>jS([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),_Me=C(()=>l.object({path:l.string().describe("Absolute path to the helper executable"),timeoutMs:l.number().int().min(1000).optional(),refreshIntervalMs:l.union([l.literal(0),l.number().int().min(60000)]).optional()})),g6=["skills","agents","hooks","mcp"],h6=Object.freeze({type:"invalid-entry-stripped"}),yMe=C(()=>l.union([l.object({type:l.literal("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:l.string().describe("Regex matched against turn output (tool results and assistant text)"),url:l.string().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:l.string().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),l.object({type:l.string().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));function x6(e){return l.object({$schema:l.string().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:l.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:l.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:l.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:l.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:l.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),processWrapper:l.string().optional().describe("Corporate launcher argv prefix for the background-agent supervisor, the sessions and workers it hosts, and the other covered background processes listed in the Claude Code corporate-launcher documentation. Equivalent to the CLAUDE_CODE_PROCESS_WRAPPER environment variable, which takes precedence when set. Honored from managed settings, a --settings/SDK-supplied settings file, and user settings, in that precedence order; project and local settings are ignored."),policyHelper:_Me().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...Hr.CLAUDE_CODE_ENABLE_XAA&&{xaaIdp:l.object({issuer:l.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:l.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:l.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:l.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:l.object({enabled:l.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:l.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 30). Re-fires every interval until you take a break."),breakThresholdMinutes:l.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 10)"),message:l.string().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:l.object({enabled:l.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:l.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:l.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:l.number().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),skillListingMaxDescChars:l.number().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:l.number().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:l.boolean().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:gMe().optional().describe("Environment variables to set for Claude Code sessions"),attribution:l.object({commit:l.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:l.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:l.boolean().optional().describe("Whether to append the claude.ai session link to commits and PRs created from web or Remote Control sessions (default: true). Set to false to omit the Claude-Session trailer and PR-body link.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:l.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,includeGitInstructions:l.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:b6(e).optional().describe("Tool usage permissions configuration"),model:l.string().optional().describe("Override the default model used by Claude Code"),fallbackModel:l.array(l.string()).optional().describe('Fallback model(s) tried in order when the primary model is overloaded or unavailable. Each element accepts a model name or alias; "default" expands to the default model. CLI --fallback-model takes precedence.'),availableModels:l.array(l.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),enforceAvailableModels:l.boolean().optional().describe("When true and availableModels is a non-empty array, the Default model selection is also constrained: if the default model for the user tier is not in availableModels, Default resolves to the first allowed availableModels entry instead. Has no effect when availableModels is unset or an empty array. Typically set in managed settings by enterprise administrators."),modelOverrides:l.record(l.string(),l.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:l.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:l.array(l.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:l.array(l.string()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:l.boolean().optional().describe("When true in any settings source, claude.ai MCP cloud connectors are not auto-fetched or connected. "+"Only gates auto-fetched connectors — a claudeai-proxy server passed explicitly "+"(e.g. via --mcp-config or the SDK mcpServers option) still follows the normal MCP config trust flow. Any-source-true wins: a project can opt out, but a project-level false cannot override a user-level true."),skillOverrides:l.record(l.string(),l.enum(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),disableBundledSkills:l.boolean().optional().describe("Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely; built-in slash commands stay typable but are hidden from the model. Plugins, .claude/skills/, and .claude/commands/ are unaffected. Equivalent to CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1."),allowedMcpServers:l.array(Oy()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:l.array(Cy()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:vs().optional().describe("Custom commands to run before/after tool executions"),worktree:l.object({symlinkDirectories:l.array(l.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:l.array(l.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:l.enum(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:l.enum(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:l.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:l.boolean().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:l.boolean().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:l.boolean().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:l.boolean().optional().describe("Disable the Artifact tool (also via CLAUDE_CODE_DISABLE_ARTIFACT)."),enableArtifact:l.boolean().optional().describe("Enable or disable the Artifact tool for this user. Unset defaults to enabled once the feature is available."),enableWorkflows:l.boolean().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowSizeGuideline:l.enum(["unrestricted","small","medium","large"]).optional().describe('Advisory size guideline for the dynamic workflows Claude writes: "small" aims for fewer than 5 agents, "medium" (the default) fewer than 15, "large" fewer than 50, and "unrestricted" sends no guideline. A value here — including from managed settings — takes precedence over the "Dynamic workflow size" choice in /config, and that /config row is hidden while a settings file provides the key. This is a guideline, not an enforced limit.'),workflowKeywordTriggerEnabled:l.boolean().optional().describe('Enable the "ultracode" keyword trigger: including the keyword in a prompt opts that turn into the Workflow tool. Set to false to disable the trigger. Default: true.'),disableSkillShellExecution:l.boolean().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:l.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),respondToBashCommands:l.boolean().optional().describe("Whether Claude responds after an input-box ! bash command runs. Set to false to add the command output to context without a response. Default: true."),allowManagedHooksOnly:l.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:l.array(l.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:l.array(l.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:l.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:l.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:l.boolean().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:l.preprocess((t)=>Array.isArray(t)?t.filter((r)=>g6.includes(r)):t,l.union([l.boolean(),l.array(l.enum(g6))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:l.object({type:l.literal("command"),command:l.string(),padding:l.number().optional(),refreshInterval:l.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:l.boolean().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:l.string().optional().describe('URL template for PR links in the footer link badges and inline messages. The detected git PR is rendered as the first footer-link badge. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),footerLinksRegexes:l.array(yMe().catch(h6)).transform((t)=>t.filter((r)=>r!==h6)).optional().catch(void 0).describe("Extra clickable footer badges that appear when a regex matches turn output (tool results and assistant responses). Read from user, flag, and managed settings only; ignored in project .claude/settings.json and local .claude/settings.local.json. At most 5 badges render; the oldest is displaced by newer matches and /clear removes them. Use to surface IDs printed by project CLIs as session links."),subagentStatusLine:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:l.record(l.string(),l.union([l.array(l.string()),l.boolean(),l.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:l.record(l.string(),hMe()).check((t)=>{for(let[r,n]of Object.entries(t.value))if(n.source.source==="settings"&&n.source.name!==r)t.issues.push({code:"custom",input:n.source.name,path:[r,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${r}" but source.name "${n.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:l.array(Md()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. "+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:l.array(Md()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),disableSideloadFlags:l.boolean().optional().describe("When true (and set in managed settings), rejects the --plugin-dir, --plugin-url, --agents, and non-sdk --mcp-config CLI flags at startup. Closes the CLI-flag bypass of strictKnownMarketplaces. Pair with allowedMcpServers for per-server MCP control; this setting does not gate other MCP entry points (SDK setMcpServers, claude mcp add, .mcp.json). Also blocks surfaces that spawn the CLI with these flags internally (see settings documentation). Only honored from managed settings; ignored in user/project/local settings."),pluginSuggestionMarketplaces:l.array(l.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips). No marketplace-declared suggestions surface without this allowlist; the built-in first-party frontend-design tip is unaffected. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored. The official marketplace is exempt from the source requirement: allowlisting its name alone suffices, since that name can only register from the official Anthropic source."),forceLoginMethod:l.enum(["claudeai","console","gateway"]).optional().catch(void 0).describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing, "gateway" for the Cloud gateway OIDC device flow'),forceLoginGatewayUrl:l.string().url().optional().catch(void 0).describe('@internal Cloud gateway URL to pre-fill and auto-connect to during login. Typically set in local managed settings alongside forceLoginMethod: "gateway" so users never type the URL. Hidden from public SDK types until Cloud gateway is documented.'),parentSettingsBehavior:l.enum(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),forceLoginOrgUUID:l.union([l.string(),l.array(l.string())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:l.boolean().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:l.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:l.string().optional().describe("Controls the output style for assistant responses"),viewMode:l.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:l.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:l.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:zk().optional(),feedbackSurveyRate:l.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),feedbackDrafts:l.enum(["notify","quiet","off"]).optional().describe('Model-drafted feedback (the SendFeedback tool). "notify" (default) shows a one-line notice when a draft is queued; "quiet" shows only the footer counter; "off" disables the tool entirely so drafts are never queued.'),spinnerTipsEnabled:l.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:l.object({mode:l.enum(["append","replace"]),verbs:l.array(l.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:l.object({excludeDefault:l.boolean().optional(),tips:l.array(l.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:l.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:l.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:l.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:l.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),ultracode:l.boolean().optional().catch(void 0).describe("Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. "+"Session-scoped — typically provided via --settings or the apply_flag_settings control request; "+"interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model."),autoCompactWindow:l.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:l.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:l.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:l.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:l.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),emojiCompletionEnabled:l.boolean().optional().describe("When false, the :emoji: shortcode typeahead (the suggestion popup and the :name: inline replacement) is disabled. When absent or true, it is enabled."),awaySummaryEnabled:l.boolean().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:l.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),askUserQuestionTimeout:l.enum(["60s","5m","10m","never"]).optional().catch(void 0).describe("Idle time before Claude's questions auto-continue with any answers "+"selected so far. Defaults to never — auto-continue only runs "+"when explicitly set to 60s/5m/10m."),agent:l.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:l.array(l.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:l.record(l.string(),l.object({mcpServers:l.record(l.string(),l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(l.undefined())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:l.object({defaultEnvironmentId:l.string().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:l.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:l.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:l.string().optional().describe("Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup with instructions to update. Only enforced from managed (policy) settings."),requiredMaximumVersion:l.string().optional().describe("Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. Only enforced from managed (policy) settings."),plansDirectory:l.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:l.enum(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:l.object({enabled:l.boolean().optional(),mode:l.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:l.boolean().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:l.boolean().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:l.array(l.object({marketplace:l.string(),plugin:l.string()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:l.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:l.boolean().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),totalTokensReminder:l.enum(["off","infinite","fixed","countdown","padded-countdown"]).optional().describe("@internal Emit a <total_tokens>N tokens left</total_tokens> block in the system prompt, after each tool result, and (when totalTokensReminderAfterUserTurn is on) after each regular user prompt. 'infinite' uses the literal value Infinite, 'fixed' uses 5000000, 'countdown' uses the live remaining context-window tokens, 'padded-countdown' counts down from totalTokensReminderBudget (re-anchoring to the full budget on each regular user prompt when totalTokensReminderAfterUserTurn "+"is on — task-budget semantics). Defaults to off. Env var "+"CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:l.number().int().positive().optional().describe("@internal Starting budget (tokens) for totalTokensReminder 'padded-countdown' mode. Defaults to 15000000. Server-controlled via GrowthBook; env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET overrides."),totalTokensReminderAfterUserTurn:l.boolean().optional().describe("@internal When true, emit the totalTokensReminder block after each regular user prompt and (for 'padded-countdown') re-anchor the task budget to the full configured value at the start of each user turn. When false, the reminder appears only in the system prompt and after each tool-result batch, and 'padded-countdown' counts down over the whole session. Defaults to off. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN overrides; server-controlled via GrowthBook tengu_lapis_anchor_user_turn."),autoMemoryEnabled:l.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:l.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:l.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:l.boolean().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:l.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:l.boolean().optional().describe("@internal Whether the user has accepted the multi-agent workflow usage warning. Until set, auto permission mode prompts before running a workflow."),disableAutoMode:l.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:l.array(l.object({id:l.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:l.string().describe("Display name for the SSH connection"),sshHost:l.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:l.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:l.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:l.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:l.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:l.array(l.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:l.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:l.union([l.enum(MG),l.string().startsWith("custom:").transform((t)=>t)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:l.enum(LG).optional().catch(void 0).describe("Key binding mode for the prompt input"),vimInsertModeRemaps:l.record(l.string(),l.unknown()).optional().catch(void 0).describe('Vim INSERT-mode key-sequence remaps, e.g. {"jj": "<Esc>"}. Each key is exactly two printable characters typed in sequence; "<Esc>" (return to NORMAL mode) is the only supported target. Applies when editorMode is "vim".'),verbose:l.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:l.enum(DG).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:l.boolean().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:l.boolean().optional().describe("Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:l.boolean().optional().describe("When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoScrollEnabled:l.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:l.boolean().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:l.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:l.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:l.boolean().optional().describe("Stamp each message with its arrival time"),terminalProgressBarEnabled:l.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:l.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:l.enum(NG).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:l.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:l.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:l.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:l.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:l.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:l.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...r6(e)}).passthrough()}var Es=C(()=>x6(Kk())),_6=Object.freeze({serverName:"invalid-entry-stripped"});function y6(e,t,r){return l.array(t.catch((n)=>(r({path:`${e}[]`,message:`Invalid entry was ignored: ${n.issues[0]?.message??"failed validation"}`}),_6))).transform((n)=>n.filter((o)=>o!==_6)).optional()}function tO(e){let t=Es(),r={};for(let[s,a]of Object.entries(t.shape))r[s]=a.catch((c)=>{e({path:s,message:`${c.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});r.allowedMcpServers=y6("allowedMcpServers",Oy(),e).catch(()=>(e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[])),r.deniedMcpServers=y6("deniedMcpServers",Cy(),e).catch(()=>{e({path:"deniedMcpServers",message:'"deniedMcpServers" was present but invalid and was dropped; its entries cannot be enforced until it is fixed.'});return}),r.allowManagedMcpServersOnly=t.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),r.enforceAvailableModels=t.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),r.availableModels=l.array(l.unknown()).transform((s,a)=>{let c=[];for(let u of s)if(typeof u==="string")c.push(u);else e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(u)}); the entry was ignored.`});return c}).optional().catch(()=>(e({path:"availableModels",message:'"availableModels" was present but invalid; enforcing an empty allowlist (only the default model is available) until it is fixed.'}),[])),r.forceLoginOrgUUID=t.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let n=Object.freeze({mode:"deny"}),o=(s,a)=>l.array(a.catch((c)=>(e({path:`sandbox.credentials.${s}[]`,message:`Invalid entry was ignored: ${c.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),n))).transform((c)=>c.filter((u)=>u!==n)).optional();return r.sandbox=zk().extend({credentials:l.object({files:o("files",jk()),envVars:o("envVars",Fk()),allowPlaintextInject:l.boolean().optional().catch((s)=>{e({path:"sandbox.credentials.allowPlaintextInject",message:`${s.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was ignored; plaintext credential injection stays disabled until it is fixed.`});return})}).optional().catch((s)=>{e({path:"sandbox.credentials",message:`${s.issues[0]?.message??"Failed schema validation"}. The credentials block was dropped; no credential protection is applied until it is fixed.`});return})}).optional().catch((s)=>{e({path:"sandbox",message:`${s.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return}),l.object(r).passthrough().transform((s)=>{for(let a of Object.keys(s))if(s[a]===void 0)delete s[a];return s})}var fo="https://code.claude.com/docs/en",bMe=[{matches:(e)=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${fo}/iam#permission-modes`}},{matches:(e)=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:(e)=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:(e)=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${fo}/settings#environment-variables`}},{matches:(e)=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:(e)=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${fo}/hooks`}},{matches:(e)=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${fo}/hooks#exec-form-and-shell-form`}},{matches:(e)=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:(e)=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${fo}/settings`}},{matches:(e)=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:(e)=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${fo}/iam#working-directories`}}],xMe={permissions:`${fo}/iam#configuring-permissions`,env:`${fo}/settings#environment-variables`,hooks:`${fo}/hooks`};function v6(e){let t=bMe.find((n)=>n.matches(e));if(!t)return null;let r={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!r.suggestion)r.suggestion=`Valid values: ${e.enumValues.map((n)=>`"${n}"`).join(", ")}`;if(!r.docLink&&e.path)r.docLink=xMe[Wy(e.path,".")];return r}var YTt=C(()=>Es().strict());function S6(e){return e.code==="invalid_type"}function E6(e){return e.code==="invalid_value"}function vMe(e){return e.code==="unrecognized_keys"}function w6(e){return e.code==="too_small"}function qc(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function T6(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function $d(e,t){return e.issues.map((r)=>{let n=r.path.map(String).join("."),o=r.message,i,s,a,c,u;if(E6(r))s=r.values.map((f)=>String(f)),a=s.join(" | "),c=void 0,u=void 0;else if(S6(r)){a=r.expected;let f=T6(r.message);c=f??qc(r.input),u=f??qc(r.input)}else if(w6(r))a=String(r.minimum);else if(r.code==="custom"&&"params"in r)c=r.params.received,u=c;let d=v6({path:n,code:r.code,expected:a,received:c,enumValues:s,message:r.message,value:c});if(E6(r))i=s?.map((f)=>`"${f}"`).join(", "),o=`Invalid value. Expected one of: ${i}`;else if(S6(r)){let f=T6(r.message)??qc(r.input);if(r.expected==="object"&&f==="null"&&n==="")o="Invalid or malformed JSON";else o=`Expected ${r.expected}, but received ${f}`}else if(vMe(r)){let f=r.keys.join(", ");o=`Unrecognized ${jO(r.keys.length,"field")}: ${f}`}else if(w6(r))o=`Number must be greater than or equal to ${r.minimum}`,i=String(r.minimum);return{file:t,path:n,message:o,expected:i,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}function SMe(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!r.permissions||typeof r.permissions!=="object")return[];let n=r.permissions,o=[];for(let i of["allow","deny","ask"]){let s=n[i];if(!Array.isArray(s))continue;n[i]=s.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${i}`,message:`Non-string value in ${i} array was removed`,severity:"warning",invalidValue:a}),!1;let c=Qk(a,i);if(!c.valid){let u=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)u+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${i}`,message:u,severity:"warning",invalidValue:a}),!1}return!0})}return o}var EMe=new Set(Os);function wMe(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!("hooks"in r))return[];if(r.hooks===null||typeof r.hooks!=="object"||Array.isArray(r.hooks)){let i=qc(r.hooks);return delete r.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${i}. This field was ignored.`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"}]}let n=r.hooks,o=[];for(let i of Object.keys(n)){if(!EMe.has(i)){delete n[i],o.push({file:t,path:`hooks.${i}`,message:`Unknown hook event "${i}" was ignored. Valid events: ${Os.join(", ")}`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(n[i])){let s=qc(n[i]);delete n[i],o.push({file:t,path:`hooks.${i}`,message:`Hook event "${i}" must be an array of matchers; received ${s}. This entry was ignored.`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"})}}if(o.length>0&&Object.keys(n).length===0)delete r.hooks;return o}var TMe=[{key:"allowedMcpServers",schema:Oy},{key:"deniedMcpServers",schema:Cy}];function AMe(e,t){if(!e||typeof e!=="object")return[];let r=e,n=[];for(let{key:o,schema:i}of TMe){if(!(o in r))continue;if(!Array.isArray(r[o])){let c=r[o];delete r[o],n.push({file:t,path:o,message:`"${o}" must be an array; received ${qc(c)}. This field was ignored.`,severity:"warning",invalidValue:c});continue}let s=r[o],a=[];for(let c=0;c<s.length;c++){let u=i().safeParse(s[c]);if(u.success)a.push(s[c]);else n.push({file:t,path:`${o}[${c}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:s[c]})}if(a.length<s.length)r[o]=a}return n}function ws(e,t,r){return[...SMe(e,t),...wMe(e,t),...r?.skipMcpServerEntryFilter?[]:AMe(e,t)]}function oO(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),wG.filter((r)=>t.has(r))}function CMe(){return Tn(xs(),"managed-settings.json")}function k6(e){if(no()==="wsl"&&e.wslInherits?.()){let t=rO(zc);if(t.settings)return t;let r=rO(xs());return{settings:r.settings,errors:[...t.errors,...r.errors]}}return rO(xs())}function rO(e){let t=[],r={},n=!1,{settings:o,errors:i}=Gc(Tn(e,"managed-settings.json"),void 0,!0);if(t.push(...i),o&&Object.keys(o).length>0)r=En(r,o,Un),n=!0;let s=Tn(e,"managed-settings.d");try{let u=Fe().readdirSync(s).filter((d)=>(d.isFile()||d.isSymbolicLink())&&d.name.endsWith(".json")&&!d.name.startsWith(".")).map((d)=>d.name).sort();for(let d of u){let{settings:f,errors:m}=Gc(Tn(s,d),void 0,!0);if(t.push(...m),f&&Object.keys(f).length>0)r=En(r,f,Un),n=!0}}catch(u){let d=dt(u);if(d!=="ENOENT"&&d!=="ENOTDIR")ce(`managed-settings.d read failed: ${u}`,{level:"error"})}let{wslInheritsWindowsSettings:a,...c}=r;return{settings:n&&Object.keys(c).length>0?r:null,errors:t}}function RMe(e,t){if(On(e))ce(`Broken symlink or missing file encountered for settings.json at path: ${t}`);else ce(`settings file read failed at ${t}: ${e}`,{level:"error"})}function Gc(e,t,r){let n=xD(e);if(n)return{settings:n.settings?Ho(n.settings):null,errors:n.errors};let o=DMe(e,t,r);return vD(e,o),{settings:o.settings?Ho(o.settings):null,errors:o.errors}}function O6(e){if(!e.mdm)return{settings:null,errors:[]};let t=e.mdm();return{settings:Object.keys(t.settings).length>0?t.settings:null,errors:t.errors}}function Ry(e,t){let r=Ho(e),n=ws(r,t,{skipMcpServerEntryFilter:!0}),o=[],i=tO((s)=>o.push({file:t,path:s.path,message:s.message,severity:"warning"})).safeParse(r);if(!i.success)return{settings:null,errors:[...n,...$d(i.error,t)]};return{settings:Object.keys(i.data).length>0?i.data:null,errors:[...n,...o]}}function C6(e){let t=e?.remote?e.remote():EG();if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return Ry(t,"remote managed settings")}function IMe(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return Ry(t,"parent managed settings")}function R6(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let r=Ho(t),n=ws(r,"SDK inline settings"),o=Es().safeParse(r);if(!o.success)return{settings:null,errors:[...n,...$d(o.error,"SDK inline settings")]};return{settings:o.data,errors:n}}var PMe=2097152;function DMe(e,t,r){try{let n;if(t!==void 0)n=t;else{let{resolvedPath:a}=ih(Fe(),e);n=bs(a,PMe)}if(n.trim()==="")return{settings:{},errors:[]};let o=Ho(Mc(n,!1));if(r){let a=ws(o,e,{skipMcpServerEntryFilter:!0}),c=[],u=tO((d)=>c.push({file:e,path:d.path,message:d.message,severity:"warning"})).safeParse(o);if(!u.success)return{settings:null,errors:[...a,...$d(u.error,e)]};return{settings:u.data,errors:[...a,...c]}}let i=ws(o,e),s=Es().safeParse(o);if(!s.success){let a=$d(s.error,e);return{settings:null,errors:[...i,...a]}}return{settings:s.data,errors:i}}catch(n){if(RMe(n,e),On(n))return{settings:null,errors:[]};return{settings:null,errors:[{file:e,path:"",message:`Settings file could not be read: ${n instanceof Error?n.message:String(n)}`,severity:"fatal"}]}}}function A6(e,t){switch(e){case"userSettings":return Zr(Yt());case"policySettings":case"projectSettings":return Zr(t.cwd);case"localSettings":return I6(t.cwd,t.canonicalGitRoot);case"flagSettings":return t.flagPath?OMe(Zr(t.flagPath)):Zr(t.cwd)}}function I6(e,t){let r=t?.(e);if(!r)return Zr(e);let n=Zr(r),o=Zr(e);if(n===o)return n;let i;try{i=MMe()}catch{return o}if(n===i)return o;if(!NMe(n))return o;return n}var LMe=re((e)=>{let t=Fe(),r=null;try{r=t.lstatSync(Tn(e,".claude")).uid}catch(n){if(!On(n))throw n}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(Tn(e,".git")).uid,claudeEntryUid:r}});function NMe(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return ce(`localSettings: not canonicalizing the consent store to ${e} — this platform has no uid semantics to verify directory ownership with, so the store stays at the session cwd (canonicalization is POSIX-only)`,{level:"warn"}),!1;let t=typeof process.geteuid==="function"?process.geteuid():process.getuid?.();try{let{rootUid:r,gitEntryUid:n,claudeEntryUid:o}=LMe(e);if(r===t&&n===t&&(o===null||o===t))return!0;return ce(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${r}), its .git entry (uid ${n}), or its .claude entry (uid ${o??"absent"}) is not owned by the current user (uid ${t}); the store stays at the session cwd (the pre-canonicalization behavior). If you own this repo, chown it (including .git and .claude) or run from a directory you own.`,{level:"warn"}),!1}catch(r){return ce(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${r instanceof Error?r.message:String(r)}); the store stays at the session cwd`,{level:"warn"}),!1}}var MMe=re(()=>{let e=Hy(kMe());if(e===null)throw Error("home directory realpath unavailable");return xr(e)});function UMe(e){if(e.coworkPlugins||Hr.CLAUDE_CODE_USE_COWORK_PLUGINS)return"cowork_settings.json";return"settings.json"}function jd(e,t){switch(e){case"userSettings":return Tn(A6(e,t),UMe(t));case"projectSettings":case"localSettings":return Tn(A6(e,t),P6(e));case"policySettings":return CMe();case"flagSettings":return t.flagPath}}function P6(e){switch(e){case"projectSettings":return Tn(".claude","settings.json");case"localSettings":return Tn(".claude","settings.local.json")}}function D6(e){if(I6(e.cwd,e.canonicalGitRoot)===Zr(e.cwd))return;return Tn(Zr(e.cwd),P6("localSettings"))}function L6(e,t){let r=yD(e);if(r!==void 0)return r;let n=FMe(e,t);return bD(e,n),n}function $Me(e){return!e||e.parentSettingsBehavior==="merge"}function jMe(e,t){let r={};if(e.allowManagedHooksOnly===!0)r.allowManagedHooksOnly=!0;if(e.allowManagedMcpServersOnly===!0)r.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)r.disableClaudeAiConnectors=!0;if(e.allowManagedPermissionRulesOnly===!0)r.allowManagedPermissionRulesOnly=!0;let n=e.strictPluginOnlyCustomization;if(n===!0||Array.isArray(n)&&n.length>0)r.strictPluginOnlyCustomization=n;if(e.deniedMcpServers)r.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)r.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)r.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)r.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)r.enforceAvailableModels=!0;if(e.permissions){let o=Ey(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")o.disableBypassPermissionsMode="disable";if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:s}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)o.allow=i;if(s)o.additionalDirectories=s}if(Object.keys(o).length>0)r.permissions=o}if(e.sandbox){let{network:o,filesystem:i,credentials:s}=e.sandbox,a={};if(e.sandbox.enabled===!0)a.enabled=!0;if(e.sandbox.failIfUnavailable===!0)a.failIfUnavailable=!0;if(e.sandbox.allowUnsandboxedCommands===!1)a.allowUnsandboxedCommands=!1;if(e.sandbox.autoAllowBashIfSandboxed===!1)a.autoAllowBashIfSandboxed=!1;if(o){let c=Ey(o,["deniedDomains"]);if(o.allowManagedDomainsOnly===!0)c.allowManagedDomainsOnly=!0;if(o.strictAllowlist===!0)c.strictAllowlist=!0;if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&o.allowedDomains)c.allowedDomains=o.allowedDomains;if(Object.keys(c).length>0)a.network=c}if(i){let c=Ey(i,["denyRead","denyWrite"]);if(i.allowManagedReadPathsOnly===!0)c.allowManagedReadPathsOnly=!0;if(i.disabled===!1)c.disabled=!1;if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)c.allowRead=i.allowRead;if(Object.keys(c).length>0)a.filesystem=c}if(s){let c=(s.files??[]).filter((f)=>f.mode==="deny"),u=(s.envVars??[]).filter((f)=>f.mode==="deny"),d={...c.length>0&&{files:c},...u.length>0&&{envVars:u}};if(s.allowPlaintextInject===!1)d.allowPlaintextInject=!1;if(Object.keys(d).length>0)a.credentials=d}if(Object.keys(a).length>0)r.sandbox=a}return r}function N6(e){if(e.helper?.())return"helper";if(C6(e).settings)return"remote";if(O6(e).settings)return no()==="macos"?"plist":"hklm";if((e.file?.()??k6(e)).settings)return"file";if(M6(e).parentSlice)return"parent";let t=e.hkcu?.();return t&&Object.keys(t.settings).length>0?"hkcu":null}function M6(e){let t=[],{settings:r,errors:n}=C6(e);t.push(...n);let{settings:o,errors:i}=O6(e);t.push(...i);let{settings:s,errors:a}=e.file?.()??k6(e);t.push(...a);let{settings:c,errors:u}=IMe(e);t.push(...u);let d=[r,o,s].filter((_)=>_!==null),f=d[0]??null,m={allowManagedPermissionRulesOnly:d.some((_)=>_.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:d.find((_)=>_.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:d.find((_)=>_.allowedMcpServers!==void 0)?.allowedMcpServers,availableModels:d[0]?.availableModels,sandbox:{network:{allowManagedDomainsOnly:d.some((_)=>_.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:d.some((_)=>_.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},g=c&&$Me(f)?jMe(c,m):null,h=g&&Object.keys(g).length>0?g:null;return{tiers:d,admin:f,parentSlice:h,errors:t}}function U6(e){let t=e.helper?.();if(t)return{settings:t,errors:e.helperWarnings?.()??[]};let{tiers:r,admin:n,parentSlice:o,errors:i}=M6(e);if(!n&&!o){let a=e.hkcu?.();if(a&&Object.keys(a.settings).length>0)return{settings:a.settings,errors:[...i,...a.errors]};return{settings:null,errors:[...i,...a?.errors??[]]}}let s=En({},o??{},n??{},Un);if(r.some((a)=>a.forceRemoteSettingsRefresh===!0))s.forceRemoteSettingsRefresh=!0;return{settings:s,errors:i}}function FMe(e,t,{includeLegacyLocalSettings:r=!0}={}){if(e==="policySettings")return U6(t).settings;let n=jd(e,t),{settings:o}=n?Gc(n,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:i}=R6(t);if(i)return En(o||{},i,Un)}if(e==="localSettings"&&r){let i=D6(t);if(i){let{settings:s}=Gc(i);if(s)return En(s,o||{},Un)}}return o}function Un(e,t,r){if(Array.isArray(e)&&Array.isArray(t)){if(r==="fallbackModel")return t;return Ra([...e,...t])}return}var nO=!1;function zMe(e){if(nO)return{settings:{},errors:[]};let t=Date.now();kd("info","settings_load_started"),nO=!0;try{let r=SD(),n={};if(r)n=En(n,r,Un);let o=[],i=new Set,s=new Set,a=(u)=>{for(let d of u){let f=`${d.file}:${d.path}:${d.message}`;if(!i.has(f))i.add(f),o.push(d)}},c=null;for(let u of oO(e)){if(u==="policySettings"){let{settings:f,errors:m}=U6(e);if(c=f,f)n=En(n,f,Un);a(m);continue}if(u==="localSettings"){let f=D6(e);if(f&&!s.has(Zr(f))){s.add(Zr(f));let{settings:m,errors:g}=Gc(f);if(a(g),m)n=En(n,m,Un)}}let d=jd(u,e);if(d){let f=Zr(d);if(!s.has(f)){s.add(f);let{settings:m,errors:g}=Gc(d,u==="flagSettings"?e.flagExpectedContent:void 0);if(a(g),m)n=En(n,m,Un)}}if(u==="flagSettings"){let{settings:f,errors:m}=R6(e);if(a(m),f)n=En(n,f,Un)}}if(c){if(c.availableModels!==void 0)n.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)n.enforceAvailableModels=c.enforceAvailableModels}return kd("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:s.size,error_count:o.length}),{settings:n,errors:o}}finally{nO=!1}}function BMe(e){let t=hD();if(t!==null)return t;let r=zMe(e);return _D(r),r}function HMe(e){let{settings:t}=BMe(e);return t||{}}function $6(e){qi();let t=[];for(let r of oO(e)){let n=L6(r,e);if(n&&Object.keys(n).length>0)t.push({source:r,settings:n})}return{effective:HMe(e),sources:t}}function j6(e,t){let r=oO(t);for(let n=r.length-1;n>=0;n--){let o=r[n];if(L6(o,t)?.[e]!==void 0)return o}return null}import{execFile as qMe}from"child_process";import{existsSync as GMe}from"fs";var WMe=null;function Fd(e,t){return new Promise((r)=>{try{qMe(e,t,{encoding:"utf-8",timeout:OG,windowsHide:!0},(n,o)=>{r({stdout:o??"",code:n?1:0})})}catch{r({stdout:"",code:1})}})}function F6(){return(async()=>{if(process.platform==="darwin"){let e=CG(),r=(await Promise.all(e.map(async({path:n,label:o})=>{if(!GMe(n))return{stdout:"",label:o,ok:!1};let{stdout:i,code:s}=await Fd(AG,[...kG,n]);return{stdout:i,label:o,ok:s===0&&!!i}}))).find((n)=>n.ok);return{plistStdouts:r?[{stdout:r.stdout,label:r.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[r,n]=await Promise.all([Fd(t,["query",Id,"/v",pi]),Fd(t,["query",Pd,"/v",pi])]);return{plistStdouts:null,hklmStdout:r.code===0?r.stdout:null,hkcuStdout:n.code===0?n.stdout:null}}if(wy()){let[e,t]=await Promise.all([Fd($k,["query",Id,"/v",pi]),Fd($k,["query",Pd,"/v",pi])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function z6(){return WMe}var fi=Object.freeze({settings:{},errors:[]}),G6=null,W6=null,V6=!1,Iy=null;function VMe(){if(Iy)return;Iy=(async()=>{let e=Date.now(),t=z6()??F6(),{mdm:r,hkcu:n,wslInherits:o}=KMe(await t);G6=r,W6=n,V6=o;let i=Date.now()-e;if(ce(`MDM settings load completed in ${i}ms`),Object.keys(r.settings).length>0){ce(`MDM settings found: ${Object.keys(r.settings).join(", ")}`);try{kd("info","mdm_settings_loaded",{duration_ms:i,key_count:Object.keys(r.settings).length,error_count:r.errors.length})}catch{}}})()}async function K6(){if(!Iy)VMe();await Iy}function Z6(){return G6??fi}function J6(){return W6??fi}function Y6(){return V6}function iO(e,t){let r=Mc(e,!1);if(!r||typeof r!=="object")return{settings:{},errors:[]};let{settings:n,errors:o}=Ry(r,t);return{settings:n??{},errors:o}}function B6(e,t="Settings"){let r=e.split(/\r?\n/),n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^\\s+${n}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let i of r){let s=i.match(o);if(s&&s[1])return s[1].trimEnd()}return null}function KMe(e){let t=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:s,label:a}=e.plistStdouts[0],c=iO(s,a),{wslInheritsWindowsSettings:u,...d}=c.settings;if(Object.keys(d).length>0)return{mdm:c,hkcu:fi,wslInherits:!1};t.push(...c.errors)}let r=null;if(e.hklmStdout){let s=B6(e.hklmStdout);if(s)r=iO(s,`Registry: ${Id}\\${pi}`)}if(r)t.push(...r.errors);let n=t.length>0?{settings:{},errors:t}:fi,o=wy(),i=!1;if(o){if(i=r?.settings.wslInheritsWindowsSettings===!0||JMe(),!i)return{mdm:n,hkcu:fi,wslInherits:!1}}if(r){let{wslInheritsWindowsSettings:s,...a}=r.settings;if(Object.keys(a).length>0)return{mdm:r,hkcu:fi,wslInherits:i}}if(ZMe(i))return{mdm:n,hkcu:fi,wslInherits:i};if(e.hkcuStdout){let s=B6(e.hkcuStdout);if(s){let a=iO(s,`Registry: ${Pd}\\${pi}`);if(!o||a.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:c,...u}=a.settings;return{mdm:n,hkcu:{settings:u,errors:a.errors},wslInherits:i}}if(a.errors.length>0)return{mdm:n,hkcu:{settings:{},errors:a.errors},wslInherits:i}}}return{mdm:n,hkcu:fi,wslInherits:i}}function ZMe(e){if(e&&q6(zc))return!0;return q6(xs())}function H6(e){let t=Ho(Mc(bs(e),!1));if(!t||typeof t!=="object")return!1;ws(t,e);let{wslInheritsWindowsSettings:r,...n}=t;return Object.keys(n).length>0}function JMe(){function e(t){try{let r=Mc(bs(t),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(e(Wc(zc,"managed-settings.json")))return!0;try{let t=Wc(zc,"managed-settings.d");for(let r of Fe().readdirSync(t))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&e(Wc(t,r.name)))return!0}catch{}return!1}function q6(e){try{if(H6(Wc(e,"managed-settings.json")))return!0}catch{}try{let t=Wc(e,"managed-settings.d"),r=Fe().readdirSync(t);for(let n of r){if(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(".json")||n.name.startsWith("."))continue;try{if(H6(Wc(t,n.name)))return!0}catch{}}}catch{}return!1}var XMe={user:"userSettings",project:"projectSettings",local:"localSettings"},X6={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},QMe=["user","project","local"],eUe=new Set(["bypassPermissions","auto","acceptEdits"]),tUe=new Set(["project"]);function rUe(e){let t=e.effective.permissions?.defaultMode;if(!t||!eUe.has(t))return e.effective;for(let r=e.sources.length-1;r>=0;r--){let n=e.sources[r];if(n.settings.permissions?.defaultMode!==void 0){if(tUe.has(n.source)){let{defaultMode:o,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Q6(e={}){await K6();let t={cwd:YMe(e.cwd??Fe().cwd()),allowedSources:(e.settingSources??QMe).map((r)=>XMe[r]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Z6,hkcu:J6,wslInherits:Y6,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}};try{let{effective:r,sources:n}=$6(t),o=N6(t)??void 0,i=n.map(({source:a,settings:c})=>({source:X6[a],settings:c,path:a==="policySettings"?void 0:jd(a,t),...a==="policySettings"&&{policyOrigin:o}})),s={};for(let a of Object.keys(r)){let c=j6(a,t);if(c)s[a]={source:X6[c],path:c==="policySettings"?void 0:jd(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:r,provenance:s,sources:i}}finally{qi()}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function kkt(e){return Q6(e)}async function fUe(e,t){try{await sUe(e,t)}catch(r){if(!On(r))throw r}}async function mUe(e,t){if(!e)return;let r=e;try{let n=yt(e);if(n?.claudeAiOauth?.refreshToken)delete n.claudeAiOauth.refreshToken,r=Re(n)}catch{}await oW(t,r,{mode:384})}function gUe(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=vF(xF);return new Promise((t)=>{nUe("security",["find-generic-password","-a",SF(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(r,n)=>t(r?void 0:n.trim()||void 0))})}async function aW(e,t,r,n,o=60000){if(!ze(t))return;let i=Jr(r),s=await Mr(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!s||s.length===0)return;let a=Dr(uUe(),`claude-resume-${lO()}`);try{let c=Dr(a,"projects",i);await sO(c,{recursive:!0});let u=Dr(c,`${t}.jsonl`);await qp(u,s);let d=n?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=d??Dr(aO(),".claude"),m;try{m=await nW(Dr(f,".credentials.json"),"utf-8")}catch(g){if(!On(g))throw g}if(!d&&!(n??process.env).ANTHROPIC_API_KEY&&!(n??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await gUe()??m;if(await mUe(m,Dr(a,".credentials.json")),await fUe(Dr(d??aO(),".claude.json"),Dr(a,".claude.json")),e.listSubkeys)await hUe(e,{projectKey:i,sessionId:t},Dr(c,t),o);return a}catch(c){throw await Py(a),c}}async function hUe(e,t,r,n){let o=await Mr(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),n,`SessionStore.listSubkeys() timed out after ${n}ms for session ${t.sessionId}`);for(let i of o){let s=zd(r,i+".jsonl");if(!i||iW(i)||i.split(/[\\/]/).includes("..")||!s.startsWith(r+uO)){ce(`[SessionStore] skipping unsafe subpath from listSubkeys: ${i}`,{level:"warn"});continue}let a=await Mr(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:i}),n,`SessionStore.load() timed out after ${n}ms for session ${t.sessionId} subpath ${i}`);if(!a||a.length===0)continue;let c=[],u=[];for(let d of a)if(cO(d))c.push(d);else u.push(d);if(u.length>0)await sO(eW(s),{recursive:!0}),await qp(s,u);if(c.length>0){let d=c.at(-1),f=zd(r,i+".meta.json");await sO(eW(f),{recursive:!0});let{type:m,...g}=d;await oW(f,Re(g),{mode:384})}}}function pO(e,t){let{isSingleUserTurn:r,resumeConfigDir:n,deferSpawn:o}=t,{systemPrompt:i,settings:s,managedSettings:a,settingSources:c,sandbox:u,...d}=e??{},f,m,g;if(i===void 0)f="";else if(typeof i==="string")f=i;else if(Array.isArray(i))f=i;else if(i.type==="preset")m=i.append,g=i.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.220";let{abortController:h=Jc(),additionalDirectories:_=[],agent:y,agents:b,allowedTools:T=[],betas:w,canUseTool:k,continue:P,cwd:te,debug:oe,debugFile:Oe,disallowedTools:ke=[],tools:jt,env:xt,executable:Ft=Cs()?"bun":"node",executableArgs:vt=[],extraArgs:St={},fallbackModel:Lr,enableFileCheckpointing:H,toolConfig:Nr,forkSession:Vt,hooks:Ye,includeHookEvents:yr,includePartialMessages:nt,forwardSubagentText:W,onElicitation:q,onUserDialog:V,supportedDialogKinds:ve,persistSession:me,sessionStore:He,sessionStoreFlush:Yr,thinking:qe,effort:mo,maxThinkingTokens:$n,maxTurns:mt,maxBudgetUsd:Bd,taskBudget:mW,mcpServers:fO,model:gW,outputFormat:mO,permissionMode:gO="default",allowDangerouslySkipPermissions:hW=!1,permissionPromptToolName:_W,plugins:yW,getOAuthToken:hO,getHostAuthToken:_O,workload:yO,resume:bO,resumeSessionAt:bW,sessionId:xW,skills:xO,stderr:vW,strictMcpConfig:SW}=d;if(He&&me===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(ve!==void 0&&ve.length>0&&!V)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");if(He&&P&&!bO&&!He.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(He&&H)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(He&&d.spawnClaudeCodeProcess)ce("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});EF(!!k,gO,T);let Ly=d.pathToClaudeCodeExecutable;if(!Ly){let br=dUe(import.meta.url),Xr=lUe(br),mi=FU((Ts)=>Xr.resolve(Ts));if(!mi)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);Ly=mi}let vO=mO?.type==="json_schema"?mO.schema:void 0,Kt=xt?{...xt}:{...process.env};if(!Kt.CLAUDE_CODE_ENTRYPOINT)Kt.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!Kt.CLAUDE_AGENT_SDK_VERSION)Kt.CLAUDE_AGENT_SDK_VERSION="0.3.220";if(H)Kt.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(hO)Kt.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(_O)Kt.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(Nr?.askUserQuestion?.previewFormat)Kt.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=Nr.askUserQuestion.previewFormat;let Ny={};if(Dy.propagation.inject(Dy.context.active(),Ny),"traceparent"in Ny){for(let br of["TRACEPARENT","TRACESTATE"])if(!(br in(xt??{})))delete Kt[br]}for(let[br,Xr]of Object.entries(Ny)){let mi=br.toUpperCase();if(!(mi in(xt??{})))Kt[mi]=Xr}let SO={},EO=new Map;if(fO)for(let[br,Xr]of Object.entries(fO))if(Xr.type==="sdk"&&Xr.instance)EO.set(br,Xr.instance);else SO[br]=Xr;let Vc;if(qe)switch(qe.type){case"adaptive":Vc={type:"adaptive",display:qe.display};break;case"enabled":Vc={type:"enabled",budgetTokens:qe.budgetTokens,display:qe.display};break;case"disabled":Vc={type:"disabled"};break}else if($n!==void 0)Vc=$n===0?{type:"disabled"}:{type:"enabled",budgetTokens:$n};if(n){if(Kt.CLAUDE_CONFIG_DIR=n,process.platform==="win32")Kt.CLAUDE_SECURESTORAGE_CONFIG_DIR=xt?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??xt?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let wO=new Uw({abortController:h,additionalDirectories:_,agent:y,betas:w,cwd:te,debug:oe,debugFile:Oe,executable:Ft,executableArgs:vt,extraArgs:yO?{...St,workload:yO}:St,pathToClaudeCodeExecutable:Ly,env:Kt,forkSession:Vt,stderr:vW,thinkingConfig:Vc,effort:mo,maxTurns:mt,maxBudgetUsd:Bd,taskBudget:mW,model:gW,fallbackModel:Lr,jsonSchema:vO,permissionMode:gO,allowDangerouslySkipPermissions:hW,permissionPromptToolName:_W,continueConversation:He?void 0:P,resume:bO,resumeSessionAt:bW,sessionId:xW,settings:typeof s==="object"?Re(s):s,managedSettings:a?Re(a):void 0,settingSources:c,skills:xO,allowedTools:T,disallowedTools:ke,tools:jt,mcpServers:SO,strictMcpConfig:SW,canUseTool:!!k,hooks:!!Ye,includeHookEvents:yr,includePartialMessages:nt,persistSession:me,sessionMirror:!!He,plugins:yW,sandbox:u,spawnClaudeCodeProcess:d.spawnClaudeCodeProcess,deferSpawn:o}),EW={systemPrompt:f,appendSystemPrompt:m,planModeInstructions:d.planModeInstructions,appendSubagentSystemPrompt:d.appendSubagentSystemPrompt,toolAliases:d.toolAliases,excludeDynamicSections:g,agents:b,title:d.title,skills:xO,webSearchIsolationExemptMcpServers:d.webSearchIsolationExemptMcpServers,promptSuggestions:d.promptSuggestions,agentProgressSummaries:d.agentProgressSummaries,forwardSubagentText:W,supportedDialogKinds:ve},My=new Hh(wO,r,k,Ye,h,EO,vO,EW,q,hO,_O,V);if(He){let br=()=>Dr(Kt.CLAUDE_CONFIG_DIR??Dr(aO(),".claude"),"projects"),Xr=Yr==="eager",mi=new Bw(async(Ts,Uy)=>{let Kc=rW(Ts,br());if(Kc)await He.append(Kc,Uy);else ce(`[SessionStore] dropping mirror frame: filePath ${Ts} is not under ${br()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(Ts,Uy)=>{let Kc=rW(Ts,br());if(Kc)My.reportMirrorError(Kc,Uy.message)},maxPendingEntries:Xr?0:qh,maxPendingBytes:Xr?0:Gh});My.setTranscriptMirrorBatcher(mi)}return{queryInstance:My,transport:wO,abortController:h,processEnv:Kt}}function dO(e,t,r,n){if(typeof r==="string")t.write(Re({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+`
137
137
  `);else e.streamInput(r).catch((o)=>n.abort(o))}var _Ue=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function Py(e){for(let t=0;;t++)try{return await cUe(e,{recursive:!0,force:!0})}catch(r){if(t>=4||!_Ue.has(dt(r)??""))return;await jn((t+1)*100)}}function yUe(e,t){e.waitForExit().catch(()=>{}).finally(()=>Py(t))}function Okt({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore)return bUe(e,t);let{queryInstance:r,transport:n,abortController:o}=pO(t,{isSingleUserTurn:typeof e==="string"});return dO(r,n,e,o),r}function bUe(e,t){let{queryInstance:r,transport:n,abortController:o,processEnv:i}=pO({...t},{isSingleUserTurn:typeof e==="string",deferSpawn:!0}),s=zd(t.cwd??"."),a=t.sessionStore,c=t.loadTimeoutMs??60000,u=t.resume;return(async()=>{if(!u)u=(await Mr(a.listSessions(Jr(s)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((m,g)=>g.mtime-m.mtime)[0]?.sessionId;if(!u)return;return aW(a,u,s,t.env,t.loadTimeoutMs)})().then((f)=>{if(f){n.updateResume(u);let m={CLAUDE_CONFIG_DIR:f};if(process.platform==="win32"){let g=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";m.CLAUDE_SECURESTORAGE_CONFIG_DIR=g,i.CLAUDE_SECURESTORAGE_CONFIG_DIR=g}n.updateEnv(m),i.CLAUDE_CONFIG_DIR=f,r.addCleanupCallback(()=>yUe(n,f))}if(!r.isClosed())n.spawn()}).catch((f)=>{let m=kn(f);n.spawnAbort(m),r.setError(m)}),dO(r,n,e,o),r}async function Ckt({options:e,initializeTimeoutMs:t=60000}={}){let r,n=e?.resume;if((n||e?.continue)&&e?.sessionStore){let a=zd(e.cwd??".");if(!n){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;n=(await Mr(e.sessionStore.listSessions(Jr(a)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((d,f)=>f.mtime-d.mtime)[0]?.sessionId}if(n)r=await aW(e.sessionStore,n,a,e.env,e.loadTimeoutMs)}let o,i,s;try{let m=function(){if(f)return;f=!0,d.close()},a=pO(r&&n&&n!==e?.resume?{...e,resume:n}:e,{isSingleUserTurn:!1,resumeConfigDir:r});o=a.queryInstance;let{transport:c,abortController:u}=a;i=c;let d=a.queryInstance;if(r){let g=r;d.addCleanupCallback(()=>{s=c.waitForExit().catch(()=>{}).then(()=>Py(g))})}await Mr(d.initializationResult(),t,`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`);let f=!1;return{query(g){if(f)throw Error("WarmQuery.query() can only be called once");f=!0;try{dO(d,c,g,u)}catch(h){throw d.close(),h}if(typeof g==="string")d.setIsSingleUserTurn(!0);return d},close:m,async[Symbol.asyncDispose](){f=!0,d.close(),await s}}}catch(a){if(o?.close(),r&&!s){let c=i;s=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>Py(r))}throw await s,a}}async function Rkt(e,t){if(t?.sessionStore)return wUe(t.sessionStore,e,t);return eF(e,t)}async function Ikt(e){if(e?.sessionStore)return vUe(e.sessionStore,e);return rF(e)}async function Pkt(e,t){if(t?.sessionStore)return TUe(t.sessionStore,e,t);return nF(e,t)}async function Dkt(e,t,r){if(r?.sessionStore)return AUe(r.sessionStore,e,t,r.dir);return aF(e,t,r)}async function Lkt(e,t,r){if(r?.sessionStore)return kUe(r.sessionStore,e,t,r.dir);return cF(e,t,r)}async function Nkt(e,t){if(!ze(e))throw new Xt(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let r=Jr(t.dir);await t.sessionStore.delete({projectKey:r,sessionId:e});return}return lF(e,t)}async function Mkt(e,t){if(t?.sessionStore)return OUe(t.sessionStore,e,t);return dF(e,t)}async function Ukt(e,t,r){if(!ze(e))throw new Xt(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let n=await Yo(e,r?.dir);if(!n)throw Error(`Session ${e} not found`);let o=Jr(r?.dir),i=r?.batchSize&&r.batchSize>0?r.batchSize:qh;if(await tW(n.filePath,{projectKey:o,sessionId:e},t,i),r?.includeSubagents===!1)return;let s=n.filePath.replace(/\.jsonl$/,""),a=Dr(s,"subagents");for(let c of await xUe(a)){let u=sW(s,c).split(uO);u[u.length-1]=u.at(-1).replace(/\.jsonl$/,"");let d={projectKey:o,sessionId:e,subpath:u.join("/")};await tW(c,d,t,i);let f=c.replace(/\.jsonl$/,".meta.json"),m;try{m=yt(await nW(f,"utf8"))}catch(g){if(!On(g))ce(`importSessionToStore: skipping unreadable sidecar ${f}: ${g}`)}if(m!==void 0)await t.append(d,[{type:"agent_metadata",...m}])}}async function tW(e,t,r,n){let o=pUe({input:oUe(e,{encoding:"utf8"}),crlfDelay:1/0}),i=[],s=0;for await(let a of o){if(!a)continue;try{i.push(yt(a))}catch(c){ce(`importSessionToStore: skipping unparseable line in ${e}: ${c}`);continue}if(s+=a.length,i.length>=n||s>=Gh)await r.append(t,i),i=[],s=0}if(i.length>0)await r.append(t,i)}async function xUe(e){let t=[];async function r(n){let o;try{o=await aUe(n,{withFileTypes:!0})}catch{return}for(let i of o){let s=Dr(n,i.name);if(i.isDirectory())await r(s);else if(i.isFile()&&i.name.endsWith(".jsonl"))t.push(s)}}return await r(e),t}async function $kt(e,t){if(t?.sessionStore)return CUe(t.sessionStore,e,t.dir);return yF(e,t)}async function jkt(e,t,r){if(r?.sessionStore)return RUe(r.sessionStore,e,t,r);return bF(e,t,r)}function cW(e){let t=zd(e??"."),r;try{r=iUe(t)}catch{r=t}return xr(r)}function Jr(e){return us(cW(e))}function lW(e){return e.map((t)=>Re(t)).join(`
138
138
  `)+`
139
139
  `}function uW(e,t,r){if(t!==void 0&&t>0)return e.slice(r,r+t);if(r>0)return e.slice(r);return e}function cO(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function vUe(e,t){let r=cW(t.dir),n=us(r),o=t.offset??0,i=t.limit;if(e.listSessionSummaries)return SUe(e,n,r,t.dir,i,o);if(!e.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let a=(await e.listSessions(n)).slice().sort((u,d)=>d.mtime-u.mtime),c=uW(a,i,o);return pW(e,c,t.dir,r)}async function SUe(e,t,r,n,o,i){let s=await e.listSessionSummaries(t),a=e.listSessions?new Map((await e.listSessions(t)).map((f)=>[f.sessionId,f])):void 0,c=[];for(let f of s){let m=a?.get(f.sessionId);if(a&&!m)continue;let g=m!==void 0&&f.mtime<m.mtime;c.push({sessionId:f.sessionId,mtime:g?m.mtime:f.mtime,info:g?void 0:HO(f,r)})}if(a){let f=new Set(s.map((m)=>m.sessionId));for(let[m,g]of a)if(!f.has(m))c.push({sessionId:m,mtime:g.mtime})}else ce("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");c.sort((f,m)=>m.mtime-f.mtime);let u=uW(c,o,i),d=u.filter((f)=>f.info===void 0);if(d.length>0){let f=await pW(e,d,n,r),m=new Map(f.map((g)=>[g.sessionId,g]));for(let g of u)if(g.info===void 0)g.info=m.get(g.sessionId)??null}return u.flatMap((f)=>f.info?[f.info]:[])}async function pW(e,t,r,n){return(await Promise.allSettled(t.map(async(i)=>{let s=await fW(e,i.sessionId,r);if(!s)return null;let a=fc(i.sessionId,dW(s,i.mtime),n);return a?{...a,lastModified:i.mtime}:null}))).flatMap((i,s)=>{let a=t[s];if(i.status==="fulfilled")return i.value?[i.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function dW(e,t){let r=Buffer.from(e,"utf-8"),n=r.length,o=r.subarray(0,dn).toString("utf-8"),i=n>dn?r.subarray(n-dn).toString("utf-8"):o;return{mtime:t,size:n,head:o,tail:i}}function EUe(e){let t=e.trimEnd(),r=t.slice(t.lastIndexOf(`