itwillsync 1.6.0 → 1.6.1
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&o(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function K(e){const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const o=Math.floor(n/60),s=n%60;return`${o}h ${s}m`}function ue(e){const t=e.match(/^\/(?:Users|home)\/[^/]+/)?.[0];return t?"~"+e.slice(t.length):e}function pe(e){return e<1024?`${e} KB`:`${(e/1024).toFixed(1)} MB`}function fe(e,t,n){const o=document.createElement("div");o.className=`session-card${e.status==="attention"?" attention":""}`,o.dataset.sessionId=e.id;const s=K(Date.now()-e.connectedAt),a=ue(e.cwd),c=document.createElement("div");c.className="card-header";const i=document.createElement("div");i.className="card-agent";const f=document.createElement("div");f.className=`agent-dot ${e.status}`;const R=document.createElement("span");R.className="agent-name",R.textContent=e.name||e.agent,i.appendChild(f),i.appendChild(R);const q=document.createElement("span");q.className="card-uptime",q.textContent=s,c.appendChild(i),c.appendChild(q);const U=document.createElement("div");U.className="card-cwd",U.textContent=a;const L=document.createElement("div");L.className="card-preview";const D=document.createElement("pre");D.className="card-preview-text",D.textContent="Waiting for output...",L.appendChild(D),L.addEventListener("click",l=>{l.stopPropagation(),n.onOpen(e)});const N=document.createElement("div");N.className="card-status";const S=document.createElement("span");S.className=`status-badge ${e.status}`,S.textContent=e.status,e.status==="attention"&&(S.style.display="none");const I=document.createElement("span");I.className="attention-badge",I.textContent="Needs your attention",e.status!=="attention"&&(I.style.display="none"),N.appendChild(S),N.appendChild(I);const h=document.createElement("div");h.className="card-actions";const k=document.createElement("button");k.className="action-btn stop",k.textContent="Stop",k.addEventListener("click",l=>{l.stopPropagation(),he(o,e.id,n.onStop)});const B=document.createElement("button");B.className="action-btn rename",B.textContent="Rename",B.addEventListener("click",l=>{l.stopPropagation(),ye(o,e.id,n.onRename)});const x=document.createElement("button");x.className="action-btn info",x.textContent="Info",x.addEventListener("click",l=>{l.stopPropagation(),n.onInfo(e.id)});const P=document.createElement("button");P.className="action-btn open",P.textContent="Open",P.addEventListener("click",l=>{l.stopPropagation(),n.onOpen(e)}),h.appendChild(P),h.appendChild(B),h.appendChild(x),h.appendChild(k);const X=document.createElement("div");return X.className="card-metadata hidden",o.addEventListener("click",()=>{n.onOpen(e)}),o.appendChild(c),o.appendChild(U),o.appendChild(L),o.appendChild(N),o.appendChild(h),o.appendChild(X),o}function he(e,t,n){e.querySelector(".confirm-overlay")?.remove();const o=document.createElement("div");o.className="confirm-overlay";const s=document.createElement("span");s.className="confirm-msg",s.textContent="Stop this session?";const a=document.createElement("button");a.className="confirm-btn yes",a.textContent="Yes",a.addEventListener("click",i=>{i.stopPropagation(),n(t),o.remove()});const c=document.createElement("button");c.className="confirm-btn no",c.textContent="No",c.addEventListener("click",i=>{i.stopPropagation(),o.remove()}),o.addEventListener("click",i=>i.stopPropagation()),o.appendChild(s),o.appendChild(a),o.appendChild(c),e.appendChild(o)}function ye(e,t,n){const o=e.querySelector(".agent-name");if(!o)return;const s=o.textContent||"",a=document.createElement("input");a.className="rename-input",a.type="text",a.value=s;const c=()=>{const i=a.value.trim();i&&i!==s&&n(t,i),o.textContent=i||s,o.style.display="",a.remove()};a.addEventListener("keydown",i=>{i.stopPropagation(),i.key==="Enter"?c():i.key==="Escape"&&(o.textContent=s,o.style.display="",a.remove())}),a.addEventListener("blur",c),a.addEventListener("click",i=>i.stopPropagation()),o.style.display="none",o.parentElement?.insertBefore(a,o.nextSibling),a.focus(),a.select()}function ie(e,t){const n=e.querySelector(".agent-dot"),o=e.querySelector(".status-badge"),s=e.querySelector(".card-uptime"),a=e.querySelector(".agent-name");n&&(n.className=`agent-dot ${t.status}`),o&&(o.className=`status-badge ${t.status}`,o.textContent=t.status),s&&(s.textContent=K(Date.now()-t.connectedAt)),a&&!a.style.display&&(a.textContent=t.name||t.agent);const c=t.status==="attention";o&&(o.style.display=c?"none":"");const i=e.querySelector(".attention-badge");i&&(i.style.display=c?"":"none"),t.status==="attention"?e.classList.add("attention"):e.classList.remove("attention")}function ge(e,t){const n=e.querySelector(".card-preview-text");n&&(t.length>0?(n.textContent=t.join(`
|
|
2
|
-
`),n.classList.remove("empty")):(n.textContent="Waiting for output...",n.classList.add("empty")))}function Ee(e,t){const n=e.querySelector(".card-metadata");if(!n)return;for(;n.firstChild;)n.removeChild(n.firstChild);const o=[["PID",String(t.pid)],["Agent",t.agent],["Port",String(t.port)],["Directory",t.cwd],["Memory",pe(t.memoryKB)],["Uptime",K(t.uptimeMs)]];for(const[s,a]of o){const c=document.createElement("div");c.className="meta-row";const i=document.createElement("span");i.className="meta-label",i.textContent=s;const f=document.createElement("span");f.className="meta-value",f.textContent=a,c.appendChild(i),c.appendChild(f),n.appendChild(c)}n.classList.toggle("hidden")}let r=null,Q=!1;function ve(){if(!Q){Q=!0;try{r=new AudioContext,r.state==="suspended"&&r.resume()}catch{}}}function Z(){if(!r)return;r.state==="suspended"&&r.resume();const e=r.currentTime,t=r.createOscillator(),n=r.createGain();t.frequency.value=587.33,t.type="sine",n.gain.setValueAtTime(.3,e),n.gain.exponentialRampToValueAtTime(.01,e+.3),t.connect(n),n.connect(r.destination),t.start(e),t.stop(e+.3);const o=r.createOscillator(),s=r.createGain();o.frequency.value=880,o.type="sine",s.gain.setValueAtTime(.3,e+.15),s.gain.exponentialRampToValueAtTime(.01,e+.45),o.connect(s),s.connect(r.destination),o.start(e+.15),o.stop(e+.45)}const ee=120*1e3,p=new Map;function te(e){if(p.has(e))return;Z();const t=setTimeout(function n(){Z();const o=p.get(e);o&&(o.timerId=setTimeout(n,ee))},ee);p.set(e,{timerId:t})}function W(e){const t=p.get(e);t&&(clearTimeout(t.timerId),p.delete(e))}function ne(){for(const e of p.values())clearTimeout(e.timerId);p.clear()}const Ce=new URLSearchParams(window.location.search),O=Ce.get("token");if(!O)throw document.body.textContent="Missing authentication token.",new Error("No token in URL");const be=window.location.protocol==="https:"?"wss:":"ws:",we=`${be}//${window.location.host}?token=${O}`,re=window.location.hostname,E=new Map,u=new Map,Le=document.getElementById("session-list"),_=document.getElementById("empty-state"),Ne=document.getElementById("session-count"),oe=document.getElementById("status-dot");let V=null;function $(){ve(),document.removeEventListener("click",$),document.removeEventListener("touchstart",$)}document.addEventListener("click",$);document.addEventListener("touchstart",$);function C(e){d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify(e))}const Se={onOpen(e){const t=E.get(e.id)||e;t.status==="attention"&&(C({type:"clear-attention",sessionId:t.id}),W(t.id));const n=window.location.href,o=`http://${re}:${t.port}?token=${t.token}&hub=${encodeURIComponent(n)}`;window.
|
|
2
|
+
`),n.classList.remove("empty")):(n.textContent="Waiting for output...",n.classList.add("empty")))}function Ee(e,t){const n=e.querySelector(".card-metadata");if(!n)return;for(;n.firstChild;)n.removeChild(n.firstChild);const o=[["PID",String(t.pid)],["Agent",t.agent],["Port",String(t.port)],["Directory",t.cwd],["Memory",pe(t.memoryKB)],["Uptime",K(t.uptimeMs)]];for(const[s,a]of o){const c=document.createElement("div");c.className="meta-row";const i=document.createElement("span");i.className="meta-label",i.textContent=s;const f=document.createElement("span");f.className="meta-value",f.textContent=a,c.appendChild(i),c.appendChild(f),n.appendChild(c)}n.classList.toggle("hidden")}let r=null,Q=!1;function ve(){if(!Q){Q=!0;try{r=new AudioContext,r.state==="suspended"&&r.resume()}catch{}}}function Z(){if(!r)return;r.state==="suspended"&&r.resume();const e=r.currentTime,t=r.createOscillator(),n=r.createGain();t.frequency.value=587.33,t.type="sine",n.gain.setValueAtTime(.3,e),n.gain.exponentialRampToValueAtTime(.01,e+.3),t.connect(n),n.connect(r.destination),t.start(e),t.stop(e+.3);const o=r.createOscillator(),s=r.createGain();o.frequency.value=880,o.type="sine",s.gain.setValueAtTime(.3,e+.15),s.gain.exponentialRampToValueAtTime(.01,e+.45),o.connect(s),s.connect(r.destination),o.start(e+.15),o.stop(e+.45)}const ee=120*1e3,p=new Map;function te(e){if(p.has(e))return;Z();const t=setTimeout(function n(){Z();const o=p.get(e);o&&(o.timerId=setTimeout(n,ee))},ee);p.set(e,{timerId:t})}function W(e){const t=p.get(e);t&&(clearTimeout(t.timerId),p.delete(e))}function ne(){for(const e of p.values())clearTimeout(e.timerId);p.clear()}const Ce=new URLSearchParams(window.location.search),O=Ce.get("token");if(!O)throw document.body.textContent="Missing authentication token.",new Error("No token in URL");const be=window.location.protocol==="https:"?"wss:":"ws:",we=`${be}//${window.location.host}?token=${O}`,re=window.location.hostname,E=new Map,u=new Map,Le=document.getElementById("session-list"),_=document.getElementById("empty-state"),Ne=document.getElementById("session-count"),oe=document.getElementById("status-dot");let V=null;function $(){ve(),document.removeEventListener("click",$),document.removeEventListener("touchstart",$)}document.addEventListener("click",$);document.addEventListener("touchstart",$);function C(e){d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify(e))}const Se={onOpen(e){const t=E.get(e.id)||e;t.status==="attention"&&(C({type:"clear-attention",sessionId:t.id}),W(t.id));const n=window.location.href,o=`http://${re}:${t.port}?token=${t.token}&hub=${encodeURIComponent(n)}`;window.location.href=o},onStop(e){C({type:"stop-session",sessionId:e})},onRename(e,t){C({type:"rename-session",sessionId:e,name:t})},onInfo(e){C({type:"get-metadata",sessionId:e})}};function de(){const e=E.size;Ne.textContent=`${e} session${e!==1?"s":""}`,e===0?_.style.display="flex":_.style.display="none"}function se(e){E.set(e.id,e);const t=fe(e,re,Se);u.set(e.id,t),Le.insertBefore(t,_),de()}function ae(e){E.delete(e);const t=u.get(e);t&&(t.remove(),u.delete(e)),de()}function Ie(e){E.set(e.id,e);const t=u.get(e.id);t&&ie(t,e)}function ke(){for(const[e,t]of E){const n=u.get(e);n&&ie(n,t)}}const Be=document.getElementById("fab-create"),b=document.getElementById("create-modal"),xe=document.getElementById("modal-close"),g=document.getElementById("tool-input"),ce=document.getElementById("tool-chips"),le=document.getElementById("dir-selected"),Pe=document.getElementById("btn-browse"),me=document.getElementById("btn-create-session"),M=document.getElementById("create-error"),v=document.getElementById("create-form-view"),T=document.getElementById("browse-view"),F=document.getElementById("browse-breadcrumb"),y=document.getElementById("browse-list"),$e=document.getElementById("browse-back"),Me=document.getElementById("browse-select"),G=document.getElementById("create-spinner");let w="~",j="~";function m(e,t,n){const o=document.createElement(e);return o.className=t,o.textContent=n,o}function Ae(){b.classList.remove("hidden"),v.classList.remove("hidden"),T.classList.add("hidden"),G.classList.add("hidden"),M.classList.add("hidden"),g.value="",w="~",le.textContent="~",Y(),Oe(),g.focus()}function J(){b.classList.add("hidden")}function Y(){me.disabled=!g.value.trim()}async function Oe(){try{const t=await(await fetch(`/api/tool-history?token=${O}`)).json();ce.replaceChildren();for(const n of t.tools.slice(0,6)){const o=m("span","chip",n);o.addEventListener("click",()=>{g.value=n,Y()}),ce.appendChild(o)}}catch{}}async function z(e){j=e,y.replaceChildren(m("div","browse-empty","Loading..."));try{const n=await(await fetch(`/api/browse?path=${encodeURIComponent(e)}&token=${O}`)).json();if(n.error){y.replaceChildren(m("div","browse-empty",n.error));return}const o=n.path||e;j=o,Te(o);const s=n.entries;if(s.length===0){y.replaceChildren(m("div","browse-empty","No subdirectories"));return}y.replaceChildren();for(const a of s){const c=document.createElement("div");c.className="browse-item",c.appendChild(m("span","browse-item-name",a)),c.appendChild(m("span","browse-item-arrow","›")),c.addEventListener("click",()=>z(`${o}/${a}`)),y.appendChild(c)}}catch{y.replaceChildren(m("div","browse-empty","Failed to load"))}}function Te(e){F.replaceChildren();const t=e.split("/").filter(Boolean);for(let n=0;n<t.length;n++){n>0&&F.appendChild(m("span","breadcrumb-sep"," / "));const o=m("span","breadcrumb-segment",t[n]),s=t.slice(0,n+1).join("/");o.addEventListener("click",()=>z(s)),F.appendChild(o)}}function Re(){const e=g.value.trim();e&&(M.classList.add("hidden"),v.classList.add("hidden"),G.classList.remove("hidden"),C({type:"create-session",tool:e,cwd:w}))}Be.addEventListener("click",Ae);xe.addEventListener("click",J);b.addEventListener("click",e=>{e.target===b&&J()});g.addEventListener("input",Y);me.addEventListener("click",Re);Pe.addEventListener("click",()=>{v.classList.add("hidden"),T.classList.remove("hidden"),z(w)});$e.addEventListener("click",()=>{T.classList.add("hidden"),v.classList.remove("hidden")});Me.addEventListener("click",()=>{w=j,le.textContent=w,T.classList.add("hidden"),v.classList.remove("hidden")});let d=null,A=0;const qe=1e4;function H(){d=new WebSocket(we),d.onopen=()=>{oe.className="connected",A=0,V&&clearInterval(V),V=setInterval(ke,1e4)},d.onmessage=e=>{try{const t=JSON.parse(e.data);switch(t.type){case"sessions":{ne();for(const n of u.keys())ae(n);for(const n of t.sessions)se(n),n.status==="attention"&&te(n.id);break}case"session-added":{se(t.session),b.classList.contains("hidden")||J();break}case"session-removed":{const n=t.sessionId;W(n),ae(n);break}case"session-updated":{const n=t.session;Ie(n),n.status==="attention"?te(n.id):W(n.id);break}case"preview":{const n=u.get(t.sessionId);n&&ge(n,t.lines);break}case"metadata":{const n=u.get(t.sessionId);n&&Ee(n,t.metadata);break}case"session-creating":break;case"session-create-error":{G.classList.add("hidden"),v.classList.remove("hidden"),M.textContent=t.error,M.classList.remove("hidden");break}case"operation-error":{console.warn(`Operation "${t.operation}" failed for session ${t.sessionId}: ${t.error}`);break}}}catch{}},d.onclose=()=>{oe.className="reconnecting",ne(),Ue()},d.onerror=()=>{d?.close()}}function Ue(){const e=Math.min(1e3*Math.pow(1.5,A),qe);A++,setTimeout(H,e)}document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&d?.readyState!==WebSocket.OPEN&&(A=0,H())});H();
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
8
8
|
<meta name="theme-color" content="#1a1a2e" />
|
|
9
9
|
<title>itwillsync Dashboard</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-C0aiYBkq.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-D6z7Ixhf.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|