@reddb-io/red-skills 2.77.0 → 2.77.1
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/bin/red-skills-afk-mcp.mjs +19 -0
- package/dist/afk-mcp.bundle.min.mjs +368 -0
- package/dist/code-nav.bundle.min.mjs +1 -1
- package/dist/dev.bundle.min.mjs +610 -584
- package/dist/memory.bundle.min.mjs +591 -584
- package/dist/rsp.bundle.min.mjs +1 -1
- package/package.json +2 -1
package/dist/rsp.bundle.min.mjs
CHANGED
|
@@ -155,7 +155,7 @@ const timer = setInterval(() => {
|
|
|
155
155
|
}, 500);
|
|
156
156
|
`,String(process.pid)],{detached:!0,stdio:"ignore"});return t.unref(),t}function qs(){for(let e of Yx())try{process.kill(e,"SIGTERM")}catch{}}function Yx(){if(process.platform==="win32")return[];let e="";try{e=Px("ps",["-eo","pid=,ppid=,args="],{encoding:"utf8"})}catch{return[]}let t=[];for(let r of e.split(/\n/)){let n=/^\s*(\d+)\s+(\d+)\s+([\s\S]*)$/.exec(r);if(!n)continue;let s=Number(n[1]),i=Number(n[2]),o=n[3]??"";i===process.pid&&/(^|\s)\S*red(?:\.exe)?\s+rpc\s+--stdio(\s|$)/.test(o)&&t.push(s)}return t}async function Qx(e){if(e.collection!==ue)return e;let t=await Ep(e.raw_text,vp(e.raw_bytes)),r=await Ep(e.emitted_text,vp(e.emitted_bytes)),{raw_text:n,emitted_text:s,...i}=e;return{...i,tokens_raw:t.tokens,tokens_emitted:r.tokens,estimated:t.estimated||r.estimated}}async function Ep(e,t){if(typeof e=="string"){let r=Buffer.byteLength(e,"utf8");if(r<=Bx)try{return await Ip((async()=>({tokens:(await Zx())("cl100k_base").encode(e).length,estimated:!1}))(),Mx,"telemetry tokenization timed out")}catch{return{tokens:Math.ceil(r/4),estimated:!0}}return{tokens:Math.ceil(r/4),estimated:!0}}return t!=null?{tokens:Math.ceil(t/4),estimated:!0}:{tokens:0,estimated:!1}}async function Zx(){return kp??=import($x(Xx()).href).then(e=>{let t=e.getEncoding;if(!t)throw new Error("js-tiktoken getEncoding export not found");return t}),await kp}function Xx(){let e=Ba(Nx(import.meta.url)),r=[Hs(e,"..","node_modules","js-tiktoken","dist","index.js"),Hs(e,"..","apps","rsp","node_modules","js-tiktoken","dist","index.js")].find(n=>Dx(n));if(!r)throw new Error("js-tiktoken dependency not found");return r}function vp(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function q(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function $a(e){return e.trim().split(/\s+/).filter(Boolean)[0]??"unknown"}async function Ip(e,t,r){let n;try{return await Promise.race([e,new Promise((s,i)=>{n=setTimeout(()=>i(new Error(r)),t),n.unref()})])}finally{n&&clearTimeout(n)}}function eE(e){try{return JSON.parse(e)}catch{return e}}function tE(e){return Tp(e)&&e.version===1&&Array.isArray(e.records)&&e.records.every(t=>Tp(t)&&(t.collection===re||t.collection===G||t.collection===ue||t.collection===Ne)&&typeof t.key=="string"&&typeof t.created_at=="string"&&typeof t.expires_at=="string"&&typeof t.bytes=="number")}function Tp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rE(e,t){let r="";e.setEncoding("utf8"),e.on("error",()=>{}),e.on("data",n=>{r+=n;let s=r.indexOf(`
|
|
157
157
|
`);if(s<0)return;let i=r.slice(0,s);e.pause(),(async()=>{let o;try{o=JSON.parse(i),await t(o)}catch(a){let u={id:o?.id??mr(),ok:!1,error:a instanceof Error?a.message:String(a)};Ap(e,u)}finally{e.end()}})()})}function Ap(e,t){if(!(e.destroyed||!e.writable))try{e.write(`${JSON.stringify(t)}
|
|
158
|
-
`)}catch{}}async function nE(e,t,r,n){if(t.op==="handover")return{handover:!0,version:n,clientVersion:t.clientVersion};if(e.kind==="opening")throw new Error("rsp resident store is not ready");if(e.kind==="failed")throw new Error(`rsp resident store failed to open: ${e.error.message}`);let s=e.store;if(t.op==="ping")return{pong:!0,version:n};if(t.op==="stats")return await s.stats();if(t.op==="accounting-stats"){let i=s.redDb();if(!i)throw new Error("rsp accounting stats require the shared RedDB store");return await yo(i,t.byteBudget)}if(t.op==="telemetry-stats"){let i=s.redDb();if(!i)throw new Error("rsp telemetry stats require the shared RedDB store");return await es(i,t.sinceDays)}if(t.op==="telemetry-gains"){let i=s.redDb();if(!i)throw new Error("rsp telemetry gains require the shared RedDB store");return await wo(i,t.sinceDays)}if(t.op==="mint")return{handle:await s.mint(Buffer.from(t.original,"base64"),t.meta)};if(t.op==="get")return iE(await s.get(t.handle));if(t.op==="memory")return await s.memory(t.action,t.payload);if(t.op==="brain")return await sE(s,r,t.action,t.payload);throw new Error(`unsupported resident op: ${t.op??"unknown"}`)}async function sE(e,t,r,n){let s=e.redDb();if(!s)throw new Error("resident brain operations require the shared RedDB store");return await hp(s,t).request(r,n)}function iE(e){return e?"status"in e?e:{...e,original:e.original.toString("base64"),original_encoding:"base64"}:null}var Bx,Mx,Cp,jx,Ux,Jx,La,xp,kp,$p=b(()=>{"use strict";De();$n();Ie();Ke();Rp();xe();Se();Bx=256*1024,Mx=500,Cp=2e3,jx=Math.max(1,Number(process.env.RSP_TEST_IDLE_SHUTDOWN_WATCHDOG_MS??"10000")),Ux="rsp-status-summary.json",Jx=[re,G,ue,Ne,Ur],La=class{constructor(t,r){this.store=t;this.opts=r;this.pendingHeals=[...r.bootHeals??[]]}running;pending=!1;pendingHeals;async drainAndSweep(){if(this.running){this.pending=!0,await this.running;return}this.running=(async()=>{do this.pending=!1,await this.drainAndSweepOnce();while(this.pending)})().finally(()=>{this.running=void 0}),await this.running}async drainAndSweepOnce(){let t=this.store.redDb();if(!t)return;let r=await Gx(t);r.unshift(...this.pendingHeals),this.pendingHeals=[];let n=await this.readIndex(t),s=n.records.length,i=[...n.records];for(let a of r)i.push(await this.writeDrainDegradation(t,{reason:"telemetry collection model mismatch",command:"rsp resident telemetry drain",source_collection:a.collection,error:`expected kv, got ${a.previousModel}`,bytes:0}));await ho(this.opts.rootDir,async a=>{let c=er(a);if(!c){let u=await this.writeDrainDegradation(t,{reason:"telemetry parse failed",command:"unknown",bytes:Buffer.byteLength(a,"utf8")});return i.push(u),!0}try{let u=await this.writeEvent(t,c);i.push(u);let l=await this.writeAccountingMirror(t,c);return l&&i.push(l),!0}catch(u){let l=await this.writeDrainDegradation(t,{reason:"telemetry event dropped",command:q(c.command)||"unknown",source_id:q(c.id),source_collection:q(c.collection),error:u instanceof Error?u.message:String(u),bytes:Buffer.byteLength(a,"utf8")});return i.push(l),!0}});let o=i.length>s;await this.prune(t,{version:1,records:i},o),await Fx(t,this.opts.rootDir)}async writeEvent(t,r){let n=new Date,s=typeof r.created_at=="string"?r.created_at:n.toISOString(),i=new Date(Date.parse(s)+this.opts.ttlDays*24*60*60*1e3).toISOString(),o=typeof r.id=="string"&&r.id.trim()!==""?r.id:mr(),a={...await Qx(r),id:o,created_at:s,expires_at:i};return await t.kv(r.collection).put(o,a),{collection:r.collection,key:o,created_at:s,expires_at:i,bytes:r.collection===re?0:typeof r.bytes=="number"&&Number.isFinite(r.bytes)?Math.max(0,r.bytes):Buffer.byteLength(JSON.stringify(a),"utf8")}}async writeAccountingMirror(t,r){return r.collection===re||r.accounting_recorded===!0?null:r.collection===ue?await this.writeEvent(t,{collection:re,id:`mirror:${q(r.id)||mr()}`,created_at:q(r.created_at)||q(r.ts)||new Date().toISOString(),event_type:"invocation",command:q(r.command)||"unknown",command_class:$a(q(r.command)||"unknown"),wrapper:r.wrapper,loss:r.loss,elided:r.elided,raw_bytes:r.raw_bytes,emitted_bytes:r.emitted_bytes,tokens_raw:r.tokens_raw,tokens_emitted:r.tokens_emitted,estimated:r.estimated,wrapper_ms:r.wrapper_ms,store_open_count:r.store_open_count,store_elapsed_ms:r.store_elapsed_ms}):r.collection===Ne?await this.writeEvent(t,{collection:re,id:`mirror:${q(r.id)||mr()}`,created_at:q(r.created_at)||q(r.ts)||new Date().toISOString(),event_type:"invocation",command:q(r.command)||"unknown",command_class:$a(q(r.command)||"unknown"),loss:"lossless",raw_bytes:0,emitted_bytes:0,degradation_reason:q(r.reason)||"unknown",wrapper_family:q(r.wrapper_family),wrapper_exit_code:r.wrapper_exit_code,stderr_head:q(r.stderr_head)}):null}async writeDrainDegradation(t,r){let n=await this.writeEvent(t,{collection:Ne,id:mr(),created_at:new Date().toISOString(),reason:r.reason,command:r.command,bytes:r.bytes,source_id:r.source_id,source_collection:r.source_collection,error:r.error});return await this.writeEvent(t,{collection:re,id:`mirror:${mr()}`,created_at:n.created_at,event_type:"invocation",command:r.command,command_class:$a(r.command),loss:"lossless",raw_bytes:0,emitted_bytes:0,degradation_reason:r.reason,source_id:r.source_id,source_collection:r.source_collection,error:r.error}),n}async readIndex(t){let r=await t.kv(Ur).get("index:v1"),n=typeof r=="string"?eE(r):r;return tE(n)?n:{version:1,records:[]}}async writeIndex(t,r){await t.kv(Ur).put("index:v1",r)}async prune(t,r,n=!1){let s=Date.now(),i=[];for(let a of r.records)Date.parse(a.expires_at)<=s?await t.kv(a.collection).delete(a.key):i.push(a);let o=i.reduce((a,c)=>a+c.bytes,0);for(i.sort((a,c)=>a.created_at.localeCompare(c.created_at));o>this.opts.byteBudget&&i.length>0;){let a=i.shift();o-=a.bytes,await t.kv(a.collection).delete(a.key)}(n||i.length<r.records.length)&&await this.writeIndex(t,{version:1,records:i})}};xp=!1});Ce();function he(e,t){let r=e.indexOf(t);return r>=0?e[r+1]:void 0}function U(e,t){let r=he(e,t);if(r==null)return;let n=Number(r);return Number.isFinite(n)&&n>0?n:void 0}function cc(e){return e[0]==="--help"||e[0]==="-h"||e.includes("--help")||e.includes("-h")}function uc(e){let t={level:"lossless",positional:[]},r=[];for(let n=0;n<e.length;n++){let s=e[n];if(s==="--store-uri")t.storeUri=e[++n];else if(s==="--brief")t.level="brief";else if(s==="--terse")t.level="terse";else if(s==="--query")t.query=e[++n];else if(s.startsWith("--query="))t.query=s.slice(8);else{if(r.length===0&&s.startsWith("--"))throw new di(s);r.push(s)}}return t.query&&r[0]!=="show"&&!r.some(n=>n==="--query"||n.startsWith("--query="))&&r.push("--query",t.query),t.command=r[0],t.handle=r[1],t.positional=r,t}var di=class extends Error{constructor(r){super(`unknown flag: ${r}`);this.flag=r}render(){return Sn("rsp",this.flag,["--store-uri","--brief","--terse","--query"],"rsp --help")}};function Ft(e){return typeof e=="object"&&e!==null&&"render"in e&&typeof e.render=="function"}function lc(e){let t=e[1];if(!t)return null;let r={};for(let n=2;n<e.length;n++){let s=e[n];if(s!=="-f"&&s!=="-F")continue;let i=e[++n]??"",o=i.indexOf("=");o<=0||(r[i.slice(0,o)]=i.slice(o+1))}return{path:t,params:r}}function xn(e,t){let r=he(e,"--since")??e.find(i=>i.startsWith("--since="))?.slice(8);if(!r)return t;let n=/^(\d+)(d)?$/.exec(r);if(!n)return t;let s=Number(n[1]);return Number.isFinite(s)&&s>0?s:t}function dc(e){return e.includes("--full")}Ie();import{existsSync as oE}from"node:fs";import{fileURLToPath as aE}from"node:url";function Rc(e){let t={app:e,version:vm(Gt("__RED_BUILD_VERSION__",()=>"2.77.
|
|
158
|
+
`)}catch{}}async function nE(e,t,r,n){if(t.op==="handover")return{handover:!0,version:n,clientVersion:t.clientVersion};if(e.kind==="opening")throw new Error("rsp resident store is not ready");if(e.kind==="failed")throw new Error(`rsp resident store failed to open: ${e.error.message}`);let s=e.store;if(t.op==="ping")return{pong:!0,version:n};if(t.op==="stats")return await s.stats();if(t.op==="accounting-stats"){let i=s.redDb();if(!i)throw new Error("rsp accounting stats require the shared RedDB store");return await yo(i,t.byteBudget)}if(t.op==="telemetry-stats"){let i=s.redDb();if(!i)throw new Error("rsp telemetry stats require the shared RedDB store");return await es(i,t.sinceDays)}if(t.op==="telemetry-gains"){let i=s.redDb();if(!i)throw new Error("rsp telemetry gains require the shared RedDB store");return await wo(i,t.sinceDays)}if(t.op==="mint")return{handle:await s.mint(Buffer.from(t.original,"base64"),t.meta)};if(t.op==="get")return iE(await s.get(t.handle));if(t.op==="memory")return await s.memory(t.action,t.payload);if(t.op==="brain")return await sE(s,r,t.action,t.payload);throw new Error(`unsupported resident op: ${t.op??"unknown"}`)}async function sE(e,t,r,n){let s=e.redDb();if(!s)throw new Error("resident brain operations require the shared RedDB store");return await hp(s,t).request(r,n)}function iE(e){return e?"status"in e?e:{...e,original:e.original.toString("base64"),original_encoding:"base64"}:null}var Bx,Mx,Cp,jx,Ux,Jx,La,xp,kp,$p=b(()=>{"use strict";De();$n();Ie();Ke();Rp();xe();Se();Bx=256*1024,Mx=500,Cp=2e3,jx=Math.max(1,Number(process.env.RSP_TEST_IDLE_SHUTDOWN_WATCHDOG_MS??"10000")),Ux="rsp-status-summary.json",Jx=[re,G,ue,Ne,Ur],La=class{constructor(t,r){this.store=t;this.opts=r;this.pendingHeals=[...r.bootHeals??[]]}running;pending=!1;pendingHeals;async drainAndSweep(){if(this.running){this.pending=!0,await this.running;return}this.running=(async()=>{do this.pending=!1,await this.drainAndSweepOnce();while(this.pending)})().finally(()=>{this.running=void 0}),await this.running}async drainAndSweepOnce(){let t=this.store.redDb();if(!t)return;let r=await Gx(t);r.unshift(...this.pendingHeals),this.pendingHeals=[];let n=await this.readIndex(t),s=n.records.length,i=[...n.records];for(let a of r)i.push(await this.writeDrainDegradation(t,{reason:"telemetry collection model mismatch",command:"rsp resident telemetry drain",source_collection:a.collection,error:`expected kv, got ${a.previousModel}`,bytes:0}));await ho(this.opts.rootDir,async a=>{let c=er(a);if(!c){let u=await this.writeDrainDegradation(t,{reason:"telemetry parse failed",command:"unknown",bytes:Buffer.byteLength(a,"utf8")});return i.push(u),!0}try{let u=await this.writeEvent(t,c);i.push(u);let l=await this.writeAccountingMirror(t,c);return l&&i.push(l),!0}catch(u){let l=await this.writeDrainDegradation(t,{reason:"telemetry event dropped",command:q(c.command)||"unknown",source_id:q(c.id),source_collection:q(c.collection),error:u instanceof Error?u.message:String(u),bytes:Buffer.byteLength(a,"utf8")});return i.push(l),!0}});let o=i.length>s;await this.prune(t,{version:1,records:i},o),await Fx(t,this.opts.rootDir)}async writeEvent(t,r){let n=new Date,s=typeof r.created_at=="string"?r.created_at:n.toISOString(),i=new Date(Date.parse(s)+this.opts.ttlDays*24*60*60*1e3).toISOString(),o=typeof r.id=="string"&&r.id.trim()!==""?r.id:mr(),a={...await Qx(r),id:o,created_at:s,expires_at:i};return await t.kv(r.collection).put(o,a),{collection:r.collection,key:o,created_at:s,expires_at:i,bytes:r.collection===re?0:typeof r.bytes=="number"&&Number.isFinite(r.bytes)?Math.max(0,r.bytes):Buffer.byteLength(JSON.stringify(a),"utf8")}}async writeAccountingMirror(t,r){return r.collection===re||r.accounting_recorded===!0?null:r.collection===ue?await this.writeEvent(t,{collection:re,id:`mirror:${q(r.id)||mr()}`,created_at:q(r.created_at)||q(r.ts)||new Date().toISOString(),event_type:"invocation",command:q(r.command)||"unknown",command_class:$a(q(r.command)||"unknown"),wrapper:r.wrapper,loss:r.loss,elided:r.elided,raw_bytes:r.raw_bytes,emitted_bytes:r.emitted_bytes,tokens_raw:r.tokens_raw,tokens_emitted:r.tokens_emitted,estimated:r.estimated,wrapper_ms:r.wrapper_ms,store_open_count:r.store_open_count,store_elapsed_ms:r.store_elapsed_ms}):r.collection===Ne?await this.writeEvent(t,{collection:re,id:`mirror:${q(r.id)||mr()}`,created_at:q(r.created_at)||q(r.ts)||new Date().toISOString(),event_type:"invocation",command:q(r.command)||"unknown",command_class:$a(q(r.command)||"unknown"),loss:"lossless",raw_bytes:0,emitted_bytes:0,degradation_reason:q(r.reason)||"unknown",wrapper_family:q(r.wrapper_family),wrapper_exit_code:r.wrapper_exit_code,stderr_head:q(r.stderr_head)}):null}async writeDrainDegradation(t,r){let n=await this.writeEvent(t,{collection:Ne,id:mr(),created_at:new Date().toISOString(),reason:r.reason,command:r.command,bytes:r.bytes,source_id:r.source_id,source_collection:r.source_collection,error:r.error});return await this.writeEvent(t,{collection:re,id:`mirror:${mr()}`,created_at:n.created_at,event_type:"invocation",command:r.command,command_class:$a(r.command),loss:"lossless",raw_bytes:0,emitted_bytes:0,degradation_reason:r.reason,source_id:r.source_id,source_collection:r.source_collection,error:r.error}),n}async readIndex(t){let r=await t.kv(Ur).get("index:v1"),n=typeof r=="string"?eE(r):r;return tE(n)?n:{version:1,records:[]}}async writeIndex(t,r){await t.kv(Ur).put("index:v1",r)}async prune(t,r,n=!1){let s=Date.now(),i=[];for(let a of r.records)Date.parse(a.expires_at)<=s?await t.kv(a.collection).delete(a.key):i.push(a);let o=i.reduce((a,c)=>a+c.bytes,0);for(i.sort((a,c)=>a.created_at.localeCompare(c.created_at));o>this.opts.byteBudget&&i.length>0;){let a=i.shift();o-=a.bytes,await t.kv(a.collection).delete(a.key)}(n||i.length<r.records.length)&&await this.writeIndex(t,{version:1,records:i})}};xp=!1});Ce();function he(e,t){let r=e.indexOf(t);return r>=0?e[r+1]:void 0}function U(e,t){let r=he(e,t);if(r==null)return;let n=Number(r);return Number.isFinite(n)&&n>0?n:void 0}function cc(e){return e[0]==="--help"||e[0]==="-h"||e.includes("--help")||e.includes("-h")}function uc(e){let t={level:"lossless",positional:[]},r=[];for(let n=0;n<e.length;n++){let s=e[n];if(s==="--store-uri")t.storeUri=e[++n];else if(s==="--brief")t.level="brief";else if(s==="--terse")t.level="terse";else if(s==="--query")t.query=e[++n];else if(s.startsWith("--query="))t.query=s.slice(8);else{if(r.length===0&&s.startsWith("--"))throw new di(s);r.push(s)}}return t.query&&r[0]!=="show"&&!r.some(n=>n==="--query"||n.startsWith("--query="))&&r.push("--query",t.query),t.command=r[0],t.handle=r[1],t.positional=r,t}var di=class extends Error{constructor(r){super(`unknown flag: ${r}`);this.flag=r}render(){return Sn("rsp",this.flag,["--store-uri","--brief","--terse","--query"],"rsp --help")}};function Ft(e){return typeof e=="object"&&e!==null&&"render"in e&&typeof e.render=="function"}function lc(e){let t=e[1];if(!t)return null;let r={};for(let n=2;n<e.length;n++){let s=e[n];if(s!=="-f"&&s!=="-F")continue;let i=e[++n]??"",o=i.indexOf("=");o<=0||(r[i.slice(0,o)]=i.slice(o+1))}return{path:t,params:r}}function xn(e,t){let r=he(e,"--since")??e.find(i=>i.startsWith("--since="))?.slice(8);if(!r)return t;let n=/^(\d+)(d)?$/.exec(r);if(!n)return t;let s=Number(n[1]);return Number.isFinite(s)&&s>0?s:t}function dc(e){return e.includes("--full")}Ie();import{existsSync as oE}from"node:fs";import{fileURLToPath as aE}from"node:url";function Rc(e){let t={app:e,version:vm(Gt("__RED_BUILD_VERSION__",()=>"2.77.1")??"0.0.0-dev"),gitSha:Gt("__RED_BUILD_GIT_SHA__",()=>"226791d23489e1390ea379faba0b53116e872c62")??"unknown",buildTime:Gt("__RED_BUILD_TIME__",()=>"2026-07-21T10:45:46-03:00")??"unknown",bundleAsset:Gt("__RED_BUNDLE_ASSET__",()=>"rsp.bundle.min.mjs")??"unknown"},r=Gt("__REDDB_SDK_VERSION__",()=>"1.23.1"),n=Gt("__REDDB_BINARY_TAG__",()=>"v1.23.1");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function vm(e){return e.startsWith("v")?e.slice(1):e}function Gt(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}Ce();Ie();xr();import{existsSync as Qw}from"node:fs";import{fileURLToPath as Zw}from"node:url";Ni();Ie();Bi();import{existsSync as hy}from"node:fs";import{fileURLToPath as yy}from"node:url";async function sr(e,t){let r={stats:wy(e.telemetryByteBudget),telemetry:Ro(t)};if(!e.storeUri.startsWith("file://"))return r;let n=yy(e.storeUri);if(!hy(n))return r;if(!n.endsWith("red-skills.rdb")){let{RspElisionStore:c}=await Promise.resolve().then(()=>(Ke(),Qt)),u=await c.open({uri:e.storeUri,ttlDays:e.ttlDays,ephemeralTtlHours:e.ephemeralTtlHours,byteBudget:e.byteBudget});try{return{stats:await u.stats(),telemetry:Ro(t)}}finally{await u.close()}}let{ensureReddbBinaryFromWarmCache:s}=await Promise.resolve().then(()=>(Ke(),Qt));await s();let{readAccountingLaneStats:i,readTelemetryStats:o}=await Promise.resolve().then(()=>(xe(),Gr)),a=await qt(e.storeUri);try{return{stats:await i(a,e.telemetryByteBudget),telemetry:await o(a,t)}}finally{await a.close()}}function So(e,t=Ro(30),r=!1){return`${j(xo(e,t,r))}
|
|
159
159
|
`}function xo(e,t,r){let n=t.savings.top_commands.slice(0,r?10:3),s=r?t.savings.daily_tokens_saved:t.savings.daily_tokens_saved.slice(-7),i=e.storage_classes??ts(),o=t.health.recent_failures.slice(0,r?20:5),a=t.decisions.top_pass_reasons.slice(0,r?10:3);return{records:e.records,bytes:e.bytes,oldest:e.oldest,budget:e.budget,storage_classes:i,savings:{window_days:t.window_days,empty:t.empty,...t.savings,tokens_saved_display:by(t.savings),dollars_saved_estimate_usd_display:_y(t.savings),daily_tokens_saved:s,daily_tokens_saved_elided:r?0:Math.max(0,t.savings.daily_tokens_saved.length-s.length),top_commands:n,top_commands_elided:r?0:Math.max(0,t.savings.top_commands.length-n.length)},health:{...t.health,degradation_rate_display:_o(t.health.degradation_rate),show_hit_rate_display:_o(t.health.show_hit_rate),by_reason:t.health.by_reason,by_family:t.health.by_family,recent_failures:o,recent_failures_elided:r?0:Math.max(0,t.health.recent_failures.length-o.length),most_recent_degradation_at:t.health.most_recent?.timestamp??null,most_recent_degradation_reason:t.health.most_recent?.reason??null},decisions:{...t.decisions,contribution_rate_display:_o(t.decisions.contribution_rate),top_pass_reasons:a,top_pass_reasons_elided:r?0:Math.max(0,t.decisions.top_pass_reasons.length-a.length)},latency:{...t.latency,wrapper_ms_p50_display:bo(t.latency.wrapper_ms_p50),wrapper_ms_p95_display:bo(t.latency.wrapper_ms_p95),store_elapsed_ms_avg_display:bo(t.latency.store_elapsed_ms_avg)}}}function Zu(e){return`${j(e)}
|
|
160
160
|
`}function Ro(e){return{window_days:e,empty:!0,savings:{invocations:0,elided:0,raw_bytes:0,emitted_bytes:0,bytes_saved:0,tokens_saved:0,tokens_saved_estimated:!1,token_estimate_range_pct:null,tokens_saved_low:null,tokens_saved_high:null,dollars_saved_estimate_usd:0,dollars_saved_low_usd:null,dollars_saved_high_usd:null,pricing_model_family:"gpt-5",pricing_input_usd_per_million_tokens:1.25,pricing_note:"estimate derived from byte-based token estimate when token counts are estimated",daily_tokens_saved:[],top_commands:[]},health:{degradations:0,degradation_rate:0,show_total:0,show_hits:0,show_misses:0,show_hit_rate:0,by_reason:[],by_family:[],recent_failures:[],most_recent:null},latency:{wrapper_ms_p50:null,wrapper_ms_p95:null,store_open_count_sum:0,store_elapsed_ms_sum:0,store_elapsed_ms_avg:null},decisions:{seen:0,contributed:0,passed:0,failed_open:0,quota_free_saved_units:0,contribution_rate:0,top_pass_reasons:[]}}}function wy(e){return{records:0,bytes:0,oldest:null,budget:e,storage_classes:ts()}}function ts(){return{derivable:{records:0,bytes:0,raw_bytes:0},"re-executable":{records:0,bytes:0,raw_bytes:0},ephemeral:{records:0,bytes:0,raw_bytes:0}}}function Eo(e){let t=e.legacyStoreMigrated?"migrated":e.storeCreated?"created":"existing";return[`config: ${e.configChanged?"updated":"unchanged"}`,`store: ${t}`,""].join(`
|
|
161
161
|
`)}function by(e){return e.tokens_saved_estimated?`${e.tokens_saved_low}-${e.tokens_saved_high} (estimate_midpoint: ${e.tokens_saved}, range_pct: ${e.token_estimate_range_pct})`:String(e.tokens_saved)}function _y(e){return e.dollars_saved_low_usd==null||e.dollars_saved_high_usd==null?Cr(e.dollars_saved_estimate_usd):`${Cr(e.dollars_saved_low_usd)}-${Cr(e.dollars_saved_high_usd)} (estimate_midpoint: ${Cr(e.dollars_saved_estimate_usd)})`}function bo(e){return e==null?"none":String(e)}function _o(e){return e.toFixed(4).replace(/0+$/,"").replace(/\.$/,".0")}async function Wl(e){let{stats:t,telemetry:r}=await sr(e,30),[n,s]=await Promise.all([Xw(e),Promise.resolve().then(()=>(Jo(),Uo)).then(i=>i.listWaits(process.cwd()),()=>[])]);return{stats:t,telemetry:r,recoveryHandles:n,waits:s}}function Hl(e){let t=xo(e.stats,e.telemetry,!1),r=gi({executable:{name:"rsp",command:"rsp"},recovery:{pending:e.recoveryHandles.length,handles:e.recoveryHandles},waits:{active:e.waits.length,entries:e.waits},store:{records:e.stats.records,bytes:e.stats.bytes,oldest:e.stats.oldest,budget:e.stats.budget,storage_classes:e.stats.storage_classes??ts()},savings:t.savings,health:t.health,decisions:t.decisions,latency:t.latency},eb(e));return`${j(r)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reddb-io/red-skills",
|
|
3
|
-
"version": "2.77.
|
|
3
|
+
"version": "2.77.1",
|
|
4
4
|
"description": "RedSkills plugin runtime bundles (dev, code-nav, memory, brain) distributed over npm — the v2 client transport (ADR 0091). Carries the platform-independent JS bundles inside the tarball plus thin bin shims; no postinstall download.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
16
|
"red-skills-dev": "bin/red-skills-dev.mjs",
|
|
17
|
+
"red-skills-afk-mcp": "bin/red-skills-afk-mcp.mjs",
|
|
17
18
|
"red-skills-code-nav": "bin/red-skills-code-nav.mjs",
|
|
18
19
|
"red-skills-memory": "bin/red-skills-memory.mjs",
|
|
19
20
|
"red-skills-brain": "bin/red-skills-brain.mjs",
|