agentix-cli 0.206.0 → 0.206.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/{App-JDW5V4HT.js → App-IEUOKINQ.js} +2 -2
  2. package/dist/{ChatApp-SNM2PORO.js → ChatApp-CCDBG6YZ.js} +2 -2
  3. package/dist/{absorb-eval-WDAV4AI2.js → absorb-eval-IIF7CY3Q.js} +2 -2
  4. package/dist/{adapter-C47BTKT6.js → adapter-LTHULD3D.js} +2 -2
  5. package/dist/{agent-EVMKJXJO.js → agent-TZ3GGNS5.js} +2 -2
  6. package/dist/{board-dashboard-EUWXJNDW.js → board-dashboard-JS6OJDH6.js} +29 -29
  7. package/dist/{chunk-USFOOYPM.js → chunk-37EABHYL.js} +2 -2
  8. package/dist/chunk-3AHYZLGE.js +115 -0
  9. package/dist/chunk-3AHYZLGE.js.map +1 -0
  10. package/dist/{chunk-PQUK6XEW.js → chunk-6U34GZ7U.js} +2 -2
  11. package/dist/{chunk-MF46BC7J.js → chunk-6ZVVAGTR.js} +2 -2
  12. package/dist/{chunk-IU63JGY3.js → chunk-7GD5GTWC.js} +2 -2
  13. package/dist/{chunk-EJFPXG6I.js → chunk-7JHB3X5N.js} +16 -16
  14. package/dist/{chunk-EJFPXG6I.js.map → chunk-7JHB3X5N.js.map} +1 -1
  15. package/dist/{chunk-SKCOIP5R.js → chunk-A2K6C6W3.js} +3 -3
  16. package/dist/{chunk-OLKYIKAZ.js → chunk-B35GIWMR.js} +2 -2
  17. package/dist/{chunk-DUCYRNCT.js → chunk-CARVBJB7.js} +20 -20
  18. package/dist/chunk-CARVBJB7.js.map +1 -0
  19. package/dist/{chunk-KRHVM26D.js → chunk-E2MW5OCE.js} +2 -2
  20. package/dist/{chunk-WJMYBRM5.js → chunk-FXA2WIIP.js} +2 -2
  21. package/dist/{chunk-V5LRR5I5.js → chunk-GCBFLU64.js} +10 -10
  22. package/dist/{chunk-TH2W2545.js → chunk-GJOKXP5D.js} +2 -2
  23. package/dist/{chunk-PQX2VJUA.js → chunk-I4753XPP.js} +45 -45
  24. package/dist/chunk-I4753XPP.js.map +1 -0
  25. package/dist/{chunk-2VSK6FAR.js → chunk-I74PTSUQ.js} +2 -2
  26. package/dist/{chunk-ERVJLPS4.js → chunk-JDU4CXGC.js} +2 -2
  27. package/dist/{chunk-DV42WUMD.js → chunk-K435U2FC.js} +2 -2
  28. package/dist/chunk-KEUW6YLL.js +2 -0
  29. package/dist/{chunk-VJ5HC63R.js.map → chunk-KEUW6YLL.js.map} +1 -1
  30. package/dist/{chunk-DOO4MUTS.js → chunk-KXMC7Z5X.js} +2 -2
  31. package/dist/chunk-LY4G7PCW.js +2 -0
  32. package/dist/chunk-LY4G7PCW.js.map +1 -0
  33. package/dist/{chunk-5STGF4MI.js → chunk-M37WJANA.js} +88 -88
  34. package/dist/chunk-M37WJANA.js.map +1 -0
  35. package/dist/{chunk-CXFVIDJV.js → chunk-R6XJWFMC.js} +2 -2
  36. package/dist/{chunk-245IOYDJ.js → chunk-RPL2P7EP.js} +2 -2
  37. package/dist/{chunk-UGRMFQAG.js → chunk-RRLQTU3X.js} +2 -2
  38. package/dist/{chunk-3B5HSNOF.js → chunk-TLRTJV2U.js} +311 -303
  39. package/dist/chunk-TLRTJV2U.js.map +1 -0
  40. package/dist/{chunk-JT5PIBCM.js → chunk-U3OJO7B7.js} +2 -2
  41. package/dist/{chunk-RXX4MYFL.js → chunk-UN7D7HWU.js} +2 -2
  42. package/dist/{chunk-2P3SHT5I.js → chunk-VALKXSXZ.js} +2 -2
  43. package/dist/{chunk-CZVCT5ZV.js → chunk-WI7J22NL.js} +2 -2
  44. package/dist/{chunk-PTZNM2JU.js → chunk-WTCMJZW3.js} +2 -2
  45. package/dist/{chunk-BED4R5CS.js → chunk-XL7UWG36.js} +6 -6
  46. package/dist/{chunk-BED4R5CS.js.map → chunk-XL7UWG36.js.map} +1 -1
  47. package/dist/{chunk-IDGEDPRJ.js → chunk-XTIPWYW5.js} +2 -2
  48. package/dist/{chunk-QASIUKZJ.js → chunk-Z6J3RTYJ.js} +2 -2
  49. package/dist/{chunk-PW3WG6JT.js → chunk-ZOK6VMEP.js} +2 -2
  50. package/dist/cli.js +1 -1
  51. package/dist/{client-WN7YI7DE.js → client-NPC2JAWL.js} +2 -2
  52. package/dist/{config-QUXKGIZX.js → config-TIMTRSFH.js} +2 -2
  53. package/dist/config-mutate-V3DRUCK4.js +2 -0
  54. package/dist/{config-mutator-OLLQR3ZD.js → config-mutator-HOYYIPNW.js} +2 -2
  55. package/dist/{contributions-LL7B4BP3.js → contributions-TYVRQG7F.js} +2 -2
  56. package/dist/doctor-TNQ4Q2OS.js +2 -0
  57. package/dist/{facts-ALJBF7IA.js → facts-XGZWX6CR.js} +2 -2
  58. package/dist/{follow-up-tool-I2HTKMP4.js → follow-up-tool-3P2YCRBL.js} +2 -2
  59. package/dist/{grants-2MNWGCSH.js → grants-TWDH3Z4K.js} +2 -2
  60. package/dist/hub-GVTRKPAU.js +2 -0
  61. package/dist/index.d.ts +67 -5
  62. package/dist/index.js +1 -1
  63. package/dist/{org-tool-JCGGJJU6.js → org-tool-EKO7GCPL.js} +2 -2
  64. package/dist/{program-NCFW4EEP.js → program-Y55FFHIJ.js} +86 -86
  65. package/dist/{promote-NSPUPPHB.js → promote-JYYV44FK.js} +2 -2
  66. package/dist/{query-VW63IHDI.js → query-PUWWCFET.js} +2 -2
  67. package/dist/{query-settings-RS7DJI4H.js → query-settings-IJPG3N6D.js} +2 -2
  68. package/dist/registry-QJGTPSK2.js +2 -0
  69. package/dist/{request-planner-HZWQIRZO.js → request-planner-HHJXCWCG.js} +2 -2
  70. package/dist/{review-candidates-2TXOUASP.js → review-candidates-XZUQELL5.js} +2 -2
  71. package/dist/rotation-memo-store-ZH6254YR.js +2 -0
  72. package/dist/rotation-memo-store-ZH6254YR.js.map +1 -0
  73. package/dist/{routing-ZV4VSZDV.js → routing-HWZHJ4LZ.js} +2 -2
  74. package/dist/schedule-tool-7W5CRUN4.js +2 -0
  75. package/dist/{scheduler-SAID6RKQ.js → scheduler-WG3KXJIH.js} +2 -2
  76. package/dist/{seat-XHBWBSTS.js → seat-5BOBWKBX.js} +2 -2
  77. package/dist/{select-QUCTTAH3.js → select-FIHHBFNR.js} +2 -2
  78. package/dist/{set-enabled-CGMXLFC6.js → set-enabled-K7OM7PSO.js} +2 -2
  79. package/dist/{sprint-tool-SWRYSX3Q.js → sprint-tool-O6TTSWJN.js} +2 -2
  80. package/dist/{tool-DA25L4ND.js → tool-4KVS2JWC.js} +2 -2
  81. package/dist/{tool-ELGOVIM5.js → tool-BYU6EZKM.js} +2 -2
  82. package/dist/{tool-MMH2JNP7.js → tool-HTUSCV22.js} +2 -2
  83. package/dist/{tool-6G63ZQW4.js → tool-HVCLZGYE.js} +2 -2
  84. package/dist/{wiki-4ZL4QXA7.js → wiki-ZMEMGR7R.js} +2 -2
  85. package/dist/wiki-enrich-QZHQV7VZ.js +2 -0
  86. package/dist/workspace-setup-GTSXWYU4.js +2 -0
  87. package/package.json +1 -1
  88. package/dist/chunk-36X7D4JA.js +0 -2
  89. package/dist/chunk-36X7D4JA.js.map +0 -1
  90. package/dist/chunk-3B5HSNOF.js.map +0 -1
  91. package/dist/chunk-5STGF4MI.js.map +0 -1
  92. package/dist/chunk-DUCYRNCT.js.map +0 -1
  93. package/dist/chunk-IFNXMUEG.js +0 -115
  94. package/dist/chunk-IFNXMUEG.js.map +0 -1
  95. package/dist/chunk-PQX2VJUA.js.map +0 -1
  96. package/dist/chunk-VJ5HC63R.js +0 -2
  97. package/dist/config-mutate-HJH24ITC.js +0 -2
  98. package/dist/doctor-X75KLAFA.js +0 -2
  99. package/dist/hub-7ASBN76I.js +0 -2
  100. package/dist/registry-6KREAROB.js +0 -2
  101. package/dist/rotation-memo-store-WMDI7NND.js +0 -2
  102. package/dist/rotation-memo-store-WMDI7NND.js.map +0 -1
  103. package/dist/schedule-tool-D357NLXS.js +0 -2
  104. package/dist/wiki-enrich-N5MUKDVW.js +0 -2
  105. package/dist/workspace-setup-QXFJRNSK.js +0 -2
  106. /package/dist/{App-JDW5V4HT.js.map → App-IEUOKINQ.js.map} +0 -0
  107. /package/dist/{ChatApp-SNM2PORO.js.map → ChatApp-CCDBG6YZ.js.map} +0 -0
  108. /package/dist/{absorb-eval-WDAV4AI2.js.map → absorb-eval-IIF7CY3Q.js.map} +0 -0
  109. /package/dist/{adapter-C47BTKT6.js.map → adapter-LTHULD3D.js.map} +0 -0
  110. /package/dist/{agent-EVMKJXJO.js.map → agent-TZ3GGNS5.js.map} +0 -0
  111. /package/dist/{board-dashboard-EUWXJNDW.js.map → board-dashboard-JS6OJDH6.js.map} +0 -0
  112. /package/dist/{chunk-USFOOYPM.js.map → chunk-37EABHYL.js.map} +0 -0
  113. /package/dist/{chunk-PQUK6XEW.js.map → chunk-6U34GZ7U.js.map} +0 -0
  114. /package/dist/{chunk-MF46BC7J.js.map → chunk-6ZVVAGTR.js.map} +0 -0
  115. /package/dist/{chunk-IU63JGY3.js.map → chunk-7GD5GTWC.js.map} +0 -0
  116. /package/dist/{chunk-SKCOIP5R.js.map → chunk-A2K6C6W3.js.map} +0 -0
  117. /package/dist/{chunk-OLKYIKAZ.js.map → chunk-B35GIWMR.js.map} +0 -0
  118. /package/dist/{chunk-KRHVM26D.js.map → chunk-E2MW5OCE.js.map} +0 -0
  119. /package/dist/{chunk-WJMYBRM5.js.map → chunk-FXA2WIIP.js.map} +0 -0
  120. /package/dist/{chunk-V5LRR5I5.js.map → chunk-GCBFLU64.js.map} +0 -0
  121. /package/dist/{chunk-TH2W2545.js.map → chunk-GJOKXP5D.js.map} +0 -0
  122. /package/dist/{chunk-2VSK6FAR.js.map → chunk-I74PTSUQ.js.map} +0 -0
  123. /package/dist/{chunk-ERVJLPS4.js.map → chunk-JDU4CXGC.js.map} +0 -0
  124. /package/dist/{chunk-DV42WUMD.js.map → chunk-K435U2FC.js.map} +0 -0
  125. /package/dist/{chunk-DOO4MUTS.js.map → chunk-KXMC7Z5X.js.map} +0 -0
  126. /package/dist/{chunk-CXFVIDJV.js.map → chunk-R6XJWFMC.js.map} +0 -0
  127. /package/dist/{chunk-245IOYDJ.js.map → chunk-RPL2P7EP.js.map} +0 -0
  128. /package/dist/{chunk-UGRMFQAG.js.map → chunk-RRLQTU3X.js.map} +0 -0
  129. /package/dist/{chunk-JT5PIBCM.js.map → chunk-U3OJO7B7.js.map} +0 -0
  130. /package/dist/{chunk-RXX4MYFL.js.map → chunk-UN7D7HWU.js.map} +0 -0
  131. /package/dist/{chunk-2P3SHT5I.js.map → chunk-VALKXSXZ.js.map} +0 -0
  132. /package/dist/{chunk-CZVCT5ZV.js.map → chunk-WI7J22NL.js.map} +0 -0
  133. /package/dist/{chunk-PTZNM2JU.js.map → chunk-WTCMJZW3.js.map} +0 -0
  134. /package/dist/{chunk-IDGEDPRJ.js.map → chunk-XTIPWYW5.js.map} +0 -0
  135. /package/dist/{chunk-QASIUKZJ.js.map → chunk-Z6J3RTYJ.js.map} +0 -0
  136. /package/dist/{chunk-PW3WG6JT.js.map → chunk-ZOK6VMEP.js.map} +0 -0
  137. /package/dist/{client-WN7YI7DE.js.map → client-NPC2JAWL.js.map} +0 -0
  138. /package/dist/{config-QUXKGIZX.js.map → config-TIMTRSFH.js.map} +0 -0
  139. /package/dist/{config-mutate-HJH24ITC.js.map → config-mutate-V3DRUCK4.js.map} +0 -0
  140. /package/dist/{config-mutator-OLLQR3ZD.js.map → config-mutator-HOYYIPNW.js.map} +0 -0
  141. /package/dist/{contributions-LL7B4BP3.js.map → contributions-TYVRQG7F.js.map} +0 -0
  142. /package/dist/{doctor-X75KLAFA.js.map → doctor-TNQ4Q2OS.js.map} +0 -0
  143. /package/dist/{facts-ALJBF7IA.js.map → facts-XGZWX6CR.js.map} +0 -0
  144. /package/dist/{follow-up-tool-I2HTKMP4.js.map → follow-up-tool-3P2YCRBL.js.map} +0 -0
  145. /package/dist/{grants-2MNWGCSH.js.map → grants-TWDH3Z4K.js.map} +0 -0
  146. /package/dist/{hub-7ASBN76I.js.map → hub-GVTRKPAU.js.map} +0 -0
  147. /package/dist/{org-tool-JCGGJJU6.js.map → org-tool-EKO7GCPL.js.map} +0 -0
  148. /package/dist/{program-NCFW4EEP.js.map → program-Y55FFHIJ.js.map} +0 -0
  149. /package/dist/{promote-NSPUPPHB.js.map → promote-JYYV44FK.js.map} +0 -0
  150. /package/dist/{query-VW63IHDI.js.map → query-PUWWCFET.js.map} +0 -0
  151. /package/dist/{query-settings-RS7DJI4H.js.map → query-settings-IJPG3N6D.js.map} +0 -0
  152. /package/dist/{registry-6KREAROB.js.map → registry-QJGTPSK2.js.map} +0 -0
  153. /package/dist/{request-planner-HZWQIRZO.js.map → request-planner-HHJXCWCG.js.map} +0 -0
  154. /package/dist/{review-candidates-2TXOUASP.js.map → review-candidates-XZUQELL5.js.map} +0 -0
  155. /package/dist/{routing-ZV4VSZDV.js.map → routing-HWZHJ4LZ.js.map} +0 -0
  156. /package/dist/{schedule-tool-D357NLXS.js.map → schedule-tool-7W5CRUN4.js.map} +0 -0
  157. /package/dist/{scheduler-SAID6RKQ.js.map → scheduler-WG3KXJIH.js.map} +0 -0
  158. /package/dist/{seat-XHBWBSTS.js.map → seat-5BOBWKBX.js.map} +0 -0
  159. /package/dist/{select-QUCTTAH3.js.map → select-FIHHBFNR.js.map} +0 -0
  160. /package/dist/{set-enabled-CGMXLFC6.js.map → set-enabled-K7OM7PSO.js.map} +0 -0
  161. /package/dist/{sprint-tool-SWRYSX3Q.js.map → sprint-tool-O6TTSWJN.js.map} +0 -0
  162. /package/dist/{tool-DA25L4ND.js.map → tool-4KVS2JWC.js.map} +0 -0
  163. /package/dist/{tool-ELGOVIM5.js.map → tool-BYU6EZKM.js.map} +0 -0
  164. /package/dist/{tool-MMH2JNP7.js.map → tool-HTUSCV22.js.map} +0 -0
  165. /package/dist/{tool-6G63ZQW4.js.map → tool-HVCLZGYE.js.map} +0 -0
  166. /package/dist/{wiki-4ZL4QXA7.js.map → wiki-ZMEMGR7R.js.map} +0 -0
  167. /package/dist/{wiki-enrich-N5MUKDVW.js.map → wiki-enrich-QZHQV7VZ.js.map} +0 -0
  168. /package/dist/{workspace-setup-QXFJRNSK.js.map → workspace-setup-GTSXWYU4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{b as W,c as K}from"./chunk-2P3SHT5I.js";import{h as z,j as Z}from"./chunk-3UOTLMXD.js";import{a as I,b as V}from"./chunk-FCPTN6NF.js";import{a as H,b as De}from"./chunk-7I7IEX4S.js";import{d as Y}from"./chunk-QIJLFPWE.js";import{execFile as tt}from"child_process";import{writeFileSync as Ee,mkdirSync as P,existsSync as D,readFileSync as nt}from"fs";import{resolve as _}from"path";var Ne=["off","shadow","authoritative"],xe={telegram:"INTENT_LEDGER_MODE_TELEGRAM",slack:"INTENT_LEDGER_MODE_SLACK",whatsapp:"INTENT_LEDGER_MODE_WHATSAPP",discord:"INTENT_LEDGER_MODE_DISCORD",gitlab:"INTENT_LEDGER_MODE_GITLAB",github:"INTENT_LEDGER_MODE_GITHUB",workflow:"INTENT_LEDGER_MODE_WORKFLOW",cron:"INTENT_LEDGER_MODE_CRON",mesh:"INTENT_LEDGER_MODE_MESH"},Se="INTENT_LEDGER_MODE";function q(n,e=process.env){let t=Q(e[xe[n]]);if(t)return t;let r=Q(e[Se]);return r||"off"}function Q(n){if(typeof n!="string")return null;let e=n.trim().toLowerCase();return Ne.includes(e)?e:null}V();import we from"better-sqlite3";import{existsSync as ut,mkdirSync as $e}from"fs";import{dirname as Oe,resolve as Le}from"path";var T=class{db;path;constructor(e={}){this.path=Le(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),$e(Oe(this.path),{recursive:!0}),this.db=new we(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),Ce(this.db)}close(){this.db.close()}schemaVersion(){return this.db.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0}recordEvent(e){if(e.sourceEventId!==null){let r=this.findEventBySourceId(e.source,e.sourceEventId);if(r)return r}let t={id:e.id??I(e.ts),ts:e.ts,source:e.source,sourceEventId:e.sourceEventId,project:e.project,subject:e.subject,intent:e.intent,rawJson:e.rawJson};return this.db.prepare(`INSERT INTO intent_events (id, ts, source, source_event_id, project, subject, intent, raw_json)
1
+ import{b as W,c as K}from"./chunk-VALKXSXZ.js";import{h as z,j as Z}from"./chunk-3UOTLMXD.js";import{a as I,b as V}from"./chunk-FCPTN6NF.js";import{a as H,b as De}from"./chunk-7I7IEX4S.js";import{d as Y}from"./chunk-QIJLFPWE.js";import{execFile as tt}from"child_process";import{writeFileSync as Ee,mkdirSync as P,existsSync as D,readFileSync as nt}from"fs";import{resolve as _}from"path";var Ne=["off","shadow","authoritative"],xe={telegram:"INTENT_LEDGER_MODE_TELEGRAM",slack:"INTENT_LEDGER_MODE_SLACK",whatsapp:"INTENT_LEDGER_MODE_WHATSAPP",discord:"INTENT_LEDGER_MODE_DISCORD",gitlab:"INTENT_LEDGER_MODE_GITLAB",github:"INTENT_LEDGER_MODE_GITHUB",workflow:"INTENT_LEDGER_MODE_WORKFLOW",cron:"INTENT_LEDGER_MODE_CRON",mesh:"INTENT_LEDGER_MODE_MESH"},Se="INTENT_LEDGER_MODE";function q(n,e=process.env){let t=Q(e[xe[n]]);if(t)return t;let r=Q(e[Se]);return r||"off"}function Q(n){if(typeof n!="string")return null;let e=n.trim().toLowerCase();return Ne.includes(e)?e:null}V();import we from"better-sqlite3";import{existsSync as ut,mkdirSync as $e}from"fs";import{dirname as Oe,resolve as Le}from"path";var T=class{db;path;constructor(e={}){this.path=Le(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),$e(Oe(this.path),{recursive:!0}),this.db=new we(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),Ce(this.db)}close(){this.db.close()}schemaVersion(){return this.db.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0}recordEvent(e){if(e.sourceEventId!==null){let r=this.findEventBySourceId(e.source,e.sourceEventId);if(r)return r}let t={id:e.id??I(e.ts),ts:e.ts,source:e.source,sourceEventId:e.sourceEventId,project:e.project,subject:e.subject,intent:e.intent,rawJson:e.rawJson};return this.db.prepare(`INSERT INTO intent_events (id, ts, source, source_event_id, project, subject, intent, raw_json)
2
2
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(t.id,t.ts,t.source,t.sourceEventId,t.project,t.subject,t.intent,t.rawJson),t}findEventBySourceId(e,t){let r=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
3
3
  FROM intent_events WHERE source = ? AND source_event_id = ?`).get(e,t);return r?j(r):null}getEventById(e){let t=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
4
4
  FROM intent_events WHERE id = ?`).get(e);return t?j(t):null}recordDecision(e){this.db.prepare(`INSERT INTO intent_decisions (event_id, decided_at, decided_by, agent_id, outcome, reason)
@@ -142,4 +142,4 @@ ${k(O(ye(c.block,F(o.brief,i.prompt)),i.report),i.expectExitZero)}`,i.maxOutputT
142
142
  `);return t.length<=e?t.join(`
143
143
  `):t.slice(-e).join(`
144
144
  `)}function st(n,e,t){return new Promise((r,i)=>{tt("/bin/sh",["-c",n],{timeout:e,maxBuffer:8*1024*1024,...t?{env:t}:{}},(o,s,a)=>{if(o&&o.killed){i(new Error(`command timed out after ${Math.round(e/1e3)}s`));return}r({stdout:String(s??""),stderr:String(a??""),code:o?typeof o.code=="number"?o.code:1:0})})})}export{T as a,te as b,St as c,wt as d,Ye as e,$t as f,Ot as g,w as h,de as i,q as j,pt as k,re as l,se as m,At as n,et as o,it as p,Ie as q,Te as r,Re as s,B as t,U as u};
145
- //# sourceMappingURL=chunk-IDGEDPRJ.js.map
145
+ //# sourceMappingURL=chunk-XTIPWYW5.js.map
@@ -1,4 +1,4 @@
1
- import{e as g}from"./chunk-SKCOIP5R.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
1
+ import{e as g}from"./chunk-A2K6C6W3.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
2
2
  `)}).join(`
3
3
 
4
4
  ---
@@ -14,4 +14,4 @@ These ${e.length} articles were found by searching the wiki for each entry below
14
14
 
15
15
  ${i}
16
16
  `}var d=/\bhttps?:\/\/[^\s<>"'`)\]]+/gi,y=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,w=/(?<![\w-])(?=[0-9a-f]*[0-9])(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}(?![\w-])/gi,k=/(?<![\w.,:/-])\d+(?:[.,:\-/]\d+)*(?![\w])/g,C=/^\s*\d+[.)]\s/gm;function A(e){let i=[...e.matchAll(d)].map(s=>s[0].replace(/[.,;:!?'"]+$/,"")),r=[...e.matchAll(y)].map(s=>s[1].trim()),n=e.replace(d," ").replace(y," ").replace(C," "),o=[...n.matchAll(w)].map(s=>s[0].toLowerCase()),c=[...n.replace(w," ").matchAll(k)].map(s=>v(s[0]));return{commits:m(o),urls:m(i),wikilinks:m(r),numbers:m(c)}}function R(e,i){let r=A(e),n=A(i),o=i.toLowerCase(),a=[];for(let t of r.commits)!o.includes(t)&&!n.commits.some(l=>l.startsWith(t)||t.startsWith(l))&&a.push(`commit ${t}`);let c=t=>t.toLowerCase().replace(/\/+$/,""),s=new Set(n.urls.map(c));for(let t of r.urls)s.has(c(t))||a.push(`link ${t}`);let f=new Set(n.wikilinks.map(t=>t.toLowerCase()));for(let t of r.wikilinks)f.has(t.toLowerCase())||a.push(`link [[${t}]]`);let h=new Set(n.numbers);for(let t of r.numbers)h.has(t)||a.push(`number ${t}`);return a}function v(e){return/^\d{1,3}(,\d{3})+$/.test(e)?e.replace(/,/g,""):e}function m(e){return[...new Set(e)]}function L(e,i){if(i.some(n=>n.path===e.path))return e.path;let r=b(e.title);return r?i.find(n=>b(n.title)===r)?.path??e.path:e.path}function b(e){return(e||"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}export{$ as a,x as b,A as c,R as d,L as e};
17
- //# sourceMappingURL=chunk-QASIUKZJ.js.map
17
+ //# sourceMappingURL=chunk-Z6J3RTYJ.js.map
@@ -1,4 +1,4 @@
1
- import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-CZVCT5ZV.js";import{b as L}from"./chunk-KEXBEUSU.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c="",p="",m=""){return Z(r,s,t,o,i,c,p,m)}function Z(n,r,s,t,o,i="",c="",p=""){let m=r?`
1
+ import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-WI7J22NL.js";import{b as L}from"./chunk-KEXBEUSU.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c="",p="",m=""){return Z(r,s,t,o,i,c,p,m)}function Z(n,r,s,t,o,i="",c="",p=""){let m=r?`
2
2
  ## Worldview
3
3
 
4
4
  ${r}
@@ -249,4 +249,4 @@ ${u}`}var x="memory-promoter",oe=["project","reference","feedback"],K="_memory-p
249
249
  Re-emit the FULL corrected JSON object \u2014 same structure, fixed issues, valid JSON only.`:n,y=await t(`${a}/task`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:r.viaAgent,message:h,freshSession:s===null,context:{channel:"api",chatId:r.chatId??"memory-promote"}}),signal:i.signal});if(!y.ok){let f=await y.text().catch(()=>"");throw new Error(`agent /task ${y.status}: ${f.slice(0,500)}`)}let w=await y.json();if(w.error)throw new Error(`agent reported error: ${w.error}`);let b=String(w.content??"").trim();if(!b)throw new Error("agent returned empty content");return b}if(!r.model)throw new Error("callPromotionLlm: viaAgent or model is required");let p=process.env.ANTHROPIC_API_KEY;if(!p)throw new Error("ANTHROPIC_API_KEY not set; use --via <agentId> instead");let m=[{role:"user",content:n}];s&&(m.push({role:"assistant",content:"(previous attempt; will retry with corrections)"}),m.push({role:"user",content:`Your previous response failed validation: ${s}
250
250
  Re-emit the FULL corrected JSON object.`}));let u=await t(me,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":ge},body:JSON.stringify({model:r.model,max_tokens:8e3,messages:m}),signal:i.signal});if(!u.ok){let a=await u.text().catch(()=>"");throw new Error(`anthropic API ${u.status}: ${a.slice(0,500)}`)}let d=await u.json(),e=(Array.isArray(d.content)?d.content:[]).filter(a=>a?.type==="text").map(a=>a.text).join(`
251
251
  `).trim();if(!e)throw new Error("anthropic API returned no text content");return e}finally{clearTimeout(c)}}async function Se(n={}){let r=n.wikiDir??P(process.cwd(),".agentx","wiki"),s=n.memoryRoot??P(process.cwd(),".agentx"),t=n.log??(()=>{}),o=n.now??Date.now(),i={candidates:[],clusters:[],proposed:[],skipped:[],gaps:[],warnings:[],errors:[],dryRun:!n.commit},c=new E(r,(...l)=>t(l.map(String).join(" "))),p=c.rebuildIndex(),m=z(r),u=[...ce(s),...n.extraCandidates??[]];if(i.candidates=de(u,p,m,{types:n.types,sinceMs:n.sinceMs,agentFilter:n.agentFilter,now:o,max:n.max}),i.candidates.length===0)return t("no unpromoted memories in window"),i;if(i.clusters=le(i.candidates),i.dryRun)return i;let d=p.articles.map(l=>({title:l.title,path:l.path,type:l.type})),g=c.getWorldview()??"",e=n.budgetTokens??ue,a=i.clusters,h=D(x,a,d,g);for(;R(h)>e&&a.length>1;)a=a.slice(0,-1),h=D(x,a,d,g);if(R(h)>e)return i.errors.push(`judge prompt (~${R(h)} tokens) exceeds the ${e}-token budget even with one cluster`),i;a.length<i.clusters.length&&i.warnings.push(`token budget: judged ${a.length} of ${i.clusters.length} clusters; the rest wait for the next run`);let y=a.flatMap(l=>l.candidates),w=new Set(y.map(l=>l.stamp)),b=n.chatId??`memory-promote-${new Date(o).toISOString().slice(0,10)}`,f=B(await G(h,{...n,chatId:b}),w);if("error"in f&&(t(`parse failed (${f.error}) \u2014 retrying with feedback`),f=B(await G(h,{...n,chatId:b},f.error),w)),"error"in f)return i.errors.push(`LLM response unusable after retry: ${f.error}`),i;i.warnings.push(...f.warnings),i.gaps=f.gaps;let v=new Date(o).toISOString(),k=[],T=new Map(y.map(l=>[l.stamp,l]));for(let l of f.articles){let A=c.readArticle(l.path);if(A&&!c.canWrite(A.meta,x)){i.errors.push(`write denied for "${l.path}" (owned by ${A.meta.owner??"?"})`);continue}let M=fe(l.promotedFrom,T),S={id:Y(o,l.path),createdAt:v,status:"pending",article:l,evidence:M,...A?{replaces:{lastUpdated:A.meta.lastUpdated,contentHash:V(A.content)}}:{}};I(r,S),i.proposed.push({id:S.id,path:l.path,title:l.title,type:l.type,stamps:l.promotedFrom,agents:M.agents,occurrences:M.occurrences});for(let X of l.promotedFrom)k.push({stamp:X,decision:"proposed",article:l.path,proposal:S.id,at:v})}for(let l of f.skipped)k.push({stamp:l.stamp,decision:"skipped",reason:l.reason,at:v}),i.skipped.push(l);return k.length&&C(r,k),i}var ue=6e4;function R(n){return Math.ceil(n.length/4)}function V(n){return ee("sha256").update(n).digest("hex").slice(0,16)}var he=600;function ye(n){return n.startsWith("review:")?"review":n.startsWith(j)?"failure":"memory"}function fe(n,r){let s=[];for(let t of n){let o=r.get(t);o&&s.push({stamp:t,kind:ye(t),agentId:o.agentId,type:o.memory.type,name:o.memory.name,description:o.memory.description,...o.occurrences?{occurrences:o.occurrences}:{},...o.sessions?.length?{sessions:o.sessions}:{},...o.tasks?.length?{tasks:o.tasks}:{},...o.failure?{failure:o.failure}:{},...o.memory.author?{author:o.memory.author}:{},...o.memory.taskId?{taskId:o.memory.taskId}:{},updatedAt:o.memory.updatedAt,excerpt:o.memory.body.slice(0,he)})}return{agents:[...new Set(s.map(t=>t.agentId))].sort(),occurrences:Math.max(1,...s.map(t=>t.occurrences??1)),sources:s}}function Ee(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=s.log??(()=>{}),i=new E(n,(...a)=>o(a.map(String).join(" "))),{article:c}=t,p=i.readArticle(c.path);if(!s.force){if(p&&!t.replaces)return{ok:!1,error:`"${c.path}" was created after this proposal; review it, then approve with --force`};if(p&&t.replaces&&V(p.content)!==t.replaces.contentHash)return{ok:!1,error:`"${c.path}" changed since this proposal; review it, then approve with --force`}}let m=s.now??Date.now(),u=new Date(m).toISOString().slice(0,10);if(!i.writeArticle(c.path,{title:c.title,type:L(c.type)?c.type:void 0,related:c.related,tags:c.tags,owner:x,access:"public",created:p?.meta.created??u,lastUpdated:u,sources:ae(p?.meta.sources,c.promotedFrom)},c.content,x))return{ok:!1,error:`write denied for "${c.path}" (owned by ${p?.meta.owner??"?"})`};let g=new Date(m).toISOString();C(n,c.promotedFrom.map(a=>({stamp:a,decision:"promoted",article:c.path,proposal:r,at:g}))),i.rebuildIndex();let e={...t,status:"approved",decidedBy:s.by??"operator",decidedAt:g};return I(n,e),{ok:!0,proposal:e}}function Oe(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=new Date(s.now??Date.now()).toISOString();C(n,t.article.promotedFrom.map(c=>({stamp:c,decision:"rejected",article:t.article.path,proposal:r,reason:s.reason,at:o})));let i={...t,status:"rejected",decidedBy:s.by??"operator",decidedAt:o,...s.reason?{reason:s.reason}:{}};return I(n,i),{ok:!0,proposal:i}}export{be as a,x as b,oe as c,K as d,q as e,ie as f,$ as g,ae as h,ce as i,z as j,C as k,le as l,B as m,de as n,G as o,Se as p,R as q,ye as r,fe as s,Ee as t,Oe as u};
252
- //# sourceMappingURL=chunk-PW3WG6JT.js.map
252
+ //# sourceMappingURL=chunk-ZOK6VMEP.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-NCFW4EEP.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
2
+ import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-Y55FFHIJ.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g}from"./chunk-2VSK6FAR.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
- //# sourceMappingURL=client-WN7YI7DE.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-I74PTSUQ.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-NPC2JAWL.js.map
@@ -1,2 +1,2 @@
1
- import{Ab as o,Bb as p,Cb as q,Db as r,Eb as s,Fb as t,Gb as u,Hb as v,Ib as w,Jb as x,Kb as y,Lb as z,Mb as A,Nb as B,Ob as C,Pb as D,Rb as E,mb as a,nb as b,ob as c,pb as d,qb as e,rb as f,sb as g,tb as h,ub as i,vb as j,wb as k,xb as l,yb as m,zb as n}from"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";E();export{a as INTEGRATION_KINDS,z as WIKI_CONTRIBUTE_JOB,A as WIKI_CONTRIBUTE_MERGE_JOB,C as WIKI_SUMMARIZE_JOB,r as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,x as crossFieldProblems,t as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,u as expandEnvVars,f as isCronExpression,w as literalSecretProblems,v as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,y as validateWorkspaces,s as wallConfigSchema,k as watchersConfigSchema,B as withContributionJobs,D as withSummariesJob};
2
- //# sourceMappingURL=config-QUXKGIZX.js.map
1
+ import{Ab as o,Bb as p,Cb as q,Db as r,Eb as s,Fb as t,Gb as u,Hb as v,Ib as w,Jb as x,Kb as y,Lb as z,Mb as A,Nb as B,Ob as C,Pb as D,Rb as E,mb as a,nb as b,ob as c,pb as d,qb as e,rb as f,sb as g,tb as h,ub as i,vb as j,wb as k,xb as l,yb as m,zb as n}from"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";E();export{a as INTEGRATION_KINDS,z as WIKI_CONTRIBUTE_JOB,A as WIKI_CONTRIBUTE_MERGE_JOB,C as WIKI_SUMMARIZE_JOB,r as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,x as crossFieldProblems,t as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,u as expandEnvVars,f as isCronExpression,w as literalSecretProblems,v as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,y as validateWorkspaces,s as wallConfigSchema,k as watchersConfigSchema,B as withContributionJobs,D as withSummariesJob};
2
+ //# sourceMappingURL=config-TIMTRSFH.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-7GD5GTWC.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
+ //# sourceMappingURL=config-mutate-V3DRUCK4.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e}from"./chunk-2P3SHT5I.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
- //# sourceMappingURL=config-mutator-OLLQR3ZD.js.map
1
+ import{a,b,c,d,e}from"./chunk-VALKXSXZ.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-HOYYIPNW.js.map
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-ERVJLPS4.js";import"./chunk-QASIUKZJ.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-SKCOIP5R.js";import"./chunk-JTFCU5LH.js";import"./chunk-WJMYBRM5.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-245IOYDJ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-A7JSRDJL.js";import"./chunk-BERWTVG2.js";import{b as N,c as H}from"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
1
+ import{a as ee}from"./chunk-JDU4CXGC.js";import"./chunk-Z6J3RTYJ.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-A2K6C6W3.js";import"./chunk-JTFCU5LH.js";import"./chunk-FXA2WIIP.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-RPL2P7EP.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-A7JSRDJL.js";import"./chunk-BERWTVG2.js";import{b as N,c as H}from"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
2
2
  `),se(t,n)}function ie(n){return{agents:E(w(S(n),"state.json"),{agents:{}}).agents??{}}}function ye(n){let r=w(S(n),"pending");return z(r)?re(r).filter(t=>t.endsWith(".json")).sort().map(t=>E(w(r,t),null)).filter(t=>!!t):[]}function G(n){return w(S(n),"held.json")}function K(n,r={}){let t=E(G(n),[]);return r.all?t:t.filter(a=>a.status==="held")}function _e(n){let r=w(S(n),"reports");if(!z(r))return null;let t=re(r).filter(a=>a.endsWith(".json")).sort().pop();return t?E(w(r,t),null):null}function ke(n,r,t,a={}){let o=ie(r).agents[t],c=a.now??Date.now(),e=a.since??o?.lastRunAt??new Date(c-864e5).toISOString(),d=e.slice(0,10),u=new Set(o?.processed??[]),s=[];for(let g of n.getAgentEntries(t))g.date<d||u.has(g.id)||s.push({id:g.id,at:g.date,kind:"chat",title:[g.source,g.sourceContext].filter(Boolean).join(" \xB7 "),text:g.content});if(a.db){let g=Date.parse(e);for(let l of V(a.db,{agentId:t,since:Number.isFinite(g)?g:void 0,limit:500})){if(l.status==="in-flight"||u.has(l.taskId))continue;let k=(Q(a.db,l.taskId)?.steps??[]).filter(b=>b.name==="tool_use"||b.action).slice(0,be).map(b=>`- ${b.action??b.name}${b.inputSummary?` ${x(b.inputSummary,160)}`:""}${b.outputSummary?` \u2192 ${x(b.outputSummary,240)}`:""}${b.error?` \u2717 ${x(b.error,120)}`:""}`),y=[`Request: ${x(l.originalMessage??l.messagePreview??"",600)}`,k.length?`Tool calls:
3
3
  ${k.join(`
4
4
  `)}`:"",l.finalResponse?`Reply: ${x(l.finalResponse,800)}`:""].filter(Boolean).join(`
@@ -54,4 +54,4 @@ _Sources: ${t.sources.join("; ")}._`,a);return n.writeArticle(r,{title:t.title,.
54
54
  `).replace(/\n{3,}/g,`
55
55
 
56
56
  `).trim(),superseded:d}}function Ce(n){let r=n.previous?` (previously: ${n.previous})`:"";return`- **${n.attribute}:** ${n.value} \u2014 ${n.source}; checked ${n.checkedAt.slice(0,10)} by ${n.by}${r}`}function Re(n){let r=n.match(/^- \*\*.+?:\*\* (.*?) — .*?; checked (\S+) by \S+(?: \(previously: (.*)\))?$/);return r?{value:r[1],checkedAt:r[2],...r[3]?{previous:r[3]}:{}}:void 0}function J(n,r){return`contribution:${n}@${r.slice(0,10)}`}var Te={person:"people",project:"projects",place:"places",concept:"concepts",event:"events",decision:"decisions",pattern:"patterns"};function de(n,r,t){let a=r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,60)||"page",o=t?Te[t]:"contributions",c=`${o}/${a}.md`;for(let e=2;n.readArticle(c);e++)c=`${o}/${a}-${e}.md`;return c}export{_ as DEFAULT_CONTRIBUTION_LIMITS,B as FACTS_HEADING,ue as applyFactLines,De as approveHeld,xe as buildContributionPrompt,S as contributionsDir,_e as latestReport,K as listHeld,ye as listPendingBatches,Be as mergeContributions,W as pageKey,Ae as parseContributionPatches,ke as pendingWork,Se as possibleDuplicate,Fe as rejectHeld,ce as replaceOnce,Me as runContribution};
57
- //# sourceMappingURL=contributions-LL7B4BP3.js.map
57
+ //# sourceMappingURL=contributions-TYVRQG7F.js.map
@@ -0,0 +1,2 @@
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-37EABHYL.js";import"./chunk-2LJZHKTY.js";import"./chunk-2YDG5CSS.js";import"./chunk-6ZVVAGTR.js";import"./chunk-IMLAPB7G.js";import"./chunk-JSCVOB4G.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-Q3A5P373.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-QUFIUXMQ.js";import"./chunk-XL7UWG36.js";import"./chunk-MNG2AMKZ.js";import"./chunk-LY4G7PCW.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
+ //# sourceMappingURL=doctor-TNQ4Q2OS.js.map
@@ -1,4 +1,4 @@
1
- import{a as g,b as y}from"./chunk-GTJIKXDB.js";import{c as F,h as G}from"./chunk-VJ5HC63R.js";import"./chunk-QIJLFPWE.js";import{existsSync as E,readFileSync as P}from"fs";import{resolve as M}from"path";var I=[["216","Tunisia"],["966","Saudi Arabia"],["971","UAE"],["974","Qatar"],["965","Kuwait"],["973","Bahrain"],["968","Oman"],["962","Jordan"],["961","Lebanon"],["212","Morocco"],["213","Algeria"],["218","Libya"],["249","Sudan"],["20","Egypt"],["90","Turkey"],["33","France"],["49","Germany"],["39","Italy"],["34","Spain"],["44","United Kingdom"],["31","Netherlands"],["32","Belgium"],["41","Switzerland"],["1","US/Canada"]];function p(n){let t=n.replace(/\D/g,""),o,e=0;for(let[r,a]of I)t.startsWith(r)&&r.length>e&&(o=a,e=r.length);return o}function A(n){let t=[];for(let o of n.split(`
1
+ import{a as g,b as y}from"./chunk-GTJIKXDB.js";import{c as F,h as G}from"./chunk-KEUW6YLL.js";import"./chunk-QIJLFPWE.js";import{existsSync as E,readFileSync as P}from"fs";import{resolve as M}from"path";var I=[["216","Tunisia"],["966","Saudi Arabia"],["971","UAE"],["974","Qatar"],["965","Kuwait"],["973","Bahrain"],["968","Oman"],["962","Jordan"],["961","Lebanon"],["212","Morocco"],["213","Algeria"],["218","Libya"],["249","Sudan"],["20","Egypt"],["90","Turkey"],["33","France"],["49","Germany"],["39","Italy"],["34","Spain"],["44","United Kingdom"],["31","Netherlands"],["32","Belgium"],["41","Switzerland"],["1","US/Canada"]];function p(n){let t=n.replace(/\D/g,""),o,e=0;for(let[r,a]of I)t.startsWith(r)&&r.length>e&&(o=a,e=r.length);return o}function A(n){let t=[];for(let o of n.split(`
2
2
  `)){let e=o.trim();if(!e||e.startsWith("ALIAS"))continue;let r=e.split(/\s{2,}/).filter(Boolean);if(r.length<2)continue;let a=r[r.length-1];if(!a.includes("@"))continue;let i=r[r.length-2],s=r.length>=3?r[r.length-3]:"";if(!s||!/\d/.test(i))continue;let l=p(i);t.push({name:s,source:"wacli",fields:{phone:`+${i.replace(/\D/g,"")}`,whatsapp:a,...l?{country:l}:{}}})}return t}function w(){return{name:"wacli",provides:["contact value","country"],async available(){if(!await y("wacli"))return{kind:"not-installed",hint:"brew install wacli \u2014 see https://wacli.sh"};let{stdout:n,stderr:t,code:o}=await g("wacli",["contacts","search","__agentx_probe__"],{timeoutMs:1e4});return o!==0&&/auth|not logged in|no session|login/i.test(n+t)?{kind:"not-configured",hint:"wacli auth \u2014 scan the QR to link the account"}:null},async lookup(n,t){let o=[],e=new Set;for(let r of n)for(let a of T(r.name)){let{stdout:i,code:s}=await g("wacli",["contacts","search",a],{signal:t,timeoutMs:15e3});if(s!==0)continue;let l=A(i).filter(u=>C(u.name,r.name));if(l.length!==0){for(let u of l){let c=u.fields.whatsapp;e.has(c)||(e.add(c),o.push({...u,fuzzy:!j(u.name,r.name)}))}break}}return o}}}var h=n=>n.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9 ]/g,"").trim(),j=(n,t)=>h(n)===h(t);function T(n){let t=h(n).split(/\s+/).filter(o=>o.length>2);return t.length>1?[n,t[t.length-1]]:[n]}function C(n,t){let o=h(n).split(/\s+/).filter(Boolean),e=h(t).split(/\s+/).filter(Boolean);if(o.length===0||e.length===0)return!1;let[r,a]=o.length<=e.length?[o,e]:[e,o];return r.every(i=>a.includes(i))}var D={whatsapp:"whatsapp",telegram:"telegram",gitlab:"gitlab",github:"github",email:"email",phone:"phone",slack:"slack",discord:"discord"};function z(n=".agentx"){return M(process.cwd(),n,"contacts.json")}function S(n){if(!E(n))return[];try{let t=JSON.parse(P(n,"utf-8"));return Array.isArray(t?.contacts)?t.contacts:[]}catch{return[]}}var b=n=>n.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9 ]/g,"").trim();function _(n){return[n.name,n.id,...n.aliases??[]].filter(t=>!!(t&&t.trim())).map(b)}function L(n){let t={};for(let[o,e]of Object.entries(n.channels??{})){let r=String(e??"").trim();if(!r)continue;let a=D[o.toLowerCase()]??o.toLowerCase();if(a==="whatsapp"){let i=r.split("@")[0].replace(/\D/g,"");if(t.whatsapp=r.includes("@")?r:`${i}@s.whatsapp.net`,i){t.phone??=`+${i}`;let s=p(i);s&&(t.country??=s)}continue}if(a==="phone"){let i=r.replace(/\D/g,"");t.phone=r.startsWith("+")?r:`+${i}`;let s=p(i);s&&(t.country??=s);continue}if(a==="telegram"&&/^\d+$/.test(r)){t.telegramId=r;continue}t[a]=a==="gitlab"||a==="github"?r.startsWith("@")?r:`@${r}`:r}return t}function k(n={}){let t=n.path??z();return{name:"contacts",provides:["contact value","handles","country"],async available(){return E(t)?S(t).length>0?null:{kind:"not-configured",hint:`${t} has no contacts`}:{kind:"not-configured",hint:`no ${t} \u2014 add {"contacts":[{"name":"\u2026","aliases":[],"channels":{"whatsapp":"\u2026"}}]}`}},async lookup(o){let e=S(t);if(e.length===0)return[];let r=new Map;for(let s of e)for(let l of _(s))l&&r.set(l,s);let a=[],i=new Set;for(let s of o){let l=r.get(b(s.name));if(!l||i.has(l))continue;i.add(l);let u=L(l);Object.keys(u).length!==0&&a.push({name:l.name??s.name,source:"contacts",fields:u,fuzzy:b(l.name??"")!==b(s.name)})}return a}}}function v(n={}){let t=(n.baseUrl??process.env.GITLAB_URL??"").replace(/\/+$/,""),o=n.token??process.env.GITLAB_ADMIN_TOKEN??process.env.GITLAB_TOKEN;return{name:"gitlab",provides:["email","handle","profile URL"],async available(){if(!t)return{kind:"not-configured",hint:"export GITLAB_URL=https://<your-gitlab-host>"};if(!o)return{kind:"not-configured",hint:"export GITLAB_ADMIN_TOKEN=<PAT> (read_api scope is enough)"};try{let e=await fetch(`${t}/api/v4/user`,{headers:{"PRIVATE-TOKEN":o}});if(e.status===401||e.status===403)return{kind:"not-configured",hint:`GitLab rejected the token (${e.status}) \u2014 set a valid GITLAB_ADMIN_TOKEN`};if(!e.ok)return{kind:"failed",hint:`GitLab returned ${e.status} for the auth probe`}}catch(e){return{kind:"failed",hint:`cannot reach ${t}: ${String(e?.message??e)}`}}return null},async lookup(e,r){if(!o||!t)return[];let a=[],i=new Set;for(let s of e){let l=`${t}/api/v4/users?search=${encodeURIComponent(s.name)}&per_page=5`,u;try{let c=await fetch(l,{headers:{"PRIVATE-TOKEN":o},signal:r});if(!c.ok)continue;u=await c.json()}catch{continue}if(Array.isArray(u))for(let c of u){let d=c.username??c.web_url??"";if(!d||i.has(d))continue;i.add(d);let f={},m=c.email||c.public_email;m&&(f.email=m),c.username&&(f.gitlab=`@${c.username}`),c.web_url&&(f.profile=c.web_url),c.organization&&(f.organisation=c.organization),c.job_title&&(f.role=c.job_title),c.state&&c.state!=="active"&&(f.accountState=c.state),Object.keys(f).length!==0&&a.push({name:c.name??s.name,source:"gitlab",fields:f,fuzzy:(c.name??"").toLowerCase()!==s.name.toLowerCase()})}}return a}}}function x(){return{name:"gog",provides:["contact value","email","organisation","role","country"],async available(){if(!await y("gog"))return{kind:"not-installed",hint:"brew install gog \u2014 Google CLI"};let{stdout:n,stderr:t}=await g("gog",["contacts","list","-j"],{timeoutMs:2e4}),o=n+t;return/unknown flag|Run with --help/i.test(o)?{kind:"failed",hint:`gog rejected the probe: ${o.split(`
3
3
  `)[0]}`}:/accessNotConfigured|has not been used in project/i.test(o)?{kind:"not-configured",hint:"enable the People API on the gog OAuth project, then retry (console.developers.google.com \u2192 APIs \u2192 People API)"}:/invalid_grant|PERMISSION_DENIED|unauthenticated/i.test(o)?{kind:"not-configured",hint:"gog auth login \u2014 the stored token is expired or lacks contacts scope"}:null},async lookup(n,t){let o=[];for(let e of n){let{stdout:r,code:a}=await g("gog",["contacts","search",e.name,"-j","--results-only"],{signal:t,timeoutMs:2e4});if(a!==0)continue;let i;try{i=JSON.parse(r)}catch{continue}let s=Array.isArray(i)?i:i?.results??i?.people??[];for(let l of s){let u={},c=l.phoneNumbers?.[0]?.value,d=l.emailAddresses?.[0]?.value,f=l.organizations?.[0];c&&(u.phone=c),d&&(u.email=d),f?.name&&(u.organisation=f.name),f?.title&&(u.role=f.title);let m=l.addresses?.[0]?.country;m&&(u.country=m),Object.keys(u).length!==0&&o.push({name:l.names?.[0]?.displayName??e.name,source:"gog",fields:u})}}return o}}}G();var R=n=>typeof n=="string"&&n.trim()?n.trim():void 0;function $(n){return String(n??"").split("@")[0].split(":")[0].toLowerCase()}function U(n){let t=new Map;for(let o of n){let e=R(o.meta?.sender);if(!e||F(e))continue;let r=R(o.meta?.senderId),a=R(o.meta?.senderUsername),i=$(o.source),s={};if(r&&/@s\.whatsapp\.net$/.test(r)){let c=r.split("@")[0].replace(/\D/g,"");if(c){s.phone=`+${c}`,s.whatsapp=r;let d=p(c);d&&(s.country=d)}}else if(i==="whatsapp"&&r&&/^\d{6,}$/.test(r)){s.phone=`+${r}`,s.whatsapp=`${r}@s.whatsapp.net`;let c=p(r);c&&(s.country=c)}if(a){let c=a.startsWith("@")?a:`@${a}`;i==="gitlab"?s.gitlab=c:i==="github"?s.github=c:i==="telegram"?s.telegram=c:s.handle=c}if(r&&!s.phone&&!a&&(s[`${i||"platform"}Id`]=r),Object.keys(s).length===0)continue;let l=e.toLowerCase(),u=t.get(l);if(!u){t.set(l,{name:e,source:"entries",fields:s});continue}for(let[c,d]of Object.entries(s))u.fields[c]??=d}return Array.from(t.values())}function H(n){let t;return{...n,available:()=>t??=n.available(),lookup:(o,e)=>n.lookup(o,e)}}function N(){return[k(),w(),v(),x()].map(H)}function ct(n,t={}){let o=t.max??25,e=new Map;for(let a of n){let i=(a.sender??"").trim();i&&O(i)&&e.set(i.toLowerCase(),{name:i,origin:"sender",type:"person"})}for(let a of n){let i=(a.context??"").trim();if(!O(i))continue;let s=i.toLowerCase();e.has(s)||e.set(s,{name:i,origin:"context"})}let r=(t.known??[]).filter(a=>a.trim().length>2);if(r.length>0){let a=n.map(i=>i.content??"").join(`
4
4
  `).toLowerCase();for(let i of r){let s=i.toLowerCase().trim();e.has(s)||a.includes(s)&&e.set(s,{name:i,origin:"body",type:"person"})}}return Array.from(e.values()).slice(0,o)}var B=new Set(["me","user","system","cron","unknown","anonymous","bot","agent","self","test","admin","none","null","n/a"]),W=new Set(["group","team","chat","channel","squad","crew","room","family","project","board","committee","club","staff","office","dept","department","support","sales","ops","admins","everyone","all"]);function O(n){let t=n.trim();if(!t||t.length>48||B.has(t.toLowerCase())||/[\d@/\\#:|_]/.test(t))return!1;let o=t.split(/\s+/);return o.length<2||o.length>4||o.some(e=>W.has(e.toLowerCase()))?!1:o.every(e=>/^[\p{Lu}][\p{L}'’.-]*$/u.test(e))}async function lt(n,t={}){let o=t.sources??N(),e=n.slice(0,t.maxEntities??25);if(e.length===0)return{records:[],results:[]};let r=new AbortController,a=setTimeout(()=>r.abort(),t.timeoutMs??12e4);try{let i=await Promise.all(o.map(async s=>{let l=Date.now();try{let u=await s.available();if(u)return{source:s.name,records:[],unavailable:u,ms:Date.now()-l};let c=await s.lookup(e,r.signal);return{source:s.name,records:c,ms:Date.now()-l}}catch(u){return{source:s.name,records:[],unavailable:{kind:"failed",hint:String(u?.message??u)},ms:Date.now()-l}}}));for(let s of i)t.onResult?.(s);return{records:i.flatMap(s=>s.records),results:i}}finally{clearTimeout(a)}}function ut(n,t=N()){let o=new Map(t.map(e=>[e.name,e.provides]));return n.filter(e=>e.unavailable&&e.unavailable.kind!=="failed").map(e=>({source:e.source,kind:e.unavailable.kind,hint:e.unavailable.hint,provides:o.get(e.source)??[]}))}function ft(n){let t=new Map;for(let o of n){let e=o.name.toLowerCase().trim(),r=t.get(e);r||(r={name:o.name,fields:{}},t.set(e,r));for(let[a,i]of Object.entries(o.fields)){if(!i?.trim())continue;let s=r.fields[a];if(!s){r.fields[a]={value:i,source:o.source};continue}s.value!==i&&(r.fields[`${a} (${o.source})`]??={value:i,source:o.source})}}return Array.from(t.values())}function dt(n){if(n.length===0)return"";let t=n.filter(o=>Object.keys(o.fields).length>0).map(o=>{let e=Object.entries(o.fields).map(([r,a])=>` - ${r}: \`${a.value}\` _(${a.source})_`).join(`
@@ -19,4 +19,4 @@ contradicts the entries, this wins and the entry is stale.
19
19
  ${t.join(`
20
20
  `)}
21
21
  `}export{p as countryFromPhone,k as createContactsSource,v as createGitlabSource,x as createGogSource,w as createWacliSource,N as defaultSources,ct as extractHints,L as factsFrom,ut as installPrompts,O as isPersonName,S as loadContacts,H as memoizeAvailability,ft as mergeRecords,_ as namesOf,A as parseContactsTable,$ as platformOf,C as plausible,U as recordsFromEntries,dt as renderFactsBlock,lt as resolveFacts};
22
- //# sourceMappingURL=facts-ALJBF7IA.js.map
22
+ //# sourceMappingURL=facts-XGZWX6CR.js.map
@@ -1,7 +1,7 @@
1
- import{b as h}from"./chunk-DOO4MUTS.js";import"./chunk-RKPAVWXF.js";import"./chunk-KRHVM26D.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-IDGEDPRJ.js";import"./chunk-2P3SHT5I.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
1
+ import{b as h}from"./chunk-KXMC7Z5X.js";import"./chunk-RKPAVWXF.js";import"./chunk-E2MW5OCE.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XTIPWYW5.js";import"./chunk-VALKXSXZ.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
2
2
  `)}async function T(t,c){let s=c.fetch??fetch,m=c.daemonUrl.replace(/\/$/,""),r=(p(t.action)||"list").toLowerCase(),f=c.env??process.env,w=async i=>{let l=await s(`${m}${i}`,{signal:AbortSignal.timeout(1e4)}),n=await l.json().catch(()=>({}));return{ok:l.ok,status:l.status,data:n}};try{if(r==="list"){let e=await w("/follow-up");if(!e.ok)return`Error: ${e.data?.error||`HTTP ${e.status}`}`;let o=e.data.groups??[];return o.length?o.map(d=>[`${d.tag}:`,...d.rows.map(a=>`- ${a.runId} "${a.title}" on ${a.step}: waiting on ${a.waitingOn} (since ${String(a.since).slice(0,16).replace("T"," ")} UTC)`)].join(`
3
3
  `)).join(`
4
4
  `):"No follow-up workflows are running."}if(r==="match"){let e=p(t.request)||p(t.title);if(!e)return"Error: match needs `request`: the owner's request in their words.";let o=h(t,f),d=await w(`/follow-up/match?q=${encodeURIComponent(e)}${o?`&agentId=${encodeURIComponent(o.agentId)}`:""}`);if(!d.ok)return`Error: ${d.data?.error||`HTTP ${d.status}`}`;let a=d.data.matches??[];return a.length?["Saved workflows, best fit first (confidence 0-1):",...a.map(u=>`- ${u.workflowId} "${u.title}" (${u.confidence}${u.autoStart?", starts without asking":""}): ${u.steps.map(k=>k.id).join(" \u2192 ")}`),'Start one with {action:"start", workflowId:"<id>", title:"\u2026", tags:["client:<name>"]}. Run its steps through the workflow, not by hand.'].join(`
5
5
  `):"No saved workflow fits. If the request has several steps, build one: start with title and steps."}if(r==="status"){let e=p(t.runId);if(!e)return"Error: status needs runId.";let o=await w(`/follow-up/${encodeURIComponent(e)}`);return o.ok?$(o.data.run):`Error: ${o.data?.error||`HTTP ${o.status}`}`}let i=h(t,f);if(!i)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=await s(`${m}/follow-up`,{method:"POST",headers:{"Content-Type":"application/json",...I(f)},body:JSON.stringify({action:r,agentId:i.agentId,workflowId:t.workflowId,title:t.title,description:t.description,tags:t.tags,inputs:t.inputs,steps:t.steps,edges:t.edges,approval:t.approval,autoStart:t.autoStart,requestId:t.requestId,runId:t.runId,step:t.step,evidence:t.evidence,note:t.note,reason:t.reason,fromRun:t.fromRun,status:t.status}),signal:AbortSignal.timeout(2e4)}),n=await l.json().catch(()=>({}));if(!l.ok)return`Error: ${n?.error||`HTTP ${l.status}`}`;if(r==="start"){let e=n.run;return[`Started run ${e.runId} "${e.title}"${n.built?" (built from the steps you gave; propose it with fromRun to keep it)":""}.`,n.awaitingApproval?"It waits for the owner's approval before the first step.":`It is on step ${e.step}: ${e.waitingOn}.`,"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.",...n.warning?[`Note: ${n.warning}`]:[]].join(" ")}return r==="plan"?[`Plan recorded on run ${n.run?.runId??t.runId}:`,...(n.plan??[]).map(e=>`- ${e.id} ${e.title}`),'Report each step with {action:"step", runId, step:"<id>", status:"started"|"done"|"failed"}.'].join(`
6
6
  `):r==="step"?`Step recorded. ${n.run?$(n.run):""}`.trim():r==="done"?`Step recorded as done. ${n.run?$(n.run):""}`.trim():r==="blocked"?"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.":`Saved ${n.workflowId} switched off, and asked the owner (card ${n.cardId}) whether to keep it as a reusable workflow.`}catch(i){return`Error: couldn't reach the daemon (${i?.message??i}).`}}export{T as runWorkflowTool};
7
- //# sourceMappingURL=follow-up-tool-I2HTKMP4.js.map
7
+ //# sourceMappingURL=follow-up-tool-3P2YCRBL.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-TH2W2545.js";import"./chunk-BED4R5CS.js";import"./chunk-MNG2AMKZ.js";import"./chunk-7I7IEX4S.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
2
- //# sourceMappingURL=grants-2MNWGCSH.js.map
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-GJOKXP5D.js";import"./chunk-XL7UWG36.js";import"./chunk-MNG2AMKZ.js";import"./chunk-7I7IEX4S.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
2
+ //# sourceMappingURL=grants-TWDH3Z4K.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-WTCMJZW3.js";import"./chunk-WI7J22NL.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-FXA2WIIP.js";import"./chunk-WPNRDEHW.js";import"./chunk-RPL2P7EP.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
+ //# sourceMappingURL=hub-GVTRKPAU.js.map
package/dist/index.d.ts CHANGED
@@ -616,6 +616,8 @@ interface McpStdioSpec {
616
616
  env?: Record<string, string>;
617
617
  /** Only these tools are listed and callable (see mcp-policy.ts). */
618
618
  allowTools?: string[];
619
+ /** Listed tools that skip the write card (see mcp-policy.ts). */
620
+ readTools?: string[];
619
621
  }
620
622
  /** HTTP MCP server (Streamable HTTP transport) — POST JSON-RPC bodies to
621
623
  * `url`, server may answer as `application/json` or stream as
@@ -630,9 +632,20 @@ interface McpHttpSpec {
630
632
  headersEnv?: Record<string, string>;
631
633
  /** Only these tools are listed and callable (see mcp-policy.ts). */
632
634
  allowTools?: string[];
635
+ /** Listed tools that skip the write card (see mcp-policy.ts). */
636
+ readTools?: string[];
633
637
  }
634
638
  type McpServerSpec = McpStdioSpec | McpHttpSpec;
635
639
  type McpServerMap = Record<string, McpServerSpec>;
640
+ /** Boot each declared server, list its tools, and return a pool that
641
+ * the orchestrator can drop into runAgenticLoop. A server that fails
642
+ * to initialize is dropped from the catalog (with a debug log) so one
643
+ * broken entry can't disable the whole tier. */
644
+ interface McpPoolOptions {
645
+ /** Asked before every call; a string refuses the call with that reason.
646
+ * The orchestrator tier passes the write-tool card here (#1736). */
647
+ beforeCall?: (name: string, input: Record<string, unknown>) => Promise<string | null>;
648
+ }
636
649
 
637
650
  interface AgentContext {
638
651
  techStack: TechStack;
@@ -693,6 +706,9 @@ interface GenerateOptions {
693
706
  * src/agents/runtime.ts — CLI-backed tiers (claude-code, codex-cli)
694
707
  * load their own `.mcp.json` natively and ignore this. */
695
708
  mcpServers?: McpServerMap;
709
+ /** Asked before each MCP tool call; a string refuses it with that
710
+ * reason. The runtime wires the write-tool card here (#1736). */
711
+ beforeMcpCall?: McpPoolOptions["beforeCall"];
696
712
  }
697
713
  interface GenerateResult {
698
714
  files: WriteResult;
@@ -1542,16 +1558,21 @@ declare const agentConfigSchema: z.ZodObject<{
1542
1558
  * `${NAME}` placeholder, never as the secret. */
1543
1559
  headersEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1544
1560
  allowTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1561
+ /** Listed tools that only read though their names do not say so; they
1562
+ * skip the write confirmation card (#1736). */
1563
+ readTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1545
1564
  }, "strip", z.ZodTypeAny, {
1546
1565
  type: "http";
1547
1566
  url: string;
1548
1567
  allowTools?: string[] | undefined;
1568
+ readTools?: string[] | undefined;
1549
1569
  headers?: Record<string, string> | undefined;
1550
1570
  headersEnv?: Record<string, string> | undefined;
1551
1571
  }, {
1552
1572
  type: "http";
1553
1573
  url: string;
1554
1574
  allowTools?: string[] | undefined;
1575
+ readTools?: string[] | undefined;
1555
1576
  headers?: Record<string, string> | undefined;
1556
1577
  headersEnv?: Record<string, string> | undefined;
1557
1578
  }>, z.ZodObject<{
@@ -1560,28 +1581,35 @@ declare const agentConfigSchema: z.ZodObject<{
1560
1581
  args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1561
1582
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1562
1583
  allowTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1584
+ /** Listed tools that only read though their names do not say so; they
1585
+ * skip the write confirmation card (#1736). */
1586
+ readTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1563
1587
  }, "strip", z.ZodTypeAny, {
1564
1588
  command: string;
1565
1589
  args: string[];
1566
1590
  type?: "stdio" | undefined;
1567
1591
  env?: Record<string, string> | undefined;
1568
1592
  allowTools?: string[] | undefined;
1593
+ readTools?: string[] | undefined;
1569
1594
  }, {
1570
1595
  command: string;
1571
1596
  type?: "stdio" | undefined;
1572
1597
  env?: Record<string, string> | undefined;
1573
1598
  args?: string[] | undefined;
1574
1599
  allowTools?: string[] | undefined;
1600
+ readTools?: string[] | undefined;
1575
1601
  }>]>>>, Record<string, {
1576
1602
  command: string;
1577
1603
  args: string[];
1578
1604
  type?: "stdio" | undefined;
1579
1605
  env?: Record<string, string> | undefined;
1580
1606
  allowTools?: string[] | undefined;
1607
+ readTools?: string[] | undefined;
1581
1608
  } | {
1582
1609
  type: "http";
1583
1610
  url: string;
1584
1611
  allowTools?: string[] | undefined;
1612
+ readTools?: string[] | undefined;
1585
1613
  headers?: Record<string, string> | undefined;
1586
1614
  headersEnv?: Record<string, string> | undefined;
1587
1615
  }> | undefined, Record<string, {
@@ -1590,10 +1618,12 @@ declare const agentConfigSchema: z.ZodObject<{
1590
1618
  env?: Record<string, string> | undefined;
1591
1619
  args?: string[] | undefined;
1592
1620
  allowTools?: string[] | undefined;
1621
+ readTools?: string[] | undefined;
1593
1622
  } | {
1594
1623
  type: "http";
1595
1624
  url: string;
1596
1625
  allowTools?: string[] | undefined;
1626
+ readTools?: string[] | undefined;
1597
1627
  headers?: Record<string, string> | undefined;
1598
1628
  headersEnv?: Record<string, string> | undefined;
1599
1629
  }> | undefined>;
@@ -2150,10 +2180,12 @@ declare const agentConfigSchema: z.ZodObject<{
2150
2180
  type?: "stdio" | undefined;
2151
2181
  env?: Record<string, string> | undefined;
2152
2182
  allowTools?: string[] | undefined;
2183
+ readTools?: string[] | undefined;
2153
2184
  } | {
2154
2185
  type: "http";
2155
2186
  url: string;
2156
2187
  allowTools?: string[] | undefined;
2188
+ readTools?: string[] | undefined;
2157
2189
  headers?: Record<string, string> | undefined;
2158
2190
  headersEnv?: Record<string, string> | undefined;
2159
2191
  }> | undefined;
@@ -2212,10 +2244,12 @@ declare const agentConfigSchema: z.ZodObject<{
2212
2244
  env?: Record<string, string> | undefined;
2213
2245
  args?: string[] | undefined;
2214
2246
  allowTools?: string[] | undefined;
2247
+ readTools?: string[] | undefined;
2215
2248
  } | {
2216
2249
  type: "http";
2217
2250
  url: string;
2218
2251
  allowTools?: string[] | undefined;
2252
+ readTools?: string[] | undefined;
2219
2253
  headers?: Record<string, string> | undefined;
2220
2254
  headersEnv?: Record<string, string> | undefined;
2221
2255
  }> | undefined;
@@ -2781,16 +2815,21 @@ declare const daemonConfigSchema: z.ZodObject<{
2781
2815
  * `${NAME}` placeholder, never as the secret. */
2782
2816
  headersEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2783
2817
  allowTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2818
+ /** Listed tools that only read though their names do not say so; they
2819
+ * skip the write confirmation card (#1736). */
2820
+ readTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2784
2821
  }, "strip", z.ZodTypeAny, {
2785
2822
  type: "http";
2786
2823
  url: string;
2787
2824
  allowTools?: string[] | undefined;
2825
+ readTools?: string[] | undefined;
2788
2826
  headers?: Record<string, string> | undefined;
2789
2827
  headersEnv?: Record<string, string> | undefined;
2790
2828
  }, {
2791
2829
  type: "http";
2792
2830
  url: string;
2793
2831
  allowTools?: string[] | undefined;
2832
+ readTools?: string[] | undefined;
2794
2833
  headers?: Record<string, string> | undefined;
2795
2834
  headersEnv?: Record<string, string> | undefined;
2796
2835
  }>, z.ZodObject<{
@@ -2799,28 +2838,35 @@ declare const daemonConfigSchema: z.ZodObject<{
2799
2838
  args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2800
2839
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2801
2840
  allowTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2841
+ /** Listed tools that only read though their names do not say so; they
2842
+ * skip the write confirmation card (#1736). */
2843
+ readTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2802
2844
  }, "strip", z.ZodTypeAny, {
2803
2845
  command: string;
2804
2846
  args: string[];
2805
2847
  type?: "stdio" | undefined;
2806
2848
  env?: Record<string, string> | undefined;
2807
2849
  allowTools?: string[] | undefined;
2850
+ readTools?: string[] | undefined;
2808
2851
  }, {
2809
2852
  command: string;
2810
2853
  type?: "stdio" | undefined;
2811
2854
  env?: Record<string, string> | undefined;
2812
2855
  args?: string[] | undefined;
2813
2856
  allowTools?: string[] | undefined;
2857
+ readTools?: string[] | undefined;
2814
2858
  }>]>>>, Record<string, {
2815
2859
  command: string;
2816
2860
  args: string[];
2817
2861
  type?: "stdio" | undefined;
2818
2862
  env?: Record<string, string> | undefined;
2819
2863
  allowTools?: string[] | undefined;
2864
+ readTools?: string[] | undefined;
2820
2865
  } | {
2821
2866
  type: "http";
2822
2867
  url: string;
2823
2868
  allowTools?: string[] | undefined;
2869
+ readTools?: string[] | undefined;
2824
2870
  headers?: Record<string, string> | undefined;
2825
2871
  headersEnv?: Record<string, string> | undefined;
2826
2872
  }> | undefined, Record<string, {
@@ -2829,10 +2875,12 @@ declare const daemonConfigSchema: z.ZodObject<{
2829
2875
  env?: Record<string, string> | undefined;
2830
2876
  args?: string[] | undefined;
2831
2877
  allowTools?: string[] | undefined;
2878
+ readTools?: string[] | undefined;
2832
2879
  } | {
2833
2880
  type: "http";
2834
2881
  url: string;
2835
2882
  allowTools?: string[] | undefined;
2883
+ readTools?: string[] | undefined;
2836
2884
  headers?: Record<string, string> | undefined;
2837
2885
  headersEnv?: Record<string, string> | undefined;
2838
2886
  }> | undefined>;
@@ -3389,10 +3437,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3389
3437
  type?: "stdio" | undefined;
3390
3438
  env?: Record<string, string> | undefined;
3391
3439
  allowTools?: string[] | undefined;
3440
+ readTools?: string[] | undefined;
3392
3441
  } | {
3393
3442
  type: "http";
3394
3443
  url: string;
3395
3444
  allowTools?: string[] | undefined;
3445
+ readTools?: string[] | undefined;
3396
3446
  headers?: Record<string, string> | undefined;
3397
3447
  headersEnv?: Record<string, string> | undefined;
3398
3448
  }> | undefined;
@@ -3451,10 +3501,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3451
3501
  env?: Record<string, string> | undefined;
3452
3502
  args?: string[] | undefined;
3453
3503
  allowTools?: string[] | undefined;
3504
+ readTools?: string[] | undefined;
3454
3505
  } | {
3455
3506
  type: "http";
3456
3507
  url: string;
3457
3508
  allowTools?: string[] | undefined;
3509
+ readTools?: string[] | undefined;
3458
3510
  headers?: Record<string, string> | undefined;
3459
3511
  headersEnv?: Record<string, string> | undefined;
3460
3512
  }> | undefined;
@@ -8759,16 +8811,23 @@ declare const daemonConfigSchema: z.ZodObject<{
8759
8811
  * agent's own chat, and a message the callee writes back to it lands
8760
8812
  * there too. Off: such a send is queued and its answer only logged. */
8761
8813
  callbackSends: z.ZodDefault<z.ZodBoolean>;
8814
+ /** How long a finished delegation's answer waits for the other ones
8815
+ * still running from the same chat, so the asking agent gets them in
8816
+ * one turn instead of one turn each (#1749). 0: only answers that
8817
+ * are already in are joined. */
8818
+ coalesceSeconds: z.ZodDefault<z.ZodNumber>;
8762
8819
  }, "strip", z.ZodTypeAny, {
8763
8820
  asyncWhenHuman: boolean;
8764
8821
  timeoutMinutes: number;
8765
8822
  requeueRelayOnRestart: boolean;
8766
8823
  callbackSends: boolean;
8824
+ coalesceSeconds: number;
8767
8825
  }, {
8768
8826
  asyncWhenHuman?: boolean | undefined;
8769
8827
  timeoutMinutes?: number | undefined;
8770
8828
  requeueRelayOnRestart?: boolean | undefined;
8771
8829
  callbackSends?: boolean | undefined;
8830
+ coalesceSeconds?: number | undefined;
8772
8831
  }>>;
8773
8832
  }, "strip", z.ZodTypeAny, {
8774
8833
  enabled: boolean;
@@ -8777,6 +8836,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8777
8836
  timeoutMinutes: number;
8778
8837
  requeueRelayOnRestart: boolean;
8779
8838
  callbackSends: boolean;
8839
+ coalesceSeconds: number;
8780
8840
  };
8781
8841
  peers: {
8782
8842
  name: string;
@@ -8804,6 +8864,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8804
8864
  timeoutMinutes?: number | undefined;
8805
8865
  requeueRelayOnRestart?: boolean | undefined;
8806
8866
  callbackSends?: boolean | undefined;
8867
+ coalesceSeconds?: number | undefined;
8807
8868
  } | undefined;
8808
8869
  peers?: {
8809
8870
  name: string;
@@ -9864,11 +9925,6 @@ declare const daemonConfigSchema: z.ZodObject<{
9864
9925
  draftAgent: z.ZodOptional<z.ZodString>;
9865
9926
  wall: z.ZodDefault<z.ZodObject<{
9866
9927
  rhythmHours: z.ZodOptional<z.ZodNumber>;
9867
- /**
9868
- * Canonical kind list — for autocomplete + doctor validation. Open string
9869
- * schema so new services drop in without a bump; doctor warns when a kind
9870
- * is outside this list.
9871
- */
9872
9928
  projects: z.ZodDefault<z.ZodArray<z.ZodObject<{
9873
9929
  name: z.ZodString;
9874
9930
  repos: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -11330,10 +11386,12 @@ declare const daemonConfigSchema: z.ZodObject<{
11330
11386
  type?: "stdio" | undefined;
11331
11387
  env?: Record<string, string> | undefined;
11332
11388
  allowTools?: string[] | undefined;
11389
+ readTools?: string[] | undefined;
11333
11390
  } | {
11334
11391
  type: "http";
11335
11392
  url: string;
11336
11393
  allowTools?: string[] | undefined;
11394
+ readTools?: string[] | undefined;
11337
11395
  headers?: Record<string, string> | undefined;
11338
11396
  headersEnv?: Record<string, string> | undefined;
11339
11397
  }> | undefined;
@@ -11372,6 +11430,7 @@ declare const daemonConfigSchema: z.ZodObject<{
11372
11430
  timeoutMinutes: number;
11373
11431
  requeueRelayOnRestart: boolean;
11374
11432
  callbackSends: boolean;
11433
+ coalesceSeconds: number;
11375
11434
  };
11376
11435
  peers: {
11377
11436
  name: string;
@@ -12668,10 +12727,12 @@ declare const daemonConfigSchema: z.ZodObject<{
12668
12727
  env?: Record<string, string> | undefined;
12669
12728
  args?: string[] | undefined;
12670
12729
  allowTools?: string[] | undefined;
12730
+ readTools?: string[] | undefined;
12671
12731
  } | {
12672
12732
  type: "http";
12673
12733
  url: string;
12674
12734
  allowTools?: string[] | undefined;
12735
+ readTools?: string[] | undefined;
12675
12736
  headers?: Record<string, string> | undefined;
12676
12737
  headersEnv?: Record<string, string> | undefined;
12677
12738
  }> | undefined;
@@ -12769,6 +12830,7 @@ declare const daemonConfigSchema: z.ZodObject<{
12769
12830
  timeoutMinutes?: number | undefined;
12770
12831
  requeueRelayOnRestart?: boolean | undefined;
12771
12832
  callbackSends?: boolean | undefined;
12833
+ coalesceSeconds?: number | undefined;
12772
12834
  } | undefined;
12773
12835
  peers?: {
12774
12836
  name: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Oa as Tt,Pa 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-3B5HSNOF.js";import"./chunk-EJFPXG6I.js";import"./chunk-GTJIKXDB.js";import"./chunk-RXX4MYFL.js";import"./chunk-ZVP6GB4G.js";import"./chunk-MF46BC7J.js";import"./chunk-IMLAPB7G.js";import"./chunk-EKJG63EJ.js";import"./chunk-PQUK6XEW.js";import"./chunk-JSCVOB4G.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-IU63JGY3.js";import"./chunk-MRIVENBY.js";import"./chunk-TH2W2545.js";import"./chunk-BED4R5CS.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-UKUH662W.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-Q3A5P373.js";import"./chunk-CXFVIDJV.js";import"./chunk-QPABR72X.js";import"./chunk-A5GYG56I.js";import"./chunk-PW3WG6JT.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6TTGRTDO.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-KRHVM26D.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-5STGF4MI.js";import"./chunk-JT5PIBCM.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.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-PQX2VJUA.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{u as ut}from"./chunk-IDGEDPRJ.js";import"./chunk-2P3SHT5I.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-PTZNM2JU.js";import{a as ht}from"./chunk-CZVCT5ZV.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-SKCOIP5R.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-WJMYBRM5.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-UGRMFQAG.js";import{j as it,k as rt,l as at}from"./chunk-245IOYDJ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-IFNXMUEG.js";import"./chunk-36X7D4JA.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.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{Fb as tt,Hb as st,Kb as ot,Rb as nt}from"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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{Oa as Tt,Pa 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-TLRTJV2U.js";import"./chunk-7JHB3X5N.js";import"./chunk-GTJIKXDB.js";import"./chunk-UN7D7HWU.js";import"./chunk-ZVP6GB4G.js";import"./chunk-6ZVVAGTR.js";import"./chunk-IMLAPB7G.js";import"./chunk-EKJG63EJ.js";import"./chunk-6U34GZ7U.js";import"./chunk-JSCVOB4G.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-7GD5GTWC.js";import"./chunk-MRIVENBY.js";import"./chunk-GJOKXP5D.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-UKUH662W.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-Q3A5P373.js";import"./chunk-R6XJWFMC.js";import"./chunk-QPABR72X.js";import"./chunk-A5GYG56I.js";import"./chunk-ZOK6VMEP.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6TTGRTDO.js";import"./chunk-RX5O5637.js";import"./chunk-E2MW5OCE.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-M37WJANA.js";import"./chunk-U3OJO7B7.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.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-I4753XPP.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{u as ut}from"./chunk-XTIPWYW5.js";import"./chunk-VALKXSXZ.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-WTCMJZW3.js";import{a as ht}from"./chunk-WI7J22NL.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-A2K6C6W3.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-FXA2WIIP.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-RRLQTU3X.js";import{j as it,k as rt,l as at}from"./chunk-RPL2P7EP.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-3AHYZLGE.js";import"./chunk-XL7UWG36.js";import"./chunk-MNG2AMKZ.js";import"./chunk-LY4G7PCW.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.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{Fb as tt,Hb as st,Kb as ot,Rb as nt}from"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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).
@@ -1,2 +1,2 @@
1
- import{b as d}from"./chunk-DOO4MUTS.js";import"./chunk-RKPAVWXF.js";import"./chunk-KRHVM26D.js";import{b as c}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-IDGEDPRJ.js";import"./chunk-2P3SHT5I.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var u=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function p(n){return typeof n=="string"?n.trim():""}async function y(n,o){let i=o.fetch??fetch,h=o.daemonUrl.replace(/\/$/,""),a=o.env??process.env,s=(p(n.action)||"show").toLowerCase();if(s==="show")try{let e=await i(`${h}/api/org`,{headers:c(a),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?String(r.text??""):`Error: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}if(s!=="propose")return`Error: unknown action "${s}". Use show or propose.`;let t=d(n,a);if(!t)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=t.channel&&t.chatId&&!u.has(t.channel)?{channel:t.channel,chatId:t.chatId,...t.accountId?{accountId:t.accountId}:{}}:void 0;try{let e=await i(`${h}/api/org/proposals`,{method:"POST",headers:{"Content-Type":"application/json",...c(a)},body:JSON.stringify({changes:n.changes,newAgent:n.newAgent,why:n.why,raised_by:t.agentId,...l?{reply:l}:{}}),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?[`Card ${r.card.id} is in the owner's Approvals inbox: "${r.text}"`,"Nothing is changed yet. On the owner's yes the daemon applies it and you get a message with the result; do not edit the org chart yourself.","Tell the owner it is waiting for their yes."].join(" "):`Not proposed: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}}export{y as runOrgTool};
2
- //# sourceMappingURL=org-tool-JCGGJJU6.js.map
1
+ import{b as d}from"./chunk-KXMC7Z5X.js";import"./chunk-RKPAVWXF.js";import"./chunk-E2MW5OCE.js";import{b as c}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XTIPWYW5.js";import"./chunk-VALKXSXZ.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-CARVBJB7.js";import"./chunk-KEUW6YLL.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var u=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function p(n){return typeof n=="string"?n.trim():""}async function y(n,o){let i=o.fetch??fetch,h=o.daemonUrl.replace(/\/$/,""),a=o.env??process.env,s=(p(n.action)||"show").toLowerCase();if(s==="show")try{let e=await i(`${h}/api/org`,{headers:c(a),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?String(r.text??""):`Error: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}if(s!=="propose")return`Error: unknown action "${s}". Use show or propose.`;let t=d(n,a);if(!t)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=t.channel&&t.chatId&&!u.has(t.channel)?{channel:t.channel,chatId:t.chatId,...t.accountId?{accountId:t.accountId}:{}}:void 0;try{let e=await i(`${h}/api/org/proposals`,{method:"POST",headers:{"Content-Type":"application/json",...c(a)},body:JSON.stringify({changes:n.changes,newAgent:n.newAgent,why:n.why,raised_by:t.agentId,...l?{reply:l}:{}}),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?[`Card ${r.card.id} is in the owner's Approvals inbox: "${r.text}"`,"Nothing is changed yet. On the owner's yes the daemon applies it and you get a message with the result; do not edit the org chart yourself.","Tell the owner it is waiting for their yes."].join(" "):`Not proposed: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}}export{y as runOrgTool};
2
+ //# sourceMappingURL=org-tool-EKO7GCPL.js.map