santriverse-skills 0.3.6 → 0.3.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "santriverse-skills",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "One-command installer that connects Santriverse skill repositories (Apps Script + Monorepo guidelines) to Google Antigravity as Agent Skills or an MCP server.",
5
5
  "bin": {
6
6
  "santriverse-skills": "bin/cli.js"
@@ -474,17 +474,38 @@ async function checkUpdate(){try{updateInfo=await getJson('/api/update');const b
474
474
  function openUpdate(){if(!updateInfo)return;const self=selfUpdate();
475
475
  $('#update-current').textContent='v'+updateInfo.current;$('#update-latest').textContent='v'+updateInfo.latest;
476
476
  $('#update-notes').href=updateInfo.releaseUrl;$('#update-command').textContent=updateInfo.command;$('#update-feedback').textContent='';
477
- show($('#update-self'),self);show($('#update-manual'),!self);show($('#update-now'),self);$('#update-now').disabled=false;$('#update-now').textContent='Update sekarang';
477
+ show($('#update-self'),self);show($('#update-manual'),!self);show($('#update-now'),self);$('#update-now').disabled=false;$('#update-now').textContent='Update sekarang';show($('#update-progress'),false);
478
478
  updateDialog.showModal()}
479
479
  $('#update-btn').onclick=openUpdate;
480
480
  $('#update-close').onclick=()=>updateDialog.close();
481
481
  $('#update-copy').onclick=async()=>{try{await navigator.clipboard.writeText(updateInfo.command);done('✓ Perintah update disalin.')}catch{fail(new Error('Clipboard tidak tersedia. Salin perintah secara manual.'))}};
482
- $('#update-now').onclick=async()=>{const btn=$('#update-now'),fb=$('#update-feedback');btn.disabled=true;btn.textContent='Mengunduh…';
483
- fb.textContent='Mengunduh installer resmi v'+updateInfo.latest+' dan memeriksa SHA-256…';
482
+ // Progress: the POST below runs the whole download; /__santrihub/update/status reports where it is.
483
+ // Steps: 0 Unduh (check, sums, download) · 1 Cek SHA-256 · 2 Pasang · 3 Buka ulang.
484
+ const UPDATE_STEP={check:0,sums:0,download:0,verify:1,install:2,restart:3};
485
+ let updateRunning=false,updateSpeed=null;
486
+ const mb=n=>(n/1048576).toLocaleString('id-ID',{minimumFractionDigits:1,maximumFractionDigits:1});
487
+ function renderUpdateProgress(s){const v='v'+(s.version||updateInfo?.latest||''),step=UPDATE_STEP[s.stage]??0,frac=s.total?Math.min(1,s.received/s.total):0;
488
+ let pct={check:1,sums:3,verify:90,install:95,restart:100}[s.stage]??0,text='Menyiapkan…';
489
+ if(s.stage==='check')text='Memeriksa versi terbaru…';
490
+ if(s.stage==='sums')text='Mengambil daftar checksum resmi…';
491
+ if(s.stage==='download'){pct=3+Math.round(frac*84);const now=performance.now();
492
+ if(updateSpeed&&now>updateSpeed.at){const rate=(s.received-updateSpeed.received)/((now-updateSpeed.at)/1000);updateSpeed.rate=updateSpeed.rate?updateSpeed.rate*.7+rate*.3:rate}
493
+ updateSpeed={at:now,received:s.received,rate:updateSpeed?.rate||0};
494
+ text=`Mengunduh installer ${v} · ${mb(s.received)}${s.total?' / '+mb(s.total):''} MB${updateSpeed.rate>0?' · '+mb(updateSpeed.rate)+' MB/s':''}`}
495
+ if(s.stage==='verify')text='Mencocokkan SHA-256 installer dengan rilis resmi…';
496
+ if(s.stage==='install')text='Installer terverifikasi. Menyiapkan pemasangan…';
497
+ if(s.stage==='restart')text=`SantriHub akan tertutup sebentar, memasang ${v}, lalu terbuka lagi sendiri.`;
498
+ const prog=$('#update-progress');show(prog,true);prog.classList.toggle('waiting',s.stage==='download'&&!s.total||s.stage==='check'||s.stage==='sums');prog.classList.toggle('finishing',s.stage==='restart');
499
+ $('#update-bar-fill').style.width=pct+'%';$('#update-bar').setAttribute('aria-valuenow',String(pct));$('#update-pct').textContent=pct+'%';$('#update-stage').textContent=text;
500
+ $$('[data-update-step]').forEach(li=>{const i=Number(li.dataset.updateStep);li.className=i<step?'done':i===step?'active':''})}
501
+ async function pollUpdate(){try{const s=await getJson('/__santrihub/update/status');if(updateRunning&&s.stage!=='idle'&&s.stage!=='error')renderUpdateProgress(s)}catch{/* app closing */}}
502
+ updateDialog.addEventListener('cancel',e=>{if(updateRunning)e.preventDefault()});
503
+ $('#update-now').onclick=async()=>{const btn=$('#update-now'),fb=$('#update-feedback');btn.disabled=true;btn.textContent='Memperbarui…';$('#update-close').disabled=true;
504
+ fb.textContent='';updateRunning=true;updateSpeed=null;renderUpdateProgress({stage:'check'});const timer=setInterval(pollUpdate,350);
484
505
  try{const res=await fetch('/__santrihub/update',{method:'POST',headers:{'Content-Type':'application/json'},body:'{}'});const data=await res.json().catch(()=>({}));
485
506
  if(!res.ok)throw new Error(data.error||'Pembaruan gagal ('+res.status+').');
486
- btn.textContent='Memasang…';fb.textContent='Installer terverifikasi. SantriHub ditutup sebentar lalu terbuka lagi di v'+(data.version||updateInfo.latest)+'.';log('Pembaruan ke v'+(data.version||updateInfo.latest)+' dimulai.')}
487
- catch(e){btn.disabled=false;btn.textContent='Coba lagi';fb.textContent=e.message;fail(e)}};
507
+ clearInterval(timer);renderUpdateProgress({stage:'restart',version:data.version||updateInfo.latest});btn.textContent='Membuka ulang…';log('Pembaruan ke v'+(data.version||updateInfo.latest)+' dimulai.')}
508
+ catch(e){clearInterval(timer);updateRunning=false;show($('#update-progress'),false);$('#update-close').disabled=false;btn.disabled=false;btn.textContent='Coba lagi';fb.textContent=e.message;fail(e)}};
488
509
  checkUpdate();
489
510
 
490
511
  // ─ Navigation ─
@@ -669,7 +690,7 @@ function checkControls(){
669
690
  }
670
691
  async function showCheck(){
671
692
  if($('#check-panel').open)return;stopCheckPoll();const epoch=++checkEpoch;checkBusy=true;checkInventory=null;checkVerified=false;checkRequest=new AbortController();const signal=checkRequest.signal;
672
- $('#check-summary').textContent='Memeriksa file dan konfigurasi global…';$('#check-results').innerHTML='';$('#check-counts').textContent='';$('#check-targets').textContent='';$('#check-proof').textContent='Belum ada callback.';$('#check-proof').classList.remove('proof-ok');$('#control-feedback').textContent='';show($('#force-antigravity'),false);show($('#check-retry'),false);$('#check-panel').showModal();checkState(0,false);
693
+ $('#check-summary').textContent='Memeriksa file dan konfigurasi global…';$('#check-results').innerHTML='';$('#check-counts').textContent='';$('#check-targets').textContent='';$('#check-proof').textContent='Belum ada callback.';$('#check-proof').classList.remove('proof-ok');proofLine('proof-mcp',false);proofLine('proof-skill',false);show($('#check-skill-list'),false);$('#check-outcome').classList.remove('proof-ok');$('#control-feedback').textContent='';show($('#force-antigravity'),false);show($('#check-retry'),false);$('#check-panel').showModal();checkState(0,false);
673
694
  try{const r=await post('/api/verify',{scope:'global',skillIds:[...selectedSkills]},signal);if(epoch===checkEpoch&&$('#check-panel').open){checkInventory=r;renderCheck(r)}}catch(e){if(epoch===checkEpoch&&e.name!=='AbortError')$('#check-summary').textContent='Pemeriksaan gagal: '+e.message}finally{if(epoch===checkEpoch){checkBusy=false;checkRequest=null;checkControls()}}
674
695
  }
675
696
  $('#check-test').onclick=showCheck;
@@ -689,25 +710,36 @@ async function pollCheckProof(epoch=checkPollEpoch){
689
710
  if(!$('#check-panel').open||checkStep!==1||epoch!==checkPollEpoch)return;
690
711
  try{checkRequest=new AbortController();const proof=await getJson('/api/verification/status',checkRequest.signal);if(epoch!==checkPollEpoch||!$('#check-panel').open||checkStep!==1)return;checkRequest=null;
691
712
  checkVerified=proof.verified===true&&proof.evidence?.server==='santri-skills'&&proof.evidence?.level==='bridge-mcp-loaded'&&proof.evidence?.source==='local-capability-callback';
692
- if(checkVerified){$('#check-proof').textContent='Callback asli diterima · bridge MCP santri-skills saja. Identitas client tidak diautentikasi; MCP lain dan Skills belum terbukti dimuat IDE.';$('#check-proof').classList.add('proof-ok');$('#check-outcome').textContent=$('#check-proof').textContent;checkState(2);return}
693
- $('#check-proof').textContent=proof.pending?'Menunggu callback asli bridge MCP santri-skills. '+(proof.expiresAt?'Batas server: '+new Date(proof.expiresAt).toLocaleTimeString()+'.':''):'Callback kedaluwarsa atau konfigurasi berubah. Belum terverifikasi; coba lagi.';
713
+ const skill=proof.skillProof?.verified===true;proofLine('proof-mcp',checkVerified);proofLine('proof-skill',skill);
714
+ if(skill){renderSkillProof(proof.skillProof);checkState(2);return}
715
+ if(checkVerified){$('#check-proof').textContent='Callback asli diterima · bridge MCP santri-skills tersambung. Menunggu kode dari skill santrihub-cek: tempel kalimat di langkah 3 ke chat Agent baru.';$('#check-proof').classList.add('proof-ok');$('#check-finish').textContent='Lihat hasil (MCP saja)'}
716
+ else $('#check-proof').textContent=proof.pending?'Menunggu callback asli bridge MCP santri-skills. '+(proof.expiresAt?'Batas server: '+new Date(proof.expiresAt).toLocaleTimeString()+'.':''):'Callback kedaluwarsa atau konfigurasi berubah. Belum terverifikasi; coba lagi.';
694
717
  show($('#check-retry'),!proof.pending);if(!proof.pending)return;
695
718
  }catch(e){if(epoch!==checkPollEpoch||e.name==='AbortError')return;checkRequest=null;$('#check-proof').textContent='Tes gagal: '+e.message;show($('#check-retry'));return}
696
719
  checkTimer=setTimeout(()=>pollCheckProof(epoch),1500);
697
720
  }
721
+ function proofLine(id,ok){const el=$('#'+id);el.classList.toggle('ok',ok);el.querySelector('b').textContent=ok?'✓ terbukti':'menunggu'}
722
+ const BRIDGE_ONLY='Callback asli diterima · bridge MCP santri-skills saja. Identitas client tidak diautentikasi; MCP lain dan Skills belum terbukti dimuat IDE.';
723
+ function renderSkillProof(p){const all=p.seen.length+p.notSeen.length;
724
+ $('#check-summary').textContent='Global semua workspace · Skill dimuat TERBUKTI lewat kode cek santrihub-cek. Identitas client tidak diautentikasi.';$('#check-outcome').classList.add('proof-ok');
725
+ $('#check-outcome').textContent=`Skill dimuat · TERBUKTI. Agent membaca kode dari skill santrihub-cek di sesi ini dan mengirimnya lewat MCP santri-skills. ${p.seen.length} dari ${all} skill terpasang disebut agent. Identitas client tidak diautentikasi.`;
726
+ const box=$('#check-skill-list'),row=(id,ok)=>{const li=el('li',ok?'ok':'warn');li.append(el('span','pill '+(ok?'ok':'warn'),ok?'DISEBUT':'TIDAK DISEBUT'),el('span',null,id));return li};
727
+ const list=el('ul');list.append(...p.seen.map(id=>row(id,true)),...p.notSeen.map(id=>row(id,false)));
728
+ box.replaceChildren(el('strong',null,'Skill yang dilaporkan agent'),list,el('small','muted',p.notSeen.length?'Tidak disebut belum tentu gagal: agent bisa merangkum. Tanyakan langsung di chat, misalnya "Gunakan skill <nama>".':'Semua skill di folder global disebut agent.'));show(box,all>0)}
698
729
  async function startCheckProof(){
699
730
  if(checkBusy||checkStep!==1||!$('#check-panel').open||$('#check-start').disabled)return;stopCheckPoll();const epoch=checkEpoch,pollEpoch=checkPollEpoch;checkBusy=true;checkVerified=false;checkRequest=new AbortController();const signal=checkRequest.signal;show($('#check-retry'),false);$('#check-proof').textContent='Menyiapkan callback bridge…';checkControls();
700
- try{await post('/api/verification/start',{scope:'global'},signal);if(epoch===checkEpoch&&pollEpoch===checkPollEpoch)await pollCheckProof(pollEpoch)}catch(e){if(epoch===checkEpoch&&e.name!=='AbortError'){$('#check-proof').textContent='Tes gagal: '+e.message;show($('#check-retry'))}}finally{if(epoch===checkEpoch){checkBusy=false;checkControls()}}
731
+ try{const r=await post('/api/verification/start',{scope:'global'},signal);if(r.prompt)$('#proof-prompt').textContent=r.prompt;proofLine('proof-mcp',false);proofLine('proof-skill',false);$('#check-finish').textContent='Tutup tanpa verifikasi';if(epoch===checkEpoch&&pollEpoch===checkPollEpoch)await pollCheckProof(pollEpoch)}catch(e){if(epoch===checkEpoch&&e.name!=='AbortError'){$('#check-proof').textContent='Tes gagal: '+e.message;show($('#check-retry'))}}finally{if(epoch===checkEpoch){checkBusy=false;checkControls()}}
701
732
  }
733
+ $('#copy-proof-prompt').onclick=e=>copyText($('#proof-prompt').textContent,e.currentTarget);
702
734
  $('#check-start').onclick=startCheckProof;$('#check-retry').onclick=startCheckProof;
703
735
  $('#check-back').onclick=()=>{if(checkBusy)return;stopCheckPoll();checkVerified=false;checkState(0)};
704
- $('#check-finish').onclick=()=>{if(checkBusy)return;if(checkStep===0){checkState(1);return}if(checkStep===1){stopCheckPoll();status('Tes ditutup tanpa verifikasi; belum ada callback asli.',true);closeCheck();return}closeCheck()};
736
+ $('#check-finish').onclick=()=>{if(checkBusy)return;if(checkStep===0){checkState(1);return}if(checkStep===1){stopCheckPoll();if(checkVerified){$('#check-outcome').textContent=BRIDGE_ONLY;$('#check-outcome').classList.remove('proof-ok');show($('#check-skill-list'),false);checkState(2);return}status('Tes ditutup tanpa verifikasi; belum ada callback asli.',true);closeCheck();return}closeCheck()};
705
737
  $('#close-check').onclick=closeCheck;
706
738
  $('#check-panel').addEventListener('cancel',e=>{e.preventDefault();closeCheck()});
707
739
  $('#check-panel').addEventListener('close',()=>{stopCheckPoll();checkEpoch++;checkBusy=false;setTimeout(()=>{if(!$('#locked').open&&!document.querySelector('dialog[open]'))$('#check-test').focus()})});
708
740
  async function checkControl(action,force=false){
709
741
  if(checkBusy||!$('#check-panel').open||checkStep!==1)return;const epoch=checkEpoch;checkBusy=true;checkControls();
710
- try{await post('/api/antigravity/control',action==='launch'?{action}:{action,confirmClose:true,force,confirmForce:force});if(epoch===checkEpoch){show($('#force-antigravity'),false);$('#control-feedback').textContent=action==='launch'?'Permintaan buka dikirim. Ini bukan bukti callback.':'Restart selesai. Panggil santrihub_status; restart bukan bukti callback.'}}catch(e){if(epoch===checkEpoch){if(!force&&e.forceRequired)show($('#force-antigravity'));$('#control-feedback').textContent=e.message;fail(e)}}finally{if(epoch===checkEpoch){checkBusy=false;checkControls()}}
742
+ try{await post('/api/antigravity/control',action==='launch'?{action}:{action,confirmClose:true,force,confirmForce:force});if(epoch===checkEpoch){show($('#force-antigravity'),false);$('#control-feedback').textContent=action==='launch'?'Permintaan buka dikirim. Ini bukan bukti callback.':'Restart selesai. Buka chat Agent baru, lalu tempel kalimat di langkah 3. Restart sendiri bukan bukti.'}}catch(e){if(epoch===checkEpoch){if(!force&&e.forceRequired)show($('#force-antigravity'));$('#control-feedback').textContent=e.message;fail(e)}}finally{if(epoch===checkEpoch){checkBusy=false;checkControls()}}
711
743
  }
712
744
  $('#open-antigravity').onclick=()=>checkControl('launch');
713
745
  $('#restart-antigravity').onclick=()=>{if(checkBusy||!$('#check-panel').open)return;$('#restart-confirm').returnValue='cancel';$('#restart-confirm').showModal()};
package/src/dashboard.css CHANGED
@@ -1071,3 +1071,53 @@ body { font-size: 16px; line-height: 1.6; }
1071
1071
  .scope-toggle span { display: none; }
1072
1072
  .header-actions { gap: 6px; }
1073
1073
  }
1074
+
1075
+ /* ── Pembaruan: steps + progress bar while the installer downloads, verifies and installs ── */
1076
+ .update-progress { display: grid; gap: 10px; margin-top: 16px; padding: 14px; border: 1px solid rgb(var(--line)); border-radius: var(--r-md); background: rgb(var(--canvas) / .6); }
1077
+ .update-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
1078
+ .update-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; color: rgb(var(--muted)); font-size: 11px; font-weight: 600; text-align: center; }
1079
+ .update-steps li::before { content: ""; display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid rgb(var(--line)); border-radius: 999px; background: rgb(var(--panel)); color: #fff; font-size: 12px; font-weight: 700; z-index: 1; box-sizing: border-box; }
1080
+ .update-steps li:not(:last-child)::after { content: ""; position: absolute; top: 10px; left: calc(50% + 13px); right: calc(-50% + 13px); height: 2px; border-radius: 2px; background: rgb(var(--line)); transition: background .3s ease; }
1081
+ .update-steps li.done { color: rgb(var(--ink)); }
1082
+ .update-steps li.done::before { content: "✓"; border-color: #8b5cf6; background: #8b5cf6; }
1083
+ .update-steps li.done::after { background: #8b5cf6; }
1084
+ .update-steps li.active { color: rgb(var(--ink)); }
1085
+ .update-steps li.active::before { border-color: #8b5cf6 rgb(var(--line)) rgb(var(--line)) rgb(var(--line)); animation: update-spin .8s linear infinite; }
1086
+ .update-bar { position: relative; height: 8px; overflow: hidden; border-radius: 999px; background: rgb(var(--line) / .7); }
1087
+ .update-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #7c3aed, #a78bfa); transition: width .35s ease; overflow: hidden; }
1088
+ .update-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .35), transparent); transform: translateX(-100%); animation: update-shine 1.3s ease-in-out infinite; }
1089
+ .update-progress.waiting .update-bar i { width: 30% !important; animation: update-slide 1.2s ease-in-out infinite; }
1090
+ .update-progress.finishing .update-bar i { background: linear-gradient(90deg, #7c3aed, #34d399); }
1091
+ .update-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: rgb(var(--muted)); font-size: var(--fs-xs); line-height: 1.5; }
1092
+ .update-meta b { flex: none; color: rgb(var(--ink)); font-variant-numeric: tabular-nums; }
1093
+ @keyframes update-spin { to { transform: rotate(360deg); } }
1094
+ @keyframes update-shine { to { transform: translateX(100%); } }
1095
+ @keyframes update-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
1096
+ @media (prefers-reduced-motion: reduce) { .update-steps li.active::before, .update-bar i::after, .update-progress.waiting .update-bar i { animation: none; } .update-bar i { transition: none; } }
1097
+
1098
+ /* ── Cek & Tes · bukti skill: three numbered steps, two live indicators, per-skill result ── */
1099
+ .proof-lead { color: rgb(var(--muted)); font-size: var(--fs-sm); line-height: 1.6; }
1100
+ .proof-steps { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: proof; }
1101
+ .proof-steps > li { display: grid; gap: 10px; padding: 14px 14px 14px 52px; position: relative; border: 1px solid rgb(var(--line)); border-radius: var(--r-md); background: rgb(var(--canvas) / .45); counter-increment: proof; }
1102
+ .proof-steps > li::before { content: counter(proof); position: absolute; left: 14px; top: 14px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: rgb(var(--accent)); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
1103
+ .proof-step-head { display: grid; gap: 2px; }
1104
+ .proof-step-head b { font-size: var(--fs-md); }
1105
+ .proof-step-head span { color: rgb(var(--muted)); font-size: var(--fs-xs); line-height: 1.5; }
1106
+ .proof-steps .check-actions { margin: 0; }
1107
+ .proof-steps #control-feedback { margin: 0; color: rgb(var(--muted)); font-size: var(--fs-xs); }
1108
+ .proof-steps #control-feedback:empty { display: none; }
1109
+ .proof-steps .copy-example { margin: 0; }
1110
+ .proof-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
1111
+ .proof-line { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid rgb(var(--line)); border-radius: 999px; color: rgb(var(--muted)); font-size: var(--fs-xs); }
1112
+ .proof-line b { color: rgb(var(--muted)); font-weight: 600; }
1113
+ .proof-line:not(.ok)::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: rgb(var(--muted) / .6); animation: proof-wait 1.2s ease-in-out infinite; }
1114
+ .proof-line.ok { border-color: rgb(var(--ok) / .5); color: rgb(var(--ink)); }
1115
+ .proof-line.ok b { color: rgb(var(--ok)); }
1116
+ .proof-about { margin-top: 12px; color: rgb(var(--muted)); font-size: var(--fs-xs); }
1117
+ .proof-about summary { cursor: pointer; font-weight: 600; }
1118
+ .proof-about p { margin-top: 6px; line-height: 1.6; }
1119
+ .proof-skills { display: grid; gap: 8px; margin-top: 14px; }
1120
+ .proof-skills ul { display: grid; gap: 4px; max-height: 260px; margin: 0; padding: 0; overflow: auto; list-style: none; }
1121
+ .proof-skills li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); background: rgb(var(--canvas) / .5); font-size: var(--fs-sm); overflow-wrap: anywhere; }
1122
+ @keyframes proof-wait { 50% { opacity: .3; } }
1123
+ @media (prefers-reduced-motion: reduce) { .proof-line:not(.ok)::before { animation: none; } }
@@ -109,12 +109,18 @@ https://mcp.example.com/mcp'></textarea><p class="note">API key di <code>env</co
109
109
  <ol class="check-stepper wizard-stepper" aria-label="Tahap Cek dan Tes"><li aria-current="step"><b class="check-circle">1</b><span>Inventaris</span></li><li><b class="check-circle">2</b><span>Callback</span></li><li><b class="check-circle">3</b><span>Hasil</span></li></ol>
110
110
  <div class="check-body wizard-body"><h3 id="check-stage" tabindex="-1">Inventaris</h3><p id="check-summary" role="status" aria-live="polite">Memeriksa file dan konfigurasi global&hellip;</p>
111
111
  <div id="check-inventory"><div id="check-counts" class="status-counts"></div><div id="check-results" class="check-accordions"></div><details class="check-accordion"><summary>Target global &middot; semua workspace</summary><div id="check-targets" class="wizard-detail-content"></div></details><p id="check-bridge">Bridge MCP santri-skills wajib terpasang pada scope global sebelum tes callback.</p></div>
112
- <div id="check-callback" hidden><p>Callback hanya membuktikan bridge MCP santri-skills berjalan; identitas client tidak diautentikasi. Bukan bukti identitas Antigravity, MCP lain, atau Skills dimuat IDE.</p><p>Di chat IDE, panggil tool MCP <code>santrihub_status</code> dari server <code>santri-skills</code>. Tunggu callback asli; jawaban teks bukan bukti.</p><p id="check-proof" class="wizard-notice" role="status" aria-live="polite">Belum ada callback.</p><div class="check-actions"><button id="check-start" type="button" class="wizard-primary">Mulai tes callback</button><button id="check-retry" type="button" class="secondary" hidden>Coba lagi</button><button id="open-antigravity" type="button" class="secondary">Buka Antigravity IDE</button><button id="restart-antigravity" type="button" class="secondary">Restart Antigravity IDE</button><button id="force-antigravity" type="button" class="secondary" hidden>Paksa Restart Antigravity IDE</button></div><p id="control-feedback" role="status" aria-live="polite"></p></div>
113
- <div id="check-result" hidden><p id="check-outcome" role="status" aria-live="polite"></p></div></div>
112
+ <div id="check-callback" hidden><p class="proof-lead">Buktikan Antigravity benar-benar memuat skill: SantriHub menaruh kode baru di skill <code>santrihub-cek</code>, lalu agent mengirim kode itu balik lewat MCP.</p>
113
+ <ol class="proof-steps"><li><div class="proof-step-head"><b>Siapkan kode cek</b><span>Membuat skill santrihub-cek berisi kode baru, berlaku 10 menit.</span></div><div class="check-actions"><button id="check-start" type="button" class="wizard-primary">Siapkan kode cek</button><button id="check-retry" type="button" class="secondary" hidden>Buat kode baru</button></div></li>
114
+ <li><div class="proof-step-head"><b>Restart Antigravity</b><span>Skill dibaca saat sesi baru dimulai. Simpan pekerjaan Anda dulu.</span></div><div class="check-actions"><button id="restart-antigravity" type="button" class="secondary">Restart Antigravity IDE</button><button id="open-antigravity" type="button" class="secondary">Buka Antigravity IDE</button><button id="force-antigravity" type="button" class="secondary" hidden>Paksa Restart Antigravity IDE</button></div><p id="control-feedback" role="status" aria-live="polite"></p></li>
115
+ <li><div class="proof-step-head"><b>Tempel di chat Agent baru</b><span>Buka chat Agent baru di Antigravity, tempel kalimat ini, lalu kirim.</span></div><div class="copy-example"><code id="proof-prompt">Gunakan skill santrihub-cek untuk mengecek SantriHub.</code><button id="copy-proof-prompt" type="button" class="copy-btn">Salin</button></div></li></ol>
116
+ <div class="proof-status" aria-live="polite"><span id="proof-mcp" class="proof-line">MCP santri-skills <b>menunggu</b></span><span id="proof-skill" class="proof-line">Skill dimuat <b>menunggu</b></span></div>
117
+ <p id="check-proof" class="wizard-notice" role="status" aria-live="polite">Belum ada callback.</p>
118
+ <details class="proof-about"><summary>Apa yang dibuktikan?</summary><p>Kode hanya ada di file skill santrihub-cek dan berganti setiap cek. Kalau agent bisa mengirimnya balik, agent itu memuat skill dari folder global di sesi ini. Daftar skill yang disebut agent adalah laporan agent, bukan bukti per file.</p><p>Callback tanpa kode hanya membuktikan bridge MCP santri-skills berjalan; identitas client tidak diautentikasi. Untuk tes MCP saja, panggil tool <code>santrihub_status</code> di chat.</p></details></div>
119
+ <div id="check-result" hidden><p id="check-outcome" role="status" aria-live="polite"></p><div id="check-skill-list" class="proof-skills" hidden></div></div></div>
114
120
  <div class="wizard-footer"><button id="check-back" type="button" class="secondary" hidden>Kembali</button><button id="check-finish" type="button" class="wizard-primary">Tes callback</button></div>
115
121
  </dialog><dialog id="force-confirm" class="confirm-dialog" aria-labelledby="force-title"><form method="dialog"><h2 id="force-title">Paksa Restart Antigravity IDE?</h2><p><strong>Pekerjaan yang belum disimpan akan hilang permanen.</strong> Paksa berhenti memakai /F hanya untuk PID executable IDE terverifikasi. Simpan pekerjaan atau batalkan.</p><div><button value="cancel" class="secondary" autofocus>Batal</button><button value="confirm">Saya setuju kehilangan perubahan — paksa restart</button></div></form></dialog><div class="toast-region"><div id="status" class="save-toast" role="status" aria-live="polite">Memeriksa sesi…</div><progress id="progress" hidden aria-label="Operasi sedang berjalan"></progress></div></main>
116
122
  <dialog id="catalog-modal" class="catalog-modal wizard-dialog" aria-labelledby="catalog-title"><div class="wizard-header"><div><span class="wizard-badge" id="catalog-kind">SKILLS &middot; GLOBAL</span><h2 id="catalog-title">Katalog Skills</h2></div><button id="catalog-close" type="button" class="wizard-x" aria-label="Tutup katalog">&times;</button></div><div class="wizard-body"><label class="catalog-search-label" for="catalog-search">Cari di katalog</label><input id="catalog-search" type="search" placeholder="Cari nama atau deskripsi&hellip;"><div id="catalog-categories" class="catalog-categories" role="group" aria-label="Filter kategori"></div><div id="catalog-items" class="catalog-grid"></div><details id="catalog-local"><summary>Import lokal</summary><section class="panel local-import"><h2>Import Skills lokal</h2><p>Sumber berbeda dari target instalasi di atas. Scan maksimal 6 tingkat, 100 skills, 2000 entri, 8 MB. Hanya SKILL.md dan pendukung .md/.txt disalin; script, file tersembunyi, dan file sensitif dilewati.</p><div class="repo-form"><label>Folder sumber absolut<input id="local-skills-source" placeholder="C:\koleksi\skills" autocomplete="off"></label><button id="preview-local-skills">Deteksi / Preview</button></div><p id="local-skills-target" class="note"></p><div id="local-skills-results" class="list"></div><button id="install-local-skills" class="secondary" hidden>Install pilihan lokal</button><p id="local-skills-installed" class="note" aria-live="polite"></p></section><section class="panel local-import"><h2>Import MCP lokal</h2><p>Folder sumber wajib berisi mcp_config.json; atau tempel file JSON eksplisit. Hanya nama ditampilkan. Pilih entri yang dipercaya: Antigravity dapat menjalankannya setelah reload, dashboard tidak menjalankan command. Config lama dipertahankan; nama bentrok ditolak.</p><div class="repo-form"><label>Folder / file sumber absolut<input id="local-mcp-source" placeholder="C:\koleksi\mcp_config.json" autocomplete="off"></label><button id="preview-local-mcp">Deteksi / Preview</button></div><p id="local-mcp-target" class="note"></p><div id="local-mcp-results" class="list"></div><button id="install-local-mcp" class="secondary" hidden>Daftarkan pilihan lokal</button><p id="local-mcp-installed" class="note" aria-live="polite"></p></section></details></div><div id="catalog-confirm" class="catalog-confirm" role="alertdialog" aria-modal="true" aria-labelledby="catalog-confirm-title" aria-describedby="catalog-confirm-warning" hidden><div class="catalog-confirm-backdrop"></div><section id="catalog-confirm-panel" class="catalog-confirm-panel" tabindex="-1"><span id="catalog-confirm-kind" class="wizard-badge">SKILLS · GLOBAL</span><h2 id="catalog-confirm-title">Konfirmasi instalasi</h2><p id="catalog-confirm-summary"></p><ul id="catalog-confirm-items" aria-label="Item terpilih"></ul><p id="catalog-confirm-warning" class="catalog-global-warning"><strong>GLOBAL · semua workspace</strong><br>Perubahan berlaku untuk semua project Antigravity.</p><div class="catalog-confirm-actions"><button id="catalog-confirm-cancel" type="button" class="secondary">Batal</button><button id="catalog-confirm-submit" type="button" class="wizard-primary">Konfirmasi Install</button></div></section></div><div class="wizard-footer"><span id="catalog-count" role="status" aria-live="polite">0 dipilih</span><div><button id="catalog-cancel" type="button" class="wizard-text">Batal</button><button id="catalog-install" type="button" class="wizard-primary">Install terpilih (0)</button></div></div></dialog>
117
- <dialog id="update-dialog" class="update-dialog wizard-dialog" aria-labelledby="update-title"><div class="wizard-header"><div><span class="wizard-badge">PEMBARUAN</span><h2 id="update-title">SantriHub versi baru</h2></div><button id="update-close" type="button" class="wizard-x" aria-label="Tutup pembaruan">&times;</button></div><div class="wizard-body"><p class="update-versions"><span>Terpasang <b id="update-current"></b></span><span aria-hidden="true">→</span><span>Terbaru <b id="update-latest"></b></span></p><div id="update-self" hidden><p>SantriHub mengunduh installer resmi dari GitHub Releases, mencocokkan SHA-256-nya, lalu memasang dan membuka ulang aplikasi otomatis. Skill dan pengaturanmu tetap aman.</p></div><div id="update-manual" hidden><p>Tutup dashboard ini (Ctrl+C di terminal), lalu jalankan versi terbaru:</p><div class="update-command"><code id="update-command"></code><button id="update-copy" type="button" class="secondary">Salin</button></div><p class="note">Pengguna aplikasi Windows: unduh <a href="https://github.com/askiya/SANTRI-SKILLS/releases/latest/download/SantriHub-Setup.exe" data-external target="_blank" rel="noopener noreferrer">SantriHub-Setup.exe</a> terbaru.</p></div><p id="update-feedback" class="note" role="status" aria-live="polite"></p></div><div class="wizard-footer"><a id="update-notes" class="secondary update-notes" href="#" data-external target="_blank" rel="noopener noreferrer">Catatan rilis ↗</a><button id="update-now" type="button" class="wizard-primary" hidden>Update sekarang</button></div></dialog><dialog id="repo-modal" class="repo-modal wizard-dialog" aria-labelledby="repo-modal-title"><div class="wizard-header"><div><span class="wizard-badge">BOOKMARK</span><h2 id="repo-modal-title">Tambah Repository</h2></div><button id="repo-modal-close" type="button" class="wizard-x" aria-label="Tutup tambah repository">&times;</button></div><div class="wizard-body"><p>Tempel URL <code>https://github.com/owner/repo</code>, lalu Simpan bookmark. Deteksi Skills/MCP otomatis; tidak ada file yang dipasang atau perintah yang dijalankan.</p><label class="repo-field" for="repo-modal-url">URL repository<input id="repo-modal-url" type="url" inputmode="url" autocomplete="off" placeholder="https://github.com/askiya/context-mode"></label><p id="repo-modal-feedback" class="note" role="status" aria-live="polite" data-error="false"></p><div id="repo-modal-preview" class="warning-box" hidden></div></div><div class="wizard-footer"><button id="repo-modal-preview-btn" type="button" class="secondary">Preview aman</button><button id="repo-modal-save" type="button" class="wizard-primary repo-primary">Simpan bookmark</button></div></dialog>
123
+ <dialog id="update-dialog" class="update-dialog wizard-dialog" aria-labelledby="update-title"><div class="wizard-header"><div><span class="wizard-badge">PEMBARUAN</span><h2 id="update-title">SantriHub versi baru</h2></div><button id="update-close" type="button" class="wizard-x" aria-label="Tutup pembaruan">&times;</button></div><div class="wizard-body"><p class="update-versions"><span>Terpasang <b id="update-current"></b></span><span aria-hidden="true">→</span><span>Terbaru <b id="update-latest"></b></span></p><div id="update-self" hidden><p>SantriHub mengunduh installer resmi dari GitHub Releases, mencocokkan SHA-256-nya, lalu memasang dan membuka ulang aplikasi otomatis. Skill dan pengaturanmu tetap aman.</p></div><div id="update-manual" hidden><p>Tutup dashboard ini (Ctrl+C di terminal), lalu jalankan versi terbaru:</p><div class="update-command"><code id="update-command"></code><button id="update-copy" type="button" class="secondary">Salin</button></div><p class="note">Pengguna aplikasi Windows: unduh <a href="https://github.com/askiya/SANTRI-SKILLS/releases/latest/download/SantriHub-Setup.exe" data-external target="_blank" rel="noopener noreferrer">SantriHub-Setup.exe</a> terbaru.</p></div><div id="update-progress" class="update-progress" hidden><ol class="update-steps" aria-hidden="true"><li data-update-step="0">Unduh</li><li data-update-step="1">Cek SHA-256</li><li data-update-step="2">Pasang</li><li data-update-step="3">Buka ulang</li></ol><div class="update-bar" id="update-bar" role="progressbar" aria-label="Progres pembaruan" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i id="update-bar-fill"></i></div><div class="update-meta"><span id="update-stage">Menyiapkan…</span><b id="update-pct">0%</b></div></div><p id="update-feedback" class="note" role="status" aria-live="polite"></p></div><div class="wizard-footer"><a id="update-notes" class="secondary update-notes" href="#" data-external target="_blank" rel="noopener noreferrer">Catatan rilis ↗</a><button id="update-now" type="button" class="wizard-primary" hidden>Update sekarang</button></div></dialog><dialog id="repo-modal" class="repo-modal wizard-dialog" aria-labelledby="repo-modal-title"><div class="wizard-header"><div><span class="wizard-badge">BOOKMARK</span><h2 id="repo-modal-title">Tambah Repository</h2></div><button id="repo-modal-close" type="button" class="wizard-x" aria-label="Tutup tambah repository">&times;</button></div><div class="wizard-body"><p>Tempel URL <code>https://github.com/owner/repo</code>, lalu Simpan bookmark. Deteksi Skills/MCP otomatis; tidak ada file yang dipasang atau perintah yang dijalankan.</p><label class="repo-field" for="repo-modal-url">URL repository<input id="repo-modal-url" type="url" inputmode="url" autocomplete="off" placeholder="https://github.com/askiya/context-mode"></label><p id="repo-modal-feedback" class="note" role="status" aria-live="polite" data-error="false"></p><div id="repo-modal-preview" class="warning-box" hidden></div></div><div class="wizard-footer"><button id="repo-modal-preview-btn" type="button" class="secondary">Preview aman</button><button id="repo-modal-save" type="button" class="wizard-primary repo-primary">Simpan bookmark</button></div></dialog>
118
124
  <dialog id="add-chooser" class="wizard-dialog" aria-labelledby="choose-title" aria-describedby="choose-description">
119
125
  <div class="wizard-header"><div><span class="wizard-badge">ANTIGRAVITY LIBRARY</span><h2 id="choose-title">Tambah ke SantriHub</h2></div><button type="button" id="close-chooser" class="wizard-x" aria-label="Tutup pilihan">×</button></div>
120
126
  <div class="wizard-body"><p id="choose-description">Pilih yang ingin kamu tambahkan. Preview dulu, pasang setelah konfirmasi.</p><div class="choice-grid">
package/src/dashboard.js CHANGED
@@ -117,9 +117,22 @@ function createDashboardServer({ cwd = process.cwd(), home, env = process.env, a
117
117
  try{fs.writeFileSync(tmp,JSON.stringify(rows),{flag:'wx',mode:0o600});fs.renameSync(tmp,reposFile)}finally{fs.rmSync(tmp,{force:true})}
118
118
  }
119
119
  let verification=null;
120
+ // Skill proof: a managed skill "santrihub-cek" holds a code that exists nowhere else. An agent that
121
+ // sends it back through santrihub_verify has read that SKILL.md in its current session.
122
+ const CHECK_SKILL='santrihub-cek',CHECK_PROMPT='Gunakan skill santrihub-cek untuk mengecek SantriHub.';
123
+ const checkSkillMd=(code,expires)=>['---','name: '+CHECK_SKILL,'description: Cek SantriHub. Pakai skill ini hanya saat pengguna meminta cek SantriHub atau menyebut santrihub-cek.','---','','# Cek SantriHub','','1. Panggil tool MCP `santrihub_verify` dari server `santri-skills` dengan:',' - `code`: "'+code+'"',' - `skills`: daftar nama (id) semua skill yang tersedia untukmu di sesi ini, termasuk santrihub-cek.','2. Sampaikan jawaban tool itu apa adanya kepada pengguna.','','Kode ini dibuat SantriHub untuk satu kali cek dan berlaku sampai '+new Date(expires).toLocaleTimeString('id-ID')+'.',''].join('\n');
124
+ function writeCheckSkill(dir,code,expires){
125
+ const dest=path.join(dir,CHECK_SKILL),marker=path.join(dest,'.santri-skills.json');assertNoLinks(dest);
126
+ if(fs.existsSync(dest)&&!fs.existsSync(marker))throw new AuthError(409,'Folder skill santrihub-cek sudah ada dan bukan buatan SantriHub. Ganti namanya dulu.');
127
+ fs.mkdirSync(dest,{recursive:true});fs.writeFileSync(path.join(dest,'SKILL.md'),checkSkillMd(code,expires));
128
+ fs.writeFileSync(marker,JSON.stringify({source:CHECK_SKILL,installedAt:new Date().toISOString()},null,2));
129
+ }
130
+ // Compares the skills found on disk at start with the names the agent reported.
131
+ const skillProof=()=>{const p=verification&&verification.skillProof;if(!p)return null;const said=new Set(p.reported);
132
+ return {verified:true,observedAt:p.observedAt,skill:CHECK_SKILL,seen:verification.skillsAtStart.filter(id=>said.has(id.toLowerCase())),notSeen:verification.skillsAtStart.filter(id=>!said.has(id.toLowerCase())),reportedCount:p.reported.length};};
120
133
  const clearVerification=()=>{verification=null;assertNoLinks(capabilityFile);fs.rmSync(capabilityFile,{force:true});};
121
134
  const binding=()=>{const t=resolveTargets('global',targetOptions());const hash=crypto.createHash('sha256').update(JSON.stringify(t));for(const file of [t.mcpFile,...t.skillsDirs.flatMap(dir=>fs.existsSync(dir)?fs.readdirSync(dir).map(id=>path.join(dir,id,'SKILL.md')):[])]){assertNoLinks(file);hash.update(file);if(fs.existsSync(file)&&fs.statSync(file).isFile())hash.update(fs.readFileSync(file));}return hash.digest('hex');};
122
- const evidence=()=>{if(verification&&(verification.expires<=Date.now()||verification.binding!==binding()))clearVerification();return {verified:Boolean(verification&&verification.evidence),pending:Boolean(verification&&!verification.evidence),expiresAt:verification?verification.expires:null,evidence:verification?verification.evidence:null,note:'Bukti hanya bridge santri-skills. MCP lain belum diketahui; file Skills bukan bukti dimuat IDE. Identitas IDE tidak diautentikasi.'};};
135
+ const evidence=()=>{if(verification&&(verification.expires<=Date.now()||verification.binding!==binding()))clearVerification();return {verified:Boolean(verification&&verification.evidence),pending:Boolean(verification&&!(verification.evidence&&verification.skillProof)),expiresAt:verification?verification.expires:null,evidence:verification?verification.evidence:null,skillProof:skillProof(),prompt:verification?CHECK_PROMPT:null,note:'Bukti hanya bridge santri-skills. MCP lain belum diketahui; file Skills bukan bukti dimuat IDE. Identitas IDE tidak diautentikasi.'};};
123
136
  const csrfTokens = new Map();
124
137
  let busy = false;
125
138
  const libRoot = library.libraryRoot(home || os.homedir());
@@ -211,9 +224,19 @@ function createDashboardServer({ cwd = process.cwd(), home, env = process.env, a
211
224
  await session.requirePremium();
212
225
  if(req.socket.remoteAddress!=='127.0.0.1')throw new AuthError(403,'Callback hanya loopback.');
213
226
  if(req.headers.origin||req.headers['content-type']!=='application/json')throw new AuthError(403,'Callback ditolak.');
214
- let raw='';for await(const c of req){raw+=c;if(Buffer.byteLength(raw)>1024)throw new AuthError(400,'Callback terlalu besar.');}
227
+ let raw='';for await(const c of req){raw+=c;if(Buffer.byteLength(raw)>32*1024)throw new AuthError(400,'Callback terlalu besar.');}
215
228
  const body=JSON.parse(raw),token=req.headers['x-santrihub-bridge'];evidence();
216
- if(!verification||typeof token!=='string'||token.length!==64||!crypto.timingSafeEqual(Buffer.from(token),Buffer.from(verification.token))||body.challenge!==verification.challenge||!['initialize','tool'].includes(body.event))throw new AuthError(403,'Callback invalid atau kedaluwarsa.');
229
+ if(!verification||typeof token!=='string'||token.length!==64||!crypto.timingSafeEqual(Buffer.from(token),Buffer.from(verification.token))||body.challenge!==verification.challenge||!['initialize','tool','verify'].includes(body.event))throw new AuthError(403,'Callback invalid atau kedaluwarsa.');
230
+ if(body.event==='verify'){
231
+ if(verification.skillProof)throw new AuthError(409,'Kode cek sudah dipakai. Buat kode baru di SantriHub.');
232
+ const code=typeof body.code==='string'?body.code.trim().toUpperCase():'';
233
+ if(code.length!==verification.code.length||!crypto.timingSafeEqual(Buffer.from(code),Buffer.from(verification.code)))throw new AuthError(403,'Kode cek tidak cocok. Buat kode baru di SantriHub, muat ulang agent, lalu coba lagi.');
234
+ const reported=Array.isArray(body.skills)?[...new Set(body.skills.filter(s=>typeof s==='string').map(s=>s.trim().toLowerCase().slice(0,160)).filter(Boolean))].slice(0,500):[];
235
+ verification.skillProof={observedAt:new Date().toISOString(),reported};
236
+ if(!verification.evidence)verification.evidence={server:'santri-skills',level:'bridge-mcp-loaded',source:'local-capability-callback',event:'verify',observedAt:new Date().toISOString(),identityAuthenticated:false};
237
+ const p=skillProof();
238
+ return send(200,{accepted:true,seen:p.seen.length,total:verification.skillsAtStart.length,notSeen:p.notSeen.slice(0,20)});
239
+ }
217
240
  if(verification.evidence)throw new AuthError(409,'Callback sudah dipakai.');
218
241
  verification.evidence={server:'santri-skills',level:'bridge-mcp-loaded',source:'local-capability-callback',event:body.event,observedAt:new Date().toISOString(),identityAuthenticated:false};
219
242
  return send(200,{accepted:true});
@@ -343,9 +366,12 @@ function createDashboardServer({ cwd = process.cwd(), home, env = process.env, a
343
366
  if(req.url==='/api/uninstall'){if(input.confirm!==true||input.confirmGlobal!==true)throw new AuthError(400,'Konfirmasi uninstall global wajib.');const target=resolveForWrite('global',{...targetOptions(),kind:input.kind==='skill'?'skills':'mcp'});const result=removeInstalled({kind:input.kind,id:input.id,skillsDir:target.skillsDirs[0],mcpFile:target.mcpFile});clearVerification();return send(200,result);}
344
367
  clearVerification();const target=resolveTargets('global',targetOptions());const status=configStatus('global',cwd,home,{skillTargets:target.skillsDirs,mcpFile:target.mcpFile});
345
368
  if(!status.mcp.servers.some(s=>s.name==='santri-skills'&&s.managed))throw new AuthError(409,'Pasang bridge MCP santri-skills resmi sebelum verifikasi callback.');
346
- const challenge=crypto.randomBytes(32).toString('hex');verification={challenge,token:crypto.randomBytes(32).toString('hex'),binding:binding(),expires:Date.now()+300000,evidence:null};
369
+ const expires=Date.now()+600000,code='SH-'+crypto.randomBytes(5).toString('hex').toUpperCase().replace(/^(.{5})/,'$1-');
370
+ writeCheckSkill(resolveForWrite('global',{...targetOptions(),kind:'skills'}).skillsDirs[0],code,expires);
371
+ const skillsAtStart=[...new Set(status.skills.map(s=>s.id).filter(id=>id&&id!==CHECK_SKILL))];
372
+ const challenge=crypto.randomBytes(32).toString('hex');verification={challenge,token:crypto.randomBytes(32).toString('hex'),binding:binding(),expires,evidence:null,code,skillsAtStart,skillProof:null};
347
373
  assertNoLinks(capabilityFile);fs.mkdirSync(path.dirname(capabilityFile),{recursive:true,mode:0o700});fs.writeFileSync(capabilityFile,JSON.stringify({port,token:verification.token,challenge,expires:verification.expires}),{flag:'wx',mode:0o600});
348
- return send(200,{challenge,expiresAt:verification.expires,prompt:'Panggil tool santrihub_status dari MCP santri-skills. Jawaban asli saja.',note:'Bridge loaded saja; bukan bukti semua MCP atau Skills dimuat IDE.'});
374
+ return send(200,{challenge,expiresAt:verification.expires,skill:CHECK_SKILL,prompt:CHECK_PROMPT,note:'Kode cek ada di skill santrihub-cek. Restart Antigravity, buka chat Agent baru, lalu tempel prompt. Callback MCP saja hanya membuktikan bridge santri-skills.'});
349
375
  }
350
376
  if (input.scope === 'global' && req.url !== '/api/verify' && !req.url.endsWith('/preview') && input.confirmGlobal !== true) throw new AuthError(400, 'Konfirmasi global wajib.');
351
377
 
@@ -200,7 +200,7 @@ const CALLBACK_PAGE = `<!doctype html><html lang="id"><head><meta charset="utf-8
200
200
  * Wrap the dashboard's request handler with the app-mode login routes.
201
201
  * Every other request (and all premium checks) still goes to the dashboard.
202
202
  */
203
- function attachBrowserLogin(server, { focus = () => {}, open = openExternal, update = null } = {}) {
203
+ function attachBrowserLogin(server, { focus = () => {}, open = openExternal, update = null, updateStatus = () => ({ stage: 'idle' }) } = {}) {
204
204
  // The dashboard offers "Update sekarang" only when this app can replace itself.
205
205
  const appScript = update ? `${APP_SCRIPT}\ndocument.documentElement.dataset.santrihubUpdate = 'self';\n` : APP_SCRIPT;
206
206
  const dashboard = server.listeners('request');
@@ -219,6 +219,8 @@ function attachBrowserLogin(server, { focus = () => {}, open = openExternal, upd
219
219
  res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store', 'Content-Security-Policy': "default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src 'self'; connect-src 'self'; frame-ancestors 'none'" });
220
220
  return res.end(CALLBACK_PAGE);
221
221
  }
222
+ // Polled by the update dialog while the POST below is still running.
223
+ if (req.method === 'GET' && pathname === '/__santrihub/update/status') return json(200, updateStatus());
222
224
  if (req.method === 'POST' && pathname === '/__santrihub/update') {
223
225
  if (!sameOriginJson()) return json(403, { error: 'Ditolak.' });
224
226
  req.resume();
@@ -394,23 +396,29 @@ function startDesktop({ version = '' } = {}) {
394
396
  // Self-update only for the installed app (not `node bin/cli.js app` or npx).
395
397
  const checkUpdate = createUpdateChecker({ current: version });
396
398
  let updating = false;
399
+ let updateProgress = { stage: 'idle' };
397
400
  const update = installed ? async () => {
398
401
  if (updating) throw Object.assign(new Error('Pembaruan sedang berjalan.'), { status: 409 });
402
+ updateProgress = { stage: 'check' };
399
403
  const info = await checkUpdate();
400
- if (!info.available) throw Object.assign(new Error('SantriHub sudah versi terbaru.'), { status: 409 });
404
+ if (!info.available) { updateProgress = { stage: 'idle' }; throw Object.assign(new Error('SantriHub sudah versi terbaru.'), { status: 409 }); }
401
405
  updating = true;
402
406
  try {
403
- const installer = await downloadInstaller(`v${info.latest}`, path.join(data, 'updates'));
407
+ const onProgress = (p) => { updateProgress = { ...p, version: info.latest }; };
408
+ const installer = await downloadInstaller(`v${info.latest}`, path.join(data, 'updates'), { onProgress });
409
+ updateProgress = { stage: 'install', version: info.latest };
404
410
  startUpdateRunner({ installer, exe: process.execPath, args: [CLI, 'app'], pid: process.pid, profile, browserProcess: browser?.process, log: path.join(data, 'santrihub.log') });
405
411
  log(`update ${version} -> ${info.latest}`);
406
- setTimeout(close, 1500).unref?.(); // let the dashboard show the confirmation first
412
+ updateProgress = { stage: 'restart', version: info.latest };
413
+ setTimeout(close, 2500).unref?.(); // let the dashboard show the last step first
407
414
  return { version: info.latest };
408
415
  } catch (error) {
409
416
  updating = false;
417
+ updateProgress = { stage: 'error', error: error?.message || 'Pembaruan gagal.' };
410
418
  throw error;
411
419
  }
412
420
  } : null;
413
- attachBrowserLogin(server, { focus: () => (browser ? focusWindow(profile, browser.process) : undefined), update });
421
+ attachBrowserLogin(server, { focus: () => (browser ? focusWindow(profile, browser.process) : undefined), update, updateStatus: () => updateProgress });
414
422
 
415
423
  let idleArmed = false;
416
424
  const armIdleShutdown = (reason) => {
package/src/mcp-server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // Minimal MCP stdio server (JSON-RPC 2.0, protocol negotiated from SUPPORTED_PROTOCOLS).
4
- // Tools: santrihub_status, list_skills, get_skill, get_skill_file, search_docs. No dashboard heartbeat or fake connection marker.
4
+ // Tools: santrihub_status, santrihub_verify, list_skills, get_skill, get_skill_file, search_docs. No dashboard heartbeat or fake connection marker.
5
5
 
6
6
  const fs = require('node:fs');
7
7
  const path = require('node:path');
@@ -13,7 +13,7 @@ const SUPPORTED_PROTOCOLS = ['2025-06-18', '2025-03-26', '2024-11-05'];
13
13
  let protocol = SUPPORTED_PROTOCOLS[0];
14
14
  const MAX_SKILL_FILE_BYTES = 512 * 1024;
15
15
  const pkg = require('../package.json');
16
- const {report}=require('./verification-bridge');
16
+ const {report,verify}=require('./verification-bridge');
17
17
 
18
18
  const TOOLS = [
19
19
  {
@@ -21,6 +21,19 @@ const TOOLS = [
21
21
  description: 'Bukti read-only bahwa runtime MCP santri-skills ini benar-benar dimuat klien: identitas server, versi, protocol, executable Node, dan root instalasi. Tidak membaca config atau secret.',
22
22
  inputSchema: { type: 'object', properties: {}, additionalProperties: false },
23
23
  },
24
+ {
25
+ name: 'santrihub_verify',
26
+ description: 'Kirim kode cek dari skill santrihub-cek ke SantriHub, beserta daftar skill yang kamu lihat, untuk membuktikan skill benar-benar dimuat. Pakai hanya saat skill santrihub-cek memintanya.',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ code: { type: 'string', description: 'kode dari skill santrihub-cek, contoh: SH-1A2B3-C4D5E' },
31
+ skills: { type: 'array', items: { type: 'string' }, description: 'nama (id) semua skill yang tersedia untukmu di sesi ini' },
32
+ },
33
+ required: ['code'],
34
+ additionalProperties: false,
35
+ },
36
+ },
24
37
  {
25
38
  name: 'list_skills',
26
39
  description: 'Daftar semua skill Santriverse (Apps Script + Monorepo) beserta deskripsinya.',
@@ -129,6 +142,12 @@ async function callTool(name, args = {}) {
129
142
  note: 'Proses bridge MCP aktif. Identitas IDE tidak diautentikasi; clientInfo bukan bukti identitas. Status tidak membuktikan MCP lain atau skill dimuat IDE.',
130
143
  }, null, 2);
131
144
  }
145
+ if (name === 'santrihub_verify') {
146
+ const { status, data } = await verify(args.code, args.skills);
147
+ if (status === 200) return `Kode cocok. SantriHub mencatat: skill dimuat dan MCP santri-skills tersambung. ${data.seen} dari ${data.total} skill terpasang disebut.${data.notSeen?.length ? ' Tidak disebut: ' + data.notSeen.join(', ') + '.' : ''} Lihat hasil lengkap di SantriHub → Cek & Tes.`;
148
+ if (status === 0) return 'SantriHub tidak menerima kode: tidak ada cek aktif. Buka SantriHub → Cek & Tes → Siapkan kode cek, lalu coba lagi.';
149
+ return 'SantriHub menolak kode: ' + (data.error || 'status ' + status) + '.';
150
+ }
132
151
  const groups = await catalog();
133
152
  if (name === 'list_skills') {
134
153
  const rows = groups.flatMap((g) => g.skills.map((s) => `- [${s.source}] ${s.id}: ${s.description.slice(0, 180)}`));
package/src/update.js CHANGED
@@ -68,9 +68,14 @@ function sumFor(sums, file) {
68
68
  return null;
69
69
  }
70
70
 
71
- /** Downloads the installer of `tag` into `dir` and returns its path once the hash matches. */
72
- async function downloadInstaller(tag, dir, { fetchImpl = globalThis.fetch } = {}) {
71
+ /**
72
+ * Downloads the installer of `tag` into `dir` and returns its path once the hash matches.
73
+ * onProgress gets {stage:'sums'}, then {stage:'download', received, total} per chunk (total 0
74
+ * when the server sends no length), then {stage:'verify'}.
75
+ */
76
+ async function downloadInstaller(tag, dir, { fetchImpl = globalThis.fetch, onProgress = () => {} } = {}) {
73
77
  if (!TAG_RE.test(tag)) throw new Error('Versi rilis tidak valid.');
78
+ onProgress({ stage: 'sums' });
74
79
  const base = `${RELEASES}/download/${tag}`;
75
80
  const get = async (url, what) => {
76
81
  const res = await fetchImpl(url, { headers: { 'User-Agent': 'SantriHub' }, signal: AbortSignal.timeout(10 * 60 * 1000) });
@@ -82,9 +87,20 @@ async function downloadInstaller(tag, dir, { fetchImpl = globalThis.fetch } = {}
82
87
  const res = await get(`${base}/${INSTALLER}`, 'installer');
83
88
  const size = Number(res.headers.get('content-length') || 0);
84
89
  if (size > MAX_INSTALLER) throw new Error('Ukuran installer tidak wajar.');
85
- const data = Buffer.from(await res.arrayBuffer());
86
- if (data.length > MAX_INSTALLER) throw new Error('Ukuran installer tidak wajar.');
87
- const actual = crypto.createHash('sha256').update(data).digest('hex');
90
+ const hash = crypto.createHash('sha256');
91
+ const chunks = [];
92
+ let received = 0;
93
+ onProgress({ stage: 'download', received, total: size });
94
+ for await (const chunk of res.body || []) {
95
+ received += chunk.length;
96
+ if (received > MAX_INSTALLER) throw new Error('Ukuran installer tidak wajar.');
97
+ hash.update(chunk);
98
+ chunks.push(chunk);
99
+ onProgress({ stage: 'download', received, total: size });
100
+ }
101
+ onProgress({ stage: 'verify' });
102
+ const data = Buffer.concat(chunks);
103
+ const actual = hash.digest('hex');
88
104
  if (actual !== expected) throw new Error('Checksum installer tidak cocok. Pembaruan dibatalkan.');
89
105
  fs.mkdirSync(dir, { recursive: true });
90
106
  const file = path.join(dir, `SantriHub-Setup-${tag}.exe`);
@@ -2,10 +2,26 @@
2
2
  const fs=require('node:fs'),path=require('node:path'),os=require('node:os'),http=require('node:http'),crypto=require('node:crypto');
3
3
  const bridgePath=()=>process.env.SANTRIHUB_BRIDGE_FILE||path.join(os.homedir(),'.santrihub','bridge.json');
4
4
  // ponytail: same-user processes can read this capability; stronger IDE identity needs vendor-signed diagnostics.
5
+ function capability(){
6
+ let cfg;try{const file=bridgePath(),stat=fs.lstatSync(file);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>2048)return null;cfg=JSON.parse(fs.readFileSync(file,'utf8'));}catch{return null}
7
+ if(!Number.isInteger(cfg.port)||cfg.port<1||cfg.port>65535||typeof cfg.token!=='string'||!/^[a-f0-9]{64}$/.test(cfg.token)||typeof cfg.challenge!=='string'||!/^[a-f0-9]{64}$/.test(cfg.challenge)||cfg.expires<=Date.now())return null;
8
+ return cfg;
9
+ }
10
+ function send(cfg,payload,onDone=()=>{}){
11
+ const body=JSON.stringify({challenge:cfg.challenge,...payload});
12
+ const req=http.request({hostname:'127.0.0.1',port:cfg.port,path:'/api/verification/bridge',method:'POST',timeout:3000,headers:{Host:`127.0.0.1:${cfg.port}`,'Content-Type':'application/json','Content-Length':Buffer.byteLength(body),'X-Santrihub-Bridge':cfg.token}},res=>{let raw='';res.setEncoding('utf8');res.on('data',c=>{if(raw.length<8192)raw+=c});res.on('end',()=>{let data={};try{data=JSON.parse(raw)}catch{}onDone({status:res.statusCode,data})})});
13
+ req.on('error',()=>onDone({status:0,data:{}}));req.on('timeout',()=>req.destroy());req.end(body);
14
+ }
5
15
  function report(event){
6
16
  if(!['initialize','tool'].includes(event))return;
7
- let cfg;try{const file=bridgePath(),stat=fs.lstatSync(file);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>2048)return;cfg=JSON.parse(fs.readFileSync(file,'utf8'));}catch{return}
8
- if(!Number.isInteger(cfg.port)||cfg.port<1||cfg.port>65535||typeof cfg.token!=='string'||!/^[a-f0-9]{64}$/.test(cfg.token)||typeof cfg.challenge!=='string'||!/^[a-f0-9]{64}$/.test(cfg.challenge)||cfg.expires<=Date.now())return;
9
- const body=JSON.stringify({challenge:cfg.challenge,event});const req=http.request({hostname:'127.0.0.1',port:cfg.port,path:'/api/verification/bridge',method:'POST',timeout:1500,headers:{Host:`127.0.0.1:${cfg.port}`,'Content-Type':'application/json','Content-Length':Buffer.byteLength(body),'X-Santrihub-Bridge':cfg.token}},res=>res.resume());req.on('error',()=>{});req.on('timeout',()=>req.destroy());req.end(body);
17
+ const cfg=capability();if(cfg)send(cfg,{event});
18
+ }
19
+ // Skill proof: the agent read the code from the santrihub-cek skill; the dashboard checks it.
20
+ function verify(code,skills){
21
+ return new Promise(resolve=>{
22
+ const cfg=capability();if(!cfg)return resolve({status:0,data:{error:'Tidak ada cek aktif di SantriHub.'}});
23
+ const list=Array.isArray(skills)?skills.filter(s=>typeof s==='string').slice(0,500).map(s=>s.slice(0,160)):[];
24
+ send(cfg,{event:'verify',code:String(code||'').slice(0,40),skills:list},resolve);
25
+ });
10
26
  }
11
- module.exports={bridgePath,report};
27
+ module.exports={bridgePath,report,verify};