@reddb-io/red-skills 4.1.19 → 4.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code-nav.bundle.min.mjs +1 -1
- package/dist/opencode-host.bundle.min.mjs +1 -1
- package/dist/redskilled-mcp.bundle.min.mjs +185 -185
- package/dist/redskilled.bundle.min.mjs +272 -266
- package/dist/release.bundle.min.mjs +2 -2
- package/dist/rsp-core.bundle.min.mjs +2 -2
- package/dist/rsp.bundle.min.mjs +1 -1
- package/package.json +1 -1
|
@@ -138,7 +138,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
138
138
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
139
139
|
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let s=t.items[t.items.length-2]?.value?.end;if(Array.isArray(s)){Hn(s,r.start),s.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let n=!this.onKeyLine&&this.indent===t.indent,s=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&r.sep&&!r.value){let o=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(i.push(this.sourceToken),t.items.push({start:i}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):s||r.value?(i.push(this.sourceToken),t.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(qe(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(ap(r.key)&&!qe(r.sep,"newline")){let o=vt(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?r.sep=r.sep.concat(i,this.sourceToken):r.sep.push(this.sourceToken);else if(qe(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=vt(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?t.items.push({start:i,key:null,sep:[this.sourceToken]}):qe(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||r.value?(t.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!qe(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&t.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let s=t.items[t.items.length-2]?.value?.end;if(Array.isArray(s)){Hn(s,r.start),s.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||qe(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===t.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=Vn(n),i=vt(s);op(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
|
|
140
140
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
141
|
-
`,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Vn(t),n=vt(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Vn(t),n=vt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};cp.Parser=Io});var fp=P(ur=>{"use strict";var lp=To(),xE=tr(),lr=sr(),IE=bi(),NE=L(),LE=xo(),up=No();function dp(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new LE.LineCounter||null,prettyErrors:t}}function qE(e,t={}){let{lineCounter:r,prettyErrors:n}=dp(t),s=new up.Parser(r?.addNewLine),i=new lp.Composer(t),o=Array.from(i.compose(s.parse(e)));if(n&&r)for(let a of o)a.errors.forEach(lr.prettifyError(e,r)),a.warnings.forEach(lr.prettifyError(e,r));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function pp(e,t={}){let{lineCounter:r,prettyErrors:n}=dp(t),s=new up.Parser(r?.addNewLine),i=new lp.Composer(t),o=null;for(let a of i.compose(s.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new lr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(lr.prettifyError(e,r)),o.warnings.forEach(lr.prettifyError(e,r))),o}function DE(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let s=pp(e,r);if(!s)return null;if(s.warnings.forEach(i=>IE.warn(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function FE(e,t,r){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(e===void 0){let{keepUndefined:s}=r??t??{};if(!s)return}return NE.isDocument(e)&&!n?e.toString(r):new xE.Document(e,n,r).toString(r)}ur.parse=DE;ur.parseAllDocuments=qE;ur.parseDocument=pp;ur.stringify=FE});var qo=P(q=>{"use strict";var jE=To(),BE=tr(),UE=eo(),Lo=sr(),ME=Ft(),De=L(),VE=xe(),HE=U(),KE=Ne(),WE=Le(),zE=Un(),JE=Co(),YE=xo(),QE=No(),Kn=fp(),hp=Nt();q.Composer=jE.Composer;q.Document=BE.Document;q.Schema=UE.Schema;q.YAMLError=Lo.YAMLError;q.YAMLParseError=Lo.YAMLParseError;q.YAMLWarning=Lo.YAMLWarning;q.Alias=ME.Alias;q.isAlias=De.isAlias;q.isCollection=De.isCollection;q.isDocument=De.isDocument;q.isMap=De.isMap;q.isNode=De.isNode;q.isPair=De.isPair;q.isScalar=De.isScalar;q.isSeq=De.isSeq;q.Pair=VE.Pair;q.Scalar=HE.Scalar;q.YAMLMap=KE.YAMLMap;q.YAMLSeq=WE.YAMLSeq;q.CST=zE;q.Lexer=JE.Lexer;q.LineCounter=YE.LineCounter;q.Parser=QE.Parser;q.parse=Kn.parse;q.parseAllDocuments=Kn.parseAllDocuments;q.parseDocument=Kn.parseDocument;q.stringify=Kn.stringify;q.visit=hp.visit;q.visitAsync=hp.visitAsync});import{readFileSync as ef}from"node:fs";import{join as tf,resolve as ta}from"node:path";function Ta(e){let t={app:e,version:bf(it("__RED_BUILD_VERSION__",()=>"4.1.19")??"0.0.0-dev"),gitSha:it("__RED_BUILD_GIT_SHA__",()=>"7d51848b71f3dfbb8f9dd0943ab6877b190eb062")??"unknown",buildTime:it("__RED_BUILD_TIME__",()=>"2026-08-21T04:26:12-03:00")??"unknown",bundleAsset:it("__RED_BUNDLE_ASSET__",()=>"release.bundle.min.mjs")??"unknown"},r=it("__REDDB_SDK_VERSION__",()=>""),n=it("__REDDB_BINARY_TAG__",()=>"");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function bf(e){return e.startsWith("v")?e.slice(1):e}function _a(e){return`${e.app} ${e.version} ${e.gitSha}`}function it(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}function ka(e){return e==="single-object"?"rest":"graphql"}function va(e,t){return e==="stable-poll"?"rest":ka(t)}function Z(e){return{none:e}}function M(e,t,r,n,s,i,o){let a=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"read",cardinality:t,volatility:r,surface:o??va(r,t),budget:n,...a,...o?{only:o}:{},why:i}}function ee(e,t,r,n,s){let i=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"write",cardinality:"single-object",surface:t,budget:r,...i,why:n}}var Sa=[M("issue view","single-object","stable-poll","rest","graphql","one issue by number, repeatedly polled while usually unchanged; REST answers in one request"),M("pr view","single-object","stable-poll","rest","graphql","one pull request by number, polled per Worker per iteration"),M("repo view","single-object","stable-poll","rest","graphql","one repository's own metadata, repeatedly read while usually unchanged"),M("run view","single-object","stable-poll","rest",Z("Actions runs have no GraphQL resource"),"one Actions run repeatedly polled to terminal"),M("release view","single-object","stable-poll","rest",Z("release lookup has no GraphQL client method"),"one release by tag, repeatedly checked while usually absent or unchanged"),M("pr diff","single-object","one-shot","rest",Z("the complete diff is exposed as a REST media type"),"one pull request's diff, read once for review"),M("issue list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged issue collection; REST can make an unchanged poll free"),M("pr list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged pull-request collection; REST can make an unchanged poll free"),M("pr checks","multi-node","stable-poll","rest","graphql","check contexts are repeatedly polled while awaiting terminal state"),M("release list","multi-node","stable-poll","rest",Z("Releases has no GraphQL collection client method"),"release waits poll a usually-unchanged list"),M("run list","multi-node","stable-poll","rest",Z("Actions has no GraphQL collection client method"),"run waits poll a usually-unchanged list"),M("label list","multi-node","one-shot","graphql","rest","a label connection loaded once for the current operation"),M("issue list (search)","multi-node","stable-poll","search",Z("search is ineligible for diverted traffic"),"queue discovery polls usually-unchanged search results through the 30/min search connection"),M("pr list (search)","multi-node","stable-poll","search",Z("search is ineligible for diverted traffic"),"PR discovery polls usually-unchanged search results through the 30/min search connection"),M("search issues","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("search prs","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("search repos","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("api graphql","multi-node","one-shot","graphql",Z("the caller explicitly chose GraphQL"),"the caller supplies one explicit GraphQL query rather than a routed poll"),M("api rest","single-object","one-shot","rest",Z("the caller explicitly chose REST"),"the caller supplies one explicit REST path rather than a routed poll"),ee("issue create","rest","rest","the write plan POSTs to `repos/{o}/{r}/issues`; GraphQL exposes createIssue","graphql"),ee("issue edit","rest","rest","the write plan PATCHes labels and body; GraphQL exposes updateIssue","graphql"),ee("issue close","rest","rest","the write plan PATCHes issue state; GraphQL exposes closeIssue","graphql"),ee("issue reopen","graphql","graphql","gh uses reopenIssue; REST can PATCH the issue state to open","rest"),ee("issue comment","rest","rest","the write plan POSTs an issue comment; GraphQL exposes addComment","graphql"),ee("issue develop","graphql","graphql","linked-branch creation is a GraphQL mutation",Z("linked-branch creation has no REST mutation")),ee("pr create","rest","rest","the write plan POSTs a pull request; GraphQL exposes createPullRequest","graphql"),ee("pr comment","rest","rest","a pull request comment is an issue comment; GraphQL exposes addComment","graphql"),ee("pr merge","rest","rest","the default plan PUTs the merge; GraphQL exposes mergePullRequest","graphql"),ee("pr close","graphql","graphql","gh uses closePullRequest; REST can PATCH the pull request state","rest"),ee("pr edit","graphql","graphql","gh uses GraphQL mutations; REST can PATCH pull-request fields and issue labels","rest"),ee("pr ready","graphql","graphql","marking ready-for-review is a GraphQL mutation",Z("GitHub exposes no REST ready-for-review mutation")),ee("pr update-branch","rest","rest","the write plan PUTs update-branch; GraphQL exposes updatePullRequestBranch","graphql"),ee("label create","rest","rest","the write plan POSTs a label; GraphQL exposes createLabel","graphql")],q_=new Map(Sa.map(e=>[e.key,e]));var ss="RED_GITHUB_REQUEST_TIMEOUT_MS",ot=class extends Error{subject;timeoutMs;constructor(t,r,n){super(`GitHub ${t} passed its ${r}ms deadline and was abandoned; raise ${ss} if this host is genuinely this slow`,n),this.name="GithubTimeoutError",this.subject=t,this.timeoutMs=r}};function Ra(e){return e instanceof ot}function _r(e=process.env){let t=e[ss];if(t===void 0||t.trim()==="")return 3e4;let r=Number(t);return!Number.isFinite(r)||r<0?3e4:Math.trunc(r)}async function kr(e,t,r){if(!Number.isFinite(t)||t<=0)return await r();let n,s=new Promise((o,a)=>{n=setTimeout(()=>a(new ot(e,t)),t),n.unref?.()}),i=Promise.resolve().then(r);i.catch(()=>{});try{return await Promise.race([i,s])}finally{n!==void 0&&clearTimeout(n)}}function is(e={}){let t=e.fetchImpl??fetch,r=e.timeoutMs??_r();return!Number.isFinite(r)||r<=0?t:async(n,s)=>{let i=AbortSignal.timeout(r),o=s?.signal??null,a=o==null?i:AbortSignal.any([o,i]),c=wf(n);try{return await kr(c,r,async()=>await t(n,{...s??{},signal:a}))}catch(l){throw Ra(l)?l:i.aborted&&o?.aborted!==!0?new ot(c,r,{cause:l}):l}}}function wf(e){let t=typeof e=="string"?e:e instanceof URL?e.href:typeof e.url=="string"?e.url:"request";try{return new URL(t).pathname}catch{return t}}var vr="off";var Aa="RED_GITHUB_BUDGET_GATE";function Ga(e){if(e===!0)return"on";if(typeof e!="string")return vr;let t=e.trim().toLowerCase();return t==="on"||t==="enabled"||t==="true"?"on":vr}function os(e){return(e??vr)==="on"}function as(e=process.env){return Ga(e[Aa])}import{execFile as Yf}from"node:child_process";import{promisify as Qf}from"node:util";var at=class extends SyntaxError{line;source;reason;constructor(t,r,n={}){super(t===0?r:`line ${t}: ${r}`,n.cause===void 0?void 0:{cause:n.cause}),this.name="ToonError",this.line=t,this.source=n.source,this.reason=r}};function ve(e,t,r={}){return new at(e,t,r)}var Ef=/(?:^\uFEFF?|\n) *#/,cs=class{value;constructor(t){if(Ef.test(t))throw new TypeError(`Raw string must not contain a line starting with "#": ${JSON.stringify(t)}`);this.value=t}};function Me(e){return e instanceof cs}function Tf(e){return/^[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/.test(e)}function _f(e){if(Object.is(e,-0))return"0";if(!Number.isFinite(e))throw ve(0,"number is not representable in TOON");return String(e)}function Sr(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"}function te(e,t){if(Me(e))return e.value;if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return _f(e);if(typeof e=="string")return vf(e,t);throw ve(0,"not a primitive")}function kf(e){return/^[A-Za-z_][A-Za-z0-9_.]*$/.test(e)}function X(e){return kf(e)?e:Rr(e)}function vf(e,t){return ls(e,t)?Rr(e):e}function ls(e,t){return e===""||/^[ \t]|[ \t]$/.test(e)||e==="true"||e==="false"||e==="null"||Tf(e)||/[:"\\[\]{}]/.test(e)||/[\u0000-\u001f]/.test(e)||e.includes(t)||e.startsWith("-")||e.startsWith("#")}var Oa=/["\\\u0000-\u001f]/g;function Rr(e){return`"${Pa(e)}"`}function Pa(e){let t="",r=0;Oa.lastIndex=0;let n;for(;(n=Oa.exec(e))!==null;){let s=e.charCodeAt(n.index),i;s===34?i='\\"':s===92?i="\\\\":s===10?i="\\n":s===13?i="\\r":s===9?i="\\t":i=`\\u${s.toString(16).padStart(4,"0")}`,t+=e.slice(r,n.index)+i,r=n.index+1}return`${t}${e.slice(r)}`}var Ca={comma:",",tab:" ",pipe:"|"},Sf=Ca.comma;var Ar=1e3,$a=["type","kind","event"],Ve="|";var tk=Symbol("need line");var Of=/[\uD800-\uDFFF]/;function be(e){if(e===null)return null;if(Me(e))return e;if(typeof e=="object"&&e!==null&&"toJSON"in e&&typeof e.toJSON=="function"){let t=e.toJSON();if(t!==e)return be(t)}if(typeof e=="string")return Na(e,"string value"),e;if(typeof e=="boolean")return e;if(typeof e=="number")return Object.is(e,-0)?0:Number.isFinite(e)?e:null;if(typeof e=="bigint")return e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER?Number(e):e.toString();if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(be);if(e instanceof Set)return Array.from(e,be);if(e instanceof Map){let t={};for(let[r,n]of e)Gt(t,String(r),be(n));return t}if(J(e)){let t={};for(let r of Object.keys(e))Na(r,"object key"),Gt(t,r,be(e[r]));return t}return null}function Na(e,t){if(Of.test(e))for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n<55296||n>57343)continue;let s=e.charCodeAt(r+1);if(n<=56319&&s>=56320&&s<=57343){r+=1;continue}throw new TypeError(`Cannot encode ${t} containing an unpaired surrogate U+${n.toString(16).toUpperCase()} at index ${r}`)}}function J(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function le(e){return e===null||Me(e)||["string","number","boolean"].includes(typeof e)}function Gt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function La(e){return encodeURIComponent(e)}function Da(e){if(!J(e))return;let t=Object.entries(e);if(t.length===0)return;let r=[];for(let[s,i]of t){let o=Cf(i);if(o===void 0)return;r.push([s,o])}let n=[];for(let[s,i]of r)Nf(n,s,i);return n.join("")}function Cf(e){if(!Array.isArray(e)||e.length===0||!e.every(J))return;let t=$f(e);if(t===void 0)return;let r=e.map(a=>a[t]),n=xf(r);if(n===void 0)return;let s=If(e,t),i=new Map;for(let a of e){let c=a[t];i.has(c)||i.set(c,[]);let l={};for(let[d,p]of Object.entries(a))if(d!==t&&!s.includes(d)&&!us(p,d,l))return;i.get(c).push(l)}let o=[];for(let a of n.cycle){let c=i.get(a),l=qf(c);if(l===void 0||l.length===0)return;o.push({fields:l,label:a,rows:c})}return{common:s,commonRows:e.map(a=>Object.fromEntries(s.map(c=>[c,a[c]]))),discriminator:t,groups:o,order:n,rows:e}}function $f(e){return $a.find(t=>e.every(r=>typeof r[t]=="string"))}function xf(e){if(!(e.length<12))for(let t=2;t<=Math.min(8,Math.floor(e.length/3));t+=1){if(e.length%t!==0)continue;let r=e.slice(0,t);if(new Set(r).size<2||!e.every((o,a)=>o===r[a%t]))continue;let n=e.length/t;if(n<3)continue;let s=e.map(La).join(","),i=`cycle(${r.map(La).join(",")})*${n}`;if(i.length<=s.length*.4)return{cycle:r,encoded:i,repeats:n}}}function If(e,t){let r=[],n=Object.keys(e[0]),s=n.indexOf(t)+1;for(let i of n.slice(s).filter(o=>o!==t)){if(!Lf(i)||!e.every(o=>Object.prototype.hasOwnProperty.call(o,i))||!e.every(o=>Sr(o[i])))break;r.push(i)}return r}function Nf(e,t,r){e.push(X(t),`:
|
|
141
|
+
`,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Vn(t),n=vt(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Vn(t),n=vt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};cp.Parser=Io});var fp=P(ur=>{"use strict";var lp=To(),xE=tr(),lr=sr(),IE=bi(),NE=L(),LE=xo(),up=No();function dp(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new LE.LineCounter||null,prettyErrors:t}}function qE(e,t={}){let{lineCounter:r,prettyErrors:n}=dp(t),s=new up.Parser(r?.addNewLine),i=new lp.Composer(t),o=Array.from(i.compose(s.parse(e)));if(n&&r)for(let a of o)a.errors.forEach(lr.prettifyError(e,r)),a.warnings.forEach(lr.prettifyError(e,r));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function pp(e,t={}){let{lineCounter:r,prettyErrors:n}=dp(t),s=new up.Parser(r?.addNewLine),i=new lp.Composer(t),o=null;for(let a of i.compose(s.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new lr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(lr.prettifyError(e,r)),o.warnings.forEach(lr.prettifyError(e,r))),o}function DE(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let s=pp(e,r);if(!s)return null;if(s.warnings.forEach(i=>IE.warn(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function FE(e,t,r){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(e===void 0){let{keepUndefined:s}=r??t??{};if(!s)return}return NE.isDocument(e)&&!n?e.toString(r):new xE.Document(e,n,r).toString(r)}ur.parse=DE;ur.parseAllDocuments=qE;ur.parseDocument=pp;ur.stringify=FE});var qo=P(q=>{"use strict";var jE=To(),BE=tr(),UE=eo(),Lo=sr(),ME=Ft(),De=L(),VE=xe(),HE=U(),KE=Ne(),WE=Le(),zE=Un(),JE=Co(),YE=xo(),QE=No(),Kn=fp(),hp=Nt();q.Composer=jE.Composer;q.Document=BE.Document;q.Schema=UE.Schema;q.YAMLError=Lo.YAMLError;q.YAMLParseError=Lo.YAMLParseError;q.YAMLWarning=Lo.YAMLWarning;q.Alias=ME.Alias;q.isAlias=De.isAlias;q.isCollection=De.isCollection;q.isDocument=De.isDocument;q.isMap=De.isMap;q.isNode=De.isNode;q.isPair=De.isPair;q.isScalar=De.isScalar;q.isSeq=De.isSeq;q.Pair=VE.Pair;q.Scalar=HE.Scalar;q.YAMLMap=KE.YAMLMap;q.YAMLSeq=WE.YAMLSeq;q.CST=zE;q.Lexer=JE.Lexer;q.LineCounter=YE.LineCounter;q.Parser=QE.Parser;q.parse=Kn.parse;q.parseAllDocuments=Kn.parseAllDocuments;q.parseDocument=Kn.parseDocument;q.stringify=Kn.stringify;q.visit=hp.visit;q.visitAsync=hp.visitAsync});import{readFileSync as ef}from"node:fs";import{join as tf,resolve as ta}from"node:path";function Ta(e){let t={app:e,version:bf(it("__RED_BUILD_VERSION__",()=>"4.1.21")??"0.0.0-dev"),gitSha:it("__RED_BUILD_GIT_SHA__",()=>"89d4b75fc2da8842313d36907b89e0bf872b3631")??"unknown",buildTime:it("__RED_BUILD_TIME__",()=>"2026-08-21T08:05:33-03:00")??"unknown",bundleAsset:it("__RED_BUNDLE_ASSET__",()=>"release.bundle.min.mjs")??"unknown"},r=it("__REDDB_SDK_VERSION__",()=>""),n=it("__REDDB_BINARY_TAG__",()=>"");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function bf(e){return e.startsWith("v")?e.slice(1):e}function _a(e){return`${e.app} ${e.version} ${e.gitSha}`}function it(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}function ka(e){return e==="single-object"?"rest":"graphql"}function va(e,t){return e==="stable-poll"?"rest":ka(t)}function Z(e){return{none:e}}function M(e,t,r,n,s,i,o){let a=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"read",cardinality:t,volatility:r,surface:o??va(r,t),budget:n,...a,...o?{only:o}:{},why:i}}function ee(e,t,r,n,s){let i=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"write",cardinality:"single-object",surface:t,budget:r,...i,why:n}}var Sa=[M("issue view","single-object","stable-poll","rest","graphql","one issue by number, repeatedly polled while usually unchanged; REST answers in one request"),M("pr view","single-object","stable-poll","rest","graphql","one pull request by number, polled per Worker per iteration"),M("repo view","single-object","stable-poll","rest","graphql","one repository's own metadata, repeatedly read while usually unchanged"),M("run view","single-object","stable-poll","rest",Z("Actions runs have no GraphQL resource"),"one Actions run repeatedly polled to terminal"),M("release view","single-object","stable-poll","rest",Z("release lookup has no GraphQL client method"),"one release by tag, repeatedly checked while usually absent or unchanged"),M("pr diff","single-object","one-shot","rest",Z("the complete diff is exposed as a REST media type"),"one pull request's diff, read once for review"),M("issue list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged issue collection; REST can make an unchanged poll free"),M("pr list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged pull-request collection; REST can make an unchanged poll free"),M("pr checks","multi-node","stable-poll","rest","graphql","check contexts are repeatedly polled while awaiting terminal state"),M("release list","multi-node","stable-poll","rest",Z("Releases has no GraphQL collection client method"),"release waits poll a usually-unchanged list"),M("run list","multi-node","stable-poll","rest",Z("Actions has no GraphQL collection client method"),"run waits poll a usually-unchanged list"),M("label list","multi-node","one-shot","graphql","rest","a label connection loaded once for the current operation"),M("issue list (search)","multi-node","stable-poll","search",Z("search is ineligible for diverted traffic"),"queue discovery polls usually-unchanged search results through the 30/min search connection"),M("pr list (search)","multi-node","stable-poll","search",Z("search is ineligible for diverted traffic"),"PR discovery polls usually-unchanged search results through the 30/min search connection"),M("search issues","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("search prs","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("search repos","multi-repository","one-shot","search",Z("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),M("api graphql","multi-node","one-shot","graphql",Z("the caller explicitly chose GraphQL"),"the caller supplies one explicit GraphQL query rather than a routed poll"),M("api rest","single-object","one-shot","rest",Z("the caller explicitly chose REST"),"the caller supplies one explicit REST path rather than a routed poll"),ee("issue create","rest","rest","the write plan POSTs to `repos/{o}/{r}/issues`; GraphQL exposes createIssue","graphql"),ee("issue edit","rest","rest","the write plan PATCHes labels and body; GraphQL exposes updateIssue","graphql"),ee("issue close","rest","rest","the write plan PATCHes issue state; GraphQL exposes closeIssue","graphql"),ee("issue reopen","graphql","graphql","gh uses reopenIssue; REST can PATCH the issue state to open","rest"),ee("issue comment","rest","rest","the write plan POSTs an issue comment; GraphQL exposes addComment","graphql"),ee("issue develop","graphql","graphql","linked-branch creation is a GraphQL mutation",Z("linked-branch creation has no REST mutation")),ee("pr create","rest","rest","the write plan POSTs a pull request; GraphQL exposes createPullRequest","graphql"),ee("pr comment","rest","rest","a pull request comment is an issue comment; GraphQL exposes addComment","graphql"),ee("pr merge","rest","rest","the default plan PUTs the merge; GraphQL exposes mergePullRequest","graphql"),ee("pr close","graphql","graphql","gh uses closePullRequest; REST can PATCH the pull request state","rest"),ee("pr edit","graphql","graphql","gh uses GraphQL mutations; REST can PATCH pull-request fields and issue labels","rest"),ee("pr ready","graphql","graphql","marking ready-for-review is a GraphQL mutation",Z("GitHub exposes no REST ready-for-review mutation")),ee("pr update-branch","rest","rest","the write plan PUTs update-branch; GraphQL exposes updatePullRequestBranch","graphql"),ee("label create","rest","rest","the write plan POSTs a label; GraphQL exposes createLabel","graphql")],q_=new Map(Sa.map(e=>[e.key,e]));var ss="RED_GITHUB_REQUEST_TIMEOUT_MS",ot=class extends Error{subject;timeoutMs;constructor(t,r,n){super(`GitHub ${t} passed its ${r}ms deadline and was abandoned; raise ${ss} if this host is genuinely this slow`,n),this.name="GithubTimeoutError",this.subject=t,this.timeoutMs=r}};function Ra(e){return e instanceof ot}function _r(e=process.env){let t=e[ss];if(t===void 0||t.trim()==="")return 3e4;let r=Number(t);return!Number.isFinite(r)||r<0?3e4:Math.trunc(r)}async function kr(e,t,r){if(!Number.isFinite(t)||t<=0)return await r();let n,s=new Promise((o,a)=>{n=setTimeout(()=>a(new ot(e,t)),t),n.unref?.()}),i=Promise.resolve().then(r);i.catch(()=>{});try{return await Promise.race([i,s])}finally{n!==void 0&&clearTimeout(n)}}function is(e={}){let t=e.fetchImpl??fetch,r=e.timeoutMs??_r();return!Number.isFinite(r)||r<=0?t:async(n,s)=>{let i=AbortSignal.timeout(r),o=s?.signal??null,a=o==null?i:AbortSignal.any([o,i]),c=wf(n);try{return await kr(c,r,async()=>await t(n,{...s??{},signal:a}))}catch(l){throw Ra(l)?l:i.aborted&&o?.aborted!==!0?new ot(c,r,{cause:l}):l}}}function wf(e){let t=typeof e=="string"?e:e instanceof URL?e.href:typeof e.url=="string"?e.url:"request";try{return new URL(t).pathname}catch{return t}}var vr="off";var Aa="RED_GITHUB_BUDGET_GATE";function Ga(e){if(e===!0)return"on";if(typeof e!="string")return vr;let t=e.trim().toLowerCase();return t==="on"||t==="enabled"||t==="true"?"on":vr}function os(e){return(e??vr)==="on"}function as(e=process.env){return Ga(e[Aa])}import{execFile as Yf}from"node:child_process";import{promisify as Qf}from"node:util";var at=class extends SyntaxError{line;source;reason;constructor(t,r,n={}){super(t===0?r:`line ${t}: ${r}`,n.cause===void 0?void 0:{cause:n.cause}),this.name="ToonError",this.line=t,this.source=n.source,this.reason=r}};function ve(e,t,r={}){return new at(e,t,r)}var Ef=/(?:^\uFEFF?|\n) *#/,cs=class{value;constructor(t){if(Ef.test(t))throw new TypeError(`Raw string must not contain a line starting with "#": ${JSON.stringify(t)}`);this.value=t}};function Me(e){return e instanceof cs}function Tf(e){return/^[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/.test(e)}function _f(e){if(Object.is(e,-0))return"0";if(!Number.isFinite(e))throw ve(0,"number is not representable in TOON");return String(e)}function Sr(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"}function te(e,t){if(Me(e))return e.value;if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return _f(e);if(typeof e=="string")return vf(e,t);throw ve(0,"not a primitive")}function kf(e){return/^[A-Za-z_][A-Za-z0-9_.]*$/.test(e)}function X(e){return kf(e)?e:Rr(e)}function vf(e,t){return ls(e,t)?Rr(e):e}function ls(e,t){return e===""||/^[ \t]|[ \t]$/.test(e)||e==="true"||e==="false"||e==="null"||Tf(e)||/[:"\\[\]{}]/.test(e)||/[\u0000-\u001f]/.test(e)||e.includes(t)||e.startsWith("-")||e.startsWith("#")}var Oa=/["\\\u0000-\u001f]/g;function Rr(e){return`"${Pa(e)}"`}function Pa(e){let t="",r=0;Oa.lastIndex=0;let n;for(;(n=Oa.exec(e))!==null;){let s=e.charCodeAt(n.index),i;s===34?i='\\"':s===92?i="\\\\":s===10?i="\\n":s===13?i="\\r":s===9?i="\\t":i=`\\u${s.toString(16).padStart(4,"0")}`,t+=e.slice(r,n.index)+i,r=n.index+1}return`${t}${e.slice(r)}`}var Ca={comma:",",tab:" ",pipe:"|"},Sf=Ca.comma;var Ar=1e3,$a=["type","kind","event"],Ve="|";var tk=Symbol("need line");var Of=/[\uD800-\uDFFF]/;function be(e){if(e===null)return null;if(Me(e))return e;if(typeof e=="object"&&e!==null&&"toJSON"in e&&typeof e.toJSON=="function"){let t=e.toJSON();if(t!==e)return be(t)}if(typeof e=="string")return Na(e,"string value"),e;if(typeof e=="boolean")return e;if(typeof e=="number")return Object.is(e,-0)?0:Number.isFinite(e)?e:null;if(typeof e=="bigint")return e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER?Number(e):e.toString();if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(be);if(e instanceof Set)return Array.from(e,be);if(e instanceof Map){let t={};for(let[r,n]of e)Gt(t,String(r),be(n));return t}if(J(e)){let t={};for(let r of Object.keys(e))Na(r,"object key"),Gt(t,r,be(e[r]));return t}return null}function Na(e,t){if(Of.test(e))for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n<55296||n>57343)continue;let s=e.charCodeAt(r+1);if(n<=56319&&s>=56320&&s<=57343){r+=1;continue}throw new TypeError(`Cannot encode ${t} containing an unpaired surrogate U+${n.toString(16).toUpperCase()} at index ${r}`)}}function J(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function le(e){return e===null||Me(e)||["string","number","boolean"].includes(typeof e)}function Gt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function La(e){return encodeURIComponent(e)}function Da(e){if(!J(e))return;let t=Object.entries(e);if(t.length===0)return;let r=[];for(let[s,i]of t){let o=Cf(i);if(o===void 0)return;r.push([s,o])}let n=[];for(let[s,i]of r)Nf(n,s,i);return n.join("")}function Cf(e){if(!Array.isArray(e)||e.length===0||!e.every(J))return;let t=$f(e);if(t===void 0)return;let r=e.map(a=>a[t]),n=xf(r);if(n===void 0)return;let s=If(e,t),i=new Map;for(let a of e){let c=a[t];i.has(c)||i.set(c,[]);let l={};for(let[d,p]of Object.entries(a))if(d!==t&&!s.includes(d)&&!us(p,d,l))return;i.get(c).push(l)}let o=[];for(let a of n.cycle){let c=i.get(a),l=qf(c);if(l===void 0||l.length===0)return;o.push({fields:l,label:a,rows:c})}return{common:s,commonRows:e.map(a=>Object.fromEntries(s.map(c=>[c,a[c]]))),discriminator:t,groups:o,order:n,rows:e}}function $f(e){return $a.find(t=>e.every(r=>typeof r[t]=="string"))}function xf(e){if(!(e.length<12))for(let t=2;t<=Math.min(8,Math.floor(e.length/3));t+=1){if(e.length%t!==0)continue;let r=e.slice(0,t);if(new Set(r).size<2||!e.every((o,a)=>o===r[a%t]))continue;let n=e.length/t;if(n<3)continue;let s=e.map(La).join(","),i=`cycle(${r.map(La).join(",")})*${n}`;if(i.length<=s.length*.4)return{cycle:r,encoded:i,repeats:n}}}function If(e,t){let r=[],n=Object.keys(e[0]),s=n.indexOf(t)+1;for(let i of n.slice(s).filter(o=>o!==t)){if(!Lf(i)||!e.every(o=>Object.prototype.hasOwnProperty.call(o,i))||!e.every(o=>Sr(o[i])))break;r.push(i)}return r}function Nf(e,t,r){e.push(X(t),`:
|
|
142
142
|
`),e.push(" order: ",te(r.order.encoded,Ve),`
|
|
143
143
|
`),e.push(" discriminator: ",te(r.discriminator,Ve),`
|
|
144
144
|
`),e.push(" rows: ",String(r.rows.length),`
|
|
@@ -146,7 +146,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
146
146
|
`);for(let s of n)e.push(" ",r.map(i=>te(s[i],Ve)).join(Ve),`
|
|
147
147
|
`)}function Lf(e){return e!==""&&ds(e)}function us(e,t,r,n=new Set){if(!ds(t))return!1;if(Sr(e))return r[t]=e,!0;if(Array.isArray(e)){if(n.has(e))return!1;n.add(e),r[`${t}.length`]=e.length;let s=e.every((i,o)=>us(i,`${t}.${o}`,r,n));return n.delete(e),s}if(J(e)){if(n.has(e))return!1;n.add(e);let s=Object.entries(e).every(([i,o])=>!i.includes(".")&&us(o,`${t}.${i}`,r,n));return n.delete(e),s}return!1}function qf(e){let t=Object.keys(e[0]??{});if(e.every(r=>Df(Object.keys(r),t)))return t.every(ds)?t:void 0}function Df(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function ds(e){return e.split(".").every(t=>/^[A-Za-z_][A-Za-z0-9_]*$|^(?:0|[1-9][0-9]*)$/.test(t))}var bk=Symbol("unset");function Fa(e,t){let r=t("",e,[]);return r===void 0?ps(e,t,[]):fs(e,r,t,[])}function fs(e,t,r,n){return Me(t)&&(Array.isArray(e)||J(e))?ps(e,r,n):ps(be(t),r,n)}function ps(e,t,r){return Array.isArray(e)?Bf(e,t,r):J(e)?jf(e,t,r):e}function jf(e,t,r){let n={};for(let[s,i]of Object.entries(e)){let o=[...r,s],a=t(s,i,o);a!==void 0&&Gt(n,s,fs(i,a,t,o))}return n}function Bf(e,t,r){let n=[];for(let s=0;s<e.length;s+=1){let i=[...r,s],o=t(String(s),e[s],i);o!==void 0&&n.push(fs(e[s],o,t,i))}return n}function ct(e,t={}){if(t.objectArrayColumns===!0){let s=ja(e);if(s!==void 0)return[{name:"values",fixedLength:s,self:!0}]}let r=Object.keys(e[0]??{});if(r.length===0)return;for(let s of e)if(!J(s)||Object.keys(s).length!==r.length||r.some(i=>!Object.prototype.hasOwnProperty.call(s,i)))return;let n=[];for(let s of r){let i=e.map(a=>a[s]);if(i.every(le)){n.push({name:s});continue}if(t.primitiveArrayColumns===!0&&i.every(a=>Array.isArray(a)&&a.every(le))){n.push({name:s,listDelimiter:";"});continue}if(t.objectArrayColumns===!0&&i.every(Array.isArray)){let a=ja(i);if(a!==void 0){n.push({name:s,fixedLength:a});continue}let c=i.flat(),l=ct(c,t);if(l!==void 0){n.push({name:s,children:l,childTable:!0});continue}}if(!i.every(a=>J(a)&&Object.keys(a).length>0))return;let o=ct(i,t);if(o===void 0)return;n.push({name:s,children:o})}return n}function Gr(e,t={}){let r=Object.values(e);if(!(r.length<2)&&r.every(n=>J(n)&&Object.keys(n).length>0))return ct(r,t)}function ja(e){let t=Array.isArray(e[0])?e[0].length:0;if(t!==0)return e.every(r=>Array.isArray(r)&&r.length===t&&r.every(le))?t:void 0}function He(e,t={}){return Array.from(Ba(e,t)).join(`
|
|
148
148
|
`)}function Ba(e,t={}){let r=t.delimiter??",";if(![",","|"," "].includes(r))throw new TypeError("invalid delimiter");let n=t.indentSize??t.indent??2,s=t.maxDepth??Ar,i=s===Number.POSITIVE_INFINITY?0:Math.max(0,Math.floor(s)),o=be(e),a=t.replacer?Fa(o,t.replacer):o,c={delimiter:r,indentSize:n,maxDepth:i,primitiveArrayColumns:t.primitiveArrayColumns===!0,objectArrayColumns:t.objectArrayColumns===!0};if(t.cyclicDiscriminatedArrays===!0){let l=Da(a);if(l!==void 0)return l.trimEnd().split(`
|
|
149
|
-
`)}return Uf(a,c)}function Uf(e,t){if(le(e))return[te(e,t.delimiter)];if(Array.isArray(e))return Ma(void 0,e,0,t);let r=Gr(e,t);return r===void 0?Or(e,0,t):Ua(void 0,e,r,0,t)}function Or(e,t,r){return ut(t,r),Object.entries(e).flatMap(([n,s])=>Mf(n,s,t,r))}function Mf(e,t,r,n){let s=H(r,n)+X(e);if(le(t))return[`${s}: ${te(t,n.delimiter)}`];if(Array.isArray(t))return Ma(e,t,r,n);let i=Gr(t,n);if(i!==void 0)return Ua(e,t,i,r,n);let o=[`${s}:`];return Object.keys(t).length>0&&o.push(...Or(t,r+1,n)),o}function Ua(e,t,r,n,s){ut(n,s);let i=Object.entries(t);Ot(r,n+1,s);let o=[H(n,s)+pe(e,i.length,r,s.delimiter,!0)];for(let[a,c]of i){let l=lt(c,r,n+2,s);o.push(H(n+1,s)+X(a)+": "+l.cells),o.push(...l.children)}return o}function Ma(e,t,r,n){ut(r,n);let s=H(r,n);if(t.length===0)return[e===void 0?`${s}[]`:`${s}${X(e)}: []`];if(t.every(le))return[s+pe(e,t.length,void 0,n.delimiter)+" "+ms(t,n.delimiter)];let i=ct(t,n);if(i!==void 0)return Vf(e,t,i,r,n);let o=[s+pe(e,t.length,void 0,n.delimiter)];for(let a of t)o.push(...hs(a,r+1,n));return o}function Vf(e,t,r,n,s){Ot(r,n+1,s);let i=[H(n,s)+pe(e,t.length,r,s.delimiter)];for(let o of t){let a=lt(o,r,n+2,s);i.push(H(n+1,s)+a.cells),i.push(...a.children)}return i}function hs(e,t,r){ut(t,r);let n=H(t,r)+"-";if(le(e))return[`${n} ${te(e,r.delimiter)}`];if(Array.isArray(e)){if(e.length===0)return[`${n} ${pe(void 0,0,void 0,r.delimiter)}`];if(e.every(le))return[`${n} ${pe(void 0,e.length,void 0,r.delimiter)} ${ms(e,r.delimiter)}`];let s=[`${n} ${pe(void 0,e.length,void 0,r.delimiter)}`];for(let i of e)s.push(...hs(i,t+1,r));return s}return Hf(e,t,r)}function Hf(e,t,r){ut(t,r);let n=Object.entries(e);if(n.length===0)return[H(t,r)+"-"];let[[s,i],...o]=n,a=Kf(s,i,t,r),c;if(a!==void 0)c=a;else if(le(i))c=[H(t,r)+"- "+X(s)+": "+te(i,r.delimiter)];else if(Array.isArray(i))if(i.length===0)c=[H(t,r)+"- "+X(s)+": []"];else{c=[H(t,r)+"- "+pe(s,i.length,void 0,r.delimiter)];for(let l of i)c.push(...hs(l,t+2,r))}else c=[H(t,r)+"- "+X(s)+":"],Object.keys(i).length>0&&c.push(...Or(i,t+2,r));return o.length>0&&c.push(...Or(Object.fromEntries(o),t+1,r)),c}function Kf(e,t,r,n){if(Array.isArray(t)&&t.length>0&&t.every(le))return[H(r,n)+"- "+pe(e,t.length,void 0,n.delimiter)+" "+ms(t,n.delimiter)];if(Array.isArray(t)&&t.every(J)){let s=ct(t,n);if(s!==void 0){Ot(s,r+1,n);let i=[H(r,n)+"- "+pe(e,t.length,s,n.delimiter)];for(let o of t){let a=lt(o,s,r+3,n);i.push(H(r+2,n)+a.cells),i.push(...a.children)}return i}}if(J(t)){let s=Gr(t,n);if(s!==void 0){Ot(s,r+1,n);let i=Object.entries(t),o=[H(r,n)+"- "+pe(e,i.length,s,n.delimiter,!0)];for(let[a,c]of i){let l=lt(c,s,r+3,n);o.push(H(r+2,n)+X(a)+": "+l.cells),o.push(...l.children)}return o}}}function pe(e,t,r,n,s=!1){let i=e===void 0?"":X(e),o=s?":":"",a=n===","?"":n,c=r===void 0?"":`{${Va(r,n)}}`;return`${i}[${t}${o}${a}]${c}:`}function Va(e,t){return e.map(r=>{let n=X(r.name);if(r.listDelimiter!==void 0)return`${n}[${r.listDelimiter}]`;if(r.fixedLength!==void 0){let s=t===","?"":t;return`${n}[${r.fixedLength}${s}]`}return n+(r.children===void 0?"":`{${Va(r.children,t)}}`)}).join(t)}function lt(e,t,r,n){let s=[],i=[];for(let o of t){let a=o.self===!0?e:e[o.name];if(o.childTable===!0){s.push(String(a.length));for(let c of a){let l=lt(c,o.children??[],r+1,n);i.push(H(r,n)+l.cells,...l.children)}}else if(o.fixedLength!==void 0)s.push(...a.map(c=>te(c,n.delimiter)));else if(o.listDelimiter!==void 0)s.push(a.map(c=>Wf(c,n.delimiter,o.listDelimiter)).join(o.listDelimiter));else if(o.children!==void 0){let c=lt(a,o.children,r,n);s.push(c.cells),i.push(...c.children)}else s.push(te(a,n.delimiter))}return{cells:s.join(n.delimiter),children:i}}function Wf(e,t,r){return typeof e!="string"?te(e,t):ls(e,t)||e.includes(r)?Rr(e):e}function ms(e,t){return e.map(r=>te(r,t)).join(t)}function H(e,t){return" ".repeat(e*t.indentSize)}function ut(e,t){if(t.maxDepth!==0&&e>t.maxDepth)throw ve(0,`maximum nesting depth exceeded (maxDepth ${t.maxDepth})`)}function Ot(e,t,r){ut(t,r);for(let n of e)n.children!==void 0&&Ot(n.children,t+1,r)}var Wk=new TextEncoder,zk=new TextDecoder;var Dv=Qf(Yf),oe=.5;var Fv=256*1024*1024,we=1024*1024,Ha=14*24*60*60*1e3,bs={"process-deaths":{maxBytes:4*we,maxAgeMs:Ha,targetRatio:oe},"github-spend":{maxBytes:8*we,targetRatio:oe},"github-balance":{maxBytes:64*1024,targetRatio:oe},"github-balance-history":{maxBytes:2*we,targetRatio:oe},"castle-singleton-events":{maxBytes:2*we,targetRatio:oe},"redskilled-events":{maxBytes:4*we,targetRatio:oe},"rsp-telemetry-spool":{maxBytes:8*we,targetRatio:oe},"rsp-telemetry-corrections":{maxBytes:we,targetRatio:oe},"death-attributions":{maxBytes:we,maxAgeMs:Ha,targetRatio:oe},"worker-log":{maxLines:5e4,targetRatio:oe},"worker-liveness":{maxBytes:we,targetRatio:oe},"castle-history":{maxLines:1e4,targetRatio:oe},verdicts:{maxBytes:4*we,targetRatio:oe}};function Y(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}var eh="0.0.0-development",th=`octokit-endpoint.js/${eh} ${Y()}`,rh={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":th},mediaType:{format:""}};function nh(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function sh(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function za(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{sh(t[n])?n in e?r[n]=za(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function Ka(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Es(e,t,r){if(typeof t=="string"){let[s,i]=t.split(" ");r=Object.assign(i?{method:s,url:i}:{url:s},r)}else r=Object.assign({},t);r.headers=nh(r.headers),Ka(r),Ka(r.headers);let n=za(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(s=>!n.mediaType.previews.includes(s)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(s=>s.replace(/-preview/,""))),n}function ih(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(s=>s==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${s}=${encodeURIComponent(t[s])}`).join("&")}var oh=/\{[^{}}]+\}/g;function ah(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function ch(e){let t=e.match(oh);return t?t.map(ah).reduce((r,n)=>r.concat(n),[]):[]}function Wa(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function Ja(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function pt(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Pt(e,t,r){return t=e==="+"||e==="#"?Ja(t):pt(t),r?pt(r)+"="+t:t}function dt(e){return e!=null}function ws(e){return e===";"||e==="&"||e==="?"}function lh(e,t,r,n){var s=e[r],i=[];if(dt(s)&&s!=="")if(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||typeof s=="boolean")s=s.toString(),n&&n!=="*"&&(s=s.substring(0,parseInt(n,10))),i.push(Pt(t,s,ws(t)?r:""));else if(n==="*")Array.isArray(s)?s.filter(dt).forEach(function(o){i.push(Pt(t,o,ws(t)?r:""))}):Object.keys(s).forEach(function(o){dt(s[o])&&i.push(Pt(t,s[o],o))});else{let o=[];Array.isArray(s)?s.filter(dt).forEach(function(a){o.push(Pt(t,a))}):Object.keys(s).forEach(function(a){dt(s[a])&&(o.push(pt(a)),o.push(Pt(t,s[a].toString())))}),ws(t)?i.push(pt(r)+"="+o.join(",")):o.length!==0&&i.push(o.join(","))}else t===";"?dt(s)&&i.push(pt(r)):s===""&&(t==="&"||t==="?")?i.push(pt(r)+"="):s===""&&i.push("");return i}function uh(e){return{expand:dh.bind(null,e)}}function dh(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,s,i){if(s){let a="",c=[];if(r.indexOf(s.charAt(0))!==-1&&(a=s.charAt(0),s=s.substr(1)),s.split(/,/g).forEach(function(l){var d=/([^:\*]*)(?::(\d+)|(\*))?/.exec(l);c.push(lh(t,a,d[1],d[2]||d[3]))}),a&&a!=="+"){var o=",";return a==="?"?o="&":a!=="#"&&(o=a),(c.length!==0?a:"")+c.join(o)}else return c.join(",")}else return Ja(i)}),e==="/"?e:e.replace(/\/$/,"")}function Ya(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),s,i=Wa(e,["method","baseUrl","url","headers","request","mediaType"]),o=ch(r);r=uh(r).expand(i),/^http/.test(r)||(r=e.baseUrl+r);let a=Object.keys(e).filter(d=>o.includes(d)).concat("baseUrl"),c=Wa(i,a);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(d=>d.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let d=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=d.concat(e.mediaType.previews).map(p=>{let f=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${p}-preview${f}`}).join(",")}return["GET","HEAD"].includes(t)?r=ih(r,c):"data"in c?s=c.data:Object.keys(c).length&&(s=c),!n["content-type"]&&typeof s<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof s>"u"&&(s=""),Object.assign({method:t,url:r,headers:n},typeof s<"u"?{body:s}:null,e.request?{request:e.request}:null)}function ph(e,t,r){return Ya(Es(e,t,r))}function Qa(e,t){let r=Es(e,t),n=ph.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:Qa.bind(null,r),merge:Es.bind(null,r),parse:Ya})}var Xa=Qa(null,rh);var gc=At(ic(),1);var _h=/^-?\d+$/,$r=/^-?\d+n+$/,Se=JSON.stringify,vs=JSON.parse,uc=/^-?\d+n$/,oc=/([\[:])?"(-?\d+)n"($|\s*[,\}\]])/g,ac=/([\[:])?("-?\d+n+)n("$|"\s*[,\}\]])/g,Ss=e=>e===void 0||typeof e=="function"||typeof e=="symbol",Rs=e=>e!==null&&typeof e=="object"&&e.constructor&&e.constructor.name==="RawJSON",kh=(e,t,r)=>{let n="";typeof r=="number"?n=" ".repeat(Math.min(10,Math.max(0,Math.floor(r)))):typeof r=="string"&&(n=r.slice(0,10));let s=typeof t=="function",i=Array.isArray(t)?new Set(t.map(String)):null,o=(w,m,y)=>(y!==null&&typeof y=="object"&&typeof y.toJSON=="function"&&(y=y.toJSON(m)),typeof y=="string"&&$r.test(y)?y+"n":typeof y=="bigint"?"rawJSON"in JSON?JSON.rawJSON(y.toString()):y.toString()+"n":(s&&(y=t.call(w,m,y)),y!==null&&typeof y=="object"&&(y instanceof Number||y instanceof String||y instanceof Boolean)&&(y=y.valueOf()),y)),a=o({"":e},"",e);if(Ss(a))return;let c=a===null||typeof a!="object",l=Rs(a);if(c||l)return Se(a);let d=[],p=0,f=[{parent:{"":a},key:"",val:a,isArray:Array.isArray(a),keys:Array.isArray(a)?null:Object.keys(a),index:0,first:!0}],h=new WeakSet([a]);for(;f.length>0;){let w=f[f.length-1];w.index===0&&(d.push(w.isArray?"[":"{"),p++);let m=!1;if(w.isArray)if(w.index<w.val.length){w.first||d.push(","),n&&d.push(`
|
|
149
|
+
`)}return Uf(a,c)}function Uf(e,t){if(le(e))return[te(e,t.delimiter)];if(Array.isArray(e))return Ma(void 0,e,0,t);let r=Gr(e,t);return r===void 0?Or(e,0,t):Ua(void 0,e,r,0,t)}function Or(e,t,r){return ut(t,r),Object.entries(e).flatMap(([n,s])=>Mf(n,s,t,r))}function Mf(e,t,r,n){let s=H(r,n)+X(e);if(le(t))return[`${s}: ${te(t,n.delimiter)}`];if(Array.isArray(t))return Ma(e,t,r,n);let i=Gr(t,n);if(i!==void 0)return Ua(e,t,i,r,n);let o=[`${s}:`];return Object.keys(t).length>0&&o.push(...Or(t,r+1,n)),o}function Ua(e,t,r,n,s){ut(n,s);let i=Object.entries(t);Ot(r,n+1,s);let o=[H(n,s)+pe(e,i.length,r,s.delimiter,!0)];for(let[a,c]of i){let l=lt(c,r,n+2,s);o.push(H(n+1,s)+X(a)+": "+l.cells),o.push(...l.children)}return o}function Ma(e,t,r,n){ut(r,n);let s=H(r,n);if(t.length===0)return[e===void 0?`${s}[]`:`${s}${X(e)}: []`];if(t.every(le))return[s+pe(e,t.length,void 0,n.delimiter)+" "+ms(t,n.delimiter)];let i=ct(t,n);if(i!==void 0)return Vf(e,t,i,r,n);let o=[s+pe(e,t.length,void 0,n.delimiter)];for(let a of t)o.push(...hs(a,r+1,n));return o}function Vf(e,t,r,n,s){Ot(r,n+1,s);let i=[H(n,s)+pe(e,t.length,r,s.delimiter)];for(let o of t){let a=lt(o,r,n+2,s);i.push(H(n+1,s)+a.cells),i.push(...a.children)}return i}function hs(e,t,r){ut(t,r);let n=H(t,r)+"-";if(le(e))return[`${n} ${te(e,r.delimiter)}`];if(Array.isArray(e)){if(e.length===0)return[`${n} ${pe(void 0,0,void 0,r.delimiter)}`];if(e.every(le))return[`${n} ${pe(void 0,e.length,void 0,r.delimiter)} ${ms(e,r.delimiter)}`];let s=[`${n} ${pe(void 0,e.length,void 0,r.delimiter)}`];for(let i of e)s.push(...hs(i,t+1,r));return s}return Hf(e,t,r)}function Hf(e,t,r){ut(t,r);let n=Object.entries(e);if(n.length===0)return[H(t,r)+"-"];let[[s,i],...o]=n,a=Kf(s,i,t,r),c;if(a!==void 0)c=a;else if(le(i))c=[H(t,r)+"- "+X(s)+": "+te(i,r.delimiter)];else if(Array.isArray(i))if(i.length===0)c=[H(t,r)+"- "+X(s)+": []"];else{c=[H(t,r)+"- "+pe(s,i.length,void 0,r.delimiter)];for(let l of i)c.push(...hs(l,t+2,r))}else c=[H(t,r)+"- "+X(s)+":"],Object.keys(i).length>0&&c.push(...Or(i,t+2,r));return o.length>0&&c.push(...Or(Object.fromEntries(o),t+1,r)),c}function Kf(e,t,r,n){if(Array.isArray(t)&&t.length>0&&t.every(le))return[H(r,n)+"- "+pe(e,t.length,void 0,n.delimiter)+" "+ms(t,n.delimiter)];if(Array.isArray(t)&&t.every(J)){let s=ct(t,n);if(s!==void 0){Ot(s,r+1,n);let i=[H(r,n)+"- "+pe(e,t.length,s,n.delimiter)];for(let o of t){let a=lt(o,s,r+3,n);i.push(H(r+2,n)+a.cells),i.push(...a.children)}return i}}if(J(t)){let s=Gr(t,n);if(s!==void 0){Ot(s,r+1,n);let i=Object.entries(t),o=[H(r,n)+"- "+pe(e,i.length,s,n.delimiter,!0)];for(let[a,c]of i){let l=lt(c,s,r+3,n);o.push(H(r+2,n)+X(a)+": "+l.cells),o.push(...l.children)}return o}}}function pe(e,t,r,n,s=!1){let i=e===void 0?"":X(e),o=s?":":"",a=n===","?"":n,c=r===void 0?"":`{${Va(r,n)}}`;return`${i}[${t}${o}${a}]${c}:`}function Va(e,t){return e.map(r=>{let n=X(r.name);if(r.listDelimiter!==void 0)return`${n}[${r.listDelimiter}]`;if(r.fixedLength!==void 0){let s=t===","?"":t;return`${n}[${r.fixedLength}${s}]`}return n+(r.children===void 0?"":`{${Va(r.children,t)}}`)}).join(t)}function lt(e,t,r,n){let s=[],i=[];for(let o of t){let a=o.self===!0?e:e[o.name];if(o.childTable===!0){s.push(String(a.length));for(let c of a){let l=lt(c,o.children??[],r+1,n);i.push(H(r,n)+l.cells,...l.children)}}else if(o.fixedLength!==void 0)s.push(...a.map(c=>te(c,n.delimiter)));else if(o.listDelimiter!==void 0)s.push(a.map(c=>Wf(c,n.delimiter,o.listDelimiter)).join(o.listDelimiter));else if(o.children!==void 0){let c=lt(a,o.children,r,n);s.push(c.cells),i.push(...c.children)}else s.push(te(a,n.delimiter))}return{cells:s.join(n.delimiter),children:i}}function Wf(e,t,r){return typeof e!="string"?te(e,t):ls(e,t)||e.includes(r)?Rr(e):e}function ms(e,t){return e.map(r=>te(r,t)).join(t)}function H(e,t){return" ".repeat(e*t.indentSize)}function ut(e,t){if(t.maxDepth!==0&&e>t.maxDepth)throw ve(0,`maximum nesting depth exceeded (maxDepth ${t.maxDepth})`)}function Ot(e,t,r){ut(t,r);for(let n of e)n.children!==void 0&&Ot(n.children,t+1,r)}var Wk=new TextEncoder,zk=new TextDecoder;var Dv=Qf(Yf),oe=.5;var Fv=256*1024*1024,we=1024*1024,Ha=14*24*60*60*1e3,bs={"process-deaths":{maxBytes:4*we,maxAgeMs:Ha,targetRatio:oe},"github-spend":{maxBytes:8*we,targetRatio:oe},"github-balance":{maxBytes:64*1024,targetRatio:oe},"github-balance-history":{maxBytes:2*we,targetRatio:oe},"castle-singleton-events":{maxBytes:2*we,targetRatio:oe},"redskilled-events":{maxBytes:4*we,targetRatio:oe},"rsp-telemetry-spool":{maxBytes:8*we,targetRatio:oe},"rsp-telemetry-corrections":{maxBytes:we,targetRatio:oe},"death-attributions":{maxBytes:we,maxAgeMs:Ha,targetRatio:oe},"worker-log":{maxLines:5e4,targetRatio:oe},"worker-liveness":{maxBytes:we,targetRatio:oe},"castle-history":{maxLines:1e4,targetRatio:oe},countersigns:{maxBytes:4*we,targetRatio:oe}};function Y(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}var eh="0.0.0-development",th=`octokit-endpoint.js/${eh} ${Y()}`,rh={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":th},mediaType:{format:""}};function nh(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function sh(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function za(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{sh(t[n])?n in e?r[n]=za(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function Ka(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Es(e,t,r){if(typeof t=="string"){let[s,i]=t.split(" ");r=Object.assign(i?{method:s,url:i}:{url:s},r)}else r=Object.assign({},t);r.headers=nh(r.headers),Ka(r),Ka(r.headers);let n=za(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(s=>!n.mediaType.previews.includes(s)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(s=>s.replace(/-preview/,""))),n}function ih(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(s=>s==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${s}=${encodeURIComponent(t[s])}`).join("&")}var oh=/\{[^{}}]+\}/g;function ah(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function ch(e){let t=e.match(oh);return t?t.map(ah).reduce((r,n)=>r.concat(n),[]):[]}function Wa(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function Ja(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function pt(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Pt(e,t,r){return t=e==="+"||e==="#"?Ja(t):pt(t),r?pt(r)+"="+t:t}function dt(e){return e!=null}function ws(e){return e===";"||e==="&"||e==="?"}function lh(e,t,r,n){var s=e[r],i=[];if(dt(s)&&s!=="")if(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||typeof s=="boolean")s=s.toString(),n&&n!=="*"&&(s=s.substring(0,parseInt(n,10))),i.push(Pt(t,s,ws(t)?r:""));else if(n==="*")Array.isArray(s)?s.filter(dt).forEach(function(o){i.push(Pt(t,o,ws(t)?r:""))}):Object.keys(s).forEach(function(o){dt(s[o])&&i.push(Pt(t,s[o],o))});else{let o=[];Array.isArray(s)?s.filter(dt).forEach(function(a){o.push(Pt(t,a))}):Object.keys(s).forEach(function(a){dt(s[a])&&(o.push(pt(a)),o.push(Pt(t,s[a].toString())))}),ws(t)?i.push(pt(r)+"="+o.join(",")):o.length!==0&&i.push(o.join(","))}else t===";"?dt(s)&&i.push(pt(r)):s===""&&(t==="&"||t==="?")?i.push(pt(r)+"="):s===""&&i.push("");return i}function uh(e){return{expand:dh.bind(null,e)}}function dh(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,s,i){if(s){let a="",c=[];if(r.indexOf(s.charAt(0))!==-1&&(a=s.charAt(0),s=s.substr(1)),s.split(/,/g).forEach(function(l){var d=/([^:\*]*)(?::(\d+)|(\*))?/.exec(l);c.push(lh(t,a,d[1],d[2]||d[3]))}),a&&a!=="+"){var o=",";return a==="?"?o="&":a!=="#"&&(o=a),(c.length!==0?a:"")+c.join(o)}else return c.join(",")}else return Ja(i)}),e==="/"?e:e.replace(/\/$/,"")}function Ya(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),s,i=Wa(e,["method","baseUrl","url","headers","request","mediaType"]),o=ch(r);r=uh(r).expand(i),/^http/.test(r)||(r=e.baseUrl+r);let a=Object.keys(e).filter(d=>o.includes(d)).concat("baseUrl"),c=Wa(i,a);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(d=>d.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let d=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=d.concat(e.mediaType.previews).map(p=>{let f=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${p}-preview${f}`}).join(",")}return["GET","HEAD"].includes(t)?r=ih(r,c):"data"in c?s=c.data:Object.keys(c).length&&(s=c),!n["content-type"]&&typeof s<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof s>"u"&&(s=""),Object.assign({method:t,url:r,headers:n},typeof s<"u"?{body:s}:null,e.request?{request:e.request}:null)}function ph(e,t,r){return Ya(Es(e,t,r))}function Qa(e,t){let r=Es(e,t),n=ph.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:Qa.bind(null,r),merge:Es.bind(null,r),parse:Ya})}var Xa=Qa(null,rh);var gc=At(ic(),1);var _h=/^-?\d+$/,$r=/^-?\d+n+$/,Se=JSON.stringify,vs=JSON.parse,uc=/^-?\d+n$/,oc=/([\[:])?"(-?\d+)n"($|\s*[,\}\]])/g,ac=/([\[:])?("-?\d+n+)n("$|"\s*[,\}\]])/g,Ss=e=>e===void 0||typeof e=="function"||typeof e=="symbol",Rs=e=>e!==null&&typeof e=="object"&&e.constructor&&e.constructor.name==="RawJSON",kh=(e,t,r)=>{let n="";typeof r=="number"?n=" ".repeat(Math.min(10,Math.max(0,Math.floor(r)))):typeof r=="string"&&(n=r.slice(0,10));let s=typeof t=="function",i=Array.isArray(t)?new Set(t.map(String)):null,o=(w,m,y)=>(y!==null&&typeof y=="object"&&typeof y.toJSON=="function"&&(y=y.toJSON(m)),typeof y=="string"&&$r.test(y)?y+"n":typeof y=="bigint"?"rawJSON"in JSON?JSON.rawJSON(y.toString()):y.toString()+"n":(s&&(y=t.call(w,m,y)),y!==null&&typeof y=="object"&&(y instanceof Number||y instanceof String||y instanceof Boolean)&&(y=y.valueOf()),y)),a=o({"":e},"",e);if(Ss(a))return;let c=a===null||typeof a!="object",l=Rs(a);if(c||l)return Se(a);let d=[],p=0,f=[{parent:{"":a},key:"",val:a,isArray:Array.isArray(a),keys:Array.isArray(a)?null:Object.keys(a),index:0,first:!0}],h=new WeakSet([a]);for(;f.length>0;){let w=f[f.length-1];w.index===0&&(d.push(w.isArray?"[":"{"),p++);let m=!1;if(w.isArray)if(w.index<w.val.length){w.first||d.push(","),n&&d.push(`
|
|
150
150
|
`+n.repeat(p));let y=w.val[w.index],R=o(w.val,String(w.index),y);if(Ss(R))d.push("null"),w.first=!1,w.index++;else{let O=R!==null&&typeof R=="object",_=Rs(R);if(O&&!_){if(h.has(R))throw new TypeError("Converting circular structure to JSON");h.add(R),f.push({parent:w.val,key:String(w.index),val:R,isArray:Array.isArray(R),keys:Array.isArray(R)?null:Object.keys(R),index:0,first:!0}),w.first=!1,w.index++}else d.push(Se(R)),w.first=!1,w.index++}}else m=!0;else{for(;w.index<w.keys.length;){let R=w.keys[w.index++];if(i&&!i.has(R))continue;let _=w.val[R],k=o(w.val,R,_);if(Ss(k))continue;w.first||d.push(","),n?d.push(`
|
|
151
151
|
`+n.repeat(p)+Se(R)+": "):d.push(Se(R)+":");let S=k!==null&&typeof k=="object",A=Rs(k);if(S&&!A){if(h.has(k))throw new TypeError("Converting circular structure to JSON");h.add(k),f.push({parent:w.val,key:R,val:k,isArray:Array.isArray(k),keys:Array.isArray(k)?null:Object.keys(k),index:0,first:!0}),w.first=!1;break}else d.push(Se(k)),w.first=!1}w.index>=w.keys.length&&f[f.length-1]===w&&(m=!0)}m&&(p--,!w.first&&n&&d.push(`
|
|
152
152
|
`+n.repeat(p)),d.push(w.isArray?"]":"}"),h.delete(w.val),f.pop())}return d.join("")},dc=(e,t,r)=>{try{return"rawJSON"in JSON?Se(e,(a,c)=>typeof c=="bigint"?JSON.rawJSON(c.toString()):typeof t=="function"?t(a,c):(Array.isArray(t)&&t.includes(a),c),r):e?Se(e,(a,c)=>typeof c=="string"&&$r.test(c)||typeof c=="bigint"?c.toString()+"n":typeof t=="function"?t(a,c):(Array.isArray(t)&&t.includes(a),c),r).replace(oc,"$1$2$3").replace(ac,"$1$2$3"):Se(e,t,r)}catch(n){if(n instanceof RangeError){let s=kh(e,t,r);return s===void 0?void 0:"rawJSON"in JSON?s:s.replace(oc,"$1$2$3").replace(ac,"$1$2$3")}throw n}},Cr=new Map,vh=()=>{let e=JSON.parse.toString();if(Cr.has(e))return Cr.get(e);try{let t=JSON.parse("1",(r,n,s)=>!!s?.source&&s.source==="1");return Cr.set(e,t),t}catch{return Cr.set(e,!1),!1}},Sh=(e,t,r,n)=>typeof t=="string"&&uc.test(t)?BigInt(t.slice(0,-1)):typeof t=="string"&&$r.test(t)?t.slice(0,-1):typeof n=="function"?n(e,t,r):t,Rh=(e,t)=>JSON.parse(e,(r,n,s)=>{let i=typeof n=="number",o=n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER,a=i&&o,c=s&&_h.test(s.source);return a&&c?BigInt(s.source):typeof t=="function"?t(r,n,s):n}),pc=Number.MAX_SAFE_INTEGER.toString(),cc=pc.length,Ah=/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g,Gh=/^"-?\d+n+"$/,Oh=(e,t)=>{let r={"":e},n=[{parent:r,key:"",visited:!1}];for(;n.length>0;){let s=n[n.length-1];if(s.visited){let{parent:i,key:o}=s,a=i[o];typeof a=="string"&&(uc.test(a)?a=BigInt(a.slice(0,-1)):$r.test(a)&&(a=a.slice(0,-1))),typeof t=="function"&&(a=t.call(i,o,a)),a===void 0?delete i[o]:i[o]=a,n.pop()}else{s.visited=!0;let i=s.parent[s.key];if(i!==null&&typeof i=="object"){let a=Object.keys(i);for(let c=a.length-1;c>=0;c--)n.push({parent:i,key:a[c],visited:!1})}}}return r[""]},lc=e=>e.replace(Ah,(t,r,n,s)=>{let i=t[0]==='"';if(i&&Gh.test(t))return t.substring(0,t.length-1)+'n"';let a=n||s,c=r&&(r.length<cc||r.length===cc&&r<=pc);return i||a||c?t:'"'+t+'n"'}),fc=(e,t)=>{if(!e)return vs(e,t);try{if(vh())return Rh(e,t);let r=lc(e);return vs(r,(n,s,i)=>Sh(n,s,i,t))}catch(r){if(r instanceof RangeError){let n=lc(e),s=vs(n);return Oh(s,t)}throw r}};var fe=class extends Error{name;status;request;response;constructor(t,r,n){super(t,{cause:n.cause}),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0);"response"in n&&(this.response=n.response);let s=Object.assign({},n.request);n.request.headers.authorization&&(s.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),s.url=s.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=s}};var Ph="10.0.13",Ch={headers:{"user-agent":`octokit-request.js/${Ph} ${Y()}`}};function $h(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}var hc=()=>"";async function mc(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,n=e.request?.parseSuccessResponseBody!==!1,s=$h(e.body)||Array.isArray(e.body)?dc(e.body):e.body,i=Object.fromEntries(Object.entries(e.headers).map(([p,f])=>[p,String(f)])),o;try{o=await t(e.url,{method:e.method,body:s,redirect:e.request?.redirect,headers:i,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(p){let f="Unknown Error";if(p instanceof Error){if(p.name==="AbortError")throw p.status=500,p;f=p.message,p.name==="TypeError"&&"cause"in p&&(p.cause instanceof Error?f=p.cause.message:typeof p.cause=="string"&&(f=p.cause))}let h=new fe(f,500,{request:e});throw h.cause=p,h}let a=o.status,c=o.url,l={};for(let[p,f]of o.headers)l[p]=f;let d={url:c,status:a,headers:l,data:""};if("deprecation"in l){let p=l.link&&l.link.match(/<([^<>]+)>; rel="deprecation"/),f=p&&p.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${f?`. See ${f}`:""}`)}if(a===204||a===205)return d;if(e.method==="HEAD"){if(a<400)return d;throw new fe(o.statusText,a,{response:d,request:e})}if(a===304)throw d.data=await As(o),new fe("Not modified",a,{response:d,request:e});if(a>=400)throw d.data=await As(o),new fe(Ih(d.data),a,{response:d,request:e});return d.data=n?await As(o):o.body,d}async function As(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(hc);let r=(0,gc.parse)(t);if(xh(r)){let n="";try{return n=await e.text(),fc(n)}catch{return n}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"&&r.type!=="application/octet-stream"?e.text().catch(hc):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function xh(e){return e.type==="application/json"||e.type==="application/scim+json"}function Ih(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if(typeof e=="object"&&e!==null&&"message"in e){let t=e,r="documentation_url"in t?` - ${t.documentation_url}`:"";return Array.isArray(t.errors)?`${t.message}: ${t.errors.map(n=>JSON.stringify(n)).join(", ")}${r}`:`${t.message}${r}`}return`Unknown error: ${JSON.stringify(e)}`}function Gs(e,t){let r=e.defaults(t);return Object.assign(function(s,i){let o=r.merge(s,i);if(!o.request||!o.request.hook)return mc(r.parse(o));let a=(c,l)=>mc(r.parse(r.merge(c,l)));return Object.assign(a,{endpoint:r,defaults:Gs.bind(null,r)}),o.request.hook(a,o)},{endpoint:r,defaults:Gs.bind(null,r)})}var j=Gs(Xa,Ch);function Nh(e){let t=e.endpoint.DEFAULTS;return/^https:\/\/(api\.)?github\.com$/.test(t.baseUrl)?"https://github.com":/^https:\/\/api\..*\.ghe\.com$/.test(t.baseUrl)?t.baseUrl.replace("api.",""):t.baseUrl.replace("/api/v3","")}async function xr(e,t,r){let n={baseUrl:Nh(e),headers:{accept:"application/json"},...r},s=await e(t,n);if("error"in s.data){let i=new fe(`${s.data.error_description} (${s.data.error}, ${s.data.error_uri})`,400,{request:e.endpoint.merge(t,n)});throw i.response=s,i}return s}async function Ec(e){let t=e.request||j,r=await xr(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,code:e.code,redirect_uri:e.redirectUrl}),n={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if(e.clientType==="github-app"){if("refresh_token"in r.data){let s=new Date(r.headers.date).getTime();n.refreshToken=r.data.refresh_token,n.expiresAt=yc(s,r.data.expires_in),n.refreshTokenExpiresAt=yc(s,r.data.refresh_token_expires_in)}delete n.scopes}return{...r,authentication:n}}function yc(e,t){return new Date(e+t*1e3).toISOString()}async function Tc(e){let t=e.request||j,r={client_id:e.clientId};return"scopes"in e&&Array.isArray(e.scopes)&&(r.scope=e.scopes.join(" ")),xr(t,"POST /login/device/code",r)}async function Os(e){let t=e.request||j,r=await xr(t,"POST /login/oauth/access_token",{client_id:e.clientId,device_code:e.code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),n={clientType:e.clientType,clientId:e.clientId,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if("clientSecret"in e&&(n.clientSecret=e.clientSecret),e.clientType==="github-app"){if("refresh_token"in r.data){let s=new Date(r.headers.date).getTime();n.refreshToken=r.data.refresh_token,n.expiresAt=bc(s,r.data.expires_in),n.refreshTokenExpiresAt=bc(s,r.data.refresh_token_expires_in)}delete n.scopes}return{...r,authentication:n}}function bc(e,t){return new Date(e+t*1e3).toISOString()}async function _c(e){let r=await(e.request||j)("POST /applications/{client_id}/token",{headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`},client_id:e.clientId,access_token:e.token}),n={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.token,scopes:r.data.scopes};return r.data.expires_at&&(n.expiresAt=r.data.expires_at),e.clientType==="github-app"&&delete n.scopes,{...r,authentication:n}}async function kc(e){let t=e.request||j,r=await xr(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,grant_type:"refresh_token",refresh_token:e.refreshToken}),n=new Date(r.headers.date).getTime(),s={clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,refreshToken:r.data.refresh_token,expiresAt:wc(n,r.data.expires_in),refreshTokenExpiresAt:wc(n,r.data.refresh_token_expires_in)};return{...r,authentication:s}}function wc(e,t){return new Date(e+t*1e3).toISOString()}async function vc(e){let t=e.request||j,r=btoa(`${e.clientId}:${e.clientSecret}`),n=await t("PATCH /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token}),s={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:n.data.token,scopes:n.data.scopes};return n.data.expires_at&&(s.expiresAt=n.data.expires_at),e.clientType==="github-app"&&delete s.scopes,{...n,authentication:s}}async function Sc(e){let t=e.request||j,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function Rc(e){let t=e.request||j,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/grant",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function Gc(e,t){let r=Lh(e,t.auth);if(r)return r;let{data:n}=await Tc({clientType:e.clientType,clientId:e.clientId,request:t.request||e.request,scopes:t.auth.scopes||e.scopes});await e.onVerification(n);let s=await Ps(t.request||e.request,e.clientId,e.clientType,n);return e.authentication=s,s}function Lh(e,t){if(t.refresh===!0||!e.authentication)return!1;if(e.clientType==="github-app")return e.authentication;let r=e.authentication,n=("scopes"in t&&t.scopes||e.scopes).join(" "),s=r.scopes.join(" ");return n===s?r:!1}async function Ac(e){await new Promise(t=>setTimeout(t,e*1e3))}async function Ps(e,t,r,n){try{let s={clientId:t,request:e,code:n.device_code},{authentication:i}=r==="oauth-app"?await Os({...s,clientType:"oauth-app"}):await Os({...s,clientType:"github-app"});return{type:"token",tokenType:"oauth",...i}}catch(s){if(!s.response)throw s;let i=s.response.data.error;if(i==="authorization_pending")return await Ac(n.interval),Ps(e,t,r,n);if(i==="slow_down")return await Ac(n.interval+7),Ps(e,t,r,n);throw s}}async function qh(e,t){return Gc(e,{auth:t})}async function Dh(e,t,r,n){let s=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(s.url))return t(s);let{token:i}=await Gc(e,{request:t,auth:{type:"oauth"}});return s.headers.authorization=`token ${i}`,t(s)}var Fh="0.0.0-development";function Oc(e){let t=e.request||j.defaults({headers:{"user-agent":`octokit-auth-oauth-device.js/${Fh} ${Y()}`}}),{request:r=t,...n}=e,s=e.clientType==="github-app"?{...n,clientType:"github-app",request:r}:{...n,clientType:"oauth-app",request:r,scopes:e.scopes||[]};if(!e.clientId)throw new Error('[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)');if(!e.onVerification)throw new Error('[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)');return Object.assign(qh.bind(null,s),{hook:Dh.bind(null,s)})}var Cc="0.0.0-development";async function Pc(e){if("code"in e.strategyOptions){let{authentication:t}=await Ec({clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request});return{type:"token",tokenType:"oauth",...t}}if("onVerification"in e.strategyOptions){let r=await Oc({clientType:e.clientType,clientId:e.clientId,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request})({type:"oauth"});return{clientSecret:e.clientSecret,...r}}if("token"in e.strategyOptions)return{type:"token",tokenType:"oauth",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions};throw new Error("[@octokit/auth-oauth-user] Invalid strategy options")}async function Cs(e,t={}){if(e.authentication||(e.authentication=e.clientType==="oauth-app"?await Pc(e):await Pc(e)),e.authentication.invalid)throw new Error("[@octokit/auth-oauth-user] Token is invalid");let r=e.authentication;if("expiresAt"in r&&(t.type==="refresh"||new Date(r.expiresAt)<new Date)){let{authentication:n}=await kc({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:r.refreshToken,request:e.request});e.authentication={tokenType:"oauth",type:"token",...n}}if(t.type==="refresh"){if(e.clientType==="oauth-app")throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");if(!r.hasOwnProperty("expiresAt"))throw new Error("[@octokit/auth-oauth-user] Refresh token missing");await e.onTokenCreated?.(e.authentication,{type:t.type})}if(t.type==="check"||t.type==="reset"){let n=t.type==="check"?_c:vc;try{let{authentication:s}=await n({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request});return e.authentication={tokenType:"oauth",type:"token",...s},t.type==="reset"&&await e.onTokenCreated?.(e.authentication,{type:t.type}),e.authentication}catch(s){throw s.status===404&&(s.message="[@octokit/auth-oauth-user] Token is invalid",e.authentication.invalid=!0),s}}if(t.type==="delete"||t.type==="deleteAuthorization"){let n=t.type==="delete"?Sc:Rc;try{await n({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request})}catch(s){if(s.status!==404)throw s}return e.authentication.invalid=!0,e.authentication}return e.authentication}var jh=/\/applications\/[^/]+\/(token|grant)s?/;function Ct(e){return e&&jh.test(e)}async function Bh(e,t,r,n={}){let s=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(s.url))return t(s);if(Ct(s.url)){let o=btoa(`${e.clientId}:${e.clientSecret}`);return s.headers.authorization=`basic ${o}`,t(s)}let{token:i}=e.clientType==="oauth-app"?await Cs({...e,request:t}):await Cs({...e,request:t});return s.headers.authorization="token "+i,t(s)}function Ir({clientId:e,clientSecret:t,clientType:r="oauth-app",request:n=j.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${Cc} ${Y()}`}}),onTokenCreated:s,...i}){let o=Object.assign({clientType:r,clientId:e,clientSecret:t,onTokenCreated:s,strategyOptions:i,request:n});return Object.assign(Cs.bind(null,o),{hook:Bh.bind(null,o)})}Ir.VERSION=Cc;async function Uh(e,t){if(t.type==="oauth-app")return{type:"oauth-app",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`}};if("factory"in t){let{type:s,...i}={...t,...e};return t.factory(i)}let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.request,...t};return(e.clientType==="oauth-app"?await Ir({...r,clientType:e.clientType}):await Ir({...r,clientType:e.clientType}))()}async function Mh(e,t,r,n){let s=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(s.url))return t(s);if(e.clientType==="github-app"&&!Ct(s.url))throw new Error(`[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${s.method} ${s.url}" is not supported.`);let i=btoa(`${e.clientId}:${e.clientSecret}`);s.headers.authorization=`basic ${i}`;try{return await t(s)}catch(o){throw o.status!==401||(o.message=`[@octokit/auth-oauth-app] "${s.method} ${s.url}" does not support clientId/clientSecret basic authentication.`),o}}var Vh="0.0.0-development";function $c(e){let t=Object.assign({request:j.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${Vh} ${Y()}`}}),clientType:"oauth-app"},e);return Object.assign(Uh.bind(null,t),{hook:Mh.bind(null,t)})}function Nr(e){return e.includes("-----BEGIN RSA PRIVATE KEY-----")}function Ic(e){return e.includes("-----BEGIN OPENSSH PRIVATE KEY-----")}function $s(e){let t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let n=0,s=e.length;n<s;n++)r[n]=e.charCodeAt(n);return t}function Nc(e){let t=e.trim().split(`
|
|
@@ -25,7 +25,7 @@ var GP=Object.create;var Vu=Object.defineProperty;var DP=Object.getOwnPropertyDe
|
|
|
25
25
|
`;return E+=k,a+=1,c+=1,l+=k.length,E},declareLane(b,y){if(d)throw Y(0,"TOONL encoder is closed");let E=wL(y),_=Sd(Yt,E),k=g(b);return ow(k.fields,E)?"":(k.fields=E,sw(b,_))},pushTagged(b,y){if(d)throw Y(0,"TOONL encoder is closed");let E=g(b),_=cw(aw(y),E.fieldsByShape),k=Sd(Yt,_),S=_.map(C=>ve(y[C],Yt)),T="";return ow(E.fields,_)||(E.fields=_,T+=sw(b,k)),`${T}${b}:${S.join(Yt)}
|
|
26
26
|
`},end(){return d?"":(d=!0,f())}}}var lw,uw,dw,Y4,Q4,fw=w(()=>{zt();ga();oo();sn();lw=[Yt,"|"," "],uw=8,dw=/^[A-Za-z0-9_-]+$/,Y4=new TextEncoder,Q4=new TextDecoder});var z,J=w(()=>{ga();oo();Zb();zt();no();ew();oo();eo();sn();ma();ga();tw();fw();z=bd});function SL(e){return e==="no-op"?0:e==="usage"?2:1}function ee(e){return Buffer.from(`${M(Rd(e))}
|
|
27
27
|
`)}function Rd(e){let t={command:e.command,category:e.category,exit_code:e.exitCode??SL(e.category),error:e.error,help:[e.help]};return e.validFlags&&e.validFlags.length>0&&(t.valid_flags=[...e.validFlags]),e.diagnostics&&(t.diagnostics=RL(e.diagnostics,3)),t}function Ue(e,t,r){let s=([r,t].find(i=>i.trim())??"").trim(),o=s.toLowerCase();return/\bgh\b/.test(e)&&eb(s)?{command:e,category:"transient",error:io(s)||"GitHub API rate limit exceeded",help:Zy,diagnostics:s}:/\bgh\b/.test(e)&&(o.includes("gh_token")||o.includes("not logged in")||o.includes("authentication"))?{command:e,category:"real-error",error:io(s)||"GitHub authentication failed",help:"gh auth login",diagnostics:s}:o.includes("not a git repository")?{command:e,category:"real-error",error:io(s)||"not a git repository",help:"git status",diagnostics:s}:o.includes("repository not found")||o.includes("could not resolve host")?{command:e,category:"real-error",error:io(s)||"repository is unavailable",help:e.startsWith("gh ")?"gh repo view":"git remote -v",diagnostics:s}:{command:e,category:"real-error",error:io(s)||"command failed",help:`${e} --help`,diagnostics:s}}function mw(e,t,r,n){return ee({command:e,category:"usage",error:`unknown flag: ${t}`,help:n,validFlags:r})}function io(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function RL(e,t){return e.split(/\r?\n/).slice(0,t).join(`
|
|
28
|
-
`).trim()}var bt=w(()=>{"use strict";tb();J()});function Ea(e){let t={app:e,version:DL(Kn("__RED_BUILD_VERSION__",()=>"4.1.
|
|
28
|
+
`).trim()}var bt=w(()=>{"use strict";tb();J()});function Ea(e){let t={app:e,version:DL(Kn("__RED_BUILD_VERSION__",()=>"4.1.21")??"0.0.0-dev"),gitSha:Kn("__RED_BUILD_GIT_SHA__",()=>"89d4b75fc2da8842313d36907b89e0bf872b3631")??"unknown",buildTime:Kn("__RED_BUILD_TIME__",()=>"2026-08-21T08:05:33-03:00")??"unknown",bundleAsset:Kn("__RED_BUNDLE_ASSET__",()=>"rsp-core.bundle.min.mjs")??"unknown"},r=Kn("__REDDB_SDK_VERSION__",()=>"1.23.1"),n=Kn("__REDDB_BINARY_TAG__",()=>"v1.23.1");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function DL(e){return e.startsWith("v")?e.slice(1):e}function Sw(e){return`${e.app} ${e.version} ${e.gitSha}`}function Kn(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}var Td=w(()=>{});import{isAbsolute as NL,join as Qt,resolve as xd}from"node:path";function ML(e){if(!e)throw new Error("root is required");return e.replace(/\/$/,"")}function vw(e){return Qt(ML(e),Rw)}function Tw(e){return Qt(vw(e),"state")}function xw(e){return Qt(vw(e),"tmp")}function ce(e){return Qt(Tw(e),"rsp")}function BL(e){return Qt(Tw(e),"red-skills.rdb")}function jL(e){return Qt(xw(e),"red-skills.rdb")}function Cw(e,t){let r=BL(e);if(t(r))return r;let n=jL(e);if(t(n))throw qL();return r}function qL(){return new Error("Legacy shared store found at .red/tmp/red-skills.rdb. Run `rsp setup` to migrate it to .red/state/red-skills.rdb before using rsp, memory, or brain.")}function Pw(e){return Qt(xw(e),"waits")}function Iw(e){let t=e.overrideEnvVars??Od;for(let n of t){let s=e.env[n];if(s)return NL(s)?s:xd(e.startDir,s)}let r=xd(e.startDir);for(;;){if(e.exists(Qt(r,Rw)))return r;let n=Qt(r,".."),s=xd(n);if(s===r)break;r=s}return e.startDir}var Rw,$L,FL,Od,Ow,Aw,et=w(()=>{Rw=".red",$L="MEMORY_ROOT",FL="RED_BRAIN_ROOT",Od=[$L,FL];Ow=".red/state/red-skills.rdb";Aw=".red/tmp/red-skills.rdb"});function ge(e){return M(e)}var UL,HL,U3,Xt=w(()=>{J();et();UL=[{id:"memory.config",plugin:"memory",legacyPath:".red/memory/config.json",toonPath:".red/memory/config.toon",kind:"toon"}],HL=[{id:"dev.afk-history",plugin:"dev",legacyPath:".red/state/afk-history.jsonl",toonPath:".red/state/castle/history.toonl",kind:"toonl"},{id:"dev.agent-log",plugin:"dev",legacyPath:".red/tmp/agent.log.toonl",toonPath:".red/tmp/agent.log.toonl",kind:"toonl"},{id:"dev.supervisor-firehose",plugin:"dev",legacyPath:".red/tmp/afk-supervisor.log.toonl",toonPath:".red/tmp/supervisors/default/supervisor.log.toonl",kind:"toonl",migration:"sniff-read"},{id:"dev.code-understanding-bench-runs",plugin:"dev",legacyPath:".red/tmp/bench/code-understanding/runs.jsonl",toonPath:".red/tmp/bench/code-understanding/runs.toonl",kind:"toonl"},{id:"dev.attempt-state",plugin:"dev",legacyPath:".red/tmp/{workers,go-workers,scout-workers}/*/*/afk.state.toon",toonPath:".red/tmp/{workers,go-workers,scout-workers}/*/*/afk.state.toon",kind:"toon"},{id:"dev.statusline-count-cache",plugin:"dev",legacyPath:".red/tmp/statusline-cache.json",toonPath:".red/state/statusline/statusline-cache.toon",kind:"toon"},{id:"dev.statusline-repo-cache",plugin:"dev",legacyPath:".red/tmp/statusline-repo-cache.json",toonPath:".red/state/statusline/statusline-repo-cache.toon",kind:"toon"},{id:"dev.rsp-resident-registry",plugin:"dev",legacyPath:".red/state/rsp/rsp-resident.pid.json",toonPath:".red/state/rsp/rsp-resident.pid.toon",kind:"toon"},{id:"dev.rsp-status-summary",plugin:"dev",legacyPath:".red/state/rsp/rsp-status-summary.json",toonPath:".red/state/rsp/rsp-status-summary.toon",kind:"toon"},{id:"dev.rsp-wait-registry",plugin:"dev",legacyPath:".red/tmp/waits/*.json",toonPath:".red/tmp/waits/*.toon",kind:"toon"}],U3=[...UL,...HL]});function ao(e){let{values:t,rest:r}=Zr(e,{query:Lw.query},Gw);return{argv:r,query:t.query?.trim()||void 0}}function Dw(e){let{values:t,rest:r}=Zr(e,Lw,Gw);return{argv:r,query:t.query?.trim()||void 0,full:t.full===!0}}function WL(e,t){if(!t)return!0;let r=Ad(e).toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(n=>r.includes(n))}function Le(e,t){return t?e.filter(r=>WL(r,t)):[...e]}function Zt(e,t){return Cd(e,t,{includeLegacyHelp:!0})}function Cd(e,t,r={}){let n=t.filter(Boolean);return n.length===0?e:{...e,...r.includeLegacyHelp?{help:n}:{},next_steps:n}}function Ad(e){return Array.isArray(e)?e.map(Ad).join(" "):typeof e=="object"&&e!==null?Object.values(e).map(Ad).join(" "):String(e??"")}var Lw,Gw,co=w(()=>{"use strict";Yu();Lw={query:{kind:"value",coerce:e=>e},full:{kind:"boolean"}},Gw={stopAtSeparator:!1}});var Aa={};se(Aa,{DEFAULT_RSP_MAX_OVERHEAD_MS:()=>ka,DEFAULT_RSP_MAX_SELF_STATE_BYTES:()=>Sa,DEFAULT_RSP_OVERHEAD_CEILING:()=>er,DEFAULT_RSP_OVERHEAD_CONSECUTIVE_BREACHES:()=>va,DEFAULT_RSP_OVERHEAD_COOLDOWN_MS:()=>Ta,DEFAULT_RSP_OVERHEAD_NET_LOSS_FLOOR_BYTES:()=>Ra,RSP_OVERHEAD_FAMILIES:()=>XL,RSP_OVERHEAD_LEDGER_FILE:()=>Fw,RSP_OVERHEAD_SCHEMA_VERSION:()=>Mw,classifyOverheadSample:()=>Ld,noteChildProcessMs:()=>jw,noteSelfStateBytesRead:()=>uo,overheadCounters:()=>Fd,overheadFamilyDisabled:()=>ZL,overheadHealth:()=>wr,overheadLedgerPath:()=>Gd,overheadMsOf:()=>Bw,overheadTelemetryFields:()=>xa,readOverheadLedger:()=>lo,readSelfStateFile:()=>Oa,readSelfStateFileSync:()=>rG,recordOverheadSample:()=>Dd,resetOverheadCounters:()=>tG,resetOverheadLedger:()=>eG,startChildProcessTimer:()=>tt});import{existsSync as VL,mkdirSync as JL,readFileSync as Nw,renameSync as KL,writeFileSync as zL}from"node:fs";import{readFile as YL}from"node:fs/promises";import{dirname as QL,join as $w}from"node:path";function Bw(e){let t=e.wrapperMs-e.childMs;return Number.isFinite(t)?Math.max(0,Id(t)):0}function Ld(e,t=er){let r=Bw(e),n=[];return r>t.maxOverheadMs&&n.push("wall-clock-ceiling"),e.selfStateBytesRead>t.maxSelfStateBytes&&n.push("self-state-byte-ceiling"),e.selfStateBytesRead>t.netLossFloorBytes&&e.selfStateBytesRead>e.bytesSaved&&n.push("overhead-exceeds-savings"),{overhead_ms:r,breached:n.length>0,reasons:n}}function xa(e,t=er){let r=Ld(e,t);return{wrapper_ms:Id(e.wrapperMs),overhead_ms:r.overhead_ms,child_ms:Id(Math.max(0,e.childMs)),self_state_bytes_read:Math.max(0,Math.trunc(e.selfStateBytesRead)),bytes_saved:Math.max(0,Math.trunc(e.bytesSaved)),overhead_breached:r.breached,overhead_breach_reasons:r.reasons.join(",")}}function Gd(e){return $w(ce(e),Fw)}function lo(e){try{let t=Nw(Gd(e),"utf8"),r=iG(t);if(aG(r))return r}catch{}return{version:1,families:{}}}function Dd(e,t,r=er,n=Date.now()){let s=lo(e),o=Ld(t,r),i=s.families[t.family]??oG(t.family,n),a=Md(i,n)?qw(i):i,c=o.breached?a.consecutive_breaches+1:0,l={...a,family:t.family,invocations:a.invocations+1,breaches:a.breaches+(o.breached?1:0),consecutive_breaches:c,breached:o.breached,reasons:o.reasons,last_overhead_ms:o.overhead_ms,last_self_state_bytes_read:Math.max(0,Math.trunc(t.selfStateBytesRead)),last_bytes_saved:Math.max(0,Math.trunc(t.bytesSaved)),updated_at:new Date(n).toISOString()};return o.breached?c>=r.consecutiveBreaches&&(l.disabled=!0,l.disabled_at=new Date(n).toISOString(),l.disabled_until=new Date(n+r.cooldownMs).toISOString(),l.disabled_reason=nG(t.family,c,o,r)):(l.disabled=!1,l.disabled_at=null,l.disabled_until=null,l.disabled_reason=null),s.families[t.family]=l,Uw(e,s),l}function ZL(e,t,r=Date.now()){let n=lo(e).families[t];return!n?.disabled||Md(n,r)?null:n}function eG(e,t){let r=lo(e);return t?delete r.families[t]:r.families={},Uw(e,r),r}function wr(e,t=er,r=Date.now()){let n=Object.values(lo(e).families).map(a=>Md(a,r)?qw(a):a).sort((a,c)=>a.family.localeCompare(c.family)),s=n.filter(a=>a.disabled),o=n.filter(a=>a.consecutive_breaches>0),i=s.length>0||o.length>0?"red":"green";return{schema_version:Mw,verdict:i,summary:sG(i,s,o),ceiling:t,breaching_families:o,disabled_families:s,families:n}}function uo(e){Number.isFinite(e)&&e>0&&(Nd+=e)}function jw(e){Number.isFinite(e)&&e>0&&($d+=e)}function Fd(){return{selfStateBytesRead:Nd,childMs:$d}}function tG(){Nd=0,$d=0}function tt(){let e=process.hrtime.bigint(),t=!1;return()=>{t||(t=!0,jw(Number(process.hrtime.bigint()-e)/1e6))}}async function Oa(e){let t=await YL(e,"utf8");return uo(Buffer.byteLength(t)),t}function rG(e){let t=Nw(e,"utf8");return uo(Buffer.byteLength(t)),t}function nG(e,t,r,n){let s=r.reasons.map(o=>o==="wall-clock-ceiling"?`added ${r.overhead_ms}ms > ${n.maxOverheadMs}ms`:o==="self-state-byte-ceiling"?`self-state read > ${n.maxSelfStateBytes}B`:"self-state read exceeded bytes saved").join("; ");return`rsp ${e} exceeded its overhead ceiling on ${t} consecutive invocations (${s}); wrapper self-disabled, commands pass through raw`}function sG(e,t,r){if(e==="green")return"every wrapper family is inside its overhead ceiling";let n=[];return t.length>0&&n.push(`self-disabled: ${t.map(s=>`${s.family} (${s.reasons.join(",")||"ceiling"})`).join(", ")}`),r.length>0&&n.push(`breaching: ${r.map(s=>`${s.family} x${s.consecutive_breaches}`).join(", ")}`),n.join("; ")}function Md(e,t){if(!e.disabled||!e.disabled_until)return!1;let r=Date.parse(e.disabled_until);return Number.isFinite(r)&&r<=t}function qw(e){return{...e,disabled:!1,disabled_at:null,disabled_until:null,disabled_reason:null,consecutive_breaches:0,breached:!1,reasons:[]}}function oG(e,t){return{family:e,invocations:0,breaches:0,consecutive_breaches:0,breached:!1,reasons:[],disabled:!1,disabled_at:null,disabled_until:null,disabled_reason:null,last_overhead_ms:0,last_self_state_bytes_read:0,last_bytes_saved:0,updated_at:new Date(t).toISOString()}}function Uw(e,t){try{let r=Gd(e);if(!VL($w(e,".red")))return;JL(QL(r),{recursive:!0});let n=`${r}.${process.pid}.tmp`;zL(n,`${M(t)}
|
|
29
29
|
`,{encoding:"utf8",mode:384}),KL(n,r)}catch{}}function iG(e){try{return JSON.parse(e)}catch{return z(e)}}function aG(e){return!Pd(e)||e.version!==1||!Pd(e.families)?!1:Object.values(e.families).every(cG)}function cG(e){return Pd(e)&&typeof e.family=="string"&&typeof e.consecutive_breaches=="number"&&typeof e.disabled=="boolean"}function Pd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Id(e){return Number.isFinite(e)?Math.round(e*1e3)/1e3:0}var Fw,Mw,ka,Sa,Ra,va,Ta,XL,er,Nd,$d,we=w(()=>{"use strict";et();J();Fw="overhead-budget.toon",Mw="red.rsp.overhead.v1",ka=250,Sa=1024*1024,Ra=64*1024,va=3,Ta=6*60*60*1e3,XL=["git","gh","gh-api-json","vitest","cargo","cat","exec","proxy"],er={maxOverheadMs:ka,maxSelfStateBytes:Sa,netLossFloorBytes:Ra,consecutiveBreaches:va,cooldownMs:Ta};Nd=0,$d=0});function Vw(e){return e.trimStart().startsWith("{")?"json":"toon"}function jd(e){let t=0;for(;e[t]===`
|
|
30
30
|
`||e[t]==="\r";)t+=1;let r=e.slice(t);if(r==="")return null;let n=Vw(r);if(n==="json"){let o=r.indexOf(`
|
|
31
31
|
`);return o<0?null:{frame:r.slice(0,o),dialect:n,rest:r.slice(o+1)}}let s=r.indexOf(`
|
|
@@ -53,7 +53,7 @@ ${s}`),n.join(`
|
|
|
53
53
|
`)){let s=n.replace(/\r$/,""),o=s.trim();if(!o||o.startsWith("#"))continue;let i=s.indexOf(":");if(i<0)continue;let a=s.length-s.trimStart().length,c=s.slice(0,i).trim();if(!c)continue;let l=s.slice(i+1).trim();for(;r.length&&r[r.length-1].indent>=a;)r.pop();if(r.push({indent:a,key:c}),l&&r.map(d=>d.key).join(".")===t)return fN(l)}}var Ja=w(()=>{});var _E={};se(_E,{DEFAULT_GH_ETAG_CACHE_MAX_BYTES:()=>cs,GH_ETAG_CACHE_DIR_NAME:()=>mE,LEGACY_GH_ETAG_CACHE_FILE:()=>hE,LEGACY_GH_ETAG_CACHE_JSON_FILE:()=>gE,enforceGhEtagCacheCeiling:()=>vp,ghEtagCacheDir:()=>Ka,ghEtagEntryPath:()=>za,isCacheEntry:()=>Qa,legacyGhEtagCachePaths:()=>Rp,migrateLegacyGhEtagCache:()=>xp,readGhEtagCache:()=>Ya,readGhEtagEntry:()=>_N,resetGhEtagCacheMigrationMemo:()=>kN,sweepGhEtagCache:()=>Tp,writeGhEtagEntry:()=>EN});import{existsSync as mN}from"node:fs";import{mkdir as hN,readdir as gN,rename as yN,rm as dE,stat as pE,unlink as fE,writeFile as bN}from"node:fs/promises";import{dirname as wN,join as as}from"node:path";function Ka(e){return as(ce(e),mE)}function za(e,t){return as(Ka(e),`${TN(t)}.toon`)}function Rp(e){let t=ce(e);return[as(t,hE),as(t,gE)]}async function _N(e,t){await xp(e);try{let r=wE(await Oa(za(e,t)));return Qa(r)?r:void 0}catch{return}}async function EN(e,t,r={}){return await bE(za(e,t.key),t),await vp(e,r.maxBytes??cs)}async function vp(e,t=cs){let r=await RN(e),n=r.reduce((o,i)=>o+i.bytes,0);if(n<=t)return{evictedEntries:0,bytes:n};r.sort((o,i)=>o.mtimeMs-i.mtimeMs||o.path.localeCompare(i.path));let s=0;for(let o of r){if(n<=t)break;try{await fE(o.path),n-=o.bytes,s+=1}catch{}}return{evictedEntries:s,bytes:n}}async function Tp(e,t={}){let r=await xp(e,{force:!0}),n=await SN(e);return{...await vp(e,t.maxBytes??cs),reclaimedTmp:n,migratedEntries:r}}async function Ya(e){for(let t of Rp(e))try{let r=wE(await Oa(t));if(xN(r))return r}catch{}return{version:1,entries:{}}}async function xp(e,t={}){if(!t.force&&kp.has(e))return 0;kp.add(e);let r=Rp(e).filter(o=>mN(o));if(r.length===0)return 0;let n=await Ya(e),s=0;for(let[o,i]of Object.entries(n.entries)){if(!Qa(i))continue;let a=za(e,o);await vN(a)||(await bE(a,{...i,key:o}),s+=1)}for(let o of r)await dE(o,{force:!0});return s}function kN(){kp.clear()}async function SN(e){let t=0;for(let r of[ce(e),Ka(e)])for(let n of await yE(r))if(n.endsWith(".tmp"))try{await fE(as(r,n)),t+=1}catch{}return t}async function RN(e){let t=Ka(e),r=[];for(let n of await yE(t)){if(!n.endsWith(".toon"))continue;let s=as(t,n);try{let o=await pE(s);o.isFile()&&r.push({path:s,bytes:o.size,mtimeMs:o.mtimeMs})}catch{}}return r}async function yE(e){try{return await gN(e)}catch{return[]}}async function vN(e){try{return await pE(e),!0}catch{return!1}}async function bE(e,t){await hN(wN(e),{recursive:!0});let r=`${e}.${process.pid}.${Date.now()}.tmp`;try{await bN(r,`${M(t)}
|
|
54
54
|
`,{encoding:"utf8",mode:384}),await yN(r,e)}catch(n){throw await dE(r,{force:!0}),n}}function TN(e){if(!/^[A-Za-z0-9_-]{1,128}$/.test(e))throw new Error(`unsafe gh etag cache key: ${e}`);return e}function wE(e){try{return JSON.parse(e)}catch{return z(e)}}function xN(e){return Sp(e)&&e.version===1&&Sp(e.entries)&&Object.values(e.entries).every(Qa)}function Qa(e){return Sp(e)&&typeof e.key=="string"&&typeof e.request=="string"&&typeof e.etag=="string"&&typeof e.body=="string"&&typeof e.updated_at=="string"}function Sp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var mE,hE,gE,cs,kp,Xa=w(()=>{"use strict";et();J();we();mE="gh-etag",hE="gh-etag-cache.toon",gE="gh-etag-cache.json",cs=4*1024*1024;kp=new Set});var Ap={};se(Ap,{DEFAULT_RSP_BYTE_BUDGET:()=>kt,DEFAULT_RSP_EPHEMERAL_TTL_HOURS:()=>Et,DEFAULT_RSP_HEAVY_GIT_BYTE_THRESHOLD:()=>ar,DEFAULT_RSP_IDLE_MS:()=>tc,DEFAULT_RSP_MEASUREMENT_HOLDOUT_SHARE:()=>vE,DEFAULT_RSP_STORE_PATH:()=>Op,DEFAULT_RSP_TELEMETRY_BYTE_BUDGET:()=>ec,DEFAULT_RSP_TELEMETRY_DRAIN_INTERVAL_MS:()=>kE,DEFAULT_RSP_TELEMETRY_DRAIN_TIMEOUT_MS:()=>SE,DEFAULT_RSP_TELEMETRY_TTL_DAYS:()=>Za,DEFAULT_RSP_TTL_DAYS:()=>_t,MIN_RSP_IDLE_MS:()=>RE,resolveRspConfig:()=>De});import{existsSync as ON,readFileSync as AN}from"node:fs";import{join as CN,resolve as EE}from"node:path";function De(e,t,r){let n=Ep(EE(e),CN(".red","config.yaml")),s=n?AN(n,"utf8"):"",o=Oo(s,"rsp.enabled")==="true",i=Oo(s,"rsp.proxy.enabled"),a=i===void 0?o:i==="true",c=Ge(_e(s,"rsp.ttlDays"),_t),l=Ge(Nt(t.RSP_EPHEMERAL_TTL_HOURS)??_e(s,"rsp.ephemeralTtlHours"),Et),u=Ge(_e(s,"rsp.byteBudget"),kt),d=Ge(_e(s,"rsp.telemetryTtlDays"),Za),p=Ge(_e(s,"rsp.telemetryByteBudget")??_e(s,"rsp.byteBudget"),ec),f=Ge(Nt(t.RSP_TELEMETRY_DRAIN_INTERVAL_MS)??_e(s,"rsp.telemetryDrainIntervalMs"),kE),m=Ge(Nt(t.RSP_TELEMETRY_DRAIN_TIMEOUT_MS)??_e(s,"rsp.telemetryDrainTimeoutMs"),SE),g=PN(Nt(t.RSP_IDLE_MS)??_e(s,"rsp.idleMs"),tc,RE),b=Ge(Nt(t.RSP_HEAVY_GIT_BYTE_THRESHOLD)??_e(s,"rsp.heavyGitByteThreshold"),ar),y=IN(Nt(t.RSP_MEASUREMENT_HOLDOUT_SHARE)??_e(s,"rsp.measurement.holdoutShare"),vE),E=Ge(Nt(t.RSP_GH_ETAG_CACHE_MAX_BYTES)??_e(s,"rsp.ghEtagCacheMaxBytes"),cs),_={maxOverheadMs:Ge(Nt(t.RSP_MAX_OVERHEAD_MS)??_e(s,"rsp.overhead.maxOverheadMs"),ka),maxSelfStateBytes:Ge(Nt(t.RSP_MAX_SELF_STATE_BYTES)??_e(s,"rsp.overhead.maxSelfStateBytes"),Sa),netLossFloorBytes:Ge(_e(s,"rsp.overhead.netLossFloorBytes"),Ra),consecutiveBreaches:Ge(Nt(t.RSP_OVERHEAD_CONSECUTIVE_BREACHES)??_e(s,"rsp.overhead.consecutiveBreaches"),va),cooldownMs:Ge(_e(s,"rsp.overhead.cooldownMs"),Ta)},k=ot(e).rootDir,S=r??t.RSP_STORE_URI??`file://${Cw(EE(k),ON)}`;return{enabled:o,proxyEnabled:a,storeUri:S,ttlDays:c,ephemeralTtlHours:l,byteBudget:u,telemetryTtlDays:d,telemetryByteBudget:p,telemetryDrainIntervalMs:f,telemetryDrainTimeoutMs:m,idleMs:g,heavyGitByteThreshold:b,measurementHoldoutShare:y,ghEtagCacheMaxBytes:E,overhead:_}}function _e(e,t){let r=Oo(e,t);if(r==null)return;let n=Number(r);return Number.isFinite(n)?n:void 0}function Ge(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function PN(e,t,r){let n=Ge(e,t);return Math.max(n,r)}function IN(e,t){return typeof e!="number"||!Number.isFinite(e)?t:e<=0?0:e>=1?1:e}function Nt(e){if(e==null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}var ar,Op,_t,Et,kt,Za,ec,kE,SE,tc,RE,vE,He=w(()=>{"use strict";Ja();et();Na();we();Xa();ar=8*1024,Op=Ow,_t=7,Et=6,kt=64*1024*1024,Za=90,ec=4*1024*1024,kE=3e4,SE=2e3,tc=5*6e4,RE=5e3,vE=0});function TE(e,t=process.env){return{async mint(r,n){let{residentElisionStore:s}=await Promise.resolve().then(()=>(sr(),Xn)),o=s(e,De(e,t));try{return await o.mint(r,n)}finally{await o.close()}}}}var xE=w(()=>{"use strict";He()});import{spawn as LN}from"node:child_process";async function AE(e){let{commandLine:t,options:r,cwd:n,registryPath:s,entry:o,signal:i}=e;if(!t.trim())return{verdict:ue("missing command line")};let a=e.store??TE(n),c=lE(e.spoolDir,o.id,r.captureBytes);return await new Promise(l=>{let u=!1,d=!1,p=async y=>{u||(u=!0,i.removeEventListener("abort",g),await qa(s,o,y.verdict.status).catch(()=>{}),l(y))},f=LN(t,{cwd:n,shell:!0,stdio:["ignore","pipe","pipe"],detached:process.platform!=="win32"});f.stdout?.on("data",y=>c.stdout.write(Buffer.from(y))),f.stderr?.on("data",y=>c.stderr.write(Buffer.from(y)));let m=async(y,E)=>{if(u||d)return;d=!0,clearTimeout(b);let _=await es(f,r.terminateGraceMs),k=await OE(null,null,c,a,t);await p({verdict:{status:y,exitCode:2,summary:E,details:k},cleanupProven:_.cleaned,survivors:_.survivors})},g=()=>void m("indeterminate","command interrupted");i.addEventListener("abort",g,{once:!0});let b=setTimeout(()=>{m("timeout",`command timed out after ${CE(r.timeoutMs)}`)},r.timeoutMs);f.once("error",y=>{clearTimeout(b),c.stdout.discard(),c.stderr.discard(),p({verdict:{status:"failure",exitCode:1,summary:y.message}})}),f.once("close",(y,E)=>{if(clearTimeout(b),u||d)return;let _=y===0;OE(y,E,c,a,t).then(k=>p({verdict:{status:_?"success":"failure",exitCode:_?0:1,summary:_?"command exited successfully":`command exited with ${E??y??"unknown"}`,details:k}}))}),i.aborted&&g()})}async function Ao(e){let{probe:t,timeoutMs:r,baseSleepMs:n,registryPath:s,entry:o,signal:i}=e,a=Date.now()+r,c=0,l;for(;Date.now()<a;){if(i.aborted)return{verdict:GN(l,c,o.last_poll_at)};let u;try{u=await t()}catch(g){u=ue(g instanceof Error?g.message:String(g))}if(l=u,o.attempts=++c,o.last_poll_at=new Date().toISOString(),o.last_observation=Cp(u),await ss(s,o).catch(()=>{}),u.status!=="running"&&u.status!=="indeterminate")return await qa(s,o,u.status).catch(()=>{}),{verdict:u};let d=Math.min(n*4,Math.round(n*Math.pow(1.25,c-1))),p=Math.floor(Math.random()*1e3),f=Math.min(d+p,Math.max(0,a-Date.now())),m=e.makeWakeSignal?.();await DN(f,i,m)}return await qa(s,o,"timeout").catch(()=>{}),{verdict:{status:"timeout",exitCode:2,summary:`timed out after ${CE(r)}`,details:l?{attempts:c,last_poll_at:o.last_poll_at??null,last_observation:Cp(l)}:{attempts:c}}}}async function OE(e,t,r,n,s){let[o,i]=await Promise.all([r.stdout.finish(n,`${s} # stdout`),r.stderr.finish(n,`${s} # stderr`)]);return{status:e??null,signal:t??null,stdout:o,stderr:i}}function Cp(e){return{status:e.status,exit_code:e.exitCode,summary:e.summary,...e.details?{details:e.details}:{}}}function GN(e,t,r){return ue("wait interrupted",{attempts:t,last_poll_at:r??null,...e?{last_observation:Cp(e)}:{}})}async function DN(e,t,r){t.aborted||e<=0||r?.aborted||await new Promise(n=>{let s=setTimeout(o,e);function o(){clearTimeout(s),t.removeEventListener("abort",i),r?.removeEventListener("abort",a),n()}let i=()=>o(),a=()=>o();t.addEventListener("abort",i,{once:!0}),r?.addEventListener("abort",a,{once:!0})})}function CE(e){return e%36e5===0?`${e/36e5}h`:e%6e4===0?`${e/6e4}m`:e%1e3===0?`${e/1e3}s`:`${e}ms`}var PE=w(()=>{"use strict";uE();xE();un();ir();Ro()});var IE={};se(IE,{readGhConditionalJson:()=>ct,readGhEtagCache:()=>Ya,sweepGhEtagCache:()=>Tp});import{execFileSync as NN}from"node:child_process";async function ct(e){if(e.signal?.aborted)return{status:1,stdout:"",stderr:"gh call cancelled",quotaFree:!1};let t=e.cwd??process.cwd(),r=e.env??process.env,n=MN(t),s={...n?{owner:n.owner,repo:n.repo}:{},...e.params??{}},o={args:e.args??FN(e.path),path:e.path,actor:$N(r),...Object.keys(s).length>0?{params:s}:{}};try{let i;if(e.residentRead)i=await e.residentRead(o);else{let a=De(t,r),c=bo(t,a);try{i=await c.githubRead(o)}finally{await c.close()}}return{status:i.status,stdout:i.stdout,stderr:i.stderr,quotaFree:i.quotaFree}}catch(i){return{status:75,stdout:"",stderr:JSON.stringify({refused:!0,reason:"rsp-github-resident-unavailable",repair:"restore the rsp resident and GitHub credential, then retry",detail:i instanceof Error?i.message:String(i)}),quotaFree:!1}}}function $N(e){let t=(e.RED_AFK_GH_ACTOR??"").trim();return t===""?"session":`proxied-agent:${t}`}function FN(e){return/\/pulls\/[^/]+\/?$/.test(e)?["pr","view"]:/\/pulls\/?$/.test(e)?["pr","list"]:/\/issues\/[^/]+\/?$/.test(e)?["issue","view"]:/\/issues\/?$/.test(e)?["issue","list"]:/\/actions\/runs\/[^/]+\/?$/.test(e)?["run","view"]:/\/actions\/runs\/?$/.test(e)?["run","list"]:["api",e]}function MN(e){let t="";try{t=String(NN("git",["config","--get","remote.origin.url"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]})).trim()}catch{return null}let n=t.replace(/^git@[^:]+:/,"").replace(/^ssh:\/\/git@[^/]+\//,"").replace(/^https?:\/\/[^/]+\//,"").replace(/\.git$/,"").replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return n.length<2?null:{owner:n[n.length-2],repo:n[n.length-1]}}var Co=w(()=>{"use strict";He();sr();Xa()});function LE(e){return e==="single-object"?"rest":"graphql"}function GE(e,t){return e==="stable-poll"?"rest":LE(t)}function We(e){return{none:e}}function de(e,t,r,n,s,o,i){let a=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"read",cardinality:t,volatility:r,surface:i??GE(r,t),budget:n,...a,...i?{only:i}:{},why:o}}function Ve(e,t,r,n,s){let o=typeof s=="string"?{fallback:s}:{fallback:null,noFallbackBecause:s.none};return{key:e,kind:"write",cardinality:"single-object",surface:t,budget:r,...o,why:n}}function NE(e){let t=[],r=0;for(;r<e.length&&e[r].startsWith("-");)r+=e[r]==="-R"||e[r]==="--repo"?2:1;for(;r<e.length&&!e[r].startsWith("-")&&t.length<2;)t.push(e[r]),r+=1;return t}function Pp(e){let t=NE(e);if(t.length===0)return"";if(t[0]==="api")return t[1]==="graphql"?"api graphql":"api rest";let r=t.length===1?t[0]:`${t[0]} ${t[1]}`;return t[1]==="list"&&e.includes("--search")?`${r} (search)`:r}function $E(e){return BN.get(Pp(e))??null}function Ip(e){let t=$E(e);if(!t)throw new rc(e);return t}var DE,BN,rc,FE=w(()=>{DE=[de("issue view","single-object","stable-poll","rest","graphql","one issue by number, repeatedly polled while usually unchanged; REST answers in one request"),de("pr view","single-object","stable-poll","rest","graphql","one pull request by number, polled per Worker per iteration"),de("repo view","single-object","stable-poll","rest","graphql","one repository's own metadata, repeatedly read while usually unchanged"),de("run view","single-object","stable-poll","rest",We("Actions runs have no GraphQL resource"),"one Actions run repeatedly polled to terminal"),de("release view","single-object","stable-poll","rest",We("release lookup has no GraphQL client method"),"one release by tag, repeatedly checked while usually absent or unchanged"),de("pr diff","single-object","one-shot","rest",We("the complete diff is exposed as a REST media type"),"one pull request's diff, read once for review"),de("issue list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged issue collection; REST can make an unchanged poll free"),de("pr list","multi-node","stable-poll","rest","graphql","a repeatedly polled, usually-unchanged pull-request collection; REST can make an unchanged poll free"),de("pr checks","multi-node","stable-poll","rest","graphql","check contexts are repeatedly polled while awaiting terminal state"),de("release list","multi-node","stable-poll","rest",We("Releases has no GraphQL collection client method"),"release waits poll a usually-unchanged list"),de("run list","multi-node","stable-poll","rest",We("Actions has no GraphQL collection client method"),"run waits poll a usually-unchanged list"),de("label list","multi-node","one-shot","graphql","rest","a label connection loaded once for the current operation"),de("issue list (search)","multi-node","stable-poll","search",We("search is ineligible for diverted traffic"),"queue discovery polls usually-unchanged search results through the 30/min search connection"),de("pr list (search)","multi-node","stable-poll","search",We("search is ineligible for diverted traffic"),"PR discovery polls usually-unchanged search results through the 30/min search connection"),de("search issues","multi-repository","one-shot","search",We("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),de("search prs","multi-repository","one-shot","search",We("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),de("search repos","multi-repository","one-shot","search",We("search is ineligible for diverted traffic"),"a one-shot cross-repository read through the REST search endpoint, metered 30/min","rest"),de("api graphql","multi-node","one-shot","graphql",We("the caller explicitly chose GraphQL"),"the caller supplies one explicit GraphQL query rather than a routed poll"),de("api rest","single-object","one-shot","rest",We("the caller explicitly chose REST"),"the caller supplies one explicit REST path rather than a routed poll"),Ve("issue create","rest","rest","the write plan POSTs to `repos/{o}/{r}/issues`; GraphQL exposes createIssue","graphql"),Ve("issue edit","rest","rest","the write plan PATCHes labels and body; GraphQL exposes updateIssue","graphql"),Ve("issue close","rest","rest","the write plan PATCHes issue state; GraphQL exposes closeIssue","graphql"),Ve("issue reopen","graphql","graphql","gh uses reopenIssue; REST can PATCH the issue state to open","rest"),Ve("issue comment","rest","rest","the write plan POSTs an issue comment; GraphQL exposes addComment","graphql"),Ve("issue develop","graphql","graphql","linked-branch creation is a GraphQL mutation",We("linked-branch creation has no REST mutation")),Ve("pr create","rest","rest","the write plan POSTs a pull request; GraphQL exposes createPullRequest","graphql"),Ve("pr comment","rest","rest","a pull request comment is an issue comment; GraphQL exposes addComment","graphql"),Ve("pr merge","rest","rest","the default plan PUTs the merge; GraphQL exposes mergePullRequest","graphql"),Ve("pr close","graphql","graphql","gh uses closePullRequest; REST can PATCH the pull request state","rest"),Ve("pr edit","graphql","graphql","gh uses GraphQL mutations; REST can PATCH pull-request fields and issue labels","rest"),Ve("pr ready","graphql","graphql","marking ready-for-review is a GraphQL mutation",We("GitHub exposes no REST ready-for-review mutation")),Ve("pr update-branch","rest","rest","the write plan PUTs update-branch; GraphQL exposes updatePullRequestBranch","graphql"),Ve("label create","rest","rest","the write plan POSTs a label; GraphQL exposes createLabel","graphql")],BN=new Map(DE.map(e=>[e.key,e]));rc=class extends Error{name="UnclassifiedGithubOperationError";operation;args;constructor(t){let r=Pp(t);super(`unclassified GitHub operation ${JSON.stringify(r||"(empty argv)")}: add an entry to GITHUB_OPERATIONS in packages/github/surface.ts stating its cardinality. Defaulting to GraphQL is what sent every single-object poll to the node-point pool (ADR 0132 decision 4).`),this.operation=r,this.args=[...t]}}});function ME(e){return e instanceof ls}function nc(e=process.env){let t=e[Lp];if(t===void 0||t.trim()==="")return 3e4;let r=Number(t);return!Number.isFinite(r)||r<0?3e4:Math.trunc(r)}async function us(e,t,r){if(!Number.isFinite(t)||t<=0)return await r();let n,s=new Promise((i,a)=>{n=setTimeout(()=>a(new ls(e,t)),t),n.unref?.()}),o=Promise.resolve().then(r);o.catch(()=>{});try{return await Promise.race([o,s])}finally{n!==void 0&&clearTimeout(n)}}function Po(e={}){let t=e.fetchImpl??fetch,r=e.timeoutMs??nc();return!Number.isFinite(r)||r<=0?t:async(n,s)=>{let o=AbortSignal.timeout(r),i=s?.signal??null,a=i==null?o:AbortSignal.any([i,o]),c=jN(n);try{return await us(c,r,async()=>await t(n,{...s??{},signal:a}))}catch(l){throw ME(l)?l:o.aborted&&i?.aborted!==!0?new ls(c,r,{cause:l}):l}}}function jN(e){let t=typeof e=="string"?e:e instanceof URL?e.href:typeof e.url=="string"?e.url:"request";try{return new URL(t).pathname}catch{return t}}var Lp,ls,Gp=w(()=>{Lp="RED_GITHUB_REQUEST_TIMEOUT_MS",ls=class extends Error{subject;timeoutMs;constructor(t,r,n){super(`GitHub ${t} passed its ${r}ms deadline and was abandoned; raise ${Lp} if this host is genuinely this slow`,n),this.name="GithubTimeoutError",this.subject=t,this.timeoutMs=r}}});function jE(e){if(e===!0)return"on";if(typeof e!="string")return sc;let t=e.trim().toLowerCase();return t==="on"||t==="enabled"||t==="true"?"on":sc}function Dp(e){return(e??sc)==="on"}function Np(e=process.env){return jE(e[BE])}var sc,BE,$p=w(()=>{sc="off",BE="RED_GITHUB_BUDGET_GATE"});import{execFile as qN}from"node:child_process";import{renameSync as UN,rmSync as HN,statSync as WN,writeFileSync as VN}from"node:fs";import{readdir as w5,readFile as JN,rename as KN,rm as zN,stat as YN,writeFile as QN}from"node:fs/promises";import{promisify as XN}from"node:util";function UE(e){let t=e.maxBytes;if(t!==void 0&&(!Number.isSafeInteger(t)||t<0))throw new Error("lane retention maxBytes must be a non-negative safe integer");return t}function HE(e){return e.code==="ENOENT"}async function ds(e,t,r,n=YN){let s=UE(r);if(s===void 0)return!1;let o=0;try{o=(await n(e)).size}catch(i){if(!HE(i))throw i}return o+t>s}function WE(e,t,r,n=WN){let s=UE(r);if(s===void 0)return!1;let o=0;try{o=n(e).size}catch(i){if(!HE(i))throw i}return o+t>s}async function t$(e,t,r){try{return await ZN("tq",["trim","--keep-last",String(t),"--in-place",e],{timeout:r,windowsHide:!0}),!0}catch{return!1}}function r$(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("lane retention keepLast must be a non-negative safe integer")}function n$(e){if(e.length===0)return"";let t=qe({trailer:!1});return e.map(r=>t.push(r)).join("")}async function s$(e,t){let r=`${e}.retaining-${process.pid}`;try{await QN(r,t,{encoding:"utf8",mode:384}),await KN(r,e)}finally{await zN(r,{force:!0})}}function VE(e,t){let r=`${e}.retaining-${process.pid}`;try{VN(r,t,{encoding:"utf8",mode:384}),UN(r,e)}finally{HN(r,{force:!0})}}async function ps(e,t,r={}){r$(t);let n=r.timeoutMs??e$;if(await(r.runTq??t$)(e,t,n))return"tq";let o=await JN(e,"utf8"),i=o.endsWith(`
|
|
55
55
|
`)?o:o.slice(0,o.lastIndexOf(`
|
|
56
|
-
`)+1),a=i===""?[]:Oe(i),c=t===0?[]:a.slice(-t);return await s$(e,n$(c)),"js"}var ZN,Ne,e$,k5,$t,qE,St,mn=w(()=>{J();ZN=XN(qN),Ne=.5,e$=5e3,k5=256*1024*1024,$t=1024*1024,qE=14*24*60*60*1e3,St={"process-deaths":{maxBytes:4*$t,maxAgeMs:qE,targetRatio:Ne},"github-spend":{maxBytes:8*$t,targetRatio:Ne},"github-balance":{maxBytes:64*1024,targetRatio:Ne},"github-balance-history":{maxBytes:2*$t,targetRatio:Ne},"castle-singleton-events":{maxBytes:2*$t,targetRatio:Ne},"redskilled-events":{maxBytes:4*$t,targetRatio:Ne},"rsp-telemetry-spool":{maxBytes:8*$t,targetRatio:Ne},"rsp-telemetry-corrections":{maxBytes:$t,targetRatio:Ne},"death-attributions":{maxBytes:$t,maxAgeMs:qE,targetRatio:Ne},"worker-log":{maxLines:5e4,targetRatio:Ne},"worker-liveness":{maxBytes:$t,targetRatio:Ne},"castle-history":{maxLines:1e4,targetRatio:Ne},
|
|
56
|
+
`)+1),a=i===""?[]:Oe(i),c=t===0?[]:a.slice(-t);return await s$(e,n$(c)),"js"}var ZN,Ne,e$,k5,$t,qE,St,mn=w(()=>{J();ZN=XN(qN),Ne=.5,e$=5e3,k5=256*1024*1024,$t=1024*1024,qE=14*24*60*60*1e3,St={"process-deaths":{maxBytes:4*$t,maxAgeMs:qE,targetRatio:Ne},"github-spend":{maxBytes:8*$t,targetRatio:Ne},"github-balance":{maxBytes:64*1024,targetRatio:Ne},"github-balance-history":{maxBytes:2*$t,targetRatio:Ne},"castle-singleton-events":{maxBytes:2*$t,targetRatio:Ne},"redskilled-events":{maxBytes:4*$t,targetRatio:Ne},"rsp-telemetry-spool":{maxBytes:8*$t,targetRatio:Ne},"rsp-telemetry-corrections":{maxBytes:$t,targetRatio:Ne},"death-attributions":{maxBytes:$t,maxAgeMs:qE,targetRatio:Ne},"worker-log":{maxLines:5e4,targetRatio:Ne},"worker-liveness":{maxBytes:$t,targetRatio:Ne},"castle-history":{maxLines:1e4,targetRatio:Ne},countersigns:{maxBytes:4*$t,targetRatio:Ne}}});import{appendFile as o$,mkdir as i$,readFile as JE}from"node:fs/promises";import{dirname as a$}from"node:path";function Mp(e){let t=e.now??(()=>new Date().toISOString()),r=St["github-spend"],n={...r,...e.maxBytes===void 0?{}:{maxBytes:e.maxBytes}},s=Promise.resolve();return{record(o){let i=d$(o.operation,o.cost,o.observedAt??t(),o.actor,e.identity),a=qe().push(f$(i)),c=s.then(async()=>{await i$(a$(e.path),{recursive:!0});let l=Buffer.byteLength(a);if(await ds(e.path,l,n)){let u=n.maxBytes;if(l>u)throw new Error(`GitHub spend observation exceeds its ${u}-byte lane ceiling`);let d=await c$(e.path),p=Math.max(Math.floor(u*r.targetRatio),l);await ps(e.path,l$(d,l,p))}await o$(e.path,a,"utf8")});return s=c.then(()=>{},()=>{}),c},async report(o){await s;let i=Fp(o.from,"report window start"),a=Fp(o.to,"report window end");if(a<=i)throw new Error("GitHub attribution report window end must be after its start");let c=await p$(e.path),l=new Map;for(let d of c.observations){let p=Date.parse(d.observed_at);if(p<i||p>=a||o.pool!==void 0&&d.pool!==o.pool)continue;let f=`${d.pool}\0${d.operation_key}\0${d.actor??""}`,m=l.get(f);l.set(f,{operation_key:d.operation_key,pool:d.pool,...d.actor===void 0?{}:{actor:d.actor},count:(m?.count??0)+1,cost:(m?.cost??0)+d.cost})}let u=[...l.values()].sort((d,p)=>p.cost-d.cost||p.count-d.count||d.operation_key.localeCompare(p.operation_key)||d.pool.localeCompare(p.pool)||(d.actor??"").localeCompare(p.actor??""));return{version:1,origin:"process-attribution",window:{from:o.from,to:o.to},pool:o.pool??null,total_count:u.reduce((d,p)=>d+p.count,0),total_cost:u.reduce((d,p)=>d+p.cost,0),operations:u,unreadable_records:c.unreadable}}}}async function c$(e){try{let t=await JE(e,"utf8");return t.trim()===""?[]:Oe(t)}catch(t){if(KE(t)&&t.code==="ENOENT")return[];throw t}}function l$(e,t,r){let n=0,s=e.length;for(;n<s;){let o=Math.ceil((n+s)/2),i=u$(e.slice(-o));Buffer.byteLength(i)+t<=r?n=o:s=o-1}return n}function u$(e){return e.map(t=>qe({trailer:!1}).push(t)).join("")}function d$(e,t,r,n,s){if(Fp(r,"GitHub spend observation"),!Number.isSafeInteger(t)||t<0)throw new Error(`GitHub spend observation cost must be a non-negative safe integer; received ${t}`);if(n!==void 0&&n.trim()==="")throw new Error("GitHub spend observation actor must be non-empty when supplied");return{version:1,observed_at:r,operation_key:e.key,...s===void 0?{}:{identity:s},pool:e.budget,...n===void 0?{}:{actor:n},cost:t}}async function p$(e){let t;try{t=await JE(e,"utf8")}catch(o){if(KE(o)&&o.code==="ENOENT")return{observations:[],unreadable:0};throw o}let r=[],n=0,s=t.split(`
|
|
57
57
|
`);for(let o=0;o<s.length;o+=1){let i=s[o];if(i.trim()==="")continue;let a=s[o+1];if(!i.startsWith("[]{")||a===void 0||a.trim()===""){n+=1;continue}let c;try{c=Oe(`${i}
|
|
58
58
|
${a}
|
|
59
59
|
`)[0]}catch{n+=1,o+=1;continue}if(!m$(c)){n+=1,o+=1;continue}r.push(c),o+=1}return{observations:r,unreadable:n}}function f$(e){return{version:e.version,observed_at:e.observed_at,operation_key:e.operation_key,...e.identity===void 0?{}:{identity:e.identity},pool:e.pool,...e.actor===void 0?{}:{actor:e.actor},cost:e.cost}}function m$(e){return h$(e)?e.version===1&&typeof e.observed_at=="string"&&Number.isFinite(Date.parse(e.observed_at))&&typeof e.operation_key=="string"&&e.operation_key!==""&&(e.pool==="rest"||e.pool==="graphql"||e.pool==="search")&&(e.actor===void 0||typeof e.actor=="string"&&e.actor!=="")&&typeof e.cost=="number"&&Number.isSafeInteger(e.cost)&&e.cost>=0:!1}function Fp(e,t){let r=Date.parse(e);if(!Number.isFinite(r))throw new Error(`${t} must be an ISO-8601 instant; received ${JSON.stringify(e)}`);return r}function h$(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KE(e){return e instanceof Error&&"code"in e}var zE=w(()=>{mn();J()});function Ae(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}var cr=w(()=>{});function w$(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function _$(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function XE(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{_$(t[n])?n in e?r[n]=XE(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function YE(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function jp(e,t,r){if(typeof t=="string"){let[s,o]=t.split(" ");r=Object.assign(o?{method:s,url:o}:{url:s},r)}else r=Object.assign({},t);r.headers=w$(r.headers),YE(r),YE(r.headers);let n=XE(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(s=>!n.mediaType.previews.includes(s)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(s=>s.replace(/-preview/,""))),n}function E$(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(s=>s==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${s}=${encodeURIComponent(t[s])}`).join("&")}function S$(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function R$(e){let t=e.match(k$);return t?t.map(S$).reduce((r,n)=>r.concat(n),[]):[]}function QE(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function ZE(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function ms(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Io(e,t,r){return t=e==="+"||e==="#"?ZE(t):ms(t),r?ms(r)+"="+t:t}function fs(e){return e!=null}function Bp(e){return e===";"||e==="&"||e==="?"}function v$(e,t,r,n){var s=e[r],o=[];if(fs(s)&&s!=="")if(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||typeof s=="boolean")s=s.toString(),n&&n!=="*"&&(s=s.substring(0,parseInt(n,10))),o.push(Io(t,s,Bp(t)?r:""));else if(n==="*")Array.isArray(s)?s.filter(fs).forEach(function(i){o.push(Io(t,i,Bp(t)?r:""))}):Object.keys(s).forEach(function(i){fs(s[i])&&o.push(Io(t,s[i],i))});else{let i=[];Array.isArray(s)?s.filter(fs).forEach(function(a){i.push(Io(t,a))}):Object.keys(s).forEach(function(a){fs(s[a])&&(i.push(ms(a)),i.push(Io(t,s[a].toString())))}),Bp(t)?o.push(ms(r)+"="+i.join(",")):i.length!==0&&o.push(i.join(","))}else t===";"?fs(s)&&o.push(ms(r)):s===""&&(t==="&"||t==="?")?o.push(ms(r)+"="):s===""&&o.push("");return o}function T$(e){return{expand:x$.bind(null,e)}}function x$(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,s,o){if(s){let a="",c=[];if(r.indexOf(s.charAt(0))!==-1&&(a=s.charAt(0),s=s.substr(1)),s.split(/,/g).forEach(function(l){var u=/([^:\*]*)(?::(\d+)|(\*))?/.exec(l);c.push(v$(t,a,u[1],u[2]||u[3]))}),a&&a!=="+"){var i=",";return a==="?"?i="&":a!=="#"&&(i=a),(c.length!==0?a:"")+c.join(i)}else return c.join(",")}else return ZE(o)}),e==="/"?e:e.replace(/\/$/,"")}function ek(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),s,o=QE(e,["method","baseUrl","url","headers","request","mediaType"]),i=R$(r);r=T$(r).expand(o),/^http/.test(r)||(r=e.baseUrl+r);let a=Object.keys(e).filter(u=>i.includes(u)).concat("baseUrl"),c=QE(o,a);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(u=>u.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let u=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=u.concat(e.mediaType.previews).map(d=>{let p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${d}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?r=E$(r,c):"data"in c?s=c.data:Object.keys(c).length&&(s=c),!n["content-type"]&&typeof s<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof s>"u"&&(s=""),Object.assign({method:t,url:r,headers:n},typeof s<"u"?{body:s}:null,e.request?{request:e.request}:null)}function O$(e,t,r){return ek(jp(e,t,r))}function tk(e,t){let r=jp(e,t),n=O$.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:tk.bind(null,r),merge:jp.bind(null,r),parse:ek})}var g$,y$,b$,k$,rk,nk=w(()=>{cr();g$="0.0.0-development",y$=`octokit-endpoint.js/${g$} ${Ae()}`,b$={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":y$},mediaType:{format:""}};k$=/\{[^{}}]+\}/g;rk=tk(null,b$)});var uk=I(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.format=I$;oc.parse=L$;var A$=/^[\u0009\u0020-\u007e\u0080-\u00ff]*$/,ok=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,C$=/[\\"]/g,P$=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,ik=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function I$(e){let{type:t,parameters:r}=e;if(!t||!P$.test(t))throw new TypeError(`Invalid type: ${t}`);let n=t;if(r)for(let s of Object.keys(r)){if(!ok.test(s))throw new TypeError(`Invalid parameter name: ${s}`);n+=`; ${s}=${$$(r[s])}`}return n}function L$(e,t){let r=e.length,n=Up(e,0,r),s=n;n=qp(e,n,r);let o=Hp(e,s,n),i=e.slice(s,o).toLowerCase(),a=t?.parameters===!1?new ik:N$(e,n,r);return{type:i,parameters:a}}var ak=32,ck=9,lk=59,G$=61,sk=34,D$=92;function N$(e,t,r){let n=new ik;e:for(;t<r;){t=Up(e,t+1,r);let s=t;for(;t<r;){let o=e.charCodeAt(t);if(o===lk)continue e;if(o===G$){let i=Hp(e,s,t),a=e.slice(s,i).toLowerCase();if(t=Up(e,t+1,r),t<r&&e.charCodeAt(t)===sk){t++;let l="";for(;t<r;){let u=e.charCodeAt(t++);if(u===sk){t=qp(e,t,r),n[a]===void 0&&(n[a]=l);break}if(u===D$&&t<r){l+=e[t++];continue}l+=String.fromCharCode(u)}continue e}let c=t;if(t=qp(e,t,r),n[a]===void 0){let l=Hp(e,c,t);n[a]=e.slice(c,l)}continue e}t++}}return n}function qp(e,t,r){for(;t<r&&e.charCodeAt(t)!==lk;)t++;return t}function Up(e,t,r){for(;t<r;){let n=e.charCodeAt(t);if(n!==ak&&n!==ck)break;t++}return t}function Hp(e,t,r){for(;r>t;){let n=e.charCodeAt(r-1);if(n!==ak&&n!==ck)break;r--}return r}function $$(e){if(ok.test(e))return e;if(A$.test(e))return`"${e.replace(C$,"\\$&")}"`;throw new TypeError(`Invalid parameter value: ${e}`)}});var F$,ac,Er,Wp,hk,dk,pk,Vp,Jp,M$,gk,ic,B$,j$,q$,yk,fk,U$,H$,W$,mk,bk,wk=w(()=>{F$=/^-?\d+$/,ac=/^-?\d+n+$/,Er=JSON.stringify,Wp=JSON.parse,hk=/^-?\d+n$/,dk=/([\[:])?"(-?\d+)n"($|\s*[,\}\]])/g,pk=/([\[:])?("-?\d+n+)n("$|"\s*[,\}\]])/g,Vp=e=>e===void 0||typeof e=="function"||typeof e=="symbol",Jp=e=>e!==null&&typeof e=="object"&&e.constructor&&e.constructor.name==="RawJSON",M$=(e,t,r)=>{let n="";typeof r=="number"?n=" ".repeat(Math.min(10,Math.max(0,Math.floor(r)))):typeof r=="string"&&(n=r.slice(0,10));let s=typeof t=="function",o=Array.isArray(t)?new Set(t.map(String)):null,i=(m,g,b)=>(b!==null&&typeof b=="object"&&typeof b.toJSON=="function"&&(b=b.toJSON(g)),typeof b=="string"&&ac.test(b)?b+"n":typeof b=="bigint"?"rawJSON"in JSON?JSON.rawJSON(b.toString()):b.toString()+"n":(s&&(b=t.call(m,g,b)),b!==null&&typeof b=="object"&&(b instanceof Number||b instanceof String||b instanceof Boolean)&&(b=b.valueOf()),b)),a=i({"":e},"",e);if(Vp(a))return;let c=a===null||typeof a!="object",l=Jp(a);if(c||l)return Er(a);let u=[],d=0,p=[{parent:{"":a},key:"",val:a,isArray:Array.isArray(a),keys:Array.isArray(a)?null:Object.keys(a),index:0,first:!0}],f=new WeakSet([a]);for(;p.length>0;){let m=p[p.length-1];m.index===0&&(u.push(m.isArray?"[":"{"),d++);let g=!1;if(m.isArray)if(m.index<m.val.length){m.first||u.push(","),n&&u.push(`
|
package/dist/rsp.bundle.min.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
3
|
import{spawn as L}from"node:child_process";import{isUtf8 as te}from"node:buffer";async function _(e,n=t=>t){let t=[],r=[];return e.stdout?.on("data",i=>t.push(Buffer.from(i))),e.stderr?.on("data",i=>r.push(Buffer.from(i))),await new Promise(i=>{let c=!1,o=async(a,s)=>{if(c)return;c=!0;let l=Buffer.concat(t),u=l;if(l.length>0&&te(l))try{u=await n(l)}catch{}if(process.stdout.write(u),process.stderr.write(Buffer.concat(r)),s){process.kill(process.pid,s),i(128);return}i(a??0)};e.once("error",a=>{r.push(Buffer.from(`${a instanceof Error?a.message:String(a)}
|
|
4
|
-
`)),o(127,null)}),e.once("close",(a,s)=>void o(a,s))})}var re=new Set(["dashboard","stats","gains","show","git","gh","vitest","cargo","cat","exec","wait","doctor","status","sweep","setup","mcp","shell-init","server","warm-resident","gh-api-json","hook"]);function R(e){let n=e[0];if(n==="--full"||n==="--brief"||n==="--terse")return e[1]!=="--"||!e[2]?null:{kind:"argv",argv:[...e.slice(2)],level:n.slice(2)};if(!n||n.startsWith("-"))return n!=="--"||!e[1]?null:{kind:"argv",argv:[...e.slice(1)],level:"automatic"};if(n==="proxy"){if(process.env.RSP_PROXY_FAIL_INTERNAL==="1")return null;let t=e.indexOf("--"),r=t>=0?e.slice(1,t):[];if(r.some(a=>a!=="--full"&&a!=="--brief"&&a!=="--terse"))return null;let i=t>=0?e.slice(t+1):e.slice(1);if(i.length!==1||!i[0]?.trim())return null;let c=i[0];if(ie(c))return null;let o=r.includes("--terse")?"terse":r.includes("--brief")?"brief":r.includes("--full")?"full":"automatic";return{kind:"shell",commandLine:c,level:o}}return re.has(n)?null:{kind:"argv",argv:[...e],level:"automatic"}}async function I(e,n){let t=e.kind==="argv"?L(e.argv[0],e.argv.slice(1),{stdio:["inherit","pipe","pipe"]}):L(e.commandLine,{shell:!0,stdio:["inherit","pipe","pipe"]});return await _(t,n)}function ie(e){return/(?:^|&&|\|\||[;|])\s*(?:(?:[A-Za-z_][A-Za-z0-9_]*=[^\s]+|env)\s+)*(?:git\s+(?:status|log|diff|show|blame|branch\s+-av)(?:\s|$)|gh\s+(?:pr|issue|run)\s+(?:list|view)(?:\s|$)|vitest(?:\s|$)|cargo\s+test(?:\s|$)|(?:cat|head|tail)\s+)/.test(e)}function F(e){let n={app:e,version:oe(x("__RED_BUILD_VERSION__",()=>"4.1.
|
|
4
|
+
`)),o(127,null)}),e.once("close",(a,s)=>void o(a,s))})}var re=new Set(["dashboard","stats","gains","show","git","gh","vitest","cargo","cat","exec","wait","doctor","status","sweep","setup","mcp","shell-init","server","warm-resident","gh-api-json","hook"]);function R(e){let n=e[0];if(n==="--full"||n==="--brief"||n==="--terse")return e[1]!=="--"||!e[2]?null:{kind:"argv",argv:[...e.slice(2)],level:n.slice(2)};if(!n||n.startsWith("-"))return n!=="--"||!e[1]?null:{kind:"argv",argv:[...e.slice(1)],level:"automatic"};if(n==="proxy"){if(process.env.RSP_PROXY_FAIL_INTERNAL==="1")return null;let t=e.indexOf("--"),r=t>=0?e.slice(1,t):[];if(r.some(a=>a!=="--full"&&a!=="--brief"&&a!=="--terse"))return null;let i=t>=0?e.slice(t+1):e.slice(1);if(i.length!==1||!i[0]?.trim())return null;let c=i[0];if(ie(c))return null;let o=r.includes("--terse")?"terse":r.includes("--brief")?"brief":r.includes("--full")?"full":"automatic";return{kind:"shell",commandLine:c,level:o}}return re.has(n)?null:{kind:"argv",argv:[...e],level:"automatic"}}async function I(e,n){let t=e.kind==="argv"?L(e.argv[0],e.argv.slice(1),{stdio:["inherit","pipe","pipe"]}):L(e.commandLine,{shell:!0,stdio:["inherit","pipe","pipe"]});return await _(t,n)}function ie(e){return/(?:^|&&|\|\||[;|])\s*(?:(?:[A-Za-z_][A-Za-z0-9_]*=[^\s]+|env)\s+)*(?:git\s+(?:status|log|diff|show|blame|branch\s+-av)(?:\s|$)|gh\s+(?:pr|issue|run)\s+(?:list|view)(?:\s|$)|vitest(?:\s|$)|cargo\s+test(?:\s|$)|(?:cat|head|tail)\s+)/.test(e)}function F(e){let n={app:e,version:oe(x("__RED_BUILD_VERSION__",()=>"4.1.21")??"0.0.0-dev"),gitSha:x("__RED_BUILD_GIT_SHA__",()=>"89d4b75fc2da8842313d36907b89e0bf872b3631")??"unknown",buildTime:x("__RED_BUILD_TIME__",()=>"2026-08-21T08:05:33-03:00")??"unknown",bundleAsset:x("__RED_BUNDLE_ASSET__",()=>"rsp.bundle.min.mjs")??"unknown"},t=x("__REDDB_SDK_VERSION__",()=>"1.23.1"),r=x("__REDDB_BINARY_TAG__",()=>"v1.23.1");return t&&(n.reddbSdkVersion=t),r&&(n.reddbBinaryTag=r),n}function oe(e){return e.startsWith("v")?e.slice(1):e}function N(e){return`${e.app} ${e.version} ${e.gitSha}`}function x(e,n){try{let t=n();return typeof t=="string"&&t.length>0?t:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}var D={"=":"data",":=":{to:"data",typed:!0},":":"meta"},se=/^[a-z][a-z0-9+.-]*:\/\//i;function ce(e,n){return typeof n=="string"?{separator:e,to:n,typed:!1,prefix:!1}:{separator:e,to:n.to,typed:n.typed??!1,prefix:n.prefix??!1}}function ae(e=D){return Object.entries(e).map(([n,t])=>ce(n,t)).sort((n,t)=>t.separator.length-n.separator.length)}function ue(e){return/^-\d+(\.\d+)?$/.test(e)}function O(e){return!(!e||e.startsWith("-")&&!ue(e))}function k(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;let n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)&&e.trim()!==""?n:e}function P(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}"))try{return JSON.parse(e)}catch{}let n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)&&e.trim()!==""?n:e.includes(",")?e.split(",").map(t=>P(t.trim())):e}function w(e,n){switch(n){case"boolean":return le(e);case"number":return fe(e);case"array":return e.split(",").map(t=>k(t.trim()));case"string":default:return e}}function le(e){let n=e.toLowerCase().trim();return n==="true"||n==="yes"||n==="1"||n==="on"}function fe(e){if(e.trim()==="")throw new TypeError(`Cannot convert "${e}" to number`);let n=Number(e);if(Number.isNaN(n))throw new TypeError(`Cannot convert "${e}" to number`);return n}function b(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function de(e,n={}){return e.map(t=>{let r=n[t.type];return r?r(t.value):t.value}).join("")}function d(e,n){return{type:e,value:n}}function pe(e){let n=[],t=he(e);if(n.push(d("section-header","Usage:"),d("text"," "),d("usage-text",t),d("newline",`
|
|
5
5
|
`),d("newline",`
|
|
6
6
|
`)),e.positional&&e.positional.length>0){n.push(d("section-header","Arguments:"),d("newline",`
|
|
7
7
|
`));for(let r of e.positional)if(r.description){let i=r.variadic?`${r.name}...`:r.name;n.push(d("indent"," "),d("positional-name",`<${i}>`)),r.required||n.push(d("positional-optional"," (optional)")),n.push(d("newline",`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reddb-io/red-skills",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.21",
|
|
4
4
|
"description": "RedSkills core npm package: compatibility bin shims, marketplace manifests, host generators, and non-plugin supporting runtimes. Plugin bundles ship in @reddb-io/red-skills-<plugin> packages (ADR 0146).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|