agentix-cli 0.188.1 → 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 (133) hide show
  1. package/dist/{App-TX7LI6KT.js → App-6AHOJ2PO.js} +2 -2
  2. package/dist/{ChatApp-EJ4HFEMK.js → ChatApp-MVSQX44C.js} +2 -2
  3. package/dist/{absorb-eval-VQPH6GEL.js → absorb-eval-PHA44MPA.js} +2 -2
  4. package/dist/{adapter-DOGVLK3V.js → adapter-RXZGBGFY.js} +2 -2
  5. package/dist/{agent-HXMOUQ34.js → agent-4CGWR2XJ.js} +2 -2
  6. package/dist/{board-dashboard-7EU5WG4C.js → board-dashboard-WCRDEXEC.js} +4 -4
  7. package/dist/{chunk-T4UW3PJG.js → chunk-2MFBCDWL.js} +2 -2
  8. package/dist/{chunk-BHAC2CFX.js → chunk-7BA4KCRW.js} +2 -2
  9. package/dist/{chunk-MNXG6R2J.js → chunk-A5KZSTYI.js} +2 -2
  10. package/dist/{chunk-PAXQYM4E.js → chunk-BSQIPD6F.js} +2 -2
  11. package/dist/{chunk-EVF6ER6O.js → chunk-C5OCJCDC.js} +2 -2
  12. package/dist/{chunk-N3YNBFSU.js → chunk-EGKOB3ZM.js} +2 -2
  13. package/dist/{chunk-3DUXFU35.js → chunk-FKT34MQ7.js} +2 -2
  14. package/dist/{chunk-BAFE33EX.js → chunk-FM5VBO3D.js} +2 -2
  15. package/dist/{chunk-PWKSA4NM.js → chunk-H7VI7OTS.js} +2 -2
  16. package/dist/{chunk-KTAVI47Q.js → chunk-J522P3Z3.js} +2 -2
  17. package/dist/{chunk-AKXVFCGZ.js → chunk-JE5KSD6Z.js} +2 -2
  18. package/dist/{chunk-DE7GI62O.js → chunk-OBVLO6FV.js} +2 -2
  19. package/dist/chunk-POK4IPY3.js +186 -0
  20. package/dist/chunk-POK4IPY3.js.map +1 -0
  21. package/dist/{chunk-QNDCZLTP.js → chunk-QBR6TGRW.js} +3 -3
  22. package/dist/{chunk-7BHYORYO.js → chunk-SOVWD6TL.js} +2 -2
  23. package/dist/{chunk-6HL5SXWI.js → chunk-U2OGZDAN.js} +2 -2
  24. package/dist/{chunk-WB2NS2XC.js → chunk-URWRA3EO.js} +2 -2
  25. package/dist/{chunk-3TMNWRDV.js → chunk-V2O4OQZC.js} +2 -2
  26. package/dist/{chunk-SWSBKCFH.js → chunk-WILRVP4X.js} +2 -2
  27. package/dist/{chunk-JFPBBLFG.js → chunk-WXJ25XH2.js} +2 -2
  28. package/dist/{chunk-OTRWL5YQ.js → chunk-XIGFRLU5.js} +11 -11
  29. package/dist/{chunk-OTRWL5YQ.js.map → chunk-XIGFRLU5.js.map} +1 -1
  30. package/dist/{chunk-ONQVHC5P.js → chunk-XWDLRABN.js} +7 -7
  31. package/dist/chunk-XWDLRABN.js.map +1 -0
  32. package/dist/{chunk-MKKNFUXP.js → chunk-YHRQQ4DB.js} +2 -2
  33. package/dist/{chunk-MUNNOE5V.js → chunk-YJDQK22T.js} +2 -2
  34. package/dist/{chunk-IPC3DD7K.js → chunk-YLCMN4OA.js} +2 -2
  35. package/dist/{chunk-BEJJADMD.js → chunk-Z55PWDYH.js} +2 -2
  36. package/dist/{chunk-2G2QFSFG.js → chunk-ZJNEJRUU.js} +2 -2
  37. package/dist/{chunk-ARPMEYAH.js → chunk-ZYZ4VQUD.js} +2 -2
  38. package/dist/cli.js +1 -1
  39. package/dist/{client-TRY2JBXV.js → client-YDESLBEL.js} +2 -2
  40. package/dist/{config-TRQM7YIS.js → config-J7LIYG6O.js} +2 -2
  41. package/dist/{config-mutate-JY7YREIC.js → config-mutate-WNWJL2BY.js} +2 -2
  42. package/dist/config-mutator-V3PSCM6Q.js +2 -0
  43. package/dist/{contributions-VCUTJ55I.js → contributions-VVKFLXVL.js} +2 -2
  44. package/dist/{doctor-QYEW3VAN.js → doctor-IPU5KA2L.js} +2 -2
  45. package/dist/{follow-up-tool-JCOV7J7F.js → follow-up-tool-NUXHITTB.js} +2 -2
  46. package/dist/{hub-TMMQVLKT.js → hub-4SPXWMRT.js} +2 -2
  47. package/dist/index.d.ts +452 -0
  48. package/dist/index.js +1 -1
  49. package/dist/{program-PY3QQUNQ.js → program-YLA7BKIE.js} +242 -241
  50. package/dist/program-YLA7BKIE.js.map +1 -0
  51. package/dist/{promote-G6HCAXBM.js → promote-A7VZBQUZ.js} +2 -2
  52. package/dist/{query-DJHRLQPO.js → query-5I6RBPPK.js} +2 -2
  53. package/dist/{query-settings-ZRUX4KFX.js → query-settings-QLLC46BO.js} +2 -2
  54. package/dist/{registry-2ZDQB6OB.js → registry-J724YF5H.js} +2 -2
  55. package/dist/{request-planner-P7LA3Y3G.js → request-planner-SF4GYBQE.js} +2 -2
  56. package/dist/{review-candidates-N476JBOT.js → review-candidates-KPAZ3FYG.js} +2 -2
  57. package/dist/{routing-KE6HJUXN.js → routing-RUJNJHM6.js} +2 -2
  58. package/dist/schedule-tool-PX5YULLG.js +2 -0
  59. package/dist/{scheduler-4G55ZZVP.js → scheduler-C44WJX4C.js} +2 -2
  60. package/dist/{seat-P5AHZ552.js → seat-QY2GW3FI.js} +2 -2
  61. package/dist/{select-AMHQBDNY.js → select-XJMJ2XVP.js} +2 -2
  62. package/dist/{set-enabled-RPQVY3WC.js → set-enabled-JC3TJ6VZ.js} +2 -2
  63. package/dist/{sprint-tool-V6CC54SR.js → sprint-tool-NP4WN7KL.js} +2 -2
  64. package/dist/{tool-C24RZAGA.js → tool-23ODBVYF.js} +2 -2
  65. package/dist/{tool-SIDS4E4E.js → tool-KHD45TSF.js} +2 -2
  66. package/dist/{tool-XXIBUQ6F.js → tool-LZR4EOQJ.js} +2 -2
  67. package/dist/{wiki-6ALVJE7O.js → wiki-N3JOY2NN.js} +2 -2
  68. package/dist/wiki-enrich-ZNFEO7BX.js +2 -0
  69. package/package.json +1 -1
  70. package/dist/chunk-7ZBRCRQL.js +0 -186
  71. package/dist/chunk-7ZBRCRQL.js.map +0 -1
  72. package/dist/chunk-ONQVHC5P.js.map +0 -1
  73. package/dist/config-mutator-7PFJYQR5.js +0 -2
  74. package/dist/program-PY3QQUNQ.js.map +0 -1
  75. package/dist/schedule-tool-CUT4S7D7.js +0 -2
  76. package/dist/wiki-enrich-H5NOCWM2.js +0 -2
  77. /package/dist/{App-TX7LI6KT.js.map → App-6AHOJ2PO.js.map} +0 -0
  78. /package/dist/{ChatApp-EJ4HFEMK.js.map → ChatApp-MVSQX44C.js.map} +0 -0
  79. /package/dist/{absorb-eval-VQPH6GEL.js.map → absorb-eval-PHA44MPA.js.map} +0 -0
  80. /package/dist/{adapter-DOGVLK3V.js.map → adapter-RXZGBGFY.js.map} +0 -0
  81. /package/dist/{agent-HXMOUQ34.js.map → agent-4CGWR2XJ.js.map} +0 -0
  82. /package/dist/{board-dashboard-7EU5WG4C.js.map → board-dashboard-WCRDEXEC.js.map} +0 -0
  83. /package/dist/{chunk-T4UW3PJG.js.map → chunk-2MFBCDWL.js.map} +0 -0
  84. /package/dist/{chunk-BHAC2CFX.js.map → chunk-7BA4KCRW.js.map} +0 -0
  85. /package/dist/{chunk-MNXG6R2J.js.map → chunk-A5KZSTYI.js.map} +0 -0
  86. /package/dist/{chunk-PAXQYM4E.js.map → chunk-BSQIPD6F.js.map} +0 -0
  87. /package/dist/{chunk-EVF6ER6O.js.map → chunk-C5OCJCDC.js.map} +0 -0
  88. /package/dist/{chunk-N3YNBFSU.js.map → chunk-EGKOB3ZM.js.map} +0 -0
  89. /package/dist/{chunk-3DUXFU35.js.map → chunk-FKT34MQ7.js.map} +0 -0
  90. /package/dist/{chunk-BAFE33EX.js.map → chunk-FM5VBO3D.js.map} +0 -0
  91. /package/dist/{chunk-PWKSA4NM.js.map → chunk-H7VI7OTS.js.map} +0 -0
  92. /package/dist/{chunk-KTAVI47Q.js.map → chunk-J522P3Z3.js.map} +0 -0
  93. /package/dist/{chunk-AKXVFCGZ.js.map → chunk-JE5KSD6Z.js.map} +0 -0
  94. /package/dist/{chunk-DE7GI62O.js.map → chunk-OBVLO6FV.js.map} +0 -0
  95. /package/dist/{chunk-QNDCZLTP.js.map → chunk-QBR6TGRW.js.map} +0 -0
  96. /package/dist/{chunk-7BHYORYO.js.map → chunk-SOVWD6TL.js.map} +0 -0
  97. /package/dist/{chunk-6HL5SXWI.js.map → chunk-U2OGZDAN.js.map} +0 -0
  98. /package/dist/{chunk-WB2NS2XC.js.map → chunk-URWRA3EO.js.map} +0 -0
  99. /package/dist/{chunk-3TMNWRDV.js.map → chunk-V2O4OQZC.js.map} +0 -0
  100. /package/dist/{chunk-SWSBKCFH.js.map → chunk-WILRVP4X.js.map} +0 -0
  101. /package/dist/{chunk-JFPBBLFG.js.map → chunk-WXJ25XH2.js.map} +0 -0
  102. /package/dist/{chunk-MKKNFUXP.js.map → chunk-YHRQQ4DB.js.map} +0 -0
  103. /package/dist/{chunk-MUNNOE5V.js.map → chunk-YJDQK22T.js.map} +0 -0
  104. /package/dist/{chunk-IPC3DD7K.js.map → chunk-YLCMN4OA.js.map} +0 -0
  105. /package/dist/{chunk-BEJJADMD.js.map → chunk-Z55PWDYH.js.map} +0 -0
  106. /package/dist/{chunk-2G2QFSFG.js.map → chunk-ZJNEJRUU.js.map} +0 -0
  107. /package/dist/{chunk-ARPMEYAH.js.map → chunk-ZYZ4VQUD.js.map} +0 -0
  108. /package/dist/{client-TRY2JBXV.js.map → client-YDESLBEL.js.map} +0 -0
  109. /package/dist/{config-TRQM7YIS.js.map → config-J7LIYG6O.js.map} +0 -0
  110. /package/dist/{config-mutate-JY7YREIC.js.map → config-mutate-WNWJL2BY.js.map} +0 -0
  111. /package/dist/{config-mutator-7PFJYQR5.js.map → config-mutator-V3PSCM6Q.js.map} +0 -0
  112. /package/dist/{contributions-VCUTJ55I.js.map → contributions-VVKFLXVL.js.map} +0 -0
  113. /package/dist/{doctor-QYEW3VAN.js.map → doctor-IPU5KA2L.js.map} +0 -0
  114. /package/dist/{follow-up-tool-JCOV7J7F.js.map → follow-up-tool-NUXHITTB.js.map} +0 -0
  115. /package/dist/{hub-TMMQVLKT.js.map → hub-4SPXWMRT.js.map} +0 -0
  116. /package/dist/{promote-G6HCAXBM.js.map → promote-A7VZBQUZ.js.map} +0 -0
  117. /package/dist/{query-DJHRLQPO.js.map → query-5I6RBPPK.js.map} +0 -0
  118. /package/dist/{query-settings-ZRUX4KFX.js.map → query-settings-QLLC46BO.js.map} +0 -0
  119. /package/dist/{registry-2ZDQB6OB.js.map → registry-J724YF5H.js.map} +0 -0
  120. /package/dist/{request-planner-P7LA3Y3G.js.map → request-planner-SF4GYBQE.js.map} +0 -0
  121. /package/dist/{review-candidates-N476JBOT.js.map → review-candidates-KPAZ3FYG.js.map} +0 -0
  122. /package/dist/{routing-KE6HJUXN.js.map → routing-RUJNJHM6.js.map} +0 -0
  123. /package/dist/{schedule-tool-CUT4S7D7.js.map → schedule-tool-PX5YULLG.js.map} +0 -0
  124. /package/dist/{scheduler-4G55ZZVP.js.map → scheduler-C44WJX4C.js.map} +0 -0
  125. /package/dist/{seat-P5AHZ552.js.map → seat-QY2GW3FI.js.map} +0 -0
  126. /package/dist/{select-AMHQBDNY.js.map → select-XJMJ2XVP.js.map} +0 -0
  127. /package/dist/{set-enabled-RPQVY3WC.js.map → set-enabled-JC3TJ6VZ.js.map} +0 -0
  128. /package/dist/{sprint-tool-V6CC54SR.js.map → sprint-tool-NP4WN7KL.js.map} +0 -0
  129. /package/dist/{tool-C24RZAGA.js.map → tool-23ODBVYF.js.map} +0 -0
  130. /package/dist/{tool-SIDS4E4E.js.map → tool-KHD45TSF.js.map} +0 -0
  131. /package/dist/{tool-XXIBUQ6F.js.map → tool-LZR4EOQJ.js.map} +0 -0
  132. /package/dist/{wiki-6ALVJE7O.js.map → wiki-N3JOY2NN.js.map} +0 -0
  133. /package/dist/{wiki-enrich-H5NOCWM2.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
@@ -11338,6 +11487,39 @@ declare const daemonConfigSchema: z.ZodObject<{
11338
11487
  };
11339
11488
  drainTimeoutSeconds?: number | undefined;
11340
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
+ };
11341
11523
  signals: {
11342
11524
  enabled: boolean;
11343
11525
  windDownSeconds: number;
@@ -12704,6 +12886,39 @@ declare const daemonConfigSchema: z.ZodObject<{
12704
12886
  } | undefined;
12705
12887
  drainTimeoutSeconds?: number | undefined;
12706
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;
12707
12922
  signals?: {
12708
12923
  enabled?: boolean | undefined;
12709
12924
  windDownSeconds?: number | undefined;
@@ -18036,6 +18251,238 @@ declare class RunStore {
18036
18251
  private clearIndex;
18037
18252
  }
18038
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
+
18039
18486
  interface RunningTask {
18040
18487
  /** Unique id for this execution (timestamp-based). */
18041
18488
  id: string;
@@ -18156,6 +18603,9 @@ declare class AgentRegistry {
18156
18603
  * the workflow engine's run store; unset means no wrapping. */
18157
18604
  private workflowRuns?;
18158
18605
  private messageQueue;
18606
+ /** Node-wide admission queue (#1521): every run waits here for room. */
18607
+ readonly admission: AdmissionQueue;
18608
+ private admissionTickets;
18159
18609
  /**
18160
18610
  * Voice chats a waiting question has claimed between its wait ending and
18161
18611
  * the chat being marked running (the rate limiter awaits in between).
@@ -18247,6 +18697,8 @@ declare class AgentRegistry {
18247
18697
  setProviders(next: Record<string, {
18248
18698
  apiKey?: string;
18249
18699
  }>): void;
18700
+ /** The admission settings in force, read on every start. */
18701
+ private admissionSettings;
18250
18702
  /** Hot-swap the live DaemonConfig reference. Registry reads it lazily at
18251
18703
  * execute-time for landscape + session policies, so next-task semantics
18252
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-ONQVHC5P.js";import"./chunk-BHAC2CFX.js";import"./chunk-GTJIKXDB.js";import"./chunk-AKXVFCGZ.js";import"./chunk-ZVP6GB4G.js";import"./chunk-KTAVI47Q.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-PWKSA4NM.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-N3YNBFSU.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-JFPBBLFG.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-7ZBRCRQL.js";import"./chunk-PAXQYM4E.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-SWSBKCFH.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-EVF6ER6O.js";import"./chunk-T4UW3PJG.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-2G2QFSFG.js";import{a as ht}from"./chunk-ARPMEYAH.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QNDCZLTP.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-WB2NS2XC.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-MKKNFUXP.js";import{j as it,k as rt,l as at}from"./chunk-7BHYORYO.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-OTRWL5YQ.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).