agentix-cli 0.116.0 → 0.117.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 (107) hide show
  1. package/dist/{App-7Z2PWARZ.js → App-UQP7UQYV.js} +2 -2
  2. package/dist/{ChatApp-GFAIRLGZ.js → ChatApp-VGSP5O6N.js} +2 -2
  3. package/dist/{agent-LXLZGVW3.js → agent-MO27U4Y7.js} +2 -2
  4. package/dist/{board-dashboard-CPCSSVZE.js → board-dashboard-CSS7XMIZ.js} +4 -4
  5. package/dist/{chunk-6LCP6SVR.js → chunk-2WK5A3UV.js} +2 -2
  6. package/dist/{chunk-ELWKTURG.js → chunk-45GOH6F7.js} +2 -2
  7. package/dist/chunk-45YETJY4.js +2 -0
  8. package/dist/chunk-45YETJY4.js.map +1 -0
  9. package/dist/{chunk-HOY2GIKV.js → chunk-4ELAUGOP.js} +2 -2
  10. package/dist/{chunk-B65YTB3T.js → chunk-5PPMPCHG.js} +2 -2
  11. package/dist/{chunk-YMNQYODO.js → chunk-746KHKT4.js} +2 -2
  12. package/dist/{chunk-KI4CIUVJ.js → chunk-BQ2HJ7TS.js} +2 -2
  13. package/dist/{chunk-IEZ6OYFJ.js → chunk-CKQ2YDFP.js} +2 -2
  14. package/dist/{chunk-AWQIUI7N.js → chunk-CUZTLQH2.js} +2 -2
  15. package/dist/chunk-FJI5GRBH.js +54 -0
  16. package/dist/chunk-FJI5GRBH.js.map +1 -0
  17. package/dist/{chunk-JLCJVPRC.js → chunk-HVZVFCJX.js} +2 -2
  18. package/dist/{chunk-J3SIOMDL.js → chunk-HYGMWCUU.js} +2 -2
  19. package/dist/{chunk-CKYSGX54.js → chunk-IZMXAXW3.js} +173 -173
  20. package/dist/chunk-IZMXAXW3.js.map +1 -0
  21. package/dist/{chunk-HSYNOMM2.js → chunk-J2YLOGNN.js} +2 -2
  22. package/dist/{chunk-CCL73Z2P.js → chunk-MSP25HE5.js} +58 -58
  23. package/dist/{chunk-CCL73Z2P.js.map → chunk-MSP25HE5.js.map} +1 -1
  24. package/dist/{chunk-7IF3LXAU.js → chunk-OJ7KM2UO.js} +2 -2
  25. package/dist/{chunk-S56ZGAFM.js → chunk-PFK3QO6S.js} +2 -2
  26. package/dist/{chunk-EKOVLUKH.js → chunk-PMQ47IPT.js} +2 -2
  27. package/dist/{chunk-R277UDDQ.js → chunk-T2VDHVYW.js} +2 -2
  28. package/dist/{chunk-Y3CZE54A.js → chunk-VEHTVYP6.js} +2 -2
  29. package/dist/{chunk-UUMNP47Q.js → chunk-VRXJW6JJ.js} +2 -2
  30. package/dist/{chunk-WRICEAR6.js → chunk-W7WNRPNQ.js} +2 -2
  31. package/dist/cli.js +1 -1
  32. package/dist/{client-CU5GNTKR.js → client-5UMNDY7Z.js} +2 -2
  33. package/dist/{config-ITVBNUWW.js → config-O44DOHFW.js} +2 -2
  34. package/dist/config-mutator-PRLY2TCE.js +2 -0
  35. package/dist/{doctor-MLD3XCYE.js → doctor-NKPH74F7.js} +2 -2
  36. package/dist/index.d.ts +38 -1
  37. package/dist/index.js +1 -1
  38. package/dist/{program-IBOVOVZI.js → program-RHIJYCEJ.js} +139 -139
  39. package/dist/program-RHIJYCEJ.js.map +1 -0
  40. package/dist/{promote-JMJPWZI7.js → promote-ZRNVPWTD.js} +2 -2
  41. package/dist/push-bridge-VPTQNM43.js +2 -0
  42. package/dist/{query-QGPVKGYY.js → query-HURONGKA.js} +2 -2
  43. package/dist/{registry-PZNC5XYT.js → registry-AYGFAKTC.js} +2 -2
  44. package/dist/{request-planner-M4IKDZBU.js → request-planner-ZZRSOBQZ.js} +2 -2
  45. package/dist/{review-candidates-6DNRBJZ6.js → review-candidates-KHH47PK7.js} +2 -2
  46. package/dist/{routing-7NSB6O2S.js → routing-GUBKKWPT.js} +2 -2
  47. package/dist/schedule-tool-VH77T3N3.js +2 -0
  48. package/dist/scheduler-SZ4YYXJE.js +2 -0
  49. package/dist/{seat-ZRCUQCUP.js → seat-CVTTTE5V.js} +2 -2
  50. package/dist/{select-OLNLTEBR.js → select-OUTM6OBC.js} +2 -2
  51. package/dist/{set-enabled-LG3ESZDC.js → set-enabled-2QKQRVUN.js} +2 -2
  52. package/dist/{tool-S6U42ULD.js → tool-OFXHMLE5.js} +2 -2
  53. package/dist/{tool-RBXRPIBV.js → tool-XY7QGHLV.js} +2 -2
  54. package/dist/wiki-46GMWX34.js +2 -0
  55. package/package.json +1 -1
  56. package/dist/chunk-BRL3UPFW.js +0 -2
  57. package/dist/chunk-BRL3UPFW.js.map +0 -1
  58. package/dist/chunk-CKYSGX54.js.map +0 -1
  59. package/dist/chunk-FBEMUCBO.js +0 -54
  60. package/dist/chunk-FBEMUCBO.js.map +0 -1
  61. package/dist/config-mutator-5YRHHA2I.js +0 -2
  62. package/dist/program-IBOVOVZI.js.map +0 -1
  63. package/dist/push-bridge-IFUQLIMF.js +0 -2
  64. package/dist/schedule-tool-ZP7H55EL.js +0 -2
  65. package/dist/scheduler-XV5UQQYH.js +0 -2
  66. package/dist/wiki-XKQN5CWR.js +0 -2
  67. /package/dist/{App-7Z2PWARZ.js.map → App-UQP7UQYV.js.map} +0 -0
  68. /package/dist/{ChatApp-GFAIRLGZ.js.map → ChatApp-VGSP5O6N.js.map} +0 -0
  69. /package/dist/{agent-LXLZGVW3.js.map → agent-MO27U4Y7.js.map} +0 -0
  70. /package/dist/{board-dashboard-CPCSSVZE.js.map → board-dashboard-CSS7XMIZ.js.map} +0 -0
  71. /package/dist/{chunk-6LCP6SVR.js.map → chunk-2WK5A3UV.js.map} +0 -0
  72. /package/dist/{chunk-ELWKTURG.js.map → chunk-45GOH6F7.js.map} +0 -0
  73. /package/dist/{chunk-HOY2GIKV.js.map → chunk-4ELAUGOP.js.map} +0 -0
  74. /package/dist/{chunk-B65YTB3T.js.map → chunk-5PPMPCHG.js.map} +0 -0
  75. /package/dist/{chunk-YMNQYODO.js.map → chunk-746KHKT4.js.map} +0 -0
  76. /package/dist/{chunk-KI4CIUVJ.js.map → chunk-BQ2HJ7TS.js.map} +0 -0
  77. /package/dist/{chunk-IEZ6OYFJ.js.map → chunk-CKQ2YDFP.js.map} +0 -0
  78. /package/dist/{chunk-AWQIUI7N.js.map → chunk-CUZTLQH2.js.map} +0 -0
  79. /package/dist/{chunk-JLCJVPRC.js.map → chunk-HVZVFCJX.js.map} +0 -0
  80. /package/dist/{chunk-J3SIOMDL.js.map → chunk-HYGMWCUU.js.map} +0 -0
  81. /package/dist/{chunk-HSYNOMM2.js.map → chunk-J2YLOGNN.js.map} +0 -0
  82. /package/dist/{chunk-7IF3LXAU.js.map → chunk-OJ7KM2UO.js.map} +0 -0
  83. /package/dist/{chunk-S56ZGAFM.js.map → chunk-PFK3QO6S.js.map} +0 -0
  84. /package/dist/{chunk-EKOVLUKH.js.map → chunk-PMQ47IPT.js.map} +0 -0
  85. /package/dist/{chunk-R277UDDQ.js.map → chunk-T2VDHVYW.js.map} +0 -0
  86. /package/dist/{chunk-Y3CZE54A.js.map → chunk-VEHTVYP6.js.map} +0 -0
  87. /package/dist/{chunk-UUMNP47Q.js.map → chunk-VRXJW6JJ.js.map} +0 -0
  88. /package/dist/{chunk-WRICEAR6.js.map → chunk-W7WNRPNQ.js.map} +0 -0
  89. /package/dist/{client-CU5GNTKR.js.map → client-5UMNDY7Z.js.map} +0 -0
  90. /package/dist/{config-ITVBNUWW.js.map → config-O44DOHFW.js.map} +0 -0
  91. /package/dist/{config-mutator-5YRHHA2I.js.map → config-mutator-PRLY2TCE.js.map} +0 -0
  92. /package/dist/{doctor-MLD3XCYE.js.map → doctor-NKPH74F7.js.map} +0 -0
  93. /package/dist/{promote-JMJPWZI7.js.map → promote-ZRNVPWTD.js.map} +0 -0
  94. /package/dist/{push-bridge-IFUQLIMF.js.map → push-bridge-VPTQNM43.js.map} +0 -0
  95. /package/dist/{query-QGPVKGYY.js.map → query-HURONGKA.js.map} +0 -0
  96. /package/dist/{registry-PZNC5XYT.js.map → registry-AYGFAKTC.js.map} +0 -0
  97. /package/dist/{request-planner-M4IKDZBU.js.map → request-planner-ZZRSOBQZ.js.map} +0 -0
  98. /package/dist/{review-candidates-6DNRBJZ6.js.map → review-candidates-KHH47PK7.js.map} +0 -0
  99. /package/dist/{routing-7NSB6O2S.js.map → routing-GUBKKWPT.js.map} +0 -0
  100. /package/dist/{schedule-tool-ZP7H55EL.js.map → schedule-tool-VH77T3N3.js.map} +0 -0
  101. /package/dist/{scheduler-XV5UQQYH.js.map → scheduler-SZ4YYXJE.js.map} +0 -0
  102. /package/dist/{seat-ZRCUQCUP.js.map → seat-CVTTTE5V.js.map} +0 -0
  103. /package/dist/{select-OLNLTEBR.js.map → select-OUTM6OBC.js.map} +0 -0
  104. /package/dist/{set-enabled-LG3ESZDC.js.map → set-enabled-2QKQRVUN.js.map} +0 -0
  105. /package/dist/{tool-S6U42ULD.js.map → tool-OFXHMLE5.js.map} +0 -0
  106. /package/dist/{tool-RBXRPIBV.js.map → tool-XY7QGHLV.js.map} +0 -0
  107. /package/dist/{wiki-XKQN5CWR.js.map → wiki-46GMWX34.js.map} +0 -0
@@ -1,2 +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,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-7IF3LXAU.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6W74CHNW.js";import"./chunk-KI4CIUVJ.js";import"./chunk-CECHWYJ2.js";import"./chunk-YMNQYODO.js";import"./chunk-WPNRDEHW.js";import"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
- //# sourceMappingURL=promote-JMJPWZI7.js.map
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,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-OJ7KM2UO.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6W74CHNW.js";import"./chunk-BQ2HJ7TS.js";import"./chunk-CECHWYJ2.js";import"./chunk-746KHKT4.js";import"./chunk-WPNRDEHW.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
+ //# sourceMappingURL=promote-ZRNVPWTD.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-45YETJY4.js";import"./chunk-DMHQIACQ.js";import"./chunk-JWDJMFU6.js";import"./chunk-GRMCAO3Q.js";import"./chunk-KZKDVIOE.js";import"./chunk-QIJLFPWE.js";export{i as PushRosterSync,a as ROSTER_CHECK_MS,b as ROSTER_RESEND_MS,h as handlePushBridge,g as peerOrigins,d as pushBridgeCaller,c as pushOrigin,f as relayTokenProblem,e as scopedPushTarget};
2
+ //# sourceMappingURL=push-bridge-VPTQNM43.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c}from"./chunk-R277UDDQ.js";import"./chunk-YMNQYODO.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_GRAPH_WEIGHT,a as agenticQuery,c as rankCatalogPool};
2
- //# sourceMappingURL=query-QGPVKGYY.js.map
1
+ import{a,b,c}from"./chunk-T2VDHVYW.js";import"./chunk-746KHKT4.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_GRAPH_WEIGHT,a as agenticQuery,c as rankCatalogPool};
2
+ //# sourceMappingURL=query-HURONGKA.js.map
@@ -1,2 +1,2 @@
1
- import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l,ca as m,da as n}from"./chunk-CCL73Z2P.js";import"./chunk-B65YTB3T.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-J3SIOMDL.js";import"./chunk-JLCJVPRC.js";import"./chunk-VWTBHLMX.js";import"./chunk-EKOVLUKH.js";import"./chunk-KI4CIUVJ.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-UUMNP47Q.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-R277UDDQ.js";import"./chunk-YMNQYODO.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{m as AgentRegistry,a as EDIT_TOOL_INSTRUCTION,h as TRACE_STEP_SUMMARY_BYTES,e as buildEntryMeta,f as buildEventDigest,g as buildWikiContext,i as clipForTrace,b as codingInstructions,l as emitTraceStepsFromStreamEvent,k as firstMissingRequiredTool,d as getGlobalRegistry,n as richReplyPrompt,c as setGlobalRegistry,j as tallyToolUses};
2
- //# sourceMappingURL=registry-PZNC5XYT.js.map
1
+ import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l,ca as m,da as n}from"./chunk-MSP25HE5.js";import"./chunk-5PPMPCHG.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-HYGMWCUU.js";import"./chunk-HVZVFCJX.js";import"./chunk-VWTBHLMX.js";import"./chunk-PMQ47IPT.js";import"./chunk-BQ2HJ7TS.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-VRXJW6JJ.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-T2VDHVYW.js";import"./chunk-746KHKT4.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{m as AgentRegistry,a as EDIT_TOOL_INSTRUCTION,h as TRACE_STEP_SUMMARY_BYTES,e as buildEntryMeta,f as buildEventDigest,g as buildWikiContext,i as clipForTrace,b as codingInstructions,l as emitTraceStepsFromStreamEvent,k as firstMissingRequiredTool,d as getGlobalRegistry,n as richReplyPrompt,c as setGlobalRegistry,j as tallyToolUses};
2
+ //# sourceMappingURL=registry-AYGFAKTC.js.map
@@ -1,6 +1,6 @@
1
- import{p as f,s as h,v as g,y as m,z as E}from"./chunk-WRICEAR6.js";import{a as p,f as w}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";E();w();var l="request-gate",x="request-context",q=.1,C=3e3;function b(t,s){return s??f(t)??C}async function k(t,s,n,r=Math.random){let d=g(l)==="active";if(d){let e=h().seats[l]?.holdout??q;if(r()<e)return{active:!0,preprocess:!1,arm:"holdout"}}let i=d?"treatment":void 0,a=await m(l,{request:t.slice(0,2e3),agent:s,channel:n,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:p("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:b(l)});if(!a||a.mode!=="active")return{active:!1,preprocess:!1,arm:i};let c=a.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(c)&&c>=.5,arm:i}}var T={patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"},v=[{id:"landscape",header:/^\[Landscape\]$/,description:"Directory of the other agents on this node and on mesh peers, and the channels they are on"},{id:"landscape.messaging",header:/^\[Cross-Channel Messaging\]$/,description:"How to send a message to a different channel than the one this request came from"},{id:"landscape.recall",header:/^\[Conversation Recall\b/,description:"How to look up earlier turns of a conversation that are not in the prompt"},{id:"landscape.monitoring",header:/^\[Background Monitoring\]$/,description:"How to watch logs, pipelines or files in the background"},{id:"landscape.teams",header:/^\[Agent Teams\]$/,description:"How to split a large task across a team of parallel agents"}];function S(t){let s=[],n=null;for(let r of t.split(`
1
+ import{p as f,s as h,v as g,y as m,z as E}from"./chunk-W7WNRPNQ.js";import{a as p,f as w}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";E();w();var l="request-gate",x="request-context",q=.1,C=3e3;function b(t,s){return s??f(t)??C}async function k(t,s,n,r=Math.random){let d=g(l)==="active";if(d){let e=h().seats[l]?.holdout??q;if(r()<e)return{active:!0,preprocess:!1,arm:"holdout"}}let i=d?"treatment":void 0,a=await m(l,{request:t.slice(0,2e3),agent:s,channel:n,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:p("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:b(l)});if(!a||a.mode!=="active")return{active:!1,preprocess:!1,arm:i};let c=a.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(c)&&c>=.5,arm:i}}var T={patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"},v=[{id:"landscape",header:/^\[Landscape\]$/,description:"Directory of the other agents on this node and on mesh peers, and the channels they are on"},{id:"landscape.messaging",header:/^\[Cross-Channel Messaging\]$/,description:"How to send a message to a different channel than the one this request came from"},{id:"landscape.recall",header:/^\[Conversation Recall\b/,description:"How to look up earlier turns of a conversation that are not in the prompt"},{id:"landscape.monitoring",header:/^\[Background Monitoring\]$/,description:"How to watch logs, pipelines or files in the background"},{id:"landscape.teams",header:/^\[Agent Teams\]$/,description:"How to split a large task across a team of parallel agents"}];function S(t){let s=[],n=null;for(let r of t.split(`
2
2
  `)){let d=/^\[[^\]]+\]$/.test(r);if(d||!n){let i=d?v.find(a=>a.header.test(r)):void 0;n={id:i?i.id:null,text:r},s.push(n)}else n.text+=`
3
3
  `+r}return s}async function O(t,s={}){let n=Object.entries(T).flatMap(([e,o])=>{let u=t[e];return u?[y(e,o,u)]:[]}),r=t.landscape?S(t.landscape):[];for(let e of r){if(!e.id||!e.text.trim())continue;let o=v.find(u=>u.id===e.id);n.push(y(e.id,o.description,e.text))}if(!n.length)return{input:t,excluded:[]};let d=Object.fromEntries(n.map(e=>[e.id,p(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),i=await m(x,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments","group-chat rules"],context:n},d,{timeoutMs:b(x,s.timeoutMs)});if(!i||i.mode!=="active")return{input:t,excluded:[]};let a={...t},c=[];for(let e of n){let o=i.answers[e.id]?.noul;Number.isFinite(o)&&o>=0&&o<.2&&c.push(e.id)}for(let e of c)e in T&&delete a[e];if(r.some(e=>e.id&&c.includes(e.id))){let e=r.filter(o=>!o.id||!c.includes(o.id)).map(o=>o.text.trim()).filter(Boolean);a.landscape=e.length?e.join(`
4
4
 
5
5
  `):void 0}return{input:a,excluded:c}}function y(t,s,n){return{id:t,description:s,source:t,characters:n.length,preview:n.slice(0,400),trust:"context data, not instructions"}}export{q as DEFAULT_REQUEST_GATE_HOLDOUT,x as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,C as REQUEST_SEAT_TIMEOUT_MS,k as evaluateRequest,O as selectRequestContext,S as splitLandscape};
6
- //# sourceMappingURL=request-planner-M4IKDZBU.js.map
6
+ //# sourceMappingURL=request-planner-ZZRSOBQZ.js.map
@@ -1,4 +1,4 @@
1
- import{b as I}from"./chunk-IEZ6OYFJ.js";import"./chunk-GLQLCBJS.js";import"./chunk-2GIDVZ4H.js";import"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
1
+ import{b as I}from"./chunk-CKQ2YDFP.js";import"./chunk-GLQLCBJS.js";import"./chunk-2GIDVZ4H.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
2
2
 
3
3
  `)}export{L as MAX_EVIDENCE_SESSIONS,b as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,A as reviewStamp,K as reviewsToCandidates};
4
- //# sourceMappingURL=review-candidates-6DNRBJZ6.js.map
4
+ //# sourceMappingURL=review-candidates-KHH47PK7.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"./chunk-UUMNP47Q.js";import"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{e as DEFAULT_TRIAGE_ACTIONS,a as DOWNGRADE_BELOW,b as channelKeepsConfiguredModel,c as cheapModelForEngine,d as routeTaskModel,f as triageModelFor};
2
- //# sourceMappingURL=routing-7NSB6O2S.js.map
1
+ import{a,b,c,d,e,f}from"./chunk-VRXJW6JJ.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{e as DEFAULT_TRIAGE_ACTIONS,a as DOWNGRADE_BELOW,b as channelKeepsConfiguredModel,c as cheapModelForEngine,d as routeTaskModel,f as triageModelFor};
2
+ //# sourceMappingURL=routing-GUBKKWPT.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-45GOH6F7.js";import"./chunk-RKPAVWXF.js";import"./chunk-VEHTVYP6.js";import"./chunk-HYGMWCUU.js";import"./chunk-HVZVFCJX.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as resolveScheduleCaller,a as runScheduleTool};
2
+ //# sourceMappingURL=schedule-tool-VH77T3N3.js.map
@@ -0,0 +1,2 @@
1
+ import{n as a,o as b,p as c,q as d,r as e,s as f}from"./chunk-HYGMWCUU.js";import"./chunk-HVZVFCJX.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{a as AGENT_RUN_TIMEOUT_FLOOR,f as CronScheduler,b as agentRunTimeout,e as cronRunId,d as getNextCronDate,c as runLinkIds};
2
+ //# sourceMappingURL=scheduler-SZ4YYXJE.js.map
@@ -1,2 +1,2 @@
1
- import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-WRICEAR6.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";l();export{a as DEFAULT_SEAT_TIMEOUT_MS,k as askSeat,c as configureDecisions,b as configuredSeatTimeout,e as decisionsRuntime,h as getSeatMode,i as labelSeatCall,f as parseSeatMode,j as recordSeatOutcome,d as resetDecisionsRuntime,g as seatEnvVar};
2
- //# sourceMappingURL=seat-ZRCUQCUP.js.map
1
+ import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";l();export{a as DEFAULT_SEAT_TIMEOUT_MS,k as askSeat,c as configureDecisions,b as configuredSeatTimeout,e as decisionsRuntime,h as getSeatMode,i as labelSeatCall,f as parseSeatMode,j as recordSeatOutcome,d as resetDecisionsRuntime,g as seatEnvVar};
2
+ //# sourceMappingURL=seat-CVTTTE5V.js.map
@@ -1,2 +1,2 @@
1
- import{y as S,z as w}from"./chunk-WRICEAR6.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
- //# sourceMappingURL=select-OLNLTEBR.js.map
1
+ import{y as S,z as w}from"./chunk-W7WNRPNQ.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
+ //# sourceMappingURL=select-OUTM6OBC.js.map
@@ -1,2 +1,2 @@
1
- import{b as a}from"./chunk-JLCJVPRC.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
2
- //# sourceMappingURL=set-enabled-LG3ESZDC.js.map
1
+ import{b as a}from"./chunk-HVZVFCJX.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
2
+ //# sourceMappingURL=set-enabled-2QKQRVUN.js.map
@@ -1,4 +1,4 @@
1
- import{b as g}from"./chunk-ELWKTURG.js";import"./chunk-RKPAVWXF.js";import{b as h}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-Y3CZE54A.js";import"./chunk-J3SIOMDL.js";import"./chunk-JLCJVPRC.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var $=t=>typeof t=="string"?t.trim():"",w={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function f(t){return t.length?t.map(e=>{let i=new Date(e.createdAt).toISOString().slice(0,16).replace("T"," "),a=e.state==="waiting_owner"&&e.question?` Question: ${e.question}`:e.state==="needs_attention"&&e.attentionReason?` ${e.attentionReason}`:"",n=String(e.text).replace(/\s+/g," ").trim();return`- ${e.id} [${w[e.state]??e.state}] ${i} UTC, ${e.channel}, ${e.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${a}`}).join(`
1
+ import{b as g}from"./chunk-45GOH6F7.js";import"./chunk-RKPAVWXF.js";import{b as h}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-VEHTVYP6.js";import"./chunk-HYGMWCUU.js";import"./chunk-HVZVFCJX.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var $=t=>typeof t=="string"?t.trim():"",w={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function f(t){return t.length?t.map(e=>{let i=new Date(e.createdAt).toISOString().slice(0,16).replace("T"," "),a=e.state==="waiting_owner"&&e.question?` Question: ${e.question}`:e.state==="needs_attention"&&e.attentionReason?` ${e.attentionReason}`:"",n=String(e.text).replace(/\s+/g," ").trim();return`- ${e.id} [${w[e.state]??e.state}] ${i} UTC, ${e.channel}, ${e.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${a}`}).join(`
2
2
  `):"No open requests."}async function m(t,e){let i=e.fetch??fetch,a=e.daemonUrl.replace(/\/$/,""),n=($(t.action)||"list").toLowerCase();try{if(n==="list"){let d=await i(`${a}/requests`,{signal:AbortSignal.timeout(1e4)}),r=await d.json().catch(()=>({}));return d.ok?r.enabled?`${r.count} open request${r.count===1?"":"s"}, oldest first.
3
3
  ${f(r.items??[])}`:"Requests are turned off on this node (requests.enabled), so nothing is recorded.":`Error: ${r?.error||`HTTP ${d.status}`}`}let s=e.env??process.env,u=g(t,s);if(!u)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let c=await i(`${a}/requests`,{method:"POST",headers:{"Content-Type":"application/json",...h(s)},body:JSON.stringify({action:n,agentId:u.agentId,id:t.id,question:t.question,evidence:t.evidence,reason:t.reason}),signal:AbortSignal.timeout(1e4)}),l=await c.json().catch(()=>({}));if(!c.ok)return`Error: ${l?.error||`HTTP ${c.status}`}`;let o=l.request;return n==="accept"?`Request ${o.id} is open and in progress. Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`:n==="wait"?`Request ${o.id} is waiting on the owner with your question. Ask them the question now, once.`:n==="done"?`Request ${o.id} is closed as done. Evidence: ${o.evidence}`:`Request ${o.id} is closed as declined. Reason: ${o.closeReason}`}catch(s){return`Error: couldn't reach the daemon (${s?.message??s}).`}}export{f as describeOpen,m as runRequestTool};
4
- //# sourceMappingURL=tool-S6U42ULD.js.map
4
+ //# sourceMappingURL=tool-OFXHMLE5.js.map
@@ -1,4 +1,4 @@
1
- import{b as h}from"./chunk-ELWKTURG.js";import"./chunk-RKPAVWXF.js";import{f}from"./chunk-Y4CYQV7G.js";import{b as u}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-Y3CZE54A.js";import"./chunk-J3SIOMDL.js";import"./chunk-JLCJVPRC.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FBEMUCBO.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var m=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function y(e){return typeof e=="string"?e.trim():""}async function A(e,i){let c=i.fetch??fetch,d=i.daemonUrl.replace(/\/$/,""),s=(y(e.action)||"create").toLowerCase(),r=h(e,i.env??process.env);if(s==="status"){let o=y(e.id);if(!o)return"Error: `id` is required for status (the card id you got when you raised it).";try{let n=await c(`${d}/approvals/${encodeURIComponent(o)}`,{signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let t=a.card;if(r&&t.raised_by!==r.agentId)return`Error: card "${o}" was raised by another agent.`;if(t.status==="pending")return`Card ${t.id} is still waiting for the operator. It expires ${t.expires}; then "${t.if_silent}" applies.`;if(t.status==="decided"){let p=t.verdict==="yes"?f(t).join(`
1
+ import{b as h}from"./chunk-45GOH6F7.js";import"./chunk-RKPAVWXF.js";import{f}from"./chunk-Y4CYQV7G.js";import{b as u}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-VEHTVYP6.js";import"./chunk-HYGMWCUU.js";import"./chunk-HVZVFCJX.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var m=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function y(e){return typeof e=="string"?e.trim():""}async function A(e,i){let c=i.fetch??fetch,d=i.daemonUrl.replace(/\/$/,""),s=(y(e.action)||"create").toLowerCase(),r=h(e,i.env??process.env);if(s==="status"){let o=y(e.id);if(!o)return"Error: `id` is required for status (the card id you got when you raised it).";try{let n=await c(`${d}/approvals/${encodeURIComponent(o)}`,{signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let t=a.card;if(r&&t.raised_by!==r.agentId)return`Error: card "${o}" was raised by another agent.`;if(t.status==="pending")return`Card ${t.id} is still waiting for the operator. It expires ${t.expires}; then "${t.if_silent}" applies.`;if(t.status==="decided"){let p=t.verdict==="yes"?f(t).join(`
2
2
  `):"";return`Card ${t.id}: the operator said ${String(t.verdict).toUpperCase()}.${t.note?` Note: ${t.note}`:""}${p?`
3
3
  ${p}`:""}`}return`Card ${t.id} expired unanswered; the default applied: ${t.outcome??t.if_silent}.`}catch(n){return`Error: couldn't reach the daemon (${n?.message??n}).`}}if(s!=="create")return`Error: unknown action "${s}". Use create or status.`;if(!r)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=r.channel&&r.chatId&&!m.has(r.channel)?{channel:r.channel,chatId:r.chatId,...r.accountId?{accountId:r.accountId}:{}}:void 0,$={title:e.title,ask:e.ask,recommend:e.recommend,if_silent:e.if_silent,expires:e.expires,source:e.source,choices:e.choices,draft:e.draft,say:e.say,context:e.context,raised_by:r.agentId,...l?{reply:l}:{}};try{let o=await c(`${d}/approvals`,{method:"POST",headers:{"Content-Type":"application/json",...u(i.env??process.env)},body:JSON.stringify($),signal:AbortSignal.timeout(1e4)}),n=await o.json().catch(()=>({}));if(!o.ok)return`Error: ${n?.error||`HTTP ${o.status}`}`;let a=n.card;return[`Decision card ${a.id} is in the operator's Approvals inbox.`,`If nobody answers by ${a.expires}, "${a.if_silent}" applies.`,"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat."].join(" ")}catch(o){return`Error: couldn't reach the daemon (${o?.message??o}).`}}export{A as runApprovalTool};
4
- //# sourceMappingURL=tool-RBXRPIBV.js.map
4
+ //# sourceMappingURL=tool-XY7QGHLV.js.map
@@ -0,0 +1,2 @@
1
+ import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-PMQ47IPT.js";import{a}from"./chunk-BQ2HJ7TS.js";import"./chunk-CECHWYJ2.js";import{a as c}from"./chunk-T2VDHVYW.js";import"./chunk-746KHKT4.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-W7WNRPNQ.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-FJI5GRBH.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
2
+ //# sourceMappingURL=wiki-46GMWX34.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentix-cli",
3
- "version": "0.116.0",
3
+ "version": "0.117.0",
4
4
  "description": "AI operations layer for small and medium businesses. Routes Telegram, WhatsApp, GitLab, GitHub, crons, webhooks, and mesh tasks to AI agents. Web wizard for operators, CLI for engineers. Self-hosted.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,2 +0,0 @@
1
- import{c as g,g as d}from"./chunk-DMHQIACQ.js";import{a as m}from"./chunk-GRMCAO3Q.js";var A=/^[A-Za-z0-9._-]{1,64}$/,y=/^[A-Za-z0-9_-]{1,64}$/,P=100,S=1e3,E=6e4,R=15*6e4;function u(s){return(s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"node").slice(0,64)}function $(s,t,n){let a=/^bearer /i.test(s)?s.slice(7).trim():"",e="Phones paired with another computer need that computer's own peer token: give it a token in mesh.peers on both computers.";if(!a||n&&a===n)return{error:e};let p=new Set(t.filter(i=>i.token===a).map(i=>u(i.name)));if(p.size===0)return{error:e};if(p.size>1)return{error:`Several mesh.peers entries share this token (${[...p].join(", ")}). Give each computer its own token.`};let[r]=p,o=t.filter(i=>i.token!==a&&u(i.name)===r).map(i=>i.name);return o.length?{error:`mesh.peers names ${o.map(i=>`"${i}"`).join(", ")} too close to this computer's name: rename one so they differ in letters or digits.`}:{origin:r}}function C(s){return new Set(s.map(t=>u(t.name)))}function j(s,t,n,a){let e=s&&typeof s=="object"?s:{};if("error"in t)return{status:403,body:{error:t.error}};let p=t.origin;if(!A.test(p))return{status:403,body:{error:"this peer's name can't be used as a notification origin"}};if(!n)return{status:503,body:{error:a??"Notifications are not set up on the computer that sends them."}};if(e.op==="roster"){if(!Array.isArray(e.active)||e.active.length>S||!e.active.every(l=>typeof l=="string"&&y.test(l)))return{status:400,body:{error:"active must be a list of device ids"}};let h=n.store();return h?{status:200,body:{ok:!0,removed:h.pruneOrigin(p,e.active)}}:{status:503,body:{error:n.reason??"the database is unavailable"}}}if(e.op!=="app")return{status:400,body:{error:"op must be app or roster"}};let r=e.call&&typeof e.call=="object"?e.call:{},o=r.device&&typeof r.device=="object"?r.device:{},i=typeof r.path=="string"?r.path:"",c=r.method==="GET"||r.method==="POST"?r.method:"";if(!g(i)||!c)return{status:404,body:{error:"not found"}};if(typeof o.id!="string"||!y.test(o.id))return{status:400,body:{error:"device.id is required"}};let v=typeof o.name=="string"&&o.name.trim()?o.name.trim():o.id,b=r.body&&typeof r.body=="object"&&!Array.isArray(r.body)?r.body:{};return d({path:i,method:c,body:b,device:{id:m(p,o.id),name:k(`${v} (${p})`,P)}},n)}var f=class{constructor(t){this.deps=t}lastKey=null;lastSentAt=0;failing=!1;async tick(){let t=(this.deps.now??Date.now)(),n;try{n=[...new Set(this.deps.active())].sort()}catch(e){return this.deps.log?.(`push: phone list not read, not sent this time: ${e?.message??e}`),!1}let a=n.join(",");if(a===this.lastKey&&t-this.lastSentAt<R)return!1;try{return await this.deps.send(n),this.lastKey=a,this.lastSentAt=t,this.failing&&this.deps.log?.("push: phone list sent to the push host again"),this.failing=!1,!0}catch(e){return this.failing||this.deps.log?.(`push: phone list not sent to the push host, retrying every minute: ${e?.message??e}`),this.failing=!0,!1}}};function k(s,t){let n=[...s];return n.length>t?n.slice(0,t-1).join("")+"\u2026":s}export{E as a,R as b,u as c,$ as d,C as e,j as f,f as g};
2
- //# sourceMappingURL=chunk-BRL3UPFW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/daemon/push-bridge.ts"],"sourcesContent":["import { isAppPushPath, runAppPush, type AppPushCall, type AppPushDeps, type AppPushResult } from \"./app-push\"\nimport { remoteDeviceId } from \"@/channels/push\"\nimport type { PushStore } from \"@/channels/push-store\"\n\n// --- Push bridge: phones paired with a relaying node (#711) ---\n//\n// Push has one host per mesh: the node that holds the VAPID keys and the\n// subscriptions table. A node with channels.push.relayTo forwards outbound\n// pushes to it (PushRelayAdapter); this module covers the other direction,\n// for a phone paired with that relaying node:\n//\n// phone → relay dashboard /api/app/push* (device token checked there)\n// → relay daemon POST /push/app (loopback)\n// → host daemon POST /push/app (the relay's peer token)\n// → runAppPush on the host's table, device id \"<origin>:<tok_…>\"\n//\n// The host never takes the origin from the request: it is the name of the\n// mesh.peers entry whose token the caller presented (pushBridgeCaller). A\n// caller holding only MESH_TOKEN, which every node accepts, names no node\n// and is refused, so one node can't subscribe, read or prune under\n// another's name.\n//\n// The relay also sends its roster of active token ids (\"roster\" op). The\n// host drops that node's rows whose phone is no longer in it, so\n// `agentx app revoke` on the relay stops the phone's notifications at the\n// next sync, as it does for a phone paired with the host.\n//\n// Every answer is { status, body }: the phone-app status and JSON, wrapped\n// so a relay can tell them apart from a transport failure.\n\n/** What a relay sends to the host's POST /push/app. */\nexport type PushBridgeRequest =\n | { op: \"app\"; origin: string; call: AppPushCall }\n | { op: \"roster\"; origin: string; active: string[] }\n\nconst ORIGIN = /^[A-Za-z0-9._-]{1,64}$/\nconst DEVICE_ID = /^[A-Za-z0-9_-]{1,64}$/\nconst MAX_NAME = 100\nconst MAX_ROSTER = 1000\n\n/** How often a relay checks its roster, and the longest it goes without\n * sending one even when nothing changed (the host may have restarted\n * from a backup, or missed a send while down). */\nexport const ROSTER_CHECK_MS = 60_000\nexport const ROSTER_RESEND_MS = 15 * 60_000\n\n/** This node's name as a relay origin: letters, digits, dot, dash and\n * underscore, so it can't contain the \":\" that scopes a device id. */\nexport function pushOrigin(nodeName: string): string {\n return (nodeName.replace(/[^A-Za-z0-9._-]+/g, \"-\").replace(/^-+|-+$/g, \"\") || \"node\").slice(0, 64)\n}\n\n/** Who is calling, on the host: the origin of the mesh.peers entry whose\n * token the caller presented, or why the call can't be tied to one. */\nexport type PushBridgeCaller = { origin: string } | { error: string }\n\nexport function pushBridgeCaller(\n authorization: string,\n peers: ReadonlyArray<{ name: string; token?: string }>,\n meshToken?: string,\n): PushBridgeCaller {\n const token = /^bearer /i.test(authorization) ? authorization.slice(7).trim() : \"\"\n const needs = \"Phones paired with another computer need that computer's own peer token: give it a token in mesh.peers on both computers.\"\n // MESH_TOKEN is shared by the whole mesh, so it says nothing about who sent it.\n if (!token || (meshToken && token === meshToken)) return { error: needs }\n const origins = new Set(peers.filter((p) => p.token === token).map((p) => pushOrigin(p.name)))\n if (origins.size === 0) return { error: needs }\n if (origins.size > 1) return { error: `Several mesh.peers entries share this token (${[...origins].join(\", \")}). Give each computer its own token.` }\n const [origin] = origins\n // Two peers whose names map to one origin would share, and prune, each\n // other's phones (\"my mac\" and \"my-mac\").\n const clash = peers.filter((p) => p.token !== token && pushOrigin(p.name) === origin).map((p) => p.name)\n if (clash.length) return { error: `mesh.peers names ${clash.map((n) => `\"${n}\"`).join(\", \")} too close to this computer's name: rename one so they differ in letters or digits.` }\n return { origin }\n}\n\n/** The origins of the configured peers, for checking a scoped device id on\n * the host: a row whose node left mesh.peers is no longer delivered. */\nexport function peerOrigins(peers: ReadonlyArray<{ name: string }>): Set<string> {\n return new Set(peers.map((p) => pushOrigin(p.name)))\n}\n\n/** On the host: answers one bridged request from `caller` (pushBridgeCaller).\n * `deps` is null when this node is not sending pushes itself; `reason`\n * then says why. An `origin` in the request itself is ignored. */\nexport function handlePushBridge(raw: unknown, caller: PushBridgeCaller, deps: (AppPushDeps & { store: () => PushStore | null }) | null, reason?: string): AppPushResult {\n const req = (raw && typeof raw === \"object\" ? raw : {}) as Record<string, any>\n if (\"error\" in caller) return { status: 403, body: { error: caller.error } }\n const origin = caller.origin\n if (!ORIGIN.test(origin)) return { status: 403, body: { error: \"this peer's name can't be used as a notification origin\" } }\n if (!deps) return { status: 503, body: { error: reason ?? \"Notifications are not set up on the computer that sends them.\" } }\n\n if (req.op === \"roster\") {\n if (!Array.isArray(req.active) || req.active.length > MAX_ROSTER || !req.active.every((id: unknown) => typeof id === \"string\" && DEVICE_ID.test(id))) {\n return { status: 400, body: { error: \"active must be a list of device ids\" } }\n }\n const store = deps.store()\n if (!store) return { status: 503, body: { error: deps.reason ?? \"the database is unavailable\" } }\n return { status: 200, body: { ok: true, removed: store.pruneOrigin(origin, req.active) } }\n }\n\n if (req.op !== \"app\") return { status: 400, body: { error: \"op must be app or roster\" } }\n const call = (req.call && typeof req.call === \"object\" ? req.call : {}) as Record<string, any>\n const device = (call.device && typeof call.device === \"object\" ? call.device : {}) as Record<string, any>\n const path = typeof call.path === \"string\" ? call.path : \"\"\n const method = call.method === \"GET\" || call.method === \"POST\" ? call.method : \"\"\n if (!isAppPushPath(path) || !method) return { status: 404, body: { error: \"not found\" } }\n if (typeof device.id !== \"string\" || !DEVICE_ID.test(device.id)) return { status: 400, body: { error: \"device.id is required\" } }\n const name = typeof device.name === \"string\" && device.name.trim() ? device.name.trim() : device.id\n const body = call.body && typeof call.body === \"object\" && !Array.isArray(call.body) ? call.body : {}\n return runAppPush({\n path,\n method,\n body,\n // The relay's name goes with the phone's, so `agentx app devices` and\n // the host's logs say where the phone is paired.\n device: { id: remoteDeviceId(origin, device.id), name: clip(`${name} (${origin})`, MAX_NAME) },\n }, deps)\n}\n\n/** On a relay: sends the roster of active token ids when it changed, or\n * every ROSTER_RESEND_MS. A failed send is retried at the next tick. */\nexport class PushRosterSync {\n private lastKey: string | null = null\n private lastSentAt = 0\n private failing = false\n\n constructor(private deps: {\n active: () => string[]\n send: (active: string[]) => Promise<unknown>\n now?: () => number\n log?: (...args: unknown[]) => void\n }) {}\n\n async tick(): Promise<boolean> {\n const now = (this.deps.now ?? Date.now)()\n let active: string[]\n try {\n active = [...new Set(this.deps.active())].sort()\n } catch (e: any) {\n // A torn or failed read of the phone list: sending nothing keeps the\n // host's rows; sending [] would unsubscribe every phone paired here.\n this.deps.log?.(`push: phone list not read, not sent this time: ${e?.message ?? e}`)\n return false\n }\n const key = active.join(\",\")\n if (key === this.lastKey && now - this.lastSentAt < ROSTER_RESEND_MS) return false\n try {\n await this.deps.send(active)\n this.lastKey = key\n this.lastSentAt = now\n if (this.failing) this.deps.log?.(\"push: phone list sent to the push host again\")\n this.failing = false\n return true\n } catch (e: any) {\n // Once per outage, not every minute.\n if (!this.failing) this.deps.log?.(`push: phone list not sent to the push host, retrying every minute: ${e?.message ?? e}`)\n this.failing = true\n return false\n }\n }\n}\n\nfunction clip(s: string, max: number): string {\n const chars = [...s]\n return chars.length > max ? chars.slice(0, max - 1).join(\"\") + \"…\" : s\n}\n"],"mappings":"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","names":["ORIGIN","DEVICE_ID","MAX_NAME","MAX_ROSTER","ROSTER_CHECK_MS","ROSTER_RESEND_MS","pushOrigin","nodeName","pushBridgeCaller","authorization","peers","meshToken","token","needs","origins","p","origin","clash","n","peerOrigins","handlePushBridge","raw","caller","deps","reason","req","id","store","call","device","path","method","isAppPushPath","name","body","runAppPush","remoteDeviceId","clip","PushRosterSync","now","active","key","max","chars"]}