d1/arti-demo — kaynak4333 bayt
← review
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>hart artifact</title><script>window.HART_DATA={};</script></head><body><!doctype html>
<html lang="tr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>arti-demo — köprü doğrulama artifact'ı</title>
<style>
body{margin:0;font-family:system-ui,sans-serif;background:#f6f8fa;color:#1a1a1a;
display:flex;justify-content:center;padding:40px 16px}
.card{max-width:560px;width:100%;background:#fff;border:1px solid #d9dee4;
border-radius:10px;padding:20px 24px}
h1{font-size:18px;margin:0 0 4px}
.mut{color:#666;font-size:13px;margin-bottom:14px}
#st{font-family:ui-monospace,monospace;font-size:15px;font-weight:700;
padding:8px 12px;border-radius:6px;background:#eef2f5;margin:10px 0}
#st.ok{background:#e6f4e6;color:#116611}
#st.fail{background:#fbeaea;color:#991111}
#log{font-family:ui-monospace,monospace;font-size:12px;color:#333;
white-space:pre-wrap;line-height:1.7}
button{font:inherit;font-size:13px;padding:8px 14px;border:1px solid #ccc;
border-radius:6px;background:#fff;cursor:pointer;margin-top:12px}
button:hover{background:#f0f0f0}
</style>
</head>
<body>
<div class="card">
<h1>window.arti köprü demosu</h1>
<div class="mut">Shim v2 · caps: storage, download, fetch · adım adım sonuçlar aşağıda.
Bu sayfa <code>srcdoc</code> + <code>sandbox</code> içinde, opaque origin'de çalışır.</div>
<div id="st">… bekleniyor</div>
<div id="log"></div>
<button id="dl">arti.download ile dosya indir</button>
</div>
<script>
// window.arti shim v2 — .devin/skills/artifact-publish/SKILL.md'den
window.arti=(()=>{let s=0;const P=new Map();
const CAPS=['storage','download','fetch'];
parent.postMessage({type:'arti.hello',v:2,caps:CAPS},'*');
window.addEventListener('message',e=>{const d=e.data||{};
if(d.type==='arti.res'&&P.has(d.id)){const{p,r}=P.get(d.id);P.delete(d.id);
d.ok?p(d.data):r(new Error(d.error||'arti hata'))}});
const q=(cap,args)=>new Promise((p,r)=>{const id='a'+(++s)+Date.now();
P.set(id,{p,r});parent.postMessage({type:'arti.req',id,cap,args},'*');
setTimeout(()=>{if(P.has(id)){P.delete(id);r(new Error('arti zaman asimi'))}},15000)});
return{complete:(prompt,o={})=>q('complete',{prompt,...o}),
storage:{get:k=>q('storage',{op:'get',key:k}),
set:(k,v)=>q('storage',{op:'set',key:k,value:v}),
del:k=>q('storage',{op:'del',key:k}),
list:()=>q('storage',{op:'list'})},
download:(f,c)=>q('download',{filename:f,content:c}),
fetch:u=>q('fetch',{url:u})}})();
</script>
<script>
const log=m=>{document.getElementById('log').textContent+=m+'\n'};
const st=document.getElementById('st');
log('shim yuklendi; hello gonderildi (caps: storage, download, fetch)');
(async()=>{
try{
const v='probe-'+Date.now();
const s=await window.arti.storage.set('arti-demo',v);
log('storage.set → '+JSON.stringify(s));
const g=await window.arti.storage.get('arti-demo');
log('storage.get → '+JSON.stringify(g));
const ok=JSON.stringify(g).includes(v);
log('roundtrip deger esit: '+ok);
const l=await window.arti.storage.list();
log('storage.list → '+JSON.stringify(l).slice(0,200));
const f=await window.arti.fetch('https://a.gonet.com.tr/a/d1/pano/latest');
const fok=f&&f.status===200&&(f.text||'').length>50;
log('fetch a.gonet → status '+f.status+' · '+(f.text||'').length+'c'+(f.truncated?' (kesildi)':''));
st.textContent=(ok&&fok)?'BRIDGE:OK':'BRIDGE:FAIL '+(ok?'fetch':'deger eslesmedi');
st.className=(ok&&fok)?'ok':'fail';
if(ok){
const f=await window.arti.storage.get('autodl').catch(()=>null);
if(f&&(f.value||f)==='1'){log('autodl bayragi KV uzerinden — download tetikleniyor');
await dl();await window.arti.storage.del('autodl');
log('autodl bayragi temizlendi')}
}
}catch(e){st.textContent='BRIDGE:FAIL '+e.message;st.className='fail';log('HATA '+e.message)}
})();
const dl=async()=>{
try{await window.arti.download('arti-demo.txt','arti koprusu download kaniti — '+new Date().toISOString());
log('download ok → arti-demo.txt')}catch(e){log('download HATA '+e.message)}};
document.getElementById('dl').onclick=dl;
if((location.search+' '+document.referrer).includes('autodl'))dl();
</script>
</body>
</html>
</body></html>
remix: kaynağı kopyala → düzenle → yeni artifact olarak publish et:
TOKEN=$(grep '^HART_TOKEN=' ~/Code/artifacts-d1/.env | cut -d= -f2)
curl -X POST "https://artifacts.gonet.com.tr/v1/publish?owner=d1&artifact=YENI-SLUG&visibility=unlisted" -H "Authorization: Bearer $TOKEN" -H 'content-type: text/html' --data-binary @duzenlenmis.html
(remix publish tokenı ister — HART_TOKEN .env'de; hesapsız modelde çatal link ile değil bu komutla olur)