agentix-cli 0.104.0 → 0.104.2

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 (99) hide show
  1. package/dist/{App-A7WZMOGA.js → App-2SSUXHUJ.js} +2 -2
  2. package/dist/{ChatApp-EWNT36ZE.js → ChatApp-RLOFB5CO.js} +2 -2
  3. package/dist/{agent-NPE76XHC.js → agent-PP6UH3O2.js} +2 -2
  4. package/dist/{board-dashboard-IRMCGCU5.js → board-dashboard-O3AYVTTF.js} +404 -215
  5. package/dist/board-dashboard-O3AYVTTF.js.map +1 -0
  6. package/dist/{chunk-CUS7WGZT.js → chunk-2XLOIA52.js} +2 -2
  7. package/dist/{chunk-IA3BC7M3.js → chunk-3MMSS5JF.js} +2 -2
  8. package/dist/{chunk-IA3BC7M3.js.map → chunk-3MMSS5JF.js.map} +1 -1
  9. package/dist/{chunk-MVLNVMWI.js → chunk-4FSU5XTD.js} +2 -2
  10. package/dist/{chunk-BUAVQUHR.js → chunk-AK4HS2PQ.js} +2 -2
  11. package/dist/{chunk-N4IWNCH3.js → chunk-BBKFCHJV.js} +2 -2
  12. package/dist/{chunk-2X5RPHPN.js → chunk-BLTE6OHO.js} +85 -85
  13. package/dist/chunk-BLTE6OHO.js.map +1 -0
  14. package/dist/{chunk-HE4PDESB.js → chunk-BTHH5ENX.js} +2 -2
  15. package/dist/{chunk-OLUAEBHJ.js → chunk-D6EX6VA5.js} +2 -2
  16. package/dist/{chunk-DEMIKEFB.js → chunk-DXOTH6MF.js} +30 -30
  17. package/dist/chunk-DXOTH6MF.js.map +1 -0
  18. package/dist/{chunk-76KJXOEV.js → chunk-E4RQHTNB.js} +2 -2
  19. package/dist/{chunk-MZQQVT3G.js → chunk-EB3B2FRY.js} +2 -2
  20. package/dist/{chunk-FZ7VHFL5.js → chunk-IM7SSJ67.js} +2 -2
  21. package/dist/{chunk-XHUOWYNY.js → chunk-J5LOMJ2Y.js} +2 -2
  22. package/dist/{chunk-ZBKKOUNJ.js → chunk-KPAGMXSL.js} +2 -2
  23. package/dist/{chunk-IOPAWHKW.js → chunk-KU3XT5S2.js} +2 -2
  24. package/dist/{chunk-NWNVHL57.js → chunk-N7YQ4IAR.js} +2 -2
  25. package/dist/{chunk-WTFNEPJ7.js → chunk-OREGWHKS.js} +2 -2
  26. package/dist/{chunk-32BPHJ4I.js → chunk-QFIIZIYX.js} +2 -2
  27. package/dist/{chunk-BEFKOHRC.js → chunk-UGM56ULD.js} +2 -2
  28. package/dist/{chunk-25RQQ55U.js → chunk-UGNXKP6Q.js} +2 -2
  29. package/dist/{chunk-Q57GZPDA.js → chunk-ZE7P7L2L.js} +2 -2
  30. package/dist/cli.js +1 -1
  31. package/dist/{client-ZX7AY7H3.js → client-LK2BLOBZ.js} +2 -2
  32. package/dist/{config-BXOS2PLC.js → config-OQKZUWUT.js} +2 -2
  33. package/dist/config-mutator-S3FP3A7K.js +2 -0
  34. package/dist/{doctor-P3QQP33C.js → doctor-ON2EECFT.js} +2 -2
  35. package/dist/index.d.ts +12 -1
  36. package/dist/index.js +1 -1
  37. package/dist/{program-X5K2P7EL.js → program-D7QOPCTE.js} +14 -14
  38. package/dist/{promote-FHX4Q62Z.js → promote-KKLC2ENK.js} +2 -2
  39. package/dist/{query-WBK3YEPV.js → query-JEOWXBWZ.js} +2 -2
  40. package/dist/{registry-T5HSN66G.js → registry-6DGUQ5YT.js} +2 -2
  41. package/dist/{request-planner-3LA5RAKG.js → request-planner-SXR7HCE7.js} +2 -2
  42. package/dist/{review-candidates-QV66TOCL.js → review-candidates-OBAXZ6IM.js} +2 -2
  43. package/dist/{routing-HF4XVD4Y.js → routing-GW7LSHRJ.js} +2 -2
  44. package/dist/schedule-tool-TX7EPMQZ.js +2 -0
  45. package/dist/scheduler-4SD7YBW3.js +2 -0
  46. package/dist/{seat-NQTZUIKH.js → seat-4KA3YZEN.js} +2 -2
  47. package/dist/{select-3GVC5RDA.js → select-WLYRCSSM.js} +2 -2
  48. package/dist/{set-enabled-SXCE2MZX.js → set-enabled-DHSDYIIA.js} +2 -2
  49. package/dist/{tool-23GOQNUW.js → tool-OBS4P2BP.js} +2 -2
  50. package/dist/{tool-E6JBENAN.js → tool-YKBDZ7K7.js} +2 -2
  51. package/dist/wiki-237HZZNR.js +2 -0
  52. package/package.json +1 -1
  53. package/dist/board-dashboard-IRMCGCU5.js.map +0 -1
  54. package/dist/chunk-2X5RPHPN.js.map +0 -1
  55. package/dist/chunk-DEMIKEFB.js.map +0 -1
  56. package/dist/config-mutator-KRAUD3CA.js +0 -2
  57. package/dist/schedule-tool-V66FX5XL.js +0 -2
  58. package/dist/scheduler-XVMWASQR.js +0 -2
  59. package/dist/wiki-VM2RTHVF.js +0 -2
  60. /package/dist/{App-A7WZMOGA.js.map → App-2SSUXHUJ.js.map} +0 -0
  61. /package/dist/{ChatApp-EWNT36ZE.js.map → ChatApp-RLOFB5CO.js.map} +0 -0
  62. /package/dist/{agent-NPE76XHC.js.map → agent-PP6UH3O2.js.map} +0 -0
  63. /package/dist/{chunk-CUS7WGZT.js.map → chunk-2XLOIA52.js.map} +0 -0
  64. /package/dist/{chunk-MVLNVMWI.js.map → chunk-4FSU5XTD.js.map} +0 -0
  65. /package/dist/{chunk-BUAVQUHR.js.map → chunk-AK4HS2PQ.js.map} +0 -0
  66. /package/dist/{chunk-N4IWNCH3.js.map → chunk-BBKFCHJV.js.map} +0 -0
  67. /package/dist/{chunk-HE4PDESB.js.map → chunk-BTHH5ENX.js.map} +0 -0
  68. /package/dist/{chunk-OLUAEBHJ.js.map → chunk-D6EX6VA5.js.map} +0 -0
  69. /package/dist/{chunk-76KJXOEV.js.map → chunk-E4RQHTNB.js.map} +0 -0
  70. /package/dist/{chunk-MZQQVT3G.js.map → chunk-EB3B2FRY.js.map} +0 -0
  71. /package/dist/{chunk-FZ7VHFL5.js.map → chunk-IM7SSJ67.js.map} +0 -0
  72. /package/dist/{chunk-XHUOWYNY.js.map → chunk-J5LOMJ2Y.js.map} +0 -0
  73. /package/dist/{chunk-ZBKKOUNJ.js.map → chunk-KPAGMXSL.js.map} +0 -0
  74. /package/dist/{chunk-IOPAWHKW.js.map → chunk-KU3XT5S2.js.map} +0 -0
  75. /package/dist/{chunk-NWNVHL57.js.map → chunk-N7YQ4IAR.js.map} +0 -0
  76. /package/dist/{chunk-WTFNEPJ7.js.map → chunk-OREGWHKS.js.map} +0 -0
  77. /package/dist/{chunk-32BPHJ4I.js.map → chunk-QFIIZIYX.js.map} +0 -0
  78. /package/dist/{chunk-BEFKOHRC.js.map → chunk-UGM56ULD.js.map} +0 -0
  79. /package/dist/{chunk-25RQQ55U.js.map → chunk-UGNXKP6Q.js.map} +0 -0
  80. /package/dist/{chunk-Q57GZPDA.js.map → chunk-ZE7P7L2L.js.map} +0 -0
  81. /package/dist/{client-ZX7AY7H3.js.map → client-LK2BLOBZ.js.map} +0 -0
  82. /package/dist/{config-BXOS2PLC.js.map → config-OQKZUWUT.js.map} +0 -0
  83. /package/dist/{config-mutator-KRAUD3CA.js.map → config-mutator-S3FP3A7K.js.map} +0 -0
  84. /package/dist/{doctor-P3QQP33C.js.map → doctor-ON2EECFT.js.map} +0 -0
  85. /package/dist/{program-X5K2P7EL.js.map → program-D7QOPCTE.js.map} +0 -0
  86. /package/dist/{promote-FHX4Q62Z.js.map → promote-KKLC2ENK.js.map} +0 -0
  87. /package/dist/{query-WBK3YEPV.js.map → query-JEOWXBWZ.js.map} +0 -0
  88. /package/dist/{registry-T5HSN66G.js.map → registry-6DGUQ5YT.js.map} +0 -0
  89. /package/dist/{request-planner-3LA5RAKG.js.map → request-planner-SXR7HCE7.js.map} +0 -0
  90. /package/dist/{review-candidates-QV66TOCL.js.map → review-candidates-OBAXZ6IM.js.map} +0 -0
  91. /package/dist/{routing-HF4XVD4Y.js.map → routing-GW7LSHRJ.js.map} +0 -0
  92. /package/dist/{schedule-tool-V66FX5XL.js.map → schedule-tool-TX7EPMQZ.js.map} +0 -0
  93. /package/dist/{scheduler-XVMWASQR.js.map → scheduler-4SD7YBW3.js.map} +0 -0
  94. /package/dist/{seat-NQTZUIKH.js.map → seat-4KA3YZEN.js.map} +0 -0
  95. /package/dist/{select-3GVC5RDA.js.map → select-WLYRCSSM.js.map} +0 -0
  96. /package/dist/{set-enabled-SXCE2MZX.js.map → set-enabled-DHSDYIIA.js.map} +0 -0
  97. /package/dist/{tool-23GOQNUW.js.map → tool-OBS4P2BP.js.map} +0 -0
  98. /package/dist/{tool-E6JBENAN.js.map → tool-YKBDZ7K7.js.map} +0 -0
  99. /package/dist/{wiki-VM2RTHVF.js.map → wiki-237HZZNR.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as tt,b as nt,c as rt,d as S,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as Te,b as gt}from"./chunk-FX3D7YON.js";import{a as ne,b as We}from"./chunk-FCPTN6NF.js";import{o as we,p as He}from"./chunk-5MUJZODV.js";import{ga as Ze,ha as et}from"./chunk-IA3BC7M3.js";import{a as ot,b as st,c as it,d as at,e as ct,f as ut,g as lt,h as dt,i as pt,j as mt,k as bt,l as ft}from"./chunk-RGDKHYY2.js";import{a as E,b as Ke,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 yt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import ht from"better-sqlite3";import{createHash as wt}from"crypto";import{mkdirSync as Tt}from"fs";import{dirname as Et,resolve as kt}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 xt(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 St(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&&_t(e),t<2&&Rt(e),t<3&&At(e)}function At(e){e.exec(`
1
+ import{a as tt,b as nt,c as rt,d as S,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as Te,b as gt}from"./chunk-FX3D7YON.js";import{a as ne,b as We}from"./chunk-FCPTN6NF.js";import{o as we,p as He}from"./chunk-5MUJZODV.js";import{ga as Ze,ha as et}from"./chunk-3MMSS5JF.js";import{a as ot,b as st,c as it,d as at,e as ct,f as ut,g as lt,h as dt,i as pt,j as mt,k as bt,l as ft}from"./chunk-RGDKHYY2.js";import{a as E,b as Ke,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 yt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import ht from"better-sqlite3";import{createHash as wt}from"crypto";import{mkdirSync as Tt}from"fs";import{dirname as Et,resolve as kt}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 xt(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 St(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&&_t(e),t<2&&Rt(e),t<3&&At(e)}function At(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 Rt(e){e.exec(`
@@ -111,4 +111,4 @@ import{a as tt,b as nt,c as rt,d as S,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): ${h}`);let M={},L=!1;for(let[k,q]of Object.entries(s.questions)){let x=_(q,m[k],{normalize:e.normalizeProbabilities??!0});M[k]=x.answer,x.repaired&&(L=!0)}return{model:a,answers:M,usage:y,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function Vt(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:U,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:U}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===U),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 zt(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 Jt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Gt(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 Bt,qt,Xt,Ue,$t,be=E(()=>{"use strict";He();Fe();gt();j();Y();v();z();Bt="claude-code",qt="claude-haiku-4-5-20251001",Xt=24e3,Ue=2e3,$t=3e4});import{readFileSync as Yt}from"fs";import{homedir as Kt}from"os";import{join as Ht}from"path";function N(e={}){let t=(e.baseUrl??Wt).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??en,s=e.maxChoiceOptions??tn,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),sn(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}=an(a.abortSignal,a.timeoutMs??e.timeoutMs??Zt);try{let b={"Content-Type":"application/json"},y=on(e.apiKeyEnv,e.apiKeyFile);y&&(b.Authorization=`Bearer ${y}`);let w=await qe(p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:rn(a.questions)}),signal:g}),g);if(!w.ok){let k=await w.text().catch(()=>"");throw new Error(`${n} ${w.status}: ${k.slice(0,300)}`)}let f=await qe(w.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
  ${F(m.error)}`);let h=m.data,M={},L=!1;for(let[k,q]of Object.entries(a.questions)){let x=_(q,h[k]);M[k]=x.answer,x.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 rn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:nn[n.type]};return t}function on(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Ht(Kt(),t.slice(2)):t;if(!Z.has(n))try{let o=Yt(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function sn(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 an(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 Wt,Zt,en,tn,nn,Z,fe=E(()=>{"use strict";j();v();z();Y();Wt="http://127.0.0.1:8000/v1",Zt=3e4,en=6e3,tn=50;nn={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var Xe={};Ke(Xe,{DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>U,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>yt,agreement:()=>ot,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>dt,askSeat:()=>mn,band:()=>Ie,bootstrapInterval:()=>mt,brier:()=>ct,buildDesign:()=>ve,calibrationReport:()=>bt,choice:()=>nt,compareCalibrators:()=>Dt,confidenceFor:()=>re,configureDecisions:()=>un,coverageCurve:()=>lt,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>N,decisionsRuntime:()=>dn,describeIssues:()=>F,ece:()=>it,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>Ne,fitRecalibrator:()=>B,fitTemperature:()=>pt,getDecisionBackend:()=>D,getSeatMode:()=>ze,labelsOf:()=>S,listDecisionBackends:()=>Ee,logLoss:()=>ut,logit:()=>le,mce:()=>at,measureConsistency:()=>jt,normalizeDistribution:()=>xe,normalizedNegEntropy:()=>oe,noul:()=>tt,pMax:()=>Se,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>P,recordSeatOutcome:()=>pn,registerBuiltinDecisionBackends:()=>cn,registerDecisionBackend:()=>R,reliabilityBins:()=>st,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>ln,score:()=>rt,seatEnvVar:()=>Ve,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function cn(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();ft();Me();je();Je();pe();be();fe();C();pe();be();fe()});function un(e){T={...ye,...T,...e},ee=!0}function ln(){T={...ye,seats:{}},ee=!1}function bn(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(et(),he(Ze)),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{}T={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 dn(){return T}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return fn.includes(t)?t:null}function Ve(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function ze(e,t=process.env){bn();let r=ge(t[Ve(e)]);return r||(T.enabled?ge(T.seats[e]?.mode)??"off":"off")}function pn(e,t,r=!1){if(!(!e||!T.store))try{T.store.recordOutcome(e,t,r)}catch{}}async function mn(e,t,r,n={}){let o=ze(e);if(o==="off")return null;let s=T.seats[e]??{mode:o},i=n.backend??s.backend??T.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}),l=gn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return yn(e,o,t,r,i,n,s,a,u),hn(e,i,u),null}}function gn(e,t,r,n,o,s,i){if(!T.store)return null;try{return T.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:Ye(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function yn(e,t,r,n,o,s,i,a,u){if(T.store)try{T.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:Ye(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function Ye(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function hn(e,t,r){let n=Date.now();n-Ge<6e4||(Ge=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var ye,T,ee,fn,Ge,Je=E(()=>{C();V();ye={enabled:!1,defaultBackend:"local",seats:{},store:null},T={...ye},ee=!1;fn=["off","shadow","active"];Ge=0});export{D as a,Ee as b,C as c,I as d,V as e,Dt as f,Me as g,jt as h,je as i,me as j,Un as k,Fe as l,cn as m,$e as n,un as o,ln as p,dn as q,ge as r,Ve as s,ze as t,pn as u,mn as v,Je as w};
114
- //# sourceMappingURL=chunk-HE4PDESB.js.map
114
+ //# sourceMappingURL=chunk-BTHH5ENX.js.map
@@ -1,5 +1,5 @@
1
- import{ca as m,da as $,ha as x}from"./chunk-IA3BC7M3.js";x();import{readFileSync as S,writeFileSync as P,existsSync as b}from"fs";import{resolve as f}from"path";function w(r){if(r)return f(r);let e=[f(process.cwd(),"agentx.json"),f(process.cwd(),".agentx/config.json")];for(let n of e)if(b(n))return n;return e[0]}function v(r){return JSON.parse(JSON.stringify(r))}async function O(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 J(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:u,daemonUrl:c}=e,o=w(u);if(!b(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let d;try{d=S(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let g;try{g=JSON.parse(d)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=v(g);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=$(i),l=m.safeParse(a);if(!l.success){let k=l.error.issues.map(y=>` ${y.path.join(".")||"<root>"}: ${y.message}`).join(`
1
+ import{ca as m,da as $,ha as x}from"./chunk-3MMSS5JF.js";x();import{readFileSync as S,writeFileSync as P,existsSync as b}from"fs";import{resolve as f}from"path";function w(r){if(r)return f(r);let e=[f(process.cwd(),"agentx.json"),f(process.cwd(),".agentx/config.json")];for(let n of e)if(b(n))return n;return e[0]}function v(r){return JSON.parse(JSON.stringify(r))}async function O(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 J(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:u,daemonUrl:c}=e,o=w(u);if(!b(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let d;try{d=S(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let g;try{g=JSON.parse(d)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=v(g);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=$(i),l=m.safeParse(a);if(!l.success){let k=l.error.issues.map(y=>` ${y.path.join(".")||"<root>"}: ${y.message}`).join(`
2
2
  `);return{success:!1,path:o,error:`Validation failed:
3
3
  ${k}`,after:i}}}if(t)return{success:!0,path:o,after:i,dryRun:!0};try{P(o,JSON.stringify(i,null,2)+`
4
4
  `)}catch(a){return{success:!1,path:o,error:`Write failed: ${a.message}`,after:i}}let p=!1,h;if(s){let a=c||R(i),l=await O(a);l.ok?p=!0:h=l.reason}return{success:!0,path:o,after:i,reloaded:p,reloadSkipped:h}}function R(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 N(r,e,n){let t=e.split("."),s=r;for(let u=0;u<t.length-1;u++){let c=t[u];(s[c]===void 0||s[c]===null)&&(s[c]={}),s=s[c]}s[t[t.length-1]]=n}function j(r,e){let n=e.split("."),t=r;for(let s of n){if(t==null)return;t=t[s]}return t}function A(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{w as a,J as b,N as c,j as d,A as e};
5
- //# sourceMappingURL=chunk-OLUAEBHJ.js.map
5
+ //# sourceMappingURL=chunk-D6EX6VA5.js.map