agentix-cli 0.47.1 → 0.48.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 (148) hide show
  1. package/apps/mac-helper/Sources/AgentXHelper/Buffer.swift +65 -0
  2. package/apps/mac-helper/Sources/AgentXHelper/Notify.swift +26 -0
  3. package/apps/mac-helper/Sources/AgentXHelper/Ring.swift +58 -0
  4. package/apps/mac-helper/Sources/AgentXHelper/Screens.swift +7 -0
  5. package/apps/mac-helper/Sources/AgentXHelper/Vision.swift +13 -8
  6. package/apps/mac-helper/Sources/AgentXHelper/Watch.swift +87 -0
  7. package/apps/mac-helper/Sources/AgentXHelper/main.swift +72 -18
  8. package/dist/{App-RZDJH6MK.js → App-EXB4HP3B.js} +2 -2
  9. package/dist/{ChatApp-6TXOFUDH.js → ChatApp-XMNE3SPH.js} +2 -2
  10. package/dist/{agent-I6RXAEXG.js → agent-ORYXXL5K.js} +2 -2
  11. package/dist/{board-dashboard-4LAQOB74.js → board-dashboard-2B3HYIXD.js} +493 -131
  12. package/dist/board-dashboard-2B3HYIXD.js.map +1 -0
  13. package/dist/{chunk-BZLHS3VF.js → chunk-26OP3X5B.js} +2 -2
  14. package/dist/{chunk-VHTFHGVW.js → chunk-2GSEEKQK.js} +51 -51
  15. package/dist/chunk-2GSEEKQK.js.map +1 -0
  16. package/dist/{chunk-FNLGY4UV.js → chunk-2WPTP5HO.js} +2 -2
  17. package/dist/{chunk-MDTKQZC6.js → chunk-3WLO2UKI.js} +2 -2
  18. package/dist/chunk-3ZHMIWSV.js +2 -0
  19. package/dist/chunk-3ZHMIWSV.js.map +1 -0
  20. package/dist/{chunk-YIXQDOPN.js → chunk-4ZX4E7P3.js} +185 -179
  21. package/dist/chunk-4ZX4E7P3.js.map +1 -0
  22. package/dist/chunk-7DXE264B.js +2 -0
  23. package/dist/chunk-7DXE264B.js.map +1 -0
  24. package/dist/chunk-DIV66W3N.js +28 -0
  25. package/dist/chunk-DIV66W3N.js.map +1 -0
  26. package/dist/{chunk-7CVJ4JOE.js → chunk-DLKRPK5M.js} +2 -2
  27. package/dist/chunk-DVNIFP7S.js +23 -0
  28. package/dist/chunk-DVNIFP7S.js.map +1 -0
  29. package/dist/chunk-FULEQYM6.js +13 -0
  30. package/dist/chunk-FULEQYM6.js.map +1 -0
  31. package/dist/chunk-GAGVFSZM.js +15 -0
  32. package/dist/{chunk-ANLKBCYH.js.map → chunk-GAGVFSZM.js.map} +1 -1
  33. package/dist/{chunk-3RHPZXCR.js → chunk-GCHUE3TN.js} +2 -2
  34. package/dist/chunk-GIK7S3OY.js +19 -0
  35. package/dist/chunk-GIK7S3OY.js.map +1 -0
  36. package/dist/{chunk-J63MRNXF.js → chunk-HEQPHUTR.js} +2 -2
  37. package/dist/{chunk-KTM7HSEB.js → chunk-LDILAHMN.js} +2 -2
  38. package/dist/{chunk-V7FYSZSV.js → chunk-LQRBGQIR.js} +2 -2
  39. package/dist/chunk-LQRBGQIR.js.map +1 -0
  40. package/dist/{chunk-LYOXXD4T.js → chunk-M5R3PWW5.js} +2 -2
  41. package/dist/{chunk-BJWK7FPT.js → chunk-MLLEOFX2.js} +2 -2
  42. package/dist/{chunk-QURVHYBP.js → chunk-OZX7HVHC.js} +168 -165
  43. package/dist/chunk-OZX7HVHC.js.map +1 -0
  44. package/dist/chunk-P5JXQRBH.js +7 -0
  45. package/dist/chunk-P5JXQRBH.js.map +1 -0
  46. package/dist/{schedule-tool-6SNLG2NA.js → chunk-P7MR53U7.js} +3 -3
  47. package/dist/{schedule-tool-6SNLG2NA.js.map → chunk-P7MR53U7.js.map} +1 -1
  48. package/dist/chunk-RKPAVWXF.js +2 -0
  49. package/dist/chunk-RKPAVWXF.js.map +1 -0
  50. package/dist/{chunk-VZDKE2EZ.js → chunk-RYLTCOYE.js} +2 -2
  51. package/dist/{chunk-XMWOV2D5.js → chunk-SL657MIM.js} +2 -2
  52. package/dist/chunk-WMI5B36E.js +5 -0
  53. package/dist/{chunk-BHPIAG3E.js.map → chunk-WMI5B36E.js.map} +1 -1
  54. package/dist/{chunk-NXJBAKBR.js → chunk-XM7ZQW4F.js} +2 -2
  55. package/dist/{chunk-XMRI32CY.js → chunk-ZUZESPCH.js} +61 -71
  56. package/dist/chunk-ZUZESPCH.js.map +1 -0
  57. package/dist/cli.js +1 -1
  58. package/dist/cli.js.map +1 -1
  59. package/dist/client-6HCY7UMW.js +2 -0
  60. package/dist/{compaction-QXU3A4LQ.js → compaction-U5SAYTX6.js} +2 -2
  61. package/dist/config-ROQ4VEU3.js +2 -0
  62. package/dist/config-mutator-ML4BAOFT.js +2 -0
  63. package/dist/doctor-3HWGAPET.js +2 -0
  64. package/dist/index.d.ts +258 -0
  65. package/dist/index.js +1 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/memory-extract-YZI2QZVR.js +2 -0
  68. package/dist/processes-XWRGOLMT.js +2 -0
  69. package/dist/program-JLZOHWIU.js +2 -0
  70. package/dist/{promote-RNSGW4AJ.js → promote-YGNTKEXI.js} +2 -2
  71. package/dist/query-V76JDSOC.js +2 -0
  72. package/dist/registry-DKN4HEI3.js +2 -0
  73. package/dist/{request-planner-5354IOYM.js → request-planner-FAFNFVFX.js} +2 -2
  74. package/dist/{review-candidates-UTWMO7UO.js → review-candidates-2XKJ2R6U.js} +2 -2
  75. package/dist/{routing-JGNWB6VJ.js → routing-PUPVGJ77.js} +2 -2
  76. package/dist/schedule-tool-6J7AHAHH.js +2 -0
  77. package/dist/scheduler-ZHQBSSRH.js +2 -0
  78. package/dist/{seat-STLDEYSO.js → seat-2MW3DEXX.js} +2 -2
  79. package/dist/{select-VP66P6XB.js → select-Q3AGLQQX.js} +2 -2
  80. package/dist/tool-IVUNSAXY.js +2 -0
  81. package/dist/tool-IVUNSAXY.js.map +1 -0
  82. package/dist/wiki-FPX2YBKS.js +2 -0
  83. package/dist/wiki-FPX2YBKS.js.map +1 -0
  84. package/package.json +1 -1
  85. package/dist/board-dashboard-4LAQOB74.js.map +0 -1
  86. package/dist/chunk-7L6M3P2N.js +0 -13
  87. package/dist/chunk-7L6M3P2N.js.map +0 -1
  88. package/dist/chunk-ANLKBCYH.js +0 -15
  89. package/dist/chunk-BHPIAG3E.js +0 -5
  90. package/dist/chunk-CQR6C5FU.js +0 -23
  91. package/dist/chunk-CQR6C5FU.js.map +0 -1
  92. package/dist/chunk-FQBPSL36.js +0 -25
  93. package/dist/chunk-FQBPSL36.js.map +0 -1
  94. package/dist/chunk-FXGSSZAP.js +0 -9
  95. package/dist/chunk-FXGSSZAP.js.map +0 -1
  96. package/dist/chunk-OSSI6R4K.js +0 -2
  97. package/dist/chunk-OSSI6R4K.js.map +0 -1
  98. package/dist/chunk-QURVHYBP.js.map +0 -1
  99. package/dist/chunk-V7FYSZSV.js.map +0 -1
  100. package/dist/chunk-VHTFHGVW.js.map +0 -1
  101. package/dist/chunk-W544ZCCO.js +0 -7
  102. package/dist/chunk-W544ZCCO.js.map +0 -1
  103. package/dist/chunk-XMRI32CY.js.map +0 -1
  104. package/dist/chunk-YIXQDOPN.js.map +0 -1
  105. package/dist/client-LAIP23IP.js +0 -2
  106. package/dist/config-OZ2OOKFA.js +0 -2
  107. package/dist/config-mutator-EUF7QQ4V.js +0 -2
  108. package/dist/doctor-PEE3F5TX.js +0 -2
  109. package/dist/memory-extract-3TO7UC5B.js +0 -2
  110. package/dist/processes-I3XAPHG7.js +0 -2
  111. package/dist/program-PMHQRD5E.js +0 -2
  112. package/dist/query-BOUVRUU4.js +0 -2
  113. package/dist/registry-GGU43EOI.js +0 -2
  114. package/dist/scheduler-N25EAWF6.js +0 -2
  115. package/dist/wiki-SKIIAVCU.js +0 -2
  116. /package/dist/{App-RZDJH6MK.js.map → App-EXB4HP3B.js.map} +0 -0
  117. /package/dist/{ChatApp-6TXOFUDH.js.map → ChatApp-XMNE3SPH.js.map} +0 -0
  118. /package/dist/{agent-I6RXAEXG.js.map → agent-ORYXXL5K.js.map} +0 -0
  119. /package/dist/{chunk-BZLHS3VF.js.map → chunk-26OP3X5B.js.map} +0 -0
  120. /package/dist/{chunk-FNLGY4UV.js.map → chunk-2WPTP5HO.js.map} +0 -0
  121. /package/dist/{chunk-MDTKQZC6.js.map → chunk-3WLO2UKI.js.map} +0 -0
  122. /package/dist/{chunk-7CVJ4JOE.js.map → chunk-DLKRPK5M.js.map} +0 -0
  123. /package/dist/{chunk-3RHPZXCR.js.map → chunk-GCHUE3TN.js.map} +0 -0
  124. /package/dist/{chunk-J63MRNXF.js.map → chunk-HEQPHUTR.js.map} +0 -0
  125. /package/dist/{chunk-KTM7HSEB.js.map → chunk-LDILAHMN.js.map} +0 -0
  126. /package/dist/{chunk-LYOXXD4T.js.map → chunk-M5R3PWW5.js.map} +0 -0
  127. /package/dist/{chunk-BJWK7FPT.js.map → chunk-MLLEOFX2.js.map} +0 -0
  128. /package/dist/{chunk-VZDKE2EZ.js.map → chunk-RYLTCOYE.js.map} +0 -0
  129. /package/dist/{chunk-XMWOV2D5.js.map → chunk-SL657MIM.js.map} +0 -0
  130. /package/dist/{chunk-NXJBAKBR.js.map → chunk-XM7ZQW4F.js.map} +0 -0
  131. /package/dist/{client-LAIP23IP.js.map → client-6HCY7UMW.js.map} +0 -0
  132. /package/dist/{compaction-QXU3A4LQ.js.map → compaction-U5SAYTX6.js.map} +0 -0
  133. /package/dist/{config-OZ2OOKFA.js.map → config-ROQ4VEU3.js.map} +0 -0
  134. /package/dist/{config-mutator-EUF7QQ4V.js.map → config-mutator-ML4BAOFT.js.map} +0 -0
  135. /package/dist/{doctor-PEE3F5TX.js.map → doctor-3HWGAPET.js.map} +0 -0
  136. /package/dist/{memory-extract-3TO7UC5B.js.map → memory-extract-YZI2QZVR.js.map} +0 -0
  137. /package/dist/{processes-I3XAPHG7.js.map → processes-XWRGOLMT.js.map} +0 -0
  138. /package/dist/{program-PMHQRD5E.js.map → program-JLZOHWIU.js.map} +0 -0
  139. /package/dist/{promote-RNSGW4AJ.js.map → promote-YGNTKEXI.js.map} +0 -0
  140. /package/dist/{query-BOUVRUU4.js.map → query-V76JDSOC.js.map} +0 -0
  141. /package/dist/{registry-GGU43EOI.js.map → registry-DKN4HEI3.js.map} +0 -0
  142. /package/dist/{request-planner-5354IOYM.js.map → request-planner-FAFNFVFX.js.map} +0 -0
  143. /package/dist/{review-candidates-UTWMO7UO.js.map → review-candidates-2XKJ2R6U.js.map} +0 -0
  144. /package/dist/{routing-JGNWB6VJ.js.map → routing-PUPVGJ77.js.map} +0 -0
  145. /package/dist/{scheduler-N25EAWF6.js.map → schedule-tool-6J7AHAHH.js.map} +0 -0
  146. /package/dist/{seat-STLDEYSO.js.map → scheduler-ZHQBSSRH.js.map} +0 -0
  147. /package/dist/{wiki-SKIIAVCU.js.map → seat-2MW3DEXX.js.map} +0 -0
  148. /package/dist/{select-VP66P6XB.js.map → select-Q3AGLQQX.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as n}from"./chunk-QURVHYBP.js";import"./chunk-BHPIAG3E.js";import"./chunk-VHTFHGVW.js";import"./chunk-SFLF64Q3.js";import"./chunk-7CVJ4JOE.js";import"./chunk-W544ZCCO.js";import"./chunk-OSSI6R4K.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-YIXQDOPN.js";import"./chunk-FQBPSL36.js";import"./chunk-FNLGY4UV.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-7L6M3P2N.js";import"./chunk-VZDKE2EZ.js";import"./chunk-3SCPRYJB.js";import"./chunk-FRHSQVFN.js";import"./chunk-L53FTKEP.js";import"./chunk-XMRI32CY.js";import"./chunk-FXGSSZAP.js";import"./chunk-DJQA2CWD.js";import"./chunk-WZGABQ72.js";import"./chunk-DP7RTNDM.js";import"./chunk-XMWOV2D5.js";import"./chunk-SFQUP3BP.js";import"./chunk-LYOXXD4T.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-J63MRNXF.js";import"./chunk-NXJBAKBR.js";import"./chunk-DWADWDMU.js";import"./chunk-CQR6C5FU.js";import"./chunk-VWTBHLMX.js";import"./chunk-BJWK7FPT.js";import"./chunk-KTM7HSEB.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-MDTKQZC6.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-BZLHS3VF.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-ANLKBCYH.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";var r=["SIGINT","SIGTERM"];function o(t=process){for(let i of r)t.on(i,()=>{t.listenerCount(i)<=1&&t.exit(0)})}o();async function s(){let t=await n();if(process.argv.slice(2).length===0){t.outputHelp();return}t.parse()}s();
2
+ import{a as n}from"./chunk-OZX7HVHC.js";import"./chunk-WMI5B36E.js";import"./chunk-2GSEEKQK.js";import"./chunk-SFLF64Q3.js";import"./chunk-DLKRPK5M.js";import"./chunk-P5JXQRBH.js";import"./chunk-RKPAVWXF.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-4ZX4E7P3.js";import"./chunk-DIV66W3N.js";import"./chunk-2WPTP5HO.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-FULEQYM6.js";import"./chunk-RYLTCOYE.js";import"./chunk-3SCPRYJB.js";import"./chunk-FRHSQVFN.js";import"./chunk-L53FTKEP.js";import"./chunk-ZUZESPCH.js";import"./chunk-GIK7S3OY.js";import"./chunk-DJQA2CWD.js";import"./chunk-WZGABQ72.js";import"./chunk-DP7RTNDM.js";import"./chunk-SL657MIM.js";import"./chunk-SFQUP3BP.js";import"./chunk-3ZHMIWSV.js";import"./chunk-M5R3PWW5.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-HEQPHUTR.js";import"./chunk-XM7ZQW4F.js";import"./chunk-DWADWDMU.js";import"./chunk-DVNIFP7S.js";import"./chunk-7DXE264B.js";import"./chunk-VWTBHLMX.js";import"./chunk-MLLEOFX2.js";import"./chunk-LDILAHMN.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-3WLO2UKI.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-26OP3X5B.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-GAGVFSZM.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";var r=["SIGINT","SIGTERM"];function o(t=process){for(let i of r)t.on(i,()=>{t.listenerCount(i)<=1&&t.exit(0)})}o();async function s(){let t=await n();if(process.argv.slice(2).length===0){t.outputHelp();return}t.parse()}s();
3
3
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/signal-exit.ts","../src/cli.ts"],"sourcesContent":["// --- Ctrl-C / SIGTERM for CLI commands ---\n//\n// Short commands should exit at once when stopped. Long-running ones (the\n// daemon above all) install their own handler to finish in-flight work first.\n// The CLI's quick exit used to be registered unconditionally, before the\n// daemon's, and Node runs listeners in registration order — so every stop\n// exited the process before the daemon's drain began and killed in-flight\n// agent tasks mid-turn (#103). Now the quick exit only fires when nobody\n// else handles the signal.\n\ntype SignalTarget = Pick<NodeJS.Process, \"on\" | \"listenerCount\" | \"exit\">\n\nexport const CLI_EXIT_SIGNALS = [\"SIGINT\", \"SIGTERM\"] as const\n\nexport function installCliSignalExit(proc: SignalTarget = process): void {\n for (const sig of CLI_EXIT_SIGNALS) {\n proc.on(sig, () => {\n // This listener is always one of them; anything more means a command\n // is handling the stop itself.\n if (proc.listenerCount(sig) <= 1) proc.exit(0)\n })\n }\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\nimport { installCliSignalExit } from \"@/utils/signal-exit\"\n\ninstallCliSignalExit()\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";wkDAYO,IAAMA,EAAmB,CAAC,SAAU,SAAS,EAE7C,SAASC,EAAqBC,EAAqB,QAAe,CACvE,QAAWC,KAAOH,EAChBE,EAAK,GAAGC,EAAK,IAAM,CAGbD,EAAK,cAAcC,CAAG,GAAK,GAAGD,EAAK,KAAK,CAAC,CAC/C,CAAC,CAEL,CClBAE,EAAqB,EAErB,eAAeC,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["CLI_EXIT_SIGNALS","installCliSignalExit","proc","sig","installCliSignalExit","main","program","buildProgram"]}
1
+ {"version":3,"sources":["../src/utils/signal-exit.ts","../src/cli.ts"],"sourcesContent":["// --- Ctrl-C / SIGTERM for CLI commands ---\n//\n// Short commands should exit at once when stopped. Long-running ones (the\n// daemon above all) install their own handler to finish in-flight work first.\n// The CLI's quick exit used to be registered unconditionally, before the\n// daemon's, and Node runs listeners in registration order — so every stop\n// exited the process before the daemon's drain began and killed in-flight\n// agent tasks mid-turn (#103). Now the quick exit only fires when nobody\n// else handles the signal.\n\ntype SignalTarget = Pick<NodeJS.Process, \"on\" | \"listenerCount\" | \"exit\">\n\nexport const CLI_EXIT_SIGNALS = [\"SIGINT\", \"SIGTERM\"] as const\n\nexport function installCliSignalExit(proc: SignalTarget = process): void {\n for (const sig of CLI_EXIT_SIGNALS) {\n proc.on(sig, () => {\n // This listener is always one of them; anything more means a command\n // is handling the stop itself.\n if (proc.listenerCount(sig) <= 1) proc.exit(0)\n })\n }\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\nimport { installCliSignalExit } from \"@/utils/signal-exit\"\n\ninstallCliSignalExit()\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";goDAYO,IAAMA,EAAmB,CAAC,SAAU,SAAS,EAE7C,SAASC,EAAqBC,EAAqB,QAAe,CACvE,QAAWC,KAAOH,EAChBE,EAAK,GAAGC,EAAK,IAAM,CAGbD,EAAK,cAAcC,CAAG,GAAK,GAAGD,EAAK,KAAK,CAAC,CAC/C,CAAC,CAEL,CClBAE,EAAqB,EAErB,eAAeC,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["CLI_EXIT_SIGNALS","installCliSignalExit","proc","sig","installCliSignalExit","main","program","buildProgram"]}
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-WMI5B36E.js";import"./chunk-GAGVFSZM.js";import"./chunk-FIOB3MEX.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-6HCY7UMW.js.map
@@ -17,7 +17,7 @@ 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-3TO7UC5B.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-YZI2QZVR.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
 
@@ -25,4 +25,4 @@ ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e
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-QXU3A4LQ.js.map
28
+ //# sourceMappingURL=compaction-U5SAYTX6.js.map
@@ -0,0 +1,2 @@
1
+ import{i as a,j as b,k as c,l as d,m as e,n as f,p as g}from"./chunk-GAGVFSZM.js";import"./chunk-FIOB3MEX.js";g();export{a as INTEGRATION_KINDS,b as approvalsConfigSchema,c as daemonConfigSchema,d as expandEnvVars,e as loadDaemonConfig,f as validateWorkspaces};
2
+ //# sourceMappingURL=config-ROQ4VEU3.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-HEQPHUTR.js";import"./chunk-GAGVFSZM.js";import"./chunk-FIOB3MEX.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-ML4BAOFT.js.map
@@ -0,0 +1,2 @@
1
+ import{b as a,c as b,d as c}from"./chunk-P5JXQRBH.js";import"./chunk-FULEQYM6.js";import"./chunk-GAGVFSZM.js";import"./chunk-FIOB3MEX.js";export{b as doctor,a as runDoctorChecks,c as runNotificationChecks};
2
+ //# sourceMappingURL=doctor-3HWGAPET.js.map
package/dist/index.d.ts CHANGED
@@ -3828,6 +3828,86 @@ declare const daemonConfigSchema: z.ZodObject<{
3828
3828
  accountId?: string | undefined;
3829
3829
  } | undefined;
3830
3830
  }>>;
3831
+ approvals: z.ZodDefault<z.ZodObject<{
3832
+ /** A card without an `expires` gets this many days. */
3833
+ defaultExpiryDays: z.ZodDefault<z.ZodNumber>;
3834
+ /** No card waits longer than this, whatever the agent asked for. */
3835
+ maxExpiryDays: z.ZodDefault<z.ZodNumber>;
3836
+ /** How long "later" hides an item. */
3837
+ laterHours: z.ZodDefault<z.ZodNumber>;
3838
+ /** Tell the agent that raised a card when it is decided or expires. */
3839
+ notifyAgent: z.ZodDefault<z.ZodBoolean>;
3840
+ /** At most one message a day: how many are waiting, and the most urgent. */
3841
+ digest: z.ZodDefault<z.ZodObject<{
3842
+ enabled: z.ZodDefault<z.ZodBoolean>;
3843
+ /** Local time, 24-hour HH:MM. */
3844
+ time: z.ZodDefault<z.ZodString>;
3845
+ /** IANA timezone for `time`. Unset: this machine's. */
3846
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
3847
+ /** Where it goes. Unset: notifications.destination. */
3848
+ destination: z.ZodOptional<z.ZodObject<{
3849
+ channel: z.ZodString;
3850
+ chatId: z.ZodString;
3851
+ accountId: z.ZodOptional<z.ZodString>;
3852
+ }, "strip", z.ZodTypeAny, {
3853
+ channel: string;
3854
+ chatId: string;
3855
+ accountId?: string | undefined;
3856
+ }, {
3857
+ channel: string;
3858
+ chatId: string;
3859
+ accountId?: string | undefined;
3860
+ }>>;
3861
+ }, "strip", z.ZodTypeAny, {
3862
+ enabled: boolean;
3863
+ time: string;
3864
+ timezone?: string | undefined;
3865
+ destination?: {
3866
+ channel: string;
3867
+ chatId: string;
3868
+ accountId?: string | undefined;
3869
+ } | undefined;
3870
+ }, {
3871
+ enabled?: boolean | undefined;
3872
+ timezone?: string | undefined;
3873
+ time?: string | undefined;
3874
+ destination?: {
3875
+ channel: string;
3876
+ chatId: string;
3877
+ accountId?: string | undefined;
3878
+ } | undefined;
3879
+ }>>;
3880
+ }, "strip", z.ZodTypeAny, {
3881
+ defaultExpiryDays: number;
3882
+ maxExpiryDays: number;
3883
+ laterHours: number;
3884
+ notifyAgent: boolean;
3885
+ digest: {
3886
+ enabled: boolean;
3887
+ time: string;
3888
+ timezone?: string | undefined;
3889
+ destination?: {
3890
+ channel: string;
3891
+ chatId: string;
3892
+ accountId?: string | undefined;
3893
+ } | undefined;
3894
+ };
3895
+ }, {
3896
+ defaultExpiryDays?: number | undefined;
3897
+ maxExpiryDays?: number | undefined;
3898
+ laterHours?: number | undefined;
3899
+ notifyAgent?: boolean | undefined;
3900
+ digest?: {
3901
+ enabled?: boolean | undefined;
3902
+ timezone?: string | undefined;
3903
+ time?: string | undefined;
3904
+ destination?: {
3905
+ channel: string;
3906
+ chatId: string;
3907
+ accountId?: string | undefined;
3908
+ } | undefined;
3909
+ } | undefined;
3910
+ }>>;
3831
3911
  /** What happens to runs a restart cuts off (agents/resume). Chat messages
3832
3912
  * are resumed in their chat; scheduled jobs never are (the next run
3833
3913
  * covers them); everything else is reported unless its channel is in
@@ -3876,6 +3956,95 @@ declare const daemonConfigSchema: z.ZodObject<{
3876
3956
  windowMinutes?: number | undefined;
3877
3957
  } | undefined;
3878
3958
  }>>;
3959
+ screen: z.ZodDefault<z.ZodObject<{
3960
+ /** Pixel budget for a captured frame; larger captures are downscaled. */
3961
+ maxPixels: z.ZodDefault<z.ZodNumber>;
3962
+ /** Longest a capture waits for a change or for the screen to settle. */
3963
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
3964
+ /** Time between samples while waiting. */
3965
+ intervalMs: z.ZodDefault<z.ZodNumber>;
3966
+ /** Mean difference (0–1) above which two samples count as different. */
3967
+ changeThreshold: z.ZodDefault<z.ZodNumber>;
3968
+ /** How long a region must stay unchanged to count as stable. */
3969
+ stableMs: z.ZodDefault<z.ZodNumber>;
3970
+ /** Named regions in screen points, e.g. { "chat": { x, y, width, height } }.
3971
+ * A name here overrides the built-in region of the same name. */
3972
+ regions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3973
+ x: z.ZodNumber;
3974
+ y: z.ZodNumber;
3975
+ width: z.ZodNumber;
3976
+ height: z.ZodNumber;
3977
+ }, "strip", z.ZodTypeAny, {
3978
+ x: number;
3979
+ y: number;
3980
+ width: number;
3981
+ height: number;
3982
+ }, {
3983
+ x: number;
3984
+ y: number;
3985
+ width: number;
3986
+ height: number;
3987
+ }>>>;
3988
+ /** The last few seconds of a region, kept in memory by the daemon. Off
3989
+ * unless enabled; frames are written out only when asked for. */
3990
+ buffer: z.ZodDefault<z.ZodObject<{
3991
+ enabled: z.ZodDefault<z.ZodBoolean>;
3992
+ seconds: z.ZodDefault<z.ZodNumber>;
3993
+ fps: z.ZodDefault<z.ZodNumber>;
3994
+ region: z.ZodDefault<z.ZodString>;
3995
+ maxPixels: z.ZodDefault<z.ZodNumber>;
3996
+ }, "strip", z.ZodTypeAny, {
3997
+ enabled: boolean;
3998
+ maxPixels: number;
3999
+ seconds: number;
4000
+ fps: number;
4001
+ region: string;
4002
+ }, {
4003
+ enabled?: boolean | undefined;
4004
+ maxPixels?: number | undefined;
4005
+ seconds?: number | undefined;
4006
+ fps?: number | undefined;
4007
+ region?: string | undefined;
4008
+ }>>;
4009
+ }, "strip", z.ZodTypeAny, {
4010
+ timeoutMs: number;
4011
+ maxPixels: number;
4012
+ intervalMs: number;
4013
+ changeThreshold: number;
4014
+ stableMs: number;
4015
+ regions: Record<string, {
4016
+ x: number;
4017
+ y: number;
4018
+ width: number;
4019
+ height: number;
4020
+ }>;
4021
+ buffer: {
4022
+ enabled: boolean;
4023
+ maxPixels: number;
4024
+ seconds: number;
4025
+ fps: number;
4026
+ region: string;
4027
+ };
4028
+ }, {
4029
+ timeoutMs?: number | undefined;
4030
+ maxPixels?: number | undefined;
4031
+ intervalMs?: number | undefined;
4032
+ changeThreshold?: number | undefined;
4033
+ stableMs?: number | undefined;
4034
+ regions?: Record<string, {
4035
+ x: number;
4036
+ y: number;
4037
+ width: number;
4038
+ height: number;
4039
+ }> | undefined;
4040
+ buffer?: {
4041
+ enabled?: boolean | undefined;
4042
+ maxPixels?: number | undefined;
4043
+ seconds?: number | undefined;
4044
+ fps?: number | undefined;
4045
+ region?: string | undefined;
4046
+ } | undefined;
4047
+ }>>;
3879
4048
  mesh: z.ZodDefault<z.ZodObject<{
3880
4049
  enabled: z.ZodDefault<z.ZodBoolean>;
3881
4050
  peers: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -5417,6 +5586,26 @@ declare const daemonConfigSchema: z.ZodObject<{
5417
5586
  draftAgent?: string | undefined;
5418
5587
  reviewAgent?: string | undefined;
5419
5588
  };
5589
+ screen: {
5590
+ timeoutMs: number;
5591
+ maxPixels: number;
5592
+ intervalMs: number;
5593
+ changeThreshold: number;
5594
+ stableMs: number;
5595
+ regions: Record<string, {
5596
+ x: number;
5597
+ y: number;
5598
+ width: number;
5599
+ height: number;
5600
+ }>;
5601
+ buffer: {
5602
+ enabled: boolean;
5603
+ maxPixels: number;
5604
+ seconds: number;
5605
+ fps: number;
5606
+ region: string;
5607
+ };
5608
+ };
5420
5609
  providers: Record<string, {
5421
5610
  apiKey?: string | undefined;
5422
5611
  thinking?: boolean | undefined;
@@ -5607,6 +5796,22 @@ declare const daemonConfigSchema: z.ZodObject<{
5607
5796
  accountId?: string | undefined;
5608
5797
  } | undefined;
5609
5798
  };
5799
+ approvals: {
5800
+ defaultExpiryDays: number;
5801
+ maxExpiryDays: number;
5802
+ laterHours: number;
5803
+ notifyAgent: boolean;
5804
+ digest: {
5805
+ enabled: boolean;
5806
+ time: string;
5807
+ timezone?: string | undefined;
5808
+ destination?: {
5809
+ channel: string;
5810
+ chatId: string;
5811
+ accountId?: string | undefined;
5812
+ } | undefined;
5813
+ };
5814
+ };
5610
5815
  meshVoices: Record<string, {
5611
5816
  system?: string | Record<string, string> | undefined;
5612
5817
  provider?: "system" | "elevenlabs" | undefined;
@@ -5977,6 +6182,26 @@ declare const daemonConfigSchema: z.ZodObject<{
5977
6182
  bm25?: number | undefined;
5978
6183
  } | undefined;
5979
6184
  } | undefined;
6185
+ screen?: {
6186
+ timeoutMs?: number | undefined;
6187
+ maxPixels?: number | undefined;
6188
+ intervalMs?: number | undefined;
6189
+ changeThreshold?: number | undefined;
6190
+ stableMs?: number | undefined;
6191
+ regions?: Record<string, {
6192
+ x: number;
6193
+ y: number;
6194
+ width: number;
6195
+ height: number;
6196
+ }> | undefined;
6197
+ buffer?: {
6198
+ enabled?: boolean | undefined;
6199
+ maxPixels?: number | undefined;
6200
+ seconds?: number | undefined;
6201
+ fps?: number | undefined;
6202
+ region?: string | undefined;
6203
+ } | undefined;
6204
+ } | undefined;
5980
6205
  providers?: Record<string, {
5981
6206
  apiKey?: string | undefined;
5982
6207
  thinking?: boolean | undefined;
@@ -6167,6 +6392,22 @@ declare const daemonConfigSchema: z.ZodObject<{
6167
6392
  accountId?: string | undefined;
6168
6393
  } | undefined;
6169
6394
  } | undefined;
6395
+ approvals?: {
6396
+ defaultExpiryDays?: number | undefined;
6397
+ maxExpiryDays?: number | undefined;
6398
+ laterHours?: number | undefined;
6399
+ notifyAgent?: boolean | undefined;
6400
+ digest?: {
6401
+ enabled?: boolean | undefined;
6402
+ timezone?: string | undefined;
6403
+ time?: string | undefined;
6404
+ destination?: {
6405
+ channel: string;
6406
+ chatId: string;
6407
+ accountId?: string | undefined;
6408
+ } | undefined;
6409
+ } | undefined;
6410
+ } | undefined;
6170
6411
  meshVoices?: Record<string, {
6171
6412
  system?: string | Record<string, string> | undefined;
6172
6413
  provider?: "system" | "elevenlabs" | undefined;
@@ -6753,6 +6994,7 @@ declare class AgentXDaemon {
6753
6994
  private voiceIntros;
6754
6995
  /** Talk mode and task narration: see src/daemon/voice-talk-api.ts. */
6755
6996
  private voiceTalk;
6997
+ private screenBuffer?;
6756
6998
  /** Voice for agents on mesh peers: see src/daemon/voice-mesh-proxy.ts. */
6757
6999
  private voiceMesh;
6758
7000
  /** Persistent-claude process registry. Null when no agent has
@@ -6772,6 +7014,17 @@ declare class AgentXDaemon {
6772
7014
  constructor(configPath?: string);
6773
7015
  start(): Promise<void>;
6774
7016
  stop(): Promise<void>;
7017
+ /** In-flight work the drain waits for: local agent tasks + mesh forwards. */
7018
+ private inflightCounts;
7019
+ /** Set by start(): the same graceful path a SIGTERM takes. */
7020
+ private requestShutdown?;
7021
+ /** Exit code stop() ends with; a self-restart may need a non-zero one. */
7022
+ private exitCode;
7023
+ private selfRestartInfo?;
7024
+ /** "Restart when idle" (dashboard button / POST /daemon/restart). */
7025
+ private idleRestart;
7026
+ /** What runs this daemon, detected once (it can't change while it runs). */
7027
+ private restartService;
6775
7028
  private midnightTimer?;
6776
7029
  /** Set on the first stop signal: new work is refused while tasks drain. */
6777
7030
  private shuttingDown;
@@ -6802,6 +7055,11 @@ declare class AgentXDaemon {
6802
7055
  restartRequired: string[];
6803
7056
  error?: string;
6804
7057
  }>;
7058
+ private approvalsTimer?;
7059
+ private approvalsSweeping;
7060
+ /** Every minute: expire decision cards, tell agents their results, and
7061
+ * send the day's digest when due (src/approvals/sweep.ts). */
7062
+ private startApprovalsSweep;
6805
7063
  private scheduleMidnightHook;
6806
7064
  private runDailyCostReport;
6807
7065
  private startChannels;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-W5C2GDNC.js";import{Y as bt,Z as Tt,_ as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt}from"./chunk-YIXQDOPN.js";import"./chunk-FQBPSL36.js";import"./chunk-FNLGY4UV.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-7L6M3P2N.js";import"./chunk-VZDKE2EZ.js";import"./chunk-3SCPRYJB.js";import"./chunk-FRHSQVFN.js";import"./chunk-L53FTKEP.js";import{O as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-XMRI32CY.js";import"./chunk-FXGSSZAP.js";import"./chunk-DJQA2CWD.js";import"./chunk-WZGABQ72.js";import"./chunk-DP7RTNDM.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-XMWOV2D5.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import{m as ut}from"./chunk-LYOXXD4T.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-J63MRNXF.js";import"./chunk-NXJBAKBR.js";import"./chunk-DWADWDMU.js";import"./chunk-CQR6C5FU.js";import"./chunk-VWTBHLMX.js";import"./chunk-BJWK7FPT.js";import{a as gt,b as ft,e as ht}from"./chunk-KTM7HSEB.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-MDTKQZC6.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-BZLHS3VF.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.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-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{j as tt,l as st,m as ot,o as nt}from"./chunk-ANLKBCYH.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.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 L}from"./chunk-W5C2GDNC.js";import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,ha as bt,ia as Tt,ja as Mt}from"./chunk-4ZX4E7P3.js";import"./chunk-DIV66W3N.js";import"./chunk-2WPTP5HO.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-FULEQYM6.js";import"./chunk-RYLTCOYE.js";import"./chunk-3SCPRYJB.js";import"./chunk-FRHSQVFN.js";import"./chunk-L53FTKEP.js";import{N as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-ZUZESPCH.js";import"./chunk-GIK7S3OY.js";import"./chunk-DJQA2CWD.js";import"./chunk-WZGABQ72.js";import"./chunk-DP7RTNDM.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-SL657MIM.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-3ZHMIWSV.js";import{m as ut}from"./chunk-M5R3PWW5.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-HEQPHUTR.js";import"./chunk-XM7ZQW4F.js";import"./chunk-DWADWDMU.js";import"./chunk-DVNIFP7S.js";import"./chunk-7DXE264B.js";import"./chunk-VWTBHLMX.js";import"./chunk-MLLEOFX2.js";import{a as gt,b as ft,e as ht}from"./chunk-LDILAHMN.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-3WLO2UKI.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-26OP3X5B.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.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-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{k as tt,m as st,n as ot,p as nt}from"./chunk-GAGVFSZM.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.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-BOKE5M5S.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).