@xenosystem/agent-sdk 0.10.29 → 0.10.31
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/artifacts/index.cjs +6 -6
- package/dist/artifacts/index.js +7 -7
- package/dist/artifacts/metafile-cjs.json +1 -1
- package/dist/artifacts/metafile-esm.json +1 -1
- package/dist/automation/index.cjs +1 -1
- package/dist/automation/index.d.cts +6 -2
- package/dist/automation/index.d.ts +6 -2
- package/dist/automation/index.js +1 -1
- package/dist/automation/metafile-cjs.json +1 -1
- package/dist/automation/metafile-esm.json +1 -1
- package/dist/control-plane/index.cjs +1 -1
- package/dist/control-plane/index.js +1 -1
- package/dist/coordination/index.cjs +2 -2
- package/dist/coordination/index.d.cts +9 -3
- package/dist/coordination/index.d.ts +9 -3
- package/dist/coordination/index.js +2 -2
- package/dist/coordination/metafile-cjs.json +1 -1
- package/dist/coordination/metafile-esm.json +1 -1
- package/dist/electron/index.cjs +199 -178
- package/dist/electron/index.d.cts +20 -2
- package/dist/electron/index.d.ts +20 -2
- package/dist/electron/index.js +199 -178
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/hosted/index.cjs +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/hosted/metafile-cjs.json +1 -1
- package/dist/hosted/metafile-esm.json +1 -1
- package/dist/index.cjs +374 -353
- package/dist/index.d.cts +93 -13
- package/dist/index.d.ts +93 -13
- package/dist/index.js +375 -354
- package/dist/intelligence/index.cjs +5 -5
- package/dist/intelligence/index.js +6 -6
- package/dist/intelligence/metafile-cjs.json +1 -1
- package/dist/intelligence/metafile-esm.json +1 -1
- package/dist/mcp/index.d.cts +6 -2
- package/dist/mcp/index.d.ts +6 -2
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/recipes/metafile-cjs.json +1 -1
- package/dist/recipes/metafile-esm.json +1 -1
- package/dist/research/metafile-cjs.json +1 -1
- package/dist/research/metafile-esm.json +1 -1
- package/dist/session/index.cjs +22 -22
- package/dist/session/index.d.cts +15 -0
- package/dist/session/index.d.ts +15 -0
- package/dist/session/index.js +22 -22
- package/dist/session/metafile-cjs.json +1 -1
- package/dist/session/metafile-esm.json +1 -1
- package/dist/sharing/index.cjs +2 -2
- package/dist/sharing/index.js +3 -3
- package/dist/sharing/metafile-cjs.json +1 -1
- package/dist/sharing/metafile-esm.json +1 -1
- package/dist/skills/index.d.cts +5 -1
- package/dist/skills/index.d.ts +5 -1
- package/dist/utils/index.cjs +19 -18
- package/dist/utils/index.d.cts +5 -2
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.js +19 -18
- package/dist/utils/metafile-cjs.json +1 -1
- package/dist/utils/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/utils/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import{readdirSync as
|
|
2
|
-
`,"utf-8")}async function
|
|
3
|
-
`,"utf-8"),await r.sync()}finally{await r.close()}}function
|
|
4
|
-
`)?"CRLF":"LF"}function
|
|
1
|
+
import{readdirSync as v,readFileSync as K}from"node:fs";import{existsSync as A,statSync as N}from"node:fs";import*as u from"node:fs/promises";import*as a from"node:path";function Yt(t){try{return A(t)&&N(t).isFile()}catch{return!1}}function Ut(t){try{return A(t)&&N(t).isDirectory()}catch{return!1}}function Gt(t,e=""){try{return K(t,"utf-8")}catch{return e}}async function C(t){await u.mkdir(t,{recursive:!0})}async function Z(t,e){let n=a.dirname(t);await C(n);let r=Math.random().toString(36).substring(2,15),o=`${t}.tmp.${process.pid}.${r}`;try{await u.writeFile(o,e),await tt(o,t)}finally{try{await u.unlink(o)}catch{}}}var Q=new Set(["EACCES","EBUSY","EPERM"]),V=[10,20,40,80,160,320,640];async function tt(t,e){for(let n=0;;n+=1)try{await u.rename(t,e);return}catch(r){let o=r.code,i=V[n];if(process.platform!=="win32"||!o||!Q.has(o)||i===void 0)throw r;await new Promise(s=>setTimeout(s,i))}}async function Kt(t,e){let n=a.dirname(t);await C(n),await u.appendFile(t,e+`
|
|
2
|
+
`,"utf-8")}async function Zt(t,e){let n=a.dirname(t);await C(n);let r=await u.open(t,"a");try{await r.writeFile(e+`
|
|
3
|
+
`,"utf-8"),await r.sync()}finally{await r.close()}}function et(t){return t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191?"utf8-bom":t.length>=2&&t[0]===255&&t[1]===254?"utf16le":t.length>=2&&t[0]===254&&t[1]===255?"utf16be":"utf8"}function O(t){let e=Buffer.from(t);for(let n=0;n+1<e.length;n+=2){let r=e[n];e[n]=e[n+1],e[n+1]=r}return e}function nt(t,e){switch(e){case"utf8-bom":return t.subarray(3).toString("utf8");case"utf16le":return t.subarray(2).toString("utf16le");case"utf16be":return O(t.subarray(2)).toString("utf16le");default:return t.toString("utf8")}}function rt(t,e){switch(e){case"utf8-bom":return Buffer.concat([Buffer.from([239,187,191]),Buffer.from(t,"utf8")]);case"utf16le":return Buffer.concat([Buffer.from([255,254]),Buffer.from(t,"utf16le")]);case"utf16be":return Buffer.concat([Buffer.from([254,255]),O(Buffer.from(t,"utf16le"))]);default:return Buffer.from(t,"utf8")}}function ot(t){return t.includes(`\r
|
|
4
|
+
`)?"CRLF":"LF"}function it(t,e){let n=t.replace(/\r\n/g,`
|
|
5
5
|
`);return e==="CRLF"?n.replace(/\n/g,`\r
|
|
6
|
-
`):n}
|
|
7
|
-
`)){let r=n.
|
|
8
|
-
`)
|
|
9
|
-
`))
|
|
10
|
-
`)}function
|
|
11
|
-
|
|
6
|
+
`):n}function Qt(t){return t.includes(`\r
|
|
7
|
+
`)?/(^|[^\r])\n/.test(t):!1}async function st(t){let e=await u.readFile(t),n=et(e),r=nt(e,n);return{content:r,encoding:n,lineEnding:ot(r),sizeBytes:e.length}}async function Vt(t,e,n){let r=n?.preserveLineEndings?e:it(e,n?.lineEnding??"LF");await Z(t,rt(r,n?.encoding??"utf8"))}async function te(t){let e=new Set,n=a.resolve(t);for(;!e.has(n);){e.add(n);try{let o=v(n,{withFileTypes:!0}).filter(i=>i.isFile()).map(i=>i.name).sort();for(let i of o){if(i.startsWith("."))continue;let s=a.extname(i).toLowerCase();if([".ts",".tsx",".js",".jsx",".json",".md",".txt",".yaml",".yml",".css",".html",".xml",".sh",".ps1"].includes(s))try{let l=a.join(n,i),c=await st(l);if(c.content.length>0)return c.lineEnding}catch{}}}catch{}let r=a.dirname(n);if(r===n)break;n=r}return"LF"}function at(t,e,n){let r=[],o=[{dir:t,depth:0}],i=new Set;for(;o.length>0&&r.length<n;){let s=o.shift();if(!i.has(s.dir)){i.add(s.dir);try{let l=v(s.dir,{withFileTypes:!0});for(let c of l){let f=a.join(s.dir,c.name);if(c.isFile()){if(r.push(f),r.length>=n)break;continue}c.isDirectory()&&s.depth<e&&!c.name.startsWith(".")&&c.name!=="node_modules"&&o.push({dir:f,depth:s.depth+1})}}catch{}}}return r}function $(t,e){let n=a.relative(t,e);return n===""||!n.startsWith("..")&&!a.isAbsolute(n)}function ee(t,e){try{let n=a.dirname(t),r=a.basename(t,a.extname(t)).toLowerCase(),o=a.basename(t).toLowerCase(),i=[n,a.dirname(n)],s=e!==void 0&&$(e,t)?e:void 0,l=i.flatMap(f=>at(f,2,500)).filter(f=>s===void 0||$(s,f)),c=null;for(let f of l){let x=a.basename(f).toLowerCase(),y=a.basename(f,a.extname(f)).toLowerCase(),g=null;if(x===o?g=0:y===r?g=1:(x.includes(r)||r.includes(y))&&(g=2),g===null)continue;let G=a.relative(n,f).split(a.sep).length,S=g+G*.01;(!c||S<c.score)&&(c={filePath:f,score:S})}return c?.filePath??null}catch{}return null}async function ne(t){try{return await u.readFile(t,"utf-8")}catch(e){if(e.code==="ENOENT")return null;throw e}}function re(t){return A(t)}async function oe(t,e){try{let r=(await u.readdir(t,{withFileTypes:!0})).filter(o=>o.isFile()).map(o=>a.join(t,o.name));return e&&(r=r.filter(o=>e.test(a.basename(o)))),r}catch(n){if(n.code==="ENOENT")return[];throw n}}async function ie(t){try{return(await u.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>a.join(t,n.name))}catch(e){if(e.code==="ENOENT")return[];throw e}}async function se(t){try{await u.unlink(t)}catch(e){if(e.code!=="ENOENT")throw e}}async function ae(t){try{await u.rm(t,{recursive:!0,force:!0})}catch(e){if(e.code!=="ENOENT")throw e}}function ce(t,e){try{return JSON.parse(t)}catch{return e}}function fe(t,e="{}"){try{return JSON.stringify(t)}catch{return e}}function le(t){let e=[];for(let n of t.split(`
|
|
8
|
+
`)){let r=n.trim();if(r)try{e.push(JSON.parse(r))}catch{}}return e}function pe(t){let e=ut(t);return{frontmatter:e.frontmatter,content:e.content.trim()}}function me(t,e){let n=Object.fromEntries(Object.entries(t).filter(([r,o])=>o!==void 0));return["---",I(n),"---","",e].join(`
|
|
9
|
+
`)}function ge(t){return t.trimStart().startsWith("---")}function ut(t){let e=t.replace(/^\uFEFF/,"");if(!e.startsWith("---"))return{frontmatter:{},content:t};let n=e.search(/\r?\n/);if(n<0||e.slice(0,n).trim()!=="---")return{frontmatter:{},content:t};let r=e.slice(n+(e[n]==="\r"?2:1)),o=r.match(/(?:^|\r?\n)---[ \t]*(?:\r?\n|$)/);if(!o||o.index===void 0)throw new Error("YAML frontmatter is not closed.");let i=r.slice(0,o.index),s=o[0],l=o.index+s.length;return{frontmatter:B(i),content:r.slice(l)}}function B(t){let e={},n=t.split(/\r?\n/);for(let r=0;r<n.length;r+=1){let o=n[r];if(!o.trim()||o.trimStart().startsWith("#"))continue;if(/^\s/.test(o))throw new Error(`Unexpected indentation at line ${r+1}.`);let i=ft(o,r+1);if(i.key==="<<")throw new Error("YAML merge keys are not supported.");if(i.value!==""){e[i.key]=P(i.value,r+1);continue}let s=ct(n,r+1);e[i.key]=s.value,r=s.nextIndex-1}return e}function ct(t,e){let n=[],r=e;for(;r<t.length;r+=1){let i=t[r];if(!i.trim()){n.push(i);continue}if(!/^\s/.test(i))break;n.push(i.replace(/^ {2}/,""))}let o=n.filter(i=>i.trim()&&!i.trimStart().startsWith("#"));return o.length===0?{value:{},nextIndex:r}:o.every(i=>i.trimStart().startsWith("- "))?{value:o.map((i,s)=>P(i.trimStart().slice(2),e+s+1)),nextIndex:r}:{value:B(n.join(`
|
|
10
|
+
`)),nextIndex:r}}function ft(t,e){let n=t.indexOf(":");if(n<=0)throw new Error(`Invalid YAML line ${e}.`);let r=t.slice(0,n).trim(),o=t.slice(n+1).trim();if(!r)throw new Error(`Invalid YAML key at line ${e}.`);return{key:r,value:o}}function P(t,e){if(t==="")return"";if(t==="[]")return[];if(t==="{}")return{};if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;if(/^-?\d+(?:\.\d+)?$/.test(t))return Number(t);if(t.startsWith('"'))return L(t,e);if(t.startsWith("'")){if(!t.endsWith("'"))throw new Error(`Unclosed quoted scalar at line ${e}.`);return t.slice(1,-1).replace(/''/g,"'")}if(t.startsWith("[")||t.startsWith("{"))return L(t,e);if(t.includes("[")||t.includes("]")||t.includes("{")||t.includes("}"))throw new Error(`Unsupported YAML scalar at line ${e}.`);return t}function L(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid YAML scalar at line ${e}.`)}}function I(t,e=""){return Object.entries(t).map(([n,r])=>lt(n,r,e)).join(`
|
|
11
|
+
`)}function lt(t,e,n){return Array.isArray(e)?`${n}${t}: ${JSON.stringify(e)}`:e&&typeof e=="object"?`${n}${t}:
|
|
12
|
+
${I(e,`${n} `)}`:`${n}${t}: ${JSON.stringify(e)}`}import*as d from"path";function dt(t,e){let n=d.resolve(t),r=d.resolve(t,e);return r===n?!0:n===d.parse(n).root?r.startsWith(n):r.startsWith(n+d.sep)}function xe(t,e){if(d.isAbsolute(e))return d.resolve(e);if(!dt(t,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return d.resolve(t,e)}function ye(t,e=process.platform){let n=d.resolve(t);return e==="win32"?n.toLowerCase():n}import{homedir as k,platform as pt,release as mt}from"node:os";import{execSync as gt}from"node:child_process";import{resolve as h}from"node:path";var M=pt(),ht=M==="win32",Te=M==="darwin",Ae=M==="linux",Ce=mt(),ke=k();function Me(){let t=process.env.XENO_AGENT_HOME?.trim();return t?h(t):h(k(),".xeno-agent")}function _e(){let t=process.env.XENO_CONFIG_DIR?.trim();return t?h(t):h(k(),".xeno-code")}function Se(t){return h(t,".xeno-code")}function $e(){return ht?"powershell":process.env.SHELL?.split("/").pop()??"bash"}function ve(t){try{return gt("git rev-parse --is-inside-work-tree",{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function Oe(t,e){for(let n of e)if(t[n]===void 0||t[n]===null||t[n]==="")return`Missing required parameter: ${n}`;return null}function Le(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="string")throw new Error(`Parameter ${e} must be a string, got ${typeof r}`);return r}function Be(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="number")throw new Error(`Parameter ${e} must be a number, got ${typeof r}`);if(isNaN(r))throw new Error(`Parameter ${e} is NaN`);return r}function Pe(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="boolean")throw new Error(`Parameter ${e} must be a boolean, got ${typeof r}`);return r}function xt(t){if(t.length>5e3)return"Pattern too long (max 5000 characters)";let n=[/(\.\*){3,}/,/(\+\+|\*\*)/,/(.*\+.*\+.*\+)/];for(let r of n)if(r.test(t))return"Pattern contains potentially unsafe constructs that could cause excessive backtracking";return null}function Ie(t,e,n=5e3){let r=xt(t);if(r)throw new Error(r);try{return new RegExp(t,e)}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`Invalid regex pattern: ${i}`)}}function De(t,e,n=1e3){if(e.length>1e5)throw new Error(`Input too large for safe regex test (${e.length} chars, max 100000)`);return t.test(e)}var yt=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(yt||{}),m=1;function je(t){m=t}function We(){return m}function p(){return new Date().toISOString()}function qe(t,e){m<=0&&(e!==void 0?process.stderr.write(`[${p()}] DEBUG: ${t} ${w(e)}
|
|
12
13
|
`):process.stderr.write(`[${p()}] DEBUG: ${t}
|
|
13
|
-
`))}function
|
|
14
|
+
`))}function Xe(t,e){m<=1&&(e!==void 0?process.stderr.write(`[${p()}] INFO: ${t} ${w(e)}
|
|
14
15
|
`):process.stderr.write(`[${p()}] INFO: ${t}
|
|
15
|
-
`))}function
|
|
16
|
+
`))}function ze(t,e){m<=2&&(e!==void 0?process.stderr.write(`[${p()}] WARN: ${t} ${w(e)}
|
|
16
17
|
`):process.stderr.write(`[${p()}] WARN: ${t}
|
|
17
|
-
`))}function
|
|
18
|
+
`))}function He(t,e){m<=3&&(e!==void 0?process.stderr.write(`[${p()}] ERROR: ${t} ${w(e)}
|
|
18
19
|
`):process.stderr.write(`[${p()}] ERROR: ${t}
|
|
19
|
-
`))}function x(t){if(t==null)return"";if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}var ht=/^[A-Za-z0-9:._*-]{1,64}$/,xt=/^[A-Za-z0-9_-][A-Za-z0-9 _-]{0,30}[A-Za-z0-9_-]$/,yt=/^[0-9][0-9A-Za-z.+-]{0,40}$/;function qe(t){if(!t||typeof t!="object")throw new TypeError("requestContext must be an object");let e=Object.keys(t).filter(r=>r!=="surface"&&r!=="client");if(e.length>0)throw new TypeError(`requestContext does not accept: ${e.join(", ")}`);if(typeof t.surface!="string"||!ht.test(t.surface))throw new TypeError("requestContext.surface must match /^[A-Za-z0-9:._*-]{1,64}$/");if(t.client===void 0)return Object.freeze({surface:t.surface});let n=t.client;if(!n||typeof n!="object"||Object.keys(n).some(r=>r!=="name"&&r!=="version"))throw new TypeError("requestContext.client must be { name, version }");if(typeof n.name!="string"||!xt.test(n.name))throw new TypeError("requestContext.client.name must be 2-32 characters of letters, digits, space, _ or -");if(typeof n.version!="string"||!yt.test(n.version))throw new TypeError("requestContext.client.version must start with a digit, e.g. 1.2.3");return Object.freeze({surface:t.surface,client:Object.freeze({name:n.name,version:n.version})})}function Xe(t){return t?{"X-Xeno-Surface":t.surface,...t.client?{"X-Xeno-Client":`${t.client.name}/${t.client.version}`}:{}}:{}}var b=class extends Error{statusCode;body;retryAfterMs;requestId;cfRay;constructor(e,n={}){super(e),this.name="ApiTransientError",this.statusCode=n.statusCode,this.retryAfterMs=n.retryAfterMs,this.requestId=n.requestId,this.cfRay=n.cfRay}},y={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function w(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function wt(t={}){let e=Math.max(0,t.maxRetries??w("XENO_API_MAX_RETRIES",y.maxRetries)),n=Math.max(50,t.baseDelayMs??w("XENO_API_BASE_DELAY_MS",y.baseDelayMs)),r=Math.max(n,t.maxDelayMs??w("XENO_API_MAX_DELAY_MS",y.maxDelayMs)),o=Math.max(0,t.jitterMs??w("XENO_API_RETRY_JITTER_MS",y.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function bt(t,e,n){if(e.retryAfterMs&&e.retryAfterMs>0)return Math.min(e.retryAfterMs,n.maxDelayMs);let r=Math.min(n.baseDelayMs*Math.pow(2,t),n.maxDelayMs),o=Math.floor(Math.random()*n.jitterMs);return Math.min(r+o,n.maxDelayMs)}function P(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function Et(t){let e=t.toLowerCase();return e.includes("network")||e.includes("timeout")||e.includes("fetch failed")||e.includes("socket hang up")||e.includes("econnreset")||e.includes("eai_again")||e.includes("enotfound")||e.includes("econnrefused")||e.includes("tls")||e.includes("temporarily unavailable")}function I(t){if(t instanceof b)return{statusCode:t.statusCode,retryAfterMs:t.retryAfterMs,requestId:t.requestId,cfRay:t.cfRay};if(!(t instanceof Error))return{};let e=t;if(e.statusCode!==void 0||e.retryAfterMs!==void 0||e.requestId!==void 0||e.cfRay!==void 0)return{statusCode:e.statusCode,retryAfterMs:e.retryAfterMs,requestId:e.requestId,cfRay:e.cfRay};let n=t.message.toLowerCase();return P(n)?{statusCode:429}:{}}var M="408|425|429|500|502|503|504";function Rt(t){let e=new RegExp(`(?:\\bstatus(?:[ _-]?code)?\\b\\s*[=:]?\\s*|\\bhttp\\b\\s*|\\bapi\\b\\s*|\\bcode\\b\\s*[=:]\\s*|\\berror\\b\\s*)(?:${M})\\b`,"i"),n=new RegExp(`\\b(?:${M})\\s+(?:internal|bad\\s+gateway|service\\s+unavailable|gateway\\s+time|request\\s+time|too\\s+early|too\\s+many)`,"i"),r=new RegExp(`^\\s*(?:${M})\\b`);return e.test(t)||n.test(t)||r.test(t)}function Tt(t){if(t&&typeof t=="object"&&"retryable"in t)return t.retryable===!0;if(t instanceof b){let{statusCode:e}=I(t);if(e)return e===429||e>=500||e===408||e===409||e===425}if(t instanceof Error){let e=t.name?.toLowerCase()??"";return e==="aborterror"||e==="agentinterruptederror"||t.message.toLowerCase().includes("aborted")||t.message.toLowerCase().includes("interrupted")?!1:Rt(t.message)?!0:P(t.message)||Et(t.message.toLowerCase())}return!1}function At(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function He(t,e={}){let n=wt(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw At(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):Tt(i))||o===n.maxRetries)throw i;let u=I(i),f=bt(o,u,n),d=e.getDelayMs?.(i,o,f),m=typeof d=="number"&&d>=0?d:f;await new Promise(R=>setTimeout(R,m))}throw r}var Ct=(t,e)=>{if(!t)return 0;let n=e.toLowerCase(),r=n.includes("claude")?3.5:n.includes("gemini")?3.8:(/(^|[/_-])(gpt|o\d)/.test(n),4),o=[...t].filter(s=>s.codePointAt(0)>127).length,i=Math.ceil(t.length/r);return Math.max(1,i+Math.ceil(o*.35))},kt=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:Ct,countImage:({detail:t})=>t==="high"?2e3:t==="low"?512:1200,safetyMarginRatio:t=>{let e=t.toLowerCase();return e.includes("claude")?.12:e.includes("gemini")?.14:/(^|[/_-])(gpt|o\d)/.test(e)?.1:.18}});function Ye(t,e,n=kt){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function Mt(t){return t?Math.ceil(t.length/4):0}function Ue(t,e){if(!t||e<=0)return"";let n=e*4;if(t.length<=n)return t;let r=t.slice(0,n),o=r.lastIndexOf(" ");return o>n*.8&&(r=r.slice(0,o)),r+"..."}function Ge(t,e){return Mt(t)<=e}function Ke(t,e){return Math.max(0,e-t)}var _t={"claude-opus-4-6-thinking":{input:15,output:75},"claude-opus-4-6":{input:15,output:75},"claude-opus-4-5-thinking":{input:15,output:75},"claude-sonnet-4-6":{input:3,output:15},"claude-sonnet-4-5-thinking":{input:3,output:15},"claude-sonnet-4-5":{input:3,output:15},"gemini-2.5-flash":{input:.15,output:.6},"gemini-2.5-flash-lite":{input:.075,output:.3},"gemini-3-flash":{input:.15,output:.6},"gemini-3-pro-high":{input:1.25,output:5},"gpt-5":{input:5,output:15},"gpt-5-codex":{input:5,output:15},"gpt-5.1":{input:5,output:15},"gpt-5.1-codex":{input:5,output:15},"gpt-5.2":{input:5,output:15},"gpt-5.2-codex":{input:5,output:15},"kimi-k2":{input:.6,output:2.4},"kimi-k2-thinking":{input:.6,output:2.4},"kimi-k2.5":{input:.6,output:2.4}};function Qe(t,e,n){let r=_t[t];return r?e/1e6*r.input+n/1e6*r.output:0}function Ve(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}import{spawnSync as St}from"node:child_process";function nn(t){let e=process.platform==="win32"?[{command:"clip.exe",args:[]}]:process.platform==="darwin"?[{command:"pbcopy",args:[]}]:[{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}],n=null;for(let r of e)try{let o=St(r.command,r.args,{input:t,encoding:"utf8"});if(o.error){n=o.error.message;continue}if(o.status===0)return;n=o.stderr||o.stdout||`exit ${o.status}`}catch(o){n=o instanceof Error?o.message:String(o)}throw new Error(`Clipboard copy failed${n?`: ${n}`:""}`)}function F(t){return t.replace(/\\/g,"/").toLowerCase()}var $t=["golden","solution","answer","expected"],Nt=["expected","golden","reference","answer","answers"],vt=new Set([";","&&","||","|"]);function j(t){return F(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function Ot(t){return $t.some(e=>t.includes(e))}function D(t){return Nt.some(e=>t.includes(e))}function W(t){return t.split("::",1)[0]?.split("?",1)[0]?.split("#",1)[0]??t}function E(t){let e=t.trim().replace(/^[({]+/,"").replace(/[),;]+$/,"");return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1)),e}function Lt(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(E).filter(e=>e.length>0)??[]}function q(t){let e=j(t),n=W(e.at(-1)??"");return D(n)||e.some(r=>D(r))}function X(t){let e=F(E(t));return!e||e==="/dev/null"||e.startsWith("/tmp/")||e.startsWith("tmp/")||e.startsWith("/var/tmp/")||e.startsWith("var/tmp/")?!1:e.startsWith("/app/")||e.startsWith("./")?!0:!e.startsWith("/")}function Bt(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function Pt(t){let e=Lt(t);for(let n=0;n<e.length;n+=1){let r=e[n]?.toLowerCase();if(r!=="cp"&&r!=="mv"&&r!=="rsync"&&r!=="install")continue;let o=[];for(let s=n+1;s<e.length;s+=1){let u=e[s];if(!u||vt.has(u))break;u!=="--"&&(u.startsWith("-")||o.push(u))}if(o.length<2)continue;let i=o.at(-1);if(X(i)){for(let s of o.slice(0,-1))if(Bt(s)&&q(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function It(t){let e=[/\bcat\s+(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*>\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i,/\bdd\b[\s\S]*?\bif=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))[\s\S]*?\bof=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i];for(let n of e){let r=t.match(n);if(!r)continue;let o=E(r[1]??r[2]??r[3]??""),i=E(r[4]??r[5]??r[6]??"");if(!(!o||!i)&&q(o)&&X(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function z(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function H(t){let e=j(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=W(e.at(-1)??"");return e.includes("tests")&&Ot(n)}function on(t){return z()?t.filter(e=>!H(e)):t}function sn(t){return`Benchmark safety: access to verifier answer or benchmark trace artifacts is blocked (${t}). Use task inputs and verifier logic, not golden, solution, or agent audit files.`}function an(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>H(e))}function un(t){if(!z())return null;let e=Pt(t)??It(t);return e?["[xeno guidance]",`Benchmark safety blocked ${e.operation} from reference-like source ${e.sourcePath} to protected destination ${e.destinationPath}.`,"Do not copy expected, golden, reference, or answer files over task inputs or submission artifacts to make validation pass.","If a previous check polluted an input, restore/regenerate the original source input, then rerun the actual script or program under test."].join(`
|
|
20
|
-
`):null}function
|
|
20
|
+
`))}function w(t){if(t==null)return"";if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}var wt=/^[A-Za-z0-9:._*-]{1,64}$/,bt=/^[A-Za-z0-9_-][A-Za-z0-9 _-]{0,30}[A-Za-z0-9_-]$/,Et=/^[0-9][0-9A-Za-z.+-]{0,40}$/;function Ye(t){if(!t||typeof t!="object")throw new TypeError("requestContext must be an object");let e=Object.keys(t).filter(r=>r!=="surface"&&r!=="client");if(e.length>0)throw new TypeError(`requestContext does not accept: ${e.join(", ")}`);if(typeof t.surface!="string"||!wt.test(t.surface))throw new TypeError("requestContext.surface must match /^[A-Za-z0-9:._*-]{1,64}$/");if(t.client===void 0)return Object.freeze({surface:t.surface});let n=t.client;if(!n||typeof n!="object"||Object.keys(n).some(r=>r!=="name"&&r!=="version"))throw new TypeError("requestContext.client must be { name, version }");if(typeof n.name!="string"||!bt.test(n.name))throw new TypeError("requestContext.client.name must be 2-32 characters of letters, digits, space, _ or -");if(typeof n.version!="string"||!Et.test(n.version))throw new TypeError("requestContext.client.version must start with a digit, e.g. 1.2.3");return Object.freeze({surface:t.surface,client:Object.freeze({name:n.name,version:n.version})})}function Ue(t){return t?{"X-Xeno-Surface":t.surface,...t.client?{"X-Xeno-Client":`${t.client.name}/${t.client.version}`}:{}}:{}}var R=class extends Error{statusCode;body;retryAfterMs;requestId;cfRay;constructor(e,n={}){super(e),this.name="ApiTransientError",this.statusCode=n.statusCode,this.retryAfterMs=n.retryAfterMs,this.requestId=n.requestId,this.cfRay=n.cfRay}},b={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function E(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function Rt(t={}){let e=Math.max(0,t.maxRetries??E("XENO_API_MAX_RETRIES",b.maxRetries)),n=Math.max(50,t.baseDelayMs??E("XENO_API_BASE_DELAY_MS",b.baseDelayMs)),r=Math.max(n,t.maxDelayMs??E("XENO_API_MAX_DELAY_MS",b.maxDelayMs)),o=Math.max(0,t.jitterMs??E("XENO_API_RETRY_JITTER_MS",b.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function Tt(t,e,n){if(e.retryAfterMs&&e.retryAfterMs>0)return Math.min(e.retryAfterMs,n.maxDelayMs);let r=Math.min(n.baseDelayMs*Math.pow(2,t),n.maxDelayMs),o=Math.floor(Math.random()*n.jitterMs);return Math.min(r+o,n.maxDelayMs)}function D(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function At(t){let e=t.toLowerCase();return e.includes("network")||e.includes("timeout")||e.includes("fetch failed")||e.includes("socket hang up")||e.includes("econnreset")||e.includes("eai_again")||e.includes("enotfound")||e.includes("econnrefused")||e.includes("tls")||e.includes("temporarily unavailable")}function F(t){if(t instanceof R)return{statusCode:t.statusCode,retryAfterMs:t.retryAfterMs,requestId:t.requestId,cfRay:t.cfRay};if(!(t instanceof Error))return{};let e=t;if(e.statusCode!==void 0||e.retryAfterMs!==void 0||e.requestId!==void 0||e.cfRay!==void 0)return{statusCode:e.statusCode,retryAfterMs:e.retryAfterMs,requestId:e.requestId,cfRay:e.cfRay};let n=t.message.toLowerCase();return D(n)?{statusCode:429}:{}}var _="408|425|429|500|502|503|504";function Ct(t){let e=new RegExp(`(?:\\bstatus(?:[ _-]?code)?\\b\\s*[=:]?\\s*|\\bhttp\\b\\s*|\\bapi\\b\\s*|\\bcode\\b\\s*[=:]\\s*|\\berror\\b\\s*)(?:${_})\\b`,"i"),n=new RegExp(`\\b(?:${_})\\s+(?:internal|bad\\s+gateway|service\\s+unavailable|gateway\\s+time|request\\s+time|too\\s+early|too\\s+many)`,"i"),r=new RegExp(`^\\s*(?:${_})\\b`);return e.test(t)||n.test(t)||r.test(t)}function kt(t){if(t&&typeof t=="object"&&"retryable"in t)return t.retryable===!0;if(t instanceof R){let{statusCode:e}=F(t);if(e)return e===429||e>=500||e===408||e===409||e===425}if(t instanceof Error){let e=t.name?.toLowerCase()??"";return e==="aborterror"||e==="agentinterruptederror"||t.message.toLowerCase().includes("aborted")||t.message.toLowerCase().includes("interrupted")?!1:Ct(t.message)?!0:D(t.message)||At(t.message.toLowerCase())}return!1}function Mt(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function Ke(t,e={}){let n=Rt(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw Mt(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):kt(i))||o===n.maxRetries)throw i;let l=F(i),c=Tt(o,l,n),f=e.getDelayMs?.(i,o,c),x=typeof f=="number"&&f>=0?f:c;await new Promise(y=>setTimeout(y,x))}throw r}var _t=(t,e)=>{if(!t)return 0;let n=e.toLowerCase(),r=n.includes("claude")?3.5:n.includes("gemini")?3.8:(/(^|[/_-])(gpt|o\d)/.test(n),4),o=[...t].filter(s=>s.codePointAt(0)>127).length,i=Math.ceil(t.length/r);return Math.max(1,i+Math.ceil(o*.35))},St=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:_t,countImage:({detail:t})=>t==="high"?2e3:t==="low"?512:1200,safetyMarginRatio:t=>{let e=t.toLowerCase();return e.includes("claude")?.12:e.includes("gemini")?.14:/(^|[/_-])(gpt|o\d)/.test(e)?.1:.18}});function Qe(t,e,n=St){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function $t(t){return t?Math.ceil(t.length/4):0}function Ve(t,e){if(!t||e<=0)return"";let n=e*4;if(t.length<=n)return t;let r=t.slice(0,n),o=r.lastIndexOf(" ");return o>n*.8&&(r=r.slice(0,o)),r+"..."}function tn(t,e){return $t(t)<=e}function en(t,e){return Math.max(0,e-t)}var vt={"claude-opus-4-6-thinking":{input:15,output:75},"claude-opus-4-6":{input:15,output:75},"claude-opus-4-5-thinking":{input:15,output:75},"claude-sonnet-4-6":{input:3,output:15},"claude-sonnet-4-5-thinking":{input:3,output:15},"claude-sonnet-4-5":{input:3,output:15},"gemini-2.5-flash":{input:.15,output:.6},"gemini-2.5-flash-lite":{input:.075,output:.3},"gemini-3-flash":{input:.15,output:.6},"gemini-3-pro-high":{input:1.25,output:5},"gpt-5":{input:5,output:15},"gpt-5-codex":{input:5,output:15},"gpt-5.1":{input:5,output:15},"gpt-5.1-codex":{input:5,output:15},"gpt-5.2":{input:5,output:15},"gpt-5.2-codex":{input:5,output:15},"kimi-k2":{input:.6,output:2.4},"kimi-k2-thinking":{input:.6,output:2.4},"kimi-k2.5":{input:.6,output:2.4}};function rn(t,e,n){let r=vt[t];return r?e/1e6*r.input+n/1e6*r.output:0}function on(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}import{spawnSync as Nt}from"node:child_process";function un(t){let e=process.platform==="win32"?[{command:"clip.exe",args:[]}]:process.platform==="darwin"?[{command:"pbcopy",args:[]}]:[{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}],n=null;for(let r of e)try{let o=Nt(r.command,r.args,{input:t,encoding:"utf8"});if(o.error){n=o.error.message;continue}if(o.status===0)return;n=o.stderr||o.stdout||`exit ${o.status}`}catch(o){n=o instanceof Error?o.message:String(o)}throw new Error(`Clipboard copy failed${n?`: ${n}`:""}`)}function W(t){return t.replace(/\\/g,"/").toLowerCase()}var Ot=["golden","solution","answer","expected"],Lt=["expected","golden","reference","answer","answers"],Bt=new Set([";","&&","||","|"]);function q(t){return W(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function Pt(t){return Ot.some(e=>t.includes(e))}function j(t){return Lt.some(e=>t.includes(e))}function X(t){return t.split("::",1)[0]?.split("?",1)[0]?.split("#",1)[0]??t}function T(t){let e=t.trim().replace(/^[({]+/,"").replace(/[),;]+$/,"");return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1)),e}function It(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(T).filter(e=>e.length>0)??[]}function z(t){let e=q(t),n=X(e.at(-1)??"");return j(n)||e.some(r=>j(r))}function H(t){let e=W(T(t));return!e||e==="/dev/null"||e.startsWith("/tmp/")||e.startsWith("tmp/")||e.startsWith("/var/tmp/")||e.startsWith("var/tmp/")?!1:e.startsWith("/app/")||e.startsWith("./")?!0:!e.startsWith("/")}function Dt(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function Ft(t){let e=It(t);for(let n=0;n<e.length;n+=1){let r=e[n]?.toLowerCase();if(r!=="cp"&&r!=="mv"&&r!=="rsync"&&r!=="install")continue;let o=[];for(let s=n+1;s<e.length;s+=1){let l=e[s];if(!l||Bt.has(l))break;l!=="--"&&(l.startsWith("-")||o.push(l))}if(o.length<2)continue;let i=o.at(-1);if(H(i)){for(let s of o.slice(0,-1))if(Dt(s)&&z(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function jt(t){let e=[/\bcat\s+(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*>\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i,/\bdd\b[\s\S]*?\bif=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))[\s\S]*?\bof=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i];for(let n of e){let r=t.match(n);if(!r)continue;let o=T(r[1]??r[2]??r[3]??""),i=T(r[4]??r[5]??r[6]??"");if(!(!o||!i)&&z(o)&&H(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function J(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function Y(t){let e=q(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=X(e.at(-1)??"");return e.includes("tests")&&Pt(n)}function fn(t){return J()?t.filter(e=>!Y(e)):t}function ln(t){return`Benchmark safety: access to verifier answer or benchmark trace artifacts is blocked (${t}). Use task inputs and verifier logic, not golden, solution, or agent audit files.`}function dn(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>Y(e))}function pn(t){if(!J())return null;let e=Ft(t)??jt(t);return e?["[xeno guidance]",`Benchmark safety blocked ${e.operation} from reference-like source ${e.sourcePath} to protected destination ${e.destinationPath}.`,"Do not copy expected, golden, reference, or answer files over task inputs or submission artifacts to make validation pass.","If a previous check polluted an input, restore/regenerate the original source input, then rerun the actual script or program under test."].join(`
|
|
21
|
+
`):null}function Wt(t){return/^data:([^;,]+)[;,]/i.exec(t.trim())?.[1]}function qt(t){let e=[];for(let n of t){if(n.type==="text"){e.push(n.text);continue}if(n.type==="image_url"){e.push(`[image ${Wt(n.image_url.url)??"unknown"}]`);continue}let r=n.text??n.data;if(r&&r.trim().length>0){e.push(r);continue}let o=n.uri??n.mimeType??"resource";e.push(`[resource ${o}]`)}return e.join(`
|
|
21
22
|
|
|
22
|
-
`).trim()}function
|
|
23
|
-
`)}function
|
|
24
|
-
`)}}function
|
|
23
|
+
`).trim()}function U(t){let e=t.trim();return e.length>0?[{type:"text",text:e}]:[]}function gn(t){return typeof t=="string"?t:qt(t)}function Xt(t){if(t.success)return t.output;let e=[`Error: ${t.error??"Tool execution failed"}`];return t.output.trim().length>0&&e.push(t.output),e.join(`
|
|
24
|
+
`)}function hn(t){let e=t.assistant_content&&t.assistant_content.length>0?t.assistant_content:typeof t.content=="string"?U(t.content):t.content,n=t.assistant_only_content??[],r=zt(t),o=[...e,...n,...r?[r]:[]];return o.length>0?o:t.content}function zt(t){let e=t.operation;if(!e)return null;let n=t.evidence??e.evidence??[],r=n.filter(i=>i.status==="verified").length,o=n.filter(i=>i.status==="failed").length;return{type:"text",text:["[xeno_operation]",`operation_id: ${e.operationId}`,`state: ${e.state}`,`terminal: ${e.terminal?"yes":"no"}`,`completion_policy: ${e.completionPolicy}`,e.taskId?`task_id: ${e.taskId}`:null,e.completionReason?`completion_reason: ${e.completionReason}`:null,`evidence: ${r} verified, ${o} failed`,t.retryable===void 0?null:`retryable: ${t.retryable?"yes":"no"}`,"[/xeno_operation]"].filter(i=>!!i).join(`
|
|
25
|
+
`)}}function xn(t){return Array.isArray(t)&&t.some(e=>e.type!=="text")}function yn(t){return typeof t=="string"?U(t):t}function wn(t,e){return{type:"tool_result",tool_use_id:t,content:Xt(e),...e.assistantContent&&e.assistantContent.length>0?{assistant_content:e.assistantContent}:{},...e.assistantOnlyContent&&e.assistantOnlyContent.length>0?{assistant_only_content:e.assistantOnlyContent}:{},is_error:!e.success,...e.operation?{operation:e.operation}:{},...e.evidence&&e.evidence.length>0?{evidence:e.evidence}:{},...e.webContext?{web_context:e.webContext}:{},...e.retryable!==void 0?{retryable:e.retryable}:{}}}function En(t,e={}){for(let n of t){let r=n.codePointAt(0);if(r===127)return!0;if(!(r>31)&&!(r===9&&e.allowTab===!0)&&!((r===10||r===13)&&e.allowLineBreaks===!0))return!0}return!1}export{R as ApiTransientError,ke as HOME_DIR,Ae as IS_LINUX,Te as IS_MAC,ht as IS_WINDOWS,yt as LogLevel,Ce as OS_VERSION,M as PLATFORM,Qe as accountTextTokens,Zt as appendDurableLine,Kt as appendLine,ln as benchmarkLeakError,wn as buildToolResultBlock,Xt as buildToolResultText,rn as calculateCost,dn as commandMentionsBenchmarkLeak,St as conservativeTokenAccountingAdapter,un as copyTextToClipboard,Ie as createSafeRegex,qe as debug,nt as decodeTextBuffer,ae as deleteDir,se as deleteFile,ot as detectLineEnding,te as detectPreferredLineEnding,et as detectTextEncoding,rt as encodeTextBuffer,C as ensureDir,He as error,$t as estimateTokens,_t as estimateTokensForModel,re as existsSync,fn as filterBenchmarkLeakPaths,ee as findSimilarFile,tn as fitsInBudget,on as formatCost,Me as getAgentHome,pn as getBenchmarkReferenceOverwriteHint,Pe as getBoolean,_e as getConfigDir,We as getLogLevel,Be as getNumber,Se as getProjectConfigDir,F as getRetryErrorContext,$e as getShellName,Le as getString,hn as getToolResultTransportContent,Ut as hasDir,En as hasDisallowedAsciiControlCharacter,Yt as hasFile,ge as hasFrontmatter,Qt as hasMixedLineEndings,xn as hasNonTextToolResultContent,Ct as hasTransientStatusMention,Xe as info,Y as isBenchmarkLeakPath,J as isBenchmarkMode,ve as isGitRepo,dt as isPathSafe,kt as isRetryableError,ie as listDirs,oe as listFiles,it as normalizeLineEndings,Ye as normalizeXenoRequestContext,pe as parseDocument,le as parseJsonLines,ye as pathIdentityKey,Gt as readFileSafe,ne as readIfExists,st as readTextFile,en as remainingBudget,tt as renameReplacingWithRetry,ce as safeJsonParse,fe as safeJsonStringify,De as safeRegexTest,xe as safeResolvePath,je as setLogLevel,me as stringifyDocument,yn as toTransportAssistantBlocks,qt as toolAssistantContentToText,gn as toolResultContentToText,Ve as truncateToTokens,xt as validateRegexPattern,Oe as validateRequired,ze as warn,Ke as withRetry,Z as writeAtomic,Vt as writeTextFile,Ue as xenoRequestContextHeaders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/utils/fs.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/utils/fs.ts":{"bytes":13355,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/yaml.ts":{"bytes":5506,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":1762,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/validation.ts":{"bytes":5336,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/utils/retry.ts":{"bytes":11711,"imports":[],"format":"esm"},"src/utils/tokens.ts":{"bytes":3207,"imports":[],"format":"esm"},"src/utils/cost.ts":{"bytes":1826,"imports":[],"format":"esm"},"src/utils/clipboard.ts":{"bytes":1156,"imports":[{"path":"node:child_process","kind":"import-statement","external":true}],"format":"esm"},"src/utils/benchmark-safety.ts":{"bytes":6542,"imports":[],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/utils/index.ts":{"bytes":1491,"imports":[{"path":"src/utils/fs.ts","kind":"import-statement","original":"./fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"./json.js"},{"path":"src/utils/yaml.ts","kind":"import-statement","original":"./yaml.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"./path-security.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"./platform.js"},{"path":"src/utils/validation.ts","kind":"import-statement","original":"./validation.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./logger.js"},{"path":"src/utils/request-context.ts","kind":"import-statement","original":"./request-context.js"},{"path":"src/utils/retry.ts","kind":"import-statement","original":"./retry.js"},{"path":"src/utils/tokens.ts","kind":"import-statement","original":"./tokens.js"},{"path":"src/utils/cost.ts","kind":"import-statement","original":"./cost.js"},{"path":"src/utils/clipboard.ts","kind":"import-statement","original":"./clipboard.js"},{"path":"src/utils/benchmark-safety.ts","kind":"import-statement","original":"./benchmark-safety.js"},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"./tool-result-content.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"./text-security.js"}],"format":"esm"}},"outputs":{"dist/utils/index.cjs":{"imports":[{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/utils/index.ts","inputs":{"src/utils/index.ts":{"bytesInOutput":2096},"src/utils/fs.ts":{"bytesInOutput":4727},"src/utils/json.ts":{"bytesInOutput":239},"src/utils/yaml.ts":{"bytesInOutput":2639},"src/utils/path-security.ts":{"bytesInOutput":403},"src/utils/platform.ts":{"bytesInOutput":687},"src/utils/validation.ts":{"bytesInOutput":1425},"src/utils/logger.ts":{"bytesInOutput":915},"src/utils/request-context.ts":{"bytesInOutput":1241},"src/utils/retry.ts":{"bytesInOutput":3188},"src/utils/tokens.ts":{"bytesInOutput":904},"src/utils/cost.ts":{"bytesInOutput":933},"src/utils/clipboard.ts":{"bytesInOutput":604},"src/utils/benchmark-safety.ts":{"bytesInOutput":3108},"src/utils/tool-result-content.ts":{"bytesInOutput":2118},"src/utils/text-security.ts":{"bytesInOutput":180}},"bytes":27460}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/utils/fs.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/utils/fs.ts":{"bytes":13355,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/yaml.ts":{"bytes":5506,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":1762,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/validation.ts":{"bytes":5336,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/utils/retry.ts":{"bytes":11711,"imports":[],"format":"esm"},"src/utils/tokens.ts":{"bytes":3207,"imports":[],"format":"esm"},"src/utils/cost.ts":{"bytes":1826,"imports":[],"format":"esm"},"src/utils/clipboard.ts":{"bytes":1156,"imports":[{"path":"node:child_process","kind":"import-statement","external":true}],"format":"esm"},"src/utils/benchmark-safety.ts":{"bytes":6542,"imports":[],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/utils/index.ts":{"bytes":1491,"imports":[{"path":"src/utils/fs.ts","kind":"import-statement","original":"./fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"./json.js"},{"path":"src/utils/yaml.ts","kind":"import-statement","original":"./yaml.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"./path-security.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"./platform.js"},{"path":"src/utils/validation.ts","kind":"import-statement","original":"./validation.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./logger.js"},{"path":"src/utils/request-context.ts","kind":"import-statement","original":"./request-context.js"},{"path":"src/utils/retry.ts","kind":"import-statement","original":"./retry.js"},{"path":"src/utils/tokens.ts","kind":"import-statement","original":"./tokens.js"},{"path":"src/utils/cost.ts","kind":"import-statement","original":"./cost.js"},{"path":"src/utils/clipboard.ts","kind":"import-statement","original":"./clipboard.js"},{"path":"src/utils/benchmark-safety.ts","kind":"import-statement","original":"./benchmark-safety.js"},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"./tool-result-content.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"./text-security.js"}],"format":"esm"}},"outputs":{"dist/utils/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true}],"exports":["ApiTransientError","HOME_DIR","IS_LINUX","IS_MAC","IS_WINDOWS","LogLevel","OS_VERSION","PLATFORM","accountTextTokens","appendDurableLine","appendLine","benchmarkLeakError","buildToolResultBlock","buildToolResultText","calculateCost","commandMentionsBenchmarkLeak","conservativeTokenAccountingAdapter","copyTextToClipboard","createSafeRegex","debug","decodeTextBuffer","deleteDir","deleteFile","detectLineEnding","detectPreferredLineEnding","detectTextEncoding","encodeTextBuffer","ensureDir","error","estimateTokens","estimateTokensForModel","existsSync","filterBenchmarkLeakPaths","findSimilarFile","fitsInBudget","formatCost","getAgentHome","getBenchmarkReferenceOverwriteHint","getBoolean","getConfigDir","getLogLevel","getNumber","getProjectConfigDir","getRetryErrorContext","getShellName","getString","getToolResultTransportContent","hasDir","hasDisallowedAsciiControlCharacter","hasFile","hasFrontmatter","hasMixedLineEndings","hasNonTextToolResultContent","hasTransientStatusMention","info","isBenchmarkLeakPath","isBenchmarkMode","isGitRepo","isPathSafe","isRetryableError","listDirs","listFiles","normalizeLineEndings","normalizeXenoRequestContext","parseDocument","parseJsonLines","pathIdentityKey","readFileSafe","readIfExists","readTextFile","remainingBudget","renameReplacingWithRetry","safeJsonParse","safeJsonStringify","safeRegexTest","safeResolvePath","setLogLevel","stringifyDocument","toTransportAssistantBlocks","toolAssistantContentToText","toolResultContentToText","truncateToTokens","validateRegexPattern","validateRequired","warn","withRetry","writeAtomic","writeTextFile","xenoRequestContextHeaders"],"entryPoint":"src/utils/index.ts","inputs":{"src/utils/fs.ts":{"bytesInOutput":4680},"src/utils/index.ts":{"bytesInOutput":0},"src/utils/json.ts":{"bytesInOutput":239},"src/utils/yaml.ts":{"bytesInOutput":2639},"src/utils/path-security.ts":{"bytesInOutput":401},"src/utils/platform.ts":{"bytesInOutput":630},"src/utils/validation.ts":{"bytesInOutput":1425},"src/utils/logger.ts":{"bytesInOutput":915},"src/utils/request-context.ts":{"bytesInOutput":1241},"src/utils/retry.ts":{"bytesInOutput":3185},"src/utils/tokens.ts":{"bytesInOutput":904},"src/utils/cost.ts":{"bytesInOutput":933},"src/utils/clipboard.ts":{"bytesInOutput":601},"src/utils/benchmark-safety.ts":{"bytesInOutput":3090},"src/utils/tool-result-content.ts":{"bytesInOutput":2115},"src/utils/text-security.ts":{"bytesInOutput":180}},"bytes":25162}}}
|