PageSourceSearch

https://councilof.ai/assets/RoutePane.r2-DHzYAuRr.js

js councilof.ai collected 2026-10-05 11:56:14 UTC 12,843 bytes, 5 lines download raw bytes

1import{c as P,r as a,j as e}from"./index.r2-Ed8qmjX1.js";import{c as D}from"./sovTools.r2-DxXVM2v3.js";import{N as I}from"./NextSteps.r2-B2LxMmjE.js";import"./mcpHttp.r2-d7eI7gTo.js";import"./arrow-right.r2-DaYJWqWf.js";const O=["read-only","local-only","eu-only","no-unmeasured"],v=["cheapest_declared","local_first","lexical_id"],F=`[
2  {"id": "hosted-model-a", "kind": "model", "provider": "vendor-a", "region": "eu", "cost_declared": 3},
3  {"id": "hosted-model-b", "kind": "model", "provider": "vendor-b", "region": "us", "cost_declared": 2},
4  {"id": "my-local-gpu", "kind": "local_gpu", "endpoint": "local:ollama", "cost_declared": 0}
5]`,k={SEPARATED:"SEPARATED: the board's top rows on this axis are statistically apart. The router may name a separated leader on this axis only.",TIE:"TIE: the board could not tell the top candidates apart on this axis. The choice below came from your tie-break rule, not from a measured difference.",UNTESTED:"UNTESTED: no separation test covers these candidates on this axis. The choice below came from your tie-break rule; an untested axis is not a tie and not a win."};function u(o){return o&&typeof o=="object"&&!Array.isArray(o)?o:null}function U(){const o=P(),f=a.useMemo(()=>(o.data?.axes??[]).filter(t=>t.kind==="model-comparison"&&typeof t.axis=="string").map(t=>t.axis),[o.data]),[i,w]=a.useState("Summarise a supplier contract and list its termination clauses."),[h,S]=a.useState(""),[b,T]=a.useState([]),[p,E]=a.useState("cheapest_declared"),[c,A]=a.useState(!0),[j,C]=a.useState(F),[l,m]=a.useState({k:"idle"});async function N(){let t;if(c)try{t=JSON.parse(j)}catch{m({k:"error",message:"The candidates are not valid JSON. Nothing was sent."});return}const n={task:i,objective:{...h?{quality_axis:h}:{},tie_break:[p,...v.filter(R=>R!==p)]},...b.length?{policy:{presets:b}}:{},...c?{candidates:t}:{}};m({k:"running"});const r=await D("route",n),x=u(r.raw?.result?.structuredContent);if(!x){m({k:"error",message:r.text||"The route tool returned no structured result."});return}m({k:"done",result:x,text:r.text})}const s=l.k==="done"?l.result:null,g=u(s?.chosen),d=typeof s?.separation=="string"?s.separation:null,_=Array.isArray(s?.forbidden)?s.forbidden:[],y=u(u(s?.record)?.observed)?.considered??[];return e.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6 sm:px-8 sm:py-8","data-testid":"route-pane",children:[e.jsx("p",{className:"t-kicker text-emerald-800",children:"Connect · Route"}),e.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-foreground",children:"GSPC Route, decide-only"}),e.jsxs("p",{className:"mt-2 max-w-3xl text-sm leading-relaxed text-muted-foreground",children:["Give it a task, your candidates and your policy. It applies your policy to our published measurements and returns a decision with an unsigned route record. Routing is not ranking: a tie is printed as TIE and untested as UNTESTED. Nothing is executed and nothing is charged. The same tool is ",e.jsx("code",{className:"font-mono",children:"route"})," on"," ",e.jsx("code",{className:"font-mono",children:"/mcp/free"})," and the A2A skill ",e.jsx("code",{className:"font-mono",children:"gspc-route"}),"."]}),e.jsxs("form",{className:"mt-6 grid gap-5 rounded-3xl border border-emerald-950/10 bg-card p-5 shadow-[0_1px_2px_rgba(6,21,15,0.04)] sm:p-6 lg:grid-cols-2",onSubmit:t=>{t.preventDefault(),N()},"aria-label":"Route a task",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("label",{htmlFor:"route-task",className:"text-sm font-bold text-foreground",children:["Task ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"(hashed with SHA-256; the text is never stored or echoed)"})]}),e.jsx("textarea",{id:"route-task",value:i,onChange:t=>w(t.target.value),rows:2,maxLength:2e4,className:"mt-2 w-full rounded-xl border border-border bg-background p-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-700"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"route-axis",className:"text-sm font-bold text-foreground",children:"Quality axis"}),e.jsxs("select",{id:"route-axis",value:h,onChange:t=>S(t.target.value),className:"mt-2 min-h-11 w-full rounded-xl border border-border bg-background px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-700",children:[e.jsx("option",{value:"",children:"None (policy and tie-break only)"}),f.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.error?`The board is unread (${o.error}); axes cannot be listed.`:f.length?"Model-comparison axes read live from GET /api/gspc.":"Reading the board…"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"route-tie",className:"text-sm font-bold text-foreground",children:"Tie-break rule (yours, and recorded)"}),e.jsx("select",{id:"route-tie",value:p,onChange:t=>E(t.target.value),className:"mt-2 min-h-11 w-full rounded-xl border border-border bg-background px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-700",children:v.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("fieldset",{className:"lg:col-span-2",children:[e.jsx("legend",{className:"text-sm font-bold text-foreground",children:"Policy presets"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:O.map(t=>{const n=b.includes(t);return e.jsxs("label",{className:`inline-flex min-h-11 cursor-pointer items-center gap-2 rounded-xl border px-3 text-sm ${n?"border-emerald-700 bg-emerald-50 font-semibold text-emerald-950":"border-border bg-background text-foreground"}`,children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-emerald-700",checked:n,onChange:()=>T(r=>n?r.filter(x=>x!==t):[...r,t])}),t]},t)}
5)})]}),e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("label",{className:"inline-flex min-h-11 items-center gap-2 text-sm font-bold text-foreground",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-emerald-700",checked:c,onChange:t=>A(t.target.checked)}),"Route among my own candidates"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Off: the router chooses among the GSPC MCP tools themselves."}),c?e.jsxs(e.Fragment,{children:[e.jsx("label",{htmlFor:"route-cands",className:"sr-only",children:"Candidates as JSON"}),e.jsx("textarea",{id:"route-cands",value:j,onChange:t=>C(t.target.value),rows:6,spellCheck:!1,className:"mt-2 w-full rounded-xl border border-border bg-background p-3 font-mono text-xs leading-relaxed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-700"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A field the router does not know makes that candidate UNCHECKABLE, never permitted. Sponsor or placement fields are ignored."})]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 lg:col-span-2",children:[e.jsx("button",{type:"submit",disabled:l.k==="running"||!i.trim(),className:"inline-flex min-h-12 items-center justify-center rounded-xl bg-emerald-800 px-6 text-base font-black text-white transition hover:bg-emerald-900 disabled:opacity-60 motion-reduce:transition-none","data-testid":"route-decide",children:"Decide the route"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Calls tools/call route on /mcp. Free, read-only, decide-only."})]})]}),e.jsx("div",{className:"mt-6","aria-live":"polite",children:l.k==="running"?e.jsx("div",{role:"status",className:"rounded-3xl border border-border bg-card p-6 text-sm text-muted-foreground","data-testid":"route-running",children:"Asking the router…"}):l.k==="error"?e.jsx("div",{role:"alert",className:"rounded-3xl border border-amber-500/60 bg-amber-50 p-5 text-sm text-amber-950","data-testid":"route-error",children:l.message}):s?e.jsxs("section",{className:"rounded-3xl border border-emerald-950/10 bg-card p-5 shadow-[0_24px_50px_-38px_rgba(4,18,12,.45)] sm:p-6","data-testid":"route-card","aria-label":"Route decision",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-full bg-[#04120c] px-3 py-1 font-mono text-xs font-bold uppercase tracking-wide text-emerald-200",children:String(s.state)}),d?e.jsx("span",{className:`rounded-full px-3 py-1 font-mono text-xs font-bold uppercase tracking-wide ${d==="SEPARATED"?"bg-emerald-800 text-white":d==="TIE"?"bg-sky-100 text-sky-950":"bg-slate-100 text-slate-900"}`,"data-testid":"route-separation",children:d}):null,e.jsx("span",{className:"rounded-full border border-border px-3 py-1 font-mono text-xs font-bold uppercase tracking-wide text-muted-foreground",children:"unsigned preview"})]}),g?e.jsxs("p",{className:"mt-4 text-lg text-foreground","data-testid":"route-chosen",children:["Routed to ",e.jsx("span",{className:"font-mono font-black",children:String(g.id)}),e.jsxs("span",{className:"block text-sm text-muted-foreground",children:["basis ",e.jsx("code",{className:"font-mono",children:String(g.choice_basis)})]})]}):e.jsx("p",{className:"mt-4 text-lg text-foreground",children:"No candidate was permitted by the policy."}),d&&k[d]?e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-relaxed text-muted-foreground","data-testid":"route-honesty",children:k[d]}):null,e.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-3 text-sm sm:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:"considered"}),e.jsx("dd",{className:"font-mono text-lg font-black",children:String(s.considered??"—")})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:"permitted"}),e.jsx("dd",{className:"font-mono text-lg font-black",children:String(s.permitted??"—")})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:"forbidden"}),e.jsx("dd",{className:"font-mono text-lg font-black",children:_.length})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:"mode"}),e.jsx("dd",{className:"font-mono text-sm font-bold",children:String(s.mode??"decide_only")})]})]}),y.length?e.jsx("div",{className:"mt-5 overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[32rem] text-left text-sm",children:[e.jsx("caption",{className:"sr-only",children:"Candidates considered and why"}),e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-xs text-muted-foreground",children:[e.jsx("th",{className:"py-2 pr-3 font-semibold",children:"candidate"}),e.jsx("th",{className:"py-2 pr-3 font-semibold",children:"permit"}),e.jsx("th",{className:"py-2 pr-3 font-semibold",children:"forbidden by"}),e.jsx("th",{className:"py-2 font-semibold",children:"measurement on the axis"})]})}),e.jsx("tbody",{children:y.map((t,n)=>{const r=(Array.isArray(t.measurements)?t.measurements:[])[0];return e.jsxs("tr",{className:"border-b border-border/60 align-top",children:[e.jsx("td",{className:"py-2 pr-3 font-mono text-xs",children:String(t.id)}),e.jsx("td",{className:"py-2 pr-3",children:t.permit?"yes":"no"}),e.jsx("td",{className:"py-2 pr-3 font-mono text-xs",children:t.forbid_policy?String(t.forbid_policy):"—"}),e.jsx("td",{className:"py-2 font-mono text-xs",children:r?`${String(r.axis)}: ${String(r.state)}`:"none requested"})]},n)})})]})}):null,e.jsx("p",{className:"mt-4 text-xs leading-relaxed text-muted-foreground",children:String(s.note??"")}),e.jsxs("details",{className:"mt-3 rounded-xl border border-border bg-background",children:[e.jsx("summary",{className:"cursor-pointer px-4 py-3 text-sm font-semibold",children:"The route record (csoai.route-evidence/0.1, unsigned)"}),e.jsx("pre",{className:"max-h-96 overflow-auto border-t border-border p-4 font-mono text-xs leading-relaxed",children:JSON.stringify(s.record,null,2)})]})]}):e.jsxs("div",{className:"rounded-3xl border border-dashed border-border p-6","data-testid":"route-idle",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"No route decided yet. The decision appears here with its separation state and the record behind it."}),e.jsx("button",{type:"button",onClick:()=>{N()},disabled:!i.trim(),className:"mt-4 inline-flex min-h-11 items-center rounded-xl bg-emerald-800 px-5 text-sm font-bold text-white hover:bg-emerald-900 disabled:opacity-60",children:"Decide with the example candidates"})]})}),s?e.jsx(I,{testId:"route-next",steps:[{href:"/dashboard?tab=board",title:"Read the axis on the board",body:"See the separation state the router read, with its sample size and interval."},{href:"/dashboard?tab=connect",title:"Call route from your agent",body:"The same tool is route on /mcp/free and the A2A skill gspc-route."},{href:"/dashboard?tab=verify",title:"Verify a signed card",body:"Check the bytes behind a measurement yourself, in your browser."}]}):null]})}export{U as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.