@xenosystem/agent-cli 0.5.42 → 0.5.43
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/index.js +2 -2
- package/dist/metafile-esm.json +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2748,7 +2748,7 @@ ${Se}${V.compose(bL(),V.bold)("\u2717")} ${tx(e)}
|
|
|
2748
2748
|
`)}function lv(){return`
|
|
2749
2749
|
${Se}${ye("Goodbye.")}
|
|
2750
2750
|
`}var ISt,MRe,bL,en,ye,rx,tx,kSt,ix,ESt,CSt,xSt,j,Se,FRe,BY,S,DY,LRe,nx,Zo=Ne(()=>{"use strict";ua();va();RRe();wL();ISt=new Wu(process.stdout),MRe=new Wu(process.stderr),bL=()=>kr(),en=e=>bL()(e),ye=V.dim,rx=V.bold,tx=e=>bL()(e),kSt="\u25A0",ix="\u2514",ESt={open:"\x1B[4m",close:"\x1B[24m"};CSt={Read:e=>Wc()(e),ReadImage:e=>Wc()(e),Glob:e=>Wc()(e),Grep:e=>Wc()(e),ElfAnalyze:e=>Wc()(e),MemoryRead:e=>Wc()(e),Write:e=>ex()(e),Edit:e=>ex()(e),MemoryWrite:e=>ex()(e),Bash:e=>RY()(e),GitStatus:e=>Wc()(e),GitDiff:e=>Wc()(e),GitLog:e=>Wc()(e),GitBranch:e=>Wc()(e),GitCommit:e=>RY()(e),WebSearch:e=>V.cyan(e),WebFetch:e=>V.cyan(e),TaskOutput:e=>Wc()(e),TaskInput:e=>V.cyan(e),TaskStop:e=>lA()(e)};xSt={Edit:"Update",Glob:"Search",Grep:"Search",WebSearch:"Web Search",WebFetch:"Web Fetch"};j={accent:en,purple:tx,cyan:tx,dim:ye,bold:rx,red:tx,green:tx},Se=" ",FRe=1e3,BY=3;S={moveTo:(e,t)=>`\x1B[${e};${t}H`,saveCursor:()=>"\x1B[s",restoreCursor:()=>"\x1B[u",setScrollRegion:(e,t)=>`\x1B[${e};${t}r`,resetScrollRegion:()=>"\x1B[r",eraseLine:()=>"\x1B[2K",clearScreen:()=>"\x1B[2J\x1B[3J\x1B[H",showCursor:()=>"\x1B[?25h",hideCursor:()=>"\x1B[?25l",disableWrap:()=>"\x1B[?7l",enableWrap:()=>"\x1B[?7h",enableMouseReporting:()=>"\x1B[?1000h\x1B[?1006h",disableMouseReporting:()=>"\x1B[?1006l\x1B[?1000l",enableBracketedPaste:()=>"\x1B[?2004h",disableBracketedPaste:()=>"\x1B[?2004l"};DY=class{atLineStart=!0;writeFn;constructor(t){this.writeFn=t??(n=>{ISt.writeOrdered(n,"stream")})}write(t){let n="";for(let r of t)this.atLineStart&&(n+=Se,this.atLineStart=!1),n+=r,r===`
|
|
2751
|
-
`&&(this.atLineStart=!0);this.writeFn(n)}reset(){this.atLineStart=!0}markLineStarted(){this.atLineStart=!1}},LRe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],nx=class{interval=null;frameIndex=0;lastLength=0;writeFn;clearFn;constructor(t,n){this.writeFn=t??(r=>{MRe.writeFrame(r,"spinner")}),this.clearFn=n??(()=>{MRe.writeFrame(`\r${" ".repeat(this.lastLength)}\r`,"spinner")})}start(t){this.stop(),this.frameIndex=0,this.interval=setInterval(()=>{let n=LRe[this.frameIndex%LRe.length],r=`${en(n)} ${ye(t)}`;this.writeFn(`\r${" ".repeat(this.lastLength)}\r${r}`),this.lastLength=t.length+4,this.frameIndex++},80)}stop(){this.interval&&(clearInterval(this.interval),this.interval=null,this.clearFn(),this.lastLength=0)}}});var ke,Gi=Ne(()=>{"use strict";ke="0.5.42"});import{readFileSync as ZCt}from"node:fs";import{WebContextClient as e0t}from"@xenosystem/web-context-client";function n0t(e=process.env){let t=e.XENO_WEB_CONTEXT_TOKEN?.trim();if(t)return t;let n=e.XENO_WEB_CONTEXT_TOKEN_FILE?.trim();if(n){let r=ZCt(n,"utf8").trim();if(r)return r}throw Object.assign(new Error("XENO Web Context is not configured. Set XENO_WEB_CONTEXT_TOKEN or XENO_WEB_CONTEXT_TOKEN_FILE."),{code:"WEB_CONTEXT_NOT_CONFIGURED"})}function eK(e=process.env){return new e0t({baseUrl:e.XENO_WEB_CONTEXT_URL?.trim()||t0t,token:n0t(e)})}function ATe(e=process.env){return{client:new ZY(e),createRequest:gN({actor:{id:"xeno-agent-cli",kind:"agent"},scope:{kind:"local-profile",profileId:"pending-token-scope"},classification:"public",purposePrefix:"xeno-agent-cli:chat",budget:{durationMs:12e4,maxAttempts:3,maxConcurrency:4,maxBytes:1e7,maxPages:100,maxRedirects:8,maxProviderCostUsd:0}})}}var t0t,ZY,tK=Ne(()=>{"use strict";ut();t0t="http://127.0.0.1:8080";ZY=class{constructor(t){this.env=t}env;client;tenantId;async search(t){return this.getClient().search(await this.bindTenant(t))}async scrapeAndWait(t,n){return this.getClient().scrapeAndWait(await this.bindTenant(t),n)}getClient(){return this.client??=eK(this.env),this.client}async bindTenant(t){this.tenantId??=this.getClient().account().then(r=>r.tenantId);let n=await this.tenantId;return{...t,scope:{kind:"tenant",tenantId:n}}}}});var wTe=Ne(()=>{"use strict"});var yTe=Ne(()=>{"use strict"});var bTe=Ne(()=>{"use strict"});import{WEB_JOB_PROGRESS_OPERATIONS as QRn,WEB_JOB_PROGRESS_SCHEMA as FRn,WEB_JOB_PROGRESS_SCHEMA_VERSION as URn,WEB_JOB_PROGRESS_STATES as jRn,TERMINAL_WEB_JOB_STATES as qRn,isTerminalWebJobState as VRn,isWebJobProgress as HRn,parseWebJobProgress as WRn}from"@xenosystem/web-context-client/progress";function a0t(e){return typeof e=="string"&&r0t.includes(e)}function c0t(e){return fo(e)?Gn(e.clientId)&&Gn(e.clientVersion)&&Gn(e.instanceId)&&a0t(e.surface):!1}function ITe(e){return!fo(e)||!fo(e.protocol)||!fo(e.host)||!fo(e.storage)?!1:Number.isInteger(e.protocol.current)&&f0t(e.protocol.supported)&&Gn(e.host.instanceId)&&Gn(e.host.version)&&(e.host.authority==="primary"||e.host.authority==="diagnostic-read-only")&&(e.host.processBoundary==="in-process"||e.host.processBoundary==="per-user-service")&&e.storage.owner==="xeno-agent-host"&&Number.isInteger(e.storage.schemaVersion)&&Number.isInteger(e.storage.eventSchemaVersion)&&c0t(e.surface)}function nK(e){return!fo(e)||!Gn(e.revision)||!Array.isArray(e.providers)?!1:e.providers.every(p0t)}function l0t(e){return!fo(e)||!fo(e.event)?!1:Gn(e.id)&&Number.isInteger(e.sequence)&&typeof e.sequence=="number"&&e.sequence>=0&&Gn(e.timestamp)&&Gn(e.conversationId)&&Gn(e.requestId)&&Gn(e.type)&&Gn(e.source)}function kTe(e){return!fo(e)||!Array.isArray(e.events)?!1:(e.nextSequence===null||typeof e.nextSequence=="number"&&Number.isInteger(e.nextSequence)&&e.nextSequence>=0)&&e.events.every(l0t)}function ETe(e){return!fo(e)||typeof e.success!="boolean"?!1:e.success?(e.status==="accepted"||e.status==="replayed")&&Gn(e.conversationId)&&Gn(e.requestId)&&Gn(e.adapterId)&&fo(e.selection)&&Gn(e.selection.providerId)&&Gn(e.selection.catalogRevision):Gn(e.code)&&Gn(e.safeError)}function STe(e){return!fo(e)||typeof e.success!="boolean"?!1:e.success?(e.status==="cancel_requested"||e.status==="replayed")&&Gn(e.conversationId)&&Gn(e.requestId):Gn(e.code)&&Gn(e.safeError)}function CTe(e){return fo(e)&&Gn(e.id)&&typeof e.sequence=="number"&&Number.isInteger(e.sequence)&&e.sequence>0&&typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)&&u0t(e.type)&&e.source==="host"&&e.schemaVersion===1&&e.redactionState==="safe"&&"payload"in e}function u0t(e){return typeof e=="string"&&s0t.includes(e)}function xTe(e,t,n){if(e.surface.surface!==t.surface||e.surface.instanceId!==t.instanceId)throw new Pi("surface_mismatch",`Agent host acknowledged ${e.surface.surface}/${e.surface.instanceId} instead of ${t.surface}/${t.instanceId}.`);if(e.protocol.current<n.min||e.protocol.current>n.max||n.max<e.protocol.supported.min||n.min>e.protocol.supported.max)throw new Pi("protocol_mismatch",`Agent host protocol ${e.protocol.current} is incompatible with client range ${n.min}-${n.max}.`)}function d0t(e){return!(!fo(e)||e.chatExecution!==void 0&&!gx(e.chatExecution)||e.durableResume!==void 0&&!gx(e.durableResume)||e.nativeTuiAttach!==void 0&&!gx(e.nativeTuiAttach)||e.reconciliation!==void 0&&!gx(e.reconciliation)||e.modelSwitchInPlace!==void 0&&!gx(e.modelSwitchInPlace)||e.resumeCompatibilityKey!==void 0&&typeof e.resumeCompatibilityKey!="string")}function gx(e){return fo(e)?(e.status==="available"||e.status==="degraded"||e.status==="blocked"||e.status==="unsupported")&&(e.source==="provider"||e.source==="host"||e.source==="policy")&&(e.reason===void 0||typeof e.reason=="string")&&(e.version===void 0||typeof e.version=="string"):!1}function p0t(e){return fo(e)?Gn(e.id)&&typeof e.kind=="string"&&i0t.includes(e.kind)&&Gn(e.displayName)&&RTe(e.availability)&&fo(e.capabilities)&&(e.providerSession===void 0||d0t(e.providerSession))&&Array.isArray(e.models)&&e.models.every(m0t)&&Gn(e.catalogRevision):!1}function m0t(e){return fo(e)&&Gn(e.id)&&Gn(e.displayName)&&RTe(e.availability)}function RTe(e){return e==="available"||e==="degraded"||e==="blocked"||e==="unavailable"}function f0t(e){return fo(e)&&Number.isInteger(e.min)&&Number.isInteger(e.max)&&typeof e.min=="number"&&typeof e.max=="number"&&e.min>0&&e.max>=e.min}function Gn(e){return typeof e=="string"&&e.trim().length>0}function fo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function TTe(e){for(let t of g0t)for(let n of h0t)if(e===`${t}tool.${n}`)return n;return null}function hA(e,t){let n=e?.[t];return typeof n=="string"&&n.trim()?n:void 0}function PTe(e){let t=e.event;return hA(t,"toolName")||hA(t,"tool")||hA(t,"name")||hA(t,"title")||hA(t,"kind")}function _Te(e){let t=e.event;return hA(t,"toolCallId")||hA(t,"tool_call_id")}function $Te(e){let t=e.event;for(let n of["rawInput","input","arguments","parameters","args"]){let r=t?.[n];if(r&&typeof r=="object"&&!Array.isArray(r))return r}}function BTe(e){let t=e.event;for(let n of["rawOutput","output","result","content"]){let r=t?.[n];if(typeof r=="string")return r.length>0?r:void 0;if(r!=null)try{let i=JSON.stringify(r);if(i&&i!=="{}"&&i!=="[]")return i}catch{}}}function MTe(e){return e==="completed"?!0:e==="failed"||e==="cancelled"?!1:null}var wv,vTe,r0t,i0t,o0t,GRn,s0t,Pi,h0t,g0t,Ax=Ne(()=>{"use strict";wTe();yTe();bTe();wv=1,vTe=1,r0t=["standalone-desktop","hub-embed","shell-embed","embed-preview","headless-client"],i0t=["sdk-native","xeno-cloud","cli-app-server","cli-remote","acp"],o0t=["host.handshake","providers.list","providers.refresh","runtime.events.list","state.workspaces.load","state.workspaces.save","state.conversations.load","state.conversations.save","state.conversations.delete","workspace.access.grant","coordination.held.list","coordination.held.release","coordination.policy.set","coordination.state.get","coordination.action","workspace.application.grant","workspace.directory.list","workspace.file.read","workspace.file.write","workspace.command.run","workspace.terminal.start","workspace.terminal.stop","workspace.pty.start","workspace.pty.snapshot","workspace.pty.input","workspace.pty.resize","workspace.pty.clear","workspace.pty.stop","conversation.open","conversation.resume","provider.lanes.list","provider.lanes.get","provider.lanes.select","provider.native.attach","provider.native.detach","provider.native.reattach","provider.native.stop","provider.reconcile","turn.start","turn.cancel","turn.steer","context.inject","turn.queue","turn.queue.list","run.observation.snapshot","run.observation.change","run.observation.overlaps","fleet.view","fleet.route","fleet.plan","subagent.run.create","subagent.run.list","subagent.run.cancel","subagent.scheduler.status","subagent.scheduler.recover","session.list","session.attach","session.detach","session.snapshot","session.input","session.takeover","session.release","session.setMode","acp.agents.list","acp.agents.addPreset","acp.agents.remove","intake.sources.list","intake.items.list","intake.item.claim","intake.item.release","intake.item.dispatch","knowledge.list","knowledge.record","knowledge.forget","knowledge.context","turn.queue.drop","elicitation.choose-directory.answer","elicitation.workspace-placement.answer","elicitation.permission.answer","turn.resume","acp.provider.approve","permissions.rules.list","permissions.rules.revoke","elicitation.ask-user.answer","sdk.sessions.list","sdk.sessions.show","sdk.sessions.attach","sdk.sessions.detach","sdk.sessions.delete","sdk.sessions.clean","sdk.checkpoints.list","sdk.checkpoints.restore","sdk.checkpoints.delete","sdk.tasks.output","sdk.tasks.stop","engineering.git.status","engineering.git.diff","engineering.git.stage","engineering.git.unstage","engineering.git.commit","engineering.git.branch","engineering.git.push","engineering.git.pr.create","engineering.landing.enqueue","engineering.landing.remove","engineering.landing.status","engineering.landing.land","engineering.landing.verify","engineering.checks.discover","engineering.checks.run","engineering.background.start","engineering.background.list","engineering.background.output","engineering.background.stop","engineering.runs.list","engineering.diagnostics","engineering.patches.list","engineering.patches.enqueue","engineering.patches.update","engineering.patches.review","engineering.checkpoints.list","engineering.checkpoints.compare","engineering.checkpoints.restore","engineering.sessions.list","engineering.runtime.timeline"],GRn=new Set(o0t),s0t=["host.ready","provider.catalog.changed","runtime.event.appended","turn.execution.completed","turn.execution.failed","turn.execution.abandoned","elicitation.choose-directory.requested","elicitation.workspace-placement.requested","elicitation.permission.requested","elicitation.ask-user.requested","task.changed","workspace.terminal.data","workspace.terminal.exit","workspace.pty.data","workspace.pty.exit","coordination.event","run.observation","session.event","provider.lane.created","provider.lane.selected","provider.lane.resumed","provider.lane.invalidated","provider.writer.acquired","provider.writer.renewed","provider.writer.released","provider.writer.recovery_classified","provider.native_tui.started","provider.native_tui.detached","provider.native_tui.exited","provider.reconciliation.started","provider.reconciliation.completed","provider.reconciliation.failed","provider.portable_context.acknowledged_partial"],Pi=class extends Error{code;constructor(t,n){super(n),this.name="AgentHostProtocolError",this.code=t}};h0t=["started","updated","completed","failed","cancelled"],g0t=["","acp."]});import{createHash as A0t}from"node:crypto";import{setTimeout as w0t}from"node:timers/promises";function v0t(e,t){return`subrun-${A0t("sha256").update(`${e}\0${t}`).digest("hex").slice(0,32)}`}async function I0t(e,t,n){return((await e.listRuntimeEvents({conversationId:t,subagentRunId:n,limit:500}))?.events??[]).map(i=>{let o=String(i.type??"").toLowerCase();if(!o.includes("text")&&!o.includes("message")&&!o.includes("delta"))return"";let s=i.event??{};return typeof s.text=="string"?s.text:typeof s.delta=="string"?s.delta:""}).join("")}function k0t(e,t,n,r){let i=new Set,o=typeof r.onToolStart=="function"||typeof r.onToolEnd=="function",s=a=>{try{a()}catch{}};return async function(){if(!o)return;let c=await e.listRuntimeEvents({conversationId:t,subagentRunId:n,limit:500}).catch(()=>null);for(let l of c?.events??[]){let u=TTe(String(l.type??""));if(!u)continue;let d=`${_Te(l)??l.id}:${u}`;if(i.has(d))continue;i.add(d);let p=PTe(l)??"unknown";if(u==="started"&&r.onToolStart){let f=r.onToolStart;s(()=>f(p,$Te(l)??{}))}let m=MTe(u);if(m!==null&&r.onToolEnd){let f=r.onToolEnd;s(()=>f(p,{success:m,output:BTe(l)??""}))}}}}function NTe(e){let t=e.pollIntervalMs??250;return async n=>{let r=n.task,i=v0t(e.rootTraceId,r.id),o={lastTraceId:null,tokenUsage:{input:0,output:0,total:0},async run(s){let a=Math.max(1e3,e.deadline-Date.now()),c={parentConversationId:e.parentConversationId,...e.parentRequestId===void 0?{}:{parentRequestId:e.parentRequestId},parentAgentId:e.parentAgentId,childConversationId:i,childAgentId:r.role?`delegated-${r.role}`:"delegated-branch",workspaceId:e.workspaceId,teamId:e.teamId,objective:s,...r.role===void 0?{}:{role:r.role},policy:{maxRuntimeMs:a}},l=await e.client.createSubagentRun(c);if(!l?.success||!l.run)throw new Error(l?.safeError??"The Agent host refused to create a subagent run for this delegated branch.");let u=l.run.id;o.lastTraceId=u;let d=k0t(e.client,i,u,{onToolStart:n.onToolStart,onToolEnd:n.onToolEnd});for(;;){if(e.signal?.aborted){await e.client.cancelSubagentRun({runId:u}).catch(()=>{});let h=new Error("Delegated branch was cancelled.");throw h.name="AgentInterruptedError",h}let m=((await e.client.listSubagentRuns({parentConversationId:e.parentConversationId}))?.runs??[]).find(h=>h.id===u),f=String(m?.status??"");if(y0t.has(f)){if(b0t.has(f))throw new Error(m?.error??`The delegated branch ended as '${f}' without reporting a reason.`);await d();let h=await I0t(e.client,i,u);if(h.length===0)throw new Error(`The delegated branch reported '${f}' but produced no readable output. Its runtime events carry no text for this run id.`);return h}if(Date.now()>=e.deadline)throw await e.client.cancelSubagentRun({runId:u}).catch(()=>{}),new Error("The delegated branch exceeded the time this run was given to wait.");await d(),await w0t(t,void 0,{signal:e.signal})}}};return o}}var y0t,b0t,OTe=Ne(()=>{"use strict";Ax();y0t=new Set(["completed","succeeded","failed","cancelled","error"]),b0t=new Set(["failed","cancelled","error"])});import{createHash as E0t,randomBytes as S0t}from"node:crypto";import{chmodSync as C0t,existsSync as x0t,mkdirSync as LTe,readFileSync as R0t,renameSync as T0t,unlinkSync as QTe,writeFileSync as P0t}from"node:fs";import{dirname as _0t,join as wx}from"node:path";function FTe(){return Mc()}function $0t(e){return E0t("sha256").update(e).digest("hex").slice(0,16)}function Ln(){return wx(FTe(),"daemon")}function rK(){return wx(Ln(),"daemon.json")}function UTe(){return wx(Ln(),"daemon.lock")}function yv(){return wx(Ln(),"daemon.log")}function iK(){let e=$0t(FTe());return process.platform==="win32"?{transport:"named-pipe",endpoint:`\\\\.\\pipe\\xeno-agent-daemon-${e}`}:{transport:"unix-socket",endpoint:wx(Ln(),"daemon.sock")}}function OL(){LTe(Ln(),{recursive:!0})}function jTe(){return S0t(32).toString("base64url")}function DTe(e){if(process.platform!=="win32")try{C0t(e,384)}catch{}}function oK(){try{return JSON.parse(R0t(rK(),"utf8"))}catch{return null}}function qTe(e){let t=rK();LTe(_0t(t),{recursive:!0});let n=`${t}.${process.pid}.${Date.now()}.tmp`;P0t(n,JSON.stringify(e,null,2)+`
|
|
2751
|
+
`&&(this.atLineStart=!0);this.writeFn(n)}reset(){this.atLineStart=!0}markLineStarted(){this.atLineStart=!1}},LRe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],nx=class{interval=null;frameIndex=0;lastLength=0;writeFn;clearFn;constructor(t,n){this.writeFn=t??(r=>{MRe.writeFrame(r,"spinner")}),this.clearFn=n??(()=>{MRe.writeFrame(`\r${" ".repeat(this.lastLength)}\r`,"spinner")})}start(t){this.stop(),this.frameIndex=0,this.interval=setInterval(()=>{let n=LRe[this.frameIndex%LRe.length],r=`${en(n)} ${ye(t)}`;this.writeFn(`\r${" ".repeat(this.lastLength)}\r${r}`),this.lastLength=t.length+4,this.frameIndex++},80)}stop(){this.interval&&(clearInterval(this.interval),this.interval=null,this.clearFn(),this.lastLength=0)}}});var ke,Gi=Ne(()=>{"use strict";ke="0.5.43"});import{readFileSync as ZCt}from"node:fs";import{WebContextClient as e0t}from"@xenosystem/web-context-client";function n0t(e=process.env){let t=e.XENO_WEB_CONTEXT_TOKEN?.trim();if(t)return t;let n=e.XENO_WEB_CONTEXT_TOKEN_FILE?.trim();if(n){let r=ZCt(n,"utf8").trim();if(r)return r}throw Object.assign(new Error("XENO Web Context is not configured. Set XENO_WEB_CONTEXT_TOKEN or XENO_WEB_CONTEXT_TOKEN_FILE."),{code:"WEB_CONTEXT_NOT_CONFIGURED"})}function eK(e=process.env){return new e0t({baseUrl:e.XENO_WEB_CONTEXT_URL?.trim()||t0t,token:n0t(e)})}function ATe(e=process.env){return{client:new ZY(e),createRequest:gN({actor:{id:"xeno-agent-cli",kind:"agent"},scope:{kind:"local-profile",profileId:"pending-token-scope"},classification:"public",purposePrefix:"xeno-agent-cli:chat",budget:{durationMs:12e4,maxAttempts:3,maxConcurrency:4,maxBytes:1e7,maxPages:100,maxRedirects:8,maxProviderCostUsd:0}})}}var t0t,ZY,tK=Ne(()=>{"use strict";ut();t0t="http://127.0.0.1:8080";ZY=class{constructor(t){this.env=t}env;client;tenantId;async search(t){return this.getClient().search(await this.bindTenant(t))}async scrapeAndWait(t,n){return this.getClient().scrapeAndWait(await this.bindTenant(t),n)}getClient(){return this.client??=eK(this.env),this.client}async bindTenant(t){this.tenantId??=this.getClient().account().then(r=>r.tenantId);let n=await this.tenantId;return{...t,scope:{kind:"tenant",tenantId:n}}}}});var wTe=Ne(()=>{"use strict"});var yTe=Ne(()=>{"use strict"});var bTe=Ne(()=>{"use strict"});import{WEB_JOB_PROGRESS_OPERATIONS as QRn,WEB_JOB_PROGRESS_SCHEMA as FRn,WEB_JOB_PROGRESS_SCHEMA_VERSION as URn,WEB_JOB_PROGRESS_STATES as jRn,TERMINAL_WEB_JOB_STATES as qRn,isTerminalWebJobState as VRn,isWebJobProgress as HRn,parseWebJobProgress as WRn}from"@xenosystem/web-context-client/progress";function a0t(e){return typeof e=="string"&&r0t.includes(e)}function c0t(e){return fo(e)?Gn(e.clientId)&&Gn(e.clientVersion)&&Gn(e.instanceId)&&a0t(e.surface):!1}function ITe(e){return!fo(e)||!fo(e.protocol)||!fo(e.host)||!fo(e.storage)?!1:Number.isInteger(e.protocol.current)&&f0t(e.protocol.supported)&&Gn(e.host.instanceId)&&Gn(e.host.version)&&(e.host.authority==="primary"||e.host.authority==="diagnostic-read-only")&&(e.host.processBoundary==="in-process"||e.host.processBoundary==="per-user-service")&&e.storage.owner==="xeno-agent-host"&&Number.isInteger(e.storage.schemaVersion)&&Number.isInteger(e.storage.eventSchemaVersion)&&c0t(e.surface)}function nK(e){return!fo(e)||!Gn(e.revision)||!Array.isArray(e.providers)?!1:e.providers.every(p0t)}function l0t(e){return!fo(e)||!fo(e.event)?!1:Gn(e.id)&&Number.isInteger(e.sequence)&&typeof e.sequence=="number"&&e.sequence>=0&&Gn(e.timestamp)&&Gn(e.conversationId)&&Gn(e.requestId)&&Gn(e.type)&&Gn(e.source)}function kTe(e){return!fo(e)||!Array.isArray(e.events)?!1:(e.nextSequence===null||typeof e.nextSequence=="number"&&Number.isInteger(e.nextSequence)&&e.nextSequence>=0)&&e.events.every(l0t)}function ETe(e){return!fo(e)||typeof e.success!="boolean"?!1:e.success?(e.status==="accepted"||e.status==="replayed")&&Gn(e.conversationId)&&Gn(e.requestId)&&Gn(e.adapterId)&&fo(e.selection)&&Gn(e.selection.providerId)&&Gn(e.selection.catalogRevision):Gn(e.code)&&Gn(e.safeError)}function STe(e){return!fo(e)||typeof e.success!="boolean"?!1:e.success?(e.status==="cancel_requested"||e.status==="replayed")&&Gn(e.conversationId)&&Gn(e.requestId):Gn(e.code)&&Gn(e.safeError)}function CTe(e){return fo(e)&&Gn(e.id)&&typeof e.sequence=="number"&&Number.isInteger(e.sequence)&&e.sequence>0&&typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)&&u0t(e.type)&&e.source==="host"&&e.schemaVersion===1&&e.redactionState==="safe"&&"payload"in e}function u0t(e){return typeof e=="string"&&s0t.includes(e)}function xTe(e,t,n){if(e.surface.surface!==t.surface||e.surface.instanceId!==t.instanceId)throw new Pi("surface_mismatch",`Agent host acknowledged ${e.surface.surface}/${e.surface.instanceId} instead of ${t.surface}/${t.instanceId}.`);if(e.protocol.current<n.min||e.protocol.current>n.max||n.max<e.protocol.supported.min||n.min>e.protocol.supported.max)throw new Pi("protocol_mismatch",`Agent host protocol ${e.protocol.current} is incompatible with client range ${n.min}-${n.max}.`)}function d0t(e){return!(!fo(e)||e.chatExecution!==void 0&&!gx(e.chatExecution)||e.durableResume!==void 0&&!gx(e.durableResume)||e.nativeTuiAttach!==void 0&&!gx(e.nativeTuiAttach)||e.reconciliation!==void 0&&!gx(e.reconciliation)||e.modelSwitchInPlace!==void 0&&!gx(e.modelSwitchInPlace)||e.resumeCompatibilityKey!==void 0&&typeof e.resumeCompatibilityKey!="string")}function gx(e){return fo(e)?(e.status==="available"||e.status==="degraded"||e.status==="blocked"||e.status==="unsupported")&&(e.source==="provider"||e.source==="host"||e.source==="policy")&&(e.reason===void 0||typeof e.reason=="string")&&(e.version===void 0||typeof e.version=="string"):!1}function p0t(e){return fo(e)?Gn(e.id)&&typeof e.kind=="string"&&i0t.includes(e.kind)&&Gn(e.displayName)&&RTe(e.availability)&&fo(e.capabilities)&&(e.providerSession===void 0||d0t(e.providerSession))&&Array.isArray(e.models)&&e.models.every(m0t)&&Gn(e.catalogRevision):!1}function m0t(e){return fo(e)&&Gn(e.id)&&Gn(e.displayName)&&RTe(e.availability)}function RTe(e){return e==="available"||e==="degraded"||e==="blocked"||e==="unavailable"}function f0t(e){return fo(e)&&Number.isInteger(e.min)&&Number.isInteger(e.max)&&typeof e.min=="number"&&typeof e.max=="number"&&e.min>0&&e.max>=e.min}function Gn(e){return typeof e=="string"&&e.trim().length>0}function fo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function TTe(e){for(let t of g0t)for(let n of h0t)if(e===`${t}tool.${n}`)return n;return null}function hA(e,t){let n=e?.[t];return typeof n=="string"&&n.trim()?n:void 0}function PTe(e){let t=e.event;return hA(t,"toolName")||hA(t,"tool")||hA(t,"name")||hA(t,"title")||hA(t,"kind")}function _Te(e){let t=e.event;return hA(t,"toolCallId")||hA(t,"tool_call_id")}function $Te(e){let t=e.event;for(let n of["rawInput","input","arguments","parameters","args"]){let r=t?.[n];if(r&&typeof r=="object"&&!Array.isArray(r))return r}}function BTe(e){let t=e.event;for(let n of["rawOutput","output","result","content"]){let r=t?.[n];if(typeof r=="string")return r.length>0?r:void 0;if(r!=null)try{let i=JSON.stringify(r);if(i&&i!=="{}"&&i!=="[]")return i}catch{}}}function MTe(e){return e==="completed"?!0:e==="failed"||e==="cancelled"?!1:null}var wv,vTe,r0t,i0t,o0t,GRn,s0t,Pi,h0t,g0t,Ax=Ne(()=>{"use strict";wTe();yTe();bTe();wv=1,vTe=1,r0t=["standalone-desktop","hub-embed","shell-embed","embed-preview","headless-client"],i0t=["sdk-native","xeno-cloud","cli-app-server","cli-remote","acp"],o0t=["host.handshake","providers.list","providers.refresh","runtime.events.list","state.workspaces.load","state.workspaces.save","state.conversations.load","state.conversations.save","state.conversations.delete","workspace.access.grant","coordination.held.list","coordination.held.release","coordination.policy.set","coordination.state.get","coordination.action","workspace.application.grant","workspace.directory.list","workspace.file.read","workspace.file.write","workspace.command.run","workspace.terminal.start","workspace.terminal.stop","workspace.pty.start","workspace.pty.snapshot","workspace.pty.input","workspace.pty.resize","workspace.pty.clear","workspace.pty.stop","conversation.open","conversation.resume","provider.lanes.list","provider.lanes.get","provider.lanes.select","provider.native.attach","provider.native.detach","provider.native.reattach","provider.native.stop","provider.reconcile","turn.start","turn.cancel","turn.steer","context.inject","turn.queue","turn.queue.list","run.observation.snapshot","run.observation.change","run.observation.overlaps","fleet.view","fleet.route","fleet.plan","subagent.run.create","subagent.run.list","subagent.run.cancel","subagent.scheduler.status","subagent.scheduler.recover","session.list","session.attach","session.detach","session.snapshot","session.input","session.takeover","session.release","session.setMode","acp.agents.list","acp.agents.addPreset","acp.agents.remove","intake.sources.list","intake.items.list","intake.item.claim","intake.item.release","intake.item.dispatch","knowledge.list","knowledge.record","knowledge.forget","knowledge.context","turn.queue.drop","elicitation.choose-directory.answer","elicitation.workspace-placement.answer","elicitation.permission.answer","turn.resume","acp.provider.approve","permissions.rules.list","permissions.rules.revoke","elicitation.ask-user.answer","sdk.sessions.list","sdk.sessions.show","sdk.sessions.attach","sdk.sessions.detach","sdk.sessions.delete","sdk.sessions.clean","sdk.checkpoints.list","sdk.checkpoints.restore","sdk.checkpoints.delete","sdk.tasks.output","sdk.tasks.stop","engineering.git.status","engineering.git.diff","engineering.git.stage","engineering.git.unstage","engineering.git.commit","engineering.git.branch","engineering.git.push","engineering.git.pr.create","engineering.landing.enqueue","engineering.landing.remove","engineering.landing.status","engineering.landing.land","engineering.landing.verify","engineering.checks.discover","engineering.checks.run","engineering.background.start","engineering.background.list","engineering.background.output","engineering.background.stop","engineering.runs.list","engineering.diagnostics","engineering.patches.list","engineering.patches.enqueue","engineering.patches.update","engineering.patches.review","engineering.checkpoints.list","engineering.checkpoints.compare","engineering.checkpoints.restore","engineering.sessions.list","engineering.runtime.timeline"],GRn=new Set(o0t),s0t=["host.ready","provider.catalog.changed","runtime.event.appended","turn.execution.completed","turn.execution.failed","turn.execution.abandoned","elicitation.choose-directory.requested","elicitation.workspace-placement.requested","elicitation.permission.requested","elicitation.ask-user.requested","task.changed","workspace.terminal.data","workspace.terminal.exit","workspace.pty.data","workspace.pty.exit","coordination.event","run.observation","session.event","provider.lane.created","provider.lane.selected","provider.lane.resumed","provider.lane.invalidated","provider.writer.acquired","provider.writer.renewed","provider.writer.released","provider.writer.recovery_classified","provider.native_tui.started","provider.native_tui.detached","provider.native_tui.exited","provider.reconciliation.started","provider.reconciliation.completed","provider.reconciliation.failed","provider.portable_context.acknowledged_partial"],Pi=class extends Error{code;constructor(t,n){super(n),this.name="AgentHostProtocolError",this.code=t}};h0t=["started","updated","completed","failed","cancelled"],g0t=["","acp."]});import{createHash as A0t}from"node:crypto";import{setTimeout as w0t}from"node:timers/promises";function v0t(e,t){return`subrun-${A0t("sha256").update(`${e}\0${t}`).digest("hex").slice(0,32)}`}async function I0t(e,t,n){return((await e.listRuntimeEvents({conversationId:t,subagentRunId:n,limit:500}))?.events??[]).map(i=>{let o=String(i.type??"").toLowerCase();if(!o.includes("text")&&!o.includes("message")&&!o.includes("delta"))return"";let s=i.event??{};return typeof s.text=="string"?s.text:typeof s.delta=="string"?s.delta:""}).join("")}function k0t(e,t,n,r){let i=new Set,o=typeof r.onToolStart=="function"||typeof r.onToolEnd=="function",s=a=>{try{a()}catch{}};return async function(){if(!o)return;let c=await e.listRuntimeEvents({conversationId:t,subagentRunId:n,limit:500}).catch(()=>null);for(let l of c?.events??[]){let u=TTe(String(l.type??""));if(!u)continue;let d=`${_Te(l)??l.id}:${u}`;if(i.has(d))continue;i.add(d);let p=PTe(l)??"unknown";if(u==="started"&&r.onToolStart){let f=r.onToolStart;s(()=>f(p,$Te(l)??{}))}let m=MTe(u);if(m!==null&&r.onToolEnd){let f=r.onToolEnd;s(()=>f(p,{success:m,output:BTe(l)??""}))}}}}function NTe(e){let t=e.pollIntervalMs??250;return async n=>{let r=n.task,i=v0t(e.rootTraceId,r.id),o={lastTraceId:null,tokenUsage:{input:0,output:0,total:0},async run(s){let a=Math.max(1e3,e.deadline-Date.now()),c={parentConversationId:e.parentConversationId,...e.parentRequestId===void 0?{}:{parentRequestId:e.parentRequestId},parentAgentId:e.parentAgentId,childConversationId:i,childAgentId:r.role?`delegated-${r.role}`:"delegated-branch",workspaceId:e.workspaceId,teamId:e.teamId,objective:s,...r.role===void 0?{}:{role:r.role},policy:{maxRuntimeMs:a}},l=await e.client.createSubagentRun(c);if(!l?.success||!l.run)throw new Error(l?.safeError??"The Agent host refused to create a subagent run for this delegated branch.");let u=l.run.id;o.lastTraceId=u;let d=k0t(e.client,i,u,{onToolStart:n.onToolStart,onToolEnd:n.onToolEnd});for(;;){if(e.signal?.aborted){await e.client.cancelSubagentRun({runId:u}).catch(()=>{});let h=new Error("Delegated branch was cancelled.");throw h.name="AgentInterruptedError",h}let m=((await e.client.listSubagentRuns({parentConversationId:e.parentConversationId}))?.runs??[]).find(h=>h.id===u),f=String(m?.status??"");if(y0t.has(f)){if(b0t.has(f))throw new Error(m?.error??`The delegated branch ended as '${f}' without reporting a reason.`);await d();let h=await I0t(e.client,i,u);if(h.length===0)throw new Error(`The delegated branch reported '${f}' but produced no readable output. Its runtime events carry no text for this run id.`);return h}if(Date.now()>=e.deadline)throw await e.client.cancelSubagentRun({runId:u}).catch(()=>{}),new Error("The delegated branch exceeded the time this run was given to wait.");await d(),await w0t(t,void 0,{signal:e.signal})}}};return o}}var y0t,b0t,OTe=Ne(()=>{"use strict";Ax();y0t=new Set(["completed","succeeded","failed","cancelled","error"]),b0t=new Set(["failed","cancelled","error"])});import{createHash as E0t,randomBytes as S0t}from"node:crypto";import{chmodSync as C0t,existsSync as x0t,mkdirSync as LTe,readFileSync as R0t,renameSync as T0t,unlinkSync as QTe,writeFileSync as P0t}from"node:fs";import{dirname as _0t,join as wx}from"node:path";function FTe(){return Mc()}function $0t(e){return E0t("sha256").update(e).digest("hex").slice(0,16)}function Ln(){return wx(FTe(),"daemon")}function rK(){return wx(Ln(),"daemon.json")}function UTe(){return wx(Ln(),"daemon.lock")}function yv(){return wx(Ln(),"daemon.log")}function iK(){let e=$0t(FTe());return process.platform==="win32"?{transport:"named-pipe",endpoint:`\\\\.\\pipe\\xeno-agent-daemon-${e}`}:{transport:"unix-socket",endpoint:wx(Ln(),"daemon.sock")}}function OL(){LTe(Ln(),{recursive:!0})}function jTe(){return S0t(32).toString("base64url")}function DTe(e){if(process.platform!=="win32")try{C0t(e,384)}catch{}}function oK(){try{return JSON.parse(R0t(rK(),"utf8"))}catch{return null}}function qTe(e){let t=rK();LTe(_0t(t),{recursive:!0});let n=`${t}.${process.pid}.${Date.now()}.tmp`;P0t(n,JSON.stringify(e,null,2)+`
|
|
2752
2752
|
`,{encoding:"utf8",mode:384}),DTe(n),T0t(n,t),DTe(t)}function DL(){try{QTe(rK())}catch{}}function VTe(){if(process.platform==="win32")return;let{endpoint:e}=iK();if(x0t(e))try{QTe(e)}catch{}}function Ju(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}}var ts=Ne(()=>{"use strict";Jh()});import{execFileSync as sK}from"node:child_process";import{createHash as B0t}from"node:crypto";import{existsSync as M0t,readFileSync as aK,readlinkSync as N0t}from"node:fs";import{hostname as bv}from"node:os";function cK(e){return Number.isInteger(e)&&e>0}function D0t(e){return B0t("sha256").update(e).digest("hex")}function bx(e){let t=e?.trim().replaceAll("\\","/").toLowerCase();return t?`sha256:${D0t(t)}`:void 0}function LL(){if(process.platform==="linux")try{return aK("/proc/sys/kernel/random/boot_id","utf8").trim()||void 0}catch{return}}function L0t(e){if(!cK(e))return!1;try{return process.kill(e,0),!0}catch{return!1}}function HTe(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function Q0t(e){let t=new Map;if(e.length===0)return t;let r=["$ErrorActionPreference = 'Stop'",`$items = @(Get-Process -Id @(${e.join(", ")}) -ErrorAction SilentlyContinue)`,"$out = @($items | ForEach-Object { $path = try { [string]$_.Path } catch { '' }; [pscustomobject]@{ pid = [int]$_.Id; startedAt = $_.StartTime.ToUniversalTime().ToString('o'); executable = $path } })","$out | ConvertTo-Json -Compress"].join("; ");try{let i=sK("powershell.exe",["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",r],{encoding:"utf8",windowsHide:!0,timeout:1e4,stdio:["ignore","pipe","ignore"]}).trim();if(!i)return t;let o=JSON.parse(i);for(let s of Array.isArray(o)?o:[o]){let a=Number(s.pid),c=HTe(String(s.startedAt??""));!cK(a)||!c||t.set(a,{pid:a,processStartedAt:c,hostname:bv(),...bx(s.executable)?{executableFingerprint:bx(s.executable)}:{},confidence:"observed"})}}catch{return t}return t}function F0t(){if(yx)return yx;try{let e=Number.parseInt(sK("getconf",["CLK_TCK"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim(),10);yx=Number.isFinite(e)&&e>0?e:100}catch{yx=100}return yx}function U0t(){try{let e=/^btime\s+(\d+)$/m.exec(aK("/proc/stat","utf8"));return e?Number.parseInt(e[1]??"",10):null}catch{return null}}function j0t(e){try{let t=aK(`/proc/${e}/stat`,"utf8"),n=t.lastIndexOf(")");if(n<0)return null;let r=t.slice(n+2).trim().split(/\s+/),i=Number(r[19]),o=U0t();if(!Number.isFinite(i)||o===null)return null;let s=new Date((o+i/F0t())*1e3).toISOString(),a;try{a=N0t(`/proc/${e}/exe`)}catch{a=void 0}return{pid:e,processStartedAt:s,hostname:bv(),...LL()?{bootId:LL()}:{},...bx(a)?{executableFingerprint:bx(a)}:{},confidence:"observed"}}catch{return null}}function q0t(e){let t=new Map;if(process.platform==="linux"){for(let n of e){let r=j0t(n);r&&t.set(n,r)}return t}for(let n of e)try{let r=sK("ps",["-p",String(n),"-o","lstart="],{encoding:"utf8",timeout:2e3,env:{...process.env,LC_ALL:"C"},stdio:["ignore","pipe","ignore"]}).trim(),i=HTe(r);if(!i)continue;t.set(n,{pid:n,processStartedAt:i,hostname:bv(),confidence:"observed"})}catch{continue}return t}function vx(e){let t=[...new Set(e.filter(cK))],n=t.includes(process.pid),r=n?t.filter(o=>o!==process.pid):t,i=process.platform==="win32"?Q0t(r):q0t(r);return n&&i.set(process.pid,gA()),i}function WTe(e){return vx([e]).get(e)??null}function QL(e,t=new Date,n=!1){return(n?WTe(e):null)??{pid:e,processStartedAt:t.toISOString(),hostname:bv(),confidence:"degraded"}}function gA(){let e=new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString();return{pid:process.pid,processStartedAt:e,hostname:bv(),...LL()?{bootId:LL()}:{},...M0t(process.execPath)?{executableFingerprint:bx(process.execPath)}:{},confidence:"self"}}function Xu(e,t=WTe){if(e.hostname!==bv())return{status:"remote",expected:e,reason:"Process belongs to another host."};if(!L0t(e.pid))return{status:"dead",expected:e,reason:"Process ID is not live."};let n=t(e.pid);if(!n)return{status:"degraded",expected:e,reason:"Creation time could not be observed."};let r=Date.parse(e.processStartedAt),i=Date.parse(n.processStartedAt);return!Number.isFinite(r)||!Number.isFinite(i)||Math.abs(r-i)>O0t?{status:"mismatch",expected:e,observed:n,reason:"Process creation time does not match."}:e.bootId&&n.bootId&&e.bootId!==n.bootId?{status:"mismatch",expected:e,observed:n,reason:"Host boot identity does not match."}:e.executableFingerprint&&n.executableFingerprint&&e.executableFingerprint!==n.executableFingerprint?{status:"mismatch",expected:e,observed:n,reason:"Executable identity does not match."}:{status:"live",expected:e,observed:n}}var O0t,yx,AA=Ne(()=>{"use strict";O0t=3e3});import{existsSync as V0t,linkSync as H0t,mkdirSync as W0t,readFileSync as G0t,rmSync as uK,statSync as J0t,writeFileSync as X0t}from"node:fs";import{hostname as GTe}from"node:os";import{dirname as z0t}from"node:path";import{randomUUID as Y0t}from"node:crypto";function K0t(){return new Date().toISOString()}function lK(e){try{return JSON.parse(G0t(e,"utf8"))}catch{return null}}function Z0t(e){if(e.hostname!==GTe())return!0;let t=Date.parse(e.acquiredAt);if(Number.isFinite(t)&&Date.now()-t<3e4)return!0;if(!Ju(e.pid))return!1;if(e.processIdentity){let n=Xu(e.processIdentity);return n.status==="live"||n.status==="degraded"||n.status==="remote"}return!0}function JTe(e,t){W0t(z0t(e),{recursive:!0});let n=`${e}.${process.pid}.${Y0t()}.tmp`;X0t(n,JSON.stringify(t,null,2)+`
|
|
2753
2753
|
`,{encoding:"utf8",flag:"wx"});try{H0t(n,e)}finally{uK(n,{force:!0})}}function ext(e){try{return Date.now()-J0t(e).mtimeMs<3e4}catch{return!1}}function txt(e,t){return e?.pid===t.pid&&e.hostname===t.hostname&&e.processStartedAt===t.processStartedAt&&e.acquiredAt===t.acquiredAt}function Ix(e,t){return new Error(`${e} is already locked ${t}.`)}function nxt(e,t,n){try{JTe(e,t)}catch(r){throw r.code==="EEXIST"?Ix(n,"by another contender"):r}}function rxt(e,t){let n=lK(e);n?.pid!==t.pid||n.hostname!==t.hostname||n.processStartedAt!==t.processStartedAt||uK(e,{force:!0})}function Vs(e,t,n){let r=K0t(),i=gA(),o={schemaVersion:1,name:t,pid:process.pid,hostname:GTe(),processStartedAt:i.processStartedAt,processIdentity:i,version:n,acquiredAt:r,updatedAt:r};try{JTe(e,o)}catch(s){if(s.code!=="EEXIST")throw s;let c=lK(e);if(c&&Z0t(c))throw Ix(t,`by PID ${c.pid} on ${c.hostname}`);if(c){if(!txt(lK(e),c))throw Ix(t,"while ownership was changing")}else{if(!V0t(e))throw Ix(t,"while ownership was changing");if(ext(e))throw Ix(t,"by an owner whose record is still being published")}uK(e,{force:!0}),nxt(e,o,t)}return{record:o,release:()=>{rxt(e,o)}}}var wA=Ne(()=>{"use strict";ts();AA()});import{createHash as KTe,randomBytes as ixt,randomUUID as ZTe}from"node:crypto";import{closeSync as oxt,existsSync as pK,fsyncSync as sxt,mkdirSync as mK,openSync as axt,readFileSync as FL,renameSync as cxt,writeFileSync as ePe}from"node:fs";import{cpus as lxt}from"node:os";import{dirname as tPe,isAbsolute as uxt,join as kv,resolve as dxt}from"node:path";function Ex(e,t,n=1,r=Number.MAX_SAFE_INTEGER){let i=typeof e=="number"?e:Number.parseInt(String(e??""),10);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.trunc(i))):t}function fxt(e,t,n=0,r=Number.MAX_SAFE_INTEGER){let i=typeof e=="number"?e:Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function vv(e,t){return t===void 0?e:Math.min(e,t)}function kx(e,t){return{maxConcurrency:vv(e.maxConcurrency,t?.maxConcurrency),maxCredentialConcurrency:vv(e.maxCredentialConcurrency,t?.maxCredentialConcurrency),maxRequestsPerWindow:vv(e.maxRequestsPerWindow,t?.maxRequestsPerWindow),maxTokensPerWindow:vv(e.maxTokensPerWindow,t?.maxTokensPerWindow),windowMs:t?.windowMs===void 0?e.windowMs:Math.max(1e3,t.windowMs)}}function hxt(e={}){let t=e.env??process.env,n=Math.max(1,e.cpuCount??lxt().length),r=Math.min(Math.max(1,n-2),pxt),i=Ex(t.XENO_WORKFLOW_GLOBAL_CONCURRENCY,r,1,dK),s=t.XENO_WORKFLOW_TRUSTED_CONCURRENCY_OVERRIDE==="1"?i:Math.min(r,i);s=vv(s,e.user?.globalConcurrency),s=vv(s,e.managed?.globalConcurrency),s=Ex(s,r,1,dK);let a={maxConcurrency:Math.min(s,8),maxCredentialConcurrency:Math.min(s,4),maxRequestsPerWindow:120,maxTokensPerWindow:2e6,windowMs:6e4},c=kx(a,e.user?.providerDefault),l=kx(c,e.managed?.providerDefault),u=new Set([...Object.keys(e.user?.providers??{}),...Object.keys(e.managed?.providers??{})]),d=Object.fromEntries([...u].map(m=>[m,kx(kx(l,e.user?.providers?.[m]),e.managed?.providers?.[m])])),p=(m,f,h=1,A=Number.MAX_SAFE_INTEGER)=>{let g=f,y=e.user?.[m],w=e.managed?.[m];return typeof y=="number"&&(g=Math.min(g,y)),typeof w=="number"&&(g=Math.min(g,w)),Ex(g,f,h,A)};return{schemaVersion:1,productHardConcurrency:dK,globalConcurrency:s,perRunConcurrency:p("perRunConcurrency",s,1,s),perParentConcurrency:p("perParentConcurrency",s,1,s),reservedPrioritySlots:Math.min(2,Math.max(0,s-1)),maxQueueLength:p("maxQueueLength",4096,1,65536),maxQueueWaitMs:p("maxQueueWaitMs",5*6e4,1e3,1440*6e4),maxAttemptsPerLogicalChild:p("maxAttemptsPerLogicalChild",3,1,100),maxAttemptsPerRun:p("maxAttemptsPerRun",1e3,1,1e4),maxReservedTokens:p("maxReservedTokens",4e6,1,Number.MAX_SAFE_INTEGER),maxReservedCostUsd:fxt(Math.min(e.user?.maxReservedCostUsd??500,e.managed?.maxReservedCostUsd??500),500,.01,1e6),leaseTtlMs:p("leaseTtlMs",4e3,2e3,5*6e4),heartbeatIntervalMs:p("heartbeatIntervalMs",1e3,250,6e4),maxStarvationMs:p("maxStarvationMs",3e4,1e3,60*6e4),providerDefault:l,providers:d}}function XTe(e,t){if(!pK(e)){if(t)throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE",`Resource policy file not found: ${e}`);return}try{let n=JSON.parse(FL(e,"utf8"));if(!n||typeof n!="object"||Array.isArray(n))throw new Error("policy root must be an object");return n}catch(n){throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE",`Resource policy is invalid: ${e}: ${n instanceof Error?n.message:String(n)}`)}}function gxt(e=process.env){let t=tPe(Ln()),n=e.XENO_WORKFLOW_RESOURCE_POLICY?.trim(),r=e.XENO_MANAGED_WORKFLOW_RESOURCE_POLICY?.trim(),i=a=>uxt(a)?a:dxt(a),o=XTe(n?i(n):kv(t,"resource-policy.json"),!!n),s=r?XTe(i(r),!0):void 0;return hxt({env:e,user:o,managed:s})}function ho(e){return new Date(e).toISOString()}function Axt(e){return{schemaVersion:1,revision:0,nextFencingToken:1,updatedAt:ho(e),permits:[],queue:[],attempts:[],usage:[],providerRates:[],effects:[]}}function wxt(e){let t=e,n=p=>!!(p&&typeof p=="object"&&!Array.isArray(p)),r=p=>typeof p=="string"&&p.length>0&&p.length<=512,i=p=>typeof p=="string"&&Number.isFinite(Date.parse(p)),o=p=>n(p)&&Number.isInteger(p.pid)&&Number(p.pid)>0&&r(p.hostname)&&i(p.processStartedAt),s=p=>n(p)&&r(p.permitId)&&r(p.requestId)&&r(p.operationId)&&r(p.runId)&&r(p.providerId)&&r(p.logicalChildId)&&r(p.attemptId)&&r(p.idempotencyKey)&&Number.isInteger(p.fencingToken)&&Number(p.fencingToken)>0&&o(p.owner)&&i(p.acquiredAt)&&i(p.heartbeatAt)&&i(p.expiresAt)&&Number.isFinite(p.reservedTokens)&&Number(p.reservedTokens)>=0&&Number.isFinite(p.reservedCostUsd)&&Number(p.reservedCostUsd)>=0,a=p=>n(p)&&r(p.requestId)&&r(p.operationId)&&r(p.runId)&&r(p.providerId)&&r(p.logicalChildId)&&r(p.attemptId)&&r(p.idempotencyKey)&&o(p.owner)&&i(p.enqueuedAt)&&i(p.updatedAt),c=p=>n(p)&&r(p.runId)&&r(p.logicalChildId)&&r(p.attemptId)&&r(p.idempotencyKey)&&r(p.state)&&i(p.startedAt),l=p=>n(p)&&r(p.runId)&&Number.isFinite(p.tokens)&&Number(p.tokens)>=0&&Number.isFinite(p.costUsd)&&Number(p.costUsd)>=0&&Number.isInteger(p.attempts)&&Number(p.attempts)>=0&&i(p.updatedAt),u=p=>n(p)&&r(p.providerId)&&i(p.timestamp)&&Number.isFinite(p.tokens)&&Number(p.tokens)>=0,d=p=>n(p)&&r(p.effectKey)&&r(p.idempotencyKey)&&r(p.permitId)&&Number.isInteger(p.fencingToken)&&Number(p.fencingToken)>0&&r(p.state)&&i(p.claimedAt);return!!(t&&t.schemaVersion===1&&Number.isInteger(t.revision)&&Number(t.revision)>=0&&Number.isInteger(t.nextFencingToken)&&Number(t.nextFencingToken)>0&&i(t.updatedAt)&&Array.isArray(t.permits)&&t.permits.every(s)&&Array.isArray(t.queue)&&t.queue.every(a)&&Array.isArray(t.attempts)&&t.attempts.every(c)&&Array.isArray(t.usage)&&t.usage.every(l)&&Array.isArray(t.providerRates)&&t.providerRates.every(u)&&Array.isArray(t.effects)&&t.effects.every(d))}function yxt(e,t){mK(tPe(e),{recursive:!0});let n=`${e}.${process.pid}.${ZTe()}.tmp`,r=axt(n,"wx",384);try{ePe(r,JSON.stringify(t,null,2)+`
|
|
2754
2754
|
`,"utf8"),sxt(r)}finally{oxt(r)}cxt(n,e)}function bxt(e,t,n){let r=Date.parse(e.requestedAt??""),i=Number.isFinite(r)?r:t,o=Date.parse(e.queueDeadlineAt??"");return{requestedAt:ho(i),deadlineAt:ho(Number.isFinite(o)?Math.min(o,i+n):i+n)}}function nPe(e,t){return kx(e.providerDefault,e.providers[t])}function zTe(e,t,n){let r=Math.max(0,t-Date.parse(e.enqueuedAt));return mxt[e.priorityClass]+Math.floor(r/n.maxStarvationMs)*1001}function vxt(e,t,n){return[...e].sort((r,i)=>zTe(i,t,n)-zTe(r,t,n)||Date.parse(r.enqueuedAt)-Date.parse(i.enqueuedAt)||r.requestId.localeCompare(i.requestId))}function Ixt(e,t){return e.pid===t.pid&&e.hostname===t.hostname&&e.processStartedAt===t.processStartedAt}function Iv(e){return Number.isFinite(e)?Math.max(0,Number(e)):0}function YTe(e,t,n,r){let i=e.permits;if(i.length>=n.globalConcurrency)return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"global_concurrency"};if(!(t.priorityClass==="control"||t.priorityClass==="foreground"||t.priorityClass==="reconciliation"||t.priorityClass==="terminal")&&i.length>=Math.max(0,n.globalConcurrency-n.reservedPrioritySlots))return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"reserved_priority_capacity"};let s=Math.min(n.perRunConcurrency,Ex(t.runConcurrencyLimit,n.perRunConcurrency,1,n.globalConcurrency));if(i.filter(b=>b.runId===t.runId).length>=s)return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"run_concurrency"};if(t.parentId&&i.filter(b=>b.parentId===t.parentId).length>=n.perParentConcurrency)return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"parent_concurrency"};let a=nPe(n,t.providerId);if(i.filter(b=>b.providerId===t.providerId).length>=a.maxConcurrency)return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"provider_concurrency"};if(t.credentialFingerprint&&i.filter(b=>b.providerId===t.providerId&&b.credentialFingerprint===t.credentialFingerprint).length>=a.maxCredentialConcurrency)return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"credential_concurrency"};if(i.some(b=>b.logicalChildId===t.logicalChildId))return{code:"WORKFLOW_CONCURRENCY_LIMIT",reason:"logical_child_active"};let c=new Set(e.attempts.filter(b=>b.logicalChildId===t.logicalChildId).map(b=>b.attemptId));if(!c.has(t.attemptId)&&c.size>=n.maxAttemptsPerLogicalChild)return{code:"WORKFLOW_ATTEMPT_LIMIT",reason:"logical_child_attempt_limit"};let l=new Set(e.attempts.filter(b=>b.runId===t.runId).map(b=>b.attemptId)),u=Math.min(n.maxAttemptsPerRun,Ex(t.runAttemptLimit,n.maxAttemptsPerRun,1,n.maxAttemptsPerRun));if(!l.has(t.attemptId)&&l.size>=u)return{code:"WORKFLOW_ATTEMPT_LIMIT",reason:"run_attempt_limit"};let d=Iv(t.reservedTokens);if(i.reduce((b,v)=>b+v.reservedTokens,0)+d>n.maxReservedTokens)return{code:"WORKFLOW_TOKEN_LIMIT",reason:"global_token_reservation"};let m=Iv(t.reservedCostUsd);if(i.reduce((b,v)=>b+v.reservedCostUsd,0)+m>n.maxReservedCostUsd)return{code:"WORKFLOW_COST_LIMIT",reason:"global_cost_reservation"};let h=e.usage.find(b=>b.runId===t.runId),A=i.filter(b=>b.runId===t.runId).reduce((b,v)=>b+v.reservedTokens,0);if(t.runTokenLimit!==void 0&&(h?.tokens??0)+A+d>t.runTokenLimit)return{code:"WORKFLOW_TOKEN_LIMIT",reason:"run_token_limit"};let g=i.filter(b=>b.runId===t.runId).reduce((b,v)=>b+v.reservedCostUsd,0);if(t.runCostLimitUsd!==void 0&&(h?.costUsd??0)+g+m>t.runCostLimitUsd)return{code:"WORKFLOW_COST_LIMIT",reason:"run_cost_limit"};let y=r-a.windowMs,w=e.providerRates.filter(b=>b.providerId===t.providerId&&Date.parse(b.timestamp)>=y&&(!t.credentialFingerprint||b.credentialFingerprint===t.credentialFingerprint));return w.length>=a.maxRequestsPerWindow?{reason:"provider_request_rate"}:w.reduce((b,v)=>b+v.tokens,0)+d>a.maxTokensPerWindow?{reason:"provider_token_rate"}:{}}function kxt(e){for(let[t,n]of Object.entries({requestId:e.requestId,operationId:e.operationId,runId:e.runId,providerId:e.providerId,logicalChildId:e.logicalChildId,attemptId:e.attemptId,idempotencyKey:e.idempotencyKey}))if(typeof n!="string"||!n.trim()||n.length>512)throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE",`Invalid resource request field: ${t}.`);if(e.credentialFingerprint&&!/^(?:cred_)?sha256_[a-f0-9]{32,64}$/i.test(e.credentialFingerprint))throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE","credentialFingerprint must be a scoped SHA-256 fingerprint.")}function Ef(e,t){let n=String(e??"default").trim().toLowerCase().split(/[/:]/,1)[0]||"default",r=t?.trim()?KTe("sha256").update(t.trim().toLowerCase()).digest("hex").slice(0,16):"default";return`${n}@${r}`}function fK(e){let t=KTe("sha256");return t.update(e.salt),t.update("\0"),t.update(e.providerId),t.update("\0"),t.update(e.endpoint?.trim().toLowerCase()??""),t.update("\0"),t.update(e.credential),`cred_sha256_${t.digest("hex")}`}function hK(e=kv(Ln(),"governor")){let t=kv(e,"credential-salt.bin");if(mK(e,{recursive:!0}),pK(t))return FL(t);let n=ixt(32);try{return ePe(t,n,{flag:"wx",mode:384}),n}catch{return FL(t)}}function Ev(e,t=process.env,n){let r=e.split("@",1)[0]?.toLowerCase(),o=(r==="anthropic"||r==="claude"?["ANTHROPIC_API_KEY","XENO_API_KEY"]:r==="openai"||r==="gpt"?["OPENAI_API_KEY","XENO_API_KEY"]:r==="google"||r==="gemini"?["GOOGLE_API_KEY","GEMINI_API_KEY","XENO_API_KEY"]:["XENO_API_KEY","ANTHROPIC_API_KEY","OPENAI_API_KEY","GOOGLE_API_KEY","GEMINI_API_KEY"]).map(s=>t[s]?.trim()).find(Boolean);return o?fK({providerId:e,endpoint:n,credential:o,salt:hK()}):void 0}function UL(e){return{XENO_RESOURCE_PERMIT_ID:e.permitId,XENO_RESOURCE_FENCING_TOKEN:String(e.fencingToken),XENO_RESOURCE_OPERATION_ID:e.operationId,XENO_RESOURCE_IDEMPOTENCY_KEY:e.idempotencyKey}}function gK(e=process.env){let t=e.XENO_RESOURCE_PERMIT_ID?.trim(),n=Number.parseInt(e.XENO_RESOURCE_FENCING_TOKEN??"",10);return t&&Number.isInteger(n)&&n>0?{permitId:t,fencingToken:n}:null}function yA(e,t,n=process.env){if(n.XENO_RESOURCE_OPERATION_ID?.trim()!==e)return;let r=gK(n);if(!t||!r||t.permitId!==r.permitId||t.fencingToken!==r.fencingToken)throw new ns("WORKER_LEASE_EXPIRED","Worker state write rejected because its fencing token is stale.");new Jr().assertFence(r.permitId,r.fencingToken)}var dK,pxt,ns,mxt,Jr,kp=Ne(()=>{"use strict";Gi();sv();ts();wA();AA();dK=64,pxt=16,ns=class extends Error{constructor(n,r){super(r);this.code=n;this.name="WorkflowResourceError"}code},mxt={control:1e3,foreground:900,reconciliation:850,terminal:800,"app-server":700,workflow:500,background:400,scheduled:300};Jr=class{policy;rootDir;ledgerPath;lockPath;now;owner;fault;constructor(t={}){this.rootDir=t.rootDir??kv(Ln(),"governor"),this.ledgerPath=kv(this.rootDir,"resource-ledger.json"),this.lockPath=kv(this.rootDir,"resource-ledger.lock"),this.policy=t.policy??gxt(),this.now=t.now??Date.now,this.owner=t.owner??gA,this.fault=t.fault,mK(this.rootDir,{recursive:!0})}acquire(t){kxt(t);let n=0,r=this.withLedger((a,c)=>{this.cleanupExpired(a,c);let l=a.permits.find(v=>v.requestId===t.requestId||v.attemptId===t.attemptId);if(l)return n=a.permits.length,{value:{status:"active",permit:l,reason:"attempt_already_active"},changed:!0};let u=bxt(t,c,this.policy.maxQueueWaitMs);if(c>Date.parse(u.deadlineAt))return{value:{status:"rejected",code:"WORKFLOW_QUEUE_EXPIRED",reason:"Queued work exceeded its deadline."},changed:!1};let d=a.queue.find(v=>v.requestId===t.requestId);if(d&&c>Date.parse(d.queueDeadlineAt??u.deadlineAt))return a.queue=a.queue.filter(v=>v.requestId!==t.requestId),{value:{status:"rejected",code:"WORKFLOW_QUEUE_EXPIRED",reason:"Queued work exceeded its deadline."},changed:!0};if(!d&&a.queue.length>=this.policy.maxQueueLength)return{value:{status:"rejected",code:"WORKFLOW_QUEUE_FULL",reason:"The host workflow queue is full."},changed:!1};let p=t.owner??this.owner(),m=d?{...d,...t,owner:d.owner,updatedAt:ho(c)}:{...t,owner:p,requestedAt:u.requestedAt,queueDeadlineAt:u.deadlineAt,enqueuedAt:ho(c),updatedAt:ho(c)};d?a.queue=a.queue.map(v=>v.requestId===m.requestId?m:v):a.queue.push(m);let f=vxt(a.queue,c,this.policy),h,A={};for(let v of f){let I=YTe(a,v,this.policy,c);if(v.requestId===m.requestId&&(A=I),!I.reason){h=v;break}}if(A.code==="WORKFLOW_ATTEMPT_LIMIT"||A.code==="WORKFLOW_TOKEN_LIMIT"||A.code==="WORKFLOW_COST_LIMIT")return a.queue=a.queue.filter(v=>v.requestId!==m.requestId),{value:{status:"rejected",code:A.code,reason:A.reason??"resource_limit"},changed:!0};if(!h||h.requestId!==m.requestId){let v=a.permits.map(R=>Date.parse(R.expiresAt)).filter(Number.isFinite).sort((R,C)=>R-C)[0],I=nPe(this.policy,m.providerId),k=a.providerRates.filter(R=>R.providerId===m.providerId&&(!m.credentialFingerprint||R.credentialFingerprint===m.credentialFingerprint)).map(R=>Date.parse(R.timestamp)+I.windowMs).filter(R=>Number.isFinite(R)&&R>c).sort((R,C)=>R-C)[0],x=[v,k].filter(R=>typeof R=="number").sort((R,C)=>R-C)[0];return{value:{status:"queued",request:m,reason:A.reason??"waiting_for_fair_turn",...x?{estimatedEligibleAt:ho(x)}:{}},changed:!0}}let g=YTe(a,m,this.policy,c);if(g.reason)return g.code==="WORKFLOW_ATTEMPT_LIMIT"||g.code==="WORKFLOW_TOKEN_LIMIT"||g.code==="WORKFLOW_COST_LIMIT"?(a.queue=a.queue.filter(v=>v.requestId!==m.requestId),{value:{status:"rejected",code:g.code,reason:g.reason},changed:!0}):{value:{status:"queued",request:m,reason:g.reason},changed:!0};let y=ho(c),w={permitId:`permit_${ZTe()}`,requestId:m.requestId,operationId:m.operationId,surface:m.surface,priorityClass:m.priorityClass,runId:m.runId,...m.parentId?{parentId:m.parentId}:{},providerId:m.providerId,...m.credentialFingerprint?{credentialFingerprint:m.credentialFingerprint}:{},logicalChildId:m.logicalChildId,attemptId:m.attemptId,idempotencyKey:m.idempotencyKey,fencingToken:a.nextFencingToken++,owner:m.owner,acquiredAt:y,heartbeatAt:y,expiresAt:ho(c+this.policy.leaseTtlMs),reservedTokens:Iv(m.reservedTokens),reservedCostUsd:Iv(m.reservedCostUsd),lastDurableSequence:0};a.queue=a.queue.filter(v=>v.requestId!==m.requestId),a.permits.push(w),n=a.permits.length;let b=a.attempts.find(v=>v.attemptId===m.attemptId);return b?Object.assign(b,{state:"active",permitId:w.permitId,endedAt:void 0,outcome:void 0}):a.attempts.push({runId:m.runId,logicalChildId:m.logicalChildId,attemptId:m.attemptId,idempotencyKey:m.idempotencyKey,state:"active",permitId:w.permitId,startedAt:y}),a.providerRates.push({providerId:m.providerId,...m.credentialFingerprint?{credentialFingerprint:m.credentialFingerprint}:{},timestamp:y,tokens:w.reservedTokens}),this.fault?.("acquire.before_commit"),{value:{status:"acquired",permit:w},changed:!0,afterCommit:()=>this.fault?.("acquire.after_commit")}}),i=r.status==="rejected"?r.code:r.status==="acquired"?"admitted":r.reason;Br("xeno.workflow.admission_results",1,{component:"resource_governor",provider:t.providerId,state:r.status,reason:i,...r.status==="rejected"?{error_code:r.code}:{}}),(i==="provider_request_rate"||i==="provider_token_rate"||i==="provider_concurrency"||i==="credential_concurrency")&&Br("xeno.workflow.provider_throttles",1,{component:"resource_governor",provider:t.providerId,reason:i});let o=Date.parse((r.status==="queued"?r.request.requestedAt:t.requestedAt)??""),s=r.status==="acquired"||r.status==="active"?Date.parse(r.permit.acquiredAt):this.now();return Number.isFinite(o)&&Number.isFinite(s)&&Ko("xeno.workflow.queue_wait_ms",Math.max(0,s-o),{component:"resource_governor",provider:t.providerId,state:r.status}),n>0&&Ko("xeno.workflow.active_concurrency",n,{component:"resource_governor",provider:t.providerId}),r}heartbeat(t){return this.withLedger((n,r)=>{let i=this.currentPermit(n,t.permitId,t.fencingToken,r),o=t.owner??this.owner();if(!Ixt(i.owner,o))throw new ns("WORKER_IDENTITY_MISMATCH","Permit heartbeat came from a different worker identity.");return i.heartbeatAt=ho(r),i.expiresAt=ho(r+this.policy.leaseTtlMs),i.lastDurableSequence=Math.max(i.lastDurableSequence,Math.max(0,t.lastDurableSequence??0)),{value:{...i},changed:!0}})}assertFence(t,n){return this.withLedger((r,i)=>({value:{...this.currentPermit(r,t,n,i)},changed:!1}))}transfer(t,n,r){return this.withLedger((i,o)=>{let s=this.currentPermit(i,t,n,o);return s.owner=r,s.heartbeatAt=ho(o),s.expiresAt=ho(o+this.policy.leaseTtlMs),{value:{...s},changed:!0}})}settle(t){return this.withLedger((n,r)=>{let i=n.permits.find(c=>c.permitId===t.permitId);if(!i)return{value:!1,changed:!1};if(i.fencingToken!==t.fencingToken||Date.parse(i.expiresAt)<=r)throw new ns("WORKER_LEASE_EXPIRED","The worker fencing token is stale.");n.permits=n.permits.filter(c=>c.permitId!==i.permitId);let o=n.attempts.find(c=>c.attemptId===i.attemptId);o&&Object.assign(o,{state:"settled",endedAt:ho(r),outcome:t.outcome});let s=n.usage.find(c=>c.runId===i.runId),a={runId:i.runId,tokens:(s?.tokens??0)+Iv(t.actualTokens),costUsd:(s?.costUsd??0)+Iv(t.actualCostUsd),attempts:(s?.attempts??0)+1,updatedAt:ho(r)};return n.usage=[...n.usage.filter(c=>c.runId!==i.runId),a],{value:!0,changed:!0}})}settleOperation(t,n,r=0,i=0){let o=this.snapshot().permits.find(s=>s.operationId===t);return o?this.settle({permitId:o.permitId,fencingToken:o.fencingToken,outcome:n,actualTokens:r,actualCostUsd:i}):!1}cancelQueued(t){return this.withLedger(n=>{let r=n.queue.some(i=>i.requestId===t);return n.queue=n.queue.filter(i=>i.requestId!==t),{value:r,changed:r}})}claimEffect(t){return this.withLedger((n,r)=>{let i=this.currentPermit(n,t.permitId,t.fencingToken,r),o=n.effects.find(s=>s.effectKey===t.effectKey||s.idempotencyKey===i.idempotencyKey);return o?{value:o.permitId===i.permitId&&o.fencingToken===i.fencingToken&&o.state==="claimed",changed:!1}:(n.effects.push({effectKey:t.effectKey,idempotencyKey:i.idempotencyKey,permitId:i.permitId,fencingToken:i.fencingToken,state:"claimed",claimedAt:ho(r)}),{value:!0,changed:!0})})}commitEffect(t){return this.withLedger((n,r)=>{this.currentPermit(n,t.permitId,t.fencingToken,r);let i=n.effects.find(o=>o.effectKey===t.effectKey);return!i||i.permitId!==t.permitId||i.fencingToken!==t.fencingToken?{value:!1,changed:!1}:i.state==="committed"?{value:!0,changed:!1}:(i.state="committed",i.committedAt=ho(r),{value:!0,changed:!0})})}reconcile(t){let n=this.withLedger((r,i)=>{let o=[...r.permits],s=[...r.queue],a=t??vx(o.map(h=>h.owner.pid)),c=new Set,l=new Set;for(let h of o){let A=Xu(h.owner,g=>a.get(g)??null);A.status==="mismatch"&&c.add(h.permitId),(A.status==="degraded"||A.status==="remote")&&l.add(h.permitId)}this.cleanupExpired(r,i,c);let u=new Set(r.permits.map(h=>h.permitId)),d=o.filter(h=>!u.has(h.permitId)&&!c.has(h.permitId)),p=o.filter(h=>c.has(h.permitId)),m=new Set(r.queue.map(h=>h.requestId)),f=s.filter(h=>!m.has(h.requestId));return{value:{expiredPermits:d,identityMismatches:p,expiredQueue:f,livePermits:r.permits.length,degradedPermits:r.permits.filter(h=>l.has(h.permitId)).length},changed:d.length>0||p.length>0||f.length>0}});return Ko("xeno.worker.live_leases",n.livePermits,{component:"resource_governor",operation:"reconcile"}),Ko("xeno.worker.degraded_leases",n.degradedPermits,{component:"resource_governor",operation:"reconcile"}),n.expiredPermits.length>0&&Br("xeno.worker.lease_expirations",n.expiredPermits.length,{component:"resource_governor",operation:"reconcile"}),n.identityMismatches.length>0&&Br("xeno.worker.identity_mismatches",n.identityMismatches.length,{component:"resource_governor",operation:"reconcile"}),n}snapshot(){return this.withLedger(t=>({value:structuredClone(t),changed:!1}))}cleanupExpired(t,n,r=new Set){let i=new Set(t.permits.filter(s=>Date.parse(s.expiresAt)<=n||r.has(s.permitId)).map(s=>s.permitId));if(i.size>0){t.permits=t.permits.filter(s=>!i.has(s.permitId));for(let s of t.attempts)s.permitId&&i.has(s.permitId)&&s.state==="active"&&(s.state="expired",s.endedAt=ho(n),s.outcome=r.has(s.permitId)?"WORKER_IDENTITY_MISMATCH":"WORKER_LEASE_EXPIRED")}t.queue=t.queue.filter(s=>Date.parse(s.queueDeadlineAt??s.updatedAt)>n);let o=Math.max(this.policy.providerDefault.windowMs,...Object.values(this.policy.providers).map(s=>s.windowMs??0));if(t.providerRates=t.providerRates.filter(s=>Date.parse(s.timestamp)>n-o),t.attempts.length>2e4){let s=t.attempts.filter(c=>c.state==="active"),a=t.attempts.filter(c=>c.state!=="active").slice(-Math.max(0,2e4-s.length));t.attempts=[...a,...s]}t.effects.length>2e4&&(t.effects=t.effects.slice(-2e4)),t.usage.length>1e4&&(t.usage=t.usage.slice(-1e4))}currentPermit(t,n,r,i){let o=t.permits.find(s=>s.permitId===n);if(!o||Date.parse(o.expiresAt)<=i||o.fencingToken!==r)throw new ns("WORKER_LEASE_EXPIRED","The worker lease is missing, expired, or fenced out.");return o}readLedger(t){if(!pK(this.ledgerPath))return Axt(t);try{let n=JSON.parse(FL(this.ledgerPath,"utf8"));if(!wxt(n))throw new Error("Unsupported resource ledger schema.");return n}catch(n){throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE",`Resource ledger is unreadable and was not overwritten: ${n instanceof Error?n.message:String(n)}`)}}withLedger(t){let n=Date.now()+5e3,r=new Int32Array(new SharedArrayBuffer(4)),i,o;for(;!i&&Date.now()<=n;)try{i=Vs(this.lockPath,"workflow-resource-governor",ke)}catch(s){if(o=s,!(s instanceof Error)||!s.message.includes("is already locked"))break;Atomics.wait(r,0,0,10)}if(!i)throw new ns("WORKFLOW_GOVERNOR_UNAVAILABLE",o instanceof Error?o.message:String(o??"Resource governor lock unavailable."));try{let s=this.now(),a=this.readLedger(s),c=t(a,s);return c.changed&&(a.revision+=1,a.updatedAt=ho(s),yxt(this.ledgerPath,a)),c.afterCommit?.(),c.value}finally{i.release()}}}});import{createHash as Ext,randomUUID as Sxt}from"node:crypto";import{setTimeout as Cxt}from"node:timers/promises";function xxt(){return`delegation-${Date.now().toString(36)}-${Sxt().slice(0,8)}`}function Rxt(e){return async t=>(await Nl({cwd:e.cwd,apiKey:e.apiKey,baseURL:e.baseURL,model:e.model,...e.fallbackModels?{fallbackModels:e.fallbackModels}:{},...e.effort?{effort:e.effort}:{},maxTokens:t.task.maxTokens,maxIterations:t.task.maxIterations,parentSystemPrompt:e.parentSystemPrompt,parentExecutionMode:e.parentExecutionMode,subagentRole:t.task.role,permissionEngine:e.permissionEngine,toolRegistry:e.createToolRegistry?.(),...e.auditLogger?{session:{auditLogger:e.auditLogger}}:{},onIteration:t.onIteration,onToolStart:t.onToolStart,onToolWillExecute:t.onToolWillExecute,onToolEnd:t.onToolEnd})).agent}async function Txt(e){for(;;){if(e.signal?.aborted){e.governor.cancelQueued(e.request.requestId);let n=new Error("Delegated branch admission was cancelled.");throw n.name="AgentInterruptedError",n}let t=e.governor.acquire(e.request);if(t.status==="acquired")return t.permit;if(t.status==="active")throw new ns("WORKFLOW_CONCURRENCY_LIMIT","Delegated branch attempt is already active.");if(t.status==="rejected")throw new ns(t.code,t.reason);if(Date.now()>=e.deadline)throw e.governor.cancelQueued(e.request.requestId),new ns("WORKFLOW_QUEUE_EXPIRED","Delegated branch exceeded its admission deadline.");await Cxt(50,void 0,{signal:e.signal})}}function Pxt(e,t,n){let r=e.run.bind(e),i=!1,o=a=>{i||(i=!0,t.settle({permitId:n.permitId,fencingToken:n.fencingToken,outcome:a,actualTokens:e.tokenUsage.total}))};e.run=async a=>{try{let c=await r(a);return o("completed"),c}catch(c){throw o(c instanceof Error&&c.name==="AgentInterruptedError"?"cancelled":"failed"),c}};let s=e;if(s.cancelCurrentTurn){let a=s.cancelCurrentTurn.bind(s);s.cancelCurrentTurn=()=>(o("cancelled"),a())}else if(s.cancel){let a=s.cancel.bind(s);s.cancel=()=>(o("cancelled"),a())}return e}async function Sx(e){let t=new Jr,n=e.rootTraceId??xxt(),r=Ef(e.model,e.baseURL),i=e.apiKey?fK({providerId:r,endpoint:e.baseURL,credential:e.apiKey,salt:hK()}):Ev(r,process.env,e.baseURL),o=e.createBranchAgent??Rxt(e),s=Date.now()+e.timeoutMs,a=async c=>{let l=c.task,u=`${n}:${l.id}`,d=`${u}:attempt-1`,p=Ext("sha256").update(`${n}\0${l.id}\0${l.prompt}`).digest("hex"),m=await Txt({governor:t,request:{requestId:`admit:${u}:attempt-1`,operationId:u,surface:"delegated-branch",priorityClass:"foreground",runId:n,parentId:n,providerId:r,...i?{credentialFingerprint:i}:{},logicalChildId:u,attemptId:d,idempotencyKey:p,reservedTokens:l.maxTokens,runConcurrencyLimit:e.branchPolicy?.maxConcurrentBranches,runAttemptLimit:e.branchPolicy?.roles?.length,runTokenLimit:e.maxTotalTokens,queueDeadlineAt:new Date(s).toISOString()},deadline:s,signal:l.signal??e.signal});if(!t.claimEffect({permitId:m.permitId,fencingToken:m.fencingToken,effectKey:`delegated:${m.operationId}`}))throw t.settle({permitId:m.permitId,fencingToken:m.fencingToken,outcome:"duplicate_branch_suppressed"}),new ns("WORKFLOW_CONCURRENCY_LIMIT","Duplicate delegated branch execution was suppressed.");try{let f=await o(c);return t.commitEffect({permitId:m.permitId,fencingToken:m.fencingToken,effectKey:`delegated:${m.operationId}`}),Pxt(f,t,m)}catch(f){throw t.settle({permitId:m.permitId,fencingToken:m.fencingToken,outcome:"branch_creation_failed"}),f}};if(e.hostDelegation){if(e.createBranchAgent)throw new Error("Host-routed delegation and a local createBranchAgent are mutually exclusive: the branch either executes on the Agent host or in this process. Pass one.");if(typeof e.onToolWillExecute=="function")throw new Error("Host-routed delegation cannot honour onToolWillExecute: it delays tool execution until it resolves, and a branch running on the Agent host does not wait for this process. A hook that cannot delay is not the hook you asked for, so it is refused rather than silently downgraded. Remove it to delegate on the host, or run without host delegation.");if(typeof e.onIteration=="function")throw new Error("Host-routed delegation cannot report onIteration: the host mints no iteration-bearing runtime event, so there is nothing to read \u2014 unlike onToolStart/onToolEnd, which now fire. Remove onIteration to delegate on the host, or run without host delegation.");return QD({...e,rootTraceId:n,createBranchAgent:NTe({...e.hostDelegation,rootTraceId:n,deadline:s,...e.signal===void 0?{}:{signal:e.signal}})})}return QD({...e,rootTraceId:n,createBranchAgent:a})}var rPe=Ne(()=>{"use strict";ut();OTe();kp();ut()});function ec(e=ke){return{createdByCliVersion:e,createdBySdkVersion:mp}}var bA=Ne(()=>{"use strict";tr();Gi()});var lPe={};Bc(lPe,{AgentRunStore:()=>je,createAgentRunId:()=>cPe,getAgentRunDir:()=>jxt,getAgentRunStoreDir:()=>IK,projectRecordStatus:()=>bK});import{randomUUID as _xt}from"node:crypto";import{appendFileSync as $xt,existsSync as jL,mkdirSync as Tx,readFileSync as sPe,readdirSync as Cx,renameSync as Bxt,rmSync as xx,writeFileSync as VL}from"node:fs";import{basename as AK,dirname as aPe,join as ws,resolve as Mxt}from"node:path";function _i(){return new Date().toISOString()}function Dxt(e=new Date){return e.toISOString().replace(/[^0-9]/g,"").slice(0,14)}function HL(e){return e.replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,80)}function vK(e){return Mxt(e)}function WL(e){return vK(e).toLowerCase()}function oPe(e,t){let n=WL(e),r=WL(t);return n===r||n.startsWith(`${r}\\`)||n.startsWith(`${r}/`)}function yK(e,t){return!!(WL(e.cwd)===WL(t)||e.git?.root&&oPe(t,e.git.root)||e.git?.worktree&&oPe(t,e.git.worktree))}function Lxt(e){return HL(Buffer.from(vK(e)).toString("base64url"))}function Qxt(){return{input:0,output:0,total:0}}function Ep(e){try{return JSON.parse(sPe(e,"utf8"))}catch{return null}}function Fxt(e){return e instanceof Error&&/\balready locked by PID\b/.test(e.message)}function Rx(e,t){Tx(aPe(e),{recursive:!0});let n=`${e}.${process.pid}.${Date.now()}.tmp`;VL(n,JSON.stringify(t,null,2)+`
|
|
@@ -4031,7 +4031,7 @@ ${r}`}}import{execFileSync as fNe}from"node:child_process";function tDt(){let e=
|
|
|
4031
4031
|
`),i.model||i.baseURL||i.apiKey||i.maxTokens||i.permissionMode||i.plugins&&i.plugins.length>0||i.mcpServers&&i.mcpServers.length>0||n.onOutput(` (no settings configured)
|
|
4032
4032
|
`),n.onOutput(`
|
|
4033
4033
|
`),{handled:!0}}function Jf(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/1e3),r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=n%60;return r>0?`${r}h ${i}m ${o}s`:i>0?`${i}m ${o}s`:`${o}s`}function SNe(e){let t=["Last Session Summary",`- model: ${e.model}`,`- mode: ${e.mode??"unknown"}`,`- status: ${e.status??"unknown"}`,`- started: ${e.startedAt}`,`- ended: ${e.endedAt}`,`- duration: ${Jf(e.durationMs)}`,`- tokens: ${e.tokenUsage.input.toLocaleString()} in / ${e.tokenUsage.output.toLocaleString()} out / ${e.tokenUsage.total.toLocaleString()} total`,`- estimated cost: ${Zu(e.estimatedCostUsd)}`];return e.sessionId&&t.splice(1,0,`- session: ${e.sessionId}`),e.role&&t.splice(e.sessionId?2:1,0,`- role: ${e.role}`),e.messageCount!==void 0&&t.push(`- messages: ${e.messageCount}`),t.join(`
|
|
4034
|
-
`)}function $Dt(e){let t=e.replace(/\s+/g," ").trim();return t.length>72?`${t.slice(0,69)}...`:t}async function UQ(e){if(!e.checkpointManager||e.messages.length===0)return null;let t=`Branch before rewind to "${$Dt(e.targetPrompt)}"`,n=await e.checkpointManager.create({trigger:"manual",messages:e.messages,description:t});if(e.sessionManager){let r=[n.id,...e.sessionManager.meta.checkpoints.filter(i=>i!==n.id)];await e.sessionManager.updateMeta({checkpoints:r}),await e.sessionManager.transcript.append({type:"checkpoint",data:{id:n.id,action:"create",name:t,trigger:"manual",messageCount:e.messages.length}})}return n.id}$r();Gi();var BDt={"0.5.42":["Durable Web Context operations now render the canonical typed evidence progress stream in human and NDJSON modes without inventing counters.","SIGINT and external abort request exactly one service-side cancellation and report whether the durable job reached a confirmed terminal state.","Synced Web Context 0.1.1, Agent SDK 0.9.25, and Agent Interface 0.1.22 for the negotiated ACP v2 evidence contract."],"0.5.41":["Durable compaction now flushes the recoverable session snapshot before mutating resident history, so repeated long-context cycles and crash recovery retain completed turns.","Chat and non-interactive run paths bind the real host parent-session identity before delegating, keeping nested work and results attached to the correct resumable conversation.","Execution handoff preserves writer fencing and live ownership across A-to-B-to-C resume while Loop continuation remains unbounded by default.","Synced the public Agent SDK 0.9.24 and Agent Interface 0.1.21 registry packages for the qualified Goal / Loop / Handoff contract."],"0.5.40":["Added durable Goal records with explicit criteria, milestones, delegated tasks, progress, steering, and evidence-gated completion.","Added distinct scheduled, development, and goal-continuation loops that are unbounded by default, persist every iteration, survive restart, and remain recoverable after an iteration failure.","Added live, heartbeat-backed execution handoff across resumed terminals with atomic A-to-B-to-C transfer and immediate source fencing; one-shot commands cannot impersonate a live owner.","Handoff now flushes and relinquishes the source session-writer lock before printing the resume command, so the target can resume the same transcript without either terminal deleting or rewriting the other's lock state.","Synced Agent SDK 0.9.23 and Agent Interface 0.1.20 for the shared Goal / Loop / Handoff runtime contract."],"0.5.39":["Added XENO Web Context search, fetch, render, map, crawl, extract, job wait/cancel/resume, and Browser handoff commands with canonical evidence metadata.","Preserved Chat and Agent session mode/workspace identity across CLI and Interface resume paths.","Synced Agent SDK 0.9.22 and Agent Interface 0.1.19 for the typed Web Context runtime event contract."],"0.5.38":["Corrective Agent Interface handoff: explicit Chat, Agent, and resume launch intent now wins over restored persisted desktop tabs after session hydration.","`xeno agent --interface` preserves the exact granted workspace even when the desktop has existing Chat history, while `xeno chat --interface` remains Chat-only with no project grant.","Synced the Agent Interface client and contract packages to the installable 0.1.18 release."],"0.5.37":["`xeno chat --interface` opens the canonical desktop surface as XENO Chat with Chat-only authority and no project grant.","`xeno agent --interface` opens the same surface as XENO Agent and grants the exact current local workspace.","Synced the Agent Interface client and contract packages to 0.1.16."],"0.5.36":["`xeno chat` and `xeno agent` now launch the same canonical XENO terminal interface while preserving their invoked identity: Chat is branded XENO CHAT and Agent is branded XENO AGENT.","Chat mode owns a private managed workspace and cannot be promoted to Agent authority by saved settings or `--mode`; Agent mode keeps the explicit local-workspace and full-capability contract.","Windows Terminal multiline paste remains one editable composer item and submits as one persisted user message, including fragmented bracketed-paste frames.","Synced the Agent Interface client and contract packages to 0.1.15 and the Agent SDK to 0.9.21."],"0.5.35":["The provider cockpit now exposes durable provider lanes, exact native attach and detach, explicit stop and reconcile controls, and persists whether each Agent session is Chat mode or Agent mode.","The status bar shows the active provider lane, and non-interactive provider, lane, attach, and reconcile commands expose the same control plane to scripts.","The local release gate now builds the native Windows XENO PTY before integration tests and typechecks the complete test surface from a clean checkout.","Synced the Agent Interface client and contract packages to 0.1.12 and the Agent SDK to 0.9.18."],"0.5.34":["Windows multiline-paste recovery now keys off the actual win32 runtime even when terminal TTY capability probing reports an inconclusive profile.","Input diagnostics now record the runtime platform, terminal profile, and stdin/stdout TTY state so real-terminal evidence explains which paste path ran."],"0.5.33":["Windows Terminal multiline paste now remains one editable composer message even when Windows omits bracketed-paste markers because virtual-terminal input is unavailable.","Real bracketed-paste frames still retain stateful fragmented-stream handling, and an ordinary Enter remains a submit after the short paste-boundary grace period.","Synced the Agent Interface client and contract packages to 0.1.11 and the Agent SDK to 0.9.17."],"0.5.32":["Recent-session state now stays inside XENO_AGENT_HOME and uses durable per-workspace updates, preventing Windows EPERM contention and lost concurrent session entries.","PowerShell command completion now drains the final stdout pipe data before settling, so successful commands cannot intermittently return empty output."],"0.5.31":["Windows Terminal bracketed-paste mode is now explicitly negotiated for the full composer lifetime, correcting 0.5.30's incomplete decoder-only repair.","Native TUI and external-editor handoffs release terminal paste mode before transfer and restore it only after XENO regains terminal ownership.","`--interface` now waits for an exact nonce-bound acknowledgement from the desktop renderer instead of reporting success when an older app merely spawned and ignored the resume request.","Managed finite operations can continue beyond the generic three-turn safety cap, recent-session writes are serialized across processes, and background commands receive privacy-safe semantic fallback labels."],"0.5.30":["Multiline terminal pastes now remain one editable composer message even when Windows Terminal fragments the bracketed-paste frame across multiple input chunks.","Complete bracketed-paste frames are handled before generic Escape sequences, and their terminal markers never leak into the submitted prompt."],"0.5.29":["ACP provider cockpit: resume durable Codex, Claude, and compatible provider lanes without replaying the XENO transcript into a new native session.","Attach, detach, reattach, stop, and reconcile native provider TUIs with one-writer ownership between the XENO TUI, Agent Interface, and provider terminal.","`--interface` handoff now preserves the selected conversation host binding and exact provider continuation identity.","Background work uses semantic task names, and continuation checkpoints retain the original objective instead of ending a live operation at an arbitrary automatic-turn boundary.","Synced Agent Interface client/contract to 0.1.8 and @xenosystem/agent-sdk to 0.9.14."],"0.5.28":["The root `xeno --help` output now exposes `--interface` and `--resume [id]`, so terminal-to-desktop session handoff is discoverable at the exact command surface where it is used."],"0.5.27":["Open the XENO Agent Interface from the terminal with `xeno --interface`, resuming an exact session ID or the latest session in the current workspace.","Long-running background commands now stay alive while active, preserve native PowerShell syntax, and display meaningful task names.","Short follow-through messages such as do it and proceed now retain implementation authority, while nested continuations preserve the original objective.","Synced @xenosystem/agent-sdk to 0.9.13."],"0.5.25":["Interactive `/status`, `/config`, `/usage`, `/stats`, `/settings` multi-tab modal with live search, keyboard cycling, and instant ~/.xeno/config.json persistence.","Live 52-week session activity heatmap, longest/current streak metrics, active days summary, lifetime token metrics, and favorite model analytics.","Real-time git workspace analytics including active branch, ahead/behind counts, working tree diff additions/deletions, and live turn API elapsed times.","Turn receipt visual polish with right-margin padding and formatted recap indentation.","Interactive `/handoff` command: switch seamlessly between specialist agents with prompt context and intent transfer.","Zero-config `.claude/agents/*.md` & `.xeno/agents/*.md` discovery with level-ordered priority shadowing.","Host mid-turn steering (`turn.steer`) and subagent wire payload artifacts integration.","Synced @xenosystem/agent-sdk to 0.9.12 with enhanced offline grace monetization validation.","xeno-rt: resolved Qwen 3.8 / 3.5 MTP NextN architecture prefixes and prevented layer 32 recurrent tensor probe failure."],"0.5.24":["Published with exact matching CLI_VERSION literal, guarded by verify:version in CI.","Synced @xenosystem/agent-sdk to 0.9.11, pulling model-aware context budgets from live gateway `/v1/models` catalog.","`/import` now immediately triggers context reconstruction turns rather than pausing at the input prompt."],"0.5.23":["Model-aware context budget: queries gateway `/v1/models` catalog for authoritative `context_window` limits.","Context compaction request byte budget scaled to prevent false refusals on large toolsets."],"0.5.22":["`/context` divided by a hardcoded 200,000 regardless of which model you are on. That figure is XENO's window and nobody else's: on a 128,000-token OpenAI model the gauge read about 12% where the truth was 19%, and near the limit it said \"Context is healthy\" with compaction imminent; on Google's 1,000,000-token window it pegged at 100% from a fifth of the way in and warned permanently. It now divides by the budget the SDK actually resolved for the run.","The gauge also says how well it knows that number. A configured budget is exact and prints a plain percentage; a provider profile is one window for every model that provider serves, so it prints `~62%` and labels itself approximate. Before any turn has reported, it says the 200,000 is an assumption rather than presenting it as fact.","The numerator was always right and is unchanged: it sums the messages currently in context, so it falls when a compaction drops them. Only the denominator was asserted rather than resolved."],"0.5.21":["Security: undici 6.27.0 -> 6.28.0, closing a cookie-injection advisory. This repo had 12 open alerts and this was the ONLY one that reaches shipped code \u2014 the five rated HIGH are all build and test tooling. Fixing by severity rank would have addressed the wrong thing first.","Worktree cleanup could delete THROUGH a junction. That is the failure that destroyed two repositories on 2026-08-03: on Windows a recursive delete follows a junction and removes the target, and npm creates one for every file: dependency. Cleanup now clears the reparse point itself and never the thing it points at.","Worktree cleanup had also decayed into a no-op \u2014 its filter excluded every orphan it existed to remove, so it ran, reported success, and cleaned nothing. And a reparse-point scan that hits its cap now REFUSES rather than returning a short list, because a truncated scan that looks complete is how the delete above becomes safe-looking.","The control-plane `list()` was not a read: it wrote once per stale record, every time anything listed runs. Listing is now free of side effects.","`/import` brings a session from another agent CLI into XENO and continues it \u2014 including agy stores, where the obvious store turned out not to be the best source. `--imported` shows what is on disk and says plainly that it persists. The source transcript is never touched, and that is enforced rather than intended.","Delegated branches now run on the Agent host under XENO_AGENT_ATTACH, report tool progress while they work, and the CLI reads the HOST's audit rather than only its own. Previously a host-routed branch was silent until it finished, and a refusal blamed a missing stream that in fact existed.","`xeno host status` now reports WHICH lanes the host offers and why a blocked one is blocked \u2014 including whose environment the blockage is about, which was the part that made the old message useless.","Pinned to @xenosystem/agent-sdk 0.9.10. The pin had been two releases stale, so work that shipped in 0.9.9 reached nobody. 0.9.10 also reports how full an agent's context is: turn.completed carries the RESIDENT token count, not the cumulative billing counter, and context.pressure arrives after every model response. The obvious field re-adds the whole prompt each turn \u2014 measured live, three one-word turns reported 3049, 6106 then 9171 tokens while the context grew by about eight.","Budget accounting no longer reads the entire run store when no budget cap is configured."],"0.5.20":["Pinned to @xenosystem/agent-sdk 0.9.8. The SDK's ownership policy still labelled this CLI by a scope retired in 8363d30c, which had failed the release smoke on every run since 2026-08-13 \u2014 the mismatch was never in this repo, so the fix was a repin rather than a workaround.","The release smoke now derives how strict it should be from the release trust policy: while no signing identity is approved it holds the engineering bar, and it tightens by itself the moment one lands. It previously demanded a signature no ordinary CI run could produce, and had failed for long enough to read as background noise.","First test coverage of the native manifest signing path, which had never executed once. Signer and verifier each carry their own copy of the canonical-JSON serializer and cannot import each other, so a drift as small as key ordering would have invalidated every release signature \u2014 and would have surfaced on release day, looking like a key problem.","Windows: temporary-directory cleanup no longer loses a race with exiting child processes, and the certification matrix checks out correctly on Windows ARM. `force: true` suppresses ENOENT, not EPERM, so the previous cleanup looked defensive and was not.","Groundwork for interactive Ctrl+C on Windows: the native addon can now raise a real console interrupt. Writing 0x03 into a ConPTY does not raise a signal, which is why Ctrl+C has never worked there. NOT yet wired \u2014 the console attach succeeds and the event is raised, and a ConPTY client still does not observe it."],"0.5.19":["The CLI did nothing at all on Linux and macOS. Its entry point did not resolve symlinks, so every npx and global install ran the wrong path and exited silently \u2014 the install looked successful and the binary did nothing. Fixed.","Agent permission decisions now reach an actual human on both rails, rather than being resolved without one.","A remote run that is read-only now says so, instead of failing silently and leaving you to work out why nothing changed.","The version the binary REPORTS is now bound to the version npm publishes, and a test enforces it. They had drifted: 0.5.18 was published as a package whose `--version` said 0.5.17.","\u26A0\uFE0F 0.5.18 exists on npm and was published from a branch that was never merged. It is superseded by this release, which is cut from `main`. If you installed 0.5.18, upgrade."],"0.5.17":["The CLI now ships as @xenosystem/agent-cli. The former name @xeno-corporation/xeno-agent-cli is deprecated on npm and receives no further releases; the `xeno`, `xeno-agent` and `xeno-code` binaries are unchanged, so nothing in your shell or scripts has to change.","The exact SDK pin moves with it: the CLI is bound to @xenosystem/agent-sdk 0.8.12. 0.8.11 was never published under either name and cannot be \u2014 GitLab evaluates .gitlab-ci.yml as it exists at the tag, and tag sdk-v0.8.11 predates that pipeline.","This release cannot be installed until @xenosystem/agent-sdk 0.8.12 is live on the registry; the release pipeline fails closed on --require-dependencies-published until it is."],"0.5.16":["Windows 11 ARM64 containment certification now performs architecture-neutral MXC host preparation with the reviewed x64 helper through operating-system emulation while keeping the contained runtime native ARM64.","The CLI is bound exactly to SDK 0.8.11, whose host-preparation reports distinguish the host architecture from the reviewed setup-helper architecture and retain timeout diagnostics."],"0.5.15":["macOS and Linux standalone diagnostics now report their verified POSIX process-group lifecycle independently from the stronger process-hardened sandbox level, preserving truthful security status while certifying full-tree cancellation, timeout, and shutdown behavior.","Generated Harbor benchmark and audit workspaces are excluded from source control, keeping Windows ARM64 checkouts below platform path limits and removing 9,938 generated artifacts from release candidates."],"0.5.14":["Windows 11 24H2 containment admission now uses the authoritative non-server NT client build floor instead of rejecting current Azure and GitHub Windows 11 images whose legacy registry ProductName still says Windows 10.","Windows Server remains fail-closed, pre-26100 clients remain ineligible, and both x64 and ARM64 host identities have regression coverage."],"0.5.13":["Hosted Windows x64 containment certification now fails closed unless the runner is Windows 11 24H2 or newer, the platform supported by Microsoft MXC, instead of treating Windows Server runner failures as product failures.","The certification matrix accepts a protected XENO_WINDOWS_X64_RUNNER label for an ephemeral Windows 11 x64 runner while keeping all other hosted platform rows unchanged.","Containment failure reports preserve bounded head-and-tail diagnostics through SDK 0.8.10 so the actionable trailing Win32 or MXC error is retained."],"0.5.12":["Windows MXC containment now launches its unrestricted host from the prepared system-drive temporary directory, outside directories whose DACLs are mutated by the contained policy, and certification captures official redacted MXC diagnostics.","Internal background session workers no longer start a competing global reconciler, preventing slower macOS hosts from quarantining a healthy turn between transcript append and checkpoint commit.","The interactive attach/input/stop smoke now follows the actual persisted inbox sequence and records worker logs on failure; the CLI is bound exactly to SDK 0.8.9."],"0.5.11":["Windows x64 containment certification now launches the MXC host and contained runtime with working-directory and temporary paths on the prepared system drive, matching split-drive GitHub runners.","The CLI is bound exactly to SDK 0.8.8, preserving the passing Linux, macOS, and Windows ARM64 conformance behavior while repairing Windows x64 ProcessContainer startup."],"0.5.10":["Linux containment certification now keeps disposable fixtures under the OS-private temporary mount instead of GitHub's workspace-projected runner directory, preserving the unlisted-filesystem boundary probe.","Windows certification retains the MXC-prepared system-drive fixture root required by hosted runners whose workspace and default temp directory use another volume."],"0.5.9":["Windows containment certification now creates its disposable fixtures on the MXC-prepared system drive, including hosted runners whose workspace and default temp directory live on another volume.","Standalone Windows certification now performs the same explicit host preparation and temporary-root binding as the native package matrix."],"0.5.8":["Native containment certification now compiles its macOS UI-policy probe against the stable libsystem_sandbox ABI without depending on private SDK headers.","Windows certification now distinguishes MXC's persistent per-policy DACL requirement from its explicit one-time host-preparation warnings."],"0.5.7":["The immutable CLI candidate now binds SDK 0.8.5 to the exact canonical Linux npm tarball bytes used by certification."],"0.5.6":["Windows containment certification now performs Microsoft MXC's explicit idempotent host preparation before AppContainer+DACL conformance.","macOS ARM64 certification now records behavioral Seatbelt evidence for pasteboard, WindowServer, LaunchServices, and HID isolation."],"0.5.5":["Native certification now resolves the SDK candidate artifact from the same workspace path on Bash and PowerShell runners.","SDK containment assets retain executable package modes on Linux and macOS, with a source regression check for every reviewed Unix binary."],"0.5.4":["Native engineering certification jobs now download the exact SDK tarball produced by the successful parent gate before installing dependencies.","The six-platform matrix remains source-bound to one immutable CLI tag and one immutable SDK candidate artifact."],"0.5.3":["Candidate packaging accepts both npm 11 array-form and npm 12 package-keyed JSON, with explicit diagnostics for malformed output.","Hosted SDK packaging now parses a bounded JSON file instead of relying on a large shell variable or an obsolete npm output shape."],"0.5.2":["Hosted certification now caps SDK declaration generation at two concurrent entry points and cleans declaration output in isolated bounded-memory workers.","SDK build subprocess failures now report their terminating signal or exit status instead of producing a silent hosted-run failure."],"0.5.1":["Hosted certification now builds the exact SDK candidate in bounded declaration groups, preventing parallel TypeScript declaration generation from exhausting GitHub-hosted runner resources.","Post-freeze readiness now distinguishes exact candidate tags verified at the candidate commit from collisions in release, registry, feed, and service namespaces."],"0.5.0":["Agent Profiles now provide enforceable Assistant, SWE, Reviewer, Writer, Research, Product, CI, DevOps, and Legal Research identities with bounded tools, permissions, skills, hooks, memory, isolation, and external-action authority.","The XENO Artifact Protocol adds durable plans, patches, diffs, reviews, screenshots, recordings, reports, provenance, approvals, and evidence relationships shared across local, hosted, and Hub workflows.","Secure Execution Contracts and capability leases now make filesystem, network, secret, process, device, browser, and external-action authority explicit and auditable.","Skills v2 adds standards-compatible SKILL.md discovery, progressive loading, bundled resources, invocation policy, version identity, and compatibility with XENO, .agents, and Claude skill locations.","MCP now supports current Streamable HTTP sessions and OAuth discovery while retaining compatible stdio and legacy SSE connections.","Browser, computer-use, hosted-agent, semantic-index, production-review, spec-planning, secure-sharing, and provider-onboarding surfaces are integrated through the shared platform contracts.","The retained TUI now presents stable grouped tool activity, live task and subagent status, candidate-bound edit previews, context-pressure and compaction state, and clearer turn completion receipts.","Six-product candidate certification now binds the SDK, XENO Use, XENO Browser, Agents API, CLI, and Hub to exact source identities, versions, tags, evidence, and protected release gates."],"0.4.45":["This transitional release is engineering-tested but not GA-certified: native PTY artifacts are unsigned and remain disabled by default until the Azure signing identity is approved; ordinary CLI and pipe-mode commands remain available.","App Server v2 now provides durable threads and turns, typed clients, permission ownership and expiry, bounded replay and backpressure, authenticated HTTP access, and additive v1 compatibility.","The terminal renderer now uses committed retained frames, bounded coalescing, one normal write per frame, a responsive 50-agent footer, accessibility modes, and a native terminal compatibility matrix.","Release certification now fails closed on six native architectures, platform and manifest signatures, reproducible package payloads, SBOMs, provenance attestations, independent approvals, npm OIDC publication, and public clean-install verification.","Long chat prompts now soft-wrap into a growing six-row composer with Unicode-safe editing, visual Up/Down navigation, file-panel parity, and a temporary XENO_INPUT_SOFT_WRAP=0 rollback switch.","Long-running model-authored shell commands now use managed operations: Ctrl+B promotes the same process, finite background work waits without model polling, and durable continuations resume exactly once after terminal output arrives.","ReadImage now uses Xeno's dependency-free owned raster codec for bounded PNG, BMP, Netpbm, and core-SVG previews; /processes and doctor expose task control, process-tree containment, operation-schema, and codec status.","Dynamic workflows now expose first-class run limits and terminal reducer summaries in run records and inspect JSON.","Background agent sessions now deliver durable completion, failure, stop, and request-keyed needs-input notifications to interactive parent chats and bounded headless runs without clobbering prompt drafts.","Workflow orchestration includes grouped phase/child progress, parent-chat completion notifications, WorkflowWait, /workflows drill-down, watch JSONL snapshots, and ultracode workflow prompts.","Workflow starts now support plan preview and exact-definition approval memory, scheduler ticks are serialized, and workflow lifecycle metrics are available through the OTel usage export.","Tool activity now uses semantic Update and Search labels, contextual line-numbered edit previews, expandable read/search/shell output, and accurate failure rendering.","Interactive chat now blocks repeated inspections and unrequested mutations on short questions, gives explicit research a larger typo-tolerant evidence budget, and reserves a tool-free final-answer turn when work limits are reached."],"0.4.44":["Markdown source links now render as clickable terminal links in supported terminals, with visible URLs preserved when links are disabled."],"0.4.43":["New background agents now appear in the footer immediately after launch, and the footer can show up to eight agent sessions."],"0.4.42":["Background agent footer rows now fit the common three-agent fanout without hiding the first agent on compact terminals.","Completed background agent sessions now close after BackgroundAgentJoin returns their result to the main agent."],"0.4.41":["Completed background agent footer rows now keep a fixed runtime instead of continuing to count upward."],"0.4.40":["One-shot background agent sessions now mark done after returning their result, while user-follow-up sessions stay idle for continued chat."],"0.4.39":["Background agent session activity now uses concise status labels like Thinking instead of showing the full task prompt."],"0.4.38":["Opened background agent sessions now show their own session activity line while keeping main-agent tool progress isolated."],"0.4.37":["Opened background agent sessions no longer show the main agent's active tool progress line."],"0.4.36":["Opened background agent sessions now render the same main-chat transcript surface for user messages, assistant messages, tool calls, and tool results."],"0.4.35":["Background agent session chat now includes tool calls and tool results in its visible history."],"0.4.34":["Opening a footer background agent now switches the main chat surface into that agent session instead of showing a separate info panel.","Child-session input now queues messages to that agent while Esc returns to the main chat."],"0.4.33":["Background agent footer rows now repaint immediately during active turns.","Remembered background-agent approvals now apply to later background-agent launches."],"0.4.32":["Startup release-note hints now sit directly under the note text and render dimmed in the side panel."],"0.4.31":["Unread release notes now render beside the startup XENO AGENT header on wide terminals."],"0.4.30":["BackgroundAgentList now only reports current-chat footer sessions so old workspace agents do not hide missing new deployments."],"0.4.29":["Background agent footer markers now use filled and empty squares.","Opening a background agent from the footer now shows its session chat with transcript and message input."],"0.4.28":["First-run default model is now gpt-5.5 while saved user model choices are preserved.","Number keys in the model picker now type into search instead of selecting by index.","Model selections made with /model now persist as the user's saved default."],"0.4.27":["Background agent footer rows are now scoped to the current chat session."],"0.4.26":["Background agent rows now sit below the status line and inherit the live chat model."],"0.4.25":["Legacy BackgroundAgent calls now create footer-visible interactive background sessions."],"0.4.24":["Model picker support now has a `xeno models --json` command, share export proof, and GitHub review artifact contracts."],"0.4.23":["Model picker and /model listings now refresh Xeno API model availability before switching."],"0.4.22":["Hook review now shows command-hook hashes and supports trust, disable, and explain commands.","Expanded lifecycle hooks now cover permission decisions, stop failures, and delegated subagent start/stop events.","Set XENO_STATUS_LINE_COMMAND to replace the TUI status line with a cached command output.","Rewind now saves the abandoned conversation branch as a manual checkpoint before restoring.","Interactive chat now supports Ctrl+R history search, Ctrl+G prompt editing, /vim input mode, and /copy answer/block/diff clipboard copy.","/theme is now a discoverable alias for /color with user/project custom theme files, and /processes stop-all stops running background tasks."],"0.4.20":["Shell completions now include the current control-plane commands, flags, statuses, scopes, and usage groups.","The local app-server browser page now includes prompt and process controls on top of advanced JSON-RPC.","Published CLI and SDK packages now include GitHub repository metadata.","Docs now call out the temporary GitHub Actions startup_failure blocker while local gates remain authoritative."],"0.1.0":["Persistent shell sessions now preserve cwd and shell state across Bash calls.","Delegated planner, explorer, executor, and reviewer branches now support staged and parallel policies.","MCP now supports stdio and SSE transports, prompt discovery, resource reads, and live tool sync.","Notebook, ask-user, and memory tools are available in the shared agent runtime.","CLI operator workflows now include doctor, bug-report, config editing, cost summaries, and runtime inspection."]};function VZ(e=ke){return BDt[e]??[]}function MDt(e=ke){let t=mt().lastReleaseNotesSeen;return VZ(e).length>0&&t!==e}function mI(e=ke){ui({lastReleaseNotesSeen:e})}function jQ(e){let t=e??ke,n=VZ(t);return n.length===0?`No release notes available for version ${t}.`:[`Release notes for version ${t}`,"",...n.map(r=>`- ${r}`)].join(`
|
|
4034
|
+
`)}function $Dt(e){let t=e.replace(/\s+/g," ").trim();return t.length>72?`${t.slice(0,69)}...`:t}async function UQ(e){if(!e.checkpointManager||e.messages.length===0)return null;let t=`Branch before rewind to "${$Dt(e.targetPrompt)}"`,n=await e.checkpointManager.create({trigger:"manual",messages:e.messages,description:t});if(e.sessionManager){let r=[n.id,...e.sessionManager.meta.checkpoints.filter(i=>i!==n.id)];await e.sessionManager.updateMeta({checkpoints:r}),await e.sessionManager.transcript.append({type:"checkpoint",data:{id:n.id,action:"create",name:t,trigger:"manual",messageCount:e.messages.length}})}return n.id}$r();Gi();var BDt={"0.5.43":["Provider-native Codex and Claude continuations can be attached from the XENO provider cockpit without replacing the XENO TUI; exact provider session identity, workspace, and ownership survive detach, reattach, and Interface handoff.","The native terminal path mirrors user messages into the owning graphical conversation and keeps XENO application system instructions out of provider-visible chat text.","Synced XENO ACP 0.2.13 and Agent Interface 0.1.23 after the earlier immutable candidates were published without moving their npm latest tags."],"0.5.42":["Durable Web Context operations now render the canonical typed evidence progress stream in human and NDJSON modes without inventing counters.","SIGINT and external abort request exactly one service-side cancellation and report whether the durable job reached a confirmed terminal state.","Synced Web Context 0.1.1, Agent SDK 0.9.25, and Agent Interface 0.1.22 for the negotiated ACP v2 evidence contract."],"0.5.41":["Durable compaction now flushes the recoverable session snapshot before mutating resident history, so repeated long-context cycles and crash recovery retain completed turns.","Chat and non-interactive run paths bind the real host parent-session identity before delegating, keeping nested work and results attached to the correct resumable conversation.","Execution handoff preserves writer fencing and live ownership across A-to-B-to-C resume while Loop continuation remains unbounded by default.","Synced the public Agent SDK 0.9.24 and Agent Interface 0.1.21 registry packages for the qualified Goal / Loop / Handoff contract."],"0.5.40":["Added durable Goal records with explicit criteria, milestones, delegated tasks, progress, steering, and evidence-gated completion.","Added distinct scheduled, development, and goal-continuation loops that are unbounded by default, persist every iteration, survive restart, and remain recoverable after an iteration failure.","Added live, heartbeat-backed execution handoff across resumed terminals with atomic A-to-B-to-C transfer and immediate source fencing; one-shot commands cannot impersonate a live owner.","Handoff now flushes and relinquishes the source session-writer lock before printing the resume command, so the target can resume the same transcript without either terminal deleting or rewriting the other's lock state.","Synced Agent SDK 0.9.23 and Agent Interface 0.1.20 for the shared Goal / Loop / Handoff runtime contract."],"0.5.39":["Added XENO Web Context search, fetch, render, map, crawl, extract, job wait/cancel/resume, and Browser handoff commands with canonical evidence metadata.","Preserved Chat and Agent session mode/workspace identity across CLI and Interface resume paths.","Synced Agent SDK 0.9.22 and Agent Interface 0.1.19 for the typed Web Context runtime event contract."],"0.5.38":["Corrective Agent Interface handoff: explicit Chat, Agent, and resume launch intent now wins over restored persisted desktop tabs after session hydration.","`xeno agent --interface` preserves the exact granted workspace even when the desktop has existing Chat history, while `xeno chat --interface` remains Chat-only with no project grant.","Synced the Agent Interface client and contract packages to the installable 0.1.18 release."],"0.5.37":["`xeno chat --interface` opens the canonical desktop surface as XENO Chat with Chat-only authority and no project grant.","`xeno agent --interface` opens the same surface as XENO Agent and grants the exact current local workspace.","Synced the Agent Interface client and contract packages to 0.1.16."],"0.5.36":["`xeno chat` and `xeno agent` now launch the same canonical XENO terminal interface while preserving their invoked identity: Chat is branded XENO CHAT and Agent is branded XENO AGENT.","Chat mode owns a private managed workspace and cannot be promoted to Agent authority by saved settings or `--mode`; Agent mode keeps the explicit local-workspace and full-capability contract.","Windows Terminal multiline paste remains one editable composer item and submits as one persisted user message, including fragmented bracketed-paste frames.","Synced the Agent Interface client and contract packages to 0.1.15 and the Agent SDK to 0.9.21."],"0.5.35":["The provider cockpit now exposes durable provider lanes, exact native attach and detach, explicit stop and reconcile controls, and persists whether each Agent session is Chat mode or Agent mode.","The status bar shows the active provider lane, and non-interactive provider, lane, attach, and reconcile commands expose the same control plane to scripts.","The local release gate now builds the native Windows XENO PTY before integration tests and typechecks the complete test surface from a clean checkout.","Synced the Agent Interface client and contract packages to 0.1.12 and the Agent SDK to 0.9.18."],"0.5.34":["Windows multiline-paste recovery now keys off the actual win32 runtime even when terminal TTY capability probing reports an inconclusive profile.","Input diagnostics now record the runtime platform, terminal profile, and stdin/stdout TTY state so real-terminal evidence explains which paste path ran."],"0.5.33":["Windows Terminal multiline paste now remains one editable composer message even when Windows omits bracketed-paste markers because virtual-terminal input is unavailable.","Real bracketed-paste frames still retain stateful fragmented-stream handling, and an ordinary Enter remains a submit after the short paste-boundary grace period.","Synced the Agent Interface client and contract packages to 0.1.11 and the Agent SDK to 0.9.17."],"0.5.32":["Recent-session state now stays inside XENO_AGENT_HOME and uses durable per-workspace updates, preventing Windows EPERM contention and lost concurrent session entries.","PowerShell command completion now drains the final stdout pipe data before settling, so successful commands cannot intermittently return empty output."],"0.5.31":["Windows Terminal bracketed-paste mode is now explicitly negotiated for the full composer lifetime, correcting 0.5.30's incomplete decoder-only repair.","Native TUI and external-editor handoffs release terminal paste mode before transfer and restore it only after XENO regains terminal ownership.","`--interface` now waits for an exact nonce-bound acknowledgement from the desktop renderer instead of reporting success when an older app merely spawned and ignored the resume request.","Managed finite operations can continue beyond the generic three-turn safety cap, recent-session writes are serialized across processes, and background commands receive privacy-safe semantic fallback labels."],"0.5.30":["Multiline terminal pastes now remain one editable composer message even when Windows Terminal fragments the bracketed-paste frame across multiple input chunks.","Complete bracketed-paste frames are handled before generic Escape sequences, and their terminal markers never leak into the submitted prompt."],"0.5.29":["ACP provider cockpit: resume durable Codex, Claude, and compatible provider lanes without replaying the XENO transcript into a new native session.","Attach, detach, reattach, stop, and reconcile native provider TUIs with one-writer ownership between the XENO TUI, Agent Interface, and provider terminal.","`--interface` handoff now preserves the selected conversation host binding and exact provider continuation identity.","Background work uses semantic task names, and continuation checkpoints retain the original objective instead of ending a live operation at an arbitrary automatic-turn boundary.","Synced Agent Interface client/contract to 0.1.8 and @xenosystem/agent-sdk to 0.9.14."],"0.5.28":["The root `xeno --help` output now exposes `--interface` and `--resume [id]`, so terminal-to-desktop session handoff is discoverable at the exact command surface where it is used."],"0.5.27":["Open the XENO Agent Interface from the terminal with `xeno --interface`, resuming an exact session ID or the latest session in the current workspace.","Long-running background commands now stay alive while active, preserve native PowerShell syntax, and display meaningful task names.","Short follow-through messages such as do it and proceed now retain implementation authority, while nested continuations preserve the original objective.","Synced @xenosystem/agent-sdk to 0.9.13."],"0.5.25":["Interactive `/status`, `/config`, `/usage`, `/stats`, `/settings` multi-tab modal with live search, keyboard cycling, and instant ~/.xeno/config.json persistence.","Live 52-week session activity heatmap, longest/current streak metrics, active days summary, lifetime token metrics, and favorite model analytics.","Real-time git workspace analytics including active branch, ahead/behind counts, working tree diff additions/deletions, and live turn API elapsed times.","Turn receipt visual polish with right-margin padding and formatted recap indentation.","Interactive `/handoff` command: switch seamlessly between specialist agents with prompt context and intent transfer.","Zero-config `.claude/agents/*.md` & `.xeno/agents/*.md` discovery with level-ordered priority shadowing.","Host mid-turn steering (`turn.steer`) and subagent wire payload artifacts integration.","Synced @xenosystem/agent-sdk to 0.9.12 with enhanced offline grace monetization validation.","xeno-rt: resolved Qwen 3.8 / 3.5 MTP NextN architecture prefixes and prevented layer 32 recurrent tensor probe failure."],"0.5.24":["Published with exact matching CLI_VERSION literal, guarded by verify:version in CI.","Synced @xenosystem/agent-sdk to 0.9.11, pulling model-aware context budgets from live gateway `/v1/models` catalog.","`/import` now immediately triggers context reconstruction turns rather than pausing at the input prompt."],"0.5.23":["Model-aware context budget: queries gateway `/v1/models` catalog for authoritative `context_window` limits.","Context compaction request byte budget scaled to prevent false refusals on large toolsets."],"0.5.22":["`/context` divided by a hardcoded 200,000 regardless of which model you are on. That figure is XENO's window and nobody else's: on a 128,000-token OpenAI model the gauge read about 12% where the truth was 19%, and near the limit it said \"Context is healthy\" with compaction imminent; on Google's 1,000,000-token window it pegged at 100% from a fifth of the way in and warned permanently. It now divides by the budget the SDK actually resolved for the run.","The gauge also says how well it knows that number. A configured budget is exact and prints a plain percentage; a provider profile is one window for every model that provider serves, so it prints `~62%` and labels itself approximate. Before any turn has reported, it says the 200,000 is an assumption rather than presenting it as fact.","The numerator was always right and is unchanged: it sums the messages currently in context, so it falls when a compaction drops them. Only the denominator was asserted rather than resolved."],"0.5.21":["Security: undici 6.27.0 -> 6.28.0, closing a cookie-injection advisory. This repo had 12 open alerts and this was the ONLY one that reaches shipped code \u2014 the five rated HIGH are all build and test tooling. Fixing by severity rank would have addressed the wrong thing first.","Worktree cleanup could delete THROUGH a junction. That is the failure that destroyed two repositories on 2026-08-03: on Windows a recursive delete follows a junction and removes the target, and npm creates one for every file: dependency. Cleanup now clears the reparse point itself and never the thing it points at.","Worktree cleanup had also decayed into a no-op \u2014 its filter excluded every orphan it existed to remove, so it ran, reported success, and cleaned nothing. And a reparse-point scan that hits its cap now REFUSES rather than returning a short list, because a truncated scan that looks complete is how the delete above becomes safe-looking.","The control-plane `list()` was not a read: it wrote once per stale record, every time anything listed runs. Listing is now free of side effects.","`/import` brings a session from another agent CLI into XENO and continues it \u2014 including agy stores, where the obvious store turned out not to be the best source. `--imported` shows what is on disk and says plainly that it persists. The source transcript is never touched, and that is enforced rather than intended.","Delegated branches now run on the Agent host under XENO_AGENT_ATTACH, report tool progress while they work, and the CLI reads the HOST's audit rather than only its own. Previously a host-routed branch was silent until it finished, and a refusal blamed a missing stream that in fact existed.","`xeno host status` now reports WHICH lanes the host offers and why a blocked one is blocked \u2014 including whose environment the blockage is about, which was the part that made the old message useless.","Pinned to @xenosystem/agent-sdk 0.9.10. The pin had been two releases stale, so work that shipped in 0.9.9 reached nobody. 0.9.10 also reports how full an agent's context is: turn.completed carries the RESIDENT token count, not the cumulative billing counter, and context.pressure arrives after every model response. The obvious field re-adds the whole prompt each turn \u2014 measured live, three one-word turns reported 3049, 6106 then 9171 tokens while the context grew by about eight.","Budget accounting no longer reads the entire run store when no budget cap is configured."],"0.5.20":["Pinned to @xenosystem/agent-sdk 0.9.8. The SDK's ownership policy still labelled this CLI by a scope retired in 8363d30c, which had failed the release smoke on every run since 2026-08-13 \u2014 the mismatch was never in this repo, so the fix was a repin rather than a workaround.","The release smoke now derives how strict it should be from the release trust policy: while no signing identity is approved it holds the engineering bar, and it tightens by itself the moment one lands. It previously demanded a signature no ordinary CI run could produce, and had failed for long enough to read as background noise.","First test coverage of the native manifest signing path, which had never executed once. Signer and verifier each carry their own copy of the canonical-JSON serializer and cannot import each other, so a drift as small as key ordering would have invalidated every release signature \u2014 and would have surfaced on release day, looking like a key problem.","Windows: temporary-directory cleanup no longer loses a race with exiting child processes, and the certification matrix checks out correctly on Windows ARM. `force: true` suppresses ENOENT, not EPERM, so the previous cleanup looked defensive and was not.","Groundwork for interactive Ctrl+C on Windows: the native addon can now raise a real console interrupt. Writing 0x03 into a ConPTY does not raise a signal, which is why Ctrl+C has never worked there. NOT yet wired \u2014 the console attach succeeds and the event is raised, and a ConPTY client still does not observe it."],"0.5.19":["The CLI did nothing at all on Linux and macOS. Its entry point did not resolve symlinks, so every npx and global install ran the wrong path and exited silently \u2014 the install looked successful and the binary did nothing. Fixed.","Agent permission decisions now reach an actual human on both rails, rather than being resolved without one.","A remote run that is read-only now says so, instead of failing silently and leaving you to work out why nothing changed.","The version the binary REPORTS is now bound to the version npm publishes, and a test enforces it. They had drifted: 0.5.18 was published as a package whose `--version` said 0.5.17.","\u26A0\uFE0F 0.5.18 exists on npm and was published from a branch that was never merged. It is superseded by this release, which is cut from `main`. If you installed 0.5.18, upgrade."],"0.5.17":["The CLI now ships as @xenosystem/agent-cli. The former name @xeno-corporation/xeno-agent-cli is deprecated on npm and receives no further releases; the `xeno`, `xeno-agent` and `xeno-code` binaries are unchanged, so nothing in your shell or scripts has to change.","The exact SDK pin moves with it: the CLI is bound to @xenosystem/agent-sdk 0.8.12. 0.8.11 was never published under either name and cannot be \u2014 GitLab evaluates .gitlab-ci.yml as it exists at the tag, and tag sdk-v0.8.11 predates that pipeline.","This release cannot be installed until @xenosystem/agent-sdk 0.8.12 is live on the registry; the release pipeline fails closed on --require-dependencies-published until it is."],"0.5.16":["Windows 11 ARM64 containment certification now performs architecture-neutral MXC host preparation with the reviewed x64 helper through operating-system emulation while keeping the contained runtime native ARM64.","The CLI is bound exactly to SDK 0.8.11, whose host-preparation reports distinguish the host architecture from the reviewed setup-helper architecture and retain timeout diagnostics."],"0.5.15":["macOS and Linux standalone diagnostics now report their verified POSIX process-group lifecycle independently from the stronger process-hardened sandbox level, preserving truthful security status while certifying full-tree cancellation, timeout, and shutdown behavior.","Generated Harbor benchmark and audit workspaces are excluded from source control, keeping Windows ARM64 checkouts below platform path limits and removing 9,938 generated artifacts from release candidates."],"0.5.14":["Windows 11 24H2 containment admission now uses the authoritative non-server NT client build floor instead of rejecting current Azure and GitHub Windows 11 images whose legacy registry ProductName still says Windows 10.","Windows Server remains fail-closed, pre-26100 clients remain ineligible, and both x64 and ARM64 host identities have regression coverage."],"0.5.13":["Hosted Windows x64 containment certification now fails closed unless the runner is Windows 11 24H2 or newer, the platform supported by Microsoft MXC, instead of treating Windows Server runner failures as product failures.","The certification matrix accepts a protected XENO_WINDOWS_X64_RUNNER label for an ephemeral Windows 11 x64 runner while keeping all other hosted platform rows unchanged.","Containment failure reports preserve bounded head-and-tail diagnostics through SDK 0.8.10 so the actionable trailing Win32 or MXC error is retained."],"0.5.12":["Windows MXC containment now launches its unrestricted host from the prepared system-drive temporary directory, outside directories whose DACLs are mutated by the contained policy, and certification captures official redacted MXC diagnostics.","Internal background session workers no longer start a competing global reconciler, preventing slower macOS hosts from quarantining a healthy turn between transcript append and checkpoint commit.","The interactive attach/input/stop smoke now follows the actual persisted inbox sequence and records worker logs on failure; the CLI is bound exactly to SDK 0.8.9."],"0.5.11":["Windows x64 containment certification now launches the MXC host and contained runtime with working-directory and temporary paths on the prepared system drive, matching split-drive GitHub runners.","The CLI is bound exactly to SDK 0.8.8, preserving the passing Linux, macOS, and Windows ARM64 conformance behavior while repairing Windows x64 ProcessContainer startup."],"0.5.10":["Linux containment certification now keeps disposable fixtures under the OS-private temporary mount instead of GitHub's workspace-projected runner directory, preserving the unlisted-filesystem boundary probe.","Windows certification retains the MXC-prepared system-drive fixture root required by hosted runners whose workspace and default temp directory use another volume."],"0.5.9":["Windows containment certification now creates its disposable fixtures on the MXC-prepared system drive, including hosted runners whose workspace and default temp directory live on another volume.","Standalone Windows certification now performs the same explicit host preparation and temporary-root binding as the native package matrix."],"0.5.8":["Native containment certification now compiles its macOS UI-policy probe against the stable libsystem_sandbox ABI without depending on private SDK headers.","Windows certification now distinguishes MXC's persistent per-policy DACL requirement from its explicit one-time host-preparation warnings."],"0.5.7":["The immutable CLI candidate now binds SDK 0.8.5 to the exact canonical Linux npm tarball bytes used by certification."],"0.5.6":["Windows containment certification now performs Microsoft MXC's explicit idempotent host preparation before AppContainer+DACL conformance.","macOS ARM64 certification now records behavioral Seatbelt evidence for pasteboard, WindowServer, LaunchServices, and HID isolation."],"0.5.5":["Native certification now resolves the SDK candidate artifact from the same workspace path on Bash and PowerShell runners.","SDK containment assets retain executable package modes on Linux and macOS, with a source regression check for every reviewed Unix binary."],"0.5.4":["Native engineering certification jobs now download the exact SDK tarball produced by the successful parent gate before installing dependencies.","The six-platform matrix remains source-bound to one immutable CLI tag and one immutable SDK candidate artifact."],"0.5.3":["Candidate packaging accepts both npm 11 array-form and npm 12 package-keyed JSON, with explicit diagnostics for malformed output.","Hosted SDK packaging now parses a bounded JSON file instead of relying on a large shell variable or an obsolete npm output shape."],"0.5.2":["Hosted certification now caps SDK declaration generation at two concurrent entry points and cleans declaration output in isolated bounded-memory workers.","SDK build subprocess failures now report their terminating signal or exit status instead of producing a silent hosted-run failure."],"0.5.1":["Hosted certification now builds the exact SDK candidate in bounded declaration groups, preventing parallel TypeScript declaration generation from exhausting GitHub-hosted runner resources.","Post-freeze readiness now distinguishes exact candidate tags verified at the candidate commit from collisions in release, registry, feed, and service namespaces."],"0.5.0":["Agent Profiles now provide enforceable Assistant, SWE, Reviewer, Writer, Research, Product, CI, DevOps, and Legal Research identities with bounded tools, permissions, skills, hooks, memory, isolation, and external-action authority.","The XENO Artifact Protocol adds durable plans, patches, diffs, reviews, screenshots, recordings, reports, provenance, approvals, and evidence relationships shared across local, hosted, and Hub workflows.","Secure Execution Contracts and capability leases now make filesystem, network, secret, process, device, browser, and external-action authority explicit and auditable.","Skills v2 adds standards-compatible SKILL.md discovery, progressive loading, bundled resources, invocation policy, version identity, and compatibility with XENO, .agents, and Claude skill locations.","MCP now supports current Streamable HTTP sessions and OAuth discovery while retaining compatible stdio and legacy SSE connections.","Browser, computer-use, hosted-agent, semantic-index, production-review, spec-planning, secure-sharing, and provider-onboarding surfaces are integrated through the shared platform contracts.","The retained TUI now presents stable grouped tool activity, live task and subagent status, candidate-bound edit previews, context-pressure and compaction state, and clearer turn completion receipts.","Six-product candidate certification now binds the SDK, XENO Use, XENO Browser, Agents API, CLI, and Hub to exact source identities, versions, tags, evidence, and protected release gates."],"0.4.45":["This transitional release is engineering-tested but not GA-certified: native PTY artifacts are unsigned and remain disabled by default until the Azure signing identity is approved; ordinary CLI and pipe-mode commands remain available.","App Server v2 now provides durable threads and turns, typed clients, permission ownership and expiry, bounded replay and backpressure, authenticated HTTP access, and additive v1 compatibility.","The terminal renderer now uses committed retained frames, bounded coalescing, one normal write per frame, a responsive 50-agent footer, accessibility modes, and a native terminal compatibility matrix.","Release certification now fails closed on six native architectures, platform and manifest signatures, reproducible package payloads, SBOMs, provenance attestations, independent approvals, npm OIDC publication, and public clean-install verification.","Long chat prompts now soft-wrap into a growing six-row composer with Unicode-safe editing, visual Up/Down navigation, file-panel parity, and a temporary XENO_INPUT_SOFT_WRAP=0 rollback switch.","Long-running model-authored shell commands now use managed operations: Ctrl+B promotes the same process, finite background work waits without model polling, and durable continuations resume exactly once after terminal output arrives.","ReadImage now uses Xeno's dependency-free owned raster codec for bounded PNG, BMP, Netpbm, and core-SVG previews; /processes and doctor expose task control, process-tree containment, operation-schema, and codec status.","Dynamic workflows now expose first-class run limits and terminal reducer summaries in run records and inspect JSON.","Background agent sessions now deliver durable completion, failure, stop, and request-keyed needs-input notifications to interactive parent chats and bounded headless runs without clobbering prompt drafts.","Workflow orchestration includes grouped phase/child progress, parent-chat completion notifications, WorkflowWait, /workflows drill-down, watch JSONL snapshots, and ultracode workflow prompts.","Workflow starts now support plan preview and exact-definition approval memory, scheduler ticks are serialized, and workflow lifecycle metrics are available through the OTel usage export.","Tool activity now uses semantic Update and Search labels, contextual line-numbered edit previews, expandable read/search/shell output, and accurate failure rendering.","Interactive chat now blocks repeated inspections and unrequested mutations on short questions, gives explicit research a larger typo-tolerant evidence budget, and reserves a tool-free final-answer turn when work limits are reached."],"0.4.44":["Markdown source links now render as clickable terminal links in supported terminals, with visible URLs preserved when links are disabled."],"0.4.43":["New background agents now appear in the footer immediately after launch, and the footer can show up to eight agent sessions."],"0.4.42":["Background agent footer rows now fit the common three-agent fanout without hiding the first agent on compact terminals.","Completed background agent sessions now close after BackgroundAgentJoin returns their result to the main agent."],"0.4.41":["Completed background agent footer rows now keep a fixed runtime instead of continuing to count upward."],"0.4.40":["One-shot background agent sessions now mark done after returning their result, while user-follow-up sessions stay idle for continued chat."],"0.4.39":["Background agent session activity now uses concise status labels like Thinking instead of showing the full task prompt."],"0.4.38":["Opened background agent sessions now show their own session activity line while keeping main-agent tool progress isolated."],"0.4.37":["Opened background agent sessions no longer show the main agent's active tool progress line."],"0.4.36":["Opened background agent sessions now render the same main-chat transcript surface for user messages, assistant messages, tool calls, and tool results."],"0.4.35":["Background agent session chat now includes tool calls and tool results in its visible history."],"0.4.34":["Opening a footer background agent now switches the main chat surface into that agent session instead of showing a separate info panel.","Child-session input now queues messages to that agent while Esc returns to the main chat."],"0.4.33":["Background agent footer rows now repaint immediately during active turns.","Remembered background-agent approvals now apply to later background-agent launches."],"0.4.32":["Startup release-note hints now sit directly under the note text and render dimmed in the side panel."],"0.4.31":["Unread release notes now render beside the startup XENO AGENT header on wide terminals."],"0.4.30":["BackgroundAgentList now only reports current-chat footer sessions so old workspace agents do not hide missing new deployments."],"0.4.29":["Background agent footer markers now use filled and empty squares.","Opening a background agent from the footer now shows its session chat with transcript and message input."],"0.4.28":["First-run default model is now gpt-5.5 while saved user model choices are preserved.","Number keys in the model picker now type into search instead of selecting by index.","Model selections made with /model now persist as the user's saved default."],"0.4.27":["Background agent footer rows are now scoped to the current chat session."],"0.4.26":["Background agent rows now sit below the status line and inherit the live chat model."],"0.4.25":["Legacy BackgroundAgent calls now create footer-visible interactive background sessions."],"0.4.24":["Model picker support now has a `xeno models --json` command, share export proof, and GitHub review artifact contracts."],"0.4.23":["Model picker and /model listings now refresh Xeno API model availability before switching."],"0.4.22":["Hook review now shows command-hook hashes and supports trust, disable, and explain commands.","Expanded lifecycle hooks now cover permission decisions, stop failures, and delegated subagent start/stop events.","Set XENO_STATUS_LINE_COMMAND to replace the TUI status line with a cached command output.","Rewind now saves the abandoned conversation branch as a manual checkpoint before restoring.","Interactive chat now supports Ctrl+R history search, Ctrl+G prompt editing, /vim input mode, and /copy answer/block/diff clipboard copy.","/theme is now a discoverable alias for /color with user/project custom theme files, and /processes stop-all stops running background tasks."],"0.4.20":["Shell completions now include the current control-plane commands, flags, statuses, scopes, and usage groups.","The local app-server browser page now includes prompt and process controls on top of advanced JSON-RPC.","Published CLI and SDK packages now include GitHub repository metadata.","Docs now call out the temporary GitHub Actions startup_failure blocker while local gates remain authoritative."],"0.1.0":["Persistent shell sessions now preserve cwd and shell state across Bash calls.","Delegated planner, explorer, executor, and reviewer branches now support staged and parallel policies.","MCP now supports stdio and SSE transports, prompt discovery, resource reads, and live tool sync.","Notebook, ask-user, and memory tools are available in the shared agent runtime.","CLI operator workflows now include doctor, bug-report, config editing, cost summaries, and runtime inspection."]};function VZ(e=ke){return BDt[e]??[]}function MDt(e=ke){let t=mt().lastReleaseNotesSeen;return VZ(e).length>0&&t!==e}function mI(e=ke){ui({lastReleaseNotesSeen:e})}function jQ(e){let t=e??ke,n=VZ(t);return n.length===0?`No release notes available for version ${t}.`:[`Release notes for version ${t}`,"",...n.map(r=>`- ${r}`)].join(`
|
|
4035
4035
|
`)}function CNe(e=ke){if(MDt(e))return[`What's new in XENO AGENT v${e}`,...VZ(e).map(t=>`- ${t}`),"Run `xeno release-notes` to view this again."].join(`
|
|
4036
4036
|
`)}Pt();nc();go();qx();import{spawn as NDt}from"node:child_process";import{setTimeout as WZ}from"node:timers/promises";function Ws(e){process.stdout.write(JSON.stringify(e,null,2)+`
|
|
4037
4037
|
`)}function ODt(e,t){if(t){Ws(e);return}if(e.ok&&e.definition){process.stdout.write(`Workflow valid: ${e.definition.name}
|