clawdi 0.13.62 → 0.13.63
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -824,7 +824,7 @@ await sdk.mutateConfigFile({
|
|
|
824
824
|
writeOptions: { allowConfigSizeDrop: true, explicitSetPaths, unsetPaths },
|
|
825
825
|
mutate: (draft) => applyMergePatch(draft, patch),
|
|
826
826
|
});
|
|
827
|
-
`,E8,N1$="clawdi.hostedManagedMcpServers.v1",vw="clawdi.hostedManagedMcpServers.v2",p1$="managed-mcp-servers.json",rd$,JJ$,XJ$,QJ$;var wJ$=F(()=>{K8();Gw();X6();T1();J4$();Z4$();KQ();F4$();b4$();z0();z8();pS();HC();m4$();H5();wL();a4$();Y0$();U0$();gK();nC();D0$();o0$();VJ();IB();L9();CL();G8();l7();CL();Z6$();U0();oS();d7();qx();X1$();w1();$1();r7();El$=L.object({plugin:L.object({id:L.string().min(1),source:L.string().min(1),origin:L.enum(["bundled","global","workspace","config"]),status:L.enum(["loaded","disabled","error"]),version:L.string().min(1).optional(),enabled:L.boolean()}).passthrough(),install:L.object({source:L.enum(["npm","archive","path","clawhub","git"]),spec:L.string().min(1).optional(),sourcePath:L.string().min(1).optional(),installPath:L.string().min(1).optional(),version:L.string().min(1).optional(),resolvedName:L.string().min(1).optional(),resolvedVersion:L.string().min(1).optional(),resolvedSpec:L.string().min(1).optional(),integrity:L.string().min(1).optional(),shasum:L.string().min(1).optional(),npmIntegrity:L.string().min(1).optional(),npmShasum:L.string().min(1).optional(),clawpackSha256:L.string().min(1).optional(),gitUrl:L.string().min(1).optional(),gitRef:L.string().min(1).optional(),gitCommit:L.string().min(1).optional()}).passthrough()}).passthrough();pl$=L.object({schemaVersion:L.literal("clawdi.liveSyncEnvironments.v1"),agentTypes:L.array(z1).default([])}).strict();z1$=`@openai/codex@${yL}`;E8=["openclaw","hermes"],rd$=/^[a-z0-9][a-z0-9._-]{0,63}$/;JJ$=["openclaw","hermes","codex"],XJ$={discord:["@openclaw/discord"],whatsapp:["clawhub:@openclaw/whatsapp"]},QJ$=["telegram","discord","whatsapp"]});var $W={};z$($W,{runtimeWatch:()=>Bp$,runtimeVerify:()=>Wp$,runtimeStatus:()=>Rp$,runtimeSidecar:()=>Np$,runtimePublicContentRevision:()=>PJ$,runtimeOnlyChangesCliPackage:()=>RJ$,runtimeInit:()=>Yp$,runtimeDoctor:()=>Ep$,runtimeAppliedContentIdentity:()=>AJ$,readSystemdUnitSnapshot:()=>e3,quiesceSystemdRuntimeCandidate:()=>EJ$,publishEgressSystemCaBundle:()=>vJ$,commitRuntimeAppliedState:()=>dx,assertCurrentEgressIdentity:()=>kJ$,applySystemdRuntimeUpdate:()=>$N});import{spawn as MJ$,spawnSync as bJ$}from"node:child_process";import{randomUUID as ln$}from"node:crypto";import{accessSync as IJ$,chmodSync as dn$,chownSync as nn$,constants as _J$,existsSync as p1,readdirSync as pn$,readFileSync as $Y}from"node:fs";import{join as mx}from"node:path";function VJ$($){try{return IJ$($,_J$.W_OK),!0}catch{return!1}}function on$($){try{return IJ$($,_J$.R_OK),!0}catch{return!1}}function rn$($,J){return A1$($.manifest,J,$.secretValues)}function AJ$($){return{sourcePath:$.sourcePath,sha256:l4({manifest:$.manifest,secretValues:rL($.manifest,$.secretValues)})}}function PJ$($){return l4({manifest:$.manifest})}function qJ$($){let{generation:J,applyGeneration:X,clawdiCli:
|
|
827
|
+
`,E8,N1$="clawdi.hostedManagedMcpServers.v1",vw="clawdi.hostedManagedMcpServers.v2",p1$="managed-mcp-servers.json",rd$,JJ$,XJ$,QJ$;var wJ$=F(()=>{K8();Gw();X6();T1();J4$();Z4$();KQ();F4$();b4$();z0();z8();pS();HC();m4$();H5();wL();a4$();Y0$();U0$();gK();nC();D0$();o0$();VJ();IB();L9();CL();G8();l7();CL();Z6$();U0();oS();d7();qx();X1$();w1();$1();r7();El$=L.object({plugin:L.object({id:L.string().min(1),source:L.string().min(1),origin:L.enum(["bundled","global","workspace","config"]),status:L.enum(["loaded","disabled","error"]),version:L.string().min(1).optional(),enabled:L.boolean()}).passthrough(),install:L.object({source:L.enum(["npm","archive","path","clawhub","git"]),spec:L.string().min(1).optional(),sourcePath:L.string().min(1).optional(),installPath:L.string().min(1).optional(),version:L.string().min(1).optional(),resolvedName:L.string().min(1).optional(),resolvedVersion:L.string().min(1).optional(),resolvedSpec:L.string().min(1).optional(),integrity:L.string().min(1).optional(),shasum:L.string().min(1).optional(),npmIntegrity:L.string().min(1).optional(),npmShasum:L.string().min(1).optional(),clawpackSha256:L.string().min(1).optional(),gitUrl:L.string().min(1).optional(),gitRef:L.string().min(1).optional(),gitCommit:L.string().min(1).optional()}).passthrough()}).passthrough();pl$=L.object({schemaVersion:L.literal("clawdi.liveSyncEnvironments.v1"),agentTypes:L.array(z1).default([])}).strict();z1$=`@openai/codex@${yL}`;E8=["openclaw","hermes"],rd$=/^[a-z0-9][a-z0-9._-]{0,63}$/;JJ$=["openclaw","hermes","codex"],XJ$={discord:["@openclaw/discord"],whatsapp:["clawhub:@openclaw/whatsapp"]},QJ$=["telegram","discord","whatsapp"]});var $W={};z$($W,{runtimeWatch:()=>Bp$,runtimeVerify:()=>Wp$,runtimeStatus:()=>Rp$,runtimeSidecar:()=>Np$,runtimePublicContentRevision:()=>PJ$,runtimeOnlyChangesCliPackage:()=>RJ$,runtimeInit:()=>Yp$,runtimeDoctor:()=>Ep$,runtimeAppliedContentIdentity:()=>AJ$,readSystemdUnitSnapshot:()=>e3,quiesceSystemdRuntimeCandidate:()=>EJ$,publishEgressSystemCaBundle:()=>vJ$,commitRuntimeAppliedState:()=>dx,assertCurrentEgressIdentity:()=>kJ$,applySystemdRuntimeUpdate:()=>$N});import{spawn as MJ$,spawnSync as bJ$}from"node:child_process";import{randomUUID as ln$}from"node:crypto";import{accessSync as IJ$,chmodSync as dn$,chownSync as nn$,constants as _J$,existsSync as p1,readdirSync as pn$,readFileSync as $Y}from"node:fs";import{join as mx}from"node:path";function VJ$($){try{return IJ$($,_J$.W_OK),!0}catch{return!1}}function on$($){try{return IJ$($,_J$.R_OK),!0}catch{return!1}}function rn$($,J){return A1$($.manifest,J,$.secretValues)}function AJ$($){return{sourcePath:$.sourcePath,sha256:l4({manifest:$.manifest,secretValues:rL($.manifest,$.secretValues)})}}function PJ$($){return l4({manifest:$.manifest})}function qJ$($){let{generation:J,applyGeneration:X,issuedAt:Q,clawdiCli:W,...Y}=$.manifest,{packageSpec:G,...z}=W??{};return{manifest:{...Y,...W===void 0?{}:{clawdiCli:z}},secretValues:rL($.manifest,$.secretValues)}}function RJ$($,J){let X=$.manifest.clawdiCli?.packageSpec?.trim(),Q=J.manifest.clawdiCli?.packageSpec?.trim();if(!X||!Q||X===Q)return!1;try{return l4(qJ$($))===l4(qJ$(J))}catch{return!1}}function in$($,J){let X=d4(J),Q=X?O9(X):null;if(!$.applyContext||!Q||!pz($.applyContext.identity,Q))return!1;let W=TL(J,$.applyContext);return"errors"in W?!1:RJ$(W,$)}function dx($){if($.applyIdentity&&$.applyIdentity.generation!==U1($.convergence.manifest))throw Error(`runtime apply identity generation ${$.applyIdentity.generation} does not match resolved manifest apply generation ${U1($.convergence.manifest)}`);let J=an$($.load.manifest);$.convergence.outputs.manifestLastGood=rn$($.load,$.paths),$.convergence.outputs.appliedState=qn({schemaVersion:"clawdi.runtimeAppliedState.v2",appliedAt:new Date().toISOString(),instanceId:$.convergence.manifest.instanceId,etag:$.etag,sourceRevision:$.sourceRevision,generation:$.convergence.manifest.generation,...$.convergence.manifest.applyGeneration===void 0?{}:{applyGeneration:$.convergence.manifest.applyGeneration},...$.applyIdentity?{manifestETag:$.applyIdentity.manifestETag,applyReceiptId:$.applyIdentity.applyReceiptId,bootNonce:$.applyIdentity.bootNonce}:{},contentIdentity:AJ$($.load),...$.daemonAuthTokenRevision?{daemonAuthTokenRevision:$.daemonAuthTokenRevision}:{},...$.egressSidecarSecretRevision?{egressSidecarSecretRevision:$.egressSidecarSecretRevision}:{},providerIds:J,projectedProviderIds:$.convergence.projectedProviderIds},$.paths)}function an$($){let J=$.runtime;if(!J)return[];return[...new Set($.runtimes[J]?.provider_ids??[])].sort()}function ZJ$($,J,X){if($===void 0)return J;let Q=typeof $==="number"?$:Number.parseInt($,10);if(!Number.isFinite(Q)||Q<=0)throw Error(`${X} must be a positive integer number of milliseconds`);return Q}function sn$(){let $=!1,J=null;return{signal:()=>{$=!0,J?.()},wait:async(X,Q)=>{if(Q?.aborted)return"aborted";if($)return $=!1,"notification";return new Promise((W)=>{let Y=!1,G=(w)=>{if(Y)return;if(Y=!0,clearTimeout(z),Q?.removeEventListener("abort",U),J=null,w==="notification")$=!1;W(w)},z=setTimeout(()=>G("poll"),X),U=()=>G("aborted");J=()=>G("notification"),Q?.addEventListener("abort",U,{once:!0})})}}}function tn$($,J){return $.apiUrl===J.apiUrl&&$.apiKey===J.apiKey&&$.environmentId===J.environmentId}function en$($){let J=vK($);if(!J||!p1($.manifestLastGood))return null;try{let X=lz.safeParse(JSON.parse($Y($.manifestLastGood,"utf-8")));if(!X.success)return null;return{apiUrl:X.data.controlPlane.apiUrl,apiKey:J,environmentId:X.data.environmentId}}catch{return null}}function BJ$($,J,X,Q){if(Q.once||Q.notifications===!1)return $;let W=en$(J);if(!W)return $?.abort.abort(),null;if($&&!$.settled&&tn$($.config,W))return $;$?.abort.abort();let Y=new AbortController,G=Q.notificationConsumer??Y2,z={config:W,abort:Y,task:Promise.resolve(),settled:!1};return z.task=G({apiUrl:W.apiUrl,apiKey:W.apiKey,abort:Y.signal,onEvent:(U)=>{if(U.type==="runtime_manifest_changed"&&U.environment_id===W.environmentId)X.signal()},onAuthFailure:()=>{}}).finally(()=>{z.settled=!0}),z.task.catch(()=>{}),z}function cx($){if(!p1($))return null;return $Y($,"utf-8")}function e3($){return{system:LJ$($.systemdSystemRoot),user:LJ$($.systemdUserRoot)}}function LJ$($){let J=new Map;if(!p1($))return J;for(let X of pn$($)){if(X.endsWith(".service")){let z=mx($,X),U=cx(z);if(U===null||!X.startsWith("clawdi-")&&!D9(U))continue;J.set(X,U);continue}if(!X.endsWith(".service.d"))continue;let Q=X.slice(0,-2),W=mx($,X,"10-clawdi-hosted.conf"),Y=cx(W);if(!Y||!D9(Y))continue;let G=cx(mx($,Q))??"";J.set(Q,`${G}
|
|
828
828
|
${Y}`)}return J}function NJ$($,J){let X=[],Q=[],W=[];for(let[Y,G]of J)if(!$.has(Y))X.push(Y);else if($.get(Y)!==G)Q.push(Y);for(let Y of $.keys())if(!J.has(Y))W.push(Y);return{added:X.sort(),changed:Q.sort(),removed:W.sort(),present:[...J.keys()].sort()}}function $p$($,J,X){let Q=new Map($.system),W=new Map($.user);for(let Y of J)Q.delete(Y);for(let Y of X)W.delete(Y);return{system:Q,user:W}}function $N($,J,X,Q={}){let W=NJ$(J.system,X.system),Y=NJ$(J.user,X.user),G=(c,G$)=>{let W$=new Set(G$);return{added:c.added.filter((s4)=>W$.has(s4)),changed:c.changed.filter((s4)=>W$.has(s4)),removed:c.removed.filter((s4)=>W$.has(s4)),present:c.present.filter((s4)=>W$.has(s4))}},z=Q.activationScope?G(W,Q.activationScope.systemUnits):W,U=Q.activationScope?G(Y,Q.activationScope.userUnits):Y,w=new Set([...z.added,...z.removed]),H=new Set([...U.added,...U.removed]),V=Q.activationScope?new Set(Q.activationScope.systemUnits):null,q=(Q.forceRestartSystemUnits??[]).filter((c)=>X.system.has(c)&&(!V||V.has(c))),Z=(Q.forceStopSystemUnits??[]).filter((c)=>X.system.has(c)&&(!V||V.has(c))),K=Q.recoverFailedUnits!==!1,N=z.added.length>0||z.changed.length>0||z.removed.length>0||U.added.length>0||U.changed.length>0||U.removed.length>0||q.length>0||Z.length>0;if(!SJ$($))return{applied:!N,systemUnitsChanged:[...w].sort(),userUnitsChanged:[...H].sort()};for(let c of z.removed){let G$=T8($,"system",c);if(c===lw&&!sQ(G$))continue;if(!sQ(G$))eQ(["stop",c])}for(let c of U.removed){let G$=T8($,"user",c);if(!sQ(G$))S8($,["stop",c]);if(!DJ$(G$))S8($,["disable",c])}for(let c of Z){let G$=T8($,"system",c);if(!sQ(G$))eQ(["stop",c]),w.add(c)}if(z.added.length>0||z.changed.length>0||z.removed.length>0)eQ(["daemon-reload"]);if(U.added.length>0||U.changed.length>0||U.removed.length>0)S8($,["daemon-reload"]);let O=new Set(z.added),D=new Set(z.changed),j=new Set(q),b=new Set(Z),I=new Set(Q.skipActivatedSystemUnits??[]),M=[],A=[],k=[];for(let c of z.present){let G$=T8($,"system",c);if(b.has(c))continue;if(I.has(c))continue;if(G$.activeState==="failed"&&K){M.push(c),A.push(c),w.add(c);continue}if(G$.activeState==="inactive"){A.push(c),w.add(c);continue}if(G$.activeState==="active"&&c!==lw&&(D.has(c)&&!Q.preserveActiveUnits||j.has(c)&&(!O.has(c)||c===tQ)))k.push(c),w.add(c)}if(M.length>0)eQ(["reset-failed",...M]);if(A.length>0)eQ(["start",...A]);if(k.length>0)eQ(["restart",...k]);let S=new Set(U.changed),l=[],s=[],w$=[],r=[],u=[];for(let c of U.present){let G$=T8($,"user",c),W$=OJ$(G$);if(G$.activeState==="failed"&&K)l.push(c),H.add(c);if(G$.activeState==="inactive"||G$.activeState==="failed"&&K){if(W$)s.push(c);else r.push(c);H.add(c);continue}if(G$.activeState!=="active")continue;if(!W$)w$.push(c),H.add(c);if(S.has(c)&&!Q.preserveActiveUnits)u.push(c),H.add(c)}if(l.length>0)S8($,["reset-failed",...l]);if(r.length>0)S8($,["enable","--now",...r]);if(w$.length>0)S8($,["enable",...w$]);if(s.length>0)S8($,["start",...s]);if(u.length>0)S8($,["restart",...u]);let a=z.present.every((c)=>{let G$=T8($,"system",c);if(b.has(c))return sQ(G$);return G$.loadState!=="not-found"&&G$.activeState==="active"}),J$=U.present.every((c)=>{let G$=T8($,"user",c);return G$.loadState!=="not-found"&&G$.activeState==="active"&&OJ$(G$)}),D$=z.removed.every((c)=>c===lw||sQ(T8($,"system",c))),L$=U.removed.every((c)=>{let G$=T8($,"user",c);return sQ(G$)&&DJ$(G$)});return{applied:a&&J$&&D$&&L$,systemUnitsChanged:[...w].sort(),userUnitsChanged:[...H].sort()}}function EJ$($,J){if(!SJ$($))return;let X=[...J.user.keys()].filter((W)=>W!==lw).sort();if(X.length>0)S8($,["stop",...X]);let Q=[...J.system.keys()].filter((W)=>W!==lw).sort();if(Q.length>0)eQ(["stop",...Q])}function T8($,J,X){let Q=["show",X,"--property=LoadState","--property=ActiveState"],W=J==="system"?Xp$(Q):lx($,Q);QN(J==="system"?dw():"systemctl --user",Q,W);let Y=Object.fromEntries(W.stdout.split(`
|
|
829
829
|
`).map((V)=>V.trim()).filter(Boolean).map((V)=>{let q=V.indexOf("=");return q<0?[V,""]:[V.slice(0,q),V.slice(q+1)]})),G=Y.LoadState,z=Y.ActiveState;if(!G||!z)throw Error(`systemd ${J} unit ${X} returned incomplete manager state`);if(J==="system")return{loadState:G,activeState:z};let U=["is-enabled",X],w=lx($,U),H=w.stdout.trim().split(/\s+/)[0]??"";if(!TJ$.has(H)&&!Jp$.has(H))throw QN("systemctl --user",U,w),Error(`systemd user unit ${X} returned unknown enabled state: ${H}`);return{loadState:G,activeState:z,enabledState:H}}function OJ$($){return $.enabledState!==void 0&&TJ$.has($.enabledState)}function sQ($){return $.loadState==="not-found"||$.activeState==="inactive"}function DJ$($){return $.loadState==="not-found"||$.enabledState==="not-found"||$.enabledState==="disabled"}function SJ$($){let J=process.env.CLAWDI_SYSTEMD_APPLY?.trim().toLowerCase();if(J==="1"||J==="true")return!0;if(J==="0"||J==="false")return!1;return $.systemdSystemRoot==="/run/systemd/system"}function eQ($){return CJ$(dw(),$)}function Xp$($){return XN(dw(),$)}function dw(){return process.env.CLAWDI_SYSTEMCTL_PATH?.trim()||"systemctl"}function S8($,J){let X=lx($,J);return QN("systemctl --user",J,X),[X.stdout,X.stderr].filter(Boolean).join(`
|
|
830
830
|
`).trim()}function lx($,J){let X=rz();if(X!=="root"){let Q=String(v1(X)),W=U8(X,$.userHome,dw(),["--user",...J],{environment:vn(Q)});return XN(W.command,W.args,W.env)}return XN(dw(),["--user",...J])}function Qp$($,J){let X=rz(),Q=U8(X,J,"test",["-r",$]);CJ$(Q.command,Q.args,Q.env)}function CJ$($,J,X){let Q=XN($,J,X);return QN($,J,Q),[Q.stdout,Q.stderr].filter(Boolean).join(`
|