agentix-cli 0.111.1 → 0.113.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 (121) hide show
  1. package/dist/{App-T4Q7SW6M.js → App-5ZI475WY.js} +2 -2
  2. package/dist/{ChatApp-BKUJUIDL.js → ChatApp-PLR7J5D3.js} +2 -2
  3. package/dist/agent-GRX75ANW.js +2 -0
  4. package/dist/{board-dashboard-MZVUQ2YO.js → board-dashboard-EKJHQKPH.js} +574 -288
  5. package/dist/board-dashboard-EKJHQKPH.js.map +1 -0
  6. package/dist/{chunk-WXQQO2PD.js → chunk-22LO3GBP.js} +2 -2
  7. package/dist/{chunk-5MUJZODV.js → chunk-2PJKGZWP.js} +32 -32
  8. package/dist/chunk-2PJKGZWP.js.map +1 -0
  9. package/dist/{chunk-DTQQ4DAY.js → chunk-37EDS7SZ.js} +8 -8
  10. package/dist/{chunk-M2L6S3Z5.js → chunk-4QCYSKPD.js} +2 -2
  11. package/dist/{chunk-3RHFEKFX.js → chunk-6FJ44HYY.js} +2 -2
  12. package/dist/{chunk-GQMUFSKB.js → chunk-74CQWVHE.js} +2 -2
  13. package/dist/{chunk-QJP37VVA.js → chunk-A6B5JRUG.js} +2 -2
  14. package/dist/{chunk-K24MYJFP.js → chunk-B37WAFT5.js} +219 -219
  15. package/dist/chunk-B37WAFT5.js.map +1 -0
  16. package/dist/{chunk-DXWDVKMX.js → chunk-DVJW3IWI.js} +2 -2
  17. package/dist/{chunk-U52IS3AF.js → chunk-EEOQ5C5N.js} +2 -2
  18. package/dist/{chunk-RS2T53EC.js → chunk-JBE4H7PL.js} +5 -5
  19. package/dist/{chunk-RS2T53EC.js.map → chunk-JBE4H7PL.js.map} +1 -1
  20. package/dist/{chunk-7UNS34CN.js → chunk-MEXXGNNN.js} +2 -2
  21. package/dist/{chunk-3RTOS727.js → chunk-OZDSQVHU.js} +4 -4
  22. package/dist/{chunk-3RTOS727.js.map → chunk-OZDSQVHU.js.map} +1 -1
  23. package/dist/{chunk-HCTWKWS3.js → chunk-QF377BDS.js} +6 -6
  24. package/dist/{chunk-LWYKS5JU.js → chunk-QWI3FM5R.js} +2 -2
  25. package/dist/{chunk-Z7L74GGT.js → chunk-R43TE2XX.js} +2 -2
  26. package/dist/{chunk-FBODSJU6.js → chunk-RXQ2XCKP.js} +2 -2
  27. package/dist/{chunk-53OS4TDU.js → chunk-THRWE4Y3.js} +2 -2
  28. package/dist/{chunk-SIOWVLZG.js → chunk-TXX5W3SH.js} +12 -12
  29. package/dist/chunk-TXX5W3SH.js.map +1 -0
  30. package/dist/{chunk-C245D4BZ.js → chunk-UG2OF2EI.js} +2 -2
  31. package/dist/{chunk-4NFDDTGA.js → chunk-V3C2BOYR.js} +2 -2
  32. package/dist/{chunk-XEOT2F4C.js → chunk-X7E27RYS.js} +2 -2
  33. package/dist/{chunk-WSKQUKCF.js → chunk-XG2XVGSL.js} +2 -2
  34. package/dist/{chunk-23A5K5UW.js → chunk-Y5MFVVTM.js} +2 -2
  35. package/dist/cli.js +1 -1
  36. package/dist/{client-O7SPKO5X.js → client-DBQ5QNJJ.js} +2 -2
  37. package/dist/{compaction-MECSN36J.js → compaction-FS6XNRLM.js} +3 -3
  38. package/dist/config-4T62LT27.js +2 -0
  39. package/dist/config-mutator-ARUEJ6V5.js +2 -0
  40. package/dist/{context-planner-JU7CNXCB.js → context-planner-BKHPKDX5.js} +2 -2
  41. package/dist/{doctor-XP7O45RC.js → doctor-M32NIOZH.js} +2 -2
  42. package/dist/heal-U67X6NIN.js +2 -0
  43. package/dist/index.d.ts +185 -0
  44. package/dist/index.js +1 -1
  45. package/dist/memory-extract-ATD6YLRK.js +2 -0
  46. package/dist/{program-YK3YR2CQ.js → program-7MG42JKO.js} +169 -169
  47. package/dist/program-7MG42JKO.js.map +1 -0
  48. package/dist/{promote-UGWANGI2.js → promote-DAEKJVWN.js} +2 -2
  49. package/dist/{providers-ES5KVLI4.js → providers-55NC2SFN.js} +2 -2
  50. package/dist/{query-ZET7Z5FT.js → query-MCJYD66I.js} +2 -2
  51. package/dist/{registry-UXWOY52B.js → registry-AYPPHZ3Z.js} +2 -2
  52. package/dist/{request-planner-W5YLKCGG.js → request-planner-7NKKLY7C.js} +2 -2
  53. package/dist/{review-candidates-GU4S5VQH.js → review-candidates-QG2U5YID.js} +2 -2
  54. package/dist/{routing-GJ4VXKIC.js → routing-HBNYDAGE.js} +2 -2
  55. package/dist/schedule-tool-6S35TPJJ.js +2 -0
  56. package/dist/scheduler-KZ6VVZZA.js +2 -0
  57. package/dist/{seat-L6XJ2BFA.js → seat-PQ7AMPMT.js} +2 -2
  58. package/dist/{select-T7CKKLC2.js → select-J6TO7RED.js} +2 -2
  59. package/dist/{set-enabled-U2HGNY2O.js → set-enabled-WXRUHFWW.js} +2 -2
  60. package/dist/{tool-2FMWZB4N.js → tool-I3OGQKAD.js} +2 -2
  61. package/dist/{tool-TX622HEB.js → tool-KN2QEPDO.js} +2 -2
  62. package/dist/wiki-2IKLQ6PO.js +2 -0
  63. package/package.json +1 -1
  64. package/dist/agent-YZVEXFE7.js +0 -2
  65. package/dist/board-dashboard-MZVUQ2YO.js.map +0 -1
  66. package/dist/chunk-5MUJZODV.js.map +0 -1
  67. package/dist/chunk-K24MYJFP.js.map +0 -1
  68. package/dist/chunk-SIOWVLZG.js.map +0 -1
  69. package/dist/config-ZHQYXFOJ.js +0 -2
  70. package/dist/config-mutator-RS2NTDNO.js +0 -2
  71. package/dist/heal-CMQL5SG4.js +0 -2
  72. package/dist/memory-extract-YCNCARZ2.js +0 -2
  73. package/dist/program-YK3YR2CQ.js.map +0 -1
  74. package/dist/schedule-tool-HD4LWKVC.js +0 -2
  75. package/dist/scheduler-3LEHZHWJ.js +0 -2
  76. package/dist/wiki-MYJBOJSM.js +0 -2
  77. /package/dist/{App-T4Q7SW6M.js.map → App-5ZI475WY.js.map} +0 -0
  78. /package/dist/{ChatApp-BKUJUIDL.js.map → ChatApp-PLR7J5D3.js.map} +0 -0
  79. /package/dist/{agent-YZVEXFE7.js.map → agent-GRX75ANW.js.map} +0 -0
  80. /package/dist/{chunk-WXQQO2PD.js.map → chunk-22LO3GBP.js.map} +0 -0
  81. /package/dist/{chunk-DTQQ4DAY.js.map → chunk-37EDS7SZ.js.map} +0 -0
  82. /package/dist/{chunk-M2L6S3Z5.js.map → chunk-4QCYSKPD.js.map} +0 -0
  83. /package/dist/{chunk-3RHFEKFX.js.map → chunk-6FJ44HYY.js.map} +0 -0
  84. /package/dist/{chunk-GQMUFSKB.js.map → chunk-74CQWVHE.js.map} +0 -0
  85. /package/dist/{chunk-QJP37VVA.js.map → chunk-A6B5JRUG.js.map} +0 -0
  86. /package/dist/{chunk-DXWDVKMX.js.map → chunk-DVJW3IWI.js.map} +0 -0
  87. /package/dist/{chunk-U52IS3AF.js.map → chunk-EEOQ5C5N.js.map} +0 -0
  88. /package/dist/{chunk-7UNS34CN.js.map → chunk-MEXXGNNN.js.map} +0 -0
  89. /package/dist/{chunk-HCTWKWS3.js.map → chunk-QF377BDS.js.map} +0 -0
  90. /package/dist/{chunk-LWYKS5JU.js.map → chunk-QWI3FM5R.js.map} +0 -0
  91. /package/dist/{chunk-Z7L74GGT.js.map → chunk-R43TE2XX.js.map} +0 -0
  92. /package/dist/{chunk-FBODSJU6.js.map → chunk-RXQ2XCKP.js.map} +0 -0
  93. /package/dist/{chunk-53OS4TDU.js.map → chunk-THRWE4Y3.js.map} +0 -0
  94. /package/dist/{chunk-C245D4BZ.js.map → chunk-UG2OF2EI.js.map} +0 -0
  95. /package/dist/{chunk-4NFDDTGA.js.map → chunk-V3C2BOYR.js.map} +0 -0
  96. /package/dist/{chunk-XEOT2F4C.js.map → chunk-X7E27RYS.js.map} +0 -0
  97. /package/dist/{chunk-WSKQUKCF.js.map → chunk-XG2XVGSL.js.map} +0 -0
  98. /package/dist/{chunk-23A5K5UW.js.map → chunk-Y5MFVVTM.js.map} +0 -0
  99. /package/dist/{client-O7SPKO5X.js.map → client-DBQ5QNJJ.js.map} +0 -0
  100. /package/dist/{compaction-MECSN36J.js.map → compaction-FS6XNRLM.js.map} +0 -0
  101. /package/dist/{config-ZHQYXFOJ.js.map → config-4T62LT27.js.map} +0 -0
  102. /package/dist/{config-mutator-RS2NTDNO.js.map → config-mutator-ARUEJ6V5.js.map} +0 -0
  103. /package/dist/{context-planner-JU7CNXCB.js.map → context-planner-BKHPKDX5.js.map} +0 -0
  104. /package/dist/{doctor-XP7O45RC.js.map → doctor-M32NIOZH.js.map} +0 -0
  105. /package/dist/{heal-CMQL5SG4.js.map → heal-U67X6NIN.js.map} +0 -0
  106. /package/dist/{memory-extract-YCNCARZ2.js.map → memory-extract-ATD6YLRK.js.map} +0 -0
  107. /package/dist/{promote-UGWANGI2.js.map → promote-DAEKJVWN.js.map} +0 -0
  108. /package/dist/{providers-ES5KVLI4.js.map → providers-55NC2SFN.js.map} +0 -0
  109. /package/dist/{query-ZET7Z5FT.js.map → query-MCJYD66I.js.map} +0 -0
  110. /package/dist/{registry-UXWOY52B.js.map → registry-AYPPHZ3Z.js.map} +0 -0
  111. /package/dist/{request-planner-W5YLKCGG.js.map → request-planner-7NKKLY7C.js.map} +0 -0
  112. /package/dist/{review-candidates-GU4S5VQH.js.map → review-candidates-QG2U5YID.js.map} +0 -0
  113. /package/dist/{routing-GJ4VXKIC.js.map → routing-HBNYDAGE.js.map} +0 -0
  114. /package/dist/{schedule-tool-HD4LWKVC.js.map → schedule-tool-6S35TPJJ.js.map} +0 -0
  115. /package/dist/{scheduler-3LEHZHWJ.js.map → scheduler-KZ6VVZZA.js.map} +0 -0
  116. /package/dist/{seat-L6XJ2BFA.js.map → seat-PQ7AMPMT.js.map} +0 -0
  117. /package/dist/{select-T7CKKLC2.js.map → select-J6TO7RED.js.map} +0 -0
  118. /package/dist/{set-enabled-U2HGNY2O.js.map → set-enabled-WXRUHFWW.js.map} +0 -0
  119. /package/dist/{tool-2FMWZB4N.js.map → tool-I3OGQKAD.js.map} +0 -0
  120. /package/dist/{tool-TX622HEB.js.map → tool-KN2QEPDO.js.map} +0 -0
  121. /package/dist/{wiki-MYJBOJSM.js.map → wiki-2IKLQ6PO.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as w,b as y,c as x}from"./chunk-SFQUP3BP.js";import{o as g,p as C}from"./chunk-5MUJZODV.js";C();import{existsSync as d,promises as h}from"fs";import c from"path";import{execa as b}from"execa";var k={enabled:!0,maxAttempts:3,provider:"claude-code"},v=class{constructor(e,r,i){this.cwd=e;this.config={...k,...r},this.memory=i||new x(e)}config;memory;async detectAndHeal(e,r,i){if(!this.config.enabled)return{healed:!1,attempts:0,error:"Heal disabled",filesChanged:[]};let t=await this.runVerification();if(!t)return{healed:!0,attempts:0,error:"",filesChanged:[]};let n=0,s=t,a=[];for(;n<this.config.maxAttempts;){n++;let l=await this.generateFix(s,e,r,n);if(!l.files.length)break;for(let o of l.files){let m=c.isAbsolute(o.path)?o.path:c.resolve(this.cwd,o.path),p=c.dirname(m);await h.mkdir(p,{recursive:!0}),await h.writeFile(m,o.content,"utf8"),a.push(o.path)}let f=await this.runVerification();if(!f)return i&&await this.memory.recordHeal(i,t,!0,a),{healed:!0,attempts:n,error:t,fix:l.explanation,filesChanged:a};s=f}return i&&await this.memory.recordHeal(i,t,!1,a),{healed:!1,attempts:n,error:s,filesChanged:a}}async runVerification(){let e=[this.config.buildCommand,this.config.lintCommand,this.config.testCommand].filter(Boolean);if(!e.length){let r=await this.detectCommands();e.push(...r)}for(let r of e)try{let[i,...t]=r.split(" ");await b(i,t,{cwd:this.cwd,timeout:6e4,reject:!0})}catch(i){let t=i.stderr||"",n=i.stdout||"",s=i.message||"";return F(`Command failed: ${r}
1
+ import{a as w,b as y,c as x}from"./chunk-SFQUP3BP.js";import{o as g,p as C}from"./chunk-2PJKGZWP.js";C();import{existsSync as d,promises as h}from"fs";import c from"path";import{execa as b}from"execa";var k={enabled:!0,maxAttempts:3,provider:"claude-code"},v=class{constructor(e,r,i){this.cwd=e;this.config={...k,...r},this.memory=i||new x(e)}config;memory;async detectAndHeal(e,r,i){if(!this.config.enabled)return{healed:!1,attempts:0,error:"Heal disabled",filesChanged:[]};let t=await this.runVerification();if(!t)return{healed:!0,attempts:0,error:"",filesChanged:[]};let n=0,s=t,a=[];for(;n<this.config.maxAttempts;){n++;let l=await this.generateFix(s,e,r,n);if(!l.files.length)break;for(let o of l.files){let m=c.isAbsolute(o.path)?o.path:c.resolve(this.cwd,o.path),p=c.dirname(m);await h.mkdir(p,{recursive:!0}),await h.writeFile(m,o.content,"utf8"),a.push(o.path)}let f=await this.runVerification();if(!f)return i&&await this.memory.recordHeal(i,t,!0,a),{healed:!0,attempts:n,error:t,fix:l.explanation,filesChanged:a};s=f}return i&&await this.memory.recordHeal(i,t,!1,a),{healed:!1,attempts:n,error:s,filesChanged:a}}async runVerification(){let e=[this.config.buildCommand,this.config.lintCommand,this.config.testCommand].filter(Boolean);if(!e.length){let r=await this.detectCommands();e.push(...r)}for(let r of e)try{let[i,...t]=r.split(" ");await b(i,t,{cwd:this.cwd,timeout:6e4,reject:!0})}catch(i){let t=i.stderr||"",n=i.stdout||"",s=i.message||"";return F(`Command failed: ${r}
2
2
  ${t}
3
3
  ${n}
4
4
  ${s}`)}return null}async detectCommands(){let e=[],r=c.resolve(this.cwd,"package.json");if(d(r))try{let t=JSON.parse(await h.readFile(r,"utf8")).scripts||{};t.build&&e.push("npm run build"),t.typecheck&&e.push("npm run typecheck"),t.lint&&e.push("npm run lint"),t.test&&e.push("npm run test")}catch{}return d(c.resolve(this.cwd,"pyproject.toml"))&&d(c.resolve(this.cwd,"conftest.py"))&&e.push("python -m pytest --tb=short -q"),e}async generateFix(e,r,i,t){let n=g(this.config.provider,this.config.apiKey),s=[];for(let o of r.slice(0,5)){let m=c.resolve(this.cwd,o);if(d(m)){let p=await h.readFile(m,"utf8");s.push(`## ${o}
@@ -29,4 +29,4 @@ Fix the error. Use create_files with the corrected file content.`}],f=await n.ge
29
29
  `)+`
30
30
  ... (truncated)`:e.join(`
31
31
  `)}export{v as a};
32
- //# sourceMappingURL=chunk-C245D4BZ.js.map
32
+ //# sourceMappingURL=chunk-UG2OF2EI.js.map
@@ -1,7 +1,7 @@
1
- import{f as j,i as x,p as O,r as I}from"./chunk-S2GAEH2F.js";import{a as R}from"./chunk-JXF54PT7.js";import{ia as S,la as L}from"./chunk-SIOWVLZG.js";L();import{Command as z}from"commander";import f from"chalk";import{execFileSync as h}from"child_process";import{accessSync as T,constants as H,existsSync as y,readFileSync as b,readdirSync as $,statSync as X}from"fs";import{join as E,resolve as m}from"path";import{homedir as B}from"os";import{createRequire as F}from"module";import{execFile as M}from"child_process";var q=(t,n)=>new Promise(e=>{try{M(t,n,{timeout:5e3},(i,s)=>e(i?null:String(s)))}catch{e(null)}}),N="Open System Settings \u203A Notifications \u203A AgentX Helper, turn on Allow notifications and choose Banners.";async function P(t={}){if((t.platform??process.platform)!=="darwin")return{state:"unsupported",message:"Desktop banners are only shown on a Mac."};let n=t.helper===void 0?I():t.helper;if(!n)return{state:"missing",message:"AgentX Helper is not installed, so banners come from Script Editor and show its icon.",fix:'Run agentx desktop install, then run agentx notify "Hello" --title "Test" and click Allow.'};let e=await(t.run??q)(n,["notify-status"]),i=null;try{i=e?JSON.parse(e):null}catch{i=null}return i?i.authorization==="notDetermined"?{state:"not-asked",path:n,message:"macOS has not asked yet whether AgentX Helper may notify; banners show the Script Editor icon until it does.",fix:'Run agentx notify "Hello" --title "Test" and click Allow when macOS asks.'}:i.authorization==="denied"?{state:"not-allowed",path:n,message:"macOS does not allow AgentX Helper to notify, so banners show the Script Editor icon.",fix:N}:i.alertStyle==="none"?{state:"hidden",path:n,message:"AgentX Helper may notify, but its banner style is None, so nothing appears on screen.",fix:N}:{state:"ready",path:n,message:"AgentX Helper posts banners with the AgentX icon."}:{state:"outdated",path:n,message:"AgentX Helper is too old to report whether it may notify.",fix:"Run agentx desktop install to update it."}}async function J(t={}){let n=[];await Z(n),U(n);let e=K(n);return e&&Q(n,e),e&&Y(n,e),e&&ee(n,e),e&&te(n,e),e&&oe(n,e),e&&await G(n,e),e&&V(n,e),t.running!==!1&&e&&await ie(n,e),{checks:n,summary:W(n)}}var ke=new z().name("doctor").description("pre-flight health check: Node, config, credentials, daemon").option("--no-running","skip the live daemon probe").option("--json","emit machine-readable JSON (stable shape for CI)").action(async t=>{let{checks:n,summary:e}=await J({running:t.running!==!1});t.json?process.stdout.write(JSON.stringify({checks:n,summary:e},null,2)+`
1
+ import{f as j,i as x,p as O,r as I}from"./chunk-S2GAEH2F.js";import{a as R}from"./chunk-JXF54PT7.js";import{ja as S,ma as L}from"./chunk-TXX5W3SH.js";L();import{Command as z}from"commander";import f from"chalk";import{execFileSync as h}from"child_process";import{accessSync as T,constants as H,existsSync as y,readFileSync as b,readdirSync as $,statSync as X}from"fs";import{join as E,resolve as m}from"path";import{homedir as B}from"os";import{createRequire as F}from"module";import{execFile as M}from"child_process";var q=(t,n)=>new Promise(e=>{try{M(t,n,{timeout:5e3},(i,s)=>e(i?null:String(s)))}catch{e(null)}}),N="Open System Settings \u203A Notifications \u203A AgentX Helper, turn on Allow notifications and choose Banners.";async function P(t={}){if((t.platform??process.platform)!=="darwin")return{state:"unsupported",message:"Desktop banners are only shown on a Mac."};let n=t.helper===void 0?I():t.helper;if(!n)return{state:"missing",message:"AgentX Helper is not installed, so banners come from Script Editor and show its icon.",fix:'Run agentx desktop install, then run agentx notify "Hello" --title "Test" and click Allow.'};let e=await(t.run??q)(n,["notify-status"]),i=null;try{i=e?JSON.parse(e):null}catch{i=null}return i?i.authorization==="notDetermined"?{state:"not-asked",path:n,message:"macOS has not asked yet whether AgentX Helper may notify; banners show the Script Editor icon until it does.",fix:'Run agentx notify "Hello" --title "Test" and click Allow when macOS asks.'}:i.authorization==="denied"?{state:"not-allowed",path:n,message:"macOS does not allow AgentX Helper to notify, so banners show the Script Editor icon.",fix:N}:i.alertStyle==="none"?{state:"hidden",path:n,message:"AgentX Helper may notify, but its banner style is None, so nothing appears on screen.",fix:N}:{state:"ready",path:n,message:"AgentX Helper posts banners with the AgentX icon."}:{state:"outdated",path:n,message:"AgentX Helper is too old to report whether it may notify.",fix:"Run agentx desktop install to update it."}}async function J(t={}){let n=[];await Z(n),U(n);let e=K(n);return e&&Q(n,e),e&&Y(n,e),e&&ee(n,e),e&&te(n,e),e&&oe(n,e),e&&await G(n,e),e&&V(n,e),t.running!==!1&&e&&await ie(n,e),{checks:n,summary:W(n)}}var ke=new z().name("doctor").description("pre-flight health check: Node, config, credentials, daemon").option("--no-running","skip the live daemon probe").option("--json","emit machine-readable JSON (stable shape for CI)").action(async t=>{let{checks:n,summary:e}=await J({running:t.running!==!1});t.json?process.stdout.write(JSON.stringify({checks:n,summary:e},null,2)+`
2
2
  `):se(n),process.exit(e.errors>0?1:0)});async function G(t,n,e=P){if(!O(n.notifications?.local).banner)return;let i=await e();i.state!=="unsupported"&&t.push({severity:i.state==="ready"?"ok":"warn",group:"Notifications",title:i.message,detail:i.path,fix:i.fix})}function V(t,n,e=process.platform,i=s=>{try{return T(s,H.X_OK),!0}catch{return!1}}){let s=n.reminders;if(!s?.enabled)return;if(e!=="darwin"){t.push({severity:"warn",group:"Reminders",title:"Reminders hand-back unavailable on this machine",detail:"reminders.enabled is set, but Apple Reminders exists only on macOS. The daemon starts without it.",fix:"Set reminders.enabled to false here, or enable it on the Mac node instead."});return}let r=s.command||"remindctl",a=r.includes("/")?i(r)?r:null:x(r,process.env.PATH||"",i);t.push(a?{severity:"ok",group:"Reminders",title:`Watching ${(s.lists||[]).join(", ")} for due reminders`,detail:a}:{severity:"fail",group:"Reminders",title:`${r} not found`,detail:"The daemon reads Apple Reminders through remindctl.",fix:"brew install steipete/tap/remindctl, or set reminders.command to its full path."})}async function Z(t){let n=R(process.versions.node);t.push({severity:n?"ok":"fail",group:"Environment",title:`Node.js ${process.versions.node}`,detail:n?void 0:"AgentX requires Node 22.19 or newer, up to Node 26.",fix:n?void 0:"Install Node 22 (nvm install 22 && nvm use 22)"});let e=l=>{try{return h(process.platform==="win32"?"where":"which",[l],{encoding:"utf-8"}).trim().split(`
3
3
  `)[0]}catch{return null}},i=e("npm");t.push({severity:i?"ok":"fail",group:"Environment",title:i?"npm on PATH":"npm not found",detail:i||void 0});let s=e("claude");if(s){let l;try{l=h("claude",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`claude CLI ${l||"installed"}`,detail:s})}else t.push({severity:"warn",group:"Environment",title:"claude CLI not on PATH",detail:"Only required for agents on the claude-code tier.",fix:"See https://docs.anthropic.com/en/docs/claude-code"});let r=e("codex");if(r){let l;try{l=h("codex",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`codex CLI ${l||"installed"}`,detail:r})}else t.push({severity:"warn",group:"Environment",title:"codex CLI not on PATH",detail:"Only required for agents on the codex-cli tier.",fix:"Install with `npm i -g @openai/codex`."});let a=e("opencode");if(a){let l;try{l=h("opencode",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`opencode CLI ${l||"installed"}`,detail:a})}else t.push({severity:"warn",group:"Environment",title:"opencode CLI not on PATH",detail:"Only required for agents on the opencode tier.",fix:"Install from https://opencode.ai/docs/."});try{F(import.meta.url)("better-sqlite3"),t.push({severity:"ok",group:"Environment",title:`better-sqlite3 loads for Node ${process.version}`,detail:`NODE_MODULE_VERSION ${process.versions.modules}`})}catch(l){t.push({severity:"fail",group:"Environment",title:"better-sqlite3 native binding does not load",detail:l?.message??String(l),fix:`Run "pnpm rebuild better-sqlite3" with the same Node used by the daemon (${process.version}, modules ${process.versions.modules}).`})}}function U(t){if(process.platform!=="darwin")return;let n=E(B(),"Library/LaunchAgents"),e=[];try{e=$(n).filter(s=>/agentx\.voice.*\.plist$/.test(s))}catch{return}let i=s=>{try{return T(s,H.X_OK),!0}catch{return!1}};for(let s of e){let r=j(b(E(n,s),"utf-8")),a=x("ffmpeg",r,i);t.push(a?{severity:"ok",group:"Desktop",title:"ffmpeg reachable by the desktop app",detail:`${a} (${s})`}:{severity:"warn",group:"Desktop",title:"ffmpeg not reachable by the desktop app",detail:`Local Whisper transcription fails without it. ${s} sets PATH to ${r}.`,fix:"Install ffmpeg (brew install ffmpeg), then rerun agentx desktop install."})}}function K(t){let n=m(process.cwd(),"agentx.json");if(!y(n))return t.push({severity:"fail",group:"Config",title:"agentx.json not found",detail:`Looked in ${n}`,fix:"Run `agentx setup` to create one via the web wizard."}),null;let e;try{e=JSON.parse(b(n,"utf-8"))}catch(a){return t.push({severity:"fail",group:"Config",title:"agentx.json is not valid JSON",detail:a.message}),null}try{S(n),t.push({severity:"ok",group:"Config",title:`agentx.json valid (${Object.keys(e.agents||{}).length} agents, ${Object.keys(e.crons||{}).length} schedules)`})}catch(a){t.push({severity:"fail",group:"Config",title:"agentx.json failed schema validation",detail:a.message,fix:"Open /admin \u2192 Advanced tab to edit and re-save."})}let i=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="claude-code");i.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["claude"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${i.length} agent(s) use claude-code tier but claude CLI is missing`,detail:i.map(([l])=>l).join(", "),fix:"Install Claude Code (https://docs.anthropic.com/en/docs/claude-code) or switch these agents to tier=sdk."}));let s=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="codex-cli");s.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["codex"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${s.length} agent(s) use codex-cli tier but codex CLI is missing`,detail:s.map(([l])=>l).join(", "),fix:"Install Codex CLI with `npm i -g @openai/codex` or switch these agents to tier=claude-code."}));let r=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="opencode");return r.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["opencode"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${r.length} agent(s) use opencode tier but OpenCode CLI is missing`,detail:r.map(([l])=>l).join(", "),fix:"Install OpenCode from https://opencode.ai/docs/ or switch these agents to another tier."})),e}function Q(t,n){let e=new Set;if(C(n,e),e.size===0){t.push({severity:"ok",group:"Secrets",title:"No ${VAR} references in agentx.json"});return}let i=m(process.cwd(),".env"),s={};if(y(i))for(let l of b(i,"utf-8").split(/\r?\n/)){let u=l.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/i);u&&(s[u[1]]=u[2])}let r=[],a=[];for(let l of e){let u=process.env[l]??s[l];u===void 0?r.push(l):(!u.trim()||/^["']?\s*["']?$/.test(u))&&a.push(l)}r.length===0&&a.length===0?t.push({severity:"ok",group:"Secrets",title:`${e.size} env reference(s) resolved`}):(r.length>0&&t.push({severity:"fail",group:"Secrets",title:`${r.length} env var(s) referenced in agentx.json but missing`,detail:r.join(", "),fix:`Add to .env \u2014 e.g. ${r[0]}=<value>`}),a.length>0&&t.push({severity:"warn",group:"Secrets",title:`${a.length} env var(s) set but empty`,detail:a.join(", ")}))}function C(t,n){if(typeof t=="string")for(let e of t.matchAll(/\$\{([A-Z_][A-Z0-9_]*)\}/g))n.add(e[1]);else if(Array.isArray(t))for(let e of t)C(e,n);else if(t&&typeof t=="object")for(let e of Object.values(t))C(e,n)}function Y(t,n){let e=[];for(let[i,s]of Object.entries(n.agents||{})){if(!s.workspace)continue;let r=s.workspace.startsWith("/")?s.workspace:m(process.cwd(),s.workspace);try{X(r).isDirectory()||e.push(`${i}: ${r} (exists but not a directory)`)}catch{e.push(`${i}: ${r}`)}}e.length===0?t.push({severity:"ok",group:"Workspaces",title:"All agent workspace folders exist"}):t.push({severity:"warn",group:"Workspaces",title:`${e.length} agent workspace(s) missing`,detail:e.join(`
4
4
  `),fix:"The daemon will create missing folders on first task, but you won't see CLAUDE.md / skills until you populate them."})}function ee(t,n){let e=/\$\{[A-Za-z_][A-Za-z0-9_]*\}/g,i=[];for(let[s,r]of Object.entries(n.agents||{})){if(!r.workspace)continue;let a=r.workspace.startsWith("/")?r.workspace:m(process.cwd(),r.workspace);for(let l of["settings.json","settings.local.json"]){let u=m(a,".claude",l);if(!y(u))continue;let w;try{w=JSON.parse(b(u,"utf-8"))}catch(d){i.push({severity:"fail",agent:s,msg:`${l}: JSON parse error \u2014 ${d.message}`});continue}let k=w.env||{};for(let[d,p]of Object.entries(k)){if(typeof p!="string")continue;let g=p.match(e);g&&i.push({severity:"fail",agent:s,msg:`${l} env.${d} contains unexpanded ${[...new Set(g)].join(",")} \u2014 Claude Code does NOT expand \${VAR} in settings.json (use a fully-literal value)`})}let o=k.PATH;if(typeof o=="string"){let d=o.split(":").filter(Boolean);d.includes("/usr/bin")||i.push({severity:"fail",agent:s,msg:`${l} env.PATH missing /usr/bin \u2014 cat/head/sh/which will fail`}),d.includes("/bin")||i.push({severity:"fail",agent:s,msg:`${l} env.PATH missing /bin \u2014 ls/cp/mv will fail`})}let c=w.permissions;if(c&&typeof c=="object"&&"allow"in c){let d=c.allow,p=c.deny;Array.isArray(d)&&d.length===0&&Array.isArray(p)&&p.length>0&&i.push({severity:"warn",agent:s,msg:`${l} permissions.allow is explicitly [] with ${p.length} deny rules \u2014 agent may be locked out (omit the key to use defaults instead)`})}}}if(i.length===0){t.push({severity:"ok",group:"Workspace settings",title:`All ${Object.keys(n.agents||{}).length} agent .claude/settings.json files clean`});return}for(let s of i)t.push({severity:s.severity,group:"Workspace settings",title:`${s.agent}: ${s.msg}`,fix:s.severity==="fail"?"Edit .claude/settings.json \u2014 replace ${VAR} with the literal value or omit the key to inherit.":"Either remove the empty allow list or populate it."})}function te(t,n){let e=n.webhooks??[],i=[],s=m(process.cwd(),n.workflows?.dir||".agentx/workflows"),r=new Set;try{if(y(s))for(let o of $(s))o.endsWith(".json")&&!o.startsWith("_")&&!o.endsWith(".disabled.json")&&r.add(o.replace(/\.json$/,""))}catch{}let a=new Set(["github","gitlab"]);for(let o of e){if(!o.enabled||!a.has(o.source))continue;!(o.triggers&&Object.keys(o.triggers).length>0)&&!o.defaultWorkflow&&i.push({severity:"warn",title:`webhook "${o.id}" (${o.source} -> ${o.agentId}) has no triggers map; every event-type collapses to the bound agent`,fix:'Add a triggers map: { "issues.opened": "wf-id", "pull_request.synchronize": "wf-id" } \u2014 or set defaultWorkflow.'})}for(let o of e)if(!(!o.enabled||!o.triggers)){for(let[c,d]of Object.entries(o.triggers))r.size>0&&!r.has(d)&&i.push({severity:"fail",title:`webhook "${o.id}".triggers["${c}"] -> "${d}" \u2014 no such workflow under ${n.workflows?.dir||".agentx/workflows"}`,fix:"Create the workflow file or fix the id in agentx.json"});o.defaultWorkflow&&r.size>0&&!r.has(o.defaultWorkflow)&&i.push({severity:"fail",title:`webhook "${o.id}".defaultWorkflow -> "${o.defaultWorkflow}" \u2014 no such workflow`,fix:"Create the workflow file or fix the id in agentx.json"})}try{if(y(s)){for(let o of $(s))if(!(!o.endsWith(".json")||o.startsWith("_")||o.endsWith(".disabled.json")))try{let c=JSON.parse(b(m(s,o),"utf-8"));c?.status==="active"&&c?.state==="quarantined"&&i.push({severity:"warn",title:`workflow "${c.id??o}" is status=active but state=quarantined \u2014 it looks live but will never dispatch`,fix:'Resolve the conflict the detector flagged, then set state back to "active" (or set status to "review" while parked).'})}catch{}}}catch{}let l=new Set((n.mesh?.peers??[]).map(o=>o.name));for(let o of e)!o.enabled||!o.node||l.has(o.node)||i.push({severity:"fail",title:`webhook "${o.id}" routes to mesh peer "${o.node}" which is not in mesh.peers`,fix:"Add the peer to mesh.peers or remove the node field on the webhook."});let u=new Map;for(let o of e){if(!o.enabled)continue;let c=`${o.source}:${o.agentId}`,d=u.get(c);d?i.push({severity:"warn",title:`webhook entries "${d}" and "${o.id}" both enabled for ${o.source} -> ${o.agentId}; only the first is dispatched`,fix:"Disable one entry, or merge their triggers maps into a single entry."}):u.set(c,o.id)}let w=new Set(Object.keys(n.agents??{}));for(let o of n.channels?.gitlab?.agentMappings??[])if(o?.agentId){if(o.node){l.has(o.node)||i.push({severity:"fail",title:`gitlab.agentMappings entry agentId="${o.agentId}" routes to mesh peer "${o.node}" which is not in mesh.peers`,fix:"Add the peer to mesh.peers or drop the node field on the mapping."});continue}w.has(o.agentId)||i.push({severity:"warn",title:`gitlab.agentMappings entry agentId="${o.agentId}" \u2014 no such agent in agents.* (and no node field, so it's not a cross-mesh route)`,fix:'Add the agent to agents.*, set node:"<peer>" if the agent lives remotely, or remove the mapping.'})}for(let[o,c]of Object.entries(n.channels?.telegram?.accounts??{}))c.agentBinding?w.has(c.agentBinding)||i.push({severity:"fail",title:`telegram account "${o}".agentBinding -> "${c.agentBinding}" \u2014 no such agent in agents.*`,fix:"Fix the agentBinding or define the agent in agents.*."}):i.push({severity:"fail",title:`telegram account "${o}" has no agentBinding; every DM to this bot will drop`,fix:"Set agentBinding to a valid agent id."});let k=new Set(["telegram-bot","whatsapp","slack-bot","discord-bot","gitlab-user","github-user","gmail","hotmail","smtp","hubspot","salesforce","pipedrive","odoo","trello","linear","asana","jira","notion","stripe","sentry","vercel","twilio","custom"]);for(let[o,c]of Object.entries(n.agents??{})){let d=c.integrations??[];if(!d.length)continue;let p=new Set;for(let g of d){let A=`${g.kind}::${g.label}`;p.has(A)&&i.push({severity:"warn",title:`agents.${o}.integrations: duplicate (${g.kind}, ${g.label})`,fix:"Remove the duplicate or rename one. (kind, label) must be unique per agent."}),p.add(A),k.has(g.kind)||i.push({severity:"warn",title:`agents.${o}.integrations: unknown kind "${g.kind}" on integration "${g.label}"`,fix:'Use a canonical kind from INTEGRATION_KINDS, or "custom" for ad-hoc services.'});let D=g.credentials||{};for(let[_,v]of Object.entries(D))typeof v=="string"&&/^[A-Z][A-Z0-9_]*$/.test(v)&&!process.env[v]&&i.push({severity:"warn",title:`agents.${o}.integrations[${g.kind}/${g.label}].${_} -> $${v} but env var is unset (in this shell)`,fix:`Set ${v} on the daemon environment. The daemon's process.env is what matters; this warning fires from your local shell.`})}}if(i.length===0){t.push({severity:"ok",group:"Routing",title:`${e.length} webhook(s), ${Object.keys(n.channels?.telegram?.accounts??{}).length} telegram account(s) \u2014 all routing references resolve`});return}for(let o of i)t.push({severity:o.severity,group:"Routing",title:o.title,fix:o.fix})}function ne(t){return typeof t?.canMeasure!="boolean"?null:t.canMeasure?{severity:"ok",group:"Runtime",title:"Daemon finds ffmpeg to measure phone recordings"}:{severity:"warn",group:"Runtime",title:t.allowUnmeasured?"Daemon can't find ffmpeg: phone recordings go unmeasured (voice.allowUnmeasured)":"Daemon can't find ffmpeg: phone voice input is refused",fix:"Install ffmpeg (brew install ffmpeg / sudo apt install ffmpeg), or set AGENTX_FFMPEG in the service's environment. The daemon's PATH is shorter than your shell's."}}async function ie(t,n){let e=n.dashboard?.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800",i={};n.dashboard?.token&&(i.Authorization=`Bearer ${n.dashboard.token}`);try{let s=new AbortController,r=setTimeout(()=>s.abort(),2e3),a=await fetch(e+"/health",{headers:i,signal:s.signal});if(clearTimeout(r),!a.ok){t.push({severity:"warn",group:"Runtime",title:`Daemon responded ${a.status}`,detail:e});return}let l=await a.json();t.push({severity:"ok",group:"Runtime",title:`Daemon healthy \u2014 ${l.agents?.length??0} agents live, uptime ${Math.round((l.uptime??0)/60)}m`,detail:e});let u=ne(l.voice);u&&t.push(u)}catch{t.push({severity:"warn",group:"Runtime",title:"Daemon not reachable (not running?)",detail:e,fix:"Run `agentx daemon start`. Skip this check with `agentx doctor --no-running`."})}}function oe(t,n){let e=Object.entries(n.agents||{}).filter(([,s])=>s?.codegraph===!0&&(s.tier==="claude-code"||s.tier==="codex-cli"));if(e.length===0)return;let i=null;try{i=h(process.platform==="win32"?"where":"which",["codegraph"],{encoding:"utf-8"}).trim().split(`
5
5
  `)[0]||null}catch{i=null}if(i){let s;try{s=h("codegraph",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"CodeGraph",title:`codegraph CLI ${s||"installed"}`,detail:i})}else t.push({severity:"fail",group:"CodeGraph",title:"codegraph CLI not on PATH",detail:`${e.length} agent(s) have codegraph:true but the binary isn't available.`,fix:"Install with `npm i -g @colbymchenry/codegraph`."});for(let[s,r]of e){if(!r.workspace||!y(r.workspace)){t.push({severity:"warn",group:"CodeGraph",title:`${s}: workspace missing`,detail:`Workspace path ${r.workspace} does not exist \u2014 codegraph will skip this agent.`});continue}let a=m(r.workspace,".codegraph","codegraph.db");y(a)?t.push({severity:"ok",group:"CodeGraph",title:`${s}: index present`,detail:a}):t.push({severity:"warn",group:"CodeGraph",title:`${s}: index not built yet`,detail:".codegraph/ missing \u2014 daemon will background-index this workspace on next boot.",fix:`Run \`codegraph init --index ${r.workspace}\` to build it now.`})}}function W(t){return{errors:t.filter(n=>n.severity==="fail").length,warnings:t.filter(n=>n.severity==="warn").length,ok:t.filter(n=>n.severity==="ok").length}}function se(t){console.log(),console.log(f.bold(" agentx doctor")),console.log();let n=new Map;for(let i of t)n.has(i.group)||n.set(i.group,[]),n.get(i.group).push(i);for(let[i,s]of n){console.log(f.bold(" "+i));for(let r of s){let a=r.severity==="ok"?f.green("\u2713"):r.severity==="warn"?f.yellow("!"):f.red("\u2717");console.log(` ${a} ${r.title}`),r.detail&&console.log(f.dim(" "+r.detail.replace(/\n/g,`
6
6
  `))),r.fix&&console.log(f.dim(" \u2192 "+r.fix))}console.log()}let e=W(t);e.errors>0?console.log(f.red.bold(` ${e.errors} error${e.errors===1?"":"s"}`)+(e.warnings?f.yellow(`, ${e.warnings} warning${e.warnings===1?"":"s"}`):"")+`. Fix the error${e.errors===1?"":"s"} and rerun.`):e.warnings>0?console.log(f.yellow.bold(` ${e.warnings} warning${e.warnings===1?"":"s"}.`)+f.dim(" Review but not blocking.")):console.log(f.green.bold(` All checks passed (${e.ok}).`)),console.log()}export{P as a,J as b,ke as c,G as d,V as e,ne as f};
7
- //# sourceMappingURL=chunk-4NFDDTGA.js.map
7
+ //# sourceMappingURL=chunk-V3C2BOYR.js.map
@@ -1,5 +1,5 @@
1
- import{ia as m,la as b}from"./chunk-SIOWVLZG.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{ja as m,ma as b}from"./chunk-TXX5W3SH.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-XEOT2F4C.js.map
5
+ //# sourceMappingURL=chunk-X7E27RYS.js.map
@@ -1,8 +1,8 @@
1
- import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as q,b as O,c as R,d as B,f as b,g as S,h as E,i as w,j as y}from"./chunk-WXQQO2PD.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-QJP37VVA.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function A(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(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 K(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&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",u=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",p=[`- ${n} [${h}] ${e.schedule} \u2014 ${S(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${u}`];return e.notify&&p.push(` notify: ${e.notify.channel} ${e.notify.chatId}`),e.command?p.push(` command: ${A(String(e.command))}`):e.prompt&&p.push(` prompt: ${A(String(e.prompt))}`),p.join(`
1
+ import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as q,b as O,c as R,d as B,f as b,g as S,h as E,i as w,j as y}from"./chunk-22LO3GBP.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-A6B5JRUG.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function A(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(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 K(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&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",u=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",p=[`- ${n} [${h}] ${e.schedule} \u2014 ${S(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${u}`];return e.notify&&p.push(` notify: ${e.notify.channel} ${e.notify.chatId}`),e.command?p.push(` command: ${A(String(e.command))}`):e.prompt&&p.push(` prompt: ${A(String(e.prompt))}`),p.join(`
2
2
  `)}async function k(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(u){return`Could not notify the operator (${u?.message??u}); the request is still recorded.`}}async function re(n,e,t={}){let r=(s(n.action)||"list").toLowerCase(),u=t.now?t.now():new Date,h;try{h=V(t.configPath)}catch(a){return`Error: ${a.message}`}let p=h.crons||{};if(r==="list"){let a=n.mine===!0,l=Object.entries(p).filter(([,i])=>!a||e&&i?.createdBy===e.agentId);return l.length?l.map(([i,f])=>Q(i,f,u)).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(!h.agents?.[e.agentId])return`Error: caller "${e.agentId}" is not an agent on this node.`;let o=s(n.id),m=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=D(a);if(!i)return`Error: couldn't parse "${a}". ${O}.`;let f=s(n.agent)||e.agentId;if(!h.agents?.[f])return`Error: agent "${f}" not found on this node.`;let g=s(n.timezone)||q;if(!B(g))return`Error: unknown timezone "${g}".`;let d=o||_(i.matched,f);if(!R(d))return`Error: invalid id "${d}" (letters, digits, "-" and "_" only).`;if(p[d])return`Error: a schedule "${d}" already exists. Pick another \`id\`.`;let $=K(n,e);if($==="invalid")return'Error: `notify` must be "here", "none", or "channel:chatId".';let z={action:"create",requestedBy:e.agentId,requestedAt:u.toISOString()},L=b({parsed:i,agent:f,prompt:l,timezone:g,notify:$,enabled:!1,createdBy:e.agentId,approval:z}),v=await m(U=>I(U,`crons.${d}`,L));if(!v.success)return`Error: ${v.error}`;let N=w(E(i.cron,g,u),g),G=[`Schedule approval requested by ${e.agentId}`,`Create: ${d}`,`When: ${i.human} \u2014 cron \`${i.cron}\` (${g})`,`Next fire: ${N}`,`Agent: ${f}`,$?`Notify: ${$.channel} ${$.chatId}`:"Notify: none",`Prompt: ${A(l,400)}`,"",`Approve: agentx schedule approve ${d}`,`Reject: agentx schedule reject ${d}`].join(`
4
4
  `),H=await k(h,t,G);return[`Requested schedule "${d}": ${i.human} (cron ${i.cron}, ${g}); next fire would be ${N}.`,"It is saved DISABLED and will not run until the operator approves it.",H].join(`
5
5
  `)}if(!o)return`Error: ${r} needs \`id\`.`;let c=p[o];if(!c)return`Error: schedule "${o}" not found.`;if(!Y(h,c,e))return Z(o,c);if(r==="pause"||r==="resume"){let a=r==="resume";if(a&&y(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 m(i=>I(i,`crons.${o}.enabled`,a));return l.success?`"${o}" ${a?"resumed":"paused"}.`:`Error: ${l.error}`}if(r==="delete"){if(y(c)&&c.approval.requestedBy===e.agentId){let d=await m($=>P($,`crons.${o}`));return d.success?`Withdrew the pending request "${o}".`:`Error: ${d.error}`}if(y(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:u.toISOString()},l=await m(d=>{if(!x(d,`crons.${o}`))throw new Error(`schedule "${o}" not found`);I(d,`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: ${S(c.schedule)} \u2014 cron \`${c.schedule}\` (${i})`,`Next fire: ${c.enabled?w(E(c.schedule,i,u),i):"\u2014 (paused)"}`,`Agent: ${c.agent}`,"",`Approve: agentx schedule approve ${o}`,`Reject: agentx schedule reject ${o}`].join(`
6
6
  `),g=await k(h,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 oe(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)),u=s(r?e.AGENTX_CHANNEL:n.channel),h=s(r?e.AGENTX_CHAT_ID:n.chatId),p=s(n.accountId);return{agentId:t,channel:u,chatId:h,...p?{accountId:p}:{}}}export{re as a,oe as b};
8
- //# sourceMappingURL=chunk-WSKQUKCF.js.map
8
+ //# sourceMappingURL=chunk-XG2XVGSL.js.map
@@ -17,7 +17,7 @@ SKIP:
17
17
  For each fact, output a JSON array:
18
18
  [{"category":"fact|preference|commitment|task-state","content":"concise fact, 1-2 sentences","keywords":["keyword1","keyword2"]}]
19
19
 
20
- If nothing worth remembering, output: []`;async function I(e,s,r,n,o){if(s.length<20&&r.length<50||!l({channel:n.channel,content:`User: ${s}`,responseLength:r.length}).capture)return;let{createProvider:h}=await import("./providers-ES5KVLI4.js"),i=(await h("claude").generate([{role:"system",content:w},{role:"user",content:`${n.sender} (via ${n.channel}): ${s}
20
+ If nothing worth remembering, output: []`;async function I(e,s,r,n,o){if(s.length<20&&r.length<50||!l({channel:n.channel,content:`User: ${s}`,responseLength:r.length}).capture)return;let{createProvider:h}=await import("./providers-55NC2SFN.js"),i=(await h("claude").generate([{role:"system",content:w},{role:"user",content:`${n.sender} (via ${n.channel}): ${s}
21
21
 
22
22
  Agent: ${r}`}],{model:y,maxTokens:512})).content.trim().match(/\[[\s\S]*\]/);if(!i)return;let a=JSON.parse(i[0]);if(!Array.isArray(a)||a.length===0)return;let m=new Date().toISOString().slice(0,10),p=u(n.channel);for(let t of a)typeof t?.content=="string"&&(t.category==="secret"||f(t.content)||o.hasSimilar(e,t.content)||o.addMemory(e,{agentId:e,category:t.category,content:t.content,keywords:t.keywords||[],source:{...n,date:m,trust:p},expiresAt:t.category==="task-state"?new Date(Date.now()+7*24*60*60*1e3).toISOString():void 0}));Math.random()<.02&&o.prune(e)}export{l as a,I as b};
23
- //# sourceMappingURL=chunk-23A5K5UW.js.map
23
+ //# sourceMappingURL=chunk-Y5MFVVTM.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-YK3YR2CQ.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.parse();
2
+ import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-7MG42JKO.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.parse();
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g}from"./chunk-XEOT2F4C.js";import"./chunk-SIOWVLZG.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
- //# sourceMappingURL=client-O7SPKO5X.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-X7E27RYS.js";import"./chunk-TXX5W3SH.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-DBQ5QNJJ.js.map
@@ -17,12 +17,12 @@ Format as a structured summary:
17
17
  Keep it under 500 words. Prioritize actionable information over conversational flow.
18
18
  Do NOT include greetings, acknowledgments, or meta-commentary about the conversation.`;function G(t){return t.length<F?!1:t.reduce((n,e)=>n+e.content.length,0)>A}async function J(t,o,n,e){if(t.length<F)return{summary:"",compactedCount:0,keptCount:t.length,memoryFlushed:!1};let r=Math.max(0,t.length-K),s=t.slice(0,r),c=t.slice(r);if(s.length===0)return{summary:"",compactedCount:0,keptCount:c.length,memoryFlushed:!1};let a=d(s);M(o,a);let m=!1;if(n)try{await $(o,s,n,e),m=!0}catch{}let u=j(s),l=await z(u),{qualityScore:i,lostEntities:g}=B(u,l),p,x=[{role:"agent",content:l,timestamp:new Date().toISOString()}],D=d(x),h=v(o);return h&&(p=S(h,D)),{summary:l,compactedCount:s.length,keptCount:c.length,memoryFlushed:m,qualityScore:i,lostEntities:g.length>0?g:void 0,drift:p&&p.overallScore>.1?p:void 0}}function B(t,o){let n=_(t);if(n.length===0)return{qualityScore:100,lostEntities:[]};let e=o.toLowerCase(),r=[],s=[];for(let a of n)e.includes(a.toLowerCase())?r.push(a):s.push(a);return{qualityScore:Math.round(r.length/n.length*100),lostEntities:s}}function _(t){let o=[],n=new Set,e=i=>{let g=i.toLowerCase().trim();g.length<3||n.has(g)||(n.add(g),o.push(i.trim()))},r=t.match(/https?:\/\/[^\s<>)"]+/g)||[];for(let i of r)e(i.slice(0,80));let s=t.match(/(?:\/[\w.-]+){2,}/g)||[];for(let i of s)e(i);let c=t.match(/[#!]\d{2,}/g)||[];for(let i of c)e(i);let a=t.match(/[\w.-]+@[\w.-]+\.\w+/g)||[];for(let i of a)e(i);let m=t.match(/"([^"]{3,40})"/g)||[];for(let i of m)e(i.slice(1,-1));let u=t.match(/[A-Z][a-z]+(?:\s+[A-Z][a-z]+)+/g)||[];for(let i of u)e(i);let l=t.match(/[a-f0-9]{8,}/gi)||[];for(let i of l.slice(0,5))e(i);return o.slice(0,30)}function W(t,o){if(o.compactedCount===0)return t;let n=t.slice(-o.keptCount);return[{role:"agent",name:"system",content:`[Compacted conversation summary \u2014 ${o.compactedCount} earlier messages]
19
19
 
20
- ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e){let r=[],s=[];for(let a of o)a.role==="user"?r.push(`${a.name||"User"}: ${a.content}`):s.push(a.content);if(r.length===0||s.length===0)return;let{extractMemories:c}=await import("./memory-extract-YCNCARZ2.js");await c(t,r.join(`
20
+ ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e){let r=[],s=[];for(let a of o)a.role==="user"?r.push(`${a.name||"User"}: ${a.content}`):s.push(a.content);if(r.length===0||s.length===0)return;let{extractMemories:c}=await import("./memory-extract-ATD6YLRK.js");await c(t,r.join(`
21
21
  `),s.join(`
22
22
  `),{channel:e?.channel??"compaction",chatId:e?.chatId??"flush",sender:"compaction"},n)}function j(t){return t.map(o=>{let n=o.timestamp.slice(11,16),e=o.role==="user"?o.name||"User":o.name||"Agent";return`[${n}] ${e}: ${o.content}`}).join(`
23
23
 
24
- `)}async function z(t){let n=t.length>2e4?t.slice(-2e4):t;try{let{createProvider:e}=await import("./providers-ES5KVLI4.js");return(await e("claude").generate([{role:"system",content:P},{role:"user",content:n}],{model:R,maxTokens:1024})).content.trim()}catch{let s=t.split(`
24
+ `)}async function z(t){let n=t.length>2e4?t.slice(-2e4):t;try{let{createProvider:e}=await import("./providers-55NC2SFN.js");return(await e("claude").generate([{role:"system",content:P},{role:"user",content:n}],{model:R,maxTokens:1024})).content.trim()}catch{let s=t.split(`
25
25
  `).slice(-20);return`[Summary unavailable \u2014 keeping last ${s.length} lines]
26
26
  ${s.join(`
27
27
  `)}`}}export{W as applyCompaction,J as compactSession,G as needsCompaction};
28
- //# sourceMappingURL=compaction-MECSN36J.js.map
28
+ //# sourceMappingURL=compaction-FS6XNRLM.js.map
@@ -0,0 +1,2 @@
1
+ import{$ as c,Z as a,_ as b,aa as d,ba as e,ca as f,da as g,ea as h,fa as i,ga as j,ha as k,ia as l,ja as m,ka as n,ma as o}from"./chunk-TXX5W3SH.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";o();export{a as INTEGRATION_KINDS,j as approvalsConfigSchema,d as callsSchema,c as cameraBotSchema,k as daemonConfigSchema,b as eventSubscriptionSchema,l as expandEnvVars,m as loadDaemonConfig,h as membersConfigSchema,g as peopleConfigSchema,f as personSchema,i as requestStatusConfigSchema,e as requestsConfigSchema,n as validateWorkspaces};
2
+ //# sourceMappingURL=config-4T62LT27.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-A6B5JRUG.js";import"./chunk-TXX5W3SH.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-ARUEJ6V5.js.map
@@ -11,7 +11,7 @@ Rules:
11
11
 
12
12
  Be conservative \u2014 unneeded context costs tokens. When in doubt, exclude.`;async function P(e){let c=Date.now(),i=e.timeoutMs??8e3,r=T(e.sessions,e.agentId,e.channel,e.chatId,4),o=[`Agent: ${e.agentId}`,`Channel: ${e.channel}`,r?`Recent conversation:
13
13
  ${r}`:"Recent conversation: (none \u2014 first message)","",`Current message: ${e.message.slice(0,1500)}`].join(`
14
- `),n;try{let{createProvider:l}=await import("./providers-ES5KVLI4.js"),S=l("claude"),y=new AbortController,p=setTimeout(()=>y.abort(),i);try{let x=await S.generate([{role:"system",content:M},{role:"user",content:o}],{model:I,maxTokens:256,abortSignal:y.signal});n=f(x.content)}finally{clearTimeout(p)}}catch(l){return process.env.AGENTX_PLANNER_DEBUG&&console.error(`[planner] error: ${l?.message??l}`),null}if(!n||typeof n!="object")return null;let m=v(n.recentTurns,0,6,3),t=!!n.memory?.include,s=typeof n.memory?.query=="string"?n.memory.query:"",a=!!n.crossChat,g=typeof n.reasoning=="string"?n.reasoning:void 0,b=w(e.sessions,e.agentId,e.channel,e.chatId,m),u="",h=[];if(t&&s)try{let l=e.memoryStore.findRelevant(s,e.agentId,5);u=e.memoryStore.buildContext(l),h=e.memoryStore.contextFacts(l)}catch{}let d="";return a&&(d=e.sessions.getCrossSessionSummary(e.agentId,e.channel,e.chatId,"")),{sessionHistory:b,memoryContext:u,memoryFacts:h,crossChatContext:d,debug:{recentTurns:m,memoryIncluded:t,memoryQuery:s||void 0,crossChatIncluded:a,reasoning:g,planLatencyMs:Date.now()-c}}}function w(e,c,i,r,o){if(o<=0)return"";let n=e.getSession(c,i,r);if(n.messages.length===0)return"";let m=Math.min(n.messages.length,o*2),t=n.messages.slice(-m),s=[`[Recent exchange \u2014 last ${t.length} messages]`];for(let a of t){let g=a.name||(a.role==="user"?"User":"Agent");s.push(`${g}: ${a.content}`)}return s.push("[End recent exchange \u2014 respond to the latest message above]"),s.push(""),s.join(`
14
+ `),n;try{let{createProvider:l}=await import("./providers-55NC2SFN.js"),S=l("claude"),y=new AbortController,p=setTimeout(()=>y.abort(),i);try{let x=await S.generate([{role:"system",content:M},{role:"user",content:o}],{model:I,maxTokens:256,abortSignal:y.signal});n=f(x.content)}finally{clearTimeout(p)}}catch(l){return process.env.AGENTX_PLANNER_DEBUG&&console.error(`[planner] error: ${l?.message??l}`),null}if(!n||typeof n!="object")return null;let m=v(n.recentTurns,0,6,3),t=!!n.memory?.include,s=typeof n.memory?.query=="string"?n.memory.query:"",a=!!n.crossChat,g=typeof n.reasoning=="string"?n.reasoning:void 0,b=w(e.sessions,e.agentId,e.channel,e.chatId,m),u="",h=[];if(t&&s)try{let l=e.memoryStore.findRelevant(s,e.agentId,5);u=e.memoryStore.buildContext(l),h=e.memoryStore.contextFacts(l)}catch{}let d="";return a&&(d=e.sessions.getCrossSessionSummary(e.agentId,e.channel,e.chatId,"")),{sessionHistory:b,memoryContext:u,memoryFacts:h,crossChatContext:d,debug:{recentTurns:m,memoryIncluded:t,memoryQuery:s||void 0,crossChatIncluded:a,reasoning:g,planLatencyMs:Date.now()-c}}}function w(e,c,i,r,o){if(o<=0)return"";let n=e.getSession(c,i,r);if(n.messages.length===0)return"";let m=Math.min(n.messages.length,o*2),t=n.messages.slice(-m),s=[`[Recent exchange \u2014 last ${t.length} messages]`];for(let a of t){let g=a.name||(a.role==="user"?"User":"Agent");s.push(`${g}: ${a.content}`)}return s.push("[End recent exchange \u2014 respond to the latest message above]"),s.push(""),s.join(`
15
15
  `)}function T(e,c,i,r,o){let n=e.getSession(c,i,r);return n.messages.length===0?"":n.messages.slice(-o).map(t=>{let s=t.name||(t.role==="user"?"User":"Agent"),a=t.content.length>200?t.content.slice(0,200)+"\u2026":t.content;return` ${s}: ${a}`}).join(`
16
16
  `)}function v(e,c,i,r){let o=typeof e=="number"?Math.floor(e):Number.parseInt(String(e??""),10);return Number.isFinite(o)?Math.min(i,Math.max(c,o)):r}export{P as planContext};
17
- //# sourceMappingURL=context-planner-JU7CNXCB.js.map
17
+ //# sourceMappingURL=context-planner-BKHPKDX5.js.map
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e}from"./chunk-4NFDDTGA.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-SIOWVLZG.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
2
- //# sourceMappingURL=doctor-XP7O45RC.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e}from"./chunk-V3C2BOYR.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-TXX5W3SH.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
2
+ //# sourceMappingURL=doctor-M32NIOZH.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-UG2OF2EI.js";import"./chunk-SFQUP3BP.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";export{a as HealEngine};
2
+ //# sourceMappingURL=heal-U67X6NIN.js.map
package/dist/index.d.ts CHANGED
@@ -4836,6 +4836,9 @@ declare const daemonConfigSchema: z.ZodObject<{
4836
4836
  people: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
4837
4837
  id: z.ZodString;
4838
4838
  name: z.ZodString;
4839
+ /** How this person's name is said aloud, e.g. "A-neess Ma-roo-shee"
4840
+ * (#433). Written forms stay as they are; see voice.pronunciations. */
4841
+ say: z.ZodOptional<z.ZodString>;
4839
4842
  /** `client` (#453): someone the owner works for; /member shows them
4840
4843
  * "Your project", not a teammate's "My work". */
4841
4844
  role: z.ZodDefault<z.ZodEnum<["owner", "member", "client", "guest"]>>;
@@ -4869,6 +4872,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4869
4872
  };
4870
4873
  role: "client" | "guest" | "owner" | "member";
4871
4874
  identities: string[];
4875
+ say?: string | undefined;
4872
4876
  }, {
4873
4877
  id: string;
4874
4878
  name: string;
@@ -4878,6 +4882,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4878
4882
  tools?: string[] | undefined;
4879
4883
  } | undefined;
4880
4884
  role?: "client" | "guest" | "owner" | "member" | undefined;
4885
+ say?: string | undefined;
4881
4886
  identities?: string[] | undefined;
4882
4887
  }>, "many">>, {
4883
4888
  agents: string[];
@@ -4889,6 +4894,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4889
4894
  };
4890
4895
  role: "client" | "guest" | "owner" | "member";
4891
4896
  identities: string[];
4897
+ say?: string | undefined;
4892
4898
  }[], {
4893
4899
  id: string;
4894
4900
  name: string;
@@ -4898,6 +4904,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4898
4904
  tools?: string[] | undefined;
4899
4905
  } | undefined;
4900
4906
  role?: "client" | "guest" | "owner" | "member" | undefined;
4907
+ say?: string | undefined;
4901
4908
  identities?: string[] | undefined;
4902
4909
  }[] | undefined>;
4903
4910
  members: z.ZodDefault<z.ZodObject<{
@@ -4946,6 +4953,105 @@ declare const daemonConfigSchema: z.ZodObject<{
4946
4953
  pollSeconds?: number | undefined;
4947
4954
  lookbackHours?: number | undefined;
4948
4955
  }>>;
4956
+ /** The phone app (/app) beyond pairing and notifications (#676). */
4957
+ app: z.ZodDefault<z.ZodObject<{
4958
+ /** The AgentX Android app (apps/android). Chrome shows it full screen,
4959
+ * without an address bar, only when this computer vouches for it at
4960
+ * /.well-known/assetlinks.json; with no fingerprints there is nothing
4961
+ * to vouch for and that address answers 404. */
4962
+ android: z.ZodDefault<z.ZodObject<{
4963
+ /** applicationId the Android app was built with. */
4964
+ packageName: z.ZodDefault<z.ZodString>;
4965
+ /** SHA-256 fingerprints of the key(s) that signed it, as AB:CD:… */
4966
+ certFingerprints: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
4967
+ }, "strip", z.ZodTypeAny, {
4968
+ packageName: string;
4969
+ certFingerprints: string[];
4970
+ }, {
4971
+ packageName?: string | undefined;
4972
+ certFingerprints?: string[] | undefined;
4973
+ }>>;
4974
+ /** Place reminders: places the Android app watches as geofences, and
4975
+ * what to do when the phone arrives or leaves (src/places). */
4976
+ places: z.ZodDefault<z.ZodObject<{
4977
+ enabled: z.ZodDefault<z.ZodBoolean>;
4978
+ /** Where places and their reminders are kept. Relative paths resolve
4979
+ * from the folder holding agentx.json. */
4980
+ file: z.ZodDefault<z.ZodString>;
4981
+ defaultRadiusMeters: z.ZodDefault<z.ZodNumber>;
4982
+ /** Android rarely notices a smaller circle reliably. */
4983
+ minRadiusMeters: z.ZodDefault<z.ZodNumber>;
4984
+ maxRadiusMeters: z.ZodDefault<z.ZodNumber>;
4985
+ /** Android lets one app watch at most 100 places. */
4986
+ maxPlaces: z.ZodDefault<z.ZodNumber>;
4987
+ maxRulesPerPlace: z.ZodDefault<z.ZodNumber>;
4988
+ /** A repeating reminder fires at most once in this window, so a
4989
+ * phone hovering at the edge of a place doesn't buzz again and again. */
4990
+ cooldownMinutes: z.ZodDefault<z.ZodNumber>;
4991
+ /** A crossing the phone could only report later (no signal) is
4992
+ * dropped once it is older than this. */
4993
+ maxEventAgeMinutes: z.ZodDefault<z.ZodNumber>;
4994
+ /** How often the Android app checks for changed places, in minutes.
4995
+ * Android runs background checks at most every 15 minutes. */
4996
+ syncMinutes: z.ZodDefault<z.ZodNumber>;
4997
+ }, "strip", z.ZodTypeAny, {
4998
+ enabled: boolean;
4999
+ file: string;
5000
+ defaultRadiusMeters: number;
5001
+ minRadiusMeters: number;
5002
+ maxRadiusMeters: number;
5003
+ maxPlaces: number;
5004
+ maxRulesPerPlace: number;
5005
+ cooldownMinutes: number;
5006
+ maxEventAgeMinutes: number;
5007
+ syncMinutes: number;
5008
+ }, {
5009
+ enabled?: boolean | undefined;
5010
+ file?: string | undefined;
5011
+ defaultRadiusMeters?: number | undefined;
5012
+ minRadiusMeters?: number | undefined;
5013
+ maxRadiusMeters?: number | undefined;
5014
+ maxPlaces?: number | undefined;
5015
+ maxRulesPerPlace?: number | undefined;
5016
+ cooldownMinutes?: number | undefined;
5017
+ maxEventAgeMinutes?: number | undefined;
5018
+ syncMinutes?: number | undefined;
5019
+ }>>;
5020
+ }, "strip", z.ZodTypeAny, {
5021
+ android: {
5022
+ packageName: string;
5023
+ certFingerprints: string[];
5024
+ };
5025
+ places: {
5026
+ enabled: boolean;
5027
+ file: string;
5028
+ defaultRadiusMeters: number;
5029
+ minRadiusMeters: number;
5030
+ maxRadiusMeters: number;
5031
+ maxPlaces: number;
5032
+ maxRulesPerPlace: number;
5033
+ cooldownMinutes: number;
5034
+ maxEventAgeMinutes: number;
5035
+ syncMinutes: number;
5036
+ };
5037
+ }, {
5038
+ android?: {
5039
+ packageName?: string | undefined;
5040
+ certFingerprints?: string[] | undefined;
5041
+ } | undefined;
5042
+ places?: {
5043
+ enabled?: boolean | undefined;
5044
+ file?: string | undefined;
5045
+ defaultRadiusMeters?: number | undefined;
5046
+ minRadiusMeters?: number | undefined;
5047
+ maxRadiusMeters?: number | undefined;
5048
+ maxPlaces?: number | undefined;
5049
+ maxRulesPerPlace?: number | undefined;
5050
+ cooldownMinutes?: number | undefined;
5051
+ maxEventAgeMinutes?: number | undefined;
5052
+ syncMinutes?: number | undefined;
5053
+ } | undefined;
5054
+ }>>;
4949
5055
  /** `agentx demo`, read from the agentx.json in the folder it runs from. */
4950
5056
  demo: z.ZodDefault<z.ZodObject<{
4951
5057
  /** Seconds each startup step (node /health, dashboard /live, mesh
@@ -5247,6 +5353,25 @@ declare const daemonConfigSchema: z.ZodObject<{
5247
5353
  /** What agents call the person they talk with, e.g. a first name.
5248
5354
  * Unset: "the user". */
5249
5355
  listener: z.ZodOptional<z.ZodString>;
5356
+ /** How a word is said aloud without changing how it is written
5357
+ * (#433): each pair's `written` form, matched as a whole word
5358
+ * without case, is spoken as `spoken`. `languages` ("en", "fr",
5359
+ * "ar") limits a pair to lines in those languages. Only speech
5360
+ * changes; cards, transcripts and messages keep the written form.
5361
+ * See src/voice/pronounce.ts. */
5362
+ pronunciations: z.ZodDefault<z.ZodArray<z.ZodObject<{
5363
+ written: z.ZodString;
5364
+ spoken: z.ZodString;
5365
+ languages: z.ZodOptional<z.ZodArray<z.ZodEnum<["en", "fr", "ar"]>, "many">>;
5366
+ }, "strict", z.ZodTypeAny, {
5367
+ written: string;
5368
+ spoken: string;
5369
+ languages?: ("en" | "fr" | "ar")[] | undefined;
5370
+ }, {
5371
+ written: string;
5372
+ spoken: string;
5373
+ languages?: ("en" | "fr" | "ar")[] | undefined;
5374
+ }>, "many">>;
5250
5375
  /** The agent's drawn pointer and name tag during a lesson. false: it
5251
5376
  * is never drawn, and a lesson is spoken only. */
5252
5377
  pointer: z.ZodDefault<z.ZodBoolean>;
@@ -5341,6 +5466,11 @@ declare const daemonConfigSchema: z.ZodObject<{
5341
5466
  maxHeight: number;
5342
5467
  };
5343
5468
  locale: string;
5469
+ pronunciations: {
5470
+ written: string;
5471
+ spoken: string;
5472
+ languages?: ("en" | "fr" | "ar")[] | undefined;
5473
+ }[];
5344
5474
  pointer: boolean;
5345
5475
  stt: "auto" | "local" | "elevenlabs";
5346
5476
  allowUnmeasured: boolean;
@@ -5373,6 +5503,11 @@ declare const daemonConfigSchema: z.ZodObject<{
5373
5503
  } | undefined;
5374
5504
  locale?: string | undefined;
5375
5505
  listener?: string | undefined;
5506
+ pronunciations?: {
5507
+ written: string;
5508
+ spoken: string;
5509
+ languages?: ("en" | "fr" | "ar")[] | undefined;
5510
+ }[] | undefined;
5376
5511
  pointer?: boolean | undefined;
5377
5512
  stt?: "auto" | "local" | "elevenlabs" | undefined;
5378
5513
  allowUnmeasured?: boolean | undefined;
@@ -6933,6 +7068,24 @@ declare const daemonConfigSchema: z.ZodObject<{
6933
7068
  skipTypes: string[];
6934
7069
  };
6935
7070
  };
7071
+ app: {
7072
+ android: {
7073
+ packageName: string;
7074
+ certFingerprints: string[];
7075
+ };
7076
+ places: {
7077
+ enabled: boolean;
7078
+ file: string;
7079
+ defaultRadiusMeters: number;
7080
+ minRadiusMeters: number;
7081
+ maxRadiusMeters: number;
7082
+ maxPlaces: number;
7083
+ maxRulesPerPlace: number;
7084
+ cooldownMinutes: number;
7085
+ maxEventAgeMinutes: number;
7086
+ syncMinutes: number;
7087
+ };
7088
+ };
6936
7089
  voice: {
6937
7090
  provider: "system" | "elevenlabs";
6938
7091
  fallback: "system" | "none";
@@ -6942,6 +7095,11 @@ declare const daemonConfigSchema: z.ZodObject<{
6942
7095
  maxHeight: number;
6943
7096
  };
6944
7097
  locale: string;
7098
+ pronunciations: {
7099
+ written: string;
7100
+ spoken: string;
7101
+ languages?: ("en" | "fr" | "ar")[] | undefined;
7102
+ }[];
6945
7103
  pointer: boolean;
6946
7104
  stt: "auto" | "local" | "elevenlabs";
6947
7105
  allowUnmeasured: boolean;
@@ -7337,6 +7495,7 @@ declare const daemonConfigSchema: z.ZodObject<{
7337
7495
  };
7338
7496
  role: "client" | "guest" | "owner" | "member";
7339
7497
  identities: string[];
7498
+ say?: string | undefined;
7340
7499
  }[];
7341
7500
  members: {
7342
7501
  logRetentionDays: number;
@@ -7737,6 +7896,24 @@ declare const daemonConfigSchema: z.ZodObject<{
7737
7896
  skipTypes?: string[] | undefined;
7738
7897
  } | undefined;
7739
7898
  } | undefined;
7899
+ app?: {
7900
+ android?: {
7901
+ packageName?: string | undefined;
7902
+ certFingerprints?: string[] | undefined;
7903
+ } | undefined;
7904
+ places?: {
7905
+ enabled?: boolean | undefined;
7906
+ file?: string | undefined;
7907
+ defaultRadiusMeters?: number | undefined;
7908
+ minRadiusMeters?: number | undefined;
7909
+ maxRadiusMeters?: number | undefined;
7910
+ maxPlaces?: number | undefined;
7911
+ maxRulesPerPlace?: number | undefined;
7912
+ cooldownMinutes?: number | undefined;
7913
+ maxEventAgeMinutes?: number | undefined;
7914
+ syncMinutes?: number | undefined;
7915
+ } | undefined;
7916
+ } | undefined;
7740
7917
  voice?: {
7741
7918
  system?: string | Record<string, string> | undefined;
7742
7919
  provider?: "system" | "elevenlabs" | undefined;
@@ -7748,6 +7925,11 @@ declare const daemonConfigSchema: z.ZodObject<{
7748
7925
  } | undefined;
7749
7926
  locale?: string | undefined;
7750
7927
  listener?: string | undefined;
7928
+ pronunciations?: {
7929
+ written: string;
7930
+ spoken: string;
7931
+ languages?: ("en" | "fr" | "ar")[] | undefined;
7932
+ }[] | undefined;
7751
7933
  pointer?: boolean | undefined;
7752
7934
  stt?: "auto" | "local" | "elevenlabs" | undefined;
7753
7935
  allowUnmeasured?: boolean | undefined;
@@ -8202,6 +8384,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8202
8384
  tools?: string[] | undefined;
8203
8385
  } | undefined;
8204
8386
  role?: "client" | "guest" | "owner" | "member" | undefined;
8387
+ say?: string | undefined;
8205
8388
  identities?: string[] | undefined;
8206
8389
  }[] | undefined;
8207
8390
  members?: {
@@ -9115,6 +9298,8 @@ declare class AgentXDaemon {
9115
9298
  private voiceIntros;
9116
9299
  /** Talk mode and task narration: see src/daemon/voice-talk-api.ts. */
9117
9300
  private voiceTalk;
9301
+ /** Words as the voice says them (voice.pronunciations, people[].say). */
9302
+ private sayAs;
9118
9303
  private screenBuffer?;
9119
9304
  /** Voice for agents on mesh peers: see src/daemon/voice-mesh-proxy.ts. */
9120
9305
  private voiceMesh;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,ia as Tt,ja as Mt}from"./chunk-K24MYJFP.js";import"./chunk-3RTOS727.js";import"./chunk-U52IS3AF.js";import"./chunk-S2GAEH2F.js";import"./chunk-GTJIKXDB.js";import"./chunk-DG5I6PPM.js";import"./chunk-ZVP6GB4G.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-LWYKS5JU.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-ACFQBLPX.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-QLWGLRT5.js";import"./chunk-JIT5GPTX.js";import{ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-DTQQ4DAY.js";import"./chunk-53OS4TDU.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import{a as L}from"./chunk-C245D4BZ.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-HCTWKWS3.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-Y4CYQV7G.js";import"./chunk-WXQQO2PD.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-M2L6S3Z5.js";import"./chunk-QJP37VVA.js";import"./chunk-VWTBHLMX.js";import"./chunk-DXWDVKMX.js";import{a as ht}from"./chunk-Z7L74GGT.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-7UNS34CN.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-FBODSJU6.js";import{f as gt,g as ft}from"./chunk-RS2T53EC.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-GQMUFSKB.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-5MUJZODV.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{ga as tt,ia as st,ja as ot,la as nt}from"./chunk-SIOWVLZG.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
1
+ import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,ia as Tt,ja as Mt}from"./chunk-B37WAFT5.js";import"./chunk-OZDSQVHU.js";import"./chunk-EEOQ5C5N.js";import"./chunk-S2GAEH2F.js";import"./chunk-GTJIKXDB.js";import"./chunk-DG5I6PPM.js";import"./chunk-ZVP6GB4G.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-QWI3FM5R.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-ACFQBLPX.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-QLWGLRT5.js";import"./chunk-JIT5GPTX.js";import{ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-37EDS7SZ.js";import"./chunk-THRWE4Y3.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import{a as L}from"./chunk-UG2OF2EI.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-QF377BDS.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-Y4CYQV7G.js";import"./chunk-22LO3GBP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-4QCYSKPD.js";import"./chunk-A6B5JRUG.js";import"./chunk-VWTBHLMX.js";import"./chunk-DVJW3IWI.js";import{a as ht}from"./chunk-R43TE2XX.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-MEXXGNNN.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-RXQ2XCKP.js";import{f as gt,g as ft}from"./chunk-JBE4H7PL.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-74CQWVHE.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-2PJKGZWP.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{ha as tt,ja as st,ka as ot,ma as nt}from"./chunk-TXX5W3SH.js";import"./chunk-UIBUZ2N3.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
2
2
  `)}
3
3
 
4
4
  ${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).
@@ -0,0 +1,2 @@
1
+ import{b as a}from"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-QIJLFPWE.js";export{a as extractMemories};
2
+ //# sourceMappingURL=memory-extract-ATD6YLRK.js.map