agentix-cli 0.112.0 → 0.114.0

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 (134) hide show
  1. package/apps/mac-helper/Resources/AppIcon.png +0 -0
  2. package/apps/mac-voice/Resources/AppIcon.png +0 -0
  3. package/apps/mac-voice/Resources/Info.plist +1 -0
  4. package/apps/mac-voice/build.sh +10 -0
  5. package/dist/{App-4AX6LR6Q.js → App-Q4UAYL2V.js} +2 -2
  6. package/dist/{ChatApp-HAIPYO4I.js → ChatApp-6KGP57OP.js} +2 -2
  7. package/dist/agent-5F4EKGQN.js +2 -0
  8. package/dist/{board-dashboard-RNWZ3H2T.js → board-dashboard-GGW5ZZLT.js} +841 -329
  9. package/dist/board-dashboard-GGW5ZZLT.js.map +1 -0
  10. package/dist/{chunk-5MUJZODV.js → chunk-2PJKGZWP.js} +32 -32
  11. package/dist/chunk-2PJKGZWP.js.map +1 -0
  12. package/dist/{chunk-NHAVY7VU.js → chunk-4COYYJJY.js} +2 -2
  13. package/dist/{chunk-QAIYUMHW.js → chunk-4VDA4UM7.js} +2 -2
  14. package/dist/{chunk-K4TN34OM.js → chunk-6WNQY6K2.js} +2 -2
  15. package/dist/{chunk-HIVQHFPT.js → chunk-A35RTVMM.js} +2 -2
  16. package/dist/{chunk-DG5I6PPM.js → chunk-BGG3ZSMW.js} +4 -2
  17. package/dist/chunk-BGG3ZSMW.js.map +1 -0
  18. package/dist/{chunk-2JEJIVOZ.js → chunk-C4S5XQKD.js} +2 -2
  19. package/dist/{chunk-ZVUVFMYN.js → chunk-CYKPDILL.js} +2 -2
  20. package/dist/{chunk-JRMYIPIL.js → chunk-FDCTFT2Q.js} +2 -2
  21. package/dist/{chunk-2S5T3VT5.js → chunk-HG6QA6EU.js} +2 -2
  22. package/dist/{chunk-HNRQQEDE.js → chunk-HPY54DU6.js} +2 -2
  23. package/dist/{chunk-EUCLJ2VL.js → chunk-ILGLEA3I.js} +5 -5
  24. package/dist/{chunk-EUCLJ2VL.js.map → chunk-ILGLEA3I.js.map} +1 -1
  25. package/dist/{chunk-ETV2UH66.js → chunk-J3GXZQXY.js} +2 -2
  26. package/dist/{chunk-Q6ILGUDE.js → chunk-LP227A6L.js} +2 -2
  27. package/dist/{chunk-WN5MCIVA.js → chunk-O2RVUM2B.js} +2 -2
  28. package/dist/{chunk-SFAZ6IH2.js → chunk-QQIWLN3H.js} +160 -160
  29. package/dist/chunk-QQIWLN3H.js.map +1 -0
  30. package/dist/{chunk-N7HKIMMR.js → chunk-SCJ5ZXEN.js} +2 -2
  31. package/dist/{chunk-C245D4BZ.js → chunk-UG2OF2EI.js} +2 -2
  32. package/dist/{chunk-7MTHXIT5.js → chunk-VGI4EZTP.js} +2 -2
  33. package/dist/{chunk-R4KGAIBF.js → chunk-VQM77L54.js} +2 -2
  34. package/dist/{chunk-6DGPWKRK.js → chunk-VTWSW4KB.js} +2 -2
  35. package/dist/{chunk-RXAR3JIV.js → chunk-XTO4GRGN.js} +8 -8
  36. package/dist/{chunk-MOO6DKMZ.js → chunk-XX7NXI3Y.js} +2 -2
  37. package/dist/{chunk-34KJ4Q4E.js → chunk-Y5HBYSJW.js} +12 -12
  38. package/dist/chunk-Y5HBYSJW.js.map +1 -0
  39. package/dist/{chunk-23A5K5UW.js → chunk-Y5MFVVTM.js} +2 -2
  40. package/dist/{chunk-XEJ4E5HH.js → chunk-YLKCFW2R.js} +2 -2
  41. package/dist/{chunk-ANV4T62P.js → chunk-YU5NDKPA.js} +6 -6
  42. package/dist/cli.js +1 -1
  43. package/dist/{client-MYU23KWY.js → client-QTXWO46T.js} +2 -2
  44. package/dist/{compaction-MECSN36J.js → compaction-FS6XNRLM.js} +3 -3
  45. package/dist/config-4XGZYYQP.js +2 -0
  46. package/dist/config-mutator-QLSA6JOY.js +2 -0
  47. package/dist/{context-planner-JU7CNXCB.js → context-planner-BKHPKDX5.js} +2 -2
  48. package/dist/{doctor-AUF5HJPW.js → doctor-DO262COW.js} +2 -2
  49. package/dist/heal-U67X6NIN.js +2 -0
  50. package/dist/index.d.ts +184 -0
  51. package/dist/index.js +1 -1
  52. package/dist/memory-extract-ATD6YLRK.js +2 -0
  53. package/dist/processes-5MP32QZT.js +2 -0
  54. package/dist/{program-7ZNCVU5A.js → program-IEMICVO3.js} +14 -14
  55. package/dist/{promote-FP4LHKWZ.js → promote-S7SKOKX2.js} +2 -2
  56. package/dist/{providers-ES5KVLI4.js → providers-55NC2SFN.js} +2 -2
  57. package/dist/{query-IJWC42YJ.js → query-GOBQ3GL5.js} +2 -2
  58. package/dist/{registry-US7IWI5G.js → registry-HUJEORRW.js} +2 -2
  59. package/dist/{request-planner-SDUMKFFP.js → request-planner-RYWFGBGK.js} +2 -2
  60. package/dist/{review-candidates-QOKFHMPL.js → review-candidates-TXX532LY.js} +2 -2
  61. package/dist/{routing-XZBHJ63Q.js → routing-IT4YS6X3.js} +2 -2
  62. package/dist/schedule-tool-FJKH2ERY.js +2 -0
  63. package/dist/scheduler-ALPDUE4H.js +2 -0
  64. package/dist/{seat-OU3VAP5Y.js → seat-LK45MTVI.js} +2 -2
  65. package/dist/{select-S6E3HJPE.js → select-4LAHUZ74.js} +2 -2
  66. package/dist/{set-enabled-GY7O7IRS.js → set-enabled-F2K56HQZ.js} +2 -2
  67. package/dist/{tool-RGYNLN6I.js → tool-J4VHHZWN.js} +2 -2
  68. package/dist/{tool-RT5REMY7.js → tool-W3ODKQM2.js} +2 -2
  69. package/dist/wiki-FZHSX4K3.js +2 -0
  70. package/package.json +1 -1
  71. package/dist/agent-Q7MDX45J.js +0 -2
  72. package/dist/board-dashboard-RNWZ3H2T.js.map +0 -1
  73. package/dist/chunk-34KJ4Q4E.js.map +0 -1
  74. package/dist/chunk-5MUJZODV.js.map +0 -1
  75. package/dist/chunk-DG5I6PPM.js.map +0 -1
  76. package/dist/chunk-SFAZ6IH2.js.map +0 -1
  77. package/dist/config-45OK6PHO.js +0 -2
  78. package/dist/config-mutator-4SUOOBNK.js +0 -2
  79. package/dist/heal-CMQL5SG4.js +0 -2
  80. package/dist/memory-extract-YCNCARZ2.js +0 -2
  81. package/dist/processes-W5VHBP7T.js +0 -2
  82. package/dist/schedule-tool-XQYEDYXX.js +0 -2
  83. package/dist/scheduler-VDIZDO6Y.js +0 -2
  84. package/dist/wiki-3UTXUIN6.js +0 -2
  85. /package/dist/{App-4AX6LR6Q.js.map → App-Q4UAYL2V.js.map} +0 -0
  86. /package/dist/{ChatApp-HAIPYO4I.js.map → ChatApp-6KGP57OP.js.map} +0 -0
  87. /package/dist/{agent-Q7MDX45J.js.map → agent-5F4EKGQN.js.map} +0 -0
  88. /package/dist/{chunk-NHAVY7VU.js.map → chunk-4COYYJJY.js.map} +0 -0
  89. /package/dist/{chunk-QAIYUMHW.js.map → chunk-4VDA4UM7.js.map} +0 -0
  90. /package/dist/{chunk-K4TN34OM.js.map → chunk-6WNQY6K2.js.map} +0 -0
  91. /package/dist/{chunk-HIVQHFPT.js.map → chunk-A35RTVMM.js.map} +0 -0
  92. /package/dist/{chunk-2JEJIVOZ.js.map → chunk-C4S5XQKD.js.map} +0 -0
  93. /package/dist/{chunk-ZVUVFMYN.js.map → chunk-CYKPDILL.js.map} +0 -0
  94. /package/dist/{chunk-JRMYIPIL.js.map → chunk-FDCTFT2Q.js.map} +0 -0
  95. /package/dist/{chunk-2S5T3VT5.js.map → chunk-HG6QA6EU.js.map} +0 -0
  96. /package/dist/{chunk-HNRQQEDE.js.map → chunk-HPY54DU6.js.map} +0 -0
  97. /package/dist/{chunk-ETV2UH66.js.map → chunk-J3GXZQXY.js.map} +0 -0
  98. /package/dist/{chunk-Q6ILGUDE.js.map → chunk-LP227A6L.js.map} +0 -0
  99. /package/dist/{chunk-WN5MCIVA.js.map → chunk-O2RVUM2B.js.map} +0 -0
  100. /package/dist/{chunk-N7HKIMMR.js.map → chunk-SCJ5ZXEN.js.map} +0 -0
  101. /package/dist/{chunk-C245D4BZ.js.map → chunk-UG2OF2EI.js.map} +0 -0
  102. /package/dist/{chunk-7MTHXIT5.js.map → chunk-VGI4EZTP.js.map} +0 -0
  103. /package/dist/{chunk-R4KGAIBF.js.map → chunk-VQM77L54.js.map} +0 -0
  104. /package/dist/{chunk-6DGPWKRK.js.map → chunk-VTWSW4KB.js.map} +0 -0
  105. /package/dist/{chunk-RXAR3JIV.js.map → chunk-XTO4GRGN.js.map} +0 -0
  106. /package/dist/{chunk-MOO6DKMZ.js.map → chunk-XX7NXI3Y.js.map} +0 -0
  107. /package/dist/{chunk-23A5K5UW.js.map → chunk-Y5MFVVTM.js.map} +0 -0
  108. /package/dist/{chunk-XEJ4E5HH.js.map → chunk-YLKCFW2R.js.map} +0 -0
  109. /package/dist/{chunk-ANV4T62P.js.map → chunk-YU5NDKPA.js.map} +0 -0
  110. /package/dist/{client-MYU23KWY.js.map → client-QTXWO46T.js.map} +0 -0
  111. /package/dist/{compaction-MECSN36J.js.map → compaction-FS6XNRLM.js.map} +0 -0
  112. /package/dist/{config-45OK6PHO.js.map → config-4XGZYYQP.js.map} +0 -0
  113. /package/dist/{config-mutator-4SUOOBNK.js.map → config-mutator-QLSA6JOY.js.map} +0 -0
  114. /package/dist/{context-planner-JU7CNXCB.js.map → context-planner-BKHPKDX5.js.map} +0 -0
  115. /package/dist/{doctor-AUF5HJPW.js.map → doctor-DO262COW.js.map} +0 -0
  116. /package/dist/{heal-CMQL5SG4.js.map → heal-U67X6NIN.js.map} +0 -0
  117. /package/dist/{memory-extract-YCNCARZ2.js.map → memory-extract-ATD6YLRK.js.map} +0 -0
  118. /package/dist/{processes-W5VHBP7T.js.map → processes-5MP32QZT.js.map} +0 -0
  119. /package/dist/{program-7ZNCVU5A.js.map → program-IEMICVO3.js.map} +0 -0
  120. /package/dist/{promote-FP4LHKWZ.js.map → promote-S7SKOKX2.js.map} +0 -0
  121. /package/dist/{providers-ES5KVLI4.js.map → providers-55NC2SFN.js.map} +0 -0
  122. /package/dist/{query-IJWC42YJ.js.map → query-GOBQ3GL5.js.map} +0 -0
  123. /package/dist/{registry-US7IWI5G.js.map → registry-HUJEORRW.js.map} +0 -0
  124. /package/dist/{request-planner-SDUMKFFP.js.map → request-planner-RYWFGBGK.js.map} +0 -0
  125. /package/dist/{review-candidates-QOKFHMPL.js.map → review-candidates-TXX532LY.js.map} +0 -0
  126. /package/dist/{routing-XZBHJ63Q.js.map → routing-IT4YS6X3.js.map} +0 -0
  127. /package/dist/{schedule-tool-XQYEDYXX.js.map → schedule-tool-FJKH2ERY.js.map} +0 -0
  128. /package/dist/{scheduler-VDIZDO6Y.js.map → scheduler-ALPDUE4H.js.map} +0 -0
  129. /package/dist/{seat-OU3VAP5Y.js.map → seat-LK45MTVI.js.map} +0 -0
  130. /package/dist/{select-S6E3HJPE.js.map → select-4LAHUZ74.js.map} +0 -0
  131. /package/dist/{set-enabled-GY7O7IRS.js.map → set-enabled-F2K56HQZ.js.map} +0 -0
  132. /package/dist/{tool-RGYNLN6I.js.map → tool-J4VHHZWN.js.map} +0 -0
  133. /package/dist/{tool-RT5REMY7.js.map → tool-W3ODKQM2.js.map} +0 -0
  134. /package/dist/{wiki-3UTXUIN6.js.map → wiki-FZHSX4K3.js.map} +0 -0
@@ -17,7 +17,7 @@ SKIP:
17
17
  For each fact, output a JSON array:
18
18
  [{"category":"fact|preference|commitment|task-state","content":"concise fact, 1-2 sentences","keywords":["keyword1","keyword2"]}]
19
19
 
20
- If nothing worth remembering, output: []`;async function I(e,s,r,n,o){if(s.length<20&&r.length<50||!l({channel:n.channel,content:`User: ${s}`,responseLength:r.length}).capture)return;let{createProvider:h}=await import("./providers-ES5KVLI4.js"),i=(await h("claude").generate([{role:"system",content:w},{role:"user",content:`${n.sender} (via ${n.channel}): ${s}
20
+ If nothing worth remembering, output: []`;async function I(e,s,r,n,o){if(s.length<20&&r.length<50||!l({channel:n.channel,content:`User: ${s}`,responseLength:r.length}).capture)return;let{createProvider:h}=await import("./providers-55NC2SFN.js"),i=(await h("claude").generate([{role:"system",content:w},{role:"user",content:`${n.sender} (via ${n.channel}): ${s}
21
21
 
22
22
  Agent: ${r}`}],{model:y,maxTokens:512})).content.trim().match(/\[[\s\S]*\]/);if(!i)return;let a=JSON.parse(i[0]);if(!Array.isArray(a)||a.length===0)return;let m=new Date().toISOString().slice(0,10),p=u(n.channel);for(let t of a)typeof t?.content=="string"&&(t.category==="secret"||f(t.content)||o.hasSimilar(e,t.content)||o.addMemory(e,{agentId:e,category:t.category,content:t.content,keywords:t.keywords||[],source:{...n,date:m,trust:p},expiresAt:t.category==="task-state"?new Date(Date.now()+7*24*60*60*1e3).toISOString():void 0}));Math.random()<.02&&o.prune(e)}export{l as a,I as b};
23
- //# sourceMappingURL=chunk-23A5K5UW.js.map
23
+ //# sourceMappingURL=chunk-Y5MFVVTM.js.map
@@ -1,2 +1,2 @@
1
- import{q as p}from"./chunk-7MTHXIT5.js";import{b as i,c as u,d as l,e as c}from"./chunk-ZVUVFMYN.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,m=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',g=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function w(e){return g.test(e)}function x(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function $(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function S(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??m,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function T(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function A(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function h(e){return e?.approval?.action==="create"}async function D(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&h(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,w as c,x as d,$ as e,S as f,P as g,T as h,A as i,h as j,D as k,I as l,O as m};
2
- //# sourceMappingURL=chunk-XEJ4E5HH.js.map
1
+ import{q as p}from"./chunk-VGI4EZTP.js";import{b as i,c as u,d as l,e as c}from"./chunk-CYKPDILL.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,m=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',g=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function w(e){return g.test(e)}function x(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function $(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function S(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??m,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function T(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function A(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function h(e){return e?.approval?.action==="create"}async function D(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&h(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,w as c,x as d,$ as e,S as f,P as g,T as h,A as i,h as j,D as k,I as l,O as m};
2
+ //# sourceMappingURL=chunk-YLKCFW2R.js.map
@@ -1,4 +1,4 @@
1
- import{a as Ge,b as Fe,c as Se}from"./chunk-SFQUP3BP.js";import{b as Te,c as Ce}from"./chunk-QOYAX2FT.js";import{a as Q,c as Ne,e as we,f as ke,g as be,i as xe,k as gt,o as ve,p as ht}from"./chunk-5MUJZODV.js";import{a as R,b as ye}from"./chunk-7I7IEX4S.js";import{b as Le,e as _e}from"./chunk-JHCI6XCJ.js";import{e as b}from"./chunk-DSYKYZMT.js";import{z as $}from"zod";var qe=$.object({provider:$.enum(["claude-code","claude","openai","deepseek","ollama","demo","custom"]).default("claude-code"),model:$.string().optional(),apiKey:$.string().optional(),skills:$.array($.string()).default([]),output:$.object({dir:$.string().default("./generated")}).default({}),context7:$.object({enabled:$.boolean().default(!0),apiKey:$.string().optional()}).default({}),agentic:$.object({maxIterations:$.number().default(20),enabledTools:$.array($.string()).default(["create_files","ask_user","read_file","search_files","list_directory","run_command","edit_file"]),disabledTools:$.array($.string()).default([])}).default({})}),Vt=["component","page","api","website","document","script","config","skill","media","report","test","workflow","schema","email","diagram","auto"],Yt={component:"UI component (any framework)",page:"Full page or screen",api:"API endpoint, route handler, or service",website:"Multi-page website or app",document:"Markdown, documentation, or specification",script:"Standalone script or utility",config:"Configuration file or setup",skill:"Agent skill (SKILL.md format for skills.sh)",media:"Media generation prompt (image/audio/video description)",report:"Analysis report or audit",test:"Test suite, test fixtures, or test data",workflow:"CI/CD pipeline, GitHub Actions, or automation",schema:"Database schema, Zod validators, or GraphQL types",email:"Email template (React Email, MJML, HTML)",diagram:"Mermaid, D2, or PlantUML diagram",auto:"Auto-detect the best output type"};ht();ke();ke();import{existsSync as yt,promises as wt}from"fs";import K from"path";import kt from"fast-glob";var Be={"prisma/schema.prisma":{type:"prisma",category:"database"},"drizzle/schema.ts":{type:"drizzle",category:"database"},"schema.graphql":{type:"graphql",category:"api"},"schema.gql":{type:"graphql",category:"api"},"openapi.yaml":{type:"openapi",category:"api"},"openapi.json":{type:"openapi",category:"api"},"swagger.yaml":{type:"openapi",category:"api"},"swagger.json":{type:"openapi",category:"api"}};async function We(r){let e={},t=await kt.glob("**/*",{cwd:r,deep:4,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**","**/target/**","**/__pycache__/**","**/vendor/**","**/.git/**"],onlyFiles:!0});for(let[s,i]of Object.entries(Be)){let c=t.find(a=>a.endsWith(s)||a===s);if(c&&i.category==="database"){let a=await Z(K.resolve(r,c));if(a){e.database={type:i.type,content:ce(a,3e3),tables:bt(a,i.type)};break}}}for(let[s,i]of Object.entries(Be)){let c=t.find(a=>a.endsWith(s)||a===s);if(c&&i.category==="api"){let a=await Z(K.resolve(r,c));if(a){e.api={type:i.type,content:ce(a,3e3)};break}}}if(!e.api){let s=t.find(i=>i.includes("trpc")&&(i.endsWith("router.ts")||i.endsWith("router.js")));if(s){let i=await Z(K.resolve(r,s));i&&(e.api={type:"trpc",content:ce(i,3e3)})}}let o=t.find(s=>s===".env.example"||s===".env.local.example"||s===".env.template");if(o){let s=await Z(K.resolve(r,o));s&&(e.env=xt(s))}let n=t.filter(s=>(s.includes("models")||s.includes("types")||s.includes("schemas"))&&(s.endsWith(".ts")||s.endsWith(".py")||s.endsWith(".rs")||s.endsWith(".go")));if(n.length){e.models=[];for(let s of n.slice(0,5)){let i=await Z(K.resolve(r,s));i&&e.models.push({path:s,content:ce(i,2e3),type:K.extname(s).slice(1)})}}return e}function bt(r,e){if(e==="prisma"){let t=r.match(/model\s+(\w+)\s*\{/g);return t?t.map(o=>o.replace(/model\s+/,"").replace(/\s*\{/,"")):[]}return[]}function xt(r){return{variables:r.split(`
1
+ import{a as Ge,b as Fe,c as Se}from"./chunk-SFQUP3BP.js";import{b as Te,c as Ce}from"./chunk-QOYAX2FT.js";import{a as Q,c as Ne,e as we,f as ke,g as be,i as xe,k as gt,o as ve,p as ht}from"./chunk-2PJKGZWP.js";import{a as R,b as ye}from"./chunk-7I7IEX4S.js";import{b as Le,e as _e}from"./chunk-JHCI6XCJ.js";import{e as b}from"./chunk-DSYKYZMT.js";import{z as $}from"zod";var qe=$.object({provider:$.enum(["claude-code","claude","openai","deepseek","ollama","demo","custom"]).default("claude-code"),model:$.string().optional(),apiKey:$.string().optional(),skills:$.array($.string()).default([]),output:$.object({dir:$.string().default("./generated")}).default({}),context7:$.object({enabled:$.boolean().default(!0),apiKey:$.string().optional()}).default({}),agentic:$.object({maxIterations:$.number().default(20),enabledTools:$.array($.string()).default(["create_files","ask_user","read_file","search_files","list_directory","run_command","edit_file"]),disabledTools:$.array($.string()).default([])}).default({})}),Vt=["component","page","api","website","document","script","config","skill","media","report","test","workflow","schema","email","diagram","auto"],Yt={component:"UI component (any framework)",page:"Full page or screen",api:"API endpoint, route handler, or service",website:"Multi-page website or app",document:"Markdown, documentation, or specification",script:"Standalone script or utility",config:"Configuration file or setup",skill:"Agent skill (SKILL.md format for skills.sh)",media:"Media generation prompt (image/audio/video description)",report:"Analysis report or audit",test:"Test suite, test fixtures, or test data",workflow:"CI/CD pipeline, GitHub Actions, or automation",schema:"Database schema, Zod validators, or GraphQL types",email:"Email template (React Email, MJML, HTML)",diagram:"Mermaid, D2, or PlantUML diagram",auto:"Auto-detect the best output type"};ht();ke();ke();import{existsSync as yt,promises as wt}from"fs";import K from"path";import kt from"fast-glob";var Be={"prisma/schema.prisma":{type:"prisma",category:"database"},"drizzle/schema.ts":{type:"drizzle",category:"database"},"schema.graphql":{type:"graphql",category:"api"},"schema.gql":{type:"graphql",category:"api"},"openapi.yaml":{type:"openapi",category:"api"},"openapi.json":{type:"openapi",category:"api"},"swagger.yaml":{type:"openapi",category:"api"},"swagger.json":{type:"openapi",category:"api"}};async function We(r){let e={},t=await kt.glob("**/*",{cwd:r,deep:4,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**","**/target/**","**/__pycache__/**","**/vendor/**","**/.git/**"],onlyFiles:!0});for(let[s,i]of Object.entries(Be)){let c=t.find(a=>a.endsWith(s)||a===s);if(c&&i.category==="database"){let a=await Z(K.resolve(r,c));if(a){e.database={type:i.type,content:ce(a,3e3),tables:bt(a,i.type)};break}}}for(let[s,i]of Object.entries(Be)){let c=t.find(a=>a.endsWith(s)||a===s);if(c&&i.category==="api"){let a=await Z(K.resolve(r,c));if(a){e.api={type:i.type,content:ce(a,3e3)};break}}}if(!e.api){let s=t.find(i=>i.includes("trpc")&&(i.endsWith("router.ts")||i.endsWith("router.js")));if(s){let i=await Z(K.resolve(r,s));i&&(e.api={type:"trpc",content:ce(i,3e3)})}}let o=t.find(s=>s===".env.example"||s===".env.local.example"||s===".env.template");if(o){let s=await Z(K.resolve(r,o));s&&(e.env=xt(s))}let n=t.filter(s=>(s.includes("models")||s.includes("types")||s.includes("schemas"))&&(s.endsWith(".ts")||s.endsWith(".py")||s.endsWith(".rs")||s.endsWith(".go")));if(n.length){e.models=[];for(let s of n.slice(0,5)){let i=await Z(K.resolve(r,s));i&&e.models.push({path:s,content:ce(i,2e3),type:K.extname(s).slice(1)})}}return e}function bt(r,e){if(e==="prisma"){let t=r.match(/model\s+(\w+)\s*\{/g);return t?t.map(o=>o.replace(/model\s+/,"").replace(/\s*\{/,"")):[]}return[]}function xt(r){return{variables:r.split(`
2
2
  `).filter(o=>o.trim()&&!o.trim().startsWith("#")).map(o=>{let[n]=o.split("="),s=n.trim(),i=o.includes("=")&&o.split("=")[1]?.trim().length>0;return{key:s,required:!i}})}}async function Z(r){try{return yt(r)?await wt.readFile(r,"utf8"):null}catch{return null}}function ce(r,e){return r.length<=e?r:r.slice(0,e)+`
3
3
  ... (truncated)`}function ze(r){let e=[];if(r.database&&e.push(`## Database Schema (${r.database.type})
4
4
  `+(r.database.tables?.length?`Tables: ${r.database.tables.join(", ")}
@@ -18,7 +18,7 @@ ${s.join(`
18
18
  ---
19
19
 
20
20
  `)}`:""}var Ye={component:{type:"component",baseDir:"src/components",filePatterns:["*.tsx","*.vue","*.svelte","*.jsx","*.ts"],description:"UI component"},page:{type:"page",baseDir:"src/app",filePatterns:["*.tsx","*.vue","*.svelte","*.jsx","*.astro"],description:"Page or screen"},api:{type:"api",baseDir:"src/api",filePatterns:["*.ts","*.js","*.py","*.go","*.rs"],description:"API route or endpoint"},website:{type:"website",baseDir:".",filePatterns:["*"],description:"Multi-file website"},document:{type:"document",baseDir:"docs",filePatterns:["*.md","*.mdx","*.txt","*.rst"],description:"Documentation"},script:{type:"script",baseDir:"scripts",filePatterns:["*.ts","*.js","*.py","*.sh","*.go"],description:"Standalone script"},config:{type:"config",baseDir:".",filePatterns:["*.json","*.yaml","*.yml","*.toml","*.env"],description:"Configuration file"},skill:{type:"skill",baseDir:".skills",filePatterns:["SKILL.md"],description:"Agent skill (SKILL.md)"},media:{type:"media",baseDir:"media",filePatterns:["*.md","*.json","*.txt"],description:"Media generation prompt/description"},report:{type:"report",baseDir:"reports",filePatterns:["*.md","*.html","*.json"],description:"Analysis report"},test:{type:"test",baseDir:"src",filePatterns:["*.test.ts","*.test.tsx","*.spec.ts","*.test.js","*.test.py","*.test.go"],description:"Test suite or fixture"},workflow:{type:"workflow",baseDir:".github/workflows",filePatterns:["*.yml","*.yaml"],description:"CI/CD pipeline or automation"},schema:{type:"schema",baseDir:"src",filePatterns:["*.ts","*.prisma","*.graphql","*.gql","*.py"],description:"Database schema, validators, or types"},email:{type:"email",baseDir:"src/emails",filePatterns:["*.tsx","*.jsx","*.html","*.mjml"],description:"Email template"},diagram:{type:"diagram",baseDir:"docs",filePatterns:["*.md","*.mmd","*.d2","*.puml"],description:"Architecture or data diagram"}};function Pe(r,e){if(r&&r!=="auto")return r;let t=e.toLowerCase(),o=[[/\b(component|button|card|modal|dialog|form|input|dropdown|nav|sidebar|header|footer|widget|ui)\b/i,"component"],[/\b(page|screen|view|route|layout|dashboard|landing)\b/i,"page"],[/\b(api|endpoint|route handler|rest|graphql|webhook|middleware|server)\b/i,"api"],[/\b(website|site|web app|landing page|portfolio|blog)\b/i,"website"],[/\b(document|doc|readme|guide|tutorial|specification|spec|changelog)\b/i,"document"],[/\b(script|cli|command|tool|utility|migration|seed|cron)\b/i,"script"],[/\b(config|configuration|setup|env|settings)\b/i,"config"],[/\b(skill|agent skill|skill\.md)\b/i,"skill"],[/\b(video|audio|image|media|animation|thumbnail|podcast)\b/i,"media"],[/\b(report|audit|analysis|review|assessment|benchmark)\b/i,"report"],[/\b(test|spec|unit test|integration test|e2e|coverage|fixture|mock)\b/i,"test"],[/\b(workflow|ci|cd|pipeline|github action|deploy|automation|ci\/cd)\b/i,"workflow"],[/\b(schema|model|migration|prisma|drizzle|zod|validator|graphql type)\b/i,"schema"],[/\b(email|newsletter|transactional|invite|welcome email|notification email)\b/i,"email"],[/\b(diagram|erd|flowchart|architecture diagram|sequence diagram|mermaid|plantuml|d2)\b/i,"diagram"]];for(let[n,s]of o)if(n.test(t))return s;return"component"}import{existsSync as It,promises as ot}from"fs";import ue from"path";import{execa as Ct}from"execa";import{z as N}from"zod";var ee=["pre:generate","post:generate","pre:file-write","post:file-write","pre:prompt","post:response","pre:command","on:error","pre:tool-call","post:tool-call","pre:channel-message","post:channel-message","pre:a2a-task","pre:cron-run","post:cron-run","on:gitlab-pipeline","on:gitlab-issue","on:gitlab-mr","on:gitlab-note","on:github-issue","on:github-pr","on:github-push","on:n8n","on:stripe-event","on:sentry-issue","on:vercel-deployment","on:odoo-event","on:hubspot-event"],Re=["pre:generate","pre:file-write","pre:prompt","post:response","pre:command","pre:tool-call","pre:channel-message","post:channel-message","pre:a2a-task","pre:cron-run"],Xe=N.object({name:N.string(),type:N.enum(["command","prompt","script"]),command:N.string().optional(),prompt:N.string().optional(),provider:N.enum(["claude-code","claude","openai","deepseek","ollama","custom"]).optional(),model:N.string().optional(),script:N.string().optional(),priority:N.number().default(100),enabled:N.boolean().default(!0)});ye();var Qe={"claude-sonnet":{input:3,output:15},"claude-opus":{input:15,output:75},"claude-haiku":{input:.25,output:1.25}};function St(r){let e=r.toLowerCase();return e.includes("opus")?"claude-opus":e.includes("haiku")?"claude-haiku":"claude-sonnet"}var le=class{steps=[];models=new Map;recordStep(e,t,o,n){let s=St(t),i=Qe[s]||Qe["claude-sonnet"],c=o/1e6*i.input+n/1e6*i.output;this.steps.push({step:e,model:t,inputTokens:o,outputTokens:n,cost:c,timestamp:Date.now()});let a=this.models.get(t)||{inputTokens:0,outputTokens:0,cost:0,steps:0};a.inputTokens+=o,a.outputTokens+=n,a.cost+=c,a.steps++,this.models.set(t,a)}getSummary(){let e=0,t=0,o=0;for(let s of this.steps)e+=s.inputTokens,t+=s.outputTokens,o+=s.cost;let n={};for(let[s,i]of this.models)n[s]={...i};return{totalInputTokens:e,totalOutputTokens:t,totalTokens:e+t,totalCost:o,steps:[...this.steps],models:n}}reset(){this.steps=[],this.models.clear()}},te=new le;function Tt(r,e){let t=[];if(t.push(`# Session: ${r.id}`),t.push(""),t.push(`- **Created**: ${r.createdAt}`),t.push(`- **Updated**: ${r.updatedAt}`),t.push(`- **CWD**: ${r.cwd}`),t.push(`- **Messages**: ${r.messages.length}`),t.push(`- **Tokens**: ${r.tokensUsed.toLocaleString()}`),t.push(""),r.filesGenerated.length){t.push("## Files Generated"),t.push("");for(let o of r.filesGenerated)t.push(`- \`${o}\``);t.push("")}if(r.messages.length){t.push("## Conversation"),t.push("");for(let o of r.messages){if(o.role==="system")continue;let n=o.role==="user"?"**User**":"**Assistant**";t.push(`### ${n}`),t.push(""),o.role,t.push(o.content),t.push("")}}if(e){if(t.push("## Cost Summary"),t.push(""),t.push(`- **Total tokens**: ${e.totalTokens.toLocaleString()}`),t.push(` - Input: ${e.totalInputTokens.toLocaleString()}`),t.push(` - Output: ${e.totalOutputTokens.toLocaleString()}`),t.push(`- **Total cost**: $${e.totalCost.toFixed(4)}`),t.push(""),Object.keys(e.models).length){t.push("### Per Model"),t.push(""),t.push("| Model | Input | Output | Cost | Steps |"),t.push("|-------|-------|--------|------|-------|");for(let[o,n]of Object.entries(e.models))t.push(`| ${o} | ${n.inputTokens.toLocaleString()} | ${n.outputTokens.toLocaleString()} | $${n.cost.toFixed(4)} | ${n.steps} |`);t.push("")}if(e.steps.length){t.push("### Per Step"),t.push(""),t.push("| Step | Model | Input | Output | Cost |"),t.push("|------|-------|-------|--------|------|");for(let o of e.steps)t.push(`| ${o.step} | ${o.model} | ${o.inputTokens.toLocaleString()} | ${o.outputTokens.toLocaleString()} | $${o.cost.toFixed(4)} |`);t.push("")}}return t.join(`
21
- `)}ke();var oe=class{hooks=new Map;register(e,t){if(!t.enabled)return;let o=this.createHandler(t),n={event:e,definition:t,handler:o},s=this.hooks.get(e)||[];s.push(n),s.sort((i,c)=>i.definition.priority-c.definition.priority),this.hooks.set(e,s)}async execute(e,t){let o=this.hooks.get(e);if(!o?.length)return{};let n=Re.includes(e),s={};for(let i of o){let c=Date.now();try{let a=await i.handler({...t,...s}),p=Date.now()-c;if(a.modified&&(s={...s,...a.modified}),n&&a.blocked)return b.hook(i.definition.name,p,"blocked"),{blocked:!0,message:a.message||`Blocked by hook: ${i.definition.name}`,modified:s};b.hook(i.definition.name,p,"ok")}catch(a){let p=Date.now()-c;if(b.hook(i.definition.name,p,`error: ${a.message}`),R.warn(`Hook "${i.definition.name}" failed: ${a.message}`),n)return{blocked:!0,message:`Hook "${i.definition.name}" errored: ${a.message}`}}}return{modified:Object.keys(s).length?s:void 0}}registerHandler(e,t,o,n=100){let i={event:e,definition:{name:t,type:"script",priority:n,enabled:!0},handler:o},c=this.hooks.get(e)||[];c.push(i),c.sort((a,p)=>a.definition.priority-p.definition.priority),this.hooks.set(e,c)}has(e){return!!this.hooks.get(e)?.length}clear(){this.hooks.clear()}size(){let e=0;for(let t of this.hooks.values())e+=t.length;return e}createHandler(e){switch(e.type){case"command":return this.createCommandHandler(e);case"script":return this.createScriptHandler(e);case"prompt":return this.createPromptHandler(e);default:throw new Error(`Unknown hook type: ${e.type}`)}}createCommandHandler(e){return async t=>{if(!e.command)return{};let o=e.command;o=o.replace(/\{\{(\w+)\}\}/g,(s,i)=>String(t[i]??""));let n=await Ct("sh",["-c",o],{cwd:t.cwd||process.cwd(),reject:!1,timeout:6e4,env:process.env});return n.exitCode!==0?{blocked:!0,message:n.stderr||n.stdout||`Command hook "${e.name}" failed`}:{}}}createScriptHandler(e){return async t=>{if(!e.script)return{};let n=await import(e.script.startsWith("/")?e.script:`${t.cwd||process.cwd()}/${e.script}`),s=n.default||n.handler||n;return typeof s=="function"?await s(t):{}}}createPromptHandler(e){return async t=>{if(!e.prompt)return{};let o=e.provider||Q()?.provider||"claude-code",n=Ne();if(!n&&o!=="claude-code")return R.warn(`Prompt hook "${e.name}" skipped: no credentials available for provider "${o}"`),{};try{let{createProvider:s}=await import("./providers-ES5KVLI4.js"),i=s(o,n?.token),c=e.prompt;c=c.replace(/\{\{(\w+)\}\}/g,(m,I)=>String(t[I]??""));let a=`You are a hook validator for agentx. Analyze the following context and respond with ONLY a JSON object (no markdown, no code fences).
21
+ `)}ke();var oe=class{hooks=new Map;register(e,t){if(!t.enabled)return;let o=this.createHandler(t),n={event:e,definition:t,handler:o},s=this.hooks.get(e)||[];s.push(n),s.sort((i,c)=>i.definition.priority-c.definition.priority),this.hooks.set(e,s)}async execute(e,t){let o=this.hooks.get(e);if(!o?.length)return{};let n=Re.includes(e),s={};for(let i of o){let c=Date.now();try{let a=await i.handler({...t,...s}),p=Date.now()-c;if(a.modified&&(s={...s,...a.modified}),n&&a.blocked)return b.hook(i.definition.name,p,"blocked"),{blocked:!0,message:a.message||`Blocked by hook: ${i.definition.name}`,modified:s};b.hook(i.definition.name,p,"ok")}catch(a){let p=Date.now()-c;if(b.hook(i.definition.name,p,`error: ${a.message}`),R.warn(`Hook "${i.definition.name}" failed: ${a.message}`),n)return{blocked:!0,message:`Hook "${i.definition.name}" errored: ${a.message}`}}}return{modified:Object.keys(s).length?s:void 0}}registerHandler(e,t,o,n=100){let i={event:e,definition:{name:t,type:"script",priority:n,enabled:!0},handler:o},c=this.hooks.get(e)||[];c.push(i),c.sort((a,p)=>a.definition.priority-p.definition.priority),this.hooks.set(e,c)}has(e){return!!this.hooks.get(e)?.length}clear(){this.hooks.clear()}size(){let e=0;for(let t of this.hooks.values())e+=t.length;return e}createHandler(e){switch(e.type){case"command":return this.createCommandHandler(e);case"script":return this.createScriptHandler(e);case"prompt":return this.createPromptHandler(e);default:throw new Error(`Unknown hook type: ${e.type}`)}}createCommandHandler(e){return async t=>{if(!e.command)return{};let o=e.command;o=o.replace(/\{\{(\w+)\}\}/g,(s,i)=>String(t[i]??""));let n=await Ct("sh",["-c",o],{cwd:t.cwd||process.cwd(),reject:!1,timeout:6e4,env:process.env});return n.exitCode!==0?{blocked:!0,message:n.stderr||n.stdout||`Command hook "${e.name}" failed`}:{}}}createScriptHandler(e){return async t=>{if(!e.script)return{};let n=await import(e.script.startsWith("/")?e.script:`${t.cwd||process.cwd()}/${e.script}`),s=n.default||n.handler||n;return typeof s=="function"?await s(t):{}}}createPromptHandler(e){return async t=>{if(!e.prompt)return{};let o=e.provider||Q()?.provider||"claude-code",n=Ne();if(!n&&o!=="claude-code")return R.warn(`Prompt hook "${e.name}" skipped: no credentials available for provider "${o}"`),{};try{let{createProvider:s}=await import("./providers-55NC2SFN.js"),i=s(o,n?.token),c=e.prompt;c=c.replace(/\{\{(\w+)\}\}/g,(m,I)=>String(t[I]??""));let a=`You are a hook validator for agentx. Analyze the following context and respond with ONLY a JSON object (no markdown, no code fences).
22
22
 
23
23
  Response format:
24
24
  {"action": "allow", "message": "optional explanation"}
@@ -48,7 +48,7 @@ The "modified" field is optional and can contain updated values to pass forward.
48
48
  ... (output truncated)`:i;return s.exitCode!==0?{tool_use_id:e.id,content:`Command exited with code ${s.exitCode}:
49
49
  ${c}`,is_error:!0}:{tool_use_id:e.id,content:c||"(no output)"}}async editFile(e){let t=String(e.input.path||""),o=e.input.edits,n=ge.resolve(this.cwd,t);if(!o||o.length===0)return{tool_use_id:e.id,content:"No edits provided.",is_error:!0};let s=await W.checkFileWrite(t);if(s==="deny")return{tool_use_id:e.id,content:`File write blocked by permissions: ${t}`,is_error:!0};if(s==="skip")return{tool_use_id:e.id,content:`File write skipped (plan mode): ${t}`};if(f.has("pre:file-write")){let a=await f.execute("pre:file-write",{event:"pre:file-write",file:n,cwd:this.cwd});if(a.blocked)return{tool_use_id:e.id,content:a.message||`File edit blocked by pre:file-write hook: ${t}`,is_error:!0}}let i=await re.readFile(n,"utf8"),c=[];for(let a of o)i.includes(a.old_text)?(i=i.replace(a.old_text,a.new_text),c.push(`Replaced: "${a.old_text.slice(0,40)}..."`)):c.push(`Not found: "${a.old_text.slice(0,40)}..."`);return this.options.dryRun||await re.writeFile(n,i,"utf8"),f.has("post:file-write")&&await f.execute("post:file-write",{event:"post:file-write",file:n,fileContent:i,cwd:this.cwd}),{tool_use_id:e.id,content:`Edited ${t}:
50
50
  ${c.join(`
51
- `)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),n=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-US7IWI5G.js"),c=i();if(!c)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(c).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:n*1e3});return p.success?{tool_use_id:e.id,content:`Sub-agent "${t}" completed (${Math.round(p.duration/1e3)}s):
51
+ `)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),n=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-HUJEORRW.js"),c=i();if(!c)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(c).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:n*1e3});return p.success?{tool_use_id:e.id,content:`Sub-agent "${t}" completed (${Math.round(p.duration/1e3)}s):
52
52
 
53
53
  ${p.content}`}:{tool_use_id:e.id,content:`Sub-agent "${t}" failed: ${p.error}`,is_error:!0}}catch(s){return{tool_use_id:e.id,content:`Failed to spawn sub-agent: ${s.message}`,is_error:!0}}}async askUser(e){let t=String(e.input.question||""),o=e.input.options,n=t;return o?.length&&(n+=`
54
54
  Options: ${o.join(", ")}`),{tool_use_id:e.id,content:"Question sent to user.",followUp:n}}};async function Ae(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,cwd:s,maxIterations:i=20,enabledTools:c,interactive:a=!0,overwrite:p=!1,dryRun:l=!1,onProgress:d,abortSignal:u}=r,m=u?{...n,abortSignal:u}:n;if(!e.generateRaw)return dt(r);let I=new se(s,{interactive:a,overwrite:p,dryRun:l,acmeContext:r.acmeContext,abortSignal:u}),D=be(c);if(r.acmeContext)for(let g of at)D.push({name:g.name,description:g.description,input_schema:g.input_schema});let E=new Set;if(r.mcpTools?.length)for(let g of r.mcpTools)D.push({name:g.name,description:g.description,input_schema:g.input_schema}),E.add(g.name);let C=o.filter(g=>g.role!=="system").map(g=>({role:g.role,content:g.content})),B=[],G=0,F=0,A=0,O="",j,_=0;for(;_<i;){if(_++,u?.aborted)throw new Error("cancelled");d?.({type:"iteration_start",iteration:_}),b.step(_,`Agentic loop iteration (${D.length} tools available)`);let g,M=!!e.generateRawStream&&!!d;try{if(M){let T=null,U=null,v="";for await(let x of e.generateRawStream(C,t,D,m))x.type==="text_delta"?(v+=x.text,d?.({type:"text_delta",text:x.text})):x.type==="thinking_delta"?d?.({type:"thinking_delta",text:x.text}):x.type==="raw_result"?T=x.result:x.type==="error"&&(U=x.error);if(U&&!T)throw new Error(U);if(!T)throw new Error("generateRawStream returned no raw_result event");g=T,g._streamedText=v}else g=await e.generateRaw(C,t,D,m)}catch(T){if(T.message?.includes("not available"))return dt(r);throw T}G+=g.usage.input_tokens+g.usage.output_tokens,F+=g.usage.input_tokens,A+=g.usage.output_tokens;let P=g._streamedText;for(let T of g.content)T.type==="text"&&(O+=T.text,P===void 0&&d?.({type:"text_delta",text:T.text}));if(P!==void 0&&delete g._streamedText,g.stop_reason==="end_turn"||g.stop_reason==="max_tokens")break;if(g.stop_reason==="tool_use"){let T=g.content.filter(v=>v.type==="tool_use");if(T.length===0)break;C.push({role:"assistant",content:g.content});let U=[];for(let v of T){d?.({type:"tool_call",name:v.name,id:v.id,input:v.input}),b.step(_,`Tool call: ${v.name}`);let x;if(E.has(v.name)&&r.mcpDispatch){let h=await r.mcpDispatch(v.name,v.input);x={tool_use_id:v.id,content:h.content,is_error:h.isError}}else x=await I.execute({name:v.name,id:v.id,input:v.input});d?.({type:"tool_result",name:v.name,id:v.id,content:x.content.slice(0,200),is_error:x.is_error}),x.files?.length&&(B.push(...x.files),d?.({type:"files_created",files:x.files})),x.followUp&&(j=x.followUp),U.push({type:"tool_result",tool_use_id:x.tool_use_id,content:x.content,is_error:x.is_error})}if(C.push({role:"user",content:U}),j)break;continue}break}return d?.({type:"complete",iterations:_,totalTokens:G}),{files:B,content:O,followUp:j,tokensUsed:G,inputTokens:F||void 0,outputTokens:A||void 0,iterations:_}}async function dt(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,maxIterations:s=5}=r,c=[{role:"system",content:t+`
@@ -65,7 +65,7 @@ ${D}`:"")}),c.push({role:"user",content:"Continue generating the remaining files
65
65
  `))>=0;){let a=n.slice(0,c);n=n.slice(c+2);let p=[];for(let u of a.split(`
66
66
  `)){let m=u.replace(/\r$/,"");m.startsWith("data:")&&p.push(m.slice(5).trim())}if(!p.length)continue;let l=p.join(`
67
67
  `);if(!l||l==="[DONE]")continue;let d;try{d=JSON.parse(l)}catch{continue}if(d&&d.id===e)return d}}}finally{try{t.cancel().catch(()=>{})}catch{}}throw new Error(`SSE stream ended without a response for id=${e}`)}var Ue=class{constructor(e,t){this.name=e;this.transport=Wt(t)?new Ie(e,t):new je(e,t)}transport;async initialize(){await this.transport.request("initialize",{protocolVersion:Lt,capabilities:{},clientInfo:{name:"agentx-orchestrator",version:"0.1.0"}},ut),this.transport.notify("notifications/initialized")}async listTools(){return((await this.transport.request("tools/list",{},ut)).tools??[]).map(t=>({name:t.name,description:t.description??"",input_schema:t.inputSchema??{type:"object",properties:{}}}))}async callTool(e,t){let o=await this.transport.request("tools/call",{name:e,arguments:t??{}},qt),n=[];for(let s of o.content??[])s?.type==="text"&&typeof s.text=="string"?n.push(s.text):n.push(JSON.stringify(s));return{content:n.join(`
68
- `)||"(no output)",isError:o.isError}}close(){this.transport.close()}};async function He(r){let e=new Map,t=[],o=new Map;for(let[n,s]of Object.entries(r)){let i=new Ue(n,s);try{await i.initialize();let c=await i.listTools();for(let a of c){let p=`${Bt}${n}__${a.name}`;t.push({name:p,description:a.description||`${n}.${a.name}`,input_schema:a.input_schema}),o.set(p,{client:i,remote:a.name})}e.set(n,i)}catch(c){b.context("mcp",`${n}: skipped \u2014 ${c.message}`),i.close()}}return{tools:t,async dispatch(n,s){let i=o.get(n);if(!i)return{content:`Unknown MCP tool: ${n}`,isError:!0};try{return await i.client.callTool(i.remote,s)}catch(c){return{content:`MCP call failed: ${c.message}`,isError:!0}}},close(){for(let n of e.values())n.close()}}}var he=class{queue=[];resolvers=[];closed=!1;push(e){if(this.closed)return;let t=this.resolvers.shift();if(t){t({value:e,done:!1});return}this.queue.push(e)}close(){if(!this.closed){this.closed=!0;for(let e of this.resolvers.splice(0))e({value:void 0,done:!0})}}async next(){return this.queue.length?{value:this.queue.shift(),done:!1}:this.closed?{value:void 0,done:!0}:new Promise(e=>{this.resolvers.push(e)})}async*[Symbol.asyncIterator](){for(;;){let{value:e,done:t}=await this.next();if(t)return;yield e}}};async function mt(r,e,t){let o=qe.parse(t||{}),n=new ne(r);await n.load();let[s,i,c]=await Promise.all([Ge(r),We(r),Le(r)]),a="";if(o.context7.enabled)try{a=await Ve(s,e,o.context7.apiKey)}catch{}let p=n.buildMemoryContext(e),l=Ee(r);return b.context("memory",p?"loaded":"empty"),b.context("instructions",l?"loaded from project":"none"),{techStack:s,schemas:i,skills:c,docs:a,config:o,memoryContext:p,projectInstructions:l}}async function Zn(r){let{task:e,cwd:t,overwrite:o=!1,dryRun:n=!1,provider:s="claude-code",model:i,apiKey:c,context7:a=!0,interactive:p=!0}=r,l=e;if(f.has("pre:prompt")){let h=await f.execute("pre:prompt",{event:"pre:prompt",task:e,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by pre:prompt hook");h.modified?.task&&(l=String(h.modified.task))}if(f.has("pre:generate")){let h=await f.execute("pre:generate",{event:"pre:generate",task:l,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by pre:generate hook")}R.info("Analyzing project...");let d=await mt(t,l,{provider:s,context7:{enabled:a,apiKey:c}}),u=Pe(r.outputType,l);R.info(`Output type: ${u}`);let m=_e(d.skills,l,u);m.length&&R.info(`Loaded ${m.length} relevant skill(s): ${m.map(h=>h.skill.frontmatter.name).join(", ")}`);let I=ft(d,u,m.map(h=>h.skill));if(!await we(c))throw new Error("No credentials configured. Run `agentx model` to set up.");let E=ve(s,c,r.providerOpts||{}),C=i||Q()?.model,B=[...r.sessionMessages||[],{role:"user",content:l}];R.info("Generating...");let G=Oe(E),F=r.maxSteps??(G?20:5),A=r.mcpServers&&Object.keys(r.mcpServers).length>0?await He(r.mcpServers):void 0,O;try{O=await Ae({provider:E,systemPrompt:I,messages:[{role:"system",content:I},...B],providerOptions:{model:C,maxTokens:8192},cwd:t,maxIterations:F,enabledTools:d.config.agentic.enabledTools.filter(h=>!d.config.agentic.disabledTools.includes(h)),interactive:p,overwrite:o,dryRun:n,acmeContext:r.acmeContext,abortSignal:r.abortSignal,mcpTools:A?.tools,mcpDispatch:A?A.dispatch.bind(A):void 0,onProgress:h=>{h.type==="iteration_start"&&h.iteration>1&&R.info(`Step ${h.iteration}/${F}...`),h.type==="tool_call"&&b.step(0,`Tool: ${h.name}`)}})}finally{A?.close()}if(O.tokensUsed){let h=C||"claude-sonnet-4-20250514",V=Math.round(O.tokensUsed*.3),Y=O.tokensUsed-V;te.recordStep(1,h,V,Y)}let{content:j}=O,{followUp:_,tokensUsed:g,inputTokens:M,outputTokens:P}=O;if(O.iterations>1&&R.info(`Completed in ${O.iterations} step(s)`),f.has("post:response")){let h=await f.execute("post:response",{event:"post:response",content:j,task:l,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by post:response hook");h.modified?.content&&(j=String(h.modified.content))}if(_&&p)return{files:{written:[],skipped:[],errors:[]},content:j,outputType:u,followUp:_,tokensUsed:g,inputTokens:M,outputTokens:P};let T=new Map;for(let h of O.files)T.set(h.path,h);let U=fe(u,d.techStack,r.outputDir),v=await me(Array.from(T.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:U}),x;if(r.heal!==!1&&!n&&v.written.length>0){let{HealEngine:h}=await import("./heal-CMQL5SG4.js");x=await new h(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(v.written,l),!x.healed&&x.error&&await f.execute("on:error",{event:"on:error",error:new Error(x.error),task:l,cwd:t})}return f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:j,cwd:t}),{files:v,content:j,outputType:u,tokensUsed:g,inputTokens:M,outputTokens:P,healResult:x}}async function*er(r){let{task:e,cwd:t,overwrite:o=!1,dryRun:n=!1,provider:s="claude-code",model:i,apiKey:c,context7:a=!0,interactive:p=!0}=r,l=e;if(f.has("pre:prompt")){let y=await f.execute("pre:prompt",{event:"pre:prompt",task:e,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by pre:prompt hook"};return}y.modified?.task&&(l=String(y.modified.task))}if(f.has("pre:generate")){let y=await f.execute("pre:generate",{event:"pre:generate",task:l,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by pre:generate hook"};return}}let d=await mt(t,l,{provider:s,context7:{enabled:a,apiKey:c}}),u=Pe(r.outputType,l);yield{type:"context_ready",outputType:u};let m=_e(d.skills,l,u),I=ft(d,u,m.map(y=>y.skill));if(!await we(c)){yield{type:"error",error:"No credentials configured. Run `agentx model` to set up."};return}let E=ve(s,c,r.providerOpts||{}),C=i||Q()?.model,B=Oe(E),G=r.maxSteps??(B?20:5),F=[...r.sessionMessages||[],{role:"user",content:l}];if(B){let y=new he,S,k,H;if(r.mcpServers&&Object.keys(r.mcpServers).length>0)try{H=await He(r.mcpServers)}catch(w){yield{type:"error",error:`MCP pool startup failed: ${w.message}`};return}let ie=(async()=>{try{S=await Ae({provider:E,systemPrompt:I,messages:[{role:"system",content:I},...F],providerOptions:{model:C,maxTokens:8192},cwd:t,maxIterations:G,abortSignal:r.abortSignal,enabledTools:d.config.agentic.enabledTools.filter(w=>!d.config.agentic.disabledTools.includes(w)),interactive:p,overwrite:o,dryRun:n,acmeContext:r.acmeContext,mcpTools:H?.tools,mcpDispatch:H?H.dispatch.bind(H):void 0,onProgress:w=>{w.type==="text_delta"&&y.push({type:"text_delta",text:w.text}),w.type==="thinking_delta"&&y.push({type:"thinking_delta",text:w.text}),w.type==="iteration_start"&&y.push({type:"iteration",iteration:w.iteration}),w.type==="tool_call"&&y.push({type:"tool_call",name:w.name,id:w.id}),w.type==="tool_result"&&y.push({type:"tool_result",name:w.name,id:w.id,is_error:w.is_error}),w.type==="files_created"&&y.push({type:"step_complete",step:0,filesCount:w.files.length})}})}catch(w){k=w}finally{H?.close(),y.close()}})();for await(let w of y)yield w;if(await ie,k){yield{type:"error",error:k instanceof Error?k.message:String(k)};return}if(!S){yield{type:"error",error:"Agentic loop failed without a result"};return}yield{type:"done",result:{content:S.content,files:S.files,tokensUsed:S.tokensUsed,followUp:S.followUp}};let{content:L}=S;if(f.has("post:response")){let w=await f.execute("post:response",{event:"post:response",content:L,task:l,cwd:t});if(w.blocked){yield{type:"error",error:w.message||"Blocked by post:response hook"};return}w.modified?.content&&(L=String(w.modified.content))}if(S.followUp&&p){yield{type:"generate_result",result:{files:{written:[],skipped:[],errors:[]},content:L,outputType:u,followUp:S.followUp,tokensUsed:S.tokensUsed,inputTokens:S.inputTokens,outputTokens:S.outputTokens}};return}let ae=new Map;for(let w of S.files)ae.set(w.path,w);let De=fe(u,d.techStack,r.outputDir),z=await me(Array.from(ae.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:De}),J;if(r.heal!==!1&&!n&&z.written.length>0){let{HealEngine:w}=await import("./heal-CMQL5SG4.js");J=await new w(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(z.written,l)}f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:L,cwd:t}),yield{type:"generate_result",result:{files:z,content:L,outputType:u,tokensUsed:S.tokensUsed,inputTokens:S.inputTokens,outputTokens:S.outputTokens,healResult:J}};return}let A=[{role:"system",content:I},...F],O=[],j=0,_="",g,M=0;M++,b.step(M,`Starting generation (model: ${C||"default"})`);let P;if(E.stream){let y="",S;for await(let k of E.stream(A,{model:C,maxTokens:8192}))yield k,k.type==="text_delta"&&(y+=k.text),k.type==="done"&&(S=k.result);P=S||{content:y,files:[],tokensUsed:0}}else{let y=await E.generate(A,{model:C,maxTokens:8192});y.content&&(yield{type:"text_delta",text:y.content}),yield{type:"done",result:y},P=y}j+=P.tokensUsed||0,_=P.content;let T=P.tokensUsed||0,U=C||"claude-sonnet-4-20250514",v=Math.round(T*.3),x=T-v;if(te.recordStep(M,U,v,x),b.api("generate",U,T),b.step(M,`Generated ${P.files.length} file(s), ${T} tokens`),P.files.length&&O.push(...P.files),P.followUp&&(g=P.followUp),yield{type:"step_complete",step:M,filesCount:P.files.length},!g&&(_.includes("[CONTINUE]")||_.includes("Next, I'll")||_.includes("Now let me")||_.includes("I'll also generate"))&&P.files.length>0){let S=P.files.map(k=>`Created: ${k.path}${k.description?` \u2014 ${k.description}`:""}`).join(`
68
+ `)||"(no output)",isError:o.isError}}close(){this.transport.close()}};async function He(r){let e=new Map,t=[],o=new Map;for(let[n,s]of Object.entries(r)){let i=new Ue(n,s);try{await i.initialize();let c=await i.listTools();for(let a of c){let p=`${Bt}${n}__${a.name}`;t.push({name:p,description:a.description||`${n}.${a.name}`,input_schema:a.input_schema}),o.set(p,{client:i,remote:a.name})}e.set(n,i)}catch(c){b.context("mcp",`${n}: skipped \u2014 ${c.message}`),i.close()}}return{tools:t,async dispatch(n,s){let i=o.get(n);if(!i)return{content:`Unknown MCP tool: ${n}`,isError:!0};try{return await i.client.callTool(i.remote,s)}catch(c){return{content:`MCP call failed: ${c.message}`,isError:!0}}},close(){for(let n of e.values())n.close()}}}var he=class{queue=[];resolvers=[];closed=!1;push(e){if(this.closed)return;let t=this.resolvers.shift();if(t){t({value:e,done:!1});return}this.queue.push(e)}close(){if(!this.closed){this.closed=!0;for(let e of this.resolvers.splice(0))e({value:void 0,done:!0})}}async next(){return this.queue.length?{value:this.queue.shift(),done:!1}:this.closed?{value:void 0,done:!0}:new Promise(e=>{this.resolvers.push(e)})}async*[Symbol.asyncIterator](){for(;;){let{value:e,done:t}=await this.next();if(t)return;yield e}}};async function mt(r,e,t){let o=qe.parse(t||{}),n=new ne(r);await n.load();let[s,i,c]=await Promise.all([Ge(r),We(r),Le(r)]),a="";if(o.context7.enabled)try{a=await Ve(s,e,o.context7.apiKey)}catch{}let p=n.buildMemoryContext(e),l=Ee(r);return b.context("memory",p?"loaded":"empty"),b.context("instructions",l?"loaded from project":"none"),{techStack:s,schemas:i,skills:c,docs:a,config:o,memoryContext:p,projectInstructions:l}}async function Zn(r){let{task:e,cwd:t,overwrite:o=!1,dryRun:n=!1,provider:s="claude-code",model:i,apiKey:c,context7:a=!0,interactive:p=!0}=r,l=e;if(f.has("pre:prompt")){let h=await f.execute("pre:prompt",{event:"pre:prompt",task:e,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by pre:prompt hook");h.modified?.task&&(l=String(h.modified.task))}if(f.has("pre:generate")){let h=await f.execute("pre:generate",{event:"pre:generate",task:l,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by pre:generate hook")}R.info("Analyzing project...");let d=await mt(t,l,{provider:s,context7:{enabled:a,apiKey:c}}),u=Pe(r.outputType,l);R.info(`Output type: ${u}`);let m=_e(d.skills,l,u);m.length&&R.info(`Loaded ${m.length} relevant skill(s): ${m.map(h=>h.skill.frontmatter.name).join(", ")}`);let I=ft(d,u,m.map(h=>h.skill));if(!await we(c))throw new Error("No credentials configured. Run `agentx model` to set up.");let E=ve(s,c,r.providerOpts||{}),C=i||Q()?.model,B=[...r.sessionMessages||[],{role:"user",content:l}];R.info("Generating...");let G=Oe(E),F=r.maxSteps??(G?20:5),A=r.mcpServers&&Object.keys(r.mcpServers).length>0?await He(r.mcpServers):void 0,O;try{O=await Ae({provider:E,systemPrompt:I,messages:[{role:"system",content:I},...B],providerOptions:{model:C,maxTokens:8192},cwd:t,maxIterations:F,enabledTools:d.config.agentic.enabledTools.filter(h=>!d.config.agentic.disabledTools.includes(h)),interactive:p,overwrite:o,dryRun:n,acmeContext:r.acmeContext,abortSignal:r.abortSignal,mcpTools:A?.tools,mcpDispatch:A?A.dispatch.bind(A):void 0,onProgress:h=>{h.type==="iteration_start"&&h.iteration>1&&R.info(`Step ${h.iteration}/${F}...`),h.type==="tool_call"&&b.step(0,`Tool: ${h.name}`)}})}finally{A?.close()}if(O.tokensUsed){let h=C||"claude-sonnet-4-20250514",V=Math.round(O.tokensUsed*.3),Y=O.tokensUsed-V;te.recordStep(1,h,V,Y)}let{content:j}=O,{followUp:_,tokensUsed:g,inputTokens:M,outputTokens:P}=O;if(O.iterations>1&&R.info(`Completed in ${O.iterations} step(s)`),f.has("post:response")){let h=await f.execute("post:response",{event:"post:response",content:j,task:l,cwd:t});if(h.blocked)throw new Error(h.message||"Blocked by post:response hook");h.modified?.content&&(j=String(h.modified.content))}if(_&&p)return{files:{written:[],skipped:[],errors:[]},content:j,outputType:u,followUp:_,tokensUsed:g,inputTokens:M,outputTokens:P};let T=new Map;for(let h of O.files)T.set(h.path,h);let U=fe(u,d.techStack,r.outputDir),v=await me(Array.from(T.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:U}),x;if(r.heal!==!1&&!n&&v.written.length>0){let{HealEngine:h}=await import("./heal-U67X6NIN.js");x=await new h(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(v.written,l),!x.healed&&x.error&&await f.execute("on:error",{event:"on:error",error:new Error(x.error),task:l,cwd:t})}return f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:j,cwd:t}),{files:v,content:j,outputType:u,tokensUsed:g,inputTokens:M,outputTokens:P,healResult:x}}async function*er(r){let{task:e,cwd:t,overwrite:o=!1,dryRun:n=!1,provider:s="claude-code",model:i,apiKey:c,context7:a=!0,interactive:p=!0}=r,l=e;if(f.has("pre:prompt")){let y=await f.execute("pre:prompt",{event:"pre:prompt",task:e,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by pre:prompt hook"};return}y.modified?.task&&(l=String(y.modified.task))}if(f.has("pre:generate")){let y=await f.execute("pre:generate",{event:"pre:generate",task:l,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by pre:generate hook"};return}}let d=await mt(t,l,{provider:s,context7:{enabled:a,apiKey:c}}),u=Pe(r.outputType,l);yield{type:"context_ready",outputType:u};let m=_e(d.skills,l,u),I=ft(d,u,m.map(y=>y.skill));if(!await we(c)){yield{type:"error",error:"No credentials configured. Run `agentx model` to set up."};return}let E=ve(s,c,r.providerOpts||{}),C=i||Q()?.model,B=Oe(E),G=r.maxSteps??(B?20:5),F=[...r.sessionMessages||[],{role:"user",content:l}];if(B){let y=new he,S,k,H;if(r.mcpServers&&Object.keys(r.mcpServers).length>0)try{H=await He(r.mcpServers)}catch(w){yield{type:"error",error:`MCP pool startup failed: ${w.message}`};return}let ie=(async()=>{try{S=await Ae({provider:E,systemPrompt:I,messages:[{role:"system",content:I},...F],providerOptions:{model:C,maxTokens:8192},cwd:t,maxIterations:G,abortSignal:r.abortSignal,enabledTools:d.config.agentic.enabledTools.filter(w=>!d.config.agentic.disabledTools.includes(w)),interactive:p,overwrite:o,dryRun:n,acmeContext:r.acmeContext,mcpTools:H?.tools,mcpDispatch:H?H.dispatch.bind(H):void 0,onProgress:w=>{w.type==="text_delta"&&y.push({type:"text_delta",text:w.text}),w.type==="thinking_delta"&&y.push({type:"thinking_delta",text:w.text}),w.type==="iteration_start"&&y.push({type:"iteration",iteration:w.iteration}),w.type==="tool_call"&&y.push({type:"tool_call",name:w.name,id:w.id}),w.type==="tool_result"&&y.push({type:"tool_result",name:w.name,id:w.id,is_error:w.is_error}),w.type==="files_created"&&y.push({type:"step_complete",step:0,filesCount:w.files.length})}})}catch(w){k=w}finally{H?.close(),y.close()}})();for await(let w of y)yield w;if(await ie,k){yield{type:"error",error:k instanceof Error?k.message:String(k)};return}if(!S){yield{type:"error",error:"Agentic loop failed without a result"};return}yield{type:"done",result:{content:S.content,files:S.files,tokensUsed:S.tokensUsed,followUp:S.followUp}};let{content:L}=S;if(f.has("post:response")){let w=await f.execute("post:response",{event:"post:response",content:L,task:l,cwd:t});if(w.blocked){yield{type:"error",error:w.message||"Blocked by post:response hook"};return}w.modified?.content&&(L=String(w.modified.content))}if(S.followUp&&p){yield{type:"generate_result",result:{files:{written:[],skipped:[],errors:[]},content:L,outputType:u,followUp:S.followUp,tokensUsed:S.tokensUsed,inputTokens:S.inputTokens,outputTokens:S.outputTokens}};return}let ae=new Map;for(let w of S.files)ae.set(w.path,w);let De=fe(u,d.techStack,r.outputDir),z=await me(Array.from(ae.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:De}),J;if(r.heal!==!1&&!n&&z.written.length>0){let{HealEngine:w}=await import("./heal-U67X6NIN.js");J=await new w(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(z.written,l)}f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:L,cwd:t}),yield{type:"generate_result",result:{files:z,content:L,outputType:u,tokensUsed:S.tokensUsed,inputTokens:S.inputTokens,outputTokens:S.outputTokens,healResult:J}};return}let A=[{role:"system",content:I},...F],O=[],j=0,_="",g,M=0;M++,b.step(M,`Starting generation (model: ${C||"default"})`);let P;if(E.stream){let y="",S;for await(let k of E.stream(A,{model:C,maxTokens:8192}))yield k,k.type==="text_delta"&&(y+=k.text),k.type==="done"&&(S=k.result);P=S||{content:y,files:[],tokensUsed:0}}else{let y=await E.generate(A,{model:C,maxTokens:8192});y.content&&(yield{type:"text_delta",text:y.content}),yield{type:"done",result:y},P=y}j+=P.tokensUsed||0,_=P.content;let T=P.tokensUsed||0,U=C||"claude-sonnet-4-20250514",v=Math.round(T*.3),x=T-v;if(te.recordStep(M,U,v,x),b.api("generate",U,T),b.step(M,`Generated ${P.files.length} file(s), ${T} tokens`),P.files.length&&O.push(...P.files),P.followUp&&(g=P.followUp),yield{type:"step_complete",step:M,filesCount:P.files.length},!g&&(_.includes("[CONTINUE]")||_.includes("Next, I'll")||_.includes("Now let me")||_.includes("I'll also generate"))&&P.files.length>0){let S=P.files.map(k=>`Created: ${k.path}${k.description?` \u2014 ${k.description}`:""}`).join(`
69
69
  `);for(A.push({role:"assistant",content:_+(S?`
70
70
 
71
71
  Files created:
@@ -73,7 +73,7 @@ ${S}`:"")}),A.push({role:"user",content:"Continue generating the remaining files
73
73
  `);A.push({role:"assistant",content:k.content+(z?`
74
74
 
75
75
  Files created:
76
- ${z}`:"")}),A.push({role:"user",content:"Continue generating the remaining files. Build on what you've already created. When finished, do not include [CONTINUE] in your response."})}}if(f.has("post:response")){let y=await f.execute("post:response",{event:"post:response",content:_,task:l,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by post:response hook"};return}y.modified?.content&&(_=String(y.modified.content))}if(g&&p){yield{type:"generate_result",result:{files:{written:[],skipped:[],errors:[]},content:_,outputType:u,followUp:g,tokensUsed:j}};return}let h=new Map;for(let y of O)h.set(y.path,y);let V=fe(u,d.techStack,r.outputDir),Y=await me(Array.from(h.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:V}),X;if(r.heal!==!1&&!n&&Y.written.length>0){let{HealEngine:y}=await import("./heal-CMQL5SG4.js");X=await new y(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(Y.written,l),!X.healed&&X.error&&await f.execute("on:error",{event:"on:error",error:new Error(X.error),task:l,cwd:t})}f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:_,cwd:t}),yield{type:"generate_result",result:{files:Y,content:_,outputType:u,tokensUsed:j,healResult:X}}}function ft(r,e,t){let o=[];o.push(`You are agentx, an agentic code generation tool. You generate high-quality, production-ready output for any tech stack.
76
+ ${z}`:"")}),A.push({role:"user",content:"Continue generating the remaining files. Build on what you've already created. When finished, do not include [CONTINUE] in your response."})}}if(f.has("post:response")){let y=await f.execute("post:response",{event:"post:response",content:_,task:l,cwd:t});if(y.blocked){yield{type:"error",error:y.message||"Blocked by post:response hook"};return}y.modified?.content&&(_=String(y.modified.content))}if(g&&p){yield{type:"generate_result",result:{files:{written:[],skipped:[],errors:[]},content:_,outputType:u,followUp:g,tokensUsed:j}};return}let h=new Map;for(let y of O)h.set(y.path,y);let V=fe(u,d.techStack,r.outputDir),Y=await me(Array.from(h.values()),{cwd:t,overwrite:o,dryRun:n,outputDir:V}),X;if(r.heal!==!1&&!n&&Y.written.length>0){let{HealEngine:y}=await import("./heal-U67X6NIN.js");X=await new y(t,{enabled:!0,testCommand:r.healConfig?.testCommand,buildCommand:r.healConfig?.buildCommand,lintCommand:r.healConfig?.lintCommand,maxAttempts:r.healConfig?.maxAttempts??3,provider:s,model:C,apiKey:c}).detectAndHeal(Y.written,l),!X.healed&&X.error&&await f.execute("on:error",{event:"on:error",error:new Error(X.error),task:l,cwd:t})}f.has("post:generate")&&await f.execute("post:generate",{event:"post:generate",task:l,content:_,cwd:t}),yield{type:"generate_result",result:{files:Y,content:_,outputType:u,tokensUsed:j,healResult:X}}}function ft(r,e,t){let o=[];o.push(`You are agentx, an agentic code generation tool. You generate high-quality, production-ready output for any tech stack.
77
77
 
78
78
  Your primary tool is \`create_files\` \u2014 use it to output all generated code, documents, and configs as files.
79
79
  If the request is ambiguous or you need critical information to proceed correctly, use \`ask_user\` to ask a clarifying question.
@@ -123,4 +123,4 @@ ${r.projectInstructions}`),r.memoryContext&&o.push(r.memoryContext),o.push(`# Ou
123
123
  Generate output appropriate for: ${e}. Use the \`create_files\` tool to output all files.`),o.join(`
124
124
 
125
125
  `)}export{qe as a,Vt as b,Yt as c,We as d,ze as e,Ve as f,Ye as g,Pe as h,ee as i,Re as j,le as k,te as l,Tt as m,oe as n,Mt as o,f as p,et as q,tt as r,Me as s,de as t,W as u,ne as v,it as w,Ee as x,$e as y,se as z,mt as A,Zn as B,er as C};
126
- //# sourceMappingURL=chunk-ANV4T62P.js.map
126
+ //# sourceMappingURL=chunk-YU5NDKPA.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-7ZNCVU5A.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.parse();
2
+ import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-IEMICVO3.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.parse();
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g}from"./chunk-2JEJIVOZ.js";import"./chunk-34KJ4Q4E.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
- //# sourceMappingURL=client-MYU23KWY.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-C4S5XQKD.js";import"./chunk-Y5HBYSJW.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-QTXWO46T.js.map
@@ -17,12 +17,12 @@ Format as a structured summary:
17
17
  Keep it under 500 words. Prioritize actionable information over conversational flow.
18
18
  Do NOT include greetings, acknowledgments, or meta-commentary about the conversation.`;function G(t){return t.length<F?!1:t.reduce((n,e)=>n+e.content.length,0)>A}async function J(t,o,n,e){if(t.length<F)return{summary:"",compactedCount:0,keptCount:t.length,memoryFlushed:!1};let r=Math.max(0,t.length-K),s=t.slice(0,r),c=t.slice(r);if(s.length===0)return{summary:"",compactedCount:0,keptCount:c.length,memoryFlushed:!1};let a=d(s);M(o,a);let m=!1;if(n)try{await $(o,s,n,e),m=!0}catch{}let u=j(s),l=await z(u),{qualityScore:i,lostEntities:g}=B(u,l),p,x=[{role:"agent",content:l,timestamp:new Date().toISOString()}],D=d(x),h=v(o);return h&&(p=S(h,D)),{summary:l,compactedCount:s.length,keptCount:c.length,memoryFlushed:m,qualityScore:i,lostEntities:g.length>0?g:void 0,drift:p&&p.overallScore>.1?p:void 0}}function B(t,o){let n=_(t);if(n.length===0)return{qualityScore:100,lostEntities:[]};let e=o.toLowerCase(),r=[],s=[];for(let a of n)e.includes(a.toLowerCase())?r.push(a):s.push(a);return{qualityScore:Math.round(r.length/n.length*100),lostEntities:s}}function _(t){let o=[],n=new Set,e=i=>{let g=i.toLowerCase().trim();g.length<3||n.has(g)||(n.add(g),o.push(i.trim()))},r=t.match(/https?:\/\/[^\s<>)"]+/g)||[];for(let i of r)e(i.slice(0,80));let s=t.match(/(?:\/[\w.-]+){2,}/g)||[];for(let i of s)e(i);let c=t.match(/[#!]\d{2,}/g)||[];for(let i of c)e(i);let a=t.match(/[\w.-]+@[\w.-]+\.\w+/g)||[];for(let i of a)e(i);let m=t.match(/"([^"]{3,40})"/g)||[];for(let i of m)e(i.slice(1,-1));let u=t.match(/[A-Z][a-z]+(?:\s+[A-Z][a-z]+)+/g)||[];for(let i of u)e(i);let l=t.match(/[a-f0-9]{8,}/gi)||[];for(let i of l.slice(0,5))e(i);return o.slice(0,30)}function W(t,o){if(o.compactedCount===0)return t;let n=t.slice(-o.keptCount);return[{role:"agent",name:"system",content:`[Compacted conversation summary \u2014 ${o.compactedCount} earlier messages]
19
19
 
20
- ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e){let r=[],s=[];for(let a of o)a.role==="user"?r.push(`${a.name||"User"}: ${a.content}`):s.push(a.content);if(r.length===0||s.length===0)return;let{extractMemories:c}=await import("./memory-extract-YCNCARZ2.js");await c(t,r.join(`
20
+ ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e){let r=[],s=[];for(let a of o)a.role==="user"?r.push(`${a.name||"User"}: ${a.content}`):s.push(a.content);if(r.length===0||s.length===0)return;let{extractMemories:c}=await import("./memory-extract-ATD6YLRK.js");await c(t,r.join(`
21
21
  `),s.join(`
22
22
  `),{channel:e?.channel??"compaction",chatId:e?.chatId??"flush",sender:"compaction"},n)}function j(t){return t.map(o=>{let n=o.timestamp.slice(11,16),e=o.role==="user"?o.name||"User":o.name||"Agent";return`[${n}] ${e}: ${o.content}`}).join(`
23
23
 
24
- `)}async function z(t){let n=t.length>2e4?t.slice(-2e4):t;try{let{createProvider:e}=await import("./providers-ES5KVLI4.js");return(await e("claude").generate([{role:"system",content:P},{role:"user",content:n}],{model:R,maxTokens:1024})).content.trim()}catch{let s=t.split(`
24
+ `)}async function z(t){let n=t.length>2e4?t.slice(-2e4):t;try{let{createProvider:e}=await import("./providers-55NC2SFN.js");return(await e("claude").generate([{role:"system",content:P},{role:"user",content:n}],{model:R,maxTokens:1024})).content.trim()}catch{let s=t.split(`
25
25
  `).slice(-20);return`[Summary unavailable \u2014 keeping last ${s.length} lines]
26
26
  ${s.join(`
27
27
  `)}`}}export{W as applyCompaction,J as compactSession,G as needsCompaction};
28
- //# sourceMappingURL=compaction-MECSN36J.js.map
28
+ //# sourceMappingURL=compaction-FS6XNRLM.js.map
@@ -0,0 +1,2 @@
1
+ import{$ as c,Z as a,_ as b,aa as d,ba as e,ca as f,da as g,ea as h,fa as i,ga as j,ha as k,ia as l,ja as m,ka as n,ma as o}from"./chunk-Y5HBYSJW.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";o();export{a as INTEGRATION_KINDS,j as approvalsConfigSchema,d as callsSchema,c as cameraBotSchema,k as daemonConfigSchema,b as eventSubscriptionSchema,l as expandEnvVars,m as loadDaemonConfig,h as membersConfigSchema,g as peopleConfigSchema,f as personSchema,i as requestStatusConfigSchema,e as requestsConfigSchema,n as validateWorkspaces};
2
+ //# sourceMappingURL=config-4XGZYYQP.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-CYKPDILL.js";import"./chunk-Y5HBYSJW.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-QLSA6JOY.js.map
@@ -11,7 +11,7 @@ Rules:
11
11
 
12
12
  Be conservative \u2014 unneeded context costs tokens. When in doubt, exclude.`;async function P(e){let c=Date.now(),i=e.timeoutMs??8e3,r=T(e.sessions,e.agentId,e.channel,e.chatId,4),o=[`Agent: ${e.agentId}`,`Channel: ${e.channel}`,r?`Recent conversation:
13
13
  ${r}`:"Recent conversation: (none \u2014 first message)","",`Current message: ${e.message.slice(0,1500)}`].join(`
14
- `),n;try{let{createProvider:l}=await import("./providers-ES5KVLI4.js"),S=l("claude"),y=new AbortController,p=setTimeout(()=>y.abort(),i);try{let x=await S.generate([{role:"system",content:M},{role:"user",content:o}],{model:I,maxTokens:256,abortSignal:y.signal});n=f(x.content)}finally{clearTimeout(p)}}catch(l){return process.env.AGENTX_PLANNER_DEBUG&&console.error(`[planner] error: ${l?.message??l}`),null}if(!n||typeof n!="object")return null;let m=v(n.recentTurns,0,6,3),t=!!n.memory?.include,s=typeof n.memory?.query=="string"?n.memory.query:"",a=!!n.crossChat,g=typeof n.reasoning=="string"?n.reasoning:void 0,b=w(e.sessions,e.agentId,e.channel,e.chatId,m),u="",h=[];if(t&&s)try{let l=e.memoryStore.findRelevant(s,e.agentId,5);u=e.memoryStore.buildContext(l),h=e.memoryStore.contextFacts(l)}catch{}let d="";return a&&(d=e.sessions.getCrossSessionSummary(e.agentId,e.channel,e.chatId,"")),{sessionHistory:b,memoryContext:u,memoryFacts:h,crossChatContext:d,debug:{recentTurns:m,memoryIncluded:t,memoryQuery:s||void 0,crossChatIncluded:a,reasoning:g,planLatencyMs:Date.now()-c}}}function w(e,c,i,r,o){if(o<=0)return"";let n=e.getSession(c,i,r);if(n.messages.length===0)return"";let m=Math.min(n.messages.length,o*2),t=n.messages.slice(-m),s=[`[Recent exchange \u2014 last ${t.length} messages]`];for(let a of t){let g=a.name||(a.role==="user"?"User":"Agent");s.push(`${g}: ${a.content}`)}return s.push("[End recent exchange \u2014 respond to the latest message above]"),s.push(""),s.join(`
14
+ `),n;try{let{createProvider:l}=await import("./providers-55NC2SFN.js"),S=l("claude"),y=new AbortController,p=setTimeout(()=>y.abort(),i);try{let x=await S.generate([{role:"system",content:M},{role:"user",content:o}],{model:I,maxTokens:256,abortSignal:y.signal});n=f(x.content)}finally{clearTimeout(p)}}catch(l){return process.env.AGENTX_PLANNER_DEBUG&&console.error(`[planner] error: ${l?.message??l}`),null}if(!n||typeof n!="object")return null;let m=v(n.recentTurns,0,6,3),t=!!n.memory?.include,s=typeof n.memory?.query=="string"?n.memory.query:"",a=!!n.crossChat,g=typeof n.reasoning=="string"?n.reasoning:void 0,b=w(e.sessions,e.agentId,e.channel,e.chatId,m),u="",h=[];if(t&&s)try{let l=e.memoryStore.findRelevant(s,e.agentId,5);u=e.memoryStore.buildContext(l),h=e.memoryStore.contextFacts(l)}catch{}let d="";return a&&(d=e.sessions.getCrossSessionSummary(e.agentId,e.channel,e.chatId,"")),{sessionHistory:b,memoryContext:u,memoryFacts:h,crossChatContext:d,debug:{recentTurns:m,memoryIncluded:t,memoryQuery:s||void 0,crossChatIncluded:a,reasoning:g,planLatencyMs:Date.now()-c}}}function w(e,c,i,r,o){if(o<=0)return"";let n=e.getSession(c,i,r);if(n.messages.length===0)return"";let m=Math.min(n.messages.length,o*2),t=n.messages.slice(-m),s=[`[Recent exchange \u2014 last ${t.length} messages]`];for(let a of t){let g=a.name||(a.role==="user"?"User":"Agent");s.push(`${g}: ${a.content}`)}return s.push("[End recent exchange \u2014 respond to the latest message above]"),s.push(""),s.join(`
15
15
  `)}function T(e,c,i,r,o){let n=e.getSession(c,i,r);return n.messages.length===0?"":n.messages.slice(-o).map(t=>{let s=t.name||(t.role==="user"?"User":"Agent"),a=t.content.length>200?t.content.slice(0,200)+"\u2026":t.content;return` ${s}: ${a}`}).join(`
16
16
  `)}function v(e,c,i,r){let o=typeof e=="number"?Math.floor(e):Number.parseInt(String(e??""),10);return Number.isFinite(o)?Math.min(i,Math.max(c,o)):r}export{P as planContext};
17
- //# sourceMappingURL=context-planner-JU7CNXCB.js.map
17
+ //# sourceMappingURL=context-planner-BKHPKDX5.js.map
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e}from"./chunk-Q6ILGUDE.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-34KJ4Q4E.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
2
- //# sourceMappingURL=doctor-AUF5HJPW.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e}from"./chunk-LP227A6L.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-Y5HBYSJW.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
2
+ //# sourceMappingURL=doctor-DO262COW.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-UG2OF2EI.js";import"./chunk-SFQUP3BP.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";export{a as HealEngine};
2
+ //# sourceMappingURL=heal-U67X6NIN.js.map
package/dist/index.d.ts CHANGED
@@ -3512,6 +3512,13 @@ declare const daemonConfigSchema: z.ZodObject<{
3512
3512
  height: z.ZodDefault<z.ZodNumber>;
3513
3513
  frameRate: z.ZodDefault<z.ZodNumber>;
3514
3514
  maxSeconds: z.ZodDefault<z.ZodNumber>;
3515
+ /** Ask the watching agent by voice: hold or tap Talk (#687). Off: the
3516
+ * phone shows the text box only. The microphone opens only while
3517
+ * you talk and is never part of the share. */
3518
+ voiceInput: z.ZodDefault<z.ZodBoolean>;
3519
+ /** Say the watching agent's answers aloud on the phone, in the
3520
+ * agent's voice or the phone's own. The owner can mute it there. */
3521
+ speakAnswers: z.ZodDefault<z.ZodBoolean>;
3515
3522
  /** An agent watching the phone camera. The bot keeps only the newest
3516
3523
  * frame; the agent gets one when asked, and every
3517
3524
  * frameIntervalSeconds when that is set. */
@@ -3529,16 +3536,26 @@ declare const daemonConfigSchema: z.ZodObject<{
3529
3536
  /** Keep the frame files in the agent's workspace after the share ends.
3530
3537
  * Off: every frame is deleted when the share ends. */
3531
3538
  keepFrames: z.ZodDefault<z.ZodBoolean>;
3539
+ /** "Keep watching" on the phone (#687): for a task that needs a stream
3540
+ * ("watch while I do this"), the agent gets a frame every this many
3541
+ * seconds, only while the owner has it on. */
3542
+ streamFrameSeconds: z.ZodDefault<z.ZodNumber>;
3543
+ /** "Keep watching" stops by itself after this many seconds. */
3544
+ streamMaxSeconds: z.ZodDefault<z.ZodNumber>;
3532
3545
  }, "strip", z.ZodTypeAny, {
3533
3546
  frameIntervalSeconds: number;
3534
3547
  maxSessionMinutes: number;
3535
3548
  maxFrameEdge: number;
3536
3549
  keepFrames: boolean;
3550
+ streamFrameSeconds: number;
3551
+ streamMaxSeconds: number;
3537
3552
  }, {
3538
3553
  frameIntervalSeconds?: number | undefined;
3539
3554
  maxSessionMinutes?: number | undefined;
3540
3555
  maxFrameEdge?: number | undefined;
3541
3556
  keepFrames?: boolean | undefined;
3557
+ streamFrameSeconds?: number | undefined;
3558
+ streamMaxSeconds?: number | undefined;
3542
3559
  }>>;
3543
3560
  }, "strip", z.ZodTypeAny, {
3544
3561
  bot: {
@@ -3546,22 +3563,30 @@ declare const daemonConfigSchema: z.ZodObject<{
3546
3563
  maxSessionMinutes: number;
3547
3564
  maxFrameEdge: number;
3548
3565
  keepFrames: boolean;
3566
+ streamFrameSeconds: number;
3567
+ streamMaxSeconds: number;
3549
3568
  };
3550
3569
  width: number;
3551
3570
  height: number;
3552
3571
  frameRate: number;
3553
3572
  maxSeconds: number;
3573
+ voiceInput: boolean;
3574
+ speakAnswers: boolean;
3554
3575
  }, {
3555
3576
  bot?: {
3556
3577
  frameIntervalSeconds?: number | undefined;
3557
3578
  maxSessionMinutes?: number | undefined;
3558
3579
  maxFrameEdge?: number | undefined;
3559
3580
  keepFrames?: boolean | undefined;
3581
+ streamFrameSeconds?: number | undefined;
3582
+ streamMaxSeconds?: number | undefined;
3560
3583
  } | undefined;
3561
3584
  width?: number | undefined;
3562
3585
  height?: number | undefined;
3563
3586
  frameRate?: number | undefined;
3564
3587
  maxSeconds?: number | undefined;
3588
+ voiceInput?: boolean | undefined;
3589
+ speakAnswers?: boolean | undefined;
3565
3590
  }>>;
3566
3591
  }, "strip", z.ZodTypeAny, {
3567
3592
  enabled: boolean;
@@ -3571,11 +3596,15 @@ declare const daemonConfigSchema: z.ZodObject<{
3571
3596
  maxSessionMinutes: number;
3572
3597
  maxFrameEdge: number;
3573
3598
  keepFrames: boolean;
3599
+ streamFrameSeconds: number;
3600
+ streamMaxSeconds: number;
3574
3601
  };
3575
3602
  width: number;
3576
3603
  height: number;
3577
3604
  frameRate: number;
3578
3605
  maxSeconds: number;
3606
+ voiceInput: boolean;
3607
+ speakAnswers: boolean;
3579
3608
  };
3580
3609
  stunServers: string[];
3581
3610
  turnServers: {
@@ -3612,11 +3641,15 @@ declare const daemonConfigSchema: z.ZodObject<{
3612
3641
  maxSessionMinutes?: number | undefined;
3613
3642
  maxFrameEdge?: number | undefined;
3614
3643
  keepFrames?: boolean | undefined;
3644
+ streamFrameSeconds?: number | undefined;
3645
+ streamMaxSeconds?: number | undefined;
3615
3646
  } | undefined;
3616
3647
  width?: number | undefined;
3617
3648
  height?: number | undefined;
3618
3649
  frameRate?: number | undefined;
3619
3650
  maxSeconds?: number | undefined;
3651
+ voiceInput?: boolean | undefined;
3652
+ speakAnswers?: boolean | undefined;
3620
3653
  } | undefined;
3621
3654
  stunServers?: string[] | undefined;
3622
3655
  turnServers?: {
@@ -3752,11 +3785,15 @@ declare const daemonConfigSchema: z.ZodObject<{
3752
3785
  maxSessionMinutes: number;
3753
3786
  maxFrameEdge: number;
3754
3787
  keepFrames: boolean;
3788
+ streamFrameSeconds: number;
3789
+ streamMaxSeconds: number;
3755
3790
  };
3756
3791
  width: number;
3757
3792
  height: number;
3758
3793
  frameRate: number;
3759
3794
  maxSeconds: number;
3795
+ voiceInput: boolean;
3796
+ speakAnswers: boolean;
3760
3797
  };
3761
3798
  stunServers: string[];
3762
3799
  turnServers: {
@@ -3900,11 +3937,15 @@ declare const daemonConfigSchema: z.ZodObject<{
3900
3937
  maxSessionMinutes?: number | undefined;
3901
3938
  maxFrameEdge?: number | undefined;
3902
3939
  keepFrames?: boolean | undefined;
3940
+ streamFrameSeconds?: number | undefined;
3941
+ streamMaxSeconds?: number | undefined;
3903
3942
  } | undefined;
3904
3943
  width?: number | undefined;
3905
3944
  height?: number | undefined;
3906
3945
  frameRate?: number | undefined;
3907
3946
  maxSeconds?: number | undefined;
3947
+ voiceInput?: boolean | undefined;
3948
+ speakAnswers?: boolean | undefined;
3908
3949
  } | undefined;
3909
3950
  stunServers?: string[] | undefined;
3910
3951
  turnServers?: {
@@ -4953,6 +4994,105 @@ declare const daemonConfigSchema: z.ZodObject<{
4953
4994
  pollSeconds?: number | undefined;
4954
4995
  lookbackHours?: number | undefined;
4955
4996
  }>>;
4997
+ /** The phone app (/app) beyond pairing and notifications (#676). */
4998
+ app: z.ZodDefault<z.ZodObject<{
4999
+ /** The AgentX Android app (apps/android). Chrome shows it full screen,
5000
+ * without an address bar, only when this computer vouches for it at
5001
+ * /.well-known/assetlinks.json; with no fingerprints there is nothing
5002
+ * to vouch for and that address answers 404. */
5003
+ android: z.ZodDefault<z.ZodObject<{
5004
+ /** applicationId the Android app was built with. */
5005
+ packageName: z.ZodDefault<z.ZodString>;
5006
+ /** SHA-256 fingerprints of the key(s) that signed it, as AB:CD:… */
5007
+ certFingerprints: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
5008
+ }, "strip", z.ZodTypeAny, {
5009
+ packageName: string;
5010
+ certFingerprints: string[];
5011
+ }, {
5012
+ packageName?: string | undefined;
5013
+ certFingerprints?: string[] | undefined;
5014
+ }>>;
5015
+ /** Place reminders: places the Android app watches as geofences, and
5016
+ * what to do when the phone arrives or leaves (src/places). */
5017
+ places: z.ZodDefault<z.ZodObject<{
5018
+ enabled: z.ZodDefault<z.ZodBoolean>;
5019
+ /** Where places and their reminders are kept. Relative paths resolve
5020
+ * from the folder holding agentx.json. */
5021
+ file: z.ZodDefault<z.ZodString>;
5022
+ defaultRadiusMeters: z.ZodDefault<z.ZodNumber>;
5023
+ /** Android rarely notices a smaller circle reliably. */
5024
+ minRadiusMeters: z.ZodDefault<z.ZodNumber>;
5025
+ maxRadiusMeters: z.ZodDefault<z.ZodNumber>;
5026
+ /** Android lets one app watch at most 100 places. */
5027
+ maxPlaces: z.ZodDefault<z.ZodNumber>;
5028
+ maxRulesPerPlace: z.ZodDefault<z.ZodNumber>;
5029
+ /** A repeating reminder fires at most once in this window, so a
5030
+ * phone hovering at the edge of a place doesn't buzz again and again. */
5031
+ cooldownMinutes: z.ZodDefault<z.ZodNumber>;
5032
+ /** A crossing the phone could only report later (no signal) is
5033
+ * dropped once it is older than this. */
5034
+ maxEventAgeMinutes: z.ZodDefault<z.ZodNumber>;
5035
+ /** How often the Android app checks for changed places, in minutes.
5036
+ * Android runs background checks at most every 15 minutes. */
5037
+ syncMinutes: z.ZodDefault<z.ZodNumber>;
5038
+ }, "strip", z.ZodTypeAny, {
5039
+ enabled: boolean;
5040
+ file: string;
5041
+ defaultRadiusMeters: number;
5042
+ minRadiusMeters: number;
5043
+ maxRadiusMeters: number;
5044
+ maxPlaces: number;
5045
+ maxRulesPerPlace: number;
5046
+ cooldownMinutes: number;
5047
+ maxEventAgeMinutes: number;
5048
+ syncMinutes: number;
5049
+ }, {
5050
+ enabled?: boolean | undefined;
5051
+ file?: string | undefined;
5052
+ defaultRadiusMeters?: number | undefined;
5053
+ minRadiusMeters?: number | undefined;
5054
+ maxRadiusMeters?: number | undefined;
5055
+ maxPlaces?: number | undefined;
5056
+ maxRulesPerPlace?: number | undefined;
5057
+ cooldownMinutes?: number | undefined;
5058
+ maxEventAgeMinutes?: number | undefined;
5059
+ syncMinutes?: number | undefined;
5060
+ }>>;
5061
+ }, "strip", z.ZodTypeAny, {
5062
+ android: {
5063
+ packageName: string;
5064
+ certFingerprints: string[];
5065
+ };
5066
+ places: {
5067
+ enabled: boolean;
5068
+ file: string;
5069
+ defaultRadiusMeters: number;
5070
+ minRadiusMeters: number;
5071
+ maxRadiusMeters: number;
5072
+ maxPlaces: number;
5073
+ maxRulesPerPlace: number;
5074
+ cooldownMinutes: number;
5075
+ maxEventAgeMinutes: number;
5076
+ syncMinutes: number;
5077
+ };
5078
+ }, {
5079
+ android?: {
5080
+ packageName?: string | undefined;
5081
+ certFingerprints?: string[] | undefined;
5082
+ } | undefined;
5083
+ places?: {
5084
+ enabled?: boolean | undefined;
5085
+ file?: string | undefined;
5086
+ defaultRadiusMeters?: number | undefined;
5087
+ minRadiusMeters?: number | undefined;
5088
+ maxRadiusMeters?: number | undefined;
5089
+ maxPlaces?: number | undefined;
5090
+ maxRulesPerPlace?: number | undefined;
5091
+ cooldownMinutes?: number | undefined;
5092
+ maxEventAgeMinutes?: number | undefined;
5093
+ syncMinutes?: number | undefined;
5094
+ } | undefined;
5095
+ }>>;
4956
5096
  /** `agentx demo`, read from the agentx.json in the folder it runs from. */
4957
5097
  demo: z.ZodDefault<z.ZodObject<{
4958
5098
  /** Seconds each startup step (node /health, dashboard /live, mesh
@@ -6969,6 +7109,24 @@ declare const daemonConfigSchema: z.ZodObject<{
6969
7109
  skipTypes: string[];
6970
7110
  };
6971
7111
  };
7112
+ app: {
7113
+ android: {
7114
+ packageName: string;
7115
+ certFingerprints: string[];
7116
+ };
7117
+ places: {
7118
+ enabled: boolean;
7119
+ file: string;
7120
+ defaultRadiusMeters: number;
7121
+ minRadiusMeters: number;
7122
+ maxRadiusMeters: number;
7123
+ maxPlaces: number;
7124
+ maxRulesPerPlace: number;
7125
+ cooldownMinutes: number;
7126
+ maxEventAgeMinutes: number;
7127
+ syncMinutes: number;
7128
+ };
7129
+ };
6972
7130
  voice: {
6973
7131
  provider: "system" | "elevenlabs";
6974
7132
  fallback: "system" | "none";
@@ -7136,11 +7294,15 @@ declare const daemonConfigSchema: z.ZodObject<{
7136
7294
  maxSessionMinutes: number;
7137
7295
  maxFrameEdge: number;
7138
7296
  keepFrames: boolean;
7297
+ streamFrameSeconds: number;
7298
+ streamMaxSeconds: number;
7139
7299
  };
7140
7300
  width: number;
7141
7301
  height: number;
7142
7302
  frameRate: number;
7143
7303
  maxSeconds: number;
7304
+ voiceInput: boolean;
7305
+ speakAnswers: boolean;
7144
7306
  };
7145
7307
  stunServers: string[];
7146
7308
  turnServers: {
@@ -7779,6 +7941,24 @@ declare const daemonConfigSchema: z.ZodObject<{
7779
7941
  skipTypes?: string[] | undefined;
7780
7942
  } | undefined;
7781
7943
  } | undefined;
7944
+ app?: {
7945
+ android?: {
7946
+ packageName?: string | undefined;
7947
+ certFingerprints?: string[] | undefined;
7948
+ } | undefined;
7949
+ places?: {
7950
+ enabled?: boolean | undefined;
7951
+ file?: string | undefined;
7952
+ defaultRadiusMeters?: number | undefined;
7953
+ minRadiusMeters?: number | undefined;
7954
+ maxRadiusMeters?: number | undefined;
7955
+ maxPlaces?: number | undefined;
7956
+ maxRulesPerPlace?: number | undefined;
7957
+ cooldownMinutes?: number | undefined;
7958
+ maxEventAgeMinutes?: number | undefined;
7959
+ syncMinutes?: number | undefined;
7960
+ } | undefined;
7961
+ } | undefined;
7782
7962
  voice?: {
7783
7963
  system?: string | Record<string, string> | undefined;
7784
7964
  provider?: "system" | "elevenlabs" | undefined;
@@ -8014,11 +8194,15 @@ declare const daemonConfigSchema: z.ZodObject<{
8014
8194
  maxSessionMinutes?: number | undefined;
8015
8195
  maxFrameEdge?: number | undefined;
8016
8196
  keepFrames?: boolean | undefined;
8197
+ streamFrameSeconds?: number | undefined;
8198
+ streamMaxSeconds?: number | undefined;
8017
8199
  } | undefined;
8018
8200
  width?: number | undefined;
8019
8201
  height?: number | undefined;
8020
8202
  frameRate?: number | undefined;
8021
8203
  maxSeconds?: number | undefined;
8204
+ voiceInput?: boolean | undefined;
8205
+ speakAnswers?: boolean | undefined;
8022
8206
  } | undefined;
8023
8207
  stunServers?: string[] | undefined;
8024
8208
  turnServers?: {