agentix-cli 0.149.0 → 0.151.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 (144) hide show
  1. package/README.md +0 -1
  2. package/apps/mac-helper/Sources/AgentXHelper/AXTree.swift +14 -2
  3. package/dist/{App-2O2UUZGG.js → App-WAWZFD66.js} +2 -2
  4. package/dist/{ChatApp-YU4NF63L.js → ChatApp-TRJIS3O4.js} +2 -2
  5. package/dist/{absorb-eval-WHWOJYDX.js → absorb-eval-CFWLHUTB.js} +2 -2
  6. package/dist/{agent-NLCR6VBE.js → agent-6KCTPI7E.js} +2 -2
  7. package/dist/{board-dashboard-VPDXHHWC.js → board-dashboard-5V6RHW3E.js} +16 -16
  8. package/dist/{board-dashboard-VPDXHHWC.js.map → board-dashboard-5V6RHW3E.js.map} +1 -1
  9. package/dist/{chunk-GMMRBTLQ.js → chunk-2GJQDJBF.js} +2 -2
  10. package/dist/{chunk-AONY6U45.js → chunk-4GXJMHSA.js} +2 -2
  11. package/dist/{chunk-WGPMUWX7.js → chunk-5I7NJMK6.js} +3 -3
  12. package/dist/{chunk-XNS5OQ3U.js → chunk-6LFOX6Q5.js} +293 -283
  13. package/dist/chunk-6LFOX6Q5.js.map +1 -0
  14. package/dist/{chunk-ATCIRFH6.js → chunk-ALE354ZC.js} +2 -2
  15. package/dist/{chunk-GRI5HOPC.js → chunk-C5UTFHPB.js} +2 -2
  16. package/dist/{chunk-UZWF7PFH.js → chunk-CBML7UCP.js} +5 -5
  17. package/dist/{chunk-5QXRPYOY.js → chunk-CTQ25CUL.js} +2 -2
  18. package/dist/{chunk-JOHDOEZ4.js → chunk-DFGANY25.js} +2 -2
  19. package/dist/{chunk-EIY2HRAS.js → chunk-DJQIJF4R.js} +2 -2
  20. package/dist/{chunk-DWOERPBG.js → chunk-DWXCZRBJ.js} +2 -2
  21. package/dist/{chunk-5IHUZVPU.js → chunk-EJTKLVIW.js} +2 -2
  22. package/dist/{chunk-E7LPZAXP.js → chunk-ETBDN5WX.js} +2 -2
  23. package/dist/{chunk-6TJNWUMA.js → chunk-FGJNSYHM.js} +3 -3
  24. package/dist/{chunk-NW4N67TU.js → chunk-IMITYHBT.js} +2 -2
  25. package/dist/chunk-L6IW6HWE.js +64 -0
  26. package/dist/chunk-L6IW6HWE.js.map +1 -0
  27. package/dist/{chunk-IGA3T3ZT.js → chunk-LVS5ESTS.js} +2 -2
  28. package/dist/chunk-O7SYQXKS.js +181 -0
  29. package/dist/chunk-O7SYQXKS.js.map +1 -0
  30. package/dist/chunk-OSH2PEBH.js +2 -0
  31. package/dist/{chunk-JXF54PT7.js.map → chunk-OSH2PEBH.js.map} +1 -1
  32. package/dist/{chunk-QZ6VBDMX.js → chunk-PUSBK2OQ.js} +8 -8
  33. package/dist/chunk-PUSBK2OQ.js.map +1 -0
  34. package/dist/{chunk-OWMKQ4HZ.js → chunk-Q5NLNLD5.js} +2 -2
  35. package/dist/{chunk-S22IBRY6.js → chunk-RGJZV5RY.js} +2 -2
  36. package/dist/{chunk-NMYC5RW7.js → chunk-TZZBGWLX.js} +2 -2
  37. package/dist/{chunk-3HVRWULP.js → chunk-UALK4F3W.js} +2 -2
  38. package/dist/chunk-V3VWYIJ3.js +7 -0
  39. package/dist/chunk-V3VWYIJ3.js.map +1 -0
  40. package/dist/{chunk-6QFDFYI7.js → chunk-X3T2GCSI.js} +2 -2
  41. package/dist/chunk-X6C6U4GL.js +5 -0
  42. package/dist/chunk-X6C6U4GL.js.map +1 -0
  43. package/dist/{chunk-2MW32M2D.js → chunk-XD7HTMOP.js} +2 -2
  44. package/dist/{chunk-6YNRLI6I.js → chunk-XVJXXELY.js} +2 -2
  45. package/dist/{chunk-BZ6Y264Z.js → chunk-YGDJV4ZZ.js} +2 -2
  46. package/dist/cli.js +1 -1
  47. package/dist/{client-A2N6ETK2.js → client-VT7GT3SK.js} +2 -2
  48. package/dist/{config-2QM2WTI2.js → config-NZS2UTHI.js} +2 -2
  49. package/dist/{config-mutate-UJS4F7BT.js → config-mutate-LINLC354.js} +2 -2
  50. package/dist/config-mutator-FUMSW5HD.js +2 -0
  51. package/dist/{contributions-43FWZOGF.js → contributions-67B3BYLV.js} +2 -2
  52. package/dist/doctor-FOKX4K2G.js +2 -0
  53. package/dist/{follow-up-tool-VB7K6HCL.js → follow-up-tool-JOIOYOON.js} +2 -2
  54. package/dist/{grants-2S33F2LV.js → grants-QXF7N6SS.js} +2 -2
  55. package/dist/{hub-JNNNUAZM.js → hub-QETWDYPD.js} +2 -2
  56. package/dist/index.d.ts +42 -0
  57. package/dist/index.js +1 -1
  58. package/dist/{program-OTENO5DS.js → program-XFZBG3EI.js} +209 -209
  59. package/dist/program-XFZBG3EI.js.map +1 -0
  60. package/dist/{promote-VFYVWVTL.js → promote-WNYNTGKC.js} +2 -2
  61. package/dist/{query-RB2MU2HV.js → query-ZU2DDCEH.js} +2 -2
  62. package/dist/{query-settings-5B54WHCS.js → query-settings-BXRIJWWO.js} +2 -2
  63. package/dist/{registry-6OX7U6FV.js → registry-7BITIEQ2.js} +2 -2
  64. package/dist/{request-planner-TUHVEYSF.js → request-planner-DLQP2NV6.js} +2 -2
  65. package/dist/{review-candidates-FDYTGG2N.js → review-candidates-3BMHLIBW.js} +2 -2
  66. package/dist/{routing-U35SFPEI.js → routing-FVZCQJ6T.js} +2 -2
  67. package/dist/schedule-tool-TDVJHRQX.js +2 -0
  68. package/dist/{scheduler-H2QHWNQ2.js → scheduler-SYI5MZ3H.js} +2 -2
  69. package/dist/{seat-EB3KJMIE.js → seat-6JF7BYM7.js} +2 -2
  70. package/dist/{select-IU4IOVSO.js → select-JT4I3JOH.js} +2 -2
  71. package/dist/{set-enabled-64BSJ7LR.js → set-enabled-JRGFKA3S.js} +2 -2
  72. package/dist/{tool-B23ACEHV.js → tool-P6GVYNDO.js} +2 -2
  73. package/dist/{tool-W3CIQZJ7.js → tool-UDOUNWQT.js} +2 -2
  74. package/dist/{wiki-4KMRUD5C.js → wiki-MTZHDFHK.js} +2 -2
  75. package/dist/wiki-enrich-CHR4RCRE.js +2 -0
  76. package/package.json +1 -1
  77. package/dist/chunk-A76PNG4E.js +0 -4
  78. package/dist/chunk-A76PNG4E.js.map +0 -1
  79. package/dist/chunk-JXF54PT7.js +0 -2
  80. package/dist/chunk-P34VSROA.js +0 -7
  81. package/dist/chunk-P34VSROA.js.map +0 -1
  82. package/dist/chunk-PXKIPU27.js +0 -64
  83. package/dist/chunk-PXKIPU27.js.map +0 -1
  84. package/dist/chunk-QZ6VBDMX.js.map +0 -1
  85. package/dist/chunk-XNS5OQ3U.js.map +0 -1
  86. package/dist/chunk-Z7GEW2SR.js +0 -174
  87. package/dist/chunk-Z7GEW2SR.js.map +0 -1
  88. package/dist/config-mutator-VWR3SMD3.js +0 -2
  89. package/dist/doctor-IN6MWP6I.js +0 -2
  90. package/dist/program-OTENO5DS.js.map +0 -1
  91. package/dist/schedule-tool-EPQKUYJX.js +0 -2
  92. package/dist/wiki-enrich-N4GLW2JX.js +0 -2
  93. /package/dist/{App-2O2UUZGG.js.map → App-WAWZFD66.js.map} +0 -0
  94. /package/dist/{ChatApp-YU4NF63L.js.map → ChatApp-TRJIS3O4.js.map} +0 -0
  95. /package/dist/{absorb-eval-WHWOJYDX.js.map → absorb-eval-CFWLHUTB.js.map} +0 -0
  96. /package/dist/{agent-NLCR6VBE.js.map → agent-6KCTPI7E.js.map} +0 -0
  97. /package/dist/{chunk-GMMRBTLQ.js.map → chunk-2GJQDJBF.js.map} +0 -0
  98. /package/dist/{chunk-AONY6U45.js.map → chunk-4GXJMHSA.js.map} +0 -0
  99. /package/dist/{chunk-WGPMUWX7.js.map → chunk-5I7NJMK6.js.map} +0 -0
  100. /package/dist/{chunk-ATCIRFH6.js.map → chunk-ALE354ZC.js.map} +0 -0
  101. /package/dist/{chunk-GRI5HOPC.js.map → chunk-C5UTFHPB.js.map} +0 -0
  102. /package/dist/{chunk-UZWF7PFH.js.map → chunk-CBML7UCP.js.map} +0 -0
  103. /package/dist/{chunk-5QXRPYOY.js.map → chunk-CTQ25CUL.js.map} +0 -0
  104. /package/dist/{chunk-JOHDOEZ4.js.map → chunk-DFGANY25.js.map} +0 -0
  105. /package/dist/{chunk-EIY2HRAS.js.map → chunk-DJQIJF4R.js.map} +0 -0
  106. /package/dist/{chunk-DWOERPBG.js.map → chunk-DWXCZRBJ.js.map} +0 -0
  107. /package/dist/{chunk-5IHUZVPU.js.map → chunk-EJTKLVIW.js.map} +0 -0
  108. /package/dist/{chunk-E7LPZAXP.js.map → chunk-ETBDN5WX.js.map} +0 -0
  109. /package/dist/{chunk-6TJNWUMA.js.map → chunk-FGJNSYHM.js.map} +0 -0
  110. /package/dist/{chunk-NW4N67TU.js.map → chunk-IMITYHBT.js.map} +0 -0
  111. /package/dist/{chunk-IGA3T3ZT.js.map → chunk-LVS5ESTS.js.map} +0 -0
  112. /package/dist/{chunk-OWMKQ4HZ.js.map → chunk-Q5NLNLD5.js.map} +0 -0
  113. /package/dist/{chunk-S22IBRY6.js.map → chunk-RGJZV5RY.js.map} +0 -0
  114. /package/dist/{chunk-NMYC5RW7.js.map → chunk-TZZBGWLX.js.map} +0 -0
  115. /package/dist/{chunk-3HVRWULP.js.map → chunk-UALK4F3W.js.map} +0 -0
  116. /package/dist/{chunk-6QFDFYI7.js.map → chunk-X3T2GCSI.js.map} +0 -0
  117. /package/dist/{chunk-2MW32M2D.js.map → chunk-XD7HTMOP.js.map} +0 -0
  118. /package/dist/{chunk-6YNRLI6I.js.map → chunk-XVJXXELY.js.map} +0 -0
  119. /package/dist/{chunk-BZ6Y264Z.js.map → chunk-YGDJV4ZZ.js.map} +0 -0
  120. /package/dist/{client-A2N6ETK2.js.map → client-VT7GT3SK.js.map} +0 -0
  121. /package/dist/{config-2QM2WTI2.js.map → config-NZS2UTHI.js.map} +0 -0
  122. /package/dist/{config-mutate-UJS4F7BT.js.map → config-mutate-LINLC354.js.map} +0 -0
  123. /package/dist/{config-mutator-VWR3SMD3.js.map → config-mutator-FUMSW5HD.js.map} +0 -0
  124. /package/dist/{contributions-43FWZOGF.js.map → contributions-67B3BYLV.js.map} +0 -0
  125. /package/dist/{doctor-IN6MWP6I.js.map → doctor-FOKX4K2G.js.map} +0 -0
  126. /package/dist/{follow-up-tool-VB7K6HCL.js.map → follow-up-tool-JOIOYOON.js.map} +0 -0
  127. /package/dist/{grants-2S33F2LV.js.map → grants-QXF7N6SS.js.map} +0 -0
  128. /package/dist/{hub-JNNNUAZM.js.map → hub-QETWDYPD.js.map} +0 -0
  129. /package/dist/{promote-VFYVWVTL.js.map → promote-WNYNTGKC.js.map} +0 -0
  130. /package/dist/{query-RB2MU2HV.js.map → query-ZU2DDCEH.js.map} +0 -0
  131. /package/dist/{query-settings-5B54WHCS.js.map → query-settings-BXRIJWWO.js.map} +0 -0
  132. /package/dist/{registry-6OX7U6FV.js.map → registry-7BITIEQ2.js.map} +0 -0
  133. /package/dist/{request-planner-TUHVEYSF.js.map → request-planner-DLQP2NV6.js.map} +0 -0
  134. /package/dist/{review-candidates-FDYTGG2N.js.map → review-candidates-3BMHLIBW.js.map} +0 -0
  135. /package/dist/{routing-U35SFPEI.js.map → routing-FVZCQJ6T.js.map} +0 -0
  136. /package/dist/{schedule-tool-EPQKUYJX.js.map → schedule-tool-TDVJHRQX.js.map} +0 -0
  137. /package/dist/{scheduler-H2QHWNQ2.js.map → scheduler-SYI5MZ3H.js.map} +0 -0
  138. /package/dist/{seat-EB3KJMIE.js.map → seat-6JF7BYM7.js.map} +0 -0
  139. /package/dist/{select-IU4IOVSO.js.map → select-JT4I3JOH.js.map} +0 -0
  140. /package/dist/{set-enabled-64BSJ7LR.js.map → set-enabled-JRGFKA3S.js.map} +0 -0
  141. /package/dist/{tool-B23ACEHV.js.map → tool-P6GVYNDO.js.map} +0 -0
  142. /package/dist/{tool-W3CIQZJ7.js.map → tool-UDOUNWQT.js.map} +0 -0
  143. /package/dist/{wiki-4KMRUD5C.js.map → wiki-MTZHDFHK.js.map} +0 -0
  144. /package/dist/{wiki-enrich-N4GLW2JX.js.map → wiki-enrich-CHR4RCRE.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{b as S,c as O}from"./chunk-E7LPZAXP.js";import{h as B,j as J}from"./chunk-3UOTLMXD.js";import{a as I,b as P}from"./chunk-FCPTN6NF.js";import{a as X,b as le}from"./chunk-7I7IEX4S.js";import{d as F}from"./chunk-QIJLFPWE.js";import{execFile as ke}from"child_process";import{writeFileSync as ie,mkdirSync as x,existsSync as b,readFileSync as Ce}from"fs";import{resolve as v}from"path";var ge=["off","shadow","authoritative"],me={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"},he="INTENT_LEDGER_MODE";function G(i,e=process.env){let t=U(e[me[i]]);if(t)return t;let n=U(e[he]);return n||"off"}function U(i){if(typeof i!="string")return null;let e=i.trim().toLowerCase();return ge.includes(e)?e:null}P();import fe from"better-sqlite3";import{existsSync as Ge,mkdirSync as pe}from"fs";import{dirname as Ee,resolve as ve}from"path";var T=class{db;path;constructor(e={}){this.path=ve(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),pe(Ee(this.path),{recursive:!0}),this.db=new fe(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),Ie(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 n=this.findEventBySourceId(e.source,e.sourceEventId);if(n)return n}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 S,c as O}from"./chunk-ETBDN5WX.js";import{h as B,j as J}from"./chunk-3UOTLMXD.js";import{a as I,b as P}from"./chunk-FCPTN6NF.js";import{a as X,b as le}from"./chunk-7I7IEX4S.js";import{d as F}from"./chunk-QIJLFPWE.js";import{execFile as ke}from"child_process";import{writeFileSync as ie,mkdirSync as x,existsSync as b,readFileSync as Ce}from"fs";import{resolve as v}from"path";var ge=["off","shadow","authoritative"],me={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"},he="INTENT_LEDGER_MODE";function G(i,e=process.env){let t=U(e[me[i]]);if(t)return t;let n=U(e[he]);return n||"off"}function U(i){if(typeof i!="string")return null;let e=i.trim().toLowerCase();return ge.includes(e)?e:null}P();import fe from"better-sqlite3";import{existsSync as Ge,mkdirSync as pe}from"fs";import{dirname as Ee,resolve as ve}from"path";var T=class{db;path;constructor(e={}){this.path=ve(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),pe(Ee(this.path),{recursive:!0}),this.db=new fe(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),Ie(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 n=this.findEventBySourceId(e.source,e.sourceEventId);if(n)return n}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 n=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 n?Y(n):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?Y(t):null}recordDecision(e){this.db.prepare(`INSERT INTO intent_decisions (event_id, decided_at, decided_by, agent_id, outcome, reason)
@@ -125,4 +125,4 @@ ${oe(a.block,r.prompt)}`,r.maxOutputTokens),agentId:r.agent,autonomy:r.autonomy,
125
125
  `);return t.length<=e?t.join(`
126
126
  `):t.slice(-e).join(`
127
127
  `)}function Pe(i,e,t){return new Promise((n,r)=>{ke("/bin/sh",["-c",i],{timeout:e,maxBuffer:8*1024*1024,...t?{env:t}:{}},(s,o,a)=>{if(s&&s.killed){r(new Error(`command timed out after ${Math.round(e/1e3)}s`));return}n({stdout:String(o??""),stderr:String(a??""),code:s?typeof s.code=="number"?s.code:1:0})})})}export{T as a,V as b,at as c,Le as d,ct as e,dt as f,L as g,ee as h,G as i,ze as j,z as k,Q as l,gt as m,Me as n,ae as o,ce as p,de as q,C as r,M as s};
128
- //# sourceMappingURL=chunk-6YNRLI6I.js.map
128
+ //# sourceMappingURL=chunk-XVJXXELY.js.map
@@ -1,4 +1,4 @@
1
- import{c as bt}from"./chunk-SZDACK6O.js";import{b as xe}from"./chunk-AFRHKA7B.js";import{b as St,c as At}from"./chunk-5TTHN7DP.js";import{b as ht,e as wt,f as yt,i as It,k as vt,l as $t,q as Rt}from"./chunk-6YNRLI6I.js";import{b as ft,d as gt,e as mt}from"./chunk-PE5V2LI7.js";import{e as ut,g as ct,h as pt,i as Re}from"./chunk-GQ76J72O.js";import{a as kt}from"./chunk-GV7S5BAX.js";import{y as at,z as Bn}from"./chunk-OWMKQ4HZ.js";import{b as st,f as Kn}from"./chunk-72SZI2UW.js";import{a as dt,b as $e,c as Se,d as lt,e as Ae}from"./chunk-QD6IICK7.js";import{c as ot,d as it}from"./chunk-QOYAX2FT.js";import{f as ve,n as Hn}from"./chunk-UIBUZ2N3.js";import{existsSync as qn,mkdirSync as xt,readFileSync as zn,writeFileSync as Jn,renameSync as Yn}from"fs";import{resolve as Pt,dirname as Gn}from"path";var Tt=class{filePath;log;constructor(e={}){let t=e.baseDir??Pt(process.cwd(),".agentx");this.filePath=Pt(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),xt(t,{recursive:!0})}key(e,t,r){return`${e}::${t}::${r||"-"}`}load(){if(!qn(this.filePath))return{version:1,overrides:{}};try{let e=zn(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){xt(Gn(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;Jn(t,JSON.stringify(e,null,2)),Yn(t,this.filePath)}get(e,t,r){let s=this.load().overrides[this.key(e,t,r)];if(s&&!(s.expiresAt&&Date.parse(s.expiresAt)<Date.now()))return s}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),r={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(r.channel,r.chatId,r.accountId)]=r,this.save(t),r}remove(e,t,r){let o=this.load(),s=this.key(e,t,r);return s in o.overrides?(delete o.overrides[s],this.save(o),!0):!1}consumeSummary(e,t,r){let o=this.load(),s=o.overrides[this.key(e,t,r)];if(!s||!s.summary||s.summaryConsumedAt)return;let a=s.summary;return s.summaryConsumedAt=new Date().toISOString(),this.save(o),a}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(r=>!r.expiresAt||Date.parse(r.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(r=>r.toAgent===e),outgoing:t.filter(r=>r.fromAgent===e)}}};import{readFileSync as Et,writeFileSync as Pe,appendFileSync as Xn,mkdirSync as er,existsSync as Mt,statSync as tr}from"fs";import{resolve as ne}from"path";var Wt="[Agent Memory \u2014 persistent facts from past conversations]",Vn=2400;function Nt(n,e){return n?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function Qn(n,e=Date.now()){let t=gt(n,e),r=n.undated?"UNVERIFIED (never checked) ":Nt(t,ut(n.verifiedAt,e));return{line:`- [wiki ${n.id}] ${r}${n.subject} \xB7 ${n.attribute}: ${n.value} (${n.source}, checked ${n.verifiedAt.slice(0,10)} by ${n.verifiedBy})`,unverified:t}}function Zn(n,e){let r=!n.source.chatId.startsWith("-")&&/^\d+$/.test(n.source.chatId)?"DM":n.source.chatId,o=pt(n,e);return{line:`- [${n.category}] ${Nt(o,ct(n,e))}${n.content} (${r}, ${n.source.date})`,unverified:o}}function Dt(n,e=[],t=Date.now()){let r=[],o=new Set,s=Wt.length,a=!1;for(let i of n){let d=e.length>0?mt(i.content,e):null,l,p,c=d&&Date.parse(i.createdAt)>Date.parse(d.verifiedAt)&&!i.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!c){if(o.has(d.id))continue;o.add(d.id),l=Qn(d,t),p=d.id}else l=Zn(i,t),d&&(l.line+=` [differs from wiki ${d.id}]`);let f=l.unverified&&!a?Re.length:0;if(s+f+l.line.length>Vn)break;r.push({fact:i,...l,...p?{wikiRef:p}:{}}),s+=f+l.line.length,f&&(a=!0)}return r}function Ot(n){if(n.length===0)return"";let e=n.some(t=>t.unverified)?[Re]:[];return[Wt,...e,...n.map(t=>t.line),"[End Memory]"].join(`
1
+ import{c as bt}from"./chunk-SZDACK6O.js";import{b as xe}from"./chunk-AFRHKA7B.js";import{b as St,c as At}from"./chunk-5TTHN7DP.js";import{b as ht,e as wt,f as yt,i as It,k as vt,l as $t,q as Rt}from"./chunk-XVJXXELY.js";import{b as ft,d as gt,e as mt}from"./chunk-PE5V2LI7.js";import{e as ut,g as ct,h as pt,i as Re}from"./chunk-GQ76J72O.js";import{a as kt}from"./chunk-GV7S5BAX.js";import{y as at,z as Bn}from"./chunk-Q5NLNLD5.js";import{b as st,f as Kn}from"./chunk-72SZI2UW.js";import{a as dt,b as $e,c as Se,d as lt,e as Ae}from"./chunk-QD6IICK7.js";import{c as ot,d as it}from"./chunk-QOYAX2FT.js";import{f as ve,n as Hn}from"./chunk-UIBUZ2N3.js";import{existsSync as qn,mkdirSync as xt,readFileSync as zn,writeFileSync as Jn,renameSync as Yn}from"fs";import{resolve as Pt,dirname as Gn}from"path";var Tt=class{filePath;log;constructor(e={}){let t=e.baseDir??Pt(process.cwd(),".agentx");this.filePath=Pt(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),xt(t,{recursive:!0})}key(e,t,r){return`${e}::${t}::${r||"-"}`}load(){if(!qn(this.filePath))return{version:1,overrides:{}};try{let e=zn(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){xt(Gn(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;Jn(t,JSON.stringify(e,null,2)),Yn(t,this.filePath)}get(e,t,r){let s=this.load().overrides[this.key(e,t,r)];if(s&&!(s.expiresAt&&Date.parse(s.expiresAt)<Date.now()))return s}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),r={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(r.channel,r.chatId,r.accountId)]=r,this.save(t),r}remove(e,t,r){let o=this.load(),s=this.key(e,t,r);return s in o.overrides?(delete o.overrides[s],this.save(o),!0):!1}consumeSummary(e,t,r){let o=this.load(),s=o.overrides[this.key(e,t,r)];if(!s||!s.summary||s.summaryConsumedAt)return;let a=s.summary;return s.summaryConsumedAt=new Date().toISOString(),this.save(o),a}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(r=>!r.expiresAt||Date.parse(r.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(r=>r.toAgent===e),outgoing:t.filter(r=>r.fromAgent===e)}}};import{readFileSync as Et,writeFileSync as Pe,appendFileSync as Xn,mkdirSync as er,existsSync as Mt,statSync as tr}from"fs";import{resolve as ne}from"path";var Wt="[Agent Memory \u2014 persistent facts from past conversations]",Vn=2400;function Nt(n,e){return n?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function Qn(n,e=Date.now()){let t=gt(n,e),r=n.undated?"UNVERIFIED (never checked) ":Nt(t,ut(n.verifiedAt,e));return{line:`- [wiki ${n.id}] ${r}${n.subject} \xB7 ${n.attribute}: ${n.value} (${n.source}, checked ${n.verifiedAt.slice(0,10)} by ${n.verifiedBy})`,unverified:t}}function Zn(n,e){let r=!n.source.chatId.startsWith("-")&&/^\d+$/.test(n.source.chatId)?"DM":n.source.chatId,o=pt(n,e);return{line:`- [${n.category}] ${Nt(o,ct(n,e))}${n.content} (${r}, ${n.source.date})`,unverified:o}}function Dt(n,e=[],t=Date.now()){let r=[],o=new Set,s=Wt.length,a=!1;for(let i of n){let d=e.length>0?mt(i.content,e):null,l,p,c=d&&Date.parse(i.createdAt)>Date.parse(d.verifiedAt)&&!i.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!c){if(o.has(d.id))continue;o.add(d.id),l=Qn(d,t),p=d.id}else l=Zn(i,t),d&&(l.line+=` [differs from wiki ${d.id}]`);let f=l.unverified&&!a?Re.length:0;if(s+f+l.line.length>Vn)break;r.push({fact:i,...l,...p?{wikiRef:p}:{}}),s+=f+l.line.length,f&&(a=!0)}return r}function Ot(n){if(n.length===0)return"";let e=n.some(t=>t.unverified)?[Re]:[];return[Wt,...e,...n.map(t=>t.line),"[End Memory]"].join(`
2
2
  `)}var Ft=200,nr=7,jt=class{memoryDir;ledger;constructor(e=process.cwd()){this.memoryDir=ne(e,".agentx/memory"),this.ledger=new ft(ne(e,".agentx/wiki")),Mt(this.memoryDir)||er(this.memoryDir,{recursive:!0})}filePath(e){return ne(this.memoryDir,`${e}.jsonl`)}addMemory(e,t){if(t.category==="secret"||$e(t.content))return!1;let r=t.source.trust??dt(t.source.channel),o=t.review??lt(r),s={...t,source:{...t.source,trust:r},...o?{review:o}:{},id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,createdAt:new Date().toISOString()};return Xn(this.filePath(e),JSON.stringify(s)+`
3
3
  `),!0}parsedCache=new Map;getAll(e){let t=this.filePath(e);if(!Mt(t))return[];try{let{mtimeMs:r,size:o}=tr(t),s=this.parsedCache.get(t);if(s&&s.mtimeMs===r&&s.size===o)return s.facts.slice();let i=Et(t,"utf-8").split(`
4
4
  `).filter(d=>d.trim()).map(d=>{try{return JSON.parse(d)}catch{return null}}).filter(d=>d!==null);return this.parsedCache.set(t,{mtimeMs:r,size:o,facts:i}),i.slice()}catch{return[]}}findRelevant(e,t,r=8){let o=this.getAll(t).filter(Ae);if(o.length===0)return[];let s=o.map(g=>`${g.keywords.join(" ")} ${g.content}`),a=ne(this.memoryDir,`${t}_bm25_cache.json`),i=it(s,a),d=ot(e,i),l=new Map(d.map(g=>[g.docIndex,g.score])),c=o.map((g,m)=>{let y=l.get(m)??0;return g.category==="commitment"&&(y+=1),{memory:g,score:y}}).filter(g=>g.score>0);if(c.length===0)return o.slice(-r);let f=c.sort((g,m)=>m.score-g.score).slice(0,r).map(g=>g.memory);if(f.length>0)try{this.recordAccess(t,f.map(g=>g.id))}catch{}return f}buildContext(e){return Ot(this.contextLines(e))}contextFacts(e){return this.contextLines(e).map(t=>t.fact)}contextLines(e){let t=[];try{t=this.ledger.list()}catch{}return Dt(e,t)}recordAccess(e,t){if(t.length===0)return;let r=this.getAll(e),o=new Set(t),s=!1;for(let a of r)if(o.has(a.id)){a.accessCount=(a.accessCount||0)+1,a.lastAccessed=new Date().toISOString();let i=a.intervalDays||1;a.intervalDays=Math.min(i*2,30),a.nextReview=new Date(Date.now()+a.intervalDays*864e5).toISOString(),s=!0}s&&Pe(this.filePath(e),r.map(a=>JSON.stringify(a)).join(`
@@ -38,4 +38,4 @@ ${n.text}`}async function me(n,e){let t=n.channels[e.channel],r={channel:e.chann
38
38
  `).filter(Boolean),o=[];for(let s=r.length-1;s>=0&&o.length<t;s--)try{let a=JSON.parse(r[s]);(!e||a.person===e)&&o.push(a)}catch{}return o}load(){if(Xe(this.file))try{let e=JSON.parse(et(this.file,"utf-8"));if(e&&Array.isArray(e.devices))return e}catch{}return{devices:[]}}save(e){Sn(xn(this.file),{recursive:!0});let t=`${this.file}.${process.pid}.${Tn(4).toString("hex")}.tmp`;Rn(t,JSON.stringify(e,null,2)+`
39
39
  `,{encoding:"utf-8",mode:384}),An(t,this.file)}};import{extname as li}from"path";var Nn=/<agentx-artifact>([\s\S]*?)<\/agentx-artifact>/gi,Dn=/<agentx-artifact>[\s\S]*$/i;function ld(n,e=1/0,t=!1){let r=[],o=String(n??"");if(!/<agentx-artifact>/i.test(o))return{text:o,artifacts:r};let s=o.replace(Nn,(a,i)=>{try{let d=JSON.parse(i.trim());if(d&&typeof d.filename=="string"&&typeof d.mime=="string"&&r.length<e){let l=d.mime,p=l.startsWith("image/")?"image":l==="application/pdf"?"pdf":l.startsWith("text/")?"text":"file";r.push({type:p,filename:d.filename,mime:l})}}catch{}return""});return{text:(t?s.replace(Dn,""):s).trim(),artifacts:r}}function ud(n,e=!1){let t=String(n??""),r=t;if(/<agentx-artifact>/i.test(t)){let o=t.replace(Nn,(s,a)=>{try{let i=JSON.parse(a.trim());return i&&typeof i.filename=="string"?i.filename:""}catch{return""}});r=(e?o.replace(Dn,""):o).trim()}return r.replace(/```[\s\S]*?```|`[^`\n]*`|!\[([^\]\n]*)\]\(([^)\s]+)\)/g,(o,s,a)=>s===void 0||a===void 0?o:`[${s||a}](${a})`)}var ui={".png":{mime:"image/png",kind:"image"},".jpg":{mime:"image/jpeg",kind:"image"},".jpeg":{mime:"image/jpeg",kind:"image"},".gif":{mime:"image/gif",kind:"image"},".webp":{mime:"image/webp",kind:"image"},".svg":{mime:"image/svg+xml",kind:"file"},".pdf":{mime:"application/pdf",kind:"file"},".txt":{mime:"text/plain; charset=utf-8",kind:"file"},".md":{mime:"text/markdown; charset=utf-8",kind:"file"},".csv":{mime:"text/csv; charset=utf-8",kind:"file"},".json":{mime:"application/json",kind:"file"},".mp3":{mime:"audio/mpeg",kind:"audio"},".m4a":{mime:"audio/mp4",kind:"audio"},".wav":{mime:"audio/wav",kind:"audio"},".mp4":{mime:"video/mp4",kind:"video"},".webm":{mime:"video/webm",kind:"video"}},cd={bytes:20*1024*1024,perMessage:20,pathChars:512};function pd(n){return ui[li(n).toLowerCase()]??null}var ci=["[Phone app: showing files]","To show the owner a file you created (a chart, a screenshot, a PDF, a recording), save or copy it into .agentx/outbox/ in your workspace and end your reply with one line per file:",'<agentx-artifact>{"filename":".agentx/outbox/<name.ext>","mime":"<mime/type>"}</agentx-artifact>',"Files outside your workspace (/tmp, your home folder) are refused. Outbox files are removed after 7 days.","The line is removed from the text. Images show in the reply, audio and video get a player, other files an Open link. Allowed: png, jpg, gif, webp, svg, pdf, txt, md, csv, json, mp3, m4a, wav, mp4, webm; up to 20 MB and 20 files per reply.","A picture already on the web can go inline as ![what it shows](https://...)."].join(`
40
40
  `);function fd(n,e,t){return n==="app"&&e&&t!==!1?ci:void 0}import{lstatSync as nt,mkdirSync as pi,readdirSync as fi,realpathSync as tt,unlinkSync as gi}from"fs";import{join as be,resolve as On}from"path";var En=".agentx/outbox",mi=7*24*60*60*1e3;function hi(n,e){try{let t=tt(On(e,n)),r=be(t,En);return tt(r)===r&&nt(r).isDirectory()?r:null}catch{return null}}function wd(n,e={}){let t=e.cwd??process.cwd();if(e.create!==!1)try{let o=tt(On(t,n));nt(be(o,".agentx"),{throwIfNoEntry:!1})?.isSymbolicLink()||pi(be(o,En),{recursive:!0})}catch{return 0}let r=hi(n,t);return r?Mn(r,(e.now??Date.now())-(e.maxAgeMs??mi)):0}function Mn(n,e){let t=0;for(let r of fi(n)){let o=be(n,r);try{let s=nt(o);s.isDirectory()?t+=Mn(o,e):Math.max(s.mtimeMs,s.ctimeMs)<e&&(gi(o),t++)}catch{}}return t}export{Tt as a,jt as b,Ct as c,Di as d,ir as e,Oi as f,T as g,z as h,S as i,oe as j,Ir as k,Oe as l,F as m,Fe as n,Ce as o,Ge as p,To as q,Mo as r,Qe as s,_r as t,Go as u,Na as v,Da as w,Oa as x,Ea as y,Ma as z,Vo as A,Qo as B,Fa as C,ja as D,Ca as E,_a as F,Ha as G,Ka as H,Ba as I,qa as J,za as K,Ja as L,Ya as M,Ga as N,Va as O,Qa as P,Za as Q,ri as R,Xa as S,ed as T,td as U,nd as V,Wn as W,ld as X,ud as Y,cd as Z,pd as _,fd as $,En as aa,wd as ba};
41
- //# sourceMappingURL=chunk-BZ6Y264Z.js.map
41
+ //# sourceMappingURL=chunk-YGDJV4ZZ.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-OTENO5DS.js"),{installCliSignalExit:r}=await import("./signal-exit-WL7G3EEZ.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-XFZBG3EI.js"),{installCliSignalExit:r}=await import("./signal-exit-WL7G3EEZ.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-NW4N67TU.js";import"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
- //# sourceMappingURL=client-A2N6ETK2.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-IMITYHBT.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-VT7GT3SK.js.map
@@ -1,2 +1,2 @@
1
- import{Aa as g,Ba as h,Ca as i,Da as j,Ea as k,Fa as l,Ga as m,Ha as n,Ia as o,Ja as p,Ka as q,La as r,Ma as s,Na as t,Oa as u,Pa as v,Qa as w,Ra as x,Sa as y,Ua as z,ua as a,va as b,wa as c,xa as d,ya as e,za as f}from"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";z();export{a as INTEGRATION_KINDS,u as WIKI_CONTRIBUTE_JOB,v as WIKI_CONTRIBUTE_MERGE_JOB,x as WIKI_SUMMARIZE_JOB,o as approvalsConfigSchema,e as callsSchema,c as cameraBotSchema,s as crossFieldProblems,p as daemonConfigSchema,b as eventSubscriptionSchema,q as expandEnvVars,d as isCronExpression,r as loadDaemonConfig,l as membersConfigSchema,g as mergePolicyConfigSchema,k as peopleConfigSchema,j as personSchema,n as qualityReportConfigSchema,m as requestStatusConfigSchema,i as requestsConfigSchema,f as reviewGateConfigSchema,t as validateWorkspaces,h as watchersConfigSchema,w as withContributionJobs,y as withSummariesJob};
2
- //# sourceMappingURL=config-2QM2WTI2.js.map
1
+ import{Aa as g,Ba as h,Ca as i,Da as j,Ea as k,Fa as l,Ga as m,Ha as n,Ia as o,Ja as p,Ka as q,La as r,Ma as s,Na as t,Oa as u,Pa as v,Qa as w,Ra as x,Sa as y,Ua as z,ua as a,va as b,wa as c,xa as d,ya as e,za as f}from"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";z();export{a as INTEGRATION_KINDS,u as WIKI_CONTRIBUTE_JOB,v as WIKI_CONTRIBUTE_MERGE_JOB,x as WIKI_SUMMARIZE_JOB,o as approvalsConfigSchema,e as callsSchema,c as cameraBotSchema,s as crossFieldProblems,p as daemonConfigSchema,b as eventSubscriptionSchema,q as expandEnvVars,d as isCronExpression,r as loadDaemonConfig,l as membersConfigSchema,g as mergePolicyConfigSchema,k as peopleConfigSchema,j as personSchema,n as qualityReportConfigSchema,m as requestStatusConfigSchema,i as requestsConfigSchema,f as reviewGateConfigSchema,t as validateWorkspaces,h as watchersConfigSchema,w as withContributionJobs,y as withSummariesJob};
2
+ //# sourceMappingURL=config-NZS2UTHI.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-6QFDFYI7.js";import"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
- //# sourceMappingURL=config-mutate-UJS4F7BT.js.map
1
+ import{a,b}from"./chunk-X3T2GCSI.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
+ //# sourceMappingURL=config-mutate-LINLC354.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-ETBDN5WX.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-FUMSW5HD.js.map
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-S22IBRY6.js";import"./chunk-5IHUZVPU.js";import{f as Q,k as V}from"./chunk-5TTHN7DP.js";import{b as O}from"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-6TJNWUMA.js";import"./chunk-SKSYII3K.js";import"./chunk-EIY2HRAS.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-OWMKQ4HZ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import{b as N,c as H}from"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-RGJZV5RY.js";import"./chunk-EJTKLVIW.js";import{f as Q,k as V}from"./chunk-5TTHN7DP.js";import{b as O}from"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-FGJNSYHM.js";import"./chunk-SKSYII3K.js";import"./chunk-DJQIJF4R.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-Q5NLNLD5.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import{b as N,c as H}from"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-43FWZOGF.js.map
57
+ //# sourceMappingURL=contributions-67B3BYLV.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}from"./chunk-V3VWYIJ3.js";import"./chunk-5I7NJMK6.js";import"./chunk-IMLAPB7G.js";import"./chunk-X6C6U4GL.js";import"./chunk-MNG2AMKZ.js";import"./chunk-KP7KDLZ2.js";import"./chunk-OSH2PEBH.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{i as daemonVoiceCheck,b as doctor,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
+ //# sourceMappingURL=doctor-FOKX4K2G.js.map
@@ -1,7 +1,7 @@
1
- import{b as h}from"./chunk-GRI5HOPC.js";import"./chunk-RKPAVWXF.js";import"./chunk-5QXRPYOY.js";import{b as I}from"./chunk-PYHR4HXO.js";import"./chunk-KP7KDLZ2.js";import"./chunk-6YNRLI6I.js";import"./chunk-E7LPZAXP.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-C5UTFHPB.js";import"./chunk-RKPAVWXF.js";import"./chunk-CTQ25CUL.js";import{b as I}from"./chunk-PYHR4HXO.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVJXXELY.js";import"./chunk-ETBDN5WX.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-VB7K6HCL.js.map
7
+ //# sourceMappingURL=follow-up-tool-JOIOYOON.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-JOHDOEZ4.js";import"./chunk-A76PNG4E.js";import"./chunk-MNG2AMKZ.js";import"./chunk-2QNT5JDS.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-2S33F2LV.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-DFGANY25.js";import"./chunk-X6C6U4GL.js";import"./chunk-MNG2AMKZ.js";import"./chunk-2QNT5JDS.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-QXF7N6SS.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-2MW32M2D.js";import"./chunk-DWOERPBG.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-EIY2HRAS.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWMKQ4HZ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
- //# sourceMappingURL=hub-JNNNUAZM.js.map
1
+ import{a}from"./chunk-XD7HTMOP.js";import"./chunk-DWXCZRBJ.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-DJQIJF4R.js";import"./chunk-WPNRDEHW.js";import"./chunk-Q5NLNLD5.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
+ //# sourceMappingURL=hub-QETWDYPD.js.map
package/dist/index.d.ts CHANGED
@@ -6857,14 +6857,21 @@ declare const daemonConfigSchema: z.ZodObject<{
6857
6857
  * the person (#846): run that turn once more after the next start,
6858
6858
  * and if it fails again, tell the person and note the open request. */
6859
6859
  requeueRelayOnRestart: z.ZodDefault<z.ZodBoolean>;
6860
+ /** An agent's send_agent from a turn no person waits on (#1100): the
6861
+ * answer, failure or timeout comes back as a turn in the asking
6862
+ * agent's own chat, and a message the callee writes back to it lands
6863
+ * there too. Off: such a send is queued and its answer only logged. */
6864
+ callbackSends: z.ZodDefault<z.ZodBoolean>;
6860
6865
  }, "strip", z.ZodTypeAny, {
6861
6866
  asyncWhenHuman: boolean;
6862
6867
  timeoutMinutes: number;
6863
6868
  requeueRelayOnRestart: boolean;
6869
+ callbackSends: boolean;
6864
6870
  }, {
6865
6871
  asyncWhenHuman?: boolean | undefined;
6866
6872
  timeoutMinutes?: number | undefined;
6867
6873
  requeueRelayOnRestart?: boolean | undefined;
6874
+ callbackSends?: boolean | undefined;
6868
6875
  }>>;
6869
6876
  }, "strip", z.ZodTypeAny, {
6870
6877
  enabled: boolean;
@@ -6872,6 +6879,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6872
6879
  asyncWhenHuman: boolean;
6873
6880
  timeoutMinutes: number;
6874
6881
  requeueRelayOnRestart: boolean;
6882
+ callbackSends: boolean;
6875
6883
  };
6876
6884
  peers: {
6877
6885
  name: string;
@@ -6898,6 +6906,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6898
6906
  asyncWhenHuman?: boolean | undefined;
6899
6907
  timeoutMinutes?: number | undefined;
6900
6908
  requeueRelayOnRestart?: boolean | undefined;
6909
+ callbackSends?: boolean | undefined;
6901
6910
  } | undefined;
6902
6911
  peers?: {
6903
6912
  name: string;
@@ -8933,6 +8942,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8933
8942
  asyncWhenHuman: boolean;
8934
8943
  timeoutMinutes: number;
8935
8944
  requeueRelayOnRestart: boolean;
8945
+ callbackSends: boolean;
8936
8946
  };
8937
8947
  peers: {
8938
8948
  name: string;
@@ -10023,6 +10033,7 @@ declare const daemonConfigSchema: z.ZodObject<{
10023
10033
  asyncWhenHuman?: boolean | undefined;
10024
10034
  timeoutMinutes?: number | undefined;
10025
10035
  requeueRelayOnRestart?: boolean | undefined;
10036
+ callbackSends?: boolean | undefined;
10026
10037
  } | undefined;
10027
10038
  peers?: {
10028
10039
  name: string;
@@ -11145,6 +11156,9 @@ declare class A2AMesh {
11145
11156
  /** The task's type (#1049): picks the evidence the peer's watcher
11146
11157
  * asks for before the task counts as done. */
11147
11158
  taskType?: string;
11159
+ /** Callback hops behind this send (#1100), so the peer's callee
11160
+ * stays under MAX_SEND_DEPTH. Top level, like taskType. */
11161
+ sendDepth?: number;
11148
11162
  }): Promise<string>;
11149
11163
  /**
11150
11164
  * Streaming variant of `sendTask`. POSTs to the peer's `/task` with
@@ -11874,6 +11888,9 @@ declare class AgentXDaemon {
11874
11888
  * peer: this node's agents have MESH_TOKEN in their environment, and
11875
11889
  * the MCP server sends it on every daemon call (#797). */
11876
11890
  private carriesMeshToken;
11891
+ /** GET /screen: every source read on its own, so one that fails is
11892
+ * named and the rest still show. */
11893
+ private screenView;
11877
11894
  /** Tell the owner about a request: a push, and the Mac banner. */
11878
11895
  private notifyRequestOwner;
11879
11896
  private plansSweeping;
@@ -11894,6 +11911,9 @@ declare class AgentXDaemon {
11894
11911
  * closed ones are deleted (src/requests/sweep.ts). Plans first: a
11895
11912
  * blocked step marks its request told, so the owner hears once. */
11896
11913
  private sweepRequests;
11914
+ /** Wait, up to `maxMs`, for the agent's turn in this chat to end, so a
11915
+ * turn told there does not run beside it (#1100). False: still busy. */
11916
+ private waitForChat;
11897
11917
  /** The watcher checkpoint at every task start (src/watchers, #1030). */
11898
11918
  private attachTaskWatchers;
11899
11919
  /** Tell the owner through the notify path: a push to the default
@@ -12688,6 +12708,9 @@ interface AgentTask {
12688
12708
  peer?: string;
12689
12709
  status: string;
12690
12710
  };
12711
+ /** The issue or merge request the work is about, when the delegating
12712
+ * agent named it (#1100). */
12713
+ home?: string;
12691
12714
  };
12692
12715
  }
12693
12716
  interface AgentResponse {
@@ -13071,6 +13094,20 @@ declare class SessionStore {
13071
13094
  * Store the Claude Code session ID after first invocation.
13072
13095
  */
13073
13096
  setClaudeSessionId(agentId: string, channel: string, chatId: string, claudeSessionId: string): void;
13097
+ /**
13098
+ * Point a new chat at the agent session of an earlier chat (#1100): the
13099
+ * native session ids, and with them what the rotation checks read (turn
13100
+ * count, last context size, last use), so a continued session is still
13101
+ * rotated when it grows or goes stale. False when the earlier chat has
13102
+ * no session to continue; nothing is written then.
13103
+ */
13104
+ continueFrom(agentId: string, from: {
13105
+ channel: string;
13106
+ chatId: string;
13107
+ }, to: {
13108
+ channel: string;
13109
+ chatId: string;
13110
+ }): boolean;
13074
13111
  getCodexSessionId(agentId: string, channel: string, chatId: string): string | undefined;
13075
13112
  setCodexSessionId(agentId: string, channel: string, chatId: string, codexSessionId: string): void;
13076
13113
  getOpenCodeSessionId(agentId: string, channel: string, chatId: string): string | undefined;
@@ -15868,6 +15905,9 @@ interface RunningTask {
15868
15905
  sender?: string;
15869
15906
  /** Wall-clock start. */
15870
15907
  startedAt: Date;
15908
+ /** The issues or merge requests the run is about (#1100), in the form
15909
+ * src/a2a/home.ts compares. */
15910
+ homes?: string[];
15871
15911
  /** The step the run is in right now (classify, compact, agent, …). A run
15872
15912
  * that hangs shows here where it stopped. */
15873
15913
  step?: string;
@@ -16249,6 +16289,8 @@ declare class AgentRegistry {
16249
16289
  * channel and chat it must be the only run on that chat. With neither
16250
16290
  * there is no answer: guessing "the agent's only turn" could attach a
16251
16291
  * same-host proxy's request to an unrelated conversation. */
16292
+ /** The trace id of a running task of `agentId`, once allocated. */
16293
+ runningTraceId(agentId: string, taskId: string): string | null;
16252
16294
  findRunningTurn(agentId: string, by?: {
16253
16295
  taskId?: string;
16254
16296
  channel?: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Ba as Tt,Ca 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-XNS5OQ3U.js";import"./chunk-QZ6VBDMX.js";import"./chunk-GTJIKXDB.js";import"./chunk-ATCIRFH6.js";import"./chunk-WGPMUWX7.js";import"./chunk-7LN4VKDU.js";import"./chunk-IMLAPB7G.js";import"./chunk-ZVP6GB4G.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-JOHDOEZ4.js";import"./chunk-A76PNG4E.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-IGA3T3ZT.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-EMGB23H5.js";import"./chunk-JAML6222.js";import"./chunk-YMX3QCV7.js";import"./chunk-JWDJMFU6.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-MNG2AMKZ.js";import"./chunk-X7UQY7CH.js";import"./chunk-5QXRPYOY.js";import"./chunk-PYHR4HXO.js";import"./chunk-KP7KDLZ2.js";import"./chunk-A5GYG56I.js";import{m as lt,n as ct,o as dt,p as mt,pa as yt,q as pt}from"./chunk-Z7GEW2SR.js";import"./chunk-BZ6Y264Z.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-UG2OF2EI.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-NMYC5RW7.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-5TTHN7DP.js";import{s as ut}from"./chunk-6YNRLI6I.js";import"./chunk-E7LPZAXP.js";import"./chunk-3UOTLMXD.js";import"./chunk-36AXN6ZB.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-2MW32M2D.js";import{a as ht}from"./chunk-DWOERPBG.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-6TJNWUMA.js";import"./chunk-SKSYII3K.js";import{f as gt,g as ft}from"./chunk-EIY2HRAS.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-GMMRBTLQ.js";import{j as it,k as rt,l as at}from"./chunk-OWMKQ4HZ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-6TURWSMN.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-2PJKGZWP.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Ja as tt,La as st,Na as ot,Ua as nt}from"./chunk-PXKIPU27.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
1
+ import{Ba as Tt,Ca 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-6LFOX6Q5.js";import"./chunk-PUSBK2OQ.js";import"./chunk-GTJIKXDB.js";import"./chunk-ALE354ZC.js";import"./chunk-5I7NJMK6.js";import"./chunk-7LN4VKDU.js";import"./chunk-IMLAPB7G.js";import"./chunk-ZVP6GB4G.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-DFGANY25.js";import"./chunk-X6C6U4GL.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-LVS5ESTS.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-EMGB23H5.js";import"./chunk-JAML6222.js";import"./chunk-YMX3QCV7.js";import"./chunk-JWDJMFU6.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-MNG2AMKZ.js";import"./chunk-X7UQY7CH.js";import"./chunk-CTQ25CUL.js";import"./chunk-PYHR4HXO.js";import"./chunk-KP7KDLZ2.js";import"./chunk-A5GYG56I.js";import{m as lt,n as ct,o as dt,p as mt,q as pt,ra as yt}from"./chunk-O7SYQXKS.js";import"./chunk-YGDJV4ZZ.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-UG2OF2EI.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-TZZBGWLX.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-5TTHN7DP.js";import{s as ut}from"./chunk-XVJXXELY.js";import"./chunk-ETBDN5WX.js";import"./chunk-3UOTLMXD.js";import"./chunk-36AXN6ZB.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-XD7HTMOP.js";import{a as ht}from"./chunk-DWXCZRBJ.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-FGJNSYHM.js";import"./chunk-SKSYII3K.js";import{f as gt,g as ft}from"./chunk-DJQIJF4R.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-2GJQDJBF.js";import{j as it,k as rt,l as at}from"./chunk-Q5NLNLD5.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-6TURWSMN.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-2PJKGZWP.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Ja as tt,La as st,Na as ot,Ua as nt}from"./chunk-L6IW6HWE.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
2
2
  `)}
3
3
 
4
4
  ${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).