PageSourceSearch

https://app.slancha.ai/assets/Review-BjTscSjV.js

js slancha.ai collected 2026-10-05 15:05:13 UTC 11,661 bytes, 3 lines download raw bytes

1import{j as e}from"./app-DeursVD0.js";import{i as S,h as _,a as j,L as f}from"./react-vendor-CkgV0jl3.js";import{N as $,E as x,u as C,r as P,a as R,b as A}from"./ErrorNote-ByAgjpyc.js";import{u as g}from"./useAction-Bh84mAiS.js";import{u as F,a as W}from"./useJobs-lLj4Gvw7.js";import{u as D}from"./BoardProvider-C0-o8kTY.js";import{u as L}from"./OrgContext-pK3UNOai.js";import{D as k}from"./Dialog-BaDFR5B3.js";import{S as B}from"./SecurityPanel-0WC1yJvb.js";import{p as E,o as T,a as q}from"./draft-DgP_jO_w.js";import{w as z,s as v,r as N,p as m}from"./format-BLHnUSsK.js";import"./supabase-J7ITh-P0.js";function y(s){return!!(s&&s.gate&&s.gate.promotable===!0&&!s.stale&&!s.scan_blocker)}function H(s){if(!s)return[];const a=s.gate,n=[];if(!a)n.push({tone:"block",label:"Blocked",text:"No check verdict was recorded. Approval is refused."});else if(a.promotable!==!0){const t=(a.blocked||[]).join("; ")||"no reason was recorded";n.push({tone:"block",label:"Blocked",text:`${t}. Approval is refused.`})}else n.push({tone:"ok",label:"Checks",text:"Passed. Nothing is scored: a clean security scan and a person decide."});for(const t of(a==null?void 0:a.warnings)||[])n.push({tone:"warn",label:"Caution",text:t});return s.stale&&n.push({tone:"block",label:"Stale",text:`${s.stale}. Approval is refused.`}),s.scan_blocker&&n.push({tone:"block",label:"Security scan",text:s.scan_blocker}),n}function U(s){return s.startsWith("+++")||s.startsWith("---")?"meta":s.startsWith("@@")?"hunk":s.startsWith("+")?"add":s.startsWith("-")?"del":""}function w({card:s}){const a=H(s);return a.length?e.jsx("ul",{className:"app-cautions","data-testid":"cautions",children:a.map(n=>e.jsxs("li",{className:`app-caution app-caution--${n.tone}`,children:[e.jsx("strong",{children:n.label})," ",n.text]},`${n.label}:${n.text}`))}):null}function oe(){var h;const{skill:s}=S(),a=D(),n=_(),[t,c]=j.useState(""),[i,l]=j.useState(null),r=(a.pending.data||[]).filter(o=>o.id!==i),p=s||((h=r[0])==null?void 0:h.skill)||null,u=(o,d)=>{c(o),l(d),a.reload(),n("/app/review",{replace:!0})};return e.jsxs("div",{className:"app-page",children:[e.jsx("header",{className:"app-head",children:e.jsxs("div",{children:[e.jsx("h1",{children:"Review"}),e.jsx("p",{className:"app-lede",children:"Every change to a skill waits here until a person approves it."})]})}),e.jsx($,{children:t}),e.jsx(x,{error:a.pending.error}),r.length>1&&e.jsx("nav",{className:"app-queue","aria-label":"Pending changes",children:r.map(o=>e.jsxs(f,{to:`/app/review/${o.skill}`,"aria-current":o.skill===p?"page":void 0,children:[o.skill,e.jsxs("span",{className:"app-muted",children:[" · ",o.kind==="creation"?"to be added":"change"]})]},o.id))}),p?e.jsx(J,{skill:p,onDecided:u},p):a.pending.data&&e.jsxs("div",{className:"app-empty",children:[e.jsx("p",{children:"No pending changes."}),e.jsxs("p",{className:"app-muted",children:["A skill you ",e.jsx(f,{to:"/app/skills/new",children:"upload"})," waits here until someone approves it."]})]})]})}function J({skill:s,onDecided:a}){var h,o;const n=C(`card:${s}`,d=>P(s,d),{poll:1e4}),{me:t}=L(),c=F(s,{onFinished:n.reload}),[i,l]=j.useState(null);if(((h=n.error)==null?void 0:h.status)===404)return e.jsx("div",{className:"app-empty",children:e.jsx("p",{children:n.error.message})});const r=n.data;if(!r)return n.error?e.jsx(x,{error:n.error}):e.jsx("p",{className:"app-muted",children:"Loading…"});const p=r.kind==="creation",u=p?"Approve & add":"Approve & promote";return e.jsxs("article",{className:"app-card","aria-labelledby":"card-title",children:[e.jsxs("h2",{id:"card-title",children:[p?"Skill to be added: ":"Pending change: ",r.skill]}),e.jsxs("p",{className:"app-meta",children:[r.source==="upload"?"Uploaded":r.source==="draft"?"Written from traces":"Proposed",r.created_by?` by ${r.created_by}`:""," · ",z(r.created)," · revision ",e.jsx("code",{children:v(r.revision)}),!p&&e.jsxs(e.Fragment,{children:[" · replaces ",e.jsx("code",{children:N(r.base_revision)})]})]}),e.jsx(x,{error:n.error}),((o=r.changed)==null?void 0:o.length)>0&&e.jsx("div",{className:"app-chips","aria-label":"Components changed",children:r.changed.map(d=>e.jsx("span",{className:"app-chip",children:d},d))}),e.jsx(w,{card:r}),e.jsx(B,{skill:r.skill,revision:r.revision,scan:r.scan,job:(c.data||[]).find(d=>d.type==="scan"&&d.revision===r.revision)||null,canScan:W(t==null?void 0:t.role,"proposer"),onScanStarted:c.reload}),e.jsx(K,{risk:r.risk}),e.jsx(O,{files:r.files}),e.jsxs("section",{className:"app-section",children:[e.jsx("h3",{children:r.risk?"Diff · served → proposed":"Proposed content"}),e.jsx(G,{diff:r.diff})]}),r.risk&&e.jsx(I,{comparison:r.comparison}),e.jsx(M,{card:r}),e.jsxs("div",{className:"app-actions app-review-decision",children:[e.jsx("button",{type:"button",className:"sh-btn sh-btn--primary",disabled:!y(r),onClick:()=>l({kind:"approve",card:r}),children:u}),e.jsx("button",{type:"button",className:"sh-btn",onClick:()=>l({kind:"reject",card:r}),children:"Reject"})]}),(i==null?void 0:i.kind)==="approve"&&e.jsx(Q,{card:i.card,live:r,onClose:()=>l(null),onRefused:n.reload,onApproved:d=>{l(null),a(d.result,i.card.id)}}),(i==null?void 0:i.kind)==="reject"&&e.jsx(V,{card:i.card,onClose:()=>l(null),onRefused:n.reload,onRejected:d=>{l(null),a(d.result,i.card.id)}})]})}function K({risk:s}){if(!s)return null;const a=n=>`${Number(n)>=0?"+":""}${Number(n).toFixed(1)}%`;return e.jsxs("section",{className:`app-risk${s.high_risk?" app-risk--high":""}`,"aria-label":"Size of the change",children:[e.jsxs("div",{children:[e.jsxs("b",{children:[s.added_lines?"+":"",s.added_lines]}),e.jsx("span",{children:"lines added"})]}),e.jsxs("div",{children:[e.jsxs("b",{children:[s.removed_lines?"−":"",s.removed_lines]}),e.jsx("span",{children:"lines removed"})]}),e.jsxs("div",{children:[e.jsxs("b",{children:[Number(s.changed_pct).toFixed(1),"%"]}),e.jsx("span",{children:"body changed"})]}),e.jsxs("div",{children:[e.jsx("b",{children:a(s.size_delta_pct)}),e.jsx("span",{children:"body size"})]}),s.high_risk&&e.jsx("p",{className:"app-risk-warning",children:"High-risk rewrite: read the whole body before deciding."})]})}function O({files:s}){if(!(s!=null&&s.length))return null;const a={added:0,modified:1,removed:2,unchanged:3},n=[...s].sort((c,i)=>(a[c.status]??1)-(a[i.status]??1)||c.path.localeCompare(i.path)),t=s.filter(c=>c.status!=="unchanged").length;return e.jsxs("details",{className:"app-section",open:s.length<=12,children:[e.jsxs("summary",{children:["Package files · ",t===s.length?m(s.length,"file"):`${t} changed, ${s.length-t} carried forward unchanged`]}),e.jsx("ul",{className:"app-files",children:n.map(c=>e.jsxs("li",{children:[e.jsx("span",{className:`app-chip app-chip--${c.status}`,children:c.status})," ",e.jsx("code",{children:c.path})]},`${c.status}:${c.path}`))})]})}function G({diff:s}){return s?e.jsx("pre",{className:"app-diff",children:s.split(`
2`).map((a,n)=>e.jsxs("span",{className:`app-diff-${U(a)||"ctx"}`,children:[a,`
3`]},n))}):e.jsx("p",{className:"app-muted",children:"(no textual diff)"})}function I({comparison:s}){return s!=null&&s.length?e.jsxs("details",{className:"app-section",children:[e.jsx("summary",{children:"Before and after, side by side"}),s.map(a=>e.jsxs("section",{className:"app-sxs",children:[e.jsx("h4",{children:a.component}),e.jsxs("div",{className:"app-sxs-cols",children:[e.jsxs("div",{children:[e.jsx("span",{className:"app-muted",children:"Served"}),e.jsx("pre",{children:String(a.before)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"app-muted",children:"Proposed"}),e.jsx("pre",{children:String(a.after)})]})]})]},a.component))]}):null}function M({card:s}){const a=s.evidence;if(s.source==="upload")return e.jsx("p",{className:"app-muted",children:"Uploaded by a person; not measured."});if((a==null?void 0:a.schema_version)!=="slancha/draft/v1")return null;const n=a.sessions||[];return e.jsxs("section",{className:"app-section","aria-label":"Sessions it was written from",children:[e.jsx("h3",{children:"Sessions it was written from"}),e.jsxs("p",{className:"app-muted",children:[m(n.length,"session"),E(a.picked_by)," · ",T(a.outcomes),". A follow-up is anything the user said after the answer, such as thanks or a new request. Personal data in them reads ",e.jsx("code",{children:"[redacted]"}),": it was removed before any model read them. ",e.jsx(f,{to:`/app/wiki/${s.skill}`,children:"What its drafts learned"})]}),a.privacy&&e.jsxs("p",{className:"app-muted","aria-label":"Privacy check",children:["The privacy filter (revision ",e.jsx("code",{children:String(a.privacy.filter_revision).slice(0,7)}),")"," ","removed ",m(a.privacy.spans_redacted??0,"piece")," of personal data from"," ",m(a.privacy.sessions_redacted??0,"session"),a.privacy.candidate_checked?", and found none in what this skill would ship.":"."]}),e.jsx("ol",{className:"app-sessions ph-no-capture",children:n.map((t,c)=>{var i;return e.jsxs("li",{className:"app-session",children:[e.jsx("span",{className:"app-chip",children:q(t.outcome)}),t.day&&e.jsxs("span",{className:"app-muted",children:[" · ",t.day]}),e.jsxs("dl",{children:[e.jsx("dt",{children:"First request"}),e.jsx("dd",{children:t.prompt||"—"}),e.jsx("dt",{children:"What the user said later"}),(i=t.followups)!=null&&i.length?t.followups.map((l,r)=>e.jsx("dd",{children:l},r)):e.jsx("dd",{children:"Nothing."}),e.jsx("dt",{children:"Where it ended"}),e.jsx("dd",{children:t.answer||"—"})]})]},`${t.trace_id}:${c}`)})})]})}function Q({card:s,live:a,onClose:n,onApproved:t,onRefused:c}){var o;const i=a&&a.id===s.id?a:s,l=s.kind==="creation",r=l?"Approve & add":"Approve & promote",p=g(()=>R(s.skill,s.id)),u=[404,409].includes((o=p.error)==null?void 0:o.status),h=async()=>{var b;const d=await p.run();d.ok?t(d.value):[404,409].includes((b=d.error)==null?void 0:b.status)&&c()};return e.jsxs(k,{title:l?`Add ${s.skill}`:`Promote ${s.skill}`,onClose:n,children:[e.jsxs("p",{children:[l?e.jsxs(e.Fragment,{children:["Serves revision ",e.jsx("code",{children:v(s.revision)})," as the first version of ",s.skill,"."]}):e.jsxs(e.Fragment,{children:["Serves revision ",e.jsx("code",{children:v(s.revision)})," in place of ",e.jsx("code",{children:N(s.base_revision)}),"."]})," ","History can roll it back."]}),e.jsx(w,{card:i}),e.jsx(x,{error:p.error}),e.jsxs("div",{className:"app-dialog-actions",children:[e.jsx("button",{type:"button",className:"sh-btn","data-autofocus":!0,onClick:n,children:"Cancel"}),e.jsx("button",{type:"button",className:"sh-btn sh-btn--primary",disabled:!y(i)||p.pending||u,onClick:h,children:p.pending?"Approving…":r})]})]})}function V({card:s,onClose:a,onRejected:n,onRefused:t}){var u;const[c,i]=j.useState(""),l=g(()=>A(s.skill,s.id,c)),r=[404,409].includes((u=l.error)==null?void 0:u.status),p=async()=>{var o;const h=await l.run();h.ok?n(h.value):[404,409].includes((o=h.error)==null?void 0:o.status)&&t()};return e.jsxs(k,{title:`Reject the pending change to ${s.skill}`,onClose:a,children:[e.jsx("p",{children:"The proposed revision is not served. The reason is kept in the audit trail."}),e.jsxs("div",{className:"sh-field",children:[e.jsx("label",{className:"sh-label",htmlFor:"reject-reason",children:"Reason (optional)"}),e.jsx("textarea",{id:"reject-reason",className:"sh-input app-textarea","data-autofocus":!0,maxLength:500,value:c,onChange:h=>i(h.target.value)})]}),e.jsx(x,{error:l.error}),e.jsxs("div",{className:"app-dialog-actions",children:[e.jsx("button",{type:"button",className:"sh-btn",onClick:a,children:"Cancel"}),e.jsx("button",{type:"button",className:"sh-btn app-btn-danger",disabled:l.pending||r,onClick:p,children:l.pending?"Rejecting…":"Reject"})]})]})}export{oe 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.