agentix-cli 0.188.0 → 0.189.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 (136) hide show
  1. package/dist/{App-WIHCYMHM.js → App-6AHOJ2PO.js} +2 -2
  2. package/dist/{ChatApp-V3UASKNG.js → ChatApp-MVSQX44C.js} +2 -2
  3. package/dist/{absorb-eval-EAGXITJH.js → absorb-eval-PHA44MPA.js} +2 -2
  4. package/dist/{adapter-7IDPCEJ7.js → adapter-RXZGBGFY.js} +2 -2
  5. package/dist/{agent-H75SWYT6.js → agent-4CGWR2XJ.js} +2 -2
  6. package/dist/{board-dashboard-GACKB3WQ.js → board-dashboard-WCRDEXEC.js} +4 -4
  7. package/dist/{chunk-NS2HSAHF.js → chunk-2MFBCDWL.js} +2 -2
  8. package/dist/{chunk-ZFMNH47D.js → chunk-7BA4KCRW.js} +3 -3
  9. package/dist/chunk-7BA4KCRW.js.map +1 -0
  10. package/dist/{chunk-YTS54UZ5.js → chunk-A5KZSTYI.js} +2 -2
  11. package/dist/{chunk-2GIYVYIM.js → chunk-BSQIPD6F.js} +2 -2
  12. package/dist/{chunk-RTIGD4NG.js → chunk-C5OCJCDC.js} +2 -2
  13. package/dist/{chunk-2V6ZGE74.js → chunk-EGKOB3ZM.js} +2 -2
  14. package/dist/{chunk-MYFTR4NH.js → chunk-FKT34MQ7.js} +2 -2
  15. package/dist/{chunk-XCDN62CQ.js → chunk-FM5VBO3D.js} +2 -2
  16. package/dist/{chunk-NHW4IY6N.js → chunk-H7VI7OTS.js} +2 -2
  17. package/dist/{chunk-ZRC2ZHHE.js → chunk-J522P3Z3.js} +2 -2
  18. package/dist/{chunk-NBWSZ53L.js → chunk-JE5KSD6Z.js} +2 -2
  19. package/dist/{chunk-OJ53ATNN.js → chunk-OBVLO6FV.js} +2 -2
  20. package/dist/chunk-POK4IPY3.js +186 -0
  21. package/dist/chunk-POK4IPY3.js.map +1 -0
  22. package/dist/{chunk-V6QFBL6F.js → chunk-QBR6TGRW.js} +3 -3
  23. package/dist/{chunk-LR4QUAJT.js → chunk-SOVWD6TL.js} +2 -2
  24. package/dist/{chunk-A4PW7EIK.js → chunk-U2OGZDAN.js} +2 -2
  25. package/dist/{chunk-56F5UTTA.js → chunk-URWRA3EO.js} +2 -2
  26. package/dist/{chunk-4HYIERJ4.js → chunk-V2O4OQZC.js} +2 -2
  27. package/dist/{chunk-2LTZUZJU.js → chunk-WILRVP4X.js} +2 -2
  28. package/dist/{chunk-V4IOGISL.js → chunk-WXJ25XH2.js} +2 -2
  29. package/dist/chunk-XIGFRLU5.js +112 -0
  30. package/dist/chunk-XIGFRLU5.js.map +1 -0
  31. package/dist/{chunk-WPNMI5PX.js → chunk-XWDLRABN.js} +250 -250
  32. package/dist/chunk-XWDLRABN.js.map +1 -0
  33. package/dist/{chunk-R2KSORSK.js → chunk-YHRQQ4DB.js} +2 -2
  34. package/dist/{chunk-7EMPPP3E.js → chunk-YJDQK22T.js} +2 -2
  35. package/dist/{chunk-PN42ECV3.js → chunk-YLCMN4OA.js} +2 -2
  36. package/dist/{chunk-GSQ2RCOZ.js → chunk-Z55PWDYH.js} +2 -2
  37. package/dist/{chunk-FJMTCU4S.js → chunk-ZJNEJRUU.js} +2 -2
  38. package/dist/{chunk-BITVUKT7.js → chunk-ZYZ4VQUD.js} +2 -2
  39. package/dist/cli.js +1 -1
  40. package/dist/{client-57TCFIV5.js → client-YDESLBEL.js} +2 -2
  41. package/dist/{config-RHCIE7VE.js → config-J7LIYG6O.js} +2 -2
  42. package/dist/{config-mutate-HCYXR2WP.js → config-mutate-WNWJL2BY.js} +2 -2
  43. package/dist/config-mutator-V3PSCM6Q.js +2 -0
  44. package/dist/{contributions-R4HXLJXU.js → contributions-VVKFLXVL.js} +2 -2
  45. package/dist/{doctor-NPHNPYHR.js → doctor-IPU5KA2L.js} +2 -2
  46. package/dist/{follow-up-tool-MC4TBGLP.js → follow-up-tool-NUXHITTB.js} +2 -2
  47. package/dist/{hub-HXVIO4U5.js → hub-4SPXWMRT.js} +2 -2
  48. package/dist/index.d.ts +461 -0
  49. package/dist/index.js +1 -1
  50. package/dist/{program-VPPB36Z2.js → program-YLA7BKIE.js} +245 -244
  51. package/dist/program-YLA7BKIE.js.map +1 -0
  52. package/dist/{promote-D24WO52J.js → promote-A7VZBQUZ.js} +2 -2
  53. package/dist/{query-J5NRZZUQ.js → query-5I6RBPPK.js} +2 -2
  54. package/dist/{query-settings-NT6ACLQY.js → query-settings-QLLC46BO.js} +2 -2
  55. package/dist/{registry-SBIZVSQV.js → registry-J724YF5H.js} +2 -2
  56. package/dist/{request-planner-2CVL22EB.js → request-planner-SF4GYBQE.js} +2 -2
  57. package/dist/{review-candidates-MMNDJOTD.js → review-candidates-KPAZ3FYG.js} +2 -2
  58. package/dist/{routing-KRST324W.js → routing-RUJNJHM6.js} +2 -2
  59. package/dist/schedule-tool-PX5YULLG.js +2 -0
  60. package/dist/{scheduler-GCCE4FQP.js → scheduler-C44WJX4C.js} +2 -2
  61. package/dist/{seat-E6F56TUM.js → seat-QY2GW3FI.js} +2 -2
  62. package/dist/{select-D2VUSUCJ.js → select-XJMJ2XVP.js} +2 -2
  63. package/dist/{set-enabled-GBI7JREU.js → set-enabled-JC3TJ6VZ.js} +2 -2
  64. package/dist/{sprint-tool-HZ24VIC2.js → sprint-tool-NP4WN7KL.js} +2 -2
  65. package/dist/{tool-QLQEYQYM.js → tool-23ODBVYF.js} +2 -2
  66. package/dist/{tool-7BEFI5SJ.js → tool-KHD45TSF.js} +2 -2
  67. package/dist/{tool-OXZ4TQBG.js → tool-LZR4EOQJ.js} +2 -2
  68. package/dist/{wiki-RFDU6SVD.js → wiki-N3JOY2NN.js} +2 -2
  69. package/dist/wiki-enrich-ZNFEO7BX.js +2 -0
  70. package/package.json +1 -1
  71. package/dist/chunk-BZJF7DJR.js +0 -107
  72. package/dist/chunk-BZJF7DJR.js.map +0 -1
  73. package/dist/chunk-UASRZKZQ.js +0 -186
  74. package/dist/chunk-UASRZKZQ.js.map +0 -1
  75. package/dist/chunk-WPNMI5PX.js.map +0 -1
  76. package/dist/chunk-ZFMNH47D.js.map +0 -1
  77. package/dist/config-mutator-JQ2R4J5Z.js +0 -2
  78. package/dist/program-VPPB36Z2.js.map +0 -1
  79. package/dist/schedule-tool-KOFUKVX5.js +0 -2
  80. package/dist/wiki-enrich-LDI67VQU.js +0 -2
  81. /package/dist/{App-WIHCYMHM.js.map → App-6AHOJ2PO.js.map} +0 -0
  82. /package/dist/{ChatApp-V3UASKNG.js.map → ChatApp-MVSQX44C.js.map} +0 -0
  83. /package/dist/{absorb-eval-EAGXITJH.js.map → absorb-eval-PHA44MPA.js.map} +0 -0
  84. /package/dist/{adapter-7IDPCEJ7.js.map → adapter-RXZGBGFY.js.map} +0 -0
  85. /package/dist/{agent-H75SWYT6.js.map → agent-4CGWR2XJ.js.map} +0 -0
  86. /package/dist/{board-dashboard-GACKB3WQ.js.map → board-dashboard-WCRDEXEC.js.map} +0 -0
  87. /package/dist/{chunk-NS2HSAHF.js.map → chunk-2MFBCDWL.js.map} +0 -0
  88. /package/dist/{chunk-YTS54UZ5.js.map → chunk-A5KZSTYI.js.map} +0 -0
  89. /package/dist/{chunk-2GIYVYIM.js.map → chunk-BSQIPD6F.js.map} +0 -0
  90. /package/dist/{chunk-RTIGD4NG.js.map → chunk-C5OCJCDC.js.map} +0 -0
  91. /package/dist/{chunk-2V6ZGE74.js.map → chunk-EGKOB3ZM.js.map} +0 -0
  92. /package/dist/{chunk-MYFTR4NH.js.map → chunk-FKT34MQ7.js.map} +0 -0
  93. /package/dist/{chunk-XCDN62CQ.js.map → chunk-FM5VBO3D.js.map} +0 -0
  94. /package/dist/{chunk-NHW4IY6N.js.map → chunk-H7VI7OTS.js.map} +0 -0
  95. /package/dist/{chunk-ZRC2ZHHE.js.map → chunk-J522P3Z3.js.map} +0 -0
  96. /package/dist/{chunk-NBWSZ53L.js.map → chunk-JE5KSD6Z.js.map} +0 -0
  97. /package/dist/{chunk-OJ53ATNN.js.map → chunk-OBVLO6FV.js.map} +0 -0
  98. /package/dist/{chunk-V6QFBL6F.js.map → chunk-QBR6TGRW.js.map} +0 -0
  99. /package/dist/{chunk-LR4QUAJT.js.map → chunk-SOVWD6TL.js.map} +0 -0
  100. /package/dist/{chunk-A4PW7EIK.js.map → chunk-U2OGZDAN.js.map} +0 -0
  101. /package/dist/{chunk-56F5UTTA.js.map → chunk-URWRA3EO.js.map} +0 -0
  102. /package/dist/{chunk-4HYIERJ4.js.map → chunk-V2O4OQZC.js.map} +0 -0
  103. /package/dist/{chunk-2LTZUZJU.js.map → chunk-WILRVP4X.js.map} +0 -0
  104. /package/dist/{chunk-V4IOGISL.js.map → chunk-WXJ25XH2.js.map} +0 -0
  105. /package/dist/{chunk-R2KSORSK.js.map → chunk-YHRQQ4DB.js.map} +0 -0
  106. /package/dist/{chunk-7EMPPP3E.js.map → chunk-YJDQK22T.js.map} +0 -0
  107. /package/dist/{chunk-PN42ECV3.js.map → chunk-YLCMN4OA.js.map} +0 -0
  108. /package/dist/{chunk-GSQ2RCOZ.js.map → chunk-Z55PWDYH.js.map} +0 -0
  109. /package/dist/{chunk-FJMTCU4S.js.map → chunk-ZJNEJRUU.js.map} +0 -0
  110. /package/dist/{chunk-BITVUKT7.js.map → chunk-ZYZ4VQUD.js.map} +0 -0
  111. /package/dist/{client-57TCFIV5.js.map → client-YDESLBEL.js.map} +0 -0
  112. /package/dist/{config-RHCIE7VE.js.map → config-J7LIYG6O.js.map} +0 -0
  113. /package/dist/{config-mutate-HCYXR2WP.js.map → config-mutate-WNWJL2BY.js.map} +0 -0
  114. /package/dist/{config-mutator-JQ2R4J5Z.js.map → config-mutator-V3PSCM6Q.js.map} +0 -0
  115. /package/dist/{contributions-R4HXLJXU.js.map → contributions-VVKFLXVL.js.map} +0 -0
  116. /package/dist/{doctor-NPHNPYHR.js.map → doctor-IPU5KA2L.js.map} +0 -0
  117. /package/dist/{follow-up-tool-MC4TBGLP.js.map → follow-up-tool-NUXHITTB.js.map} +0 -0
  118. /package/dist/{hub-HXVIO4U5.js.map → hub-4SPXWMRT.js.map} +0 -0
  119. /package/dist/{promote-D24WO52J.js.map → promote-A7VZBQUZ.js.map} +0 -0
  120. /package/dist/{query-J5NRZZUQ.js.map → query-5I6RBPPK.js.map} +0 -0
  121. /package/dist/{query-settings-NT6ACLQY.js.map → query-settings-QLLC46BO.js.map} +0 -0
  122. /package/dist/{registry-SBIZVSQV.js.map → registry-J724YF5H.js.map} +0 -0
  123. /package/dist/{request-planner-2CVL22EB.js.map → request-planner-SF4GYBQE.js.map} +0 -0
  124. /package/dist/{review-candidates-MMNDJOTD.js.map → review-candidates-KPAZ3FYG.js.map} +0 -0
  125. /package/dist/{routing-KRST324W.js.map → routing-RUJNJHM6.js.map} +0 -0
  126. /package/dist/{schedule-tool-KOFUKVX5.js.map → schedule-tool-PX5YULLG.js.map} +0 -0
  127. /package/dist/{scheduler-GCCE4FQP.js.map → scheduler-C44WJX4C.js.map} +0 -0
  128. /package/dist/{seat-E6F56TUM.js.map → seat-QY2GW3FI.js.map} +0 -0
  129. /package/dist/{select-D2VUSUCJ.js.map → select-XJMJ2XVP.js.map} +0 -0
  130. /package/dist/{set-enabled-GBI7JREU.js.map → set-enabled-JC3TJ6VZ.js.map} +0 -0
  131. /package/dist/{sprint-tool-HZ24VIC2.js.map → sprint-tool-NP4WN7KL.js.map} +0 -0
  132. /package/dist/{tool-QLQEYQYM.js.map → tool-23ODBVYF.js.map} +0 -0
  133. /package/dist/{tool-7BEFI5SJ.js.map → tool-KHD45TSF.js.map} +0 -0
  134. /package/dist/{tool-OXZ4TQBG.js.map → tool-LZR4EOQJ.js.map} +0 -0
  135. /package/dist/{wiki-RFDU6SVD.js.map → wiki-N3JOY2NN.js.map} +0 -0
  136. /package/dist/{wiki-enrich-LDI67VQU.js.map → wiki-enrich-ZNFEO7BX.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -6796,6 +6796,155 @@ declare const daemonConfigSchema: z.ZodObject<{
6796
6796
  maxContinuations?: number | undefined;
6797
6797
  } | undefined;
6798
6798
  }>>;
6799
+ /** Admission queue (src/admission, #1521): every new agent session waits
6800
+ * in one priority queue until the node has room (memory, swap, disk,
6801
+ * load), is under its session caps, and the start pace allows it.
6802
+ * Read it with GET /api/queue or `agentx queue`. */
6803
+ admission: z.ZodDefault<z.ZodObject<{
6804
+ enabled: z.ZodDefault<z.ZodBoolean>;
6805
+ /** "observe" only logs what it would hold. */
6806
+ mode: z.ZodDefault<z.ZodEnum<["enforce", "observe"]>>;
6807
+ /** Agent tiers that go through the queue (those that start a local process). */
6808
+ tiers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6809
+ /** Most live sessions on this node; 0 = one per GB above the first 2 GB (min 2). */
6810
+ maxSessions: z.ZodDefault<z.ZodNumber>;
6811
+ /** Owner turns may go this many over maxSessions (never over resources). */
6812
+ ownerExtraSessions: z.ZodDefault<z.ZodNumber>;
6813
+ /** Helper runs started by a running session may go this many over
6814
+ * maxSessions, so parents waiting on helpers cannot fill the node. */
6815
+ delegationHeadroom: z.ZodDefault<z.ZodNumber>;
6816
+ /** Hold below this available memory: the larger of MB and percent. */
6817
+ minAvailableMemoryMB: z.ZodDefault<z.ZodNumber>;
6818
+ minAvailableMemoryPercent: z.ZodDefault<z.ZodNumber>;
6819
+ /** Hold above this swap in use; 0 = half the swap size, or three
6820
+ * quarters of the memory size where swap grows on demand (macOS). */
6821
+ maxSwapUsedMB: z.ZodDefault<z.ZodNumber>;
6822
+ /** Hold below this free disk where the daemon runs; 0 = no check. */
6823
+ minDiskFreeMB: z.ZodDefault<z.ZodNumber>;
6824
+ /** Hold above this 1-minute load average per CPU; 0 = no check. */
6825
+ maxLoadPerCpu: z.ZodDefault<z.ZodNumber>;
6826
+ /** Least seconds between two starts (owner turns excepted). */
6827
+ minStartGapSeconds: z.ZodDefault<z.ZodNumber>;
6828
+ /** After the daemon starts: at most startsPerInterval starts every
6829
+ * intervalSeconds, for windowSeconds (owner turns excepted). */
6830
+ boot: z.ZodDefault<z.ZodObject<{
6831
+ windowSeconds: z.ZodDefault<z.ZodNumber>;
6832
+ startsPerInterval: z.ZodDefault<z.ZodNumber>;
6833
+ intervalSeconds: z.ZodDefault<z.ZodNumber>;
6834
+ }, "strip", z.ZodTypeAny, {
6835
+ windowSeconds: number;
6836
+ startsPerInterval: number;
6837
+ intervalSeconds: number;
6838
+ }, {
6839
+ windowSeconds?: number | undefined;
6840
+ startsPerInterval?: number | undefined;
6841
+ intervalSeconds?: number | undefined;
6842
+ }>>;
6843
+ /** With nothing of ours running, one run starts even when resources
6844
+ * are short: the pressure is not ours. */
6845
+ allowOneWhenIdle: z.ZodDefault<z.ZodBoolean>;
6846
+ /** A run still waiting after this many minutes is refused in plain
6847
+ * words; 0 = wait as long as it takes. */
6848
+ maxWaitMinutes: z.ZodDefault<z.ZodNumber>;
6849
+ /** Seconds between resource re-reads while work waits. */
6850
+ sampleSeconds: z.ZodDefault<z.ZodNumber>;
6851
+ /** Named caps, e.g. { "browser": { "max": 1, "agents": ["web-tester"] } }. */
6852
+ classes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
6853
+ max: z.ZodNumber;
6854
+ agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6855
+ channels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6856
+ }, "strip", z.ZodTypeAny, {
6857
+ max: number;
6858
+ agents?: string[] | undefined;
6859
+ channels?: string[] | undefined;
6860
+ }, {
6861
+ max: number;
6862
+ agents?: string[] | undefined;
6863
+ channels?: string[] | undefined;
6864
+ }>>>;
6865
+ /** Queue order: owner > critical > normal > background, then age. */
6866
+ priority: z.ZodDefault<z.ZodObject<{
6867
+ ownerChannels: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6868
+ /** config.people ids whose turns run at owner priority. */
6869
+ ownerPeople: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6870
+ criticalAgents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6871
+ backgroundChannels: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6872
+ }, "strip", z.ZodTypeAny, {
6873
+ ownerChannels: string[];
6874
+ ownerPeople: string[];
6875
+ criticalAgents: string[];
6876
+ backgroundChannels: string[];
6877
+ }, {
6878
+ ownerChannels?: string[] | undefined;
6879
+ ownerPeople?: string[] | undefined;
6880
+ criticalAgents?: string[] | undefined;
6881
+ backgroundChannels?: string[] | undefined;
6882
+ }>>;
6883
+ }, "strip", z.ZodTypeAny, {
6884
+ enabled: boolean;
6885
+ priority: {
6886
+ ownerChannels: string[];
6887
+ ownerPeople: string[];
6888
+ criticalAgents: string[];
6889
+ backgroundChannels: string[];
6890
+ };
6891
+ mode: "enforce" | "observe";
6892
+ maxWaitMinutes: number;
6893
+ tiers: string[];
6894
+ maxSessions: number;
6895
+ ownerExtraSessions: number;
6896
+ delegationHeadroom: number;
6897
+ minAvailableMemoryMB: number;
6898
+ minAvailableMemoryPercent: number;
6899
+ maxSwapUsedMB: number;
6900
+ minDiskFreeMB: number;
6901
+ maxLoadPerCpu: number;
6902
+ minStartGapSeconds: number;
6903
+ boot: {
6904
+ windowSeconds: number;
6905
+ startsPerInterval: number;
6906
+ intervalSeconds: number;
6907
+ };
6908
+ allowOneWhenIdle: boolean;
6909
+ sampleSeconds: number;
6910
+ classes: Record<string, {
6911
+ max: number;
6912
+ agents?: string[] | undefined;
6913
+ channels?: string[] | undefined;
6914
+ }>;
6915
+ }, {
6916
+ enabled?: boolean | undefined;
6917
+ priority?: {
6918
+ ownerChannels?: string[] | undefined;
6919
+ ownerPeople?: string[] | undefined;
6920
+ criticalAgents?: string[] | undefined;
6921
+ backgroundChannels?: string[] | undefined;
6922
+ } | undefined;
6923
+ mode?: "enforce" | "observe" | undefined;
6924
+ maxWaitMinutes?: number | undefined;
6925
+ tiers?: string[] | undefined;
6926
+ maxSessions?: number | undefined;
6927
+ ownerExtraSessions?: number | undefined;
6928
+ delegationHeadroom?: number | undefined;
6929
+ minAvailableMemoryMB?: number | undefined;
6930
+ minAvailableMemoryPercent?: number | undefined;
6931
+ maxSwapUsedMB?: number | undefined;
6932
+ minDiskFreeMB?: number | undefined;
6933
+ maxLoadPerCpu?: number | undefined;
6934
+ minStartGapSeconds?: number | undefined;
6935
+ boot?: {
6936
+ windowSeconds?: number | undefined;
6937
+ startsPerInterval?: number | undefined;
6938
+ intervalSeconds?: number | undefined;
6939
+ } | undefined;
6940
+ allowOneWhenIdle?: boolean | undefined;
6941
+ sampleSeconds?: number | undefined;
6942
+ classes?: Record<string, {
6943
+ max: number;
6944
+ agents?: string[] | undefined;
6945
+ channels?: string[] | undefined;
6946
+ }> | undefined;
6947
+ }>>;
6799
6948
  /** Stop and resume signals (agents/signals, #857): stop a running task
6800
6949
  * cleanly, keep the agent's resume plan, resume it later. The owner may
6801
6950
  * always signal; an agent may signal tasks it dispatched, or any task
@@ -6850,6 +6999,11 @@ declare const daemonConfigSchema: z.ZodObject<{
6850
6999
  * for staleAfterHours, closes as done with its delegate's link (or
6851
7000
  * marked unproven) instead of coming back to the owner (#1138). */
6852
7001
  settleHandedBack: z.ZodDefault<z.ZodBoolean>;
7002
+ /** An open request with no closeWhen whose home is a GitHub or GitLab
7003
+ * issue, pull or merge request closes as done once that home is merged
7004
+ * or closed as completed (#1522). Requests waiting on the owner are
7005
+ * left. Read as often as requests.checkers.checkEveryMinutes. */
7006
+ homeCloses: z.ZodDefault<z.ZodBoolean>;
6853
7007
  /** One Promise (src/requests/promise.ts, #1138 D): what a closed promise
6854
7008
  * leaves, and whether decision cards are promises too. */
6855
7009
  promises: z.ZodDefault<z.ZodObject<{
@@ -7192,6 +7346,7 @@ declare const daemonConfigSchema: z.ZodObject<{
7192
7346
  timeoutSeconds: number;
7193
7347
  };
7194
7348
  settleHandedBack: boolean;
7349
+ homeCloses: boolean;
7195
7350
  statusDrift: {
7196
7351
  enabled: boolean;
7197
7352
  projects: {
@@ -7267,6 +7422,7 @@ declare const daemonConfigSchema: z.ZodObject<{
7267
7422
  timeoutSeconds?: number | undefined;
7268
7423
  } | undefined;
7269
7424
  settleHandedBack?: boolean | undefined;
7425
+ homeCloses?: boolean | undefined;
7270
7426
  statusDrift?: {
7271
7427
  enabled?: boolean | undefined;
7272
7428
  projects?: {
@@ -10795,6 +10951,7 @@ declare const daemonConfigSchema: z.ZodObject<{
10795
10951
  timeoutSeconds: number;
10796
10952
  };
10797
10953
  settleHandedBack: boolean;
10954
+ homeCloses: boolean;
10798
10955
  statusDrift: {
10799
10956
  enabled: boolean;
10800
10957
  projects: {
@@ -11330,6 +11487,39 @@ declare const daemonConfigSchema: z.ZodObject<{
11330
11487
  };
11331
11488
  drainTimeoutSeconds?: number | undefined;
11332
11489
  };
11490
+ admission: {
11491
+ enabled: boolean;
11492
+ priority: {
11493
+ ownerChannels: string[];
11494
+ ownerPeople: string[];
11495
+ criticalAgents: string[];
11496
+ backgroundChannels: string[];
11497
+ };
11498
+ mode: "enforce" | "observe";
11499
+ maxWaitMinutes: number;
11500
+ tiers: string[];
11501
+ maxSessions: number;
11502
+ ownerExtraSessions: number;
11503
+ delegationHeadroom: number;
11504
+ minAvailableMemoryMB: number;
11505
+ minAvailableMemoryPercent: number;
11506
+ maxSwapUsedMB: number;
11507
+ minDiskFreeMB: number;
11508
+ maxLoadPerCpu: number;
11509
+ minStartGapSeconds: number;
11510
+ boot: {
11511
+ windowSeconds: number;
11512
+ startsPerInterval: number;
11513
+ intervalSeconds: number;
11514
+ };
11515
+ allowOneWhenIdle: boolean;
11516
+ sampleSeconds: number;
11517
+ classes: Record<string, {
11518
+ max: number;
11519
+ agents?: string[] | undefined;
11520
+ channels?: string[] | undefined;
11521
+ }>;
11522
+ };
11333
11523
  signals: {
11334
11524
  enabled: boolean;
11335
11525
  windDownSeconds: number;
@@ -12167,6 +12357,7 @@ declare const daemonConfigSchema: z.ZodObject<{
12167
12357
  timeoutSeconds?: number | undefined;
12168
12358
  } | undefined;
12169
12359
  settleHandedBack?: boolean | undefined;
12360
+ homeCloses?: boolean | undefined;
12170
12361
  statusDrift?: {
12171
12362
  enabled?: boolean | undefined;
12172
12363
  projects?: {
@@ -12695,6 +12886,39 @@ declare const daemonConfigSchema: z.ZodObject<{
12695
12886
  } | undefined;
12696
12887
  drainTimeoutSeconds?: number | undefined;
12697
12888
  } | undefined;
12889
+ admission?: {
12890
+ enabled?: boolean | undefined;
12891
+ priority?: {
12892
+ ownerChannels?: string[] | undefined;
12893
+ ownerPeople?: string[] | undefined;
12894
+ criticalAgents?: string[] | undefined;
12895
+ backgroundChannels?: string[] | undefined;
12896
+ } | undefined;
12897
+ mode?: "enforce" | "observe" | undefined;
12898
+ maxWaitMinutes?: number | undefined;
12899
+ tiers?: string[] | undefined;
12900
+ maxSessions?: number | undefined;
12901
+ ownerExtraSessions?: number | undefined;
12902
+ delegationHeadroom?: number | undefined;
12903
+ minAvailableMemoryMB?: number | undefined;
12904
+ minAvailableMemoryPercent?: number | undefined;
12905
+ maxSwapUsedMB?: number | undefined;
12906
+ minDiskFreeMB?: number | undefined;
12907
+ maxLoadPerCpu?: number | undefined;
12908
+ minStartGapSeconds?: number | undefined;
12909
+ boot?: {
12910
+ windowSeconds?: number | undefined;
12911
+ startsPerInterval?: number | undefined;
12912
+ intervalSeconds?: number | undefined;
12913
+ } | undefined;
12914
+ allowOneWhenIdle?: boolean | undefined;
12915
+ sampleSeconds?: number | undefined;
12916
+ classes?: Record<string, {
12917
+ max: number;
12918
+ agents?: string[] | undefined;
12919
+ channels?: string[] | undefined;
12920
+ }> | undefined;
12921
+ } | undefined;
12698
12922
  signals?: {
12699
12923
  enabled?: boolean | undefined;
12700
12924
  windDownSeconds?: number | undefined;
@@ -18027,6 +18251,238 @@ declare class RunStore {
18027
18251
  private clearIndex;
18028
18252
  }
18029
18253
 
18254
+ interface ResourceSample {
18255
+ at: number;
18256
+ memTotalMB: number;
18257
+ memAvailableMB: number;
18258
+ /** 0 when the node has no swap configured. */
18259
+ swapTotalMB: number;
18260
+ swapUsedMB: number;
18261
+ /** The OS grows swap as it is used (macOS swap files), so the total is
18262
+ * not a fixed size and used/total is always high. */
18263
+ swapGrows: boolean;
18264
+ /** Free space for this user on the disk holding the daemon's folder;
18265
+ * null when it could not be read. */
18266
+ diskFreeMB: number | null;
18267
+ load1: number;
18268
+ cpuCount: number;
18269
+ }
18270
+ /** Caches samples for `ttlMs`; concurrent callers share one reading. */
18271
+ declare class ResourceSampler {
18272
+ private readonly diskPath;
18273
+ private readonly ttlMs;
18274
+ private readonly sample;
18275
+ private last;
18276
+ private pending;
18277
+ constructor(diskPath: string, ttlMs?: number, sample?: (diskPath: string) => Promise<ResourceSample>);
18278
+ latest(): ResourceSample | null;
18279
+ read(now?: number): Promise<ResourceSample>;
18280
+ }
18281
+
18282
+ type AdmissionPriority = "owner" | "critical" | "normal" | "background";
18283
+ interface AdmissionClass {
18284
+ /** Most runs of this class at once on the node. */
18285
+ max: number;
18286
+ /** Agents whose runs belong to the class. */
18287
+ agents?: string[];
18288
+ /** Channels whose runs belong to the class. */
18289
+ channels?: string[];
18290
+ }
18291
+ interface AdmissionSettings {
18292
+ enabled: boolean;
18293
+ /** "observe" logs what it would hold but starts everything. */
18294
+ mode: "enforce" | "observe";
18295
+ /** Agent tiers whose runs go through the queue (the ones that start a
18296
+ * local process); other tiers start at once and are not counted. */
18297
+ tiers: string[];
18298
+ /** Node-wide most live sessions; 0 = one per GB of memory above the
18299
+ * first 2 GB (kept for the system), at least 2. */
18300
+ maxSessions: number;
18301
+ /** Owner runs may go this many over maxSessions (never over resources). */
18302
+ ownerExtraSessions: number;
18303
+ /** Delegated helper runs may go this many over maxSessions. */
18304
+ delegationHeadroom: number;
18305
+ /** Hold below this much available memory: the larger of the two. */
18306
+ minAvailableMemoryMB: number;
18307
+ minAvailableMemoryPercent: number;
18308
+ /** Hold above this much swap in use. 0 = half the swap size, or three
18309
+ * quarters of the memory size where swap grows on demand (macOS). */
18310
+ maxSwapUsedMB: number;
18311
+ /** Hold below this much free disk where the daemon keeps its data; 0 = off. */
18312
+ minDiskFreeMB: number;
18313
+ /** Hold above this 1-minute load average per CPU; 0 = off. */
18314
+ maxLoadPerCpu: number;
18315
+ /** Least time between two starts, any time. A session takes several
18316
+ * seconds to reach its full memory, so the next reading must see it. */
18317
+ minStartGapSeconds: number;
18318
+ /** Warm-up after the daemon starts: at most `startsPerInterval` starts
18319
+ * every `intervalSeconds`, for `windowSeconds`. */
18320
+ boot: {
18321
+ windowSeconds: number;
18322
+ startsPerInterval: number;
18323
+ intervalSeconds: number;
18324
+ };
18325
+ allowOneWhenIdle: boolean;
18326
+ /** A run still waiting after this long is refused in plain words; 0 = never. */
18327
+ maxWaitMinutes: number;
18328
+ /** Seconds between resource re-reads while work is waiting. */
18329
+ sampleSeconds: number;
18330
+ classes: Record<string, AdmissionClass>;
18331
+ priority: {
18332
+ ownerChannels: string[];
18333
+ /** People ids (config.people) whose turns run at owner priority. */
18334
+ ownerPeople: string[];
18335
+ criticalAgents: string[];
18336
+ backgroundChannels: string[];
18337
+ };
18338
+ }
18339
+ interface AdmissionRequest {
18340
+ agentId: string;
18341
+ channel: string;
18342
+ chatId?: string;
18343
+ /** The person behind the turn (config.people id), when known. */
18344
+ person?: string | null;
18345
+ /** The person behind the turn has the owner role. */
18346
+ owner?: boolean;
18347
+ /** A helper run started from inside another run (delegation). */
18348
+ delegated?: boolean;
18349
+ /** Set by the caller to override the computed priority. */
18350
+ priority?: AdmissionPriority;
18351
+ /** Set by the caller to override the class computed from config. */
18352
+ class?: string;
18353
+ /** Short text for the queue view (never the full message). */
18354
+ label?: string;
18355
+ /** The caller's own condition, e.g. "the agent has a free slot". When
18356
+ * false the run keeps waiting, without holding up the runs behind it. */
18357
+ canStart?: () => boolean;
18358
+ /** Called in the same step as admission, before anything else can run:
18359
+ * the place to take the agent's slot. */
18360
+ onStart?: () => void;
18361
+ /** On close, leave this run unanswered (a chat message the router
18362
+ * replays on boot) instead of answering "closed". */
18363
+ keepOnClose?: boolean;
18364
+ signal?: AbortSignal;
18365
+ }
18366
+ interface AdmissionTicket {
18367
+ id: string;
18368
+ /** Idempotent. */
18369
+ release(): void;
18370
+ }
18371
+ type AdmissionOutcome = {
18372
+ ok: true;
18373
+ ticket: AdmissionTicket;
18374
+ } | {
18375
+ ok: false;
18376
+ reason: "caller-gone" | "closed" | "timeout";
18377
+ waitedMs: number;
18378
+ blockedBy: string[];
18379
+ };
18380
+ interface ResourceLimits {
18381
+ minAvailableMemoryMB: number;
18382
+ maxSwapUsedMB: number;
18383
+ minDiskFreeMB: number;
18384
+ maxLoad1: number;
18385
+ }
18386
+ declare class AdmissionQueue {
18387
+ private readonly settings;
18388
+ private readonly sampler;
18389
+ private readonly log;
18390
+ private readonly now;
18391
+ private waiting;
18392
+ private running;
18393
+ private starts;
18394
+ private seq;
18395
+ private pumping;
18396
+ private again;
18397
+ private timer;
18398
+ private closedAt;
18399
+ private lastReasons;
18400
+ private readonly bootAt;
18401
+ constructor(settings: () => AdmissionSettings, sampler: ResourceSampler, log?: (msg: string) => void, now?: () => number);
18402
+ get closed(): boolean;
18403
+ /** Waits until the run may start. A run with keepOnClose is never
18404
+ * answered once the daemon is stopping. */
18405
+ admit(req: AdmissionRequest): Promise<AdmissionOutcome>;
18406
+ /** The daemon is stopping: nothing starts any more. Runs marked
18407
+ * keepOnClose (chat messages) are left unanswered on purpose, so they
18408
+ * keep their unfinished entry in the router's inflight log and are
18409
+ * replayed on boot; every other waiting run is answered "closed", so a
18410
+ * scheduled job logs its run and a calling agent gets a reply. */
18411
+ close(): {
18412
+ kept: number;
18413
+ refused: number;
18414
+ };
18415
+ get waitingCount(): number;
18416
+ private drop;
18417
+ private refuse;
18418
+ private start;
18419
+ private ordered;
18420
+ /** Ms until the pace allows one more start of `priority` (0 = now). */
18421
+ private paceWait;
18422
+ private classCount;
18423
+ /** Starts every waiting run that may start now, in queue order. */
18424
+ pump(): Promise<void>;
18425
+ private pass;
18426
+ private admitEntry;
18427
+ /** Re-checks while work waits: resources change without any release. */
18428
+ private arm;
18429
+ /** What GET /api/queue and `agentx queue` show. */
18430
+ snapshot(): AdmissionSnapshot;
18431
+ /** Reads resources now (the snapshot shows the last reading). */
18432
+ refresh(): Promise<void>;
18433
+ }
18434
+ interface AdmissionSnapshot {
18435
+ enabled: boolean;
18436
+ mode: AdmissionSettings["mode"];
18437
+ /** When the resources shown were read. */
18438
+ checkedAt: string | null;
18439
+ resources: ResourceSample | null;
18440
+ limits: ResourceLimits | null;
18441
+ gate: {
18442
+ open: boolean;
18443
+ reasons: string[];
18444
+ };
18445
+ caps: {
18446
+ maxSessions: number | null;
18447
+ ownerExtraSessions: number;
18448
+ delegationHeadroom: number;
18449
+ classes: Record<string, {
18450
+ max: number;
18451
+ running: number;
18452
+ }>;
18453
+ };
18454
+ warmUp: {
18455
+ active: boolean;
18456
+ until: string;
18457
+ startsPerInterval: number;
18458
+ intervalSeconds: number;
18459
+ };
18460
+ running: Array<{
18461
+ id: string;
18462
+ agentId: string;
18463
+ channel: string;
18464
+ chatId: string | null;
18465
+ priority: AdmissionPriority;
18466
+ class: string | null;
18467
+ label: string;
18468
+ startedAt: string;
18469
+ waitedSeconds: number;
18470
+ }>;
18471
+ waiting: Array<{
18472
+ position: number;
18473
+ id: string;
18474
+ agentId: string;
18475
+ channel: string;
18476
+ chatId: string | null;
18477
+ priority: AdmissionPriority;
18478
+ class: string | null;
18479
+ label: string;
18480
+ waitingSeconds: number;
18481
+ blockedBy: string[];
18482
+ }>;
18483
+ next: AdmissionSnapshot["waiting"][number] | null;
18484
+ }
18485
+
18030
18486
  interface RunningTask {
18031
18487
  /** Unique id for this execution (timestamp-based). */
18032
18488
  id: string;
@@ -18147,6 +18603,9 @@ declare class AgentRegistry {
18147
18603
  * the workflow engine's run store; unset means no wrapping. */
18148
18604
  private workflowRuns?;
18149
18605
  private messageQueue;
18606
+ /** Node-wide admission queue (#1521): every run waits here for room. */
18607
+ readonly admission: AdmissionQueue;
18608
+ private admissionTickets;
18150
18609
  /**
18151
18610
  * Voice chats a waiting question has claimed between its wait ending and
18152
18611
  * the chat being marked running (the rate limiter awaits in between).
@@ -18238,6 +18697,8 @@ declare class AgentRegistry {
18238
18697
  setProviders(next: Record<string, {
18239
18698
  apiKey?: string;
18240
18699
  }>): void;
18700
+ /** The admission settings in force, read on every start. */
18701
+ private admissionSettings;
18241
18702
  /** Hot-swap the live DaemonConfig reference. Registry reads it lazily at
18242
18703
  * execute-time for landscape + session policies, so next-task semantics
18243
18704
  * match setProviders. */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Ja as Tt,Ka as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-WPNMI5PX.js";import"./chunk-ZFMNH47D.js";import"./chunk-GTJIKXDB.js";import"./chunk-NBWSZ53L.js";import"./chunk-ZVP6GB4G.js";import"./chunk-ZRC2ZHHE.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-NHW4IY6N.js";import"./chunk-6V5JBHUN.js";import"./chunk-2VDO2HEK.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-PPUN7YHA.js";import"./chunk-A5GYG56I.js";import"./chunk-2V6ZGE74.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-QPABR72X.js";import"./chunk-V4IOGISL.js";import"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import{m as lt,n as ct,o as dt,p as mt,q as pt,ya as yt}from"./chunk-UASRZKZQ.js";import"./chunk-2GIYVYIM.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-BAXGL6TY.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-2LTZUZJU.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-RTIGD4NG.js";import"./chunk-NS2HSAHF.js";import"./chunk-3UOTLMXD.js";import"./chunk-BE64IJWM.js";import"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-FJMTCU4S.js";import{a as ht}from"./chunk-BITVUKT7.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-V6QFBL6F.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-56F5UTTA.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-R2KSORSK.js";import{j as it,k as rt,l as at}from"./chunk-LR4QUAJT.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-LE3BXIUF.js";import"./chunk-BERWTVG2.js";import"./chunk-AHWWJ7AF.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-DCIYOPJF.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{Gb as nt,vb as tt,xb as st,zb as ot}from"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.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{Ja as Tt,Ka as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-XWDLRABN.js";import"./chunk-7BA4KCRW.js";import"./chunk-GTJIKXDB.js";import"./chunk-JE5KSD6Z.js";import"./chunk-ZVP6GB4G.js";import"./chunk-J522P3Z3.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-H7VI7OTS.js";import"./chunk-6V5JBHUN.js";import"./chunk-2VDO2HEK.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-PPUN7YHA.js";import"./chunk-A5GYG56I.js";import"./chunk-EGKOB3ZM.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-QPABR72X.js";import"./chunk-WXJ25XH2.js";import"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import{m as lt,n as ct,o as dt,p as mt,q as pt,ya as yt}from"./chunk-POK4IPY3.js";import"./chunk-BSQIPD6F.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-BAXGL6TY.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-WILRVP4X.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-C5OCJCDC.js";import"./chunk-2MFBCDWL.js";import"./chunk-3UOTLMXD.js";import"./chunk-BE64IJWM.js";import"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-ZJNEJRUU.js";import{a as ht}from"./chunk-ZYZ4VQUD.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QBR6TGRW.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-URWRA3EO.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-YHRQQ4DB.js";import{j as it,k as rt,l as at}from"./chunk-SOVWD6TL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-LE3BXIUF.js";import"./chunk-BERWTVG2.js";import"./chunk-AHWWJ7AF.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-DCIYOPJF.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{Gb as nt,vb as tt,xb as st,zb as ot}from"./chunk-XIGFRLU5.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.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).