Login
What would you like to create? I'll ask a few questions to make sure I build exactly what you want.

Content Publisher

Bring your content. Compose with AI. Sign with truth tiers. Publish with proof.

`; const blob = new Blob([html], {type: 'text/html'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = title.replace(/[^a-z0-9]/gi, '_') + '_composed.html'; a.click(); URL.revokeObjectURL(url); stat('Composed and exported'); } // ── Share ────────────────────────────── function doShare(){const t=encodeURIComponent(document.getElementById('title').value||'');window.open(`https://twitter.com/intent/tweet?text=${t}`,'_blank');} // ── Preview ─────────────────────────── function doPreview(){ const body=document.getElementById('preview-body');let h=''; document.querySelectorAll('#inner .blk').forEach(el=>{ const ce=el.querySelector('[contenteditable]'); if(el.classList.contains('h1'))h+=`

${ce?ce.textContent:''}

`; else if(el.classList.contains('blk-text')&&!el.classList.contains('h1'))h+=`

${ce?ce.textContent:''}

`; else if(el.classList.contains('blk-code')){const pre=el.querySelector('pre');const out=el.querySelector('.code-out');h+=`
${pre?pre.textContent:''}
`;if(out&&out.style.display!=='none')h+=`
${out.textContent}
`;} else if(el.classList.contains('blk-yt')){const iframe=el.querySelector('iframe');if(iframe)h+=`
${iframe.outerHTML}
`;} else if(el.classList.contains('blk-img')){const img=el.querySelector('img');if(img)h+=`
${img.alt||'Document image'}
`;} else if(el.classList.contains('blk-stage')){h+=`
${ce?ce.textContent:''}
`;} else if(el.classList.contains('blk-chart'))h+=el.innerHTML; else if(el.classList.contains('blk-div'))h+='
'; }); document.getElementById('preview-body').innerHTML=h; document.getElementById('preview').classList.add('open'); } function closePreview(){document.getElementById('preview').classList.remove('open');} // ── Keyboard ────────────────────────── document.getElementById('chat-in').onkeydown=e=>{if(e.key==='Enter'){e.preventDefault();sendChat();}}; document.onkeydown=e=>{if(e.key==='Escape')closePreview();}; // ── Schedule ────────────────────────── function doSchedule(){ if(!curDoc){stat('Save first');return;} const dt=prompt('Schedule for (ISO date, e.g. 2026-04-01T12:00:00Z):'); if(!dt)return; api('POST','/api/human/schedule',{doc_id:curDoc.doc_id,channels:['x','linkedin'],send_at:dt}) .then(d=>{if(d.id)stat('Scheduled: '+d.id);else stat('Schedule failed');}).catch(e=>stat('Error: '+e.message)); } // ── Publish (Living URL) ───────────── async function doPublish(){ if(!curDoc){stat('Save first');return;} const done = _btnLoading('.hbtn.publish', 'Publishing...'); try{ const d=await api('POST','/api/human/publish',{doc_id:curDoc.doc_id}); if(d.url){ const fullUrl=window.location.origin+d.url; await navigator.clipboard.writeText(fullUrl); stat('Published! Link copied: '+fullUrl); appendChat('ai','Your document is live at: '+fullUrl); }else if(d.live_url){ await navigator.clipboard.writeText(d.live_url); stat('Published! Link copied.'); }else{ stat('Published'); } }catch(e){stat('Publish failed: '+e.message);} done(); } // ── Auth UI ────────────────────────── function showAuth(){document.getElementById('auth-modal').classList.add('open');} function hideAuth(){document.getElementById('auth-modal').classList.remove('open');} function updateAuthUI(){ const el=document.getElementById('user-indicator'); if(window.authManager&&window.authManager.isLoggedIn()){ const u=window.authManager.getUser(); el.innerHTML=''+(u?u.display_name:'User')+' Logout'; } else { el.innerHTML='Login'; } } async function doAuthSubmit(){ const mode=document.getElementById('auth-mode').value; const user=document.getElementById('auth-user').value; const pass=document.getElementById('auth-pass').value; const err=document.getElementById('auth-error'); try{ if(mode==='register')await window.authManager.register(user,pass); else await window.authManager.login(user,pass); hideAuth();updateAuthUI();refreshDocs(); }catch(e){err.textContent=e.message;} } function doLogout(){if(window.authManager)window.authManager.logout();updateAuthUI();refreshDocs();} function toggleAuthMode(){ const m=document.getElementById('auth-mode'); const btn=document.getElementById('auth-submit-btn'); if(m.value==='login'){m.value='register';btn.textContent='Register';} else{m.value='login';btn.textContent='Login';} } // ── Authorship & Trajectory ────────── async function showAuthorship() { if (!curDoc) { stat('Open a document first'); return; } try { const d = await api('GET', `/api/human/authorship/${curDoc.doc_id}`); const badge = document.getElementById('authorshipBadge'); const pct = Math.round((d.human_probability || 0) * 100); const color = pct >= 60 ? '#16A34A' : pct >= 35 ? '#F59E0B' : '#EF4444'; badge.textContent = `${pct}% human`; badge.style.display = 'inline-block'; badge.style.background = color + '15'; badge.style.color = color; badge.style.border = `1px solid ${color}40`; // Show detail in a simple overlay const signals = d.signals || {}; let html = `

Human Authorship Analysis

${pct}%
${d.label || ''}
${d.reasoning || ''}
Edit Pattern
Revisions${signals.version_count || 0}
Changed direction while editing${signals.gravity_bouncing ? 'Yes' : 'No'}
Restructured between versions${signals.cosine_variance > 0.001 ? 'Yes' : 'No'}
Mixed editing patterns${signals.trend_entropy >= 0.5 ? 'Yes' : signals.trend_entropy > 0 ? 'Some' : 'No'}
Uncertainty while editing${signals.confidence_shifting ? 'Yes' : 'No'}
${d.trajectory && d.trajectory.versions && d.trajectory.versions.length > 1 ? `
Quality Over Time
${d.trajectory.versions.map(v => { const g = v.gravity || 0; const h = Math.max(8, Math.min(48, Math.round((12 - g) / 12 * 48))); const c = g < 3 ? '#16A34A' : g < 5 ? '#F59E0B' : '#EF4444'; return '
'; }).join('')}
${d.trajectory.versions.map(v => '
v' + v.version + '
').join('')}
` : ''}
`; document.body.insertAdjacentHTML('beforeend', html); stat(`Authorship: ${pct}% human — ${d.label}`); } catch (e) { stat('Authorship check failed: ' + e.message); } } // Update authorship badge when doc loads const _origLoadDoc = loadDoc; loadDoc = async function(id) { await _origLoadDoc(id); try { const d = await api('GET', `/api/human/authorship/${id}`); const badge = document.getElementById('authorshipBadge'); const pct = Math.round((d.human_probability || 0) * 100); const color = pct >= 60 ? '#16A34A' : pct >= 35 ? '#F59E0B' : '#EF4444'; badge.textContent = `${pct}% human`; badge.style.display = 'inline-block'; badge.style.background = color + '15'; badge.style.color = color; } catch { document.getElementById('authorshipBadge').style.display = 'none'; } }; // ── Init ────────────────────────────── refreshDocs(); if(window.authManager)updateAuthUI(); if(window.realtimeManager)window.realtimeManager.connect();

SovrenAI — Sign In