agentix-cli 0.182.0 → 0.184.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 (165) hide show
  1. package/apps/mac-helper/Sources/AgentXHelper/Presence.swift +9 -0
  2. package/apps/mac-helper/Sources/AgentXHelper/PresenceTag.swift +25 -9
  3. package/dist/{App-XWSSUYKF.js → App-WIHCYMHM.js} +2 -2
  4. package/dist/{ChatApp-UT2BRHYE.js → ChatApp-V3UASKNG.js} +2 -2
  5. package/dist/{absorb-eval-SFGUURBD.js → absorb-eval-EAGXITJH.js} +2 -2
  6. package/dist/{adapter-UHR7FVM7.js → adapter-7IDPCEJ7.js} +2 -2
  7. package/dist/{agent-5NTFSCEO.js → agent-H75SWYT6.js} +2 -2
  8. package/dist/{board-dashboard-7HIME2W4.js → board-dashboard-MHPJY4JB.js} +709 -2204
  9. package/dist/board-dashboard-MHPJY4JB.js.map +1 -0
  10. package/dist/{chunk-QGNV2HA4.js → chunk-2GIYVYIM.js} +2 -2
  11. package/dist/{chunk-5YG2ZQQW.js → chunk-2LTZUZJU.js} +3 -3
  12. package/dist/{chunk-343MPMLD.js → chunk-2V6ZGE74.js} +2 -2
  13. package/dist/{chunk-4KNHLHE3.js → chunk-4HYIERJ4.js} +2 -2
  14. package/dist/{chunk-XHJ5SVO5.js → chunk-4IKZSV5A.js} +302 -297
  15. package/dist/chunk-4IKZSV5A.js.map +1 -0
  16. package/dist/{chunk-QB6UPODO.js → chunk-56F5UTTA.js} +2 -2
  17. package/dist/chunk-5ELIX7BQ.js +3 -0
  18. package/dist/chunk-5ELIX7BQ.js.map +1 -0
  19. package/dist/{chunk-NIPMVM3G.js → chunk-7EMPPP3E.js} +2 -2
  20. package/dist/{chunk-IFHVAHQM.js → chunk-A4PW7EIK.js} +2 -2
  21. package/dist/chunk-AHWWJ7AF.js +2 -0
  22. package/dist/chunk-AHWWJ7AF.js.map +1 -0
  23. package/dist/{chunk-7WGJZLVJ.js → chunk-BITVUKT7.js} +2 -2
  24. package/dist/{chunk-MD2HCGSC.js → chunk-BZJF7DJR.js} +3 -3
  25. package/dist/chunk-BZJF7DJR.js.map +1 -0
  26. package/dist/{chunk-5NGQQOVK.js → chunk-CVPERUWT.js} +2 -2
  27. package/dist/chunk-CZMVJP7O.js +2 -0
  28. package/dist/chunk-CZMVJP7O.js.map +1 -0
  29. package/dist/chunk-DPV4M4AQ.js +2903 -0
  30. package/dist/chunk-DPV4M4AQ.js.map +1 -0
  31. package/dist/{chunk-GEFZMDDX.js → chunk-FJMTCU4S.js} +2 -2
  32. package/dist/{chunk-IGBW4VVM.js → chunk-GSQ2RCOZ.js} +2 -2
  33. package/dist/chunk-I5TUF6U7.js +888 -0
  34. package/dist/chunk-I5TUF6U7.js.map +1 -0
  35. package/dist/{chunk-YX4R2VGD.js → chunk-LR4QUAJT.js} +2 -2
  36. package/dist/{chunk-RDWDDPBI.js → chunk-NBWSZ53L.js} +2 -2
  37. package/dist/{chunk-4WSJKKSA.js → chunk-NHW4IY6N.js} +2 -2
  38. package/dist/{chunk-FDX4IGLK.js → chunk-NS2HSAHF.js} +2 -2
  39. package/dist/{chunk-YSPBVLTZ.js → chunk-OJ53ATNN.js} +2 -2
  40. package/dist/{chunk-JNWXHOJE.js → chunk-PN42ECV3.js} +2 -2
  41. package/dist/{chunk-Y4TVCWWF.js → chunk-R2KSORSK.js} +2 -2
  42. package/dist/{chunk-FYFJ7IQJ.js → chunk-RTIGD4NG.js} +2 -2
  43. package/dist/{chunk-Y5TBOMHY.js → chunk-UASRZKZQ.js} +6 -6
  44. package/dist/{chunk-H2KOXGDX.js → chunk-V4IOGISL.js} +2 -2
  45. package/dist/{chunk-Z4XVPGPZ.js → chunk-V6QFBL6F.js} +3 -3
  46. package/dist/{chunk-XI2HH5NR.js → chunk-WKHRKYCY.js} +2 -2
  47. package/dist/{chunk-BY3AUZYM.js → chunk-YTS54UZ5.js} +2 -2
  48. package/dist/cli.js +1 -1
  49. package/dist/{client-SQMU25PS.js → client-57TCFIV5.js} +2 -2
  50. package/dist/{compaction-26OHHULF.js → compaction-R7VWQB6X.js} +2 -2
  51. package/dist/{config-56NBA4SF.js → config-RHCIE7VE.js} +2 -2
  52. package/dist/{config-mutate-PD4O3HZ7.js → config-mutate-HCYXR2WP.js} +2 -2
  53. package/dist/config-mutator-JQ2R4J5Z.js +2 -0
  54. package/dist/{contributions-DKTJ623L.js → contributions-R4HXLJXU.js} +2 -2
  55. package/dist/{doctor-OI6GJZR5.js → doctor-22PZVT6A.js} +2 -2
  56. package/dist/{follow-up-tool-DYSLS6ZI.js → follow-up-tool-MC4TBGLP.js} +2 -2
  57. package/dist/hub-HXVIO4U5.js +2 -0
  58. package/dist/index.d.ts +55 -1
  59. package/dist/index.js +1 -1
  60. package/dist/{program-4GDIWCDM.js → program-736BTK4B.js} +260 -259
  61. package/dist/program-736BTK4B.js.map +1 -0
  62. package/dist/{promote-3272TZNI.js → promote-D24WO52J.js} +2 -2
  63. package/dist/push-bridge-NR7SLHGX.js +1 -1
  64. package/dist/{query-7XM6V4QG.js → query-J5NRZZUQ.js} +2 -2
  65. package/dist/{query-settings-HHVBIIVQ.js → query-settings-NT6ACLQY.js} +2 -2
  66. package/dist/{registry-QL3AM3UH.js → registry-SBIZVSQV.js} +2 -2
  67. package/dist/{request-planner-WNEDEA7X.js → request-planner-2CVL22EB.js} +2 -2
  68. package/dist/{review-candidates-TGPDJMWJ.js → review-candidates-MMNDJOTD.js} +2 -2
  69. package/dist/{routing-ALXY25NE.js → routing-KRST324W.js} +2 -2
  70. package/dist/schedule-tool-KOFUKVX5.js +2 -0
  71. package/dist/{scheduler-5PHNW243.js → scheduler-GCCE4FQP.js} +2 -2
  72. package/dist/{seat-ZYVVEILY.js → seat-E6F56TUM.js} +2 -2
  73. package/dist/{select-6QLEV6AC.js → select-D2VUSUCJ.js} +2 -2
  74. package/dist/self-SO6GCVYD.js +2 -0
  75. package/dist/{set-enabled-SYYTKJPC.js → set-enabled-GBI7JREU.js} +2 -2
  76. package/dist/signal-exit-C5EUGHKI.js +3 -0
  77. package/dist/signal-exit-C5EUGHKI.js.map +1 -0
  78. package/dist/{sprint-tool-PYVHPHR2.js → sprint-tool-HZ24VIC2.js} +2 -2
  79. package/dist/{tool-GIYOYXXM.js → tool-7BEFI5SJ.js} +2 -2
  80. package/dist/{tool-ZKZ4KYJT.js → tool-OXZ4TQBG.js} +2 -2
  81. package/dist/{tool-TDOUM3BJ.js → tool-QLQEYQYM.js} +2 -2
  82. package/dist/wiki-RFDU6SVD.js +2 -0
  83. package/dist/wiki-enrich-LDI67VQU.js +2 -0
  84. package/package.json +4 -1
  85. package/dist/board-dashboard-7HIME2W4.js.map +0 -1
  86. package/dist/chunk-7PQQZC6B.js +0 -310
  87. package/dist/chunk-7PQQZC6B.js.map +0 -1
  88. package/dist/chunk-MD2HCGSC.js.map +0 -1
  89. package/dist/chunk-NRUUT5TL.js +0 -256
  90. package/dist/chunk-NRUUT5TL.js.map +0 -1
  91. package/dist/chunk-OKADR5QO.js +0 -869
  92. package/dist/chunk-OKADR5QO.js.map +0 -1
  93. package/dist/chunk-QOYAX2FT.js +0 -2
  94. package/dist/chunk-QOYAX2FT.js.map +0 -1
  95. package/dist/chunk-R3CDFSNF.js +0 -580
  96. package/dist/chunk-R3CDFSNF.js.map +0 -1
  97. package/dist/chunk-XHJ5SVO5.js.map +0 -1
  98. package/dist/chunk-ZRALOFEG.js +0 -2035
  99. package/dist/chunk-ZRALOFEG.js.map +0 -1
  100. package/dist/config-mutator-ITL64FBW.js +0 -2
  101. package/dist/hub-4HDMTSR7.js +0 -2
  102. package/dist/processes-M7YPWX7H.js +0 -2
  103. package/dist/program-4GDIWCDM.js.map +0 -1
  104. package/dist/schedule-tool-22UBZXCG.js +0 -2
  105. package/dist/signal-exit-WL7G3EEZ.js +0 -2
  106. package/dist/signal-exit-WL7G3EEZ.js.map +0 -1
  107. package/dist/wiki-ZRGLGMII.js +0 -2
  108. package/dist/wiki-enrich-CTID7JQW.js +0 -2
  109. /package/dist/{App-XWSSUYKF.js.map → App-WIHCYMHM.js.map} +0 -0
  110. /package/dist/{ChatApp-UT2BRHYE.js.map → ChatApp-V3UASKNG.js.map} +0 -0
  111. /package/dist/{absorb-eval-SFGUURBD.js.map → absorb-eval-EAGXITJH.js.map} +0 -0
  112. /package/dist/{adapter-UHR7FVM7.js.map → adapter-7IDPCEJ7.js.map} +0 -0
  113. /package/dist/{agent-5NTFSCEO.js.map → agent-H75SWYT6.js.map} +0 -0
  114. /package/dist/{chunk-QGNV2HA4.js.map → chunk-2GIYVYIM.js.map} +0 -0
  115. /package/dist/{chunk-5YG2ZQQW.js.map → chunk-2LTZUZJU.js.map} +0 -0
  116. /package/dist/{chunk-343MPMLD.js.map → chunk-2V6ZGE74.js.map} +0 -0
  117. /package/dist/{chunk-4KNHLHE3.js.map → chunk-4HYIERJ4.js.map} +0 -0
  118. /package/dist/{chunk-QB6UPODO.js.map → chunk-56F5UTTA.js.map} +0 -0
  119. /package/dist/{chunk-NIPMVM3G.js.map → chunk-7EMPPP3E.js.map} +0 -0
  120. /package/dist/{chunk-IFHVAHQM.js.map → chunk-A4PW7EIK.js.map} +0 -0
  121. /package/dist/{chunk-7WGJZLVJ.js.map → chunk-BITVUKT7.js.map} +0 -0
  122. /package/dist/{chunk-5NGQQOVK.js.map → chunk-CVPERUWT.js.map} +0 -0
  123. /package/dist/{chunk-GEFZMDDX.js.map → chunk-FJMTCU4S.js.map} +0 -0
  124. /package/dist/{chunk-IGBW4VVM.js.map → chunk-GSQ2RCOZ.js.map} +0 -0
  125. /package/dist/{chunk-YX4R2VGD.js.map → chunk-LR4QUAJT.js.map} +0 -0
  126. /package/dist/{chunk-RDWDDPBI.js.map → chunk-NBWSZ53L.js.map} +0 -0
  127. /package/dist/{chunk-4WSJKKSA.js.map → chunk-NHW4IY6N.js.map} +0 -0
  128. /package/dist/{chunk-FDX4IGLK.js.map → chunk-NS2HSAHF.js.map} +0 -0
  129. /package/dist/{chunk-YSPBVLTZ.js.map → chunk-OJ53ATNN.js.map} +0 -0
  130. /package/dist/{chunk-JNWXHOJE.js.map → chunk-PN42ECV3.js.map} +0 -0
  131. /package/dist/{chunk-Y4TVCWWF.js.map → chunk-R2KSORSK.js.map} +0 -0
  132. /package/dist/{chunk-FYFJ7IQJ.js.map → chunk-RTIGD4NG.js.map} +0 -0
  133. /package/dist/{chunk-Y5TBOMHY.js.map → chunk-UASRZKZQ.js.map} +0 -0
  134. /package/dist/{chunk-H2KOXGDX.js.map → chunk-V4IOGISL.js.map} +0 -0
  135. /package/dist/{chunk-Z4XVPGPZ.js.map → chunk-V6QFBL6F.js.map} +0 -0
  136. /package/dist/{chunk-XI2HH5NR.js.map → chunk-WKHRKYCY.js.map} +0 -0
  137. /package/dist/{chunk-BY3AUZYM.js.map → chunk-YTS54UZ5.js.map} +0 -0
  138. /package/dist/{client-SQMU25PS.js.map → client-57TCFIV5.js.map} +0 -0
  139. /package/dist/{compaction-26OHHULF.js.map → compaction-R7VWQB6X.js.map} +0 -0
  140. /package/dist/{config-56NBA4SF.js.map → config-RHCIE7VE.js.map} +0 -0
  141. /package/dist/{config-mutate-PD4O3HZ7.js.map → config-mutate-HCYXR2WP.js.map} +0 -0
  142. /package/dist/{config-mutator-ITL64FBW.js.map → config-mutator-JQ2R4J5Z.js.map} +0 -0
  143. /package/dist/{contributions-DKTJ623L.js.map → contributions-R4HXLJXU.js.map} +0 -0
  144. /package/dist/{doctor-OI6GJZR5.js.map → doctor-22PZVT6A.js.map} +0 -0
  145. /package/dist/{follow-up-tool-DYSLS6ZI.js.map → follow-up-tool-MC4TBGLP.js.map} +0 -0
  146. /package/dist/{hub-4HDMTSR7.js.map → hub-HXVIO4U5.js.map} +0 -0
  147. /package/dist/{processes-M7YPWX7H.js.map → promote-D24WO52J.js.map} +0 -0
  148. /package/dist/{promote-3272TZNI.js.map → query-J5NRZZUQ.js.map} +0 -0
  149. /package/dist/{query-settings-HHVBIIVQ.js.map → query-settings-NT6ACLQY.js.map} +0 -0
  150. /package/dist/{query-7XM6V4QG.js.map → registry-SBIZVSQV.js.map} +0 -0
  151. /package/dist/{request-planner-WNEDEA7X.js.map → request-planner-2CVL22EB.js.map} +0 -0
  152. /package/dist/{review-candidates-TGPDJMWJ.js.map → review-candidates-MMNDJOTD.js.map} +0 -0
  153. /package/dist/{registry-QL3AM3UH.js.map → routing-KRST324W.js.map} +0 -0
  154. /package/dist/{routing-ALXY25NE.js.map → schedule-tool-KOFUKVX5.js.map} +0 -0
  155. /package/dist/{schedule-tool-22UBZXCG.js.map → scheduler-GCCE4FQP.js.map} +0 -0
  156. /package/dist/{scheduler-5PHNW243.js.map → seat-E6F56TUM.js.map} +0 -0
  157. /package/dist/{select-6QLEV6AC.js.map → select-D2VUSUCJ.js.map} +0 -0
  158. /package/dist/{seat-ZYVVEILY.js.map → self-SO6GCVYD.js.map} +0 -0
  159. /package/dist/{set-enabled-SYYTKJPC.js.map → set-enabled-GBI7JREU.js.map} +0 -0
  160. /package/dist/{sprint-tool-PYVHPHR2.js.map → sprint-tool-HZ24VIC2.js.map} +0 -0
  161. /package/dist/{tool-GIYOYXXM.js.map → tool-7BEFI5SJ.js.map} +0 -0
  162. /package/dist/{tool-ZKZ4KYJT.js.map → tool-OXZ4TQBG.js.map} +0 -0
  163. /package/dist/{tool-TDOUM3BJ.js.map → tool-QLQEYQYM.js.map} +0 -0
  164. /package/dist/{wiki-ZRGLGMII.js.map → wiki-RFDU6SVD.js.map} +0 -0
  165. /package/dist/{wiki-enrich-CTID7JQW.js.map → wiki-enrich-LDI67VQU.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{c as Ct}from"./chunk-SZDACK6O.js";import{b as Le}from"./chunk-AFRHKA7B.js";import{b as Ut,c as Ht}from"./chunk-VJVXEVZ7.js";import{b as Dt,e as jt,f as Mt,i as Ft,k as _t,l as Lt,r as Bt}from"./chunk-FYFJ7IQJ.js";import{b as Wt,d as Ot,e as Nt}from"./chunk-PE5V2LI7.js";import{e as xt,g as Pt,h as Tt,i as _e}from"./chunk-GQ76J72O.js";import{a as Et}from"./chunk-GV7S5BAX.js";import{y as St,z as yr}from"./chunk-YX4R2VGD.js";import{b as $t,f as wr}from"./chunk-72SZI2UW.js";import{a as At,b as Ee,d as Ce,e as Rt,f as Fe}from"./chunk-BERWTVG2.js";import{c as It,d as vt}from"./chunk-QOYAX2FT.js";import{ea as Me,pa as hr}from"./chunk-MD2HCGSC.js";import{j as je,r as mr}from"./chunk-UEEB3UTU.js";import{existsSync as kr,mkdirSync as Kt,readFileSync as br,writeFileSync as Ir,renameSync as vr}from"fs";import{resolve as qt,dirname as $r}from"path";var zt=class{filePath;log;constructor(e={}){let t=e.baseDir??qt(process.cwd(),".agentx");this.filePath=qt(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),Kt(t,{recursive:!0})}key(e,t,r){return`${e}::${t}::${r||"-"}`}load(){if(!kr(this.filePath))return{version:1,overrides:{}};try{let e=br(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){Kt($r(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;Ir(t,JSON.stringify(e,null,2)),vr(t,this.filePath)}get(e,t,r){let s=this.load().overrides[this.key(e,t,r)];if(s&&!(s.expiresAt&&Date.parse(s.expiresAt)<Date.now()))return s}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),r={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(r.channel,r.chatId,r.accountId)]=r,this.save(t),r}remove(e,t,r){let o=this.load(),s=this.key(e,t,r);return s in o.overrides?(delete o.overrides[s],this.save(o),!0):!1}consumeSummary(e,t,r){let o=this.load(),s=o.overrides[this.key(e,t,r)];if(!s||!s.summary||s.summaryConsumedAt)return;let a=s.summary;return s.summaryConsumedAt=new Date().toISOString(),this.save(o),a}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(r=>!r.expiresAt||Date.parse(r.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(r=>r.toAgent===e),outgoing:t.filter(r=>r.fromAgent===e)}}};import{readFileSync as Qt,writeFileSync as Ue,appendFileSync as xr,mkdirSync as Pr,existsSync as Zt,statSync as Tr}from"fs";import{resolve as ce}from"path";var Jt="[Agent Memory \u2014 persistent facts from past conversations]",Sr=2400;function Yt(n,e){return n?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function Ar(n,e=Date.now()){let t=Ot(n,e),r=n.undated?"UNVERIFIED (never checked) ":Yt(t,xt(n.verifiedAt,e));return{line:`- [wiki ${n.id}] ${r}${n.subject} \xB7 ${n.attribute}: ${n.value} (${n.source}, checked ${n.verifiedAt.slice(0,10)} by ${n.verifiedBy})`,unverified:t}}function Rr(n,e){let r=!n.source.chatId.startsWith("-")&&/^\d+$/.test(n.source.chatId)?"DM":n.source.chatId,o=Tt(n,e);return{line:`- [${n.category}] ${Yt(o,Pt(n,e))}${n.content} (${r}, ${n.source.date})`,unverified:o}}function Gt(n,e=[],t=Date.now()){let r=[],o=new Set,s=Jt.length,a=!1;for(let i of n){let d=e.length>0?Nt(i.content,e):null,l,c,p=d&&Date.parse(i.createdAt)>Date.parse(d.verifiedAt)&&!i.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!p){if(o.has(d.id))continue;o.add(d.id),l=Ar(d,t),c=d.id}else l=Rr(i,t),d&&(l.line+=` [differs from wiki ${d.id}]`);let f=l.unverified&&!a?_e.length:0;if(s+f+l.line.length>Sr)break;r.push({fact:i,...l,...c?{wikiRef:c}:{}}),s+=f+l.line.length,f&&(a=!0)}return r}function Vt(n){if(n.length===0)return"";let e=n.some(t=>t.unverified)?[_e]:[];return[Jt,...e,...n.map(t=>t.line),"[End Memory]"].join(`
1
+ import{c as Ct}from"./chunk-SZDACK6O.js";import{b as Le}from"./chunk-AFRHKA7B.js";import{b as Ut,c as Ht}from"./chunk-VJVXEVZ7.js";import{b as Dt,e as jt,f as Mt,i as Ft,k as _t,l as Lt,r as Bt}from"./chunk-RTIGD4NG.js";import{b as Wt,d as Ot,e as Nt}from"./chunk-PE5V2LI7.js";import{e as xt,g as Pt,h as Tt,i as _e}from"./chunk-GQ76J72O.js";import{a as Et}from"./chunk-GV7S5BAX.js";import{y as St,z as yr}from"./chunk-LR4QUAJT.js";import{b as $t,f as wr}from"./chunk-72SZI2UW.js";import{a as At,b as Ee,d as Ce,e as Rt,f as Fe}from"./chunk-BERWTVG2.js";import{c as It,d as vt}from"./chunk-AHWWJ7AF.js";import{ea as Me,pa as hr}from"./chunk-BZJF7DJR.js";import{j as je,r as mr}from"./chunk-UEEB3UTU.js";import{existsSync as kr,mkdirSync as Kt,readFileSync as br,writeFileSync as Ir,renameSync as vr}from"fs";import{resolve as qt,dirname as $r}from"path";var zt=class{filePath;log;constructor(e={}){let t=e.baseDir??qt(process.cwd(),".agentx");this.filePath=qt(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),Kt(t,{recursive:!0})}key(e,t,r){return`${e}::${t}::${r||"-"}`}load(){if(!kr(this.filePath))return{version:1,overrides:{}};try{let e=br(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){Kt($r(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;Ir(t,JSON.stringify(e,null,2)),vr(t,this.filePath)}get(e,t,r){let s=this.load().overrides[this.key(e,t,r)];if(s&&!(s.expiresAt&&Date.parse(s.expiresAt)<Date.now()))return s}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),r={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(r.channel,r.chatId,r.accountId)]=r,this.save(t),r}remove(e,t,r){let o=this.load(),s=this.key(e,t,r);return s in o.overrides?(delete o.overrides[s],this.save(o),!0):!1}consumeSummary(e,t,r){let o=this.load(),s=o.overrides[this.key(e,t,r)];if(!s||!s.summary||s.summaryConsumedAt)return;let a=s.summary;return s.summaryConsumedAt=new Date().toISOString(),this.save(o),a}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(r=>!r.expiresAt||Date.parse(r.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(r=>r.toAgent===e),outgoing:t.filter(r=>r.fromAgent===e)}}};import{readFileSync as Qt,writeFileSync as Ue,appendFileSync as xr,mkdirSync as Pr,existsSync as Zt,statSync as Tr}from"fs";import{resolve as ce}from"path";var Jt="[Agent Memory \u2014 persistent facts from past conversations]",Sr=2400;function Yt(n,e){return n?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function Ar(n,e=Date.now()){let t=Ot(n,e),r=n.undated?"UNVERIFIED (never checked) ":Yt(t,xt(n.verifiedAt,e));return{line:`- [wiki ${n.id}] ${r}${n.subject} \xB7 ${n.attribute}: ${n.value} (${n.source}, checked ${n.verifiedAt.slice(0,10)} by ${n.verifiedBy})`,unverified:t}}function Rr(n,e){let r=!n.source.chatId.startsWith("-")&&/^\d+$/.test(n.source.chatId)?"DM":n.source.chatId,o=Tt(n,e);return{line:`- [${n.category}] ${Yt(o,Pt(n,e))}${n.content} (${r}, ${n.source.date})`,unverified:o}}function Gt(n,e=[],t=Date.now()){let r=[],o=new Set,s=Jt.length,a=!1;for(let i of n){let d=e.length>0?Nt(i.content,e):null,l,c,p=d&&Date.parse(i.createdAt)>Date.parse(d.verifiedAt)&&!i.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!p){if(o.has(d.id))continue;o.add(d.id),l=Ar(d,t),c=d.id}else l=Rr(i,t),d&&(l.line+=` [differs from wiki ${d.id}]`);let f=l.unverified&&!a?_e.length:0;if(s+f+l.line.length>Sr)break;r.push({fact:i,...l,...c?{wikiRef:c}:{}}),s+=f+l.line.length,f&&(a=!0)}return r}function Vt(n){if(n.length===0)return"";let e=n.some(t=>t.unverified)?[_e]:[];return[Jt,...e,...n.map(t=>t.line),"[End Memory]"].join(`
2
2
  `)}var Xt=200,Wr=7,en=class{memoryDir;ledger;constructor(e=process.cwd()){this.memoryDir=ce(e,".agentx/memory"),this.ledger=new Wt(ce(e,".agentx/wiki")),Zt(this.memoryDir)||Pr(this.memoryDir,{recursive:!0})}filePath(e){return ce(this.memoryDir,`${e}.jsonl`)}addMemory(e,t){if(t.category==="secret"||Ee(t.content))return!1;let r=t.source.trust??At(t.source.channel),o=t.review??Rt(r),s={...t,source:{...t.source,trust:r},...o?{review:o}:{},id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,createdAt:new Date().toISOString()};return xr(this.filePath(e),JSON.stringify(s)+`
3
3
  `),!0}parsedCache=new Map;getAll(e){let t=this.filePath(e);if(!Zt(t))return[];try{let{mtimeMs:r,size:o}=Tr(t),s=this.parsedCache.get(t);if(s&&s.mtimeMs===r&&s.size===o)return s.facts.slice();let i=Qt(t,"utf-8").split(`
4
4
  `).filter(d=>d.trim()).map(d=>{try{return JSON.parse(d)}catch{return null}}).filter(d=>d!==null);return this.parsedCache.set(t,{mtimeMs:r,size:o,facts:i}),i.slice()}catch{return[]}}findRelevant(e,t,r=8){let o=this.getAll(t).filter(Fe);if(o.length===0)return[];let s=o.map(g=>`${g.keywords.join(" ")} ${g.content}`),a=ce(this.memoryDir,`${t}_bm25_cache.json`),i=vt(s,a),d=It(e,i),l=new Map(d.map(g=>[g.docIndex,g.score])),p=o.map((g,m)=>{let y=l.get(m)??0;return g.category==="commitment"&&(y+=1),{memory:g,score:y}}).filter(g=>g.score>0);if(p.length===0)return o.slice(-r);let f=p.sort((g,m)=>m.score-g.score).slice(0,r).map(g=>g.memory);if(f.length>0)try{this.recordAccess(t,f.map(g=>g.id))}catch{}return f}buildContext(e){return Vt(this.contextLines(e))}contextFacts(e){return this.contextLines(e).map(t=>t.fact)}contextLines(e){let t=[];try{t=this.ledger.list()}catch{}return Gt(e,t)}recordAccess(e,t){if(t.length===0)return;let r=this.getAll(e),o=new Set(t),s=!1;for(let a of r)if(o.has(a.id)){a.accessCount=(a.accessCount||0)+1,a.lastAccessed=new Date().toISOString();let i=a.intervalDays||1;a.intervalDays=Math.min(i*2,30),a.nextReview=new Date(Date.now()+a.intervalDays*864e5).toISOString(),s=!0}s&&Ue(this.filePath(e),r.map(a=>JSON.stringify(a)).join(`
@@ -39,4 +39,4 @@ ${n.text}`}async function xe(n,e){let t=n.channels[e.channel],r={channel:e.chann
39
39
  `).filter(Boolean),o=[];for(let s=r.length-1;s>=0&&o.length<t;s--)try{let a=JSON.parse(r[s]);(!e||a.person===e)&&o.push(a)}catch{}return o}load(){if(ht(this.file))try{let e=JSON.parse(wt(this.file,"utf-8"));if(e&&Array.isArray(e.devices))return e}catch{}return{devices:[]}}save(e){Qn(er(this.file),{recursive:!0});let t=`${this.file}.${process.pid}.${nr(4).toString("hex")}.tmp`;Xn(t,JSON.stringify(e,null,2)+`
40
40
  `,{encoding:"utf-8",mode:384}),Zn(t,this.file)}};import{extname as ti}from"path";var or=/<agentx-artifact>([\s\S]*?)<\/agentx-artifact>/gi,sr=/<agentx-artifact>[\s\S]*$/i;function Nl(n,e=1/0,t=!1){let r=[],o=String(n??"");if(!/<agentx-artifact>/i.test(o))return{text:o,artifacts:r};let s=o.replace(or,(a,i)=>{try{let d=JSON.parse(i.trim());if(d&&typeof d.filename=="string"&&typeof d.mime=="string"&&r.length<e){let l=d.mime,c=l.startsWith("image/")?"image":l==="application/pdf"?"pdf":l.startsWith("text/")?"text":"file";r.push({type:c,filename:d.filename,mime:l})}}catch{}return""});return{text:(t?s.replace(sr,""):s).trim(),artifacts:r}}function Dl(n,e=!1){let t=String(n??""),r=t;if(/<agentx-artifact>/i.test(t)){let o=t.replace(or,(s,a)=>{try{let i=JSON.parse(a.trim());return i&&typeof i.filename=="string"?i.filename:""}catch{return""}});r=(e?o.replace(sr,""):o).trim()}return r.replace(/```[\s\S]*?```|`[^`\n]*`|!\[([^\]\n]*)\]\(([^)\s]+)\)/g,(o,s,a)=>s===void 0||a===void 0?o:`[${s||a}](${a})`)}var ni={".png":{mime:"image/png",kind:"image"},".jpg":{mime:"image/jpeg",kind:"image"},".jpeg":{mime:"image/jpeg",kind:"image"},".gif":{mime:"image/gif",kind:"image"},".webp":{mime:"image/webp",kind:"image"},".svg":{mime:"image/svg+xml",kind:"file"},".pdf":{mime:"application/pdf",kind:"file"},".txt":{mime:"text/plain; charset=utf-8",kind:"file"},".md":{mime:"text/markdown; charset=utf-8",kind:"file"},".csv":{mime:"text/csv; charset=utf-8",kind:"file"},".json":{mime:"application/json",kind:"file"},".mp3":{mime:"audio/mpeg",kind:"audio"},".m4a":{mime:"audio/mp4",kind:"audio"},".wav":{mime:"audio/wav",kind:"audio"},".mp4":{mime:"video/mp4",kind:"video"},".webm":{mime:"video/webm",kind:"video"}},jl={bytes:20*1024*1024,perMessage:20,pathChars:512};function Ml(n){return ni[ti(n).toLowerCase()]??null}var ri=["[Phone app: showing files]","To show the owner a file you created (a chart, a screenshot, a PDF, a recording), save or copy it into .agentx/outbox/ in your workspace and end your reply with one line per file:",'<agentx-artifact>{"filename":".agentx/outbox/<name.ext>","mime":"<mime/type>"}</agentx-artifact>',"Files outside your workspace (/tmp, your home folder) are refused. Outbox files are removed after 7 days.","The line is removed from the text. Images show in the reply, audio and video get a player, other files an Open link. Allowed: png, jpg, gif, webp, svg, pdf, txt, md, csv, json, mp3, m4a, wav, mp4, webm; up to 20 MB and 20 files per reply.","A picture already on the web can go inline as ![what it shows](https://...)."].join(`
41
41
  `);function El(n,e,t){return n==="app"&&e&&t!==!1?ri:void 0}import{lstatSync as kt,mkdirSync as oi,readdirSync as si,realpathSync as yt,unlinkSync as ii}from"fs";import{join as Ne,resolve as ir}from"path";var ar=".agentx/outbox",ai=7*24*60*60*1e3;function di(n,e){try{let t=yt(ir(e,n)),r=Ne(t,ar);return yt(r)===r&&kt(r).isDirectory()?r:null}catch{return null}}function Ll(n,e={}){let t=e.cwd??process.cwd();if(e.create!==!1)try{let o=yt(ir(t,n));kt(Ne(o,".agentx"),{throwIfNoEntry:!1})?.isSymbolicLink()||oi(Ne(o,ar),{recursive:!0})}catch{return 0}let r=di(n,t);return r?dr(r,(e.now??Date.now())-(e.maxAgeMs??ai)):0}function dr(n,e){let t=0;for(let r of si(n)){let o=Ne(n,r);try{let s=kt(o);s.isDirectory()?t+=dr(o,e):Math.max(s.mtimeMs,s.ctimeMs)<e&&(ii(o),t++)}catch{}}return t}export{zt as a,en as b,tn as c,Si as d,Dr as e,Ai as f,jr as g,xi as h,Pi as i,Ti as j,Wi as k,Oi as l,Ni as m,Di as n,Cr as o,ji as p,Mi as q,_i as r,qe as s,qr as t,Li as u,Ui as v,zr as w,Hi as x,ln as y,qi as z,zi as A,cn as B,pn as C,Qr as D,Qi as E,Zi as F,ta as G,na as H,O as I,te as J,S as K,he as L,go as M,Ve as N,L as O,Xe as P,tt as Q,pt as R,Is as S,xs as T,gt as U,No as V,Us as W,el as X,tl as Y,nl as Z,rl as _,ol as $,Hs as aa,Bs as ba,sl as ca,il as da,al as ea,dl as fa,cl as ga,pl as ha,fl as ia,gl as ja,ml as ka,hl as la,wl as ma,yl as na,kl as oa,bl as pa,Il as qa,Gs as ra,vl as sa,$l as ta,Sl as ua,Al as va,rr as wa,Nl as xa,Dl as ya,jl as za,Ml as Aa,El as Ba,ar as Ca,Ll as Da};
42
- //# sourceMappingURL=chunk-QGNV2HA4.js.map
42
+ //# sourceMappingURL=chunk-2GIYVYIM.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-DCIYOPJF.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-AHWWJ7AF.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-DCIYOPJF.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(", ")}
@@ -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-QL3AM3UH.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-SBIZVSQV.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+`
@@ -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-5YG2ZQQW.js.map
126
+ //# sourceMappingURL=chunk-2LTZUZJU.js.map
@@ -1,4 +1,4 @@
1
- import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-7WGJZLVJ.js";import{b as L}from"./chunk-KEXBEUSU.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c="",p="",m=""){return Z(r,s,t,o,i,c,p,m)}function Z(n,r,s,t,o,i="",c="",p=""){let m=r?`
1
+ import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-BITVUKT7.js";import{b as L}from"./chunk-KEXBEUSU.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c="",p="",m=""){return Z(r,s,t,o,i,c,p,m)}function Z(n,r,s,t,o,i="",c="",p=""){let m=r?`
2
2
  ## Worldview
3
3
 
4
4
  ${r}
@@ -249,4 +249,4 @@ ${u}`}var x="memory-promoter",oe=["project","reference","feedback"],K="_memory-p
249
249
  Re-emit the FULL corrected JSON object \u2014 same structure, fixed issues, valid JSON only.`:n,y=await t(`${a}/task`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:r.viaAgent,message:h,freshSession:s===null,context:{channel:"api",chatId:r.chatId??"memory-promote"}}),signal:i.signal});if(!y.ok){let f=await y.text().catch(()=>"");throw new Error(`agent /task ${y.status}: ${f.slice(0,500)}`)}let w=await y.json();if(w.error)throw new Error(`agent reported error: ${w.error}`);let b=String(w.content??"").trim();if(!b)throw new Error("agent returned empty content");return b}if(!r.model)throw new Error("callPromotionLlm: viaAgent or model is required");let p=process.env.ANTHROPIC_API_KEY;if(!p)throw new Error("ANTHROPIC_API_KEY not set; use --via <agentId> instead");let m=[{role:"user",content:n}];s&&(m.push({role:"assistant",content:"(previous attempt; will retry with corrections)"}),m.push({role:"user",content:`Your previous response failed validation: ${s}
250
250
  Re-emit the FULL corrected JSON object.`}));let u=await t(me,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":ge},body:JSON.stringify({model:r.model,max_tokens:8e3,messages:m}),signal:i.signal});if(!u.ok){let a=await u.text().catch(()=>"");throw new Error(`anthropic API ${u.status}: ${a.slice(0,500)}`)}let d=await u.json(),e=(Array.isArray(d.content)?d.content:[]).filter(a=>a?.type==="text").map(a=>a.text).join(`
251
251
  `).trim();if(!e)throw new Error("anthropic API returned no text content");return e}finally{clearTimeout(c)}}async function Se(n={}){let r=n.wikiDir??P(process.cwd(),".agentx","wiki"),s=n.memoryRoot??P(process.cwd(),".agentx"),t=n.log??(()=>{}),o=n.now??Date.now(),i={candidates:[],clusters:[],proposed:[],skipped:[],gaps:[],warnings:[],errors:[],dryRun:!n.commit},c=new E(r,(...l)=>t(l.map(String).join(" "))),p=c.rebuildIndex(),m=z(r),u=[...ce(s),...n.extraCandidates??[]];if(i.candidates=de(u,p,m,{types:n.types,sinceMs:n.sinceMs,agentFilter:n.agentFilter,now:o,max:n.max}),i.candidates.length===0)return t("no unpromoted memories in window"),i;if(i.clusters=le(i.candidates),i.dryRun)return i;let d=p.articles.map(l=>({title:l.title,path:l.path,type:l.type})),g=c.getWorldview()??"",e=n.budgetTokens??ue,a=i.clusters,h=D(x,a,d,g);for(;R(h)>e&&a.length>1;)a=a.slice(0,-1),h=D(x,a,d,g);if(R(h)>e)return i.errors.push(`judge prompt (~${R(h)} tokens) exceeds the ${e}-token budget even with one cluster`),i;a.length<i.clusters.length&&i.warnings.push(`token budget: judged ${a.length} of ${i.clusters.length} clusters; the rest wait for the next run`);let y=a.flatMap(l=>l.candidates),w=new Set(y.map(l=>l.stamp)),b=n.chatId??`memory-promote-${new Date(o).toISOString().slice(0,10)}`,f=B(await G(h,{...n,chatId:b}),w);if("error"in f&&(t(`parse failed (${f.error}) \u2014 retrying with feedback`),f=B(await G(h,{...n,chatId:b},f.error),w)),"error"in f)return i.errors.push(`LLM response unusable after retry: ${f.error}`),i;i.warnings.push(...f.warnings),i.gaps=f.gaps;let v=new Date(o).toISOString(),k=[],T=new Map(y.map(l=>[l.stamp,l]));for(let l of f.articles){let A=c.readArticle(l.path);if(A&&!c.canWrite(A.meta,x)){i.errors.push(`write denied for "${l.path}" (owned by ${A.meta.owner??"?"})`);continue}let M=fe(l.promotedFrom,T),S={id:Y(o,l.path),createdAt:v,status:"pending",article:l,evidence:M,...A?{replaces:{lastUpdated:A.meta.lastUpdated,contentHash:V(A.content)}}:{}};I(r,S),i.proposed.push({id:S.id,path:l.path,title:l.title,type:l.type,stamps:l.promotedFrom,agents:M.agents,occurrences:M.occurrences});for(let X of l.promotedFrom)k.push({stamp:X,decision:"proposed",article:l.path,proposal:S.id,at:v})}for(let l of f.skipped)k.push({stamp:l.stamp,decision:"skipped",reason:l.reason,at:v}),i.skipped.push(l);return k.length&&C(r,k),i}var ue=6e4;function R(n){return Math.ceil(n.length/4)}function V(n){return ee("sha256").update(n).digest("hex").slice(0,16)}var he=600;function ye(n){return n.startsWith("review:")?"review":n.startsWith(j)?"failure":"memory"}function fe(n,r){let s=[];for(let t of n){let o=r.get(t);o&&s.push({stamp:t,kind:ye(t),agentId:o.agentId,type:o.memory.type,name:o.memory.name,description:o.memory.description,...o.occurrences?{occurrences:o.occurrences}:{},...o.sessions?.length?{sessions:o.sessions}:{},...o.tasks?.length?{tasks:o.tasks}:{},...o.failure?{failure:o.failure}:{},...o.memory.author?{author:o.memory.author}:{},...o.memory.taskId?{taskId:o.memory.taskId}:{},updatedAt:o.memory.updatedAt,excerpt:o.memory.body.slice(0,he)})}return{agents:[...new Set(s.map(t=>t.agentId))].sort(),occurrences:Math.max(1,...s.map(t=>t.occurrences??1)),sources:s}}function Ee(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=s.log??(()=>{}),i=new E(n,(...a)=>o(a.map(String).join(" "))),{article:c}=t,p=i.readArticle(c.path);if(!s.force){if(p&&!t.replaces)return{ok:!1,error:`"${c.path}" was created after this proposal; review it, then approve with --force`};if(p&&t.replaces&&V(p.content)!==t.replaces.contentHash)return{ok:!1,error:`"${c.path}" changed since this proposal; review it, then approve with --force`}}let m=s.now??Date.now(),u=new Date(m).toISOString().slice(0,10);if(!i.writeArticle(c.path,{title:c.title,type:L(c.type)?c.type:void 0,related:c.related,tags:c.tags,owner:x,access:"public",created:p?.meta.created??u,lastUpdated:u,sources:ae(p?.meta.sources,c.promotedFrom)},c.content,x))return{ok:!1,error:`write denied for "${c.path}" (owned by ${p?.meta.owner??"?"})`};let g=new Date(m).toISOString();C(n,c.promotedFrom.map(a=>({stamp:a,decision:"promoted",article:c.path,proposal:r,at:g}))),i.rebuildIndex();let e={...t,status:"approved",decidedBy:s.by??"operator",decidedAt:g};return I(n,e),{ok:!0,proposal:e}}function Oe(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=new Date(s.now??Date.now()).toISOString();C(n,t.article.promotedFrom.map(c=>({stamp:c,decision:"rejected",article:t.article.path,proposal:r,reason:s.reason,at:o})));let i={...t,status:"rejected",decidedBy:s.by??"operator",decidedAt:o,...s.reason?{reason:s.reason}:{}};return I(n,i),{ok:!0,proposal:i}}export{be as a,x as b,oe as c,K as d,q as e,ie as f,$ as g,ae as h,ce as i,z as j,C as k,le as l,B as m,de as n,G as o,Se as p,R as q,ye as r,fe as s,Ee as t,Oe as u};
252
- //# sourceMappingURL=chunk-343MPMLD.js.map
252
+ //# sourceMappingURL=chunk-2V6ZGE74.js.map
@@ -1,8 +1,8 @@
1
- import{a as _,b as q}from"./chunk-RKPAVWXF.js";import{a as R,b as O,c as B,d as b,f as k,g as z,h as v,i as w,j as S,k as m}from"./chunk-H2KOXGDX.js";import{a as x,b as C,c as E,d as P,e as D}from"./chunk-FDX4IGLK.js";import{existsSync as J,readFileSync as M}from"fs";var V=new Set(["cron","heartbeat","api","a2a","mesh"]),W=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function A(n,e=W){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function Y(n){let e=x(n);if(!J(e))throw new Error(`config not found at ${e}`);return JSON.parse(M(e,"utf-8"))}function Z(n,e){return n?.agents?.[e]?.admin===!0}function K(n,e,t){return Z(n,t.agentId)||e?.createdBy===t.agentId}function Q(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function j(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!V.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function ee(n,e,t){let r=e.timezone||"UTC",d=e.enabled&&!m(e)?S(w(e.schedule,r,t),r):"\u2014",p=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",h=[`- ${n} [${p}] ${e.schedule} \u2014 ${v(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${d}`];return e.notify&&h.push(` notify: ${e.notify.channel} ${e.notify.chatId} ${z(e)}`),e.command?h.push(` command: ${A(String(e.command))}`):e.prompt&&h.push(` prompt: ${A(String(e.prompt))}`),h.join(`
1
+ import{a as _,b as q}from"./chunk-RKPAVWXF.js";import{a as R,b as O,c as B,d as b,f as k,g as z,h as v,i as w,j as S,k as m}from"./chunk-V4IOGISL.js";import{a as x,b as C,c as E,d as P,e as D}from"./chunk-NS2HSAHF.js";import{existsSync as J,readFileSync as M}from"fs";var V=new Set(["cron","heartbeat","api","a2a","mesh"]),W=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function A(n,e=W){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function Y(n){let e=x(n);if(!J(e))throw new Error(`config not found at ${e}`);return JSON.parse(M(e,"utf-8"))}function Z(n,e){return n?.agents?.[e]?.admin===!0}function K(n,e,t){return Z(n,t.agentId)||e?.createdBy===t.agentId}function Q(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function j(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!V.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function ee(n,e,t){let r=e.timezone||"UTC",d=e.enabled&&!m(e)?S(w(e.schedule,r,t),r):"\u2014",p=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",h=[`- ${n} [${p}] ${e.schedule} \u2014 ${v(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${d}`];return e.notify&&h.push(` notify: ${e.notify.channel} ${e.notify.chatId} ${z(e)}`),e.command?h.push(` command: ${A(String(e.command))}`):e.prompt&&h.push(` prompt: ${A(String(e.prompt))}`),h.join(`
2
2
  `)}async function L(n,e,t){let r=n?.notifications?.destination;if(!r?.channel||!r?.chatId)return"No operator notification destination is configured (notifications.destination); the operator must check `agentx schedule list`.";if(!e.notifyOperator)return"Operator notification is unavailable in this context.";try{return await e.notifyOperator({channel:r.channel,chatId:r.chatId,accountId:r.accountId},t),"The operator has been notified."}catch(d){return`Could not notify the operator (${d?.message??d}); the request is still recorded.`}}async function ae(n,e,t={}){let r=(s(n.action)||"list").toLowerCase(),d=t.now?t.now():new Date,p;try{p=Y(t.configPath)}catch(a){return`Error: ${a.message}`}let h=p.crons||{};if(r==="list"){let a=n.mine===!0,l=Object.entries(h).filter(([,i])=>!a||e&&i?.createdBy===e.agentId);return l.length?l.map(([i,f])=>ee(i,f,d)).join(`
3
3
  `):a?"You have no schedules.":"No schedules."}if(!e?.agentId)return"Error: caller agent is unknown (AGENTX_AGENT_ID not set). Pass callerAgentId.";if(!p.agents?.[e.agentId])return`Error: caller "${e.agentId}" is not an agent on this node.`;let o=s(n.id),I=a=>C(a,{configPath:t.configPath,reload:t.reload});if(r==="create"){let a=s(n.when),l=s(n.prompt);if(!a||!l)return"Error: create needs `when` (plain English) and `prompt`.";let i=_(a);if(!i)return`Error: couldn't parse "${a}". ${O}.`;let f=s(n.agent)||e.agentId;if(!p.agents?.[f])return`Error: agent "${f}" not found on this node.`;let g=s(n.timezone)||R;if(!b(g))return`Error: unknown timezone "${g}".`;let u=o||q(i.matched,f);if(!B(u))return`Error: invalid id "${u}" (letters, digits, "-" and "_" only).`;if(h[u])return`Error: a schedule "${u}" already exists. Pick another \`id\`.`;let $=j(n,e);if($==="invalid")return'Error: `notify` must be "here", "none", or "channel:chatId".';let y=s(n.report);if(y&&y!=="always"&&y!=="exceptions")return'Error: `report` must be "always" or "exceptions".';let G={action:"create",requestedBy:e.agentId,requestedAt:d.toISOString()},H=k({parsed:i,agent:f,prompt:l,timezone:g,notify:$,report:y,enabled:!1,createdBy:e.agentId,approval:G}),N=await I(F=>E(F,`crons.${u}`,H));if(!N.success)return`Error: ${N.error}`;let T=S(w(i.cron,g,d),g),U=[`Schedule approval requested by ${e.agentId}`,`Create: ${u}`,`When: ${i.human} \u2014 cron \`${i.cron}\` (${g})`,`Next fire: ${T}`,`Agent: ${f}`,$?`${y==="exceptions"?"Exceptions":"Results"} and failures go to: ${$.channel} ${$.chatId}${$.channel==="voice"?" (as a push notification)":""}`:"Results go to: run log only (no chat)",`Prompt: ${A(l,400)}`,"",`Approve: agentx schedule approve ${u}`,`Reject: agentx schedule reject ${u}`].join(`
4
4
  `),X=await L(p,t,U);return[`Requested schedule "${u}": ${i.human} (cron ${i.cron}, ${g}); next fire would be ${T}.`,"It is saved DISABLED and will not run until the operator approves it.",X].join(`
5
5
  `)}if(!o)return`Error: ${r} needs \`id\`.`;let c=h[o];if(!c)return`Error: schedule "${o}" not found.`;if(!K(p,c,e))return Q(o,c);if(r==="pause"||r==="resume"){let a=r==="resume";if(a&&m(c))return`"${o}" is still awaiting operator approval; it can't be resumed until approved.`;if(c.enabled===a)return`"${o}" is already ${a?"active":"paused"}.`;let l=await I(i=>E(i,`crons.${o}.enabled`,a));return l.success?`"${o}" ${a?"resumed":"paused"}.`:`Error: ${l.error}`}if(r==="delete"){if(m(c)&&c.approval.requestedBy===e.agentId){let u=await I($=>D($,`crons.${o}`));return u.success?`Withdrew the pending request "${o}".`:`Error: ${u.error}`}if(m(c))return`"${o}" is a creation request still awaiting approval; only its requester or the operator (\`agentx schedule reject ${o}\`) can drop it.`;if(c.approval?.action==="delete")return`Deletion of "${o}" is already awaiting approval.`;let a={action:"delete",requestedBy:e.agentId,requestedAt:d.toISOString()},l=await I(u=>{if(!P(u,`crons.${o}`))throw new Error(`schedule "${o}" not found`);E(u,`crons.${o}.approval`,a)});if(!l.success)return`Error: ${l.error}`;let i=c.timezone||"UTC",f=[`Schedule approval requested by ${e.agentId}`,`Delete: ${o}`,`When: ${v(c.schedule)} \u2014 cron \`${c.schedule}\` (${i})`,`Next fire: ${c.enabled?S(w(c.schedule,i,d),i):"\u2014 (paused)"}`,`Agent: ${c.agent}`,"",`Approve: agentx schedule approve ${o}`,`Reject: agentx schedule reject ${o}`].join(`
6
6
  `),g=await L(p,t,f);return[`Deletion of "${o}" requested. It keeps its current state until the operator approves.`,g].join(`
7
7
  `)}return`Error: unknown action "${r}". Use list, create, pause, resume or delete.`}function ie(n,e=process.env){let t=s(e.AGENTX_AGENT_ID)||s(n.callerAgentId);if(!t)return null;let r=!!(s(e.AGENTX_CHANNEL)&&s(e.AGENTX_CHAT_ID)),d=s(r?e.AGENTX_CHANNEL:n.channel),p=s(r?e.AGENTX_CHAT_ID:n.chatId),h=s(n.accountId);return{agentId:t,channel:d,chatId:p,...h?{accountId:h}:{}}}export{ae as a,ie as b};
8
- //# sourceMappingURL=chunk-4KNHLHE3.js.map
8
+ //# sourceMappingURL=chunk-4HYIERJ4.js.map