@xenosystem/agent-sdk 0.9.10 → 0.9.11
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/agents/index.cjs +9 -9
- package/dist/agents/index.d.cts +12 -2
- package/dist/agents/index.d.ts +12 -2
- package/dist/agents/index.js +16 -16
- package/dist/agents/metafile-cjs.json +1 -1
- package/dist/agents/metafile-esm.json +1 -1
- package/dist/artifacts/browser.cjs +1 -1
- package/dist/artifacts/browser.d.cts +2 -2
- package/dist/artifacts/browser.d.ts +2 -2
- package/dist/artifacts/browser.js +1 -1
- package/dist/artifacts/{diff-artifact-C2tQZWcs.d.cts → diff-artifact-CmhmeSu5.d.cts} +87 -7
- package/dist/artifacts/{diff-artifact-C2tQZWcs.d.ts → diff-artifact-CmhmeSu5.d.ts} +87 -7
- package/dist/artifacts/index.cjs +8 -8
- package/dist/artifacts/index.d.cts +22 -5
- package/dist/artifacts/index.d.ts +22 -5
- package/dist/artifacts/index.js +8 -8
- package/dist/artifacts/metafile-cjs.json +1 -1
- package/dist/artifacts/metafile-esm.json +1 -1
- package/dist/automation/index.cjs +2 -2
- package/dist/automation/index.d.cts +97 -7
- package/dist/automation/index.d.ts +97 -7
- package/dist/automation/index.js +2 -2
- package/dist/automation/metafile-cjs.json +1 -1
- package/dist/automation/metafile-esm.json +1 -1
- package/dist/control-plane/index.cjs +7 -7
- package/dist/control-plane/index.d.cts +19 -2
- package/dist/control-plane/index.d.ts +19 -2
- package/dist/control-plane/index.js +7 -7
- package/dist/control-plane/metafile-cjs.json +1 -1
- package/dist/control-plane/metafile-esm.json +1 -1
- package/dist/electron/index.cjs +142 -142
- package/dist/electron/index.d.cts +24 -4
- package/dist/electron/index.d.ts +24 -4
- package/dist/electron/index.js +140 -140
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/hooks/index.d.cts +10 -1
- package/dist/hooks/index.d.ts +10 -1
- package/dist/hosted/index.cjs +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/hosted/metafile-cjs.json +1 -1
- package/dist/hosted/metafile-esm.json +1 -1
- package/dist/index.cjs +327 -327
- package/dist/index.d.cts +192 -24
- package/dist/index.d.ts +192 -24
- package/dist/index.js +328 -328
- package/dist/mcp/index.cjs +17 -17
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/metafile-cjs.json +1 -1
- package/dist/mcp/metafile-esm.json +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/oracle/index.cjs +1 -1
- package/dist/oracle/index.d.cts +86 -6
- package/dist/oracle/index.d.ts +86 -6
- package/dist/oracle/index.js +1 -1
- package/dist/oracle/metafile-cjs.json +1 -1
- package/dist/oracle/metafile-esm.json +1 -1
- package/dist/providers/index.cjs +10 -10
- package/dist/providers/index.d.cts +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +10 -10
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/recipes/index.cjs +2 -2
- package/dist/recipes/index.d.cts +10 -1
- package/dist/recipes/index.d.ts +10 -1
- package/dist/recipes/index.js +2 -2
- package/dist/recipes/metafile-cjs.json +1 -1
- package/dist/recipes/metafile-esm.json +1 -1
- package/dist/research/index.cjs +3 -3
- package/dist/research/index.d.cts +86 -6
- package/dist/research/index.d.ts +86 -6
- package/dist/research/index.js +3 -3
- package/dist/research/metafile-cjs.json +1 -1
- package/dist/research/metafile-esm.json +1 -1
- package/dist/session/index.cjs +20 -20
- package/dist/session/index.js +21 -21
- package/dist/session/metafile-cjs.json +1 -1
- package/dist/session/metafile-esm.json +1 -1
- package/dist/utils/index.cjs +20 -20
- package/dist/utils/index.d.cts +3 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +17 -17
- package/dist/utils/metafile-cjs.json +1 -1
- package/dist/utils/metafile-esm.json +1 -1
- package/package.json +23 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,{encoding:"utf8",flag:"wx"})}function Ie(n,e){let t=
|
|
3
|
-
`,"utf8"),f}finally{s.release()}}read(e){return
|
|
4
|
-
`,"utf8"),(0,d.renameSync)(t,n)}function
|
|
5
|
-
`,"utf8"),(0,c.renameSync)(t,n)}var
|
|
6
|
-
`,"utf8"),i}readEvents(e){let t=this.eventsPath(e);return(0,c.existsSync)(t)?(0,c.readFileSync)(t,"utf8").split(/\r?\n/).filter(Boolean).flatMap(r=>{try{return[JSON.parse(r)]}catch{return[]}}):[]}writeRun(e){
|
|
7
|
-
`,"utf8"),t}query(e={}){return(0,v.existsSync)(this.path)?(0,v.readFileSync)(this.path,"utf8").split(/\r?\n/).filter(Boolean).flatMap(t=>{try{let r=JSON.parse(t);return
|
|
1
|
+
"use strict";var L=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var ke=(n,e)=>{for(var t in e)L(n,t,{get:e[t],enumerable:!0})},Ae=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of we(e))!ve.call(n,o)&&o!==t&&L(n,o,{get:()=>e[o],enumerable:!(r=Re(e,o))||r.enumerable});return n};var ye=n=>Ae(L({},"__esModule",{value:!0}),n);var Je={};ke(Je,{AGENT_DAEMON_PROTOCOL_VERSION:()=>S,AgentDaemonClient:()=>G,AgentDaemonServer:()=>B,AgentEventStore:()=>P,AgentRunController:()=>z,AgentRunStore:()=>T,MonitorManager:()=>K,MonitorStopTool:()=>ee,MonitorTool:()=>Y,OtelExporter:()=>re,UsageAccumulator:()=>N,UsageLedger:()=>te,WorkflowPlanner:()=>E,WorkflowRuntime:()=>Z,WorkflowStore:()=>M,acquireControlPlaneLock:()=>I,createAgentRunId:()=>pe,getAgentRunDir:()=>Le,getAgentRunStoreDir:()=>$e});module.exports=ye(Je);var le=require("node:crypto"),d=require("node:fs"),u=require("node:path");var x="0.9.10";var h=require("node:fs"),F=require("node:os"),se=require("node:path");function Se(){return new Date().toISOString()}function Ee(){return new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString()}function ie(n){try{return JSON.parse((0,h.readFileSync)(n,"utf8"))}catch{return null}}function De(n){if(!n||n<=0)return!1;try{return process.kill(n,0),!0}catch{return!1}}function xe(n){return n.hostname!==(0,F.hostname)()?!0:De(n.pid)}function oe(n,e){(0,h.mkdirSync)((0,se.dirname)(n),{recursive:!0}),(0,h.writeFileSync)(n,JSON.stringify(e,null,2)+`
|
|
2
|
+
`,{encoding:"utf8",flag:"wx"})}function Ie(n,e){let t=ie(n);t?.pid!==e.pid||t.hostname!==e.hostname||(0,h.rmSync)(n,{force:!0})}function I(n,e,t){let r=Se(),o={schemaVersion:1,name:e,pid:process.pid,hostname:(0,F.hostname)(),processStartedAt:Ee(),version:t,acquiredAt:r,updatedAt:r};try{oe(n,o)}catch(i){if(i.code!=="EEXIST")throw i;let a=ie(n);if(a&&xe(a))throw new Error(`${e} is already locked by PID ${a.pid} on ${a.hostname}.`);(0,h.rmSync)(n,{force:!0}),oe(n,o)}return{record:o,release:()=>{Ie(n,o)}}}var de=require("node:crypto"),R=require("node:fs"),A=require("node:path");function ae(n){return(0,A.basename)(n).replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,96)}function ue(n){return(0,R.existsSync)(n)?(0,R.readFileSync)(n,"utf8").split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null):[]}var P=class{constructor(e){this.runsDir=e;(0,R.mkdirSync)(this.runsDir,{recursive:!0})}runsDir;pathFor(e){return(0,A.join)(this.runsDir,ae(e),"events.jsonl")}append(e,t,r={},o=new Date().toISOString()){let i=this.pathFor(e);(0,R.mkdirSync)((0,A.dirname)(i),{recursive:!0});let s=I(`${i}.lock`,`events:${ae(e)}`,x);try{let a=ue(i).reduce((W,m,b)=>Math.max(W,m.sequence??b),-1)+1,f={schemaVersion:1,eventId:`event_${(0,de.randomUUID)()}`,sequence:a,runId:e,type:t,timestamp:o,payload:r};return(0,R.appendFileSync)(i,`${JSON.stringify(f)}
|
|
3
|
+
`,"utf8"),f}finally{s.release()}}read(e){return ue(this.pathFor(e))}tail(e,t=100){let r=Math.max(0,Math.min(1e4,Math.trunc(t)));return r===0?[]:this.read(e).slice(-r)}};var k=require("node:os");var j=require("node:path"),Ze=(0,k.platform)();var Ke=(0,k.release)(),Ye=(0,k.homedir)();function y(){let n=process.env.XENO_AGENT_HOME?.trim();return n?(0,j.resolve)(n):(0,j.resolve)((0,k.homedir)(),".xeno-agent")}var Pe=1,Te=(0,u.join)(y(),"daemon"),H=(0,u.join)(Te,"runs");function p(){return new Date().toISOString()}function be(n=new Date){return n.toISOString().replace(/[^0-9]/g,"").slice(0,14)}function J(n){return n.replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,80)}function q(n){return(0,u.resolve)(n)}function C(n){return q(n).toLowerCase()}function ce(n,e){let t=C(n),r=C(e);return t===r||t.startsWith(`${r}\\`)||t.startsWith(`${r}/`)}function Oe(n,e){return!!(C(n.cwd)===C(e)||n.git?.root&&ce(e,n.git.root)||n.git?.worktree&&ce(e,n.git.worktree))}function Ce(n){return J(Buffer.from(q(n)).toString("base64url"))}function _e(){return{input:0,output:0,total:0}}function O(n){try{return JSON.parse((0,d.readFileSync)(n,"utf8"))}catch{return null}}function Ue(n){return n instanceof Error&&/\balready locked by PID\b/.test(n.message)}function Me(n,e){(0,d.mkdirSync)((0,u.dirname)(n),{recursive:!0});let t=`${n}.${process.pid}.${Date.now()}.tmp`;(0,d.writeFileSync)(t,JSON.stringify(e,null,2)+`
|
|
4
|
+
`,"utf8"),(0,d.renameSync)(t,n)}function Ne(n){if(!n||n<=0)return!1;try{return process.kill(n,0),!0}catch{return!1}}function Ve(n){return n==="completed"||n==="failed"||n==="cancelled"||n==="interrupted"}function We(n,e){return n.pinned!==e.pinned?n.pinned?-1:1:Date.parse(e.updatedAt)-Date.parse(n.updatedAt)}function $e(){return H}function Le(n){return(0,u.join)(H,n)}function pe(n=new Date){return`run_${be(n)}_${(0,le.randomUUID)().slice(0,8)}`}var T=class{constructor(e=H){this.runsDir=e;(0,d.mkdirSync)(this.runsDir,{recursive:!0}),this.eventStore=new P(this.runsDir)}runsDir;eventStore;create(e){let t=pe(),r=(0,u.join)(this.runsDir,t);(0,d.mkdirSync)(r,{recursive:!0});let o=p(),i=(0,u.join)(r,"events.jsonl"),s={schemaVersion:Pe,runId:t,sessionId:t,rootRunId:t,cwd:q(e.cwd),workspaceId:Ce(e.cwd),prompt:e.prompt,...e.title?{title:e.title}:{},status:"starting",model:e.model,...e.effort?{effort:e.effort}:{},...e.agent?{agent:e.agent}:{},...e.git?{git:e.git}:{},permissionMode:e.permissionMode,...e.cliVersion?{createdByCliVersion:e.cliVersion}:{},createdBySdkVersion:e.sdkVersion??x,createdAt:o,updatedAt:o,lastActivityAt:o,pinned:!!e.pinned,attachedClients:0,...e.cliVersion?{cliVersion:e.cliVersion}:{},...e.sdkVersion?{sdkVersion:e.sdkVersion}:{},stdoutPath:(0,u.join)(r,"stdout.log"),stderrPath:(0,u.join)(r,"stderr.log"),eventsPath:i,usage:_e(),children:[],tags:[]};return(0,d.writeFileSync)(s.stdoutPath,"","utf8"),(0,d.writeFileSync)(s.stderrPath,"","utf8"),(0,d.writeFileSync)(s.eventsPath,"","utf8"),this.write(s),this.appendEvent(t,"run_created",{cwd:s.cwd,model:s.model,...s.agent?{agent:s.agent}:{},...s.git?{git:s.git}:{},permissionMode:s.permissionMode,pinned:s.pinned}),s}get(e){let t=O(this.recordPath(e));return t?this.refreshRecordStatus(t):null}list(e={}){if(!(0,d.existsSync)(this.runsDir))return[];let t=(0,d.readdirSync)(this.runsDir,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>{try{return this.get(r.name)}catch(o){if(Ue(o))return O(this.recordPath(r.name));throw o}}).filter(r=>r!==null).filter(r=>e.all||!e.cwd||Oe(r,e.cwd)).filter(r=>!e.status||e.status.includes(r.status)).sort(We);return typeof e.limit=="number"&&e.limit>0?t.slice(0,e.limit):t}markSpawned(e,t,r){return this.update(e,o=>({...o,status:"running",workerPid:t,...r?{workerVersion:r}:{},startedAt:o.startedAt??p(),lastActivityAt:p()}))}markStarted(e,t){return this.update(e,r=>({...r,status:"running",workerPid:t.pid,...t.workerVersion?{workerVersion:t.workerVersion}:{},...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},startedAt:r.startedAt??p(),lastActivityAt:p()}))}markCompleted(e,t){return this.update(e,r=>({...r,status:t.status,...t.statusReason?{statusReason:t.statusReason}:{},exitCode:t.exitCode??null,usage:t.usage??r.usage,endedAt:p(),lastActivityAt:p()}))}markCancelled(e,t){return this.update(e,r=>({...r,status:"cancelled",statusReason:t,endedAt:p(),lastActivityAt:p()}))}markPaused(e,t="Paused by user."){let r=this.update(e,o=>({...o,status:"paused",statusReason:t,lastActivityAt:p()}));return r&&this.appendEvent(e,"run_paused",{reason:t}),r}markResumed(e,t="Resumed by user."){let r=this.update(e,o=>{let i={...o,status:"running",statusReason:t,lastActivityAt:p()};return delete i.endedAt,delete i.exitCode,i});return r&&this.appendEvent(e,"run_resumed",{reason:t}),r}setPinned(e,t){let r=this.update(e,o=>({...o,pinned:t,lastActivityAt:p()}));return r&&this.appendEvent(e,t?"run_pinned":"run_unpinned",{pinned:t}),r}appendEvent(e,t,r={}){let o=O(this.recordPath(e)),i=this.eventStore.append(e,t,r);o&&this.update(e,s=>({...s,lastActivityAt:i.timestamp}))}readEvents(e){return this.get(e)?this.eventStore.read(e):[]}delete(e){(0,d.rmSync)((0,u.join)(this.runsDir,e),{recursive:!0,force:!0})}refreshRecordStatus(e){if(Ve(e.status))return e;if(e.workerPid&&!Ne(e.workerPid)){let t={...e,status:"failed",statusReason:"Worker process is no longer running and did not record a terminal status.",endedAt:e.endedAt??p(),updatedAt:p()};return this.write(t),t}return e}update(e,t){let r=O(this.recordPath(e));if(!r)return null;let o=t(r);return o.updatedAt=p(),this.write(o),o}write(e){let t=I((0,u.join)(this.runDir(e.runId),"run.lock"),`run:${e.runId}`,x);try{Me(this.recordPath(e.runId),e)}finally{t.release()}}recordPath(e){return(0,u.join)(this.runsDir,J((0,u.basename)(e)),"run.json")}runDir(e){return(0,u.join)(this.runsDir,J((0,u.basename)(e)))}};function ge(n){return n==="completed"||n==="failed"||n==="cancelled"||n==="interrupted"}var z=class{constructor(e={}){this.options=e;this.store=e.store??new T}options;store;create(e){return this.store.create(e)}async start(e){let t=this.create(e);if(!this.options.spawn)return t;try{let r=await this.options.spawn(t),o=this.store.markSpawned(t.runId,r.pid,r.workerVersion);if(!o)throw new Error(`Run disappeared during spawn: ${t.runId}`);return this.store.appendEvent(t.runId,"run_started",{pid:r.pid}),o}catch(r){let o=r instanceof Error?r.message:String(r);throw this.store.markCompleted(t.runId,{status:"failed",statusReason:o,exitCode:null}),this.store.appendEvent(t.runId,"run_start_failed",{reason:o}),r}}get(e){return this.store.get(e)}list(e={}){return this.store.list(e)}events(e,t){let r=this.store.readEvents(e);return t===void 0?r:r.slice(-Math.max(0,Math.trunc(t)))}async stop(e,t="Stopped by user."){let r=this.store.get(e);if(!r||ge(r.status))return r;await this.options.stop?.(r,t);let o=this.store.markCancelled(e,t);return o&&this.store.appendEvent(e,"run_cancelled",{reason:t}),o}async pause(e,t="Paused by user."){let r=this.store.get(e);return!r||ge(r.status)||r.status==="paused"?r:(await this.options.pause?.(r,t),this.store.markPaused(e,t))}async resume(e,t="Resumed by user."){let r=this.store.get(e);return!r||r.status!=="paused"?r:(await this.options.resume?.(r,t),this.store.markResumed(e,t))}complete(e,t,r={}){let o=this.store.markCompleted(e,{status:t,...r.reason?{statusReason:r.reason}:{},...r.exitCode!==void 0?{exitCode:r.exitCode}:{},...r.usage?{usage:r.usage}:{}});return o&&this.store.appendEvent(e,`run_${t}`,{...r.reason?{reason:r.reason}:{}}),o}};var _=require("node:crypto"),S=1;function Fe(n,e){if(!n)return!1;let t=Buffer.from(n),r=Buffer.from(e);return t.length===r.length&&(0,_.timingSafeEqual)(t,r)}var B=class{constructor(e={}){this.options=e}options;handlers=new Map;register(e,t){let r=e.trim();if(!r)throw new Error("Daemon method name cannot be empty.");if(this.handlers.has(r))throw new Error(`Daemon method already registered: ${r}`);return this.handlers.set(r,t),this}registerController(e){return this.register("runs.start",t=>e.start(t)).register("runs.get",t=>e.get(t.runId)).register("runs.list",t=>e.list(t??{})).register("runs.events",t=>{let r=t;return e.events(r.runId,r.limit)}).register("runs.stop",t=>{let r=t;return e.stop(r.runId,r.reason)}).register("runs.pause",t=>{let r=t;return e.pause(r.runId,r.reason)}).register("runs.resume",t=>{let r=t;return e.resume(r.runId,r.reason)})}async handle(e){if(e.protocolVersion!==S)return this.error(e.id,"PROTOCOL_MISMATCH",`Unsupported protocol version: ${e.protocolVersion}`);if(this.options.authToken&&!Fe(e.authToken,this.options.authToken))return this.error(e.id,"UNAUTHORIZED","Daemon authentication failed.");let t=this.handlers.get(e.method);if(!t)return this.error(e.id,"METHOD_NOT_FOUND",`Unknown daemon method: ${e.method}`);try{return{protocolVersion:S,id:e.id,result:await t(e.params,e)}}catch(r){return this.error(e.id,"INTERNAL_ERROR",r instanceof Error?r.message:String(r))}}error(e,t,r){return{protocolVersion:S,id:e,error:{code:t,message:r}}}},G=class{constructor(e,t={}){this.transport=e;this.options=t}transport;options;async request(e,t){let r={protocolVersion:S,id:`request_${(0,_.randomUUID)()}`,method:e,params:t,...this.options.authToken?{authToken:this.options.authToken}:{}},o=await this.transport(r);if(o.protocolVersion!==S||o.id!==r.id)throw new Error("Invalid daemon response identity.");if("error"in o){let i=new Error(o.error.message);throw i.code=o.error.code,i}return o.result}};var X=require("node:crypto"),c=require("node:fs"),g=require("node:path");function U(n){return(0,g.basename)(n).replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,96)}function Q(n){try{return JSON.parse((0,c.readFileSync)(n,"utf8"))}catch{return null}}function me(n,e){(0,c.mkdirSync)((0,g.dirname)(n),{recursive:!0});let t=`${n}.${process.pid}.${Date.now()}.tmp`;(0,c.writeFileSync)(t,`${JSON.stringify(e,null,2)}
|
|
5
|
+
`,"utf8"),(0,c.renameSync)(t,n)}var E=class{plan(e){if(e.schemaVersion!==1)throw new Error("Unsupported workflow schema version.");if(!e.id.trim()||!e.name.trim())throw new Error("Workflow id and name are required.");let t=new Map;for(let s of e.nodes){if(!s.id.trim())throw new Error("Workflow node id cannot be empty.");if(t.has(s.id))throw new Error(`Duplicate workflow node: ${s.id}`);t.set(s.id,s)}for(let s of e.nodes)for(let a of s.dependsOn??[]){if(!t.has(a))throw new Error(`Workflow node ${s.id} depends on unknown node ${a}.`);if(a===s.id)throw new Error(`Workflow node ${s.id} cannot depend on itself.`)}let r=new Set(t.keys()),o=new Set,i=[];for(;r.size>0;){let s=[...r].filter(a=>(t.get(a)?.dependsOn??[]).every(f=>o.has(f))).sort();if(s.length===0)throw new Error("Workflow dependency graph contains a cycle.");i.push(s);for(let a of s)r.delete(a),o.add(a)}return{workflowId:e.id,waves:i}}},M=class{constructor(e=(0,g.join)(y(),"workflows")){this.rootDir=e;(0,c.mkdirSync)(this.definitionsDir(),{recursive:!0}),(0,c.mkdirSync)(this.runsDir(),{recursive:!0})}rootDir;saveDefinition(e){return new E().plan(e),me((0,g.join)(this.definitionsDir(),`${U(e.id)}.json`),e),e}getDefinition(e){return Q((0,g.join)(this.definitionsDir(),`${U(e)}.json`))}listDefinitions(){return(0,c.readdirSync)(this.definitionsDir(),{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".json")).map(e=>Q((0,g.join)(this.definitionsDir(),e.name))).filter(e=>e!==null)}createRun(e){new E().plan(e);let t=new Date().toISOString(),r={schemaVersion:1,runId:`workflow_run_${(0,X.randomUUID)()}`,workflowId:e.id,status:"queued",createdAt:t,updatedAt:t,nodes:Object.fromEntries(e.nodes.map(o=>[o.id,{status:"pending"}]))};return this.writeRun(r),this.appendEvent(r.runId,"workflow_created",{}),r}getRun(e){return Q(this.runPath(e))}updateRun(e,t){let r=this.getRun(e);if(!r)throw new Error(`Workflow run not found: ${e}`);let o=t(r);return o.updatedAt=new Date().toISOString(),this.writeRun(o),o}appendEvent(e,t,r,o){let i={schemaVersion:1,eventId:`workflow_event_${(0,X.randomUUID)()}`,runId:e,type:t,timestamp:new Date().toISOString(),...o?{nodeId:o}:{},payload:r},s=this.eventsPath(e);return(0,c.mkdirSync)((0,g.dirname)(s),{recursive:!0}),(0,c.appendFileSync)(s,`${JSON.stringify(i)}
|
|
6
|
+
`,"utf8"),i}readEvents(e){let t=this.eventsPath(e);return(0,c.existsSync)(t)?(0,c.readFileSync)(t,"utf8").split(/\r?\n/).filter(Boolean).flatMap(r=>{try{return[JSON.parse(r)]}catch{return[]}}):[]}writeRun(e){me(this.runPath(e.runId),e)}definitionsDir(){return(0,g.join)(this.rootDir,"definitions")}runsDir(){return(0,g.join)(this.rootDir,"runs")}runPath(e){return(0,g.join)(this.runsDir(),U(e),"run.json")}eventsPath(e){return(0,g.join)(this.runsDir(),U(e),"events.jsonl")}},Z=class{constructor(e=new M,t=new E){this.store=e;this.planner=t}store;planner;async run(e,t){let r=this.planner.plan(e),o=this.store.createRun(e);o=this.store.updateRun(o.runId,a=>({...a,status:"running"})),this.store.appendEvent(o.runId,"workflow_started",{waves:r.waves.length});let i=Math.max(1,Math.trunc(e.maxConcurrency??4)),s=!1;for(let a of r.waves)for(let f=0;f<a.length;f+=i){let W=a.slice(f,f+i);await Promise.all(W.map(async m=>{let b=e.nodes.find(l=>l.id===m);if((b.dependsOn??[]).some(l=>this.store.getRun(o.runId)?.nodes[l]?.status!=="completed")||s&&e.failFast!==!1){this.store.updateRun(o.runId,l=>({...l,nodes:{...l.nodes,[m]:{status:"skipped",completedAt:new Date().toISOString()}}})),this.store.appendEvent(o.runId,"node_skipped",{},m);return}let $=new Date().toISOString();o=this.store.updateRun(o.runId,l=>({...l,nodes:{...l.nodes,[m]:{status:"running",startedAt:$}}})),this.store.appendEvent(o.runId,"node_started",{},m);try{let l=await t(b,{run:o,definition:e});this.store.updateRun(o.runId,D=>({...D,nodes:{...D.nodes,[m]:{status:"completed",startedAt:$,completedAt:new Date().toISOString(),output:l}}})),this.store.appendEvent(o.runId,"node_completed",{},m)}catch(l){s=!0;let D=l instanceof Error?l.message:String(l);this.store.updateRun(o.runId,ne=>({...ne,nodes:{...ne.nodes,[m]:{status:"failed",startedAt:$,completedAt:new Date().toISOString(),error:D}}})),this.store.appendEvent(o.runId,"node_failed",{error:D},m)}}))}return o=this.store.updateRun(o.runId,a=>({...a,status:s?"failed":"completed",completedAt:new Date().toISOString()})),this.store.appendEvent(o.runId,s?"workflow_failed":"workflow_completed",{}),o}};var fe=require("node:crypto"),K=class{constructor(e=1e4){this.maxEvents=e;if(!Number.isInteger(e)||e<1)throw new Error("maxEvents must be a positive integer.")}maxEvents;sources=new Map;events=[];register(e){if(!e.id.trim())throw new Error("Monitor source id cannot be empty.");if(this.sources.has(e.id))throw new Error(`Monitor source already registered: ${e.id}`);return this.sources.set(e.id,{source:e,running:!1}),this}async start(e,t=1e3){let r=this.require(e);if(r.running)return this.snapshot(e);await r.source.start?.(),r.running=!0,await this.poll(e);let o=Math.max(25,Math.trunc(t));return r.timer=setInterval(()=>{this.poll(e).catch(()=>{})},o),r.timer.unref?.(),this.snapshot(e)}async poll(e){let o=(await this.require(e).source.poll()).map(i=>({schemaVersion:1,eventId:`monitor_event_${(0,fe.randomUUID)()}`,sourceId:e,type:i.type,timestamp:i.timestamp??new Date().toISOString(),payload:i.payload}));return this.events.push(...o),this.events.length>this.maxEvents&&this.events.splice(0,this.events.length-this.maxEvents),o}async stop(e){let t=this.require(e);return t.timer&&clearInterval(t.timer),t.timer=void 0,t.running&&await t.source.stop?.(),t.running=!1,this.snapshot(e)}async stopAll(){await Promise.all([...this.sources.keys()].map(e=>this.stop(e)))}snapshot(e,t=100){let r=this.require(e);return{sourceId:e,running:r.running,events:this.events.filter(o=>o.sourceId===e).slice(-Math.max(0,Math.trunc(t)))}}list(){return[...this.sources].map(([e,t])=>({sourceId:e,running:t.running}))}require(e){let t=this.sources.get(e);if(!t)throw new Error(`Monitor source not found: ${e}`);return t}},Y=class{constructor(e){this.manager=e}manager;execute(e){return this.manager.start(e.sourceId,e.intervalMs)}},ee=class{constructor(e){this.manager=e}manager;execute(e){return this.manager.stop(e.sourceId)}};var he=require("node:crypto"),v=require("node:fs"),V=require("node:path");function w(n){return Number.isFinite(n)?Math.max(0,n??0):0}var N=class{totalsValue={inputTokens:0,outputTokens:0,totalTokens:0,cachedInputTokens:0,estimatedCostUsd:0,events:0};add(e){let t=w(e.inputTokens),r=w(e.outputTokens);return this.totalsValue.inputTokens+=t,this.totalsValue.outputTokens+=r,this.totalsValue.totalTokens+=t+r,this.totalsValue.cachedInputTokens+=w(e.cachedInputTokens),this.totalsValue.estimatedCostUsd+=w(e.estimatedCostUsd),this.totalsValue.events+=1,this}snapshot(){return{...this.totalsValue}}};function je(n,e){if(["runId","sessionId","workflowRunId","agentId","provider","model"].some(o=>e[o]!==void 0&&n[o]!==e[o]))return!1;let r=Date.parse(n.timestamp);return!(e.from&&r<Date.parse(e.from)||e.to&&r>Date.parse(e.to))}var te=class{path;constructor(e=(0,V.join)(y(),"usage","events.jsonl")){this.path=e,(0,v.mkdirSync)((0,V.dirname)(e),{recursive:!0})}append(e){let t={...e,schemaVersion:1,eventId:`usage_${(0,he.randomUUID)()}`,timestamp:e.timestamp??new Date().toISOString(),inputTokens:w(e.inputTokens),outputTokens:w(e.outputTokens),...e.cachedInputTokens!==void 0?{cachedInputTokens:w(e.cachedInputTokens)}:{},...e.estimatedCostUsd!==void 0?{estimatedCostUsd:w(e.estimatedCostUsd)}:{}};return(0,v.appendFileSync)(this.path,`${JSON.stringify(t)}
|
|
7
|
+
`,"utf8"),t}query(e={}){return(0,v.existsSync)(this.path)?(0,v.readFileSync)(this.path,"utf8").split(/\r?\n/).filter(Boolean).flatMap(t=>{try{let r=JSON.parse(t);return je(r,e)?[r]:[]}catch{return[]}}):[]}summarize(e={}){let t=new N;for(let r of this.query(e))t.add(r);return t.snapshot()}},re=class{constructor(e){this.adapter=e}adapter;export(e){for(let t of e){let r={...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{}};this.adapter.addCounter("xeno.usage.input_tokens",t.inputTokens,r),this.adapter.addCounter("xeno.usage.output_tokens",t.outputTokens,r),t.cachedInputTokens&&this.adapter.addCounter("xeno.usage.cached_input_tokens",t.cachedInputTokens,r),t.estimatedCostUsd&&this.adapter.addCounter("xeno.usage.estimated_cost_usd",t.estimatedCostUsd,r),this.adapter.recordEvent?.("xeno.usage.recorded",r)}}};0&&(module.exports={AGENT_DAEMON_PROTOCOL_VERSION,AgentDaemonClient,AgentDaemonServer,AgentEventStore,AgentRunController,AgentRunStore,MonitorManager,MonitorStopTool,MonitorTool,OtelExporter,UsageAccumulator,UsageLedger,WorkflowPlanner,WorkflowRuntime,WorkflowStore,acquireControlPlaneLock,createAgentRunId,getAgentRunDir,getAgentRunStoreDir});
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
declare const AGENT_EFFORT_LEVELS: readonly [
|
|
2
|
+
"low",
|
|
3
|
+
"medium",
|
|
4
|
+
"high",
|
|
5
|
+
"xhigh",
|
|
6
|
+
"max"
|
|
7
|
+
];
|
|
8
|
+
declare const AGENT_PERMISSION_MODES: readonly [
|
|
9
|
+
"default",
|
|
10
|
+
"plan",
|
|
11
|
+
"acceptEdits",
|
|
12
|
+
"auto",
|
|
13
|
+
"dontAsk",
|
|
14
|
+
"bypassPermissions"
|
|
15
|
+
];
|
|
16
|
+
type AgentPermissionMode = (typeof AGENT_PERMISSION_MODES)[number];
|
|
17
|
+
type AgentEffortLevel = (typeof AGENT_EFFORT_LEVELS)[number];
|
|
1
18
|
type AgentRunStatus = "queued" | "starting" | "running" | "blocked" | "waiting_for_user" | "waiting_for_tool" | "waiting_for_hook" | "waiting_for_permission" | "paused" | "completed" | "failed" | "cancelled" | "interrupted" | "detached";
|
|
2
19
|
interface AgentRunUsage {
|
|
3
20
|
input: number;
|
|
@@ -26,9 +43,9 @@ interface AgentRunRecord {
|
|
|
26
43
|
statusReason?: string;
|
|
27
44
|
blockedReason?: string;
|
|
28
45
|
model: string;
|
|
29
|
-
effort?:
|
|
46
|
+
effort?: AgentEffortLevel;
|
|
30
47
|
agent?: AgentRunAgentDefinitionRef;
|
|
31
|
-
permissionMode:
|
|
48
|
+
permissionMode: AgentPermissionMode;
|
|
32
49
|
createdByCliVersion?: string;
|
|
33
50
|
createdBySdkVersion?: string;
|
|
34
51
|
createdAt: string;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
declare const AGENT_EFFORT_LEVELS: readonly [
|
|
2
|
+
"low",
|
|
3
|
+
"medium",
|
|
4
|
+
"high",
|
|
5
|
+
"xhigh",
|
|
6
|
+
"max"
|
|
7
|
+
];
|
|
8
|
+
declare const AGENT_PERMISSION_MODES: readonly [
|
|
9
|
+
"default",
|
|
10
|
+
"plan",
|
|
11
|
+
"acceptEdits",
|
|
12
|
+
"auto",
|
|
13
|
+
"dontAsk",
|
|
14
|
+
"bypassPermissions"
|
|
15
|
+
];
|
|
16
|
+
type AgentPermissionMode = (typeof AGENT_PERMISSION_MODES)[number];
|
|
17
|
+
type AgentEffortLevel = (typeof AGENT_EFFORT_LEVELS)[number];
|
|
1
18
|
type AgentRunStatus = "queued" | "starting" | "running" | "blocked" | "waiting_for_user" | "waiting_for_tool" | "waiting_for_hook" | "waiting_for_permission" | "paused" | "completed" | "failed" | "cancelled" | "interrupted" | "detached";
|
|
2
19
|
interface AgentRunUsage {
|
|
3
20
|
input: number;
|
|
@@ -26,9 +43,9 @@ interface AgentRunRecord {
|
|
|
26
43
|
statusReason?: string;
|
|
27
44
|
blockedReason?: string;
|
|
28
45
|
model: string;
|
|
29
|
-
effort?:
|
|
46
|
+
effort?: AgentEffortLevel;
|
|
30
47
|
agent?: AgentRunAgentDefinitionRef;
|
|
31
|
-
permissionMode:
|
|
48
|
+
permissionMode: AgentPermissionMode;
|
|
32
49
|
createdByCliVersion?: string;
|
|
33
50
|
createdBySdkVersion?: string;
|
|
34
51
|
createdAt: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{randomUUID as
|
|
2
|
-
`,{encoding:"utf8",flag:"wx"})}function
|
|
3
|
-
`,"utf8"),p}finally{s.release()}}read(e){return q(this.pathFor(e))}tail(e,t=100){let r=Math.max(0,Math.min(1e4,Math.trunc(t)));return r===0?[]:this.read(e).slice(-r)}};var
|
|
4
|
-
`,"utf8"),
|
|
5
|
-
`,"utf8"),
|
|
6
|
-
`,"utf8"),i}readEvents(e){let t=this.eventsPath(e);return
|
|
7
|
-
`,"utf8"),t}query(e={}){return
|
|
1
|
+
import{randomUUID as Pe}from"node:crypto";import{existsSync as Te,mkdirSync as O,readFileSync as be,readdirSync as Oe,renameSync as Ce,rmSync as _e,writeFileSync as E}from"node:fs";import{basename as G,dirname as Ue,join as l,resolve as Me}from"node:path";var R="0.9.10";import{mkdirSync as ce,readFileSync as le,rmSync as L,writeFileSync as pe}from"node:fs";import{hostname as F}from"node:os";import{dirname as ge}from"node:path";function me(){return new Date().toISOString()}function fe(){return new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString()}function j(n){try{return JSON.parse(le(n,"utf8"))}catch{return null}}function he(n){if(!n||n<=0)return!1;try{return process.kill(n,0),!0}catch{return!1}}function Re(n){return n.hostname!==F()?!0:he(n.pid)}function $(n,e){ce(ge(n),{recursive:!0}),pe(n,JSON.stringify(e,null,2)+`
|
|
2
|
+
`,{encoding:"utf8",flag:"wx"})}function we(n,e){let t=j(n);t?.pid!==e.pid||t.hostname!==e.hostname||L(n,{force:!0})}function A(n,e,t){let r=me(),o={schemaVersion:1,name:e,pid:process.pid,hostname:F(),processStartedAt:fe(),version:t,acquiredAt:r,updatedAt:r};try{$(n,o)}catch(i){if(i.code!=="EEXIST")throw i;let a=j(n);if(a&&Re(a))throw new Error(`${e} is already locked by PID ${a.pid} on ${a.hostname}.`);L(n,{force:!0}),$(n,o)}return{record:o,release:()=>{we(n,o)}}}import{randomUUID as ve}from"node:crypto";import{appendFileSync as ke,existsSync as Ae,mkdirSync as J,readFileSync as ye}from"node:fs";import{basename as Se,dirname as Ee,join as De}from"node:path";function H(n){return Se(n).replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,96)}function q(n){return Ae(n)?ye(n,"utf8").split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null):[]}var y=class{constructor(e){this.runsDir=e;J(this.runsDir,{recursive:!0})}runsDir;pathFor(e){return De(this.runsDir,H(e),"events.jsonl")}append(e,t,r={},o=new Date().toISOString()){let i=this.pathFor(e);J(Ee(i),{recursive:!0});let s=A(`${i}.lock`,`events:${H(e)}`,R);try{let a=q(i).reduce((T,c,k)=>Math.max(T,c.sequence??k),-1)+1,p={schemaVersion:1,eventId:`event_${ve()}`,sequence:a,runId:e,type:t,timestamp:o,payload:r};return ke(i,`${JSON.stringify(p)}
|
|
3
|
+
`,"utf8"),p}finally{s.release()}}read(e){return q(this.pathFor(e))}tail(e,t=100){let r=Math.max(0,Math.min(1e4,Math.trunc(t)));return r===0?[]:this.read(e).slice(-r)}};import{homedir as B,platform as xe,release as Ie}from"node:os";import{resolve as z}from"node:path";var xt=xe();var It=Ie(),Pt=B();function f(){let n=process.env.XENO_AGENT_HOME?.trim();return n?z(n):z(B(),".xeno-agent")}var Ne=1,Ve=l(f(),"daemon"),_=l(Ve,"runs");function d(){return new Date().toISOString()}function We(n=new Date){return n.toISOString().replace(/[^0-9]/g,"").slice(0,14)}function C(n){return n.replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,80)}function U(n){return Me(n)}function D(n){return U(n).toLowerCase()}function Q(n,e){let t=D(n),r=D(e);return t===r||t.startsWith(`${r}\\`)||t.startsWith(`${r}/`)}function $e(n,e){return!!(D(n.cwd)===D(e)||n.git?.root&&Q(e,n.git.root)||n.git?.worktree&&Q(e,n.git.worktree))}function Le(n){return C(Buffer.from(U(n)).toString("base64url"))}function Fe(){return{input:0,output:0,total:0}}function S(n){try{return JSON.parse(be(n,"utf8"))}catch{return null}}function je(n){return n instanceof Error&&/\balready locked by PID\b/.test(n.message)}function Je(n,e){O(Ue(n),{recursive:!0});let t=`${n}.${process.pid}.${Date.now()}.tmp`;E(t,JSON.stringify(e,null,2)+`
|
|
4
|
+
`,"utf8"),Ce(t,n)}function He(n){if(!n||n<=0)return!1;try{return process.kill(n,0),!0}catch{return!1}}function qe(n){return n==="completed"||n==="failed"||n==="cancelled"||n==="interrupted"}function ze(n,e){return n.pinned!==e.pinned?n.pinned?-1:1:Date.parse(e.updatedAt)-Date.parse(n.updatedAt)}function Vt(){return _}function Wt(n){return l(_,n)}function Be(n=new Date){return`run_${We(n)}_${Pe().slice(0,8)}`}var x=class{constructor(e=_){this.runsDir=e;O(this.runsDir,{recursive:!0}),this.eventStore=new y(this.runsDir)}runsDir;eventStore;create(e){let t=Be(),r=l(this.runsDir,t);O(r,{recursive:!0});let o=d(),i=l(r,"events.jsonl"),s={schemaVersion:Ne,runId:t,sessionId:t,rootRunId:t,cwd:U(e.cwd),workspaceId:Le(e.cwd),prompt:e.prompt,...e.title?{title:e.title}:{},status:"starting",model:e.model,...e.effort?{effort:e.effort}:{},...e.agent?{agent:e.agent}:{},...e.git?{git:e.git}:{},permissionMode:e.permissionMode,...e.cliVersion?{createdByCliVersion:e.cliVersion}:{},createdBySdkVersion:e.sdkVersion??R,createdAt:o,updatedAt:o,lastActivityAt:o,pinned:!!e.pinned,attachedClients:0,...e.cliVersion?{cliVersion:e.cliVersion}:{},...e.sdkVersion?{sdkVersion:e.sdkVersion}:{},stdoutPath:l(r,"stdout.log"),stderrPath:l(r,"stderr.log"),eventsPath:i,usage:Fe(),children:[],tags:[]};return E(s.stdoutPath,"","utf8"),E(s.stderrPath,"","utf8"),E(s.eventsPath,"","utf8"),this.write(s),this.appendEvent(t,"run_created",{cwd:s.cwd,model:s.model,...s.agent?{agent:s.agent}:{},...s.git?{git:s.git}:{},permissionMode:s.permissionMode,pinned:s.pinned}),s}get(e){let t=S(this.recordPath(e));return t?this.refreshRecordStatus(t):null}list(e={}){if(!Te(this.runsDir))return[];let t=Oe(this.runsDir,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>{try{return this.get(r.name)}catch(o){if(je(o))return S(this.recordPath(r.name));throw o}}).filter(r=>r!==null).filter(r=>e.all||!e.cwd||$e(r,e.cwd)).filter(r=>!e.status||e.status.includes(r.status)).sort(ze);return typeof e.limit=="number"&&e.limit>0?t.slice(0,e.limit):t}markSpawned(e,t,r){return this.update(e,o=>({...o,status:"running",workerPid:t,...r?{workerVersion:r}:{},startedAt:o.startedAt??d(),lastActivityAt:d()}))}markStarted(e,t){return this.update(e,r=>({...r,status:"running",workerPid:t.pid,...t.workerVersion?{workerVersion:t.workerVersion}:{},...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},startedAt:r.startedAt??d(),lastActivityAt:d()}))}markCompleted(e,t){return this.update(e,r=>({...r,status:t.status,...t.statusReason?{statusReason:t.statusReason}:{},exitCode:t.exitCode??null,usage:t.usage??r.usage,endedAt:d(),lastActivityAt:d()}))}markCancelled(e,t){return this.update(e,r=>({...r,status:"cancelled",statusReason:t,endedAt:d(),lastActivityAt:d()}))}markPaused(e,t="Paused by user."){let r=this.update(e,o=>({...o,status:"paused",statusReason:t,lastActivityAt:d()}));return r&&this.appendEvent(e,"run_paused",{reason:t}),r}markResumed(e,t="Resumed by user."){let r=this.update(e,o=>{let i={...o,status:"running",statusReason:t,lastActivityAt:d()};return delete i.endedAt,delete i.exitCode,i});return r&&this.appendEvent(e,"run_resumed",{reason:t}),r}setPinned(e,t){let r=this.update(e,o=>({...o,pinned:t,lastActivityAt:d()}));return r&&this.appendEvent(e,t?"run_pinned":"run_unpinned",{pinned:t}),r}appendEvent(e,t,r={}){let o=S(this.recordPath(e)),i=this.eventStore.append(e,t,r);o&&this.update(e,s=>({...s,lastActivityAt:i.timestamp}))}readEvents(e){return this.get(e)?this.eventStore.read(e):[]}delete(e){_e(l(this.runsDir,e),{recursive:!0,force:!0})}refreshRecordStatus(e){if(qe(e.status))return e;if(e.workerPid&&!He(e.workerPid)){let t={...e,status:"failed",statusReason:"Worker process is no longer running and did not record a terminal status.",endedAt:e.endedAt??d(),updatedAt:d()};return this.write(t),t}return e}update(e,t){let r=S(this.recordPath(e));if(!r)return null;let o=t(r);return o.updatedAt=d(),this.write(o),o}write(e){let t=A(l(this.runDir(e.runId),"run.lock"),`run:${e.runId}`,R);try{Je(this.recordPath(e.runId),e)}finally{t.release()}}recordPath(e){return l(this.runsDir,C(G(e)),"run.json")}runDir(e){return l(this.runsDir,C(G(e)))}};function X(n){return n==="completed"||n==="failed"||n==="cancelled"||n==="interrupted"}var Z=class{constructor(e={}){this.options=e;this.store=e.store??new x}options;store;create(e){return this.store.create(e)}async start(e){let t=this.create(e);if(!this.options.spawn)return t;try{let r=await this.options.spawn(t),o=this.store.markSpawned(t.runId,r.pid,r.workerVersion);if(!o)throw new Error(`Run disappeared during spawn: ${t.runId}`);return this.store.appendEvent(t.runId,"run_started",{pid:r.pid}),o}catch(r){let o=r instanceof Error?r.message:String(r);throw this.store.markCompleted(t.runId,{status:"failed",statusReason:o,exitCode:null}),this.store.appendEvent(t.runId,"run_start_failed",{reason:o}),r}}get(e){return this.store.get(e)}list(e={}){return this.store.list(e)}events(e,t){let r=this.store.readEvents(e);return t===void 0?r:r.slice(-Math.max(0,Math.trunc(t)))}async stop(e,t="Stopped by user."){let r=this.store.get(e);if(!r||X(r.status))return r;await this.options.stop?.(r,t);let o=this.store.markCancelled(e,t);return o&&this.store.appendEvent(e,"run_cancelled",{reason:t}),o}async pause(e,t="Paused by user."){let r=this.store.get(e);return!r||X(r.status)||r.status==="paused"?r:(await this.options.pause?.(r,t),this.store.markPaused(e,t))}async resume(e,t="Resumed by user."){let r=this.store.get(e);return!r||r.status!=="paused"?r:(await this.options.resume?.(r,t),this.store.markResumed(e,t))}complete(e,t,r={}){let o=this.store.markCompleted(e,{status:t,...r.reason?{statusReason:r.reason}:{},...r.exitCode!==void 0?{exitCode:r.exitCode}:{},...r.usage?{usage:r.usage}:{}});return o&&this.store.appendEvent(e,`run_${t}`,{...r.reason?{reason:r.reason}:{}}),o}};import{randomUUID as Ge,timingSafeEqual as Qe}from"node:crypto";var w=1;function Xe(n,e){if(!n)return!1;let t=Buffer.from(n),r=Buffer.from(e);return t.length===r.length&&Qe(t,r)}var K=class{constructor(e={}){this.options=e}options;handlers=new Map;register(e,t){let r=e.trim();if(!r)throw new Error("Daemon method name cannot be empty.");if(this.handlers.has(r))throw new Error(`Daemon method already registered: ${r}`);return this.handlers.set(r,t),this}registerController(e){return this.register("runs.start",t=>e.start(t)).register("runs.get",t=>e.get(t.runId)).register("runs.list",t=>e.list(t??{})).register("runs.events",t=>{let r=t;return e.events(r.runId,r.limit)}).register("runs.stop",t=>{let r=t;return e.stop(r.runId,r.reason)}).register("runs.pause",t=>{let r=t;return e.pause(r.runId,r.reason)}).register("runs.resume",t=>{let r=t;return e.resume(r.runId,r.reason)})}async handle(e){if(e.protocolVersion!==w)return this.error(e.id,"PROTOCOL_MISMATCH",`Unsupported protocol version: ${e.protocolVersion}`);if(this.options.authToken&&!Xe(e.authToken,this.options.authToken))return this.error(e.id,"UNAUTHORIZED","Daemon authentication failed.");let t=this.handlers.get(e.method);if(!t)return this.error(e.id,"METHOD_NOT_FOUND",`Unknown daemon method: ${e.method}`);try{return{protocolVersion:w,id:e.id,result:await t(e.params,e)}}catch(r){return this.error(e.id,"INTERNAL_ERROR",r instanceof Error?r.message:String(r))}}error(e,t,r){return{protocolVersion:w,id:e,error:{code:t,message:r}}}},Y=class{constructor(e,t={}){this.transport=e;this.options=t}transport;options;async request(e,t){let r={protocolVersion:w,id:`request_${Ge()}`,method:e,params:t,...this.options.authToken?{authToken:this.options.authToken}:{}},o=await this.transport(r);if(o.protocolVersion!==w||o.id!==r.id)throw new Error("Invalid daemon response identity.");if("error"in o){let i=new Error(o.error.message);throw i.code=o.error.code,i}return o.result}};import{randomUUID as ee}from"node:crypto";import{appendFileSync as Ze,existsSync as Ke,mkdirSync as P,readFileSync as ne,readdirSync as Ye,renameSync as et,writeFileSync as tt}from"node:fs";import{basename as rt,dirname as oe,join as g}from"node:path";function I(n){return rt(n).replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,96)}function M(n){try{return JSON.parse(ne(n,"utf8"))}catch{return null}}function te(n,e){P(oe(n),{recursive:!0});let t=`${n}.${process.pid}.${Date.now()}.tmp`;tt(t,`${JSON.stringify(e,null,2)}
|
|
5
|
+
`,"utf8"),et(t,n)}var v=class{plan(e){if(e.schemaVersion!==1)throw new Error("Unsupported workflow schema version.");if(!e.id.trim()||!e.name.trim())throw new Error("Workflow id and name are required.");let t=new Map;for(let s of e.nodes){if(!s.id.trim())throw new Error("Workflow node id cannot be empty.");if(t.has(s.id))throw new Error(`Duplicate workflow node: ${s.id}`);t.set(s.id,s)}for(let s of e.nodes)for(let a of s.dependsOn??[]){if(!t.has(a))throw new Error(`Workflow node ${s.id} depends on unknown node ${a}.`);if(a===s.id)throw new Error(`Workflow node ${s.id} cannot depend on itself.`)}let r=new Set(t.keys()),o=new Set,i=[];for(;r.size>0;){let s=[...r].filter(a=>(t.get(a)?.dependsOn??[]).every(p=>o.has(p))).sort();if(s.length===0)throw new Error("Workflow dependency graph contains a cycle.");i.push(s);for(let a of s)r.delete(a),o.add(a)}return{workflowId:e.id,waves:i}}},N=class{constructor(e=g(f(),"workflows")){this.rootDir=e;P(this.definitionsDir(),{recursive:!0}),P(this.runsDir(),{recursive:!0})}rootDir;saveDefinition(e){return new v().plan(e),te(g(this.definitionsDir(),`${I(e.id)}.json`),e),e}getDefinition(e){return M(g(this.definitionsDir(),`${I(e)}.json`))}listDefinitions(){return Ye(this.definitionsDir(),{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".json")).map(e=>M(g(this.definitionsDir(),e.name))).filter(e=>e!==null)}createRun(e){new v().plan(e);let t=new Date().toISOString(),r={schemaVersion:1,runId:`workflow_run_${ee()}`,workflowId:e.id,status:"queued",createdAt:t,updatedAt:t,nodes:Object.fromEntries(e.nodes.map(o=>[o.id,{status:"pending"}]))};return this.writeRun(r),this.appendEvent(r.runId,"workflow_created",{}),r}getRun(e){return M(this.runPath(e))}updateRun(e,t){let r=this.getRun(e);if(!r)throw new Error(`Workflow run not found: ${e}`);let o=t(r);return o.updatedAt=new Date().toISOString(),this.writeRun(o),o}appendEvent(e,t,r,o){let i={schemaVersion:1,eventId:`workflow_event_${ee()}`,runId:e,type:t,timestamp:new Date().toISOString(),...o?{nodeId:o}:{},payload:r},s=this.eventsPath(e);return P(oe(s),{recursive:!0}),Ze(s,`${JSON.stringify(i)}
|
|
6
|
+
`,"utf8"),i}readEvents(e){let t=this.eventsPath(e);return Ke(t)?ne(t,"utf8").split(/\r?\n/).filter(Boolean).flatMap(r=>{try{return[JSON.parse(r)]}catch{return[]}}):[]}writeRun(e){te(this.runPath(e.runId),e)}definitionsDir(){return g(this.rootDir,"definitions")}runsDir(){return g(this.rootDir,"runs")}runPath(e){return g(this.runsDir(),I(e),"run.json")}eventsPath(e){return g(this.runsDir(),I(e),"events.jsonl")}},re=class{constructor(e=new N,t=new v){this.store=e;this.planner=t}store;planner;async run(e,t){let r=this.planner.plan(e),o=this.store.createRun(e);o=this.store.updateRun(o.runId,a=>({...a,status:"running"})),this.store.appendEvent(o.runId,"workflow_started",{waves:r.waves.length});let i=Math.max(1,Math.trunc(e.maxConcurrency??4)),s=!1;for(let a of r.waves)for(let p=0;p<a.length;p+=i){let T=a.slice(p,p+i);await Promise.all(T.map(async c=>{let k=e.nodes.find(u=>u.id===c);if((k.dependsOn??[]).some(u=>this.store.getRun(o.runId)?.nodes[u]?.status!=="completed")||s&&e.failFast!==!1){this.store.updateRun(o.runId,u=>({...u,nodes:{...u.nodes,[c]:{status:"skipped",completedAt:new Date().toISOString()}}})),this.store.appendEvent(o.runId,"node_skipped",{},c);return}let b=new Date().toISOString();o=this.store.updateRun(o.runId,u=>({...u,nodes:{...u.nodes,[c]:{status:"running",startedAt:b}}})),this.store.appendEvent(o.runId,"node_started",{},c);try{let u=await t(k,{run:o,definition:e});this.store.updateRun(o.runId,h=>({...h,nodes:{...h.nodes,[c]:{status:"completed",startedAt:b,completedAt:new Date().toISOString(),output:u}}})),this.store.appendEvent(o.runId,"node_completed",{},c)}catch(u){s=!0;let h=u instanceof Error?u.message:String(u);this.store.updateRun(o.runId,W=>({...W,nodes:{...W.nodes,[c]:{status:"failed",startedAt:b,completedAt:new Date().toISOString(),error:h}}})),this.store.appendEvent(o.runId,"node_failed",{error:h},c)}}))}return o=this.store.updateRun(o.runId,a=>({...a,status:s?"failed":"completed",completedAt:new Date().toISOString()})),this.store.appendEvent(o.runId,s?"workflow_failed":"workflow_completed",{}),o}};import{randomUUID as nt}from"node:crypto";var se=class{constructor(e=1e4){this.maxEvents=e;if(!Number.isInteger(e)||e<1)throw new Error("maxEvents must be a positive integer.")}maxEvents;sources=new Map;events=[];register(e){if(!e.id.trim())throw new Error("Monitor source id cannot be empty.");if(this.sources.has(e.id))throw new Error(`Monitor source already registered: ${e.id}`);return this.sources.set(e.id,{source:e,running:!1}),this}async start(e,t=1e3){let r=this.require(e);if(r.running)return this.snapshot(e);await r.source.start?.(),r.running=!0,await this.poll(e);let o=Math.max(25,Math.trunc(t));return r.timer=setInterval(()=>{this.poll(e).catch(()=>{})},o),r.timer.unref?.(),this.snapshot(e)}async poll(e){let o=(await this.require(e).source.poll()).map(i=>({schemaVersion:1,eventId:`monitor_event_${nt()}`,sourceId:e,type:i.type,timestamp:i.timestamp??new Date().toISOString(),payload:i.payload}));return this.events.push(...o),this.events.length>this.maxEvents&&this.events.splice(0,this.events.length-this.maxEvents),o}async stop(e){let t=this.require(e);return t.timer&&clearInterval(t.timer),t.timer=void 0,t.running&&await t.source.stop?.(),t.running=!1,this.snapshot(e)}async stopAll(){await Promise.all([...this.sources.keys()].map(e=>this.stop(e)))}snapshot(e,t=100){let r=this.require(e);return{sourceId:e,running:r.running,events:this.events.filter(o=>o.sourceId===e).slice(-Math.max(0,Math.trunc(t)))}}list(){return[...this.sources].map(([e,t])=>({sourceId:e,running:t.running}))}require(e){let t=this.sources.get(e);if(!t)throw new Error(`Monitor source not found: ${e}`);return t}},ie=class{constructor(e){this.manager=e}manager;execute(e){return this.manager.start(e.sourceId,e.intervalMs)}},ae=class{constructor(e){this.manager=e}manager;execute(e){return this.manager.stop(e.sourceId)}};import{randomUUID as ot}from"node:crypto";import{appendFileSync as st,existsSync as it,mkdirSync as at,readFileSync as ut}from"node:fs";import{dirname as dt,join as ct}from"node:path";function m(n){return Number.isFinite(n)?Math.max(0,n??0):0}var V=class{totalsValue={inputTokens:0,outputTokens:0,totalTokens:0,cachedInputTokens:0,estimatedCostUsd:0,events:0};add(e){let t=m(e.inputTokens),r=m(e.outputTokens);return this.totalsValue.inputTokens+=t,this.totalsValue.outputTokens+=r,this.totalsValue.totalTokens+=t+r,this.totalsValue.cachedInputTokens+=m(e.cachedInputTokens),this.totalsValue.estimatedCostUsd+=m(e.estimatedCostUsd),this.totalsValue.events+=1,this}snapshot(){return{...this.totalsValue}}};function lt(n,e){if(["runId","sessionId","workflowRunId","agentId","provider","model"].some(o=>e[o]!==void 0&&n[o]!==e[o]))return!1;let r=Date.parse(n.timestamp);return!(e.from&&r<Date.parse(e.from)||e.to&&r>Date.parse(e.to))}var ue=class{path;constructor(e=ct(f(),"usage","events.jsonl")){this.path=e,at(dt(e),{recursive:!0})}append(e){let t={...e,schemaVersion:1,eventId:`usage_${ot()}`,timestamp:e.timestamp??new Date().toISOString(),inputTokens:m(e.inputTokens),outputTokens:m(e.outputTokens),...e.cachedInputTokens!==void 0?{cachedInputTokens:m(e.cachedInputTokens)}:{},...e.estimatedCostUsd!==void 0?{estimatedCostUsd:m(e.estimatedCostUsd)}:{}};return st(this.path,`${JSON.stringify(t)}
|
|
7
|
+
`,"utf8"),t}query(e={}){return it(this.path)?ut(this.path,"utf8").split(/\r?\n/).filter(Boolean).flatMap(t=>{try{let r=JSON.parse(t);return lt(r,e)?[r]:[]}catch{return[]}}):[]}summarize(e={}){let t=new V;for(let r of this.query(e))t.add(r);return t.snapshot()}},de=class{constructor(e){this.adapter=e}adapter;export(e){for(let t of e){let r={...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{}};this.adapter.addCounter("xeno.usage.input_tokens",t.inputTokens,r),this.adapter.addCounter("xeno.usage.output_tokens",t.outputTokens,r),t.cachedInputTokens&&this.adapter.addCounter("xeno.usage.cached_input_tokens",t.cachedInputTokens,r),t.estimatedCostUsd&&this.adapter.addCounter("xeno.usage.estimated_cost_usd",t.estimatedCostUsd,r),this.adapter.recordEvent?.("xeno.usage.recorded",r)}}};export{w as AGENT_DAEMON_PROTOCOL_VERSION,Y as AgentDaemonClient,K as AgentDaemonServer,y as AgentEventStore,Z as AgentRunController,x as AgentRunStore,se as MonitorManager,ae as MonitorStopTool,ie as MonitorTool,de as OtelExporter,V as UsageAccumulator,ue as UsageLedger,v as WorkflowPlanner,re as WorkflowRuntime,N as WorkflowStore,A as acquireControlPlaneLock,Be as createAgentRunId,Wt as getAgentRunDir,Vt as getAgentRunStoreDir};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/control-plane/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/control-plane/types.ts":{"bytes":2578,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2591,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/event-store.ts":{"bytes":2379,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"}],"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/control-plane/run-store.ts":{"bytes":11948,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/control-plane/event-store.ts","kind":"import-statement","original":"./event-store.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/controller.ts":{"bytes":4220,"imports":[{"path":"src/control-plane/run-store.ts","kind":"import-statement","original":"./run-store.js"}],"format":"esm"},"src/control-plane/daemon.ts":{"bytes":5047,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/workflow.ts":{"bytes":10381,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/monitor.ts":{"bytes":4128,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/usage.ts":{"bytes":5156,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/index.ts":{"bytes":281,"imports":[{"path":"src/control-plane/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/control-plane/run-store.ts","kind":"import-statement","original":"./run-store.js"},{"path":"src/control-plane/event-store.ts","kind":"import-statement","original":"./event-store.js"},{"path":"src/control-plane/controller.ts","kind":"import-statement","original":"./controller.js"},{"path":"src/control-plane/daemon.ts","kind":"import-statement","original":"./daemon.js"},{"path":"src/control-plane/workflow.ts","kind":"import-statement","original":"./workflow.js"},{"path":"src/control-plane/monitor.ts","kind":"import-statement","original":"./monitor.js"},{"path":"src/control-plane/usage.ts","kind":"import-statement","original":"./usage.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"}],"format":"esm"}},"outputs":{"dist/control-plane/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/control-plane/index.ts","inputs":{"src/control-plane/index.ts":{"bytesInOutput":483},"src/control-plane/run-store.ts":{"bytesInOutput":5446},"src/version.ts":{"bytesInOutput":15},"src/control-plane/lock.ts":{"bytesInOutput":1063},"src/control-plane/event-store.ts":{"bytesInOutput":1057},"src/utils/platform.ts":{"bytesInOutput":240},"src/control-plane/controller.ts":{"bytesInOutput":1689},"src/control-plane/daemon.ts":{"bytesInOutput":1935},"src/control-plane/workflow.ts":{"bytesInOutput":4800},"src/control-plane/monitor.ts":{"bytesInOutput":1817},"src/control-plane/usage.ts":{"bytesInOutput":2183}},"bytes":21508}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/control-plane/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/control-plane/types.ts":{"bytes":2578,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2591,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/event-store.ts":{"bytes":2379,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"}],"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/control-plane/run-store.ts":{"bytes":11948,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/control-plane/event-store.ts","kind":"import-statement","original":"./event-store.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/controller.ts":{"bytes":4220,"imports":[{"path":"src/control-plane/run-store.ts","kind":"import-statement","original":"./run-store.js"}],"format":"esm"},"src/control-plane/daemon.ts":{"bytes":5047,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/workflow.ts":{"bytes":10381,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/monitor.ts":{"bytes":4128,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/usage.ts":{"bytes":5156,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/control-plane/index.ts":{"bytes":281,"imports":[{"path":"src/control-plane/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/control-plane/run-store.ts","kind":"import-statement","original":"./run-store.js"},{"path":"src/control-plane/event-store.ts","kind":"import-statement","original":"./event-store.js"},{"path":"src/control-plane/controller.ts","kind":"import-statement","original":"./controller.js"},{"path":"src/control-plane/daemon.ts","kind":"import-statement","original":"./daemon.js"},{"path":"src/control-plane/workflow.ts","kind":"import-statement","original":"./workflow.js"},{"path":"src/control-plane/monitor.ts","kind":"import-statement","original":"./monitor.js"},{"path":"src/control-plane/usage.ts","kind":"import-statement","original":"./usage.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"./lock.js"}],"format":"esm"}},"outputs":{"dist/control-plane/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["AGENT_DAEMON_PROTOCOL_VERSION","AgentDaemonClient","AgentDaemonServer","AgentEventStore","AgentRunController","AgentRunStore","MonitorManager","MonitorStopTool","MonitorTool","OtelExporter","UsageAccumulator","UsageLedger","WorkflowPlanner","WorkflowRuntime","WorkflowStore","acquireControlPlaneLock","createAgentRunId","getAgentRunDir","getAgentRunStoreDir"],"entryPoint":"src/control-plane/index.ts","inputs":{"src/control-plane/index.ts":{"bytesInOutput":0},"src/control-plane/run-store.ts":{"bytesInOutput":5285},"src/version.ts":{"bytesInOutput":15},"src/control-plane/lock.ts":{"bytesInOutput":1041},"src/control-plane/event-store.ts":{"bytesInOutput":1057},"src/utils/platform.ts":{"bytesInOutput":220},"src/control-plane/controller.ts":{"bytesInOutput":1686},"src/control-plane/daemon.ts":{"bytesInOutput":1941},"src/control-plane/workflow.ts":{"bytesInOutput":4685},"src/control-plane/monitor.ts":{"bytesInOutput":1820},"src/control-plane/usage.ts":{"bytesInOutput":2200}},"bytes":20385}}}
|