toyon 0.13.0 → 0.15.0

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.
Files changed (29) hide show
  1. package/README.md +2 -2
  2. package/dist/CHANGELOG.md +602 -0
  3. package/dist/bridge.js +1 -1
  4. package/dist/cli.js +60 -53
  5. package/dist/daemon.js +695 -283
  6. package/dist/shell/assets/{Editor-CUcgZuoM.js → Editor-jjf6IGvI.js} +3 -3
  7. package/dist/shell/assets/{XTerm-V6sBDIe-.js → XTerm-ClBPMY5e.js} +1 -1
  8. package/dist/shell/assets/{cssMode-CSyiAvIn.js → cssMode-CgTk4Slg.js} +1 -1
  9. package/dist/shell/assets/{freemarker2-C4-FNK3V.js → freemarker2-B4Eirl4Y.js} +1 -1
  10. package/dist/shell/assets/{grammar-DzHb7e7O.js → grammar-E8nWrhy3.js} +1 -1
  11. package/dist/shell/assets/{handlebars-DcjVaOCM.js → handlebars-C6uEGz8T.js} +1 -1
  12. package/dist/shell/assets/{html-Csl8cogA.js → html-tDAdsEYh.js} +1 -1
  13. package/dist/shell/assets/{htmlMode-rewe9UaO.js → htmlMode-DXGTr81h.js} +1 -1
  14. package/dist/shell/assets/index-1FLxRByi.js +267 -0
  15. package/dist/shell/assets/index-D-4W2x1P.css +1 -0
  16. package/dist/shell/assets/{javascript--pKV-E-G.js → javascript-BeM3ebwd.js} +1 -1
  17. package/dist/shell/assets/{jsonMode-zPVc0E6l.js → jsonMode-CXStIFU4.js} +1 -1
  18. package/dist/shell/assets/{liquid-jZT5xQG-.js → liquid-2UNKoWGQ.js} +1 -1
  19. package/dist/shell/assets/{lspLanguageFeatures-BuiqKs90.js → lspLanguageFeatures-G4xsCwWV.js} +1 -1
  20. package/dist/shell/assets/{mdx-DwnR-ia2.js → mdx-CoF6St9y.js} +1 -1
  21. package/dist/shell/assets/{python-DU3pl9Zu.js → python-rULGuAEe.js} +1 -1
  22. package/dist/shell/assets/{razor-BzVUPqHs.js → razor-0I41g6kD.js} +1 -1
  23. package/dist/shell/assets/{tsMode-ONmZhHHZ.js → tsMode-CyMsmAXC.js} +1 -1
  24. package/dist/shell/assets/{xml-BXW7X3BT.js → xml-BNhTd1tm.js} +1 -1
  25. package/dist/shell/assets/{yaml-DFE79ex1.js → yaml-Cp69rkq5.js} +1 -1
  26. package/dist/shell/index.html +2 -2
  27. package/package.json +1 -1
  28. package/dist/shell/assets/index-Bkn7zNFw.js +0 -267
  29. package/dist/shell/assets/index-iVaPr_If.css +0 -1
package/dist/bridge.js CHANGED
@@ -1 +1 @@
1
- var b=[{id:"quick-open",key:"p"},{id:"commands",key:"p",shift:!0,bareAlias:"F1"},{id:"search",key:"f",shift:!0},{id:"chats",key:"g"},{id:"changes",key:"b",ctrlAlias:{key:"g",shift:!0}},{id:"files",key:"e",shift:!0},{id:"panel-tab-prev",key:"ArrowLeft",alt:!0,textKeeps:!0},{id:"panel-tab-next",key:"ArrowRight",alt:!0,textKeeps:!0},{id:"composer",key:"l"},{id:"rail",key:"k",shift:!0},{id:"keys",key:","},{id:"terminal",key:"j",ctrlAlias:{key:"`"}},{id:"design",key:"d"},{id:"term-tab",key:"`",ctrl:!0,shift:!0},{id:"pick",key:"e"},{id:"inspect",key:"i"},{id:"zen",key:"."},{id:"new",key:"k",aliases:["n"]},{id:"worktree",key:"1-9"},{id:"wt-prev",key:"ArrowUp",alt:!0,ctrlAlias:{key:"Tab",shift:!0},cmdShiftAlias:["[","{"]},{id:"wt-next",key:"ArrowDown",alt:!0,ctrlAlias:{key:"Tab"},cmdShiftAlias:["]","}"]},{id:"wt-unseen-prev",key:"ArrowUp",alt:!0,shift:!0},{id:"wt-unseen-next",key:"ArrowDown",alt:!0,shift:!0},{id:"wt-archive",key:"Backspace",alt:!0,textKeeps:!0,emptyGives:!0},{id:"mark-unread",key:"u",alt:!0,textKeeps:!0},{id:"project",key:"o",ctrlAlias:{key:"r",hostOnly:!0},cmdShiftAlias:["o"]},{id:"refs",key:"g",shift:!0},{id:"routes",key:"u"},{id:"reload",key:"r"},{id:"back",key:"ArrowLeft",textKeeps:!0},{id:"forward",key:"ArrowRight",textKeeps:!0},{id:"close",key:"w"}],j=new Set(["zen","close","back","forward"]);function G(e,{guest:t=!1}={}){if(e.altKey){if(e.metaKey||e.ctrlKey)return null;let r=b.find((i)=>i.alt&&!!i.shift===e.shiftKey&&(i.key===e.key||i.key.length===1&&e.code===`Key${i.key.toUpperCase()}`));return r&&r.id!=="worktree"?{id:r.id}:null}if(!e.metaKey&&!e.ctrlKey){if(e.shiftKey||t)return null;let r=b.find((i)=>i.bareAlias===e.key);return r&&r.id!=="worktree"?{id:r.id}:null}if(!!e.ctrlKey===e.metaKey)return null;let n=e.key.length===1?e.key.toLowerCase():e.key;if(e.metaKey&&!e.shiftKey&&n>="1"&&n<="9")return{id:"worktree",digit:Number(n)};for(let r of b){if(r.id==="worktree")continue;let i=r.ctrlAlias;if(i&&e.ctrlKey&&i.key===n&&!!i.shift===e.shiftKey&&!(t&&i.hostOnly))return{id:r.id};if(e.metaKey&&e.shiftKey&&r.cmdShiftAlias?.includes(n))return{id:r.id};if(r.alt)continue;if(e.ctrlKey&&!r.ctrl||!!r.shift!==e.shiftKey)continue;if(r.key===n||r.aliases?.includes(n))return{id:r.id}}return null}function X(e){if(e.altKey||e.key.toLowerCase()!=="s")return!1;return!!e.ctrlKey!==e.metaKey}function U(e){let t=b.find((n)=>n.id===e);if(!t)throw Error(`unknown chord ${e}`);return t}function q(e){let t=e;if(!t?.tagName)return!1;if(t.isContentEditable||t.tagName==="TEXTAREA")return!0;return t.tagName==="INPUT"&&!["button","checkbox","radio","range","submit","reset"].includes(t.type??"")}var re=Symbol.for("react.forward_ref"),ie=Symbol.for("react.memo");function z(e){if(e._debugSource?.fileName)return{file:e._debugSource.fileName,line:e._debugSource.lineNumber};let t=e._debugStack?.stack;if(t){let n=t.match(/https?:\/\/[^/]+(\/src\/[^)\s?]+)(?:\?[^:)\s]*)?:(\d+):\d+/);if(n?.[1])return{file:n[1],line:Number(n[2])||void 0}}return null}function L(e){for(let t=e;t;t=t.return){let n=z(t);if(n)return n}return null}function C(e){if(typeof e==="function")return e.displayName||e.name||null;let t=e;if(t?.$$typeof===re)return t.displayName||C(t.render);if(t?.$$typeof===ie)return t.displayName||C(t.type);return null}var oe=(e)=>typeof e.type==="string"||e.tag===6,le=(e,t)=>!!e&&(e===t||!!e.stateNode&&e.stateNode===t.stateNode);function se(e){let t=null,n=(r)=>{for(let i=r.child??null;i;i=i.sibling??null)if(oe(i)){if(t)return!1;t=i}else if(!n(i))return!1;return!0};return n(e)?t:null}function ae(e){for(let t=e;t;t=t.return){let n=z(t);if(n)return t._debugOwner===null?null:n}return null}function N(e){let t=L(e),n=null,r=null,i=!1;for(let o=e;o;o=o.return){let s=C(o.type);if(!s)continue;let l=!!e&&le(se(o),e),a=ae(o);if(n&&!(l&&a))break;if(n=s,r=a,i=l,!l)break}if(r&&t&&r.file===t.file&&r.line===t.line)r=null;return{src:t,comp:n,call:r,wraps:i}}function _({src:e,call:t,wraps:n},r){let i=n?t:e,o=n?e:t;return(r?o??i:i??o)??null}if(window.__toyonBridge)throw Error("Toyon bridge already installed");window.__toyonBridge=!0;var v=window.__toyonShellOrigins??[],P=null,c=(e)=>{try{let t=P?[P]:v.length?v:["*"];for(let n of t)window.parent.postMessage({__toyon:!0,...e},n)}catch{}};c({type:"loaded",url:location.href,title:document.title});var E="#fa891e",Z="#1d2021";window.addEventListener("vite:afterUpdate",()=>c({type:"hmr"}));window.addEventListener("error",(e)=>{c({type:"page-error",message:String(e.message),source:e.filename,line:e.lineno})});window.addEventListener("unhandledrejection",(e)=>{c({type:"page-error",message:`unhandled rejection: ${String(e.reason)}`})});var K=()=>c({type:"navigated",url:location.href,title:document.title}),ce=history.pushState.bind(history);history.pushState=(...e)=>{ce(...e),B(),K()};var ue=history.replaceState.bind(history);history.replaceState=(...e)=>{ue(...e),K()};window.addEventListener("popstate",K);window.addEventListener("hashchange",K);var de=window.navigation,g=null;function B(){g=de?.currentEntry?.index??null}B();window.addEventListener("popstate",()=>{let e=g;B();let t=e===null||g===null||e===g?void 0:g<e?"back":"forward";c({type:"traversed",...t?{dir:t}:{}})});var fe=performance.getEntriesByType("navigation")[0];if(fe?.type==="back_forward")c({type:"traversed"});window.addEventListener("pageshow",(e)=>{if(e.persisted)c({type:"traversed"})});var F=document.title;if(document.head)new MutationObserver(()=>{if(document.title===F)return;F=document.title,c({type:"title",title:F})}).observe(document.head,{childList:!0,subtree:!0,characterData:!0});var V=!1,R=null;window.addEventListener("keyup",(e)=>{if(window.__toyonShell||e.key!==R)return;R=null,c({type:"key",key:e.key,meta:!1,up:!0})},!0);window.addEventListener("keydown",(e)=>{if(window.__toyonShell)return;if(X(e))e.preventDefault();let t=G(e,{guest:!0});if(t&&U(t.id).textKeeps&&q(e.target))return;if(V){if(!t||!j.has(t.id))return}else if(e.key==="Escape"){c({type:"key",key:"Escape",meta:!1});return}else if(!t)return;e.preventDefault(),e.stopPropagation(),c({type:"key",key:e.key,code:e.code,meta:e.metaKey,ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey}),R=e.altKey?"Alt":e.ctrlKey?"Control":e.metaKey?"Meta":null},!0);var D=()=>c({type:"focus",gesture:navigator.userActivation?.isActive??!0});window.addEventListener("focusin",D,!0);window.addEventListener("focus",D);if(document.hasFocus()&&document.activeElement&&document.activeElement!==document.body)D();var J=(e)=>!e.defaultPrevented&&!!e.dataTransfer?.types.includes("Files");window.addEventListener("dragover",(e)=>{if(!J(e))return;if(e.preventDefault(),e.dataTransfer)e.dataTransfer.dropEffect="copy";c({type:"drag-files"})});window.addEventListener("drop",(e)=>{if(!J(e))return;e.preventDefault(),c({type:"drop-files",files:Array.from(e.dataTransfer?.files??[])})});function H(e){for(let t of Object.keys(e))if(t.startsWith("__reactFiber$"))return e[t]??null;return null}var y=null;function pe(){if(y?.isConnected)return y;return y=document.createElement("div"),y.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483647;",document.documentElement.appendChild(y),y}function m(){if(y)y.innerHTML=""}var O=20;function x(e,t,n=!0){let r=document.createElement("div");if(r.style.cssText=`position:fixed;left:${e.left}px;top:${e.top}px;width:${e.width}px;height:${e.height}px;outline:2px solid ${E};outline-offset:-1px;${n?`background:${E}14;`:""}border-radius:2px;`,t){let i=e.top>=O,o=e.bottom+O<=window.innerHeight;if(t.style.top=i?`${-O}px`:o?`${e.height+4}px`:"2px",!i&&!o)t.style.left="2px";r.appendChild(t)}if(pe().appendChild(r),t){let i=t.getBoundingClientRect(),o=i.right-(window.innerWidth-2);if(o>0){let s=Number.parseFloat(t.style.left||"0");t.style.left=`${s-Math.min(o,Math.max(0,i.left-2))}px`}}}function k(e,t){let n=document.createElement("div");if(n.textContent=e,n.style.cssText=`position:absolute;left:0;background:${E};color:${Z};font:11px -apple-system,sans-serif;padding:1px 6px;border-radius:3px;white-space:nowrap;`,t){let r=document.createElement("span");r.textContent=` ${t}`,r.style.opacity="0.55",n.appendChild(r)}return n}var S=!1,d=null,p=!1,f=!1,h=!1,M=(e)=>`${te(e.file)}${e.line?`:${e.line}`:""}`;function T(e){d=e,m();let t=N(H(e)),{src:n,comp:r,call:i}=t,o=_(t,f),s=o===n?i:n,l=p!==h,a=(...w)=>w.filter(Boolean).join(" ")||void 0,u=l?o?k(`open ${M(o)}`,a(s&&`⇧ ${M(s)}`,h&&"⌥ chat")):k(`find ${Y(e)}`,a(h&&"⌥ chat")):k(r?`<${r} />${o?` · ${M(o)}`:""}`:Y(e),a(!h&&"⌥ code"));x(e.getBoundingClientRect(),u,l)}function Y(e){let t=e.tagName.toLowerCase(),n=e.classList[0];return(e.id?`${t}#${e.id}`:n?`${t}.${n}`:t).slice(0,48)}var ye=new Set(["name","placeholder","aria-label","title","alt","for","href","type","role","src"]);function he(e){let t="";for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)t+=r.textContent??"";let n=[];for(let r of Array.from(e.attributes)){if(n.length===12)break;if(r.value&&(ye.has(r.name)||r.name.startsWith("data-")))n.push([r.name.slice(0,40),r.value.slice(0,200)])}return{tag:e.tagName.toLowerCase().slice(0,40),id:e.id.slice(0,200),classes:Array.from(e.classList).slice(0,16).map((r)=>r.slice(0,120)),text:t.replace(/\s+/g," ").trim().slice(0,200),attrs:n}}function Q(e){let t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return;let n=t!==d||e.altKey!==p||e.shiftKey!==f;if(p=e.altKey,f=e.shiftKey,n)T(t)}function ee(e){e.preventDefault(),e.stopPropagation();let t=d??document.elementFromPoint(e.clientX,e.clientY),n=N(t?H(t):null),{src:r,comp:i,call:o}=n;f=e.shiftKey;let s=_(n,f),l=e.altKey!==h;if(I(),!t)return;c({type:"picked",verb:l?"code":"chat",site:s&&s===o?"call":"source",component:i,file:r?.file??null,line:r?.line??null,callFile:o?.file??null,callLine:o?.line??null,selector:ge(t),tag:t.tagName.toLowerCase(),classes:t.className?.toString?.().slice(0,200)??"",text:t.textContent?.trim().slice(0,120)??"",html:t.outerHTML.slice(0,600),route:location.pathname+location.search,element:he(t)})}function A(e){if(e.key==="Escape"&&e.type==="keydown"){e.preventDefault(),e.stopPropagation(),I(),c({type:"pick-cancel"});return}if((e.key==="Alt"||e.key==="Shift")&&(p!==e.altKey||f!==e.shiftKey)){if(p=e.altKey,f=e.shiftKey,d)T(d)}}function me(e){if(h=e,S){if(d)T(d);return}S=!0,d=null,p=!1,f=!1,document.addEventListener("mousemove",Q,!0),document.addEventListener("click",ee,!0),document.addEventListener("keydown",A,!0),document.addEventListener("keyup",A,!0),document.documentElement.style.cursor="crosshair"}function I(){S=!1,h=!1,d=null,p=!1,f=!1,m(),document.removeEventListener("mousemove",Q,!0),document.removeEventListener("click",ee,!0),document.removeEventListener("keydown",A,!0),document.removeEventListener("keyup",A,!0),document.documentElement.style.cursor=""}function ge(e){let t=[],n=e;for(let r=0;n&&n!==document.documentElement&&r<6;r++){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let i=n.parentElement,o=i?Array.from(i.children).indexOf(n)+1:1;t.unshift(`${n.tagName.toLowerCase()}:nth-child(${o})`),n=i}return t.join(" > ")}function te(e){let t=e.lastIndexOf("/src/");return t>=0?e.slice(t+1):e.split("/").slice(-2).join("/")}function ke(e,t){return e.endsWith(t)||t.endsWith(te(e))}function we(e,t){let n=[],r=0;for(let s of Array.from(document.querySelectorAll("*"))){let l=L(H(s));if(l)r++;if(!l||!ke(l.file,e))continue;n.push({el:s,line:l.line??-1})}if(!t||t.length===0)return{matched:n,fromFile:n,withSource:r};if(t.length===1&&t[0][0]===t[0][1]){let s=t[0][0],l=n.filter((u)=>u.line===s);if(l.length>0)return{matched:l,fromFile:n,withSource:r};let a=n.filter((u)=>u.line>0&&u.line<s);return a.sort((u,w)=>w.line-u.line),{matched:a.slice(0,1),fromFile:n,withSource:r}}return{matched:n.filter((s)=>t.some(([l,a])=>s.line>=l-8&&s.line<=a+1)),fromFile:n,withSource:r}}function be(e,t){m();let{matched:n,fromFile:r,withSource:i}=we(e,t),o=0;for(let{el:s}of n){if(o>=40)break;let l=s.getBoundingClientRect();if(l.width>0&&l.height>0)x(l),o++}if(o===0)c({type:"highlight-miss",path:e,fileMatched:r.length,withSource:i,ranges:t})}window.addEventListener("message",(e)=>{if(e.source!==window.parent)return;if(v.length&&!v.includes(e.origin))return;let t=e.data;if(!t?.__toyon)return;P=e.origin;let n=t;switch(n.type){case"reload":location.reload();break;case"navigate":if(/^[/?#]/.test(n.path))location.assign(n.path);break;case"back":case"forward":{let r=window.navigation;if((n.type==="back"?r?.canGoBack:r?.canGoForward)===!1)break;if(n.type==="back")history.back();else history.forward();break}case"links":{let r=new Set,i=[];for(let o of Array.from(document.querySelectorAll("a[href]"))){if(o.origin!==location.origin||o.target==="_blank"||o.hasAttribute("download"))continue;let s=o.pathname+(o.hash.startsWith("#/")?o.hash:"");if(s.startsWith("/__toyon")||r.has(s))continue;r.add(s);let l=(o.textContent||o.getAttribute("aria-label")||"").replace(/\s+/g," ").trim();if(i.push({path:s,text:l.slice(0,80)}),i.length>=200)break}c({type:"links",links:i});break}case"pick-start":me(n.verb==="code");break;case"pick-mods":if(S&&(p!==n.alt||f!==n.shift)){if(p=n.alt,f=n.shift,d)T(d)}break;case"pick-cancel":I();break;case"highlight-file":be(n.path,n.ranges??null);break;case"highlight-computed":{m();let r=/^(color|font|line-height|letter-|text-|word-)/,i=(l)=>{if(/^(INPUT|TEXTAREA|SELECT)$/.test(l.tagName))return!0;for(let a=l.firstChild;a;a=a.nextSibling)if(a.nodeType===3&&a.textContent&&a.textContent.trim())return!0;return!1},o=document.querySelectorAll("*"),s=!0;for(let l=0;l<o.length;l++){let a=getComputedStyle(o[l]),u=([W,ne])=>a.getPropertyValue(W)===ne&&(!r.test(W)||i(o[l]));if(n.match==="any"?n.props.some(u):n.props.every(u))x(o[l].getBoundingClientRect(),s&&n.label?k(n.label):void 0),s=!1}break}case"highlight-selector":{m();try{let r=document.querySelectorAll(n.selector);for(let i=0;i<r.length;i++)x(r[i].getBoundingClientRect(),i===0&&n.label?k(n.label):void 0)}catch{}break}case"highlight-clear":m();break;case"zen":V=n.on;break;case"theme":if(/^#[0-9a-f]{3,8}$/i.test(n.accent))E=n.accent;if(/^#[0-9a-f]{3,8}$/i.test(n.accentFg))Z=n.accentFg;break}});
1
+ var b=[{id:"quick-open",key:"p"},{id:"commands",key:"p",shift:!0,bareAlias:"F1"},{id:"search",key:"f",shift:!0},{id:"chats",key:"g"},{id:"changes",key:"b",ctrlAlias:{key:"g",shift:!0}},{id:"files",key:"e",shift:!0},{id:"panel-tab-prev",key:"ArrowLeft",alt:!0,textKeeps:!0},{id:"panel-tab-next",key:"ArrowRight",alt:!0,textKeeps:!0},{id:"composer",key:"l"},{id:"rail",key:"k",shift:!0},{id:"keys",key:","},{id:"terminal",key:"j",ctrlAlias:{key:"`"}},{id:"design",key:"d"},{id:"term-tab",key:"`",ctrl:!0,shift:!0},{id:"pick",key:"e"},{id:"inspect",key:"i"},{id:"zen",key:"."},{id:"new",key:"k",aliases:["n"]},{id:"worktree",key:"1-9"},{id:"wt-prev",key:"ArrowUp",alt:!0,ctrlAlias:{key:"Tab",shift:!0},cmdShiftAlias:["[","{"]},{id:"wt-next",key:"ArrowDown",alt:!0,ctrlAlias:{key:"Tab"},cmdShiftAlias:["]","}"]},{id:"wt-unseen-prev",key:"ArrowUp",alt:!0,shift:!0},{id:"wt-unseen-next",key:"ArrowDown",alt:!0,shift:!0},{id:"wt-archive",key:"Backspace",alt:!0,textKeeps:!0,emptyGives:!0},{id:"mark-unread",key:"u",alt:!0,textKeeps:!0},{id:"project",key:"o",ctrlAlias:{key:"r",hostOnly:!0},cmdShiftAlias:["o"]},{id:"refs",key:"g",shift:!0},{id:"routes",key:"u"},{id:"reload",key:"r"},{id:"back",key:"ArrowLeft",textKeeps:!0},{id:"forward",key:"ArrowRight",textKeeps:!0},{id:"close",key:"w"}],G=new Set(["zen","close","back","forward"]);function X(e,{guest:t=!1}={}){if(e.altKey){if(e.metaKey||e.ctrlKey)return null;let r=b.find((i)=>i.alt&&!!i.shift===e.shiftKey&&(i.key===e.key||i.key.length===1&&e.code===`Key${i.key.toUpperCase()}`));return r&&r.id!=="worktree"?{id:r.id}:null}if(!e.metaKey&&!e.ctrlKey){if(e.shiftKey||t)return null;let r=b.find((i)=>i.bareAlias===e.key);return r&&r.id!=="worktree"?{id:r.id}:null}if(!!e.ctrlKey===e.metaKey)return null;let n=e.key.length===1?e.key.toLowerCase():e.key;if(e.metaKey&&!e.shiftKey&&n>="1"&&n<="9")return{id:"worktree",digit:Number(n)};for(let r of b){if(r.id==="worktree")continue;let i=r.ctrlAlias;if(i&&e.ctrlKey&&i.key===n&&!!i.shift===e.shiftKey&&!(t&&i.hostOnly))return{id:r.id};if(e.metaKey&&e.shiftKey&&r.cmdShiftAlias?.includes(n))return{id:r.id};if(r.alt)continue;if(e.ctrlKey&&!r.ctrl||!!r.shift!==e.shiftKey)continue;if(r.key===n||r.aliases?.includes(n))return{id:r.id}}return null}function U(e){if(e.altKey||e.key.toLowerCase()!=="s")return!1;return!!e.ctrlKey!==e.metaKey}function q(e){let t=b.find((n)=>n.id===e);if(!t)throw Error(`unknown chord ${e}`);return t}function z(e){let t=e;if(!t?.tagName)return!1;if(t.isContentEditable||t.tagName==="TEXTAREA")return!0;return t.tagName==="INPUT"&&!["button","checkbox","radio","range","submit","reset"].includes(t.type??"")}var re=Symbol.for("react.forward_ref"),ie=Symbol.for("react.memo");function Y(e){if(e._debugSource?.fileName)return{file:e._debugSource.fileName,line:e._debugSource.lineNumber};let t=e._debugStack?.stack;if(t){let n=t.match(/https?:\/\/[^/]+(\/src\/[^)\s?]+)(?:\?[^:)\s]*)?:(\d+):\d+/);if(n?.[1])return{file:n[1],line:Number(n[2])||void 0}}return null}function L(e){for(let t=e;t;t=t.return){let n=Y(t);if(n)return n}return null}function C(e){if(typeof e==="function")return e.displayName||e.name||null;let t=e;if(t?.$$typeof===re)return t.displayName||C(t.render);if(t?.$$typeof===ie)return t.displayName||C(t.type);return null}var oe=(e)=>typeof e.type==="string"||e.tag===6,le=(e,t)=>!!e&&(e===t||!!e.stateNode&&e.stateNode===t.stateNode);function se(e){let t=null,n=(r)=>{for(let i=r.child??null;i;i=i.sibling??null)if(oe(i)){if(t)return!1;t=i}else if(!n(i))return!1;return!0};return n(e)?t:null}function ae(e){for(let t=e;t;t=t.return){let n=Y(t);if(n)return t._debugOwner===null?null:n}return null}function N(e){let t=L(e),n=null,r=null,i=!1;for(let o=e;o;o=o.return){let s=C(o.type);if(!s)continue;let l=!!e&&le(se(o),e),a=ae(o);if(n&&!(l&&a))break;if(n=s,r=a,i=l,!l)break}if(r&&t&&r.file===t.file&&r.line===t.line)r=null;return{src:t,comp:n,call:r,wraps:i}}function _({src:e,call:t,wraps:n},r){let i=n?t:e,o=n?e:t;return(r?o??i:i??o)??null}if(window.__toyonBridge)throw Error("Toyon bridge already installed");window.__toyonBridge=!0;var v=window.__toyonShellOrigins??[],P=null,c=(e)=>{try{let t=P?[P]:v.length?v:["*"];for(let n of t)window.parent.postMessage({__toyon:!0,...e},n)}catch{}};c({type:"loaded",url:location.href,title:document.title});var E="#fa891e",V="#1d2021";window.addEventListener("vite:afterUpdate",()=>c({type:"hmr"}));window.addEventListener("error",(e)=>{c({type:"page-error",message:String(e.message),source:e.filename,line:e.lineno})});window.addEventListener("unhandledrejection",(e)=>{c({type:"page-error",message:`unhandled rejection: ${String(e.reason)}`})});var K=()=>c({type:"navigated",url:location.href,title:document.title}),ce=history.pushState.bind(history);history.pushState=(...e)=>{ce(...e),B(),K()};var ue=history.replaceState.bind(history);history.replaceState=(...e)=>{ue(...e),K()};window.addEventListener("popstate",K);window.addEventListener("hashchange",K);var de=window.navigation,g=null;function B(){g=de?.currentEntry?.index??null}B();window.addEventListener("popstate",()=>{let e=g;B();let t=e===null||g===null||e===g?void 0:g<e?"back":"forward";c({type:"traversed",...t?{dir:t}:{}})});var fe=performance.getEntriesByType("navigation")[0];if(fe?.type==="back_forward")c({type:"traversed"});window.addEventListener("pageshow",(e)=>{if(e.persisted)c({type:"traversed"})});var F=document.title;if(document.head)new MutationObserver(()=>{if(document.title===F)return;F=document.title,c({type:"title",title:F})}).observe(document.head,{childList:!0,subtree:!0,characterData:!0});var J=!1,R=null;window.addEventListener("keyup",(e)=>{if(window.__toyonShell||e.key!==R)return;R=null,c({type:"key",key:e.key,meta:!1,up:!0})},!0);window.addEventListener("keydown",(e)=>{if(window.__toyonShell)return;if(U(e))e.preventDefault();let t=X(e,{guest:!0});if(t&&q(t.id).textKeeps&&z(e.target))return;if(J){if(!t||!G.has(t.id))return}else if(e.key==="Escape"){c({type:"key",key:"Escape",meta:!1});return}else if(!t)return;e.preventDefault(),e.stopPropagation(),c({type:"key",key:e.key,code:e.code,meta:e.metaKey,ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey}),R=e.altKey?"Alt":e.ctrlKey?"Control":e.metaKey?"Meta":null},!0);var D=()=>c({type:"focus",gesture:navigator.userActivation?.isActive??!0});window.addEventListener("focusin",D,!0);window.addEventListener("focus",D);if(document.hasFocus()&&document.activeElement&&document.activeElement!==document.body)D();var H=(e)=>!e.defaultPrevented&&!!e.dataTransfer?.types.includes("Files");window.addEventListener("dragover",(e)=>{if(!H(e))return;if(e.preventDefault(),e.dataTransfer)e.dataTransfer.dropEffect="copy";c({type:"drag-files",over:!0})});window.addEventListener("dragleave",(e)=>{if(H(e))c({type:"drag-files",over:!1})});window.addEventListener("drop",(e)=>{if(!H(e))return;e.preventDefault(),c({type:"drop-files",files:Array.from(e.dataTransfer?.files??[])})});function I(e){for(let t of Object.keys(e))if(t.startsWith("__reactFiber$"))return e[t]??null;return null}var y=null;function pe(){if(y?.isConnected)return y;return y=document.createElement("div"),y.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483647;",document.documentElement.appendChild(y),y}function m(){if(y)y.innerHTML=""}var O=20;function x(e,t,n=!0){let r=document.createElement("div");if(r.style.cssText=`position:fixed;left:${e.left}px;top:${e.top}px;width:${e.width}px;height:${e.height}px;outline:2px solid ${E};outline-offset:-1px;${n?`background:${E}14;`:""}border-radius:2px;`,t){let i=e.top>=O,o=e.bottom+O<=window.innerHeight;if(t.style.top=i?`${-O}px`:o?`${e.height+4}px`:"2px",!i&&!o)t.style.left="2px";r.appendChild(t)}if(pe().appendChild(r),t){let i=t.getBoundingClientRect(),o=i.right-(window.innerWidth-2);if(o>0){let s=Number.parseFloat(t.style.left||"0");t.style.left=`${s-Math.min(o,Math.max(0,i.left-2))}px`}}}function k(e,t){let n=document.createElement("div");if(n.textContent=e,n.style.cssText=`position:absolute;left:0;background:${E};color:${V};font:11px -apple-system,sans-serif;padding:1px 6px;border-radius:3px;white-space:nowrap;`,t){let r=document.createElement("span");r.textContent=` ${t}`,r.style.opacity="0.55",n.appendChild(r)}return n}var S=!1,d=null,p=!1,f=!1,h=!1,M=(e)=>`${te(e.file)}${e.line?`:${e.line}`:""}`;function T(e){d=e,m();let t=N(I(e)),{src:n,comp:r,call:i}=t,o=_(t,f),s=o===n?i:n,l=p!==h,a=(...w)=>w.filter(Boolean).join(" ")||void 0,u=l?o?k(`open ${M(o)}`,a(s&&`⇧ ${M(s)}`,h&&"⌥ chat")):k(`find ${Z(e)}`,a(h&&"⌥ chat")):k(r?`<${r} />${o?` · ${M(o)}`:""}`:Z(e),a(!h&&"⌥ code"));x(e.getBoundingClientRect(),u,l)}function Z(e){let t=e.tagName.toLowerCase(),n=e.classList[0];return(e.id?`${t}#${e.id}`:n?`${t}.${n}`:t).slice(0,48)}var ye=new Set(["name","placeholder","aria-label","title","alt","for","href","type","role","src"]);function he(e){let t="";for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)t+=r.textContent??"";let n=[];for(let r of Array.from(e.attributes)){if(n.length===12)break;if(r.value&&(ye.has(r.name)||r.name.startsWith("data-")))n.push([r.name.slice(0,40),r.value.slice(0,200)])}return{tag:e.tagName.toLowerCase().slice(0,40),id:e.id.slice(0,200),classes:Array.from(e.classList).slice(0,16).map((r)=>r.slice(0,120)),text:t.replace(/\s+/g," ").trim().slice(0,200),attrs:n}}function Q(e){let t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return;let n=t!==d||e.altKey!==p||e.shiftKey!==f;if(p=e.altKey,f=e.shiftKey,n)T(t)}function ee(e){e.preventDefault(),e.stopPropagation();let t=d??document.elementFromPoint(e.clientX,e.clientY),n=N(t?I(t):null),{src:r,comp:i,call:o}=n;f=e.shiftKey;let s=_(n,f),l=e.altKey!==h;if(W(),!t)return;c({type:"picked",verb:l?"code":"chat",site:s&&s===o?"call":"source",component:i,file:r?.file??null,line:r?.line??null,callFile:o?.file??null,callLine:o?.line??null,selector:ge(t),tag:t.tagName.toLowerCase(),classes:t.className?.toString?.().slice(0,200)??"",text:t.textContent?.trim().slice(0,120)??"",html:t.outerHTML.slice(0,600),route:location.pathname+location.search,element:he(t)})}function A(e){if(e.key==="Escape"&&e.type==="keydown"){e.preventDefault(),e.stopPropagation(),W(),c({type:"pick-cancel"});return}if((e.key==="Alt"||e.key==="Shift")&&(p!==e.altKey||f!==e.shiftKey)){if(p=e.altKey,f=e.shiftKey,d)T(d)}}function me(e){if(h=e,S){if(d)T(d);return}S=!0,d=null,p=!1,f=!1,document.addEventListener("mousemove",Q,!0),document.addEventListener("click",ee,!0),document.addEventListener("keydown",A,!0),document.addEventListener("keyup",A,!0),document.documentElement.style.cursor="crosshair"}function W(){S=!1,h=!1,d=null,p=!1,f=!1,m(),document.removeEventListener("mousemove",Q,!0),document.removeEventListener("click",ee,!0),document.removeEventListener("keydown",A,!0),document.removeEventListener("keyup",A,!0),document.documentElement.style.cursor=""}function ge(e){let t=[],n=e;for(let r=0;n&&n!==document.documentElement&&r<6;r++){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let i=n.parentElement,o=i?Array.from(i.children).indexOf(n)+1:1;t.unshift(`${n.tagName.toLowerCase()}:nth-child(${o})`),n=i}return t.join(" > ")}function te(e){let t=e.lastIndexOf("/src/");return t>=0?e.slice(t+1):e.split("/").slice(-2).join("/")}function ke(e,t){return e.endsWith(t)||t.endsWith(te(e))}function we(e,t){let n=[],r=0;for(let s of Array.from(document.querySelectorAll("*"))){let l=L(I(s));if(l)r++;if(!l||!ke(l.file,e))continue;n.push({el:s,line:l.line??-1})}if(!t||t.length===0)return{matched:n,fromFile:n,withSource:r};if(t.length===1&&t[0][0]===t[0][1]){let s=t[0][0],l=n.filter((u)=>u.line===s);if(l.length>0)return{matched:l,fromFile:n,withSource:r};let a=n.filter((u)=>u.line>0&&u.line<s);return a.sort((u,w)=>w.line-u.line),{matched:a.slice(0,1),fromFile:n,withSource:r}}return{matched:n.filter((s)=>t.some(([l,a])=>s.line>=l-8&&s.line<=a+1)),fromFile:n,withSource:r}}function be(e,t){m();let{matched:n,fromFile:r,withSource:i}=we(e,t),o=0;for(let{el:s}of n){if(o>=40)break;let l=s.getBoundingClientRect();if(l.width>0&&l.height>0)x(l),o++}if(o===0)c({type:"highlight-miss",path:e,fileMatched:r.length,withSource:i,ranges:t})}window.addEventListener("message",(e)=>{if(e.source!==window.parent)return;if(v.length&&!v.includes(e.origin))return;let t=e.data;if(!t?.__toyon)return;P=e.origin;let n=t;switch(n.type){case"reload":location.reload();break;case"navigate":if(/^[/?#]/.test(n.path))location.assign(n.path);break;case"back":case"forward":{let r=window.navigation;if((n.type==="back"?r?.canGoBack:r?.canGoForward)===!1)break;if(n.type==="back")history.back();else history.forward();break}case"links":{let r=new Set,i=[];for(let o of Array.from(document.querySelectorAll("a[href]"))){if(o.origin!==location.origin||o.target==="_blank"||o.hasAttribute("download"))continue;let s=o.pathname+(o.hash.startsWith("#/")?o.hash:"");if(s.startsWith("/__toyon")||r.has(s))continue;r.add(s);let l=(o.textContent||o.getAttribute("aria-label")||"").replace(/\s+/g," ").trim();if(i.push({path:s,text:l.slice(0,80)}),i.length>=200)break}c({type:"links",links:i});break}case"pick-start":me(n.verb==="code");break;case"pick-mods":if(S&&(p!==n.alt||f!==n.shift)){if(p=n.alt,f=n.shift,d)T(d)}break;case"pick-cancel":W();break;case"highlight-file":be(n.path,n.ranges??null);break;case"highlight-computed":{m();let r=/^(color|font|line-height|letter-|text-|word-)/,i=(l)=>{if(/^(INPUT|TEXTAREA|SELECT)$/.test(l.tagName))return!0;for(let a=l.firstChild;a;a=a.nextSibling)if(a.nodeType===3&&a.textContent&&a.textContent.trim())return!0;return!1},o=document.querySelectorAll("*"),s=!0;for(let l=0;l<o.length;l++){let a=getComputedStyle(o[l]),u=([j,ne])=>a.getPropertyValue(j)===ne&&(!r.test(j)||i(o[l]));if(n.match==="any"?n.props.some(u):n.props.every(u))x(o[l].getBoundingClientRect(),s&&n.label?k(n.label):void 0),s=!1}break}case"highlight-selector":{m();try{let r=document.querySelectorAll(n.selector);for(let i=0;i<r.length;i++)x(r[i].getBoundingClientRect(),i===0&&n.label?k(n.label):void 0)}catch{}break}case"highlight-clear":m();break;case"zen":J=n.on;break;case"theme":if(/^#[0-9a-f]{3,8}$/i.test(n.accent))E=n.accent;if(/^#[0-9a-f]{3,8}$/i.test(n.accentFg))V=n.accentFg;break}});
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import { join as join7, resolve } from "path";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "toyon",
10
- version: "0.13.0",
10
+ version: "0.15.0",
11
11
  description: "Toyon is where coding agents work on your web app while you check each change by using it. Every chat gets its own running copy with a live preview.",
12
12
  license: "MIT",
13
13
  type: "module",
@@ -5373,8 +5373,9 @@ function post(route, token, body) {
5373
5373
  body: JSON.stringify(body)
5374
5374
  });
5375
5375
  }
5376
+ var shellOrigins = ["http://toyon.localhost", `http://toyon.localhost:${port}`];
5376
5377
  function shellUrl(token, branded) {
5377
- return branded ? `http://toyon.localhost/#token=${token}` : `http://toyon.localhost:${port}/#token=${token}`;
5378
+ return `${branded ? shellOrigins[0] : shellOrigins[1]}/#token=${token}`;
5378
5379
  }
5379
5380
 
5380
5381
  // src/openUrl.ts
@@ -5386,17 +5387,16 @@ function openUrl(url) {
5386
5387
  }
5387
5388
 
5388
5389
  // src/app.ts
5389
- var CHROMIUMS = ["Google Chrome", "Arc", "Brave Browser", "Microsoft Edge", "Chromium"];
5390
- var DATA_DIRS = {
5391
- "Google Chrome": "Google/Chrome",
5392
- Arc: "Arc/User Data",
5393
- "Brave Browser": "BraveSoftware/Brave-Browser",
5394
- "Microsoft Edge": "Microsoft Edge",
5395
- Chromium: "Chromium"
5396
- };
5390
+ var CHROMIUMS = [
5391
+ { name: "Google Chrome", dataDir: "Google/Chrome", bundleId: "com.google.chrome" },
5392
+ { name: "Arc", dataDir: "Arc/User Data", bundleId: "company.thebrowser.browser" },
5393
+ { name: "Brave Browser", dataDir: "BraveSoftware/Brave-Browser", bundleId: "com.brave.browser" },
5394
+ { name: "Microsoft Edge", dataDir: "Microsoft Edge", bundleId: "com.microsoft.edgemac" },
5395
+ { name: "Chromium", dataDir: "Chromium", bundleId: "org.chromium.chromium" }
5396
+ ];
5397
5397
  var pwaCacheDir = join3(home, "pwa");
5398
5398
  function profilesOf(browser) {
5399
- const root = join3(homedir2(), "Library", "Application Support", DATA_DIRS[browser] ?? browser);
5399
+ const root = join3(homedir2(), "Library", "Application Support", browser.dataDir);
5400
5400
  if (!existsSync3(root))
5401
5401
  return [];
5402
5402
  return readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join3(root, d.name));
@@ -5404,14 +5404,15 @@ function profilesOf(browser) {
5404
5404
  function pwaStillInstalled(browser, id) {
5405
5405
  return profilesOf(browser).some((p) => existsSync3(join3(p, "Web Applications", "Manifest Resources", id)));
5406
5406
  }
5407
- function findPwaId(browser, manifestId) {
5408
- const cache = join3(pwaCacheDir, `${browser.replace(/\W+/g, "-")}.id`);
5407
+ function findPwaId(browser) {
5408
+ const cache = join3(pwaCacheDir, `${browser.name.replace(/\W+/g, "-")}.id`);
5409
5409
  if (existsSync3(cache)) {
5410
5410
  const id = readFileSync2(cache, "utf8").trim();
5411
5411
  if (/^[a-p]{32}$/.test(id) && pwaStillInstalled(browser, id))
5412
5412
  return id;
5413
5413
  }
5414
- const re = new RegExp(`web_apps-dt-([a-p]{32})[\\s\\S]{0,16}?${manifestId.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}`);
5414
+ const ids = shellOrigins.map((o) => `${o}/`.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")).join("|");
5415
+ const re = new RegExp(`web_apps-dt-([a-p]{32})[\\s\\S]{0,16}?(?:${ids})`);
5415
5416
  for (const p of profilesOf(browser)) {
5416
5417
  const dir = join3(p, "Sync Data", "LevelDB");
5417
5418
  if (!existsSync3(dir))
@@ -5429,29 +5430,48 @@ function findPwaId(browser, manifestId) {
5429
5430
  }
5430
5431
  return null;
5431
5432
  }
5432
- function showAppWindow(daemon) {
5433
- const appUrl = shellUrl(daemon.token, false);
5434
- console.log(`toyon: app window (${appUrl.split("#")[0]})`);
5435
- if (openAppWindow(appUrl))
5433
+ function openShell(daemon) {
5434
+ console.log(`toyon: ${daemon.url}`);
5435
+ const found = process.platform === "darwin" ? launchInstalledApp() : { kind: "none" };
5436
+ if (found.kind === "launched")
5436
5437
  return;
5437
- console.log("no Chromium browser found; opening in default browser");
5438
5438
  openUrl(daemon.url);
5439
+ if (found.kind !== "uninstalled")
5440
+ return;
5441
+ const where = defaultBrowserInstalls(readLinkHandlers()) ? "" : `open it in ${found.browser} to `;
5442
+ console.log(`tip: ${where}install Toyon as an app from the top bar; toyon then opens in its own window`);
5439
5443
  }
5440
- function openAppWindow(appUrl) {
5441
- const manifestId = new URL("/", appUrl).href;
5444
+ function launchInstalledApp() {
5445
+ let seen = null;
5442
5446
  for (const app of CHROMIUMS) {
5443
- if (spawnSync("open", ["-Ra", app]).status === 0) {
5444
- const id = findPwaId(app, manifestId);
5445
- const flag = id ? `--app-id=${id}` : `--app=${appUrl}`;
5446
- spawn3("open", ["-na", app, "--args", flag], { stdio: "ignore" }).unref();
5447
- if (!id) {
5448
- console.log(`tip: install Toyon as an app (browser menu, then Install, or the install button in the top bar when opened in a tab)`);
5449
- console.log(` once installed, it gets a native-style title bar; \`toyon --app\` then launches the installed app`);
5450
- }
5451
- return true;
5452
- }
5447
+ if (spawnSync("open", ["-Ra", app.name]).status !== 0)
5448
+ continue;
5449
+ seen ??= app.name;
5450
+ const id = findPwaId(app);
5451
+ if (!id)
5452
+ continue;
5453
+ spawn3("open", ["-na", app.name, "--args", `--app-id=${id}`], { stdio: "ignore" }).unref();
5454
+ return { kind: "launched" };
5453
5455
  }
5454
- return false;
5456
+ return seen ? { kind: "uninstalled", browser: seen } : { kind: "none" };
5457
+ }
5458
+ function readLinkHandlers() {
5459
+ const plist = join3(homedir2(), "Library", "Preferences", "com.apple.LaunchServices", "com.apple.launchservices.secure.plist");
5460
+ const out = spawnSync("plutil", ["-convert", "json", "-o", "-", plist], { encoding: "utf8" });
5461
+ if (out.status !== 0)
5462
+ return null;
5463
+ try {
5464
+ return JSON.parse(out.stdout).LSHandlers;
5465
+ } catch {
5466
+ return null;
5467
+ }
5468
+ }
5469
+ function defaultBrowserInstalls(handlers) {
5470
+ if (!Array.isArray(handlers))
5471
+ return false;
5472
+ const http = handlers.find((h) => typeof h === "object" && h !== null && h.LSHandlerURLScheme === "http");
5473
+ const id = http?.LSHandlerRoleAll?.toLowerCase();
5474
+ return id !== undefined && CHROMIUMS.some((c) => id === c.bundleId || id.startsWith(`${c.bundleId}.`));
5455
5475
  }
5456
5476
 
5457
5477
  // src/args.ts
@@ -5532,18 +5552,14 @@ function parseArgs(argv) {
5532
5552
  }
5533
5553
  }
5534
5554
  let path = null;
5535
- let app = false;
5536
5555
  for (const a of argv) {
5537
- if (a === "--app" || a === "--pwa")
5538
- app = true;
5539
- else if (a.startsWith("-"))
5556
+ if (a.startsWith("-"))
5540
5557
  return { kind: "error", message: `unknown option ${a}` };
5541
- else if (path !== null)
5558
+ if (path !== null)
5542
5559
  return { kind: "error", message: "Toyon opens one path at a time" };
5543
- else
5544
- path = a;
5560
+ path = a;
5545
5561
  }
5546
- return { kind: "open", path, app };
5562
+ return { kind: "open", path };
5547
5563
  }
5548
5564
  function parseLogs(rest) {
5549
5565
  let follow = false;
@@ -5641,9 +5657,6 @@ usage
5641
5657
  toyon deploy fly destroy <name> [--yes]
5642
5658
  delete that app and its volume
5643
5659
 
5644
- options for toyon [path]
5645
- --app open a Chromium app window (the installed Toyon app when there is one)
5646
-
5647
5660
  environment
5648
5661
  TOYON_HOME where state lives (default ~/.toyon)
5649
5662
  TOYON_PORT the daemon's port (default 4141)
@@ -6107,7 +6120,7 @@ function agentLines(agents) {
6107
6120
  continue;
6108
6121
  const state = a.installed === null ? `${a.id} ${a.pinned} is not installed` : `${a.id} runs ${a.installed}, not the pinned ${a.pinned}`;
6109
6122
  if (a.error)
6110
- lines.push(line(false, "agents", `${state}: ${a.error}. \`${restartCmd}\` tries again`));
6123
+ lines.push(line(false, "agents", `${state}: ${a.error}. The agent's install button in Settings or \`${restartCmd}\` tries again`));
6111
6124
  else
6112
6125
  lines.push(line(true, "agents", `${state}; it may still be installing`));
6113
6126
  }
@@ -6218,7 +6231,7 @@ async function helper(args) {
6218
6231
  if (!res.ok)
6219
6232
  console.error(`could not open ${path}: ${await res.text()}`);
6220
6233
  }
6221
- showAppWindow(daemon);
6234
+ openShell(daemon);
6222
6235
  return 0;
6223
6236
  }
6224
6237
 
@@ -6849,16 +6862,10 @@ async function open2(cmd) {
6849
6862
  const res = await post("/register", daemon.token, { path: target });
6850
6863
  if (!res.ok) {
6851
6864
  console.error(`could not open ${target}: ${await res.text()}`);
6852
- if (explicit || !cmd.app)
6853
- return 1;
6865
+ return 1;
6854
6866
  }
6855
6867
  }
6856
- if (cmd.app)
6857
- showAppWindow(daemon);
6858
- else {
6859
- console.log(`toyon: ${daemon.url}`);
6860
- openUrl(daemon.url);
6861
- }
6868
+ openShell(daemon);
6862
6869
  return 0;
6863
6870
  }
6864
6871
  async function start() {