moi-computer 0.13.0 → 0.13.1-next.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.
- package/client/api/app-config.ts +0 -1
- package/client/api/query-client.ts +5 -0
- package/client/app/app-router.tsx +1 -1
- package/client/app/routes/workspace-route.tsx +5 -6
- package/client/features/account/account-provider.tsx +28 -77
- package/client/features/account/account-test-utils.tsx +103 -93
- package/client/features/account/api.ts +36 -111
- package/client/features/account/profile-actions.ts +31 -0
- package/client/features/app-settings/avatar-upload.tsx +62 -0
- package/client/features/app-settings/profile-settings.tsx +10 -0
- package/client/features/app-settings/settings-page.tsx +0 -4
- package/client/features/chat/applet-chat-intents.ts +4 -4
- package/client/features/chat/sessions/api.ts +5 -5
- package/client/features/chat/sessions/use-selected-session.ts +3 -3
- package/client/features/chat/use-chat.ts +4 -4
- package/client/features/collab/applet-api.ts +1 -1
- package/client/features/collab/components/cursors.tsx +6 -1
- package/client/features/collab/components/presence-avatars.tsx +1 -1
- package/client/features/collab/components/presence-frame.tsx +1 -1
- package/client/features/collab/components/presence-group.tsx +1 -1
- package/client/features/collab/components/presence-helpers.ts +2 -2
- package/client/features/collab/components/user-avatar-group.tsx +1 -1
- package/client/features/collab/components/user-avatar.tsx +1 -1
- package/client/features/collab/components/user.tsx +1 -1
- package/client/features/collab/host-state.ts +45 -85
- package/client/features/collab/index.ts +3 -3
- package/client/features/collab/members/api.ts +23 -0
- package/client/features/collab/members/hooks.ts +103 -0
- package/client/features/collab/members/keys.ts +6 -0
- package/client/features/collab/members/store.ts +123 -0
- package/client/features/collab/members/types.ts +53 -0
- package/client/features/collab/{client.ts → presence/client.ts} +38 -13
- package/client/features/collab/{hooks.tsx → presence/hooks.tsx} +9 -8
- package/client/features/collab/{provider.tsx → presence/provider.tsx} +1 -12
- package/client/features/collab/{users.ts → presence/users.ts} +19 -33
- package/client/features/collab/sharing/agent-invite.tsx +30 -0
- package/client/features/collab/sharing/workspace-members.tsx +277 -0
- package/client/features/collab/sharing/workspace-sharing-menu.tsx +179 -0
- package/client/features/collab/testing/component-fixtures.tsx +3 -3
- package/client/features/collab/testing/fake-engine.ts +15 -3
- package/client/features/dev/collab/collab-playground.tsx +2 -2
- package/client/features/dev/workspace-setup-mocks.ts +0 -1
- package/client/features/identity/host-api.ts +34 -0
- package/client/features/identity/store.ts +32 -0
- package/client/features/identity/types.ts +41 -0
- package/client/features/identity/use-identity.ts +6 -0
- package/client/features/views/use-view-actions.ts +3 -3
- package/client/features/workspace/browser-tab-state.ts +6 -6
- package/client/features/workspace/workspace-content.tsx +10 -6
- package/client/index.html +1 -1
- package/client/index.tsx +5 -9
- package/client/main.tsx +2 -2
- package/dist/{chunk-cqt3s31j.js → chunk-3smkkcfw.js} +86 -86
- package/dist/chunk-47h9c2qy.js +2 -0
- package/dist/chunk-8qed2gqp.js +75 -0
- package/dist/{chunk-bncc7heg.js → chunk-8zy3vesm.js} +1 -1
- package/dist/chunk-a47zy276.js +2 -0
- package/dist/chunk-g4c1nte9.css +1 -0
- package/dist/chunk-kcactdr4.js +2 -0
- package/dist/chunk-m8bhx6tw.js +1 -0
- package/dist/{chunk-58dyt9bk.js → chunk-pf19zcrn.js} +2 -2
- package/dist/{chunk-2y59vrxg.js → chunk-th91xfnp.js} +1 -1
- package/dist/chunk-ygzxah0e.js +1 -0
- package/dist/index.html +2 -2
- package/lib/types.ts +0 -1
- package/package.json +5 -4
- package/server/app-config.ts +2 -5
- package/server/applets/declarations.ts +6 -7
- package/server/cli/commands/init.ts +0 -11
- package/server/collab/config.ts +1 -5
- package/server/collab/manager.ts +5 -2
- package/server/collab/skill/index.ts +1 -47
- package/server/skills/template.ts +3 -2
- package/server/skills/update.ts +1 -1
- package/server/skills/workspace.ts +0 -2
- package/server/web.ts +1 -2
- package/server/workspaces/scaffold.ts +1 -0
- package/skill/SKILL.md +1 -1
- package/client/features/account/identity.ts +0 -23
- package/client/features/app-settings/users-settings.tsx +0 -195
- package/client/features/collab/workspace-users-menu.tsx +0 -190
- package/dist/chunk-dcmks9sm.js +0 -75
- package/dist/chunk-md45evr2.css +0 -1
- package/dist/chunk-n0nab26d.js +0 -1
- package/dist/chunk-nmzhgyp9.js +0 -2
- package/dist/chunk-q37knr3m.js +0 -2
- package/dist/chunk-s90m4qkz.js +0 -1
- package/dist/chunk-wjvd4byz.js +0 -2
- /package/client/features/collab/{presence-publisher.ts → presence/presence-publisher.ts} +0 -0
- /package/client/features/collab/{presence-target.ts → presence/presence-target.ts} +0 -0
- /package/client/features/collab/{store.ts → presence/store.ts} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e,x}from"/chunk-a47zy276.js";import{p}from"/chunk-pf19zcrn.js";var t=x(function(m,r){r.exports=globalThis.__esm.react});var f=e(t(),1);var s={environment:"local",demo:!1,demoInstallUrl:"https://moi.computer"},o=s,i=new Set;function c(n){return i.add(n),()=>{i.delete(n)}}async function l(){try{o=await p("/api/config");for(let n of i)n();return o}catch{}}async function bt(){return l()}function v(){return f.useSyncExternalStore(c,()=>o)}
|
|
2
|
+
export{t,bt,v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{yt}from"/chunk-th91xfnp.js";export{yt as sanitizeSvg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function s(t,e){let o=await t.text();return Error(o||e)}async function p(t,e,o="Request failed"){let n=await fetch(t,e);if(!n.ok)throw await s(n,o);return n.json()}async function
|
|
2
|
-
export{p,
|
|
1
|
+
async function s(t,e){let o=await t.text();return Error(o||e)}async function p(t,e,o="Request failed"){let n=await fetch(t,e);if(!n.ok)throw await s(n,o);return n.json()}async function V(t,e,o="Request failed"){let n=await fetch(t,e);if(!n.ok)throw await s(n,o)}function w(t,e){return{method:t,headers:{"Content-Type":"application/json"},body:e===void 0?void 0:JSON.stringify(e)}}
|
|
2
|
+
export{p,V,w};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* SVG/attribute allowlists and URI sanitization approach derived from DOMPurify.
|
|
3
3
|
* DOMPurify — MIT License, Copyright (c) 2015 Mario Heiderich
|
|
4
4
|
* https://github.com/cure53/DOMPurify/blob/main/LICENSE
|
|
5
|
-
*/var v=new Set(["svg","a","altglyph","altglyphdef","altglyphitem","animate","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","fedistantlight","fedropshadow","feflood","fefunca","fefuncb","fefuncg","fefuncr","fegaussianblur","feimage","femerge","femergenode","femorphology","feoffset","fepointlight","fespecularlighting","fespotlight","fetile","feturbulence","filter","font","foreignobject","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","set","stop","style","switch","symbol","text","textpath","title","tref","tspan","use","view","vkern"]),y=new Set(["a","b","blockquote","body","br","code","del","div","em","h1","h2","h3","h4","h5","h6","i","li","mark","ol","p","pre","span","strong","s","sub","sup","table","tbody","td","th","thead","tr","u","ul"]),A=new Set(["script","iframe","object","embed","form","input","textarea","select","button","link","meta","base","img","video","audio","source","picture","svg"]),x=new Set(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clip-path","clip-rule","clippathunits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","diffuseconstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","from","fx","fy","g1","g2","glyph-name","glyphref","gradienttransform","gradientunits","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","kernelmatrix","kernelunitlength","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","mask","mask-type","maskcontentunits","maskunits","max","media","method","min","mode","name","numoctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","radius","refx","refy","repeatcount","repeatdur","requiredfeatures","restart","result","role","rotate","rx","ry","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","text-anchor","text-decoration","text-rendering","textlength","to","transform","transform-origin","type","u1","u2","unicode","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewbox","visibility","width","word-spacing","wrap","writing-mode","x","x1","x2","xchannelselector","xlink:href","xml:id","xml:space","xlink:title","xmlns","xmlns:xlink","y","y1","y2","z","zoomandpan"]),k=new Set(["class","dir","href","id","lang","role","style","tabindex","title"]),d=/^data-/,p=/^aria-/,o=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,g=/^(?:https?:|mailto:)/i,S=/^data:/i,T=/^data:image\/(?:png|jpeg|jpg|gif|webp|avif|bmp|tiff|x-icon|vnd\.microsoft\.icon)[;,]/i,_=/^data:image\/svg\+xml[;,]/i,u=/^#/;function w(t){return t.replace(/\\([0-9a-fA-F]{1,6})\s?|\\([^\n])/g,(i,r,n)=>{if(r){let e=parseInt(r,16);if(e>1114111||e===0)return"�";return String.fromCodePoint(e)}return n})}var E=/^data:(?:image\/(?:png|jpeg|jpg|gif|webp|avif)|font\/(?:woff2?|opentype|truetype|sfnt)|application\/(?:x-font-woff|font-woff2?|x-font-ttf|x-font-opentype|font-sfnt))[;,]/i;function f(t){let i=w(t);return i=i.replace(/@import\s+(?:url\s*\([^)]*\)|"[^"]*"|'[^']*')[^;]*;?|@import\b[^;]*;?/gi,""),i=i.replace(/expression\s*\([^)]*\)/gi,""),i=i.replace(/-moz-binding\s*:[^;]*/gi,""),i=i.replace(/behavior\s*:[^;]*/gi,""),i=i.replace(/url\s*\(\s*(['"]?)(.*?)\1\s*\)/gis,(r,n,e)=>{let a=e.replace(o,"");if(E.test(a)||u.test(a))return r;return""}),i}function L(t){return f(t)}var N=new Set(["animate","set","animatecolor","animatetransform"]),R=/^(?:href|xlink:href|on)/i;function z(t){let i=t.getAttribute("attributeName");if(!i)return!1;return R.test(i.replace(o,""))}var h=/^on/i,D=new Set(["clip-path","cursor","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]),m=10;function I(t){let i=t.search(/;base64,/i);if(i>=0){let n=t.slice(i+8),e=Uint8Array.from(atob(n),(a)=>a.charCodeAt(0));return new TextDecoder().decode(e)}let r=t.indexOf(",");if(r<0)return null;return decodeURIComponent(t.slice(r+1))}function C(t){let i=new TextEncoder().encode(t),r=Array.from(i,(n)=>String.fromCharCode(n)).join("");return"data:image/svg+xml;base64,"+btoa(r)}function G(t,i){if(i>=m)return console.warn(`Embedded SVG data URI recursion depth limit (${m}) reached`),null;let r;try{let e=I(t);if(e===null)return null;r=e}catch{return null}let n=b(r,i+1);if(!n)return null;return C(n)}function O(t,i,r,n){let e=r.replace(o,""),a=t.tagName.toLowerCase();if(a==="image"||a==="feimage"){if(T.test(e))return r;if(_.test(e))return G(e,n);return null}if(a==="use"){if(u.test(e))return r;return null}if(a==="a"){if(g.test(e))return r;return null}if(S.test(e)||u.test(e))return r;return null}function l(t,i){for(let r=t.attributes.length-1;r>=0;r--){let n=t.attributes[r],e=n.name.toLowerCase(),a=e.replace(o,"");if(h.test(a)){t.removeAttribute(n.name);continue}if(d.test(e)||p.test(e))continue;if(!x.has(e)){t.removeAttribute(n.name);continue}if(e==="href"||e==="xlink:href"){let s=O(t,e,n.value,i);if(s===null)t.removeAttribute(n.name);else if(s!==n.value)n.value=s;continue}if(e==="style"){n.value=f(n.value);continue}if(D.has(e)&&/url\s*\(/i.test(n.value))n.value=f(n.value)}}function M(t){let i=t.tagName.toLowerCase();for(let r=t.attributes.length-1;r>=0;r--){let n=t.attributes[r],e=n.name.toLowerCase(),a=e.replace(o,"");if(h.test(a)){t.removeAttribute(n.name);continue}if(d.test(e)||p.test(e))continue;if(!k.has(e)){t.removeAttribute(n.name);continue}if(e==="href"){if(i!=="a"){t.removeAttribute(n.name);continue}let s=n.value.replace(o,"");if(!g.test(s))t.removeAttribute(n.name);continue}if(e==="style")n.value=f(n.value)}}function c(t,i,r){for(let n=t.children.length-1;n>=0;n--){let e=t.children[n],a=e.tagName.toLowerCase();if(i==="svg")if(a==="foreignobject")l(e,r),c(e,"html",r);else if(a==="style"){if(l(e,r),e.textContent)e.textContent=L(e.textContent)}else if(N.has(a)&&z(e))e.remove();else if(v.has(a))l(e,r),c(e,"svg",r);else e.remove();else if(A.has(a))e.remove();else if(y.has(a))M(e),c(e,"html",r);else e.remove()}}function b(t,i){let r=new DOMParser().parseFromString(t,"image/svg+xml");if(r.querySelector("parsererror"))return"";let e=r.documentElement;if(e.tagName.toLowerCase()!=="svg")return"";if(l(e,i),c(e,"svg",i),e.children.length===0)return"";return new XMLSerializer().serializeToString(e)}function
|
|
5
|
+
*/var v=new Set(["svg","a","altglyph","altglyphdef","altglyphitem","animate","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","fedistantlight","fedropshadow","feflood","fefunca","fefuncb","fefuncg","fefuncr","fegaussianblur","feimage","femerge","femergenode","femorphology","feoffset","fepointlight","fespecularlighting","fespotlight","fetile","feturbulence","filter","font","foreignobject","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","set","stop","style","switch","symbol","text","textpath","title","tref","tspan","use","view","vkern"]),y=new Set(["a","b","blockquote","body","br","code","del","div","em","h1","h2","h3","h4","h5","h6","i","li","mark","ol","p","pre","span","strong","s","sub","sup","table","tbody","td","th","thead","tr","u","ul"]),A=new Set(["script","iframe","object","embed","form","input","textarea","select","button","link","meta","base","img","video","audio","source","picture","svg"]),x=new Set(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clip-path","clip-rule","clippathunits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","diffuseconstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","from","fx","fy","g1","g2","glyph-name","glyphref","gradienttransform","gradientunits","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","kernelmatrix","kernelunitlength","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","mask","mask-type","maskcontentunits","maskunits","max","media","method","min","mode","name","numoctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","radius","refx","refy","repeatcount","repeatdur","requiredfeatures","restart","result","role","rotate","rx","ry","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","text-anchor","text-decoration","text-rendering","textlength","to","transform","transform-origin","type","u1","u2","unicode","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewbox","visibility","width","word-spacing","wrap","writing-mode","x","x1","x2","xchannelselector","xlink:href","xml:id","xml:space","xlink:title","xmlns","xmlns:xlink","y","y1","y2","z","zoomandpan"]),k=new Set(["class","dir","href","id","lang","role","style","tabindex","title"]),d=/^data-/,p=/^aria-/,o=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,g=/^(?:https?:|mailto:)/i,S=/^data:/i,T=/^data:image\/(?:png|jpeg|jpg|gif|webp|avif|bmp|tiff|x-icon|vnd\.microsoft\.icon)[;,]/i,_=/^data:image\/svg\+xml[;,]/i,u=/^#/;function w(t){return t.replace(/\\([0-9a-fA-F]{1,6})\s?|\\([^\n])/g,(i,r,n)=>{if(r){let e=parseInt(r,16);if(e>1114111||e===0)return"�";return String.fromCodePoint(e)}return n})}var E=/^data:(?:image\/(?:png|jpeg|jpg|gif|webp|avif)|font\/(?:woff2?|opentype|truetype|sfnt)|application\/(?:x-font-woff|font-woff2?|x-font-ttf|x-font-opentype|font-sfnt))[;,]/i;function f(t){let i=w(t);return i=i.replace(/@import\s+(?:url\s*\([^)]*\)|"[^"]*"|'[^']*')[^;]*;?|@import\b[^;]*;?/gi,""),i=i.replace(/expression\s*\([^)]*\)/gi,""),i=i.replace(/-moz-binding\s*:[^;]*/gi,""),i=i.replace(/behavior\s*:[^;]*/gi,""),i=i.replace(/url\s*\(\s*(['"]?)(.*?)\1\s*\)/gis,(r,n,e)=>{let a=e.replace(o,"");if(E.test(a)||u.test(a))return r;return""}),i}function L(t){return f(t)}var N=new Set(["animate","set","animatecolor","animatetransform"]),R=/^(?:href|xlink:href|on)/i;function z(t){let i=t.getAttribute("attributeName");if(!i)return!1;return R.test(i.replace(o,""))}var h=/^on/i,D=new Set(["clip-path","cursor","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]),m=10;function I(t){let i=t.search(/;base64,/i);if(i>=0){let n=t.slice(i+8),e=Uint8Array.from(atob(n),(a)=>a.charCodeAt(0));return new TextDecoder().decode(e)}let r=t.indexOf(",");if(r<0)return null;return decodeURIComponent(t.slice(r+1))}function C(t){let i=new TextEncoder().encode(t),r=Array.from(i,(n)=>String.fromCharCode(n)).join("");return"data:image/svg+xml;base64,"+btoa(r)}function G(t,i){if(i>=m)return console.warn(`Embedded SVG data URI recursion depth limit (${m}) reached`),null;let r;try{let e=I(t);if(e===null)return null;r=e}catch{return null}let n=b(r,i+1);if(!n)return null;return C(n)}function O(t,i,r,n){let e=r.replace(o,""),a=t.tagName.toLowerCase();if(a==="image"||a==="feimage"){if(T.test(e))return r;if(_.test(e))return G(e,n);return null}if(a==="use"){if(u.test(e))return r;return null}if(a==="a"){if(g.test(e))return r;return null}if(S.test(e)||u.test(e))return r;return null}function l(t,i){for(let r=t.attributes.length-1;r>=0;r--){let n=t.attributes[r],e=n.name.toLowerCase(),a=e.replace(o,"");if(h.test(a)){t.removeAttribute(n.name);continue}if(d.test(e)||p.test(e))continue;if(!x.has(e)){t.removeAttribute(n.name);continue}if(e==="href"||e==="xlink:href"){let s=O(t,e,n.value,i);if(s===null)t.removeAttribute(n.name);else if(s!==n.value)n.value=s;continue}if(e==="style"){n.value=f(n.value);continue}if(D.has(e)&&/url\s*\(/i.test(n.value))n.value=f(n.value)}}function M(t){let i=t.tagName.toLowerCase();for(let r=t.attributes.length-1;r>=0;r--){let n=t.attributes[r],e=n.name.toLowerCase(),a=e.replace(o,"");if(h.test(a)){t.removeAttribute(n.name);continue}if(d.test(e)||p.test(e))continue;if(!k.has(e)){t.removeAttribute(n.name);continue}if(e==="href"){if(i!=="a"){t.removeAttribute(n.name);continue}let s=n.value.replace(o,"");if(!g.test(s))t.removeAttribute(n.name);continue}if(e==="style")n.value=f(n.value)}}function c(t,i,r){for(let n=t.children.length-1;n>=0;n--){let e=t.children[n],a=e.tagName.toLowerCase();if(i==="svg")if(a==="foreignobject")l(e,r),c(e,"html",r);else if(a==="style"){if(l(e,r),e.textContent)e.textContent=L(e.textContent)}else if(N.has(a)&&z(e))e.remove();else if(v.has(a))l(e,r),c(e,"svg",r);else e.remove();else if(A.has(a))e.remove();else if(y.has(a))M(e),c(e,"html",r);else e.remove()}}function b(t,i){let r=new DOMParser().parseFromString(t,"image/svg+xml");if(r.querySelector("parsererror"))return"";let e=r.documentElement;if(e.tagName.toLowerCase()!=="svg")return"";if(l(e,i),c(e,"svg",i),e.children.length===0)return"";return new XMLSerializer().serializeToString(e)}function yt(t){return b(t,0)}export{yt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bt,v}from"/chunk-kcactdr4.js";export{bt as loadAppConfig,v as useAppConfig};
|
package/dist/index.html
CHANGED
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
<link rel="modulepreload" href="/vendor/react/19.2.4/production/react-dom-client.js" />
|
|
56
56
|
<link rel="modulepreload" href="/vendor/react/19.2.4/production/_impl/react-dom-client.js" />
|
|
57
57
|
|
|
58
|
-
<link rel="stylesheet" crossorigin href="/chunk-
|
|
58
|
+
<link rel="stylesheet" crossorigin href="/chunk-g4c1nte9.css"><script type="module" crossorigin src="/chunk-a47zy276.js"></script></head>
|
|
59
59
|
<body>
|
|
60
60
|
<div id="root"></div>
|
|
61
61
|
|
|
62
|
-
<script type="module">
|
|
62
|
+
<script id="moi-start" type="module">
|
|
63
63
|
const [react, jsxRuntime, jsxDevRuntime, reactDom, reactDomClient] = await Promise.all([
|
|
64
64
|
import('react'),
|
|
65
65
|
import('react/jsx-runtime'),
|
package/lib/types.ts
CHANGED
|
@@ -351,7 +351,6 @@ export type AppEnvironment = 'local' | 'cloud'
|
|
|
351
351
|
|
|
352
352
|
export type ClientAppConfig = {
|
|
353
353
|
environment: AppEnvironment
|
|
354
|
-
collab: boolean
|
|
355
354
|
// Demo mode: workspace creation is blocked; the UI offers the
|
|
356
355
|
// cloud-demo promo dialog instead.
|
|
357
356
|
demo: boolean
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moi-computer",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1-next.1",
|
|
4
4
|
"description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"homepage": "https://github.com/
|
|
7
|
+
"homepage": "https://github.com/moi-computer/moi#readme",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/moi-computer/moi.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/moi-computer/moi/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"ai",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
69
69
|
"@tabler/icons-react": "^3.46.0",
|
|
70
70
|
"@tailwindcss/typography": "^0.5.20",
|
|
71
|
+
"@tanstack/query-core": "5.102.8",
|
|
71
72
|
"@tanstack/react-query": "^5.102.8",
|
|
72
73
|
"@tldraw/store": "5.2.3",
|
|
73
74
|
"@tldraw/tlschema": "5.2.3",
|
package/server/app-config.ts
CHANGED
|
@@ -18,7 +18,6 @@ import { DATA_DIR } from './data-dir'
|
|
|
18
18
|
// CLI or server down with it.
|
|
19
19
|
export type AppConfig = {
|
|
20
20
|
environment: AppEnvironment
|
|
21
|
-
collab: boolean
|
|
22
21
|
// Demo mode: workspace creation is blocked (UI shows the
|
|
23
22
|
// cloud-demo promo dialog instead) and `moi` system commands are disabled.
|
|
24
23
|
demo: boolean
|
|
@@ -48,8 +47,6 @@ export type CloudflareAccessConfig = {
|
|
|
48
47
|
|
|
49
48
|
const DEFAULTS: AppConfig = {
|
|
50
49
|
environment: 'local',
|
|
51
|
-
// Temporarily disabled while collaboration is being reconsidered.
|
|
52
|
-
collab: false,
|
|
53
50
|
demo: false,
|
|
54
51
|
demoInstallUrl: 'https://moi.computer',
|
|
55
52
|
cloudflareAccess: null,
|
|
@@ -262,6 +259,6 @@ export function resetAppConfig(): void {
|
|
|
262
259
|
// The only shape that reaches the browser (GET /api/config). Server-only keys
|
|
263
260
|
// added to AppConfig later stay out unless explicitly forwarded here.
|
|
264
261
|
export function clientAppConfig(): ClientAppConfig {
|
|
265
|
-
const { environment,
|
|
266
|
-
return { environment,
|
|
262
|
+
const { environment, demo, demoInstallUrl } = getAppConfig()
|
|
263
|
+
return { environment, demo, demoInstallUrl }
|
|
267
264
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mkdir, stat } from 'node:fs/promises'
|
|
2
|
+
import { getAppConfig } from '../app-config'
|
|
2
3
|
import { dirname, join } from 'node:path'
|
|
3
4
|
|
|
4
5
|
export const BASE_DECLARATION_SOURCE_PATH = join(import.meta.dir, 'declarations', 'base.d.ts')
|
|
@@ -33,14 +34,12 @@ export async function syncAppletDeclarations(
|
|
|
33
34
|
const updated: AppletDeclarationFile[] = []
|
|
34
35
|
if (await writeDeclaration(workspacePath, 'base.d.ts')) updated.push('base.d.ts')
|
|
35
36
|
|
|
36
|
-
//
|
|
37
|
-
if (
|
|
37
|
+
// Keep existing applets typecheckable when a cloud workspace is opened locally.
|
|
38
|
+
if (
|
|
39
|
+
getAppConfig().environment === 'cloud' ||
|
|
40
|
+
(await Bun.file(appletDeclarationPath(workspacePath, 'collab.d.ts')).exists())
|
|
41
|
+
) {
|
|
38
42
|
if (await writeDeclaration(workspacePath, 'collab.d.ts')) updated.push('collab.d.ts')
|
|
39
43
|
}
|
|
40
44
|
return updated
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
export async function installCollabDeclaration(workspacePath: string): Promise<void> {
|
|
44
|
-
await writeDeclaration(workspacePath, 'base.d.ts')
|
|
45
|
-
await writeDeclaration(workspacePath, 'collab.d.ts')
|
|
46
|
-
}
|
|
@@ -2,7 +2,6 @@ import type { WorkspaceType } from '@/lib/types'
|
|
|
2
2
|
import { defineCommand } from 'citty'
|
|
3
3
|
import { existsSync } from 'node:fs'
|
|
4
4
|
import { join, resolve } from 'path'
|
|
5
|
-
import { installCollabSkill } from '../../collab/skill'
|
|
6
5
|
import { PORT } from '../../constants'
|
|
7
6
|
import type { DetectedAgent } from '../../harness/detect'
|
|
8
7
|
import {
|
|
@@ -137,11 +136,6 @@ export const init = defineCommand({
|
|
|
137
136
|
default: false,
|
|
138
137
|
description: 'Start the web server if not already running'
|
|
139
138
|
},
|
|
140
|
-
collab: {
|
|
141
|
-
type: 'boolean',
|
|
142
|
-
default: false,
|
|
143
|
-
description: 'Include the optional collaboration guide and applet types'
|
|
144
|
-
},
|
|
145
139
|
id: {
|
|
146
140
|
type: 'string',
|
|
147
141
|
description:
|
|
@@ -204,11 +198,6 @@ export const init = defineCommand({
|
|
|
204
198
|
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
205
199
|
console.log()
|
|
206
200
|
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
|
|
207
|
-
if (args['collab']) {
|
|
208
|
-
const { referencePath } = await installCollabSkill(target, type)
|
|
209
|
-
console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
|
|
210
|
-
console.log(pc.dim(' Live presence is available in the cloud environment'))
|
|
211
|
-
}
|
|
212
201
|
if (scaffold !== 'exists') {
|
|
213
202
|
if (scaffold === 'installing') {
|
|
214
203
|
console.log(pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
package/server/collab/config.ts
CHANGED
|
@@ -3,15 +3,11 @@ import type { WorkspaceType } from '@/lib/types'
|
|
|
3
3
|
import { getAppConfig } from '../app-config'
|
|
4
4
|
import { collabSkillReferencePath } from './skill'
|
|
5
5
|
|
|
6
|
-
export function isCollabEnabled(): boolean {
|
|
7
|
-
return getAppConfig().collab
|
|
8
|
-
}
|
|
9
|
-
|
|
10
6
|
export async function getCollabReferencePath(
|
|
11
7
|
workspacePath: string,
|
|
12
8
|
type?: WorkspaceType
|
|
13
9
|
): Promise<string | undefined> {
|
|
14
|
-
if (
|
|
10
|
+
if (getAppConfig().environment !== 'cloud') return undefined
|
|
15
11
|
const referencePath = collabSkillReferencePath(workspacePath, type)
|
|
16
12
|
return (await Bun.file(referencePath).exists()) ? referencePath : undefined
|
|
17
13
|
}
|
package/server/collab/manager.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { join, resolve } from 'node:path'
|
|
|
5
5
|
import { COLLAB_MAX_MESSAGE_BYTES, isCollabClientMessage } from '@/lib/collab/protocol'
|
|
6
6
|
import type { CollabClientMessage, CollabServerMessage, UserProfile } from '@/lib/collab/types'
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { getAppConfig } from '../app-config'
|
|
9
9
|
import type { ParentMessage, WorkerMessage } from './worker-messages'
|
|
10
10
|
|
|
11
11
|
export type ClientSocket = {
|
|
@@ -107,7 +107,10 @@ export class CollabManager {
|
|
|
107
107
|
const canonicalPath = await realpath(workspacePath)
|
|
108
108
|
binding.workspacePaths.add(canonicalPath)
|
|
109
109
|
if (binding.closed) throw new CollabRuntimeError('unavailable', 'Collab connection closed')
|
|
110
|
-
|
|
110
|
+
const enabled = this.options.enabled
|
|
111
|
+
? await this.options.enabled(canonicalPath)
|
|
112
|
+
: getAppConfig().environment === 'cloud'
|
|
113
|
+
if (!enabled) {
|
|
111
114
|
throw new CollabRuntimeError(
|
|
112
115
|
'unavailable',
|
|
113
116
|
'Collaboration is only available in the cloud environment'
|
|
@@ -1,53 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, join } from 'node:path'
|
|
3
|
-
|
|
1
|
+
import { join } from 'node:path'
|
|
4
2
|
import type { WorkspaceType } from '@/lib/types'
|
|
5
|
-
|
|
6
|
-
import { appletDeclarationPath, installCollabDeclaration } from '../../applets/declarations'
|
|
7
|
-
import { COLLAB_REFERENCE_SOURCE_PATH } from '../../skills/template'
|
|
8
3
|
import { skillsDirFor } from '../../workspaces/init'
|
|
9
4
|
|
|
10
|
-
export type SkillPaths = { referencePath: string; typesPath: string }
|
|
11
|
-
|
|
12
5
|
export function collabSkillReferencePath(workspacePath: string, type?: WorkspaceType): string {
|
|
13
6
|
return join(skillsDirFor(workspacePath, type), 'moi-workspace', 'references', 'COLLAB.md')
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
function targetPaths(workspacePath: string, type?: WorkspaceType): SkillPaths {
|
|
17
|
-
return {
|
|
18
|
-
referencePath: collabSkillReferencePath(workspacePath, type),
|
|
19
|
-
typesPath: appletDeclarationPath(workspacePath, 'collab.d.ts')
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function writeChanged(path: string, contents: string): Promise<void> {
|
|
24
|
-
const file = Bun.file(path)
|
|
25
|
-
if ((await file.exists()) && (await file.text()) === contents) return
|
|
26
|
-
await mkdir(dirname(path), { recursive: true })
|
|
27
|
-
await Bun.write(path, contents)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Only an explicit `moi init --collab` installs the guide and types.
|
|
31
|
-
export async function installCollabSkill(
|
|
32
|
-
workspacePath: string,
|
|
33
|
-
type?: WorkspaceType
|
|
34
|
-
): Promise<SkillPaths> {
|
|
35
|
-
const source = Bun.file(COLLAB_REFERENCE_SOURCE_PATH)
|
|
36
|
-
if (!(await source.exists())) {
|
|
37
|
-
throw new Error('The collab guide is unavailable in this build: COLLAB.md is missing.')
|
|
38
|
-
}
|
|
39
|
-
const reference = await source.text()
|
|
40
|
-
const paths = targetPaths(workspacePath, type)
|
|
41
|
-
await writeChanged(paths.referencePath, reference)
|
|
42
|
-
await installCollabDeclaration(workspacePath)
|
|
43
|
-
return paths
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function removeCollabSkill(
|
|
47
|
-
workspacePath: string,
|
|
48
|
-
type?: WorkspaceType
|
|
49
|
-
): Promise<void> {
|
|
50
|
-
const paths = targetPaths(workspacePath, type)
|
|
51
|
-
await rm(paths.referencePath, { force: true })
|
|
52
|
-
await rm(paths.typesPath, { force: true })
|
|
53
|
-
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// workspace). Both commands take a fresh or existing directory and lay
|
|
4
4
|
// down the same set of skill folders.
|
|
5
5
|
import { cp, lstat, mkdir, readFile, readdir, readlink } from 'node:fs/promises'
|
|
6
|
+
import { getAppConfig } from '../app-config'
|
|
6
7
|
import { join } from 'node:path'
|
|
7
8
|
|
|
8
9
|
// Resolve relative to this file so source checkouts and published installs agree.
|
|
@@ -19,9 +20,9 @@ export async function bundledSkillNames(): Promise<string[]> {
|
|
|
19
20
|
|
|
20
21
|
export const COLLAB_REFERENCE_SOURCE_PATH = join(BUNDLED_SKILL_DIR, 'references', 'COLLAB.md')
|
|
21
22
|
|
|
22
|
-
//
|
|
23
|
+
// Only cloud workspaces expose live presence to applets.
|
|
23
24
|
function isDefaultSkillFile(source: string): boolean {
|
|
24
|
-
return source !== COLLAB_REFERENCE_SOURCE_PATH
|
|
25
|
+
return source !== COLLAB_REFERENCE_SOURCE_PATH || getAppConfig().environment === 'cloud'
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
async function matchesBundledPath(source: string, target: string, exact = false): Promise<boolean> {
|
package/server/skills/update.ts
CHANGED
|
@@ -80,7 +80,7 @@ async function updateWorkspaceSkillFiles(
|
|
|
80
80
|
}
|
|
81
81
|
const changedSkills = [...new Set(changedSkillPaths.map(path => basename(path)))]
|
|
82
82
|
// Applet declarations ship with the CLI, so refresh installed copies along
|
|
83
|
-
// with skills.
|
|
83
|
+
// with skills.
|
|
84
84
|
const updatedAppletTypes = await syncAppletDeclarations(workspaceRoot)
|
|
85
85
|
const skills = await skillStatuses(workspaceRoot, type)
|
|
86
86
|
|
|
@@ -52,8 +52,6 @@ export async function installWorkspaceSkillFiles(
|
|
|
52
52
|
return (await installBundledSkills(directory)).map(name => join(directory, name))
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// Both init and updates reset the owned skill. Local additions (including the
|
|
56
|
-
// experimental collab guide) are intentionally discarded; sibling skills stay.
|
|
57
55
|
async function resetWorkspaceSkill(workspaceRoot: string): Promise<string[]> {
|
|
58
56
|
const root = resolve(workspaceRoot)
|
|
59
57
|
const canonical = join(root, '.agents', 'skills', SKILL_NAME)
|
package/server/web.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { harnessStore } from './harness/auth'
|
|
|
14
14
|
import { PORT } from './constants'
|
|
15
15
|
import { control } from './control'
|
|
16
16
|
import { proxyUserState } from './collab/cloudflare-access'
|
|
17
|
-
import { isCollabEnabled } from './collab/config'
|
|
18
17
|
import { collabManager } from './collab/manager'
|
|
19
18
|
import { EVENTS_TOPIC, setEventServer } from './events'
|
|
20
19
|
import { killBuildWorkers } from './applets/build-worker'
|
|
@@ -179,7 +178,7 @@ export const app = Bun.serve<WsData>({
|
|
|
179
178
|
const workspaceId = decodeURIComponent(new URL(req.url).pathname.split('/')[3] ?? '')
|
|
180
179
|
const workspace = await getWorkspace(workspaceId)
|
|
181
180
|
if (!workspace) return new Response('Workspace not found', { status: 404 })
|
|
182
|
-
if (
|
|
181
|
+
if (getAppConfig().environment !== 'cloud') {
|
|
183
182
|
return new Response('Collab is not enabled for this workspace', { status: 403 })
|
|
184
183
|
}
|
|
185
184
|
// Behind Cloudflare Access, presence is joined only as the verified viewer.
|
|
@@ -154,6 +154,7 @@ export async function scaffoldMoiDir(
|
|
|
154
154
|
// Repair path: workspaces scaffolded before `.moi/.gitignore` existed pick
|
|
155
155
|
// it up on the next `moi init` instead of leaking cache files into git.
|
|
156
156
|
await ensureMoiGitignore(workspacePath)
|
|
157
|
+
await syncAppletDeclarations(workspacePath)
|
|
157
158
|
return 'exists'
|
|
158
159
|
}
|
|
159
160
|
// A bare `.moi/` dir without package.json counts as not-bootstrapped —
|
package/skill/SKILL.md
CHANGED
|
@@ -522,4 +522,4 @@ This skill is installed with Moi (via the CLI or the UI) and can fall behind whe
|
|
|
522
522
|
- **Then** — if you updated, mention it.
|
|
523
523
|
|
|
524
524
|
<!-- moi skill version marker — read by `moi skill` to detect drift; do not edit by hand -->
|
|
525
|
-
<moi-skill version="0.20.
|
|
525
|
+
<moi-skill version="0.20.2" />
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getCurrentUser, getDirectory, publishUsers } from '@/client/features/collab/host-state'
|
|
2
|
-
import type { CloudSession, CloudTeam } from './api'
|
|
3
|
-
|
|
4
|
-
// The session identifies the viewer. Keep the injected directory until the team
|
|
5
|
-
// request resolves, and preserve known avatar and color information by user id.
|
|
6
|
-
export function syncCloudIdentity(session: CloudSession, team?: CloudTeam): void {
|
|
7
|
-
if (!session || session.user.isAnonymous) {
|
|
8
|
-
publishUsers({ users: [] })
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
const { id, name, email } = session.user
|
|
12
|
-
const sameAccount = getCurrentUser()?.id === id
|
|
13
|
-
const known = new Map((getDirectory() ?? []).map(user => [user.id, user]))
|
|
14
|
-
const users =
|
|
15
|
-
team?.members.map(user => ({
|
|
16
|
-
...known.get(user.userId),
|
|
17
|
-
id: user.userId,
|
|
18
|
-
name: user.name,
|
|
19
|
-
email: user.email
|
|
20
|
-
})) ?? (sameAccount ? [...known.values()] : [])
|
|
21
|
-
const profile = { ...known.get(id), id, name, email }
|
|
22
|
-
publishUsers({ me: id, users: [...users.filter(user => user.id !== id), profile] })
|
|
23
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { useState, useSyncExternalStore } from 'react'
|
|
2
|
-
import { IconX } from '@tabler/icons-react'
|
|
3
|
-
import { useIsMutating, useMutation, useQueryClient } from '@tanstack/react-query'
|
|
4
|
-
import { Field, FieldLabel } from '@/ui-components/field'
|
|
5
|
-
import { Button } from '@/client/components/ui/button'
|
|
6
|
-
import { Input } from '@/client/components/ui/input'
|
|
7
|
-
import { Skeleton } from '@/client/components/ui/skeleton'
|
|
8
|
-
import { toast } from '@/client/components/ui/toast'
|
|
9
|
-
import { User } from '@/client/features/collab/components/user'
|
|
10
|
-
import {
|
|
11
|
-
getDirectory,
|
|
12
|
-
normalizeUserProfile,
|
|
13
|
-
subscribeDirectoryStore
|
|
14
|
-
} from '@/client/features/collab/host-state'
|
|
15
|
-
import { useAccount } from '../account/account-provider'
|
|
16
|
-
import { SettingsSection } from './settings-section'
|
|
17
|
-
import {
|
|
18
|
-
accountKeys,
|
|
19
|
-
CloudApiError,
|
|
20
|
-
cancelInvitation,
|
|
21
|
-
inviteMember,
|
|
22
|
-
removeMember
|
|
23
|
-
} from '../account/api'
|
|
24
|
-
import type { CloudSession, TeamMember } from '../account/api'
|
|
25
|
-
|
|
26
|
-
export function UsersSettings() {
|
|
27
|
-
const { team, removingMemberIds, setRemovingMemberIds } = useAccount()
|
|
28
|
-
const directory = useSyncExternalStore(subscribeDirectoryStore, getDirectory, getDirectory)
|
|
29
|
-
const qc = useQueryClient()
|
|
30
|
-
const [email, setEmail] = useState('')
|
|
31
|
-
const mutation = useMutation({
|
|
32
|
-
mutationKey: accountKeys.team,
|
|
33
|
-
mutationFn: (action: () => Promise<unknown>) => action(),
|
|
34
|
-
onSuccess: () => qc.invalidateQueries({ queryKey: accountKeys.team }),
|
|
35
|
-
onError: error => {
|
|
36
|
-
toast.add({ title: 'Couldn’t update users', description: error.message, type: 'error' })
|
|
37
|
-
if (error instanceof CloudApiError && error.status === 401)
|
|
38
|
-
void qc.invalidateQueries({ queryKey: accountKeys.session })
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
const pending = useIsMutating({ mutationKey: accountKeys.team }) > 0
|
|
42
|
-
|
|
43
|
-
function act(action: () => Promise<unknown>) {
|
|
44
|
-
if (!pending) mutation.mutate(action)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function remove(member: TeamMember) {
|
|
48
|
-
const userId = qc.getQueryData<CloudSession>(accountKeys.session)?.user.id
|
|
49
|
-
const restore = () => setRemovingMemberIds(ids => ids.filter(id => id !== member.id))
|
|
50
|
-
let undone = false
|
|
51
|
-
setRemovingMemberIds(ids => [...ids, member.id])
|
|
52
|
-
// Keep access intact until the toast closes, so Undo needs no restore API.
|
|
53
|
-
const id = toast.add({
|
|
54
|
-
title: `${member.name.trim() || member.email} removed`,
|
|
55
|
-
timeout: 5000,
|
|
56
|
-
onClose: () => {
|
|
57
|
-
if (undone || qc.getQueryData<CloudSession>(accountKeys.session)?.user.id !== userId) {
|
|
58
|
-
restore()
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
void mutation.mutateAsync(() => removeMember(member.id)).then(restore, restore)
|
|
62
|
-
},
|
|
63
|
-
actionProps: {
|
|
64
|
-
children: 'Undo',
|
|
65
|
-
onClick: () => {
|
|
66
|
-
undone = true
|
|
67
|
-
toast.close(id)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (team.isPending)
|
|
74
|
-
return (
|
|
75
|
-
<SettingsSection title="Users">
|
|
76
|
-
<div className="flex flex-col gap-4" aria-label="Loading users">
|
|
77
|
-
<Skeleton className="h-6 w-32" />
|
|
78
|
-
<Skeleton className="h-24 w-full" />
|
|
79
|
-
</div>
|
|
80
|
-
</SettingsSection>
|
|
81
|
-
)
|
|
82
|
-
if (team.isError)
|
|
83
|
-
return (
|
|
84
|
-
<SettingsSection title="Users">
|
|
85
|
-
<div className="flex flex-col items-start gap-3">
|
|
86
|
-
<p role="alert">{team.error.message}</p>
|
|
87
|
-
<Button variant="outline" onClick={() => void team.refetch()}>
|
|
88
|
-
Try again
|
|
89
|
-
</Button>
|
|
90
|
-
</div>
|
|
91
|
-
</SettingsSection>
|
|
92
|
-
)
|
|
93
|
-
const { members, invitations, role } = team.data
|
|
94
|
-
const owner = role === 'owner'
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<SettingsSection title="Users">
|
|
98
|
-
<ul className="flex flex-col gap-4">
|
|
99
|
-
{members
|
|
100
|
-
.filter(member => !removingMemberIds.includes(member.id))
|
|
101
|
-
.map(member => (
|
|
102
|
-
<li key={member.id} className="flex items-center gap-3">
|
|
103
|
-
<User
|
|
104
|
-
profile={normalizeUserProfile({
|
|
105
|
-
...directory?.find(user => user.id === member.userId),
|
|
106
|
-
id: member.userId,
|
|
107
|
-
name: member.name,
|
|
108
|
-
email: member.email
|
|
109
|
-
})}
|
|
110
|
-
size="sm"
|
|
111
|
-
showYouLabel={member.me}
|
|
112
|
-
description={member.name?.trim() ? member.email : undefined}
|
|
113
|
-
className="flex-1"
|
|
114
|
-
/>
|
|
115
|
-
<span className="text-xs text-muted-foreground">
|
|
116
|
-
{member.role === 'owner' ? 'Owner' : 'Member'}
|
|
117
|
-
</span>
|
|
118
|
-
{owner && !member.me && (
|
|
119
|
-
<Button
|
|
120
|
-
variant="ghost"
|
|
121
|
-
size="sm"
|
|
122
|
-
disabled={pending}
|
|
123
|
-
aria-label={`Remove ${member.email}`}
|
|
124
|
-
onClick={() => remove(member)}
|
|
125
|
-
>
|
|
126
|
-
Remove
|
|
127
|
-
</Button>
|
|
128
|
-
)}
|
|
129
|
-
</li>
|
|
130
|
-
))}
|
|
131
|
-
{owner &&
|
|
132
|
-
invitations.map(invitation => (
|
|
133
|
-
<li
|
|
134
|
-
key={`invitation-${invitation.id}`}
|
|
135
|
-
className="group/invitation flex items-center gap-3"
|
|
136
|
-
tabIndex={0}
|
|
137
|
-
>
|
|
138
|
-
<User
|
|
139
|
-
profile={normalizeUserProfile({ id: invitation.id, email: invitation.email })}
|
|
140
|
-
size="sm"
|
|
141
|
-
description={`Invitation expires ${new Date(invitation.expiresAt).toLocaleDateString()}`}
|
|
142
|
-
className="flex-1 text-muted-foreground [&_[data-slot=avatar]]:opacity-50"
|
|
143
|
-
/>
|
|
144
|
-
<div className="flex shrink-0 items-center gap-2">
|
|
145
|
-
<span className="text-xs text-muted-foreground [@media(hover:hover)]:group-focus-within/invitation:hidden [@media(hover:hover)]:group-hover/invitation:hidden">
|
|
146
|
-
Pending invite
|
|
147
|
-
</span>
|
|
148
|
-
<Button
|
|
149
|
-
variant="ghost"
|
|
150
|
-
size="icon-sm"
|
|
151
|
-
className="text-muted-foreground transition-none group-focus-within/invitation:inline-flex group-hover/invitation:inline-flex [@media(hover:hover)]:hidden"
|
|
152
|
-
disabled={pending}
|
|
153
|
-
aria-label={`Cancel invitation for ${invitation.email}`}
|
|
154
|
-
onClick={() => act(() => cancelInvitation(invitation.id))}
|
|
155
|
-
>
|
|
156
|
-
<IconX stroke={1.75} />
|
|
157
|
-
</Button>
|
|
158
|
-
</div>
|
|
159
|
-
</li>
|
|
160
|
-
))}
|
|
161
|
-
</ul>
|
|
162
|
-
{owner && (
|
|
163
|
-
<form
|
|
164
|
-
className="flex items-end gap-2"
|
|
165
|
-
onSubmit={event => {
|
|
166
|
-
event.preventDefault()
|
|
167
|
-
const value = email.trim()
|
|
168
|
-
if (!value) return
|
|
169
|
-
act(async () => {
|
|
170
|
-
await inviteMember(value)
|
|
171
|
-
setEmail('')
|
|
172
|
-
})
|
|
173
|
-
}}
|
|
174
|
-
>
|
|
175
|
-
<Field className="min-w-0 flex-1">
|
|
176
|
-
<FieldLabel htmlFor="invite-email">Invite someone</FieldLabel>
|
|
177
|
-
<Input
|
|
178
|
-
id="invite-email"
|
|
179
|
-
type="email"
|
|
180
|
-
required
|
|
181
|
-
autoComplete="off"
|
|
182
|
-
placeholder="Email"
|
|
183
|
-
value={email}
|
|
184
|
-
disabled={pending}
|
|
185
|
-
onChange={event => setEmail(event.target.value)}
|
|
186
|
-
/>
|
|
187
|
-
</Field>
|
|
188
|
-
<Button type="submit" disabled={pending}>
|
|
189
|
-
Invite
|
|
190
|
-
</Button>
|
|
191
|
-
</form>
|
|
192
|
-
)}
|
|
193
|
-
</SettingsSection>
|
|
194
|
-
)
|
|
195
|
-
}
|