agentix-cli 0.206.0 → 0.206.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/{App-JDW5V4HT.js → App-IEUOKINQ.js} +2 -2
  2. package/dist/{ChatApp-SNM2PORO.js → ChatApp-CCDBG6YZ.js} +2 -2
  3. package/dist/{absorb-eval-WDAV4AI2.js → absorb-eval-IIF7CY3Q.js} +2 -2
  4. package/dist/{adapter-C47BTKT6.js → adapter-LTHULD3D.js} +2 -2
  5. package/dist/{agent-EVMKJXJO.js → agent-TZ3GGNS5.js} +2 -2
  6. package/dist/{board-dashboard-EUWXJNDW.js → board-dashboard-JS6OJDH6.js} +29 -29
  7. package/dist/{chunk-USFOOYPM.js → chunk-37EABHYL.js} +2 -2
  8. package/dist/chunk-3AHYZLGE.js +115 -0
  9. package/dist/chunk-3AHYZLGE.js.map +1 -0
  10. package/dist/{chunk-PQUK6XEW.js → chunk-6U34GZ7U.js} +2 -2
  11. package/dist/{chunk-MF46BC7J.js → chunk-6ZVVAGTR.js} +2 -2
  12. package/dist/{chunk-IU63JGY3.js → chunk-7GD5GTWC.js} +2 -2
  13. package/dist/{chunk-EJFPXG6I.js → chunk-7JHB3X5N.js} +16 -16
  14. package/dist/{chunk-EJFPXG6I.js.map → chunk-7JHB3X5N.js.map} +1 -1
  15. package/dist/{chunk-SKCOIP5R.js → chunk-A2K6C6W3.js} +3 -3
  16. package/dist/{chunk-OLKYIKAZ.js → chunk-B35GIWMR.js} +2 -2
  17. package/dist/{chunk-DUCYRNCT.js → chunk-CARVBJB7.js} +20 -20
  18. package/dist/chunk-CARVBJB7.js.map +1 -0
  19. package/dist/{chunk-KRHVM26D.js → chunk-E2MW5OCE.js} +2 -2
  20. package/dist/{chunk-WJMYBRM5.js → chunk-FXA2WIIP.js} +2 -2
  21. package/dist/{chunk-V5LRR5I5.js → chunk-GCBFLU64.js} +10 -10
  22. package/dist/{chunk-TH2W2545.js → chunk-GJOKXP5D.js} +2 -2
  23. package/dist/{chunk-PQX2VJUA.js → chunk-I4753XPP.js} +45 -45
  24. package/dist/chunk-I4753XPP.js.map +1 -0
  25. package/dist/{chunk-2VSK6FAR.js → chunk-I74PTSUQ.js} +2 -2
  26. package/dist/{chunk-ERVJLPS4.js → chunk-JDU4CXGC.js} +2 -2
  27. package/dist/{chunk-DV42WUMD.js → chunk-K435U2FC.js} +2 -2
  28. package/dist/chunk-KEUW6YLL.js +2 -0
  29. package/dist/{chunk-VJ5HC63R.js.map → chunk-KEUW6YLL.js.map} +1 -1
  30. package/dist/{chunk-DOO4MUTS.js → chunk-KXMC7Z5X.js} +2 -2
  31. package/dist/chunk-LY4G7PCW.js +2 -0
  32. package/dist/chunk-LY4G7PCW.js.map +1 -0
  33. package/dist/{chunk-5STGF4MI.js → chunk-M37WJANA.js} +88 -88
  34. package/dist/chunk-M37WJANA.js.map +1 -0
  35. package/dist/{chunk-CXFVIDJV.js → chunk-R6XJWFMC.js} +2 -2
  36. package/dist/{chunk-245IOYDJ.js → chunk-RPL2P7EP.js} +2 -2
  37. package/dist/{chunk-UGRMFQAG.js → chunk-RRLQTU3X.js} +2 -2
  38. package/dist/{chunk-3B5HSNOF.js → chunk-TLRTJV2U.js} +311 -303
  39. package/dist/chunk-TLRTJV2U.js.map +1 -0
  40. package/dist/{chunk-JT5PIBCM.js → chunk-U3OJO7B7.js} +2 -2
  41. package/dist/{chunk-RXX4MYFL.js → chunk-UN7D7HWU.js} +2 -2
  42. package/dist/{chunk-2P3SHT5I.js → chunk-VALKXSXZ.js} +2 -2
  43. package/dist/{chunk-CZVCT5ZV.js → chunk-WI7J22NL.js} +2 -2
  44. package/dist/{chunk-PTZNM2JU.js → chunk-WTCMJZW3.js} +2 -2
  45. package/dist/{chunk-BED4R5CS.js → chunk-XL7UWG36.js} +6 -6
  46. package/dist/{chunk-BED4R5CS.js.map → chunk-XL7UWG36.js.map} +1 -1
  47. package/dist/{chunk-IDGEDPRJ.js → chunk-XTIPWYW5.js} +2 -2
  48. package/dist/{chunk-QASIUKZJ.js → chunk-Z6J3RTYJ.js} +2 -2
  49. package/dist/{chunk-PW3WG6JT.js → chunk-ZOK6VMEP.js} +2 -2
  50. package/dist/cli.js +1 -1
  51. package/dist/{client-WN7YI7DE.js → client-NPC2JAWL.js} +2 -2
  52. package/dist/{config-QUXKGIZX.js → config-TIMTRSFH.js} +2 -2
  53. package/dist/config-mutate-V3DRUCK4.js +2 -0
  54. package/dist/{config-mutator-OLLQR3ZD.js → config-mutator-HOYYIPNW.js} +2 -2
  55. package/dist/{contributions-LL7B4BP3.js → contributions-TYVRQG7F.js} +2 -2
  56. package/dist/doctor-TNQ4Q2OS.js +2 -0
  57. package/dist/{facts-ALJBF7IA.js → facts-XGZWX6CR.js} +2 -2
  58. package/dist/{follow-up-tool-I2HTKMP4.js → follow-up-tool-3P2YCRBL.js} +2 -2
  59. package/dist/{grants-2MNWGCSH.js → grants-TWDH3Z4K.js} +2 -2
  60. package/dist/hub-GVTRKPAU.js +2 -0
  61. package/dist/index.d.ts +67 -5
  62. package/dist/index.js +1 -1
  63. package/dist/{org-tool-JCGGJJU6.js → org-tool-EKO7GCPL.js} +2 -2
  64. package/dist/{program-NCFW4EEP.js → program-Y55FFHIJ.js} +86 -86
  65. package/dist/{promote-NSPUPPHB.js → promote-JYYV44FK.js} +2 -2
  66. package/dist/{query-VW63IHDI.js → query-PUWWCFET.js} +2 -2
  67. package/dist/{query-settings-RS7DJI4H.js → query-settings-IJPG3N6D.js} +2 -2
  68. package/dist/registry-QJGTPSK2.js +2 -0
  69. package/dist/{request-planner-HZWQIRZO.js → request-planner-HHJXCWCG.js} +2 -2
  70. package/dist/{review-candidates-2TXOUASP.js → review-candidates-XZUQELL5.js} +2 -2
  71. package/dist/rotation-memo-store-ZH6254YR.js +2 -0
  72. package/dist/rotation-memo-store-ZH6254YR.js.map +1 -0
  73. package/dist/{routing-ZV4VSZDV.js → routing-HWZHJ4LZ.js} +2 -2
  74. package/dist/schedule-tool-7W5CRUN4.js +2 -0
  75. package/dist/{scheduler-SAID6RKQ.js → scheduler-WG3KXJIH.js} +2 -2
  76. package/dist/{seat-XHBWBSTS.js → seat-5BOBWKBX.js} +2 -2
  77. package/dist/{select-QUCTTAH3.js → select-FIHHBFNR.js} +2 -2
  78. package/dist/{set-enabled-CGMXLFC6.js → set-enabled-K7OM7PSO.js} +2 -2
  79. package/dist/{sprint-tool-SWRYSX3Q.js → sprint-tool-O6TTSWJN.js} +2 -2
  80. package/dist/{tool-DA25L4ND.js → tool-4KVS2JWC.js} +2 -2
  81. package/dist/{tool-ELGOVIM5.js → tool-BYU6EZKM.js} +2 -2
  82. package/dist/{tool-MMH2JNP7.js → tool-HTUSCV22.js} +2 -2
  83. package/dist/{tool-6G63ZQW4.js → tool-HVCLZGYE.js} +2 -2
  84. package/dist/{wiki-4ZL4QXA7.js → wiki-ZMEMGR7R.js} +2 -2
  85. package/dist/wiki-enrich-QZHQV7VZ.js +2 -0
  86. package/dist/workspace-setup-GTSXWYU4.js +2 -0
  87. package/package.json +1 -1
  88. package/dist/chunk-36X7D4JA.js +0 -2
  89. package/dist/chunk-36X7D4JA.js.map +0 -1
  90. package/dist/chunk-3B5HSNOF.js.map +0 -1
  91. package/dist/chunk-5STGF4MI.js.map +0 -1
  92. package/dist/chunk-DUCYRNCT.js.map +0 -1
  93. package/dist/chunk-IFNXMUEG.js +0 -115
  94. package/dist/chunk-IFNXMUEG.js.map +0 -1
  95. package/dist/chunk-PQX2VJUA.js.map +0 -1
  96. package/dist/chunk-VJ5HC63R.js +0 -2
  97. package/dist/config-mutate-HJH24ITC.js +0 -2
  98. package/dist/doctor-X75KLAFA.js +0 -2
  99. package/dist/hub-7ASBN76I.js +0 -2
  100. package/dist/registry-6KREAROB.js +0 -2
  101. package/dist/rotation-memo-store-WMDI7NND.js +0 -2
  102. package/dist/rotation-memo-store-WMDI7NND.js.map +0 -1
  103. package/dist/schedule-tool-D357NLXS.js +0 -2
  104. package/dist/wiki-enrich-N5MUKDVW.js +0 -2
  105. package/dist/workspace-setup-QXFJRNSK.js +0 -2
  106. /package/dist/{App-JDW5V4HT.js.map → App-IEUOKINQ.js.map} +0 -0
  107. /package/dist/{ChatApp-SNM2PORO.js.map → ChatApp-CCDBG6YZ.js.map} +0 -0
  108. /package/dist/{absorb-eval-WDAV4AI2.js.map → absorb-eval-IIF7CY3Q.js.map} +0 -0
  109. /package/dist/{adapter-C47BTKT6.js.map → adapter-LTHULD3D.js.map} +0 -0
  110. /package/dist/{agent-EVMKJXJO.js.map → agent-TZ3GGNS5.js.map} +0 -0
  111. /package/dist/{board-dashboard-EUWXJNDW.js.map → board-dashboard-JS6OJDH6.js.map} +0 -0
  112. /package/dist/{chunk-USFOOYPM.js.map → chunk-37EABHYL.js.map} +0 -0
  113. /package/dist/{chunk-PQUK6XEW.js.map → chunk-6U34GZ7U.js.map} +0 -0
  114. /package/dist/{chunk-MF46BC7J.js.map → chunk-6ZVVAGTR.js.map} +0 -0
  115. /package/dist/{chunk-IU63JGY3.js.map → chunk-7GD5GTWC.js.map} +0 -0
  116. /package/dist/{chunk-SKCOIP5R.js.map → chunk-A2K6C6W3.js.map} +0 -0
  117. /package/dist/{chunk-OLKYIKAZ.js.map → chunk-B35GIWMR.js.map} +0 -0
  118. /package/dist/{chunk-KRHVM26D.js.map → chunk-E2MW5OCE.js.map} +0 -0
  119. /package/dist/{chunk-WJMYBRM5.js.map → chunk-FXA2WIIP.js.map} +0 -0
  120. /package/dist/{chunk-V5LRR5I5.js.map → chunk-GCBFLU64.js.map} +0 -0
  121. /package/dist/{chunk-TH2W2545.js.map → chunk-GJOKXP5D.js.map} +0 -0
  122. /package/dist/{chunk-2VSK6FAR.js.map → chunk-I74PTSUQ.js.map} +0 -0
  123. /package/dist/{chunk-ERVJLPS4.js.map → chunk-JDU4CXGC.js.map} +0 -0
  124. /package/dist/{chunk-DV42WUMD.js.map → chunk-K435U2FC.js.map} +0 -0
  125. /package/dist/{chunk-DOO4MUTS.js.map → chunk-KXMC7Z5X.js.map} +0 -0
  126. /package/dist/{chunk-CXFVIDJV.js.map → chunk-R6XJWFMC.js.map} +0 -0
  127. /package/dist/{chunk-245IOYDJ.js.map → chunk-RPL2P7EP.js.map} +0 -0
  128. /package/dist/{chunk-UGRMFQAG.js.map → chunk-RRLQTU3X.js.map} +0 -0
  129. /package/dist/{chunk-JT5PIBCM.js.map → chunk-U3OJO7B7.js.map} +0 -0
  130. /package/dist/{chunk-RXX4MYFL.js.map → chunk-UN7D7HWU.js.map} +0 -0
  131. /package/dist/{chunk-2P3SHT5I.js.map → chunk-VALKXSXZ.js.map} +0 -0
  132. /package/dist/{chunk-CZVCT5ZV.js.map → chunk-WI7J22NL.js.map} +0 -0
  133. /package/dist/{chunk-PTZNM2JU.js.map → chunk-WTCMJZW3.js.map} +0 -0
  134. /package/dist/{chunk-IDGEDPRJ.js.map → chunk-XTIPWYW5.js.map} +0 -0
  135. /package/dist/{chunk-QASIUKZJ.js.map → chunk-Z6J3RTYJ.js.map} +0 -0
  136. /package/dist/{chunk-PW3WG6JT.js.map → chunk-ZOK6VMEP.js.map} +0 -0
  137. /package/dist/{client-WN7YI7DE.js.map → client-NPC2JAWL.js.map} +0 -0
  138. /package/dist/{config-QUXKGIZX.js.map → config-TIMTRSFH.js.map} +0 -0
  139. /package/dist/{config-mutate-HJH24ITC.js.map → config-mutate-V3DRUCK4.js.map} +0 -0
  140. /package/dist/{config-mutator-OLLQR3ZD.js.map → config-mutator-HOYYIPNW.js.map} +0 -0
  141. /package/dist/{contributions-LL7B4BP3.js.map → contributions-TYVRQG7F.js.map} +0 -0
  142. /package/dist/{doctor-X75KLAFA.js.map → doctor-TNQ4Q2OS.js.map} +0 -0
  143. /package/dist/{facts-ALJBF7IA.js.map → facts-XGZWX6CR.js.map} +0 -0
  144. /package/dist/{follow-up-tool-I2HTKMP4.js.map → follow-up-tool-3P2YCRBL.js.map} +0 -0
  145. /package/dist/{grants-2MNWGCSH.js.map → grants-TWDH3Z4K.js.map} +0 -0
  146. /package/dist/{hub-7ASBN76I.js.map → hub-GVTRKPAU.js.map} +0 -0
  147. /package/dist/{org-tool-JCGGJJU6.js.map → org-tool-EKO7GCPL.js.map} +0 -0
  148. /package/dist/{program-NCFW4EEP.js.map → program-Y55FFHIJ.js.map} +0 -0
  149. /package/dist/{promote-NSPUPPHB.js.map → promote-JYYV44FK.js.map} +0 -0
  150. /package/dist/{query-VW63IHDI.js.map → query-PUWWCFET.js.map} +0 -0
  151. /package/dist/{query-settings-RS7DJI4H.js.map → query-settings-IJPG3N6D.js.map} +0 -0
  152. /package/dist/{registry-6KREAROB.js.map → registry-QJGTPSK2.js.map} +0 -0
  153. /package/dist/{request-planner-HZWQIRZO.js.map → request-planner-HHJXCWCG.js.map} +0 -0
  154. /package/dist/{review-candidates-2TXOUASP.js.map → review-candidates-XZUQELL5.js.map} +0 -0
  155. /package/dist/{routing-ZV4VSZDV.js.map → routing-HWZHJ4LZ.js.map} +0 -0
  156. /package/dist/{schedule-tool-D357NLXS.js.map → schedule-tool-7W5CRUN4.js.map} +0 -0
  157. /package/dist/{scheduler-SAID6RKQ.js.map → scheduler-WG3KXJIH.js.map} +0 -0
  158. /package/dist/{seat-XHBWBSTS.js.map → seat-5BOBWKBX.js.map} +0 -0
  159. /package/dist/{select-QUCTTAH3.js.map → select-FIHHBFNR.js.map} +0 -0
  160. /package/dist/{set-enabled-CGMXLFC6.js.map → set-enabled-K7OM7PSO.js.map} +0 -0
  161. /package/dist/{sprint-tool-SWRYSX3Q.js.map → sprint-tool-O6TTSWJN.js.map} +0 -0
  162. /package/dist/{tool-DA25L4ND.js.map → tool-4KVS2JWC.js.map} +0 -0
  163. /package/dist/{tool-ELGOVIM5.js.map → tool-BYU6EZKM.js.map} +0 -0
  164. /package/dist/{tool-MMH2JNP7.js.map → tool-HTUSCV22.js.map} +0 -0
  165. /package/dist/{tool-6G63ZQW4.js.map → tool-HVCLZGYE.js.map} +0 -0
  166. /package/dist/{wiki-4ZL4QXA7.js.map → wiki-ZMEMGR7R.js.map} +0 -0
  167. /package/dist/{wiki-enrich-N5MUKDVW.js.map → wiki-enrich-QZHQV7VZ.js.map} +0 -0
  168. /package/dist/{workspace-setup-QXFJRNSK.js.map → workspace-setup-GTSXWYU4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{_ as y,aa as v,ga as w,ha as C,ja as E,ka as R,la as I}from"./chunk-DUCYRNCT.js";I();v();var L=1e4,T=["issues","prs","all"],W=/^[\w.-]+(?:\/[\w.-]+)+$/,m=e=>typeof e=="string"?e.trim():"";function f(e){let t=m(e.provider).toLowerCase();if(t!=="github"&&t!=="gitlab")return"count.provider must be github or gitlab";let r=m(e.project),n=r.split("/");if(!W.test(r)||n.some(o=>o==="."||o==="..")||t==="github"&&n.length!==2)return t==="github"?'count.project must be "owner/repo"':'count.project must be "group/project"';let s=(m(e.what)||"issues").toLowerCase();if(!T.includes(s))return`count.what must be one of ${T.join(", ")}`;let i=e.max===void 0||e.max===null||e.max===""?0:Number(e.max);return!Number.isInteger(i)||i<0?"count.max must be a whole number, 0 or more":{provider:t,project:r,what:s,max:i}}function S(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let r=f(t);return typeof r=="string"?null:r}catch{return null}}var _=e=>e==="issues"?"open issues":e==="prs"?"open pull requests":"open issues and pull requests";function $(e){return`${_(e.what)} in ${e.provider} ${e.project} \u2264 ${e.max}`}async function Y(e,t){if(!t)return{verdict:"unverifiable",detail:`no ${e.provider} connector on this node`};try{let r=e.what==="all"?["issues","prs"]:[e.what],n=0;for(let i of r){let o=await t(e.provider,e.project,i);if(typeof o!="number")return{verdict:"unverifiable",detail:`${e.project}: ${o.error}`};n+=o}let s=`${n} ${_(e.what)} in ${e.project}`;return{verdict:n<=e.max?"met":"not_met",detail:s,count:n}}catch(r){return{verdict:"unverifiable",detail:`the count check failed: ${String(r?.message??r).slice(0,200)}`}}}function B(e,t=fetch){return async(r,n,s)=>{let i;if(r==="github"){let a=e.github;if(!a)return{error:"no github connector on this node (channels.github or requests.checkers.github)"};let d=encodeURIComponent(`repo:${n} is:open is:${s==="prs"?"pr":"issue"}`);i=`${a.apiUrl.replace(/\/$/,"")}/search/issues?q=${d}&per_page=1`}else{let a=e.gitlab;if(!a)return{error:"no gitlab connector on this node (channels.gitlab or requests.checkers.gitlab)"};i=`${a.url.replace(/\/$/,"")}/api/v4/projects/${encodeURIComponent(n)}/${s==="prs"?"merge_requests":"issues"}?state=opened&per_page=1`}let o;try{o=await t(i,{headers:y(r,e),signal:AbortSignal.timeout(L)})}catch(a){return{error:`could not be reached: ${String(a?.message??a).slice(0,200)}`}}if(!o.ok)return{error:o.status===404?"not found (or not visible to the connector)":`HTTP ${o.status}`};if(r==="gitlab"){let a=Number(o.headers.get("x-total"));return Number.isInteger(a)&&a>=0?a:{error:"no X-Total in the answer"}}let c=await o.json().catch(()=>null),l=Number(c?.total_count);return Number.isInteger(l)&&l>=0?l:{error:"no total_count in the answer"}}}var F=["active","done","dropped"],Q=300,A=500;function ee(e,t=w,r=Date.now()){if(e&&typeof e=="object"&&!Array.isArray(e)&&String(e.kind).trim().toLowerCase()==="count"){let s=f(e);return typeof s=="string"?s:{kind:"count",...s}}let n=C(e,t,r);return typeof n!="string"?n:/^closeWhen(\.kind)? must be/.test(n)?"check must be an object with a kind: url, issue, git-ancestor, reply or count":n.replace(/^closeWhen/,"check")}function U(e){if(!e)return null;try{if(JSON.parse(e)?.kind==="count"){let t=S(e);return t?{kind:"count",...t}:null}}catch{return null}return R(e)}function j(e){return e.kind==="count"?$(e):E(e)}function k(e){return{id:e.id,title:e.title,ownerAgent:e.owner_agent??null,state:e.state,doneWhen:e.done_when??null,check:U(e.check_spec),evidence:e.evidence??null,lastCheck:e.last_check??null,lastCheckAt:e.last_check_at??null,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at??null}}var N=class{constructor(t){this.db=t;t.exec(`
1
+ import{_ as y,aa as v,ga as w,ha as C,ja as E,ka as R,la as I}from"./chunk-CARVBJB7.js";I();v();var L=1e4,T=["issues","prs","all"],W=/^[\w.-]+(?:\/[\w.-]+)+$/,m=e=>typeof e=="string"?e.trim():"";function f(e){let t=m(e.provider).toLowerCase();if(t!=="github"&&t!=="gitlab")return"count.provider must be github or gitlab";let r=m(e.project),n=r.split("/");if(!W.test(r)||n.some(o=>o==="."||o==="..")||t==="github"&&n.length!==2)return t==="github"?'count.project must be "owner/repo"':'count.project must be "group/project"';let s=(m(e.what)||"issues").toLowerCase();if(!T.includes(s))return`count.what must be one of ${T.join(", ")}`;let i=e.max===void 0||e.max===null||e.max===""?0:Number(e.max);return!Number.isInteger(i)||i<0?"count.max must be a whole number, 0 or more":{provider:t,project:r,what:s,max:i}}function S(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let r=f(t);return typeof r=="string"?null:r}catch{return null}}var _=e=>e==="issues"?"open issues":e==="prs"?"open pull requests":"open issues and pull requests";function $(e){return`${_(e.what)} in ${e.provider} ${e.project} \u2264 ${e.max}`}async function Y(e,t){if(!t)return{verdict:"unverifiable",detail:`no ${e.provider} connector on this node`};try{let r=e.what==="all"?["issues","prs"]:[e.what],n=0;for(let i of r){let o=await t(e.provider,e.project,i);if(typeof o!="number")return{verdict:"unverifiable",detail:`${e.project}: ${o.error}`};n+=o}let s=`${n} ${_(e.what)} in ${e.project}`;return{verdict:n<=e.max?"met":"not_met",detail:s,count:n}}catch(r){return{verdict:"unverifiable",detail:`the count check failed: ${String(r?.message??r).slice(0,200)}`}}}function B(e,t=fetch){return async(r,n,s)=>{let i;if(r==="github"){let a=e.github;if(!a)return{error:"no github connector on this node (channels.github or requests.checkers.github)"};let d=encodeURIComponent(`repo:${n} is:open is:${s==="prs"?"pr":"issue"}`);i=`${a.apiUrl.replace(/\/$/,"")}/search/issues?q=${d}&per_page=1`}else{let a=e.gitlab;if(!a)return{error:"no gitlab connector on this node (channels.gitlab or requests.checkers.gitlab)"};i=`${a.url.replace(/\/$/,"")}/api/v4/projects/${encodeURIComponent(n)}/${s==="prs"?"merge_requests":"issues"}?state=opened&per_page=1`}let o;try{o=await t(i,{headers:y(r,e),signal:AbortSignal.timeout(L)})}catch(a){return{error:`could not be reached: ${String(a?.message??a).slice(0,200)}`}}if(!o.ok)return{error:o.status===404?"not found (or not visible to the connector)":`HTTP ${o.status}`};if(r==="gitlab"){let a=Number(o.headers.get("x-total"));return Number.isInteger(a)&&a>=0?a:{error:"no X-Total in the answer"}}let c=await o.json().catch(()=>null),l=Number(c?.total_count);return Number.isInteger(l)&&l>=0?l:{error:"no total_count in the answer"}}}var F=["active","done","dropped"],Q=300,A=500;function ee(e,t=w,r=Date.now()){if(e&&typeof e=="object"&&!Array.isArray(e)&&String(e.kind).trim().toLowerCase()==="count"){let s=f(e);return typeof s=="string"?s:{kind:"count",...s}}let n=C(e,t,r);return typeof n!="string"?n:/^closeWhen(\.kind)? must be/.test(n)?"check must be an object with a kind: url, issue, git-ancestor, reply or count":n.replace(/^closeWhen/,"check")}function U(e){if(!e)return null;try{if(JSON.parse(e)?.kind==="count"){let t=S(e);return t?{kind:"count",...t}:null}}catch{return null}return R(e)}function j(e){return e.kind==="count"?$(e):E(e)}function k(e){return{id:e.id,title:e.title,ownerAgent:e.owner_agent??null,state:e.state,doneWhen:e.done_when??null,check:U(e.check_spec),evidence:e.evidence??null,lastCheck:e.last_check??null,lastCheckAt:e.last_check_at??null,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at??null}}var N=class{constructor(t){this.db=t;t.exec(`
2
2
  CREATE TABLE IF NOT EXISTS goals (
3
3
  id TEXT PRIMARY KEY,
4
4
  title TEXT NOT NULL,
@@ -17,4 +17,4 @@ import{_ as y,aa as v,ga as w,ha as C,ja as E,ka as R,la as I}from"./chunk-DUCYR
17
17
  `)}get(t){let r=this.db.prepare("SELECT * FROM goals WHERE id = ?").get(t);return r?k(r):null}list(t=F,r=200){let n=t.map(()=>"?").join(", ");return this.db.prepare(`SELECT * FROM goals WHERE state IN (${n}) ORDER BY updated_at DESC, rowid DESC LIMIT ?`).all(...t,r).map(k)}ensure(t,r,n){return this.db.prepare("INSERT INTO goals (id, title, owner_agent, state, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?) ON CONFLICT(id) DO NOTHING").run(t.id,t.title,r,n,n),this.get(t.id)}upsert(t,r){let n=this.get(t.id);return n?this.db.prepare("UPDATE goals SET title = ?, owner_agent = ?, done_when = ?, check_spec = ?, updated_at = ? WHERE id = ?").run(t.title||n.title,t.ownerAgent!==void 0?t.ownerAgent:n.ownerAgent,t.doneWhen!==void 0?t.doneWhen:n.doneWhen,t.check!==void 0?t.check?JSON.stringify(t.check):null:n.check?JSON.stringify(n.check):null,r,t.id):this.db.prepare("INSERT INTO goals (id, title, owner_agent, state, done_when, check_spec, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?, ?, ?)").run(t.id,t.title,t.ownerAgent??null,t.doneWhen??null,t.check?JSON.stringify(t.check):null,r,r),this.get(t.id)}close(t,r,n,s){return this.db.prepare("UPDATE goals SET state = ?, evidence = ?, closed_at = ?, updated_at = ? WHERE id = ? AND state = 'active'").run(r,n?n.slice(0,A):null,s,s,t).changes>0}markChecked(t,r,n){this.db.prepare("UPDATE goals SET last_check = ?, last_check_at = ? WHERE id = ?").run(r.slice(0,A),n,t)}dueChecks(t){return this.db.prepare("SELECT * FROM goals WHERE state = 'active' AND check_spec IS NOT NULL AND (last_check_at IS NULL OR last_check_at <= ?) ORDER BY last_check_at ASC LIMIT 50").all(t).map(k)}};async function te(e,t,r,n,s=()=>{}){let i=[];for(let o of e.dueChecks(n-r*6e4)){let c;try{c=await t(o.check)}catch(l){c={verdict:"unverifiable",detail:String(l?.message??l)}}e.markChecked(o.id,c.detail,n),c.verdict==="met"&&e.close(o.id,"done",`check: ${c.detail}`,n)?(i.push(o.id),s(`[goals] ${o.id} done: ${c.detail}`)):c.verdict==="unverifiable"&&s(`[goals] ${o.id}: check failed: ${c.detail}`)}return i}function ne(e,t){let r=[`[Goal] ${e.title} (${e.id}): ${e.state}${e.ownerAgent?`, owner ${e.ownerAgent}`:""}.`];return e.doneWhen&&r.push(`Done when: ${e.doneWhen}`),e.check&&r.push(`Check: ${j(e.check)}${e.lastCheck?`; last seen: ${e.lastCheck}${e.lastCheckAt?` (${new Date(e.lastCheckAt).toISOString().slice(0,16).replace("T"," ")} UTC)`:""}`:""}`),t&&r.push(`Requests under it: ${t.open} open, ${t.done} done.`),r.join(`
18
18
  `)}var g="Africa/Tunis";function b(e,t=g){let r=Object.fromEntries(new Intl.DateTimeFormat("en-GB",{timeZone:t,hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(new Date(e)).map(s=>[s.type,s.value])),n=(Number(r.hour)%24*3600+Number(r.minute)*60+Number(r.second))*1e3+e%1e3;return e-n}var M=(e,t)=>new Intl.DateTimeFormat("en-GB",{timeZone:t,hour12:!1,hour:"2-digit",minute:"2-digit"}).format(new Date(e));function q(e,t=10){let r=e.replace(/\s+/g," ").trim().split(" ");return r.slice(0,t).join(" ")+(r.length>t?" \u2026":"")}var H=new Set(["issue","idea","approval","erp","card"]);function oe(e,t={}){let r=e.map(n=>{let s=[],i=(o,c)=>{s.some(l=>l.kind===o&&l.ref===c)||s.push({kind:o,ref:c})};for(let o of n.links??[])H.has(o.kind)&&i(o.kind,o.ref);return n.home&&i(n.home.kind,n.home.link),t.hasPlan?.(n.id)&&i("plan",n.id),n.evidence&&i("evidence",n.evidence),{id:n.id,time:M(n.createdAt,t.zone??g),words:q(n.text),state:n.state,owner:n.agentId,landed:s,noHome:s.length===0&&n.state!=="declined"&&n.state!=="dropped"}});return[...r.filter(n=>n.noHome),...r.filter(n=>!n.noHome)]}var x={timeZone:g,days:7},X=90,D=5,G=120,P=(e,t)=>new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e));function Z(e,t){return{day:P(e,t),start:e,asked:0,done:0,dropped:0,moving:0,waiting:0,stuck:0,rate:null,dropReasons:[],moreReasons:0,resent:0,resentDone:0}}function ie(e,t={}){let r=t.zone??x.timeZone,n=Math.min(Math.max(Math.floor(t.days??x.days),1),X),s=t.now??Date.now(),i=[b(s,r)];for(;i.length<n;)i.unshift(b(i[0]-1,r));let o=i.map(a=>Z(a,r)),c=o.map(()=>new Map),l=0;for(let a of e.flowRows(i[0])){for(;l+1<o.length&&a.createdAt>=o[l+1].start;)l++;let d=o[l];if(d.asked++,a.state==="done")d.done++;else if(a.state==="declined"||a.state==="dropped"){d.dropped++;let p=(a.closeReason??"").replace(/\s+/g," ").trim(),u=p.length>G?`${p.slice(0,G-1)}\u2026`:p||"no reason given";c[l].set(u,(c[l].get(u)??0)+1)}else a.state==="in_progress"||a.state==="waiting_other"?d.moving++:a.state==="waiting_owner"?d.waiting++:a.state==="needs_attention"&&d.stuck++;a.resentAt!==null&&(d.resent++,a.state==="done"&&d.resentDone++)}return o.forEach((a,d)=>{a.rate=a.asked?(a.done+a.dropped)/a.asked:null;let p=[...c[d]].sort((u,h)=>h[1]-u[1]);a.dropReasons=p.slice(0,D).map(([u,h])=>({reason:u,count:h})),a.moreReasons=p.slice(D).reduce((u,[,h])=>u+h,0)}),{zone:r,days:o,today:o[o.length-1]}}var O=e=>e===null?"\u2013":`${Math.round(e*100)}%`;function ce(e){let t=e.today,r=[`Today (${t.day}, ${e.zone}): ${t.asked?`${t.done+t.dropped} of ${t.asked} closed, ${O(t.rate)}`:"nothing asked yet"}.`,` ${t.done} done, ${t.dropped} dropped, ${t.moving} moving, ${t.waiting} waiting on the owner, ${t.stuck} stuck.`+(t.resent?` ${t.resent} resent once on its own, ${t.resentDone} of them done.`:"")];if(t.dropReasons.length){r.push(" Dropped because:");for(let n of t.dropReasons)r.push(` ${n.count} \xD7 ${n.reason}`);t.moreReasons&&r.push(` ${t.moreReasons} more`)}if(e.days.length>1){r.push("","Day asked done dropped moving waiting stuck rate");for(let n of e.days){let s=[n.asked,n.done,n.dropped,n.moving,n.waiting,n.stuck].map(String);r.push(`${n.day} ${s[0].padStart(5)} ${s[1].padStart(4)} ${s[2].padStart(7)} ${s[3].padStart(6)} ${s[4].padStart(7)} ${s[5].padStart(5)} ${O(n.rate).padStart(4)}`)}}return r.join(`
19
19
  `)}export{f as a,S as b,$ as c,Y as d,B as e,Q as f,A as g,ee as h,j as i,N as j,te as k,ne as l,b as m,oe as n,x as o,X as p,ie as q,ce as r};
20
- //# sourceMappingURL=chunk-CXFVIDJV.js.map
20
+ //# sourceMappingURL=chunk-R6XJWFMC.js.map
@@ -1,4 +1,4 @@
1
- import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{Qb as tt,Rb as nt}from"./chunk-DUCYRNCT.js";import{a as it,b as at,c as ct,d as ut,e as lt,f as dt,g as pt,h as mt,i as bt,j as ft,k as gt,l as yt}from"./chunk-RGDKHYY2.js";import{a as E,b as We,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function wt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import Tt from"better-sqlite3";import{createHash as Et}from"crypto";import{mkdirSync as kt}from"fs";import{dirname as St,resolve as xt}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function At(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Rt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&vt(e),t<2&&Ot(e),t<3&&_t(e)}function _t(e){e.exec(`
1
+ import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{Qb as tt,Rb as nt}from"./chunk-CARVBJB7.js";import{a as it,b as at,c as ct,d as ut,e as lt,f as dt,g as pt,h as mt,i as bt,j as ft,k as gt,l as yt}from"./chunk-RGDKHYY2.js";import{a as E,b as We,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function wt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import Tt from"better-sqlite3";import{createHash as Et}from"crypto";import{mkdirSync as kt}from"fs";import{dirname as St,resolve as xt}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function At(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Rt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&vt(e),t<2&&Ot(e),t<3&&_t(e)}function _t(e){e.exec(`
2
2
  ALTER TABLE decision_calls ADD COLUMN features_json TEXT;
3
3
  INSERT INTO schema_version (v) VALUES (3);
4
4
  `)}function Ot(e){e.exec(`
@@ -111,4 +111,4 @@ import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";im
111
111
  `)}if(!m)throw new Error(`local decision backend could not get a valid answer after ${f+1} attempt(s): ${w}`);let M={},L=!1;for(let[k,q]of Object.entries(s.questions)){let S=_(q,m[k],{normalize:e.normalizeProbabilities??!0});M[k]=S.answer,S.repaired&&(L=!0)}return{model:a,answers:M,usage:h,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function Jt(e,t,r,n,o){if(!e.generateRaw)throw new Error(`provider "${e.name}" has no generateRaw(); use structureMode "text"`);let s=[{role:"user",content:r},...n?[{role:"user",content:n}]:[]],i=await e.generateRaw(s,J,[{name:F,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:F}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===F),u=a&&a.type==="tool_use"?a.input:null;return{answers:Be(u),usage:{inputTokens:i.usage.input_tokens,outputTokens:i.usage.output_tokens}}}async function Gt(e,t,r,n,o){let s=[r,ae(t)].join(`
112
112
  `),i=[{role:"system",content:J},{role:"user",content:s},...n?[{role:"user",content:n}]:[]],a=await e.generate(i,o);return{answers:Be(Te(a.content??"")),usage:{inputTokens:0,outputTokens:a.tokensUsed??0}}}function Be(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(t.answers&&typeof t.answers=="object")return t.answers}return e}function Yt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Kt(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var Xt,$t,Vt,Fe,zt,be=E(()=>{"use strict";Ze();Ue();ht();j();Y();v();z();Xt="claude-code",$t="claude-haiku-4-5-20251001",Vt=24e3,Fe=2e3,zt=3e4});import{readFileSync as Ht}from"fs";import{homedir as Wt}from"os";import{join as Zt}from"path";function N(e={}){let t=(e.baseUrl??en).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??nn,s=e.maxChoiceOptions??rn,i={probabilitySource:e.probabilitySource??"logits",calibratedProbabilities:!1,maxChoiceOptions:s,maxStateChars:o,parallelQuestions:!0,images:!1};return{name:n,capabilities:i,async decide(a){A(a.questions),cn(a.questions,s);let u=Date.now(),c=a.model??e.model;if(!c)throw new Error("simple-jev backend needs a model id");let l=G(a.state,o),p=e.fetchImpl??fetch,{signal:g,dispose:d}=un(a.abortSignal,a.timeoutMs??e.timeoutMs??tn);try{let b={"Content-Type":"application/json"},h=an(e.apiKeyEnv,e.apiKeyFile);h&&(b.Authorization=`Bearer ${h}`);let T=await qe(p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:sn(a.questions)}),signal:g}),g);if(!T.ok){let k=await T.text().catch(()=>"");throw new Error(`${n} ${T.status}: ${k.slice(0,300)}`)}let f=await qe(T.json(),g),m=P(a.questions).safeParse(f.answers);if(!m.success)throw new Error(`${n} returned a response that does not match the requested questions (contract drift, not a model slip \u2014 retrying will not help):
113
113
  ${U(m.error)}`);let w=m.data,M={},L=!1;for(let[k,q]of Object.entries(a.questions)){let S=_(q,w[k]);M[k]=S.answer,S.repaired&&(L=!0)}return{model:f.model??c,answers:M,usage:{inputTokens:f.usage?.input_tokens??0,outputTokens:f.usage?.output_tokens??0},meta:{backend:n,structureMode:i.probabilitySource==="native"?"native":"logprobs",answerMode:"probabilities",repaired:L,retries:0,stateTruncated:l.truncated,latencyMs:Date.now()-u}}}finally{d()}}}}function sn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:on[n.type]};return t}function an(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Zt(Wt(),t.slice(2)):t;if(!Z.has(n))try{let o=Ht(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function cn(e,t){for(let[r,n]of Object.entries(e))if(n.type==="choice"){let o=Object.keys(n.criteria).length;if(o>t)throw new Error(`question "${r}": accepts at most ${t} choice options, got ${o}`)}else if(n.type==="score"&&n.criteria.length>t)throw new Error(`question "${r}": accepts at most ${t} score levels, got ${n.criteria.length}`)}function qe(e,t){return t.aborted?Promise.reject(t.reason??new Error("aborted")):new Promise((r,n)=>{let o=()=>n(t.reason??new Error("aborted"));t.addEventListener("abort",o,{once:!0}),e.then(s=>{t.removeEventListener("abort",o),r(s)},s=>{t.removeEventListener("abort",o),n(s)})})}function un(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var en,tn,nn,rn,on,Z,fe=E(()=>{"use strict";j();v();z();Y();en="http://127.0.0.1:8000/v1",tn=3e4,nn=6e3,rn=50;on={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var Xe={};We(Xe,{DEFAULT_SEAT_TIMEOUT_MS:()=>Ve,DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>F,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>wt,agreement:()=>it,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>mt,askSeat:()=>yn,band:()=>Ie,bootstrapInterval:()=>ft,brier:()=>lt,buildDesign:()=>ve,calibrationReport:()=>gt,choice:()=>ot,compareCalibrators:()=>It,confidenceFor:()=>re,configureDecisions:()=>pn,configuredSeatTimeout:()=>dn,coverageCurve:()=>pt,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>N,decisionsRuntime:()=>bn,describeIssues:()=>U,ece:()=>ct,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>Ne,fitRecalibrator:()=>B,fitTemperature:()=>bt,getDecisionBackend:()=>D,getSeatMode:()=>Je,labelSeatCall:()=>fn,labelsOf:()=>x,listDecisionBackends:()=>Ee,logLoss:()=>dt,logit:()=>le,mce:()=>ut,measureConsistency:()=>Ut,normalizeDistribution:()=>Se,normalizedNegEntropy:()=>oe,noul:()=>rt,pMax:()=>xe,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>P,recordSeatOutcome:()=>gn,registerBuiltinDecisionBackends:()=>ln,registerDecisionBackend:()=>R,reliabilityBins:()=>at,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>mn,score:()=>st,seatEnvVar:()=>ze,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function ln(e={},t={},r={},n={}){R("mock",()=>H()),R("local",()=>W(e)),R("simple-jev",()=>N(t)),R("jev",()=>N({name:"jev",baseUrl:"https://openrouter.ai/api/alpha",path:"/decisions",model:"jev-latest",apiKeyEnv:"OPENROUTER_API_KEY",apiKeyFile:"~/.agentx/openrouter-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...r})),R("typesafe",()=>N({name:"typesafe",baseUrl:"https://api.typesafe.ai/v1",path:"/systemone",model:"jev-latest",apiKeyEnv:"TYPESAFE_API_KEY",apiKeyFile:"~/.agentx/typesafe-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...n}))}var $e=E(()=>{"use strict";ke();v();j();z();C();Y();V();yt();Me();je();Ge();pe();be();fe();C();pe();be();fe()});function dn(e){return Ke(),y.seats[e]?.timeoutMs}function pn(e){y={...ye,...y,...e},ee=!0}function mn(){y={...ye,seats:{}},ee=!1}function Ke(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(nt(),he(tt)),t=e()?.decisions;if(!t?.enabled)return;let{registerBuiltinDecisionBackends:r}=($e(),he(Xe)),n=t.backends??{};r(n.local,n.simpleJev,n.jev,n.typesafe);let o=null;try{o=new I({path:t.dbPath})}catch{}y={enabled:!0,defaultBackend:t.defaultBackend,store:o,seats:Object.fromEntries(Object.entries(t.seats??{}).map(([s,i])=>[s,{...i,redactState:t.redactState,keepStateRows:t.keepStateRows}]))}}catch{}}}function bn(){return y}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return hn.includes(t)?t:null}function ze(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function Je(e,t=process.env){Ke();let r=ge(t[ze(e)]);return r||(y.enabled?ge(y.seats[e]?.mode)??"off":"off")}function fn(e,t,r,n={}){if(!(!e||!y.store))try{y.store.label(e,t,r,n)}catch{}}function gn(e,t,r=!1){if(!(!e||!y.store))try{y.store.recordOutcome(e,t,r)}catch{}}async function yn(e,t,r,n={}){let o=Je(e);if(o==="off")return null;let s=y.seats[e]??{mode:o},i=n.backend??s.backend??y.defaultBackend,a=Date.now();try{let c=await D(i).decide({state:t,questions:r,model:n.model??s.model,abortSignal:n.signal,timeoutMs:n.timeoutMs??s.timeoutMs??(y.seats[e]?Ve:void 0)}),l=wn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return Tn(e,o,t,r,i,n,s,a,u),En(e,i,u),null}}function wn(e,t,r,n,o,s,i){if(!y.store)return null;try{return y.store.recordCall({seat:e,mode:t,backend:o.meta.backend,model:o.model,meta:o.meta,state:r,questions:n,answers:o.answers,usage:o.usage,incumbent:He(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function Tn(e,t,r,n,o,s,i,a,u){if(y.store)try{y.store.recordCall({seat:e,mode:t,backend:o,model:s.model??i.model??"unknown",meta:{structureMode:"text",answerMode:"probabilities",retries:0,stateTruncated:!1,latencyMs:Date.now()-a},state:r,questions:n,answers:{},incumbent:He(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function He(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function En(e,t,r){let n=Date.now();n-Ye<6e4||(Ye=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var Ve,ye,y,ee,hn,Ye,Ge=E(()=>{C();V();Ve=1e4;ye={enabled:!1,defaultBackend:"local",seats:{},store:null},y={...ye},ee=!1;hn=["off","shadow","active"];Ye=0});export{D as a,Ee as b,C as c,I as d,V as e,It as f,Me as g,Ut as h,je as i,me as j,Xn as k,Ue as l,ln as m,$e as n,Ve as o,dn as p,pn as q,mn as r,bn as s,ge as t,ze as u,Je as v,fn as w,gn as x,yn as y,Ge as z};
114
- //# sourceMappingURL=chunk-245IOYDJ.js.map
114
+ //# sourceMappingURL=chunk-RPL2P7EP.js.map
@@ -1,2 +1,2 @@
1
- import{y as l,z as T}from"./chunk-245IOYDJ.js";import{a,f as w}from"./chunk-72SZI2UW.js";T();w();var d="task-tier";function u(e){return{task:b(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:a("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function b(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2;function p(e){return e==="voice"||e==="desktop"||e==="opencode"}var f=60*60*1e3;function M(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function v(e){let n=(s,r=null)=>({downgraded:!1,needsFlagship:r,reason:s});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let s=e.sessionIdleMs??0,r=e.cacheTtlMs??f;if(s<r)return n(`follow-up on a warm cache (idle ${Math.round(s/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"},timeoutMs:1500})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let o=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${o<(e.threshold??h)?"downgrade":"keep"} (${o.toFixed(2)})`,o);let i=e.threshold??h;return o>=i?n(`needs the flagship (${o.toFixed(2)})`,o):{model:e.cheapModel,downgraded:!0,needsFlagship:o,reason:`mechanical task (${o.toFixed(2)} below ${i}) \u2192 ${e.cheapModel}`}}var A=["labeled","unlabeled","closed"];function y(e){let n=r=>({downgraded:!1,needsFlagship:null,reason:r});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);let t=e.eventActions??[];if(!t.length)return n("not started by a platform event");let o=e.triage?.actions??A,i=t.find(r=>!o.includes(r));if(i)return n(`"${i}" is not a triage action`);let s=M(e.tier,{cheapModels:e.triage?.models});if(!s)return n(`no triage model set for ${e.tier}`);if(e.isFollowUp){let r=e.sessionIdleMs??0,m=e.cacheTtlMs??f;if(r<m)return n(`follow-up on a warm cache (idle ${Math.round(r/1e3)}s) \u2014 keeping the session's model`)}return{model:s,downgraded:!0,needsFlagship:null,reason:`triage event (${t.join(", ")}) \u2192 ${s}`}}export{h as a,p as b,M as c,v as d,A as e,y as f};
2
- //# sourceMappingURL=chunk-UGRMFQAG.js.map
1
+ import{y as l,z as T}from"./chunk-RPL2P7EP.js";import{a,f as w}from"./chunk-72SZI2UW.js";T();w();var d="task-tier";function u(e){return{task:b(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:a("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function b(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2;function p(e){return e==="voice"||e==="desktop"||e==="opencode"}var f=60*60*1e3;function M(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function v(e){let n=(s,r=null)=>({downgraded:!1,needsFlagship:r,reason:s});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let s=e.sessionIdleMs??0,r=e.cacheTtlMs??f;if(s<r)return n(`follow-up on a warm cache (idle ${Math.round(s/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"},timeoutMs:1500})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let o=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${o<(e.threshold??h)?"downgrade":"keep"} (${o.toFixed(2)})`,o);let i=e.threshold??h;return o>=i?n(`needs the flagship (${o.toFixed(2)})`,o):{model:e.cheapModel,downgraded:!0,needsFlagship:o,reason:`mechanical task (${o.toFixed(2)} below ${i}) \u2192 ${e.cheapModel}`}}var A=["labeled","unlabeled","closed"];function y(e){let n=r=>({downgraded:!1,needsFlagship:null,reason:r});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);let t=e.eventActions??[];if(!t.length)return n("not started by a platform event");let o=e.triage?.actions??A,i=t.find(r=>!o.includes(r));if(i)return n(`"${i}" is not a triage action`);let s=M(e.tier,{cheapModels:e.triage?.models});if(!s)return n(`no triage model set for ${e.tier}`);if(e.isFollowUp){let r=e.sessionIdleMs??0,m=e.cacheTtlMs??f;if(r<m)return n(`follow-up on a warm cache (idle ${Math.round(r/1e3)}s) \u2014 keeping the session's model`)}return{model:s,downgraded:!0,needsFlagship:null,reason:`triage event (${t.join(", ")}) \u2192 ${s}`}}export{h as a,p as b,M as c,v as d,A as e,y as f};
2
+ //# sourceMappingURL=chunk-RRLQTU3X.js.map