agentix-cli 0.78.0 → 0.79.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.
- package/dist/{App-UNWLWLH5.js → App-NZQQXETO.js} +2 -2
- package/dist/{ChatApp-UBSOVFRK.js → ChatApp-CSVN3PRK.js} +2 -2
- package/dist/{agent-XWWWL5RV.js → agent-RTZDVG5B.js} +2 -2
- package/dist/{board-dashboard-ABEIELBC.js → board-dashboard-SI5GP3XR.js} +4 -4
- package/dist/{board-dashboard-ABEIELBC.js.map → board-dashboard-SI5GP3XR.js.map} +1 -1
- package/dist/{chunk-H4RCKWJA.js → chunk-2WRWBPDL.js} +2 -2
- package/dist/{chunk-SLQZ4AHG.js → chunk-2XSVV3M3.js} +2 -2
- package/dist/chunk-2YIWQ57T.js +22 -0
- package/dist/chunk-2YIWQ57T.js.map +1 -0
- package/dist/{chunk-U6XM4M5V.js → chunk-3AFZBXNX.js} +2 -2
- package/dist/{chunk-JVJYCR67.js → chunk-3OIFSKSR.js} +2 -2
- package/dist/{chunk-FWDWHZ6H.js → chunk-B5VRY4NI.js} +2 -2
- package/dist/{chunk-2XICJMS6.js → chunk-EOBFJGTV.js} +30 -30
- package/dist/chunk-EOBFJGTV.js.map +1 -0
- package/dist/{chunk-4STRKIUA.js → chunk-IWQURDYO.js} +2 -2
- package/dist/{chunk-WEUF5WRR.js → chunk-IXWPA6WM.js} +2 -2
- package/dist/chunk-KH4PKJGD.js +15 -0
- package/dist/chunk-KH4PKJGD.js.map +1 -0
- package/dist/{chunk-53J2D2ZJ.js → chunk-N2A3KIVY.js} +2 -2
- package/dist/{chunk-NWP44FEW.js → chunk-P5KHF46N.js} +2 -2
- package/dist/{chunk-GTZDTKDW.js → chunk-PF5ZXMEG.js} +2 -2
- package/dist/{chunk-TVORP6BW.js → chunk-QAKL2D7O.js} +2 -2
- package/dist/{chunk-GX4U2ILS.js → chunk-QIMIARFO.js} +2 -2
- package/dist/{chunk-4EJ65BMF.js → chunk-QJM2D22B.js} +194 -194
- package/dist/chunk-QJM2D22B.js.map +1 -0
- package/dist/{chunk-R7AS5M32.js → chunk-SYXAEWFN.js} +5 -5
- package/dist/{chunk-IMVW5ZSY.js → chunk-THZOPGSP.js} +2 -2
- package/dist/{chunk-KEPK7ZZ2.js → chunk-TQT4XDNN.js} +2 -2
- package/dist/{chunk-JQXP3JWF.js → chunk-VIUCCUJ4.js} +2 -2
- package/dist/{chunk-FSVUSXJB.js → chunk-Y4EWOE4N.js} +17 -17
- package/dist/{chunk-FSVUSXJB.js.map → chunk-Y4EWOE4N.js.map} +1 -1
- package/dist/{chunk-6HUDHMAC.js → chunk-ZBRZ5T2G.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/client-TZPRACLX.js +2 -0
- package/dist/{config-44LINWKG.js → config-OQVGSZWB.js} +2 -2
- package/dist/config-mutator-BA7YVYJY.js +2 -0
- package/dist/{doctor-OXR3VXX6.js → doctor-NHEB7IMW.js} +2 -2
- package/dist/{editor-chat-V24MXQIB.js → editor-chat-4MLCP5D2.js} +5 -3
- package/dist/editor-chat-4MLCP5D2.js.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/program-TSFYLHMZ.js +2 -0
- package/dist/{promote-72BY34SI.js → promote-O6Y2RG4K.js} +2 -2
- package/dist/{query-AJO3NOO6.js → query-J3XX5U3P.js} +2 -2
- package/dist/registry-DBLLSQ75.js +2 -0
- package/dist/{request-planner-Q74NYFRJ.js → request-planner-NP2XHSMV.js} +2 -2
- package/dist/{review-candidates-ZBBIPFJT.js → review-candidates-J3OBF4GM.js} +2 -2
- package/dist/{routing-7VU524EZ.js → routing-VTQBG767.js} +2 -2
- package/dist/schedule-tool-RQBVG3ZJ.js +2 -0
- package/dist/scheduler-BHXA74R6.js +2 -0
- package/dist/{seat-MKY332GD.js → seat-NBQOUDGU.js} +2 -2
- package/dist/{select-FZX63JK5.js → select-T5FEWTZA.js} +2 -2
- package/dist/{set-enabled-RNDSUIYU.js → set-enabled-2GHZXDEA.js} +2 -2
- package/dist/{tool-XBSFEGWW.js → tool-6WLJTCE5.js} +2 -2
- package/dist/web/workflow-editor.global.js +10 -10
- package/dist/web/workflow-editor.global.js.map +1 -1
- package/dist/wiki-ZB6KMJKX.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-2XICJMS6.js.map +0 -1
- package/dist/chunk-4EJ65BMF.js.map +0 -1
- package/dist/chunk-DBXN7I2X.js +0 -15
- package/dist/chunk-DBXN7I2X.js.map +0 -1
- package/dist/chunk-LQJNRSCT.js +0 -21
- package/dist/chunk-LQJNRSCT.js.map +0 -1
- package/dist/client-OAAE3KM5.js +0 -2
- package/dist/config-mutator-P6QEABPU.js +0 -2
- package/dist/editor-chat-V24MXQIB.js.map +0 -1
- package/dist/program-X7ROPRQP.js +0 -2
- package/dist/registry-AFNYREN2.js +0 -2
- package/dist/schedule-tool-6RRXRW5K.js +0 -2
- package/dist/scheduler-WA4KTCCU.js +0 -2
- package/dist/wiki-ZOK6XGIX.js +0 -2
- /package/dist/{App-UNWLWLH5.js.map → App-NZQQXETO.js.map} +0 -0
- /package/dist/{ChatApp-UBSOVFRK.js.map → ChatApp-CSVN3PRK.js.map} +0 -0
- /package/dist/{agent-XWWWL5RV.js.map → agent-RTZDVG5B.js.map} +0 -0
- /package/dist/{chunk-H4RCKWJA.js.map → chunk-2WRWBPDL.js.map} +0 -0
- /package/dist/{chunk-SLQZ4AHG.js.map → chunk-2XSVV3M3.js.map} +0 -0
- /package/dist/{chunk-U6XM4M5V.js.map → chunk-3AFZBXNX.js.map} +0 -0
- /package/dist/{chunk-JVJYCR67.js.map → chunk-3OIFSKSR.js.map} +0 -0
- /package/dist/{chunk-FWDWHZ6H.js.map → chunk-B5VRY4NI.js.map} +0 -0
- /package/dist/{chunk-4STRKIUA.js.map → chunk-IWQURDYO.js.map} +0 -0
- /package/dist/{chunk-WEUF5WRR.js.map → chunk-IXWPA6WM.js.map} +0 -0
- /package/dist/{chunk-53J2D2ZJ.js.map → chunk-N2A3KIVY.js.map} +0 -0
- /package/dist/{chunk-NWP44FEW.js.map → chunk-P5KHF46N.js.map} +0 -0
- /package/dist/{chunk-GTZDTKDW.js.map → chunk-PF5ZXMEG.js.map} +0 -0
- /package/dist/{chunk-TVORP6BW.js.map → chunk-QAKL2D7O.js.map} +0 -0
- /package/dist/{chunk-GX4U2ILS.js.map → chunk-QIMIARFO.js.map} +0 -0
- /package/dist/{chunk-R7AS5M32.js.map → chunk-SYXAEWFN.js.map} +0 -0
- /package/dist/{chunk-IMVW5ZSY.js.map → chunk-THZOPGSP.js.map} +0 -0
- /package/dist/{chunk-KEPK7ZZ2.js.map → chunk-TQT4XDNN.js.map} +0 -0
- /package/dist/{chunk-JQXP3JWF.js.map → chunk-VIUCCUJ4.js.map} +0 -0
- /package/dist/{chunk-6HUDHMAC.js.map → chunk-ZBRZ5T2G.js.map} +0 -0
- /package/dist/{client-OAAE3KM5.js.map → client-TZPRACLX.js.map} +0 -0
- /package/dist/{config-44LINWKG.js.map → config-OQVGSZWB.js.map} +0 -0
- /package/dist/{config-mutator-P6QEABPU.js.map → config-mutator-BA7YVYJY.js.map} +0 -0
- /package/dist/{doctor-OXR3VXX6.js.map → doctor-NHEB7IMW.js.map} +0 -0
- /package/dist/{program-X7ROPRQP.js.map → program-TSFYLHMZ.js.map} +0 -0
- /package/dist/{promote-72BY34SI.js.map → promote-O6Y2RG4K.js.map} +0 -0
- /package/dist/{query-AJO3NOO6.js.map → query-J3XX5U3P.js.map} +0 -0
- /package/dist/{registry-AFNYREN2.js.map → registry-DBLLSQ75.js.map} +0 -0
- /package/dist/{request-planner-Q74NYFRJ.js.map → request-planner-NP2XHSMV.js.map} +0 -0
- /package/dist/{review-candidates-ZBBIPFJT.js.map → review-candidates-J3OBF4GM.js.map} +0 -0
- /package/dist/{routing-7VU524EZ.js.map → routing-VTQBG767.js.map} +0 -0
- /package/dist/{schedule-tool-6RRXRW5K.js.map → schedule-tool-RQBVG3ZJ.js.map} +0 -0
- /package/dist/{scheduler-WA4KTCCU.js.map → scheduler-BHXA74R6.js.map} +0 -0
- /package/dist/{seat-MKY332GD.js.map → seat-NBQOUDGU.js.map} +0 -0
- /package/dist/{select-FZX63JK5.js.map → select-T5FEWTZA.js.map} +0 -0
- /package/dist/{set-enabled-RNDSUIYU.js.map → set-enabled-2GHZXDEA.js.map} +0 -0
- /package/dist/{tool-XBSFEGWW.js.map → tool-6WLJTCE5.js.map} +0 -0
- /package/dist/{wiki-ZOK6XGIX.js.map → wiki-ZB6KMJKX.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Te,b as gt}from"./chunk-FX3D7YON.js";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 ne,b as We}from"./chunk-FCPTN6NF.js";import{o as we,p as He}from"./chunk-5MUJZODV.js";import{
|
|
1
|
+
import{a as Te,b as gt}from"./chunk-FX3D7YON.js";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 ne,b as We}from"./chunk-FCPTN6NF.js";import{o as we,p as He}from"./chunk-5MUJZODV.js";import{G as Ze,H as et}from"./chunk-KH4PKJGD.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 Te,b as gt}from"./chunk-FX3D7YON.js";import{a as tt,b as nt,c as rt,
|
|
|
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-
|
|
114
|
+
//# sourceMappingURL=chunk-QAKL2D7O.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as l,w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{v as l,w}from"./chunk-QAKL2D7O.js";import{a as i,f as p}from"./chunk-72SZI2UW.js";w();p();var d="task-tier";function u(e){return{task:m(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:i("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 m(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2,T=60*60*1e3;function F(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 _(e){let n=(s,r=null)=>({downgraded:!1,needsFlagship:r,reason:s});if(e.channel==="voice"||e.channel==="desktop"||e.channel==="opencode")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??T;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 a=e.threshold??h;return o>=a?n(`needs the flagship (${o.toFixed(2)})`,o):{model:e.cheapModel,downgraded:!0,needsFlagship:o,reason:`mechanical task (${o.toFixed(2)} below ${a}) \u2192 ${e.cheapModel}`}}export{F as a,_ as b};
|
|
2
|
+
//# sourceMappingURL=chunk-QIMIARFO.js.map
|