totem-llm 0.3.3 → 0.3.5

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 +1 @@
1
- import{u as P,a as k,r as d,j as t,i as w,W as f,b as I,p as E,s as _,L,c as C,P as F,d as U,e as R,f as z}from"../index.js";import{S as A,a as H}from"./index-6bd7928a.js";import{P as M,D as O,a as D,b as N,C as B,c as G,W as J,d as Q,e as V,Q as q,S as K,f as X,M as Y,g as T}from"./index-dcc00e8c.js";import"./truncate-06273256.js";import"./XCircle-edfe554c.js";import"./moment-75486807.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-bb85eef1.js";import"./mcpServers-1686e782.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./Copy-d323e545.js";import"./Trans-820f1dad.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./agentFlows-e4124dd3.js";import"./index-3cb59d82.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";async function Z(){const s=_(localStorage.getItem(L));if(s!=null&&s.slug){const n=await f.bySlug(s.slug);if(n)return n}const r=await f.all();return r.length>0?r[0]:null}async function S(s="My Workspace"){const{workspace:r,message:n}=await f.new({name:s});return r||(C(n||"Failed to create workspace","error"),null)}function $(){const{t:s}=P(),{user:r}=k(),[n,h]=d.useState(null),[c,u]=d.useState(null),[v,p]=d.useState(!0),[b,x]=d.useState(!1),g=d.useRef([]);d.useEffect(()=>{async function o(){const e=await Z();if(e){const[i,{showAgentCommand:a}]=await Promise.all([f.getSuggestedMessages(e.slug),f.agentCommandAvailable(e.slug)]);h({...e,suggestedMessages:i,showAgentCommand:a})}p(!1)}o()},[]),d.useEffect(()=>{if(n&&c&&g.current.length>0){const o=g.current;g.current=[],window.dispatchEvent(new CustomEvent(M,{detail:{files:o}}))}},[n,c]),d.useEffect(()=>{if(c)return;async function o(e){var m;const i=(m=e.detail)==null?void 0:m.files;if(!(i!=null&&i.length))return;g.current=i;let a=n;if(!a){if(a=await S(s("new-workspace.placeholder")),!a)return;h(a)}const{thread:l}=await f.threads.new(a.slug);l&&u(l.slug)}return window.addEventListener(M,o),()=>window.removeEventListener(M,o)},[n,c]);async function y(o){x(!1),g.current=o;const e=await S(s("new-workspace.placeholder"));if(!e)return;h(e);const{thread:i}=await f.threads.new(e.slug);i&&u(i.slug)}async function j(o){x(!1),g.current=o;const{thread:e}=await f.threads.new(n.slug);e&&u(e.slug)}return v?t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden"}):!n&&(r==null?void 0:r.role)==="default"?t.jsx(ee,{}):n&&c?t.jsx(O,{workspace:n,threadSlug:c,children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:c,setThreadSlug:u})}):t.jsx(D.Provider,{value:{files:[],ready:!0,dragging:b,setDragging:x,onDrop:n?j:y,parseAttachments:()=>[]},children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:null,setThreadSlug:u})})}function W({workspace:s,setWorkspace:r,threadSlug:n,setThreadSlug:h}){const{t:c}=P(),u=I(),[v,p]=d.useState(!1),{files:b,parseAttachments:x}=d.useContext(D);d.useEffect(()=>{window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:"",writeMode:"replace"}}))},[]);async function g(e,i=[]){if(!(!e||v)){p(!0);try{let a=s,l=n;if(!a){if(a=await S(c("new-workspace.placeholder")),!a){p(!1);return}r(a)}if(!l){const{thread:m}=await f.threads.new(a.slug);l=m==null?void 0:m.slug,m&&h(m.slug)}sessionStorage.setItem(F,JSON.stringify({message:e,attachments:i})),u(l?E.workspace.thread(a.slug,l):E.workspace.chat(a.slug))}catch(a){console.error("Error submitting message:",a),C("Failed to send message","error"),p(!1)}}}async function y(e){var a,l;e.preventDefault();const i=((l=(a=document.getElementById(T))==null?void 0:a.value)==null?void 0:l.trim())||"";await g(i,x())}function j({text:e="",autoSubmit:i=!1,writeMode:a="replace"}){var l;if(i){if(a==="append"&&(e=(((l=document.getElementById(T))==null?void 0:l.value)??"")+e),!e.trim())return;g(e.trim());return}window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:e,writeMode:a}}))}async function o(){let e=s;if(!e){if(e=await S(c("new-workspace.placeholder")),!e)return;r(e)}u(E.workspace.settings.generalAppearance(e.slug))}return t.jsx(B,{children:t.jsxs("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"relative flex md:ml-[2px] md:mr-[16px] md:my-[16px] w-full h-full z-[2]",children:[t.jsx(G,{}),t.jsxs("div",{className:"flex-1 min-w-0 transition-all duration-500 relative md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden border-none light:border-solid light:border light:border-theme-modal-border",children:[w&&t.jsx(A,{}),t.jsx(J,{workspaceSlug:s==null?void 0:s.slug}),t.jsx(Q,{children:t.jsxs("div",{className:"flex flex-col h-full w-full items-center justify-center",children:[t.jsxs("div",{className:"flex flex-col items-center w-full max-w-[750px]",children:[t.jsx("h1",{className:"text-white text-xl md:text-2xl mb-11 text-center",children:c("main-page.greeting")}),t.jsx(V,{workspace:s,submit:y,isStreaming:v,sendCommand:j,attachments:b,centered:!0,workspaceSlug:s==null?void 0:s.slug,threadSlug:n}),t.jsx(q,{hasAvailableWorkspace:!!s,onCreateAgent:()=>u(E.settings.agentSkills()),onEditWorkspace:o,onUploadDocument:()=>{var e;return(e=document.getElementById("dnd-chat-file-uploader"))==null?void 0:e.click()}})]}),t.jsx(K,{suggestedMessages:s==null?void 0:s.suggestedMessages,sendCommand:j})]})}),t.jsx(X,{})]}),t.jsx(Y,{workspace:s})]})})}function ee(){const{t:s}=P();return t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden",children:t.jsx("div",{className:"flex flex-col h-full w-full items-center justify-center",children:t.jsx("p",{className:"text-white/60 text-sm text-center whitespace-pre-line",children:s("home.notAssigned")})})})}function Se(){const{loading:s,requiresAuth:r,mode:n}=U();return s?t.jsx(R,{}):r!==!1?t.jsx(t.Fragment,{children:r!==null&&t.jsx(z,{mode:n})}):t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[w?t.jsx(A,{}):t.jsx(H,{}),t.jsx($,{})]})}export{Se as default};
1
+ import{u as P,a as k,r as d,j as t,i as w,W as f,b as I,p as E,s as _,L,c as C,P as F,d as U,e as R,f as z}from"../index.js";import{S as A,a as H}from"./index-6bd7928a.js";import{P as M,D as O,a as D,b as N,C as B,c as G,W as J,d as Q,e as V,Q as q,S as K,f as X,M as Y,g as T}from"./index-671239cd.js";import"./truncate-06273256.js";import"./XCircle-edfe554c.js";import"./moment-75486807.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-bb85eef1.js";import"./mcpServers-1686e782.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./Copy-d323e545.js";import"./Trans-820f1dad.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./agentFlows-e4124dd3.js";import"./index-3cb59d82.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";async function Z(){const s=_(localStorage.getItem(L));if(s!=null&&s.slug){const n=await f.bySlug(s.slug);if(n)return n}const r=await f.all();return r.length>0?r[0]:null}async function S(s="My Workspace"){const{workspace:r,message:n}=await f.new({name:s});return r||(C(n||"Failed to create workspace","error"),null)}function $(){const{t:s}=P(),{user:r}=k(),[n,h]=d.useState(null),[c,u]=d.useState(null),[v,p]=d.useState(!0),[b,x]=d.useState(!1),g=d.useRef([]);d.useEffect(()=>{async function o(){const e=await Z();if(e){const[i,{showAgentCommand:a}]=await Promise.all([f.getSuggestedMessages(e.slug),f.agentCommandAvailable(e.slug)]);h({...e,suggestedMessages:i,showAgentCommand:a})}p(!1)}o()},[]),d.useEffect(()=>{if(n&&c&&g.current.length>0){const o=g.current;g.current=[],window.dispatchEvent(new CustomEvent(M,{detail:{files:o}}))}},[n,c]),d.useEffect(()=>{if(c)return;async function o(e){var m;const i=(m=e.detail)==null?void 0:m.files;if(!(i!=null&&i.length))return;g.current=i;let a=n;if(!a){if(a=await S(s("new-workspace.placeholder")),!a)return;h(a)}const{thread:l}=await f.threads.new(a.slug);l&&u(l.slug)}return window.addEventListener(M,o),()=>window.removeEventListener(M,o)},[n,c]);async function y(o){x(!1),g.current=o;const e=await S(s("new-workspace.placeholder"));if(!e)return;h(e);const{thread:i}=await f.threads.new(e.slug);i&&u(i.slug)}async function j(o){x(!1),g.current=o;const{thread:e}=await f.threads.new(n.slug);e&&u(e.slug)}return v?t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden"}):!n&&(r==null?void 0:r.role)==="default"?t.jsx(ee,{}):n&&c?t.jsx(O,{workspace:n,threadSlug:c,children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:c,setThreadSlug:u})}):t.jsx(D.Provider,{value:{files:[],ready:!0,dragging:b,setDragging:x,onDrop:n?j:y,parseAttachments:()=>[]},children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:null,setThreadSlug:u})})}function W({workspace:s,setWorkspace:r,threadSlug:n,setThreadSlug:h}){const{t:c}=P(),u=I(),[v,p]=d.useState(!1),{files:b,parseAttachments:x}=d.useContext(D);d.useEffect(()=>{window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:"",writeMode:"replace"}}))},[]);async function g(e,i=[]){if(!(!e||v)){p(!0);try{let a=s,l=n;if(!a){if(a=await S(c("new-workspace.placeholder")),!a){p(!1);return}r(a)}if(!l){const{thread:m}=await f.threads.new(a.slug);l=m==null?void 0:m.slug,m&&h(m.slug)}sessionStorage.setItem(F,JSON.stringify({message:e,attachments:i})),u(l?E.workspace.thread(a.slug,l):E.workspace.chat(a.slug))}catch(a){console.error("Error submitting message:",a),C("Failed to send message","error"),p(!1)}}}async function y(e){var a,l;e.preventDefault();const i=((l=(a=document.getElementById(T))==null?void 0:a.value)==null?void 0:l.trim())||"";await g(i,x())}function j({text:e="",autoSubmit:i=!1,writeMode:a="replace"}){var l;if(i){if(a==="append"&&(e=(((l=document.getElementById(T))==null?void 0:l.value)??"")+e),!e.trim())return;g(e.trim());return}window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:e,writeMode:a}}))}async function o(){let e=s;if(!e){if(e=await S(c("new-workspace.placeholder")),!e)return;r(e)}u(E.workspace.settings.generalAppearance(e.slug))}return t.jsx(B,{children:t.jsxs("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"relative flex md:ml-[2px] md:mr-[16px] md:my-[16px] w-full h-full z-[2]",children:[t.jsx(G,{}),t.jsxs("div",{className:"flex-1 min-w-0 transition-all duration-500 relative md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden border-none light:border-solid light:border light:border-theme-modal-border",children:[w&&t.jsx(A,{}),t.jsx(J,{workspaceSlug:s==null?void 0:s.slug}),t.jsx(Q,{children:t.jsxs("div",{className:"flex flex-col h-full w-full items-center justify-center",children:[t.jsxs("div",{className:"flex flex-col items-center w-full max-w-[750px]",children:[t.jsx("h1",{className:"text-white text-xl md:text-2xl mb-11 text-center",children:c("main-page.greeting")}),t.jsx(V,{workspace:s,submit:y,isStreaming:v,sendCommand:j,attachments:b,centered:!0,workspaceSlug:s==null?void 0:s.slug,threadSlug:n}),t.jsx(q,{hasAvailableWorkspace:!!s,onCreateAgent:()=>u(E.settings.agentSkills()),onEditWorkspace:o,onUploadDocument:()=>{var e;return(e=document.getElementById("dnd-chat-file-uploader"))==null?void 0:e.click()}})]}),t.jsx(K,{suggestedMessages:s==null?void 0:s.suggestedMessages,sendCommand:j})]})}),t.jsx(X,{})]}),t.jsx(Y,{workspace:s})]})})}function ee(){const{t:s}=P();return t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden",children:t.jsx("div",{className:"flex flex-col h-full w-full items-center justify-center",children:t.jsx("p",{className:"text-white/60 text-sm text-center whitespace-pre-line",children:s("home.notAssigned")})})})}function Se(){const{loading:s,requiresAuth:r,mode:n}=U();return s?t.jsx(R,{}):r!==!1?t.jsx(t.Fragment,{children:r!==null&&t.jsx(z,{mode:n})}):t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[w?t.jsx(A,{}):t.jsx(H,{}),t.jsx($,{})]})}export{Se as default};