Victoria's bridge app
This Vercel-hosted HTML command invokes a public sibling command through window.wimble.run().
This Vercel-hosted HTML command invokes a public sibling command through window.wimble.run().
123456789101112131415// @ts-check
/** @param {{ args: string[], accept: string[] }} context */export default function bridge({ args, accept }) { if (args.includes("--help")) return "Invoke a sibling command from Victoria's HTML app.\n\nUsage: run.js\n"; if (accept.includes("text/html")) return new Response(html(), { headers: { "content-type": "text/html; charset=utf-8" }, }); return "Use the web view to try Victoria's HTML bridge app.\n";}
function html() { return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>:root{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#20241f}body{margin:0;padding:20px;display:grid;gap:14px;justify-items:start}button{border:0;border-radius:8px;background:#1d7558;color:white;padding:11px 16px;font:inherit;cursor:pointer}output{white-space:pre-wrap}</style></head><body><button id="run" type="button">Run Victoria's sibling</button><output id="out">Ready.</output><script>const button=document.getElementById("run"),out=document.getElementById("out");button.onclick=async()=>{button.disabled=true;try{const value=await window.wimble.run({path:"./message.run.js",args:["Victoria's user app bridge works."]});out.textContent=value.stdout||value.stderr||"No output."}catch(error){out.textContent=error instanceof Error?error.message:String(error)}finally{button.disabled=false}}</script></body></html>`;}