agentix-cli 0.180.0 → 0.181.1

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 (137) hide show
  1. package/dist/{App-43V7KUZU.js → App-UXX5TGFF.js} +2 -2
  2. package/dist/{ChatApp-ZG2IXOB5.js → ChatApp-X635NOAE.js} +2 -2
  3. package/dist/{absorb-eval-4NMMBFH3.js → absorb-eval-4ZPDWNBA.js} +2 -2
  4. package/dist/{adapter-57X4HJEA.js → adapter-Z23K544D.js} +2 -2
  5. package/dist/{agent-LP5F5OCL.js → agent-OBRH5BJZ.js} +2 -2
  6. package/dist/{board-dashboard-SIBVGWSE.js → board-dashboard-SFXVOICJ.js} +36 -9
  7. package/dist/{board-dashboard-SIBVGWSE.js.map → board-dashboard-SFXVOICJ.js.map} +1 -1
  8. package/dist/{chunk-S25OP23O.js → chunk-33DLG4I2.js} +5 -5
  9. package/dist/{chunk-2BI43ZKI.js → chunk-7RVJWLIP.js} +2 -2
  10. package/dist/{chunk-KPRWATQR.js → chunk-CF7CPE7K.js} +2 -2
  11. package/dist/{chunk-LQS27HSV.js → chunk-CTNZVRPA.js} +4 -4
  12. package/dist/chunk-CTNZVRPA.js.map +1 -0
  13. package/dist/{chunk-XXWSFJFZ.js → chunk-FRVFRWFN.js} +2 -2
  14. package/dist/{chunk-6FNJ7GQ2.js → chunk-G6ZRPC6E.js} +2 -2
  15. package/dist/{chunk-BCDC7BOQ.js → chunk-HBQRVCLU.js} +2 -2
  16. package/dist/{chunk-YIR6FABW.js → chunk-HMEFQL5P.js} +2 -2
  17. package/dist/{chunk-KUZATIJA.js → chunk-IRZYRLXQ.js} +2 -2
  18. package/dist/{chunk-3VZNOJJK.js → chunk-IYITREE5.js} +2 -2
  19. package/dist/{chunk-DUWKRQKT.js → chunk-J56YGKUO.js} +2 -2
  20. package/dist/{chunk-P7FSTC5E.js → chunk-KOY3EOPH.js} +41 -29
  21. package/dist/chunk-KOY3EOPH.js.map +1 -0
  22. package/dist/{chunk-FZMS4UFL.js → chunk-KVAWRQBA.js} +2 -2
  23. package/dist/{chunk-T7E33M6T.js → chunk-LZY6YN2J.js} +2 -2
  24. package/dist/{chunk-FXMUUDSH.js → chunk-NI2XD6P3.js} +2 -2
  25. package/dist/{chunk-TLSMX7LZ.js → chunk-OYCMFCME.js} +2 -2
  26. package/dist/{chunk-7NJLRLQN.js → chunk-PCWXHXTM.js} +2 -2
  27. package/dist/{chunk-E5QQJY6T.js → chunk-QJXGJMHM.js} +53 -53
  28. package/dist/chunk-QJXGJMHM.js.map +1 -0
  29. package/dist/{chunk-CVFQA3TH.js → chunk-SD6UDSXV.js} +2 -2
  30. package/dist/{chunk-3X2BFCOZ.js → chunk-SDINSYTN.js} +2 -2
  31. package/dist/{chunk-OHPCZOOM.js → chunk-TZ7GB7FI.js} +2 -2
  32. package/dist/{chunk-5DJOGAS2.js → chunk-U5S6IP7Z.js} +3 -3
  33. package/dist/{chunk-RMSB6DKW.js → chunk-UFUQQ5J5.js} +2 -2
  34. package/dist/{chunk-7WMZJFYD.js → chunk-UHTIZCKU.js} +2 -2
  35. package/dist/{chunk-FRR6DRLY.js → chunk-UMHN33JQ.js} +2 -2
  36. package/dist/{chunk-M4BNVLGJ.js → chunk-VK3M3TVL.js} +2 -2
  37. package/dist/{chunk-QJKQELHR.js → chunk-WKU7YFDV.js} +2 -2
  38. package/dist/{chunk-PHT6HTAW.js → chunk-WZUY7VGL.js} +2 -2
  39. package/dist/{chunk-HYLVA6VA.js → chunk-Z2UDWVZZ.js} +2 -2
  40. package/dist/{chunk-L7F226TX.js → chunk-ZSY6PFHD.js} +2 -2
  41. package/dist/cli.js +1 -1
  42. package/dist/{client-NJKGG5OP.js → client-ILPJFCTF.js} +2 -2
  43. package/dist/{config-HILBFLHC.js → config-JVWOL233.js} +2 -2
  44. package/dist/{config-mutate-SJYPUDP5.js → config-mutate-WYCHP6VK.js} +2 -2
  45. package/dist/config-mutator-DKNHE6VP.js +2 -0
  46. package/dist/{contributions-HN3JAPFB.js → contributions-XD66HYWE.js} +2 -2
  47. package/dist/{doctor-6P5PYFMD.js → doctor-DYTYJQYC.js} +2 -2
  48. package/dist/{follow-up-tool-MXMT3GED.js → follow-up-tool-HPET6LZW.js} +2 -2
  49. package/dist/{grants-Z332LOTO.js → grants-FY2TIT7I.js} +2 -2
  50. package/dist/{hub-EBZO3VRY.js → hub-L5FFJPS3.js} +2 -2
  51. package/dist/index.js +1 -1
  52. package/dist/{program-BB2XYW5V.js → program-24C3VBSD.js} +23 -23
  53. package/dist/{promote-M3GWICXS.js → promote-XI6W27JK.js} +2 -2
  54. package/dist/{query-XBRRKY6I.js → query-MGG5QKNC.js} +2 -2
  55. package/dist/{query-settings-3UVI3UQF.js → query-settings-CALZYYWD.js} +2 -2
  56. package/dist/{registry-5YYMCHMF.js → registry-XJWSLJ4O.js} +2 -2
  57. package/dist/{request-planner-45D32J2H.js → request-planner-JCRGGJUO.js} +2 -2
  58. package/dist/{review-candidates-VOTQHP2K.js → review-candidates-OEBEEAEZ.js} +2 -2
  59. package/dist/{routing-SPX5VDTG.js → routing-CGH54RYG.js} +2 -2
  60. package/dist/schedule-tool-UM3CAPDX.js +2 -0
  61. package/dist/{scheduler-OVYVZN6N.js → scheduler-2K5YEV2U.js} +2 -2
  62. package/dist/{seat-4VQ2X5PF.js → seat-DEL5YUOS.js} +2 -2
  63. package/dist/{select-2QW6SYWW.js → select-MRTWSI7U.js} +2 -2
  64. package/dist/{set-enabled-API6VRUP.js → set-enabled-XTDCFCZY.js} +2 -2
  65. package/dist/{sprint-tool-4PLRLWOU.js → sprint-tool-N7WPDX5J.js} +2 -2
  66. package/dist/{tool-PVFI2DWN.js → tool-BQEJOTF3.js} +2 -2
  67. package/dist/{tool-CMOZJTA2.js → tool-KZHWJ7BC.js} +2 -2
  68. package/dist/{tool-XEGKIHUP.js → tool-NZTJZDSB.js} +2 -2
  69. package/dist/{wiki-3MTKUBPS.js → wiki-YERCKD3E.js} +2 -2
  70. package/dist/wiki-enrich-K54LGNU3.js +2 -0
  71. package/package.json +1 -1
  72. package/dist/chunk-E5QQJY6T.js.map +0 -1
  73. package/dist/chunk-LQS27HSV.js.map +0 -1
  74. package/dist/chunk-P7FSTC5E.js.map +0 -1
  75. package/dist/config-mutator-XGZRKKD4.js +0 -2
  76. package/dist/schedule-tool-IUUGZFJ3.js +0 -2
  77. package/dist/wiki-enrich-7KX7YTZ4.js +0 -2
  78. /package/dist/{App-43V7KUZU.js.map → App-UXX5TGFF.js.map} +0 -0
  79. /package/dist/{ChatApp-ZG2IXOB5.js.map → ChatApp-X635NOAE.js.map} +0 -0
  80. /package/dist/{absorb-eval-4NMMBFH3.js.map → absorb-eval-4ZPDWNBA.js.map} +0 -0
  81. /package/dist/{adapter-57X4HJEA.js.map → adapter-Z23K544D.js.map} +0 -0
  82. /package/dist/{agent-LP5F5OCL.js.map → agent-OBRH5BJZ.js.map} +0 -0
  83. /package/dist/{chunk-S25OP23O.js.map → chunk-33DLG4I2.js.map} +0 -0
  84. /package/dist/{chunk-2BI43ZKI.js.map → chunk-7RVJWLIP.js.map} +0 -0
  85. /package/dist/{chunk-KPRWATQR.js.map → chunk-CF7CPE7K.js.map} +0 -0
  86. /package/dist/{chunk-XXWSFJFZ.js.map → chunk-FRVFRWFN.js.map} +0 -0
  87. /package/dist/{chunk-6FNJ7GQ2.js.map → chunk-G6ZRPC6E.js.map} +0 -0
  88. /package/dist/{chunk-BCDC7BOQ.js.map → chunk-HBQRVCLU.js.map} +0 -0
  89. /package/dist/{chunk-YIR6FABW.js.map → chunk-HMEFQL5P.js.map} +0 -0
  90. /package/dist/{chunk-KUZATIJA.js.map → chunk-IRZYRLXQ.js.map} +0 -0
  91. /package/dist/{chunk-3VZNOJJK.js.map → chunk-IYITREE5.js.map} +0 -0
  92. /package/dist/{chunk-DUWKRQKT.js.map → chunk-J56YGKUO.js.map} +0 -0
  93. /package/dist/{chunk-FZMS4UFL.js.map → chunk-KVAWRQBA.js.map} +0 -0
  94. /package/dist/{chunk-T7E33M6T.js.map → chunk-LZY6YN2J.js.map} +0 -0
  95. /package/dist/{chunk-FXMUUDSH.js.map → chunk-NI2XD6P3.js.map} +0 -0
  96. /package/dist/{chunk-TLSMX7LZ.js.map → chunk-OYCMFCME.js.map} +0 -0
  97. /package/dist/{chunk-7NJLRLQN.js.map → chunk-PCWXHXTM.js.map} +0 -0
  98. /package/dist/{chunk-CVFQA3TH.js.map → chunk-SD6UDSXV.js.map} +0 -0
  99. /package/dist/{chunk-3X2BFCOZ.js.map → chunk-SDINSYTN.js.map} +0 -0
  100. /package/dist/{chunk-OHPCZOOM.js.map → chunk-TZ7GB7FI.js.map} +0 -0
  101. /package/dist/{chunk-5DJOGAS2.js.map → chunk-U5S6IP7Z.js.map} +0 -0
  102. /package/dist/{chunk-RMSB6DKW.js.map → chunk-UFUQQ5J5.js.map} +0 -0
  103. /package/dist/{chunk-7WMZJFYD.js.map → chunk-UHTIZCKU.js.map} +0 -0
  104. /package/dist/{chunk-FRR6DRLY.js.map → chunk-UMHN33JQ.js.map} +0 -0
  105. /package/dist/{chunk-M4BNVLGJ.js.map → chunk-VK3M3TVL.js.map} +0 -0
  106. /package/dist/{chunk-QJKQELHR.js.map → chunk-WKU7YFDV.js.map} +0 -0
  107. /package/dist/{chunk-PHT6HTAW.js.map → chunk-WZUY7VGL.js.map} +0 -0
  108. /package/dist/{chunk-HYLVA6VA.js.map → chunk-Z2UDWVZZ.js.map} +0 -0
  109. /package/dist/{chunk-L7F226TX.js.map → chunk-ZSY6PFHD.js.map} +0 -0
  110. /package/dist/{client-NJKGG5OP.js.map → client-ILPJFCTF.js.map} +0 -0
  111. /package/dist/{config-HILBFLHC.js.map → config-JVWOL233.js.map} +0 -0
  112. /package/dist/{config-mutate-SJYPUDP5.js.map → config-mutate-WYCHP6VK.js.map} +0 -0
  113. /package/dist/{config-mutator-XGZRKKD4.js.map → config-mutator-DKNHE6VP.js.map} +0 -0
  114. /package/dist/{contributions-HN3JAPFB.js.map → contributions-XD66HYWE.js.map} +0 -0
  115. /package/dist/{doctor-6P5PYFMD.js.map → doctor-DYTYJQYC.js.map} +0 -0
  116. /package/dist/{follow-up-tool-MXMT3GED.js.map → follow-up-tool-HPET6LZW.js.map} +0 -0
  117. /package/dist/{grants-Z332LOTO.js.map → grants-FY2TIT7I.js.map} +0 -0
  118. /package/dist/{hub-EBZO3VRY.js.map → hub-L5FFJPS3.js.map} +0 -0
  119. /package/dist/{program-BB2XYW5V.js.map → program-24C3VBSD.js.map} +0 -0
  120. /package/dist/{promote-M3GWICXS.js.map → promote-XI6W27JK.js.map} +0 -0
  121. /package/dist/{query-XBRRKY6I.js.map → query-MGG5QKNC.js.map} +0 -0
  122. /package/dist/{query-settings-3UVI3UQF.js.map → query-settings-CALZYYWD.js.map} +0 -0
  123. /package/dist/{registry-5YYMCHMF.js.map → registry-XJWSLJ4O.js.map} +0 -0
  124. /package/dist/{request-planner-45D32J2H.js.map → request-planner-JCRGGJUO.js.map} +0 -0
  125. /package/dist/{review-candidates-VOTQHP2K.js.map → review-candidates-OEBEEAEZ.js.map} +0 -0
  126. /package/dist/{routing-SPX5VDTG.js.map → routing-CGH54RYG.js.map} +0 -0
  127. /package/dist/{schedule-tool-IUUGZFJ3.js.map → schedule-tool-UM3CAPDX.js.map} +0 -0
  128. /package/dist/{scheduler-OVYVZN6N.js.map → scheduler-2K5YEV2U.js.map} +0 -0
  129. /package/dist/{seat-4VQ2X5PF.js.map → seat-DEL5YUOS.js.map} +0 -0
  130. /package/dist/{select-2QW6SYWW.js.map → select-MRTWSI7U.js.map} +0 -0
  131. /package/dist/{set-enabled-API6VRUP.js.map → set-enabled-XTDCFCZY.js.map} +0 -0
  132. /package/dist/{sprint-tool-4PLRLWOU.js.map → sprint-tool-N7WPDX5J.js.map} +0 -0
  133. /package/dist/{tool-PVFI2DWN.js.map → tool-BQEJOTF3.js.map} +0 -0
  134. /package/dist/{tool-CMOZJTA2.js.map → tool-KZHWJ7BC.js.map} +0 -0
  135. /package/dist/{tool-XEGKIHUP.js.map → tool-NZTJZDSB.js.map} +0 -0
  136. /package/dist/{wiki-3MTKUBPS.js.map → wiki-YERCKD3E.js.map} +0 -0
  137. /package/dist/{wiki-enrich-7KX7YTZ4.js.map → wiki-enrich-K54LGNU3.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as Fe}from"./chunk-GTJIKXDB.js";import{C as vn,J as Cn,k as P}from"./chunk-6FNJ7GQ2.js";import{f as An,g as In,h as Tn,k as Dn}from"./chunk-PHT6HTAW.js";import{a as k}from"./chunk-N6VBEITO.js";import{b as $n}from"./chunk-2VDO2HEK.js";import{f as En,i as _n,k as Me,l as Ue,n as G,o as j,q as Rn}from"./chunk-LQS27HSV.js";import{t as Sn,u as xn}from"./chunk-3X2BFCOZ.js";import{d as wn,e as kn}from"./chunk-AQASR6KR.js";import{a as dn,b as pn,d as gn,e as fn}from"./chunk-MNG2AMKZ.js";import{h as K,j as mn,l as hn,m as bn,n as yn}from"./chunk-RX5O5637.js";import{h as on,i as an,j as ln,l as cn,m as un}from"./chunk-OHPCZOOM.js";import{a as rn,c as sn}from"./chunk-KP7KDLZ2.js";import{Aa as Oe,Ca as Pe,b as Ce,s as Ne,u as Le,xa as nn,za as le}from"./chunk-M4BNVLGJ.js";import{r as tn}from"./chunk-CVFQA3TH.js";import{a as Qt,b as ae,e as en}from"./chunk-KUZATIJA.js";import{a as Zt}from"./chunk-QUFIUXMQ.js";import{da as Ht,ea as zt,fb as De,ga as Xt,ha as Kt,ob as Gt,p as ie,pb as Jt,q as Vt,r as Bt,s as ro,yb as Yt}from"./chunk-P7FSTC5E.js";import{a as Ie,h as so}from"./chunk-VJ5HC63R.js";import{j as Te,r as oo}from"./chunk-UEEB3UTU.js";import{existsSync as io,readdirSync as ao,readFileSync as lo,statSync as co}from"fs";import{resolve as uo}from"path";function Nn(t,e,n=Date.now(),r=7){let s=r*864e5,o=new Map;for(let i of e){let a=o.get(i.workflowId);a?a.push(i):o.set(i.workflowId,[i])}return t.map(i=>{let a=o.get(i.id)??[],l=a.filter(f=>n-f.at<=s),u=a.filter(f=>n-f.at>s&&n-f.at<=s*2),c=l.filter(f=>f.status==="failed").length,d=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=a.length?u.length>0&&l.length===0?"dormant":l.length>0&&c*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:i.id,name:i.name||i.id,state:g,lastRunAt:p,recent:l.length,prior:u.length,failed:c,paused:d}}).sort((i,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[i.state]-l[a.state]||(a.lastRunAt??0)-(i.lastRunAt??0)})}var ce=new Map;function Uc(t,e=1e3){if(!io(t))return[];let n=ao(t).filter(o=>o.endsWith(".jsonl")).map(o=>{let i=uo(t,o);return{path:i,mtime:co(i).mtimeMs}}).sort((o,i)=>i.mtime-o.mtime).slice(0,e),r=new Set(n.map(o=>o.path));for(let o of ce.keys())r.has(o)||ce.delete(o);let s=[];for(let{path:o,mtime:i}of n){let a=ce.get(o);if(a&&a.mtime===i){a.summary&&s.push(a.summary);continue}let l=po(o,i);ce.set(o,{mtime:i,summary:l}),l&&s.push(l)}return s}function po(t,e){try{let n=lo(t,"utf-8").split(`
1
+ import{a as Fe}from"./chunk-GTJIKXDB.js";import{C as vn,J as Cn,k as P}from"./chunk-G6ZRPC6E.js";import{f as An,g as In,h as Tn,k as Dn}from"./chunk-WZUY7VGL.js";import{a as k}from"./chunk-N6VBEITO.js";import{b as $n}from"./chunk-2VDO2HEK.js";import{f as En,i as _n,k as Me,l as Ue,n as G,o as j,q as Rn}from"./chunk-CTNZVRPA.js";import{t as Sn,u as xn}from"./chunk-SDINSYTN.js";import{d as wn,e as kn}from"./chunk-AQASR6KR.js";import{a as dn,b as pn,d as gn,e as fn}from"./chunk-MNG2AMKZ.js";import{h as K,j as mn,l as hn,m as bn,n as yn}from"./chunk-RX5O5637.js";import{h as on,i as an,j as ln,l as cn,m as un}from"./chunk-TZ7GB7FI.js";import{a as rn,c as sn}from"./chunk-KP7KDLZ2.js";import{Aa as Oe,Ca as Pe,b as Ce,s as Ne,u as Le,xa as nn,za as le}from"./chunk-VK3M3TVL.js";import{r as tn}from"./chunk-SD6UDSXV.js";import{a as Qt,b as ae,e as en}from"./chunk-IRZYRLXQ.js";import{a as Zt}from"./chunk-QUFIUXMQ.js";import{da as Ht,ea as zt,fb as De,ga as Xt,ha as Kt,ob as Gt,p as ie,pb as Jt,q as Vt,r as Bt,s as ro,yb as Yt}from"./chunk-KOY3EOPH.js";import{a as Ie,h as so}from"./chunk-VJ5HC63R.js";import{j as Te,r as oo}from"./chunk-UEEB3UTU.js";import{existsSync as io,readdirSync as ao,readFileSync as lo,statSync as co}from"fs";import{resolve as uo}from"path";function Nn(t,e,n=Date.now(),r=7){let s=r*864e5,o=new Map;for(let i of e){let a=o.get(i.workflowId);a?a.push(i):o.set(i.workflowId,[i])}return t.map(i=>{let a=o.get(i.id)??[],l=a.filter(f=>n-f.at<=s),u=a.filter(f=>n-f.at>s&&n-f.at<=s*2),c=l.filter(f=>f.status==="failed").length,d=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=a.length?u.length>0&&l.length===0?"dormant":l.length>0&&c*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:i.id,name:i.name||i.id,state:g,lastRunAt:p,recent:l.length,prior:u.length,failed:c,paused:d}}).sort((i,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[i.state]-l[a.state]||(a.lastRunAt??0)-(i.lastRunAt??0)})}var ce=new Map;function Uc(t,e=1e3){if(!io(t))return[];let n=ao(t).filter(o=>o.endsWith(".jsonl")).map(o=>{let i=uo(t,o);return{path:i,mtime:co(i).mtimeMs}}).sort((o,i)=>i.mtime-o.mtime).slice(0,e),r=new Set(n.map(o=>o.path));for(let o of ce.keys())r.has(o)||ce.delete(o);let s=[];for(let{path:o,mtime:i}of n){let a=ce.get(o);if(a&&a.mtime===i){a.summary&&s.push(a.summary);continue}let l=po(o,i);ce.set(o,{mtime:i,summary:l}),l&&s.push(l)}return s}function po(t,e){try{let n=lo(t,"utf-8").split(`
2
2
  `).filter(Boolean);if(!n.length)return null;let r=JSON.parse(n[0]),s=r.run?.workflowId;if(!s)return null;let o=r.run?.status??"unknown";for(let i=n.length-1;i>=0;i--){let a=JSON.parse(n[i]),l=a.status??a.run?.status;if(l){o=l;break}}return{workflowId:s,status:o,at:e}}catch{return null}}var Ln=7,go={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},S={routines:200,summary:160,filters:6,filterValue:60,text:120},fo=(t,e,n)=>{try{return tn(t,e,n)}catch{return null}},On=864e5;function qc(t){let e=t.now??Date.now(),n={...go,...t.thresholds},r=t.nextFire??fo,s=[];for(let a of t.crons){let l=t.cronRuns.get(a.id)??[],u=a.timezone||"UTC",c=l.map(g=>({at:Date.parse(g.startedAt),status:g.status})),d=l[0],p={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:I(a.id,S.text),trigger:{schedule:I(a.schedule,S.text),timezone:u},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?We(a.nextRun)??We(r(a.schedule,new Date(e),u)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:ko(d.status==="success"?void 0:d.errorSummary,S.summary)}:null,lastSuccessAt:l.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:Pn(c),sampledRuns:l.length,flags:[],attention:null,recent:l.slice(0,Ln).map(g=>({at:g.startedAt,status:g.status}))};p.flags=Mn(p,c,a.schedule,u,null,e,n,r),s.push(Un(p))}let o=new Map(Nn(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),i=new Map;for(let a of t.workflowRuns){let l=i.get(a.workflowId);l?l.push(a):i.set(a.workflowId,[a])}for(let a of t.workflows){let l=a.nodes.find(w=>w.type.startsWith("trigger."));if(!l||l.type!=="trigger.cron"&&l.type!=="trigger.hook")continue;let u=l.config??{},c=a.state||"active",d=c==="active",p=(i.get(a.id)??[]).slice().sort((w,Ae)=>Ae.at-w.at),g=p.map(w=>({at:w.at,status:bo(w.status)})),f=g[0],m=l.type==="trigger.cron",b=typeof u.spec=="string"?u.spec:"",v=typeof u.timezone=="string"?u.timezone:"UTC",W={id:`workflow:${a.id}`,source:"workflow",kind:m?"schedule":"event",name:I(a.title||a.id,S.text),trigger:m?{schedule:I(b,S.text),timezone:v}:{event:I(typeof u.event=="string"?u.event:"",S.text),filters:wo(u.filter,a)},agent:yo(a),enabled:d,state:c,nextRunAt:m&&d&&b?We(r(b,new Date(e),v)):null,lastRun:f?{at:new Date(f.at).toISOString(),status:f.status}:null,lastSuccessAt:(()=>{let w=g.find(Ae=>Ae.status==="success");return w?new Date(w.at).toISOString():null})(),consecutiveFailures:Pn(g),sampledRuns:p.length,flags:[],attention:null,recent:g.slice(0,Ln).map(w=>({at:new Date(w.at).toISOString(),status:w.status}))},oe=Date.parse(a.updated||a.created||"");W.flags=m?Mn(W,g,b,v,Number.isFinite(oe)?oe:null,e,n,r):mo(W,o.get(a.id)?.state==="dormant",Number.isFinite(oe)?oe:null,e,n),s.push(Un(W))}return s.sort(ho).slice(0,S.routines)}function Pn(t){let e=0;for(let n of t)if(!(n.status==="running"||n.status==="paused"||n.status==="unknown"))if(n.status==="failed"||n.status==="timeout")e++;else break;return e}function Mn(t,e,n,r,s,o,i,a){let l=[],u=e.length?e[0].at:null;if(!t.enabled){let p=Wn(u,s,o,i);return p&&l.push(p),l}if(t.consecutiveFailures>=i.failStreak&&l.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),u===null)return l.push({reason:"never-ran",detail:"No persisted attempt"}),l;let c=new Date(u),d=null;for(let p=0;p<i.missedFires&&(d=a(n,c,r),!!d);p++)c=d;return d&&o>d.getTime()+i.graceMs&&l.push({reason:"overdue",detail:`No attempt since ${new Date(u).toISOString()}; ${i.missedFires} scheduled fires missed`}),l}function mo(t,e,n,r,s){let o=[],i=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=Wn(i,n,r,s);return a&&o.push(a),o}return t.consecutiveFailures>=s.failStreak&&o.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),i===null?o.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&o.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),o}function Wn(t,e,n,r){let s=Math.max(t??0,e??0);return s&&n-s<r.disabledDays*On?null:{reason:"disabled-long",detail:s?`Disabled; no activity for ${Math.floor((n-s)/On)} days`:"Disabled and never ran"}}function Un(t){let e=new Set(t.flags.map(n=>n.reason));return t.attention=e.has("failing")?"critical":e.has("overdue")||e.has("dormant")||e.has("never-ran")?"warning":e.has("disabled-long")?"info":null,t}var Fn={critical:0,warning:1,info:2};function ho(t,e){let n=t.attention?Fn[t.attention]:3,r=e.attention?Fn[e.attention]:3;return n-r||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function bo(t){switch(t){case"completed":case"ok":return"success";case"failed":return"failed";case"timeout":return"timeout";case"canceled":return"canceled";case"running":return"running";case"paused":return"paused";default:return"unknown"}}function yo(t){if(t.ownerAgent)return I(t.ownerAgent,S.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?I(String(e.config.agentId),S.text):null}function wo(t,e){let n=[],r=e?.project;if(r&&n.push(I(`project=${r}`,S.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[s,o]of Object.entries(t)){let i=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];i.length&&n.push(I(`${s}=${i.join(",")}`,S.filterValue))}return n.slice(0,S.filters)}function We(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function I(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function ko(t,e){return t===void 0?void 0:I(t,e)}import{mkdirSync as So,readFileSync as xo,renameSync as vo,writeFileSync as $o}from"fs";import{resolve as Eo}from"path";function jn(t){return Eo(Ue(t),"_state.json")}function $(t){try{let e=JSON.parse(xo(jn(t),"utf-8"));return{snoozed:e&&typeof e.snoozed=="object"&&e.snoozed?e.snoozed:{},...typeof e?.lastDigest=="string"?{lastDigest:e.lastDigest}:{},...e?.popped&&typeof e.popped=="object"?{popped:e.popped}:{},...typeof e?.passAt=="string"?{passAt:e.passAt}:{},...Array.isArray(e?.wanted)?{wanted:e.wanted.filter(n=>typeof n=="string")}:{}}}catch{return{snoozed:{}}}}function J(t,e){So(Ue(t),{recursive:!0});let n=jn(t),r=`${n}.${process.pid}.tmp`;$o(r,JSON.stringify(e,null,2)+`
3
3
  `),vo(r,n)}function qn(t,e,n,r=Date.now()){let s=$(t),o={};for(let[i,a]of Object.entries(s.snoozed))Date.parse(a)>r&&(o[i]=a);o[e]=n.toISOString(),J(t,{...s,snoozed:o})}function Xc(t,e){J(t,{...$(t),lastDigest:e})}function je(t,e,n,r=Date.now()){let s=$(t),o=new Set(n),i={};for(let[l,u]of Object.entries(s.popped??{}))o.has(l)&&(i[l]=u);i[e]=new Date(r).toISOString();let a=(s.wanted??[]).filter(l=>l!==e&&o.has(l));J(t,{...s,popped:i,wanted:a})}function Vn(t,e){let n=$(t);J(t,{...n,wanted:[...(n.wanted??[]).filter(r=>r!==e),e]})}function Kc(t,e=Date.now()){J(t,{...$(t),popped:{},passAt:new Date(e).toISOString()})}import{existsSync as _o,readFileSync as Ro}from"fs";Yt();so();function Bn(t){let e=Qt(t),n={};if(_o(e))try{n=Gt(JSON.parse(Ro(e,"utf-8")))}catch{n={}}let r=De.safeParse(n?.requests);return r.success?r.data:De.parse(void 0)}async function eu(t,e={}){let n=(t.channels??[]).filter(r=>!Ie.has(r.toLowerCase().split("@")[0]));return n.length?{success:!1,error:`unknown channel ${n.map(r=>`"${r}"`).join(", ")}: use ${[...Ie].join(", ")}`}:ae(r=>{let s=r.requests??={};for(let o of["enabled","channels","from","staleAfterHours","retentionDays","settleHandedBack"])t[o]!==void 0&&(s[o]=t[o]);if(t.plans){let o=s.plans??={};for(let i of["enabled","stallMinutes","maxNudges","approveKinds","disabledAgents","requireForWork","requireOverMinutes"])t.plans[i]!==void 0&&(o[i]=t.plans[i])}if(t.headlines?.enabled!==void 0&&((s.headlines??={}).enabled=t.headlines.enabled),t.catchPromises){let o=s.catchPromises??={};for(let i of["enabled","dailyCap"])t.catchPromises[i]!==void 0&&(o[i]=t.catchPromises[i])}if(t.checkers){let o=s.checkers??={};for(let i of["enabled","checkEveryMinutes"])t.checkers[i]!==void 0&&(o[i]=t.checkers[i])}},{configPath:e.configPath,reload:e.reload})}import{existsSync as Y,readdirSync as Go,readFileSync as ze}from"fs";import{dirname as Jo,resolve as E}from"path";import{randomBytes as Xn}from"crypto";import{existsSync as Io,mkdirSync as To,readdirSync as Do,readFileSync as Co,renameSync as Kn,unlinkSync as No,writeFileSync as Lo}from"fs";import{resolve as Gn}from"path";function Hn(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var Ao=t=>t.trim().split(`
4
4
  `).pop()?.slice(0,300)||"no output";async function zn(t,e,n,r=Fe){let s=await r(t.bin,[...Hn(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return s.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${Ao(s.stderr||s.stdout)}`}}async function ru(t,e,n,r,s=Fe){return(await s(t.bin,[...Hn(t),"--read-only","media","download","--chat",e,"--id",n,"--output",r],{timeoutMs:12e4})).code===0}var Oo=2e3,Po=t=>zn(t.wacli,t.to,t.text);function qe(t){return Gn(t,".agentx","whatsapp-triage","drafts")}var Mo=t=>/^[a-z0-9-]{8,64}$/.test(t),ue=(t,e)=>Gn(qe(t),`${e}.json`);function Jn(t,e){To(qe(t),{recursive:!0});let n=ue(t,e.id),r=`${n}.${process.pid}.tmp`;Lo(r,JSON.stringify(e,null,2)+`
@@ -577,4 +577,4 @@ Document the arguments, commands, or files the skill expects. Example:
577
577
  claude-code ${qt(t)} --arg value
578
578
  \`\`\`
579
579
  `}Yt();var Qs={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function eo(t){return{...Qs,...t??{},regions:{...t?.regions??{}},buffer:{...Qs.buffer,...t?.buffer??{}}}}function lf(t){try{return eo(Jt(t).screen)}catch{return eo(void 0)}}var Oc=/^[a-z][\w-]*$/,to=["window","screen","menubar","notifications"];function se(t,e,n,r){let s=Number(t);if(t===""||t===null||!Number.isFinite(s)||!n(s))throw new Error(`${e} must be ${r}`);return s}var Re=(t,e)=>se(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function no(t){let e=typeof t=="string"?t.split(",").map(Number):[t?.x,t?.y,t?.width,t?.height].map(Number);if(e.length!==4||!e.every(Number.isFinite)||e[2]<=0||e[3]<=0)throw new Error("a region is x,y,width,height in screen points, with width and height above 0");return{x:e[0],y:e[1],width:e[2],height:e[3]}}function cf(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=Re(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=Re(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=Re(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=se(e.stableMs,"stableMs",s=>Number.isInteger(s)&&s>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=se(e.changeThreshold,"changeThreshold",s=>s>=0&&s<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let s={...n.regions??{}};for(let[o,i]of Object.entries(e.regions)){if(!Oc.test(o))throw new Error(`region name "${o}" must be lowercase letters, digits, - or _`);i===null?delete s[o]:s[o]=no(i)}n.regions=s}if(e.buffer&&typeof e.buffer=="object"){let s=e.buffer,o={...n.buffer??{}};"enabled"in s&&(o.enabled=!!s.enabled),"seconds"in s&&(o.seconds=se(s.seconds,"buffer.seconds",i=>i>0&&i<=120,"above 0 and at most 120")),"fps"in s&&(o.fps=se(s.fps,"buffer.fps",i=>i>0&&i<=10,"above 0 and at most 10")),"maxPixels"in s&&(o.maxPixels=Re(s.maxPixels,"buffer.maxPixels")),"region"in s&&(o.region=String(s.region).trim()),n.buffer=o}let r=n.buffer?.region;if(r!==void 0&&!to.includes(r)&&!n.regions?.[r])try{no(r)}catch{throw new Error(`buffer.region "${r}" is not a region \u2014 use ${[...to,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Nn as a,Uc as b,kt as c,Aa as d,Ia as e,Jd as f,Yd as g,Zd as h,tp as i,np as j,rp as k,Qr as l,es as m,sp as n,ts as o,ip as p,lp as q,L as r,ns as s,S as t,qc as u,os as v,fp as w,bp as x,as as y,yp as z,ls as A,wp as B,ee as C,nl as D,kp as E,Sp as F,us as G,ru as H,Po as I,cu as J,Zn as K,du as L,$ as M,Xc as N,Kc as O,wu as P,pe as Q,ku as R,Bn as S,eu as T,M as U,Vu as V,pr as W,gr as X,gi as Y,fi as Z,zu as _,Xu as $,Si as aa,Yu as ba,ps as ca,$p as da,ed as ea,td as fa,Gr as ga,dt as ha,Sa as ia,Es as ja,eg as ka,tg as la,jl as ma,og as na,Ds as oa,ig as pa,ag as qa,gg as ra,Zl as sa,fg as ta,rd as ua,sd as va,od as wa,id as xa,ad as ya,ld as za,ud as Aa,dd as Ba,kd as Ca,nt as Da,Sd as Ea,xd as Fa,Z as Ga,Q as Ha,sc as Ia,vg as Ja,$g as Ka,Eg as La,_g as Ma,Tt as Na,Rg as Oa,ot as Pa,it as Qa,ke as Ra,Xi as Sa,Gi as Ta,Rd as Ua,lt as Va,ct as Wa,Ji as Xa,Yi as Ya,Ur as Za,qr as _a,Ad as $a,ea as ab,Id as bb,la as cb,da as db,ut as eb,ga as fb,Vr as gb,O as hb,qs as ib,Vs as jb,Bs as kb,Ct as lb,Ng as mb,gc as nb,zs as ob,Xs as pb,Bg as qb,Hg as rb,Ic as sb,zg as tb,Gs as ub,Se as vb,jd as wb,yt as xb,Kd as yb,Jg as zb,Yg as Ab,Zg as Bb,Qg as Cb,ef as Db,tf as Eb,nf as Fb,rf as Gb,sf as Hb,Qs as Ib,eo as Jb,lf as Kb,to as Lb,cf as Mb};
580
- //# sourceMappingURL=chunk-FZMS4UFL.js.map
580
+ //# sourceMappingURL=chunk-KVAWRQBA.js.map
@@ -1,5 +1,5 @@
1
- import{pb as m,yb as b}from"./chunk-P7FSTC5E.js";b();function w(t){let e=typeof t.node=="string"?t.node:"",n=typeof t.token=="string"?t.token:"";if(!e||!n)try{let o=m(t.config);e||(e=o.dashboard?.daemonUrl||""),n||(n=o.dashboard?.token||"")}catch{}return e||(e="http://localhost:18800"),{baseUrl:e.replace(/\/+$/,""),token:n}}async function d(t,e,n){let o={Accept:"application/json"};t.token&&(o.Authorization=`Bearer ${t.token}`);let r=await fetch(`${t.baseUrl}${e}`,{headers:o,signal:n});if(!r.ok)throw new Error(`GET ${e} \u2192 HTTP ${r.status}`);return await r.json()}function R(t,e){return d(t,"/agents",e)}async function S(t,e){return(await d(t,"/api/processes",e)).processes??[]}function P(t,e){return d(t,"/crons",e)}async function h(t,e,n,o){let r={Accept:"application/json","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}${e}`,{method:"POST",headers:r,body:JSON.stringify(n),signal:o}),a=await s.text(),i;try{i=a?JSON.parse(a):{}}catch{i={raw:a}}if(!s.ok)throw new Error(i?.error||`POST ${e} \u2192 HTTP ${s.status}`);return i}function A(t,e,n="tui"){return h(t,"/api/processes/kill",{...e,reason:n})}function C(t,e,n,o){return h(t,"/task",{agent:e,message:n,context:o??{channel:"tui",chatId:"tui:operator"}})}async function $(t,e,n,o={}){let r={Accept:"text/event-stream","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}/task`,{method:"POST",headers:r,body:JSON.stringify({agent:e,message:n,stream:!0,context:{channel:o.channel??"chat-cli",chatId:o.chatId??"chat-cli:operator"}}),signal:o.signal});if(!s.ok||!s.body){let g=await s.text().catch(()=>"");throw new Error(`POST /task (stream) \u2192 HTTP ${s.status}${g?`: ${g.slice(0,200)}`:""}`)}let a=s.body.getReader(),i=new TextDecoder,u={content:""},c="";try{for(;;){let{done:g,value:p}=await a.read();if(g)break;c+=i.decode(p,{stream:!0});let l;for(;(l=c.indexOf(`
1
+ import{pb as m,yb as b}from"./chunk-KOY3EOPH.js";b();function w(t){let e=typeof t.node=="string"?t.node:"",n=typeof t.token=="string"?t.token:"";if(!e||!n)try{let o=m(t.config);e||(e=o.dashboard?.daemonUrl||""),n||(n=o.dashboard?.token||"")}catch{}return e||(e="http://localhost:18800"),{baseUrl:e.replace(/\/+$/,""),token:n}}async function d(t,e,n){let o={Accept:"application/json"};t.token&&(o.Authorization=`Bearer ${t.token}`);let r=await fetch(`${t.baseUrl}${e}`,{headers:o,signal:n});if(!r.ok)throw new Error(`GET ${e} \u2192 HTTP ${r.status}`);return await r.json()}function R(t,e){return d(t,"/agents",e)}async function S(t,e){return(await d(t,"/api/processes",e)).processes??[]}function P(t,e){return d(t,"/crons",e)}async function h(t,e,n,o){let r={Accept:"application/json","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}${e}`,{method:"POST",headers:r,body:JSON.stringify(n),signal:o}),a=await s.text(),i;try{i=a?JSON.parse(a):{}}catch{i={raw:a}}if(!s.ok)throw new Error(i?.error||`POST ${e} \u2192 HTTP ${s.status}`);return i}function A(t,e,n="tui"){return h(t,"/api/processes/kill",{...e,reason:n})}function C(t,e,n,o){return h(t,"/task",{agent:e,message:n,context:o??{channel:"tui",chatId:"tui:operator"}})}async function $(t,e,n,o={}){let r={Accept:"text/event-stream","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}/task`,{method:"POST",headers:r,body:JSON.stringify({agent:e,message:n,stream:!0,context:{channel:o.channel??"chat-cli",chatId:o.chatId??"chat-cli:operator"}}),signal:o.signal});if(!s.ok||!s.body){let g=await s.text().catch(()=>"");throw new Error(`POST /task (stream) \u2192 HTTP ${s.status}${g?`: ${g.slice(0,200)}`:""}`)}let a=s.body.getReader(),i=new TextDecoder,u={content:""},c="";try{for(;;){let{done:g,value:p}=await a.read();if(g)break;c+=i.decode(p,{stream:!0});let l;for(;(l=c.indexOf(`
2
2
 
3
3
  `))>=0;){let k=c.slice(0,l);c=c.slice(l+2);let f=x(k);f&&T(f,o,u)}}}finally{try{a.releaseLock()}catch{}}return u}function T(t,e,n){let{event:o,data:r}=t;switch(o){case"text":r?.text&&(n.content+=r.text,e.onText?.(r.text));break;case"thinking":r?.text&&e.onThinking?.(r.text);break;case"tool":e.onTool?.(r);break;case"done":typeof r?.content=="string"&&(n.content=r.content),n.usage=r?.usage,n.duration=r?.duration;break;case"error":n.error=r?.error,n.errorKind=r?.errorKind;break}}function x(t){let e="message",n="";for(let r of t.split(`
4
4
  `))r.startsWith("event: ")?e=r.slice(7).trim():r.startsWith("data: ")&&(n=r.slice(6));if(!n)return null;let o;try{o=JSON.parse(n)}catch{o=n}return{event:e,data:o}}export{w as a,R as b,S as c,P as d,A as e,C as f,$ as g};
5
- //# sourceMappingURL=chunk-T7E33M6T.js.map
5
+ //# sourceMappingURL=chunk-LZY6YN2J.js.map
@@ -1,4 +1,4 @@
1
- import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{xb as tt,yb as nt}from"./chunk-P7FSTC5E.js";import{a as it,b as at,c as ct,d as ut,e as lt,f as dt,g as pt,h as mt,i as bt,j as ft,k as gt,l as yt}from"./chunk-RGDKHYY2.js";import{a as E,b as We,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function wt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import Tt from"better-sqlite3";import{createHash as Et}from"crypto";import{mkdirSync as kt}from"fs";import{dirname as St,resolve as xt}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function At(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Rt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&vt(e),t<2&&Ot(e),t<3&&_t(e)}function _t(e){e.exec(`
1
+ import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{xb as tt,yb as nt}from"./chunk-KOY3EOPH.js";import{a as it,b as at,c as ct,d as ut,e as lt,f as dt,g as pt,h as mt,i as bt,j as ft,k as gt,l as yt}from"./chunk-RGDKHYY2.js";import{a as E,b as We,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function wt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import Tt from"better-sqlite3";import{createHash as Et}from"crypto";import{mkdirSync as kt}from"fs";import{dirname as St,resolve as xt}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function At(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Rt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&vt(e),t<2&&Ot(e),t<3&&_t(e)}function _t(e){e.exec(`
2
2
  ALTER TABLE decision_calls ADD COLUMN features_json TEXT;
3
3
  INSERT INTO schema_version (v) VALUES (3);
4
4
  `)}function Ot(e){e.exec(`
@@ -111,4 +111,4 @@ import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";im
111
111
  `)}if(!m)throw new Error(`local decision backend could not get a valid answer after ${f+1} attempt(s): ${w}`);let M={},L=!1;for(let[k,q]of Object.entries(s.questions)){let S=_(q,m[k],{normalize:e.normalizeProbabilities??!0});M[k]=S.answer,S.repaired&&(L=!0)}return{model:a,answers:M,usage:h,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function Jt(e,t,r,n,o){if(!e.generateRaw)throw new Error(`provider "${e.name}" has no generateRaw(); use structureMode "text"`);let s=[{role:"user",content:r},...n?[{role:"user",content:n}]:[]],i=await e.generateRaw(s,J,[{name:F,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:F}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===F),u=a&&a.type==="tool_use"?a.input:null;return{answers:Be(u),usage:{inputTokens:i.usage.input_tokens,outputTokens:i.usage.output_tokens}}}async function Gt(e,t,r,n,o){let s=[r,ae(t)].join(`
112
112
  `),i=[{role:"system",content:J},{role:"user",content:s},...n?[{role:"user",content:n}]:[]],a=await e.generate(i,o);return{answers:Be(Te(a.content??"")),usage:{inputTokens:0,outputTokens:a.tokensUsed??0}}}function Be(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(t.answers&&typeof t.answers=="object")return t.answers}return e}function Yt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Kt(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var Xt,$t,Vt,Fe,zt,be=E(()=>{"use strict";Ze();Ue();ht();j();Y();v();z();Xt="claude-code",$t="claude-haiku-4-5-20251001",Vt=24e3,Fe=2e3,zt=3e4});import{readFileSync as Ht}from"fs";import{homedir as Wt}from"os";import{join as Zt}from"path";function N(e={}){let t=(e.baseUrl??en).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??nn,s=e.maxChoiceOptions??rn,i={probabilitySource:e.probabilitySource??"logits",calibratedProbabilities:!1,maxChoiceOptions:s,maxStateChars:o,parallelQuestions:!0,images:!1};return{name:n,capabilities:i,async decide(a){A(a.questions),cn(a.questions,s);let u=Date.now(),c=a.model??e.model;if(!c)throw new Error("simple-jev backend needs a model id");let l=G(a.state,o),p=e.fetchImpl??fetch,{signal:g,dispose:d}=un(a.abortSignal,a.timeoutMs??e.timeoutMs??tn);try{let b={"Content-Type":"application/json"},h=an(e.apiKeyEnv,e.apiKeyFile);h&&(b.Authorization=`Bearer ${h}`);let T=await qe(p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:sn(a.questions)}),signal:g}),g);if(!T.ok){let k=await T.text().catch(()=>"");throw new Error(`${n} ${T.status}: ${k.slice(0,300)}`)}let f=await qe(T.json(),g),m=P(a.questions).safeParse(f.answers);if(!m.success)throw new Error(`${n} returned a response that does not match the requested questions (contract drift, not a model slip \u2014 retrying will not help):
113
113
  ${U(m.error)}`);let w=m.data,M={},L=!1;for(let[k,q]of Object.entries(a.questions)){let S=_(q,w[k]);M[k]=S.answer,S.repaired&&(L=!0)}return{model:f.model??c,answers:M,usage:{inputTokens:f.usage?.input_tokens??0,outputTokens:f.usage?.output_tokens??0},meta:{backend:n,structureMode:i.probabilitySource==="native"?"native":"logprobs",answerMode:"probabilities",repaired:L,retries:0,stateTruncated:l.truncated,latencyMs:Date.now()-u}}}finally{d()}}}}function sn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:on[n.type]};return t}function an(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Zt(Wt(),t.slice(2)):t;if(!Z.has(n))try{let o=Ht(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function cn(e,t){for(let[r,n]of Object.entries(e))if(n.type==="choice"){let o=Object.keys(n.criteria).length;if(o>t)throw new Error(`question "${r}": accepts at most ${t} choice options, got ${o}`)}else if(n.type==="score"&&n.criteria.length>t)throw new Error(`question "${r}": accepts at most ${t} score levels, got ${n.criteria.length}`)}function qe(e,t){return t.aborted?Promise.reject(t.reason??new Error("aborted")):new Promise((r,n)=>{let o=()=>n(t.reason??new Error("aborted"));t.addEventListener("abort",o,{once:!0}),e.then(s=>{t.removeEventListener("abort",o),r(s)},s=>{t.removeEventListener("abort",o),n(s)})})}function un(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var en,tn,nn,rn,on,Z,fe=E(()=>{"use strict";j();v();z();Y();en="http://127.0.0.1:8000/v1",tn=3e4,nn=6e3,rn=50;on={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var Xe={};We(Xe,{DEFAULT_SEAT_TIMEOUT_MS:()=>Ve,DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>F,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>wt,agreement:()=>it,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>mt,askSeat:()=>yn,band:()=>Ie,bootstrapInterval:()=>ft,brier:()=>lt,buildDesign:()=>ve,calibrationReport:()=>gt,choice:()=>ot,compareCalibrators:()=>It,confidenceFor:()=>re,configureDecisions:()=>pn,configuredSeatTimeout:()=>dn,coverageCurve:()=>pt,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>N,decisionsRuntime:()=>bn,describeIssues:()=>U,ece:()=>ct,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>Ne,fitRecalibrator:()=>B,fitTemperature:()=>bt,getDecisionBackend:()=>D,getSeatMode:()=>Je,labelSeatCall:()=>fn,labelsOf:()=>x,listDecisionBackends:()=>Ee,logLoss:()=>dt,logit:()=>le,mce:()=>ut,measureConsistency:()=>Ut,normalizeDistribution:()=>Se,normalizedNegEntropy:()=>oe,noul:()=>rt,pMax:()=>xe,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>P,recordSeatOutcome:()=>gn,registerBuiltinDecisionBackends:()=>ln,registerDecisionBackend:()=>R,reliabilityBins:()=>at,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>mn,score:()=>st,seatEnvVar:()=>ze,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function ln(e={},t={},r={},n={}){R("mock",()=>H()),R("local",()=>W(e)),R("simple-jev",()=>N(t)),R("jev",()=>N({name:"jev",baseUrl:"https://openrouter.ai/api/alpha",path:"/decisions",model:"jev-latest",apiKeyEnv:"OPENROUTER_API_KEY",apiKeyFile:"~/.agentx/openrouter-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...r})),R("typesafe",()=>N({name:"typesafe",baseUrl:"https://api.typesafe.ai/v1",path:"/systemone",model:"jev-latest",apiKeyEnv:"TYPESAFE_API_KEY",apiKeyFile:"~/.agentx/typesafe-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...n}))}var $e=E(()=>{"use strict";ke();v();j();z();C();Y();V();yt();Me();je();Ge();pe();be();fe();C();pe();be();fe()});function dn(e){return Ke(),y.seats[e]?.timeoutMs}function pn(e){y={...ye,...y,...e},ee=!0}function mn(){y={...ye,seats:{}},ee=!1}function Ke(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(nt(),he(tt)),t=e()?.decisions;if(!t?.enabled)return;let{registerBuiltinDecisionBackends:r}=($e(),he(Xe)),n=t.backends??{};r(n.local,n.simpleJev,n.jev,n.typesafe);let o=null;try{o=new I({path:t.dbPath})}catch{}y={enabled:!0,defaultBackend:t.defaultBackend,store:o,seats:Object.fromEntries(Object.entries(t.seats??{}).map(([s,i])=>[s,{...i,redactState:t.redactState,keepStateRows:t.keepStateRows}]))}}catch{}}}function bn(){return y}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return hn.includes(t)?t:null}function ze(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function Je(e,t=process.env){Ke();let r=ge(t[ze(e)]);return r||(y.enabled?ge(y.seats[e]?.mode)??"off":"off")}function fn(e,t,r,n={}){if(!(!e||!y.store))try{y.store.label(e,t,r,n)}catch{}}function gn(e,t,r=!1){if(!(!e||!y.store))try{y.store.recordOutcome(e,t,r)}catch{}}async function yn(e,t,r,n={}){let o=Je(e);if(o==="off")return null;let s=y.seats[e]??{mode:o},i=n.backend??s.backend??y.defaultBackend,a=Date.now();try{let c=await D(i).decide({state:t,questions:r,model:n.model??s.model,abortSignal:n.signal,timeoutMs:n.timeoutMs??s.timeoutMs??(y.seats[e]?Ve:void 0)}),l=wn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return Tn(e,o,t,r,i,n,s,a,u),En(e,i,u),null}}function wn(e,t,r,n,o,s,i){if(!y.store)return null;try{return y.store.recordCall({seat:e,mode:t,backend:o.meta.backend,model:o.model,meta:o.meta,state:r,questions:n,answers:o.answers,usage:o.usage,incumbent:He(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function Tn(e,t,r,n,o,s,i,a,u){if(y.store)try{y.store.recordCall({seat:e,mode:t,backend:o,model:s.model??i.model??"unknown",meta:{structureMode:"text",answerMode:"probabilities",retries:0,stateTruncated:!1,latencyMs:Date.now()-a},state:r,questions:n,answers:{},incumbent:He(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function He(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function En(e,t,r){let n=Date.now();n-Ye<6e4||(Ye=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var Ve,ye,y,ee,hn,Ye,Ge=E(()=>{C();V();Ve=1e4;ye={enabled:!1,defaultBackend:"local",seats:{},store:null},y={...ye},ee=!1;hn=["off","shadow","active"];Ye=0});export{D as a,Ee as b,C as c,I as d,V as e,It as f,Me as g,Ut as h,je as i,me as j,Xn as k,Ue as l,ln as m,$e as n,Ve as o,dn as p,pn as q,mn as r,bn as s,ge as t,ze as u,Je as v,fn as w,gn as x,yn as y,Ge as z};
114
- //# sourceMappingURL=chunk-FXMUUDSH.js.map
114
+ //# sourceMappingURL=chunk-NI2XD6P3.js.map
@@ -1,4 +1,4 @@
1
- import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-EBZO3VRY.js"),{GraphCache:y}=await import("./graph-ZVKV3JBD.js"),{loadOntology:c}=await import("./load-Q3HCFXDT.js"),{loadRoster:$}=await import("./roster-BZGKG2ZA.js"),{ENRICH_TYPES:a,loadEnrichState:s,runEnrich:p,saveEnrichState:g}=await import("./enrich-MZMIQ3SV.js"),i=E(e.dir),r=e.types.split(",").map(o=>o.trim()).filter(Boolean),b=r.filter(o=>!a.includes(o));if(b.length){console.error(t.red(` not an entity type this job handles: ${b.join(", ")} (use ${a.join(", ")})`)),process.exitCode=1;return}let x=Number(e.max);if(!Number.isInteger(x)||x<1){console.error(t.red(" --max must be a whole number of entities, 1 or more")),process.exitCode=1;return}let w=Number(e.maxCost);if(!Number.isFinite(w)||w<=0){console.error(t.red(" --max-cost must be a positive number of dollars")),process.exitCode=1;return}let m=new h(i,()=>{});if(e.create){let{createEntityPage:o}=await import("./enrich-MZMIQ3SV.js");if(!e.as||!a.includes(e.as)||!e.owner){console.error(t.red(` --create needs --as <${a.join("|")}> and --owner <agent>`)),process.exitCode=1;return}if(m.syncedFrom(e.owner)){console.error(t.red(` ${e.owner}'s pages are copied from another node; pick an agent that runs here`)),process.exitCode=1;return}if(e.dryRun)console.log(t.dim(` --dry-run: would create "${e.create}" (${e.as}) in ${e.owner}'s wiki`));else{let f=o(m,e.create,e.as,e.owner,new Date().toISOString().slice(0,10));console.log(f?t.green(` created ${e.owner}/${f}`):t.dim(` ${e.owner} already has a page titled "${e.create}"`))}d=[...d,e.create],r.includes(e.as)||r.push(e.as)}let{ontology:v}=c(i),k=new y().get(m,v,$(i,m.listAgents([]),v.agent_names)),C=s(i),u=await p(m,k,N(e.model),{types:r,only:d,max:x,maxCostUsd:w,dryRun:!!e.dryRun,force:!!e.force,today:new Date().toISOString().slice(0,10),save:o=>g(i,o)},C);if(e.json){console.log(JSON.stringify(u,null,2));return}for(let o of u.outcomes){let f=o.status==="written"?t.green("\u2713"):o.status==="dry-run"?t.cyan("~"):t.yellow("\xB7");console.log(` ${f} ${o.title} ${t.dim(`${o.status} \xB7 ${o.page??"no page"} \xB7 overview ${o.overview?"yes":"no"} \xB7 ${o.statements} facts \xB7 ${o.links} links \xB7 $${o.costUsd.toFixed(3)}`)}`);for(let n of o.facts??[])console.log(t.dim(` fact: ${n.property} \u2192 ${n.value}${n.role?` (${n.role})`:""} \xB7 source ${n.source}`));for(let n of o.dropped.slice(0,6))console.log(t.dim(` dropped: ${n}`));o.preview&&console.log(t.dim(o.preview.split(`
1
+ import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-L5FFJPS3.js"),{GraphCache:y}=await import("./graph-ZVKV3JBD.js"),{loadOntology:c}=await import("./load-Q3HCFXDT.js"),{loadRoster:$}=await import("./roster-BZGKG2ZA.js"),{ENRICH_TYPES:a,loadEnrichState:s,runEnrich:p,saveEnrichState:g}=await import("./enrich-MZMIQ3SV.js"),i=E(e.dir),r=e.types.split(",").map(o=>o.trim()).filter(Boolean),b=r.filter(o=>!a.includes(o));if(b.length){console.error(t.red(` not an entity type this job handles: ${b.join(", ")} (use ${a.join(", ")})`)),process.exitCode=1;return}let x=Number(e.max);if(!Number.isInteger(x)||x<1){console.error(t.red(" --max must be a whole number of entities, 1 or more")),process.exitCode=1;return}let w=Number(e.maxCost);if(!Number.isFinite(w)||w<=0){console.error(t.red(" --max-cost must be a positive number of dollars")),process.exitCode=1;return}let m=new h(i,()=>{});if(e.create){let{createEntityPage:o}=await import("./enrich-MZMIQ3SV.js");if(!e.as||!a.includes(e.as)||!e.owner){console.error(t.red(` --create needs --as <${a.join("|")}> and --owner <agent>`)),process.exitCode=1;return}if(m.syncedFrom(e.owner)){console.error(t.red(` ${e.owner}'s pages are copied from another node; pick an agent that runs here`)),process.exitCode=1;return}if(e.dryRun)console.log(t.dim(` --dry-run: would create "${e.create}" (${e.as}) in ${e.owner}'s wiki`));else{let f=o(m,e.create,e.as,e.owner,new Date().toISOString().slice(0,10));console.log(f?t.green(` created ${e.owner}/${f}`):t.dim(` ${e.owner} already has a page titled "${e.create}"`))}d=[...d,e.create],r.includes(e.as)||r.push(e.as)}let{ontology:v}=c(i),k=new y().get(m,v,$(i,m.listAgents([]),v.agent_names)),C=s(i),u=await p(m,k,N(e.model),{types:r,only:d,max:x,maxCostUsd:w,dryRun:!!e.dryRun,force:!!e.force,today:new Date().toISOString().slice(0,10),save:o=>g(i,o)},C);if(e.json){console.log(JSON.stringify(u,null,2));return}for(let o of u.outcomes){let f=o.status==="written"?t.green("\u2713"):o.status==="dry-run"?t.cyan("~"):t.yellow("\xB7");console.log(` ${f} ${o.title} ${t.dim(`${o.status} \xB7 ${o.page??"no page"} \xB7 overview ${o.overview?"yes":"no"} \xB7 ${o.statements} facts \xB7 ${o.links} links \xB7 $${o.costUsd.toFixed(3)}`)}`);for(let n of o.facts??[])console.log(t.dim(` fact: ${n.property} \u2192 ${n.value}${n.role?` (${n.role})`:""} \xB7 source ${n.source}`));for(let n of o.dropped.slice(0,6))console.log(t.dim(` dropped: ${n}`));o.preview&&console.log(t.dim(o.preview.split(`
2
2
  `).slice(0,12).map(n=>` | ${n}`).join(`
3
3
  `)))}u.outcomes.length===0&&console.log(t.dim(" nothing to do: no entity of these types changed since the last run (--force redoes them)")),console.log(t.dim(` spent $${u.costUsd.toFixed(3)} of $${w}${u.capped?" \xB7 stopped at the cap":""}`))})}export{N as a,I as b};
4
- //# sourceMappingURL=chunk-TLSMX7LZ.js.map
4
+ //# sourceMappingURL=chunk-OYCMFCME.js.map
@@ -1,6 +1,6 @@
1
- import{d as h}from"./chunk-7WMZJFYD.js";var d=["main contact","primary contact","point of contact","billing contact","technical contact","decision maker"],f=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,w=/\b(role|title|position|job)\s*\**\s*[::]\s*\**\s*([^\n;|]+)/gi;function L(t,c,e=[]){let l=[c,...e].join(`
1
+ import{d as h}from"./chunk-UHTIZCKU.js";var d=["main contact","primary contact","point of contact","billing contact","technical contact","decision maker"],f=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,w=/\b(role|title|position|job)\s*\**\s*[::]\s*\**\s*([^\n;|]+)/gi;function L(t,c,e=[]){let l=[c,...e].join(`
2
2
  `),a=l.toLowerCase(),i=h(t,l);for(let s of p(t.match(f)??[]))a.includes(s.toLowerCase())||i.push(`email ${s}`);let m=t.toLowerCase();for(let s of d)m.includes(s)&&!a.includes(s)&&i.push(`marker "${s}"`);for(let s of t.matchAll(w)){let n=s[2].replace(/\*+/g,"").trim();n&&!a.includes(n.toLowerCase())&&i.push(`${s[1].toLowerCase()} "${n}"`)}return p(i)}function p(t){return[...new Set(t)]}var $=.9,g=/^\s*(?:wait\b|here(?:'s| is) the (?:updated|modified|patched|revised)|i (?:must|need to|will|should) (?:output|return|write)|(?:okay|ok|sure)[,.!]\s|let me\b|as requested\b)/im;function k(t,c){let e=[],l=t.split(`
3
3
  `).filter(o=>o.trim()).length,a=c.split(`
4
4
  `).filter(o=>o.trim()).length;l>=5&&a<Math.floor(l*$)&&e.push(`the article shrinks from ${l} to ${a} lines`);let i=c.match(g);i&&!t.match(g)&&e.push(`it contains the model's own commentary ("${i[0].trim().slice(0,40)}")`);let m=o=>{let r=new Map;for(let u of o.split(`
5
5
  `))/^#{1,6} /.test(u)&&r.set(u.trim(),(r.get(u.trim())??0)+1);return r},s=m(t);for(let[o,r]of m(c))r>1&&r>(s.get(o)??0)&&e.push(`the heading "${o}" appears ${r} times`);let n=L(t,c);return n.length&&e.push(`it drops ${n.length} fact(s): ${n.slice(0,6).join(", ")}${n.length>6?", \u2026":""}`),e}export{L as a,k as b};
6
- //# sourceMappingURL=chunk-7NJLRLQN.js.map
6
+ //# sourceMappingURL=chunk-PCWXHXTM.js.map