PageSourceSearch

https://www.tradehorde.ai/_next/static/chunks/app/admin/x-editorial/page-cdd349da12b46b5c.js

js tradehorde.ai collected 2026-10-05 13:08:22 UTC 13,041 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8785],{8654:(e,t,a)=>{Promise.resolve().then(a.bind(a,16178))},16178:(e,t,a)=>{"use strict";a.d(t,{default:()=>d});var s=a(95155),r=a(12115);let i="rounded border border-th-gray-800 px-3 py-2 text-sm text-th-text-primary disabled:opacity-40",n="rounded border border-th-gray-800 bg-th-bg-primary p-2 text-sm text-th-text-primary",l=e=>null==e?"Unknown":e.toLocaleString(void 0,{maximumFractionDigits:1});function d(){var e,t,a,d,c,o,h,u,p,x,m,v,j;let[b,g]=(0,r.useState)(null),[y,f]=(0,r.useState)(""),[N,w]=(0,r.useState)(!1),[k,_]=(0,r.useState)({}),[S,C]=(0,r.useState)({}),[A,I]=(0,r.useState)("what_changed"),[R,P]=(0,r.useState)(""),[z,E]=(0,r.useState)(""),[U,D]=(0,r.useState)(!1),[L,O]=(0,r.useState)({}),[V,M]=(0,r.useState)({}),T=(0,r.useCallback)(async()=>{let e=await fetch("/api/admin/x-editorial",{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(t.error||"Review unavailable");g(t)},[]);(0,r.useEffect)(()=>{T().catch(e=>f(e.message))},[T]);let q=async e=>{w(!0),f("");try{let t=await fetch("/api/admin/x-editorial",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();if(!t.ok)throw Error(a.error||"Action rejected");await T()}catch(e){f(e instanceof Error?e.message:"Action failed")}finally{w(!1)}},F=N||!b||"off"===b.mode||!0===b.killed,G=(e,t)=>q({action:t,draftId:e.id,approvalHash:e.approval_hash,claimsReviewed:!0===S[e.id],note:k[e.id]||("revoke"===t?"Approval revoked by reviewer":"")});return(0,s.jsxs)("main",{className:"mx-auto max-w-5xl space-y-6 p-6",children:[(0,s.jsxs)("header",{className:"space-y-2",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-th-text-primary",children:"X editorial review"}),(0,s.jsx)("p",{className:"text-th-text-secondary",children:"Goal: 1,000 average impressions at 72 hours across every authored post. Required signal reporting stays independent."}),(0,s.jsxs)("p",{className:"text-sm text-th-text-secondary",children:["Mode: ",(null==b?void 0:b.mode)||"loading"," \xb7 Kill switch: ",(null==b?void 0:b.killed)?"on":"off"," \xb7 Account: ",(null==b?void 0:b.accountId)||"not configured"]}),(0,s.jsxs)("p",{className:"text-xs text-th-text-secondary",children:["Last scripts report: ",(null==b||null==(t=b.runs)||null==(e=t.find(e=>e.worker_revision))?void 0:e.worker_revision)||"not observed"," \xb7 ",(null==b||null==(d=b.runs)||null==(a=d.find(e=>e.worker_mode))?void 0:a.worker_mode)||"unknown mode"]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{className:i,disabled:N,onClick:()=>void T().catch(e=>f(e.message)),children:"Refresh"}),(null==b?void 0:b.initialized)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:i,disabled:N,onClick:()=>void q({action:"pause"}),children:"Pause editor"}),(0,s.jsx)("button",{className:i,disabled:F||!(null==(c=b.account)?void 0:c.paused),onClick:()=>void q({action:"resume"}),children:"Resume configured mode"})]})]})]}),y&&(0,s.jsx)("p",{role:"alert",className:"rounded border border-th-gray-800 p-3 text-th-text-primary",children:y}),!(null==b?void 0:b.initialized)&&(0,s.jsxs)("section",{className:"space-y-3 rounded border border-th-gray-800 p-4",children:[(0,s.jsx)("h2",{className:"font-semibold text-th-text-primary",children:"Not active"}),(0,s.jsx)("p",{className:"text-th-text-secondary",children:"Apply migration 217, configure the exact account, user-context read token, approved budgets, sources, mode and kill switch. Initialization starts a prospective baseline and remains paused."}),(0,s.jsx)("button",{className:i,disabled:F||(null==b?void 0:b.migrationRequired)||(null==b?void 0:b.configurationRequired),onClick:()=>void q({action:"initialize",cohortStart:new Date().toISOString()}),children:"Initialize baseline starting now"})]}),(null==b||null==(o=b.reports)?void 0:o[0])&&(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-th-text-primary",children:"Account-wide results"}),(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-left text-sm text-th-text-primary",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:["Publication window","Status","Posts","Mean","Median","Missing","Top post share"].map(e=>(0,s.jsx)("th",{className:"p-2",children:e},e))})}),(0,s.jsx)("tbody",{children:b.reports[0].result.cohorts.map(e=>(0,s.jsxs)("tr",{className:"border-t border-th-gray-800",children:[(0,s.jsxs)("td",{className:"p-2",children:[e.start.slice(0,10)," – ",e.end.slice(0,10)]}),(0,s.jsx)("td",{children:e.status}),(0,s.jsx)("td",{children:e.summary.count}),(0,s.jsx)("td",{children:l(e.summary.observedMean)}),(0,s.jsx)("td",{children:l(e.summary.median)}),(0,s.jsx)("td",{children:e.summary.missing}),(0,s.jsxs)("td",{children:[l(e.summary.largestPostSharePercent),"%"]})]},e.start))})]})}),(0,s.jsx)("p",{className:"text-sm text-th-text-secondary",children:"An observed-only mean is not a verified target when coverage is missing. Paid/organic reach and causal uplift are separate questions."})]}),(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-th-text-primary",children:"Latest 30 drafts"}),!(null==b||null==(h=b.drafts)?void 0:h.length)&&(0,s.jsx)("p",{className:"text-th-text-secondary",children:"No drafts yet. Nothing is published without exact-copy approval and a separately authorized pilot."}),null==b||null==(u=b.drafts)?void 0:u.map(e=>{var t,a,r,l;return(0,s.jsxs)("article",{className:"space-y-3 rounded border border-th-gray-800 bg-th-bg-secondary p-4",children:[(0,s.jsxs)("p",{className:"text-sm text-th-text-secondary",children:[e.topic," \xb7 ",e.variant," \xb7 ",e.status," ",e.dispatch_status&&"\xb7 ".concat(e.dispatch_status)]}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap font-sans text-th-text-primary",children:e.text}),(0,s.jsxs)("p",{className:"text-xs text-th-text-secondary",children:["Send window: ",new Date(e.scheduled_at).toLocaleStr
1ing()," – ",new Date(e.valid_until).toLocaleString()]}),(0,s.jsxs)("details",{className:"text-sm text-th-text-secondary",children:[(0,s.jsx)("summary",{children:"Source evidence and validation"}),(0,s.jsx)("p",{children:e.validation.ok?"Automated checks passed; verify meaning against the sources.":e.validation.errors.join(", ")}),null==(a=e.content)||null==(t=a.sentences)?void 0:t.map((e,t)=>(0,s.jsxs)("p",{className:"my-2",children:[e.type,": ",e.text," → ",e.factIds.join(", ")]},t)),e.evidence.sources.map(e=>(0,s.jsxs)("div",{className:"my-2 space-y-1",children:[(0,s.jsx)("a",{className:"underline",href:e.url,target:"_blank",rel:"noreferrer",children:e.url}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap font-sans",children:e.text}),(0,s.jsxs)("p",{children:["Retrieved ",e.retrievedAt,"; expires ",e.validUntil,"."]})]},e.id))]}),"PENDING_REVIEW"===e.status&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-th-text-primary",children:[(0,s.jsx)("input",{type:"checkbox",checked:S[e.id]||!1,onChange:t=>C(a=>({...a,[e.id]:t.target.checked}))}),"I checked every claim, its period/basis, and the exact copy against the sources."]}),(0,s.jsx)("input",{className:"".concat(n," w-full"),"aria-label":"Review note",maxLength:1e3,value:k[e.id]||"",onChange:t=>_(a=>({...a,[e.id]:t.target.value})),placeholder:"Acceptance rationale or specific rejection feedback"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{className:i,disabled:F||!S[e.id]||!(null==(r=k[e.id])?void 0:r.trim())||!e.validation.ok,onClick:()=>void G(e,"approve"),children:"Approve exact copy"}),(0,s.jsx)("button",{className:i,disabled:F||!(null==(l=k[e.id])?void 0:l.trim()),onClick:()=>void G(e,"reject"),children:"Reject with feedback"})]})]}),"APPROVED"===e.status&&(0,s.jsx)("button",{className:i,disabled:F,onClick:()=>void G(e,"revoke"),children:"Revoke unsent approval"}),e.post_id&&(0,s.jsx)("a",{className:"text-sm text-th-text-primary underline",href:"https://x.com/i/status/".concat(e.post_id),target:"_blank",rel:"noreferrer",children:"View confirmed publication"}),"AMBIGUOUS"===e.dispatch_status&&(0,s.jsx)("p",{className:"text-sm text-th-text-primary",children:"Send outcome is uncertain. Do not repost; inspect the account and reconcile the dispatch."}),"AMBIGUOUS"===e.dispatch_status&&(0,s.jsx)("button",{className:i,disabled:F,onClick:()=>void q({action:"reconcile",dispatchId:e.dispatch_id}),children:"Request another bounded reconciliation check"})]},e.id)})]}),(null==b?void 0:b.initialized)&&(0,s.jsxs)("section",{className:"space-y-3 rounded border border-th-gray-800 p-4",children:[(0,s.jsx)("h2",{className:"font-semibold text-th-text-primary",children:"Controlled learning"}),(0,s.jsx)("p",{className:"text-sm text-th-text-secondary",children:"After the baseline and draft review, authorize a text pilot. A candidate must succeed in a separate confirmation cohort before its opening rule can be adopted for that format."}),!(null==(p=b.account)?void 0:p.publish_authorized)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("input",{className:"".concat(n," w-full"),"aria-label":"Verified scripts revision",placeholder:"Verified scripts-service commit (40 characters)",maxLength:40,value:z,onChange:e=>E(e.target.value)}),(0,s.jsxs)("label",{className:"flex gap-2 text-sm text-th-text-primary",children:[(0,s.jsx)("input",{type:"checkbox",checked:U,onChange:e=>D(e.target.checked)}),"I verified deployment, copy fixes, budgets, and pilot readiness."]}),(0,s.jsx)("button",{className:i,disabled:F||!U||!(null==(x=b.reports)?void 0:x[0])||40!==z.length,onClick:()=>{var e,t;q({action:"authorize_pilot",reportId:null==(t=b.reports)||null==(e=t[0])?void 0:e.id,copyRevision:z,readinessReviewed:U})},children:"Authorize reviewed text pilot"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("select",{className:n,"aria-label":"Experimental format",value:A,onChange:e=>I(e.target.value),children:[(0,s.jsx)("option",{value:"what_changed",children:"What changed"}),(0,s.jsx)("option",{value:"countercase",children:"Countercase"}),(0,s.jsx)("option",{value:"post_mortem",children:"Post-mortem"})]}),(0,s.jsx)("input",{className:n,"aria-label":"Prospective experiment start UTC",placeholder:"Start: 2026-10-12T14:00:00Z",value:R,onChange:e=>P(e.target.value)}),(0,s.jsx)("button",{className:i,disabled:F||!(null==(m=b.account)?void 0:m.publish_authorized)||!R,onClick:()=>void q({action:"create_experiment",format:A,start:R}),children:"Freeze 28-day experiment"})]}),null==(v=b.experiments)?void 0:v.map(e=>{var t,a,r;return(0,s.jsxs)("div",{className:"space-y-2 border-t border-th-gray-800 pt-3 text-sm text-th-text-primary",children:[(0,s.jsxs)("p",{children:[e.protocol.format," \xb7 ",e.starts_at.slice(0,10)," – ",e.ends_at.slice(0,10)," \xb7 ",(null==(t=e.report)?void 0:t.status)||e.state]}),e.report&&(0,s.jsxs)("details",{children:[(0,s.jsx)("summary",{children:"Frozen results, uncertainty and guardrails"}),(0,s.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(e.report,null,2)})]}),(null==(a=e.report)?void 0:a.candidate)&&!e.parent_id&&(0,s.jsx)("button",{className:i,disabled:F||!R,onClick:()=>void q({action:"create_experiment",format:e.protocol.format,start:R,parentId:e.id}),children:"Start separate confirmation at entered date"}),(null==(r=e.report)?void 0:r.candidate)&&e.parent_id&&"EVALUATED"===e.state&&(0,s.jsx)("button",{className:i,disabled:F,onClick:()=>void q({action:"adopt",experimentId:e.id}),children:"Adopt confirmed rule for this format"})]},e.id)})]}),(0,s.jsxs)("details",{className:"text-sm text-th-text-secondary",children:[(0,s.jsx)("summary",{children:"Latest operations and reserved spend"}),null==b||null==(j=b.runs)?void 0:j.map(e=>{var t,a,r;return(0,s.jsxs)("div",{className:"my-2 space-y-2",children:[(0,s.jsxs)("p",{children:[e.created_at," \xb7 ",e.kind," \xb7 ",e.status," \xb7 reserved $",e.reserved_usd,"; actual ",null==e.actual_usd?"unknown; ceiling retained":"$".concat(e.actual_usd)]}),(null==(t=e.result)?void 0:t.reason)&&(0,s.jsx)("p",{children:e.result.reason}),"UNKNOWN"===e.status&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("input",{className:n,"aria-label":"Verified provider charge in USD",placeholder:"Verified charge in USD",value:L[e.id]||"",onChange:t=>O(a=>({...a,[e.id]:t.target.value}))}),(0,s.jsx)("input",{className:n,"aria-label":"Provider receipt reference",placeholder:"Provider receipt/reference, not credentials",value:V[e.id]||"",maxLength:1e3,onChange:t=>M(a=>({...a,[e.id]:t.target.value}))}),(0,s.jsx)("button",{className:i,disabled:F||!(null==(a=L[e.id])?void 0:a.trim())||!(null==(r=V[e.id])?void 0:r.trim()),onClick:()=>void q({action:"reconcile_cost",runId:e.id,actualUsd:Number(L[e.id]),receipt:V[e.
1id]}),children:"Record verified charge"})]})]},e.id)})]})]})}}},e=>{e.O(0,[8441,4696,7358],()=>e(e.s=8654)),_N_E=e.O()}]);

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.