agentix-cli 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/{App-IEQXWJ7B.js → App-2LAWZNMG.js} +2 -2
  2. package/dist/{ChatApp-NWOSAP5U.js → ChatApp-2KRDHMTV.js} +2 -2
  3. package/dist/{agent-SPE7Q7MD.js → agent-ZRRIMLTX.js} +2 -2
  4. package/dist/{board-dashboard-K4DM32SO.js → board-dashboard-LL3YVODL.js} +192 -171
  5. package/dist/board-dashboard-LL3YVODL.js.map +1 -0
  6. package/dist/{chunk-MGNJWBVP.js → chunk-2DBGOCCW.js} +2 -2
  7. package/dist/{chunk-MGNJWBVP.js.map → chunk-2DBGOCCW.js.map} +1 -1
  8. package/dist/chunk-2DMVKLLE.js +13 -0
  9. package/dist/chunk-2DMVKLLE.js.map +1 -0
  10. package/dist/chunk-2GIDVZ4H.js +3 -0
  11. package/dist/{chunk-EVWEG3VD.js.map → chunk-2GIDVZ4H.js.map} +1 -1
  12. package/dist/{chunk-UCQ2N3KO.js → chunk-2TJ5L7CB.js} +2 -2
  13. package/dist/{chunk-FKBGJYWQ.js → chunk-3RHPZXCR.js} +2 -2
  14. package/dist/{chunk-DI7FMCDK.js → chunk-4CR463C6.js} +2 -2
  15. package/dist/{chunk-IVQO43U2.js → chunk-5FEQI22L.js} +2 -2
  16. package/dist/{chunk-45BLFNDG.js → chunk-6VQKHMEQ.js} +47 -47
  17. package/dist/chunk-6VQKHMEQ.js.map +1 -0
  18. package/dist/{chunk-52ZPELD2.js → chunk-7CVJ4JOE.js} +2 -2
  19. package/dist/{chunk-4KXBUORV.js → chunk-A4YR3PQY.js} +2 -2
  20. package/dist/{chunk-Q7CZIRBB.js → chunk-B2XTYYXV.js} +2 -2
  21. package/dist/{chunk-JKYMXLYL.js → chunk-G5MFPNGJ.js} +2 -2
  22. package/dist/{chunk-EL3J74N2.js → chunk-GWQIMAJ7.js} +2 -2
  23. package/dist/{chunk-42DCRKUD.js → chunk-H57XXGMF.js} +96 -94
  24. package/dist/chunk-H57XXGMF.js.map +1 -0
  25. package/dist/{chunk-V4HURNMX.js → chunk-JGJE5Y2J.js} +2 -2
  26. package/dist/{chunk-SC5DIKBB.js → chunk-JWKIFAXA.js} +2 -2
  27. package/dist/{chunk-UU4WOZNR.js → chunk-K6E7WJ7O.js} +2 -2
  28. package/dist/{chunk-AUNDQPDR.js → chunk-MFVI5FOM.js} +2 -2
  29. package/dist/{chunk-M4AMWP3H.js → chunk-QLTM3F7M.js} +17 -8
  30. package/dist/{chunk-M4AMWP3H.js.map → chunk-QLTM3F7M.js.map} +1 -1
  31. package/dist/{chunk-IWMW5432.js → chunk-V7FYSZSV.js} +1 -1
  32. package/dist/{chunk-IWMW5432.js.map → chunk-V7FYSZSV.js.map} +1 -1
  33. package/dist/chunk-VMDA2SX2.js +43 -0
  34. package/dist/chunk-VMDA2SX2.js.map +1 -0
  35. package/dist/{chunk-GK7XAM3D.js → chunk-W3YGESNK.js} +2 -2
  36. package/dist/{chunk-GUBMLV34.js → chunk-WFIBOAXN.js} +8 -8
  37. package/dist/chunk-WFIBOAXN.js.map +1 -0
  38. package/dist/cli.js +1 -1
  39. package/dist/client-IP643GRO.js +2 -0
  40. package/dist/config-IVDP46ZG.js +2 -0
  41. package/dist/config-mutator-UCGAV3SP.js +2 -0
  42. package/dist/doctor-MMT4SREV.js +2 -0
  43. package/dist/index.d.ts +35 -0
  44. package/dist/index.js +1 -1
  45. package/dist/processes-I3XAPHG7.js +2 -0
  46. package/dist/program-7ULXLTD6.js +2 -0
  47. package/dist/query-RHVR6QUZ.js +2 -0
  48. package/dist/registry-OB6S66XX.js +2 -0
  49. package/dist/request-planner-F5NVL2G7.js +2 -0
  50. package/dist/request-planner-F5NVL2G7.js.map +1 -0
  51. package/dist/{review-candidates-O2PS7L3B.js → review-candidates-IRPKFWL2.js} +2 -2
  52. package/dist/{rotation-memo-7T75BLEX.js → rotation-memo-QEO3COFH.js} +3 -3
  53. package/dist/rotation-memo-QEO3COFH.js.map +1 -0
  54. package/dist/{routing-5K7PGHPL.js → routing-OSPRKRAY.js} +2 -2
  55. package/dist/scheduler-JL6K5HHI.js +2 -0
  56. package/dist/{seat-FZRNRAHQ.js → seat-2MHKVMW2.js} +2 -2
  57. package/dist/{select-SOJYFAMI.js → select-7LCHJVPK.js} +2 -2
  58. package/dist/{surface-usage-NS74AXSE.js → surface-usage-UREILT2E.js} +2 -2
  59. package/dist/web/activity-graph.global.js +901 -368
  60. package/dist/web/activity-graph.global.js.map +1 -1
  61. package/dist/wiki-MY32MON3.js +2 -0
  62. package/package.json +2 -1
  63. package/dist/board-dashboard-K4DM32SO.js.map +0 -1
  64. package/dist/chunk-42DCRKUD.js.map +0 -1
  65. package/dist/chunk-45BLFNDG.js.map +0 -1
  66. package/dist/chunk-4BR7D2OU.js +0 -36
  67. package/dist/chunk-4BR7D2OU.js.map +0 -1
  68. package/dist/chunk-EVWEG3VD.js +0 -3
  69. package/dist/chunk-GMNKJXTR.js +0 -13
  70. package/dist/chunk-GMNKJXTR.js.map +0 -1
  71. package/dist/chunk-GUBMLV34.js.map +0 -1
  72. package/dist/client-5Z3URGPY.js +0 -2
  73. package/dist/config-ORSGLVRW.js +0 -2
  74. package/dist/config-mutator-JB3S2E7H.js +0 -2
  75. package/dist/doctor-FS2BX6H4.js +0 -2
  76. package/dist/processes-WU23U2OJ.js +0 -2
  77. package/dist/program-DWZAI4GY.js +0 -2
  78. package/dist/query-3HXGBKGM.js +0 -2
  79. package/dist/registry-EJRWAJYG.js +0 -2
  80. package/dist/request-planner-BCOXUAPA.js +0 -2
  81. package/dist/request-planner-BCOXUAPA.js.map +0 -1
  82. package/dist/rotation-memo-7T75BLEX.js.map +0 -1
  83. package/dist/scheduler-DSAOMV4O.js +0 -2
  84. package/dist/wiki-34XVI32N.js +0 -2
  85. /package/dist/{App-IEQXWJ7B.js.map → App-2LAWZNMG.js.map} +0 -0
  86. /package/dist/{ChatApp-NWOSAP5U.js.map → ChatApp-2KRDHMTV.js.map} +0 -0
  87. /package/dist/{agent-SPE7Q7MD.js.map → agent-ZRRIMLTX.js.map} +0 -0
  88. /package/dist/{chunk-UCQ2N3KO.js.map → chunk-2TJ5L7CB.js.map} +0 -0
  89. /package/dist/{chunk-FKBGJYWQ.js.map → chunk-3RHPZXCR.js.map} +0 -0
  90. /package/dist/{chunk-DI7FMCDK.js.map → chunk-4CR463C6.js.map} +0 -0
  91. /package/dist/{chunk-IVQO43U2.js.map → chunk-5FEQI22L.js.map} +0 -0
  92. /package/dist/{chunk-52ZPELD2.js.map → chunk-7CVJ4JOE.js.map} +0 -0
  93. /package/dist/{chunk-4KXBUORV.js.map → chunk-A4YR3PQY.js.map} +0 -0
  94. /package/dist/{chunk-Q7CZIRBB.js.map → chunk-B2XTYYXV.js.map} +0 -0
  95. /package/dist/{chunk-JKYMXLYL.js.map → chunk-G5MFPNGJ.js.map} +0 -0
  96. /package/dist/{chunk-EL3J74N2.js.map → chunk-GWQIMAJ7.js.map} +0 -0
  97. /package/dist/{chunk-V4HURNMX.js.map → chunk-JGJE5Y2J.js.map} +0 -0
  98. /package/dist/{chunk-SC5DIKBB.js.map → chunk-JWKIFAXA.js.map} +0 -0
  99. /package/dist/{chunk-UU4WOZNR.js.map → chunk-K6E7WJ7O.js.map} +0 -0
  100. /package/dist/{chunk-AUNDQPDR.js.map → chunk-MFVI5FOM.js.map} +0 -0
  101. /package/dist/{chunk-GK7XAM3D.js.map → chunk-W3YGESNK.js.map} +0 -0
  102. /package/dist/{client-5Z3URGPY.js.map → client-IP643GRO.js.map} +0 -0
  103. /package/dist/{config-ORSGLVRW.js.map → config-IVDP46ZG.js.map} +0 -0
  104. /package/dist/{config-mutator-JB3S2E7H.js.map → config-mutator-UCGAV3SP.js.map} +0 -0
  105. /package/dist/{doctor-FS2BX6H4.js.map → doctor-MMT4SREV.js.map} +0 -0
  106. /package/dist/{processes-WU23U2OJ.js.map → processes-I3XAPHG7.js.map} +0 -0
  107. /package/dist/{program-DWZAI4GY.js.map → program-7ULXLTD6.js.map} +0 -0
  108. /package/dist/{query-3HXGBKGM.js.map → query-RHVR6QUZ.js.map} +0 -0
  109. /package/dist/{registry-EJRWAJYG.js.map → registry-OB6S66XX.js.map} +0 -0
  110. /package/dist/{review-candidates-O2PS7L3B.js.map → review-candidates-IRPKFWL2.js.map} +0 -0
  111. /package/dist/{routing-5K7PGHPL.js.map → routing-OSPRKRAY.js.map} +0 -0
  112. /package/dist/{scheduler-DSAOMV4O.js.map → scheduler-JL6K5HHI.js.map} +0 -0
  113. /package/dist/{seat-FZRNRAHQ.js.map → seat-2MHKVMW2.js.map} +0 -0
  114. /package/dist/{select-SOJYFAMI.js.map → select-7LCHJVPK.js.map} +0 -0
  115. /package/dist/{surface-usage-NS74AXSE.js.map → surface-usage-UREILT2E.js.map} +0 -0
  116. /package/dist/{wiki-34XVI32N.js.map → wiki-MY32MON3.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as ne,b as He}from"./chunk-ZTEU5JVQ.js";import{a as Te,b as ft}from"./chunk-AJONZWLT.js";import{a as et,b as tt,c as nt,d as S,e as A,f as N}from"./chunk-F4HZTZHW.js";import{o as we,p as Ke}from"./chunk-LCIREYTD.js";import{i as We,j as Ze}from"./chunk-GMNKJXTR.js";import{a as rt,b as ot,c as st,d as it,e as at,f as ct,g as ut,h as lt,i as dt,j as pt,k as mt,l as bt}from"./chunk-BH3GTCZ6.js";import{b as E,c as Ye,d as he}from"./chunk-FIOB3MEX.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 gt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import yt from"better-sqlite3";import{createHash as ht}from"crypto";import{mkdirSync as wt}from"fs";import{dirname as Tt,resolve as Et}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 kt(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 xt(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&&Rt(e),t<2&&At(e),t<3&&St(e)}function St(e){e.exec(`
1
+ import{a as ne,b as He}from"./chunk-ZTEU5JVQ.js";import{a as Te,b as ft}from"./chunk-AJONZWLT.js";import{a as et,b as tt,c as nt,d as S,e as A,f as N}from"./chunk-F4HZTZHW.js";import{o as we,p as Ke}from"./chunk-LCIREYTD.js";import{i as We,j as Ze}from"./chunk-2DMVKLLE.js";import{a as rt,b as ot,c as st,d as it,e as at,f as ct,g as ut,h as lt,i as dt,j as pt,k as mt,l as bt}from"./chunk-BH3GTCZ6.js";import{b as E,c as Ye,d as he}from"./chunk-FIOB3MEX.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 gt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import yt from"better-sqlite3";import{createHash as ht}from"crypto";import{mkdirSync as wt}from"fs";import{dirname as Tt,resolve as Et}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 kt(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 xt(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&&Rt(e),t<2&&At(e),t<3&&St(e)}function St(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 At(e){e.exec(`
@@ -111,4 +111,4 @@ import{a as ne,b as He}from"./chunk-ZTEU5JVQ.js";import{a as Te,b as ft}from"./c
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:g,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function $t(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:B,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:B}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===B),u=a&&a.type==="tool_use"?a.input:null;return{answers:Pe(u),usage:{inputTokens:i.usage.input_tokens,outputTokens:i.usage.output_tokens}}}async function Vt(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:Pe(Te(a.content??"")),usage:{inputTokens:0,outputTokens:a.tokensUsed??0}}}function Pe(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 zt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Jt(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,Pt,qt,Be,Xt,be=E(()=>{"use strict";Ke();Ue();ft();j();Y();N();z();Bt="claude-code",Pt="claude-haiku-4-5-20251001",qt=24e3,Be=2e3,Xt=3e4});import{readFileSync as Gt}from"fs";import{homedir as Yt}from"os";import{join as Kt}from"path";function v(e={}){let t=(e.baseUrl??Ht).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??Zt,s=e.maxChoiceOptions??en,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),on(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:y,dispose:d}=sn(a.abortSignal,a.timeoutMs??e.timeoutMs??Wt);try{let b={"Content-Type":"application/json"},g=rn(e.apiKeyEnv,e.apiKeyFile);g&&(b.Authorization=`Bearer ${g}`);let w=await p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:nn(a.questions)}),signal:y});if(!w.ok){let k=await w.text().catch(()=>"");throw new Error(`${n} ${w.status}: ${k.slice(0,300)}`)}let f=await w.json(),m=F(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 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 nn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:tn[n.type]};return t}function rn(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Kt(Yt(),t.slice(2)):t;if(!Z.has(n))try{let o=Gt(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function on(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 sn(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 Ht,Wt,Zt,en,tn,Z,fe=E(()=>{"use strict";j();N();z();Y();Ht="http://127.0.0.1:8000/v1",Wt=3e4,Zt=6e3,en=50;tn={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var qe={};Ye(qe,{DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>B,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>gt,agreement:()=>rt,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>lt,askSeat:()=>pn,band:()=>Ie,bootstrapInterval:()=>pt,brier:()=>at,buildDesign:()=>Ne,calibrationReport:()=>mt,choice:()=>tt,compareCalibrators:()=>Lt,confidenceFor:()=>re,configureDecisions:()=>cn,coverageCurve:()=>ut,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>v,decisionsRuntime:()=>ln,describeIssues:()=>U,ece:()=>st,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>ve,fitRecalibrator:()=>P,fitTemperature:()=>dt,getDecisionBackend:()=>D,getSeatMode:()=>Ve,labelsOf:()=>S,listDecisionBackends:()=>Ee,logLoss:()=>ct,logit:()=>le,mce:()=>it,measureConsistency:()=>Qt,normalizeDistribution:()=>xe,normalizedNegEntropy:()=>oe,noul:()=>et,pMax:()=>Se,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>F,recordSeatOutcome:()=>dn,registerBuiltinDecisionBackends:()=>an,registerDecisionBackend:()=>R,reliabilityBins:()=>ot,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>un,score:()=>nt,seatEnvVar:()=>$e,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function an(e={},t={},r={},n={}){R("mock",()=>H()),R("local",()=>W(e)),R("simple-jev",()=>v(t)),R("jev",()=>v({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",()=>v({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 Xe=E(()=>{"use strict";ke();N();j();z();C();Y();V();bt();Me();je();ze();pe();be();fe();C();pe();be();fe()});function cn(e){T={...ye,...T,...e},ee=!0}function un(){T={...ye,seats:{}},ee=!1}function mn(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(Ze(),he(We)),t=e()?.decisions;if(!t?.enabled)return;let{registerBuiltinDecisionBackends:r}=(Xe(),he(qe)),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 ln(){return T}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return bn.includes(t)?t:null}function $e(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function Ve(e,t=process.env){mn();let r=ge(t[$e(e)]);return r||(T.enabled?ge(T.seats[e]?.mode)??"off":"off")}function dn(e,t,r=!1){if(!(!e||!T.store))try{T.store.recordOutcome(e,t,r)}catch{}}async function pn(e,t,r,n={}){let o=Ve(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=fn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return gn(e,o,t,r,i,n,s,a,u),yn(e,i,u),null}}function fn(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:Ge(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function gn(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:Ge(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function Ge(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function yn(e,t,r){let n=Date.now();n-Je<6e4||(Je=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var ye,T,ee,bn,Je,ze=E(()=>{C();V();ye={enabled:!1,defaultBackend:"local",seats:{},store:null},T={...ye},ee=!1;bn=["off","shadow","active"];Je=0});export{D as a,Ee as b,C as c,I as d,V as e,Lt as f,Me as g,Qt as h,je as i,me as j,Un as k,Ue as l,an as m,Xe as n,cn as o,un as p,ln as q,ge as r,$e as s,Ve as t,dn as u,pn as v,ze as w};
114
- //# sourceMappingURL=chunk-MGNJWBVP.js.map
114
+ //# sourceMappingURL=chunk-2DBGOCCW.js.map