agentix-cli 0.156.0 → 0.157.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.
- package/dist/{App-NSZBO2ZD.js → App-AFRBV666.js} +2 -2
- package/dist/{ChatApp-HDLLCAE6.js → ChatApp-EBTSY27Z.js} +2 -2
- package/dist/{absorb-eval-A6HIYEBY.js → absorb-eval-VUJFGASJ.js} +2 -2
- package/dist/agent-EA55CR6J.js +2 -0
- package/dist/{board-dashboard-FPNEYUYE.js → board-dashboard-2X72LAVO.js} +4 -4
- package/dist/{board-dashboard-FPNEYUYE.js.map → board-dashboard-2X72LAVO.js.map} +1 -1
- package/dist/{chunk-SP323WDN.js → chunk-2NLPGLLL.js} +2 -2
- package/dist/{chunk-PXJWLJWA.js → chunk-3HO6CHT6.js} +3 -3
- package/dist/{chunk-FRSHCCRH.js → chunk-3ZMVYNFH.js} +2 -2
- package/dist/{chunk-YZHYE4LQ.js → chunk-4UJ7S2DD.js} +6 -6
- package/dist/chunk-4UJ7S2DD.js.map +1 -0
- package/dist/{chunk-HV7EIZUB.js → chunk-4UMMAI3Z.js} +2 -2
- package/dist/{chunk-C5W2QXHG.js → chunk-5OZMFHIZ.js} +3 -3
- package/dist/chunk-5OZMFHIZ.js.map +1 -0
- package/dist/{chunk-TO7TTQAW.js → chunk-6HNCLOHS.js} +2 -2
- package/dist/{chunk-JNG3P5V2.js → chunk-6QLRRSKU.js} +21 -21
- package/dist/chunk-6QLRRSKU.js.map +1 -0
- package/dist/{chunk-DWESRGS4.js → chunk-B3I4EBLE.js} +2 -2
- package/dist/{chunk-B2DFT7QY.js → chunk-BY2AAMOO.js} +2 -2
- package/dist/{chunk-U23LVMMZ.js → chunk-CCSG7MSD.js} +2 -2
- package/dist/{chunk-EVJ3A5EI.js → chunk-CLNOAP6S.js} +2 -2
- package/dist/{chunk-EVJ3A5EI.js.map → chunk-CLNOAP6S.js.map} +1 -1
- package/dist/{chunk-GJMTN72H.js → chunk-E4O32ZYZ.js} +2 -2
- package/dist/{chunk-L6LJEBXY.js → chunk-EWBUH2IU.js} +2 -2
- package/dist/{chunk-7U6YGXWE.js → chunk-FEF432WU.js} +2 -2
- package/dist/{chunk-GNRECXDY.js → chunk-FKYIYJF7.js} +2 -2
- package/dist/{chunk-5BOSHX42.js → chunk-GKQVXA3P.js} +264 -250
- package/dist/chunk-GKQVXA3P.js.map +1 -0
- package/dist/{chunk-YSRH6AXN.js → chunk-I5FRA3JS.js} +8 -8
- package/dist/{chunk-YSRH6AXN.js.map → chunk-I5FRA3JS.js.map} +1 -1
- package/dist/{chunk-7JRBOEWC.js → chunk-JJV7O7YK.js} +2 -2
- package/dist/{chunk-E7LKRV7R.js → chunk-KPNAXVET.js} +2 -2
- package/dist/{chunk-B4CZHRRV.js → chunk-MBPYC6QF.js} +2 -2
- package/dist/{chunk-HH3UZA4Y.js → chunk-MJHAMHEF.js} +2 -2
- package/dist/{chunk-HH3UZA4Y.js.map → chunk-MJHAMHEF.js.map} +1 -1
- package/dist/{chunk-RKGDYAOV.js → chunk-NY5ZY2WV.js} +2 -2
- package/dist/chunk-O5H6BCUN.js +77 -0
- package/dist/chunk-O5H6BCUN.js.map +1 -0
- package/dist/{chunk-HW4BVIWX.js → chunk-OABGAL3N.js} +2 -2
- package/dist/{chunk-W2KZCY7H.js → chunk-OYPKAYCH.js} +2 -2
- package/dist/{chunk-NGSEAAUR.js → chunk-PA3KFAXH.js} +2 -2
- package/dist/{chunk-U7BSIXY5.js → chunk-R4HBEILQ.js} +2 -2
- package/dist/{chunk-IVBCCSDR.js → chunk-TCC56PYX.js} +2 -2
- package/dist/{chunk-ATCWYDB2.js → chunk-YLFNY4OF.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-LOLBLWQH.js → client-7ZJZT5H7.js} +2 -2
- package/dist/{compaction-PFXWL4H7.js → compaction-GSUWZYBK.js} +3 -3
- package/dist/{config-XIHDFV7R.js → config-NFDEJ3NB.js} +2 -2
- package/dist/{config-mutate-GLGD4OXG.js → config-mutate-JYW5G7T6.js} +2 -2
- package/dist/config-mutator-OMWL5XHO.js +2 -0
- package/dist/{context-planner-DJB6CKY6.js → context-planner-2XBAPQ3S.js} +2 -2
- package/dist/{contributions-ZWZKNT7F.js → contributions-TMZ3DYY5.js} +2 -2
- package/dist/{doctor-P7TUOQJL.js → doctor-FTUB5ITL.js} +2 -2
- package/dist/{follow-up-tool-PS4ZST7N.js → follow-up-tool-FNO2IG72.js} +2 -2
- package/dist/heal-KCM6JYUK.js +2 -0
- package/dist/hub-MOAG5BEQ.js +2 -0
- package/dist/index.d.ts +509 -373
- package/dist/index.js +1 -1
- package/dist/memory-extract-PFJDJNBH.js +2 -0
- package/dist/{program-K3YRP5QZ.js → program-HWWXPPS5.js} +24 -24
- package/dist/program-HWWXPPS5.js.map +1 -0
- package/dist/{promote-U4MVP653.js → promote-AAEZYPBP.js} +2 -2
- package/dist/{providers-BDJXGHEY.js → providers-VVT2OBXA.js} +2 -2
- package/dist/{query-CHK6IY4Z.js → query-2EWUIUIT.js} +2 -2
- package/dist/{query-settings-NZT2BKX5.js → query-settings-7CB37D6D.js} +2 -2
- package/dist/{registry-VAZ7KJAX.js → registry-EZMQ2OYY.js} +2 -2
- package/dist/{request-planner-XOFWVB6L.js → request-planner-2AU3VK4P.js} +2 -2
- package/dist/{review-candidates-IYXJRG5K.js → review-candidates-CIEGXF7K.js} +2 -2
- package/dist/routing-XJ25QONX.js +2 -0
- package/dist/schedule-tool-5T4CH4CM.js +2 -0
- package/dist/{scheduler-O35FPVFM.js → scheduler-UKJWO2TR.js} +2 -2
- package/dist/{seat-C3D3GZCW.js → seat-JWRCBUKR.js} +2 -2
- package/dist/{select-AA7JJN2D.js → select-KIDX6WWF.js} +2 -2
- package/dist/{set-enabled-IDPKRK5C.js → set-enabled-F4D3VWKI.js} +2 -2
- package/dist/tool-7FFJSFTS.js +6 -0
- package/dist/tool-7FFJSFTS.js.map +1 -0
- package/dist/{tool-35X6HKUQ.js → tool-YSS2C2UX.js} +2 -2
- package/dist/wiki-PSUAAREB.js +2 -0
- package/dist/wiki-enrich-TJIL4B3V.js +2 -0
- package/package.json +2 -1
- package/dist/agent-PSZY33DQ.js +0 -2
- package/dist/chunk-5BOSHX42.js.map +0 -1
- package/dist/chunk-C5W2QXHG.js.map +0 -1
- package/dist/chunk-HM6VPTXV.js +0 -76
- package/dist/chunk-HM6VPTXV.js.map +0 -1
- package/dist/chunk-JNG3P5V2.js.map +0 -1
- package/dist/chunk-YZHYE4LQ.js.map +0 -1
- package/dist/config-mutator-OC6ZQQCR.js +0 -2
- package/dist/heal-RGM7X2ZG.js +0 -2
- package/dist/hub-5FDLTQA4.js +0 -2
- package/dist/memory-extract-GHLBXV4H.js +0 -2
- package/dist/program-K3YRP5QZ.js.map +0 -1
- package/dist/routing-ZMRPUXLA.js +0 -2
- package/dist/schedule-tool-EU2ILYUI.js +0 -2
- package/dist/tool-NWVSRBIK.js +0 -6
- package/dist/tool-NWVSRBIK.js.map +0 -1
- package/dist/wiki-I7BSMBAC.js +0 -2
- package/dist/wiki-enrich-G4GUITL4.js +0 -2
- /package/dist/{App-NSZBO2ZD.js.map → App-AFRBV666.js.map} +0 -0
- /package/dist/{ChatApp-HDLLCAE6.js.map → ChatApp-EBTSY27Z.js.map} +0 -0
- /package/dist/{absorb-eval-A6HIYEBY.js.map → absorb-eval-VUJFGASJ.js.map} +0 -0
- /package/dist/{agent-PSZY33DQ.js.map → agent-EA55CR6J.js.map} +0 -0
- /package/dist/{chunk-SP323WDN.js.map → chunk-2NLPGLLL.js.map} +0 -0
- /package/dist/{chunk-PXJWLJWA.js.map → chunk-3HO6CHT6.js.map} +0 -0
- /package/dist/{chunk-FRSHCCRH.js.map → chunk-3ZMVYNFH.js.map} +0 -0
- /package/dist/{chunk-HV7EIZUB.js.map → chunk-4UMMAI3Z.js.map} +0 -0
- /package/dist/{chunk-TO7TTQAW.js.map → chunk-6HNCLOHS.js.map} +0 -0
- /package/dist/{chunk-DWESRGS4.js.map → chunk-B3I4EBLE.js.map} +0 -0
- /package/dist/{chunk-B2DFT7QY.js.map → chunk-BY2AAMOO.js.map} +0 -0
- /package/dist/{chunk-U23LVMMZ.js.map → chunk-CCSG7MSD.js.map} +0 -0
- /package/dist/{chunk-GJMTN72H.js.map → chunk-E4O32ZYZ.js.map} +0 -0
- /package/dist/{chunk-L6LJEBXY.js.map → chunk-EWBUH2IU.js.map} +0 -0
- /package/dist/{chunk-7U6YGXWE.js.map → chunk-FEF432WU.js.map} +0 -0
- /package/dist/{chunk-GNRECXDY.js.map → chunk-FKYIYJF7.js.map} +0 -0
- /package/dist/{chunk-7JRBOEWC.js.map → chunk-JJV7O7YK.js.map} +0 -0
- /package/dist/{chunk-E7LKRV7R.js.map → chunk-KPNAXVET.js.map} +0 -0
- /package/dist/{chunk-B4CZHRRV.js.map → chunk-MBPYC6QF.js.map} +0 -0
- /package/dist/{chunk-RKGDYAOV.js.map → chunk-NY5ZY2WV.js.map} +0 -0
- /package/dist/{chunk-HW4BVIWX.js.map → chunk-OABGAL3N.js.map} +0 -0
- /package/dist/{chunk-W2KZCY7H.js.map → chunk-OYPKAYCH.js.map} +0 -0
- /package/dist/{chunk-NGSEAAUR.js.map → chunk-PA3KFAXH.js.map} +0 -0
- /package/dist/{chunk-U7BSIXY5.js.map → chunk-R4HBEILQ.js.map} +0 -0
- /package/dist/{chunk-IVBCCSDR.js.map → chunk-TCC56PYX.js.map} +0 -0
- /package/dist/{chunk-ATCWYDB2.js.map → chunk-YLFNY4OF.js.map} +0 -0
- /package/dist/{client-LOLBLWQH.js.map → client-7ZJZT5H7.js.map} +0 -0
- /package/dist/{compaction-PFXWL4H7.js.map → compaction-GSUWZYBK.js.map} +0 -0
- /package/dist/{config-XIHDFV7R.js.map → config-NFDEJ3NB.js.map} +0 -0
- /package/dist/{config-mutate-GLGD4OXG.js.map → config-mutate-JYW5G7T6.js.map} +0 -0
- /package/dist/{config-mutator-OC6ZQQCR.js.map → config-mutator-OMWL5XHO.js.map} +0 -0
- /package/dist/{context-planner-DJB6CKY6.js.map → context-planner-2XBAPQ3S.js.map} +0 -0
- /package/dist/{contributions-ZWZKNT7F.js.map → contributions-TMZ3DYY5.js.map} +0 -0
- /package/dist/{doctor-P7TUOQJL.js.map → doctor-FTUB5ITL.js.map} +0 -0
- /package/dist/{follow-up-tool-PS4ZST7N.js.map → follow-up-tool-FNO2IG72.js.map} +0 -0
- /package/dist/{heal-RGM7X2ZG.js.map → heal-KCM6JYUK.js.map} +0 -0
- /package/dist/{hub-5FDLTQA4.js.map → hub-MOAG5BEQ.js.map} +0 -0
- /package/dist/{memory-extract-GHLBXV4H.js.map → memory-extract-PFJDJNBH.js.map} +0 -0
- /package/dist/{promote-U4MVP653.js.map → promote-AAEZYPBP.js.map} +0 -0
- /package/dist/{providers-BDJXGHEY.js.map → providers-VVT2OBXA.js.map} +0 -0
- /package/dist/{query-CHK6IY4Z.js.map → query-2EWUIUIT.js.map} +0 -0
- /package/dist/{query-settings-NZT2BKX5.js.map → query-settings-7CB37D6D.js.map} +0 -0
- /package/dist/{registry-VAZ7KJAX.js.map → registry-EZMQ2OYY.js.map} +0 -0
- /package/dist/{request-planner-XOFWVB6L.js.map → request-planner-2AU3VK4P.js.map} +0 -0
- /package/dist/{review-candidates-IYXJRG5K.js.map → review-candidates-CIEGXF7K.js.map} +0 -0
- /package/dist/{routing-ZMRPUXLA.js.map → routing-XJ25QONX.js.map} +0 -0
- /package/dist/{schedule-tool-EU2ILYUI.js.map → schedule-tool-5T4CH4CM.js.map} +0 -0
- /package/dist/{scheduler-O35FPVFM.js.map → scheduler-UKJWO2TR.js.map} +0 -0
- /package/dist/{seat-C3D3GZCW.js.map → seat-JWRCBUKR.js.map} +0 -0
- /package/dist/{select-AA7JJN2D.js.map → select-KIDX6WWF.js.map} +0 -0
- /package/dist/{set-enabled-IDPKRK5C.js.map → set-enabled-F4D3VWKI.js.map} +0 -0
- /package/dist/{tool-35X6HKUQ.js.map → tool-YSS2C2UX.js.map} +0 -0
- /package/dist/{wiki-I7BSMBAC.js.map → wiki-PSUAAREB.js.map} +0 -0
- /package/dist/{wiki-enrich-G4GUITL4.js.map → wiki-enrich-TJIL4B3V.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as d}from"./chunk-OYPKAYCH.js";import{b as i,c as u,d as l,e as c}from"./chunk-EWBUH2IU.js";import f from"cronstrue";var p=Intl.DateTimeFormat().resolvedOptions().timeZone,m=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',g=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function w(e){return g.test(e)}function x(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function $(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function S(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||p,agent:e.agent,prompt:e.prompt,timeout:e.timeout??m,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){try{return f.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function T(e,r,t=new Date){try{return d(e,t,r)}catch{return null}}function A(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function h(e){return e?.approval?.action==="create"}async function D(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&h(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{p as a,E as b,w as c,x as d,$ as e,S as f,P as g,T as h,A as i,h as j,D as k,I as l,O as m};
|
|
2
|
+
//# sourceMappingURL=chunk-E4O32ZYZ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{db as b,eb as k,gb as x,ob as S}from"./chunk-O5H6BCUN.js";S();import{readFileSync as w,writeFileSync as v,existsSync as P}from"fs";import{resolve as d}from"path";function O(r){if(r)return d(r);let e=[d(process.cwd(),"agentx.json"),d(process.cwd(),".agentx/config.json")];for(let n of e)if(P(n))return n;return e[0]}function R(r){return JSON.parse(JSON.stringify(r))}async function C(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/reload`,{method:"POST",signal:AbortSignal.timeout(3e3)});return e.ok?{ok:!0}:{ok:!1,reason:`HTTP ${e.status}`}}catch(e){return{ok:!1,reason:e?.cause?.code||e?.message||"unreachable"}}}async function N(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:l,daemonUrl:c}=e,o=O(l);if(!P(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let g;try{g=w(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let p;try{p=JSON.parse(g)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=R(p);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=k(i),u=b.safeParse(a);if(!u.success){let f=u.error.issues.map($=>` ${$.path.join(".")||"<root>"}: ${$.message}`).join(`
|
|
2
2
|
`);return{success:!1,path:o,error:`Validation failed:
|
|
3
3
|
${f}`,after:i}}let m=x(u.data);if(m.length)return{success:!1,path:o,error:`Validation failed:
|
|
4
4
|
${m.map(f=>` ${f}`).join(`
|
|
5
5
|
`)}`,after:i}}if(t)return{success:!0,path:o,after:i,dryRun:!0};try{v(o,JSON.stringify(i,null,2)+`
|
|
6
6
|
`)}catch(a){return{success:!1,path:o,error:`Write failed: ${a.message}`,after:i}}let h=!1,y;if(s){let a=c||M(i),u=await C(a);u.ok?h=!0:y=u.reason}return{success:!0,path:o,after:i,reloaded:h,reloadSkipped:y}}function M(r){let e=r?.node?.bind;if(!e)return"http://127.0.0.1:18800";let[n,t]=e.split(":");return`http://${n==="0.0.0.0"||n==="::"?"127.0.0.1":n}:${t}`}function A(r,e,n){let t=e.split("."),s=r;for(let l=0;l<t.length-1;l++){let c=t[l];(s[c]===void 0||s[c]===null)&&(s[c]={}),s=s[c]}s[t[t.length-1]]=n}function F(r,e){let n=e.split("."),t=r;for(let s of n){if(t==null)return;t=t[s]}return t}function U(r,e){let n=e.split("."),t=r;for(let s=0;s<n.length-1;s++){if(t==null)return;t=t[n[s]]}t!=null&&delete t[n[n.length-1]]}export{O as a,N as b,A as c,F as d,U as e};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-EWBUH2IU.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-
|
|
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-6QLRRSKU.js";import{nb as tt,ob as nt}from"./chunk-O5H6BCUN.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-
|
|
114
|
+
//# sourceMappingURL=chunk-FEF432WU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-6HNCLOHS.js";var d=["main contact","primary contact","point of contact","billing contact","technical contact","decision maker"],f=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,w=/\b(role|title|position|job)\s*\**\s*[::]\s*\**\s*([^\n;|]+)/gi;function L(t,c,e=[]){let l=[c,...e].join(`
|
|
2
2
|
`),a=l.toLowerCase(),i=h(t,l);for(let s of p(t.match(f)??[]))a.includes(s.toLowerCase())||i.push(`email ${s}`);let m=t.toLowerCase();for(let s of d)m.includes(s)&&!a.includes(s)&&i.push(`marker "${s}"`);for(let s of t.matchAll(w)){let n=s[2].replace(/\*+/g,"").trim();n&&!a.includes(n.toLowerCase())&&i.push(`${s[1].toLowerCase()} "${n}"`)}return p(i)}function p(t){return[...new Set(t)]}var $=.9,g=/^\s*(?:wait\b|here(?:'s| is) the (?:updated|modified|patched|revised)|i (?:must|need to|will|should) (?:output|return|write)|(?:okay|ok|sure)[,.!]\s|let me\b|as requested\b)/im;function k(t,c){let e=[],l=t.split(`
|
|
3
3
|
`).filter(o=>o.trim()).length,a=c.split(`
|
|
4
4
|
`).filter(o=>o.trim()).length;l>=5&&a<Math.floor(l*$)&&e.push(`the article shrinks from ${l} to ${a} lines`);let i=c.match(g);i&&!t.match(g)&&e.push(`it contains the model's own commentary ("${i[0].trim().slice(0,40)}")`);let m=o=>{let r=new Map;for(let u of o.split(`
|
|
5
5
|
`))/^#{1,6} /.test(u)&&r.set(u.trim(),(r.get(u.trim())??0)+1);return r},s=m(t);for(let[o,r]of m(c))r>1&&r>(s.get(o)??0)&&e.push(`the heading "${o}" appears ${r} times`);let n=L(t,c);return n.length&&e.push(`it drops ${n.length} fact(s): ${n.slice(0,6).join(", ")}${n.length>6?", \u2026":""}`),e}export{L as a,k as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-FKYIYJF7.js.map
|