limixbot 0.3.114 → 0.3.116
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/dist/assets/{ActivityPanel-DiLMgzph.js → ActivityPanel-CPyIoUmY.js} +1 -1
- package/dist/assets/{App-Ddh_DeKL.js → App-D_fqRJhk.js} +8 -8
- package/dist/assets/{AppEventEditor-DxveH-cr.js → AppEventEditor-DTYGJT1f.js} +1 -1
- package/dist/assets/{BotSettingsDialog-DMl_BpJ5.js → BotSettingsDialog-De6r2yvR.js} +1 -1
- package/dist/assets/{BrowserPanel-epB3EK-g.js → BrowserPanel-abUgbX2z.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BCHI-qVi.js → BrowserProfilesManager-IuxTSnih.js} +1 -1
- package/dist/assets/{CloudAddDialog-C6MFVLlA.js → CloudAddDialog-C8OGeyq3.js} +1 -1
- package/dist/assets/{ComputerFilesPane--Bw2H6YF.js → ComputerFilesPane-BCaN6XSL.js} +1 -1
- package/dist/assets/{ComputerPanel-C4Q3wifa.js → ComputerPanel-LPwMftDF.js} +2 -2
- package/dist/assets/{DataPanel-D6IvdVhd.js → DataPanel-X1VUpw1U.js} +1 -1
- package/dist/assets/{GrokMoveDialog-0QYeBKvp.js → GrokMoveDialog-D-z86fT9.js} +1 -1
- package/dist/assets/{InspectorPanel-DUqPg7KZ.js → InspectorPanel-DbJq2m5L.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-BaPZ9Yfj.js → KeyboardShortcutsModal-DYTFL_aJ.js} +1 -1
- package/dist/assets/{LimixResizeHandles-Cgoym0Xl.js → LimixResizeHandles-DLDtm0nE.js} +1 -1
- package/dist/assets/{LiveDesktop-BGy8nqFB.js → LiveDesktop-B8KndeA2.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-BUhMJYrY.js → LocalVmWorkspace-B2V9D2cJ.js} +1 -1
- package/dist/assets/{MacLocalControl-DDgUk1AE.js → MacLocalControl-6LKkmAKt.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-0simEJp-.js → MarkdownFilePreview-BCxhBtBJ.js} +1 -1
- package/dist/assets/{NewBotDialog-DHQujvPN.js → NewBotDialog-o7l4HJW-.js} +1 -1
- package/dist/assets/{PhoneAppDialog-Cq-1ZBsB.js → PhoneAppDialog-C4mtXK2o.js} +1 -1
- package/dist/assets/{PluginsPanel-D0mOM94r.js → PluginsPanel-D-4XAvSO.js} +1 -1
- package/dist/assets/{ProIntroduction-CutUiKNu.js → ProIntroduction-BBpRtakG.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DZzqIhvL.js → RemoteAgentSettingsPanel-Ce3lFnoM.js} +1 -1
- package/dist/assets/{RoomPanel-DVkmk2hl.js → RoomPanel-CtqyNeOi.js} +1 -1
- package/dist/assets/{RoutinesPage-C3w9qdbF.js → RoutinesPage-D9VQa8Id.js} +1 -1
- package/dist/assets/SettingsModal-D1thqDC-.js +19 -0
- package/dist/assets/{ShareTeamDialog-CIvnf9Ql.js → ShareTeamDialog-CDAXGizM.js} +1 -1
- package/dist/assets/{SignedInSites-BE6eaSJq.js → SignedInSites-B9tzCm-B.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-BIcy8Iyf.js → TeamLibraryPanel-CU39m2wr.js} +1 -1
- package/dist/assets/{TeamMapPage-DnXg1zmn.js → TeamMapPage-kKb_yOAX.js} +1 -1
- package/dist/assets/{TriggersPage-D9sr9f5M.js → TriggersPage-DRuKK0G6.js} +1 -1
- package/dist/assets/{VisibilitySection-j0PdMnH3.js → VisibilitySection-B-4LSDjd.js} +1 -1
- package/dist/assets/{WebhookTrigger-ByvIgnn0.js → WebhookTrigger-rBYKz_RM.js} +1 -1
- package/dist/assets/{WorksOnGrid-D__HSyhm.js → WorksOnGrid-DCpYS0ZD.js} +1 -1
- package/dist/assets/{core-DnKXzdi1.js → core-PnDBcOH3.js} +1 -1
- package/dist/assets/{import-name-DEPg2ht3.js → import-name-BSWA4Waq.js} +1 -1
- package/dist/assets/{index-BIFgmFd6.js → index-CD6r_oet.js} +2 -2
- package/dist/assets/{index-B48L2b4D.js → index-CRS8Hcp2.js} +1 -1
- package/dist/assets/{mcp-servers-CIoA0Z8X.js → mcp-servers-6KR1t77y.js} +1 -1
- package/dist/assets/{new-bot-DB8EcyfW.js → new-bot-Dapj-7yH.js} +1 -1
- package/dist/assets/{org-library-C-mDWISC.js → org-library-Q_EDTsK1.js} +1 -1
- package/dist/assets/{package-format-CYXsEP2B.js → package-format-G8_Vezo4.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BTKO8ICQ.js → remote-desktop-panel-CaJgKj1v.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/index.js +38 -36
- package/dist-server/package.json +1 -1
- package/dist-server/server/bot-channels/zalo-media.js +4 -4
- package/dist-server/server/chief-of-staff.js +1 -1
- package/dist-server/server/limix-skill-hub.js +27 -3
- package/package.json +1 -1
- package/dist/assets/SettingsModal-Dokjrp1d.js +0 -19
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{dg as W,dh as A,di as k,dj as C,dk as $,dl as q,dm as z,dn as U,dp as X}from"./App-
|
|
1
|
+
import{dg as W,dh as A,di as k,dj as C,dk as $,dl as q,dm as z,dn as U,dp as X}from"./App-D_fqRJhk.js";import j from"./katex-HP8lGamR.js";import"./styles-DaC7RuGF.js";import"./index-CD6r_oet.js";import"./PlacesRail-3RYT-fm8.js";import"./monitor-Ehduuiym.js";import"./MenuMotion-READmdk4.js";const T=/[#.]/g;function Y(e,t){const n=e||"",r={};let o=0,i,s;for(;o<n.length;){T.lastIndex=o;const a=T.exec(n),c=n.slice(o,a?a.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:s=c,o+=c.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||t||"div",properties:r,children:[]}}function B(e,t,n){const r=n?v(n):void 0;function o(i,s,...a){let c;if(i==null){c={type:"root",children:[]};const f=s;a.unshift(f)}else{c=Y(i,t);const f=c.tagName.toLowerCase(),l=r?r.get(f):void 0;if(c.tagName=l||f,J(s))a.unshift(s);else for(const[u,d]of Object.entries(s))Q(e,c.properties,u,d)}for(const f of a)w(c.children,f);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return o}function J(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const o=t[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Q(e,t,n,r){const o=W(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=A(r):o.commaSeparated?i=k(r):o.commaOrSpaceSeparated?i=A(k(r).join(" ")):i=E(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?Z(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push(E(o,o.property,a));i=s}o.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}function w(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)w(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?w(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function E(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||C(n)===C(t)))return!0}return n}function Z(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function v(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const ee=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","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","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],te=B($,"div"),ne=B(q,"g",ee),y={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function re(e,t){return P(e,{})||{type:"root",children:[]}}function P(e,t){const n=oe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function oe(e,t){switch(e.nodeType){case 1:return ae(e,t);case 3:return se(e);case 8:return ce(e);case 9:return S(e,t);case 10:return ie();case 11:return S(e,t);default:return}}function S(e,t){return{type:"root",children:D(e,t)}}function ie(){return{type:"doctype"}}function se(e){return{type:"text",value:e.nodeValue||""}}function ce(e){return{type:"comment",value:e.nodeValue||""}}function ae(e,t){const n=e.namespaceURI,r=n===y.svg?ne:te,o=n===y.html?e.tagName.toLowerCase():e.tagName,i=n===y.html&&o==="template"?e.content:e,s=e.getAttributeNames(),a={};let c=-1;for(;++c<s.length;)a[s[c]]=e.getAttribute(s[c])||"";return r(o,a,D(i,t))}function D(e,t){const n=e.childNodes,r=[];let o=-1;for(;++o<n.length;){const i=P(n[o],t);i!==void 0&&r.push(i)}return r}new DOMParser;function fe(e,t){const n=le(e);return re(n)}function le(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const I=(function(e,t,n){const r=z(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),h=(function(e){if(e==null)return he;if(typeof e=="string")return pe(e);if(typeof e=="object")return ue(e);if(typeof e=="function")return b(e);throw new Error("Expected function, string, or array as `test`")});function ue(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=h(e[n]);return b(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function pe(e){return b(t);function t(n){return n.tagName===e}}function b(e){return t;function t(n,r,o){return!!(de(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function he(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function de(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const O=/\n/g,M=/[\t ]+/g,N=h("br"),F=h(Ae),me=h("p"),L=h("tr"),ge=h(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",xe,ke]),G=h(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function ye(e,t){const n=t||{},r="children"in e?e.children:[],o=G(e),i=H(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(..._(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...R(r[a],e,{whitespace:i,breakBefore:a?void 0:o,breakAfter:a<r.length-1?N(r[a+1]):o}));const c=[];let f;for(a=-1;++a<s.length;){const l=s[a];typeof l=="number"?f!==void 0&&l>f&&(f=l):l&&(f!==void 0&&f>-1&&c.push(`
|
|
2
2
|
`.repeat(f)||" "),f=-1,c.push(l))}return c.join("")}function R(e,t,n){return e.type==="element"?we(e,t,n):e.type==="text"?n.whitespace==="normal"?_(e,n):Ne(e):[]}function we(e,t,n){const r=H(e,n),o=e.children||[];let i=-1,s=[];if(ge(e))return s;let a,c;for(N(e)||L(e)&&I(t,e,L)?c=`
|
|
3
3
|
`:me(e)?(a=2,c=2):G(e)&&(a=1,c=1);++i<o.length;)s=s.concat(R(o[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<o.length-1?N(o[i+1]):c}));return F(e)&&I(t,e,F)&&s.push(" "),a&&s.unshift(a),c&&s.push(c),s}function _(e,t){const n=String(e.value),r=[],o=[];let i=0;for(;i<=n.length;){O.lastIndex=i;const c=O.exec(n),f=c&&"index"in c?c.index:n.length;r.push(be(n.slice(i,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,f===n.length?t.breakAfter:!0)),i=f+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(o.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&o.push(a),o.push(r[s]),a=0):(s===0||s===r.length-1)&&o.push(0);return o}function Ne(e){return[String(e.value)]}function be(e,t,n){const r=[];let o=0,i;for(;o<e.length;){M.lastIndex=o;const s=M.exec(e);i=s?s.index:e.length,!o&&!i&&s&&!t&&r.push(""),o!==i&&r.push(e.slice(o,i)),o=s?i+s[0].length:i}return o!==i&&!n&&r.push(""),r.join(" ")}function H(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function xe(e){return!!(e.properties||{}).hidden}function Ae(e){return e.tagName==="td"||e.tagName==="th"}function ke(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Ce={},je=[];function Le(e){const t=e||Ce;return function(n,r){U(n,"element",function(o,i){const s=Array.isArray(o.properties.className)?o.properties.className:je,a=s.includes("language-math"),c=s.includes("math-display"),f=s.includes("math-inline");let l=c;if(!a&&!c&&!f)return;let u=i[i.length-1],d=o;if(o.tagName==="code"&&a&&u&&u.type==="element"&&u.tagName==="pre"&&(d=u,u=i[i.length-2],l=!0),!u)return;const m=ye(d,{whitespace:"pre"});let p;try{p=j.renderToString(m,{...t,displayMode:l,throwOnError:!0})}catch(g){const x=g,V=x.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,o],cause:x,place:o.position,ruleId:V,source:"rehype-katex"});try{p=j.renderToString(m,{...t,displayMode:l,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(g)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=fe(p).children);const K=u.children.indexOf(d);return u.children.splice(K,1,...p),X})}}export{Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i}from"./styles-DaC7RuGF.js";import{j as p}from"./App-
|
|
1
|
+
import{r as i}from"./styles-DaC7RuGF.js";import{j as p}from"./App-D_fqRJhk.js";let l={servers:null,error:!1},o=null,u=0;const c=new Set,a=()=>l,v=e=>(c.add(e),()=>{c.delete(e)});function d(e){u+=1,o=null,l={servers:e.map(({name:r,enabled:t,bot:s,offFor:n})=>({name:r,enabled:!!t,...s?{bot:s}:{},...n?.length?{offFor:n}:{}})),error:!1};for(const r of c)r()}function f(e=!1){if(!e&&l.servers&&!l.error)return Promise.resolve(l.servers);if(!e&&o)return o;const r=++u;return o=p("/api/mcp/servers").then(t=>(r===u&&d(t.servers??[]),l.servers??[])).catch(()=>{if(r===u){l={...l,error:!0};for(const t of c)t()}return l.servers??[]}).finally(()=>{r===u&&(o=null)}),o}function h(){const e=i.useSyncExternalStore(v,a,a);return i.useEffect(()=>{f(!0)},[]),{...e,refresh:()=>f(!0)}}function m(e,r){return e.filter(t=>!t.bot||t.bot===r)}function g(e,r,t){const s=m(e,t).filter(n=>n.enabled);return r==null?s:s.filter(n=>r.includes(n.name))}function x(e,r,t){const s=r??e.filter(n=>n.enabled).map(n=>n.name);return s.includes(t)?s.filter(n=>n!==t):[...s,t]}export{h as a,m as b,x as c,g as m,d as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as v,W as O,ba as $,bb as C,bc as L,bd as N,h as j,be as E,bf as _,bg as R,bh as I,bi as x,bj as F,bk as J}from"./App-
|
|
1
|
+
import{j as v,W as O,ba as $,bb as C,bc as L,bd as N,h as j,be as E,bf as _,bg as R,bh as I,bi as x,bj as F,bk as J}from"./App-D_fqRJhk.js";import{t as h,l as D}from"./styles-DaC7RuGF.js";import{b as G}from"./PlacesRail-3RYT-fm8.js";const te={profile:{},memory:{},skills:[],routines:[]},H=t=>({name:t.name,prompt:t.prompt,schedule:t.schedule,enabled:t.enabled,runOn:t.runOn,durationMinutes:t.durationMinutes,timeoutMinutes:t.timeoutMinutes,overlap:t.overlap,attachments:t.attachments});class z{constructor(e,a,o=v){this.changed=a,this.network=o,this.template=structuredClone(e),this.routines=e.routines.map(n=>this.routine({...n,botId:this.id}))}changed;network;id=`draft-${O()}`;template;consent={};routines;preset;role;avatarFile;avatarObjectUrl;get bot(){const{computer:e,cwd:a,toolScope:o,...n}=this.template.profile;return{id:this.id,threadId:this.id,name:"",title:"",description:"",soul:"",color:"green",notifications:!0,unread:!1,messages:[],modelSelection:{instanceId:"",model:""},...n,computer:e??void 0,cwd:a??void 0,toolScope:o??void 0}}patch(e){const{acknowledgeLocalAuto:a,acknowledgePeerScope:o,applyToAllThreads:n,keepThreadModels:r,autoApprove:i,...l}=e;a!==void 0&&(this.consent.acknowledgeLocalAuto=a),o!==void 0&&(this.consent.acknowledgePeerScope=o),i!==void 0&&l.approvalMode===void 0&&(l.approvalMode=i?"auto":"ask"),this.template.profile={...this.template.profile,...l},this.changed()}setModel(e){this.patch({modelSelection:e})}choosePreset(e){this.preset=e,this.changed()}chooseRole(e){this.role=e,this.changed()}setMemory(e,a){a===null?delete this.template.memory[e]:this.template.memory[e]=a,this.changed()}setRoutineEnabled(e,a){this.routines=this.routines.map(o=>o.id===e?{...o,enabled:a}:o),this.changed()}removeRoutine(e){this.routines=this.routines.filter(a=>a.id!==e),this.changed()}export(){return structuredClone({...this.template,routines:this.routines.map(H)})}uploadAvatar=async e=>{if(!["image/png","image/jpeg","image/gif","image/webp"].includes(e.type))throw new Error(h("newBot.avatar.invalidType"));if(e.size>10*1024*1024)throw new Error(h("newBot.avatar.tooLarge"));return this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl),this.avatarFile=e,this.avatarObjectUrl=URL.createObjectURL(e),this.avatarObjectUrl};dispose(){this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl)}routine(e,a){const{groupId:o,resultsThreadId:n,checks:r,access:i,deliver:l,modelSelection:c,schedule:s,...g}=e,p=s.type==="interval"?{...s,weekdays:s.weekdays??void 0,window:s.window??void 0,endsAt:s.endsAt??void 0}:s.type==="limit_reset"?{...s,repeat:s.repeat??"once",at:s.at??null}:s;return{id:a?.id??`draft-${O()}`,createdAt:a?.createdAt??Date.now(),updatedAt:Date.now(),nextRunAt:null,runOn:"maus",...a,...g,enabled:e.enabled??a?.enabled??!0,target:"bot",botId:this.id,timeoutMinutes:e.timeoutMinutes??void 0,durationMinutes:e.durationMinutes??a?.durationMinutes??30,schedule:p}}request=async(e,a)=>{const o=a?.method??"GET",n=typeof a?.body=="string"?JSON.parse(a.body):{},r=`/api/bots/${this.id}`;let i;if(e===r&&o==="PATCH")this.patch(n),i={bot:this.bot};else if(e===`${r}/soul`&&o==="GET")i={soul:this.bot.soul,revision:"draft",bytes:new TextEncoder().encode(this.bot.soul).length,limit:24e3,file:"",drift:!1};else if(e===`${r}/skills`&&o==="GET")i={skills:this.template.skills,staged:[]};else if(e===`${r}/skills`&&o==="POST"){const l=await this.network("/api/bot-defaults/skills/preview",{method:"POST",body:JSON.stringify(n)}),c=new Set(this.template.skills.map(s=>s.name));if(l.skills.some(s=>c.has(s.name)))throw new Error(h("newBot.skillExists"));this.template.skills.push(...l.skills),this.changed(),i={installed:l.skills}}else if(e.startsWith(`${r}/skills/`)){const l=decodeURIComponent(e.slice(`${r}/skills/`.length)),c=this.template.skills.find(s=>s.name===l);if(!c)throw new Error("No such draft skill");if(o==="GET")i={text:c.text};else if(o==="PATCH"&&typeof n.enabled=="boolean")c.enabled=n.enabled,this.changed(),i={ok:!0};else if(o==="DELETE")this.template.skills=this.template.skills.filter(s=>s!==c),this.changed(),i={ok:!0};else throw new Error("Unsupported draft skill operation")}else if(e===`${r}/avatar/generate`&&o==="POST"){const{name:l,title:c,description:s}=this.bot,{dataUrl:g}=await this.network("/api/bot-defaults/avatar",{method:"POST",body:JSON.stringify({profile:{name:l,title:c,description:s},prompt:n.prompt})}),p=await(await fetch(g)).blob(),f=await this.uploadAvatar(new File([p],"avatar.png",{type:p.type}));i={avatarUrl:f,bot:{...this.bot,avatarUrl:f,avatarCrop:"circle"}}}else if(e==="/api/routines"&&o==="POST"||e.startsWith("/api/routines/draft-")&&o==="PATCH"){if(n.target&&n.target!=="bot")throw new Error("A new bot's routine must target that bot");if(n.botId!==this.id)throw new Error("Routine belongs to another bot");const l=this.routines.find(s=>e===`/api/routines/${s.id}`);if(o==="PATCH"&&!l)throw new Error("No such draft routine");const c=this.routine(n,l);this.routines=[...this.routines.filter(s=>s.id!==c.id),c],this.changed(),i={routine:c}}else throw new Error("This operation requires a created bot");return i}}const W=new Set(["coder","agency-ai-engineer","agency-api-platform-engineer","agency-backend-architect","agency-code-reviewer","agency-codebase-onboarding-engineer","agency-data-engineer","agency-data-visualization-engineer","agency-desktop-app-engineer","agency-developer-tooling-engineer","agency-devops-automator","agency-dx-engineer","agency-frontend-developer","agency-i18n-engineer","agency-identity-access-engineer","agency-minimal-change-engineer","agency-mobile-release-engineer","agency-payments-billing-engineer","agency-platform-engineer","agency-rag-pipeline-engineer","agency-rapid-prototyper","agency-realtime-collaboration-engineer","agency-search-relevance-engineer","agency-software-architect","agency-sre","agency-test-automation-engineer"]);function Y(t){return typeof t=="string"&&W.has(t)}async function K(t){const e=t.export();if(e.profile.avatarUrl?.startsWith("blob:")){if(!t.avatarFile)throw new Error(h("newBot.avatar.chooseAgain"));const a=await j(t.avatarFile),o=a&&G(a.path);if(!o)throw new Error(h("newBot.avatar.storeFailed"));e.profile.avatarUrl=o}return e}async function Q(t,e=v,a=$,o=N(),n,r){const i=await K(t),{chiefOfStaff:l,managedSections:c,toolScope:s,modelSelection:g,...p}=i.profile;if(!p.name?.trim())throw new Error(h("newBot.nameRequired"));const f=t.preset,k=!f&&t.role?C(t.role):void 0,U=g?.instanceId&&g.model?{modelSelection:g,requireAvailableModel:!0}:{},S=await e("/api/bots",{method:"POST",body:JSON.stringify({name:p.name,title:p.title,description:p.description,...U,section:p.section,useDefaults:!1,...n!==void 0?{visibility:n}:{},...r?{reportsTo:r}:{},...!f&&Y(t.role)?{codingTemplate:t.role}:{},...!f&&t.role==="video-workflow"?{videoTemplate:!0}:{},...k?{industryTemplate:k.id,templateLocale:D()}:{},...Object.hasOwn(i.profile,"toolScope")?{settings:{toolScope:s}}:{},...f?{preset:f.id}:{}})});let u=S.bot;const b=[],y=[];try{const m=await a(u.id,{...p,...t.consent},new AbortController().signal,e,o,u);if(u={...u,...m},p.approvalMode==="full"||p.approvalMode==="custom"){if(m.approvalMode!==p.approvalMode)throw new Error(h("newBot.approvalNotGranted"));if((await L(u.id,u.threadId,{approvalMode:p.approvalMode,acknowledgeLocalAuto:t.consent.acknowledgeLocalAuto===!0},o,e)).approvalMode!==p.approvalMode)throw new Error(h("newBot.threadApprovalNotGranted"))}for(const[d,w]of Object.entries(i.memory))f?.notes.includes(d)||await e(`/api/bots/${u.id}/memory/file`,{method:"PUT",body:JSON.stringify({path:d,text:w})});for(const d of i.skills)f?.skills.includes(d.name)||await e(`/api/bots/${u.id}/skill-template`,{method:"POST",body:JSON.stringify(d)});for(const d of i.routines){const w=await e("/api/routines",{method:"POST",body:JSON.stringify({...d,botId:u.id,enabled:!1})});b.push({id:w.routine.id,enabled:d.enabled!==!1})}}catch(m){const d=[];for(const T of b)try{await e(`/api/routines/${T.id}`,{method:"DELETE"})}catch{d.push(`routine ${T.id}`)}try{await e(`/api/bots/${u.id}`,{method:"DELETE"})}catch{d.push(`bot ${u.name} (${u.id})`)}const w=m instanceof Error?m.message:String(m);throw new Error(d.length?`${w}. Cleanup failed for ${d.join(", ")}; remove them before retrying.`:w)}if(l)try{const m=await e(`/api/bots/${u.id}`,{method:"PATCH",body:JSON.stringify({chiefOfStaff:l,managedSections:c,acknowledgePeerScope:!0})});u={...u,...m.bot}}catch(m){y.push(h("newBot.warning.chiefOfStaff",{error:m instanceof Error?m.message:String(m)}))}for(const m of b.filter(d=>d.enabled))try{await e(`/api/routines/${m.id}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})}catch(d){y.push(h("newBot.warning.routine",{error:d instanceof Error?d.message:String(d)}))}return{bot:u,warnings:y,...S.paused?{paused:!0}:{}}}function A(t,e){const a=structuredClone(t.defaults),o=a.profile.modelSelection;return(!o||o.instanceId===""&&o.model==="")&&(a.profile.modelSelection=t.modelSelection),e&&(a.profile.name=a.profile.name?.trim()||t.suggestedName),a}function M(t,e){const a=new Set(e.map(o=>o.name.trim().toLowerCase()));if(!a.has(t.trim().toLowerCase()))return t;for(let o=2;;o++)if(!a.has(`${t} ${o}`.toLowerCase()))return`${t} ${o}`}function B(t,e,a,o){if(t)return t;const n=a.filter(r=>!r.hidden&&(r.section?.trim()||"")===(e?.trim()||""));return J(n,o)?.email??o.me?.email??null}function P(t,e,a,{preserveSelection:o=!1,showThreads:n,source:r,role:i,paused:l}){R(r,i),t({type:"botAdded",bot:e,preserveSelection:o}),!o&&I()&&x(t,e,n),a.length&&t({type:"error",message:a.join(`
|
|
2
2
|
`)}),l&&F(e.id)}async function V(t,e,a,o){if(typeof window<"u"&&window.ogb?.remoteClient?.active){const{bot:c,paused:s}=await o("/api/bots",{method:"POST",body:JSON.stringify(t===void 0?{}:{section:t})});return{bot:c,warnings:[],startsOnAsk:!1,...s?{paused:s}:{}}}const n=A(await o("/api/bot-defaults"),!0);n.profile.name=M(n.profile.name,e),t!==void 0&&(n.profile.section=t);const r=new z(n,()=>{},o),i=r.bot.approvalMode==="auto"&&r.bot.computer==="local";i&&r.patch({approvalMode:"ask"});const l=a?B(null,r.bot.section,e,a)??void 0:void 0;try{return{...await Q(r,o,void 0,void 0,void 0,l),startsOnAsk:i}}finally{r.dispose()}}async function X(t,e,a,o,n=v){if(E()?.admin===!1)return;let r;try{r=await V(t.section,e,E(),n)}catch(i){if(_(i))return;const l=h("newBot.failed",{error:i instanceof Error?i.message:String(i)});t.onError?t.onError(l):a({type:"error",message:l});return}P(a,r.bot,r.warnings,{preserveSelection:t.preserveSelection,showThreads:o,source:"blank",paused:r.paused}),r.startsOnAsk&&a({type:"notice",notice:{kind:"note",botName:null,text:h("newBot.startsOnAsk",{name:r.bot.name})}}),t.onCreated?.(r.bot)}const oe=Object.freeze(Object.defineProperty({__proto__:null,announceNewBot:P,freeName:M,makeNewBot:X,reportsToFor:B,startingTemplate:A},Symbol.toStringTag,{value:"Module"}));export{z as B,te as E,P as a,Q as c,oe as n,K as p,B as r,A as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as l,H as b,I as d,g as h,h as w,s as p,J as L,K as M,f as x,M as O,N as P,O as R,t as n}from"./styles-DaC7RuGF.js";import{p as C,P as N,a as j}from"./package-format-CYXsEP2B.js";import{m as B}from"./PlacesRail-3RYT-fm8.js";import{a_ as S,a$ as _,b0 as G,b1 as $}from"./App-Ddh_DeKL.js";const se=50*1024*1024,q="Bot profiles, instructions, sections, rooms, playbooks, routines, each bot's memory (MEMORY.md, topic notes and daily logs) and conversation text (all tasks and branches).",u=p().min(1).max(200),v=p().trim().min(1).max(200),I=w().finite().nonnegative(),F=h(_),A=l({role:d("bot"),text:p().max(2e6),textCode:h(["chat.notice.exportedGoal.working","chat.notice.exportedGoal.completed","chat.notice.exportedGoal.needs-input","chat.notice.exportedGoal.blocked","chat.notice.exportedGoal.limit-reached","chat.notice.exportedGoal.paused","chat.notice.exportedGoal.stopped","chat.notice.exportedGoal.failed"]),textParams:l({before:p().max(2e6),content:p().max(2e6)})}),K=l({id:u,role:h(["bot","user"]),text:A.shape.text,textCode:A.shape.textCode.optional(),textParams:A.shape.textParams.optional(),at:I,parentId:u.nullable(),replyToId:u.optional(),from:l({botId:u,name:v,color:p().max(40)}).optional(),peerPost:l({unattended:x().optional()}).optional(),serverCard:d(!0).optional()}),U=l({key:u,title:p().max(2e3),createdAt:I,titleFromFirstMessage:d(!0).optional(),outside:d(!0).optional(),openedBy:l({botId:u,name:v,at:I,kind:h(["pair","work"]).optional()}).optional(),closedBy:l({botId:u,name:v,at:I}).optional(),pinned:d(!0).optional(),turnTimeoutMinutes:w().int().min(1).max(1440).optional(),activeLeafId:u.nullable(),messages:b(K).max(1e5)}),T={key:u,name:v,section:p().max(200).optional(),activeTask:u,tasks:b(U).min(1).max(1e4)},V=l({key:u,name:v,summary:p().max(24e3),triggers:b(p().max(2e3)).max(100),instructions:p().max(2e5)}),Y=M("type",[l({type:d("once"),at:I}),l({type:d("daily"),time:p().regex(/^([01]\d|2[0-3]):[0-5]\d$/),weekdays:b(w().int().min(0).max(6)).min(1).max(7)}),l({type:d("interval"),everyMinutes:w().int().min(5).max(1440),anchorAt:w().int().min(0).max(864e13)})]),E=p().max(2e6),H=l({file:E,topics:b(l({name:p().regex(/^[\w][\w .-]{0,199}\.md$/),text:E})).max(1e3),logs:b(l({name:p().regex(/^\d{4}-\d{2}-\d{2}\.md$/),text:E})).max(1e4)}),z=P(p().regex($),l({tools:R([d("*"),b(p().regex(G)).min(1).max(500)])}));function D(r){if(!r||typeof r!="object"||Array.isArray(r))return r;const o=r,e=o.defaultResponder&&typeof o.defaultResponder=="object"?o.defaultResponder.kind:void 0;if(typeof e!="string"||["member","everyone","mentions","auto"].includes(e))return r;const m=Array.isArray(o.memberIds)&&typeof o.memberIds[0]=="string"?o.memberIds[0]:void 0;return{...o,defaultResponder:m?{kind:"member",botId:m}:{kind:"mentions"}}}const J=l({format:d("openmaus.backup"),version:d(1),name:v,exportedAt:I,warnings:b(p().max(2e3)).max(4e3).default([]),bots:b(l({...T,title:p().max(2e3),description:p().max(2e5),soul:p().refine(r=>new TextEncoder().encode(r).byteLength<=24e3,{error:"standing instructions must be at most 24000 bytes"}).optional(),color:F,mascotExpression:p().max(80).optional(),mascotBody:p().max(40).optional(),mascotFaceColor:B.optional(),chiefOfStaff:x(),hidden:x(),playbooks:b(V).max(200),connectorTools:z.optional(),toolScope:O(r=>r!==void 0&&S(r).ok,"Invalid tool selection").transform(r=>{const o=S(r);return o.ok?o.scope:r}).optional(),helperModel:x().optional(),memory:H.optional()})).min(1).max(200),groups:b(L(D,l({...T,memberIds:b(u).max(200),dm:x(),bulletin:p().max(2e5),defaultResponder:M("kind",[l({kind:d("member"),botId:u}),l({kind:d("everyone")}),l({kind:d("mentions")}),l({kind:d("auto"),fallbackBotId:u.optional()})])}))).max(2e3),routines:b(l({name:v,prompt:p().trim().min(1).max(2e5),target:h(["bot","room-goal"]),botId:u,groupId:u.optional(),runOn:h(["maus","cloud"]),schedule:Y,durationMinutes:w().finite().positive(),timeoutMinutes:w().int().min(5).max(240).optional(),checks:b(h(["calendar","mail","runs"])).max(3).optional(),access:d("read-and-draft").optional(),deliver:d("brief").optional()})).max(2e3)});function W(r){const o=J.safeParse(r);if(!o.success){const a=o.error.issues[0];throw new Error(`Invalid backup: ${a.path.join(".")||"file"}: ${a.message}`)}const e=o.data,m=(a,f)=>{const i=new Set(a);if(i.size!==a.length)throw new Error(`Invalid backup: duplicate ${f}`);return i},s=m(e.bots.map(a=>a.key),"bot key"),t=m(e.groups.map(a=>a.key),"room key"),c=new Set;for(const a of e.bots){if(!a.chiefOfStaff)continue;const f=a.section?.trim()??"";if(c.has(f)||a.hidden)throw new Error("Invalid backup: a section must have at most one visible Chief of Staff");c.add(f)}for(const a of e.groups){if(a.memberIds.some(i=>!s.has(i)))throw new Error("Invalid backup: unknown room member");m(a.memberIds,"room member");const f=a.defaultResponder.kind==="member"?a.defaultResponder.botId:a.defaultResponder.kind==="auto"?a.defaultResponder.fallbackBotId:void 0;if(f!==void 0&&!a.memberIds.includes(f))throw new Error("Invalid backup: room responder is not a member");if(a.dm&&(a.memberIds.length!==2||a.tasks.length!==1))throw new Error("Invalid backup: invalid direct-message room")}for(const a of e.routines){if(!s.has(a.botId))throw new Error("Invalid backup: unknown routine bot");if(a.target==="room-goal"){if(a.runOn!=="maus")throw new Error("Invalid backup: room goals must run on this computer");const f=e.groups.find(i=>i.key===a.groupId);if(a.groupId!==void 0&&(!t.has(a.groupId)||!f||f.dm||!f.memberIds.includes(a.botId)))throw new Error("Invalid backup: unknown routine room or coordinator")}}for(const a of[...e.bots,...e.groups]){if(!m(a.tasks.map(i=>i.key),"task key").has(a.activeTask))throw new Error("Invalid backup: unknown active task");for(const i of a.tasks){const k=m(i.messages.map(y=>y.id),"message key"),g=new Set;for(const y of i.messages){if(y.parentId!==null&&!g.has(y.parentId))throw new Error("Invalid backup: invalid conversation branch");if(y.replyToId&&!k.has(y.replyToId))throw new Error("Invalid backup: unknown reply");g.add(y.id)}if(i.activeLeafId!==null&&!k.has(i.activeLeafId))throw new Error("Invalid backup: unknown conversation head")}}return e}function X(r){if(typeof r=="string"&&(r=Q(r)),!r||typeof r!="object"||Array.isArray(r))throw new Error(n("teamImport.noTeam"));const o=r;if(o.format==="openmaus.backup"){const s=W(r);return{manifest:s,kind:"backup",name:s.name,description:q,members:s.bots.map(t=>({name:t.name,title:t.title})),rooms:s.groups.length,playbooks:s.bots.reduce((t,c)=>t+c.playbooks.length,0),routines:s.routines.length,apps:[],conversations:[...s.bots,...s.groups].reduce((t,c)=>t+c.tasks.length,0),archivedBots:s.bots.filter(t=>t.hidden).length,warnings:s.warnings}}if(o.format==="openmaus.package")return re(o,r);if(o.format!=="openmaus.team")throw new Error(n("teamImport.unknownFormat"));if(o.version!==1&&o.version!==2)throw new Error(n("teamImport.teamVersion",{version:String(o.version)}));if(!o.team||typeof o.team!="object"||Array.isArray(o.team))throw new Error(n("teamImport.teamMissing"));const e=o.team;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.teamNoName"));if(!Array.isArray(e.members)||e.members.length===0)throw new Error(n("teamImport.teamNoMembers"));if(e.members.length>200)throw new Error(n("teamImport.teamTooMany"));const m=e.members.map((s,t)=>{if(!s||typeof s!="object"||Array.isArray(s))throw new Error(n("teamImport.memberInvalid",{number:t+1}));const c=s;if(typeof c.name!="string"||!c.name.trim())throw new Error(n("teamImport.memberNoName",{number:t+1}));return{name:c.name.trim(),title:typeof c.title=="string"?c.title.trim():""}});return{manifest:r,kind:"team",name:e.name.trim(),description:typeof e.description=="string"?e.description.trim():"",members:m,rooms:o.version===1&&e.room&&typeof e.room=="object"?1:0,playbooks:0,routines:0,apps:[]}}function Q(r){const o=r.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!o)throw new Error(n("teamImport.markdownNoFrontmatter"));let e;try{e=C(o[1])}catch{throw new Error(n("teamImport.markdownBadYaml"))}if(!e||typeof e!="object"||Array.isArray(e))throw new Error(n("teamImport.markdownNoBlueprint"));const{botmrr:m,...s}=e;if(m!==1)throw new Error(n("teamImport.markdownVersion"));return{format:"openmaus.package",version:1,package:s}}function Z(r,o){const e=r.package;if(!e.agents.length)return ee(r,o);const m=new Set(e.agents.flatMap(t=>t.skills??[])),s=e.team?.leader?e.agents.find(t=>t.key===e.team?.leader)?.name:void 0;return{manifest:o,kind:"package",version:2,name:e.name,teamName:e.team?.name??e.name,description:e.summary,members:e.agents.map(t=>({name:t.name,title:t.title??""})),...s?{chiefOfStaff:s}:{},...e.team?.brief?.trim()?{brief:e.team.brief}:{},pictures:e.agents.map(t=>t.appearance.avatar?`data:${t.appearance.avatar.mime};base64,${t.appearance.avatar.data}`:null),rooms:e.rooms?.length??0,playbooks:e.playbooks?.length??0,routines:e.routines?.length??0,apps:e.requirements.apps.map(t=>({label:t.label,optional:t.optional===!0})),skills:(e.skills?.entries??[]).filter(t=>m.has(t.name)).map(t=>t.name),offeredSkills:(e.skills?.entries??[]).filter(t=>!m.has(t.name)).map(t=>t.name),connections:(e.connections??[]).map(t=>({label:t.label,url:t.mcp.url,values:t.mcp.valueNames.length})),notes:e.agents.reduce((t,c)=>t+Object.keys(c.seed?.memory??{}).length,0),presets:(e.presets??[]).map(t=>t.name)}}function ee(r,o){const e=r.package;if(!e.presets?.length)throw new Error(n("teamImport.libraryEmpty"));return{manifest:o,kind:"package",version:2,library:!0,name:e.name,description:e.summary,members:[],rooms:0,playbooks:e.playbooks?.length??0,routines:0,apps:[],skills:[],offeredSkills:(e.skills?.entries??[]).filter(m=>!e.presets.some(s=>s.skills?.includes(m.name))).map(m=>m.name),presets:e.presets.map(m=>m.name)}}function re(r,o){if(typeof r.version=="number"&&r.version>N)throw new Error(n("teamImport.newer"));if(r.version===N)return Z(j(o),o);if(r.version!==1)throw new Error(n("teamImport.playbookVersion",{version:String(r.version)}));if(!r.package||typeof r.package!="object"||Array.isArray(r.package))throw new Error(n("teamImport.playbookMissing"));const e=r.package;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.playbookNoName"));if(!Array.isArray(e.agents)||e.agents.length===0)throw new Error(n("teamImport.playbookNoBots"));if(e.agents.length>200)throw new Error(n("teamImport.playbookTooMany"));const m=e.agents.map((i,k)=>{if(!i||typeof i!="object"||Array.isArray(i))throw new Error(n("teamImport.botInvalid",{number:k+1}));const g=i;if(typeof g.name!="string"||!g.name.trim())throw new Error(n("teamImport.botNoName",{number:k+1}));return{name:g.name.trim(),title:typeof g.title=="string"?g.title.trim():""}}),s=typeof e.chiefOfStaff=="string"?e.chiefOfStaff:void 0,t=s?e.agents.find(i=>i.key===s)?.name:void 0,c=e.requirements&&typeof e.requirements=="object"&&!Array.isArray(e.requirements)?e.requirements:{},a=Array.isArray(c.apps)?c.apps.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const k=i;return typeof k.label=="string"?[{label:k.label.trim(),optional:k.optional===!0}]:[]}):[],f=e.skills&&typeof e.skills=="object"&&!Array.isArray(e.skills)?e.skills.entries:void 0;return{manifest:o,kind:"package",version:1,name:e.name.trim(),description:typeof e.summary=="string"?e.summary.trim():"",members:m,...typeof t=="string"?{chiefOfStaff:t}:{},rooms:Array.isArray(e.rooms)?e.rooms.length:0,playbooks:Array.isArray(e.playbooks)?e.playbooks.length:0,routines:Array.isArray(e.routines)?e.routines.length:0,apps:a,skills:Array.isArray(f)?f.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const{name:k}=i;return typeof k=="string"&&k.trim()?[k.trim()]:[]}):[]}}function ie(r){return r.installed&&r.installed.status!=="removed"?"added":r.release?r.blob==="unsupported"?"updateApp":r.blob!=="ready"?"notReady":"add":"noRelease"}function me(r){return r.publisher.self?n("orgLibrary.fromSelf"):n("orgLibrary.from",{name:r.publisher.name})}function pe(r){return r.mode==="required"?n("orgLibrary.recommended",{name:r.publisher.name}):null}function le(r){const o=[];return r.installed?.status==="withdrawn"&&o.push(n("orgLibrary.withdrawn",{name:r.publisher.name})),r.installed?.status==="installed"&&r.release&&r.release.version!==r.installed.release&&o.push(n("orgLibrary.newerRelease",{version:r.release.version})),o}function ce(r){const o=[];return r.bots&&o.push(n("orgLibrary.bots",{count:r.bots})),r.skills&&o.push(n("orgLibrary.skills",{count:r.skills})),r.presets&&o.push(n("orgLibrary.presets",{count:r.presets})),r.rooms&&o.push(n("orgLibrary.rooms",{count:r.rooms})),r.routines&&o.push(n("orgLibrary.routines",{count:r.routines})),r.connections&&o.push(n("orgLibrary.connections",{count:r.connections})),o.join(" · ")}function de(r,o=[]){if(r?.source!=="org")return null;const e=r.publisher?.name??"",m=o.find(s=>s.installId===r.installId);return{line:e?n("orgLibrary.provenance",{name:r.name,release:r.release,publisher:e}):n("orgLibrary.provenanceFile",{name:r.name,release:r.release}),withdrawn:m?.status==="withdrawn"?n("orgLibrary.withdrawn",{name:m.publisher||e}):null}}function ue(r){if(r.package.agents.length)return X(r);const o=r.package;return{manifest:r,kind:"package",version:2,name:o.name,teamName:o.name,description:o.summary,members:[],rooms:0,playbooks:o.playbooks?.length??0,routines:0,apps:o.requirements.apps.map(e=>({label:e.label,optional:e.optional===!0})),skills:[],offeredSkills:(o.skills?.entries??[]).map(e=>e.name),connections:[],notes:0,presets:(o.presets??[]).map(e=>e.name)}}export{se as M,pe as a,le as b,me as c,ce as d,ue as e,ie as o,de as p,X as t};
|
|
1
|
+
import{o as l,H as b,I as d,g as h,h as w,s as p,J as L,K as M,f as x,M as O,N as P,O as R,t as n}from"./styles-DaC7RuGF.js";import{p as C,P as N,a as j}from"./package-format-G8_Vezo4.js";import{m as B}from"./PlacesRail-3RYT-fm8.js";import{a_ as S,a$ as _,b0 as G,b1 as $}from"./App-D_fqRJhk.js";const se=50*1024*1024,q="Bot profiles, instructions, sections, rooms, playbooks, routines, each bot's memory (MEMORY.md, topic notes and daily logs) and conversation text (all tasks and branches).",u=p().min(1).max(200),v=p().trim().min(1).max(200),I=w().finite().nonnegative(),F=h(_),A=l({role:d("bot"),text:p().max(2e6),textCode:h(["chat.notice.exportedGoal.working","chat.notice.exportedGoal.completed","chat.notice.exportedGoal.needs-input","chat.notice.exportedGoal.blocked","chat.notice.exportedGoal.limit-reached","chat.notice.exportedGoal.paused","chat.notice.exportedGoal.stopped","chat.notice.exportedGoal.failed"]),textParams:l({before:p().max(2e6),content:p().max(2e6)})}),K=l({id:u,role:h(["bot","user"]),text:A.shape.text,textCode:A.shape.textCode.optional(),textParams:A.shape.textParams.optional(),at:I,parentId:u.nullable(),replyToId:u.optional(),from:l({botId:u,name:v,color:p().max(40)}).optional(),peerPost:l({unattended:x().optional()}).optional(),serverCard:d(!0).optional()}),U=l({key:u,title:p().max(2e3),createdAt:I,titleFromFirstMessage:d(!0).optional(),outside:d(!0).optional(),openedBy:l({botId:u,name:v,at:I,kind:h(["pair","work"]).optional()}).optional(),closedBy:l({botId:u,name:v,at:I}).optional(),pinned:d(!0).optional(),turnTimeoutMinutes:w().int().min(1).max(1440).optional(),activeLeafId:u.nullable(),messages:b(K).max(1e5)}),T={key:u,name:v,section:p().max(200).optional(),activeTask:u,tasks:b(U).min(1).max(1e4)},V=l({key:u,name:v,summary:p().max(24e3),triggers:b(p().max(2e3)).max(100),instructions:p().max(2e5)}),Y=M("type",[l({type:d("once"),at:I}),l({type:d("daily"),time:p().regex(/^([01]\d|2[0-3]):[0-5]\d$/),weekdays:b(w().int().min(0).max(6)).min(1).max(7)}),l({type:d("interval"),everyMinutes:w().int().min(5).max(1440),anchorAt:w().int().min(0).max(864e13)})]),E=p().max(2e6),H=l({file:E,topics:b(l({name:p().regex(/^[\w][\w .-]{0,199}\.md$/),text:E})).max(1e3),logs:b(l({name:p().regex(/^\d{4}-\d{2}-\d{2}\.md$/),text:E})).max(1e4)}),z=P(p().regex($),l({tools:R([d("*"),b(p().regex(G)).min(1).max(500)])}));function D(r){if(!r||typeof r!="object"||Array.isArray(r))return r;const o=r,e=o.defaultResponder&&typeof o.defaultResponder=="object"?o.defaultResponder.kind:void 0;if(typeof e!="string"||["member","everyone","mentions","auto"].includes(e))return r;const m=Array.isArray(o.memberIds)&&typeof o.memberIds[0]=="string"?o.memberIds[0]:void 0;return{...o,defaultResponder:m?{kind:"member",botId:m}:{kind:"mentions"}}}const J=l({format:d("openmaus.backup"),version:d(1),name:v,exportedAt:I,warnings:b(p().max(2e3)).max(4e3).default([]),bots:b(l({...T,title:p().max(2e3),description:p().max(2e5),soul:p().refine(r=>new TextEncoder().encode(r).byteLength<=24e3,{error:"standing instructions must be at most 24000 bytes"}).optional(),color:F,mascotExpression:p().max(80).optional(),mascotBody:p().max(40).optional(),mascotFaceColor:B.optional(),chiefOfStaff:x(),hidden:x(),playbooks:b(V).max(200),connectorTools:z.optional(),toolScope:O(r=>r!==void 0&&S(r).ok,"Invalid tool selection").transform(r=>{const o=S(r);return o.ok?o.scope:r}).optional(),helperModel:x().optional(),memory:H.optional()})).min(1).max(200),groups:b(L(D,l({...T,memberIds:b(u).max(200),dm:x(),bulletin:p().max(2e5),defaultResponder:M("kind",[l({kind:d("member"),botId:u}),l({kind:d("everyone")}),l({kind:d("mentions")}),l({kind:d("auto"),fallbackBotId:u.optional()})])}))).max(2e3),routines:b(l({name:v,prompt:p().trim().min(1).max(2e5),target:h(["bot","room-goal"]),botId:u,groupId:u.optional(),runOn:h(["maus","cloud"]),schedule:Y,durationMinutes:w().finite().positive(),timeoutMinutes:w().int().min(5).max(240).optional(),checks:b(h(["calendar","mail","runs"])).max(3).optional(),access:d("read-and-draft").optional(),deliver:d("brief").optional()})).max(2e3)});function W(r){const o=J.safeParse(r);if(!o.success){const a=o.error.issues[0];throw new Error(`Invalid backup: ${a.path.join(".")||"file"}: ${a.message}`)}const e=o.data,m=(a,f)=>{const i=new Set(a);if(i.size!==a.length)throw new Error(`Invalid backup: duplicate ${f}`);return i},s=m(e.bots.map(a=>a.key),"bot key"),t=m(e.groups.map(a=>a.key),"room key"),c=new Set;for(const a of e.bots){if(!a.chiefOfStaff)continue;const f=a.section?.trim()??"";if(c.has(f)||a.hidden)throw new Error("Invalid backup: a section must have at most one visible Chief of Staff");c.add(f)}for(const a of e.groups){if(a.memberIds.some(i=>!s.has(i)))throw new Error("Invalid backup: unknown room member");m(a.memberIds,"room member");const f=a.defaultResponder.kind==="member"?a.defaultResponder.botId:a.defaultResponder.kind==="auto"?a.defaultResponder.fallbackBotId:void 0;if(f!==void 0&&!a.memberIds.includes(f))throw new Error("Invalid backup: room responder is not a member");if(a.dm&&(a.memberIds.length!==2||a.tasks.length!==1))throw new Error("Invalid backup: invalid direct-message room")}for(const a of e.routines){if(!s.has(a.botId))throw new Error("Invalid backup: unknown routine bot");if(a.target==="room-goal"){if(a.runOn!=="maus")throw new Error("Invalid backup: room goals must run on this computer");const f=e.groups.find(i=>i.key===a.groupId);if(a.groupId!==void 0&&(!t.has(a.groupId)||!f||f.dm||!f.memberIds.includes(a.botId)))throw new Error("Invalid backup: unknown routine room or coordinator")}}for(const a of[...e.bots,...e.groups]){if(!m(a.tasks.map(i=>i.key),"task key").has(a.activeTask))throw new Error("Invalid backup: unknown active task");for(const i of a.tasks){const k=m(i.messages.map(y=>y.id),"message key"),g=new Set;for(const y of i.messages){if(y.parentId!==null&&!g.has(y.parentId))throw new Error("Invalid backup: invalid conversation branch");if(y.replyToId&&!k.has(y.replyToId))throw new Error("Invalid backup: unknown reply");g.add(y.id)}if(i.activeLeafId!==null&&!k.has(i.activeLeafId))throw new Error("Invalid backup: unknown conversation head")}}return e}function X(r){if(typeof r=="string"&&(r=Q(r)),!r||typeof r!="object"||Array.isArray(r))throw new Error(n("teamImport.noTeam"));const o=r;if(o.format==="openmaus.backup"){const s=W(r);return{manifest:s,kind:"backup",name:s.name,description:q,members:s.bots.map(t=>({name:t.name,title:t.title})),rooms:s.groups.length,playbooks:s.bots.reduce((t,c)=>t+c.playbooks.length,0),routines:s.routines.length,apps:[],conversations:[...s.bots,...s.groups].reduce((t,c)=>t+c.tasks.length,0),archivedBots:s.bots.filter(t=>t.hidden).length,warnings:s.warnings}}if(o.format==="openmaus.package")return re(o,r);if(o.format!=="openmaus.team")throw new Error(n("teamImport.unknownFormat"));if(o.version!==1&&o.version!==2)throw new Error(n("teamImport.teamVersion",{version:String(o.version)}));if(!o.team||typeof o.team!="object"||Array.isArray(o.team))throw new Error(n("teamImport.teamMissing"));const e=o.team;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.teamNoName"));if(!Array.isArray(e.members)||e.members.length===0)throw new Error(n("teamImport.teamNoMembers"));if(e.members.length>200)throw new Error(n("teamImport.teamTooMany"));const m=e.members.map((s,t)=>{if(!s||typeof s!="object"||Array.isArray(s))throw new Error(n("teamImport.memberInvalid",{number:t+1}));const c=s;if(typeof c.name!="string"||!c.name.trim())throw new Error(n("teamImport.memberNoName",{number:t+1}));return{name:c.name.trim(),title:typeof c.title=="string"?c.title.trim():""}});return{manifest:r,kind:"team",name:e.name.trim(),description:typeof e.description=="string"?e.description.trim():"",members:m,rooms:o.version===1&&e.room&&typeof e.room=="object"?1:0,playbooks:0,routines:0,apps:[]}}function Q(r){const o=r.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!o)throw new Error(n("teamImport.markdownNoFrontmatter"));let e;try{e=C(o[1])}catch{throw new Error(n("teamImport.markdownBadYaml"))}if(!e||typeof e!="object"||Array.isArray(e))throw new Error(n("teamImport.markdownNoBlueprint"));const{botmrr:m,...s}=e;if(m!==1)throw new Error(n("teamImport.markdownVersion"));return{format:"openmaus.package",version:1,package:s}}function Z(r,o){const e=r.package;if(!e.agents.length)return ee(r,o);const m=new Set(e.agents.flatMap(t=>t.skills??[])),s=e.team?.leader?e.agents.find(t=>t.key===e.team?.leader)?.name:void 0;return{manifest:o,kind:"package",version:2,name:e.name,teamName:e.team?.name??e.name,description:e.summary,members:e.agents.map(t=>({name:t.name,title:t.title??""})),...s?{chiefOfStaff:s}:{},...e.team?.brief?.trim()?{brief:e.team.brief}:{},pictures:e.agents.map(t=>t.appearance.avatar?`data:${t.appearance.avatar.mime};base64,${t.appearance.avatar.data}`:null),rooms:e.rooms?.length??0,playbooks:e.playbooks?.length??0,routines:e.routines?.length??0,apps:e.requirements.apps.map(t=>({label:t.label,optional:t.optional===!0})),skills:(e.skills?.entries??[]).filter(t=>m.has(t.name)).map(t=>t.name),offeredSkills:(e.skills?.entries??[]).filter(t=>!m.has(t.name)).map(t=>t.name),connections:(e.connections??[]).map(t=>({label:t.label,url:t.mcp.url,values:t.mcp.valueNames.length})),notes:e.agents.reduce((t,c)=>t+Object.keys(c.seed?.memory??{}).length,0),presets:(e.presets??[]).map(t=>t.name)}}function ee(r,o){const e=r.package;if(!e.presets?.length)throw new Error(n("teamImport.libraryEmpty"));return{manifest:o,kind:"package",version:2,library:!0,name:e.name,description:e.summary,members:[],rooms:0,playbooks:e.playbooks?.length??0,routines:0,apps:[],skills:[],offeredSkills:(e.skills?.entries??[]).filter(m=>!e.presets.some(s=>s.skills?.includes(m.name))).map(m=>m.name),presets:e.presets.map(m=>m.name)}}function re(r,o){if(typeof r.version=="number"&&r.version>N)throw new Error(n("teamImport.newer"));if(r.version===N)return Z(j(o),o);if(r.version!==1)throw new Error(n("teamImport.playbookVersion",{version:String(r.version)}));if(!r.package||typeof r.package!="object"||Array.isArray(r.package))throw new Error(n("teamImport.playbookMissing"));const e=r.package;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.playbookNoName"));if(!Array.isArray(e.agents)||e.agents.length===0)throw new Error(n("teamImport.playbookNoBots"));if(e.agents.length>200)throw new Error(n("teamImport.playbookTooMany"));const m=e.agents.map((i,k)=>{if(!i||typeof i!="object"||Array.isArray(i))throw new Error(n("teamImport.botInvalid",{number:k+1}));const g=i;if(typeof g.name!="string"||!g.name.trim())throw new Error(n("teamImport.botNoName",{number:k+1}));return{name:g.name.trim(),title:typeof g.title=="string"?g.title.trim():""}}),s=typeof e.chiefOfStaff=="string"?e.chiefOfStaff:void 0,t=s?e.agents.find(i=>i.key===s)?.name:void 0,c=e.requirements&&typeof e.requirements=="object"&&!Array.isArray(e.requirements)?e.requirements:{},a=Array.isArray(c.apps)?c.apps.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const k=i;return typeof k.label=="string"?[{label:k.label.trim(),optional:k.optional===!0}]:[]}):[],f=e.skills&&typeof e.skills=="object"&&!Array.isArray(e.skills)?e.skills.entries:void 0;return{manifest:o,kind:"package",version:1,name:e.name.trim(),description:typeof e.summary=="string"?e.summary.trim():"",members:m,...typeof t=="string"?{chiefOfStaff:t}:{},rooms:Array.isArray(e.rooms)?e.rooms.length:0,playbooks:Array.isArray(e.playbooks)?e.playbooks.length:0,routines:Array.isArray(e.routines)?e.routines.length:0,apps:a,skills:Array.isArray(f)?f.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const{name:k}=i;return typeof k=="string"&&k.trim()?[k.trim()]:[]}):[]}}function ie(r){return r.installed&&r.installed.status!=="removed"?"added":r.release?r.blob==="unsupported"?"updateApp":r.blob!=="ready"?"notReady":"add":"noRelease"}function me(r){return r.publisher.self?n("orgLibrary.fromSelf"):n("orgLibrary.from",{name:r.publisher.name})}function pe(r){return r.mode==="required"?n("orgLibrary.recommended",{name:r.publisher.name}):null}function le(r){const o=[];return r.installed?.status==="withdrawn"&&o.push(n("orgLibrary.withdrawn",{name:r.publisher.name})),r.installed?.status==="installed"&&r.release&&r.release.version!==r.installed.release&&o.push(n("orgLibrary.newerRelease",{version:r.release.version})),o}function ce(r){const o=[];return r.bots&&o.push(n("orgLibrary.bots",{count:r.bots})),r.skills&&o.push(n("orgLibrary.skills",{count:r.skills})),r.presets&&o.push(n("orgLibrary.presets",{count:r.presets})),r.rooms&&o.push(n("orgLibrary.rooms",{count:r.rooms})),r.routines&&o.push(n("orgLibrary.routines",{count:r.routines})),r.connections&&o.push(n("orgLibrary.connections",{count:r.connections})),o.join(" · ")}function de(r,o=[]){if(r?.source!=="org")return null;const e=r.publisher?.name??"",m=o.find(s=>s.installId===r.installId);return{line:e?n("orgLibrary.provenance",{name:r.name,release:r.release,publisher:e}):n("orgLibrary.provenanceFile",{name:r.name,release:r.release}),withdrawn:m?.status==="withdrawn"?n("orgLibrary.withdrawn",{name:m.publisher||e}):null}}function ue(r){if(r.package.agents.length)return X(r);const o=r.package;return{manifest:r,kind:"package",version:2,name:o.name,teamName:o.name,description:o.summary,members:[],rooms:0,playbooks:o.playbooks?.length??0,routines:0,apps:o.requirements.apps.map(e=>({label:e.label,optional:e.optional===!0})),skills:[],offeredSkills:(o.skills?.entries??[]).map(e=>e.name),connections:[],notes:0,presets:(o.presets??[]).map(e=>e.name)}}export{se as M,pe as a,le as b,me as c,ce as d,ue as e,ie as o,de as p,X as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a$ as as,b8 as cn,gT as fn,B as un,b5 as hn,b7 as Ut,h5 as ls}from"./App-
|
|
1
|
+
import{a$ as as,b8 as cn,gT as fn,B as un,b5 as hn,b7 as Ut,h5 as ls}from"./App-D_fqRJhk.js";import{o as $,H as T,I as q,g as X,h as V,f as oe,s as F,K as cs,O as dn,aX as pn,aY as mn,J as gn,N as yn}from"./styles-DaC7RuGF.js";const Ot=Symbol.for("yaml.alias"),pt=Symbol.for("yaml.document"),se=Symbol.for("yaml.map"),fs=Symbol.for("yaml.pair"),Q=Symbol.for("yaml.scalar"),be=Symbol.for("yaml.seq"),G=Symbol.for("yaml.node.type"),we=s=>!!s&&typeof s=="object"&&s[G]===Ot,Qe=s=>!!s&&typeof s=="object"&&s[G]===pt,Ce=s=>!!s&&typeof s=="object"&&s[G]===se,M=s=>!!s&&typeof s=="object"&&s[G]===fs,_=s=>!!s&&typeof s=="object"&&s[G]===Q,Me=s=>!!s&&typeof s=="object"&&s[G]===be;function v(s){if(s&&typeof s=="object")switch(s[G]){case se:case be:return!0}return!1}function C(s){if(s&&typeof s=="object")switch(s[G]){case Ot:case se:case Q:case be:return!0}return!1}const us=s=>(_(s)||v(s))&&!!s.anchor,ne=Symbol("break visit"),bn=Symbol("skip children"),Ie=Symbol("remove node");function ke(s,e){const t=wn(e);Qe(s)?ue(null,s.contents,t,Object.freeze([s]))===Ie&&(s.contents=null):ue(null,s,t,Object.freeze([]))}ke.BREAK=ne;ke.SKIP=bn;ke.REMOVE=Ie;function ue(s,e,t,n){const i=kn(s,e,t,n);if(C(i)||M(i))return Sn(s,n,i),ue(s,i,t,n);if(typeof i!="symbol"){if(v(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ue(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===ne)return ne;o===Ie&&(e.items.splice(r,1),r-=1)}}}else if(M(e)){n=Object.freeze(n.concat(e));const r=ue("key",e.key,t,n);if(r===ne)return ne;r===Ie&&(e.key=null);const o=ue("value",e.value,t,n);if(o===ne)return ne;o===Ie&&(e.value=null)}}return i}function wn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function kn(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(Ce(e))return t.Map?.(s,e,n);if(Me(e))return t.Seq?.(s,e,n);if(M(e))return t.Pair?.(s,e,n);if(_(e))return t.Scalar?.(s,e,n);if(we(e))return t.Alias?.(s,e,n)}function Sn(s,e,t){const n=e[e.length-1];if(v(n))n.items[s]=t;else if(M(n))s==="key"?n.key=t:n.value=t;else if(Qe(n))n.contents=t;else{const i=we(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const An={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Nn=s=>s.replace(/[!,[\]{}]/g,e=>An[e]);class D{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},D.defaultYaml,e),this.tags=Object.assign({},D.defaultTags,t)}clone(){const e=new D(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new D(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:D.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},D.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:D.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},D.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Nn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&C(e.contents)){const r={};ke(e.contents,(o,a)=>{C(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
2
|
`)}}D.defaultYaml={explicit:!1,version:"1.2"};D.defaultTags={"!!":"tag:yaml.org,2002:"};function hs(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function ds(s){const e=new Set;return ke(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function ps(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function On(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=ds(s));const o=ps(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(_(o.node)||v(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}function he(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],a=he(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=he(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=he(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=he(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function J(s,e,t){if(Array.isArray(s))return s.map((n,i)=>J(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!us(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}class Et{constructor(e){Object.defineProperty(this,G,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!Qe(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=J(this,"",o);if(typeof i=="function")for(const{count:c,res:l}of o.anchors.values())i(l,c);return typeof r=="function"?he(r,{"":a},"",a):a}}class $t extends Et{constructor(e){super(Ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ke(e,{Node:(r,o)=>{(we(o)||us(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(J(o,null,t),a=n.get(o)),a?.res===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fe(i,o,n)),a.count*a.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(hs(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Fe(s,e,t){if(we(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(v(e)){let n=0;for(const i of e.items){const r=Fe(s,i,t);r>n&&(n=r)}return n}else if(M(e)){const n=Fe(s,e.key,t),i=Fe(s,e.value,t);return Math.max(n,i)}return 1}const ms=s=>!s||typeof s!="function"&&typeof s!="object";class O extends Et{constructor(e){super(Q),this.value=e}toJSON(e,t){return t?.keep?this.value:J(this.value,e,t)}toString(){return String(this.value)}}O.BLOCK_FOLDED="BLOCK_FOLDED";O.BLOCK_LITERAL="BLOCK_LITERAL";O.PLAIN="PLAIN";O.QUOTE_DOUBLE="QUOTE_DOUBLE";O.QUOTE_SINGLE="QUOTE_SINGLE";const En="tag:yaml.org,2002:";function $n(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function _e(s,e,t){if(Qe(s)&&(s=s.contents),C(s))return s;if(M(s)){const f=t.schema[se].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t;let c;if(n&&s&&typeof s=="object"){if(c=a.get(s),c)return c.anchor??(c.anchor=i(s)),new $t(c.anchor);c={anchor:null,node:null},a.set(s,c)}e?.startsWith("!!")&&(e=En+e.slice(2));let l=$n(s,e,o.tags);if(!l){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new O(s);return c&&(c.node=f),f}l=s instanceof Map?o[se]:Symbol.iterator in Object(s)?o[be]:o[se]}r&&(r(l),delete t.onTagObj);const d=l?.createNode?l.createNode(t.schema,s,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,s,t):new O(s);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}function Ye(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return _e(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const $e=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class gs extends Et{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||M(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if($e(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(v(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ye(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(v(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&_(r)?r.value:r:v(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;const n=t.value;return n==null||e&&_(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return v(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(v(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ye(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const Tn=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function z(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const ie=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?z(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,t as n,a as B,X as _,p as K,i as y}from"./styles-DaC7RuGF.js";import{b as Q,r as Z,i as ee}from"./remote-desktop-DDRRx8uY.js";import{u as te,L as C,P as se}from"./PlacesRail-3RYT-fm8.js";import{u as ne,B as re}from"./BrowserPanel-epB3EK-g.js";import{u as ae,k as ie,t as oe,G as le,m as ce,n as U,o as de,C as ue,j as b,A as pe,p as me,q as xe}from"./App-Ddh_DeKL.js";import{R as fe}from"./RoutinesPage-C3w9qdbF.js";import{M as F}from"./monitor-Ehduuiym.js";import{C as he}from"./calendar-days-BuEc0yb0.js";import"./BrowserProfilesManager-BCHI-qVi.js";import"./index-BIFgmFd6.js";import"./SignedInSites-BE6eaSJq.js";import"./minimize-6B5ELLt0.js";import"./file-up-CMuz1zvC.js";import"./MenuMotion-READmdk4.js";import"./ProIntroduction-CutUiKNu.js";function ge(t){if(typeof t!="string"||!t)throw new Error(n("remoteDesktop.noLink"));return t.startsWith("/vps-viewer/")?new URL(t,window.location.origin).toString():t}function be(t){if(t.schedule.type==="cron"||t.schedule.type==="limit_reset")return me(t.schedule);if(t.schedule.type==="once")return new Date(t.schedule.at).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(t.schedule.type==="interval"){const d=t.schedule.everyMinutes%60===0?n("routines.interval.hours",{hours:t.schedule.everyMinutes/60}):n("routines.interval.minutes",{minutes:t.schedule.everyMinutes});return n("remoteDesktop.startingAt",{cadence:d,date:new Date(t.schedule.anchorAt).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})}const r=t.schedule.weekdays,l=r.length===7?n("routines.repeat.daily"):r.join(",")==="1,2,3,4,5"?n("routines.repeat.weekdays"):r.map(xe).join(", "),[w,k]=t.schedule.time.split(":").map(Number);return`${l} · ${new Date(2e3,0,1,w,k).toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function ye(t){if(t==null)return n("routines.pausedSchedule");const r=new Date(t),l=new Date;return`${r.toDateString()===l.toDateString()?n("routines.today"):r.toLocaleDateString(y(),{month:"short",day:"numeric"})}, ${r.toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function Oe({bot:t}){const{state:r,dispatch:l}=ae(),{dragProps:w}=te(),k=ie(t.id),[d,I]=i.useState(!1),[v,j]=i.useState(null),[p,R]=i.useState(null),[M,D]=i.useState(!0),[H,m]=i.useState(!1),[P,E]=i.useState(!1),A=ne(),L=i.useRef(t.busy);i.useEffect(()=>{L.current=t.busy},[t.busy]);const[G,z]=i.useState(!1),[x,O]=i.useState(()=>oe(t.id)?"browser":"desktop"),[J,W]=i.useState(),u=r.computerControl[t.id]?.help??null,q=u?r.bots.find(s=>s.id===u.botId)?.name??t.name:t.name,c=r.signInFocus?.botId===t.id?r.signInFocus:void 0;i.useEffect(()=>{!c||c.consumed||(O(c.place==="browser"?"browser":"desktop"),c.place==="browser"&&W({url:c.url,site:c.site,nonce:c.requestId}),l({type:"signInFocusConsumed",requestId:c.requestId}))},[l,c]);const N=r.routines.filter(s=>s.botId===t.id).sort((s,a)=>Number(a.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(a.nextRunAt??1/0)),f=r.routineRuns.find(s=>s.botId===t.id&&["queued","running","waiting"].includes(s.status)),X=!!(r.config?.box.configured&&Q(r.instances,t.modelSelection.instanceId)?.snapshot.state==="available");i.useEffect(()=>{R(null),D(!0),m(!1)},[t.id]),i.useEffect(()=>{const s=window.ogb?.desktopViewer;if(!s)return;let a=!0;s.currentState().then(o=>{a&&E(o.open&&o.contextId===t.id)}).catch(()=>{});const h=s.onState(o=>{(o.contextId===t.id||!o.open)&&E(o.open&&o.contextId===t.id)});return()=>{a=!1,h()}},[t.id]),i.useEffect(()=>{if(x!=="desktop"||!A||P||d)return;const s=new AbortController;let a=!1,h=-1/0,o=null,S=null;const $=async()=>{if(!(a||s.signal.aborted)&&!(Date.now()-h<(o??(L.current?4e3:3e4)))){a=!0,o=null;try{const g=Z(await b(`/api/bots/${t.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([s.signal,AbortSignal.timeout(9e4)])}));!s.signal.aborted&&g?(R(g),m(!1),S=null):s.signal.aborted||m(!0)}catch(g){if(!s.signal.aborted)if(g instanceof pe&&ee(g)){o=1e3,S??=Date.now();const T=Date.now()-S>=1e4;m(T),D(!T)}else S=null,m(!0)}finally{!s.signal.aborted&&o===null&&D(!1),a=!1,h=Date.now()}}};$();const Y=window.setInterval($,1e3);return()=>{s.abort(),window.clearInterval(Y)}},[t.id,A,P,d,x]);const V=async()=>{I(!0),j(null);let s=!1;try{if(!window.ogb?.desktopViewer)throw new Error(n("remoteDesktop.viewerUnavailable"));await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),s=!0;const a=await b(`/api/bots/${t.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(ge(a.joinUrl),n("computer.viewerTitle",{name:t.name}),t.id))throw new Error(n("computer.err.openDesktop",{app:K()}))}catch(a){s&&await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await b(`/api/bots/${t.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),j(a instanceof Error?a.message:String(a))}finally{I(!1)}};return e.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",ref:k,"data-computer-panel":!0,children:[e.jsxs("div",{...w,className:"flex items-center justify-between border-b border-hairline px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.title",{name:t.name})}),e.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:n(t.cloudBackend==="vps"?"botAccess.cloud.selfHostedVps":"remoteDesktop.cloudDesktop")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex rounded-full bg-inset p-0.5","aria-label":n("computer.tabsAria"),children:["desktop","browser"].map(s=>e.jsxs("button",{type:"button",onClick:()=>O(s),"aria-pressed":x===s,className:B("flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px]",x===s?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:[s==="desktop"?e.jsx(F,{size:12}):e.jsx(le,{size:12}),n(s==="desktop"?"remoteDesktop.desktop":"place.browser")]},s))}),e.jsx("button",{type:"button","data-computer-panel-close":!0,onClick:()=>{ce(k.current,t.id),l({type:"toggleComputer",open:!1})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("remoteDesktop.close"),children:e.jsx(_,{size:18})})]})]}),x==="browser"?e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4 pt-1",children:[u?.place==="browser"&&e.jsx("div",{className:"-mt-2 mb-3",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsx(re,{bot:t,signIn:J}),v&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:v}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.browserHint")})]}):e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[u&&u.place!=="browser"&&e.jsx("div",{className:"-mt-3 w-full",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d||!p,className:"group relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-xl border border-hairline bg-black disabled:cursor-default","aria-label":p?n("computer.openLiveDesktopAria",{name:t.name}):n("remoteDesktop.previewUnavailableLabel"),children:[p?e.jsx("img",{src:p,alt:n("remoteDesktop.previewAlt",{name:t.name}),className:"h-full w-full object-contain"}):M?e.jsx(C,{size:22,className:"animate-spin text-ink-secondary"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[e.jsx(de,{size:24}),e.jsx("span",{className:"text-[11px]",children:n(H?"remoteDesktop.previewUnavailable":"remoteDesktop.previewWaiting")})]}),p&&e.jsx("span",{className:"absolute inset-x-0 bottom-0 bg-black/65 py-2 text-[11px] font-medium text-white opacity-0 transition-opacity group-hover:opacity-100",children:n("computer.openLiveDesktop")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.openLive")}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.relayHint")})]}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[d?e.jsx(C,{size:15,className:"animate-spin"}):e.jsx(F,{size:15}),n(d?"settings.updates.opening":"computer.takeControl")]}),v&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-left text-[12px] text-danger",children:v}),e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.accessHint")}),e.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(ue,{size:16,className:"text-accent"}),n("computer.routines.title")]}),N.length>0&&e.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:N.length})]}),f&&e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"mt-3 flex w-full items-center gap-2 rounded-lg border border-accent/25 bg-accent/10 px-3 py-2 text-left text-[12px] text-accent hover:bg-accent/15",children:[e.jsx(C,{size:13,className:f.status==="queued"?"":"animate-spin"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f.routineName," · ",n(f.status==="waiting"?"computer.routines.needsYou":f.status==="queued"?"computer.runStatus.queued":"computer.runStatus.running")]})]}),N.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:N.slice(0,3).map(s=>e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex w-full items-center gap-2 rounded-lg bg-inset px-3 py-2 text-left hover:bg-control/60",children:[e.jsx("span",{className:B("size-1.5 shrink-0 rounded-full",s.enabled?"bg-success":"bg-ink-secondary/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium text-ink",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-ink-secondary",children:[be(s),s.runOn==="cloud"?` · ${n("remoteDesktop.runsOnVm")}`:""]})]}),e.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:ye(s.nextRunAt)})]},s.id))}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(!0),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110",children:[e.jsx(se,{size:14}),n("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",title:n("computer.routines.openTitle"),children:[e.jsx(he,{size:14}),n("computer.routines.schedules")]})]})]})]}),G&&e.jsx(fe,{bots:[t],lockedBotId:t.id,defaultRunOn:X?"cloud":"maus",onClose:()=>z(!1)})]})}export{Oe as RemoteDesktopPanel};
|
|
1
|
+
import{r as i,j as e,t as n,a as B,X as _,p as K,i as y}from"./styles-DaC7RuGF.js";import{b as Q,r as Z,i as ee}from"./remote-desktop-DDRRx8uY.js";import{u as te,L as C,P as se}from"./PlacesRail-3RYT-fm8.js";import{u as ne,B as re}from"./BrowserPanel-abUgbX2z.js";import{u as ae,k as ie,t as oe,G as le,m as ce,n as U,o as de,C as ue,j as b,A as pe,p as me,q as xe}from"./App-D_fqRJhk.js";import{R as fe}from"./RoutinesPage-D9VQa8Id.js";import{M as F}from"./monitor-Ehduuiym.js";import{C as he}from"./calendar-days-BuEc0yb0.js";import"./BrowserProfilesManager-IuxTSnih.js";import"./index-CD6r_oet.js";import"./SignedInSites-B9tzCm-B.js";import"./minimize-6B5ELLt0.js";import"./file-up-CMuz1zvC.js";import"./MenuMotion-READmdk4.js";import"./ProIntroduction-BBpRtakG.js";function ge(t){if(typeof t!="string"||!t)throw new Error(n("remoteDesktop.noLink"));return t.startsWith("/vps-viewer/")?new URL(t,window.location.origin).toString():t}function be(t){if(t.schedule.type==="cron"||t.schedule.type==="limit_reset")return me(t.schedule);if(t.schedule.type==="once")return new Date(t.schedule.at).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(t.schedule.type==="interval"){const d=t.schedule.everyMinutes%60===0?n("routines.interval.hours",{hours:t.schedule.everyMinutes/60}):n("routines.interval.minutes",{minutes:t.schedule.everyMinutes});return n("remoteDesktop.startingAt",{cadence:d,date:new Date(t.schedule.anchorAt).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})}const r=t.schedule.weekdays,l=r.length===7?n("routines.repeat.daily"):r.join(",")==="1,2,3,4,5"?n("routines.repeat.weekdays"):r.map(xe).join(", "),[w,k]=t.schedule.time.split(":").map(Number);return`${l} · ${new Date(2e3,0,1,w,k).toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function ye(t){if(t==null)return n("routines.pausedSchedule");const r=new Date(t),l=new Date;return`${r.toDateString()===l.toDateString()?n("routines.today"):r.toLocaleDateString(y(),{month:"short",day:"numeric"})}, ${r.toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function Oe({bot:t}){const{state:r,dispatch:l}=ae(),{dragProps:w}=te(),k=ie(t.id),[d,I]=i.useState(!1),[v,j]=i.useState(null),[p,R]=i.useState(null),[M,D]=i.useState(!0),[H,m]=i.useState(!1),[P,E]=i.useState(!1),A=ne(),L=i.useRef(t.busy);i.useEffect(()=>{L.current=t.busy},[t.busy]);const[G,z]=i.useState(!1),[x,O]=i.useState(()=>oe(t.id)?"browser":"desktop"),[J,W]=i.useState(),u=r.computerControl[t.id]?.help??null,q=u?r.bots.find(s=>s.id===u.botId)?.name??t.name:t.name,c=r.signInFocus?.botId===t.id?r.signInFocus:void 0;i.useEffect(()=>{!c||c.consumed||(O(c.place==="browser"?"browser":"desktop"),c.place==="browser"&&W({url:c.url,site:c.site,nonce:c.requestId}),l({type:"signInFocusConsumed",requestId:c.requestId}))},[l,c]);const N=r.routines.filter(s=>s.botId===t.id).sort((s,a)=>Number(a.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(a.nextRunAt??1/0)),f=r.routineRuns.find(s=>s.botId===t.id&&["queued","running","waiting"].includes(s.status)),X=!!(r.config?.box.configured&&Q(r.instances,t.modelSelection.instanceId)?.snapshot.state==="available");i.useEffect(()=>{R(null),D(!0),m(!1)},[t.id]),i.useEffect(()=>{const s=window.ogb?.desktopViewer;if(!s)return;let a=!0;s.currentState().then(o=>{a&&E(o.open&&o.contextId===t.id)}).catch(()=>{});const h=s.onState(o=>{(o.contextId===t.id||!o.open)&&E(o.open&&o.contextId===t.id)});return()=>{a=!1,h()}},[t.id]),i.useEffect(()=>{if(x!=="desktop"||!A||P||d)return;const s=new AbortController;let a=!1,h=-1/0,o=null,S=null;const $=async()=>{if(!(a||s.signal.aborted)&&!(Date.now()-h<(o??(L.current?4e3:3e4)))){a=!0,o=null;try{const g=Z(await b(`/api/bots/${t.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([s.signal,AbortSignal.timeout(9e4)])}));!s.signal.aborted&&g?(R(g),m(!1),S=null):s.signal.aborted||m(!0)}catch(g){if(!s.signal.aborted)if(g instanceof pe&&ee(g)){o=1e3,S??=Date.now();const T=Date.now()-S>=1e4;m(T),D(!T)}else S=null,m(!0)}finally{!s.signal.aborted&&o===null&&D(!1),a=!1,h=Date.now()}}};$();const Y=window.setInterval($,1e3);return()=>{s.abort(),window.clearInterval(Y)}},[t.id,A,P,d,x]);const V=async()=>{I(!0),j(null);let s=!1;try{if(!window.ogb?.desktopViewer)throw new Error(n("remoteDesktop.viewerUnavailable"));await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),s=!0;const a=await b(`/api/bots/${t.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(ge(a.joinUrl),n("computer.viewerTitle",{name:t.name}),t.id))throw new Error(n("computer.err.openDesktop",{app:K()}))}catch(a){s&&await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await b(`/api/bots/${t.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),j(a instanceof Error?a.message:String(a))}finally{I(!1)}};return e.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",ref:k,"data-computer-panel":!0,children:[e.jsxs("div",{...w,className:"flex items-center justify-between border-b border-hairline px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.title",{name:t.name})}),e.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:n(t.cloudBackend==="vps"?"botAccess.cloud.selfHostedVps":"remoteDesktop.cloudDesktop")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex rounded-full bg-inset p-0.5","aria-label":n("computer.tabsAria"),children:["desktop","browser"].map(s=>e.jsxs("button",{type:"button",onClick:()=>O(s),"aria-pressed":x===s,className:B("flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px]",x===s?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:[s==="desktop"?e.jsx(F,{size:12}):e.jsx(le,{size:12}),n(s==="desktop"?"remoteDesktop.desktop":"place.browser")]},s))}),e.jsx("button",{type:"button","data-computer-panel-close":!0,onClick:()=>{ce(k.current,t.id),l({type:"toggleComputer",open:!1})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("remoteDesktop.close"),children:e.jsx(_,{size:18})})]})]}),x==="browser"?e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4 pt-1",children:[u?.place==="browser"&&e.jsx("div",{className:"-mt-2 mb-3",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsx(re,{bot:t,signIn:J}),v&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:v}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.browserHint")})]}):e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[u&&u.place!=="browser"&&e.jsx("div",{className:"-mt-3 w-full",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d||!p,className:"group relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-xl border border-hairline bg-black disabled:cursor-default","aria-label":p?n("computer.openLiveDesktopAria",{name:t.name}):n("remoteDesktop.previewUnavailableLabel"),children:[p?e.jsx("img",{src:p,alt:n("remoteDesktop.previewAlt",{name:t.name}),className:"h-full w-full object-contain"}):M?e.jsx(C,{size:22,className:"animate-spin text-ink-secondary"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[e.jsx(de,{size:24}),e.jsx("span",{className:"text-[11px]",children:n(H?"remoteDesktop.previewUnavailable":"remoteDesktop.previewWaiting")})]}),p&&e.jsx("span",{className:"absolute inset-x-0 bottom-0 bg-black/65 py-2 text-[11px] font-medium text-white opacity-0 transition-opacity group-hover:opacity-100",children:n("computer.openLiveDesktop")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.openLive")}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.relayHint")})]}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[d?e.jsx(C,{size:15,className:"animate-spin"}):e.jsx(F,{size:15}),n(d?"settings.updates.opening":"computer.takeControl")]}),v&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-left text-[12px] text-danger",children:v}),e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.accessHint")}),e.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(ue,{size:16,className:"text-accent"}),n("computer.routines.title")]}),N.length>0&&e.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:N.length})]}),f&&e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"mt-3 flex w-full items-center gap-2 rounded-lg border border-accent/25 bg-accent/10 px-3 py-2 text-left text-[12px] text-accent hover:bg-accent/15",children:[e.jsx(C,{size:13,className:f.status==="queued"?"":"animate-spin"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f.routineName," · ",n(f.status==="waiting"?"computer.routines.needsYou":f.status==="queued"?"computer.runStatus.queued":"computer.runStatus.running")]})]}),N.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:N.slice(0,3).map(s=>e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex w-full items-center gap-2 rounded-lg bg-inset px-3 py-2 text-left hover:bg-control/60",children:[e.jsx("span",{className:B("size-1.5 shrink-0 rounded-full",s.enabled?"bg-success":"bg-ink-secondary/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium text-ink",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-ink-secondary",children:[be(s),s.runOn==="cloud"?` · ${n("remoteDesktop.runsOnVm")}`:""]})]}),e.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:ye(s.nextRunAt)})]},s.id))}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(!0),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110",children:[e.jsx(se,{size:14}),n("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",title:n("computer.routines.openTitle"),children:[e.jsx(he,{size:14}),n("computer.routines.schedules")]})]})]})]}),G&&e.jsx(fe,{bots:[t],lockedBotId:t.id,defaultRunOn:X?"cloud":"maus",onClose:()=>z(!1)})]})}export{Oe as RemoteDesktopPanel};
|
package/dist/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
26
26
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
27
27
|
<title>Limix Bot</title>
|
|
28
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-CD6r_oet.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/styles-DaC7RuGF.js">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/assets/styles-D55d5vt1.css">
|
|
31
31
|
</head>
|
package/dist-server/index.js
CHANGED
|
@@ -18847,9 +18847,9 @@ chat.type==="private",raw=typeof message8.text=="string"?message8.text:typeof me
|
|
|
18847
18847
|
direct,from:{id:String(from.id),name:[from.first_name,from.last_name].filter(Boolean).join(" ")||from.username||String(from.id)},text:raw.replace(mention,"").trim(),...file2?{media:!0}:{},...typeof file2?.file_id=="string"?{loadMedia:async()=>{let signal=AbortSignal.any([io2.signal,AbortSignal.timeout(3e4)]),path8=(await api(token3,"getFile",{file_id:file2.file_id},signal))?.file_path;if(typeof path8!="string"||!path8.split("/").every(part2=>/^[\w.-]+$/.test(part2)&&part2!=="."&&part2!==".."))throw Error(
|
|
18848
18848
|
"Attachment unavailable");let response=await call2(`${base2}/file/bot${token3}/${path8}`,{signal,redirect:"error"});return storeChannelMedia(await readChannelDownload(response),file2.file_name??path8.split("/").at(-1))}}:{}}};return{done:(async()=>{let offset4=io2.offset;for(;!io2.signal.aborted;){let updates=await api(token3,"getUpdates",{offset:offset4,timeout:POLL_S,allowed_updates:["message"]},io2.signal).catch(error66=>{if(io2.signal.aborted)return[];throw error66});if(io2.healthy(),!(!Array.
|
|
18849
18849
|
isArray(updates)||!updates.length)){offset4=Math.max(...updates.map(update4=>Number(update4?.update_id)||0))+1;for(let update4 of updates){let message8=toMessage(update4?.message);message8&&io2.deliver(message8)}io2.saveOffset(offset4)}}})(),send:async(chatId,text33)=>{await api(token3,"sendMessage",{chat_id:Number(chatId),text:text33})},sendMedia:async(chatId,attachment)=>{let file2=await readChannelMedia(attachment),image4=attachment.kind==="image"&&attachment.mime!=="image/webp",form2=new FormData;
|
|
18850
|
-
form2.set("chat_id",chatId),form2.set(image4?"photo":"document",channelFileBlob(file2),file2.filename),await api(token3,image4?"sendPhoto":"sendDocument",form2,AbortSignal.timeout(6e4))},typing:async chatId=>{await api(token3,"sendChatAction",{chat_id:Number(chatId),action:"typing"})}}}}}init_provider_icon();import{Readable as Readable2}from"node:stream";var
|
|
18851
|
-
1,timeoutMs:3e4,maxRedirects:0});if(!page.ok||!page.body.length||page.body.length>limit2)throw Error("Zalo media unavailable");if(photo){let mime=["image/jpeg","image/png","image/webp"].find(type4=>imageDimensions(page.body,type4));if(!mime)throw Error("Unsupported image");let{path:path8}=saveImage(page.body,mime);return{kind:"image",path:path8,mime}}if(page.body.toString("ascii",4,8)!=="ftyp")throw Error("Unsupported video");let file2=await saveFile(Readable2.from([page.body]),
|
|
18852
|
-
|
|
18850
|
+
form2.set("chat_id",chatId),form2.set(image4?"photo":"document",channelFileBlob(file2),file2.filename),await api(token3,image4?"sendPhoto":"sendDocument",form2,AbortSignal.timeout(6e4))},typing:async chatId=>{await api(token3,"sendChatAction",{chat_id:Number(chatId),action:"typing"})}}}}}init_provider_icon();import{Readable as Readable2}from"node:stream";var ZALO_FILE_LIMIT=32*1024*1024,ZALO_CDN=["zaloapp.com","zalo.me","zdn.vn","zadn.vn","zalo.vn"];function receiveZaloFile(url3,name6){return fetchChannelMedia(url3,ZALO_CDN,name6,ZALO_FILE_LIMIT)}async function receiveZaloMedia(url3,photo){let limit2=photo?IMAGE_MAX_BYTES:ZALO_FILE_LIMIT,target4=new URL(url3);if(target4.protocol!=="https:"||!/(^|\.)(zaloapp\.com|zalo\.me|zdn\.vn|zadn\.vn|zalo\.vn)$/.test(target4.hostname))throw Error("Unsupported Zalo media address");let page=await fetchPublicPage(
|
|
18851
|
+
url3,{maxBytes:limit2+1,timeoutMs:3e4,maxRedirects:0});if(!page.ok||!page.body.length||page.body.length>limit2)throw Error("Zalo media unavailable");if(photo){let mime=["image/jpeg","image/png","image/webp"].find(type4=>imageDimensions(page.body,type4));if(!mime)throw Error("Unsupported image");let{path:path8}=saveImage(page.body,mime);return{kind:"image",path:path8,mime}}if(page.body.toString("ascii",4,8)!=="ftyp")throw Error("Unsupported video");let file2=await saveFile(Readable2.from([page.body]),
|
|
18852
|
+
"video.mp4","video/mp4",{expectedBytes:page.body.length});return{kind:"file",path:file2.path,name:file2.name,mime:file2.mime}}async function zaloUpload(file2){let{data:data4,filename}=await readChannelMedia(file2,file2.kind==="image"?IMAGE_MAX_BYTES:ZALO_FILE_LIMIT),dimensions=file2.kind==="image"?imageDimensions(data4,file2.mime):void 0;if(file2.kind==="image"&&!dimensions)throw Error("Unsupported image");return{data:data4,filename,metadata:{...dimensions,totalSize:data4.length}}}var USER=0,GROUP=1,loadZcaJs=async()=>{let{Zalo:Zalo2}=await Promise.resolve().then(()=>(init_dist(),dist_exports2));return new Zalo2({selfListen:!1,checkUpdate:!1,logging:!1})},thread=chatId=>({type:chatId.startsWith("g:")?GROUP:USER,id:chatId.slice(2)});function zaloAdapter(load9=loadZcaJs){async function signIn2(secret){let credentials;try{credentials=JSON.parse(secret)}catch{throw new ChannelError("auth","Phi\xEAn Zalo h\u1ECFng. Qu\xE9t m\xE3 QR l\u1EA1i.")}return(await load9()).login(credentials).
|
|
18853
18853
|
catch(error66=>{throw new ChannelError("auth",`Phi\xEAn Zalo \u0111\xE3 h\u1EBFt h\u1EA1n ho\u1EB7c b\u1ECB \u0111\u0103ng xu\u1EA5t. Qu\xE9t m\xE3 QR l\u1EA1i. (${error66 instanceof Error?error66.message:String(error66)})`)})}async function account2(api){let info2=await api.fetchAccountInfo().catch(()=>null),name6=info2?.profile?.displayName??info2?.profile?.zaloName??"";return{username:api.getOwnId(),name:name6}}return{kind:"zalo",label:"Zalo",textMax:2e3,quietToStrangers:!0,paceMs:[400,1200],
|
|
18854
18854
|
async check(secret){return account2(await signIn2(secret))},async open(secret,io2){let api=await signIn2(secret),self2=api.getOwnId();return{done:new Promise((resolve59,reject)=>{let stop2=()=>{try{api.listener.stop()}catch{}};io2.signal.addEventListener("abort",()=>{stop2(),resolve59()},{once:!0}),api.listener.on("connected",()=>io2.healthy()),api.listener.on("error",()=>{}),api.listener.on("closed",code=>{if(io2.signal.aborted)return resolve59();if(code===3e3||code===3003)return reject(new ChannelError(
|
|
18855
18855
|
"auth","T\xE0i kho\u1EA3n Zalo c\u1EE7a bot v\u1EEBa m\u1EDF \u1EDF n\u01A1i kh\xE1c (Zalo Web ho\u1EB7c m\xE1y kh\xE1c) n\xEAn bot \u0111\xE3 d\u1EEBng. \u0110\xF3ng n\u01A1i \u0111\xF3 r\u1ED3i t\u1EAFt v\xE0 b\u1EADt l\u1EA1i Zalo \u1EDF \u0111\xE2y."));reject(new ChannelError("retry",`Zalo ng\u1EAFt k\u1EBFt n\u1ED1i (${code}).`))}),api.listener.on("message",event2=>{if(event2.isSelf||String(event2.data.uidFrom)===self2||event2.type!==USER&&event2.type!==GROUP)return;let direct=event2.type===
|
|
@@ -24368,17 +24368,18 @@ late name it comes from (or that it is custom), why it fits, what it is responsi
|
|
|
24368
24368
|
e fix, and use propose_team_setup for any bot change; never ask them to send you a token or password.",sectionKey3=section4=>section4?.trim()||"",EVERYONE_ON_THE_MAP="When the person writes to @everyone on the Team map, it comes to you alone, so you decide who it concerns: hand it with coordinate_bots to the teammates whose work it touches, never to all of them by default, and do the part that is yours. If it concerns nobody else, answer it yourself.";function chiefOfStaffSystemPrompt(chiefId,bots,canDelegate,also){
|
|
24369
24369
|
let chief=bots.find(bot=>bot.id===chiefId),chiefSection=sectionKey3(chief?.section),sectionName=peerName(chiefSection)||"General",owner2=chief?botOwner(chief):null,person2=owner2?peerName(nameFromEmail(owner2))||"your person":null,reachable=reachablePeers(bots,chief??{id:chiefId,name:""},also),team=chief?reachable.filter(bot=>hasAuthority(chief,bot)):reachable,others=chief?reachable.filter(bot=>!hasAuthority(chief,bot)):[],roster=renderRoster(team,{max:ROSTER_MAX_BOTS,empty:"- No other visible b\
|
|
24370
24370
|
ots are available yet.",about:!0,department:chiefSection}),othersRoster=others.length?renderRoster(others,{max:Math.max(ROSTER_MAX_BOTS-team.length,OTHERS_MIN_BOTS),empty:"",about:!1,department:chiefSection}):"",delegation=canDelegate?"Use list_bots or list_room_targets for the live reachable roster. Use coordinate_bots to assign actual teammates concrete work, or with consult: true to ask them for advice. It returns immediately and keeps you available to the user; give clear, self-contained bri\
|
|
24371
|
-
efs, then end your turn \u2014 you resume automatically when their results return, success or failure. Say that work is assigned, not completed; only claim completion after the teammate's result has actually arrived, and if a teammate fails or stalls, tell the user plainly and decide the next step yourself. Leads can coordinate their own specialists.
|
|
24372
|
-
|
|
24373
|
-
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
|
|
24377
|
-
|
|
24378
|
-
|
|
24379
|
-
|
|
24380
|
-
you
|
|
24381
|
-
|
|
24371
|
+
efs, then end your turn \u2014 you resume automatically when their results return, success or failure. Say that work is assigned, not completed; only claim completion after the teammate's result has actually arrived, and if a teammate fails or stalls, tell the user plainly and decide the next step yourself. Leads can coordinate their own specialists. For a multi-part deliverable, give each work item one accountable owner. Send independent items in parallel with separate calls. Sequence dependent work\
|
|
24372
|
+
after its prerequisite result. In each brief include the relevant inputs, the output to return and a verifiable done_when. Assign overlapping edits sequentially. If independent review is needed, give a different teammate the actual artifact and acceptance criteria. Reconcile their findings and surface any unresolved blocker before handoff. Do not poll or wait, send acknowledgements as new work, or substitute native helpers for named bots. On return, verify the requested outcome, resolve decisio\
|
|
24373
|
+
ns within the user's scope, request concrete corrections with rework=true when necessary, and return one consolidated answer. Consultations are advice, not proof that work or tests ran. A refusal from coordinate_bots means nothing was sent: fix what it names (usually the id \u2014 copy it from list_bots or your roster; a unique teammate name also works) and retry, and never describe a handoff the tool did not accept.":"Your current engine cannot contact teammates. Be honest about that limitation\
|
|
24374
|
+
and ask the user to choose a delegation-compatible engine before promising coordinated work.",isChief=!chief?.defaultBot||chief.chiefOfStaff===!0;return[isChief?person2?`You are ${person2}'s assistant and Chief of Staff: their one point of contact. The bots that report to ${person2}, in every department, are your team: you direct their work, and their incidents come to you.`:`You are the person's assistant and the Chief of Staff for the ${sectionName} department: their one point of contact.`:chief?.
|
|
24375
|
+
defaultBot?.person?`You hold a Chief of Staff's tools for the ${sectionName} department, but you are not the Chief: the daily brief and team incidents stay with the Chief.`:`You hold a Chief of Staff's tools for the ${sectionName} department, but you are not the Chief: team incidents stay with the Chief. Keeping an eye on the person's day and their daily brief are yours.`,chief?.managedSections?.length?`The owner also made you responsible for these departments: ${chief.managedSections.map(s4=>peerName(
|
|
24376
|
+
s4)||"General").join(", ")}. You supervise their bots and may propose setup changes there. You remain the user's single point of contact. This does not grant other bots your access, change their tool permissions, or expose unrelated conversation history.`:"",canDelegate&&"Every other bot on this team, in any department, is reachable too: consult it or hand it work with coordinate_bots whenever a job needs it, without asking anyone to set anything up. Reaching a bot gives you no authority over it\
|
|
24377
|
+
: its setup, its threads and its incidents stay with its own Chief, so ask rather than direct.","Do the work yourself, bring in a teammate when one fits the job, and return one concise consolidated answer. Never invent a teammate's progress or result. Normal permission and approval rules still apply.",canDelegate&&"A standing preference the person states for all their bots (where reminders go, how replies should sound) is one line you save yourself with memory_update action prefer: every bot rea\
|
|
24378
|
+
ds it. Never send it to each bot with coordinate_bots.",canDelegate?SPECIALISTS:"",canDelegate&&isChief?EVERYONE_ON_THE_MAP:"",canDelegate&&isChief?`Incidents: when a teammate's run fails, stalls or cannot start, Limix Bot reports it to you in your "Problems to look at" thread with a link to the thread. Read the report, then either call retry_thread to resume that thread where it stopped, coordinate_bots with a corrected brief when the request itself must change, or \u2014 when only the person can fi\
|
|
24379
|
+
x the cause (a sign-in, a missing credential, an unanswered question, a setting) \u2014 say so plainly and stop. Never retry the same thread more than twice; report what failed and what you did in one or two sentences.`:"",delegation,canDelegate?'Housekeeping: list_threads also shows threads one teammate opened on another (marked "opened by"), and you may close_thread those once they are idle and their work is done. Threads the person started are theirs: never close them.':"",canDelegate?"When t\
|
|
24380
|
+
he user asks you to assemble or configure a team, use list_team_setup for the exact authorized teams, bot IDs and model catalog, then propose_team_setup once with all named specialists and their profile/model changes. Include new teams explicitly; the plan covers their creation and your access. Existing thread models and other bots' execution permissions stay unchanged. Every plan waits for the person's decision on a card: end your turn after proposing; the decision automatically resumes you onc\
|
|
24381
|
+
e with a structured result, including the group chat if they chose one. Report failed or cancelled results honestly. Do not ask for another yes, poll, or repeat the proposal. After successful setup, use the available coordination tools for already requested work. For explicitly requested bot deletion, use propose_bot_deletion separately and follow its applied or pending result too.":"",person2?`Bots that report to ${person2} (your team):`:chief?.managedSections?.length?"Your team, in the departm\
|
|
24382
|
+
ents you are responsible for:":`Current ${sectionName} department (your team):`,roster,othersRoster&&(person2?"Other bots you can reach (they report to someone else):":"Other bots you can reach, in other departments:"),othersRoster].filter(Boolean).join(`
|
|
24382
24383
|
`)}var tooLongRefusal=(field5,max4,how)=>`${field5} is over its ${String(max4)}-character limit, so nothing was done. ${how}`,COORDINATE_FIELDS={message:"Send only what the teammate needs to start, and save the long detail to a file in this folder and name its path, then call coordinate_bots again.",done_when:"Say in a sentence or two what finished looks like, then call coordinate_bots again.",title:"Use a shorter title, then call coordinate_bots again.",reason:"Say why in one short line, then call\
|
|
24383
24384
|
coordinate_bots again."};function coordinateTooLong(issues){let refusals=issues.map(issue3=>{let field5=String(issue3.path[0]),how=COORDINATE_FIELDS[field5];return issue3.code==="too_big"&&how&&issue3.maximum!==void 0?tooLongRefusal(field5,issue3.maximum,how):void 0});return refusals.length&&refusals.every(Boolean)?refusals.join(" "):void 0}init_bot_owner();var ledBy=(room,botId2)=>{let lead=room.defaultResponder;return lead.kind==="member"?lead.botId===botId2:lead.kind==="auto"&&lead.fallbackBotId===botId2};function chiefAbsentFrom(room,bots){if(room.dm)return;let scope=chiefScope({section:room.section}),chief=bots.find(bot=>bot.chiefOfStaff&&!bot.hidden&&chiefScope(bot)===scope);return chief&&!room.memberIds.includes(chief.id)?{botId:chief.id,name:chief.name}:void 0}function createChiefRooms(deps){let{store:store5}=deps;function retarget(room,from,to2){
|
|
24384
24385
|
let lead=room.defaultResponder.kind==="auto"?{kind:"auto",fallbackBotId:to2.id}:{kind:"member",botId:to2.id};try{let updated=deps.updateRoom(room.id,{memberIds:[...new Set([...room.memberIds,to2.id])],defaultResponder:lead});return store5.appendMessage(room.threadId,{role:"bot",kind:"activity",tool:{name:`notice: ${serverLine(conversationLanguage(room.threadId),"server.rooms.chiefRetargeted",{chief:to2.name,former:from.name})}`,ok:!0}}),updated}catch(error66){return console.warn(`chief rooms: ${room.
|
|
@@ -31935,28 +31936,29 @@ out={}
|
|
|
31935
31936
|
for n in sys.argv[1:]:
|
|
31936
31937
|
try: out[n]=m.version(n)
|
|
31937
31938
|
except m.PackageNotFoundError: pass
|
|
31938
|
-
print(json.dumps(out))`,{stdout}=await run10(python,["-c",code,...names5],{timeout:1e4,windowsHide:!0,maxBuffer:1024*1024}),versions=JSON.parse(stdout);for(let row of pythonRows)row.version=versions[row.name],row.where=python,row.status=row.version?row.required?"review":"found":"missing"}catch{warnings.push("Could not inspect Python package metadata")}return{scope:"host",scannedAt:new Date().toISOString(),skillCount:sources2.size,requirements,warnings}}async function fetchHubFile(root3,area5,id12,path8,fetcher){let first2=area5==="quarantine"?"quarantine":"skills",response=await fetcher(`${root3}/${first2}/${id12}/${path8}`);return response.status!==404?response:fetcher(`${root3}/${first2==="skills"?"quarantine":"skills"}/${id12}/${path8}`)}import{createHash as createHash120}from"node:crypto";import{existsSync as existsSync102,mkdirSync as mkdirSync124,readFileSync as readFileSync190}from"node:fs";import{join as join266}from"node:path";init_atomic();init_config3();var HUB_REPO="leomieo/limix-skill-hub",HUB_BRANCH="main",SYNC_MIN_GAP_MS=1200*60*1e3,
|
|
31939
|
-
...readJson7(settingsFile(),{})}}function saveSettings(next){mkdirSync124(hubDir(),{recursive:!0,mode:448}),writeFileAtomic(settingsFile(),JSON.stringify(next,null,2),{mode:384})}function hubCatalog(){let body3=readJson7(catalogFile(),{});return Array.isArray(body3.skills)?body3.skills:[]}var rawUrl=path8=>`https://raw.githubusercontent.com/${HUB_REPO}/${HUB_BRANCH}/${path8}`;async function fetchText2(url3,headers={}){return fetch(url3,{signal:AbortSignal.timeout(3e4),headers:{
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
{
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31939
|
+
print(json.dumps(out))`,{stdout}=await run10(python,["-c",code,...names5],{timeout:1e4,windowsHide:!0,maxBuffer:1024*1024}),versions=JSON.parse(stdout);for(let row of pythonRows)row.version=versions[row.name],row.where=python,row.status=row.version?row.required?"review":"found":"missing"}catch{warnings.push("Could not inspect Python package metadata")}return{scope:"host",scannedAt:new Date().toISOString(),skillCount:sources2.size,requirements,warnings}}async function fetchHubFile(root3,area5,id12,path8,fetcher){let first2=area5==="quarantine"?"quarantine":"skills",response=await fetcher(`${root3}/${first2}/${id12}/${path8}`);return response.status!==404?response:fetcher(`${root3}/${first2==="skills"?"quarantine":"skills"}/${id12}/${path8}`)}import{createHash as createHash120}from"node:crypto";import{existsSync as existsSync102,mkdirSync as mkdirSync124,readFileSync as readFileSync190}from"node:fs";import{join as join266}from"node:path";init_atomic();init_config3();var HUB_REPO="leomieo/limix-skill-hub",FILE_MAX_BYTES3=SKILL_FOLDER_LIMITS.fileBytes,HUB_BRANCH="main",SYNC_MIN_GAP_MS=1200*60*1e3,DEFAULT_SETTINGS={autoSync:!0,autoInstall:!1,lastSync:null,lastError:null,etag:null},hubDir=()=>join266(DATA_DIR,"skill-hub"),settingsFile=()=>join266(hubDir(),"settings.json"),catalogFile=()=>join266(hubDir(),"catalog.json");function readJson7(file2,fallback2){try{return JSON.parse(readFileSync190(file2,"utf8"))}catch{return fallback2}}function hubSettings(){return{
|
|
31940
|
+
...DEFAULT_SETTINGS,...readJson7(settingsFile(),{})}}function saveSettings(next){mkdirSync124(hubDir(),{recursive:!0,mode:448}),writeFileAtomic(settingsFile(),JSON.stringify(next,null,2),{mode:384})}function hubCatalog(){let body3=readJson7(catalogFile(),{});return Array.isArray(body3.skills)?body3.skills:[]}var rawUrl=path8=>`https://raw.githubusercontent.com/${HUB_REPO}/${HUB_BRANCH}/${path8}`;async function fetchText2(url3,headers={}){return fetch(url3,{signal:AbortSignal.timeout(3e4),headers:{
|
|
31941
|
+
"User-Agent":"limix-bot",...headers}})}async function withCatalogDates(entries4){let cached6=new Map(hubCatalog().map(skill=>[skill.id,skill.added_at])),dated=entries4.map(skill=>({...skill,added_at:skill.added_at||cached6.get(skill.id)||null}));if(dated.every(skill=>skill.added_at))return dated;try{let response=await fetchText2(rawUrl("registry/versions.json"));if(!response.ok)return dated;let history=await response.json();for(let skill of dated){if(skill.added_at||!Array.isArray(history[skill.
|
|
31942
|
+
id]))continue;let dates=history[skill.id].flatMap(({at:at8})=>at8&&Number.isFinite(Date.parse(at8))?[Date.parse(at8)]:[]);dates.length&&(skill.added_at=new Date(Math.min(...dates)).toISOString())}}catch{}return dated}var syncing=null;function syncHub(){return syncing||(syncing=(async()=>{let settings=hubSettings();try{let response=await fetchText2(rawUrl("registry/catalog.json"),settings.etag&&existsSync102(catalogFile())&&hubCatalog().every(skill=>skill.added_at)?{"If-None-Match":settings.etag}:
|
|
31943
|
+
{});if(response.status===304)return saveSettings({...settings,lastSync:new Date().toISOString(),lastError:null}),{changed:!1,count:hubCatalog().length};if(!response.ok)throw new Error(lxs(`Hub tr\u1EA3 v\u1EC1 ${response.status}`,`The hub returned ${response.status}`));let text33=await response.text(),parsed3=JSON.parse(text33);if(!Array.isArray(parsed3.skills))throw new Error(lxs("Danh m\u1EE5c Hub kh\xF4ng \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng","The hub catalog has the wrong format"));return mkdirSync124(
|
|
31944
|
+
hubDir(),{recursive:!0,mode:448}),writeFileAtomic(catalogFile(),JSON.stringify({...parsed3,skills:await withCatalogDates(parsed3.skills)}),{mode:384}),saveSettings({...settings,etag:response.headers.get("etag"),lastSync:new Date().toISOString(),lastError:null}),settings.autoInstall&&await autoInstallEligible(),{changed:!0,count:parsed3.skills.length}}catch(cause){let message8=cause instanceof Error?cause.message:String(cause);return saveSettings({...settings,lastError:message8}),{error:message8}}finally{
|
|
31945
|
+
syncing=null}})(),syncing)}var SCRIPT4=/\.(py|js|mjs|cjs|ts|sh|bash|zsh|ps1|bat|cmd|rb|pl|php|go|rs|exe|dll|so|dylib|bin|jar|class|scr|msi|com|apk|dex|node|wasm)$/i,MCP_FILE=/(^|\/)(\.mcp\.json|mcp\.json|mcp-servers?\.json|claude_desktop_config\.json)$/i,isToolFile=path8=>SCRIPT4.test(path8)||MCP_FILE.test(path8),sha=data4=>createHash120("sha256").update(data4).digest("hex");function hubSkillBlocked(entry2){return entry2.area==="quarantine"||entry2.security_status==="quarantined"?lxs("B\u1ED9 qu\xE9t \u0111\xE1\
|
|
31946
|
+
nh d\u1EA5u r\u1EE7i ro v\xE0 c\xE1ch ly skill; c\u1EA7n xem c\xE1c ph\xE1t hi\u1EC7n tr\u01B0\u1EDBc khi d\xF9ng.","The scanner flagged risks and quarantined this skill; review the findings before use."):entry2.approval_status==="quarantined"||entry2.approval_status==="rejected"?lxs("Skill b\u1ECB t\u1EEB ch\u1ED1i.","This skill was rejected."):null}function installedFromHub(){let out=new Map;for(let entry2 of Object.values(readSkillLibraryIndex())){let match5=/^limix-hub:([a-z0-9-]+)@([0-9a-f]{64})/.
|
|
31947
|
+
exec(entry2.source);match5&&out.set(match5[1],{checksum:match5[2],sha256:entry2.sha256,reviewState:entry2.reviewState})}return out}function hubSkills(){let installed2=installedFromHub(),library=readSkillLibraryIndex();return hubCatalog().map(entry2=>{let have=installed2.get(entry2.id);return{...entry2,installed:!!have,enabled:have?.reviewState==="approved",updateAvailable:!!(have&&have.checksum!==entry2.checksum),blocked:!have&&library[entry2.id]?lxs("Th\u01B0 vi\u1EC7n \u0111\xE3 c\xF3 k\u1EF9 n\u0103ng c\xF9ng t\xEAn kh\xF4ng \u0111\u1EBFn t\u1EEB\
|
|
31948
|
+
Hub.","The library already has a skill with this name that did not come from the hub."):null,risky:hubSkillBlocked(entry2)}})}async function installHubSkill(id12,options2={}){if(!isSkillName(id12))return{error:lxs("T\xEAn k\u1EF9 n\u0103ng kh\xF4ng h\u1EE3p l\u1EC7","Invalid skill name")};let entry2=hubCatalog().find(e=>e.id===id12);if(!entry2)return{error:lxs("Kh\xF4ng th\u1EA5y k\u1EF9 n\u0103ng n\xE0y trong danh m\u1EE5c Hub. H\xE3y \u0111\u1ED3ng b\u1ED9 l\u1EA1i.","This skill is not in the\
|
|
31949
|
+
hub catalog. Sync again.")};let blocked=hubSkillBlocked(entry2);if(blocked&&!options2.allowRisky)return{error:blocked};let installed2=installedFromHub().get(id12);if(readSkillLibraryIndex()[id12]&&!installed2)return{error:lxs("Th\u01B0 vi\u1EC7n \u0111\xE3 c\xF3 k\u1EF9 n\u0103ng c\xF9ng t\xEAn kh\xF4ng \u0111\u1EBFn t\u1EEB Hub.","The library already has a skill with this name that did not come from the hub.")};let wanted=Object.keys(entry2.file_hashes).filter(path8=>path8!=="SKILL.md"&&(options2.
|
|
31950
|
+
allowTools||!isToolFile(path8))),skipped2=Object.keys(entry2.file_hashes).filter(path8=>path8!=="SKILL.md"&&!wanted.includes(path8)),files2=[],skillMd="";for(let path8 of["SKILL.md",...wanted]){let expected=entry2.file_hashes[path8];if(!expected)return{error:lxs(`Danh m\u1EE5c thi\u1EBFu m\xE3 ki\u1EC3m tra cho ${path8}`,`The catalog has no checksum for ${path8}`)};let response;try{response=await fetchHubFile(rawUrl("").replace(/\/$/,""),entry2.area,id12,path8,fetchText2)}catch(cause){return{error:lxs(
|
|
31951
|
+
`Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c ${path8}: `,`Couldn't download ${path8}: `)+(cause instanceof Error?cause.message:String(cause))}}if(!response.ok)return{error:lxs(`Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c ${path8} (${response.status})`,`Couldn't download ${path8} (${response.status})`),...response.status===404?{missingFile:path8}:{}};let bytes4=new Uint8Array(await response.arrayBuffer());if(bytes4.byteLength>FILE_MAX_BYTES3)return{error:lxs(`${path8} qu\xE1 l\u1EDBn`,`${path8} is too large`)};
|
|
31952
|
+
if(sha(bytes4)!==expected)return{error:lxs(`${path8} kh\xF4ng kh\u1EDBp m\xE3 SHA-256 trong danh m\u1EE5c \u2014 \u0111\xE3 d\u1EEBng c\xE0i`,`${path8} does not match the SHA-256 in the catalog \u2014 install stopped`)};path8==="SKILL.md"?skillMd=new TextDecoder().decode(bytes4):files2.push({path:path8,content:bytes4})}if(installed2){let retired=retireLibrarySkill(id12,installed2.sha256);if("error"in retired)return{error:retired.error};if("stale"in retired)return{error:lxs("K\u1EF9 n\u0103ng \u0111\xE3 b\u1ECB s\u1EEDa tay\
|
|
31953
|
+
sau khi c\xE0i, kh\xF4ng c\u1EADp nh\u1EADt \u0111\xE8.","This skill was edited by hand after installing, so it is not overwritten.")}}let result2=installLibrarySkill({name:id12,instructions:skillMd,source:`limix-hub:${id12}@${entry2.checksum} (${entry2.source.repository??"?"}@${(entry2.source.commit??"").slice(0,7)})`,...entry2.license?{license:entry2.license}:{},...entry2.compatibility.text?{compatibility:entry2.compatibility.text}:{},...entry2.tags.length?{tags:entry2.tags}:{},warnings:entry2.
|
|
31954
|
+
notes,skippedFiles:skipped2,reviewState:blocked?"disabled":"approved",...files2.length?{files:files2}:{}});return"error"in result2?{error:result2.error}:{ok:!0,skipped:skipped2}}function setHubSkillEnabled(id12,enabled){if(!installedFromHub().has(id12))return{error:lxs("K\u1EF9 n\u0103ng n\xE0y ch\u01B0a c\xE0i t\u1EEB Hub","This skill was not installed from the hub")};let result2=setLibrarySkillReviewState(id12,enabled?"approved":"disabled");return"error"in result2?{error:result2.error}:{ok:!0}}
|
|
31955
|
+
function removeHubSkill(id12){let installed2=installedFromHub().get(id12);if(!installed2)return{error:lxs("K\u1EF9 n\u0103ng n\xE0y ch\u01B0a c\xE0i t\u1EEB Hub","This skill was not installed from the hub")};let result2=retireLibrarySkill(id12,installed2.sha256);return"error"in result2?{error:result2.error}:"stale"in result2?{error:lxs("K\u1EF9 n\u0103ng \u0111\xE3 b\u1ECB s\u1EEDa tay sau khi c\xE0i, kh\xF4ng g\u1EE1 t\u1EF1 \u0111\u1ED9ng.","This skill was edited by hand after installing, so i\
|
|
31956
|
+
t is not removed automatically.")}:{ok:!0}}async function autoInstallEligible(){let budget=5;for(let skill of hubSkills()){if(budget<=0)return;if(!(!skill.blocked&&!skill.risky&&skill.kind==="instructions-only"&&skill.approval_status==="approved"&&(skill.grade==="excellent"||skill.grade==="recommended"))||skill.installed&&!skill.updateAvailable)continue;budget-=1,"ok"in await installHubSkill(skill.id)&&skill.updateAvailable&&skill.enabled&&setHubSkillEnabled(skill.id,!0)}}async function handleLimixHub(method2,path8,body3){
|
|
31957
|
+
let record31=body3&&typeof body3=="object"?body3:{};if(method2==="GET"&&path8==="/api/limix/hub")return{status:200,body:{repo:HUB_REPO,settings:hubSettings(),skills:hubSkills()}};if(method2==="POST"&&path8==="/api/limix/hub/sync"){let result2=await syncHub();return"error"in result2?{status:502,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/settings"){let current3=hubSettings();return saveSettings({...current3,autoSync:typeof record31.autoSync=="boolean"?record31.
|
|
31958
|
+
autoSync:current3.autoSync,autoInstall:typeof record31.autoInstall=="boolean"?record31.autoInstall:current3.autoInstall}),{status:200,body:{settings:hubSettings()}}}let id12=typeof record31.id=="string"?record31.id:"";if(method2==="POST"&&(path8==="/api/limix/hub/install"||path8==="/api/limix/hub/update")){let expected=hubCatalog().find(entry2=>entry2.id===id12)?.checksum,result2=await installHubSkill(id12,{allowTools:record31.allowTools===!0,allowRisky:record31.allowRisky===!0});return"error"in
|
|
31959
|
+
result2&&result2.missingFile?!("error"in await syncHub())&&hubCatalog().find(entry2=>entry2.id===id12)?.checksum!==expected?{status:409,body:{error:lxs("Kho k\u1EF9 n\u0103ng v\u1EEBa c\u1EADp nh\u1EADt. H\xE3y xem l\u1EA1i m\u1EE5c n\xE0y tr\u01B0\u1EDBc khi c\xE0i.","The skill catalog has changed. Review this skill before installing.")}}:{status:422,body:{error:lxs(`G\xF3i k\u1EF9 n\u0103ng \u0111ang thi\u1EBFu t\u1EC7p ${result2.missingFile}. Ch\u01B0a c\xE0i \u0111\u1EB7t k\u1EF9 n\u0103ng.`,
|
|
31960
|
+
`The skill package is missing ${result2.missingFile}. The skill was not installed.`)}}:"error"in result2?{status:422,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/enable"){let result2=setHubSkillEnabled(id12,record31.enabled===!0);return"error"in result2?{status:422,body:result2}:{status:200,body:result2}}if(method2==="POST"&&path8==="/api/limix/hub/remove"){let result2=removeHubSkill(id12);return"error"in result2?{status:422,body:result2}:{status:200,body:result2}}
|
|
31961
|
+
return null}var started2=!1;function startHubAutoSync(){if(started2)return;started2=!0;let tick2=()=>{let settings=hubSettings();settings.autoSync&&(settings.lastSync&&Date.now()-Date.parse(settings.lastSync)<SYNC_MIN_GAP_MS||syncHub())};setTimeout(tick2,6e4).unref(),setInterval(tick2,1800*1e3).unref()}function createBotSkillsRoutes(deps){let{store:store5,cfg:cfg2,listBotSkills:listBotSkills2,readBotSkillFile:readBotSkillFile2,stagedSkillListing:stagedSkillListing2}=deps;return async({req,res,url:url3,path:path8,method:method2,json:json7,readBody:readBody2})=>{let m3=null;if(method2==="GET"&&path8==="/api/limix/skill-requirements")return json7(res,200,await scanSkillRequirements(store5.bots,cfg2.mcpServers));if(method2==="POST"&&path8==="/api/limix/skill-requirements/scan"){let input2=external_exports.
|
|
31960
31962
|
object({projects:external_exports.array(external_exports.string().max(4096).refine(isAbsolute44)).max(200)}).safeParse(await readBody2(req));return input2.success?json7(res,200,await scanSkillRequirements(store5.bots,cfg2.mcpServers,input2.data.projects)):json7(res,400,{error:"Choose valid project folders"})}if(path8.startsWith("/api/limix/bots")){let library=await handleLimixBotLibrary(method2,path8);if(library)return json7(res,library.status,library.body)}if(path8.startsWith("/api/limix/hub")){
|
|
31961
31963
|
let hub=await handleLimixHub(method2,path8,method2==="POST"?await readBody2(req):void 0);if(hub)return json7(res,hub.status,hub.body)}if(path8.startsWith("/api/limix/skill-store/")){let skillStore=handleLimixSkillStore(store5,method2,path8,method2==="POST"?await readBody2(req):void 0);if(skillStore)return json7(res,skillStore.status,skillStore.body)}if(method2==="GET"&&path8==="/api/limix/bundled-skills"){let skills=loadBundledSkills().map(({manifest})=>({id:manifest.id,name:manifest.name,description:limixSkillText(
|
|
31962
31964
|
manifest.id,manifest.description),defaultEnabled:manifest.defaultEnabled,triggerTerms:manifest.triggerTerms,core:LIMIX_CORE_SKILLS.has(manifest.id)}));return json7(res,200,{skills})}if(m3=path8.match(/^\/api\/bots\/([\w-]+)\/skill-template$/),m3&&method2==="POST"){if(!store5.bot(m3[1]))return json7(res,404,{error:"no such bot"});let checked=botSkillTemplateSchema.safeParse(await readBody2(req));if(!checked.success)return json7(res,400,{error:checked.error.message});let input2=checked.data,parsed3=parseSkillMd(
|
package/dist-server/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"0.3.
|
|
1
|
+
{"type":"module","version":"0.3.116"}
|