@anthropic-ai/claude-agent-sdk 0.3.275 → 0.3.276
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/bridge.mjs +2 -2
- package/browser-sdk.js +1 -1
- package/manifest.json +14 -14
- package/manifest.zst.json +25 -25
- package/package.json +10 -10
- package/sdk.mjs +2 -2
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.
|
|
4
|
+
// Version: 0.3.276
|
|
5
5
|
|
|
6
6
|
// Want to see the unminified source? We're hiring!
|
|
7
7
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -225,7 +225,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
225
225
|
`+"\t".repeat(t))}};var rQ;(function(e){e.DEFAULT={allowTrailingComma:!1}})(rQ||(rQ={}));var oQ;(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"})(oQ||(oQ={}));var sQ;(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"})(sQ||(sQ={}));var iQ;(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"})(iQ||(iQ={}));var id=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,cQ=new Set,uL=typeof process==="object"&&!!process?process:{},lQ=(e,t,n,r)=>{typeof uL.emitWarning==="function"?uL.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},{AbortController:_E,AbortSignal:aQ}=globalThis;if(typeof _E>"u"){aQ=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,o){this._onabort.push(o)}},_E=class{constructor(){t()}signal=new aQ;abort(r){if(this.signal.aborted)return;this.signal.reason=r,this.signal.aborted=!0;for(let o of this.signal._onabort)o(r);this.signal.onabort?.(r)}};let e=uL.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,lQ("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 J8e=(e)=>!cQ.has(e),oqt=Symbol("type"),Zi=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),uQ=(e)=>!Zi(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?Sh:null;class Sh extends Array{constructor(e){super(e);this.fill(0)}}class ad{heap;length;static#e=!1;static create(e){let t=uQ(e);if(!t)return[];ad.#e=!0;let n=new ad(e,t);return ad.#e=!1,n}constructor(e,t){if(!ad.#e)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 yE{#e;#t;#n;#o;#a;#l;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#i;#s;#r;#d;#f;#p;#m;#g;#h;#S;#b;#y;#E;#v;#x;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#y,sizes:e.#S,keyMap:e.#i,keyList:e.#s,valList:e.#r,next:e.#d,prev:e.#f,get head(){return e.#p},get tail(){return e.#m},free:e.#g,isBackgroundFetch:(t)=>e.#_(t),backgroundFetch:(t,n,r,o)=>e.#M(t,n,r,o),moveToTail:(t)=>e.#I(t),indexes:(t)=>e.#T(t),rindexes:(t)=>e.#R(t),isStale:(t)=>e.#C(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#l}get dispose(){return this.#n}get disposeAfter(){return this.#o}constructor(e){let{max:t=0,ttl:n,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:i,allowStale:a,dispose:c,disposeAfter:l,noDisposeOnSet:u,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:x,ignoreFetchAbort:w}=e;if(t!==0&&!Zi(t))throw TypeError("max option must be a nonnegative integer");let I=t?uQ(t):Array;if(!I)throw Error("invalid max value: "+t);if(this.#e=t,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!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.#l=y,g!==void 0&&typeof g!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#a=g,this.#v=!!g,this.#i=new Map,this.#s=Array(t).fill(void 0),this.#r=Array(t).fill(void 0),this.#d=new I(t),this.#f=new I(t),this.#p=0,this.#m=0,this.#g=ad.create(t),this.#c=0,this.#u=0,typeof c==="function")this.#n=c;if(typeof l==="function")this.#o=l,this.#h=[];else this.#o=void 0,this.#h=void 0;if(this.#E=!!this.#n,this.#x=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#t!==0){if(!Zi(this.#t))throw TypeError("maxSize must be a positive integer if specified")}if(!Zi(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#j()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!i,this.ttlResolution=Zi(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Zi(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){if(J8e("LRU_CACHE_UNBOUNDED"))cQ.add("LRU_CACHE_UNBOUNDED"),lQ("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",yE)}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#O(){let e=new Sh(this.#e),t=new Sh(this.#e);this.#y=e,this.#b=t,this.#N=(o,s,i=id.now())=>{if(t[o]=s!==0?i:0,e[o]=s,s!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#C(o))this.#k(this.#s[o],"expire")},s+1);if(a.unref)a.unref()}},this.#w=(o)=>{t[o]=e[o]!==0?id.now():0},this.#A=(o,s)=>{if(e[s]){let i=e[s],a=t[s];if(!i||!a)return;o.ttl=i,o.start=a,o.now=n||r();let c=o.now-a;o.remainingTTL=i-c}};let n=0,r=()=>{let o=id.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);if(s.unref)s.unref()}return o};this.getRemainingTTL=(o)=>{let s=this.#i.get(o);if(s===void 0)return 0;let i=e[s],a=t[s];if(!i||!a)return 1/0;let c=(n||r())-a;return i-c},this.#C=(o)=>{let s=t[o],i=e[o];return!!i&&!!s&&(n||r())-s>i}}#w=()=>{};#A=()=>{};#N=()=>{};#C=()=>!1;#j(){let e=new Sh(this.#e);this.#u=0,this.#S=e,this.#P=(t)=>{this.#u-=e[t],e[t]=0},this.#U=(t,n,r,o)=>{if(this.#_(n))return 0;if(!Zi(r))if(o){if(typeof o!=="function")throw TypeError("sizeCalculation must be a function");if(r=o(n,t),!Zi(r))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 r},this.#D=(t,n,r)=>{if(e[t]=n,this.#t){let o=this.#t-e[t];while(this.#u>o)this.#L(!0)}if(this.#u+=e[t],r)r.entrySize=n,r.totalCalculatedSize=this.#u}}#P=(e)=>{};#D=(e,t,n)=>{};#U=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;;){if(!this.#F(t))break;if(e||!this.#C(t))yield t;if(t===this.#p)break;else t=this.#f[t]}}*#R({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#p;;){if(!this.#F(t))break;if(e||!this.#C(t))yield t;if(t===this.#m)break;else t=this.#d[t]}}#F(e){return e!==void 0&&this.#i.get(this.#s[e])===e}*entries(){for(let e of this.#T())if(this.#r[e]!==void 0&&this.#s[e]!==void 0&&!this.#_(this.#r[e]))yield[this.#s[e],this.#r[e]]}*rentries(){for(let e of this.#R())if(this.#r[e]!==void 0&&this.#s[e]!==void 0&&!this.#_(this.#r[e]))yield[this.#s[e],this.#r[e]]}*keys(){for(let e of this.#T()){let t=this.#s[e];if(t!==void 0&&!this.#_(this.#r[e]))yield t}}*rkeys(){for(let e of this.#R()){let t=this.#s[e];if(t!==void 0&&!this.#_(this.#r[e]))yield t}}*values(){for(let e of this.#T())if(this.#r[e]!==void 0&&!this.#_(this.#r[e]))yield this.#r[e]}*rvalues(){for(let e of this.#R())if(this.#r[e]!==void 0&&!this.#_(this.#r[e]))yield this.#r[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#T()){let r=this.#r[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;if(e(o,this.#s[n],this))return this.get(this.#s[n],t)}}forEach(e,t=this){for(let n of this.#T()){let r=this.#r[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#s[n],this)}}rforEach(e,t=this){for(let n of this.#R()){let r=this.#r[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#s[n],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))if(this.#C(t))this.#k(this.#s[t],"expire"),e=!0;return e}info(e){let t=this.#i.get(e);if(t===void 0)return;let n=this.#r[t],r=this.#_(n)?n.__staleWhileFetching:n;if(r===void 0)return;let o={value:r};if(this.#y&&this.#b){let s=this.#y[t],i=this.#b[t];if(s&&i){let a=s-(id.now()-i);o.ttl=a,o.start=Date.now()}}if(this.#S)o.size=this.#S[t];return o}dump(){let e=[];for(let t of this.#T({allowStale:!0})){let n=this.#s[t],r=this.#r[t],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#y&&this.#b){s.ttl=this.#y[t];let i=id.now()-this.#b[t];s.start=Math.floor(Date.now()-i)}if(this.#S)s.size=this.#S[t];e.unshift([n,s])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let r=Date.now()-n.start;n.start=id.now()-r}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:i=this.sizeCalculation,status:a}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#U(e,t,n.size||0,i);if(this.maxEntrySize&&l>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#k(e,"set"),this}let u=this.#c===0?void 0:this.#i.get(e);if(u===void 0){if(u=this.#c===0?this.#m:this.#g.length!==0?this.#g.pop():this.#c===this.#e?this.#L(!1):this.#c,this.#s[u]=e,this.#r[u]=t,this.#i.set(e,u),this.#d[this.#m]=u,this.#f[u]=this.#m,this.#m=u,this.#c++,this.#D(u,l,a),a)a.set="add";c=!1}else{this.#I(u);let p=this.#r[u];if(t!==p){if(this.#v&&this.#_(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;if(f!==void 0&&!s){if(this.#E)this.#n?.(f,e,"set");if(this.#x)this.#h?.push([f,e,"set"])}}else if(!s){if(this.#E)this.#n?.(p,e,"set");if(this.#x)this.#h?.push([p,e,"set"])}if(this.#P(u),this.#D(u,l,a),this.#r[u]=t,a){a.set="replace";let f=p&&this.#_(p)?p.__staleWhileFetching:p;if(f!==void 0)a.oldValue=f}}else if(a)a.set="update"}if(r!==0&&!this.#y)this.#O();if(this.#y){if(!c)this.#N(u,r,o);if(a)this.#A(a,u)}if(!s&&this.#x&&this.#h){let p=this.#h,f;while(f=p?.shift())this.#o?.(...f)}return this}pop(){try{while(this.#c){let e=this.#r[this.#p];if(this.#L(!0),this.#_(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#x&&this.#h){let e=this.#h,t;while(t=e?.shift())this.#o?.(...t)}}}#L(e){let t=this.#p,n=this.#s[t],r=this.#r[t];if(this.#v&&this.#_(r))r.__abortController.abort(Error("evicted"));else if(this.#E||this.#x){if(this.#E)this.#n?.(r,n,"evict");if(this.#x)this.#h?.push([r,n,"evict"])}if(this.#P(t),e)this.#s[t]=void 0,this.#r[t]=void 0,this.#g.push(t);if(this.#c===1)this.#p=this.#m=0,this.#g.length=0;else this.#p=this.#d[t];return this.#i.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,o=this.#i.get(e);if(o!==void 0){let s=this.#r[o];if(this.#_(s)&&s.__staleWhileFetching===void 0)return!1;if(!this.#C(o)){if(n)this.#w(o);if(r)r.has="hit",this.#A(r,o);return!0}else if(r)r.has="stale",this.#A(r,o)}else if(r)r.has="miss";return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#i.get(e);if(r===void 0||!n&&this.#C(r))return;let o=this.#r[r];return this.#_(o)?o.__staleWhileFetching:o}#M(e,t,n,r){let o=t===void 0?void 0:this.#r[t];if(this.#_(o))return o;let s=new _E,{signal:i}=n;i?.addEventListener("abort",()=>s.abort(i.reason),{signal:s.signal});let a={signal:s.signal,options:n,context:r},c=(h,g=!1)=>{let{aborted:y}=s.signal,E=n.ignoreFetchAbort&&h!==void 0;if(n.status)if(y&&!g){if(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,E)n.status.fetchAbortIgnored=!0}else n.status.fetchResolved=!0;if(y&&!E&&!g)return u(s.signal.reason);let v=f;if(this.#r[t]===f)if(h===void 0)if(v.__staleWhileFetching)this.#r[t]=v.__staleWhileFetching;else this.#k(e,"fetch");else{if(n.status)n.status.fetchUpdated=!0;this.set(e,h,a.options)}return h},l=(h)=>{if(n.status)n.status.fetchRejected=!0,n.status.fetchError=h;return u(h)},u=(h)=>{let{aborted:g}=s.signal,y=g&&n.allowStaleOnFetchAbort,E=y||n.allowStaleOnFetchRejection,v=E||n.noDeleteOnFetchRejection,S=f;if(this.#r[t]===f){if(!v||S.__staleWhileFetching===void 0)this.#k(e,"fetch");else if(!y)this.#r[t]=S.__staleWhileFetching}if(E){if(n.status&&S.__staleWhileFetching!==void 0)n.status.returnedStale=!0;return S.__staleWhileFetching}else if(S.__returned===S)throw h},p=(h,g)=>{let y=this.#a?.(e,o,a);if(y&&y instanceof Promise)y.then((E)=>h(E===void 0?void 0:E),g);s.signal.addEventListener("abort",()=>{if(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort){if(h(void 0),n.allowStaleOnFetchAbort)h=(E)=>c(E,!0)}})};if(n.status)n.status.fetchDispatched=!0;let f=new Promise(p).then(c,l),m=Object.assign(f,{__abortController:s,__staleWhileFetching:o,__returned:void 0});if(t===void 0)this.set(e,m,{...a.options,status:void 0}),t=this.#i.get(e);else this.#r[t]=m;return m}#_(e){if(!this.#v)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof _E}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:i=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:g=!1,status:y,signal:E}=t;if(!this.#v){if(y)y.fetch="get";return this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:y})}let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:i,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:E},S=this.#i.get(e);if(S===void 0){if(y)y.fetch="miss";let x=this.#M(e,S,v,h);return x.__returned=x}else{let x=this.#r[S];if(this.#_(x)){let N=n&&x.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",N)y.returnedStale=!0}return N?x.__staleWhileFetching:x.__returned=x}let w=this.#C(S);if(!g&&!w){if(y)y.fetch="hit";if(this.#I(S),r)this.#w(S);if(y)this.#A(y,S);return x}let I=this.#M(e,S,v,h),z=I.__staleWhileFetching!==void 0&&n;if(y){if(y.fetch=w?"stale":"refresh",z&&w)y.returnedStale=!0}return z?I.__staleWhileFetching:I.__returned=I}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#l;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...s}=t,i=this.get(e,s);if(!o&&i!==void 0)return i;let a=n(e,i,{options:s,context:r});return this.set(e,a,s),a}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=t,i=this.#i.get(e);if(i!==void 0){let a=this.#r[i],c=this.#_(a);if(s)this.#A(s,i);if(this.#C(i)){if(s)s.get="stale";if(!c){if(!o)this.#k(e,"expire");if(s&&n)s.returnedStale=!0;return n?a:void 0}else{if(s&&n&&a.__staleWhileFetching!==void 0)s.returnedStale=!0;return n?a.__staleWhileFetching:void 0}}else{if(s)s.get="hit";if(c)return a.__staleWhileFetching;if(this.#I(i),r)this.#w(i);return a}}else if(s)s.get="miss"}#$(e,t){this.#f[t]=e,this.#d[e]=t}#I(e){if(e!==this.#m){if(e===this.#p)this.#p=this.#d[e];else this.#$(this.#f[e],this.#d[e]);this.#$(this.#m,e),this.#m=e}}delete(e){return this.#k(e,"delete")}#k(e,t){let n=!1;if(this.#c!==0){let r=this.#i.get(e);if(r!==void 0)if(n=!0,this.#c===1)this.#z(t);else{this.#P(r);let o=this.#r[r];if(this.#_(o))o.__abortController.abort(Error("deleted"));else if(this.#E||this.#x){if(this.#E)this.#n?.(o,e,t);if(this.#x)this.#h?.push([o,e,t])}if(this.#i.delete(e),this.#s[r]=void 0,this.#r[r]=void 0,r===this.#m)this.#m=this.#f[r];else if(r===this.#p)this.#p=this.#d[r];else{let s=this.#f[r];this.#d[s]=this.#d[r];let i=this.#d[r];this.#f[i]=this.#f[r]}this.#c--,this.#g.push(r)}}if(this.#x&&this.#h?.length){let r=this.#h,o;while(o=r?.shift())this.#o?.(...o)}return n}clear(){return this.#z("delete")}#z(e){for(let t of this.#R({allowStale:!0})){let n=this.#r[t];if(this.#_(n))n.__abortController.abort(Error("deleted"));else{let r=this.#s[t];if(this.#E)this.#n?.(n,r,e);if(this.#x)this.#h?.push([n,r,e])}}if(this.#i.clear(),this.#r.fill(void 0),this.#s.fill(void 0),this.#y&&this.#b)this.#y.fill(0),this.#b.fill(0);if(this.#S)this.#S.fill(0);if(this.#p=0,this.#m=0,this.#g.length=0,this.#u=0,this.#c=0,this.#x&&this.#h){let t=this.#h,n;while(n=t?.shift())this.#o?.(...n)}}}function SE(e,t,n=100){let r=new yE({max:n}),o=(...s)=>{let i=t(...s),a=r.get(i);if(a!==void 0)return a;let c=e(...s);return r.set(i,c),c};return o.cache={clear:()=>r.clear(),size:()=>r.size,delete:(s)=>r.delete(s),get:(s)=>r.peek(s),has:(s)=>r.has(s),set:(s,i)=>void r.set(s,i)},o}var X8e=8192;function pQ(e,t){try{return{ok:!0,value:JSON.parse(Au(e))}}catch(n){if(t)G_(l1(n,`safeParseJSON: invalid JSON (${n instanceof Error?n.constructor.name:typeof n}, ${e.length} bytes)`));return{ok:!1}}}class fQ{cached=SE(pQ,(e)=>e,50);cache=this.cached.cache;parse(e,t){return this.cached(e,t)}}var dQ=new fQ;var bc=Object.assign(function(t,n=!0){if(!t)return null;let r=t.length>X8e?pQ(t,n):dQ.parse(t,n);return r.ok?r.value:null},{cache:dQ.cache});import{join as Q8e}from"path";class mQ{managedFilePath=void 0;dropInDir=void 0;getManagedFilePath(){return this.managedFilePath??=tXe(),this.managedFilePath}getDropInDir(){return this.dropInDir??=Q8e(Ec(),"managed-settings.d"),this.dropInDir}clearDropInDir(){this.dropInDir=void 0}reset(){this.managedFilePath=void 0,this.dropInDir=void 0}}var eXe=new mQ;function Ec(){return eXe.getManagedFilePath()}function tXe(){let e=nXe();if(e!==void 0)return e;switch(En()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}function nXe(){return}var bh=["low","medium","high","xhigh","max"];var Eh=[{path:["allowManagedPermissionRulesOnly"],restrictive:!0},{path:["allowManagedHooksOnly"],restrictive:!0},{path:["allowManagedMcpServersOnly"],restrictive:!0},{path:["enforceAvailableModels"],restrictive:!0},{path:["disableAllHooks"],restrictive:!0},{path:["disableClaudeAiConnectors"],restrictive:!0},{path:["disableCommandPluginSources"],restrictive:!0},{path:["disableSideloadFlags"],restrictive:!0},{path:["disableSkillShellExecution"],restrictive:!0},{path:["disableRemoteControl"],restrictive:!0},{path:["disableAgentView"],restrictive:!0},{path:["disableWorkflows"],restrictive:!0},{path:["disableArtifact"],restrictive:!0},{path:["disableBundledSkills"],restrictive:!0},{path:["fastModePerSessionOptIn"],restrictive:!0},{path:["isolatePeerMachines"],restrictive:!0},{path:["strictPluginOnlyCustomization"],restrictive:!0},{path:["disableAutoMode"],restrictive:"disable"},{path:["disableDeepLinkRegistration"],restrictive:"disable"},{path:["permissions","disableBypassPermissionsMode"],restrictive:"disable"},{path:["permissions","disableAutoMode"],restrictive:"disable"},{path:["permissions","blockReadsOutsideWorkingDirectories"],restrictive:!0},{path:["autoMode","classifyAllShell"],restrictive:!0},...[],{path:["worktree","bgIsolation"],restrictive:"worktree"},{path:["enableArtifact"],restrictive:!1},{path:["enableWorkflows"],restrictive:!1},{path:["syncClaudeAiSkills"],restrictive:!1},{path:["syncClaudeAiPlugins"],restrictive:!1},{path:["useAutoModeDuringPlan"],restrictive:!1},{path:["skipDangerousModePermissionPrompt"],restrictive:!1},{path:["skipAutoPermissionPrompt"],restrictive:!1},{path:["enableAllProjectMcpServers"],restrictive:!1},{path:["channelsEnabled"],restrictive:!1},{path:["skipWebFetchPreflight"],restrictive:!1},{path:["skipWorkflowUsageWarning"],restrictive:!1},{path:["autoUploadSessions"],restrictive:!1},{path:["remoteControlAtStartup"],restrictive:!1},{path:["remoteTools","allowUnattendedServing"],restrictive:!1},{path:["autoContinueAtUsageLimit"],restrictive:!1},...[],{path:["attribution","sessionUrl"],restrictive:!1},{path:["crossSessionInbound"],restrictive:["refuse","hold"]},{path:["remoteControl","shareHostProfile"],restrictive:["off","basic"]},{path:["modelProposedGoals"],restrictive:["disabled","alwaysAsk"]},{path:["maxEffortLevel"],restrictive:bh},{path:["feedbackDrafts"],restrictive:"off"},{path:["askUserQuestionTimeout"],restrictive:"never"},{path:["dialogExpiry"],restrictive:"never"},{path:["sandbox","enabled"],restrictive:!0},{path:["sandbox","failIfUnavailable"],restrictive:!0},{path:["sandbox","autoAllowBashIfSandboxed"],restrictive:!1},{path:["sandbox","allowUnsandboxedCommands"],restrictive:!1},{path:["sandbox","enableWeakerNestedSandbox"],restrictive:!1},{path:["sandbox","enableWeakerNetworkIsolation"],restrictive:!1},{path:["sandbox","allowAppleEvents"],restrictive:!1},{path:["sandbox","network","allowManagedDomainsOnly"],restrictive:!0},{path:["sandbox","network","strictAllowlist"],restrictive:!0},{path:["sandbox","network","allowAllUnixSockets"],restrictive:!1},{path:["sandbox","network","allowLocalBinding"],restrictive:!1},{path:["sandbox","filesystem","allowManagedReadPathsOnly"],restrictive:!0},{path:["sandbox","filesystem","disabled"],restrictive:!1},{path:["sandbox","credentials","allowPlaintextInject"],restrictive:!1},{path:["sandbox","credentials","sigv4","streaming"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","presigned"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","sigv4a"],restrictive:"deny"},{path:["isolation","required"],restrictive:!0},{path:["isolation","persistHome"],restrictive:!1}];function xh(e){return Array.isArray(e)?e:[e]}function Hs(e,t){let n=e;for(let r of t){if(n===null||typeof n!=="object")return;n=n[r]}return n}function Yi(e,t,n){let r=[e],o=e;for(let i of t.slice(0,-1)){let a={...o[i]};o[i]=a,o=a,r.push(o)}let s=t.at(-1);if(n!==void 0){o[s]=n;return}delete o[s];for(let i=r.length-1;i>0;i--){if(Object.keys(r[i]).length>0)break;delete r[i-1][t[i-1]]}}function rXe(e,t,n){if(n!==void 0&&!$o(e[t],n)||n===void 0&&!(t in e))Js(e,t,n)}var vh=rXe;var EE={};Lr(EE,{default:()=>wh});var yQ=typeof EE=="object"&&EE&&!EE.nodeType&&EE,hQ=yQ&&typeof bE=="object"&&bE&&!bE.nodeType&&bE,oXe=hQ&&hQ.exports===yQ,gQ=oXe?Wt.Buffer:void 0,_Q=gQ?gQ.allocUnsafe:void 0;function sXe(e,t){if(t)return e.slice();var n=e.length,r=_Q?_Q(n):new e.constructor(n);return e.copy(r),r}var wh=sXe;function iXe(e){var t=new e.constructor(e.byteLength);return new Uc(t).set(new Uc(e)),t}var cd=iXe;function aXe(e,t){var n=t?cd(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var xE=aXe;function cXe(e,t){var n=-1,r=e.length;t||(t=Array(r));while(++n<r)t[n]=e[n];return t}var vE=cXe;var SQ=Object.create,lXe=function(){function e(){}return function(t){if(!Ht(t))return{};if(SQ)return SQ(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),bQ=lXe;function uXe(e){return typeof e.constructor=="function"&&!Bc(e)?bQ(od(e)):{}}var wE=uXe;function dXe(e){return Yt(e)&&Ys(e)}var EQ=dXe;var pXe="[object Object]",fXe=Function.prototype,mXe=Object.prototype,xQ=fXe.toString,hXe=mXe.hasOwnProperty,gXe=xQ.call(Object);function _Xe(e){if(!Yt(e)||hr(e)!=pXe)return!1;var t=od(e);if(t===null)return!0;var n=hXe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&xQ.call(n)==gXe}var AE=_Xe;function yXe(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var Ah=yXe;function SXe(e,t,n,r){var o=!n;n||(n={});var s=-1,i=t.length;while(++s<i){var a=t[s],c=r?r(n[a],e[a],a,n,e):void 0;if(c===void 0)c=e[a];if(o)Js(n,a,c);else rd(n,a,c)}return n}var no=SXe;function bXe(e){return no(e,is(e))}var vQ=bXe;function EXe(e,t,n,r,o,s,i){var a=Ah(e,n),c=Ah(t,n),l=i.get(c);if(l){vh(e,n,l);return}var u=s?s(a,c,n+"",e,t,i):void 0,p=u===void 0;if(p){var f=wt(c),m=!f&&jo(c),h=!f&&!m&&Hc(c);if(u=c,f||m||h)if(wt(a))u=a;else if(EQ(a))u=vE(a);else if(m)p=!1,u=wh(c,!0);else if(h)p=!1,u=xE(c,!0);else u=[];else if(AE(c)||us(c)){if(u=a,us(a))u=vQ(a);else if(!Ht(a)||Dc(a))u=wE(c)}else p=!1}if(p)i.set(c,u),o(u,c,r,s,i),i.delete(c);vh(e,n,u)}var wQ=EXe;function AQ(e,t,n,r,o){if(e===t)return;dg(t,function(s,i){if(o||(o=new zo),Ht(s))wQ(e,t,i,n,AQ,r,o);else{var a=r?r(Ah(e,i),s,i+"",e,t,o):void 0;if(a===void 0)a=s;vh(e,i,a)}},is)}var CQ=AQ;function xXe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var TQ=xXe;var RQ=Math.max;function vXe(e,t,n){return t=RQ(t===void 0?e.length-1:t,0),function(){var r=arguments,o=-1,s=RQ(r.length-t,0),i=Array(s);while(++o<s)i[o]=r[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=r[o];return a[t]=n(i),TQ(e,this,a)}}var CE=vXe;function wXe(e){return function(){return e}}var kQ=wXe;var AXe=!Wc?Yc:function(e,t){return Wc(e,"toString",{configurable:!0,enumerable:!1,value:kQ(t),writable:!0})},OQ=AXe;var CXe=800,TXe=16,RXe=Date.now;function kXe(e){var t=0,n=0;return function(){var r=RXe(),o=TXe-(r-n);if(n=r,o>0){if(++t>=CXe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var PQ=kXe;var OXe=PQ(OQ),TE=OXe;function PXe(e,t){return TE(CE(e,t,Yc),e+"")}var IQ=PXe;function IXe(e,t,n){if(!Ht(n))return!1;var r=typeof t;if(r=="number"?Ys(n)&&Zs(t,n.length):r=="string"&&(t in n))return $o(n[t],e);return!1}var DQ=IXe;function DXe(e){return IQ(function(t,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,i=o>2?n[2]:void 0;if(s=e.length>3&&typeof s=="function"?(o--,s):void 0,i&&DQ(n[0],n[1],i))s=o<3?void 0:s,o=1;t=Object(t);while(++r<o){var a=n[r];if(a)e(t,a,r,s)}return t})}var LQ=DXe;var LXe=LQ(function(e,t,n,r){CQ(e,t,n,r)}),Wn=LXe;function MXe(e,t){var n=-1,r=e==null?0:e.length;while(++n<r)if(t(e[n],n,e)===!1)break;return e}var MQ=MXe;function NXe(e,t){return e&&no(t,Bo(t),e)}var NQ=NXe;function UXe(e,t){return e&&no(t,is(t),e)}var UQ=UXe;function FXe(e,t){return no(e,$c(e),t)}var FQ=FXe;function $Xe(e,t){return no(e,hE(e),t)}var $Q=$Xe;var zXe=Object.prototype,jXe=zXe.hasOwnProperty;function HXe(e){var t=e.length,n=new e.constructor(t);if(t&&typeof e[0]=="string"&&jXe.call(e,"index"))n.index=e.index,n.input=e.input;return n}var zQ=HXe;function BXe(e,t){var n=t?cd(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var jQ=BXe;var KXe=/\w*$/;function GXe(e){var t=new e.constructor(e.source,KXe.exec(e));return t.lastIndex=e.lastIndex,t}var HQ=GXe;var BQ=ln?ln.prototype:void 0,KQ=BQ?BQ.valueOf:void 0;function WXe(e){return KQ?Object(KQ.call(e)):{}}var GQ=WXe;var VXe="[object Boolean]",qXe="[object Date]",ZXe="[object Map]",YXe="[object Number]",JXe="[object RegExp]",XXe="[object Set]",QXe="[object String]",e7e="[object Symbol]",t7e="[object ArrayBuffer]",n7e="[object DataView]",r7e="[object Float32Array]",o7e="[object Float64Array]",s7e="[object Int8Array]",i7e="[object Int16Array]",a7e="[object Int32Array]",c7e="[object Uint8Array]",l7e="[object Uint8ClampedArray]",u7e="[object Uint16Array]",d7e="[object Uint32Array]";function p7e(e,t,n){var r=e.constructor;switch(t){case t7e:return cd(e);case VXe:case qXe:return new r(+e);case n7e:return jQ(e,n);case r7e:case o7e:case s7e:case i7e:case a7e:case c7e:case l7e:case u7e:case d7e:return xE(e,n);case ZXe:return new r;case YXe:case QXe:return new r(e);case JXe:return HQ(e);case XXe:return new r;case e7e:return GQ(e)}}var WQ=p7e;var f7e="[object Map]";function m7e(e){return Yt(e)&&ds(e)==f7e}var VQ=m7e;var qQ=Ho&&Ho.isMap,h7e=qQ?jc(qQ):VQ,ZQ=h7e;var g7e="[object Set]";function _7e(e){return Yt(e)&&ds(e)==g7e}var YQ=_7e;var JQ=Ho&&Ho.isSet,y7e=JQ?jc(JQ):YQ,XQ=y7e;var S7e=1,b7e=2,E7e=4,QQ="[object Arguments]",x7e="[object Array]",v7e="[object Boolean]",w7e="[object Date]",A7e="[object Error]",eee="[object Function]",C7e="[object GeneratorFunction]",T7e="[object Map]",R7e="[object Number]",tee="[object Object]",k7e="[object RegExp]",O7e="[object Set]",P7e="[object String]",I7e="[object Symbol]",D7e="[object WeakMap]",L7e="[object ArrayBuffer]",M7e="[object DataView]",N7e="[object Float32Array]",U7e="[object Float64Array]",F7e="[object Int8Array]",$7e="[object Int16Array]",z7e="[object Int32Array]",j7e="[object Uint8Array]",H7e="[object Uint8ClampedArray]",B7e="[object Uint16Array]",K7e="[object Uint32Array]",St={};St[QQ]=St[x7e]=St[L7e]=St[M7e]=St[v7e]=St[w7e]=St[N7e]=St[U7e]=St[F7e]=St[$7e]=St[z7e]=St[T7e]=St[R7e]=St[tee]=St[k7e]=St[O7e]=St[P7e]=St[I7e]=St[j7e]=St[H7e]=St[B7e]=St[K7e]=!0;St[A7e]=St[eee]=St[D7e]=!1;function RE(e,t,n,r,o,s){var i,a=t&S7e,c=t&b7e,l=t&E7e;if(n)i=o?n(e,r,o,s):n(e);if(i!==void 0)return i;if(!Ht(e))return e;var u=wt(e);if(u){if(i=zQ(e),!a)return vE(e,i)}else{var p=ds(e),f=p==eee||p==C7e;if(jo(e))return wh(e,a);if(p==tee||p==QQ||f&&!o){if(i=c||f?{}:wE(e),!a)return c?$Q(e,UQ(i,e)):FQ(e,NQ(i,e))}else{if(!St[p])return o?e:{};i=WQ(e,p,a)}}s||(s=new zo);var m=s.get(e);if(m)return m;if(s.set(e,i),XQ(e))e.forEach(function(y){i.add(RE(y,t,n,y,e,s))});else if(ZQ(e))e.forEach(function(y,E){i.set(E,RE(y,t,n,E,e,s))});var h=l?c?sd:Cd:c?is:Bo,g=u?void 0:h(e);return MQ(g||e,function(y,E){if(g)E=y,y=e[E];rd(i,E,RE(y,t,n,E,e,s))}),i}var nee=RE;function G7e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var ree=G7e;function W7e(e,t,n){var r=-1,o=e.length;if(t<0)t=-t>o?0:o+t;if(n=n>o?o:n,n<0)n+=o;o=t>n?0:n-t>>>0,t>>>=0;var s=Array(o);while(++r<o)s[r]=e[r+t];return s}var oee=W7e;function V7e(e,t){return t.length<2?e:Xs(e,oee(t,0,-1))}var see=V7e;var q7e=Object.prototype,Z7e=q7e.hasOwnProperty;function Y7e(e,t){t=Mr(t,e);var n=-1,r=t.length;if(!r)return!0;while(++n<r){var o=gr(t[n]);if(o==="__proto__"&&!Z7e.call(e,"__proto__"))return!1;if((o==="constructor"||o==="prototype")&&n<r-1)return!1}var s=see(e,t);return s==null||delete s[gr(ree(t))]}var iee=Y7e;function J7e(e){return AE(e)?void 0:e}var aee=J7e;var cee=ln?ln.isConcatSpreadable:void 0;function X7e(e){return wt(e)||us(e)||!!(cee&&e&&e[cee])}var lee=X7e;function uee(e,t,n,r,o){var s=-1,i=e.length;n||(n=lee),o||(o=[]);while(++s<i){var a=e[s];if(t>0&&n(a))if(t>1)uee(a,t-1,n,r,o);else Fc(o,a);else if(!r)o[o.length]=a}return o}var dee=uee;function Q7e(e){var t=e==null?0:e.length;return t?dee(e,1):[]}var pee=Q7e;function eQe(e){return TE(CE(e,void 0,pee),e+"")}var kE=eQe;var tQe=1,nQe=2,rQe=4,oQe=kE(function(e,t){var n={};if(e==null)return n;var r=!1;if(t=Zc(t,function(s){return s=Mr(s,e),r||(r=s.length>1),s}),no(e,sd(e),n),r)n=nee(n,tQe|nQe|rQe,aee);var o=t.length;while(o--)iee(n,t[o]);return n}),Ch=oQe;function sQe(e,t){return mE(e,t,function(n,r){return mg(e,r)})}var fee=sQe;var iQe=kE(function(e,t){return e==null?{}:fee(e,t)}),Th=iQe;import{homedir as $rt}from"os";import{dirname as zrt,join as No,resolve as mr}from"path";Gc();var aQe="Expected a function";function cQe(e){if(typeof e!="function")throw TypeError(aQe);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 mee=cQe;function lQe(e,t){return gE(e,mee(Qs(t)))}var Rh=lQe;import{join as kne}from"path";import{isAbsolute as hee}from"path";var uQe=L(()=>C({allowedDomains:D(_()).optional(),deniedDomains:D(_()).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:k().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:k().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:D(_()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:k().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:k().optional(),allowMachLookup:D(_().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:Q().optional(),socksProxyPort:Q().optional(),tlsTerminate:C({caCertPath:_().min(1).optional(),caKeyPath:_().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. On native Windows an ephemeral CA cannot pass the sandbox trust check, so omitting the paths uses a persistent CA managed by the sandbox runtime (set up and trusted via /sandbox install); configured paths are passed to the sandbox runtime verbatim, which rejects a bad or incomplete pair at sandbox initialization. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — project settings "+"(.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),dQe=L(()=>C({allowWrite:D(_()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:D(_()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:D(_()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:D(_()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:k().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used."),disabled:k().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 deny entries for sandboxed commands, since both are enforced by the filesystem layer this turns off; credentials.files mask entries (sentinel binds) and credentials.envVars deny/mask are 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 deny 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 and credentials.files mask entries "+"do not pin it — env scrubbing and sentinel binds are independent of the filesystem "+"layer and survive this setting.) When unset, filesystem isolation stays on.")}).optional());function gee(e,t,n){if(e.length===0||e.some((r)=>r.length===0))n.addIssue({code:Zr.custom,path:["maskClaims"],message:"maskClaims must name at least one non-empty claim — omit maskClaims for whole-token masking."});if(t===void 0)n.addIssue({code:Zr.custom,path:["maskClaims"],message:"maskClaims requires decode — without a decode format there is no token to read claims from. Set decode, or omit maskClaims."})}function _ee(e,t){let n;try{n=new RegExp(e)}catch(o){t.addIssue({code:Zr.custom,path:["extract"],message:`extract is not a valid regular expression: ${Hr(o)}`});return}if(new RegExp(n.source+"|").exec("").length-1<1)t.addIssue({code:Zr.custom,path:["extract"],message:"extract must contain at least one capturing group — "+'group 1 is the credential value to mask (e.g. "token:\\s*(\\S+)").'})}function yee(e){if(typeof e!=="object"||e===null)return e;let t=e;if(t.mode!=="deny")return e;let n={...t};if("extract"in n&&typeof n.extract!=="string")delete n.extract;if("onExtractNoMatch"in n&&n.onExtractNoMatch!=="warn"&&n.onExtractNoMatch!=="deny"&&n.onExtractNoMatch!=="error")delete n.onExtractNoMatch;if("decode"in n&&n.decode!=="jwt")delete n.decode;if("maskClaims"in n&&!(Array.isArray(n.maskClaims)&&n.maskClaims.every((r)=>typeof r==="string")))delete n.maskClaims;if("maskDuplicates"in n&&typeof n.maskDuplicates!=="boolean")delete n.maskDuplicates;if("injectHosts"in n&&!(Array.isArray(n.injectHosts)&&n.injectHosts.every((r)=>typeof r==="string")))delete n.injectHosts;return n}var OE=L(()=>tt(yee,C({path:_().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:W(["deny","mask"]).describe("Access mode for this path. `deny` blocks reads inside the sandbox; `mask` shows sandboxed commands a sentinel-substituted copy (whole-file, or only the spans captured by `extract`) and the "+"host proxy swaps sentinel→real on egress to `injectHosts`. "+"On macOS and Windows `mask` currently degrades to `deny`."),extract:_().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the file; capture group 1 of each match is a credential value, and only those captured spans are replaced "+"with sentinels — the rest of the file is preserved so a tool "+"that parses it (.netrc, JSON, YAML) still succeeds. Without `extract`, the entire file content is replaced with one sentinel (whole-file masking, suited to single-secret files). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),onExtractNoMatch:W(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the file — or, "+"with `decode`, when no candidate survives verification. `warn` (default) emits a stderr warning and leaves the file readable as-is inside the sandbox (fail-open, for credentials that may be legitimately absent); `deny` degrades the entry to "+"mode `deny` so the file is unreadable (fail-closed) — under "+"`sandbox.filesystem.disabled` it is treated as `error`, since read-denies are dropped in that mode; `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),decode:W(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: candidates are located with a built-in JWT regex (or the explicit `extract` pattern, if set), verified to actually be JWTs before masking, and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working. If no candidate verifies, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),maskClaims:D(_()).optional().describe("Names of top-level payload claims to mask inside each decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so a tool that decodes the token and reads a non-secret claim keeps working. Requires `decode`. If no named claim matches in any verified token, behavior is governed by `onExtractNoMatch` (default `warn`). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),maskDuplicates:k().optional().describe("If true, verbatim occurrences of each captured credential value outside the regex-matched spans are also replaced with the "+"corresponding sentinel — for a secret repeated where the regex "+"does not reach (e.g. pasted into a comment). Matches raw substrings, so short or common values may corrupt unrelated content; intended for long, high-entropy secrets. Defaults to false. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),injectHosts:D(_()).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).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.path.endsWith("/"))t.addIssue({code:Zr.custom,path:["path"],message:'Credential mode "mask" applies to a single file, not a directory. List the specific credential file(s), or use "deny" for the directory.'});if(e.mode==="mask"&&e.extract!==void 0)_ee(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)gee(e.maskClaims,e.decode,t)}))),ld=()=>_().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"),PE=L(()=>tt(yee,C({name:ld().describe("Environment variable name."),mode:W(["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`."),extract:_().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the value; capture group 1 of each match is a credential value, and only those captured spans are "+"replaced with sentinels — the rest of the value is preserved "+"so a tool that parses it (a `DATABASE_URL` connection string, a composite `KEY:SECRET` pair) still succeeds inside the sandbox. Without `extract`, the entire value is replaced with one sentinel (whole-value masking, suited to bare tokens). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Cannot be combined with `decode` (the decode path never consults it). Accepted but ignored for `deny`."),onExtractNoMatch:W(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the value. `warn` (default) emits a stderr warning and lets the variable pass through unmasked (fail-open, for credentials that may be legitimately absent); `deny` unsets the variable inside the sandbox (fail-closed); `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` is set without `decode`. On a mask entry with `decode`, the runtime takes the decode path and never consults this field, so a fail-closed setting "+"cannot be honored — `deny` and `error` are rejected there; "+"only `warn` is accepted. In all other shapes the field is accepted but ignored."),decode:W(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: the variable's whole value is verified to actually be a JWT and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working; the proxy swaps the whole fake token on egress. If the value does not verify, the variable is left unmasked with a stderr warning "+"(fail-open). Cannot be combined with `extract` — the decode "+"path never consults it. Accepted but ignored for `deny`."),maskClaims:D(_()).optional().describe("Names of top-level payload claims to mask inside the decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so claim-reading clients keep working. Requires `decode`. If no named claim matches, the variable is left unmasked with a stderr warning (fail-open). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),injectHosts:D(_()).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).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.extract!==void 0)_ee(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)gee(e.maskClaims,e.decode,t);if(e.mode==="mask"&&e.decode!==void 0&&e.extract!==void 0)t.addIssue({code:Zr.custom,path:["extract"],message:"extract cannot be combined with decode on an env entry — the runtime takes the decode path (whole-value JWT verification) and never consults extract, silently disabling the structured masking. Remove one of the two."});if(e.mode==="mask"&&e.decode!==void 0&&(e.onExtractNoMatch==="deny"||e.onExtractNoMatch==="error"))t.addIssue({code:Zr.custom,path:["onExtractNoMatch"],message:"onExtractNoMatch cannot be honored on an env entry with decode — the runtime takes the decode path (which is unconditionally fail-open on verify failure) and never consults extract or onExtractNoMatch. Remove onExtractNoMatch, or drop decode to use extract-based masking (whose no-match handling does honor it)."})}))),Ji=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"];var dL="_INVALID_PAIR_",IE="_PARENT_PAIR_SUPPRESSOR_";var DE=L(()=>C({accessKeyIdVar:ld().describe("Name of the masked env var holding the AWS access key id."),secretAccessKeyVar:ld().describe("Name of the masked env var holding the AWS secret access key."),sessionTokenVar:ld().optional().describe("Optional name of the masked env var holding the AWS session token (temporary credentials). When set, the proxy sends the real token as x-amz-security-token on re-signed requests and adds it to the signed header set if the client did not.")}).superRefine((e,t)=>{let n=new Map;for(let[r,o]of[["accessKeyIdVar",e.accessKeyIdVar],["secretAccessKeyVar",e.secretAccessKeyVar],["sessionTokenVar",e.sessionTokenVar]]){if(o===void 0)continue;let s=n.get(o);if(s!==void 0)t.addIssue({code:Zr.custom,path:[r],message:`${r} names the same env var ('${o}') as ${s} — each pair member must be a distinct variable.`});else n.set(o,r)}})),pQe=L(()=>{let e=W(["deny","passthrough"]);return C({streaming:e.optional().describe("Policy for aws-chunked streaming uploads (x-amz-content-sha256: STREAMING-*): per-chunk signatures chain off the seed signature, so re-signing would require rewriting the body. `deny` (default) fails closed with a 403; `passthrough` forwards the request unre-signed (the upstream will reject its signature)."),presigned:e.optional().describe("Policy for presigned URLs (X-Amz-Algorithm/X-Amz-Signature in the query, no Authorization header): the signature lives in the URL itself. `deny` (default) or `passthrough`."),sigv4a:e.optional().describe("Policy for SigV4A (AWS4-ECDSA-P256-SHA256) asymmetric signatures: there is no shared-key HMAC to recompute. `deny` (default) or `passthrough`.")})}),fQe=L(()=>C({files:D(OE()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox; `mask` substitutes a sentinel inside the sandbox (whole-file, or per-`extract` capture) and injects the real value at the proxy. On macOS and Windows `mask` degrades to `deny`."),envVars:D(PE()).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:k().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."),awsPairs:D(DE()).optional().describe("Explicit groupings of masked env vars into AWS credential pairs for SigV4 re-signing, for non-standard variable names. The conventional AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN trio is paired automatically when masked. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored. A member is only usable when its env var is forwarded as a whole-value `mask` entry (an entry carrying `extract` or `decode` does not "+"qualify — re-signing needs the whole real value). A pair "+"whose key id or secret member is unusable never re-signs: it is dropped, unless it names a conventional AWS variable, in which case it is forwarded as an inert suppressor so implicit auto-pairing stays overridden. A pair whose ONLY unusable member is the session token still re-signs, without an x-amz-security-token (temporary-credential requests fail upstream until the entry is fixed)."),sigv4:pQe().optional().describe("Policies for AWS SigV4 request shapes the proxy cannot re-sign (streaming, presigned, sigv4a) when they reference a masked credential pair: `deny` (default) or `passthrough`. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored.")}).superRefine((e,t)=>{let n=new Set;for(let[r,o]of(e?.awsPairs??[]).entries()){let s=[["accessKeyIdVar",o.accessKeyIdVar],["secretAccessKeyVar",o.secretAccessKeyVar],["sessionTokenVar",o.sessionTokenVar]],i=new Set;for(let[a,c]of s){if(c===void 0)continue;if(n.has(c))t.addIssue({code:Zr.custom,path:["awsPairs",r,a],message:`"${c}" appears in more than one awsPairs slot (within or across pairs) — each variable can fill exactly one slot.`});i.add(c)}for(let a of i)n.add(a)}}).optional()),pL=L(()=>C({enabled:k().optional(),failIfUnavailable:k().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:k().optional(),allowUnsandboxedCommands:k().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:uQe(),filesystem:dQe(),credentials:fQe(),ignoreViolations:Z(_(),D(_())).optional(),enableWeakerNestedSandbox:k().optional(),enableWeakerNetworkIsolation:k().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:k().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:D(_()).optional(),ripgrep:C({command:_(),args:D(_()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),bwrapPath:tt((e)=>typeof e==="string"&&hee(e)?e:void 0,_()).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:tt((e)=>typeof e==="string"&&hee(e)?e:void 0,_()).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 See=new Set(["disableAllHooks"]);function bee(e){let t={};for(let{path:u,restrictive:p}of Eh){if(See.has(u[0]))continue;let f=Hs(e,u);if((typeof f==="boolean"||typeof f==="string")&&xh(p).includes(f))Yi(t,u,f)}let n=LE(e.permissions,["deny","ask","disableBypassPermissionsMode","disableAutoMode"]);if(n)t.permissions={...t.permissions,...n};for(let u of mQe)if(e[u]!==void 0)t[u]=e[u];for(let[u,p]of Object.entries(e))if((u.startsWith("disable")&&(p===!0||p==="disable")||u.startsWith("enable")&&p===!1)&&!See.has(u))t[u]=p;if(e.disableAllHooks===!0)t.allowManagedHooksOnly=!0;if(Array.isArray(e.httpHookAllowedEnvVars)&&e.httpHookAllowedEnvVars.length===0)t.httpHookAllowedEnvVars=[];let r=LE(e.sandbox?.filesystem,["denyRead","denyWrite","allowManagedReadPathsOnly"]),o=LE(e.sandbox?.network,["deniedDomains","strictAllowlist","allowManagedDomainsOnly"]),s=LE(e.sandbox?.credentials,["files","envVars"])??{},i=(e.sandbox?.credentials?.awsPairs??[]).flatMap((u)=>[u.accessKeyIdVar,u.secretAccessKeyVar,u.sessionTokenVar]),a=Ji.filter((u)=>i.includes(u));if(a.length>0)s.awsPairs=a.map((u,p)=>({accessKeyIdVar:u,secretAccessKeyVar:`${IE}${p+1}_`}));let c=e.sandbox?.credentials?.sigv4;if(c){let u={};for(let[p,f]of Object.entries(c))if(f==="deny")u[p]="deny";if(Object.keys(u).length>0)s.sigv4=u}let l=Object.keys(s).length>0;if(r||o||l){let u=t.sandbox??{};t.sandbox={...u,...r&&{filesystem:{...u.filesystem,...r}},...o&&{network:{...u.network,...o}},...l&&{credentials:{...u.credentials,...s}}}}return Object.keys(t).length>0?t:null}function LE(e,t){if(!e)return;let n={};for(let r of t)if(e[r]!==void 0)n[r]=e[r];return Object.keys(n).length>0?n:void 0}var mQe=["allowedMcpServers","deniedMcpServers","allowManagedMcpServersOnly","disabledMcpjsonServers","allowManagedHooksOnly","allowedHttpHookUrls","strictKnownMarketplaces","allowedMarketplaces","blockedMarketplaces","strictPluginOnlyCustomization","availableModels","enforceAvailableModels"];function xee(e){let t=0,n=e.length;while(t<n&&Eee(e.charCodeAt(t)))t++;while(n>t&&Eee(e.charCodeAt(n-1)))n--;let r=hQe(e.slice(t,n));if(r!==-1)return{kind:"line_break",index:fL(e,t+r)};for(let o=t;o<n;o++){let s=e.charCodeAt(o);if(s===0)return{kind:"nul",index:fL(e,o)};if(s>255)return{kind:"non_ascii",index:fL(e,o),codePoint:gQe(e,o)}}return null}function hQe(e){let t=e.indexOf(`
|
|
226
226
|
`),n=e.indexOf("\r");if(t===-1)return n;return n===-1?t:Math.min(t,n)}function Eee(e){return e===9||e===32||e===10||e===13}function gQe(e,t){return e.codePointAt(t)??e.charCodeAt(t)}function fL(e,t){let n=0;for(let r=0;r<t;r++){let o=e.charCodeAt(r);if(o>=55296&&o<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320)r++;n++}return n}var mL=["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"],vee=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE"];var wee="OTEL_EXPORTER_OTLP_",Aee=["OTEL_LOG_RAW_API_BODIES","OTEL_LOG_USER_PROMPTS","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOG_MANAGED_SETTINGS","OTEL_LOGS_EXPORTER","ENABLE_BETA_TRACING_DETAILED","BETA_TRACING_ENDPOINT","ANT_OTEL_LOGS_EXPORTER"],Cee=[wee,`ANT_${wee}`],Tee={apiKeyHelper:["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL"],awsAuthRefresh:[...vee,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],awsCredentialExport:[...vee,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],gcpAuthRefresh:["CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]},_Qe=["CLAUDE_CODE_MEMORY_API_BASE_URL","CLAUDE_CODE_MEMORY_API_TOKEN"];var hL=["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","CLAUDE_CODE_ARTIFACTS_API_TOKEN","CLAUDE_CODE_ARTIFACT_ASSET_BASE_URL","CLAUDE_CODE_ARTIFACT_LIVE_BASE_URL","CLAUDE_CODE_ARTIFACT_SYNC_BASE_URL","CLAUDE_CODE_ARTIFACT_VIEWER_BASE_URL",..._Qe],yQe=[{endpoint:"ANTHROPIC_BASE_URL",companions:["_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_BEDROCK_BASE_URL",selection:"CLAUDE_CODE_USE_BEDROCK",companions:["CLAUDE_CODE_SKIP_BEDROCK_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_VERTEX_BASE_URL",selection:"CLAUDE_CODE_USE_VERTEX",companions:["CLAUDE_CODE_SKIP_VERTEX_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_FOUNDRY_BASE_URL",selection:"CLAUDE_CODE_USE_FOUNDRY",companions:["CLAUDE_CODE_SKIP_FOUNDRY_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_AWS_BASE_URL",selection:"CLAUDE_CODE_USE_ANTHROPIC_AWS",companions:["CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_GOOGLE_CLOUD_BASE_URL",selection:"CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD",companions:["CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_BEDROCK_MANTLE_BASE_URL",selection:"CLAUDE_CODE_USE_MANTLE",companions:["CLAUDE_CODE_SKIP_MANTLE_AUTH","ANTHROPIC_CUSTOM_HEADERS"]}],mZt=Gr(yQe.flatMap((e)=>[e.endpoint,...e.companions])),gL=["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"],SQe=["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"],_L=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_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"],yL=["ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES"],bQe=["CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR","CLAUDE_CODE_GATEWAY_TOKEN_FILE_DESCRIPTOR","CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR","CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR"],hZt=["CLAUDE_CODE_OAUTH_TOKEN",...bQe,"CLAUDE_CODE_ARTIFACTS_API_TOKEN","CLAUDE_CODE_SLACK_TAG_TOKEN","CLAUDE_CODE_HFI_BEARER_TOKEN","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_TRUSTED_DEVICE_TOKEN","AGENT_PROXY_AUTH_TOKEN","CLAUDE_CODE_MCP_SERVE_AUTH_TOKEN","CLAUDE_BG_AUTH_SNAPSHOT_PATH","CLAUDE_BG_SOCKET_TOKENS_PATH","CLAUDE_BG_RV_AUTH","CLAUDE_BG_PTY_AUTH","CLAUDE_BG_CLAIM_AUTH"],EQe=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"],SL=[...EQe,"AWS_PROFILE","AWS_CONFIG_FILE","AWS_SHARED_CREDENTIALS_FILE","GOOGLE_APPLICATION_CREDENTIALS","GOOGLE_CLOUD_PROJECT"];var bL=["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_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN"],EL=["GCE_METADATA_HOST","GCE_METADATA_ROOT","GCE_METADATA_IP","METADATA_SERVER_DETECTION"],gZt=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...mL,...hL,...gL,...SQe,"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",...SL,"GCLOUD_PROJECT","GOOGLE_CLOUD_QUOTA_PROJECT",...EL,...bL,"AWS_REGION","AWS_DEFAULT_REGION",..._L,"ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_BEDROCK_REGION_PREFIX","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK","CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CODE_SUBAGENT_MODEL_FORCE",...yL]);var Ree=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","fileSuggestion","gcpAuthRefresh","otelHeadersHelper","processWrapper","policyHelpers","proxyAuthHelper","statusLine","subagentStatusLine"],xL=["bwrapPath","ripgrep","socatPath"],kee=["allowAppleEvents","credentials","enableWeakerNestedSandbox","enableWeakerNetworkIsolation","filesystem.disabled","network.allowAllUnixSockets","network.allowMachLookup","network.allowUnixSockets","network.httpProxyPort","network.socksProxyPort","network.tlsTerminate"],Oee=["required","egress"],xQe=new Set(["ANTHROPIC_BEDROCK_REGION_PREFIX","ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_MODEL","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_FOUNDRY_API_KEY","ANTHROPIC_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","ANTHROPIC_SMALL_FAST_MODEL","AWS_DEFAULT_REGION","AWS_PROFILE","AWS_REGION","BASH_DEFAULT_TIMEOUT_MS","BASH_MAX_OUTPUT_LENGTH","BASH_MAX_TIMEOUT_MS","CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR","CLAUDE_CODE_API_KEY_HELPER_TTL_MS","CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS","CLAUDE_CODE_DISABLE_TERMINAL_TITLE","CLAUDE_CODE_ENABLE_AUTO_MODE","CLAUDE_CODE_ENABLE_DESIGN_SYNC","CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL","CLAUDE_CODE_ENABLE_TELEMETRY","CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS","CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL","CLAUDE_CODE_MAX_OUTPUT_TOKENS","CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_GATEWAY","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_POWERSHELL_TOOL","CLAUDE_CODE_USE_VERTEX","DISABLE_AUTOUPDATER","DISABLE_BUG_COMMAND","DISABLE_COST_WARNINGS","DISABLE_FEEDBACK_COMMAND","DISABLE_GROWTHBOOK","DISABLE_INSTALLATION_CHECKS","DISABLE_UPDATES","ENABLE_TOOL_SEARCH","MAX_MCP_OUTPUT_TOKENS","MAX_THINKING_TOKENS","MCP_CONNECT_TIMEOUT_MS","MCP_TIMEOUT","MCP_TOOL_TIMEOUT","OTEL_EXPORTER_OTLP_COMPRESSION","OTEL_EXPORTER_OTLP_HEADERS","OTEL_EXPORTER_OTLP_LOGS_COMPRESSION","OTEL_EXPORTER_OTLP_LOGS_HEADERS","OTEL_EXPORTER_OTLP_LOGS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_COMPRESSION","OTEL_EXPORTER_OTLP_METRICS_HEADERS","OTEL_EXPORTER_OTLP_METRICS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_TRACES_COMPRESSION","OTEL_EXPORTER_OTLP_TRACES_HEADERS","OTEL_EXPORTER_OTLP_TRACES_PROTOCOL","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOG_USER_PROMPTS","OTEL_LOGS_EXPORT_INTERVAL","OTEL_LOGS_EXPORTER","OTEL_METRIC_EXPORT_INTERVAL","OTEL_METRICS_EXPORTER","OTEL_METRICS_INCLUDE_ACCOUNT_UUID","OTEL_METRICS_INCLUDE_ENTRYPOINT","OTEL_METRICS_INCLUDE_REPOSITORY","OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES","OTEL_METRICS_INCLUDE_SESSION_ID","OTEL_METRICS_INCLUDE_VERSION","OTEL_RESOURCE_ATTRIBUTES","OTEL_SERVICE_NAME","OTEL_TRACES_EXPORT_INTERVAL","OTEL_TRACES_EXPORTER","USE_BUILTIN_RIPGREP","VERTEX_REGION_CLAUDE_3_5_HAIKU","VERTEX_REGION_CLAUDE_3_5_SONNET","VERTEX_REGION_CLAUDE_3_7_SONNET","VERTEX_REGION_CLAUDE_4_0_OPUS","VERTEX_REGION_CLAUDE_4_0_SONNET","VERTEX_REGION_CLAUDE_4_1_OPUS","VERTEX_REGION_CLAUDE_4_5_OPUS","VERTEX_REGION_CLAUDE_4_6_OPUS","VERTEX_REGION_CLAUDE_4_7_OPUS","VERTEX_REGION_CLAUDE_4_8_OPUS","VERTEX_REGION_CLAUDE_5_OPUS","VERTEX_REGION_CLAUDE_FABLE_5","VERTEX_REGION_CLAUDE_FABLE_5_1","VERTEX_REGION_CLAUDE_4_5_SONNET","VERTEX_REGION_CLAUDE_4_6_SONNET","VERTEX_REGION_CLAUDE_5_SONNET","VERTEX_REGION_CLAUDE_HAIKU_4_5","CLAUDE_AUTOCOMPACT_PCT_OVERRIDE","CLAUDE_CODE_AUTO_COMPACT_WINDOW","CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT","CLAUDE_CODE_MAX_CONTEXT_TOKENS","DISABLE_AUTO_COMPACT","DISABLE_COMPACT","CLAUDE_CODE_ALWAYS_ENABLE_EFFORT","CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING","CLAUDE_CODE_DISABLE_FAST_MODE","CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP","CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK","CLAUDE_CODE_DISABLE_THINKING","CLAUDE_CODE_EFFORT_LEVEL","CLAUDE_CODE_PROMPT_CACHE_TTL","CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL","DISABLE_INTERLEAVED_THINKING","DISABLE_PROMPT_CACHING","DISABLE_PROMPT_CACHING_FABLE","DISABLE_PROMPT_CACHING_HAIKU","DISABLE_PROMPT_CACHING_OPUS","DISABLE_PROMPT_CACHING_SONNET","ENABLE_PROMPT_CACHING_1H","ENABLE_PROMPT_CACHING_1H_BEDROCK","FALLBACK_FOR_ALL_PRIMARY_MODELS","FORCE_PROMPT_CACHING_5M","CLAUDE_AUTO_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_ADVISOR_TOOL","CLAUDE_CODE_DISABLE_AGENT_VIEW","CLAUDE_CODE_DISABLE_ARTIFACT","CLAUDE_CODE_DISABLE_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_BUNDLED_SKILLS","CLAUDE_CODE_DISABLE_CRON","CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS","CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY","CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING","CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND","CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE","CLAUDE_CODE_DISABLE_WORKFLOWS","CLAUDE_CODE_ENABLE_AWAY_SUMMARY","CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING","CLAUDE_CODE_ENABLE_FUNCTION_HOOKS","CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION","CLAUDE_CODE_ENABLE_TASKS","CLAUDE_CODE_FORK_SUBAGENT","CLAUDE_CODE_PLAN_MODE_REQUIRED","DISABLE_DOCTOR_COMMAND","DISABLE_EXTRA_USAGE_COMMAND","DISABLE_INSTALL_GITHUB_APP_COMMAND","DISABLE_LOGIN_COMMAND","DISABLE_LOGOUT_COMMAND","DISABLE_UPGRADE_COMMAND","CLAUDE_AX_SCREEN_READER","CLAUDE_CODE_ACCESSIBILITY","CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN","CLAUDE_CODE_DISABLE_MOUSE","CLAUDE_CODE_DISABLE_MOUSE_CLICKS","CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL","CLAUDE_CODE_FORCE_STRIKETHROUGH","CLAUDE_CODE_FORCE_TERMINAL_IMAGES","CLAUDE_CODE_HIDE_CWD","CLAUDE_CODE_NATIVE_CURSOR","CLAUDE_CODE_NO_FLICKER","CLAUDE_CODE_SCROLL_SPEED","CLAUDE_CODE_SYNTAX_HIGHLIGHT","API_TIMEOUT_MS","CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS","CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS","CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS","CLAUDE_CODE_GLOB_TIMEOUT_SECONDS","CLAUDE_CODE_MAX_RETRIES","CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION","CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY","CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION","CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS","CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT","CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS","CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS","CLAUDE_STREAM_IDLE_TIMEOUT_MS","MAX_STRUCTURED_OUTPUT_RETRIES","MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE","MCP_SERVER_CONNECTION_BATCH_SIZE","SLASH_COMMAND_TOOL_CHAR_BUDGET","TASK_MAX_OUTPUT_LENGTH","MCP_CONNECTION_NONBLOCKING","CLAUDE_ENABLE_BYTE_WATCHDOG","CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK","CLAUDE_ENABLE_STREAM_WATCHDOG"]),vQe=new Set(["API_FORCE_IDLE_TIMEOUT","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY","DO_NOT_TRACK"]),wQe=new Set(["ENABLE_BETA_TRACING_DETAILED","OTEL_LOG_RAW_API_BODIES"]),AQe=/auth|key|token|cookie|secret|credential|session|signature|passw|jwt|assertion|cert|oidc|org|tenant|account|project|workspace|user|email|identity|principal|consumer|client|host|url|base|target|upstream|endpoint|proxy|forward|route|fallback|override|apigw|x-goog-|l5d-|bypass|guardrail|amz|x-ms-|azureml|extra-parameters|envoy|helicone|litellm|cf-aig|cf-access|beta|version/;function CQe(e){if(/\r(?!\n)/.test(e))return!0;return e.split(/\n|\r\n/).some((t)=>{let n=t.indexOf(":");if(n===-1)return!1;let r=t.slice(0,n).trim();return!TQe.test(r)||xee(t.slice(n+1))!==null||AQe.test(r.toLowerCase())})}var TQe=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Pee(e,t){let n=e.toUpperCase();return xQe.has(n)||vQe.has(n)&&Pe(t)||wQe.has(n)&&oa(t)||n==="ANTHROPIC_CUSTOM_HEADERS"&&!CQe(t)}import{posix as rne,win32 as one}from"path";var ud=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],kQe=[...ud],Iee=kQe;function kh(e){return e==="manual"?"default":e}var SZt=`Cannot set permission mode: must be one of ${ud.join(", ")}`,bZt={dangerousRemoval:{bypassImmune:!0,classifierRouted:!0,hostPersonOnly:!1,localProjectionOnly:!1},backgroundOperator:{bypassImmune:!1,classifierRouted:!0,hostPersonOnly:!1,localProjectionOnly:!1},suspiciousWindowsPath:{bypassImmune:!1,classifierRouted:!0,hostPersonOnly:!1,localProjectionOnly:!1},isolatePeerMachines:{bypassImmune:!0,classifierRouted:!1,hostPersonOnly:!1,localProjectionOnly:!1},restrictedMode:{bypassImmune:!0,classifierRouted:!1,hostPersonOnly:!1,localProjectionOnly:!1},outsideReadsBlocked:{bypassImmune:!0,classifierRouted:!1,hostPersonOnly:!1,localProjectionOnly:!1},claudeSettingsFile:{bypassImmune:!1,classifierRouted:!1,hostPersonOnly:!0,localProjectionOnly:!1},...{},...{}};var Dee=["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"];var Lee=["normal","vim"];var Mee=["auto","12-hour","24-hour","24-hour-utc"],Nee=["auto","tmux","iterm2","in-process"],OQe=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],Uee=["auto",...OQe],Fee=["auto","alwaysAsk","disabled"],$ee=1e5,zee=1e6;var PQe=String.raw`\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-[^}]*)?\}`;function jee(e){return new RegExp(PQe).test(e)}var CZt=L(()=>W(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),TZt=L(()=>W(["stdio","sse","sse-ide","http","ws","sdk"]));var dd=L(()=>j("comms").optional().catch(void 0)),Xi=L(()=>Q().int().positive()),IQe=300000,Hee=L(()=>Q().int().positive().optional().catch(void 0).describe("@internal CCR backend wire hint; folded into timeout at parse."));function Bee({request_timeout_ms:e,...t}){return{...t,...t.timeout===void 0&&e!==void 0&&{timeout:Math.min(e,IQe)}}}var DQe=L(()=>C({type:j("stdio").optional(),command:_().min(1,"Command cannot be empty"),args:D(_()).default([]),env:Z(_(),_()).optional(),timeout:Xi().optional(),alwaysLoad:k().optional(),role:dd()})),LQe=L(()=>k()),Kee=L(()=>C({clientId:_().optional(),callbackPort:Q().int().positive().optional(),authServerMetadataUrl:_().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:_().min(1).optional(),xaa:LQe().optional()})),Gee=L(()=>C({name:_(),permission_policy:W(["always_allow","always_ask","always_deny"]).optional()})),Wee=L(()=>C({type:j("sse"),url:_(),headers:Z(_(),_()).optional(),headersHelper:_().optional(),oauth:Kee().optional(),timeout:Xi().optional(),request_timeout_ms:Hee(),tools:D(Gee()).optional(),alwaysLoad:k().optional(),discoveryCache:k().optional(),role:dd(),toolPermissions:Z(_(),CL()).optional()}).transform(Bee)),MQe=L(()=>C({type:j("sse-ide"),url:_(),ideName:_(),ideRunningInWindows:k().optional(),timeout:Xi().optional(),alwaysLoad:k().optional(),role:dd()})),NQe=L(()=>C({type:j("ws-ide"),url:_(),ideName:_(),authToken:_().optional(),ideRunningInWindows:k().optional(),timeout:Xi().optional(),alwaysLoad:k().optional(),role:dd()})),Vee=L(()=>C({type:W(["http","streamable-http"]).transform(()=>"http"),url:_(),headers:Z(_(),_()).optional(),headersHelper:_().optional(),oauth:Kee().optional(),timeout:Xi().optional(),request_timeout_ms:Hee(),tools:D(Gee()).optional(),alwaysLoad:k().optional(),discoveryCache:k().optional(),role:dd(),toolPermissions:Z(_(),CL()).optional()}).transform(Bee)),UQe=["command","args","env","headersHelper"],FQe=new Set(["http","streamable-http","sse"]),$Qe=/[\p{Cc}\p{Cf}\u2028\u2029]/u,zQe=/[\p{Cc}\p{Cf}\u2028\u2029]/gu;function vL(e){return/^[A-Za-z0-9_-]+$/.test(e)&&e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function jQe(e){try{let t=new URL(e);return t.protocol==="https:"&&t.hostname!==""}catch{return!1}}function qee(e,t="",n=0){if(typeof e==="string")return[[t,e,!1]];if(n>4||e===null||typeof e!=="object")return[];return Object.entries(e).flatMap(([r,o])=>{let s=r.replace(zQe,(a)=>`\\u${a.codePointAt(0).toString(16).padStart(4,"0")}`),i=t?`${t}.${s}`:s;return[[i,r,!0],...qee(o,i,n+1)]})}var wL=L(()=>Z(_(),Ee()).check((e)=>{let t=(r,o)=>{e.issues.push({code:"custom",path:r,message:o,input:e.value})};for(let r of UQe)if(Object.hasOwn(e.value,r))t([r],`"${r}" is not allowed in managed settings: only http/sse URL servers can be delivered this way, and a managed settings document must not name a program to run`);if(!FQe.has(e.value.type))t(["type"],'managed settings can only deliver "http" or "sse" servers');let n=e.value.url;if(typeof n==="string"&&!jQe(n))t(["url"],"managed settings servers must use a valid https:// url");for(let[r,o,s]of qee(e.value))if($Qe.test(o))t(r.split("."),"contains control or invisible format characters (in a key or a value); a managed settings document must not be able to print escape sequences");else if(!s&&jee(o))t(r.split("."),"${VAR} references are not expanded in managed settings; use a literal value (a managed settings document must not read the user's environment)")}).pipe(le([Vee(),Wee()]))),AL=`"managedMcpServers" must be an object keyed by server name (the .mcp.json mcpServers shape; Claude Desktop's array form of its same-named key is not accepted here: use the server name as the key and "type" instead of "transport"). No managed MCP servers are installed from it until it is fixed.`;function ME(e,t){if(e===void 0)return;if(e===null||typeof e!=="object"||Array.isArray(e)){t("",AL);return}let n=Object.create(null);for(let[r,o]of Object.entries(e)){if(!vL(r)){t("<invalid name>","server names may only contain letters, numbers, hyphens and underscores");continue}let s=wL().safeParse(o);if(s.success){n[r]=s.data;continue}let i=s.error.issues[0];t(r,i?[i.path.join("."),i.message].filter(Boolean).join(": "):"failed validation")}return n}var HQe=L(()=>C({type:j("ws"),url:_(),headers:Z(_(),_()).optional(),headersHelper:_().optional(),timeout:Xi().optional(),alwaysLoad:k().optional(),role:dd()})),BQe=L(()=>C({type:j("sdk"),name:_(),timeout:Xi().optional(),alwaysLoad:k().optional()})),CL=L(()=>W(["allow","ask","blocked"])),KQe=L(()=>C({type:j("claudeai-proxy"),url:_(),id:_(),displayName:_().optional(),iconUrl:_().optional(),timeout:Xi().optional(),alwaysLoad:k().optional(),toolPermissions:Z(_(),CL()).optional(),stateless:k().optional(),cachedInitResponse:Z(_(),Ee()).nullish(),discoverSupport:W(["supported","legacy","unknown"]).optional().catch(void 0),cachedDiscoverResponse:Z(_(),Ee()).nullish(),eligible:k().nullish(),ineligibleReason:_().nullish(),enterpriseManaged:k().optional()})),NE=L(()=>le([DQe(),Wee(),MQe(),NQe(),Vee(),HQe(),BQe(),KQe()]));var RZt=L(()=>C({mcpServers:Z(_(),NE())}));var IZt=En()==="macos"?"⏺":"●";var VQe=new Set(["Claude Preview","Claude Browser"]),qQe=new Set(["claude-in-chrome","Claude in Chrome"]),UZt=new Set([...qQe,...VQe]);var ZQe=["Claude_Browser__"],YQe=["claude-in-chrome__","Claude_in_Chrome__"],FZt=[...ZQe,...YQe];var qZt=L(()=>tt(kh,W(Iee))),ZZt=L(()=>tt(kh,W(ud)));import{posix as wet,win32 as Aet}from"path";var Zee={".ts":"ts",".tsx":"tsx",".jsx":"jsx",".js":"js",".mjs":"js",".cjs":"js",".mts":"ts",".cts":"ts"};var TL=Object.keys(Zee);var QQe=`${TL.slice(0,-1).join(", ")} or `+String(TL.at(-1));import{isIPv4 as eet,isIPv6 as tet}from"net";var net=new Set(["metadata.google.internal","metadata.goog","metadata","instance-data","instance-data.ec2.internal","ip6-localhost","ip6-loopback","localhost.localdomain","localhost4","localhost4.localdomain4","localhost6","localhost6.localdomain6"]),Jee=new Set(["100.100.100.200","168.63.129.16","192.0.0.192"]);function Xee(e,t,n,r){return e===127||e===169&&t===254||e===0}function ret(e){let t=e.indexOf("%"),r=(t>=0?e.slice(0,t):e).toLowerCase().split("::");if(r.length>2)return;let o=r[0]?r[0].split(":"):[],s=r.length===2&&r[1]?r[1].split(":"):[],i=r.length===2?s:o,a=[],c=i.at(-1);if(c!==void 0&&c.includes(".")){let m=c.split(".").map(Number);if(m.length!==4||m.some((h)=>!Number.isInteger(h)||h<0||h>255))return;a=m,i.pop()}let l=(m)=>{let h=[];for(let g of m){if(!/^[0-9a-f]{1,4}$/.test(g))return;let y=parseInt(g,16);h.push(y>>8,y&255)}return h},u=l(r.length===2?o:[]),p=l(i);if(u===void 0||p===void 0)return;let f=u.length+p.length+a.length;if(f>16||r.length===1&&f!==16)return;return[...u,...Array(16-f).fill(0),...p,...a]}function oet(e){return Qee(e)&&e[4]===0&&e[5]===1}function Qee(e){return e[0]===0&&e[1]===100&&e[2]===255&&e[3]===155}function set(e){let t=[];if(e[0]===32&&e[1]===2)t.push(e.slice(2,6));let n=e.slice(0,10).every((a)=>a===0),r=n&&e[10]===255&&e[11]===255,o=n&&e[10]===0&&e[11]===0,s=Qee(e)&&e.slice(4,12).every((a)=>a===0),i=(e[8]===0||e[8]===2)&&e[9]===0&&e[10]===94&&e[11]===254;if(r||o||s||i)t.push(e.slice(12,16));return t}function ete(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t.endsWith("."))t=t.slice(0,-1);if(t===""||t==="localhost"||t.endsWith(".localhost"))return!0;if(net.has(t))return!0;if(t.startsWith("instance-data.")&&t.endsWith(".compute.internal"))return!0;if(eet(t)){if(Jee.has(t))return!0;let[r=0,o=0,s=0,i=0]=t.split(".").map(Number);return Xee(r,o,s,i)}if(!tet(t))return!1;let n=ret(t);if(n===void 0)return!0;if(oet(n))return!0;if(n.every((r)=>r===0))return!0;if(n.slice(0,15).every((r)=>r===0)&&n[15]===1)return!0;if(t==="fd00:ec2::254")return!0;if(n[0]===254&&(n[1]??0)>=128&&(n[1]??0)<=191)return!0;return set(n).some((r)=>{let[o=0,s=0,i=0,a=0]=r;return Xee(o,s,i,a)||Jee.has(`${o}.${s}.${i}.${a}`)})}var iet=/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF]|[\uDC00-\uDFFF]/g;function aet(e){return e.replace(iet,(t)=>t.length===2?t:"")}var cet=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\u2800]|(?!\u0020)\p{Zs}/gu;function tte(e){if(typeof e!=="string")return"";let t=e;for(let n=0;n<64;n++){let r=aet(t).replace(cet,"");if(r===t)return r;t=r}return""}var nte=["bash","powershell"];var Oh=L(()=>_().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 uet(){let e=C({type:j("command").describe("Shell command hook type"),command:_().describe("Shell command to execute"),args:D(_()).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:Oh(),shell:W(nte).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:Q().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:k().optional().describe("If true, hook runs once and is removed after execution"),async:k().optional().describe("If true, hook runs in background without blocking"),asyncRewake:k().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:_().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:_().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".'),cloud:W(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'device': offer it to the cloud session and run it here even when its script sits where the cloud session can write on this machine or cannot be pinned — the author accepts that the session may have changed files this hook executes. 'skip': never offer it to cloud sessions. Omit for the default: a command hook whose script could be read and pinned and lies outside everything the cloud session can write here is offered; other command hooks are not. Applies to this entry only: the same hook written in another settings scope keeps its own setting. An unrecognised value reads as 'skip' (the file still loads; the hook stays on this machine).")}),t=C({type:j("prompt").describe("LLM prompt hook type"),prompt:_().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Oh(),timeout:Q().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:_().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:k().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:_().optional().describe("Custom status message to display in spinner while hook runs"),once:k().optional().describe("If true, hook runs once and is removed after execution")}),n=C({type:j("mcp_tool").describe("MCP tool hook type"),server:_().describe("Name of an already-configured MCP server to invoke"),tool:_().describe("Name of the tool on that server to call"),input:Z(_(),Ee()).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:Oh(),timeout:Q().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:k().optional().describe("If true, hook runs once and is removed after execution")}),r=C({type:j("http").describe("HTTP hook type"),url:_().url().describe("URL to POST the hook input JSON to"),if:Oh(),timeout:Q().positive().optional().describe("Timeout in seconds for this specific request"),headers:Z(_(),_()).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:D(_()).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:_().optional().describe("Custom status message to display in spinner while hook runs"),once:k().optional().describe("If true, hook runs once and is removed after execution"),cloud:W(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'skip': never offer it to cloud sessions; 'device' or omitted: offered (an HTTP hook has no script to pin). Applies to this entry only. An unrecognised value reads as 'skip' (the file still loads).")}),o=C({type:j("agent").describe("Agentic verifier hook type"),prompt:_().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Oh(),timeout:Q().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:_().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:k().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:r,AgentHookSchema:o,McpToolHookSchema:n}}var UE=L(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r,McpToolHookSchema:o}=uet();return cc("type",[...[e,t,n,r,o]])}),RL=L(()=>C({matcher:_().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:D(UE()).describe("List of hooks to execute when the matcher matches")})),wc=L(()=>tZ(W(_s),D(RL())));function FE(){return new Set(UE().options.map((e)=>e.shape.type.value))}function det(e,t){if(!e||typeof e!=="object"||Array.isArray(e)){let o=xc(e);return{problem:`Hook entry must be an object; received ${o}`,received:o,aboutType:!1}}let n=e.type;if(typeof n!=="string"){let o=xc(n);return{problem:n===void 0?'Hook entry has no "type"':`Hook entry "type" must be a string; received ${o}`,received:o,aboutType:!0}}if(!t.has(n)){let o=L_(n);return{problem:`Unknown hook type "${o}"`,received:o,aboutType:!0}}let r=UE().safeParse(e);if(!r.success)return{problem:`Invalid ${n} hook (${rte(r.error)})`,received:n,aboutType:!1};return}function rte(e){return e.issues.map((t)=>t.path.length>0?`${t.path.join(".")}: ${t.message}`:t.message).join("; ")}function $E(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;if(!("matcher"in e)&&Object.keys(e).some((n)=>_s.includes(n)))return!1;let t=e.hooks;if(Array.isArray(t))return t.length>0;return!!t&&typeof t==="object"&&(("matcher"in e)||typeof t.type==="string")}function vc(e,t=3,{matchersCount:n=!0,unscannedKeys:r=pet,inHooksList:o=!1}={}){if(ite(e))return!0;if(n&&$E(e))return!0;if(t===0||!e||typeof e!=="object")return!1;if(Array.isArray(e))return e.some((s)=>vc(s,t-1,{matchersCount:n,unscannedKeys:r,inHooksList:o}));if(o&&typeof e.type==="string")return!1;return Object.entries(e).some(([s,i])=>!r.has(s)&&vc(i,t-1,{unscannedKeys:r,matchersCount:n&&!_s.includes(s),inHooksList:s==="hooks"&&Array.isArray(i)}))}function ote(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return!1;return ite(e)||Object.entries(e).some(([n,r])=>n!=="hooks"&&!t.has(n)&&vc(r,3,{unscannedKeys:t,matchersCount:!_s.includes(n)}))}var pet=new Set,ste=new Set(["mcpServers","managedMcpServers","lspServers","pluginConfigs","enabledPlugins","extraKnownMarketplaces","env","skillOverrides","modelSettings"]),fet=new Set(["metadata","mcpServers","lspServers"]),h9t=new Set([...fet,"experimental"]);function ite(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;return Object.entries(e).some(([t,n])=>Ph.has(t)&&n!==null&&n!==void 0&&!(Array.isArray(n)&&n.length===0))}function kL(e){if($E(e))return!0;if(Array.isArray(e))return e.some(kL);if(!e||typeof e!=="object")return!1;return Object.entries(e).some(([t,n])=>Ph.has(t)&&n!==null&&n!==void 0&&!(Array.isArray(n)&&n.length===0))}var Ph=new Set(["PreToolUse","PermissionRequest"]);function ate(e,t){if(!Array.isArray(e))return{stripped:[],unloadableGuards:[]};let n=Ph.has(t),r=FE(),o=RL(),s=[],i=[];for(let a=e.length-1;a>=0;a--){let c=e[a],l=(m,h)=>{if(!n)e.splice(a,1);s.push({matcherIndex:a,hookIndex:void 0,path:`${a}`,problem:m,received:h,aboutType:!1})};if(vc(c,3,{matchersCount:!1})){(n?s:i).push({matcherIndex:a,hookIndex:void 0,path:`${a}`,problem:"holds PreToolUse/PermissionRequest hooks where a matcher was expected",received:xc(c),aboutType:!1});continue}if(!c||typeof c!=="object"||Array.isArray(c)){l(`Hook matcher must be an object; received ${xc(c)}`,xc(c));continue}let u=c.hooks;if(!Array.isArray(u)){l(`Hook matcher "hooks" must be an array of hook entries; received ${xc(u)}`,xc(u));continue}let p=[];for(let m=u.length-1;m>=0;m--){let h=det(u[m],r);if(h!==void 0){if(!n)u.splice(m,1);p.push({matcherIndex:a,hookIndex:m,path:`${a}.hooks.${m}`,...h})}}let f=o.safeParse(n?{...c,hooks:[]}:c);if(!f.success){l(`Invalid hook matcher (${rte(f.error)})`,"matcher");continue}s.push(...p)}return s.reverse(),i.reverse(),n?{stripped:[],unloadableGuards:s}:{stripped:s,unloadableGuards:i}}var Ac="a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed";function xc(e){if(e===null||e===void 0)return String(e);if(Array.isArray(e))return"an array";let t=typeof e;return`${t==="object"?"an":"a"} ${t}`}var pd="github.com",y9t=[`git@${pd}:`,`ssh://git@${pd}/`],S9t=[`https://${pd}`,`https://${pd}/`,pd],b9t=`users.noreply.${pd}`;var met=/[:/\\?#@\s]/;function het(e){let t=cte(e.replace(/[\t\n\r]/g,"").toLowerCase());if(t===""||met.test(t))return t;try{let n=new URL(`https://${t}`);if(n.username!==""||n.password!==""||n.port!==""||n.pathname!=="/"||n.search!==""||n.hash!=="")return t;return cte(n.hostname)}catch{return t}}var E9t=SE(function(t){let n=het(t);while(n.startsWith("www."))n=n.slice(4);return n},(e)=>e,50);function cte(e){let t=e.length;while(t>0&&e[t-1]===".")t--;return e.slice(0,t)}function get(e){return dS(bet(D_(e))).replace(/ {2,}/g," ").trim()}var _et=/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]|\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/g,yet=4;function bet(e){let t=e;for(let n=0;n<yet;n++){let r=t.replace(_et,"");if(r===t)break;t=r}return t}function OL(e,t=160){return Eet(get(xet(e,t)).normalize("NFC").replace(/[`\uff40\u02cb\u1fef\u2035]/g,"'").replace(vet,""),t)}function Eet(e,t=2000){return e.length>t?`${hi(e,t)}…`:e}function xet(e,t){let n=hi(e,t*8);if(n.length===e.length)return n;let r=/\x1b(?:[\]PX^_][^\x1b\x07]*\x1b?|\[[\x30-\x3f]*[\x20-\x2f]*)$/.exec(n);if(r===null)return n;let o=e.slice(r.index);return(o[1]==="["?/^\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/.test(o):/^\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/.test(o))?n.slice(0,r.index):n}var vet=/(?<![^\s\p{P}])\p{M}+/gu;var ML=500,Cet=32;function hte(){return{claudeaiPluginId:_().max(128).optional().catch(void 0),archiveSha256:Pte().optional().catch(void 0)}}function NL(e){if(!/^https?:\/\/[^/\\]/i.test(e))return!1;try{let{protocol:t}=new URL(e);return t==="https:"||t==="http:"}catch{return!1}}function gte(){return{npmVersionSpec:_().max(256).optional().catch(void 0),npmResolved:_().max(2048).optional().catch(void 0),npmIntegrity:_().max(256).optional().catch(void 0),npmRegistry:_().max(2048).refine(NL).optional().catch(void 0)}}function _te(){return{sourceCommand:_().max(ML+20).optional().catch(void 0).describe("The `command`-source command the user accepted at explicit install/update. The once-per-session background re-resolve only runs while the marketplace entry still declares this exact command; a changed command (or an entry that became command-sourced later) is skipped with a warning until the user runs an explicit update."),sourceProducerPath:_().max(4096).refine(lte,{message:"must be an absolute path"}).optional().catch(void 0).describe("The directory a `command`-source plugin was last resolved to (what its command printed). Served in place in link mode and re-copied every session in copy mode, so the sandbox write-denies it; refreshed on every install/update, including no-op updates that resolve to a new location."),previousProducerPaths:D(Ee()).transform((e)=>e.filter((t)=>typeof t==="string"&&t.length<=4096&<e(t)).slice(-Cet)).optional().catch(void 0).describe("Producer directories this installation was resolved to before the current one (most recent last, bounded). A concurrent older session may still serve one of them, so the sandbox keeps write-denying them too.")}}function lte(e){return wet.isAbsolute(e)||Aet.isAbsolute(e)}var yte=/[^\x20-\x7E]| {4,}/;function UL(){return _().max(ML,{message:"headersHelper must not be longer than the install consent UI can display"}).refine((e)=>!yte.test(e),{message:"headersHelper must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"})}var Tet=new Set(["claude-community","claude-plugins-community","healthcare"]),Ret=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","claude-tag-plugins"]),Ste=new Set([...Ret,...Tet]);var ket=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Oet=/[^\u0020-\u007E]/;function Pet(e){if(Ste.has(e.toLowerCase()))return!1;if(Oet.test(e))return!0;return ket.test(e)}var Lo=L(()=>_().startsWith("./")),Cc=L(()=>Lo().endsWith(".json")),ute=L(()=>le([j("."),Lo()])),dte=L(()=>le([Lo().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"),_().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),IL=L(()=>Lo().endsWith(".md")),DL=L(()=>le([IL(),Lo()])),FL={inline:"--plugin-dir session plugins",builtin:"built-in plugins","skills-dir":"plugins auto-loaded from .claude/skills/",synced:"plugins synced from your claude.ai account","claude-plugin-test":"plugins loaded by claude plugin test",npm:"plugins installed from an npm registry (`<package>@npm`); remove this marketplace and add it again under another name",pip:"plugins installed from a Python package index (reserved; not yet available)",uv:"plugins installed from a Python package index through uv (reserved; not yet available)",cargo:"plugins installed from a Rust crate registry (reserved; not yet available)",github:"plugins installed straight from a GitHub repository (`<owner>/<repo>@github`; reserved; not yet available)",gh:"plugins installed straight from a GitHub repository (reserved; not yet available)"},bte="npm",Iet=["pip","uv","cargo","github","gh"];function Ete(e){return Object.hasOwn(FL,e)}var Det=[bte,...Iet];function xte(e){return Det.includes(e.toLowerCase())}function Let(e,t){let n=e.toLowerCase();if(xte(n)&&Ete(n))t.addIssue({code:"custom",message:`Marketplace name "${n}" is reserved for ${FL[n]}`})}var vte=L(()=>_().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)=>!Lte.test(e),{message:"Marketplace name cannot contain control or bidirectional-formatting characters"}).refine((e)=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine((e)=>!Pet(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).superRefine((e,t)=>{let n=e.toLowerCase();if(!Ete(n)||xte(n))return;t.addIssue({code:"custom",message:`Marketplace name "${n}" is reserved for ${FL[n]}`})})),zE=L(()=>_().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).refine((e)=>!Lte.test(e),{message:"Plugin name cannot contain control or bidirectional-formatting characters"})),$L=L(()=>C({name:_().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:_().optional().describe("Contact email for support or feedback"),url:_().optional().describe("Website, GitHub profile, or organization URL")})),Met=L(()=>C({$schema:_().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:zE().describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:_().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:_().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:_().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:$L().optional().describe("Information about the plugin creator or maintainer"),homepage:_().url().optional().describe("Plugin homepage or documentation URL"),repository:_().optional().describe("Source code repository URL"),license:_().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:D(_()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:k().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:D(Utt()).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.`),metadata:tt((e)=>Ve(e)?e:void 0,Z(_(),Ee()).optional()).describe("Free-form metadata for the plugin author's own use (e.g. entitlement or catalog fields). Preserved on the parsed manifest but not read by Claude Code.")})),Net=1,eYt=L(()=>C({description:_().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:GS(()=>wc()).optional().describe("The hooks provided by the plugin, in the same format as the one used for settings"),modules:D(_()).max(Net,{message:"hooks.json `modules` names one hooks module per plugin; a second entry is refused"}).optional().describe(`The hooks module: one path, relative to this hooks.json, of a module exporting register(on). The module, and every file it imports from the plugin, is named like code (${QQe}; a file named otherwise is not loaded) and is an ES module whatever its suffix. What it hooks and calls is read from its source before it loads; \`claude plugin validate\` shows the result.`),surface:HS({error:'hooks.json `surface` is gone: name the module in the Client element, `Client({ module: "./board.tsx", key })`, a path relative to the file that builds it'}).optional()}).refine((e)=>e.hooks!==void 0||(e.modules?.length??0)>0,{message:"hooks.json must have `hooks` (the hook matchers) or `modules` (hooks modules), or both"})),Uet=L(()=>C({hooks:le([Cc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),GS(()=>wc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),D(le([Cc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),GS(()=>wc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),Fet=L(()=>C({source:DL().optional().describe("Path to command markdown file, relative to plugin root"),content:_().optional().describe("Inline markdown content for the command"),description:_().optional().describe("Command description override"),argumentHint:_().optional().describe('Hint for command arguments (e.g., "[file]")'),model:_().optional().describe("Default model for this command"),allowedTools:D(_()).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'})),$et=L(()=>C({commands:le([DL().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."),D(DL().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."),Z(_(),Fet()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),zet=L(()=>C({agents:le([IL().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."),D(IL().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.")])})),jet=L(()=>C({skills:le([ute().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself). 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).'),D(ute().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself).')).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).")])})),Het=L(()=>le([_(),D(_())])),wte=L(()=>C({outputStyles:le([Lo().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."),D(Lo().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.")])})),Bet=L(()=>_().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),Ket=16,Get=L(()=>C({id:Bet(),remote:_().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:_().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),Wet=L(()=>C({syntaxHighlighting:C({hljsLanguages:D(Get()).max(Ket)}).strict()})),Ate=L(()=>C({themes:le([Lo().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."),D(Lo().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.")])})),Vet=L(()=>C({})),pte=L(()=>_().min(1)),qet=L(()=>_().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),Zet=L(()=>C({mcpServers:le([Cc().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),dte().describe("Path or URL to MCPB file containing MCP server configuration"),Z(_(),NE()).describe("MCP server configurations keyed by server name"),D(le([Cc().describe("Path to MCP servers configuration file"),dte().describe("Path or URL to MCPB file"),Z(_(),NE()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),Cte=L(()=>C({type:W(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:_().describe("Human-readable label shown in the config dialog"),description:_().describe("Help text shown beneath the field in the config dialog"),required:k().optional().describe("If true, validation fails when this field is empty"),default:le([_(),Q(),k(),D(_())]).optional().describe("Default value used when the user provides nothing"),multiple:k().optional().describe("For string type: allow an array of strings"),sensitive:k().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:Q().optional().describe("Minimum value (number type only)"),max:Q().optional().describe("Maximum value (number type only)"),options:D(_().min(1,"An option cannot be empty").max(64,"An option can be at most 64 characters").refine((e)=>tte(e)===e,{message:"An option cannot contain control, invisible or bidirectional-formatting characters"}).refine((e)=>e.trim()===e,{message:"An option cannot start or end with a space"})).min(1,"options needs at least one value").refine((e)=>new Set(e.map((t)=>t.toLowerCase())).size===e.length,{message:"options cannot repeat a value (in any letter case)"}).readonly().optional().describe("For string type: the only values the field takes. /config shows the field as a picker over them, and a stored value outside them counts as unset")}).strict().superRefine((e,t)=>{if(e.options===void 0)return;if(e.type!=="string"||e.multiple===!0||e.sensitive===!0){t.addIssue({code:"custom",path:["options"],message:'options is only for a field of type "string" that is neither multiple nor sensitive'});return}if(e.default===void 0){if(e.required!==!0)t.addIssue({code:"custom",path:["default"],message:"a field with options needs a default among them, or required: true"});return}if(typeof e.default!=="string"||!e.options.includes(e.default))t.addIssue({code:"custom",path:["default"],message:`default must be one of the options: ${e.options.join(", ")}`})})),Yet=L(()=>C({userConfig:Z(_().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"),Cte()).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.")})),Jet=L(()=>C({channels:D(C({server:_().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:_().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:Z(_(),Cte()).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.")})),fte=L(()=>aI({command:_().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:D(pte()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:Z(qet(),pte()).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:W(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:Z(_(),_()).optional().describe("Environment variables to set when starting the server"),initializationOptions:Ee().optional().describe("Initialization options passed to the server during initialization"),settings:Ee().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:_().optional().describe("Workspace folder path to use for the server"),startupTimeout:Q().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:Q().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:k().optional().describe("Whether to restart the server if it crashes"),maxRestarts:Q().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:k().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.")})),Xet=L(()=>aI({name:_().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:_().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 (the named --project-config-root when a host set one) — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:_().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:le([j("always"),_().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).')})),Qet=L(()=>D(Xet()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),Tte=L(()=>C({monitors:le([Cc().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),Qet()]).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.")})),ett=L(()=>C({lspServers:le([Cc().describe("Path to .lsp.json configuration file relative to plugin root"),Z(_(),fte()).describe("LSP server configurations keyed by server name"),D(le([Cc().describe("Path to LSP configuration file"),Z(_(),fte()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),ttt=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,ntt=/^[a-z0-9][a-z0-9-._]*$/,rtt=/^@[a-z0-9][a-z0-9-._]*\/\*$/;function Rte(e){return!e.includes("..")&&!e.includes("//")&&(ttt.test(e)||ntt.test(e))}var kte=L(()=>_().refine((e)=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine((e)=>Rte(e),"Invalid npm package name format")),ott=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,stt=/^[0-9a-f]{64}$/;var itt=64;var att=L(()=>C({sha256:_().regex(stt)}));function ctt(e){let t=Z(_(),Ee()).safeParse(e);if(!t.success)return;let n=Object.create(null),r=0;for(let[o,s]of Object.entries(t.data)){if(r>=itt)break;let i=att().safeParse(s);if(ott.test(o)&&i.success)n[o]=i.data,r++}return r>0?n:void 0}var ltt=L(()=>C({binaries:Ee().transform(ctt).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),utt=L(()=>C({settings:Z(_(),Ee()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),dtt=L(()=>C({types:Lo().refine((e)=>e.endsWith(".d.ts"),{message:"types must name a TypeScript declaration file ending in '.d.ts'"}).refine((e)=>!e.split(/[\\/]/).includes(".."),{message:"types must stay inside the plugin directory (no '..' segment)"}).optional().describe("Path to the plugin's type contract, relative to the plugin root and starting with ./: a self-contained .d.ts (no import, export-from, require or reference) that exports the types of the noun the plugin's hooks module adds in engine.create at its top level and declares the noun in a `declare module 'claude-code' { interface EngineInterface { ... } }` block, nothing else. /plugin-types copies each enabled plugin's contract to .claude/types/claude-code-plugins/<plugin>.d.ts and indexes them in claude-code-plugins.d.ts for dependents to type against; claude plugin validate checks the file.")})),ptt=L(()=>C({experimental:tt((e)=>Ve(e)?e:void 0,C({...Ate().partial().shape,...Wet().partial().shape,...Tte().partial().shape,...wte().partial().shape,evals:Het().optional().describe("Directory of eval cases for the plugin evaluation harness, relative to the plugin root (default: evals/). A list is accepted; its first entry is the case directory.")}).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 ftt=L(()=>C({...Met().shape,...Uet().partial().shape,...$et().partial().shape,...zet().partial().shape,...jet().partial().shape,...wte().partial().shape,...Ate().partial().shape,...Vet().shape,...Jet().partial().shape,...Zet().partial().shape,...ett().partial().shape,...Tte().partial().shape,...utt().partial().shape,...dtt().partial().shape,...Yet().partial().shape,...ltt().partial().shape,...ptt().partial().shape})),Ote=new Set(["url","github","git","npm","file","directory","skills-dir","hostPattern","pathPattern","settings"]),fd=L(()=>cc("source",[C({source:j("url"),url:_().url().describe("Direct URL to marketplace.json file"),headers:Z(_(),_()).optional().describe("Custom HTTP headers (e.g., for authentication)"),headersHelper:UL().optional().describe("Command that prints a JSON object of HTTP headers (e.g. a short-lived auth token). Its output overrides `headers` and, like `headers`, is inherited by same-origin archive downloads from this marketplace. Runs from a fixed directory (the Claude config home, never the session's), so give a bare command found via PATH or an absolute path; it is re-run on later refreshes of this marketplace.")}),C({source:j("github"),repo:_().describe('GitHub repository in owner/repo format. ONLY in the managed-settings policy lists (strictKnownMarketplaces / blockedMarketplaces) the owner-wildcard form "owner/*" matches every repository under exactly that owner. Everywhere else (marketplace add, extraKnownMarketplaces, known_marketplaces.json) the value '+"must name a single repository — a wildcard is taken literally and fails to clone."),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:_().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:D(_()).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:k().optional().describe("Has no effect; accepted so existing settings keep working. Claude Code's own git never downloads Git LFS content: LFS-tracked files in the marketplace repository are checked out as pointer files whether or not this is set, and adding or updating the marketplace says how many were. To fetch their content, run `git lfs pull` in the marketplace's checkout under ~/.claude/plugins/marketplaces/.")}),C({source:j("git"),url:_().describe("Full git repository URL"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:_().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:D(_()).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:k().optional().describe("Has no effect; accepted so existing settings keep working. Claude Code's own git never downloads Git LFS content: LFS-tracked files in the marketplace repository are checked out as pointer files whether or not this is set, and adding or updating the marketplace says how many were. To fetch their content, run `git lfs pull` in the marketplace's checkout under ~/.claude/plugins/marketplaces/.")}),C({source:j("npm"),package:kte().or(_().regex(rtt,"Invalid npm package name format")).describe('npm package containing marketplace.json (e.g. "@acme/claude-marketplace"). In strictKnownMarketplaces / blockedMarketplaces an entry also governs plugins installed straight from the npm marketplace (`<package>@npm`): an exact package name matches that package, and "@acme/*" matches every package under the scope.'),version:_().optional().describe('Version or range to fetch (e.g. "1.4.0", "^1.4"); defaults to the latest dist-tag'),registry:_().url().refine(NL,"Registry must be an http(s) URL").optional().describe(`Registry URL. When adding a marketplace: a one-off registry override (otherwise your npm configuration decides). In a policy entry: the origin and path prefix the package's RESOLVED tarball URL must fall under (e.g. "https://npm.example.com/api/npm/internal/").`)}),C({source:j("file"),path:_().describe("Local file path to marketplace.json")}),C({source:j("directory"),path:_().describe("Local directory containing .claude-plugin/marketplace.json")}),C({source:j("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."),C({source:j("hostPattern"),hostPattern:_().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$").')}),C({source:j("pathPattern"),pathPattern:_().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.')}),C({source:j("settings"),name:vte().refine((e)=>!Ste.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:D(_tt()).describe("Plugin entries declared inline in settings.json"),owner:$L().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).")])),PL=L(()=>_().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),Pte=L(()=>_().regex(/^[0-9a-fA-F]{64}$/,"Must be a 64-character hex SHA-256 digest")),mtt="Archive URLs must use https:// and must not point at a loopback, link-local, or cloud-metadata host";function htt(e){try{let t=new URL(e);return t.protocol==="https:"&&!ete(t.hostname)}catch{return!1}}var gtt=L(()=>C({source:j("archive"),url:_().url().refine(htt,{message:mtt}).describe("HTTPS URL of a zip archive containing the plugin. The plugin root (the directory holding .claude-plugin/) may be at the top of the archive "+"or nested one directory deep — a single wrapping directory is stripped."),sha256:Pte().optional().describe("SHA-256 digest of the archive. When set, every download is verified against it and the install is refused on mismatch. It also serves as the version identity when neither plugin.json nor the marketplace entry declares a `version`. Recommended. Note the update signal is the version string (plugin.json "+"version, else the entry version, else this digest) — changing only the digest "+"while a version is declared does not trigger an update.")}).describe("Plugin distributed as a zip archive fetched over HTTPS — for hosting on any "+"static file server or artifact repository (S3, GitLab, nginx) with no git or npm on the client. Authentication: the entry's own `headers` / `headersHelper` (bound to this URL), overlaid on the enclosing url-source marketplace's headers (static or `headersHelper`-minted) when the archive shares its origin.")),Ite=L(()=>le([tt((e)=>e==="."?"./":e,Lo()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),C({source:j("npm"),package:kte().or(_().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:_().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:_().url().refine(NL,"Registry must be an http(s) URL").optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),C({source:j("url"),url:_().describe("Full git repository URL (https:// or git@)"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:PL().optional().describe("Specific commit SHA to use")}),C({source:j("github"),repo:_().describe("GitHub repository in owner/repo format"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:PL().optional().describe("Specific commit SHA to use")}),C({source:j("git-subdir"),url:_().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:_().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:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:PL().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."),gtt(),C({source:j("command"),command:_().min(1).max(ML,{message:"command must not be longer than the install consent UI can display"}).refine((e)=>!yte.test(e),{message:"command must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"}).describe("Shell command that prints the absolute path of the plugin directory on stdout (exactly one line) and exits 0. It must leave a complete plugin in that directory before exiting; the directory is copied into the plugin cache, so the printed path may change between runs (it is re-resolved on every install and update, and once per session in the background). Runs through the platform shell (sh on macOS/Linux, cmd.exe on Windows) from the user's home directory with Claude Code's subprocess environment."),timeout:Q().int().positive().max(600).optional().describe("Seconds to wait for the command before giving up (default: 60)"),mode:W(["copy","link"]).optional().describe("copy (default): the printed directory is copied into the plugin cache and content-hashed, so it may be deleted afterwards. link: the cache entry links to the printed directory "+"in place (no copy, no size limit; macOS/Linux) — for large exports; the directory must then stay "+"valid while Claude Code runs, and a different printed path is what signals new content.")}).describe("Plugin directory produced by a locally installed tool (e.g. an IDE that renders its plugin for the currently selected SDK). Claude Code runs the command, copies the directory it prints, and re-runs it in the background at startup to pick up changes."),C({source:j("unsupported"),error:_().optional()}).describe("Placeholder for source types this Claude Code version does not recognize, or a known type whose fields failed validation (then `error` "+"holds the reason). 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 an actionable message.")])),_tt=L(()=>C({name:zE().describe("Plugin name as it appears in the target repository"),source:Ite().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:_().optional(),version:_().optional(),strict:k().optional(),headers:Z(_(),_()).optional().describe("HTTP headers sent when downloading this entry's `archive` source."),headersHelper:UL().optional().describe("Command that prints a JSON object of HTTP headers for downloading this entry's `archive` source. Runs only when a user explicitly installs or updates this plugin. Unlike a catalog entry, an entry written here does not need `strict: false`: it is declared in a settings file, which has no manifest fields to inline. A declaration in project settings is not operator-authored, so request-routing and client-identity header names are still filtered there. Use an absolute path.")}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, archive, command). 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, archive, command)."}));var ytt=L(()=>C({cli:D(_().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:D(_().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:D(_().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:D(C({file:_().max(256),pattern:_().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:D(_().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.`)})),Stt=L(()=>C({topic:_().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:ytt().optional().describe("Matchers that determine when the plugin is relevant.")})),btt=L(()=>ftt().partial().extend({name:zE().describe("Unique identifier matching the plugin name"),source:Ite().describe("Where to fetch the plugin from"),headers:Z(_(),_()).optional().describe("Custom HTTP headers for fetching this plugin's archive; overrides the marketplace's"),headersHelper:UL().optional().describe("Command that prints a JSON object of HTTP headers for fetching this plugin's archive (e.g. a short-lived auth token); overrides this entry's `headers` and the marketplace's. Runs only when the user installs or updates this plugin, never during catalog browse. An entry that sets it must be `strict: false` with its manifest inlined here, so consent is informed from the entry alone before the command runs."),category:_().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:D(_()).optional().describe("Tags for searchability and discovery"),strict:k().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:tt((e)=>Ve(e)?e:void 0,Stt().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.`)})),Ett=L(()=>C({name:zE()}));function xtt(e){let t=btt();return e.flatMap((n,r)=>{let o=t.safeParse(n);if(o.success){let a=o.data.source;if(typeof a==="object"&&a.source==="unsupported"&&a.error!==void 0)return[{...o.data,source:{source:"unsupported"}}];return[o.data]}let s=Ett().safeParse(n).data?.name,i=o.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(s){ie(`Stubbing unparseable marketplace plugin entry (${s}): ${i}`,{level:"warn"});let a=Dte(Ve(n)?n.source:void 0)?ktt:zL(n)?void 0:wtt(o.error.issues)??jE(o.error.issues);return[{name:s,source:{source:"unsupported",...a&&{error:a}},strict:!0}]}return ie(`Dropping unparseable marketplace plugin entry (index ${r}): ${i}`,{level:"warn"}),[]})}var vtt=new Set(["npm","url","github","git-subdir","archive","command","unsupported"]);function zL(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.source;return typeof n==="string"&&!vtt.has(n)}function wtt(e){let t=e.find((r)=>r.path.length===1&&r.path[0]==="source");if(!t||t.code!=="invalid_union")return;let n=t.errors.find((r)=>!r.some((o)=>o.path.length===0||o.code==="invalid_value"&&o.path[0]==="source"));if(!n||n.length===0)return;return jE(n.map((r)=>({...r,path:["source",...r.path]})))}var Att=/^[A-Za-z0-9_$.-]{1,40}$/;function as(e){return Att.test(e)?e:"<key>"}var Ctt=3,Ttt=160;function jE(e){let t=e.slice(0,Ctt).map((r)=>{let o=r.path.map(String).map((i)=>as(i)).join("."),s=r.code==="unrecognized_keys"?`Unrecognized ${r.keys.length===1?"field":"fields"}: ${r.keys.map(as).join(", ")}`:OL(r.message,Ttt);return o?`${o}: ${s}`:s}),n=e.length-t.length;return n>0?`${t.join(", ")} (+${n} more)`:t.join(", ")}var Rtt=/^[A-Za-z0-9][-A-Za-z0-9._]*$/,ktt='Bare source names resolve under metadata.pluginRoot, which this marketplace does not set (or sets to a path outside the marketplace root). Use a "./relative/path" source, or set metadata.pluginRoot to allow bare names.';function Dte(e){return typeof e==="string"&&Rtt.test(e)&&!e.includes("..")}function Ott(e){if(typeof e!=="string"||e===""||e.startsWith("/")||e.includes("\\")||e.includes(":"))return;let t=e.replace(/^\.\//,"").replace(/\/+$/,"");if(t===""||t===".")return".";if(t.split("/").some((n)=>n===""||n==="."||n===".."))return;return t}function Ptt(e,t){if(t===void 0||!Ve(e)||!Dte(e.source))return e;let n=t==="."?`./${e.source}`:`./${t}/${e.source}`;return{...e,source:n}}function Itt(e){if(!Ve(e)||!Array.isArray(e.plugins))return e;let t=Ve(e.metadata)?Ott(e.metadata.pluginRoot):void 0;if(t===void 0)return e;return{...e,plugins:e.plugins.map((n)=>Ptt(n,t))}}var Dtt=L(()=>C({$schema:_().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:vte().superRefine(Let),version:_().optional().describe("Marketplace manifest version"),description:_().optional().describe("Human-readable description of this marketplace"),owner:$L().describe("Marketplace maintainer or curator information"),plugins:D(Ee()).transform(xtt).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:k().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:C({pluginRoot:_().optional().describe('Base directory for bare plugin source names, relative to the marketplace root (e.g. "./plugins" resolves "source": "formatter" as ./plugins/formatter). Sources that already start with "./" are unaffected.'),version:_().optional().describe("Marketplace version"),description:_().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:D(_()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust."),renames:Z(_(),_().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.")})),tYt=L(()=>tt(Itt,Dtt())),LL="[A-Za-z0-9][-A-Za-z0-9._]*",nYt=new RegExp(`^${LL}$`);var Ltt=new RegExp(`^${LL}@${LL}$`),mte=`@${bte}`;function Mtt(e){return e.endsWith(mte)&&Rte(e.slice(0,-mte.length))}var HE=L(()=>_().refine((e)=>Ltt.test(e)||Mtt(e),"Plugin ID must be in format: plugin@marketplace")),rYt=new RegExp(`[@:\\s/\\\\${wu}]`,"u"),oYt=new RegExp(`[${wu}]`,"u"),Lte=/[\p{Cc}\u200E\u200F\u202A-\u202E\u2066-\u2069]/u,Ntt=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,Utt=L(()=>le([_().regex(Ntt,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),C({name:_().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:_().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),Ftt=L(()=>C({version:_().describe("Currently installed version"),installedAt:_().describe("ISO 8601 timestamp of installation"),lastUpdated:_().optional().describe("ISO 8601 timestamp of last update"),installPath:_().describe("Absolute path to the installed plugin directory"),gitCommitSha:_().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:_().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:k().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)."),...hte(),..._te(),...gte()})),sYt=L(()=>C({version:j(1).describe("Schema version 1"),plugins:Z(HE(),Ftt()).describe("Map of plugin IDs to their installation metadata")})),$tt=L(()=>W(["managed","user","project","local"])),ztt=L(()=>C({scope:$tt().describe("Installation scope"),projectPath:_().optional().describe("Project path (required for project/local scopes)"),installPath:_().describe("Absolute path to the versioned plugin directory"),version:_().optional().describe("Currently installed version"),installedAt:_().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:_().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:_().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:_().optional().describe("Tag-derived semver this install resolved to"),auto:k().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep."),...hte(),..._te(),...gte()})),iYt=L(()=>C({version:j(2).describe("Schema version 2"),plugins:Z(HE(),D(ztt())).describe("Map of plugin IDs to arrays of installation entries")})),jtt=L(()=>C({source:fd().describe("Where to fetch the marketplace from"),installLocation:_().describe("Local cache path where marketplace manifest is stored"),lastUpdated:_().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:k().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),aYt=L(()=>Z(_(),jtt()));var BE=["aspell","hunspell","ispell"];var Mte=2147483647;var Htt=["autoMode","deepLink","voice","briefView","screenReader"],jL={},KE={autoMode:{buildGate:()=>!1,shape:()=>jL,permissionsShape:()=>jL,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:W(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!0,shape:()=>({voiceEnabled:k().optional().describe("Enable voice mode (hold-to-talk dictation)")})},briefView:{buildGate:()=>!0,shape:()=>({defaultView:W(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>jL}};function Dh(){return Htt.filter((e)=>KE[e].buildGate())}function Nte(e){let t={};for(let n of e)t={...t,...KE[n].shape()};return t}function Ute(e){let t={};for(let n of e)t={...t,...KE[n].permissionsShape?.()};return t}function Fte(e){let t=[];for(let n of e)t.push(...KE[n].permissionModes?.()??[]);return t}var $te={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 HL(e){return Object.hasOwn($te,e)?$te[e]:e}var zte="workspace",hYt=`mcp__${zte}__bash`,gYt=`mcp__${zte}__web_fetch`;function GE(e){return e.includes("*")}function Btt(e){return e.replaceAll("\\","\\\\").replaceAll("(","\\(").replaceAll(")","\\)")}function Ktt(e){return Gtt(e).replaceAll("\\\\","\\")}function Gtt(e){return e.replaceAll("\\(","(").replaceAll("\\)",")")}function BL(e){let t=Wtt(e,"("),n=Vtt(e,")");if(t===-1&&n===-1)return{kind:"bare"};let r=e.substring(0,t);if(t===-1||n<=t||n!==e.length-1||/[()]/.test(r))return{kind:"malformed"};return{kind:"call",toolName:r,rawContent:e.substring(t+1,n)}}function jte(e){let t=BL(e);if(t.kind!=="call"||!t.toolName)return{toolName:HL(e)};if(t.rawContent===""||t.rawContent==="*")return{toolName:HL(t.toolName)};let n=Ktt(t.rawContent);return{toolName:HL(t.toolName),ruleContent:n}}function WE(e){if(!e.ruleContent)return e.toolName;let t=Btt(e.ruleContent);return`${e.toolName}(${t})`}function Wtt(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function Vtt(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function KL(e){let t=e.split("__"),[n,r,...o]=t;if(n!=="mcp"||!r)return null;let s=o.length>0?o.join("__"):void 0;return{serverName:r,toolName:s}}var VE={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 GL(e){return VE.filePatternTools.includes(e)}function Hte(e){return VE.bashPrefixTools.includes(e)}function Bte(e){return Object.hasOwn(VE.customValidation,e)?VE.customValidation[e]:void 0}function Vte(e,t){let n=0,r=t-1;while(r>=0&&e[r]==="\\")n++,r--;return n%2!==0}function Kte(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t&&!Vte(e,r))n++;return n}var qtt=/(?:^|[^\\])\\[()]/;function Ztt(e){return qtt.test(e)&&Kte(e,"(")!==Kte(e,")")}var Ytt=/^(?:[|&;<>]|\d+[<>])/;function Jtt(e){return Ytt.test(e)}function Gte(e){for(let t=0;t<e.length;t++)if(e[t]==="*"&&!Vte(e,t))return!0;return!1}function Xtt(e){if(e.endsWith(":*"))return;let t=e.trim().split(/\s+/).filter(Boolean),n=t[0];if(t.length<3||n===void 0||Gte(n))return;let r=!1;for(let o of t.slice(1)){if(Jtt(o))return;if(Gte(o)){r=!0;continue}if(o.startsWith("-"))continue;return r?n:void 0}return}function Wte(e){if(!GE(e))return null;let t=KL(e);if(t&&!GE(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 WL(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let n=BL(e);if(n.kind==="malformed")return{valid:!1,error:"Malformed Tool(content) rule",suggestion:'Rules take the form Tool or Tool(content) and must end at the closing ")"; parentheses inside the content are literal'};if(n.kind==="call"&&n.rawContent===""){if(!n.toolName)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 "${n.toolName}" without parentheses`,examples:[`${n.toolName}`,`${n.toolName}(some-pattern)`]}}let r=jte(e),o=KL(r.toolName);if(o){if(n.kind==="call")return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${r.toolName}" without parentheses, or use "mcp__${o.serverName}__*" for all tools`,examples:[`mcp__${o.serverName}`,`mcp__${o.serverName}__*`,o.toolName&&o.toolName!=="*"?`mcp__${o.serverName}__${o.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let i=Wte(r.toolName);if(i)return i}return{valid:!0}}if(!r.toolName||r.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let i=Wte(r.toolName);if(i)return i}if(!r.toolName.includes("_")&&r.toolName[0]!==r.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${ef(String(r.toolName))}"`};if(n.kind==="call"&&Ztt(n.rawContent)){let i=GL(r.toolName);return{valid:!1,error:'Ambiguous "\\(" or "\\)" beside an unescaped parenthesis',suggestion:i?"Write a Windows path with forward slashes, or spell a literal parenthesis as [(] or [)]":'Double a backslash that is a path separator ("\\\\("), and escape literal parentheses in pairs',examples:i?[`${r.toolName}(C:/Projects/(drafts)/**)`,`${r.toolName}(C:\\Projects\\[(]drafts)\\**)`]:[`${r.toolName}(C:\\tools\\\\(x86)\\run.exe *)`]}}let s=Bte(r.toolName);if(s&&r.ruleContent!==void 0){let i=s(r.ruleContent);if(!i.valid)return i}if(Hte(r.toolName)&&r.ruleContent!==void 0){let i=r.ruleContent;if(i.includes(":*")&&!i.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(i===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]};if(t==="allow"){let a=Xtt(i);if(a!==void 0){let c=a==="git",l=c?" For git, options such as -c and --exec-path can run arbitrary commands.":"",u=c?" (for example Bash(git status *))":"";return{valid:!0,warning:`${WE(r)} has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt.${l} Replace that * with the exact value you mean, or only use * after the subcommand${u}.`}}}}if(GL(r.toolName)&&r.ruleContent!==void 0){if(r.ruleContent.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${r.toolName}(*.ts) - matches .ts files`,`${r.toolName}(src/**) - matches all files in src`,`${r.toolName}(**/*.test.ts) - matches test files`]}}if(r.ruleContent!==void 0){let i=r.toolName==="Write"||r.toolName==="NotebookEdit"||r.toolName==="MultiEdit"?"Edit":r.toolName==="Glob"?"Read":void 0;if(i!==void 0&&!r.ruleContent.includes(":*"))return{valid:!0,warning:`${WE(r)} is not matched by file permission checks — only ${i}(path) rules are. Use ${WE({toolName:i,ruleContent:r.ruleContent})} instead (${i} rules cover all file-${i==="Edit"?"editing":"reading"} tools).`}}return{valid:!0}}var VL=L(()=>Zte()),qte=L(()=>Zte("allow"));function Zte(e){return _().superRefine((t,n)=>{let r=WL(t,e);if(!r.valid){let o=r.error;if(r.suggestion)o+=`. ${r.suggestion}`;if(r.examples&&r.examples.length>0)o+=`. Examples: ${r.examples.join(", ")}`;n.addIssue({code:Zr.custom,message:o,params:{received:t}})}})}var Lh=["accept","hold","refuse"],YE=["off","basic","full"],Qtt=L(()=>Z(_(),vKe()));function sne(e){return C({allow:D(qte()).optional().describe("List of permission rules for allowed operations"),deny:D(VL()).optional().describe("List of permission rules for denied operations"),ask:D(VL()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:tt(kh,W([...ud,...Fte(e)])).optional().describe("Default permission mode when Claude Code needs access ('manual' is accepted as an alias for 'default')"),disableBypassPermissionsMode:W(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),blockReadsOutsideWorkingDirectories:k().optional().describe('Refuse file-tool reads (Read, Grep, Glob, LSP) outside the working directories in every permission mode; true in any settings source wins. Also set when the user picks "block" on the one-time auto-mode prompt for a read outside the working directories.'),...Ute(e),additionalDirectories:D(_()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var tJt=L(()=>sne(Dh())),ent=L(()=>le([_(),C({}).passthrough().describe('{ id: stable id (letters, digits, ".", "_", "-"; max 64), text: the tip (max 500 characters, one line), cooldownSessions?: sessions to wait before showing it again (default 0), priority?: tie-break weight among never-shown tips (default 0) }')])),tnt=L(()=>tt((e)=>Array.isArray(e)?e.filter((t)=>typeof t==="string"||!!t&&typeof t==="object"&&!Array.isArray(t)):[],D(ent()))),JL=L(()=>C({source:fd().describe("Where to fetch the marketplace from"),installLocation:_().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:k().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),XL=L(()=>{let e=()=>Q().min(0).max(1e4);return C({input:e(),output:e(),cacheRead:e(),cacheWrite:e()})}),QL=L(()=>Q().gt(0).lte(10).optional()),e0=L(()=>C({model:_().describe('Model to select, taken verbatim: an alias ("opus"), an Anthropic model ID, or a provider-format ID (Vertex, Bedrock, gateway). Same values --model accepts.'),label:_().optional().describe("Row title. Defaults to the model name."),description:_().optional().describe("Row subtitle. Defaults to a generic description."),behavesAs:_().optional().describe("For a model this version of Claude Code does not know: the ID of a model it does know "+'(e.g. "claude-opus-4-8") whose client-side handling — prompt profile, capability and effort '+"defaults — applies to it. Changes neither the row's label nor the model ID sent. Without it, "+"a model-catalog row for a model this version does not know is not offered until Claude Code is updated.")})),JE=L(()=>C({serverName:_().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:D(_()).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:_().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>xf([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"'})),XE=L(()=>C({serverName:_().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:D(_()).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:_().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>xf([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"'})),ine=L(()=>C({marketplace:_(),plugin:_()})),nnt=L(()=>tt((e)=>{if(typeof e!=="string"||!HE().safeParse(e).success)return e;let t=e.indexOf("@");return{marketplace:e.slice(t+1),plugin:e.slice(0,t)}},ine())),rnt=/[\x00-\x1f\x7f-\x9f\u2028\u2029]|\p{DI}/u;function ont(e){let t=e.replaceAll("/","\\");if(va(t))return!1;return/^\\{2}[^\\]/.test(t)}function snt(e){return fi(e)||/^\/network\/servers(\/|$)/i.test(e)}function int(e){return/^\/(proc|dev\/(fd|stdin|stdout|stderr))(\/|$)/i.test(e)}function ant(e,t,n={}){if(t==="win32"){let r=e.replaceAll("/","\\");if(va(r))return!1;let o=ont(r);if(n.rejectUnc&&o)return!1;if(n.rejectDriveRelative){if(!/^[A-Za-z]:\\/.test(r)&&!o&&/^(\\|[A-Za-z]:)/.test(r))return!1}if(one.normalize(r)!==r)return!1;let s=r.split("\\");if(s.some((a)=>a==="."||a===".."))return!1;if(s.some((a,c)=>/[. ]$/.test(a)||a.includes(":")&&!(c===0&&/^[A-Za-z]:$/.test(a))))return!1;let i=r.startsWith("\\\\")?r.slice(2):r;if(/\\{2}/.test(i))return!1;return!r.endsWith("\\")||/^([A-Za-z]:)?\\$/.test(r)}if(n.rejectNetworkRoot&&snt(e))return!1;if(n.rejectMagicLinkRoot&&int(e))return!1;if(rne.normalize(e)!==e)return!1;if(e.split("/").some((r)=>r==="."||r===".."))return!1;if(/\/{2}/.test(e))return!1;return!e.endsWith("/")||e==="/"}var cnt=/\.(exe|ps1)$/i;function lnt(e){return/\.ps1$/i.test(e)}function unt(e){return lnt(e)&&/[[\]`*?]/.test(e)}var dnt='a .ps1 path must not contain "[", "]", "`", "*", or "?" on Windows (PowerShell resolves them as wildcard syntax)',pnt=()=>_().describe("Absolute path to the helper executable"),Qi=(e)=>tt((t)=>t===null?void 0:t,e.optional()).optional(),fnt=Mte,Yte=(e)=>Q().int().min(e).transform((t)=>Math.min(t,fnt)),Jte=["path","script","defaultSettings"];function ane(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;let t=e;return Jte.some((n)=>t[n]===null)&&Jte.every((n)=>t[n]===null||t[n]===void 0)}var Xte=64,ZE=L(()=>C({path:pnt(),timeoutMs:Qi(Yte(1000)),refreshIntervalMs:Qi(le([j(0),Yte(60000)]))})),cne=()=>W(["replace","merge"]).describe("How the helper's managedSettings compose with the settings of the source that delivered this entry: 'replace' (default) — the output is the policy; 'merge' — the output is deep-merged over that source's own settings the way merged managed sources compose (helper scalars win, arrays union, objects merge — except fallbackModel, forceLoginOrgUUID, gatewayInternalNetworks, sandbox.filesystem.allowRead, sandbox.credentials.awsPairs, sandbox.ripgrep and the restriction allowlists such as allowedMcpServers, availableModels and allowedHttpHookUrls, which are the helper's whole value when it emits one; tighten a permission with a deny), so a failed helper costs only the delta");function lne(e){return e==="continue"||e==="refuse"}var mnt=()=>tt((e)=>e===void 0||lne(e)?e:"refuse",W(["continue","refuse"]).describe(`What happens when this entry's helper fails at startup (bad path, missing file or interpreter, non-zero exit, timeout, oversize or invalid output) and no static settings payload (this entry's own, the linux entry's on WSL, or the map's "default") applies in its place: 'refuse' — Claude Code does not start, naming the failure; 'continue' — Claude Code starts without the helper's output, on the delivering source's own settings, with a /status notice. Default: 'refuse' when the entry comes from MDM or the managed settings file, 'continue' when it comes from remote managed settings. Any other value is treated as 'refuse', with a /status notice. The install and update commands start no session and are never refused over a remote entry: they report the refusal in /status. An entry whose other fields fail validation runs no helper; from MDM or the managed settings file, any value but 'continue' on it then refuses to start Claude Code until the entry is fixed, unless a static settings payload (the entry's own, kept when it validates, the linux entry's for a wsl one, or the map's "default") serves in its place. From remote, a non-interactive session runs the helper off settings verified this session without the interactive approval, so 'refuse' there too means the helper ran and failed; a launch whose remote settings could not be verified this session (offline, fetch failed) starts without the helper regardless; and a failure first reached after the session has started (settings verified or approved mid-session, which on a machine that only ever runs non-interactively is every launch) ends a session no person watches (non-interactive, a background session no client is attached to, or a teammate session) as the refused start would have, and leaves a watched interactive one (a terminal, with or without remote control, or an attached background session) running under a /status notice with its next start refused. Background refresh failures always keep the last good output whatever this says`)),hnt=5,gnt=()=>Q().int().min(0).transform((e)=>Math.min(e,hnt)).describe("How many more times to run this entry's helper when a run fails to execute — it could not be launched, exited non-zero, or was stopped at timeoutMs — before that counts as a failure (a non-negative integer; default 0, a single attempt; above 5 is treated as 5). Attempts are separated by a short randomized backoff (from 250 ms, doubling per attempt, at most 4 s each) and each attempt gets the full timeoutMs, so a start that waits on the helper can wait up to (retries + 1) × timeoutMs plus the backoff. Output the helper did produce and that was refused — oversized, not a JSON object, an invalid envelope, or settings that fail validation — is not retried, and neither is an invalid path. Applies alike at startup and on each background refresh; only once the attempts are used up do the entry's failure rules (a static settings payload in its place, onFailure, the refresh notice) apply, naming the last attempt's failure"),_nt=(e)=>(e==="windows"?j("pwsh",{message:"interpreter must be 'pwsh' on windows ('sh' is not supported there)"}):j("sh",{message:"interpreter must be 'sh' on macos/linux/wsl"})).describe("Fixed interpreter for `script`: 'sh' (/bin/sh) on macos/linux/wsl entries; 'pwsh' (PowerShell at its fixed install locations, never PATH) on the windows entry"),ynt="exactly one of path/script must be configured",Snt='"script" and "interpreter" must be configured together',bnt="script must be ASCII-only on Windows (PowerShell decodes stdin with the console OEM code page); spell non-ASCII characters as escapes, e.g. [char]0x00E9",Ent=(e)=>_({message:"script must be a string"}).min(1,{message:"script must not be empty"}).max(65536,{message:"script must be at most 65536 characters"}).refine((t)=>!t.includes("\x00"),{message:"script must not contain NUL bytes"}).refine((t)=>I_(t),{message:"script must be valid UTF-8 (no lone surrogates)"}).refine((t)=>e!=="windows"||!/[\u0080-\uffff]/.test(t),{message:bnt}).describe("Inline helper script, delivered to the fixed interpreter over stdin (never written to disk)");var Vn=["macos","linux","windows","wsl"];function t0(e){return e==="wsl"?["wsl","linux"]:[e]}function xnt(e){return e==="windows"?"win32":"posix"}function vnt(e){return{rejectDriveRelative:e==="windows",rejectUnc:e==="windows",rejectNetworkRoot:e!=="windows",rejectMagicLinkRoot:e!=="windows",requireWin32ExecutableSuffix:e==="windows"}}function wnt(e){let t=xnt(e),n=vnt(e);return _().max(1024,{message:"path must be at most 1024 characters"}).refine((r)=>!rnt.test(r),{message:"path must not contain control, line/paragraph-separator, or invisible (default-ignorable) characters"}).refine((r)=>(t==="win32"?one:rne).isAbsolute(r),{message:"path must be absolute"}).refine((r)=>!(t==="win32"&&n.requireWin32ExecutableSuffix)||cnt.test(r),{message:"path must end in .exe or .ps1 on Windows"}).refine((r)=>t!=="win32"||!unt(r),{message:dnt}).refine((r)=>ant(r,t,n),{message:t==="win32"?'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, no component ending in "." or a space, no ":" outside the drive letter, no device-namespace (\\\\?\\) prefix, no drive-relative (\\dir or C:name) or UNC (\\\\server\\share) form':'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, and not under a network automount root (/net/<host>, /Network/Servers) or a kernel magic-link root (/proc, /dev/fd)'}).describe("Absolute path to the helper executable")}var n0=[...Vn,"default"],ZL=["path","script","interpreter","outputBehavior","onFailure","retries","timeoutMs","refreshIntervalMs","defaultSettings"],qE=["managedSettings","appendSystemPrompt"],Tc=L(()=>Z(_(),Ee()).superRefine((e,t)=>{for(let n of["policyHelper","policyHelpers"])if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — the default payload is applied as managed settings and cannot configure further policy helpers`});for(let n of ZL)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is a managed-settings object, not a policyHelpers entry; entry fields (${ZL.join("/")}) belong on the per-OS entries (policyHelpers.${Vn.join("/")})`});for(let n of qE)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the managedSettings SUBTREE, not the helper's stdout envelope; paste the object your helper emits UNDER "managedSettings", not the envelope around it`});for(let n of n0)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the VALUE of a policyHelpers key (a managed-settings object), never another policyHelpers map; don't paste the map or its "${n}" line inside the slot`})})),Ant='Entry must carry "path" (a helper executable) or "script" + "interpreter" (an inline helper), and/or "defaultSettings" (a static settings payload)';function Cnt(e){let{path:t,script:n,interpreter:r,defaultSettings:o}=e;if(t!==void 0&&n!==void 0)return ynt;if(n===void 0!==(r===void 0))return Snt;if(t===void 0&&n===void 0&&o===void 0)return Ant;return null}function une(e,t){return ZE().omit({path:!0}).extend({path:Qi(wnt(e)),script:Qi(Ent(e)),interpreter:Qi(_nt(e)),outputBehavior:Qi(cne()),onFailure:Qi(mnt()),retries:Qi(gnt()),defaultSettings:tt((n)=>n===null?void 0:n,t.optional()).optional()}).check((n)=>{if(n.issues.length>0)return;let r=Cnt(n.value);if(r!==null)n.issues.push({code:"custom",message:r,input:n.value})})}var nJt=L(()=>une("linux",Tc()));function YL(e,t=Tc()){return e==="default"?Tc():une(e,t)}var Tnt=L(()=>C(Object.fromEntries(n0.map((e)=>[e,tt((t)=>{if(t===null)return;if(e!=="default"&&ane(t))return;return t},YL(e).optional()).optional()])))),Qte=["skills","agents","hooks","mcp"],ene=Object.freeze({type:"invalid-entry-stripped"}),Rnt=L(()=>le([C({type:j("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:_().describe("Regex matched against turn output (tool results and assistant text)"),url:_().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:_().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),C({type:_().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()])),knt=()=>Q().int().min($ee).max(zee).optional().catch(void 0);function QE(e,{strictPolicyHelperKeys:t=!1}={}){function n(o){return Z(_(),JL()).check((s)=>{for(let[i,a]of Object.entries(s.value))if(a.source.source==="settings"&&a.source.name!==i)s.issues.push({code:"custom",input:a.source.name,path:[i,"source","name"],message:`Settings-sourced marketplace name must match its ${o} key (got key "${i}" but source.name "${a.source.name}")`})})}let r=(o,s)=>t?tt((i)=>{if(i===null)return;return s?s(i):i},o):o.catch(void 0);return C({$schema:_().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:_().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:_().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:_().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:_().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:_().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),processWrapper:_().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:r(ZE().optional(),(o)=>o&&typeof o==="object"&&!Array.isArray(o)&&o.path===null?void 0:o).describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),policyHelpers:r(Tnt().optional()).describe(`@internal Per-OS variant of policyHelper, keyed by platform: macos, linux, windows, wsl, plus an optional "default" entry that is a STATIC settings payload (a JSON object of managed settings, not a helper). Each per-OS entry carries a helper — a "path", or an inline "script" + "interpreter" delivered to a fixed interpreter over stdin, either with timeoutMs/refreshIntervalMs — its own static "defaultSettings" payload, or both; an entry may be payload-only. Selection for a platform walks its chain (the platform's own entry; on wsl the linux entry next): the first helper on the chain wins over policyHelper; if no helper is configured — or the selected helper fails at startup or refresh — the first payload applies (the chain's "defaultSettings" in platform-specific-first order, then the top-level "default", applied with no process spawned; unrecognized platforms reach only "default"); with no payload either, policyHelper. Honored from admin-controlled policy sources, and from remote managed settings — a payload of plain policy as delivered, like any other remote key; a helper, or a payload carrying anything the managed-settings approval dialog lists, only once the settings are verified this session and approved there (policyHelper itself is never honored from remote).`),...xn.CLAUDE_CODE_ENABLE_XAA&&{xaaIdp:C({issuer:_().url().describe("IdP issuer URL for OIDC discovery"),clientId:_().describe("Claude Code's client_id registered at the IdP"),callbackPort:Q().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:C({type:j("command"),command:_()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:k().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:C({enabled:k().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:Q().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 30). Re-fires every interval until you take a break."),breakThresholdMinutes:Q().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 10)"),message:_().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:C({enabled:k().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:_().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:_().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:Q().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."),desktopSessionCleanupPeriodDays:Q().int().nonnegative().optional().describe("Retention ceiling in days for session transcripts created or last written by a desktop-host surface (Claude Desktop, Cowork), which are otherwise exempt from the cleanupPeriodDays sweep. 0 (the default) means no ceiling: such transcripts are kept until deleted another way. Unlike cleanupPeriodDays, 0 is allowed because this setting never disables writes — it only bounds an exemption from deletion. The ceiling is a hard cap: it also bounds an active archive grace, so the grace window of a release marker never keeps files past the ceiling. Ignored when cleanupPeriodDays is managed by org policy. A ceiling at or below cleanupPeriodDays effectively disables the exemption: those transcripts age out on the regular cleanupPeriodDays schedule, so the effective retention is whichever of the two periods is longer."),syncClaudeAiSkills:k().optional().describe("Set to false to turn off syncing of the skills you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced skills (~/.claude/skills/synced) can no longer be run, are hidden from every session started afterwards, and are moved to ~/.claude/skills/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced skills are blocked and hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced skills are available in every session, re-synced every 10 minutes, and removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),syncClaudeAiPlugins:k().optional().describe("Set to false to turn off syncing of the plugins you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced plugins (~/.claude/plugins/synced) are hidden from every session started afterwards and moved to ~/.claude/plugins/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced plugins are hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced plugins load in every session like plugins you installed yourself (a plugin you installed with the same name takes precedence), are re-synced at each launch, and are removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),skillListingMaxDescChars:Q().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:Q().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:k().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:Qtt().optional().describe("Environment variables to set for Claude Code sessions"),attribution:C({commit:_().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:_().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:k().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."),...!1}).passthrough().optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:k().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,...!1,includeGitInstructions:k().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:sne(e).optional().describe("Tool usage permissions configuration"),model:_().optional().describe("Override the default model used by Claude Code"),fallbackModel:D(_()).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:D(_()).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:k().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:Z(_(),_()).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.'),modelPicker:C({options:D(e0()).describe("Rows to show in the /model picker, in order."),replaceBuiltInOptions:k().optional().describe("When true, the picker shows only the Default row and these options — the built-in "+"lineup, gateway-discovered models and ANTHROPIC_CUSTOM_MODEL_OPTION are hidden. When false or unset, these options are added after the built-in lineup.")}).optional().describe("Curate the /model picker: an ordered list of models with your own labels, independent of the built-in lineup and of Claude Code releases. availableModels still applies to these rows. Honored from managed, --settings/SDK, and user settings only (not from a project checkout); the highest-precedence of those that defines modelPicker wins outright (no merging across sources). Typically set in managed settings by enterprise administrators."),modelPricing:C({multiplier:QL(),overrides:Z(_(),XL()).optional()}).optional().describe("Price usage at your organization's contracted rates instead of list price. "+"Affects every spend figure Claude Code reports — /cost, the status line, the SDK total_cost_usd, "+"--max-budget-usd, and the OpenTelemetry cost metric and events — which remain USD estimates, not an invoice "+'(the per-Mtok price labels in /model stay at list). "overrides" maps a model ID to its USD-per-million-token rates (input, output, cacheRead, '+"cacheWrite — all four required, each 0 to 10000; cacheWrite prices both 5-minute and 1-hour cache writes). "+"A matching row is charged exactly as written; fast-mode and US-data-residency surcharges are not added on top. "+'A key Claude Code itself uses for a built-in model — its ID such as "claude-sonnet-4-6", or its '+"first-party, Bedrock (any or no region prefix), Vertex or Foundry ID — covers every dated and provider form "+"of that model; any other key — a gateway model alias, or a spelling Claude Code does not itself use — "+'matches that model ID only (case-insensitive), and such an exact match wins over a built-in row. On Bedrock an application inference profile is matched by its backing model. An invalid row or multiplier is reported and skipped; the rest still apply. "multiplier" in (0, 10] scales every computed cost, overridden or not (0.85 = 85% of the price, 1.2 = 120%). Only honored from managed settings (server-managed, MDM / OS policy, or managed-settings.json), '+"or — when none of those sets it — when supplied by a host application that manages the model "+"provider; ignored in user, project, local and --settings sources."),...!1,enableAllProjectMcpServers:k().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:D(_()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:D(_()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:k().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:Z(_(),W(["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:k().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."),managedMcpServers:Z(_().refine(vL,{error:"server names may only contain letters, numbers, hyphens and underscores, and may not be __proto__, constructor or prototype"}),wL(),{error:AL}).optional().describe(`MCP servers the organization provides to every user, keyed by server name, each with the .mcp.json entry shape; only "http" and "sse" servers are accepted (nothing that names a program to run, no \${VAR} references). Honored from managed settings only; users cannot remove them, deniedMcpServers still applies, and they need no allowedMcpServers entry. Not read in Claude Desktop's Code tab on a third-party deployment or in Cowork sessions, where Claude Desktop supplies and locks the session's MCP servers itself.`),allowedMcpServers:D(JE()).optional().describe("Enterprise allowlist of the MCP servers users may use. Governs servers users add (user, project and local config, --mcp-config, agent frontmatter, plugins, claude.ai connectors); servers the organization itself delivers (managedMcpServers, and managed-mcp.json entries that use no ${VAR} expansion) are allowed without being listed; a managed-mcp.json entry that uses ${VAR} expansion is still checked against this list. If undefined, all servers are allowed. If empty array, users can use no servers of their own. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:D(XE()).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:wc().optional().describe("Custom commands to run before/after tool executions"),worktree:C({symlinkDirectories:D(_()).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:D(_()).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:W(["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:W(["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."),location:_().optional().catch(void 0).describe("Directory under which Claude Code Desktop creates the worktrees of SSH sessions that run on this machine (an absolute path or one starting with ~/), instead of <project>/.claude/worktrees. Read by the desktop app from the SSH host user settings; a location chosen in the desktop app's SSH connection settings takes precedence. The CLI (--worktree, EnterWorktree, agent isolation) does not read it yet.")}).optional().describe("Git worktree configuration: the CLI --worktree flag, EnterWorktree and agent isolation, plus the location Claude Code Desktop uses for SSH-session worktrees on this machine."),disableAllHooks:k().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:k().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:k().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:k().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:k().optional().describe("Deprecated: use enableArtifact: false. Still honored — true disables the Artifact tool; false is ignored."),enableArtifact:k().optional().describe("Turn the Artifact tool on or off. Off in any of managed, --settings, or user settings wins; project and local settings can only turn it off. Unset defaults to on once the feature is available."),enableWorkflows:k().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowSizeGuideline:W(["unrestricted","small","medium","large"]).optional().describe('Advisory size guideline for the dynamic workflows Claude writes: "small" aims for fewer than 5 agents, "medium" fewer than 10, "large" fewer than 50, and "unrestricted" sends no guideline. Unset defaults to "medium", or "small" on Pro plans. 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:k().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:k().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:W(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),bashEditDiffEnabled:k().optional().describe("Whether the Bash tool shows a diff of the files a Bash command changed (PostToolUse Bash hooks get the changed-file list in tool_response). Set to false to turn that off. Default: on when the Bash tool handles file edits. Only user, flag or policy settings can turn it on outside auto and bypassPermissions modes."),bashOutputMaxChars:Q().int().positive().optional().catch(void 0).describe("How many characters of a successful Bash or PowerShell command's output Claude receives inline (default 30000; values clamp to 4000-128000). Output past this is saved to a file and Claude receives a short preview plus the path. When set, this also replaces BASH_MAX_OUTPUT_LENGTH, which on its own only sizes the read-back window."),taskOutputMaxChars:Q().int().positive().optional().catch(void 0).describe("How many characters of a background task's output the TaskOutput tool hands Claude inline (default 32000; values clamp to 4000-128000). Longer output is cut to its most recent characters with the path of the full output file, except that a shell command still running returns its first characters up to this size. When set, this also replaces TASK_MAX_OUTPUT_LENGTH, which on its own only sizes that window."),respondToBashCommands:k().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:k().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:D(_()).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:D(_()).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:k().optional().describe("When true (and set in managed settings), permission rules from user, project, local, and --settings files and allow rules from --allowedTools are ignored; only managed settings can add allow rules through settings. --disallowedTools and other deny and ask rules from the command line or the current session still apply."),allowManagedMcpServersOnly:k().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:k().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:tt((o)=>Array.isArray(o)?o.filter((s)=>Qte.includes(s)):o,le([k(),D(W(Qte))])).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:C({type:j("command"),command:_(),padding:Q().optional(),refreshInterval:Q().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:k().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:_().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:D(Rnt().catch(ene)).transform((o)=>o.filter((s)=>s!==ene)).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:C({type:j("command"),command:_()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:Z(_(),le([D(_()),k(),sI()])).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.'),prependPlugins:D(_()).optional().catch(void 0).describe("Managed plugins (plugin@marketplace ids that managed enabledPlugins sets true) whose hooks run first, outermost, in the listed order: the first id listed sees every event before any other plugin and every result after it. Managed plugins not listed here or in appendPlugins follow the listed ones; user, project and marketplace plugins come after those; then appendPlugins; then the built-in plugins. The bundled sec-default@builtin seats itself outermost (on a machine with managed settings and for Team and Enterprise organizations) unless this list is set, in which case list sec-default@builtin where it should sit or leave it out. Any other id that is not an enabled managed plugin is skipped; an id listed in both keys is prepended. Only honored from managed settings (or, on a machine with none, from user settings for your own plugins); ignored in project, local and --settings sources."),appendPlugins:D(_()).optional().catch(void 0).describe("Managed plugins (plugin@marketplace ids that managed enabledPlugins sets true) whose hooks run last among plugins, innermost, in the listed order: the last id listed sits just above the built-in plugins and sees each event as every other plugin left it. Only honored from managed settings (or, on a machine with none, from user settings for your own plugins); ignored in project, local and --settings sources."),extraKnownMarketplaces:n("extraKnownMarketplaces").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."),additionalMarketplaces:n("additionalMarketplaces").optional().describe("Alias for extraKnownMarketplaces: this key is read exactly as if it were spelled "+"extraKnownMarketplaces. Do not set both in one file — if both appear, this key is ignored "+"with a warning. Claude Code may rewrite this key as extraKnownMarketplaces when it updates the file. Clients older than this alias ignore it, so prefer extraKnownMarketplaces while older Claude Code versions still share the same settings."),strictKnownMarketplaces:D(fd()).optional().describe('Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these sources can be added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to allow every repository under that owner. 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."),allowedMarketplaces:D(fd()).optional().describe("Alias for strictKnownMarketplaces (managed settings only): this key is read exactly as if it "+"were spelled strictKnownMarketplaces. Do not set both in one file — if both appear, this key "+"is ignored with a warning. Clients older than this alias ignore it, so keep using strictKnownMarketplaces when the allowlist must also bind older Claude Code versions."),blockedMarketplaces:D(fd()).optional().describe('Enterprise blocklist of marketplace sources. When set in managed settings, these sources are blocked from being added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to block every repository under that owner. The check happens BEFORE downloading, so blocked sources never touch the filesystem.'),disableCommandPluginSources:k().optional().describe("Controls the `command` plugin source, whose plugin directory is produced by running a marketplace-declared command on this machine. true: command-sourced plugins are never installed, updated, or re-resolved (the command never runs). false: explicitly allowed. "+"Unset: follows allowManagedHooksOnly — an org that restricts hook execution to managed "+"settings gets command sources disabled too. Only honored from managed settings."),disableSideloadFlags:k().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:D(_()).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:W(["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:_().min(1).optional().catch(void 0).describe('Cloud gateway URL to pre-fill and auto-connect to during login, alongside forceLoginMethod: "gateway". Honored only from admin-controlled managed settings (MDM / managed-settings.json / policy helper); ignored in user, project, and remote-delivered settings.'),gatewayInternalNetworks:D(_()).optional().catch([dne]).meta({default:void 0}).describe("IPv4 CIDR blocks (at most 4, each /8 to /32, not overlapping) your Cloud gateway sits in: the public block your organization numbers its internal network from, which lets /login reach a gateway there. A block must lie entirely outside private space, where /login accepts a gateway without this key. /login accepts a gateway inside a listed block over a direct connection only, and only when this machine's own address on that connection is inside the same block, so /login must happen from a machine whose own address is inside the block (not through a proxy, VPN pool, container or NAT segment outside it). A bar against copied settings files, not proof of location. Honored only from admin-controlled managed settings (MDM / managed-settings.json / policy helper); ignored in user, project, and remote-delivered settings."),parentSettingsBehavior:W(["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).`),managedSourcesBehavior:W(["first-wins","merge"]).optional().describe('Controls how the managed settings sources compose. "first-wins" (default): the highest-priority source present (server-managed > MDM (managed plist / HKLM) > managed-settings.json) is the managed tier alone. "merge": every present source deep-merges with fixed '+"precedence server-managed > MDM > managed-settings.json — scalars "+"take the highest source's value (a restrictive boolean or enum — "+"the allowManaged*Only locks, the disable* switches, the sandbox "+"lock family — takes the strictest value any source sets) and "+"arrays union, except fallbackModel, the restriction allowlists allowedMcpServers, availableModels, strictKnownMarketplaces and allowedChannelPlugins, and sandbox.credentials.awsPairs and sandbox.ripgrep (the highest source that sets one owns it whole), modelOverrides (the whole map of the highest source that sets it, dropped when that source sits below the one that sets availableModels), managedMcpServers (server names union; a name set by two sources takes the higher source's whole entry), and the keys taken from the highest source only: the auth pins forceLoginOrgUUID, forceLoginMethod, forceLoginGatewayUrl and gatewayInternalNetworks, the credential helpers apiKeyHelper, awsAuthRefresh, awsCredentialExport, gcpAuthRefresh, otelHeadersHelper and proxyAuthHelper, modelPicker, permissions.defaultMode, parentSettingsBehavior and the policyHelper configuration (env keeps its own per-key union). Honored only from the highest-priority source present; enable it only when every lower source is admin-controlled, since lower sources then contribute entries such as permissions.allow. HKCU and --managed-settings never take part in the merge."),forceLoginOrgUUID:le([_(),D(_())]).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:k().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:_().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:_().optional().describe("Controls the output style for assistant responses"),viewMode:W(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:_().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:k().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:pL().optional(),...!1,feedbackSurveyRate:Q().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:W(["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:k().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:C({mode:W(["append","replace"]),verbs:D(_())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:C({excludeDefault:k().optional().catch(void 0),tips:tnt().optional(),tipsFile:_().optional().catch(void 0).describe("Absolute or ~/ local path to a JSON file holding an array of tips (same shapes as `tips`); honored from user, --settings and on-disk managed settings only. Read once per CLI process (restart to pick up edits)."),label:_().optional().catch(void 0).describe('Prefix shown before your tips in the spinner (default "Tip")')}).passthrough().optional().catch(void 0).describe("Add your organization's own tips to the spinner tip rotation. tips: strings or {id, text, cooldownSessions?, priority?} objects; tipsFile: a JSON file of the same; label: prefix shown before your tips; excludeDefault: if true, only show your tips (default: false)."),syntaxHighlightingDisabled:k().optional().describe("Whether to disable syntax highlighting in diffs"),spellcheck:C({enabled:k().optional().catch(void 0).describe("Turn on spell checking of the prompt input (default: false)"),checker:_().optional().catch(void 0).describe(`Which spell checker to run: ${BE.map((o)=>`"${o}"`).join(", ")}, or "auto" (default) for the first of those found on PATH`),language:_().optional().catch(void 0).describe(`Dictionary to use, passed to the checker as-is (aspell --lang, hunspell -d, ispell -d), e.g. "en_GB"; names are checker-specific (letters, digits and _ - . , only). Default: the checker's own default`),color:_().optional().catch(void 0).describe(`Color of misspelled words (they are also underlined): a terminal color name such as "red" or "magenta", "#rrggbb", "rgb(r,g,b)", "ansi256(n)" or "ansi:<name>". Default: the theme's error color`)}).passthrough().optional().catch(void 0).describe(`Underline misspelled words in the prompt input as you type, using an installed ${BE.slice(0,-1).join(", ")} or ${BE.at(-1)} (off unless "enabled" is true; does nothing if none is installed). Read from user, flag and managed settings only (the whole block from the highest-precedence of those applies); ignored in project .claude/settings.json and .claude/settings.local.json.`),terminalTitleFromRename:k().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),promptCacheTtl:W(_u).optional().catch(void 0).describe('Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): "5m" or "1h". Unset = automatic: 1 hour on a Claude subscription within its usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry. 1-hour cache writes are billed at a higher rate; the cache stays warm across longer breaks. The CLAUDE_CODE_PROMPT_CACHE_TTL environment variable takes precedence.'),subagentPromptCacheTtl:W(_u).optional().catch(void 0).describe("Prompt cache TTL for everything outside the main conversation — subagents, workflows, background and helper requests: "+'"5m" or "1h". Unset = automatic (5 minutes unless ENABLE_PROMPT_CACHING_1H=1). The CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL environment variable takes precedence.'),alwaysThinkingEnabled:k().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:W(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),maxEffortLevel:W(bh).optional().catch(void 0).describe("Maximum effort level. Anything above it (an /effort or /model pick, --effort, CLAUDE_CODE_EFFORT_LEVEL, a model default) is clamped to it, on every provider including Bedrock, Vertex and Foundry. Combines with an organization's per-model effort cap by taking the lower of the two; across settings files the lowest value wins, and modelSettings.<model>.maxEffortLevel replaces it per model. Enforced client-side: an effort supplied through CLAUDE_CODE_EXTRA_BODY is not clamped."),modelSettings:tt((o)=>typeof o==="object"&&o!==null&&!Array.isArray(o)?Rh(o,(s,i)=>Object.hasOwn(Object.prototype,i)):o,Z(_(),C({effortLevel:W(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for this model."),maxEffortLevel:W(bh).optional().catch(void 0).describe('Maximum effort level for this model. Within one settings file it replaces the top-level maxEffortLevel for the model ("max" exempts it); across settings files the lowest applicable value wins. Keyed like effortLevel: the canonical model name also matches its dated, [1m], Bedrock and Vertex spellings.')}).passthrough().optional().catch(void 0))).optional().catch(void 0).describe("Per-model settings keyed by canonical model name."),ultracode:k().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:knt().describe("Auto-compact window size"),...!1,advisorModel:_().optional().describe("Advisor model for the server-side advisor tool."),fastMode:k().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:k().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:k().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),emojiCompletionEnabled:k().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:k().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:k().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),askUserQuestionTimeout:W(["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."),dialogExpiry:W(["60s","5m","10m","never"]).optional().catch(void 0).describe('Max time a permission/user dialog forwarded to a remote client stays parked awaiting an answer, and how long a HELD cross-session message awaits approval, before either resolves to its safe no-action default (cancelled / dropped-with-denial). Defaults to 5m to match the long-standing remote-dialog deadline; "never" disables the deadline. Local-only permission prompts (no remote client) are unaffected. The CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS env var, when set, overrides this. Read from trusted sources only (never a checked-in repo settings file).'),agent:_().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."),modelProposedGoals:W(Fee).optional().catch(void 0).describe("@internal Controls the ProposeGoal tool (model-proposed session goals). 'auto' (the default when absent) lets the model choose per proposal whether to ask for approval via its ask_user parameter; 'alwaysAsk' routes every model-proposed goal through the approval dialog; 'disabled' turns the tool off. A typed /goal is unaffected. Consent-affecting, so it is read "+"from trusted sources only (user/policy/flag) — "+"workspace-resident project and local settings are ignored."),companyAnnouncements:D(_()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:Z(_(),C({mcpServers:Z(_(),Z(_(),le([_(),Q(),k(),D(_())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:Z(_(),le([_(),Q(),k(),D(_())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(sI())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:C({defaultEnvironmentId:_().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:W(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:_().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:_().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:_().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:_().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:W(["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:C({enabled:k().optional(),mode:W(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:k().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:k().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:D(ine()).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:k().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),timeFormat:le([W(Mee),_()]).optional().describe('Clock format for times shown in the UI: "auto" (default, follows the locale), "12-hour", "24-hour", "24-hour-utc" ("18:05Z"), or a strftime pattern such as "%H:%M" (any value containing "%"; other values read as "auto"). A pattern replaces the time everywhere; message timestamps show only the pattern, so include %Y-%m-%d for the date. /config offers the presets; a pattern is set here.'),timeZone:_().optional().describe('IANA time zone for times shown in the UI, e.g. "UTC" or "Europe/Dublin". Default: the system time zone. An unknown name falls back to the system time zone.'),doneMeansMerged:k().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:W(["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 padded-countdown. "+"Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:Q().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:k().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 on. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN overrides; server-controlled via GrowthBook tengu_lapis_anchor_user_turn."),autoMemoryEnabled:k().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:_().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:k().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:k().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:k().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:k().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:W(["disable"]).optional().describe("Disable auto mode"),remoteTools:C({allowUnattendedServing:k().optional().describe("@internal When false in managed or user settings, a cloud session in auto mode may not run commands on this computer without a person approving each one, whatever consent the computer has given; a project, local or --settings value is ignored. Default: true.")}).optional().describe("@internal How this computer serves tool calls to cloud sessions"),sshConfigs:D(C({id:_().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:_().describe("Display name for the SSH connection"),sshHost:_().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:Q().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:_().optional().describe("Path to SSH identity file (private key)"),startDirectory:_().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:_().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:D(_()).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:_().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:le([W(Uee),_().startsWith("custom:").transform((o)=>o)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:W(Lee).optional().catch(void 0).describe("Key binding mode for the prompt input"),keybindingFlavor:W(["classic","readline"]).optional().catch(void 0).describe("Deprecated: no longer has any effect. The prompt's word-editing keys always follow Bash (readline) conventions."),vimInsertModeRemaps:Z(_(),Ee()).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:k().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:W(Dee).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:k().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:k().optional().describe("Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:k().optional().describe("When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoContinueAtUsageLimit:k().optional().describe("When a claude.ai usage limit stops your session, wait for the limit to reset and continue the task automatically. When off, the limit dialog offers the wait as a choice instead."),autoScrollEnabled:k().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:k().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:k().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:k().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:k().optional().describe("Stamp each message with its arrival time"),terminalProgressBarEnabled:k().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:k().optional().describe("Enable the todo / task tracking panel"),teammateMode:W(Nee).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:k().optional().describe("Start Remote Control bridge automatically each session"),remoteControl:C({shareHostProfile:W(YE).optional().catch(void 0).describe("@internal What a Remote Control environment reports about this machine when it registers: 'off' reports nothing, 'basic' the OS, architecture and detected developer tools, 'full' also the names of MCP servers configured on this machine (never a repository's .mcp.json). When unset, the level comes from the feature rollout, which may be any of the three. Managed, --settings and user settings choose the level (the most restrictive wins); project and local settings can only lower it, never raise it. Read when Remote Control starts; lowering it later applies from the next registration, raising it from the next start.")}).optional().describe("@internal Remote Control (`claude remote-control`) options"),isolatePeerMachines:k().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:W(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),crossSessionInbound:W(Lh).optional().catch(void 0).describe("Inbound cross-session peer messages (SendMessage from your other sessions): 'accept' delivers them, 'hold' parks them for your review without letting Claude act, 'refuse' opts this session out. An explicit value always wins. Unset (mode parity): a message auto-delivers only when the sending session's permission-mode class matches yours (bypass↔bypass or prompting↔prompting); a mismatched sender's message is held for your approval; a sender that asserts no class is held only while this session bypasses permission prompts."),autoUploadSessions:k().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:k().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:k().optional().describe("Allow Claude to push proactive mobile notifications"),...Nte(e)}).passthrough()}var md=L(()=>QE(Dh())),tne=Object.freeze({serverName:"invalid-entry-stripped"});function nne(e,t,n){return D(t.catch((r)=>(n({path:`${e}[]`,message:`Invalid entry was ignored: ${r.issues[0]?.message??"failed validation"}`}),tne))).transform((r)=>r.filter((o)=>o!==tne)).optional()}var dne="(unreadable)";function qL(e,t,n,r,o){return D(Ee()).transform((s)=>{let i=[];for(let[a,c]of s.entries()){let l=t.safeParse(c);if(l.success){i.push(l.data);let u=o?.(c,l.data);if(u!==void 0)n({path:`${e}[${a}]`,message:u,statusOnly:!0})}else{let u=l.error.issues[0],p=u===void 0?"failed validation":u.path.length?`${u.path.join(".")}: ${u.message}`:u.message;n({path:`${e}[${a}]`,message:`Invalid entry was ignored: ${p}`})}}if(s.length>0&&i.length===0)n({path:e,message:`Every entry of "${e}" was invalid; enforcing an empty allowlist (${r}) until it is fixed.`});return i}).optional().catch(()=>(n({path:e,message:`"${e}" was present but invalid; enforcing an empty allowlist (${r}) until it is fixed.`}),[]))}function r0(e,t){let n=md(),r={};for(let[S,x]of Object.entries(n.shape))r[S]=x.catch((w)=>{e({path:S,message:`${w.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});for(let S of["prependPlugins","appendPlugins"])if(S in n.shape)r[S]=D(_()).optional().catch((x)=>{e({path:S,message:`${x.issues[0]?.message??"Failed schema validation"}. This field was ignored; read as unset.`});return});r.allowedMcpServers=nne("allowedMcpServers",JE(),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=nne("deniedMcpServers",XE(),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.managedMcpServers=Ee().transform((S)=>ME(S,(x,w)=>e({path:x?`managedMcpServers.${x}`:"managedMcpServers",message:x?`Managed MCP server was ignored: ${w}`:w,statusOnly:!0}))).optional(),r.allowManagedHooksOnly=n.shape.allowManagedHooksOnly.catch(()=>(e({path:"allowManagedHooksOnly",message:'"allowManagedHooksOnly" was present but invalid; treating it as true (only managed hooks run; command-sourced plugins disabled) until it is fixed.'}),!0)),r.syncClaudeAiSkills=n.shape.syncClaudeAiSkills.catch(()=>(e({path:"syncClaudeAiSkills",message:'"syncClaudeAiSkills" was present but invalid; treating it as false (claude.ai skills sync off) until it is fixed.'}),!1)),r.syncClaudeAiPlugins=n.shape.syncClaudeAiPlugins.catch(()=>(e({path:"syncClaudeAiPlugins",message:'"syncClaudeAiPlugins" was present but invalid; treating it as false (claude.ai plugins sync off) until it is fixed.'}),!1)),r.remoteTools=n.shape.remoteTools.catch(()=>(e({path:"remoteTools",message:'"remoteTools" was present but invalid; treating allowUnattendedServing as false (no unattended serving) until it is fixed.'}),{allowUnattendedServing:!1})),r.disableCommandPluginSources=n.shape.disableCommandPluginSources.catch(()=>(e({path:"disableCommandPluginSources",message:'"disableCommandPluginSources" was present but invalid; treating it as true (command-sourced plugins disabled) until it is fixed.'}),!0)),r.allowManagedMcpServersOnly=n.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),r.enforceAvailableModels=n.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),r.availableModels=D(Ee()).transform((S,x)=>{let w=[];for(let I of S)if(typeof I==="string")w.push(I);else e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(I)}); the entry was ignored.`});return w}).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.allowedHttpHookUrls=qL("allowedHttpHookUrls",_(),e,"no HTTP hooks may run"),r.httpHookAllowedEnvVars=qL("httpHookAllowedEnvVars",_(),e,"no environment variables may be interpolated into HTTP hook headers"),r.allowedChannelPlugins=qL("allowedChannelPlugins",nnt(),e,"no channel plugins admitted",(S,x)=>typeof S==="string"?`"allowedChannelPlugins" entry "${S}" was accepted; prefer the documented object form {"plugin": "${x.plugin}", "marketplace": "${x.marketplace}"}.`:void 0),r.gatewayInternalNetworks=D(_()).optional().catch(()=>(e({path:"gatewayInternalNetworks",message:'"gatewayInternalNetworks" was present but invalid; gateway sign-in governed by this source is refused until it is fixed.'}),[dne])),r.forceLoginOrgUUID=n.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let o=!1,s=(S,x)=>{let w=S.safeParse(x);if(w.success)return;return w.error.issues.slice(0,3).map((I)=>I.path.length?`${I.path.join(".")}: ${I.message}`:I.message).join("; ")},i;r.policyHelper=tt((S)=>{if(o=!1,i=S,S&&typeof S==="object"&&!Array.isArray(S)){let x=S;for(let w of["defaultSettings","default",...qE])if(x[w]!==void 0&&x[w]!==null)e({path:"policyHelper",message:`"${w}" on the singular policyHelper is ignored — static fallback payloads belong on the policyHelpers per-OS entries ("defaultSettings") or the map's "default" key. The intended fallback will NOT apply from here.`,statusOnly:!0});for(let w of["policyHelper","policyHelpers"])if(x[w]!==void 0&&x[w]!==null)e({path:"policyHelper",message:`"${w}" inside the singular policyHelper is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside the singular entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let w of Vn)if(x[w]!==void 0&&x[w]!==null)e({path:"policyHelper",message:`"${w}" on the singular policyHelper is ignored — per-OS entries live on the policyHelpers MAP ("policyHelpers": {"${w}": ...}), not inside the singular key. The intended per-OS config will NOT apply from here.`,statusOnly:!0});if(x.claudeMd!==void 0&&x.claudeMd!==null)e({path:"policyHelper",message:`"claudeMd" on the singular policyHelper is ignored — "claudeMd" is a managed-settings key: put it at the settings top level or inside a static payload, or emit it from the helper's stdout envelope. The intended instructions will NOT apply from here.`,statusOnly:!0});if(x.outputBehavior!==void 0&&x.outputBehavior!==null)e({path:"policyHelper",message:`"outputBehavior" on the singular policyHelper is ignored — it is only honored on the policyHelpers per-OS entries (policyHelpers.${Vn.join("/")}); this helper's output REPLACES the policy tier whatever the value says.`,statusOnly:!0});if(x.onFailure!==void 0&&x.onFailure!==null)e({path:"policyHelper",message:`"onFailure" on the singular policyHelper is ignored — it is only honored on the policyHelpers per-OS entries (policyHelpers.${Vn.join("/")}); a failure of this helper REFUSES to start Claude Code whatever the value says.`,statusOnly:!0});if(x.retries!==void 0&&x.retries!==null)e({path:"policyHelper",message:`"retries" on the singular policyHelper is ignored — it is only honored on the policyHelpers per-OS entries (policyHelpers.${Vn.join("/")}); this helper is run ONCE per start or refresh, never re-run, whatever the value says.`,statusOnly:!0});if(x.path===null||x.path===void 0)o=!0}return S===null?void 0:S},ZE().optional()).catch((S)=>{e({path:"policyHelper",message:`${S.issues[0]?.message??s(ZE(),i)??"Failed schema validation"}. This field was ignored.`,...o&&{statusOnly:!0}});return});let a=(S,x)=>{e({path:S,message:`"${S}" is not a valid static settings payload: ${x??"failed validation"}. When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0})},c=[],l=(S)=>{let x=!1,w,I=YL(S,Tc().optional().catch((O)=>{x=!0,a(`policyHelpers.${S}.defaultSettings`,O.issues[0]?.message??s(Tc(),w&&typeof w==="object"&&!Array.isArray(w)?w.defaultSettings:void 0));return}));return tt((O)=>{if(x=!1,w=O,S!=="default"&&O&&typeof O==="object"&&!Array.isArray(O)){let z=O;for(let V of[...qE,"claudeMd"])if(z[V]!==void 0&&z[V]!==null)e({path:`policyHelpers.${S}`,message:`"${V}" on the policyHelpers.${S} entry is ignored — helper output cannot be pre-seeded on an entry; a static fallback payload goes under this entry's "defaultSettings" (a managed-settings object). The intended content will NOT apply from here.`,statusOnly:!0});for(let V of["policyHelper","policyHelpers"])if(z[V]!==void 0&&z[V]!==null)e({path:`policyHelpers.${S}`,message:`"${V}" on the policyHelpers.${S} entry is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside an entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let V of Vn)if(z[V]!==void 0&&z[V]!==null)e({path:`policyHelpers.${S}`,message:`"${V}" on the policyHelpers.${S} entry is ignored — per-OS entries are SIBLINGS on the policyHelpers map, not nested inside each other. The intended ${V} config will NOT apply from here.`,statusOnly:!0});if(z.default!==void 0&&z.default!==null)e({path:`policyHelpers.${S}`,message:`"default" on the policyHelpers.${S} entry is ignored — the per-entry static payload field is spelled "defaultSettings"; "default" is the MAP's any-platform catch-all key (a sibling of the OS entries). The intended fallback will NOT apply from here.`,statusOnly:!0});let N=z.onFailure;if(N!==void 0&&N!==null&&!lne(N)){let V;if(typeof N==="string"){let X=N.replace(/[^\x20-\x7e]/gu,"?");V=JSON.stringify(X.length>Xte?`${X.slice(0,Xte-1)}…`:X)}else if(typeof N==="number"||typeof N==="boolean")V=String(N);else V=`a non-string value (${Array.isArray(N)?"array":typeof N})`;e({path:`policyHelpers.${S}.onFailure`,message:`"onFailure": ${V} on the policyHelpers.${S} entry is not a recognized value ("continue" or "refuse"); it is treated as "refuse" — a startup failure of this entry's helper with no static payload in its place will not start Claude Code.`,statusOnly:!0})}if(ane(O))return}return O===null?void 0:O},I.optional()).catch((O)=>{if(S==="default"){a("policyHelpers.default",O.issues[0]?.message??s(Tc(),w));return}if(x)return;let z=s(YL(S),w)??"failed validation",N=w,V=N&&typeof N==="object"&&!Array.isArray(N)?N:null,X=V?.onFailure,ee=X!==void 0&&X!==null&&X!=="continue",fe=(te)=>{let nt=`policyHelpers.${S}`;if(ee)c.push({entryKey:S,message:te});else e({path:nt,message:te,statusOnly:!0})};if(V){let te=V.defaultSettings;if(te!==void 0&&te!==null){let nt=Tc().safeParse(te);if(nt.success){let De=V.outputBehavior,Dt=De===void 0||De===null?null:cne().safeParse(De);if(Dt&&!Dt.success){fe(`Invalid entry was ignored: ${z}. Its "defaultSettings" static payload was NOT kept: "outputBehavior" is unrecognized, so whether the payload replaces or merges over this source's settings is unknown. No policy helper runs on ${S} from this entry.`);return}return e({path:`policyHelpers.${S}`,message:`Invalid entry: its helper fields were ignored (${z}), but its "defaultSettings" static payload was kept. No policy helper runs on ${S} from this entry.`,statusOnly:!0}),{defaultSettings:nt.data,...Dt&&{outputBehavior:Dt.data}}}}}fe(`Invalid entry was ignored: ${z}. No policy helper runs on ${S} from this entry.`);return})};r.policyHelpers=tt((S)=>{if(c=[],S&&typeof S==="object"&&!Array.isArray(S)){let x=S;for(let w of["defaultSettings",...qE,"claudeMd"])if(x[w]!==void 0&&x[w]!==null)e({path:"policyHelpers",message:`"${w}" directly on the policyHelpers map is ignored — static fallback payloads go on a per-OS entry's "defaultSettings" or the map's "default" key (a managed-settings object), and helper-output keys come from the helper's stdout. The intended content will NOT apply from here.`,statusOnly:!0});for(let w of["policyHelper","policyHelpers"])if(x[w]!==void 0&&x[w]!==null)e({path:"policyHelpers",message:`"${w}" inside the policyHelpers map is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; the map's keys are the per-OS entries and "default". The nested config will NOT apply from here.`,statusOnly:!0});for(let w of ZL.filter((I)=>I!=="defaultSettings"))if(x[w]!==void 0&&x[w]!==null){let I=w==="script"||w==="interpreter"?"; inline scripts are per-OS only (the singular policyHelper key takes a path)":w==="outputBehavior"||w==="onFailure"||w==="retries"?"":", or on the singular policyHelper key";e({path:"policyHelpers",message:`"${w}" directly on the policyHelpers map is ignored — helper configs go on a per-OS entry (policyHelpers.${Vn.join("/")})${I}. No helper runs from this field here.`,statusOnly:!0})}}return S===null?void 0:S},C(Object.fromEntries(n0.map((S)=>[S,l(S)]))).transform((S)=>{for(let x of Object.keys(S))if(S[x]===void 0)delete S[x];for(let{entryKey:x,message:w}of c){let I=`policyHelpers.${x}`,O=t0(x).find((N)=>S[N]?.defaultSettings!==void 0&&S[N]?.defaultSettings!==null),z=O!==void 0?`${O}.defaultSettings`:S.default!==void 0?"default":null;e(z!==null?{path:I,message:`${w} Its "onFailure" requires the helper; the "policyHelpers.${z}" static payload serves in its place.`,statusOnly:!0}:{path:I,message:`${w} Its "onFailure" requires the helper, so when delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0})}return c=[],S}).optional().catch((S)=>(e({path:"policyHelpers",message:`"policyHelpers" could not be parsed: expected an object mapping OS keys (${Vn.join(", ")}) to helper entries, plus an optional "default" settings payload (${S.issues[0]?.message??"failed schema validation"}). When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0}),{})));let u=Object.freeze({mode:"deny"}),p=Object.freeze({accessKeyIdVar:"_STRIPPED_",secretAccessKeyVar:"_STRIPPED_2_"}),f=0,m=[],h=t===void 0?"":`${[...t].reduce((S,x)=>Math.imul(S^x.charCodeAt(0),16777619)>>>0,2166136261).toString(16).toUpperCase().padStart(8,"0")}_`,g=(S,x)=>{if(typeof S!=="object"||S===null)return;let w=(Oe)=>x.some((q)=>q.path?.includes(Oe)),I=(Oe)=>{let q=S[Oe];if(typeof q==="string")return q;return w(Oe)?"":void 0},O=I("accessKeyIdVar"),z=I("secretAccessKeyVar"),N=I("sessionTokenVar"),V=Ji;if(![O,z,N].some((Oe)=>Oe!==void 0&&V.includes(Oe)))return;let X=(Oe)=>Oe!==void 0&&ld().safeParse(Oe).success;f+=1;let ee=(Oe)=>`${dL}${Oe}_${h}${f}_`,fe=X(O)?O:ee("ACCESS_KEY_ID"),te=X(z)&&z!==fe?z:ee("SECRET_ACCESS_KEY"),nt=N===void 0?void 0:X(N)&&N!==fe&&N!==te?N:ee("SESSION_TOKEN"),De=(Oe)=>Oe.startsWith(dL);if(!De(fe)&&!De(te)){let Oe=V.includes(te)?te:void 0;if(te=ee("SECRET_ACCESS_KEY"),Oe!==void 0){let q=g({accessKeyIdVar:Oe},[]);if(q!==void 0)m.push(q)}}let Dt=DE().safeParse({accessKeyIdVar:fe,secretAccessKeyVar:te,...nt!==void 0&&{sessionTokenVar:nt}});return Dt.success?Dt.data:void 0},y=(S,x,w)=>D(x.catch((I)=>{let O=w(I.value);if(O!==void 0)return e({path:`sandbox.credentials.${S}[]`,message:`Invalid entry was degraded to mode "deny": ${I.issues[0]?.message??"failed validation"}. The credential stays blocked (not masked) until the entry is fixed.${S==="files"?" Under sandbox.filesystem.disabled, file read-denies are not enforced.":""}`}),O;return e({path:`sandbox.credentials.${S}[]`,message:`Invalid entry was ignored: ${I.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),u})).transform((I)=>I.filter((O)=>O!==u)).optional().catch((I)=>{if(typeof I.value==="object"&&I.value!==null&&!Array.isArray(I.value)){let O=x.safeParse(I.value);if(O.success)return e({path:`sandbox.credentials.${S}`,message:`"${S}" must be an array; a lone entry object was accepted as a one-element list. Wrap it in [ ] to silence this warning.`}),[O.data];let z=w(I.value);if(z!==void 0)return e({path:`sandbox.credentials.${S}`,message:`"${S}" must be an array; its lone entry object was invalid and was degraded to mode "deny". The credential stays blocked (not masked) until it is fixed.`}),[z]}return e({path:`sandbox.credentials.${S}`,message:`${I.issues[0]?.message??"Invalid value"}. "${S}" was ignored; these credential entries are NOT protected until it is fixed.`}),[]}),E=C({files:y("files",OE(),(S)=>{if(typeof S!=="object"||S===null||!("mode"in S)||S.mode!=="mask"&&S.mode!=="deny"||!("path"in S)||typeof S.path!=="string")return;let x=OE().safeParse({path:S.path,mode:"deny"});return x.success?x.data:void 0}),envVars:y("envVars",PE(),(S)=>{if(typeof S!=="object"||S===null||!("mode"in S)||S.mode!=="mask"&&S.mode!=="deny"||!("name"in S)||typeof S.name!=="string")return;let x=PE().safeParse({name:S.name,mode:"deny"});return x.success?x.data:void 0}),allowPlaintextInject:k().optional().catch((S)=>(e({path:"sandbox.credentials.allowPlaintextInject",message:`${S.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was degraded to an explicit false; plaintext credential injection stays disabled (lower-precedence values cannot enable it) until it is fixed.`}),!1)),awsPairs:D(DE().catch((S)=>{let x=g(S.value,S.issues);if(x!==void 0)return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was degraded to a non-functional suppressor: ${S.issues[0]?.message??"failed validation"}. It keeps implicit AWS auto-pairing suppressed but re-signs nothing until it is fixed.`}),x;return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was ignored: ${S.issues[0]?.message??"failed validation"}. SigV4 re-signing stays unconfigured for this pair until it is fixed.`}),p})).transform((S)=>{let x=S.filter((w)=>w!==p);if(m.length>0)x.push(...m),m.length=0;return x}).optional().catch((S)=>{let x=typeof S.value==="object"&&S.value!==null?g(S.value,[]):void 0,w=typeof S.value==="object"&&S.value!==null&&(("accessKeyIdVar"in S.value)||("secretAccessKeyVar"in S.value)||("sessionTokenVar"in S.value));if(x===void 0&&w)return m.length=0,e({path:"sandbox.credentials.awsPairs",message:`${S.issues[0]?.message??"Invalid value"}. "awsPairs" must be an array; its lone pair-shaped entry claimed no conventional AWS name and was ignored. SigV4 re-signing stays unconfigured until it is fixed.`}),[];let I=x!==void 0?[x]:Ji.flatMap((O)=>{let z=g({accessKeyIdVar:O},[]);return z!==void 0?[z]:[]});if(m.length>0)I.push(...m),m.length=0;return e({path:"sandbox.credentials.awsPairs",message:`${S.issues[0]?.message??"Invalid value"}. "awsPairs" was degraded to non-functional suppressor pair(s); implicit AWS auto-pairing stays suppressed but nothing re-signs until it is fixed.`}),I}),sigv4:C(Object.fromEntries(["streaming","presigned","sigv4a"].map((S)=>[S,W(["deny","passthrough"]).optional().catch((x)=>(e({path:`sandbox.credentials.sigv4.${S}`,message:`${x.issues[0]?.message??"Invalid value"}. "${S}" was degraded to an explicit deny; this SigV4 request shape stays denied until it is fixed.`}),"deny"))]))).optional().catch((S)=>(e({path:"sandbox.credentials.sigv4",message:`${S.issues[0]?.message??"Invalid value"}. "sigv4" was degraded to an all-deny block (all shapes stay denied, and lower-precedence sigv4 values cannot take effect) until it is fixed.`}),{streaming:"deny",presigned:"deny",sigv4a:"deny"}))}).optional().catch((S)=>{e({path:"sandbox.credentials",message:`${S.issues[0]?.message??"Failed schema validation"}. The credentials block was degraded to a fail-closed skeleton (all-deny sigv4, implicit AWS auto-pairing suppressed, no masking) until it is fixed.`});let x=Ji.flatMap((w)=>{let I=g({accessKeyIdVar:w},[]);return I!==void 0?[I]:[]});return m.length=0,{allowPlaintextInject:!1,awsPairs:x,sigv4:{streaming:"deny",presigned:"deny",sigv4a:"deny"}}});return r.sandbox=pL().extend({credentials:E}).optional().catch((S)=>{e({path:"sandbox",message:`${S.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});let x=S.value;if(typeof x==="object"&&x!==null&&"credentials"in x){let w=E.safeParse(x.credentials);if(w.success&&w.data!==void 0)return e({path:"sandbox.credentials",message:"The credentials block was salvaged from the invalid sandbox value and stays enforced; every other sandbox field was ignored."}),{credentials:w.data}}return}),C(r).passthrough().transform((S)=>{for(let x of Object.keys(S))if(S[x]===void 0)delete S[x];return S})}function Ont(){let e=W_();return e!==void 0&&V_(e)}function pne(){let e=En(),t=e==="wsl"&&!Ont()?"linux":e;switch(t){case"unknown":return{platform:t,chain:[]};default:return{platform:t,chain:t0(t)}}}var o0=[{alias:"additionalMarketplaces",canonical:"extraKnownMarketplaces"},{alias:"allowedMarketplaces",canonical:"strictKnownMarketplaces"}];function fne(e,t){if(!Ve(e))return[];let n=[];for(let{alias:r,canonical:o}of o0){if(!(r in e))continue;if(o in e&&e[o]!==null)n.push({file:t,path:r,message:`"${r}" is an alias for "${o}" and this file sets both; the "${r}" value was ignored. Use only "${o}".`,severity:"warning",alias:r,canonical:o});else e[o]=e[r];delete e[r]}return n}function s0(e){if(typeof e!=="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ex(e){if(Array.isArray(e))return e.map(ex);if(e!==null&&typeof e==="object"){let t={};for(let n of Object.keys(e).sort())t[n]=ex(e[n]);return t}return e}var Dnt=["enabled","enabledPlatforms"],Mh="network.allowedDomains",Lnt=new Set(["OTEL_LOG_MANAGED_SETTINGS"]);function gne(e){if(!e)return{shellSettings:{},envVars:{},sandboxSettings:{},isolationSettings:{},hasHooks:!1,payloadSlots:{}};let t=_ne(e),n=Mnt(e);Nnt([t,...n.map(([,i])=>i)]);let r={};for(let[i,a]of n){let c={shellSettings:a.hasHooks?{...a.shellSettings,hooks:ea(a.hooks)}:a.shellSettings,envVars:a.envVars,sandboxSettings:a.sandboxSettings,isolationSettings:a.isolationSettings};if(bne(c))r[i]=c}let{sandboxSwitches:o,...s}=t;return{...s,payloadSlots:r}}function _ne(e){let t={},n;for(let p of Ree){let f=e[p];if(p==="policyHelpers"){if(f!==null&&typeof f==="object")for(let h of Vn){let g=Knt(f[h]);if(g){if(t[`policyHelpers.${h}`]=g.command,g.scriptSize)n??={},n[`policyHelpers.${h}`]=g.scriptSize}}continue}let m;if(typeof f==="string")m=f;else if(f!==null&&typeof f==="object"&&"command"in f&&typeof f.command==="string")m=f.command;if(m!==void 0&&m.length>0)t[p]=m}let r=Ynt(e);if(r&&typeof r==="object")for(let[p,f]of Object.entries(r)){let m=f?.source;if(!m||typeof m!=="object")continue;if(m.source==="url"&&typeof m.headersHelper==="string"&&m.headersHelper.length>0)t[`extraKnownMarketplaces[${me(p)}].source.headersHelper`]=hne(m.headersHelper,"url",m.url);if(m.source==="settings"&&Array.isArray(m.plugins)){let h=new Map;for(let g of m.plugins){let y=me(g?.name),E=h.get(y)??0;h.set(y,E+1);let v=g?.source;if(v!==null&&typeof v==="object"&&"source"in v&&v.source==="command"&&"command"in v&&typeof v.command==="string"&&v.command.length>0)t[`extraKnownMarketplaces[${me(p)}].plugins[${me(g.name)}][${E}].source.command`]=v.command;if(typeof g?.headersHelper==="string"&&g.headersHelper.length>0){let S=g.source,x=S!==null&&typeof S==="object";t[`extraKnownMarketplaces[${me(p)}].plugins[${me(g.name)}][${E}].headersHelper`]=hne(g.headersHelper,x&&"source"in S?S.source:void 0,x&&"url"in S?S.url:void 0)}}}}let o=e.sandbox,s={},i={enabled:hd(o,"enabled"),enabledPlatforms:hd(o,"enabledPlatforms"),[Mh]:hd(o,Mh)};if(o!==null&&typeof o==="object"){let p={enabled:i.enabled,enabledPlatforms:i.enabledPlatforms};for(let f of xL){let m=Vnt(o[f]);if(m)t[`sandbox.${f}`]=ea({value:m,...p})}for(let f of kee){let m=hd(o,f);if(Unt(f,m))s[`sandbox.${f}`]=ea({value:m,...p,...Ene.has(f)&&{allowedDomains:xne(i[Mh])}})}}let a=e.isolation,c={};for(let p of Oee){let f=hd(a,p);if(Fnt(p,f))c[`isolation.${p}`]=ea({value:f})}let l={};if(e.env&&typeof e.env==="object")for(let[p,f]of Object.entries(e.env)){if(f===void 0)continue;let m=String(f);if(m.length>0&&!Lnt.has(p.toUpperCase())&&!Pee(p,m))l[p]=m}let u=e.hooks!==void 0&&e.hooks!==null&&typeof e.hooks==="object"&&Object.keys(e.hooks).length>0;return{shellSettings:t,inlineHelperScriptSizes:n,envVars:l,sandboxSettings:s,isolationSettings:c,hasHooks:u,hooks:u?e.hooks:void 0,sandboxSwitches:i}}function Mnt(e){return a0(e).map(([t,n])=>[t,_ne(n)])}function a0(e){let t=[];for(let n of Sne){let r=`policyHelpers.${n}`,o=hd(e,r);if(!s0(o))continue;let{policyHelper:s,policyHelpers:i,...a}=o;t.push([r,a])}return t}function yne(e){return Vn.find((t)=>e===`policyHelpers.${t}.defaultSettings`)}function Nnt(e){let t=e.map((r)=>Object.keys(r.sandboxSettings).length>0||xL.some((o)=>r.shellSettings[`sandbox.${o}`]!==void 0)),n=e.map((r)=>[...Ene].some((o)=>r.sandboxSettings[`sandbox.${o}`]!==void 0));e.forEach((r,o)=>{if(t.some((s,i)=>s&&i!==o))for(let s of Dnt){let i=r.sandboxSwitches[s];if(i!==void 0)r.sandboxSettings[`sandbox.${s}`]=ea({value:i})}if(n.some((s,i)=>s&&i!==o)){let s=r.sandboxSwitches[Mh];if(s!==void 0)r.sandboxSettings[`sandbox.${Mh}`]=ea({value:xne(s)??s})}})}var Sne=[...Vn.map((e)=>`${e}.defaultSettings`),"default"];function i0(e){let t=[];for(let n of Sne){let r=`policyHelpers.${n}`,o=e.payloadSlots[r];if(o!==void 0&&bne(o))t.push([r,o])}return t}function bne(e){return Object.keys(e.shellSettings).length>0||Object.keys(e.envVars).length>0||Object.keys(e.sandboxSettings).length>0||Object.keys(e.isolationSettings).length>0}var Ene=new Set(["credentials","network.tlsTerminate"]);function xne(e){return Array.isArray(e)?Gr(e.filter((t)=>typeof t==="string")).sort():void 0}function hd(e,t){let n=e;for(let r of t.split(".")){if(n===null||typeof n!=="object")return;n=n[r]}return n}function Unt(e,t){if(t===void 0||t===null||t===!1)return!1;if(Array.isArray(t)&&t.length===0)return!1;return!(e==="credentials"&&znt(t))}function Fnt(e,t){if(t===void 0||t===null)return!1;switch(e){case"required":return t!==!1;case"egress":return!s0(t)||Object.entries(t).some(([n,r])=>$nt.has(n)?r!==void 0&&r!==null&&!(Array.isArray(r)&&r.length===0):r!==void 0)}}var $nt=new Set(["allowedHosts","deniedHosts"]);function znt(e){if(typeof e!=="object"||e===null)return!1;return Object.entries(e).every(([t,n])=>{if(n===void 0)return!0;if(t==="files"||t==="envVars")return Array.isArray(n)&&n.every((r)=>typeof r==="object"&&r!==null&&r.mode==="deny");if(t==="sigv4")return typeof n==="object"&&n!==null&&Object.values(n).every((r)=>r===void 0||r==="deny");return t==="allowPlaintextInject"&&n===!1})}function jnt(e){return Object.keys(e.shellSettings).some(Hnt)}function Hnt(e){return Vn.some((t)=>e===`policyHelpers.${t}`)}function vne(e){return jnt(e)||Object.keys(e.shellSettings).some((t)=>t.startsWith("extraKnownMarketplaces["))||i0(e).length>0}function Bnt(e){return e==="sh"||e==="pwsh"}function Knt(e){if(e===null||typeof e!=="object")return;let{path:t,script:n,interpreter:r,timeoutMs:o,refreshIntervalMs:s}=e,i,a;if(typeof t==="string"&&t)i=t;else if(typeof n==="string"&&n&&Bnt(r))i={interpreter:r,script:Wnt(n)},a=Gnt(n);else return;return{command:me([i,o??null,s??null]),scriptSize:a}}function Gnt(e){return{bytes:Buffer.byteLength(e,"utf8"),lines:B1(e,`
|
|
227
227
|
`)+(e.endsWith(`
|
|
228
|
-
`)?0:1)}}function Wnt(e){return Im(me(e))}function Vnt(e){if(typeof e==="string")return e||void 0;if(e===null||typeof e!=="object"||!("command"in e)||typeof e.command!=="string"||!e.command)return;let t="args"in e&&Array.isArray(e.args)?e.args.map(String):[];return me([e.command,...t])}function qnt(e){return ea(wne(e))}function wne(e){return{shellSettings:e.shellSettings,envVars:e.envVars,sandboxSettings:Object.keys(e.sandboxSettings).length>0?e.sandboxSettings:void 0,...mne(e),hooks:e.hooks,payloadSlots:i0(e).length>0?Object.fromEntries(i0(e).map(([t,n])=>{let{isolationSettings:r,...o}=n;return[t,{...o,...mne(n)}]})):void 0}}function mne(e){return Object.keys(e.isolationSettings).length>0?{isolationSettings:e.isolationSettings}:{}}function ea(e){return me(ex(e))}function Ane(e){return Im(qnt(e))}function Cne(e,t,n){if(Ane(t)===e)return!0;return typeof n==="string"&&n.length>0&&Im(ea({...wne(t),claudeMd:n}))===e}function hne(e,t,n){return me([e,typeof t==="string"?t:null,typeof n==="string"?n:null])}var Znt=new Set(["dns","unix","ipv4","ipv6"]),FJt=new Set([...Znt,"http","https","ws","wss","ftp","file","grpc","grpcs","otlp","xds","tcp","udp","tls","h2","h2c","http2"]);function Tne(e){return e.replace(/[^\x20-\x7e]/gu,"?")}function Ynt(e){let t=e.extraKnownMarketplaces;if(t!==void 0&&t!==null)return t;let n=e;for(let{alias:r,canonical:o}of o0){if(o!=="extraKnownMarketplaces")continue;let s=n[r];if(s!==void 0&&s!==null&&typeof s==="object")return s}return}var Jnt="remote-settings.json";var One="remote-settings-helper-consent";function Xnt(){return kne(qt(),One)}function Qnt(e){let t=gne(e);return vne(t)?t:void 0}function ert(e){return Rh(e,(t,n)=>n.startsWith("$")&&n!=="$schema")}class Pne{sessionCache=null;eligible=void 0;eligibilityMemo=void 0;ineligibleReason=void 0;evalPolicySnapshotOnly=!1;lastLoadStatus=void 0;lastLoadStatusChanged=At();policySettingsNotified=!1;verifiedPayload=null;unverifiedView=null;projectedView=null;consentedPayload=null;deferredPayload=null;resetEpoch=0;backendView=void 0;replaceSessionCache(e,t){if(this.sessionCache=e,t?.verified){if(this.verifiedPayload=e,t.consentDeferred)this.deferredPayload=e}}seedFromDisk(e){this.sessionCache=e;let t=Qnt(e);if(t!==void 0){let n=irt();if(n===void 0||!Cne(n,t,e.claudeMd))return}this.consentedPayload??=e}markConsented(e){this.consentedPayload=e}dropConsentDeferral(){this.deferredPayload=null}markPolicySettingsNotified(){this.policySettingsNotified=!0}recordEligibility(e,t){if(this.eligible=e,t.memoize)this.eligibilityMemo=e,this.ineligibleReason=e?void 0:t.ineligibleReason}resetListener=null;registerResetListener(e){if(this.resetListener!==null)throw Error("registerSyncCacheResetListener: a listener is already registered; a second one would unhook the first");this.resetListener=e}reset(){this.sessionCache=null,this.eligible=void 0,this.eligibilityMemo=void 0,this.ineligibleReason=void 0,this.evalPolicySnapshotOnly=!1,this.lastLoadStatus=void 0,this.policySettingsNotified=!1,this.verifiedPayload=null,this.unverifiedView=null,this.projectedView=null,this.consentedPayload=null,this.deferredPayload=null,this.resetEpoch++,this.emitLoadStatusChanged(void 0)}emitLoadStatusChanged(e){try{this.lastLoadStatusChanged.emit(e)}catch(t){ie(`Remote settings: load-status listener threw: ${Hr(t)}`,{level:"error"})}}}var trt=new Qe(()=>new Pne);function gd(){return trt.of(In().host)}function tx(){return}function Ine(){return gd().evalPolicySnapshotOnly}function Dne(e){return e!==null&&gd().projectedView?.view===e}function nrt(e){return e&&Ine()?{...bee(e),managedSourcesBehavior:"merge"}:e}function rrt(){return tx()??kne(qt(),Jnt)}var Lne=8388608;function ort(){try{let e=art();if(e===null)return null;let t=dt(Au(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return ert(t)}catch(e){if(J7(e))ie(`Remote settings: Disk cache exceeds ${Lne} bytes; ignoring it as if absent`);return null}}var srt=4096;function irt(){let e=c0();if(e!==void 0)return e.attestation;try{return Sc(Xnt(),srt).trim()||void 0}catch{return}}function art(){let e=c0();if(e!==void 0)return e.content;return Sc(rrt(),Lne)}function c0(){let e=gd().backendView;if(!Se()||e===void 0||!e.ready||e.stoodDown||tx()!==void 0)return;if(!x$(e.configHome)){e.standDown("config home changed");return}return e}var u5t=on.state("remote-settings"),d5t=on.state(One);var crt=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",...mL,...hL,"AWS_ENDPOINT_URL_STS","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_SSO","AWS_ENDPOINT_URL_SSO_OIDC","AWS_ENDPOINT_URL_BEDROCK","AWS_ENDPOINT_URL_BEDROCK_RUNTIME",...SL,...bL,...EL,"CLOUDSDK_CONFIG","GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES","GCLOUD_PROJECT","CLAUDE_CODE_CUSTOM_OAUTH_URL",...gL,"CLAUDE_CODE_API_BASE_URL","CLAUDE_CODE_OAUTH_REFRESH_TOKEN","CLAUDE_CODE_OAUTH_SCOPES","CLAUDE_CODE_OAUTH_CLIENT_ID","CLAUDE_CODE_SESSION_ACCESS_TOKEN","CLAUDE_SESSION_INGRESS_TOKEN_FILE","CLAUDE_CODE_ENVIRONMENT_KIND","CLAUDE_CODE_REMOTE_SESSION_ID","ANTHROPIC_FEDERATION_RULE_ID","ANTHROPIC_ORGANIZATION_ID","ANTHROPIC_WORKSPACE_ID","ANTHROPIC_SERVICE_ACCOUNT_ID","ANTHROPIC_IDENTITY_TOKEN","ANTHROPIC_IDENTITY_TOKEN_FILE","ANTHROPIC_SCOPE","ANTHROPIC_PROFILE","ANTHROPIC_CONFIG_DIR","CLAUDE_CODE_FEDERATION_CACHE_DIR","HOME","XDG_CONFIG_HOME","APPDATA","USERPROFILE","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_MANAGED_SETTINGS_PATH","CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE","CLAUDE_LOCAL_OAUTH_APPS_BASE","CLAUDE_LOCAL_OAUTH_CONSOLE_BASE","CLAUDE_BRIDGE_BASE_URL","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_BRIDGE_SESSION_INGRESS_URL","CLAUDE_REMOTE_TOOLS_BRIDGE_URL"].map((e)=>e.toUpperCase()));function lrt(e){if(!e||!e.env&&!("managedMcpServers"in e))return e;let{managedMcpServers:t,...n}=e;return e.env?{...n,env:Rh(e.env,(r,o)=>crt.has(o.toUpperCase()))}:n}function Mne(){let e=Une();if(e===null||Nne(gd(),e))return!1;if(Rne(e))return!0;let t=a0(e);if(t.length===0)return!1;let{chain:n}=pne();return t.some(([r,o])=>{let s=yne(r);return(s===void 0||n.includes(s))&&Rne(o)})}function Rne(e){let t=e.managedMcpServers;return Ve(t)&&Object.keys(t).length>0}function Nne(e,t){return t===e.verifiedPayload||Boolean(tx())}function Une(){let e=gd();if(!tx()&&e.eligible!==!0)return null;if(e.sessionCache)return e.sessionCache;let t=c0()!==void 0,n=ort();if(n){if(e.seedFromDisk(n),t)yc().invalidatePolicyLayer();else z7();return n}return null}function Fne(){let e=Une(),t=gd(),n=Nne(t,e)?e:urt(t,e);if(n===null||!Ine())return n;if(t.projectedView?.raw!==n)t.projectedView={raw:n,view:nrt(n)};return t.projectedView.view}function urt(e,t){if(t===null)return null;if(e.unverifiedView?.raw!==t)e.unverifiedView={raw:t,view:lrt(t)};return e.unverifiedView.view}var $ne={cli:!0,mcp:!0,"sdk-cli":!0,"sdk-ts":!0,"sdk-py":!0,bench:!0,"claude-vscode":!0,"claude-code-github-action":!0,"local-agent":!0,local_agent:!0,"claude-desktop":!0,remote:!0,remote_baku:!0,remote_cowork:!0,remote_trigger:!0,remote_cowork_trigger:!0,remote_desktop:!0,remote_mobile:!0,claude_in_slack:!0,"claude-in-slack":!0,"claude-in-teams":!0,"claude-desktop-3p":!0,"claude-security":!0,"ssh-remote":!0,"claude-coworker":!0,"claude-coworker-terminal":!0};var b5t=new Set(Object.keys($ne));var drt=new Set(["claude-desktop-3p","local-agent"]);function zne(){let e=xn.CLAUDE_CODE_ENTRYPOINT;return e!==void 0&&drt.has(e)}class jne{entrypoint=void 0;interactive=!1;spawnedByAttendedSession=void 0;childSession=!1;claudecode=!1;coworkFrameArtifacts=!1;setEntrypoint(e){this.entrypoint=e}setInteractive(e){this.interactive=e}setSpawnedByAttendedSession(e){this.spawnedByAttendedSession=e}setChildSession(e){this.childSession=e}setClaudecode(e){this.claudecode=e}setCoworkFrameArtifacts(e){this.coworkFrameArtifacts=e}}var E5t=new Qe(()=>new jne);function prt(e){return e!==void 0&&(e.commit!==void 0||e.pr!==void 0)}function Hne(e,t){let n=e?.commitTrailers;if(typeof n==="boolean")return n?"explicit-enabled":"disabled";if(e!==void 0&&prt(e))return e.commit===""?"disabled":"implicit-enabled";if(t!==void 0)return t?"implicit-enabled":"disabled";return}var frt=["allowManagedMcpServersOnly","allowedMcpServers","deniedMcpServers","disabledMcpjsonServers","enabledMcpjsonServers","enableAllProjectMcpServers","disableClaudeAiConnectors","managedMcpServers"];function nx({slot:e,adminTiers:t}){return e?.allowManagedMcpServersOnly===!0||t.some((n)=>n.allowManagedMcpServersOnly===!0)}function l0({slot:e,adminTiers:t}){return e?.allowedMcpServers??t.find((n)=>n.allowedMcpServers!==void 0)?.allowedMcpServers}function Bne(e,t){return frt.filter((n)=>e[n]!==void 0&&!mrt(n,e,t))}function mrt(e,t,n){let r=n.slot??{};switch(e){case"deniedMcpServers":return!0;case"allowManagedMcpServersOnly":return t.allowManagedMcpServersOnly===nx(n);case"disableClaudeAiConnectors":return t.disableClaudeAiConnectors===(r.disableClaudeAiConnectors===!0||n.adminTiers.some((o)=>o.disableClaudeAiConnectors===!0));case"allowedMcpServers":return ps(t.allowedMcpServers,nx(n)?l0(n):r.allowedMcpServers);case"disabledMcpjsonServers":return(t.disabledMcpjsonServers??[]).every((o)=>r.disabledMcpjsonServers?.includes(o)===!0);case"enabledMcpjsonServers":return(t.enabledMcpjsonServers??[]).every((o)=>r.enabledMcpjsonServers?.includes(o)===!0);case"enableAllProjectMcpServers":return(t.enableAllProjectMcpServers??!1)===(r.enableAllProjectMcpServers??!1);case"managedMcpServers":{let o=r.managedMcpServers??{};return Object.entries(t.managedMcpServers??{}).every(([s,i])=>Object.hasOwn(o,s)&&ps(o[s],i))}}}import{userInfo as hrt}from"os";var Kne="com.anthropic.claudecode",rx="HKLM\\SOFTWARE\\Policies\\ClaudeCode",ox="HKCU\\SOFTWARE\\Policies\\ClaudeCode",Nh="Settings",u0="/usr/bin/plutil",Gne=["-convert","json","-o","-","--"],Wne=["-lint","-s","--"],Vne=5000,sx=2097152,qne="/mnt/c/Windows/System32/reg.exe",_d="/mnt/c/Program Files/ClaudeCode";function Uh(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=Ae("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function Zne(){let e="";try{e=hrt().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${Kne}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${Kne}.plist`,label:"device-level managed preferences"}),t}var Yne=512;function Jne(e){return e.map(grt)}function grt(e){let{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,errorClass:i,preserveOnWrite:a,mcpErrorMetadata:c,userWritable:l,wslIgnored:u,path:p,message:f,expected:m,suggestion:h,invalidValue:g,...y}=e,E=y;return{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,errorClass:i,preserveOnWrite:a,mcpErrorMetadata:c,userWritable:l,wslIgnored:u,path:Fh(p),message:Fh(f),expected:m===void 0?void 0:Fh(m),suggestion:h===void 0?void 0:Fh(h),invalidValue:typeof g==="string"?Fh(g):void 0}}function Fh(e){let t=Tne(e.replace(/\s+/gu," "));return t.length>Yne?`${t.slice(0,Yne-1)}…`:t}var Bs="https://code.claude.com/docs/en",_rt=[{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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/iam#working-directories`}}],yrt={permissions:`${Bs}/iam#configuring-permissions`,env:`${Bs}/settings#environment-variables`,hooks:`${Bs}/hooks`};function Xne(e){let t=_rt.find((r)=>r.matches(e));if(!t)return null;let n={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!n.suggestion)n.suggestion=`Valid values: ${e.enumValues.map((r)=>`"${r}"`).join(", ")}`;if(!n.docLink&&e.path)n.docLink=yrt[NA(e.path,".")];return n}var o8t=L(()=>QE(Dh(),{strictPolicyHelperKeys:!0}).strict());function Qne(e){return e.code==="invalid_type"}function ere(e){return e.code==="invalid_value"}function Srt(e){return e.code==="unrecognized_keys"}function tre(e){return e.code==="too_small"}function qn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function nre(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function $h(e,t){return e.issues.map((n)=>{let r=n.path.map(String).join("."),o=n.message,s,i,a,c,l;if(ere(n))i=n.values.map((p)=>String(p)),a=i.join(" | "),c=void 0,l=void 0;else if(Qne(n)){a=n.expected;let p=nre(n.message);c=p??qn(n.input),l=p??qn(n.input)}else if(tre(n))a=String(n.minimum);else if(n.code==="custom"&&"params"in n)c=n.params.received,l=c;let u=Xne({path:r,code:n.code,expected:a,received:c,enumValues:i,message:n.message,value:c});if(ere(n))s=i?.map((p)=>`"${p}"`).join(", "),o=`Invalid value. Expected one of: ${s}`;else if(Qne(n)){let p=nre(n.message)??qn(n.input);if(n.expected==="object"&&p==="null"&&r==="")o="Invalid or malformed JSON";else o=`Expected ${n.expected}, but received ${p}`}else if(Srt(n)){let p=n.keys.join(", ");o=`Unrecognized ${MA(n.keys.length,"field")}: ${p}`}else if(tre(n))o=`Number must be greater than or equal to ${n.minimum}`,s=String(n.minimum);return{file:t,path:r,message:o,expected:s,invalidValue:l,suggestion:u?.suggestion,docLink:u?.docLink}})}function brt(e,t){if(!e||typeof e!=="object")return[];let n=e;if(!n.permissions||typeof n.permissions!=="object")return[];let r=n.permissions,o=[];for(let s of["allow","deny","ask"]){let i=r[s];if(!Array.isArray(i))continue;r[s]=i.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${s}`,message:`Non-string value in ${s} array was removed`,severity:"warning",invalidValue:a}),!1;let c=WL(a,s);if(!c.valid){let l=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)l+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${s}`,message:l,severity:"warning",invalidValue:a}),!1}return!0})}return o}var Ert=new Set(_s);function xrt(e,t){if(!e||typeof e!=="object")return[];return[...ote(e,ste)?[{file:t,path:"hooks",message:`PreToolUse/PermissionRequest hooks are declared outside "hooks" (at the top level or under another key) — ${Ac}.`,severity:"fatal",docLink:"https://code.claude.com/docs/en/hooks"}]:[],...vrt(e,t)]}function vrt(e,t){if(!("hooks"in e))return[];if(e.hooks===null||typeof e.hooks!=="object"||Array.isArray(e.hooks)){let o=qn(e.hooks);if(Array.isArray(e.hooks)&&(e.hooks.some(Ve)||kL(e.hooks)))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o} — ${Ac}.`,invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}];return delete e.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o}. This field was ignored.`,severity:"warning",invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}]}let n=e.hooks;if($E(n))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received a single matcher — ${Ac}.`,docLink:"https://code.claude.com/docs/en/hooks"}];let r=[];for(let o of Object.keys(n)){let s=L_(o);if(!Ert.has(o)){if(vc(n[o],3,{matchersCount:!Array.isArray(n[o])})){r.push({file:t,path:`hooks.${s}`,message:`"${s}" is not a hook event, but it holds PreToolUse/PermissionRequest hooks — ${Ac}.`,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Unknown hook event "${s}" was ignored. Valid events: ${_s.join(", ")}`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0});continue}if(!Array.isArray(n[o])){let i=n[o],a=qn(i);if(Ph.has(o)&&i!==null||vc(i,3,{matchersCount:!1})){r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a} — ${Ac}.`,invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a}. This entry was ignored.`,severity:"warning",invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks",...i!==null&&{preserveOnWrite:!0}})}}for(let[o,s]of Object.entries(n)){let{stripped:i,unloadableGuards:a}=ate(s,o);for(let c of a)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:`${c.problem} — ${Ac}.${c.aboutType?` Valid types: ${[...FE()].join(", ")}`:""}`,severity:"fatal",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks"});for(let c of i)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:c.aboutType?`${c.problem}; entry ignored. Valid types: ${[...FE()].join(", ")}`:`${c.problem}; ${c.hookIndex===void 0?"matcher":"entry"} ignored.`,severity:"warning",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0})}if(r.length>0&&Object.keys(n).length===0)delete e.hooks;return r}var wrt=[{key:"allowedMcpServers",schema:JE},{key:"deniedMcpServers",schema:XE}];function Art(e,t,n){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:s,schema:i}of wrt){if(!(s in r))continue;if(!Array.isArray(r[s])){if(n?.keepWholeFieldInvalid)continue;let l=r[s];delete r[s],o.push({file:t,path:s,message:`"${s}" must be an array; received ${qn(l)}. This field was ignored.`,severity:"warning",invalidValue:l});continue}let a=r[s],c=[];for(let l=0;l<a.length;l++){let u=i().safeParse(a[l]);if(u.success)c.push(a[l]);else o.push({file:t,path:`${s}[${l}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:a[l]})}if(c.length<a.length)r[s]=c}return o}function Crt(e,t){if(!Ve(e)||e.managedMcpServers===void 0)return[];let r=[],o=ME(e.managedMcpServers,(s,i)=>r.push({file:t,path:s?`managedMcpServers.${s}`:"managedMcpServers",message:s?`Managed MCP server was ignored: ${i}`:i,severity:"warning"}));if(o===void 0)delete e.managedMcpServers;else e.managedMcpServers=o;return r}function Trt(e){if(!e||typeof e!=="object")return;let t=e.source;if(!t||typeof t!=="object")return;let n=t.source;return typeof n==="string"?n:void 0}function Rrt(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.plugins;return Array.isArray(n)&&n.some(zL)}function krt(e,t){if(!e||typeof e!=="object")return[];let n=e,r="extraKnownMarketplaces";if(!(r in n))return[];let o=n[r];if(!o||typeof o!=="object"||Array.isArray(o)){let a=qn(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object mapping marketplace names to declarations; received ${a}. This field was ignored.`,severity:"warning",invalidValue:a}]}let s=o,i=[];for(let a of Object.keys(s)){let c=JL().safeParse(s[a]),l;if(!c.success){let u=Trt(s[a]);if(u!==void 0&&!Ote.has(u)||Rrt(s[a]))continue;l=jE(c.error.issues)}else if(c.data.source.source==="settings"&&c.data.source.name!==a)l=`key "${as(a)}" must match the settings source name "${as(c.data.source.name)}"`;if(l!==void 0)i.push({file:t,path:`${r}.${as(a)}`,message:`Invalid marketplace entry was ignored: ${l}`,severity:"warning"}),delete s[a]}return i}function Ort(e,t){if(!e||typeof e!=="object")return[];let n=e,r="modelPicker";if(!(r in n))return[];let o=n[r];if(!Ve(o)||!Array.isArray(o.options)){let c=Ve(o)?`options: ${qn(o.options)}`:qn(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object with an "options" array of { model, label?, description?, behavesAs? } rows; received ${c}. This field was ignored.`,severity:"warning",invalidValue:c}]}let s=[];if("replaceBuiltInOptions"in o&&typeof o.replaceBuiltInOptions!=="boolean"){let c=qn(o.replaceBuiltInOptions);delete o.replaceBuiltInOptions,s.push({file:t,path:`${r}.replaceBuiltInOptions`,message:`"replaceBuiltInOptions" must be true or false; received ${c}. This entry was ignored (the rows are added to the built-in lineup).`,severity:"warning",invalidValue:c})}let i=o.options,a=[];for(let c=0;c<i.length;c++){let l=e0().safeParse(i[c]);if(l.success){a.push(i[c]);continue}s.push({file:t,path:`${r}.options.${c}`,message:`${Irt(l.error.issues[0])}. This row was ignored; the other rows still apply.`,severity:"warning",invalidValue:qn(i[c])})}if(a.length!==i.length)o.options=a;return s}function Prt(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=e;if(!("modelPricing"in n)||n.modelPricing===void 0)return[];let r=n.modelPricing;if(!r||typeof r!=="object"||Array.isArray(r))return delete n.modelPricing,[{file:t,path:"modelPricing",message:`"modelPricing" must be an object; received ${qn(r)}. It was ignored.`,severity:"warning"}];let o=r,s=[];if(o.multiplier!==void 0&&!QL().safeParse(o.multiplier).success)s.push({file:t,path:"modelPricing.multiplier",message:'"multiplier" must be a number greater than 0 and at most 10. It was ignored.',severity:"warning",invalidValue:o.multiplier}),delete o.multiplier;if(o.overrides!==void 0){let i=o.overrides;if(!i||typeof i!=="object"||Array.isArray(i))s.push({file:t,path:"modelPricing.overrides",message:`"overrides" must be an object mapping model ID to rates; received ${qn(i)}. It was ignored.`,severity:"warning"}),delete o.overrides;else{let a=i;for(let c of Object.keys(a)){let l=XL().safeParse(a[c]);if(l.success&&c!=="constructor"&&c!=="__proto__")continue;let u=l.success?void 0:l.error.issues[0];s.push({file:t,path:`modelPricing.overrides.${as(c)}`,message:`Invalid pricing row was ignored (${u?`${u.path.join(".")||"row"}: ${u.message}`:"not a model ID"}).`,severity:"warning",invalidValue:a[c]}),delete a[c]}}}return s}function Irt(e){if(!e)return"Invalid modelPicker row";return`modelPicker row ${e.path.length>0?`"${e.path.join(".")}" `:""}${e.message}`.trim()}function Drt(e,t,n){if(!e||typeof e!=="object"||Array.isArray(e))return[];let r=e,o=r.crossSessionInbound;if(o===void 0||Lrt(o))return[];if(n?.policySource)r.crossSessionInbound="refuse";else delete r.crossSessionInbound;return[Urt(o,t,n?.policySource===!0)]}function Lrt(e){return typeof e==="string"&&Lh.includes(e)}var Mrt="crossSessionInbound";function Nrt(e){let t=Lh.map((r)=>`"${r}"`).join(", "),n=typeof e==="string"?`"${as(e).replace(/^<key>$/,"<value>")}"`:qn(e);return`must be one of ${t}; received ${n}`}function Urt(e,t,n=!1){let r=Lh.map((s)=>`"${s}"`).join(", "),o=n?'In managed settings an unrecognized value is treated as "refuse" (the most restrictive): cross-session messages to this session are turned away until an administrator fixes it.':"This value was ignored; while it is present, cross-session messages are held for your approval instead of being delivered. Set it to one of the values above.";return{file:t,path:Mrt,message:`"crossSessionInbound" ${Nrt(e)}. ${o}`,severity:"warning",expected:r,...n&&{statusOnly:!0}}}var rre="remoteControl.shareHostProfile";function Frt(e,t,n){if(!Ve(e)||e.remoteControl===void 0)return[];let r=n?.policySource===!0,o=YE.map((f)=>`"${f}"`).join(", "),s=r?'In managed settings this is treated as "off" (the most restrictive): Remote Control environments report nothing about this machine until an administrator fixes it.':"While it is present, Remote Control environments report nothing about this machine.",i=(f)=>({file:t,path:rre,message:`${f}. ${s}`,severity:"warning",expected:o,...r?{statusOnly:!0}:{preserveOnWrite:!0}}),a=(f)=>typeof f==="string"?`"${as(f).replace(/^<key>$/,"<value>")}"`:qn(f),c=e.remoteControl;if(!Ve(c)){if(r)e.remoteControl={shareHostProfile:"off"};else delete e.remoteControl;return[i(`"remoteControl" must be an object like { "shareHostProfile": ${o.replace(/, /g," | ")} }; received ${a(c)}`)]}let l=[],u=Object.keys(c).filter((f)=>f!=="shareHostProfile");if(u.length>0){if(r)c.shareHostProfile="off";l.push(i(`"remoteControl" has an unrecognized key ${u.map((f)=>`"${as(f)}"`).join(", ")} (its only key is "shareHostProfile")`))}let p=c.shareHostProfile;if(p!==void 0&&!(typeof p==="string"&&YE.includes(p))){if(r)c.shareHostProfile="off";else delete c.shareHostProfile;l.push(i(`"${rre}" must be one of ${o}; received ${a(p)}`))}return l}function Rc(e,t,n){return[...fne(e,t),...brt(e,t),...xrt(e,t),...krt(e,t),...Ort(e,t),...Prt(e,t),...Drt(e,t,{policySource:n?.policySource}),...Frt(e,t,{policySource:n?.policySource}),...n?.skipMcpServerEntryFilter?[]:Art(e,t,{keepWholeFieldInvalid:n?.mcpServerEntrySalvageOnly}),...n?.mcpServerEntrySalvageOnly?Crt(e,t):[]]}function h0(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),j7.filter((n)=>t.has(n))}function jrt(){return No(Ec(),"managed-settings.json")}function g0(e){if(En()==="wsl"&&e.wslInherits?.()){let t=d0(_d,e.store);if(t.settings)return t;let n=d0(Ec(),e.store);return{settings:n.settings,errors:[...t.errors,...n.errors]}}return d0(Ec(),e.store)}function Hrt(e){return e.endsWith(".json")&&!e.startsWith(".")}function d0(e,t){let n=[],r={},o=!1,{settings:s,errors:i}=yd(No(e,"managed-settings.json"),t,void 0,!0);if(n.push(...i),s&&Object.keys(s).length>0)r=Wn(r,s,Mo),o=!0;let a=No(e,"managed-settings.d");try{let c=t.folderListingForPolicyWalk(a),l;if(c!==void 0)l=c;else l=et().readdirSync(a).filter((u)=>(u.isFile()||u.isSymbolicLink())&&Hrt(u.name)).map((u)=>u.name).sort(),t.noteWalkListing(a,l);for(let u of l){let{settings:p,errors:f}=yd(No(a,u),t,void 0,!0);if(n.push(...f),p&&Object.keys(p).length>0)r=Wn(r,p,Mo),o=!0}}catch(c){let l=xe(c);if(l!=="ENOENT"&&l!=="ENOTDIR")ie(`managed-settings.d read failed: ${c}`,{level:"error"}),n.push(zh(a,c,"directory"))}return{settings:o&&Oc(r)?r:null,errors:n}}function Brt(e,t){if(bn(e))qrt(t);else ie(`settings file read failed at ${t}: ${e}`,{level:"error"})}function yd(e,t,n,r){let o=n!==void 0?`${e}\x00pinned`:e,s=t.parsedFiles.get(o);if(s)return{settings:s.settings?lo(s.settings):null,errors:s.errors};let i=Wrt(e,n,r);return t.parsedFiles.set(o,i),{settings:i.settings?lo(i.settings):null,errors:i.errors}}function _0(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 lx(e,t){let n=ore.get(e),r=n?.get(t);if(r)return{settings:r.settings&&lo(r.settings),errors:r.errors.map((s)=>({...s}))};let o=Krt(e,t);if(n)n.set(t,o);else ore.set(e,new Map([[t,o]]));return{settings:o.settings&&lo(o.settings),errors:o.errors.map((s)=>({...s}))}}var ore=new WeakMap;function Krt(e,t){let n=lo(e),r=Rc(n,t,{skipMcpServerEntryFilter:!0,policySource:!0}),o=[],s=r0(dre(t,o),t).safeParse(n);if(!s.success)return{settings:null,errors:[...r,...$h(s.error,t)]};return{settings:Object.keys(s.data).length>0?s.data:null,errors:[...r,...o]}}function kc(e){return zne()&&(e==="managedMcpServers"||e.startsWith("managedMcpServers."))}var ux=["managedMcpServers","isolation"];function ure(e,t){if(!Ve(e))return[];let n=[];for(let r of ux){if(!(r in e))continue;if(delete e[r],!kc(r))n.push({file:t,path:r,message:`"${r}" is only honored from managed settings and was ignored here.`,severity:"warning",preserveOnWrite:!0})}return n}function dre(e,t){return(n)=>{if(kc(n.path))return;if(t.push({file:e,path:n.path,message:n.message,severity:"warning",...n.statusOnly&&{statusOnly:n.statusOnly},...n.startupFatal&&{startupFatal:n.startupFatal}}),n.statusOnly||n.startupFatal)ie(`${e}: ${n.path}: ${n.message}`,{level:n.startupFatal?"error":"warn"})}}function pre(e){let t=e?.remote?e.remote():Fne(),n=!e?.remote&&!kc("managedMcpServers")&&Mne()?[{file:"remote managed settings",path:"managedMcpServers",message:"The organization's MCP servers in the cached remote settings are withheld until the server confirms them this session; they connect as soon as it does.",severity:"warning",statusOnly:!0}]:[];if(!t||Object.keys(t).length===0)return{settings:null,errors:n,servedSnapshot:!1};let{settings:r,errors:o}=lx(t,"remote managed settings");return{settings:r,errors:[...n,...Jne(o)],servedSnapshot:Dne(t)}}var sre="parent managed settings";function Grt(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let n=lx(t,sre);for(let r of ux)if(n.settings?.[r]!==void 0&&!kc(r))n.errors.push({file:sre,path:r,message:`"${r}" is only honored from the organization's managed settings sources (server-managed, MDM, managed-settings.json), not from settings a host passes in, and was ignored here.`,severity:"warning",statusOnly:!0});return n}function fre(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let n=lo(t),r=[...ure(n,"SDK inline settings"),...Rc(n,"SDK inline settings")],o=md().safeParse(n);if(!o.success)return{settings:null,errors:[...r,...$h(o.error,"SDK inline settings")]};if(r.some((s)=>s.severity==="fatal"))return{settings:null,errors:r};return{settings:o.data,errors:r}}var dx=2097152;function Wrt(e,t,n){try{let r;if(t!==void 0)r=t;else{let{resolvedPath:o}=rf(et(),e);r=Sc(o,dx)}return Vrt(r,e,n)}catch(r){return Yrt(r,e)}}function Vrt(e,t,n){if(e.trim()==="")return{settings:{},errors:[]};let r=lo(bc(e,!1));if(n){if(!Ve(r))return{settings:null,errors:[px(t)]};let i=Rc(r,t,{skipMcpServerEntryFilter:!0,policySource:!0}),a=[],c=r0(dre(t,a),t).safeParse(r);if(!c.success)return{settings:null,errors:[...i,...$h(c.error,t)]};return{settings:c.data,errors:[...i,...a]}}let o=[...ure(r,t),...Rc(r,t)],s=md().safeParse(r);if(!s.success){let i=$h(s.error,t);return{settings:null,errors:[...o,...i]}}if(o.some((i)=>i.severity==="fatal"))return{settings:null,errors:o};return{settings:s.data,errors:o}}function px(e,{userWritable:t=!1}={}){return t?{file:e,path:"",message:`Managed settings document (${e}) could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.`,severity:"warning",statusOnly:!0,userWritable:!0}:{file:e,path:"",message:"Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.",startupFatal:!0}}function qrt(e){ie(`Broken symlink or missing file encountered for settings.json at path: ${e}`)}function Zrt(){return{settings:null,errors:[]}}function Yrt(e,t){if(Brt(e,t),bn(e))return Zrt();return{settings:null,errors:[zh(t,e)]}}function zh(e,t,n="file"){return{file:e,path:"",message:`${n==="directory"?"Managed settings drop-in directory":"Settings file"} could not be read: ${t instanceof Error?t.message:String(t)}`,severity:"fatal",errorClass:"unreadable"}}function ire(e,t){switch(e){case"userSettings":return mr(qt());case"policySettings":return mr(t.cwd);case"projectSettings":return mr(t.projectConfigDir??t.cwd);case"localSettings":{if(t.projectConfigDir!==void 0)return mr(t.projectConfigDir);return mre(t.cwd,t.canonicalGitRoot)}case"flagSettings":return t.flagPath?zrt(mr(t.flagPath)):mr(t.cwd)}}function mre(e,t){let n=Jrt(e,t);if(n.decided!==void 0)return n.decided;if(!eot(n.root))return n.cwdResolved;return n.root}function Jrt(e,t){let n=t?.(e);if(!n)return{decided:mr(e)};let r=mr(n),o=mr(e);if(r===o)return{decided:r};let s;try{s=tot()}catch{return{decided:o}}if(r===s)return{decided:o};return{decided:void 0,root:r,cwdResolved:o}}function Xrt(e){return yc().localStoreProbes.canonicalRootOwnerUids(e,Qrt)}function Qrt(e){let t=et(),n=null;try{n=t.lstatSync(No(e,".claude")).uid}catch(r){if(!bn(r))throw r}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(No(e,".git")).uid,claudeEntryUid:n}}function eot(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return ie(`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:n,gitEntryUid:r,claudeEntryUid:o}=Xrt(e);if(n===t&&r===t&&(o===null||o===t))return!0;return ie(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${n}), its .git entry (uid ${r}), 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(n){return ie(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${n instanceof Error?n.message:String(n)}); the store stays at the session cwd`,{level:"warn"}),!1}}function tot(){return yc().localStoreProbes.normalizedRealHomeDir(not)}function not(){let e=gA($rt());if(e===null)throw Error("home directory realpath unavailable");return it(e)}var are={default:"settings.json",cowork:"cowork_settings.json"};function rot(e){if(e.coworkPlugins||xn.CLAUDE_CODE_USE_COWORK_PLUGINS)return are.cowork;return are.default}function jh(e,t){switch(e){case"userSettings":return No(ire(e,t),rot(t));case"projectSettings":case"localSettings":return No(ire(e,t),hre(e));case"policySettings":return jrt();case"flagSettings":return t.flagPath}}function hre(e){switch(e){case"projectSettings":return No(".claude","settings.json");case"localSettings":return No(".claude","settings.local.json")}}function gre(e){if(mre(e.cwd,e.canonicalGitRoot)===mr(e.cwd))return;if(e.projectConfigDir!==void 0)return;return No(mr(e.cwd),hre("localSettings"))}function _re(e,t){let n=t.store.perSource.get(e);if(n!==void 0)return n;let r=Oot(e,t);return t.store.perSource.set(e,r),r}function oot(e,t=!1){return!e||e.parentSettingsBehavior==="merge"||t}var sot=[["permissions","defaultMode"],["modelPicker","replaceBuiltInOptions"]];function iot(e){let t={};for(let{path:n,restrictive:r}of Eh){let o=Hs(e,n);if(n[0]==="sandbox"&&xh(r).includes(o))Yi(t,n,o)}return t.sandbox??{}}var aot=/^(?:Read|Edit)\((?:\.\/)?!/;function cot(e,t){let n={};if(e.allowManagedHooksOnly===!0)n.allowManagedHooksOnly=!0;if(e.disableCommandPluginSources===!0)n.disableCommandPluginSources=!0;if(e.allowManagedMcpServersOnly===!0)n.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)n.disableClaudeAiConnectors=!0;if(e.syncClaudeAiSkills===!1)n.syncClaudeAiSkills=!1;if(e.syncClaudeAiPlugins===!1)n.syncClaudeAiPlugins=!1;if(e.remoteTools?.allowUnattendedServing===!1)n.remoteTools={...n.remoteTools,allowUnattendedServing:!1};if(e.allowManagedPermissionRulesOnly===!0)n.allowManagedPermissionRulesOnly=!0;if(e.disableAutoMode==="disable")n.disableAutoMode="disable";let r=e.remoteControl?.shareHostProfile;if(r==="off"||r==="basic")n.remoteControl={...n.remoteControl,shareHostProfile:r};if(Hne(e.attribution,e.includeCoAuthoredBy)==="disabled")n.attribution={...n.attribution,commitTrailers:!1};if(e.attribution?.sessionUrl===!1)n.attribution={...n.attribution,sessionUrl:!1};let o=e.strictPluginOnlyCustomization;if(o===!0||Array.isArray(o)&&o.length>0)n.strictPluginOnlyCustomization=o;if(e.deniedMcpServers)n.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)n.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)n.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)n.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)n.enforceAvailableModels=!0;if(e.permissions){let s=Th(e.permissions,["deny","ask"]);for(let i of["deny","ask"]){let a=s[i];if(a!==void 0)s[i]=a.filter((c)=>{if(!aot.test(c))return!0;return ie(`Ignoring ${i} rule "${c}" from the parent process's managed settings: a rule starting with "!" removes paths from the rules listed before it instead of restricting anything, so it is not merged into the policy rules. Spell the deny without the exception instead.`,{level:"warn"}),!1})}if(e.permissions.disableBypassPermissionsMode==="disable")s.disableBypassPermissionsMode="disable";if(e.permissions.disableAutoMode==="disable")s.disableAutoMode="disable";if(e.permissions.blockReadsOutsideWorkingDirectories===!0)s.blockReadsOutsideWorkingDirectories=!0;if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:a}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)s.allow=i;if(a)s.additionalDirectories=a}if(Object.keys(s).length>0)n.permissions=s}if(e.sandbox){let{network:s,filesystem:i,credentials:a}=e.sandbox,c={},l=s?Th(s,["deniedDomains"]):{},u=i?Th(i,["denyRead","denyWrite"]):{};if(s){if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&s.allowedDomains)l.allowedDomains=s.allowedDomains}if(Object.keys(l).length>0)c.network=l;if(i){if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)u.allowRead=i.allowRead}if(Object.keys(u).length>0)c.filesystem=u;if(a){let p=(a.files??[]).map((h)=>h.mode==="deny"?{path:h.path,mode:"deny"}:{path:h.path,mode:"mask",injectHosts:[]}),f=(a.envVars??[]).filter((h)=>h.mode==="deny").map((h)=>({name:h.name,mode:"deny"})),m={...p.length>0&&{files:p},...f.length>0&&{envVars:f}};if(a.sigv4){let h={};for(let g of["streaming","presigned","sigv4a"])if(a.sigv4[g]==="deny")h[g]="deny";m.sigv4=h}{let h=yre(a.awsPairs??[],[]);if(h.length>0)m.awsPairs=h}if(Object.keys(m).length>0)c.credentials=m}if(Wn(c,iot(e)),Object.keys(c).length>0)n.sandbox=c}return n}function yre(e,t){let n=Ji,r=new Set(t.flatMap(cre));return Gr(e.flatMap(cre)).filter((o)=>n.includes(o)&&!r.has(o)).map((o,s)=>({accessKeyIdVar:o,secretAccessKeyVar:`${IE}${s+1}_`}))}function cre(e){if(!Ve(e))return[];return[e.accessKeyIdVar,e.secretAccessKeyVar,e.sessionTokenVar].filter((t)=>typeof t==="string")}var lot=new Set([...[..._L].filter((e)=>e!=="ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION"),...yL,"CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CODE_SUBAGENT_MODEL_FORCE"]);function uot(e,t){if(!t||!e)return null;let n={};if(e.model!==void 0)n.model=e.model;if(e.availableModels!==void 0)n.availableModels=e.availableModels;if(e.enforceAvailableModels!==void 0)n.enforceAvailableModels=e.enforceAvailableModels;if(e.fallbackModel!==void 0)n.fallbackModel=e.fallbackModel;if(e.modelPicker!==void 0)n.modelPicker=e.modelPicker;return Object.keys(n).length>0?n:null}function ix(e){if(delete e.model,delete e.fallbackModel,delete e.modelPicker,delete e.modelOverrides,e.env){let t={};for(let[n,r]of Object.entries(e.env))if(!lot.has(n.toUpperCase()))t[n]=r;e.env=t}}function cx(){return En()==="macos"?"plist":"hklm"}function Sre(e){let t=S0(e);if(t.composes==="tier")return"helper";let n=f0(e);if(t.composes==="remoteSlot"||n.present.remote)return"remote";if(n.present.mdm)return cx();if(n.present.file)return"file";if(n.parentSlice||n.hostModelOverlay)return"parent";let r=e.hkcu?.();return r&&Object.keys(r.settings).length>0?"hkcu":null}function f0(e){let t=[],{settings:n,errors:r,servedSnapshot:o}=pre(e);t.push(...r);let s=S0(e),i=s.composes==="remoteSlot"?s.helper:p0(n),{settings:a,errors:c}=_0(e);t.push(...c);let l=p0(a),{settings:u,errors:p}=e.file?.()??g0(e);t.push(...p);let f=p0(u),{settings:m,errors:h}=Grt(e);t.push(...h);let g=m!==null&&(l===null&&f===null||(l??f)?.parentSettingsBehavior==="merge"),y=[got(i,o&&s.composes!=="remoteSlot",[l,f,...g?[Th(m,hot)]:[]]),l,f].filter((te)=>te!==null),v=(s.composes==="remoteSlot"?s.helper:[n,a,u].find((te)=>te!==null&&(te===n&&o?i!==null:te.managedSourcesBehavior!==void 0||Oc(te))))?.managedSourcesBehavior,S=i!==null&&o&&s.composes!=="remoteSlot",{admin:x,merged:w}=dot(y,v,S),I={remote:i!==null,mdm:l!==null,file:f!==null},O=[];if(w){let te=I.remote?"remote":I.mdm?cx():"file",nt=[[l,cx()],[f,"file"]];for(let[De,Dt]of nt){if(De===null||De===y[0]||S&&De===y[1])continue;let Oe=y0.filter((Rn)=>Object.values(De[Rn]??{}).some((vt)=>vt!==void 0&&vt!==null)),[q]=Oe;if(q===void 0)continue;O.push(Dt),t.push({file:ax[Dt],path:q,message:`${Oe.map((Rn)=>`"${Rn}"`).join(" and ")} in ${ax[Dt]} ignored: policy helper configuration is read from the highest managed settings source only (${ax[te]} here), even with managedSourcesBehavior "merge". Configure the helper in that source instead.`,severity:"warning",statusOnly:!0})}}let z=(te)=>te!==null&&(te===y[0]||Object.keys(Ch(te,Cre())).length>0),N={remote:z(i),mdm:z(l),file:z(f)},V={allowManagedPermissionRulesOnly:y.some((te)=>te.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:x?.forceLoginOrgUUID,allowedMcpServers:nx({slot:x,adminTiers:y})||m?.allowManagedMcpServersOnly===!0&&x?.allowManagedMcpServersOnly!==!1?l0({slot:x,adminTiers:y}):x?.allowedMcpServers,availableModels:x?.availableModels,sandbox:{network:{allowManagedDomainsOnly:y.some((te)=>te.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:y.some((te)=>te.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},X=m&&oot(x,S&&!I.mdm&&!I.file)?cot(m,V):null,ee=X&&Object.keys(X).length>0?X:null,fe=uot(m,e.hostManagedProvider);return{tiers:y,admin:x,parentSlice:ee,hostModelOverlay:fe,errors:t,present:I,mode:v,merged:w,composed:N,snapshotFirst:S,shadowedHelperSources:O}}function dot(e,t,n){let r=e[0];if(!r)return{admin:null,merged:!1};let{managedSourcesBehavior:o,...s}=r;if(t!=="merge"||e.length<2)return{admin:o===void 0?r:s,merged:!1};let i=e.slice(1).map((c,l)=>{let u=n&&l===0?{...c}:Ch(c,Cre());if(!(n&&l===0)){for(let f of sot)if(Hs(u,f)!==void 0)Yi(u,f,void 0)}let p=Hs(u.sandbox,["enabledPlatforms"]);if(Array.isArray(p)&&p.includes(En()))Yi(u,["sandbox","enabledPlatforms"],void 0);else if(p!==void 0)delete u.sandbox;return u}),a={};for(let c of[...i].reverse())Wn(a,c,m0);return Wn(a,s,n?_ot:m0),yot(a,[r,...i]),pot(a,[r,...i],n),{admin:a,merged:!0}}var bre=["managedSourcesBehavior","wslInheritsWindowsSettings"],y0=["policyHelper","policyHelpers"],ax={remote:"server-managed settings",plist:"the managed preferences plist",hklm:"the HKLM policy key",file:"managed-settings.json"};function Oc(e){return Object.keys(e).some((t)=>!bre.includes(t))}function p0(e){return e&&Oc(e)?e:null}function pot(e,t,n){let r=t.findIndex((s)=>s.availableModels!==void 0),o=t.findIndex((s)=>s.modelOverrides!==void 0);if(o!==-1&&(r===-1||o<=r||n&&r===0))e.modelOverrides={...t[o].modelOverrides};else delete e.modelOverrides}var Ere=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins"],fot=["awsPairs","ripgrep"];function xre(e,t,n){if(t===void 0)return e;if(Array.isArray(t))return n==="awsPairs"&&Array.isArray(e)?[...t,...yre(e,t)]:[...t];if(!Ve(t))return t;return Rd(t,(r)=>Array.isArray(r)?[...r]:r)}var mot=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins","allowedMarketplaces","allowedHttpHookUrls","httpHookAllowedEnvVars"],hot=["allowedMcpServers","availableModels"];function got(e,t,n){if(e===null||!t)return e;let r=mot.filter((o)=>n.some((s)=>s?.[o]!==void 0));return r.length===0?e:Ch(e,r)}function m0(e,t,n){if(n!==void 0&&(Ere.includes(n)||fot.includes(n)))return xre(e,t,n);return vre(e,t,n)}function _ot(e,t,n){if(n!==void 0&&Ere.includes(n))return xre(e,t,n);return vre(e,t,n)}function vre(e,t,n){if(Array.isArray(e)&&Array.isArray(t)&&n!=="fallbackModel")return Gr([...t,...e]);return Mo(e,t,n)}function yot(e,t){let n=t[0],r=e;for(let{path:o,restrictive:s}of Eh){let i=xh(s),a=Math.min(...t.map((c)=>i.indexOf(Hs(c,o))).filter((c)=>c!==-1));if(Number.isFinite(a))Yi(r,o,i[a]);else if(Hs(n,o)===void 0&&Hs(e,o)!==void 0)Yi(r,o,void 0)}if(e.strictPluginOnlyCustomization!==!0){let o=Gr(t.flatMap((s)=>Array.isArray(s.strictPluginOnlyCustomization)?s.strictPluginOnlyCustomization:[]));if(o.length>0)e.strictPluginOnlyCustomization=o;else if(n?.strictPluginOnlyCustomization===void 0)delete e.strictPluginOnlyCustomization}}function S0(e){let t=e.helper?.()??null;if(!t)return{composes:"none"};let n=e.helperArmedFromRemote?.()===!1?"tier":"remoteSlot";if(e.helperMergesOutput?.()!==!0)return{composes:n,helper:t,mergedOver:null};if(!e.store.policy.mergedHelper){let r,o;if(n==="remoteSlot")r=pre(e).settings,o="remote";else if(r=_0(e).settings)o=En()==="macos"?"plist":"hklm";else r=(e.file?.()??g0(e)).settings,o="file";e.store.policy.mergedHelper={helper:xot(r,t),mergedOver:Object.keys(wre(r)).length>0?o:null}}return{composes:n,...e.store.policy.mergedHelper}}function wre(e){return Ch(e??{},y0)}function Sot(e,t){let n=new Map;for(let[o,s]of Object.entries(t)){let i=o.toUpperCase();if(!n.has(i))n.set(i,s)}let r={};for(let[o,s]of Object.entries(e))r[o]=n.get(o.toUpperCase())??s;return Object.assign(r,t)}var bot=["forceLoginOrgUUID","gatewayInternalNetworks","allowedHttpHookUrls","httpHookAllowedEnvVars","allowRead"];function Eot(e,t,n){let r=n!==void 0&&t!==void 0&&bot.includes(n)?t:m0(e,t,n);return r===t&&Array.isArray(r)?[...r]:r}function xot(e,t){let n=wre(e),r=Wn({},n,t,Eot);if(n.env&&t.env)r.env=Sot(n.env,t.env);return r}function vot(e,t,n){let r=[...t.remote?["remote"]:[],...t.mdm?[cx()]:[],...t.file?["file"]:[]],o={slot:n,adminTiers:e};return e.flatMap((s,i)=>{let a=r[i],c=Bne(s,o);return a!==void 0&&c.length>0?[{source:a,keys:c}]:[]})}var Are=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","gcpAuthRefresh"];var wot=[...Are,"otelHeadersHelper","proxyAuthHelper","forceLoginOrgUUID","forceLoginMethod","forceLoginGatewayUrl","gatewayInternalNetworks","parentSettingsBehavior","env","modelPicker",...y0,...bre];function Cre(){return wot}function Aot(e){return Cee.some((t)=>e.startsWith(t))||Aee.includes(e)}function Cot(e,t,n,r=0){let o=new Map,s=new Map,i=!1;for(let[a,c]of e.entries()){let l=new Set,u=t?.[a]===!0;for(let[p,f]of Object.entries(c??{})){let m=p.toUpperCase(),h=Aot(m);if(h&&f.trim()==="")continue;if(h&&i)continue;if(h&&a>r&&t?.[a]===!0)continue;let g=o.get(m);if(g!==void 0){if(l.has(m))s.set(p,f);else if(!s.has(p))s.set(p,g);continue}if(a>r&&n?.[a]?.has(m))continue;if(s.set(p,f),l.add(m),o.set(m,f),h)u=!0}if(u)i=!0}return Object.fromEntries(s)}var Tot="CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION";function lre(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))if(n.toUpperCase()!==Tot)t[n]=r;return t}function Rot(e,t){let n=Object.entries(e??{}),r=t??{};return n.length===Object.keys(r).length&&n.every(([o,s])=>r[o]===s)}function kot(e){let t=_0(e);return t.settings?t.errors:[...t.errors,...(e.file?.()??g0(e)).errors]}function Tre(e){let t=S0(e),n=(e.helperWarnings?.()??[]).filter((g)=>!kc(g.path));if(t.composes==="tier"){let{helper:g}=t;e.store.lastPolicyEnvComposition=null;let y=e.hostManagedProvider?{...g}:g;if(e.hostManagedProvider)ix(y);e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&g.availableModels!==void 0?g.modelOverrides:void 0};let E=e.store.policy.helperBaseStatusNotices??=[...e.helperMergesOutput?.()===!0?kot(e).filter((v)=>!v.statusOnly):[],...f0(e).errors.filter((v)=>v.statusOnly)];return{settings:y,errors:[...E,...n]}}let{tiers:r,admin:o,parentSlice:s,hostModelOverlay:i,errors:a,present:c,snapshotFirst:l}=f0(e);if(a.push(...n),!o&&!s){e.store.lastPolicyEnvComposition=null,e.store.policy.pairedModelOverrides={value:void 0};let g=e.hkcu?.();if(g&&Object.keys(g.settings).length>0){let y=e.hostManagedProvider?{...g.settings}:g.settings;if(e.hostManagedProvider){if(ix(y),i)Object.assign(y,i)}return{settings:y,errors:[...a,...g.errors]}}if(i)return{settings:{...i},errors:[...a,...g?.errors??[]]};return{settings:null,errors:[...a,...g?.errors??[]]}}let u=Wn({},s??{},o??{},Mo);if(r.some((g)=>g.forceRemoteSettingsRefresh===!0))u.forceRemoteSettingsRefresh=!0;let p=xn.CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION===!0,f=u.env;if(!p){let g=Cot(r.map((y)=>y.env),r.map((y)=>(y.otelHeadersHelper??"").trim()!==""),r.map((y)=>{let E=new Set;for(let v of Are){let S=y[v];if(typeof S==="string"&&S.trim()!=="")for(let x of Tee[v])E.add(x)}return E.size>0?E:void 0}),l?1:0);if(Object.keys(g).length>0)u.env=g;else delete u.env}if(u.env){let g=lre(u.env);if(g&&Object.keys(g).length>0)u.env=g;else delete u.env}if(e.hostManagedProvider){if(ix(u),i)Object.assign(u,i)}let m={env:lre(f)};if(e.hostManagedProvider)ix(m);let h=!p&&!Rot(u.env,m.env);e.store.lastPolicyEnvComposition={unionOptedOut:p,unionChangedEnv:h,remoteTierPresent:c.remote,mdmTierPresent:c.mdm,fileTierPresent:c.file,adminTierCount:r.length,tiersWithEnv:xf(r,(g)=>Object.keys(g.env??{}).length>0)},e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&o?.availableModels!==void 0&&o.modelOverrides!==void 0&&i?.availableModels===void 0?o.modelOverrides:void 0};for(let{source:g,keys:y}of vot(r,c,u)){let[E]=y;if(E===void 0)continue;let v=ax[g],S=y.length===1;a.push({file:v,path:E,message:`${y.map((x)=>`"${x}"`).join(" and ")} in ${v} ${S?"is":"are"} not applied: ${v} is not the managed settings source that applies for ${S?"this key":"these keys"} (/status lists the setting sources). Remove ${S?"it":"them"} from ${v}, or set ${S?"it":"them"} in the source that applies.`,severity:"warning",statusOnly:!0})}return{settings:u,errors:a}}function Oot(e,t,{includeLegacyLocalSettings:n=!0}={}){if(e==="policySettings")return Tre(t).settings;let r=jh(e,t),{settings:o}=r?yd(r,t.store,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:s}=fre(t);if(s)return Wn(o||{},s,Mo)}if(e==="localSettings"&&n){let s=gre(t);if(s){let{settings:i}=yd(s,t.store);if(i)return t.onLegacyLocalSettingsRead?.("per_source"),Wn(i,o||{},Mo)}}return o}function Pot(e,t){return{...e,...t}}function Mo(e,t,n){if(n==="modelPicker"&&t!==void 0)return Rre(t);if(Array.isArray(e)&&Array.isArray(t)){if(n==="fallbackModel")return t;return Gr([...e,...t])}if((n==="extraKnownMarketplaces"||n==="managedMcpServers")&&Ve(e)&&Ve(t))return Pot(e,t);return}function Rre(e){if(!Ve(e))return e;let t=e.options;return{...e,...Array.isArray(t)&&{options:t.map((n)=>Ve(n)?{...n}:n)}}}function Iot(e){if(e.store.isLoadingFromDisk)return{settings:{},errors:[]};let t=Date.now();yh("info","settings_load_started"),e.store.isLoadingFromDisk=!0;try{let n=e.store.pluginBase,r={};if(n)r=Wn(r,n,Mo);let o=[],s=new Set,i=new Set,a=(l)=>{for(let u of l){let p=`${u.file}:${u.path}:${u.message}`;if(!s.has(p))s.add(p),o.push(u)}},c=null;for(let l of h0(e)){if(l==="policySettings"){let{settings:p,errors:f}=Tre(e);if(c=p,p)r=Wn(r,p,Mo);a(f);continue}if(l==="localSettings"){let p=gre(e);if(p&&!i.has(mr(p))){i.add(mr(p));let{settings:f,errors:m}=yd(p,e.store);if(a(m),f)e.onLegacyLocalSettingsRead?.("cascade"),r=Wn(r,f,Mo)}}let u=jh(l,e);if(u){let p=mr(u),f=l==="flagSettings"&&e.flagExpectedContent!==void 0;if(!i.has(p)||f){i.add(p);let{settings:m,errors:h}=yd(u,e.store,l==="flagSettings"?e.flagExpectedContent:void 0);if(a(h),m)r=Wn(r,m,Mo)}}if(l==="flagSettings"){let{settings:p,errors:f}=fre(e);if(a(f),p)r=Wn(r,p,Mo)}}if(c){if(c.availableModels!==void 0)r.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)r.enforceAvailableModels=c.enforceAvailableModels;if(c.modelPicker!==void 0)r.modelPicker=Rre(c.modelPicker)}return yh("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:i.size,error_count:o.length}),{settings:r,errors:o}}finally{e.store.isLoadingFromDisk=!1}}function Dot(e){let t=e.store.mergedSettings;if(t!==null)return t;let n=Iot(e);return e.store.mergedSettings=n,n}function Lot(e){let{settings:t}=Dot(e);return t||{}}function kre(e){e.store.invalidateAll();let t=[];for(let n of h0(e)){let r=_re(n,e);if(r&&Object.keys(r).length>0)t.push({source:n,settings:r})}return{effective:Lot(e),sources:t}}function Ore(e,t){let n=h0(t);for(let r=n.length-1;r>=0;r--){let o=n[r];if(_re(o,t)?.[e]!==void 0)return o}return null}import{execFile as Mot}from"child_process";import{accessSync as Not,closeSync as Uot,constants as Fot,openSync as $ot,readSync as zot}from"fs";class Lre{promise=null;start(){if(this.promise)return;this.promise=E0()}reset(){this.promise=null}}var jot=new Lre;function Hot(e){if(!e)return{status:"ok",exitCode:0,errno:null,signal:null};let t=e,n=typeof t.signal==="string"&&t.signal?t.signal:null;if(typeof t.code==="string")return{status:"spawn_error",exitCode:null,errno:t.code,signal:null};if(t.killed===!0)return{status:"timeout",exitCode:null,errno:null,signal:n};if(n)return{status:"killed",exitCode:null,errno:null,signal:n};return{status:"exited",exitCode:typeof t.code==="number"?t.code:null,errno:null,signal:null}}function b0(e,t,n){let r=Date.now();return new Promise((o)=>{try{Mot(e,t,{encoding:"utf-8",timeout:Vne,windowsHide:!0,...n!==void 0&&{maxBuffer:n}},(s,i)=>{o({stdout:i??"",...Hot(s),durationMs:Date.now()-r})})}catch(s){let i=s.code;o({stdout:"",status:"spawn_error",exitCode:null,errno:typeof i==="string"?i:null,signal:null,durationMs:Date.now()-r})}})}function Pre(e){return{status:e.status,exitCode:e.exitCode,errno:e.errno,signal:e.signal,durationMs:e.durationMs}}function Ire(e){return e.status==="ok"||e.status==="exited"&&e.exitCode!==null}function Bot(e){return e.status==="spawn_error"&&e.errno==="ERR_CHILD_PROCESS_STDIO_MAXBUFFER"}function Kot(e){let t;try{return t=$ot(e,"r"),zot(t,Buffer.alloc(1),0,1,0),null}catch(n){return{code:n&&typeof n==="object"&&"code"in n?n.code:void 0,message:n instanceof Error?n.message:String(n)}}finally{if(t!==void 0)try{Uot(t)}catch{}}}function E0(){return(async()=>{if(process.platform==="darwin"){let e=Zne(),n=(await Promise.all(e.map(async({path:o,...s})=>{try{Not(o,Fot.R_OK)}catch(l){let u=l&&typeof l==="object"&&"code"in l?l.code:void 0;if(u==="ENOENT"||u==="ENOTDIR")return null;return{stdout:null,unreadReason:l instanceof Error?l.message:String(l),...s}}let i=await b0(u0,[...Gne,o],sx);if(!Ire(i))return{stdout:null,unreadReason:"plutil did not finish converting it",...s};if(i.status==="ok")return{stdout:i.stdout,...s};let a=await b0(u0,[...Wne,o]);if(!Ire(a))return{stdout:null,unreadReason:"plutil did not finish checking it",...s};if(a.status==="ok")return{stdout:null,unreadReason:"it holds a value plutil cannot convert to JSON (a date or data value)",...s};let c=Kot(o);if(c!==null){if(c.code==="ENOENT"||c.code==="ENOTDIR")return null;return{stdout:null,unreadReason:c.message,...s}}return{stdout:"",...s}}))).filter((o)=>o!==null),r=n.findIndex((o)=>o.stdout!==null);return{plistStdouts:r===-1?n:n.slice(0,r+1),hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`;return Dre(t)}if(Uh())return Dre(qne);return{plistStdouts:null,hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}})()}async function Dre(e){let t=(o)=>b0(e,["query",o,"/v",Nh],sx),[n,r]=await Promise.all([t(rx),t(ox)]);return{plistStdouts:null,hklmStdout:n.status==="ok"?n.stdout:null,...Bot(n)&&{hklmUnreadReason:`the value exceeds ${sx/1048576} MiB`},hkcuStdout:r.status==="ok"?r.stdout:null,outcomes:{hklm:Pre(n),hkcu:Pre(r)}}}function Mre(){return jot.promise}var Ks=Object.freeze({settings:{},errors:[]});class Bre{mdm=null;hkcu=null;wslInherits=!1;loadPromise=null;startLoad(e){if(this.loadPromise)return;this.loadPromise=(async()=>{let t=Date.now(),r=await(Mre()??E0()),{mdm:o,hkcu:s,wslInherits:i}=await tst(r,e);this.replace(o,s,i);let a=Date.now()-t;ie(`MDM settings load completed in ${a}ms`);try{Oi("tengu_managed_settings_os_read",est(r,a))}catch{}if(Object.keys(o.settings).length>0){ie(`MDM settings found: ${Object.keys(o.settings).join(", ")}`);try{yh("info","mdm_settings_loaded",{duration_ms:a,key_count:Object.keys(o.settings).length,error_count:o.errors.length})}catch{}}})()}replace(e,t,n){this.mdm=e,this.hkcu=t,this.wslInherits=n}reset(){this.mdm=null,this.hkcu=null,this.wslInherits=!1,this.loadPromise=null}}var Nre="@builtin",Got=["prependPlugins","appendPlugins"];function Wot(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Vot=new Qe(()=>new Bre);function Hh(){return Vot.of(In().host)}function qot(e){Hh().startLoad(e)}async function Kre(){let e=Hh();if(!e.loadPromise)qot();await e.loadPromise}function Gre(){return Hh().mdm??Ks}function Wre(){return Hh().hkcu??Ks}function Vre(){return Hh().wslInherits}function x0(e,t,{userWritable:n=!1}={}){let r=bc(e,!1);if(!Ve(r))return{settings:{},errors:[px(t,{userWritable:n})]};let o=[],s=r;for(let l of n?ux:[]){if(!(l in s))continue;if(s=s===r?{...r}:s,delete s[l],!kc(l))o.push({file:t,path:l,message:`"${l}" is only honored from administrator-controlled managed settings and was ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}if(n){for(let u of Got){if(!(u in s))continue;s=s===r?{...r}:s,delete s[u],o.push({file:t,path:u,message:`"${u}" is only honored from administrator-controlled managed settings and was ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}let l=s.enabledPlugins;if(Wot(l)){if(Object.entries(l).filter(([p,f])=>p.endsWith(Nre)||f!==!1).length>0){s=s===r?{...r}:s;let p=gE(l,(f,m)=>!m.endsWith(Nre)&&f===!1);if(Object.keys(p).length>0)s.enabledPlugins=p;else delete s.enabledPlugins;o.push({file:t,path:"enabledPlugins",message:`"enabledPlugins" entries that enable a plugin, or name a built-in, are only honored from administrator-controlled managed settings and were ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}}}let{settings:i,errors:a}=lx(s,t),c=[...o,...a];return{settings:i??{},errors:n?c.map((l)=>({...l.severity==="warning"&&!l.startupFatal?l:{...Zot(l),severity:"warning",statusOnly:!0},userWritable:!0})):c}}function Zot({startupFatal:e,...t}){return t}function Ure(e,t,n){return{file:e,path:"",message:`Managed settings document (${e}) could not be read: ${t}; none of its settings are in effect.`,severity:n?"warning":"fatal",statusOnly:!0,errorClass:"unreadable",...n&&{userWritable:!0}}}function Fre(e,t="Settings"){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`^[ \\t]+${n}[ \\t]+REG_(?:EXPAND_)?SZ[ \\t]+([\\s\\S]*)`,"im"),o=e.match(r)?.[1]?.trimEnd();return o?o:null}var Yot=new Map([["ENOENT",Sn("ENOENT")],["EACCES",Sn("EACCES")],["EPERM",Sn("EPERM")],["ENOEXEC",Sn("ENOEXEC")],["EAGAIN",Sn("EAGAIN")],["EMFILE",Sn("EMFILE")],["ENOMEM",Sn("ENOMEM")],["ETIMEDOUT",Sn("ETIMEDOUT")],["ERR_CHILD_PROCESS_STDIO_MAXBUFFER",Sn("ERR_CHILD_PROCESS_STDIO_MAXBUFFER")]]),Jot=new Map([["SIGTERM",Sn("SIGTERM")],["SIGKILL",Sn("SIGKILL")],["SIGINT",Sn("SIGINT")]]);function Xot(e){if(!e)return;return Yot.get(e)??Sn("other")}function Qot(e){if(!e)return;return Jot.get(e)??Sn("other")}function $re(e,t){if(!t)return{};return{[`${e}_status`]:pi(t.status),[`${e}_exit_code`]:t.exitCode??void 0,[`${e}_errno`]:Xot(t.errno),[`${e}_signal`]:Qot(t.signal),[`${e}_duration_ms`]:t.durationMs}}function est(e,t){return{is_wsl:Uh(),await_ms:t,...$re("hklm",e.outcomes.hklm),...$re("hkcu",e.outcomes.hkcu)}}async function tst(e,t){let n=[];for(let c of e.plistStdouts??[]){let{label:l,userWritable:u}=c;if(c.stdout===null){n.push(Ure(l,c.unreadReason,u));continue}let p=x0(c.stdout,l,{userWritable:u});if(Oc(p.settings))return{mdm:{settings:p.settings,errors:[...n,...p.errors],...u&&{userWritable:u}},hkcu:Ks,wslInherits:!1};n.push(...p.errors)}let r=`Registry: ${rx}\\${Nh}`,o=null;if(e.hklmStdout!==null)o=x0(Fre(e.hklmStdout)??"",r);else if(e.hklmUnreadReason!==void 0)n.push(Ure(r,e.hklmUnreadReason,!1));if(o)n.push(...o.errors);let s=Uh(),i=!1;if(s){if(i=o?.settings.wslInheritsWindowsSettings===!0,!i){let c=await rst(t);if(i=c.flag,!i)n.push(...c.records)}}let a=n.length>0?{settings:{},errors:n}:Ks;if(s&&!i){let c=new Set(o?.errors.filter((l)=>l.severity==="warning"));return{mdm:n.length>0?{settings:{},errors:n.map((l)=>c.has(l)?{...l,wslIgnored:!0}:l)}:Ks,hkcu:Ks,wslInherits:!1}}if(o){if(Oc(o.settings))return{mdm:o,hkcu:Ks,wslInherits:i}}if(await nst(i,t))return{mdm:a,hkcu:Ks,wslInherits:i};if(e.hkcuStdout!==null){let c=x0(Fre(e.hkcuStdout)??"",`Registry: ${ox}\\${Nh}`,{userWritable:!0});if(!s||c.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:l,managedSourcesBehavior:u,...p}=c.settings;return{mdm:a,hkcu:{settings:p,errors:c.errors},wslInherits:i}}if(c.errors.length>0)return{mdm:a,hkcu:{settings:{},errors:c.errors},wslInherits:i}}return{mdm:a,hkcu:Ks,wslInherits:i}}async function qre(e,t){if(Se()&&t!==void 0)return(await eQ(e,dx)).content;return Sc(e,dx)}async function Zre(e,t){if(Se()&&t!==void 0)return await et().readdir(e);return et().readdirSync(e)}async function nst(e,t){if(e&&await Hre(_d,t))return!0;return Hre(Ec(),t)}async function zre(e,t){let n=lo(bc(await qre(e,t),!1));if(!n||typeof n!=="object")return!1;return Rc(n,e,{skipMcpServerEntryFilter:!0,policySource:!0}),Oc(n)}function jre(e){let t=xe(e);return t==="ENOENT"||t==="ENOTDIR"}async function rst(e){let t=[];async function n(s){let i;try{i=await qre(s,e)}catch(c){if(!jre(c))t.push(zh(s,c));return!1}if(i.trim()==="")return!1;let a=bc(i,!1);if(!Ve(a))return t.push(px(s)),!1;return a.wslInheritsWindowsSettings===!0}if(await n(Sd(_d,"managed-settings.json")))return{flag:!0,records:t};let r=Sd(_d,"managed-settings.d"),o;try{o=await Zre(r,e)}catch(s){if(!jre(s))t.push(zh(r,s,"directory"));return{flag:!1,records:t}}for(let s of o)if((s.isFile()||s.isSymbolicLink())&&s.name.endsWith(".json")&&!s.name.startsWith(".")&&await n(Sd(r,s.name)))return{flag:!0,records:t};return{flag:!1,records:t}}async function Hre(e,t){try{if(await zre(Sd(e,"managed-settings.json"),t))return!0}catch{}try{let n=Sd(e,"managed-settings.d"),r=await Zre(n,t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(await zre(Sd(n,o.name),t))return!0}catch{}}}catch{}return!1}var sst={user:"userSettings",project:"projectSettings",local:"localSettings"},Yre={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},ist=["user","project","local"],ast=new Set(["bypassPermissions","auto","acceptEdits"]),cst=new Set(["project"]),lst=new Set(["project","local"]);function ust(e){let t=e.effective.permissions?.defaultMode;if(!t||!ast.has(t))return e.effective;for(let n=e.sources.length-1;n>=0;n--){let r=e.sources[n];if(r.settings.permissions?.defaultMode!==void 0){if((H7.includes(t)?lst:cst).has(r.source)){let{defaultMode:s,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Jre(e={}){await Kre();let t={store:new cg,cwd:ost(e.cwd??et().cwd()),allowedSources:(e.settingSources??ist).map((a)=>sst[a]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Gre,hkcu:Wre,wslInherits:Vre,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}},{effective:n,sources:r}=kre(t),o=Sre(t)??void 0,s=r.map(({source:a,settings:c})=>({source:Yre[a],settings:c,path:a==="policySettings"?void 0:jh(a,t),...a==="policySettings"&&{policyOrigin:o}})),i={};for(let a of Object.keys(n)){let c=Ore(a,t);if(c)i[a]={source:Yre[c],path:c==="policySettings"?void 0:jh(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:n,provenance:i,sources:s}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function i7t(e){return Jre(e)}var xst=["enabledPlugins","extraKnownMarketplaces","additionalMarketplaces"];function Xre(e){let t;try{t=dt(Au(e.toString("utf8")))}catch{return e}if(!Qre(t))return e;let n=!1;for(let o of xst)if(Object.hasOwn(t,o))delete t[o],n=!0;let r=t.env;if(Qre(r)&&Object.hasOwn(r,"CLAUDE_CONFIG_DIR"))delete r.CLAUDE_CONFIG_DIR,n=!0;return n?me(t):e}function Qre(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}async function vst(e,t){if(!e)return;let n=e;try{let r=dt(e);if(r?.claudeAiOauth?.refreshToken)delete r.claudeAiOauth.refreshToken,n=me(r)}catch{}await roe(t,n,{mode:384})}function wst(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=j9(z9);return new Promise((t)=>{dst("security",["find-generic-password","-a",H9(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(n,r)=>t(n?void 0:r.trim()||void 0))})}async function ioe(e,t,n,r,o=60000,s){if(!ct(t))return;let i=ro(n,r),a=await Kr(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!a||a.length===0)return;let c=Gt(_st(),`claude-resume-${T0()}`);try{let l=Gt(c,"projects",i);await v0(l,{recursive:!0,mode:448});let u=Gt(l,`${t}.jsonl`);await pm(u,a);let p=r?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=p??Gt(w0(),".claude"),m;try{m=await noe(Gt(f,".credentials.json"),"utf-8")}catch(v){if(!bn(v))throw v}if(!p&&!(r??process.env).ANTHROPIC_API_KEY&&!(r??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await wst()??m;await vst(m,Gt(c,".credentials.json"));let h=$9(xn.CLAUDE_CONFIG_DIR),g=p||w0(),y=Gt(g,".claude.json");await Uu(y,Gt(c,".claude.json"),void 0,AI(s,y,h.globalConfig,on.globalConfig())),await Uu(Gt(f,".config.json"),Gt(c,".config.json"));for(let v of Gz)if(v)await Uu(Gt(g,`.claude${v}.json`),Gt(c,`.claude${v}.json`));let E=Gt(f,"settings.json");if(await Uu(E,Gt(c,"settings.json"),Xre,AI(s,E,h.userSettings,on.userSettings())),await Uu(Gt(f,"cowork_settings.json"),Gt(c,"cowork_settings.json"),Xre),e.listSubkeys)await Ast(e,{projectKey:i,sessionId:t},Gt(l,t),o);return c}catch(l){throw await fx(c),l}}async function Ast(e,t,n,r){let o=await Kr(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),r,`SessionStore.listSubkeys() timed out after ${r}ms for session ${t.sessionId}`);for(let s of o){let i=Bh(n,s+".jsonl");if(!s||ooe(s)||s.split(/[\\/]/).includes("..")||!i.startsWith(n+R0)){ie(`[SessionStore] skipping unsafe subpath from listSubkeys: ${s}`,{level:"warn"});continue}let a=await Kr(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:s}),r,`SessionStore.load() timed out after ${r}ms for session ${t.sessionId} subpath ${s}`);if(!a||a.length===0)continue;let c=[],l=[];for(let u of a)if(C0(u))c.push(u);else l.push(u);if(l.length>0)await v0(A0(i),{recursive:!0}),await pm(i,l);if(c.length>0){let u=c.at(-1),p=Bh(n,s+".meta.json");await v0(A0(p),{recursive:!0});let{type:f,...m}=u;await roe(p,me(m),{mode:384})}}}function k0(e,t){let{isSingleUserTurn:n,resumeConfigDir:r,deferSpawn:o}=t,{systemPrompt:s,settings:i,managedSettings:a,settingSources:c,sandbox:l,...u}=e??{},p,f,m,h;if(s===void 0)p="";else if(typeof s==="string")p=s;else if(Array.isArray(s))p=s;else if(s.type==="custom")p=s.prompt,h=s.snapshot;else if(s.type==="preset")f=s.append,m=s.excludeDynamicSections,h=s.snapshot;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.275";let{abortController:g=Qp(),additionalDirectories:y=[],projectConfigRoot:E,agent:v,agents:S,allowedTools:x=[],betas:w,canUseTool:I,continue:O,cwd:z,debug:N,debugFile:V,disallowedTools:X=[],tools:ee,env:fe,executable:te=Il()?"bun":"node",executableArgs:nt=[],extraArgs:De={},fallbackModel:Dt,enableFileCheckpointing:Oe,toolConfig:q,forkSession:Rn,hooks:vt,includeHookEvents:ae,includePartialMessages:re,forwardSubagentText:Fe,onElicitation:ht,onUserDialog:Ye,supportedDialogKinds:he,perTaskStopAffordance:$t,rapidFollowupPreempt:He,workspaceTrust:an,persistSession:Uo,sessionStore:rt,sessionStoreFlush:ta,thinking:bd,effort:foe,maxThinkingTokens:hx,maxTurns:moe,maxBudgetUsd:hoe,taskBudget:goe,mcpServers:P0,model:_oe,outputFormat:I0,permissionMode:yoe,allowDangerouslySkipPermissions:Soe=!1,permissionPromptToolName:boe,permissionPrompts:Eoe,plugins:Kh,pluginDelivery:gx="argv",getOAuthToken:D0,getHostAuthToken:L0,workload:M0,resume:N0,resumeSessionAt:xoe,resumeDropsTurn:voe,sessionId:woe,skills:U0,stderr:Aoe,strictMcpConfig:Coe}=u,F0=yoe??(e?.resolvePermissionModeInCli?void 0:"default");if(rt&&Uo===!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(he!==void 0&&he.length>0&&!Ye)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");let $0=an?.accepted===!0&&(typeof an.directory!=="string"||!(yst.isAbsolute(an.directory)||Sst.isAbsolute(an.directory)))?void 0:an;if(an!==void 0&&$0===void 0)ie("workspaceTrust ignored: accepted requires an absolute directory, as it exists where Claude Code runs",{level:"warn"});if(rt&&O&&!N0&&!rt.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(rt&&Oe)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(rt&&u.spawnClaudeCodeProcess)ie("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"});if(K9(!!I,F0??"default",x),gx!=="argv"&&gx!=="initialize")throw Error("Invalid pluginDelivery. Expected 'argv' or 'initialize'.");let z0=gx==="initialize"&&Kh!==void 0&&Kh.length>0,_x=u.pathToClaudeCodeExecutable;if(!_x){let Nn=Est(import.meta.url),Zn=gst(Nn),Fo=KG((Pc)=>Zn.resolve(Pc));if(!Fo)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.`);_x=Fo}let j0=I0?.type==="json_schema"?I0.schema:void 0,cn=fe?{...fe}:{...process.env};if(!cn.CLAUDE_CODE_ENTRYPOINT)cn.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!cn.CLAUDE_AGENT_SDK_VERSION)cn.CLAUDE_AGENT_SDK_VERSION="0.3.275";if(Oe)cn.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(D0)cn.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(L0)cn.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(q?.askUserQuestion?.previewFormat)cn.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=q.askUserQuestion.previewFormat;for(let[Nn,Zn]of[[q?.askUserQuestion?.extendedQuestions,"CLAUDE_CODE_QUESTION_EXTENDED"],[q?.askUserQuestion?.optionalDescriptions,"CLAUDE_CODE_QUESTION_OPTIONAL_DESCRIPTIONS"]])if(Nn)cn[Zn]="1";else if(!fe){for(let Fo of Object.keys(cn))if(Fo.toUpperCase()===Zn)delete cn[Fo]}let yx={};if(mx.propagation.inject(mx.context.active(),yx),"traceparent"in yx){for(let Nn of["TRACEPARENT","TRACESTATE"])if(!(Nn in(fe??{})))delete cn[Nn]}for(let[Nn,Zn]of Object.entries(yx)){let Fo=Nn.toUpperCase();if(!(Fo in(fe??{})))cn[Fo]=Zn}let H0={},B0=new Map;if(P0)for(let[Nn,Zn]of Object.entries(P0))if(Zn.type==="sdk"&&Zn.instance)B0.set(Nn,Zn);else H0[Nn]=Zn;let Ed;if(bd)switch(bd.type){case"adaptive":Ed={type:"adaptive",display:bd.display};break;case"enabled":Ed={type:"enabled",budgetTokens:bd.budgetTokens,display:bd.display};break;case"disabled":Ed={type:"disabled"};break}else if(hx!==void 0)Ed=hx===0?{type:"disabled"}:{type:"enabled",budgetTokens:hx};if(r){if(cn.CLAUDE_CONFIG_DIR=r,process.platform==="win32")cn.CLAUDE_SECURESTORAGE_CONFIG_DIR=fe?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??fe?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let K0=new OR({abortController:g,additionalDirectories:y,projectConfigRoot:E,agent:v,betas:w,cwd:z,debug:N,debugFile:V,executable:te,executableArgs:nt,extraArgs:M0?{...De,workload:M0}:De,pathToClaudeCodeExecutable:_x,env:cn,forkSession:Rn,stderr:Aoe,thinkingConfig:Ed,effort:foe,maxTurns:moe,maxBudgetUsd:hoe,taskBudget:goe,model:_oe,fallbackModel:Dt,jsonSchema:j0,permissionMode:F0,allowDangerouslySkipPermissions:Soe,permissionPromptToolName:boe,permissionPrompts:Eoe,continueConversation:rt?void 0:O,resume:N0,resumeSessionAt:xoe,resumeDropsTurn:voe,sessionId:woe,settings:typeof i==="object"?me(i):i,managedSettings:a?me(a):void 0,settingSources:c,skills:U0,allowedTools:x,disallowedTools:X,tools:ee,mcpServers:H0,strictMcpConfig:Coe,canUseTool:!!I,hooks:!!vt,includeHookEvents:ae,includePartialMessages:re,persistSession:Uo,sessionMirror:!!rt,plugins:Kh,pluginsViaInitialize:z0,sandbox:l,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),Toe={systemPrompt:p,appendSystemPrompt:f,planModeInstructions:u.planModeInstructions,systemPromptSnapshot:h,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:m,agents:S,title:u.title,skills:U0,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:Fe,supportedDialogKinds:he,perTaskStopAffordance:$t,rapidFollowupPreempt:He,workspaceTrust:$0,plugins:z0?Kh:void 0},Sx=new nS(K0,n,I,vt,g,B0,j0,Toe,ht,D0,L0,Ye);if(rt){let Nn=()=>Gt(cn.CLAUDE_CONFIG_DIR??Gt(w0(),".claude"),"projects"),Zn=ta==="eager",Fo=new LR(async(Pc,bx)=>{let xd=toe(Pc,Nn());if(xd)await rt.append(xd,bx);else ie(`[SessionStore] dropping mirror frame: filePath ${Pc} is not under ${Nn()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(Pc,bx)=>{let xd=toe(Pc,Nn());if(xd)Sx.reportMirrorError(xd,bx.message)},maxPendingEntries:Zn?0:rS,maxPendingBytes:Zn?0:Su});Sx.setTranscriptMirrorBatcher(Fo)}return{queryInstance:Sx,transport:K0,abortController:g,processEnv:cn}}function O0(e,t,n,r){if(typeof n==="string")t.write(me({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:n}]},parent_tool_use_id:null})+`
|
|
228
|
+
`)?0:1)}}function Wnt(e){return Im(me(e))}function Vnt(e){if(typeof e==="string")return e||void 0;if(e===null||typeof e!=="object"||!("command"in e)||typeof e.command!=="string"||!e.command)return;let t="args"in e&&Array.isArray(e.args)?e.args.map(String):[];return me([e.command,...t])}function qnt(e){return ea(wne(e))}function wne(e){return{shellSettings:e.shellSettings,envVars:e.envVars,sandboxSettings:Object.keys(e.sandboxSettings).length>0?e.sandboxSettings:void 0,...mne(e),hooks:e.hooks,payloadSlots:i0(e).length>0?Object.fromEntries(i0(e).map(([t,n])=>{let{isolationSettings:r,...o}=n;return[t,{...o,...mne(n)}]})):void 0}}function mne(e){return Object.keys(e.isolationSettings).length>0?{isolationSettings:e.isolationSettings}:{}}function ea(e){return me(ex(e))}function Ane(e){return Im(qnt(e))}function Cne(e,t,n){if(Ane(t)===e)return!0;return typeof n==="string"&&n.length>0&&Im(ea({...wne(t),claudeMd:n}))===e}function hne(e,t,n){return me([e,typeof t==="string"?t:null,typeof n==="string"?n:null])}var Znt=new Set(["dns","unix","ipv4","ipv6"]),FJt=new Set([...Znt,"http","https","ws","wss","ftp","file","grpc","grpcs","otlp","xds","tcp","udp","tls","h2","h2c","http2"]);function Tne(e){return e.replace(/[^\x20-\x7e]/gu,"?")}function Ynt(e){let t=e.extraKnownMarketplaces;if(t!==void 0&&t!==null)return t;let n=e;for(let{alias:r,canonical:o}of o0){if(o!=="extraKnownMarketplaces")continue;let s=n[r];if(s!==void 0&&s!==null&&typeof s==="object")return s}return}var Jnt="remote-settings.json";var One="remote-settings-helper-consent";function Xnt(){return kne(qt(),One)}function Qnt(e){let t=gne(e);return vne(t)?t:void 0}function ert(e){return Rh(e,(t,n)=>n.startsWith("$")&&n!=="$schema")}class Pne{sessionCache=null;eligible=void 0;eligibilityMemo=void 0;ineligibleReason=void 0;evalPolicySnapshotOnly=!1;lastLoadStatus=void 0;lastLoadStatusChanged=At();policySettingsNotified=!1;verifiedPayload=null;unverifiedView=null;projectedView=null;consentedPayload=null;deferredPayload=null;resetEpoch=0;backendView=void 0;replaceSessionCache(e,t){if(this.sessionCache=e,t?.verified){if(this.verifiedPayload=e,t.consentDeferred)this.deferredPayload=e}}seedFromDisk(e){this.sessionCache=e;let t=Qnt(e);if(t!==void 0){let n=irt();if(n===void 0||!Cne(n,t,e.claudeMd))return}this.consentedPayload??=e}markConsented(e){this.consentedPayload=e}dropConsentDeferral(){this.deferredPayload=null}markPolicySettingsNotified(){this.policySettingsNotified=!0}recordEligibility(e,t){if(this.eligible=e,t.memoize)this.eligibilityMemo=e,this.ineligibleReason=e?void 0:t.ineligibleReason}resetListener=null;registerResetListener(e){if(this.resetListener!==null)throw Error("registerSyncCacheResetListener: a listener is already registered; a second one would unhook the first");this.resetListener=e}reset(){this.sessionCache=null,this.eligible=void 0,this.eligibilityMemo=void 0,this.ineligibleReason=void 0,this.evalPolicySnapshotOnly=!1,this.lastLoadStatus=void 0,this.policySettingsNotified=!1,this.verifiedPayload=null,this.unverifiedView=null,this.projectedView=null,this.consentedPayload=null,this.deferredPayload=null,this.resetEpoch++,this.emitLoadStatusChanged(void 0)}emitLoadStatusChanged(e){try{this.lastLoadStatusChanged.emit(e)}catch(t){ie(`Remote settings: load-status listener threw: ${Hr(t)}`,{level:"error"})}}}var trt=new Qe(()=>new Pne);function gd(){return trt.of(In().host)}function tx(){return}function Ine(){return gd().evalPolicySnapshotOnly}function Dne(e){return e!==null&&gd().projectedView?.view===e}function nrt(e){return e&&Ine()?{...bee(e),managedSourcesBehavior:"merge"}:e}function rrt(){return tx()??kne(qt(),Jnt)}var Lne=8388608;function ort(){try{let e=art();if(e===null)return null;let t=dt(Au(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return ert(t)}catch(e){if(J7(e))ie(`Remote settings: Disk cache exceeds ${Lne} bytes; ignoring it as if absent`);return null}}var srt=4096;function irt(){let e=c0();if(e!==void 0)return e.attestation;try{return Sc(Xnt(),srt).trim()||void 0}catch{return}}function art(){let e=c0();if(e!==void 0)return e.content;return Sc(rrt(),Lne)}function c0(){let e=gd().backendView;if(!Se()||e===void 0||!e.ready||e.stoodDown||tx()!==void 0)return;if(!x$(e.configHome)){e.standDown("config home changed");return}return e}var u5t=on.state("remote-settings"),d5t=on.state(One);var crt=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",...mL,...hL,"AWS_ENDPOINT_URL_STS","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_SSO","AWS_ENDPOINT_URL_SSO_OIDC","AWS_ENDPOINT_URL_BEDROCK","AWS_ENDPOINT_URL_BEDROCK_RUNTIME",...SL,...bL,...EL,"CLOUDSDK_CONFIG","GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES","GCLOUD_PROJECT","CLAUDE_CODE_CUSTOM_OAUTH_URL",...gL,"CLAUDE_CODE_API_BASE_URL","CLAUDE_CODE_OAUTH_REFRESH_TOKEN","CLAUDE_CODE_OAUTH_SCOPES","CLAUDE_CODE_OAUTH_CLIENT_ID","CLAUDE_CODE_SESSION_ACCESS_TOKEN","CLAUDE_SESSION_INGRESS_TOKEN_FILE","CLAUDE_CODE_ENVIRONMENT_KIND","CLAUDE_CODE_REMOTE_SESSION_ID","ANTHROPIC_FEDERATION_RULE_ID","ANTHROPIC_ORGANIZATION_ID","ANTHROPIC_WORKSPACE_ID","ANTHROPIC_SERVICE_ACCOUNT_ID","ANTHROPIC_IDENTITY_TOKEN","ANTHROPIC_IDENTITY_TOKEN_FILE","ANTHROPIC_SCOPE","ANTHROPIC_PROFILE","ANTHROPIC_CONFIG_DIR","CLAUDE_CODE_FEDERATION_CACHE_DIR","HOME","XDG_CONFIG_HOME","APPDATA","USERPROFILE","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_MANAGED_SETTINGS_PATH","CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE","CLAUDE_LOCAL_OAUTH_APPS_BASE","CLAUDE_LOCAL_OAUTH_CONSOLE_BASE","CLAUDE_BRIDGE_BASE_URL","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_BRIDGE_SESSION_INGRESS_URL","CLAUDE_REMOTE_TOOLS_BRIDGE_URL"].map((e)=>e.toUpperCase()));function lrt(e){if(!e||!e.env&&!("managedMcpServers"in e))return e;let{managedMcpServers:t,...n}=e;return e.env?{...n,env:Rh(e.env,(r,o)=>crt.has(o.toUpperCase()))}:n}function Mne(){let e=Une();if(e===null||Nne(gd(),e))return!1;if(Rne(e))return!0;let t=a0(e);if(t.length===0)return!1;let{chain:n}=pne();return t.some(([r,o])=>{let s=yne(r);return(s===void 0||n.includes(s))&&Rne(o)})}function Rne(e){let t=e.managedMcpServers;return Ve(t)&&Object.keys(t).length>0}function Nne(e,t){return t===e.verifiedPayload||Boolean(tx())}function Une(){let e=gd();if(!tx()&&e.eligible!==!0)return null;if(e.sessionCache)return e.sessionCache;let t=c0()!==void 0,n=ort();if(n){if(e.seedFromDisk(n),t)yc().invalidatePolicyLayer();else z7();return n}return null}function Fne(){let e=Une(),t=gd(),n=Nne(t,e)?e:urt(t,e);if(n===null||!Ine())return n;if(t.projectedView?.raw!==n)t.projectedView={raw:n,view:nrt(n)};return t.projectedView.view}function urt(e,t){if(t===null)return null;if(e.unverifiedView?.raw!==t)e.unverifiedView={raw:t,view:lrt(t)};return e.unverifiedView.view}var $ne={cli:!0,mcp:!0,"sdk-cli":!0,"sdk-ts":!0,"sdk-py":!0,bench:!0,"claude-vscode":!0,"claude-code-github-action":!0,"local-agent":!0,local_agent:!0,"claude-desktop":!0,remote:!0,remote_baku:!0,remote_cowork:!0,remote_trigger:!0,remote_cowork_trigger:!0,remote_desktop:!0,remote_mobile:!0,claude_in_slack:!0,"claude-in-slack":!0,"claude-in-teams":!0,"claude-desktop-3p":!0,"claude-security":!0,"ssh-remote":!0,"claude-coworker":!0,"claude-coworker-terminal":!0};var b5t=new Set(Object.keys($ne));var drt=new Set(["claude-desktop-3p","local-agent"]);function zne(){let e=xn.CLAUDE_CODE_ENTRYPOINT;return e!==void 0&&drt.has(e)}class jne{entrypoint=void 0;interactive=!1;spawnedByAttendedSession=void 0;childSession=!1;claudecode=!1;coworkFrameArtifacts=!1;setEntrypoint(e){this.entrypoint=e}setInteractive(e){this.interactive=e}setSpawnedByAttendedSession(e){this.spawnedByAttendedSession=e}setChildSession(e){this.childSession=e}setClaudecode(e){this.claudecode=e}setCoworkFrameArtifacts(e){this.coworkFrameArtifacts=e}}var E5t=new Qe(()=>new jne);function prt(e){return e!==void 0&&(e.commit!==void 0||e.pr!==void 0)}function Hne(e,t){let n=e?.commitTrailers;if(typeof n==="boolean")return n?"explicit-enabled":"disabled";if(e!==void 0&&prt(e))return e.commit===""?"disabled":"implicit-enabled";if(t!==void 0)return t?"implicit-enabled":"disabled";return}var frt=["allowManagedMcpServersOnly","allowedMcpServers","deniedMcpServers","disabledMcpjsonServers","enabledMcpjsonServers","enableAllProjectMcpServers","disableClaudeAiConnectors","managedMcpServers"];function nx({slot:e,adminTiers:t}){return e?.allowManagedMcpServersOnly===!0||t.some((n)=>n.allowManagedMcpServersOnly===!0)}function l0({slot:e,adminTiers:t}){return e?.allowedMcpServers??t.find((n)=>n.allowedMcpServers!==void 0)?.allowedMcpServers}function Bne(e,t){return frt.filter((n)=>e[n]!==void 0&&!mrt(n,e,t))}function mrt(e,t,n){let r=n.slot??{};switch(e){case"deniedMcpServers":return!0;case"allowManagedMcpServersOnly":return t.allowManagedMcpServersOnly===nx(n);case"disableClaudeAiConnectors":return t.disableClaudeAiConnectors===(r.disableClaudeAiConnectors===!0||n.adminTiers.some((o)=>o.disableClaudeAiConnectors===!0));case"allowedMcpServers":return ps(t.allowedMcpServers,nx(n)?l0(n):r.allowedMcpServers);case"disabledMcpjsonServers":return(t.disabledMcpjsonServers??[]).every((o)=>r.disabledMcpjsonServers?.includes(o)===!0);case"enabledMcpjsonServers":return(t.enabledMcpjsonServers??[]).every((o)=>r.enabledMcpjsonServers?.includes(o)===!0);case"enableAllProjectMcpServers":return(t.enableAllProjectMcpServers??!1)===(r.enableAllProjectMcpServers??!1);case"managedMcpServers":{let o=r.managedMcpServers??{};return Object.entries(t.managedMcpServers??{}).every(([s,i])=>Object.hasOwn(o,s)&&ps(o[s],i))}}}import{userInfo as hrt}from"os";var Kne="com.anthropic.claudecode",rx="HKLM\\SOFTWARE\\Policies\\ClaudeCode",ox="HKCU\\SOFTWARE\\Policies\\ClaudeCode",Nh="Settings",u0="/usr/bin/plutil",Gne=["-convert","json","-o","-","--"],Wne=["-lint","-s","--"],Vne=5000,sx=2097152,qne="/mnt/c/Windows/System32/reg.exe",_d="/mnt/c/Program Files/ClaudeCode";function Uh(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=Ae("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function Zne(){let e="";try{e=hrt().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${Kne}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${Kne}.plist`,label:"device-level managed preferences"}),t}var Yne=512;function Jne(e){return e.map(grt)}function grt(e){let{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,errorClass:i,preserveOnWrite:a,mcpErrorMetadata:c,userWritable:l,wslIgnored:u,path:p,message:f,expected:m,suggestion:h,invalidValue:g,...y}=e,E=y;return{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,errorClass:i,preserveOnWrite:a,mcpErrorMetadata:c,userWritable:l,wslIgnored:u,path:Fh(p),message:Fh(f),expected:m===void 0?void 0:Fh(m),suggestion:h===void 0?void 0:Fh(h),invalidValue:typeof g==="string"?Fh(g):void 0}}function Fh(e){let t=Tne(e.replace(/\s+/gu," "));return t.length>Yne?`${t.slice(0,Yne-1)}…`:t}var Bs="https://code.claude.com/docs/en",_rt=[{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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/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:`${Bs}/iam#working-directories`}}],yrt={permissions:`${Bs}/iam#configuring-permissions`,env:`${Bs}/settings#environment-variables`,hooks:`${Bs}/hooks`};function Xne(e){let t=_rt.find((r)=>r.matches(e));if(!t)return null;let n={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!n.suggestion)n.suggestion=`Valid values: ${e.enumValues.map((r)=>`"${r}"`).join(", ")}`;if(!n.docLink&&e.path)n.docLink=yrt[NA(e.path,".")];return n}var o8t=L(()=>QE(Dh(),{strictPolicyHelperKeys:!0}).strict());function Qne(e){return e.code==="invalid_type"}function ere(e){return e.code==="invalid_value"}function Srt(e){return e.code==="unrecognized_keys"}function tre(e){return e.code==="too_small"}function qn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function nre(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function $h(e,t){return e.issues.map((n)=>{let r=n.path.map(String).join("."),o=n.message,s,i,a,c,l;if(ere(n))i=n.values.map((p)=>String(p)),a=i.join(" | "),c=void 0,l=void 0;else if(Qne(n)){a=n.expected;let p=nre(n.message);c=p??qn(n.input),l=p??qn(n.input)}else if(tre(n))a=String(n.minimum);else if(n.code==="custom"&&"params"in n)c=n.params.received,l=c;let u=Xne({path:r,code:n.code,expected:a,received:c,enumValues:i,message:n.message,value:c});if(ere(n))s=i?.map((p)=>`"${p}"`).join(", "),o=`Invalid value. Expected one of: ${s}`;else if(Qne(n)){let p=nre(n.message)??qn(n.input);if(n.expected==="object"&&p==="null"&&r==="")o="Invalid or malformed JSON";else o=`Expected ${n.expected}, but received ${p}`}else if(Srt(n)){let p=n.keys.join(", ");o=`Unrecognized ${MA(n.keys.length,"field")}: ${p}`}else if(tre(n))o=`Number must be greater than or equal to ${n.minimum}`,s=String(n.minimum);return{file:t,path:r,message:o,expected:s,invalidValue:l,suggestion:u?.suggestion,docLink:u?.docLink}})}function brt(e,t){if(!e||typeof e!=="object")return[];let n=e;if(!n.permissions||typeof n.permissions!=="object")return[];let r=n.permissions,o=[];for(let s of["allow","deny","ask"]){let i=r[s];if(!Array.isArray(i))continue;r[s]=i.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${s}`,message:`Non-string value in ${s} array was removed`,severity:"warning",invalidValue:a}),!1;let c=WL(a,s);if(!c.valid){let l=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)l+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${s}`,message:l,severity:"warning",invalidValue:a}),!1}return!0})}return o}var Ert=new Set(_s);function xrt(e,t){if(!e||typeof e!=="object")return[];return[...ote(e,ste)?[{file:t,path:"hooks",message:`PreToolUse/PermissionRequest hooks are declared outside "hooks" (at the top level or under another key) — ${Ac}.`,severity:"fatal",docLink:"https://code.claude.com/docs/en/hooks"}]:[],...vrt(e,t)]}function vrt(e,t){if(!("hooks"in e))return[];if(e.hooks===null||typeof e.hooks!=="object"||Array.isArray(e.hooks)){let o=qn(e.hooks);if(Array.isArray(e.hooks)&&(e.hooks.some(Ve)||kL(e.hooks)))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o} — ${Ac}.`,invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}];return delete e.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o}. This field was ignored.`,severity:"warning",invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}]}let n=e.hooks;if($E(n))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received a single matcher — ${Ac}.`,docLink:"https://code.claude.com/docs/en/hooks"}];let r=[];for(let o of Object.keys(n)){let s=L_(o);if(!Ert.has(o)){if(vc(n[o],3,{matchersCount:!Array.isArray(n[o])})){r.push({file:t,path:`hooks.${s}`,message:`"${s}" is not a hook event, but it holds PreToolUse/PermissionRequest hooks — ${Ac}.`,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Unknown hook event "${s}" was ignored. Valid events: ${_s.join(", ")}`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0});continue}if(!Array.isArray(n[o])){let i=n[o],a=qn(i);if(Ph.has(o)&&i!==null||vc(i,3,{matchersCount:!1})){r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a} — ${Ac}.`,invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a}. This entry was ignored.`,severity:"warning",invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks",...i!==null&&{preserveOnWrite:!0}})}}for(let[o,s]of Object.entries(n)){let{stripped:i,unloadableGuards:a}=ate(s,o);for(let c of a)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:`${c.problem} — ${Ac}.${c.aboutType?` Valid types: ${[...FE()].join(", ")}`:""}`,severity:"fatal",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks"});for(let c of i)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:c.aboutType?`${c.problem}; entry ignored. Valid types: ${[...FE()].join(", ")}`:`${c.problem}; ${c.hookIndex===void 0?"matcher":"entry"} ignored.`,severity:"warning",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0})}if(r.length>0&&Object.keys(n).length===0)delete e.hooks;return r}var wrt=[{key:"allowedMcpServers",schema:JE},{key:"deniedMcpServers",schema:XE}];function Art(e,t,n){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:s,schema:i}of wrt){if(!(s in r))continue;if(!Array.isArray(r[s])){if(n?.keepWholeFieldInvalid)continue;let l=r[s];delete r[s],o.push({file:t,path:s,message:`"${s}" must be an array; received ${qn(l)}. This field was ignored.`,severity:"warning",invalidValue:l});continue}let a=r[s],c=[];for(let l=0;l<a.length;l++){let u=i().safeParse(a[l]);if(u.success)c.push(a[l]);else o.push({file:t,path:`${s}[${l}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:a[l]})}if(c.length<a.length)r[s]=c}return o}function Crt(e,t){if(!Ve(e)||e.managedMcpServers===void 0)return[];let r=[],o=ME(e.managedMcpServers,(s,i)=>r.push({file:t,path:s?`managedMcpServers.${s}`:"managedMcpServers",message:s?`Managed MCP server was ignored: ${i}`:i,severity:"warning"}));if(o===void 0)delete e.managedMcpServers;else e.managedMcpServers=o;return r}function Trt(e){if(!e||typeof e!=="object")return;let t=e.source;if(!t||typeof t!=="object")return;let n=t.source;return typeof n==="string"?n:void 0}function Rrt(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.plugins;return Array.isArray(n)&&n.some(zL)}function krt(e,t){if(!e||typeof e!=="object")return[];let n=e,r="extraKnownMarketplaces";if(!(r in n))return[];let o=n[r];if(!o||typeof o!=="object"||Array.isArray(o)){let a=qn(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object mapping marketplace names to declarations; received ${a}. This field was ignored.`,severity:"warning",invalidValue:a}]}let s=o,i=[];for(let a of Object.keys(s)){let c=JL().safeParse(s[a]),l;if(!c.success){let u=Trt(s[a]);if(u!==void 0&&!Ote.has(u)||Rrt(s[a]))continue;l=jE(c.error.issues)}else if(c.data.source.source==="settings"&&c.data.source.name!==a)l=`key "${as(a)}" must match the settings source name "${as(c.data.source.name)}"`;if(l!==void 0)i.push({file:t,path:`${r}.${as(a)}`,message:`Invalid marketplace entry was ignored: ${l}`,severity:"warning"}),delete s[a]}return i}function Ort(e,t){if(!e||typeof e!=="object")return[];let n=e,r="modelPicker";if(!(r in n))return[];let o=n[r];if(!Ve(o)||!Array.isArray(o.options)){let c=Ve(o)?`options: ${qn(o.options)}`:qn(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object with an "options" array of { model, label?, description?, behavesAs? } rows; received ${c}. This field was ignored.`,severity:"warning",invalidValue:c}]}let s=[];if("replaceBuiltInOptions"in o&&typeof o.replaceBuiltInOptions!=="boolean"){let c=qn(o.replaceBuiltInOptions);delete o.replaceBuiltInOptions,s.push({file:t,path:`${r}.replaceBuiltInOptions`,message:`"replaceBuiltInOptions" must be true or false; received ${c}. This entry was ignored (the rows are added to the built-in lineup).`,severity:"warning",invalidValue:c})}let i=o.options,a=[];for(let c=0;c<i.length;c++){let l=e0().safeParse(i[c]);if(l.success){a.push(i[c]);continue}s.push({file:t,path:`${r}.options.${c}`,message:`${Irt(l.error.issues[0])}. This row was ignored; the other rows still apply.`,severity:"warning",invalidValue:qn(i[c])})}if(a.length!==i.length)o.options=a;return s}function Prt(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=e;if(!("modelPricing"in n)||n.modelPricing===void 0)return[];let r=n.modelPricing;if(!r||typeof r!=="object"||Array.isArray(r))return delete n.modelPricing,[{file:t,path:"modelPricing",message:`"modelPricing" must be an object; received ${qn(r)}. It was ignored.`,severity:"warning"}];let o=r,s=[];if(o.multiplier!==void 0&&!QL().safeParse(o.multiplier).success)s.push({file:t,path:"modelPricing.multiplier",message:'"multiplier" must be a number greater than 0 and at most 10. It was ignored.',severity:"warning",invalidValue:o.multiplier}),delete o.multiplier;if(o.overrides!==void 0){let i=o.overrides;if(!i||typeof i!=="object"||Array.isArray(i))s.push({file:t,path:"modelPricing.overrides",message:`"overrides" must be an object mapping model ID to rates; received ${qn(i)}. It was ignored.`,severity:"warning"}),delete o.overrides;else{let a=i;for(let c of Object.keys(a)){let l=XL().safeParse(a[c]);if(l.success&&c!=="constructor"&&c!=="__proto__")continue;let u=l.success?void 0:l.error.issues[0];s.push({file:t,path:`modelPricing.overrides.${as(c)}`,message:`Invalid pricing row was ignored (${u?`${u.path.join(".")||"row"}: ${u.message}`:"not a model ID"}).`,severity:"warning",invalidValue:a[c]}),delete a[c]}}}return s}function Irt(e){if(!e)return"Invalid modelPicker row";return`modelPicker row ${e.path.length>0?`"${e.path.join(".")}" `:""}${e.message}`.trim()}function Drt(e,t,n){if(!e||typeof e!=="object"||Array.isArray(e))return[];let r=e,o=r.crossSessionInbound;if(o===void 0||Lrt(o))return[];if(n?.policySource)r.crossSessionInbound="refuse";else delete r.crossSessionInbound;return[Urt(o,t,n?.policySource===!0)]}function Lrt(e){return typeof e==="string"&&Lh.includes(e)}var Mrt="crossSessionInbound";function Nrt(e){let t=Lh.map((r)=>`"${r}"`).join(", "),n=typeof e==="string"?`"${as(e).replace(/^<key>$/,"<value>")}"`:qn(e);return`must be one of ${t}; received ${n}`}function Urt(e,t,n=!1){let r=Lh.map((s)=>`"${s}"`).join(", "),o=n?'In managed settings an unrecognized value is treated as "refuse" (the most restrictive): cross-session messages to this session are turned away until an administrator fixes it.':"This value was ignored; while it is present, cross-session messages are held for your approval instead of being delivered. Set it to one of the values above.";return{file:t,path:Mrt,message:`"crossSessionInbound" ${Nrt(e)}. ${o}`,severity:"warning",expected:r,...n&&{statusOnly:!0}}}var rre="remoteControl.shareHostProfile";function Frt(e,t,n){if(!Ve(e)||e.remoteControl===void 0)return[];let r=n?.policySource===!0,o=YE.map((f)=>`"${f}"`).join(", "),s=r?'In managed settings this is treated as "off" (the most restrictive): Remote Control environments report nothing about this machine until an administrator fixes it.':"While it is present, Remote Control environments report nothing about this machine.",i=(f)=>({file:t,path:rre,message:`${f}. ${s}`,severity:"warning",expected:o,...r?{statusOnly:!0}:{preserveOnWrite:!0}}),a=(f)=>typeof f==="string"?`"${as(f).replace(/^<key>$/,"<value>")}"`:qn(f),c=e.remoteControl;if(!Ve(c)){if(r)e.remoteControl={shareHostProfile:"off"};else delete e.remoteControl;return[i(`"remoteControl" must be an object like { "shareHostProfile": ${o.replace(/, /g," | ")} }; received ${a(c)}`)]}let l=[],u=Object.keys(c).filter((f)=>f!=="shareHostProfile");if(u.length>0){if(r)c.shareHostProfile="off";l.push(i(`"remoteControl" has an unrecognized key ${u.map((f)=>`"${as(f)}"`).join(", ")} (its only key is "shareHostProfile")`))}let p=c.shareHostProfile;if(p!==void 0&&!(typeof p==="string"&&YE.includes(p))){if(r)c.shareHostProfile="off";else delete c.shareHostProfile;l.push(i(`"${rre}" must be one of ${o}; received ${a(p)}`))}return l}function Rc(e,t,n){return[...fne(e,t),...brt(e,t),...xrt(e,t),...krt(e,t),...Ort(e,t),...Prt(e,t),...Drt(e,t,{policySource:n?.policySource}),...Frt(e,t,{policySource:n?.policySource}),...n?.skipMcpServerEntryFilter?[]:Art(e,t,{keepWholeFieldInvalid:n?.mcpServerEntrySalvageOnly}),...n?.mcpServerEntrySalvageOnly?Crt(e,t):[]]}function h0(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),j7.filter((n)=>t.has(n))}function jrt(){return No(Ec(),"managed-settings.json")}function g0(e){if(En()==="wsl"&&e.wslInherits?.()){let t=d0(_d,e.store);if(t.settings)return t;let n=d0(Ec(),e.store);return{settings:n.settings,errors:[...t.errors,...n.errors]}}return d0(Ec(),e.store)}function Hrt(e){return e.endsWith(".json")&&!e.startsWith(".")}function d0(e,t){let n=[],r={},o=!1,{settings:s,errors:i}=yd(No(e,"managed-settings.json"),t,void 0,!0);if(n.push(...i),s&&Object.keys(s).length>0)r=Wn(r,s,Mo),o=!0;let a=No(e,"managed-settings.d");try{let c=t.folderListingForPolicyWalk(a),l;if(c!==void 0)l=c;else l=et().readdirSync(a).filter((u)=>(u.isFile()||u.isSymbolicLink())&&Hrt(u.name)).map((u)=>u.name).sort(),t.noteWalkListing(a,l);for(let u of l){let{settings:p,errors:f}=yd(No(a,u),t,void 0,!0);if(n.push(...f),p&&Object.keys(p).length>0)r=Wn(r,p,Mo),o=!0}}catch(c){let l=xe(c);if(l!=="ENOENT"&&l!=="ENOTDIR")ie(`managed-settings.d read failed: ${c}`,{level:"error"}),n.push(zh(a,c,"directory"))}return{settings:o&&Oc(r)?r:null,errors:n}}function Brt(e,t){if(bn(e))qrt(t);else ie(`settings file read failed at ${t}: ${e}`,{level:"error"})}function yd(e,t,n,r){let o=n!==void 0?`${e}\x00pinned`:e,s=t.parsedFiles.get(o);if(s)return{settings:s.settings?lo(s.settings):null,errors:s.errors};let i=Wrt(e,n,r);return t.parsedFiles.set(o,i),{settings:i.settings?lo(i.settings):null,errors:i.errors}}function _0(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 lx(e,t){let n=ore.get(e),r=n?.get(t);if(r)return{settings:r.settings&&lo(r.settings),errors:r.errors.map((s)=>({...s}))};let o=Krt(e,t);if(n)n.set(t,o);else ore.set(e,new Map([[t,o]]));return{settings:o.settings&&lo(o.settings),errors:o.errors.map((s)=>({...s}))}}var ore=new WeakMap;function Krt(e,t){let n=lo(e),r=Rc(n,t,{skipMcpServerEntryFilter:!0,policySource:!0}),o=[],s=r0(dre(t,o),t).safeParse(n);if(!s.success)return{settings:null,errors:[...r,...$h(s.error,t)]};return{settings:Object.keys(s.data).length>0?s.data:null,errors:[...r,...o]}}function kc(e){return zne()&&(e==="managedMcpServers"||e.startsWith("managedMcpServers."))}var ux=["managedMcpServers","isolation"];function ure(e,t){if(!Ve(e))return[];let n=[];for(let r of ux){if(!(r in e))continue;if(delete e[r],!kc(r))n.push({file:t,path:r,message:`"${r}" is only honored from managed settings and was ignored here.`,severity:"warning",preserveOnWrite:!0})}return n}function dre(e,t){return(n)=>{if(kc(n.path))return;if(t.push({file:e,path:n.path,message:n.message,severity:"warning",...n.statusOnly&&{statusOnly:n.statusOnly},...n.startupFatal&&{startupFatal:n.startupFatal}}),n.statusOnly||n.startupFatal)ie(`${e}: ${n.path}: ${n.message}`,{level:n.startupFatal?"error":"warn"})}}function pre(e){let t=e?.remote?e.remote():Fne(),n=!e?.remote&&!kc("managedMcpServers")&&Mne()?[{file:"remote managed settings",path:"managedMcpServers",message:"The organization's MCP servers in the cached remote settings are withheld until the server confirms them this session; they connect as soon as it does.",severity:"warning",statusOnly:!0}]:[];if(!t||Object.keys(t).length===0)return{settings:null,errors:n,servedSnapshot:!1};let{settings:r,errors:o}=lx(t,"remote managed settings");return{settings:r,errors:[...n,...Jne(o)],servedSnapshot:Dne(t)}}var sre="parent managed settings";function Grt(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let n=lx(t,sre);for(let r of ux)if(n.settings?.[r]!==void 0&&!kc(r))n.errors.push({file:sre,path:r,message:`"${r}" is only honored from the organization's managed settings sources (server-managed, MDM, managed-settings.json), not from settings a host passes in, and was ignored here.`,severity:"warning",statusOnly:!0});return n}function fre(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let n=lo(t),r=[...ure(n,"SDK inline settings"),...Rc(n,"SDK inline settings")],o=md().safeParse(n);if(!o.success)return{settings:null,errors:[...r,...$h(o.error,"SDK inline settings")]};if(r.some((s)=>s.severity==="fatal"))return{settings:null,errors:r};return{settings:o.data,errors:r}}var dx=2097152;function Wrt(e,t,n){try{let r;if(t!==void 0)r=t;else{let{resolvedPath:o}=rf(et(),e);r=Sc(o,dx)}return Vrt(r,e,n)}catch(r){return Yrt(r,e)}}function Vrt(e,t,n){if(e.trim()==="")return{settings:{},errors:[]};let r=lo(bc(e,!1));if(n){if(!Ve(r))return{settings:null,errors:[px(t)]};let i=Rc(r,t,{skipMcpServerEntryFilter:!0,policySource:!0}),a=[],c=r0(dre(t,a),t).safeParse(r);if(!c.success)return{settings:null,errors:[...i,...$h(c.error,t)]};return{settings:c.data,errors:[...i,...a]}}let o=[...ure(r,t),...Rc(r,t)],s=md().safeParse(r);if(!s.success){let i=$h(s.error,t);return{settings:null,errors:[...o,...i]}}if(o.some((i)=>i.severity==="fatal"))return{settings:null,errors:o};return{settings:s.data,errors:o}}function px(e,{userWritable:t=!1}={}){return t?{file:e,path:"",message:`Managed settings document (${e}) could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.`,severity:"warning",statusOnly:!0,userWritable:!0}:{file:e,path:"",message:"Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.",startupFatal:!0}}function qrt(e){ie(`Broken symlink or missing file encountered for settings.json at path: ${e}`)}function Zrt(){return{settings:null,errors:[]}}function Yrt(e,t){if(Brt(e,t),bn(e))return Zrt();return{settings:null,errors:[zh(t,e)]}}function zh(e,t,n="file"){return{file:e,path:"",message:`${n==="directory"?"Managed settings drop-in directory":"Settings file"} could not be read: ${t instanceof Error?t.message:String(t)}`,severity:"fatal",errorClass:"unreadable"}}function ire(e,t){switch(e){case"userSettings":return mr(qt());case"policySettings":return mr(t.cwd);case"projectSettings":return mr(t.projectConfigDir??t.cwd);case"localSettings":{if(t.projectConfigDir!==void 0)return mr(t.projectConfigDir);return mre(t.cwd,t.canonicalGitRoot)}case"flagSettings":return t.flagPath?zrt(mr(t.flagPath)):mr(t.cwd)}}function mre(e,t){let n=Jrt(e,t);if(n.decided!==void 0)return n.decided;if(!eot(n.root))return n.cwdResolved;return n.root}function Jrt(e,t){let n=t?.(e);if(!n)return{decided:mr(e)};let r=mr(n),o=mr(e);if(r===o)return{decided:r};let s;try{s=tot()}catch{return{decided:o}}if(r===s)return{decided:o};return{decided:void 0,root:r,cwdResolved:o}}function Xrt(e){return yc().localStoreProbes.canonicalRootOwnerUids(e,Qrt)}function Qrt(e){let t=et(),n=null;try{n=t.lstatSync(No(e,".claude")).uid}catch(r){if(!bn(r))throw r}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(No(e,".git")).uid,claudeEntryUid:n}}function eot(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return ie(`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:n,gitEntryUid:r,claudeEntryUid:o}=Xrt(e);if(n===t&&r===t&&(o===null||o===t))return!0;return ie(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${n}), its .git entry (uid ${r}), 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(n){return ie(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${n instanceof Error?n.message:String(n)}); the store stays at the session cwd`,{level:"warn"}),!1}}function tot(){return yc().localStoreProbes.normalizedRealHomeDir(not)}function not(){let e=gA($rt());if(e===null)throw Error("home directory realpath unavailable");return it(e)}var are={default:"settings.json",cowork:"cowork_settings.json"};function rot(e){if(e.coworkPlugins||xn.CLAUDE_CODE_USE_COWORK_PLUGINS)return are.cowork;return are.default}function jh(e,t){switch(e){case"userSettings":return No(ire(e,t),rot(t));case"projectSettings":case"localSettings":return No(ire(e,t),hre(e));case"policySettings":return jrt();case"flagSettings":return t.flagPath}}function hre(e){switch(e){case"projectSettings":return No(".claude","settings.json");case"localSettings":return No(".claude","settings.local.json")}}function gre(e){if(mre(e.cwd,e.canonicalGitRoot)===mr(e.cwd))return;if(e.projectConfigDir!==void 0)return;return No(mr(e.cwd),hre("localSettings"))}function _re(e,t){let n=t.store.perSource.get(e);if(n!==void 0)return n;let r=Oot(e,t);return t.store.perSource.set(e,r),r}function oot(e,t=!1){return!e||e.parentSettingsBehavior==="merge"||t}var sot=[["permissions","defaultMode"],["modelPicker","replaceBuiltInOptions"]];function iot(e){let t={};for(let{path:n,restrictive:r}of Eh){let o=Hs(e,n);if(n[0]==="sandbox"&&xh(r).includes(o))Yi(t,n,o)}return t.sandbox??{}}var aot=/^(?:Read|Edit)\((?:\.\/)?!/;function cot(e,t){let n={};if(e.allowManagedHooksOnly===!0)n.allowManagedHooksOnly=!0;if(e.disableCommandPluginSources===!0)n.disableCommandPluginSources=!0;if(e.allowManagedMcpServersOnly===!0)n.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)n.disableClaudeAiConnectors=!0;if(e.syncClaudeAiSkills===!1)n.syncClaudeAiSkills=!1;if(e.syncClaudeAiPlugins===!1)n.syncClaudeAiPlugins=!1;if(e.remoteTools?.allowUnattendedServing===!1)n.remoteTools={...n.remoteTools,allowUnattendedServing:!1};if(e.allowManagedPermissionRulesOnly===!0)n.allowManagedPermissionRulesOnly=!0;if(e.disableAutoMode==="disable")n.disableAutoMode="disable";let r=e.remoteControl?.shareHostProfile;if(r==="off"||r==="basic")n.remoteControl={...n.remoteControl,shareHostProfile:r};if(Hne(e.attribution,e.includeCoAuthoredBy)==="disabled")n.attribution={...n.attribution,commitTrailers:!1};if(e.attribution?.sessionUrl===!1)n.attribution={...n.attribution,sessionUrl:!1};let o=e.strictPluginOnlyCustomization;if(o===!0||Array.isArray(o)&&o.length>0)n.strictPluginOnlyCustomization=o;if(e.deniedMcpServers)n.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)n.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)n.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)n.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)n.enforceAvailableModels=!0;if(e.permissions){let s=Th(e.permissions,["deny","ask"]);for(let i of["deny","ask"]){let a=s[i];if(a!==void 0)s[i]=a.filter((c)=>{if(!aot.test(c))return!0;return ie(`Ignoring ${i} rule "${c}" from the parent process's managed settings: a rule starting with "!" removes paths from the rules listed before it instead of restricting anything, so it is not merged into the policy rules. Spell the deny without the exception instead.`,{level:"warn"}),!1})}if(e.permissions.disableBypassPermissionsMode==="disable")s.disableBypassPermissionsMode="disable";if(e.permissions.disableAutoMode==="disable")s.disableAutoMode="disable";if(e.permissions.blockReadsOutsideWorkingDirectories===!0)s.blockReadsOutsideWorkingDirectories=!0;if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:a}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)s.allow=i;if(a)s.additionalDirectories=a}if(Object.keys(s).length>0)n.permissions=s}if(e.sandbox){let{network:s,filesystem:i,credentials:a}=e.sandbox,c={},l=s?Th(s,["deniedDomains"]):{},u=i?Th(i,["denyRead","denyWrite"]):{};if(s){if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&s.allowedDomains)l.allowedDomains=s.allowedDomains}if(Object.keys(l).length>0)c.network=l;if(i){if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)u.allowRead=i.allowRead}if(Object.keys(u).length>0)c.filesystem=u;if(a){let p=(a.files??[]).map((h)=>h.mode==="deny"?{path:h.path,mode:"deny"}:{path:h.path,mode:"mask",injectHosts:[]}),f=(a.envVars??[]).filter((h)=>h.mode==="deny").map((h)=>({name:h.name,mode:"deny"})),m={...p.length>0&&{files:p},...f.length>0&&{envVars:f}};if(a.sigv4){let h={};for(let g of["streaming","presigned","sigv4a"])if(a.sigv4[g]==="deny")h[g]="deny";m.sigv4=h}{let h=yre(a.awsPairs??[],[]);if(h.length>0)m.awsPairs=h}if(Object.keys(m).length>0)c.credentials=m}if(Wn(c,iot(e)),Object.keys(c).length>0)n.sandbox=c}return n}function yre(e,t){let n=Ji,r=new Set(t.flatMap(cre));return Gr(e.flatMap(cre)).filter((o)=>n.includes(o)&&!r.has(o)).map((o,s)=>({accessKeyIdVar:o,secretAccessKeyVar:`${IE}${s+1}_`}))}function cre(e){if(!Ve(e))return[];return[e.accessKeyIdVar,e.secretAccessKeyVar,e.sessionTokenVar].filter((t)=>typeof t==="string")}var lot=new Set([...[..._L].filter((e)=>e!=="ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION"),...yL,"CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CODE_SUBAGENT_MODEL_FORCE"]);function uot(e,t){if(!t||!e)return null;let n={};if(e.model!==void 0)n.model=e.model;if(e.availableModels!==void 0)n.availableModels=e.availableModels;if(e.enforceAvailableModels!==void 0)n.enforceAvailableModels=e.enforceAvailableModels;if(e.fallbackModel!==void 0)n.fallbackModel=e.fallbackModel;if(e.modelPicker!==void 0)n.modelPicker=e.modelPicker;return Object.keys(n).length>0?n:null}function ix(e){if(delete e.model,delete e.fallbackModel,delete e.modelPicker,delete e.modelOverrides,e.env){let t={};for(let[n,r]of Object.entries(e.env))if(!lot.has(n.toUpperCase()))t[n]=r;e.env=t}}function cx(){return En()==="macos"?"plist":"hklm"}function Sre(e){let t=S0(e);if(t.composes==="tier")return"helper";let n=f0(e);if(t.composes==="remoteSlot"||n.present.remote)return"remote";if(n.present.mdm)return cx();if(n.present.file)return"file";if(n.parentSlice||n.hostModelOverlay)return"parent";let r=e.hkcu?.();return r&&Object.keys(r.settings).length>0?"hkcu":null}function f0(e){let t=[],{settings:n,errors:r,servedSnapshot:o}=pre(e);t.push(...r);let s=S0(e),i=s.composes==="remoteSlot"?s.helper:p0(n),{settings:a,errors:c}=_0(e);t.push(...c);let l=p0(a),{settings:u,errors:p}=e.file?.()??g0(e);t.push(...p);let f=p0(u),{settings:m,errors:h}=Grt(e);t.push(...h);let g=m!==null&&(l===null&&f===null||(l??f)?.parentSettingsBehavior==="merge"),y=[got(i,o&&s.composes!=="remoteSlot",[l,f,...g?[Th(m,hot)]:[]]),l,f].filter((te)=>te!==null),v=(s.composes==="remoteSlot"?s.helper:[n,a,u].find((te)=>te!==null&&(te===n&&o?i!==null:te.managedSourcesBehavior!==void 0||Oc(te))))?.managedSourcesBehavior,S=i!==null&&o&&s.composes!=="remoteSlot",{admin:x,merged:w}=dot(y,v,S),I={remote:i!==null,mdm:l!==null,file:f!==null},O=[];if(w){let te=I.remote?"remote":I.mdm?cx():"file",nt=[[l,cx()],[f,"file"]];for(let[De,Dt]of nt){if(De===null||De===y[0]||S&&De===y[1])continue;let Oe=y0.filter((Rn)=>Object.values(De[Rn]??{}).some((vt)=>vt!==void 0&&vt!==null)),[q]=Oe;if(q===void 0)continue;O.push(Dt),t.push({file:ax[Dt],path:q,message:`${Oe.map((Rn)=>`"${Rn}"`).join(" and ")} in ${ax[Dt]} ignored: policy helper configuration is read from the highest managed settings source only (${ax[te]} here), even with managedSourcesBehavior "merge". Configure the helper in that source instead.`,severity:"warning",statusOnly:!0})}}let z=(te)=>te!==null&&(te===y[0]||Object.keys(Ch(te,Cre())).length>0),N={remote:z(i),mdm:z(l),file:z(f)},V={allowManagedPermissionRulesOnly:y.some((te)=>te.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:x?.forceLoginOrgUUID,allowedMcpServers:nx({slot:x,adminTiers:y})||m?.allowManagedMcpServersOnly===!0&&x?.allowManagedMcpServersOnly!==!1?l0({slot:x,adminTiers:y}):x?.allowedMcpServers,availableModels:x?.availableModels,sandbox:{network:{allowManagedDomainsOnly:y.some((te)=>te.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:y.some((te)=>te.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},X=m&&oot(x,S&&!I.mdm&&!I.file)?cot(m,V):null,ee=X&&Object.keys(X).length>0?X:null,fe=uot(m,e.hostManagedProvider);return{tiers:y,admin:x,parentSlice:ee,hostModelOverlay:fe,errors:t,present:I,mode:v,merged:w,composed:N,snapshotFirst:S,shadowedHelperSources:O}}function dot(e,t,n){let r=e[0];if(!r)return{admin:null,merged:!1};let{managedSourcesBehavior:o,...s}=r;if(t!=="merge"||e.length<2)return{admin:o===void 0?r:s,merged:!1};let i=e.slice(1).map((c,l)=>{let u=n&&l===0?{...c}:Ch(c,Cre());if(!(n&&l===0)){for(let f of sot)if(Hs(u,f)!==void 0)Yi(u,f,void 0)}let p=Hs(u.sandbox,["enabledPlatforms"]);if(Array.isArray(p)&&p.includes(En()))Yi(u,["sandbox","enabledPlatforms"],void 0);else if(p!==void 0)delete u.sandbox;return u}),a={};for(let c of[...i].reverse())Wn(a,c,m0);return Wn(a,s,n?_ot:m0),yot(a,[r,...i]),pot(a,[r,...i],n),{admin:a,merged:!0}}var bre=["managedSourcesBehavior","wslInheritsWindowsSettings"],y0=["policyHelper","policyHelpers"],ax={remote:"server-managed settings",plist:"the managed preferences plist",hklm:"the HKLM policy key",file:"managed-settings.json"};function Oc(e){return Object.keys(e).some((t)=>!bre.includes(t))}function p0(e){return e&&Oc(e)?e:null}function pot(e,t,n){let r=t.findIndex((s)=>s.availableModels!==void 0),o=t.findIndex((s)=>s.modelOverrides!==void 0);if(o!==-1&&(r===-1||o<=r||n&&r===0))e.modelOverrides={...t[o].modelOverrides};else delete e.modelOverrides}var Ere=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins"],fot=["awsPairs","ripgrep"];function xre(e,t,n){if(t===void 0)return e;if(Array.isArray(t))return n==="awsPairs"&&Array.isArray(e)?[...t,...yre(e,t)]:[...t];if(!Ve(t))return t;return Rd(t,(r)=>Array.isArray(r)?[...r]:r)}var mot=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins","allowedMarketplaces","allowedHttpHookUrls","httpHookAllowedEnvVars"],hot=["allowedMcpServers","availableModels"];function got(e,t,n){if(e===null||!t)return e;let r=mot.filter((o)=>n.some((s)=>s?.[o]!==void 0));return r.length===0?e:Ch(e,r)}function m0(e,t,n){if(n!==void 0&&(Ere.includes(n)||fot.includes(n)))return xre(e,t,n);return vre(e,t,n)}function _ot(e,t,n){if(n!==void 0&&Ere.includes(n))return xre(e,t,n);return vre(e,t,n)}function vre(e,t,n){if(Array.isArray(e)&&Array.isArray(t)&&n!=="fallbackModel")return Gr([...t,...e]);return Mo(e,t,n)}function yot(e,t){let n=t[0],r=e;for(let{path:o,restrictive:s}of Eh){let i=xh(s),a=Math.min(...t.map((c)=>i.indexOf(Hs(c,o))).filter((c)=>c!==-1));if(Number.isFinite(a))Yi(r,o,i[a]);else if(Hs(n,o)===void 0&&Hs(e,o)!==void 0)Yi(r,o,void 0)}if(e.strictPluginOnlyCustomization!==!0){let o=Gr(t.flatMap((s)=>Array.isArray(s.strictPluginOnlyCustomization)?s.strictPluginOnlyCustomization:[]));if(o.length>0)e.strictPluginOnlyCustomization=o;else if(n?.strictPluginOnlyCustomization===void 0)delete e.strictPluginOnlyCustomization}}function S0(e){let t=e.helper?.()??null;if(!t)return{composes:"none"};let n=e.helperArmedFromRemote?.()===!1?"tier":"remoteSlot";if(e.helperMergesOutput?.()!==!0)return{composes:n,helper:t,mergedOver:null};if(!e.store.policy.mergedHelper){let r,o;if(n==="remoteSlot")r=pre(e).settings,o="remote";else if(r=_0(e).settings)o=En()==="macos"?"plist":"hklm";else r=(e.file?.()??g0(e)).settings,o="file";e.store.policy.mergedHelper={helper:xot(r,t),mergedOver:Object.keys(wre(r)).length>0?o:null}}return{composes:n,...e.store.policy.mergedHelper}}function wre(e){return Ch(e??{},y0)}function Sot(e,t){let n=new Map;for(let[o,s]of Object.entries(t)){let i=o.toUpperCase();if(!n.has(i))n.set(i,s)}let r={};for(let[o,s]of Object.entries(e))r[o]=n.get(o.toUpperCase())??s;return Object.assign(r,t)}var bot=["forceLoginOrgUUID","gatewayInternalNetworks","allowedHttpHookUrls","httpHookAllowedEnvVars","allowRead"];function Eot(e,t,n){let r=n!==void 0&&t!==void 0&&bot.includes(n)?t:m0(e,t,n);return r===t&&Array.isArray(r)?[...r]:r}function xot(e,t){let n=wre(e),r=Wn({},n,t,Eot);if(n.env&&t.env)r.env=Sot(n.env,t.env);return r}function vot(e,t,n){let r=[...t.remote?["remote"]:[],...t.mdm?[cx()]:[],...t.file?["file"]:[]],o={slot:n,adminTiers:e};return e.flatMap((s,i)=>{let a=r[i],c=Bne(s,o);return a!==void 0&&c.length>0?[{source:a,keys:c}]:[]})}var Are=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","gcpAuthRefresh"];var wot=[...Are,"otelHeadersHelper","proxyAuthHelper","forceLoginOrgUUID","forceLoginMethod","forceLoginGatewayUrl","gatewayInternalNetworks","parentSettingsBehavior","env","modelPicker",...y0,...bre];function Cre(){return wot}function Aot(e){return Cee.some((t)=>e.startsWith(t))||Aee.includes(e)}function Cot(e,t,n,r=0){let o=new Map,s=new Map,i=!1;for(let[a,c]of e.entries()){let l=new Set,u=t?.[a]===!0;for(let[p,f]of Object.entries(c??{})){let m=p.toUpperCase(),h=Aot(m);if(h&&f.trim()==="")continue;if(h&&i)continue;if(h&&a>r&&t?.[a]===!0)continue;let g=o.get(m);if(g!==void 0){if(l.has(m))s.set(p,f);else if(!s.has(p))s.set(p,g);continue}if(a>r&&n?.[a]?.has(m))continue;if(s.set(p,f),l.add(m),o.set(m,f),h)u=!0}if(u)i=!0}return Object.fromEntries(s)}var Tot="CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION";function lre(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))if(n.toUpperCase()!==Tot)t[n]=r;return t}function Rot(e,t){let n=Object.entries(e??{}),r=t??{};return n.length===Object.keys(r).length&&n.every(([o,s])=>r[o]===s)}function kot(e){let t=_0(e);return t.settings?t.errors:[...t.errors,...(e.file?.()??g0(e)).errors]}function Tre(e){let t=S0(e),n=(e.helperWarnings?.()??[]).filter((g)=>!kc(g.path));if(t.composes==="tier"){let{helper:g}=t;e.store.lastPolicyEnvComposition=null;let y=e.hostManagedProvider?{...g}:g;if(e.hostManagedProvider)ix(y);e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&g.availableModels!==void 0?g.modelOverrides:void 0};let E=e.store.policy.helperBaseStatusNotices??=[...e.helperMergesOutput?.()===!0?kot(e).filter((v)=>!v.statusOnly):[],...f0(e).errors.filter((v)=>v.statusOnly)];return{settings:y,errors:[...E,...n]}}let{tiers:r,admin:o,parentSlice:s,hostModelOverlay:i,errors:a,present:c,snapshotFirst:l}=f0(e);if(a.push(...n),!o&&!s){e.store.lastPolicyEnvComposition=null,e.store.policy.pairedModelOverrides={value:void 0};let g=e.hkcu?.();if(g&&Object.keys(g.settings).length>0){let y=e.hostManagedProvider?{...g.settings}:g.settings;if(e.hostManagedProvider){if(ix(y),i)Object.assign(y,i)}return{settings:y,errors:[...a,...g.errors]}}if(i)return{settings:{...i},errors:[...a,...g?.errors??[]]};return{settings:null,errors:[...a,...g?.errors??[]]}}let u=Wn({},s??{},o??{},Mo);if(r.some((g)=>g.forceRemoteSettingsRefresh===!0))u.forceRemoteSettingsRefresh=!0;let p=xn.CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION===!0,f=u.env;if(!p){let g=Cot(r.map((y)=>y.env),r.map((y)=>(y.otelHeadersHelper??"").trim()!==""),r.map((y)=>{let E=new Set;for(let v of Are){let S=y[v];if(typeof S==="string"&&S.trim()!=="")for(let x of Tee[v])E.add(x)}return E.size>0?E:void 0}),l?1:0);if(Object.keys(g).length>0)u.env=g;else delete u.env}if(u.env){let g=lre(u.env);if(g&&Object.keys(g).length>0)u.env=g;else delete u.env}if(e.hostManagedProvider){if(ix(u),i)Object.assign(u,i)}let m={env:lre(f)};if(e.hostManagedProvider)ix(m);let h=!p&&!Rot(u.env,m.env);e.store.lastPolicyEnvComposition={unionOptedOut:p,unionChangedEnv:h,remoteTierPresent:c.remote,mdmTierPresent:c.mdm,fileTierPresent:c.file,adminTierCount:r.length,tiersWithEnv:xf(r,(g)=>Object.keys(g.env??{}).length>0)},e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&o?.availableModels!==void 0&&o.modelOverrides!==void 0&&i?.availableModels===void 0?o.modelOverrides:void 0};for(let{source:g,keys:y}of vot(r,c,u)){let[E]=y;if(E===void 0)continue;let v=ax[g],S=y.length===1;a.push({file:v,path:E,message:`${y.map((x)=>`"${x}"`).join(" and ")} in ${v} ${S?"is":"are"} not applied: ${v} is not the managed settings source that applies for ${S?"this key":"these keys"} (/status lists the setting sources). Remove ${S?"it":"them"} from ${v}, or set ${S?"it":"them"} in the source that applies.`,severity:"warning",statusOnly:!0})}return{settings:u,errors:a}}function Oot(e,t,{includeLegacyLocalSettings:n=!0}={}){if(e==="policySettings")return Tre(t).settings;let r=jh(e,t),{settings:o}=r?yd(r,t.store,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:s}=fre(t);if(s)return Wn(o||{},s,Mo)}if(e==="localSettings"&&n){let s=gre(t);if(s){let{settings:i}=yd(s,t.store);if(i)return t.onLegacyLocalSettingsRead?.("per_source"),Wn(i,o||{},Mo)}}return o}function Pot(e,t){return{...e,...t}}function Mo(e,t,n){if(n==="modelPicker"&&t!==void 0)return Rre(t);if(Array.isArray(e)&&Array.isArray(t)){if(n==="fallbackModel")return t;return Gr([...e,...t])}if((n==="extraKnownMarketplaces"||n==="managedMcpServers")&&Ve(e)&&Ve(t))return Pot(e,t);return}function Rre(e){if(!Ve(e))return e;let t=e.options;return{...e,...Array.isArray(t)&&{options:t.map((n)=>Ve(n)?{...n}:n)}}}function Iot(e){if(e.store.isLoadingFromDisk)return{settings:{},errors:[]};let t=Date.now();yh("info","settings_load_started"),e.store.isLoadingFromDisk=!0;try{let n=e.store.pluginBase,r={};if(n)r=Wn(r,n,Mo);let o=[],s=new Set,i=new Set,a=(l)=>{for(let u of l){let p=`${u.file}:${u.path}:${u.message}`;if(!s.has(p))s.add(p),o.push(u)}},c=null;for(let l of h0(e)){if(l==="policySettings"){let{settings:p,errors:f}=Tre(e);if(c=p,p)r=Wn(r,p,Mo);a(f);continue}if(l==="localSettings"){let p=gre(e);if(p&&!i.has(mr(p))){i.add(mr(p));let{settings:f,errors:m}=yd(p,e.store);if(a(m),f)e.onLegacyLocalSettingsRead?.("cascade"),r=Wn(r,f,Mo)}}let u=jh(l,e);if(u){let p=mr(u),f=l==="flagSettings"&&e.flagExpectedContent!==void 0;if(!i.has(p)||f){i.add(p);let{settings:m,errors:h}=yd(u,e.store,l==="flagSettings"?e.flagExpectedContent:void 0);if(a(h),m)r=Wn(r,m,Mo)}}if(l==="flagSettings"){let{settings:p,errors:f}=fre(e);if(a(f),p)r=Wn(r,p,Mo)}}if(c){if(c.availableModels!==void 0)r.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)r.enforceAvailableModels=c.enforceAvailableModels;if(c.modelPicker!==void 0)r.modelPicker=Rre(c.modelPicker)}return yh("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:i.size,error_count:o.length}),{settings:r,errors:o}}finally{e.store.isLoadingFromDisk=!1}}function Dot(e){let t=e.store.mergedSettings;if(t!==null)return t;let n=Iot(e);return e.store.mergedSettings=n,n}function Lot(e){let{settings:t}=Dot(e);return t||{}}function kre(e){e.store.invalidateAll();let t=[];for(let n of h0(e)){let r=_re(n,e);if(r&&Object.keys(r).length>0)t.push({source:n,settings:r})}return{effective:Lot(e),sources:t}}function Ore(e,t){let n=h0(t);for(let r=n.length-1;r>=0;r--){let o=n[r];if(_re(o,t)?.[e]!==void 0)return o}return null}import{execFile as Mot}from"child_process";import{accessSync as Not,closeSync as Uot,constants as Fot,openSync as $ot,readSync as zot}from"fs";class Lre{promise=null;start(){if(this.promise)return;this.promise=E0()}reset(){this.promise=null}}var jot=new Lre;function Hot(e){if(!e)return{status:"ok",exitCode:0,errno:null,signal:null};let t=e,n=typeof t.signal==="string"&&t.signal?t.signal:null;if(typeof t.code==="string")return{status:"spawn_error",exitCode:null,errno:t.code,signal:null};if(t.killed===!0)return{status:"timeout",exitCode:null,errno:null,signal:n};if(n)return{status:"killed",exitCode:null,errno:null,signal:n};return{status:"exited",exitCode:typeof t.code==="number"?t.code:null,errno:null,signal:null}}function b0(e,t,n){let r=Date.now();return new Promise((o)=>{try{Mot(e,t,{encoding:"utf-8",timeout:Vne,windowsHide:!0,...n!==void 0&&{maxBuffer:n}},(s,i)=>{o({stdout:i??"",...Hot(s),durationMs:Date.now()-r})})}catch(s){let i=s.code;o({stdout:"",status:"spawn_error",exitCode:null,errno:typeof i==="string"?i:null,signal:null,durationMs:Date.now()-r})}})}function Pre(e){return{status:e.status,exitCode:e.exitCode,errno:e.errno,signal:e.signal,durationMs:e.durationMs}}function Ire(e){return e.status==="ok"||e.status==="exited"&&e.exitCode!==null}function Bot(e){return e.status==="spawn_error"&&e.errno==="ERR_CHILD_PROCESS_STDIO_MAXBUFFER"}function Kot(e){let t;try{return t=$ot(e,"r"),zot(t,Buffer.alloc(1),0,1,0),null}catch(n){return{code:n&&typeof n==="object"&&"code"in n?n.code:void 0,message:n instanceof Error?n.message:String(n)}}finally{if(t!==void 0)try{Uot(t)}catch{}}}function E0(){return(async()=>{if(process.platform==="darwin"){let e=Zne(),n=(await Promise.all(e.map(async({path:o,...s})=>{try{Not(o,Fot.R_OK)}catch(l){let u=l&&typeof l==="object"&&"code"in l?l.code:void 0;if(u==="ENOENT"||u==="ENOTDIR")return null;return{stdout:null,unreadReason:l instanceof Error?l.message:String(l),...s}}let i=await b0(u0,[...Gne,o],sx);if(!Ire(i))return{stdout:null,unreadReason:"plutil did not finish converting it",...s};if(i.status==="ok")return{stdout:i.stdout,...s};let a=await b0(u0,[...Wne,o]);if(!Ire(a))return{stdout:null,unreadReason:"plutil did not finish checking it",...s};if(a.status==="ok")return{stdout:null,unreadReason:"it holds a value plutil cannot convert to JSON (a date or data value)",...s};let c=Kot(o);if(c!==null){if(c.code==="ENOENT"||c.code==="ENOTDIR")return null;return{stdout:null,unreadReason:c.message,...s}}return{stdout:"",...s}}))).filter((o)=>o!==null),r=n.findIndex((o)=>o.stdout!==null);return{plistStdouts:r===-1?n:n.slice(0,r+1),hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`;return Dre(t)}if(Uh())return Dre(qne);return{plistStdouts:null,hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}})()}async function Dre(e){let t=(o)=>b0(e,["query",o,"/v",Nh],sx),[n,r]=await Promise.all([t(rx),t(ox)]);return{plistStdouts:null,hklmStdout:n.status==="ok"?n.stdout:null,...Bot(n)&&{hklmUnreadReason:`the value exceeds ${sx/1048576} MiB`},hkcuStdout:r.status==="ok"?r.stdout:null,outcomes:{hklm:Pre(n),hkcu:Pre(r)}}}function Mre(){return jot.promise}var Ks=Object.freeze({settings:{},errors:[]});class Bre{mdm=null;hkcu=null;wslInherits=!1;loadPromise=null;startLoad(e){if(this.loadPromise)return;this.loadPromise=(async()=>{let t=Date.now(),r=await(Mre()??E0()),{mdm:o,hkcu:s,wslInherits:i}=await tst(r,e);this.replace(o,s,i);let a=Date.now()-t;ie(`MDM settings load completed in ${a}ms`);try{Oi("tengu_managed_settings_os_read",est(r,a))}catch{}if(Object.keys(o.settings).length>0){ie(`MDM settings found: ${Object.keys(o.settings).join(", ")}`);try{yh("info","mdm_settings_loaded",{duration_ms:a,key_count:Object.keys(o.settings).length,error_count:o.errors.length})}catch{}}})()}replace(e,t,n){this.mdm=e,this.hkcu=t,this.wslInherits=n}reset(){this.mdm=null,this.hkcu=null,this.wslInherits=!1,this.loadPromise=null}}var Nre="@builtin",Got=["prependPlugins","appendPlugins"];function Wot(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Vot=new Qe(()=>new Bre);function Hh(){return Vot.of(In().host)}function qot(e){Hh().startLoad(e)}async function Kre(){let e=Hh();if(!e.loadPromise)qot();await e.loadPromise}function Gre(){return Hh().mdm??Ks}function Wre(){return Hh().hkcu??Ks}function Vre(){return Hh().wslInherits}function x0(e,t,{userWritable:n=!1}={}){let r=bc(e,!1);if(!Ve(r))return{settings:{},errors:[px(t,{userWritable:n})]};let o=[],s=r;for(let l of n?ux:[]){if(!(l in s))continue;if(s=s===r?{...r}:s,delete s[l],!kc(l))o.push({file:t,path:l,message:`"${l}" is only honored from administrator-controlled managed settings and was ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}if(n){for(let u of Got){if(!(u in s))continue;s=s===r?{...r}:s,delete s[u],o.push({file:t,path:u,message:`"${u}" is only honored from administrator-controlled managed settings and was ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}let l=s.enabledPlugins;if(Wot(l)){if(Object.entries(l).filter(([p,f])=>p.endsWith(Nre)||f!==!1).length>0){s=s===r?{...r}:s;let p=gE(l,(f,m)=>!m.endsWith(Nre)&&f===!1);if(Object.keys(p).length>0)s.enabledPlugins=p;else delete s.enabledPlugins;o.push({file:t,path:"enabledPlugins",message:`"enabledPlugins" entries that enable a plugin, or name a built-in, are only honored from administrator-controlled managed settings and were ignored in ${t}, which the user account can write.`,severity:"warning",statusOnly:!0})}}}let{settings:i,errors:a}=lx(s,t),c=[...o,...a];return{settings:i??{},errors:n?c.map((l)=>({...l.severity==="warning"&&!l.startupFatal?l:{...Zot(l),severity:"warning",statusOnly:!0},userWritable:!0})):c}}function Zot({startupFatal:e,...t}){return t}function Ure(e,t,n){return{file:e,path:"",message:`Managed settings document (${e}) could not be read: ${t}; none of its settings are in effect.`,severity:n?"warning":"fatal",statusOnly:!0,errorClass:"unreadable",...n&&{userWritable:!0}}}function Fre(e,t="Settings"){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`^[ \\t]+${n}[ \\t]+REG_(?:EXPAND_)?SZ[ \\t]+([\\s\\S]*)`,"im"),o=e.match(r)?.[1]?.trimEnd();return o?o:null}var Yot=new Map([["ENOENT",Sn("ENOENT")],["EACCES",Sn("EACCES")],["EPERM",Sn("EPERM")],["ENOEXEC",Sn("ENOEXEC")],["EAGAIN",Sn("EAGAIN")],["EMFILE",Sn("EMFILE")],["ENOMEM",Sn("ENOMEM")],["ETIMEDOUT",Sn("ETIMEDOUT")],["ERR_CHILD_PROCESS_STDIO_MAXBUFFER",Sn("ERR_CHILD_PROCESS_STDIO_MAXBUFFER")]]),Jot=new Map([["SIGTERM",Sn("SIGTERM")],["SIGKILL",Sn("SIGKILL")],["SIGINT",Sn("SIGINT")]]);function Xot(e){if(!e)return;return Yot.get(e)??Sn("other")}function Qot(e){if(!e)return;return Jot.get(e)??Sn("other")}function $re(e,t){if(!t)return{};return{[`${e}_status`]:pi(t.status),[`${e}_exit_code`]:t.exitCode??void 0,[`${e}_errno`]:Xot(t.errno),[`${e}_signal`]:Qot(t.signal),[`${e}_duration_ms`]:t.durationMs}}function est(e,t){return{is_wsl:Uh(),await_ms:t,...$re("hklm",e.outcomes.hklm),...$re("hkcu",e.outcomes.hkcu)}}async function tst(e,t){let n=[];for(let c of e.plistStdouts??[]){let{label:l,userWritable:u}=c;if(c.stdout===null){n.push(Ure(l,c.unreadReason,u));continue}let p=x0(c.stdout,l,{userWritable:u});if(Oc(p.settings))return{mdm:{settings:p.settings,errors:[...n,...p.errors],...u&&{userWritable:u}},hkcu:Ks,wslInherits:!1};n.push(...p.errors)}let r=`Registry: ${rx}\\${Nh}`,o=null;if(e.hklmStdout!==null)o=x0(Fre(e.hklmStdout)??"",r);else if(e.hklmUnreadReason!==void 0)n.push(Ure(r,e.hklmUnreadReason,!1));if(o)n.push(...o.errors);let s=Uh(),i=!1;if(s){if(i=o?.settings.wslInheritsWindowsSettings===!0,!i){let c=await rst(t);if(i=c.flag,!i)n.push(...c.records)}}let a=n.length>0?{settings:{},errors:n}:Ks;if(s&&!i){let c=new Set(o?.errors.filter((l)=>l.severity==="warning"));return{mdm:n.length>0?{settings:{},errors:n.map((l)=>c.has(l)?{...l,wslIgnored:!0}:l)}:Ks,hkcu:Ks,wslInherits:!1}}if(o){if(Oc(o.settings))return{mdm:o,hkcu:Ks,wslInherits:i}}if(await nst(i,t))return{mdm:a,hkcu:Ks,wslInherits:i};if(e.hkcuStdout!==null){let c=x0(Fre(e.hkcuStdout)??"",`Registry: ${ox}\\${Nh}`,{userWritable:!0});if(!s||c.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:l,managedSourcesBehavior:u,...p}=c.settings;return{mdm:a,hkcu:{settings:p,errors:c.errors},wslInherits:i}}if(c.errors.length>0)return{mdm:a,hkcu:{settings:{},errors:c.errors},wslInherits:i}}return{mdm:a,hkcu:Ks,wslInherits:i}}async function qre(e,t){if(Se()&&t!==void 0)return(await eQ(e,dx)).content;return Sc(e,dx)}async function Zre(e,t){if(Se()&&t!==void 0)return await et().readdir(e);return et().readdirSync(e)}async function nst(e,t){if(e&&await Hre(_d,t))return!0;return Hre(Ec(),t)}async function zre(e,t){let n=lo(bc(await qre(e,t),!1));if(!n||typeof n!=="object")return!1;return Rc(n,e,{skipMcpServerEntryFilter:!0,policySource:!0}),Oc(n)}function jre(e){let t=xe(e);return t==="ENOENT"||t==="ENOTDIR"}async function rst(e){let t=[];async function n(s){let i;try{i=await qre(s,e)}catch(c){if(!jre(c))t.push(zh(s,c));return!1}if(i.trim()==="")return!1;let a=bc(i,!1);if(!Ve(a))return t.push(px(s)),!1;return a.wslInheritsWindowsSettings===!0}if(await n(Sd(_d,"managed-settings.json")))return{flag:!0,records:t};let r=Sd(_d,"managed-settings.d"),o;try{o=await Zre(r,e)}catch(s){if(!jre(s))t.push(zh(r,s,"directory"));return{flag:!1,records:t}}for(let s of o)if((s.isFile()||s.isSymbolicLink())&&s.name.endsWith(".json")&&!s.name.startsWith(".")&&await n(Sd(r,s.name)))return{flag:!0,records:t};return{flag:!1,records:t}}async function Hre(e,t){try{if(await zre(Sd(e,"managed-settings.json"),t))return!0}catch{}try{let n=Sd(e,"managed-settings.d"),r=await Zre(n,t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(await zre(Sd(n,o.name),t))return!0}catch{}}}catch{}return!1}var sst={user:"userSettings",project:"projectSettings",local:"localSettings"},Yre={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},ist=["user","project","local"],ast=new Set(["bypassPermissions","auto","acceptEdits"]),cst=new Set(["project"]),lst=new Set(["project","local"]);function ust(e){let t=e.effective.permissions?.defaultMode;if(!t||!ast.has(t))return e.effective;for(let n=e.sources.length-1;n>=0;n--){let r=e.sources[n];if(r.settings.permissions?.defaultMode!==void 0){if((H7.includes(t)?lst:cst).has(r.source)){let{defaultMode:s,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Jre(e={}){await Kre();let t={store:new cg,cwd:ost(e.cwd??et().cwd()),allowedSources:(e.settingSources??ist).map((a)=>sst[a]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Gre,hkcu:Wre,wslInherits:Vre,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}},{effective:n,sources:r}=kre(t),o=Sre(t)??void 0,s=r.map(({source:a,settings:c})=>({source:Yre[a],settings:c,path:a==="policySettings"?void 0:jh(a,t),...a==="policySettings"&&{policyOrigin:o}})),i={};for(let a of Object.keys(n)){let c=Ore(a,t);if(c)i[a]={source:Yre[c],path:c==="policySettings"?void 0:jh(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:n,provenance:i,sources:s}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function i7t(e){return Jre(e)}var xst=["enabledPlugins","extraKnownMarketplaces","additionalMarketplaces"];function Xre(e){let t;try{t=dt(Au(e.toString("utf8")))}catch{return e}if(!Qre(t))return e;let n=!1;for(let o of xst)if(Object.hasOwn(t,o))delete t[o],n=!0;let r=t.env;if(Qre(r)&&Object.hasOwn(r,"CLAUDE_CONFIG_DIR"))delete r.CLAUDE_CONFIG_DIR,n=!0;return n?me(t):e}function Qre(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}async function vst(e,t){if(!e)return;let n=e;try{let r=dt(e);if(r?.claudeAiOauth?.refreshToken)delete r.claudeAiOauth.refreshToken,n=me(r)}catch{}await roe(t,n,{mode:384})}function wst(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=j9(z9);return new Promise((t)=>{dst("security",["find-generic-password","-a",H9(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(n,r)=>t(n?void 0:r.trim()||void 0))})}async function ioe(e,t,n,r,o=60000,s){if(!ct(t))return;let i=ro(n,r),a=await Kr(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!a||a.length===0)return;let c=Gt(_st(),`claude-resume-${T0()}`);try{let l=Gt(c,"projects",i);await v0(l,{recursive:!0,mode:448});let u=Gt(l,`${t}.jsonl`);await pm(u,a);let p=r?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=p??Gt(w0(),".claude"),m;try{m=await noe(Gt(f,".credentials.json"),"utf-8")}catch(v){if(!bn(v))throw v}if(!p&&!(r??process.env).ANTHROPIC_API_KEY&&!(r??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await wst()??m;await vst(m,Gt(c,".credentials.json"));let h=$9(xn.CLAUDE_CONFIG_DIR),g=p||w0(),y=Gt(g,".claude.json");await Uu(y,Gt(c,".claude.json"),void 0,AI(s,y,h.globalConfig,on.globalConfig())),await Uu(Gt(f,".config.json"),Gt(c,".config.json"));for(let v of Gz)if(v)await Uu(Gt(g,`.claude${v}.json`),Gt(c,`.claude${v}.json`));let E=Gt(f,"settings.json");if(await Uu(E,Gt(c,"settings.json"),Xre,AI(s,E,h.userSettings,on.userSettings())),await Uu(Gt(f,"cowork_settings.json"),Gt(c,"cowork_settings.json"),Xre),e.listSubkeys)await Ast(e,{projectKey:i,sessionId:t},Gt(l,t),o);return c}catch(l){throw await fx(c),l}}async function Ast(e,t,n,r){let o=await Kr(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),r,`SessionStore.listSubkeys() timed out after ${r}ms for session ${t.sessionId}`);for(let s of o){let i=Bh(n,s+".jsonl");if(!s||ooe(s)||s.split(/[\\/]/).includes("..")||!i.startsWith(n+R0)){ie(`[SessionStore] skipping unsafe subpath from listSubkeys: ${s}`,{level:"warn"});continue}let a=await Kr(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:s}),r,`SessionStore.load() timed out after ${r}ms for session ${t.sessionId} subpath ${s}`);if(!a||a.length===0)continue;let c=[],l=[];for(let u of a)if(C0(u))c.push(u);else l.push(u);if(l.length>0)await v0(A0(i),{recursive:!0}),await pm(i,l);if(c.length>0){let u=c.at(-1),p=Bh(n,s+".meta.json");await v0(A0(p),{recursive:!0});let{type:f,...m}=u;await roe(p,me(m),{mode:384})}}}function k0(e,t){let{isSingleUserTurn:n,resumeConfigDir:r,deferSpawn:o}=t,{systemPrompt:s,settings:i,managedSettings:a,settingSources:c,sandbox:l,...u}=e??{},p,f,m,h;if(s===void 0)p="";else if(typeof s==="string")p=s;else if(Array.isArray(s))p=s;else if(s.type==="custom")p=s.prompt,h=s.snapshot;else if(s.type==="preset")f=s.append,m=s.excludeDynamicSections,h=s.snapshot;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.276";let{abortController:g=Qp(),additionalDirectories:y=[],projectConfigRoot:E,agent:v,agents:S,allowedTools:x=[],betas:w,canUseTool:I,continue:O,cwd:z,debug:N,debugFile:V,disallowedTools:X=[],tools:ee,env:fe,executable:te=Il()?"bun":"node",executableArgs:nt=[],extraArgs:De={},fallbackModel:Dt,enableFileCheckpointing:Oe,toolConfig:q,forkSession:Rn,hooks:vt,includeHookEvents:ae,includePartialMessages:re,forwardSubagentText:Fe,onElicitation:ht,onUserDialog:Ye,supportedDialogKinds:he,perTaskStopAffordance:$t,rapidFollowupPreempt:He,workspaceTrust:an,persistSession:Uo,sessionStore:rt,sessionStoreFlush:ta,thinking:bd,effort:foe,maxThinkingTokens:hx,maxTurns:moe,maxBudgetUsd:hoe,taskBudget:goe,mcpServers:P0,model:_oe,outputFormat:I0,permissionMode:yoe,allowDangerouslySkipPermissions:Soe=!1,permissionPromptToolName:boe,permissionPrompts:Eoe,plugins:Kh,pluginDelivery:gx="argv",getOAuthToken:D0,getHostAuthToken:L0,workload:M0,resume:N0,resumeSessionAt:xoe,resumeDropsTurn:voe,sessionId:woe,skills:U0,stderr:Aoe,strictMcpConfig:Coe}=u,F0=yoe??(e?.resolvePermissionModeInCli?void 0:"default");if(rt&&Uo===!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(he!==void 0&&he.length>0&&!Ye)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");let $0=an?.accepted===!0&&(typeof an.directory!=="string"||!(yst.isAbsolute(an.directory)||Sst.isAbsolute(an.directory)))?void 0:an;if(an!==void 0&&$0===void 0)ie("workspaceTrust ignored: accepted requires an absolute directory, as it exists where Claude Code runs",{level:"warn"});if(rt&&O&&!N0&&!rt.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(rt&&Oe)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(rt&&u.spawnClaudeCodeProcess)ie("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"});if(K9(!!I,F0??"default",x),gx!=="argv"&&gx!=="initialize")throw Error("Invalid pluginDelivery. Expected 'argv' or 'initialize'.");let z0=gx==="initialize"&&Kh!==void 0&&Kh.length>0,_x=u.pathToClaudeCodeExecutable;if(!_x){let Nn=Est(import.meta.url),Zn=gst(Nn),Fo=KG((Pc)=>Zn.resolve(Pc));if(!Fo)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.`);_x=Fo}let j0=I0?.type==="json_schema"?I0.schema:void 0,cn=fe?{...fe}:{...process.env};if(!cn.CLAUDE_CODE_ENTRYPOINT)cn.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!cn.CLAUDE_AGENT_SDK_VERSION)cn.CLAUDE_AGENT_SDK_VERSION="0.3.276";if(Oe)cn.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(D0)cn.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(L0)cn.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(q?.askUserQuestion?.previewFormat)cn.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=q.askUserQuestion.previewFormat;for(let[Nn,Zn]of[[q?.askUserQuestion?.extendedQuestions,"CLAUDE_CODE_QUESTION_EXTENDED"],[q?.askUserQuestion?.optionalDescriptions,"CLAUDE_CODE_QUESTION_OPTIONAL_DESCRIPTIONS"]])if(Nn)cn[Zn]="1";else if(!fe){for(let Fo of Object.keys(cn))if(Fo.toUpperCase()===Zn)delete cn[Fo]}let yx={};if(mx.propagation.inject(mx.context.active(),yx),"traceparent"in yx){for(let Nn of["TRACEPARENT","TRACESTATE"])if(!(Nn in(fe??{})))delete cn[Nn]}for(let[Nn,Zn]of Object.entries(yx)){let Fo=Nn.toUpperCase();if(!(Fo in(fe??{})))cn[Fo]=Zn}let H0={},B0=new Map;if(P0)for(let[Nn,Zn]of Object.entries(P0))if(Zn.type==="sdk"&&Zn.instance)B0.set(Nn,Zn);else H0[Nn]=Zn;let Ed;if(bd)switch(bd.type){case"adaptive":Ed={type:"adaptive",display:bd.display};break;case"enabled":Ed={type:"enabled",budgetTokens:bd.budgetTokens,display:bd.display};break;case"disabled":Ed={type:"disabled"};break}else if(hx!==void 0)Ed=hx===0?{type:"disabled"}:{type:"enabled",budgetTokens:hx};if(r){if(cn.CLAUDE_CONFIG_DIR=r,process.platform==="win32")cn.CLAUDE_SECURESTORAGE_CONFIG_DIR=fe?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??fe?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let K0=new OR({abortController:g,additionalDirectories:y,projectConfigRoot:E,agent:v,betas:w,cwd:z,debug:N,debugFile:V,executable:te,executableArgs:nt,extraArgs:M0?{...De,workload:M0}:De,pathToClaudeCodeExecutable:_x,env:cn,forkSession:Rn,stderr:Aoe,thinkingConfig:Ed,effort:foe,maxTurns:moe,maxBudgetUsd:hoe,taskBudget:goe,model:_oe,fallbackModel:Dt,jsonSchema:j0,permissionMode:F0,allowDangerouslySkipPermissions:Soe,permissionPromptToolName:boe,permissionPrompts:Eoe,continueConversation:rt?void 0:O,resume:N0,resumeSessionAt:xoe,resumeDropsTurn:voe,sessionId:woe,settings:typeof i==="object"?me(i):i,managedSettings:a?me(a):void 0,settingSources:c,skills:U0,allowedTools:x,disallowedTools:X,tools:ee,mcpServers:H0,strictMcpConfig:Coe,canUseTool:!!I,hooks:!!vt,includeHookEvents:ae,includePartialMessages:re,persistSession:Uo,sessionMirror:!!rt,plugins:Kh,pluginsViaInitialize:z0,sandbox:l,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),Toe={systemPrompt:p,appendSystemPrompt:f,planModeInstructions:u.planModeInstructions,systemPromptSnapshot:h,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:m,agents:S,title:u.title,skills:U0,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:Fe,supportedDialogKinds:he,perTaskStopAffordance:$t,rapidFollowupPreempt:He,workspaceTrust:$0,plugins:z0?Kh:void 0},Sx=new nS(K0,n,I,vt,g,B0,j0,Toe,ht,D0,L0,Ye);if(rt){let Nn=()=>Gt(cn.CLAUDE_CONFIG_DIR??Gt(w0(),".claude"),"projects"),Zn=ta==="eager",Fo=new LR(async(Pc,bx)=>{let xd=toe(Pc,Nn());if(xd)await rt.append(xd,bx);else ie(`[SessionStore] dropping mirror frame: filePath ${Pc} is not under ${Nn()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(Pc,bx)=>{let xd=toe(Pc,Nn());if(xd)Sx.reportMirrorError(xd,bx.message)},maxPendingEntries:Zn?0:rS,maxPendingBytes:Zn?0:Su});Sx.setTranscriptMirrorBatcher(Fo)}return{queryInstance:Sx,transport:K0,abortController:g,processEnv:cn}}function O0(e,t,n,r){if(typeof n==="string")t.write(me({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:n}]},parent_tool_use_id:null})+`
|
|
229
229
|
`);else e.streamInput(n).catch((o)=>r.abort(o))}var Cst=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function fx(e){for(let t=0;;t++)try{return await hst(e,{recursive:!0,force:!0})}catch(n){if(t>=4||!Cst.has(xe(n)??""))return;await Br((t+1)*100)}}function Tst(e,t){e.waitForExit().catch(()=>{}).finally(()=>fx(t))}function a7t({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore)return Rst(e,t);let{queryInstance:n,transport:r,abortController:o}=k0(t,{isSingleUserTurn:typeof e==="string"});return O0(n,r,e,o),n}function Rst(e,t){let{queryInstance:n,transport:r,abortController:o,processEnv:s}=k0({...t},{isSingleUserTurn:typeof e==="string",deferSpawn:!0}),i=Bh(t.cwd??"."),a=t.sessionStore,c=t.loadTimeoutMs??60000,l=t.resume;return(async()=>{if(!l)l=(await Kr(a.listSessions(ro(i,t.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((f,m)=>m.mtime-f.mtime)[0]?.sessionId;if(!l)return;return ioe(a,l,i,t.env,t.loadTimeoutMs)})().then((p)=>{if(p){r.updateResume(l);let f={CLAUDE_CONFIG_DIR:p};if(process.platform==="win32"){let m=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";f.CLAUDE_SECURESTORAGE_CONFIG_DIR=m,s.CLAUDE_SECURESTORAGE_CONFIG_DIR=m}r.updateEnv(f),s.CLAUDE_CONFIG_DIR=p,n.addCleanupCallback(()=>Tst(r,p))}if(!n.isClosed())r.spawn()}).catch((p)=>{let f=vr(p);r.spawnAbort(f),n.setError(f)}),O0(n,r,e,o),n}async function c7t({options:e,initializeTimeoutMs:t=60000}={}){let n,r=e?.resume;if((r||e?.continue)&&e?.sessionStore){let a=Bh(e.cwd??".");if(!r){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;r=(await Kr(e.sessionStore.listSessions(ro(a,e.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((u,p)=>p.mtime-u.mtime)[0]?.sessionId}if(r)n=await ioe(e.sessionStore,r,a,e.env,e.loadTimeoutMs)}let o,s,i;try{let m=function(){if(f)return;f=!0,u.close()},a=k0(n&&r&&r!==e?.resume?{...e,resume:r}:e,{isSingleUserTurn:!1,resumeConfigDir:n});o=a.queryInstance;let{transport:c,abortController:l}=a;s=c;let u=a.queryInstance;if(n){let h=n;u.addCleanupCallback(()=>{i=c.waitForExit().catch(()=>{}).then(()=>fx(h))})}let p=`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`;await Kr(u.initializationResult(),t,p).catch((h)=>{throw d1(h,p)?Pn(h,{telemetryMessage:`Subprocess initialization did not complete within ${t}ms`,errorClass:"initialize_timeout"}):h});let f=!1;return{query(h){if(f)throw Error("WarmQuery.query() can only be called once");f=!0;try{O0(u,c,h,l)}catch(g){throw u.close(),g}if(typeof h==="string")u.setIsSingleUserTurn(!0);return u},close:m,async[Symbol.asyncDispose](){f=!0,u.close(),await i}}}catch(a){if(o?.close(),n&&!i){let c=s;i=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>fx(n))}throw await i,a}}async function l7t(e,t){if(t?.sessionStore)return Dst(t.sessionStore,e,t);return WZ(e,t)}async function u7t(e){if(e?.sessionStore)return Ost(e.sessionStore,e);return i9(e)}async function d7t(e,t){if(t?.sessionStore)return Lst(t.sessionStore,e,t);return a9(e,t)}async function p7t(e,t,n){if(n?.sessionStore)return Mst(n.sessionStore,e,t,n.dir);return p9(e,t,n)}async function f7t(e,t,n){if(n?.sessionStore)return Nst(n.sessionStore,e,t,n.dir);return f9(e,t,n)}async function m7t(e,t){if(!ct(e))throw new Je(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=ro(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return m9(e,t)}async function h7t(e,t){if(t?.sessionStore)return Ust(t.sessionStore,e,t);return b9(e,t)}async function g7t(e,t,n,r){if(!ct(e))throw new Je(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let o=Se(),s=o?r:void 0,i=await Pi(e,n?.dir,lr(s),o);if(!i)throw Error(`Session ${e} not found`);let a=ro(n?.dir),c=n?.batchSize&&n.batchSize>0?n.batchSize:rS,l=s===void 0?void 0:tc(A0(i.filePath),hn),u=s!==void 0&&l!==void 0?{backend:s,projectKey:l}:void 0;if(u!==void 0)await vI(u.backend,on.transcript(u.projectKey,e),{projectKey:a,sessionId:e},t,c);else await eoe(i.filePath,{projectKey:a,sessionId:e},t,c);if(n?.includeSubagents===!1)return;if(u!==void 0){let m=await L9(u.backend,u.projectKey,e),h=await M9(u.backend,u.projectKey,e,m);for(let g of m){let y={projectKey:a,sessionId:e,subpath:rb(g)};await vI(u.backend,g.kind==="agent"?on.transcript(u.projectKey,e,g.agentId,g.agentRelPath):on.journal(u.projectKey,e,g.agentRelPath),y,t,c);let E=h.get(y.subpath),v;if(E!==void 0)try{v=dt(E)}catch(S){ie(`importSessionToStore: skipping unreadable sidecar for ${y.subpath}: ${S}`)}if(v!==void 0)await t.append(y,[{type:"agent_metadata",...v}])}return}let p=i.filePath.replace(/\.jsonl$/,""),f=Gt(p,"subagents");for(let m of await kst(f)){let h=soe(p,m).split(R0);h[h.length-1]=h.at(-1).replace(/\.jsonl$/,"");let g={projectKey:a,sessionId:e,subpath:h.join("/")};await eoe(m,g,t,c);let y=m.replace(/\.jsonl$/,".meta.json"),E;try{E=dt(await noe(y,"utf8"))}catch(v){if(!bn(v))ie(`importSessionToStore: skipping unreadable sidecar ${y}: ${v}`)}if(E!==void 0)await t.append(g,[{type:"agent_metadata",...E}])}}async function eoe(e,t,n,r){let o=bst({input:pst(e,{encoding:"utf8"}),crlfDelay:1/0}),s=[],i=0;for await(let a of o){if(!a)continue;try{s.push(dt(a))}catch(c){ie(`importSessionToStore: skipping unparseable line in ${e}: ${c}`);continue}if(i+=a.length,s.length>=r||i>=Su)await n.append(t,s),s=[],i=0}if(s.length>0)await n.append(t,s)}async function kst(e){let t=[];async function n(r){let o;try{o=await mst(r,{withFileTypes:!0})}catch{return}for(let s of o){let i=Gt(r,s.name);if(s.isDirectory())await n(i);else if(s.isFile()&&s.name.endsWith(".jsonl"))t.push(i)}}return await n(e),t}async function _7t(e,t){if(t?.sessionStore)return Fst(t.sessionStore,e,t.dir);return O9(e,t)}async function y7t(e,t,n){if(n?.sessionStore)return $st(n.sessionStore,e,t,n);return P9(e,t,n)}function aoe(e){let t=Bh(e??"."),n;try{n=fst(t)}catch{n=t}return it(n)}function ro(e,t){let n=aoe(e);if(t===void 0)return Is(n);return(t.CLAUDE_CONFIG_DIR?XA(t.CLAUDE_CODE_PROJECT_DIR_NAME):void 0)??fm(n)}function coe(e){return e.map((t)=>me(t)).join(`
|
|
230
230
|
`)+`
|
|
231
231
|
`}function loe(e,t,n){if(t!==void 0&&t>0)return e.slice(n,n+t);if(n>0)return e.slice(n);return e}function C0(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function Ost(e,t){let n=aoe(t.dir),r=Is(n),o=t.offset??0,s=t.limit;if(e.listSessionSummaries)return Pst(e,r,n,t.dir,s,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(r)).slice().sort((l,u)=>u.mtime-l.mtime),c=loe(a,s,o);return uoe(e,c,t.dir,n)}async function Pst(e,t,n,r,o,s){let i=await e.listSessionSummaries(t),a=e.listSessions?new Map((await e.listSessions(t)).map((p)=>[p.sessionId,p])):void 0,c=[];for(let p of i){let f=a?.get(p.sessionId);if(a&&!f)continue;let m=f!==void 0&&p.mtime<f.mtime;c.push({sessionId:p.sessionId,mtime:m?f.mtime:p.mtime,info:m?void 0:K1(p,n)})}if(a){let p=new Set(i.map((f)=>f.sessionId));for(let[f,m]of a)if(!p.has(f))c.push({sessionId:f,mtime:m.mtime})}else ie("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");c.sort((p,f)=>f.mtime-p.mtime);let l=loe(c,o,s),u=l.filter((p)=>p.info===void 0);if(u.length>0){let p=await uoe(e,u,r,n),f=new Map(p.map((m)=>[m.sessionId,m]));for(let m of l)if(m.info===void 0)m.info=f.get(m.sessionId)??null}return l.flatMap((p)=>p.info?[p.info]:[])}async function uoe(e,t,n,r){return(await Promise.allSettled(t.map(async(s)=>{let i=await poe(e,s.sessionId,n);if(!i)return null;let a=Nu(s.sessionId,doe(i,s.mtime),r);return a?{...a,lastModified:s.mtime}:null}))).flatMap((s,i)=>{let a=t[i];if(s.status==="fulfilled")return s.value?[s.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function doe(e,t){let n=Buffer.from(e,"utf-8"),r=n.length,o=n.subarray(0,jn).toString("utf-8"),s=r>jn?n.subarray(r-jn).toString("utf-8"):o;return{mtime:t,size:r,head:o,tail:s}}function Ist(e){let t=e.trimEnd(),n=t.slice(t.lastIndexOf(`
|