@reddb-io/red-skills 4.0.8 → 4.0.10
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 +137 -137
- package/dist/redskilled.bundle.min.mjs +2 -2
- package/dist/release.bundle.min.mjs +1 -1
- package/dist/rsp-core.bundle.min.mjs +1 -1
- package/dist/rsp.bundle.min.mjs +1 -1
- package/package.json +1 -1
|
@@ -164,7 +164,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
164
164
|
`}function GS(e,t){return t.map(Qr).join(e)}function Vue(e){if(!Array.isArray(e)||e.length===0)throw Rt(0,"TOONL header requires fields");return e.map(t=>{let r;try{[r]=Ys(String(t),0)}catch(n){throw ed(n)}if(r==="")throw Rt(0,"TOONL header requires fields");return r})}function KU(e,t){return e!==null&&e.length===t.length&&e.every((r,n)=>r===t[n])}function JU(e){if(e!==void 0&&(!Number.isInteger(e)||e<=0))throw Rt(0,"TOONL continuation cadence must be positive")}function Kue(e,t,r){return e.continuationEveryRows!==void 0&&t>=e.continuationEveryRows||e.continuationEveryBytes!==void 0&&r>=e.continuationEveryBytes}function ZU(e){if(e===null||typeof e!="object"||Array.isArray(e))throw Rt(0,"TOONL output requires object rows");let t=Object.keys(e);if(t.length===0)throw Rt(0,"TOONL output requires object rows");if(t.some(r=>!Xp(e[r])))throw Rt(0,"TOONL rows must be flat objects");return t}function Jue(e){return JSON.stringify([...e].sort())}function YU(e,t){let r=Jue(e),n=t.get(r);return n!==void 0?n:(t.set(r,e),e)}function Ht({delimiter:e=ss,trailer:t=!0,continuationEveryRows:r,continuationEveryBytes:n}={}){Hue(e),JU(r),JU(n);let o=null,i="",s=new Map,a=0,l=0,c=0,d=new Map,u=!1,p={continuationEveryRows:r,continuationEveryBytes:n},m=()=>o===null||!t?"":`[=${a}]
|
|
165
165
|
`,h=()=>Kue(p,l,c)?(l=0,c=0,HU(e,i,!0)):"",g=k=>{t2(k,0);let _=d.get(k);if(_===void 0){if(d.size>=XU)throw Rt(0,"too many tagged lanes");_={fields:null,fieldsByShape:new Map},d.set(k,_)}return _};return{push(k){if(u)throw Rt(0,"TOONL encoder is closed");let _=YU(ZU(k),s),S="";(o===null||o.length!==_.length||o.some((E,O)=>E!==_[O]))&&(S+=m(),o=_,i=GS(e,o),a=0,l=0,c=0,S+=HU(e,i));let P=o.map(E=>Yr(k[E],e));S+=h();let A=`${P.join(e)}
|
|
166
166
|
`;return S+=A,a+=1,l+=1,c+=A.length,S},declareLane(k,_){if(u)throw Rt(0,"TOONL encoder is closed");let S=Vue(_),P=GS(ss,S),A=g(k);return KU(A.fields,S)?"":(A.fields=S,VU(k,P))},pushTagged(k,_){if(u)throw Rt(0,"TOONL encoder is closed");let S=g(k),P=YU(ZU(_),S.fieldsByShape),A=GS(ss,P),E=P.map(D=>Yr(_[D],ss)),O="";return KU(S.fields,P)||(S.fields=P,O+=VU(k,A)),`${O}${k}:${E.join(ss)}
|
|
167
|
-
`},end(){return u?"":(u=!0,m())}}}var $t=jS;function ml(e){let t={app:e,version:Zue(id("__RED_BUILD_VERSION__",()=>"4.0.
|
|
167
|
+
`},end(){return u?"":(u=!0,m())}}}var $t=jS;function ml(e){let t={app:e,version:Zue(id("__RED_BUILD_VERSION__",()=>"4.0.10")??"0.0.0-dev"),gitSha:id("__RED_BUILD_GIT_SHA__",()=>"3d81b7e98824d7f9b040f21f2a1097f97f84b90e")??"unknown",buildTime:id("__RED_BUILD_TIME__",()=>"2026-08-20T10:19:53-03:00")??"unknown",bundleAsset:id("__RED_BUNDLE_ASSET__",()=>"redskilled.bundle.min.mjs")??"unknown"},r=id("__REDDB_SDK_VERSION__",()=>"1.23.1"),n=id("__REDDB_BINARY_TAG__",()=>"v1.23.1");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function Zue(e){return e.startsWith("v")?e.slice(1):e}function r2(e){return`${e.app} ${e.version} ${e.gitSha}`}function id(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}var n2={"=":"data",":=":{to:"data",typed:!0},":":"meta"},Yue=/^[a-z][a-z0-9+.-]*:\/\//i;function Que(e,t){return typeof t=="string"?{separator:e,to:t,typed:!1,prefix:!1}:{separator:e,to:t.to,typed:t.typed??!1,prefix:t.prefix??!1}}function Xue(e=n2){return Object.entries(e).map(([t,r])=>Que(t,r)).sort((t,r)=>r.separator.length-t.separator.length)}function epe(e){return/^-\d+(\.\d+)?$/.test(e)}function rf(e){return!(!e||e.startsWith("-")&&!epe(e))}function wy(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;let t=Number(e);return!Number.isNaN(t)&&Number.isFinite(t)&&e.trim()!==""?t:e}function o2(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 t=Number(e);return!Number.isNaN(t)&&Number.isFinite(t)&&e.trim()!==""?t:e.includes(",")?e.split(",").map(r=>o2(r.trim())):e}function hl(e,t){switch(t){case"boolean":return tpe(e);case"number":return rpe(e);case"array":return e.split(",").map(r=>wy(r.trim()));case"string":default:return e}}function tpe(e){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"||t==="on"}function rpe(e){if(e.trim()==="")throw new TypeError(`Cannot convert "${e}" to number`);let t=Number(e);if(Number.isNaN(t))throw new TypeError(`Cannot convert "${e}" to number`);return t}function Qs(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function npe(e,t={}){return e.map(r=>{let n=t[r.type];return n?n(r.value):r.value}).join("")}function qt(e,t){return{type:e,value:t}}function ope(e){let t=[],r=spe(e);if(t.push(qt("section-header","Usage:"),qt("text"," "),qt("usage-text",r),qt("newline",`
|
|
168
168
|
`),qt("newline",`
|
|
169
169
|
`)),e.positional&&e.positional.length>0){t.push(qt("section-header","Arguments:"),qt("newline",`
|
|
170
170
|
`));for(let n of e.positional)if(n.description){let o=n.variadic?`${n.name}...`:n.name;t.push(qt("indent"," "),qt("positional-name",`<${o}>`)),n.required||t.push(qt("positional-optional"," (optional)")),t.push(qt("newline",`
|
|
@@ -335,7 +335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
335
335
|
`),aliases:n}}function PQ(e,t){let r=$h(t),n=$h(r.data),o=Array.isArray(r.errors)?r.errors.map($h):[],i=BNe(n.rateLimit,o);return{projects:e.aliases.map(({alias:a,project:l})=>{let c=qNe(n[a]);if(c!=null)return{project_label:l.project_label,outcome:"counted",depth:c,detail:`project ${JSON.stringify(l.project_label)} has ${c} item(s) matching its selector`};let d=o.find(u=>UNe(u.path,a));return i.exhausted||$Q(d)?{project_label:l.project_label,outcome:"rate-limited",depth:null,detail:`the host token's quota was spent before project ${JSON.stringify(l.project_label)} answered, so this queue has no depth rather than a depth of zero`+(i.reset_at==null?"":`; the quota resets at ${i.reset_at}`)}:{project_label:l.project_label,outcome:"unreachable",depth:null,detail:`project ${JSON.stringify(l.project_label)} could not be counted with the host token: ${bN(d?.message)||"the query returned no count for this selector"}`}}),rate_limit:i}}function NNe(e){return{version:1,fetched_at:e,request_count:0,project_count:0,batch_size:zh,rate_limit:{remaining:null,reset_at:null,exhausted:!1},projects:[]}}function AQ(e,t,r){return{version:1,fetched_at:t,request_count:0,project_count:e.length,batch_size:zh,rate_limit:{remaining:null,reset_at:null,exhausted:!1},projects:e.map(n=>({project_label:n.project_label,outcome:"unconfigured",depth:null,detail:`project ${JSON.stringify(n.project_label)} was not counted because this host polls no tracker: ${r}`}))}}async function IQ(e){if(e.projects.length===0)return NNe(e.now);if(e.transport.conditionalList)return await FNe(e);let t=e.batchSize??zh,r=MNe(e.projects,t),n=[],o={remaining:null,reset_at:null,exhausted:!1};for(let i of r){let s=TQ(i,{batchSize:t});try{let a=await e.transport(s.query),l=PQ(s,a);n.push(...l.projects),o=Ih(o,l.rate_limit)}catch(a){let l=a instanceof Error?a.message:String(a),c=/rate limit|secondary rate|429/i.test(l);o=Ih(o,{remaining:null,reset_at:null,exhausted:c});for(let d of i)n.push({project_label:d.project_label,outcome:c?"rate-limited":"unreachable",depth:null,detail:`the queue fetch failed before project ${JSON.stringify(d.project_label)} answered: ${l}`})}}return{version:1,fetched_at:e.now,request_count:r.length,project_count:n.length,batch_size:t,rate_limit:o,projects:n}}var LNe={key:"redskilled queue poll",budget:"rest"};async function FNe(e){_N(e.projects);let t=e.transport.conditionalList,r=[],n={remaining:null,reset_at:null,exhausted:!1},o=0;for(let i of e.projects)try{if(i.poll==null){let c=TQ([i],{batchSize:1}),d=PQ(c,await e.transport(c.query));o+=1,r.push(...d.projects),n=Ih(n,d.rate_limit);continue}let s=await t({cacheKey:`queue:${i.project_label}:${JSON.stringify(i.poll)}`,route:"GET /repos/{owner}/{repo}/issues",parameters:{owner:i.poll.owner,repo:i.poll.repo,state:"open",labels:i.poll.labels.join(","),...i.poll.creator==null?{}:{creator:i.poll.creator}},operation:LNe});o+=s.requestCount;let a=s.data.filter(c=>!zQ(c.pull_request)),l=a.length;n=Ih(n,GNe(s.headers)),r.push({project_label:i.project_label,outcome:"counted",depth:l,detail:`project ${JSON.stringify(i.project_label)} has ${l} item(s) matching its selector`,items:jNe(a),tickets:EQ(a)})}catch(s){let a=Sl(s);n=Ih(n,{remaining:null,reset_at:a?vf(s):null,exhausted:a}),r.push({project_label:i.project_label,outcome:a?"rate-limited":"unreachable",depth:null,detail:`the queue fetch failed before project ${JSON.stringify(i.project_label)} answered: ${s instanceof Error?s.message:String(s)}`})}return{version:1,fetched_at:e.now,request_count:o,project_count:r.length,batch_size:1,rate_limit:n,projects:r}}function _N(e){if(e.length===0)throw new Error("redskilled queue discovery needs at least one registered project");let t=new Set;for(let r of e){if(typeof r.project_label!="string"||r.project_label==="")throw new Error("redskilled queue discovery needs a project label for every registered project");if(typeof r.selector!="string"||r.selector==="")throw new Error(`redskilled queue discovery needs a selector for project ${JSON.stringify(r.project_label)}: a project that names no work has no queue to discover`);if(t.has(r.project_label))throw new Error(`redskilled holds one selector per project, and ${JSON.stringify(r.project_label)} is registered twice`);t.add(r.project_label)}}function Ih(e,t){return{remaining:t.remaining==null?e.remaining:e.remaining==null?t.remaining:Math.min(e.remaining,t.remaining),reset_at:t.reset_at??e.reset_at,exhausted:e.exhausted||t.exhausted}}function GNe(e){let t=RQ(e,"x-ratelimit-remaining"),r=RQ(e,"x-ratelimit-reset");return{remaining:t,reset_at:r==null?null:new Date(r*1e3).toISOString(),exhausted:t===0}}function RQ(e,t){let r=e[t];if(typeof r!="string"&&typeof r!="number")return null;let n=Number(r);return Number.isSafeInteger(n)&&n>=0?n:null}function BNe(e,t){let r=$h(e),n=typeof r.remaining=="number"&&Number.isFinite(r.remaining)?r.remaining:null,o=typeof r.resetAt=="string"?r.resetAt:null;return{remaining:n,reset_at:o,exhausted:t.some($Q)||n===0}}function $Q(e){return e==null?!1:bN(e.type)==="RATE_LIMITED"||/rate limit/i.test(bN(e.message))}function UNe(e,t){return Array.isArray(e)&&e.includes(t)}function qNe(e){let t=$h(e);return Number.isInteger(t.issueCount)?t.issueCount:null}function $h(e){return zQ(e)?e:{}}function zQ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bN(e){return typeof e=="string"?e:""}function CQ(e,t,r){let n=e?.rate_limit;if(n==null)return t;if(n.exhausted){let i=n.reset_at==null?Number.NaN:Date.parse(n.reset_at),s=Number.isFinite(i)?i-r+1e3:t*4;return Math.min(WNe,Math.max(t,s))}let o=n.remaining;return o==null?t:o<=HNe?Math.max(t,3e4):o<=VNe?Math.max(t,2e4):t}var WNe=1e5,HNe=250,VNe=1e3;var Dv=[Ee.projectDrain,Ee.projectStop,Ee.projectStatus];function jv(e,t){let r=t.get(e.projectId)??{drainIntent:"inactive",revision:0,updates:[]};return{version:1,project_id:e.projectId,project_label:e.projectLabel,workspace_path:e.workspacePath,drain_intent:r.drainIntent,revision:r.revision,requested_target:r.target??null,requested_runner:r.runner??null,updates:[...r.updates]}}function e1e(e,t,r,n){let o=r.workers.filter(k=>k.project_label===e.projectLabel).sort((k,_)=>k.worker_id.localeCompare(_.worker_id)),i=r.registrations?.find(k=>k.project_label===e.projectLabel),s=r.demand?.projects.find(k=>k.project_label===e.projectLabel),a=i?.last_poll,l=i1e(n,a?.at),c=a==null||l==null?"unknown":l>SQ?"stale":"fresh",d=a?.outcome==="counted"?a.depth:null,u=s?.outcome??(d==null?"unknown":d===0?"queue-drained":"queued"),p=t.get(e.projectId)?.drainIntent??"inactive",m=i==null&&p==="draining",h=r.request_health,g={version:1,observed_at:n,queue:{posture:u,depth:d,target:s?.target??i?.target??null,live:o.length,wanted:s?.wanted??null,observed_at:a?.at??null,age_ms:l,freshness:c,detail:m?GQ:s?.detail??a?.detail??"the daemon has not observed this Project queue",registered:i!=null,items:[...a?.items??[]]},workers:{total:o.length,freshness:"fresh",observed_at:n,items:o.map(k=>({worker_id:k.worker_id,state:"running",started_at:k.started_at,isolated:k.isolated,warnings:[...k.warnings],base_commits_ahead:k.base_commits_ahead??null}))},adapter_health:h==null?{status:"unknown",checked_at:null,last_success_at:null,last_failure_at:null,detail:"the daemon has not published request-lane health"}:{status:h.status,checked_at:h.last_probe_at,last_success_at:h.last_success_at,last_failure_at:h.last_failure_at,detail:h.detail}};return{...jv(e,t),context:g}}async function jQ(e,t,r,n,o={}){let i=r.get(e.projectId);if(i==null&&t==="stop")return{...jv(e,r),status:"already-stopped"};let s=i??{drainIntent:"inactive",revision:0,updates:[]},a=t==="drain"?"draining":"stopped",l=o.target??s.target,c=o.runner??s.runner,d=l!==s.target||c!==s.runner;if(s.drainIntent===a&&!d){let m=t==="drain"?"already-draining":"already-stopped";return{...jv(e,r),status:m}}let u=s.revision+1,p=new Map(r);return p.set(e.projectId,{drainIntent:a,revision:u,updates:[...s.updates,{sequence:u,operation:t,drain_intent:a}],...l==null?{}:{target:l},...c==null?{}:{runner:c}}),await n(p),r.set(e.projectId,p.get(e.projectId)),{...jv(e,r),status:a}}function MQ(e){return XNe(DQ(e),"redskilled.project-control.toon")}function NQ(e){let t=Promise.resolve();return{async read(){await t;let r;try{r=await ZNe(e,"utf8")}catch(o){if(o.code==="ENOENT")return new Map;throw o}let n=s1e(r);return a1e(n)?new Map(n.projects.map(({project_id:o,state:i})=>[o,i])):new Map},replace(r){let n={version:1,projects:[...r].map(([o,i])=>({project_id:o,state:i}))};return t=t.then(async()=>{await JNe(DQ(e),{recursive:!0,mode:448});let o=`${e}.${process.pid}.${KNe()}.tmp`;await QNe(o,`${We(n)}
|
|
336
336
|
`,{encoding:"utf8",mode:384}),await YNe(o,e)}),t}}}var t1e=new Map([["drain","drain"],["project_drain","drain"],["stop","stop"],["project_stop","stop"],["status","status"],["project_status","status"]]);function wN(e){let t=n1e(e).trim(),r=t.indexOf("{"),n=(r<0?t:t.slice(0,r)).trim().toLowerCase(),o=t1e.get(n.startsWith("/")?n.slice(1):n);if(o==null)return;if(r<0)return{operation:o};let i=sc(r1e(t.slice(r)));if(i==null)return{operation:o};let s=typeof i.target=="number"&&Number.isInteger(i.target)&&i.target>=0?i.target:void 0,a=typeof i.runner=="string"&&i.runner.length>0?i.runner:void 0;return{operation:o,...s==null?{}:{target:s},...a==null?{}:{runner:a}}}function r1e(e){try{return JSON.parse(e)}catch{return null}}function n1e(e){return Array.isArray(e)?e.map(t=>sc(t)).filter(t=>t?.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
|
|
337
337
|
`):""}async function o1e(e,t,r,n){await e.notify(Te.client.session.update,{sessionId:t,update:{sessionUpdate:"plan",entries:[{content:r==="status"?"Observe the Project status":`${r==="drain"?"Continue":"Stop"} the Project drain`,priority:"high",status:"completed"}]}}),await e.notify(Te.client.session.update,{sessionId:t,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:`Project drain intent is ${n.drain_intent} at revision ${n.revision}
|
|
338
|
-
`}}})}async function LQ(e,t,r,n){let o=wN(e.prompt);if(o==null)return null;let i=o.operation,s=i==="status"?await n.read(r):await n.mutate(i,{target:o.target,runner:o.runner});return await o1e(t,e.sessionId,i,s),{stopReason:"end_turn",_meta:{redskills:{authority:"redskilled",projectControl:s}}}}async function FQ(e,t,r,n,o,i,s){let a=e.get(t.sessionId);if(a==null)return;let l=n.operation,c=l==="status"?await s(a.project):await jQ(a.project,l,o,i,{target:n.target,runner:n.runner});await r.notify(Er.client.session.update,{sessionId:t.sessionId,update:{sessionUpdate:"plan_update",plan:{type:"items",planId:"project-control",entries:[{content:l==="status"?"Observe the Project status":`${l==="drain"?"Continue":"Stop"} the Project drain`,priority:"high",status:"completed"}]}}}),await r.notify(Er.client.session.update,{sessionId:t.sessionId,update:{sessionUpdate:"state_update",state:"idle",stopReason:"end_turn"},_meta:{redskills:{authority:"redskilled",projectControl:c}}})}function i1e(e,t){if(t==null)return null;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(n)?Math.max(0,r-n):null}function s1e(e){let t=e.trim();if(!t)return null;try{return $t(t)}catch{try{return JSON.parse(t)}catch{return null}}}function a1e(e){let t=sc(e);return t?.version===1&&Array.isArray(t.projects)&&t.projects.every(r=>{let n=sc(r),o=sc(n?.state);return typeof n?.project_id=="string"&&(o?.drainIntent==="inactive"||o?.drainIntent==="draining"||o?.drainIntent==="stopped")&&typeof o.revision=="number"&&Array.isArray(o.updates)})}function sc(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function OQ(e){let t=sc(e);if(t==null)return{};let{target:r,runner:n}=t;if(r!==void 0&&!(typeof r=="number"&&Number.isInteger(r)&&r>=0))throw oe.invalidParams("target must be a non-negative integer");if(n!==void 0&&!(typeof n=="string"&&n.length>0))throw oe.invalidParams("runner must be a non-empty string");let o=t.registration;if(o!==void 0&&sc(o)==null)throw oe.invalidParams("registration must be an object");return{...r===void 0?{}:{target:r},...n===void 0?{}:{runner:n},...o===void 0?{}:{registration:o}}}var GQ="this Project holds no registration, so the daemon polls no queue and births no Worker for it; the drain intent is recorded and nothing acts on it";function l1e(e){return e instanceof Error&&e.name==="RedskilledProjectRegisteredError"}function c1e(e,t){return(e.registrations??[]).some(r=>r.project_label===t.projectLabel)}function BQ(e){return{mutateProjectControl:async(t,r={})=>{let n=e.scopedProject();if(t==="drain"&&r.registration!=null){if(e.registerProject==null)throw new Error("this endpoint cannot register a project: the daemon handed it no registration path");try{e.registerProject({...r.registration,project_label:n.
|
|
338
|
+
`}}})}async function LQ(e,t,r,n){let o=wN(e.prompt);if(o==null)return null;let i=o.operation,s=i==="status"?await n.read(r):await n.mutate(i,{target:o.target,runner:o.runner});return await o1e(t,e.sessionId,i,s),{stopReason:"end_turn",_meta:{redskills:{authority:"redskilled",projectControl:s}}}}async function FQ(e,t,r,n,o,i,s){let a=e.get(t.sessionId);if(a==null)return;let l=n.operation,c=l==="status"?await s(a.project):await jQ(a.project,l,o,i,{target:n.target,runner:n.runner});await r.notify(Er.client.session.update,{sessionId:t.sessionId,update:{sessionUpdate:"plan_update",plan:{type:"items",planId:"project-control",entries:[{content:l==="status"?"Observe the Project status":`${l==="drain"?"Continue":"Stop"} the Project drain`,priority:"high",status:"completed"}]}}}),await r.notify(Er.client.session.update,{sessionId:t.sessionId,update:{sessionUpdate:"state_update",state:"idle",stopReason:"end_turn"},_meta:{redskills:{authority:"redskilled",projectControl:c}}})}function i1e(e,t){if(t==null)return null;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(n)?Math.max(0,r-n):null}function s1e(e){let t=e.trim();if(!t)return null;try{return $t(t)}catch{try{return JSON.parse(t)}catch{return null}}}function a1e(e){let t=sc(e);return t?.version===1&&Array.isArray(t.projects)&&t.projects.every(r=>{let n=sc(r),o=sc(n?.state);return typeof n?.project_id=="string"&&(o?.drainIntent==="inactive"||o?.drainIntent==="draining"||o?.drainIntent==="stopped")&&typeof o.revision=="number"&&Array.isArray(o.updates)})}function sc(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function OQ(e){let t=sc(e);if(t==null)return{};let{target:r,runner:n}=t;if(r!==void 0&&!(typeof r=="number"&&Number.isInteger(r)&&r>=0))throw oe.invalidParams("target must be a non-negative integer");if(n!==void 0&&!(typeof n=="string"&&n.length>0))throw oe.invalidParams("runner must be a non-empty string");let o=t.registration;if(o!==void 0&&sc(o)==null)throw oe.invalidParams("registration must be an object");return{...r===void 0?{}:{target:r},...n===void 0?{}:{runner:n},...o===void 0?{}:{registration:o}}}var GQ="this Project holds no registration, so the daemon polls no queue and births no Worker for it; the drain intent is recorded and nothing acts on it";function l1e(e){return e instanceof Error&&e.name==="RedskilledProjectRegisteredError"}function c1e(e,t){return(e.registrations??[]).some(r=>r.project_label===t.projectLabel)}function BQ(e){return{mutateProjectControl:async(t,r={})=>{let n=e.scopedProject();if(t==="drain"&&r.registration!=null){if(e.registerProject==null)throw new Error("this endpoint cannot register a project: the daemon handed it no registration path");try{e.registerProject({...r.registration,project_label:n.projectId})}catch(i){if(!l1e(i))throw i}}let o=await jQ(n,t,e.projectControls,e.persistProjectControls,r);return t==="drain"&&!c1e(e.hostState(),n)?{...o,warning:GQ}:o},readProjectStatus:async t=>{let r=e1e(t,e.projectControls,e.hostState(),e.clock()),n=await e.readGithubCustody();return n==null?r:{...r,merge_custody:n}}}}function UQ(e){return{domain:"project",bindings:[jt(Dv[0],OQ,({params:t})=>e.mutate("drain",t)),jt(Dv[1],OQ,({params:t})=>e.mutate("stop",t)),jt(Dv[2],$v,()=>e.read())],capability:{projectControl:{version:1,methods:Dv}}}}function qQ(e){let t=r=>jY([hQ({scopedState:e.scopedState}),UQ({mutate:e.mutateProjectControl,read:e.readProjectStatus}),zv({gateway:e.githubGateway,scopedProject:e.scopedProject,onReader:e.onGithubReader}),VY({gateway:e.githubGateway,scopedProject:e.scopedProject,hostAdministration:e.hostAdministration}),fQ({tracker:mQ(e.githubGateway,e.scopedProject),admit:r}),vQ({registeredCheckout:()=>u1e(e),workerWorktrees:()=>p1e(e)}),yQ({hostAdministration:e.hostAdministration}),BY({store:e.brainStore}),gQ({store:e.memoryStore,scopedProject:e.scopedProject})]);return{v1:t(f1e(e)),v2:t(m1e(e))}}function u1e(e){let t=e.scopedProject(),r=e.hostState().registrations?.find(n=>n.project_label===t.projectLabel);if(r!=null)return{project_label:t.projectLabel,checkout_root:t.checkoutRoot,...r.trunk==null?{}:{trunk:r.trunk}}}function p1e(e){let t=e.scopedProject();return e.hostState().workers.filter(r=>r.project_label===t.projectLabel).map(r=>({worker_id:r.worker_id,path:r.workspace_path}))}function f1e(e){return async(t,r)=>{let n=r.client;return await WQ(e,{forward:()=>n.notify.bind(n),permission:o=>n.request(Te.client.session.requestPermission,o)})(t)}}function m1e(e){return async(t,r)=>{let n=r.client,o=d1e();return await WQ(e,{forward:i=>async(s,a)=>{let l=Ev(a.update,o);l!=null&&await n.notify(Er.client.session.update,{sessionId:i,update:l,_meta:a._meta})},permission:async i=>await n.request(Er.client.session.requestPermission,i)})(t)}}function WQ(e,t){return pQ({paths:e.paths,startWorker:e.startWorker,hostState:e.hostState,sessionJournal:e.sessionJournal,sessions:e.sessions,active:e.active,project:e.scopedProject,forward:t.forward,permission:(r,n)=>e.permission(r,n,t.permission)})}import{randomUUID as h1e}from"node:crypto";function vN(e){return Array.isArray(e)?e.map(r=>g1e(r)).filter(r=>r?.type==="text"&&typeof r.text=="string").map(r=>r.text).join(`
|
|
339
339
|
`).trim().toLowerCase()==="/retake":!1}function HQ(e){let t=["Subordinate provider session evidence (the redskilled journal remains session truth):"];e.evidence.length===0&&t.push("- no provider artifact was reported");for(let r of e.evidence)t.push(r.reference==null?`- ${r.provider} reported no provider artifact`:`- ${r.reference} \u2014 ${r.provider}, ${r.availability}, retained as evidence`);return`${t.join(`
|
|
340
340
|
`)}
|
|
341
341
|
`}async function VQ(e,t,r){await e.notify(Te.client.session.update,{sessionId:t,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:HQ(r)}}})}async function KQ(e,t,r){await e.notify(Er.client.session.update,{sessionId:t,update:{sessionUpdate:"agent_message_chunk",messageId:h1e(),content:{type:"text",text:HQ(r)}}}),await e.notify(Er.client.session.update,{sessionId:t,update:{sessionUpdate:"state_update",state:"idle",stopReason:"end_turn"},_meta:{redskills:{authority:"redskilled"}}})}function g1e(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}async function Mv(e,t,r,n,o){let i=y1e(r),s=[...e.recovery(t).entries].reverse().find(l=>l.kind==="permission"&&l.policy_key===i&&l.decision==="attached-approved"&&l.option_kind==="allow_always"),a=s==null?void 0:r.options.find(l=>l.optionId===s.option_id&&l.kind==="allow_always");if(a!=null)return await e.permission(t,r,i,"policy-pre-authorized",a.optionId),JQ(a.optionId,"policy-pre-authorized");if(n())try{let l=await Lu(o(r),b1e(),"attached ACP permission decision"),c=l.outcome,d=c.outcome==="selected"?r.options.find(u=>u.optionId===c.optionId):void 0;if(d!=null){let p=d.kind==="allow_once"||d.kind==="allow_always"?"attached-approved":"attached-denied";return await e.permission(t,r,i,p,d.optionId),JQ(d.optionId,p,l._meta)}}catch{}return await e.permission(t,r,i,"hitl-required"),{outcome:{outcome:"cancelled"},_meta:{redskills:{permissionResolution:"hitl-required",durableHitl:!0}}}}function JQ(e,t,r){return{outcome:{outcome:"selected",optionId:e},_meta:{...r??{},redskills:{...r?.redskills??{},permissionResolution:t}}}}function y1e(e){return`${e.toolCall.kind??"other"}:${e.toolCall.title??"untitled"}`}function b1e(){let e=Number.parseInt(process.env.REDSKILLED_ACP_PERMISSION_TIMEOUT_MS??"30000",10);return Number.isFinite(e)&&e>=0?e:3e4}function Bu(e,t,r){let n=Number.parseInt(process.env.REDSKILLED_ACP_WORKER_IDLE_MS??"30000",10),o=Number.isFinite(n)&&n>=0?n:3e4,i=setTimeout(()=>void Cs(e,t,r,"idle-policy"),o);i.unref(),t.idleTimer=i}async function Cs(e,t,r,n){await zs(t,"reaping",n).catch(()=>{}),Jo(e,t,r,n)}async function zs(e,t,r){await Ch(e.notify,e.publicSessionId,{event:t,workerId:e.workerId,...e.dispatch==null?{}:{dispatch:e.dispatch},...r==null?{}:{reason:r}})}async function Ch(e,t,r){await e(Te.client.session.update,{sessionId:t,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:""}},_meta:{redskills:{lifecycle:r}}})}function Uu(e){return e.stopReason==="cancelled"?"cancellation":e._meta?.redskills?.workflowOutcome}function Jo(e,t,r,n="cleanup"){if(t.cleaned)return;t.cleaned=!0,t.idleTimer!=null&&clearTimeout(t.idleTimer),r.get(e)===t&&r.delete(e),t.connection.close(),t.socket.destroy(),Is(t.endpoint);let o=[...r.values()].map(s=>s.workerId);(t.evidence==null?Promise.resolve():x9(k1e(t,t.evidence,n)).then(()=>{})).catch(()=>{}).then(async()=>{t.workspace!=null&&await Ah(t.workspace).catch(()=>{}),t.evidence!=null&&await E9({root:t.evidence.root,ttlMs:t.evidence.ttlMs,live:o}).catch(()=>{})}).catch(()=>{})}function k1e(e,t,r){return{root:t.root,...t.logPath==null?{}:{logPath:t.logPath},verdict:{workerId:e.workerId,outcome:r,diedAt:new Date().toISOString(),publicSessionId:e.publicSessionId,...e.workspace==null?{}:{workspacePath:e.workspace.workspacePath},...t.sessionArtifact==null?{}:{sessionArtifact:t.sessionArtifact}}}}function RN(e){return e.socket.destroyed||e.socket.readableEnded||e.socket.writableEnded||!e.socket.readable||!e.socket.writable}async function Nv(e,t,r,n){let o=t.get(e);o==null&&(o=await n(!1),t.set(e,o),await zs(o,"admission")),o.idleTimer!=null&&clearTimeout(o.idleTimer);let i=async a=>(a.cancelled&&await a.connection.agent.notify(Te.agent.session.cancel,{sessionId:a.downstreamSessionId}),a.connection.agent.request(Te.agent.session.prompt,{sessionId:a.downstreamSessionId,prompt:r.prompt,...r._meta==null?{}:{_meta:r._meta}}));try{let a=await i(o);return po().observeTurn("completed"),{worker:o,response:a}}catch(a){if(!RN(o))throw Bu(e,o,t),po().observeTurn("refused"),a;Jo(e,o,t)}let s=await n(!0);t.set(e,s),await zs(s,"replacement");try{let a=await i(s);return po().observeTurn("completed"),{worker:s,response:a}}catch(a){throw Jo(e,s,t),po().observeTurn("refused"),a}}function _1e(e){let t=e._meta?.redskills?.ticket,r=t==null||typeof t!="object"?void 0:t;if(r?.outcome!=null){let n=r.stage??r.failedStage;return`${String(r.outcome)}${n==null?"":` at ${String(n)}`}${r.detail==null?"":`: ${String(r.detail)}`}`}return`${Uu(e)??"no-workflow-outcome"} (${e.stopReason})`}function ZQ(e,t,r){if(r!=null)return e.find(n=>n.project_label===t)?.tickets?.find(n=>n.id===r)}function YQ(e,t,r,n){if(e?.prompt==null)return null;let o=Tx({argv:[e.prompt]},{worker_id:r,slot:t.index,workspace_path:t.workspace_path,...t.work_item==null?{}:{work_item:t.work_item}}).argv[0],i=Number(n?.id),s=e.trunk?.branch,a=n!=null&&Number.isInteger(i)&&i>0&&n.title!==""&&s!=null&&s!=="";return{workspacePath:t.workspace_path,prompt:o,...t.work_item==null?{}:{workItem:t.work_item},...a?{ticket:{number:i,title:n.title,labels:[...n.labels],base:s,handoff:o,worker_id:r}}:{}}}function QQ(e){return`redskilled: unattended turn ${e.event} for project ${JSON.stringify(e.project_label)}${e.work_item==null?"":` on item ${e.work_item}`}${e.worker_id==null?"":` (worker ${e.worker_id})`}${e.detail==null?"":`: ${e.detail}`}
|
|
@@ -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.0.8")??"0.0.0-dev"),gitSha:it("__RED_BUILD_GIT_SHA__",()=>"4767ffba5cfef04cb196ab6dfe383ff3f9817243")??"unknown",buildTime:it("__RED_BUILD_TIME__",()=>"2026-08-20T09:32:28-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 ce(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.0.10")??"0.0.0-dev"),gitSha:it("__RED_BUILD_GIT_SHA__",()=>"3d81b7e98824d7f9b040f21f2a1097f97f84b90e")??"unknown",buildTime:it("__RED_BUILD_TIME__",()=>"2026-08-20T10:19:53-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 ce(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),`
|
|
@@ -25,7 +25,7 @@ var PP=Object.create;var Vu=Object.defineProperty;var IP=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=gL(y),w=Sd(zt,E),k=g(b);return rw(k.fields,E)?"":(k.fields=E,tw(b,w))},pushTagged(b,y){if(d)throw Y(0,"TOONL encoder is closed");let E=g(b),w=ow(sw(y),E.fieldsByShape),k=Sd(zt,w),S=w.map(C=>ve(y[C],zt)),T="";return rw(E.fields,w)||(E.fields=w,T+=tw(b,k)),`${T}${b}:${S.join(zt)}
|
|
26
26
|
`},end(){return d?"":(d=!0,f())}}}var iw,aw,cw,G4,N4,uw=_(()=>{Kt();ga();so();nn();iw=[zt,"|"," "],aw=8,cw=/^[A-Za-z0-9_-]+$/,G4=new TextEncoder,N4=new TextDecoder});var z,J=_(()=>{ga();so();Yb();Kt();ro();Qb();so();Zs();nn();ma();ga();Xb();uw();z=bd});function _L(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??_L(e.category),error:e.error,help:[e.help]};return e.validFlags&&e.validFlags.length>0&&(t.valid_flags=[...e.validFlags]),e.diagnostics&&(t.diagnostics=EL(e.diagnostics,3)),t}function qe(e,t,r){let s=([r,t].find(i=>i.trim())??"").trim(),o=s.toLowerCase();return/\bgh\b/.test(e)&&Qy(s)?{command:e,category:"transient",error:oo(s)||"GitHub API rate limit exceeded",help:Yy,diagnostics:s}:/\bgh\b/.test(e)&&(o.includes("gh_token")||o.includes("not logged in")||o.includes("authentication"))?{command:e,category:"real-error",error:oo(s)||"GitHub authentication failed",help:"gh auth login",diagnostics:s}:o.includes("not a git repository")?{command:e,category:"real-error",error:oo(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:oo(s)||"repository is unavailable",help:e.startsWith("gh ")?"gh repo view":"git remote -v",diagnostics:s}:{command:e,category:"real-error",error:oo(s)||"command failed",help:`${e} --help`,diagnostics:s}}function dw(e,t,r,n){return ee({command:e,category:"usage",error:`unknown flag: ${t}`,help:n,validFlags:r})}function oo(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function EL(e,t){return e.split(/\r?\n/).slice(0,t).join(`
|
|
28
|
-
`).trim()}var bt=_(()=>{"use strict";Xy();J()});function Ea(e){let t={app:e,version:IL(Jn("__RED_BUILD_VERSION__",()=>"4.0.
|
|
28
|
+
`).trim()}var bt=_(()=>{"use strict";Xy();J()});function Ea(e){let t={app:e,version:IL(Jn("__RED_BUILD_VERSION__",()=>"4.0.10")??"0.0.0-dev"),gitSha:Jn("__RED_BUILD_GIT_SHA__",()=>"3d81b7e98824d7f9b040f21f2a1097f97f84b90e")??"unknown",buildTime:Jn("__RED_BUILD_TIME__",()=>"2026-08-20T10:19:53-03:00")??"unknown",bundleAsset:Jn("__RED_BUNDLE_ASSET__",()=>"rsp-core.bundle.min.mjs")??"unknown"},r=Jn("__REDDB_SDK_VERSION__",()=>"1.23.1"),n=Jn("__REDDB_BINARY_TAG__",()=>"v1.23.1");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function IL(e){return e.startsWith("v")?e.slice(1):e}function _w(e){return`${e.app} ${e.version} ${e.gitSha}`}function Jn(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=_(()=>{});import{isAbsolute as LL,join as Yt,resolve as xd}from"node:path";function DL(e){if(!e)throw new Error("root is required");return e.replace(/\/$/,"")}function kw(e){return Yt(DL(e),Ew)}function Sw(e){return Yt(kw(e),"state")}function Rw(e){return Yt(kw(e),"tmp")}function ce(e){return Yt(Sw(e),"rsp")}function $L(e){return Yt(Sw(e),"red-skills.rdb")}function FL(e){return Yt(Rw(e),"red-skills.rdb")}function xw(e,t){let r=$L(e);if(t(r))return r;let n=FL(e);if(t(n))throw ML();return r}function ML(){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 Ow(e){return Yt(Rw(e),"waits")}function Aw(e){let t=e.overrideEnvVars??Od;for(let n of t){let s=e.env[n];if(s)return LL(s)?s:xd(e.startDir,s)}let r=xd(e.startDir);for(;;){if(e.exists(Yt(r,Ew)))return r;let n=Yt(r,".."),s=xd(n);if(s===r)break;r=s}return e.startDir}var Ew,GL,NL,Od,vw,Tw,et=_(()=>{Ew=".red",GL="MEMORY_ROOT",NL="RED_BRAIN_ROOT",Od=[GL,NL];vw=".red/state/red-skills.rdb";Tw=".red/tmp/red-skills.rdb"});function ge(e){return M(e)}var BL,jL,x3,Qt=_(()=>{J();et();BL=[{id:"memory.config",plugin:"memory",legacyPath:".red/memory/config.json",toonPath:".red/memory/config.toon",kind:"toon"}],jL=[{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"}],x3=[...BL,...jL]});function io(e){let{values:t,rest:r}=Xr(e,{query:Cw.query},Pw);return{argv:r,query:t.query?.trim()||void 0}}function Iw(e){let{values:t,rest:r}=Xr(e,Cw,Pw);return{argv:r,query:t.query?.trim()||void 0,full:t.full===!0}}function qL(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=>qL(r,t)):[...e]}function Xt(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 Cw,Pw,ao=_(()=>{"use strict";Yu();Cw={query:{kind:"value",coerce:e=>e},full:{kind:"boolean"}},Pw={stopAtSeparator:!1}});var Aa={};se(Aa,{DEFAULT_RSP_MAX_OVERHEAD_MS:()=>ka,DEFAULT_RSP_MAX_SELF_STATE_BYTES:()=>Sa,DEFAULT_RSP_OVERHEAD_CEILING:()=>Zt,DEFAULT_RSP_OVERHEAD_CONSECUTIVE_BREACHES:()=>va,DEFAULT_RSP_OVERHEAD_COOLDOWN_MS:()=>Ta,DEFAULT_RSP_OVERHEAD_NET_LOSS_FLOOR_BYTES:()=>Ra,RSP_OVERHEAD_FAMILIES:()=>zL,RSP_OVERHEAD_LEDGER_FILE:()=>Nw,RSP_OVERHEAD_SCHEMA_VERSION:()=>Dw,classifyOverheadSample:()=>Ld,noteChildProcessMs:()=>Fw,noteSelfStateBytesRead:()=>lo,overheadCounters:()=>Fd,overheadFamilyDisabled:()=>YL,overheadHealth:()=>wr,overheadLedgerPath:()=>Gd,overheadMsOf:()=>$w,overheadTelemetryFields:()=>xa,readOverheadLedger:()=>co,readSelfStateFile:()=>Oa,readSelfStateFileSync:()=>ZL,recordOverheadSample:()=>Nd,resetOverheadCounters:()=>XL,resetOverheadLedger:()=>QL,startChildProcessTimer:()=>tt});import{existsSync as UL,mkdirSync as HL,readFileSync as Lw,renameSync as WL,writeFileSync as VL}from"node:fs";import{readFile as JL}from"node:fs/promises";import{dirname as KL,join as Gw}from"node:path";function $w(e){let t=e.wrapperMs-e.childMs;return Number.isFinite(t)?Math.max(0,Id(t)):0}function Ld(e,t=Zt){let r=$w(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=Zt){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 Gw(ce(e),Nw)}function co(e){try{let t=Lw(Gd(e),"utf8"),r=nG(t);if(sG(r))return r}catch{}return{version:1,families:{}}}function Nd(e,t,r=Zt,n=Date.now()){let s=co(e),o=Ld(t,r),i=s.families[t.family]??rG(t.family,n),a=Md(i,n)?Mw(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=eG(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,Bw(e,s),l}function YL(e,t,r=Date.now()){let n=co(e).families[t];return!n?.disabled||Md(n,r)?null:n}function QL(e,t){let r=co(e);return t?delete r.families[t]:r.families={},Bw(e,r),r}function wr(e,t=Zt,r=Date.now()){let n=Object.values(co(e).families).map(a=>Md(a,r)?Mw(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:Dw,verdict:i,summary:tG(i,s,o),ceiling:t,breaching_families:o,disabled_families:s,families:n}}function lo(e){Number.isFinite(e)&&e>0&&(Dd+=e)}function Fw(e){Number.isFinite(e)&&e>0&&($d+=e)}function Fd(){return{selfStateBytesRead:Dd,childMs:$d}}function XL(){Dd=0,$d=0}function tt(){let e=process.hrtime.bigint(),t=!1;return()=>{t||(t=!0,Fw(Number(process.hrtime.bigint()-e)/1e6))}}async function Oa(e){let t=await JL(e,"utf8");return lo(Buffer.byteLength(t)),t}function ZL(e){let t=Lw(e,"utf8");return lo(Buffer.byteLength(t)),t}function eG(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 tG(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 Mw(e){return{...e,disabled:!1,disabled_at:null,disabled_until:null,disabled_reason:null,consecutive_breaches:0,breached:!1,reasons:[]}}function rG(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 Bw(e,t){try{let r=Gd(e);if(!UL(Gw(e,".red")))return;HL(KL(r),{recursive:!0});let n=`${r}.${process.pid}.tmp`;VL(n,`${M(t)}
|
|
29
29
|
`,{encoding:"utf8",mode:384}),WL(n,r)}catch{}}function nG(e){try{return JSON.parse(e)}catch{return z(e)}}function sG(e){return!Pd(e)||e.version!==1||!Pd(e.families)?!1:Object.values(e.families).every(oG)}function oG(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 Nw,Dw,ka,Sa,Ra,va,Ta,zL,Zt,Dd,$d,we=_(()=>{"use strict";et();J();Nw="overhead-budget.toon",Dw="red.rsp.overhead.v1",ka=250,Sa=1024*1024,Ra=64*1024,va=3,Ta=6*60*60*1e3,zL=["git","gh","gh-api-json","vitest","cargo","cat","exec","proxy"],Zt={maxOverheadMs:ka,maxSelfStateBytes:Sa,netLossFloorBytes:Ra,consecutiveBreaches:va,cooldownMs:Ta};Dd=0,$d=0});function Uw(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=Uw(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(`
|
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.0.
|
|
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.0.10")??"0.0.0-dev"),gitSha:x("__RED_BUILD_GIT_SHA__",()=>"3d81b7e98824d7f9b040f21f2a1097f97f84b90e")??"unknown",buildTime:x("__RED_BUILD_TIME__",()=>"2026-08-20T10:19:53-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.0.
|
|
3
|
+
"version": "4.0.10",
|
|
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",
|