@xenosystem/agent-sdk 0.9.24 → 0.9.25

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.
Files changed (41) hide show
  1. package/dist/artifacts/index.cjs +1 -1
  2. package/dist/artifacts/index.js +1 -1
  3. package/dist/automation/index.cjs +1 -1
  4. package/dist/automation/index.d.cts +3 -0
  5. package/dist/automation/index.d.ts +3 -0
  6. package/dist/automation/index.js +1 -1
  7. package/dist/control-plane/index.cjs +1 -1
  8. package/dist/control-plane/index.js +1 -1
  9. package/dist/electron/index.cjs +124 -124
  10. package/dist/electron/index.d.cts +3 -0
  11. package/dist/electron/index.d.ts +3 -0
  12. package/dist/electron/index.js +123 -123
  13. package/dist/electron/metafile-cjs.json +1 -1
  14. package/dist/electron/metafile-esm.json +1 -1
  15. package/dist/governance/index.d.cts +2 -0
  16. package/dist/governance/index.d.ts +2 -0
  17. package/dist/hosted/index.cjs +1 -1
  18. package/dist/hosted/index.js +1 -1
  19. package/dist/hosted/metafile-cjs.json +1 -1
  20. package/dist/hosted/metafile-esm.json +1 -1
  21. package/dist/index.cjs +263 -263
  22. package/dist/index.d.cts +16 -7
  23. package/dist/index.d.ts +16 -7
  24. package/dist/index.js +273 -273
  25. package/dist/mcp/index.d.cts +3 -0
  26. package/dist/mcp/index.d.ts +3 -0
  27. package/dist/metafile-cjs.json +1 -1
  28. package/dist/metafile-esm.json +1 -1
  29. package/dist/session/index.cjs +1 -1
  30. package/dist/session/index.d.cts +2 -0
  31. package/dist/session/index.d.ts +2 -0
  32. package/dist/session/index.js +1 -1
  33. package/dist/session/metafile-cjs.json +1 -1
  34. package/dist/session/metafile-esm.json +1 -1
  35. package/dist/skills/index.d.cts +3 -0
  36. package/dist/skills/index.d.ts +3 -0
  37. package/dist/ui/index.d.cts +2 -0
  38. package/dist/ui/index.d.ts +2 -0
  39. package/dist/utils/index.d.cts +2 -0
  40. package/dist/utils/index.d.ts +2 -0
  41. package/package.json +10 -1
@@ -48,7 +48,7 @@ ${this.stringify(e.data)}
48
48
  `)+`
49
49
  `;await w(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await w(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await w(c,u)}catch(u){this.workspaceMirrorDisabled=!0,$("Transcript workspace mirror disabled",u)}}}async truncateAfterMessageCount(e){let t=await y(this.transcriptPath);if(!t)return;let r=K(t),s=Math.max(0,e),i=0,o=[];for(let c of r){if(c.type==="user_message"||c.type==="assistant_message"){if(i>=s)break;i+=1}o.push(c)}let a=o.length>0?o.map(c=>JSON.stringify(c)).join(`
50
50
  `)+`
51
- `:"";await w(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await w(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await w(c,u)}catch(u){this.workspaceMirrorDisabled=!0,$("Transcript workspace mirror disabled",u)}}}getSequence(){return this.sequence}async initialize(){try{let e=await y(this.transcriptPath);if(!e){this.sequence=0;return}let t=K(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);$(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};var Y=P(require("path"),1),Ze=require("crypto"),et=require("fs/promises");var $t={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit"};function pe(n){return $t[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=Y.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await B(this.checkpointsDir);let t=(0,Ze.randomUUID)(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=Y.join(this.checkpointsDir,`${t}.json`);return await w(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await ze(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await y(r);if(s){let i=v(s,null);if(i){let o=await(0,et.stat)(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=Y.join(this.checkpointsDir,`${e}.json`),r;try{r=await y(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=v(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=pe(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=Y.join(this.checkpointsDir,`${e}.json`);await I(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};var L=P(require("path"),1),Me=P(require("os"),1),N=P(require("fs"),1);var Nt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),Lt=globalThis,De=Lt[Nt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},_e=De.cleanups;function jt(){for(let n of _e)try{n()}catch{}}function tt(n){return _e.add(n),!De.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(De.exitHandlerRegistered=!0,process.on("exit",jt)),()=>{_e.delete(n)}}var rt="0.9.24";var Ft=1e4,Bt=6e4,Ht="session.lock",Wt="lock.json",X=new Map;function Ie(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function Gt(){for(let[n,e]of X)try{let t=v(N.readFileSync(n,"utf8"),null);Ie(t,e)&&N.unlinkSync(n)}catch{}X.clear()}tt(Gt);var G=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=L.join(e,Ht),this.legacyLockPath=L.join(e,Wt),this.sessionId=L.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:Me.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:rt,acquiredAt:e,updatedAt:e,heartbeat:e},r=L.dirname(this.lockPath);await N.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await I(s)}try{await N.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,X.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let l=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${l?.pid} on ${l?.hostname}`)}await I(this.lockPath);try{await N.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(l){throw l.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):l}this.acquiredOwner=t,X.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;X.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Ie(t,e)&&await I(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===Me.hostname())try{process.kill(t.pid,0)}catch(i){if(i.code!=="EPERM")return!0}let r=new Date(t.heartbeat).getTime();return Date.now()-r>Bt}startHeartbeat(e=Ft){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){H("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}H(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Ie(e,t)){this.acquiredOwner=void 0,X.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await w(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await y(e);return t?v(t,null):null}async findExistingLockPath(){return await y(this.lockPath)?this.lockPath:await y(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await ae(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await I(a),r.push(L.basename(s))}}return r}};var _=P(require("path"),1);var R=P(require("path"),1);function Ut(n,e){let t=R.resolve(n),r=R.resolve(n,e);return r===t?!0:t===R.parse(t).root?r.startsWith(t):r.startsWith(t+R.sep)}function U(n,e){if(R.isAbsolute(e))return R.resolve(e);if(!Ut(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return R.resolve(n,e)}var x=P(require("path"),1),me=P(require("os"),1),E=P(require("node:fs/promises"),1),fe=require("node:crypto");var q=require("node:os");var Ce=require("node:path"),Lr=(0,q.platform)();var jr=(0,q.release)(),Fr=(0,q.homedir)();function de(){let n=process.env.XENO_AGENT_HOME?.trim();return n?(0,Ce.resolve)(n):(0,Ce.resolve)((0,q.homedir)(),".xeno-agent")}var nt=1,st="recent.json",qt=".lock",ot=".entries",Jt=3e4,Ae=6e4,at=new Set(["EACCES","EBUSY","EPERM"]),zt=[5,10,20,40,80,160,320],ge=new Map;function Vt(n,e){let t=(0,fe.createHash)("sha256").update(e).digest("hex");return x.join(`${n}${ot}`,`${t}.json`)}async function Oe(n,e,t){let r={schemaVersion:1,key:e,entry:t};await w(Vt(n,e),JSON.stringify(r)+`
51
+ `:"";await w(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await w(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await w(c,u)}catch(u){this.workspaceMirrorDisabled=!0,$("Transcript workspace mirror disabled",u)}}}getSequence(){return this.sequence}async initialize(){try{let e=await y(this.transcriptPath);if(!e){this.sequence=0;return}let t=K(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);$(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};var Y=P(require("path"),1),Ze=require("crypto"),et=require("fs/promises");var $t={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit"};function pe(n){return $t[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=Y.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await B(this.checkpointsDir);let t=(0,Ze.randomUUID)(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=Y.join(this.checkpointsDir,`${t}.json`);return await w(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await ze(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await y(r);if(s){let i=v(s,null);if(i){let o=await(0,et.stat)(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=Y.join(this.checkpointsDir,`${e}.json`),r;try{r=await y(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=v(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=pe(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=Y.join(this.checkpointsDir,`${e}.json`);await I(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};var L=P(require("path"),1),Me=P(require("os"),1),N=P(require("fs"),1);var Nt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),Lt=globalThis,De=Lt[Nt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},_e=De.cleanups;function jt(){for(let n of _e)try{n()}catch{}}function tt(n){return _e.add(n),!De.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(De.exitHandlerRegistered=!0,process.on("exit",jt)),()=>{_e.delete(n)}}var rt="0.9.25";var Ft=1e4,Bt=6e4,Ht="session.lock",Wt="lock.json",X=new Map;function Ie(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function Gt(){for(let[n,e]of X)try{let t=v(N.readFileSync(n,"utf8"),null);Ie(t,e)&&N.unlinkSync(n)}catch{}X.clear()}tt(Gt);var G=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=L.join(e,Ht),this.legacyLockPath=L.join(e,Wt),this.sessionId=L.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:Me.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:rt,acquiredAt:e,updatedAt:e,heartbeat:e},r=L.dirname(this.lockPath);await N.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await I(s)}try{await N.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,X.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let l=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${l?.pid} on ${l?.hostname}`)}await I(this.lockPath);try{await N.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(l){throw l.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):l}this.acquiredOwner=t,X.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;X.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Ie(t,e)&&await I(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===Me.hostname())try{process.kill(t.pid,0)}catch(i){if(i.code!=="EPERM")return!0}let r=new Date(t.heartbeat).getTime();return Date.now()-r>Bt}startHeartbeat(e=Ft){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){H("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}H(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Ie(e,t)){this.acquiredOwner=void 0,X.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await w(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await y(e);return t?v(t,null):null}async findExistingLockPath(){return await y(this.lockPath)?this.lockPath:await y(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await ae(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await I(a),r.push(L.basename(s))}}return r}};var _=P(require("path"),1);var R=P(require("path"),1);function Ut(n,e){let t=R.resolve(n),r=R.resolve(n,e);return r===t?!0:t===R.parse(t).root?r.startsWith(t):r.startsWith(t+R.sep)}function U(n,e){if(R.isAbsolute(e))return R.resolve(e);if(!Ut(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return R.resolve(n,e)}var x=P(require("path"),1),me=P(require("os"),1),E=P(require("node:fs/promises"),1),fe=require("node:crypto");var q=require("node:os");var Ce=require("node:path"),Lr=(0,q.platform)();var jr=(0,q.release)(),Fr=(0,q.homedir)();function de(){let n=process.env.XENO_AGENT_HOME?.trim();return n?(0,Ce.resolve)(n):(0,Ce.resolve)((0,q.homedir)(),".xeno-agent")}var nt=1,st="recent.json",qt=".lock",ot=".entries",Jt=3e4,Ae=6e4,at=new Set(["EACCES","EBUSY","EPERM"]),zt=[5,10,20,40,80,160,320],ge=new Map;function Vt(n,e){let t=(0,fe.createHash)("sha256").update(e).digest("hex");return x.join(`${n}${ot}`,`${t}.json`)}async function Oe(n,e,t){let r={schemaVersion:1,key:e,entry:t};await w(Vt(n,e),JSON.stringify(r)+`
52
52
  `)}async function Xt(n,e){let t=`${n}${ot}`,r;try{r=await E.readdir(t)}catch(s){if(s.code==="ENOENT")return;throw s}await Promise.all(r.filter(s=>s.endsWith(".json")).map(async s=>{let i=await E.readFile(x.join(t,s),"utf8").catch(()=>""),o=v(i,null);if(!(!o||o.schemaVersion!==1||typeof o.key!="string")){if(o.entry===null){delete e[o.key];return}typeof o.entry.sessionId!="string"||typeof o.entry.endedAt!="string"||(e[o.key]=o.entry)}}))}function it(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function Kt(n){try{let[e,t]=await Promise.all([E.readFile(x.join(n,"owner.json"),"utf8").catch(()=>""),E.stat(n)]),r=v(e,null);return r?.hostname===me.hostname()&&it(r.pid)?!1:r?.hostname&&r.hostname!==me.hostname()||!r?Date.now()-t.mtimeMs>Ae:Date.now()-t.mtimeMs>Ae||!it(r.pid)}catch{return!1}}async function ct(n){for(let e=0;;e+=1)try{await E.rm(n,{recursive:!0});return}catch(t){let r=t.code;if(r==="ENOENT")return;let s=zt[e];if(process.platform!=="win32"||!r||!at.has(r)||s===void 0)throw t;await new Promise(i=>setTimeout(i,s))}}async function Yt(n,e){try{let t=await E.readFile(x.join(n,"owner.json"),"utf8");v(t,null)?.token===e&&await ct(n)}catch(t){if(t.code!=="ENOENT")throw t}}async function $e(n,e){let t=J(n),r=ge.get(t)??Promise.resolve(),s,i=new Promise(o=>{s=o});ge.set(t,i),await r;try{return await Qt(t,e)}finally{s(),ge.get(t)===i&&ge.delete(t)}}async function Qt(n,e){let t=`${n}${qt}`,r=(0,fe.randomUUID)(),s=Date.now();await E.mkdir(x.dirname(n),{recursive:!0});for(let i=0;;i+=1){let o={schemaVersion:1,token:r,pid:process.pid,hostname:me.hostname(),acquiredAt:new Date().toISOString()};try{await E.mkdir(t),await E.writeFile(x.join(t,"owner.json"),JSON.stringify(o),"utf8");break}catch(a){let l=a.code,c=process.platform==="win32"&&!!l&&at.has(l);if(l!=="EEXIST"&&!c)throw a;if(await Kt(t)){await ct(t);continue}if(Date.now()-s>=Jt)throw new Error(`Timed out waiting for recent-sessions index lock: ${t}`);let u=Math.min(100,5+i*5)+Math.floor(Math.random()*10);await new Promise(g=>setTimeout(g,u))}}try{return await e()}finally{await Yt(t,r)}}function J(n){return n===void 0?x.join(de(),st):x.join(n,".xeno-agent",st)}function Q(n){let e=x.normalize(n).replace(/[\\/]+$/,""),t=e.length>0?e:x.parse(x.normalize(n)).root;return process.platform==="win32"?t.toLowerCase():t}async function j(n){let e=J(n),t=oe(e)?await y(e):null,r=t?v(t,null):null,s=r&&typeof r=="object"?r:null,i={},o=s?.version===nt&&s.entries&&typeof s.entries=="object"?s.entries:{};for(let[a,l]of Object.entries(o)){if(!l||typeof l!="object")continue;let c=l;typeof c.sessionId!="string"||c.sessionId.length===0||typeof c.endedAt=="string"&&(i[a]={sessionId:c.sessionId,endedAt:c.endedAt,role:typeof c.role=="string"?c.role:void 0})}return await Xt(e,i),{version:nt,entries:i}}async function he(n,e={}){let t=await j(e.homeDir),r=Q(n),s=t.entries[r];if(s&&!(e.role&&s.role&&s.role!==e.role))return s}async function ye(n,e={}){let t=Q(n.cwd),r={sessionId:n.sessionId,role:n.role,endedAt:n.endedAt??new Date().toISOString()},s=J(e.homeDir);await Oe(s,t,r),await $e(e.homeDir,async()=>{let i=await j(e.homeDir);i.entries[t]=r,await w(s,JSON.stringify(i,null,2)+`
53
53
  `)})}async function lt(n,e={}){let t=Q(n),r=J(e.homeDir);(await j(e.homeDir)).entries[t]&&(await Oe(r,t,null),await $e(e.homeDir,async()=>{let i=await j(e.homeDir);delete i.entries[t],await w(r,JSON.stringify(i,null,2)+`
54
54
  `)}))}async function Z(n,e={}){let t=await j(e.homeDir),r=Object.entries(t.entries).filter(([,i])=>i.sessionId===n).map(([i])=>i);if(r.length===0)return;let s=J(e.homeDir);await Promise.all(r.map(i=>Oe(s,i,null))),await $e(e.homeDir,async()=>{let i=await j(e.homeDir);for(let[o,a]of Object.entries(i.entries))a.sessionId===n&&delete i.entries[o];await w(s,JSON.stringify(i,null,2)+`
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  type TokenAccountingSource = "exact" | "provider-reported" | "estimated";
2
3
  interface CompactionRecord {
3
4
  schemaVersion: 1;
@@ -50,6 +51,7 @@ interface WebContextToolResult {
50
51
  mediaType: string;
51
52
  bytes: number;
52
53
  };
54
+ jobProgress?: WebJobProgress;
53
55
  }
54
56
  interface ImageUrlBlock {
55
57
  type: "image_url";
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  type TokenAccountingSource = "exact" | "provider-reported" | "estimated";
2
3
  interface CompactionRecord {
3
4
  schemaVersion: 1;
@@ -50,6 +51,7 @@ interface WebContextToolResult {
50
51
  mediaType: string;
51
52
  bytes: number;
52
53
  };
54
+ jobProgress?: WebJobProgress;
53
55
  }
54
56
  interface ImageUrlBlock {
55
57
  type: "image_url";
@@ -48,7 +48,7 @@ ${this.stringify(e.data)}
48
48
  `)+`
49
49
  `;await y(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await y(c,u)}catch(u){this.workspaceMirrorDisabled=!0,I("Transcript workspace mirror disabled",u)}}}async truncateAfterMessageCount(e){let t=await h(this.transcriptPath);if(!t)return;let r=z(t),s=Math.max(0,e),i=0,o=[];for(let c of r){if(c.type==="user_message"||c.type==="assistant_message"){if(i>=s)break;i+=1}o.push(c)}let a=o.length>0?o.map(c=>JSON.stringify(c)).join(`
50
50
  `)+`
51
- `:"";await y(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await y(c,u)}catch(u){this.workspaceMirrorDisabled=!0,I("Transcript workspace mirror disabled",u)}}}getSequence(){return this.sequence}async initialize(){try{let e=await h(this.transcriptPath);if(!e){this.sequence=0;return}let t=z(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);I(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};import*as V from"path";import{randomUUID as bt}from"crypto";import{stat as Rt}from"fs/promises";var Tt={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit"};function re(n){return Tt[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=V.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await L(this.checkpointsDir);let t=bt(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=V.join(this.checkpointsDir,`${t}.json`);return await y(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await je(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await h(r);if(s){let i=S(s,null);if(i){let o=await Rt(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=V.join(this.checkpointsDir,`${e}.json`),r;try{r=await h(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=S(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=re(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=V.join(this.checkpointsDir,`${e}.json`);await _(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};import*as $ from"path";import*as ke from"os";import*as O from"fs";var Dt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),_t=globalThis,ye=_t[Dt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},we=ye.cleanups;function Mt(){for(let n of we)try{n()}catch{}}function qe(n){return we.add(n),!ye.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(ye.exitHandlerRegistered=!0,process.on("exit",Mt)),()=>{we.delete(n)}}var Je="0.9.24";var It=1e4,Ct=6e4,At="session.lock",Ot="lock.json",G=new Map;function Se(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function $t(){for(let[n,e]of G)try{let t=S(O.readFileSync(n,"utf8"),null);Se(t,e)&&O.unlinkSync(n)}catch{}G.clear()}qe($t);var U=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=$.join(e,At),this.legacyLockPath=$.join(e,Ot),this.sessionId=$.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:ke.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:Je,acquiredAt:e,updatedAt:e,heartbeat:e},r=$.dirname(this.lockPath);await O.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await _(s)}try{await O.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,G.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let l=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${l?.pid} on ${l?.hostname}`)}await _(this.lockPath);try{await O.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(l){throw l.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):l}this.acquiredOwner=t,G.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;G.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Se(t,e)&&await _(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===ke.hostname())try{process.kill(t.pid,0)}catch(i){if(i.code!=="EPERM")return!0}let r=new Date(t.heartbeat).getTime();return Date.now()-r>Ct}startHeartbeat(e=It){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){j("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}j(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Se(e,t)){this.acquiredOwner=void 0,G.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await y(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await h(e);return t?S(t,null):null}async findExistingLockPath(){return await h(this.lockPath)?this.lockPath:await h(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await ee(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await _(a),r.push($.basename(s))}}return r}};import*as R from"path";import*as T from"path";function Nt(n,e){let t=T.resolve(n),r=T.resolve(n,e);return r===t?!0:t===T.parse(t).root?r.startsWith(t):r.startsWith(t+T.sep)}function B(n,e){if(T.isAbsolute(e))return T.resolve(e);if(!Nt(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return T.resolve(n,e)}import*as v from"path";import*as ie from"os";import*as x from"node:fs/promises";import{createHash as Ft,randomUUID as Bt}from"node:crypto";import{homedir as Ve,platform as Lt,release as jt}from"node:os";import{resolve as ze}from"node:path";var Gr=Lt();var Ur=jt(),qr=Ve();function ne(){let n=process.env.XENO_AGENT_HOME?.trim();return n?ze(n):ze(Ve(),".xeno-agent")}var Xe=1,Ke="recent.json",Ht=".lock",Qe=".entries",Wt=3e4,ve=6e4,Ze=new Set(["EACCES","EBUSY","EPERM"]),Gt=[5,10,20,40,80,160,320],se=new Map;function Ut(n,e){let t=Ft("sha256").update(e).digest("hex");return v.join(`${n}${Qe}`,`${t}.json`)}async function xe(n,e,t){let r={schemaVersion:1,key:e,entry:t};await y(Ut(n,e),JSON.stringify(r)+`
51
+ `:"";await y(this.transcriptPath,a);let l=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,l),!this.workspaceMirrorDisabled){let c=await this.resolveWorkspaceMarkdownPath();if(c)try{let u=this.buildMarkdownDocument(o,"workspace mirror");await y(c,u)}catch(u){this.workspaceMirrorDisabled=!0,I("Transcript workspace mirror disabled",u)}}}getSequence(){return this.sequence}async initialize(){try{let e=await h(this.transcriptPath);if(!e){this.sequence=0;return}let t=z(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);I(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};import*as V from"path";import{randomUUID as bt}from"crypto";import{stat as Rt}from"fs/promises";var Tt={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit"};function re(n){return Tt[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=V.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await L(this.checkpointsDir);let t=bt(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=V.join(this.checkpointsDir,`${t}.json`);return await y(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await je(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await h(r);if(s){let i=S(s,null);if(i){let o=await Rt(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=V.join(this.checkpointsDir,`${e}.json`),r;try{r=await h(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=S(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=re(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=V.join(this.checkpointsDir,`${e}.json`);await _(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};import*as $ from"path";import*as ke from"os";import*as O from"fs";var Dt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),_t=globalThis,ye=_t[Dt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},we=ye.cleanups;function Mt(){for(let n of we)try{n()}catch{}}function qe(n){return we.add(n),!ye.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(ye.exitHandlerRegistered=!0,process.on("exit",Mt)),()=>{we.delete(n)}}var Je="0.9.25";var It=1e4,Ct=6e4,At="session.lock",Ot="lock.json",G=new Map;function Se(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function $t(){for(let[n,e]of G)try{let t=S(O.readFileSync(n,"utf8"),null);Se(t,e)&&O.unlinkSync(n)}catch{}G.clear()}qe($t);var U=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=$.join(e,At),this.legacyLockPath=$.join(e,Ot),this.sessionId=$.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:ke.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:Je,acquiredAt:e,updatedAt:e,heartbeat:e},r=$.dirname(this.lockPath);await O.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await _(s)}try{await O.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,G.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let l=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${l?.pid} on ${l?.hostname}`)}await _(this.lockPath);try{await O.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(l){throw l.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):l}this.acquiredOwner=t,G.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;G.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Se(t,e)&&await _(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===ke.hostname())try{process.kill(t.pid,0)}catch(i){if(i.code!=="EPERM")return!0}let r=new Date(t.heartbeat).getTime();return Date.now()-r>Ct}startHeartbeat(e=It){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){j("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}j(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Se(e,t)){this.acquiredOwner=void 0,G.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await y(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await h(e);return t?S(t,null):null}async findExistingLockPath(){return await h(this.lockPath)?this.lockPath:await h(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await ee(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await _(a),r.push($.basename(s))}}return r}};import*as R from"path";import*as T from"path";function Nt(n,e){let t=T.resolve(n),r=T.resolve(n,e);return r===t?!0:t===T.parse(t).root?r.startsWith(t):r.startsWith(t+T.sep)}function B(n,e){if(T.isAbsolute(e))return T.resolve(e);if(!Nt(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return T.resolve(n,e)}import*as v from"path";import*as ie from"os";import*as x from"node:fs/promises";import{createHash as Ft,randomUUID as Bt}from"node:crypto";import{homedir as Ve,platform as Lt,release as jt}from"node:os";import{resolve as ze}from"node:path";var Gr=Lt();var Ur=jt(),qr=Ve();function ne(){let n=process.env.XENO_AGENT_HOME?.trim();return n?ze(n):ze(Ve(),".xeno-agent")}var Xe=1,Ke="recent.json",Ht=".lock",Qe=".entries",Wt=3e4,ve=6e4,Ze=new Set(["EACCES","EBUSY","EPERM"]),Gt=[5,10,20,40,80,160,320],se=new Map;function Ut(n,e){let t=Ft("sha256").update(e).digest("hex");return v.join(`${n}${Qe}`,`${t}.json`)}async function xe(n,e,t){let r={schemaVersion:1,key:e,entry:t};await y(Ut(n,e),JSON.stringify(r)+`
52
52
  `)}async function qt(n,e){let t=`${n}${Qe}`,r;try{r=await x.readdir(t)}catch(s){if(s.code==="ENOENT")return;throw s}await Promise.all(r.filter(s=>s.endsWith(".json")).map(async s=>{let i=await x.readFile(v.join(t,s),"utf8").catch(()=>""),o=S(i,null);if(!(!o||o.schemaVersion!==1||typeof o.key!="string")){if(o.entry===null){delete e[o.key];return}typeof o.entry.sessionId!="string"||typeof o.entry.endedAt!="string"||(e[o.key]=o.entry)}}))}function Ye(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function Jt(n){try{let[e,t]=await Promise.all([x.readFile(v.join(n,"owner.json"),"utf8").catch(()=>""),x.stat(n)]),r=S(e,null);return r?.hostname===ie.hostname()&&Ye(r.pid)?!1:r?.hostname&&r.hostname!==ie.hostname()||!r?Date.now()-t.mtimeMs>ve:Date.now()-t.mtimeMs>ve||!Ye(r.pid)}catch{return!1}}async function et(n){for(let e=0;;e+=1)try{await x.rm(n,{recursive:!0});return}catch(t){let r=t.code;if(r==="ENOENT")return;let s=Gt[e];if(process.platform!=="win32"||!r||!Ze.has(r)||s===void 0)throw t;await new Promise(i=>setTimeout(i,s))}}async function zt(n,e){try{let t=await x.readFile(v.join(n,"owner.json"),"utf8");S(t,null)?.token===e&&await et(n)}catch(t){if(t.code!=="ENOENT")throw t}}async function Ee(n,e){let t=q(n),r=se.get(t)??Promise.resolve(),s,i=new Promise(o=>{s=o});se.set(t,i),await r;try{return await Vt(t,e)}finally{s(),se.get(t)===i&&se.delete(t)}}async function Vt(n,e){let t=`${n}${Ht}`,r=Bt(),s=Date.now();await x.mkdir(v.dirname(n),{recursive:!0});for(let i=0;;i+=1){let o={schemaVersion:1,token:r,pid:process.pid,hostname:ie.hostname(),acquiredAt:new Date().toISOString()};try{await x.mkdir(t),await x.writeFile(v.join(t,"owner.json"),JSON.stringify(o),"utf8");break}catch(a){let l=a.code,c=process.platform==="win32"&&!!l&&Ze.has(l);if(l!=="EEXIST"&&!c)throw a;if(await Jt(t)){await et(t);continue}if(Date.now()-s>=Wt)throw new Error(`Timed out waiting for recent-sessions index lock: ${t}`);let u=Math.min(100,5+i*5)+Math.floor(Math.random()*10);await new Promise(d=>setTimeout(d,u))}}try{return await e()}finally{await zt(t,r)}}function q(n){return n===void 0?v.join(ne(),Ke):v.join(n,".xeno-agent",Ke)}function oe(n){let e=v.normalize(n).replace(/[\\/]+$/,""),t=e.length>0?e:v.parse(v.normalize(n)).root;return process.platform==="win32"?t.toLowerCase():t}async function H(n){let e=q(n),t=Z(e)?await h(e):null,r=t?S(t,null):null,s=r&&typeof r=="object"?r:null,i={},o=s?.version===Xe&&s.entries&&typeof s.entries=="object"?s.entries:{};for(let[a,l]of Object.entries(o)){if(!l||typeof l!="object")continue;let c=l;typeof c.sessionId!="string"||c.sessionId.length===0||typeof c.endedAt=="string"&&(i[a]={sessionId:c.sessionId,endedAt:c.endedAt,role:typeof c.role=="string"?c.role:void 0})}return await qt(e,i),{version:Xe,entries:i}}async function Pe(n,e={}){let t=await H(e.homeDir),r=oe(n),s=t.entries[r];if(s&&!(e.role&&s.role&&s.role!==e.role))return s}async function Te(n,e={}){let t=oe(n.cwd),r={sessionId:n.sessionId,role:n.role,endedAt:n.endedAt??new Date().toISOString()},s=q(e.homeDir);await xe(s,t,r),await Ee(e.homeDir,async()=>{let i=await H(e.homeDir);i.entries[t]=r,await y(s,JSON.stringify(i,null,2)+`
53
53
  `)})}async function Xt(n,e={}){let t=oe(n),r=q(e.homeDir);(await H(e.homeDir)).entries[t]&&(await xe(r,t,null),await Ee(e.homeDir,async()=>{let i=await H(e.homeDir);delete i.entries[t],await y(r,JSON.stringify(i,null,2)+`
54
54
  `)}))}async function ae(n,e={}){let t=await H(e.homeDir),r=Object.entries(t.entries).filter(([,i])=>i.sessionId===n).map(([i])=>i);if(r.length===0)return;let s=q(e.homeDir);await Promise.all(r.map(i=>xe(s,i,null))),await Ee(e.homeDir,async()=>{let i=await H(e.homeDir);for(let[o,a]of Object.entries(i.entries))a.sessionId===n&&delete i.entries[o];await y(s,JSON.stringify(i,null,2)+`
@@ -1 +1 @@
1
- {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":10199,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26619,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":11638,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":14200,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"fs/promises","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/session/index.ts","inputs":{"src/session/index.ts":{"bytesInOutput":754},"src/session/id-generator.ts":{"bytesInOutput":341},"src/session/transcript.ts":{"bytesInOutput":7794},"src/utils/fs.ts":{"bytesInOutput":1604},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2302},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3728},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2698},"src/utils/path-security.ts":{"bytesInOutput":314},"src/session/recent-sessions.ts":{"bytesInOutput":4297},"src/utils/platform.ts":{"bytesInOutput":244},"src/session/manager.ts":{"bytesInOutput":5129},"src/session/recovery.ts":{"bytesInOutput":4149},"src/session/turn-restore.ts":{"bytesInOutput":13502}},"bytes":50351}}}
1
+ {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":10199,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":27097,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":11638,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":14200,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"fs/promises","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/session/index.ts","inputs":{"src/session/index.ts":{"bytesInOutput":754},"src/session/id-generator.ts":{"bytesInOutput":341},"src/session/transcript.ts":{"bytesInOutput":7794},"src/utils/fs.ts":{"bytesInOutput":1604},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2302},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3728},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2698},"src/utils/path-security.ts":{"bytesInOutput":314},"src/session/recent-sessions.ts":{"bytesInOutput":4297},"src/utils/platform.ts":{"bytesInOutput":244},"src/session/manager.ts":{"bytesInOutput":5129},"src/session/recovery.ts":{"bytesInOutput":4149},"src/session/turn-restore.ts":{"bytesInOutput":13502}},"bytes":50351}}}
@@ -1 +1 @@
1
- {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":10199,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26619,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":11638,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":14200,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["CheckpointManager","DIRECT_SHELL_CONTEXT_WARNING","MAX_DIRECT_SHELL_OUTPUT_CHARS","SessionLock","SessionManager","SessionRegistry","TranscriptWriter","TurnRestoreManager","createDirectShellMessage","forgetRecentSession","forgetRecentSessionById","formatDirectShellContext","generateSessionId","getRecentSessionsIndexPath","isDirectShellMessage","isValidSessionId","loadRecentSessionsIndex","lookupRecentSession","normalizeDirectShellResultRecord","normalizeWorkingDirectory","parseSessionId","readSessionFormatVersion","recordRecentSession","recoverSessionMessages","repairInterruptedToolCalls"],"entryPoint":"src/session/index.ts","inputs":{"src/session/id-generator.ts":{"bytesInOutput":338},"src/session/index.ts":{"bytesInOutput":0},"src/session/transcript.ts":{"bytesInOutput":7788},"src/utils/fs.ts":{"bytesInOutput":1615},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2301},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3724},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2695},"src/utils/path-security.ts":{"bytesInOutput":310},"src/session/recent-sessions.ts":{"bytesInOutput":4300},"src/utils/platform.ts":{"bytesInOutput":227},"src/session/manager.ts":{"bytesInOutput":5125},"src/session/recovery.ts":{"bytesInOutput":4149},"src/session/turn-restore.ts":{"bytesInOutput":13082}},"bytes":48689}}}
1
+ {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":10199,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":27097,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":11638,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":14200,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["CheckpointManager","DIRECT_SHELL_CONTEXT_WARNING","MAX_DIRECT_SHELL_OUTPUT_CHARS","SessionLock","SessionManager","SessionRegistry","TranscriptWriter","TurnRestoreManager","createDirectShellMessage","forgetRecentSession","forgetRecentSessionById","formatDirectShellContext","generateSessionId","getRecentSessionsIndexPath","isDirectShellMessage","isValidSessionId","loadRecentSessionsIndex","lookupRecentSession","normalizeDirectShellResultRecord","normalizeWorkingDirectory","parseSessionId","readSessionFormatVersion","recordRecentSession","recoverSessionMessages","repairInterruptedToolCalls"],"entryPoint":"src/session/index.ts","inputs":{"src/session/id-generator.ts":{"bytesInOutput":338},"src/session/index.ts":{"bytesInOutput":0},"src/session/transcript.ts":{"bytesInOutput":7788},"src/utils/fs.ts":{"bytesInOutput":1615},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2301},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3724},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2695},"src/utils/path-security.ts":{"bytesInOutput":310},"src/session/recent-sessions.ts":{"bytesInOutput":4300},"src/utils/platform.ts":{"bytesInOutput":227},"src/session/manager.ts":{"bytesInOutput":5125},"src/session/recovery.ts":{"bytesInOutput":4149},"src/session/turn-restore.ts":{"bytesInOutput":13082}},"bytes":48689}}}
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
3
  interface WebContextEvidenceProjection {
3
4
  evidenceId: string;
@@ -24,6 +25,7 @@ interface WebContextToolResult {
24
25
  mediaType: string;
25
26
  bytes: number;
26
27
  };
28
+ jobProgress?: WebJobProgress;
27
29
  }
28
30
  interface ToolDefinition {
29
31
  name: string;
@@ -105,6 +107,7 @@ interface ToolProgressUpdate {
105
107
  bytes?: number;
106
108
  outputBytes?: number;
107
109
  nextOffset?: number;
110
+ webContextProgress?: WebJobProgress;
108
111
  }
109
112
  interface ToolAuthorizationReceipt {
110
113
  turnId: string;
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
3
  interface WebContextEvidenceProjection {
3
4
  evidenceId: string;
@@ -24,6 +25,7 @@ interface WebContextToolResult {
24
25
  mediaType: string;
25
26
  bytes: number;
26
27
  };
28
+ jobProgress?: WebJobProgress;
27
29
  }
28
30
  interface ToolDefinition {
29
31
  name: string;
@@ -105,6 +107,7 @@ interface ToolProgressUpdate {
105
107
  bytes?: number;
106
108
  outputBytes?: number;
107
109
  nextOffset?: number;
110
+ webContextProgress?: WebJobProgress;
108
111
  }
109
112
  interface ToolAuthorizationReceipt {
110
113
  turnId: string;
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
3
  interface WebContextEvidenceProjection {
3
4
  evidenceId: string;
@@ -24,6 +25,7 @@ interface WebContextToolResult {
24
25
  mediaType: string;
25
26
  bytes: number;
26
27
  };
28
+ jobProgress?: WebJobProgress;
27
29
  }
28
30
  interface ImageUrlBlock {
29
31
  type: "image_url";
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
3
  interface WebContextEvidenceProjection {
3
4
  evidenceId: string;
@@ -24,6 +25,7 @@ interface WebContextToolResult {
24
25
  mediaType: string;
25
26
  bytes: number;
26
27
  };
28
+ jobProgress?: WebJobProgress;
27
29
  }
28
30
  interface ImageUrlBlock {
29
31
  type: "image_url";
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  type TextEncoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
2
3
  type LineEnding = "LF" | "CRLF";
3
4
  interface TextFileContents {
@@ -162,6 +163,7 @@ interface WebContextToolResult {
162
163
  mediaType: string;
163
164
  bytes: number;
164
165
  };
166
+ jobProgress?: WebJobProgress;
165
167
  }
166
168
  interface ImageUrlBlock {
167
169
  type: "image_url";
@@ -1,3 +1,4 @@
1
+ import { WebJobProgress } from "@xenosystem/web-context-client/progress";
1
2
  type TextEncoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
2
3
  type LineEnding = "LF" | "CRLF";
3
4
  interface TextFileContents {
@@ -162,6 +163,7 @@ interface WebContextToolResult {
162
163
  mediaType: string;
163
164
  bytes: number;
164
165
  };
166
+ jobProgress?: WebJobProgress;
165
167
  }
166
168
  interface ImageUrlBlock {
167
169
  type: "image_url";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/agent-sdk",
3
- "version": "0.9.24",
3
+ "version": "0.9.25",
4
4
  "description": "XENO Agent SDK built from the same engine as XENO CODE",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -200,8 +200,17 @@
200
200
  "dependencies": {
201
201
  "@primno/dpapi": "2.0.1"
202
202
  },
203
+ "peerDependencies": {
204
+ "@xenosystem/web-context-client": "0.1.1"
205
+ },
206
+ "peerDependenciesMeta": {
207
+ "@xenosystem/web-context-client": {
208
+ "optional": true
209
+ }
210
+ },
203
211
  "devDependencies": {
204
212
  "@eslint/js": "^9.39.4",
213
+ "@xenosystem/web-context-client": "0.1.1",
205
214
  "@types/node": "^22.12.0",
206
215
  "@typescript/native": "npm:typescript@^7.0.2",
207
216
  "eslint": "^9.39.4",