@botmobile/botmobile-openclaw 0.0.7 → 0.0.8

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.

Potentially problematic release.


This version of @botmobile/botmobile-openclaw might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -17,4 +17,4 @@ ${P.join(`
17
17
  `)})}async function _5(Z){let $=sZ;console.log(`${NZ} initiating pairing with worker=${$}`),console.log(`${NZ} instance=${Z}`);let Q=await fetch(`${$}/api/pair/init`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ocInstanceId:Z})});if(!Q.ok){let V=await Q.text();throw console.error(`${NZ} pairing init failed: ${Q.status} ${V}`),Error(`Failed to initiate pairing: ${V}`)}let X=await Q.json(),Y=(X.pairingCode??X.pairingId??"").toUpperCase();if(!/^[A-Z0-9]{4}-[A-Z0-9]{4}$/.test(Y))throw Error("Pairing init response missing valid pairing code");console.log(`${NZ} code=${Y}`),console.log(`${NZ} pairing code registered, showing QR`),N8(Y,$);let H=`${$.replace(/^http/,"ws")}/ws/pair?code=${encodeURIComponent(Y)}`;return console.log(`${NZ} connecting to pairing WS...`),new Promise((V,J)=>{let K=new z8(H),B=setTimeout(()=>{K.close(),J(Error("Pairing timed out"))},600000);K.on("open",()=>{console.log(`${NZ} pairing WS connected, waiting for phone...`)}),K.on("message",(O)=>{let L=JSON.parse(O.toString());if(L.type==="paired"&&L.userId&&L.sharedSecret)clearTimeout(B),K.close(),console.log(`${NZ} ✓ pairing complete! userId=${L.userId}`),V({userId:L.userId,sharedSecret:L.sharedSecret,pushSecret:L.pushSecret})}),K.on("close",()=>{clearTimeout(B)}),K.on("error",(O)=>{clearTimeout(B),console.error(`${NZ} pairing WS error: ${O.message}`),J(Error(`Pairing WS error: ${O.message}`))})})}var k0="[botmobile]";function W5(Z){return Z.channels?.botmobile}function z5(Z,$){let Q=Z.channels??{},X={...Q.botmobile??{}};return delete X.workerUrl,{...Z,channels:{...Q,botmobile:{...X,...$}}}}var N5={channel:"botmobile",async getStatus(Z){let $=W5(Z.cfg),Q=!!$?.sharedSecret,X=$?.enabled!==!1,Y=[];if(Q){if(Y.push(`BotMobile: paired (user: ${$?.userId?.slice(0,8)??"?"}...)`),Y.push(` Worker: ${sZ}`),typeof $?.pushSecret==="string"&&$.pushSecret.length>0)Y.push(" Push auth: configured");else Y.push(" Push auth: missing");if(!X)Y.push(" (disabled)")}else Y.push("BotMobile: not configured");return{channel:"botmobile",configured:Q,statusLines:Y,selectionHint:Q?void 0:"Pair your phone via QR code"}},async configure(Z){if(W5(Z.cfg)?.sharedSecret){if(!await Z.prompter.confirm({message:"BotMobile is already paired. Re-pair with a new device?"}))return{cfg:Z.cfg,accountId:"default"}}console.log(`${k0} starting pairing flow...`),await Z.prompter.note(`Scan the QR code below with the BotMobile iOS app.
18
18
  Or enter the code manually in the app.`,"BotMobile Pairing");let Q=crypto.randomUUID(),X=await _5(Q);console.log(`${k0} pairing complete, saving config`);let Y=z5(Z.cfg,{enabled:!0,sharedSecret:X.sharedSecret,pushSecret:X.pushSecret??"",userId:X.userId}),V=Y.channels;return console.log(`${k0} updatedCfg.channels keys: ${V?Object.keys(V).join(", "):"MISSING"}`),console.log(`${k0} updatedCfg.channels.botmobile: ${V?.botmobile?"present":"MISSING"}`),await Z.prompter.note(`Paired successfully! User ID: ${X.userId.slice(0,8)}...
19
19
  The gateway will now connect to your phone.`,"BotMobile Connected"),{cfg:Y,accountId:"default"}},disable(Z){return z5(Z,{enabled:!1})}};q0();Q0();var qZ="[botmobile]",E5=new Map;function P5(Z){let $=Z.trim();if(!$)return Z;let Q=":user:",X=$.indexOf(Q);if(X>=0){let Y=$.slice(X+Q.length).trim();if(Y.length>0)return Y}return $}function E8(Z,$){if(!$)return Z;if(Z.startsWith($))return Z;return`${$} ${Z}`.trim()}function R5(Z){let{cfg:$,accountId:Q,conversationId:X}=Z,Y=null;try{Y=J0().channel.routing.resolveAgentRoute({cfg:$,channel:"botmobile",accountId:Q??"default",peer:{kind:"direct",id:X}})}catch(B){console.warn(`${qZ} outbound metadata route failed conv=${X}: ${String(B)}`);return}let H=Y.agentId;if(typeof H!=="string"||!H.trim())return;let V=bZ($,H);F0(X,{id:H,name:V.name,emoji:V.emoji});let J=E8(V.name,V.emoji);if(E5.get(X)===J)return;let K=Date.now();k({type:"conversation_list",conversations:[{id:X,name:J,createdAt:K,lastActivity:K}]}),E5.set(X,J),console.log(`${qZ} outbound conversation meta conv=${X} agent=${H} name="${J}" source=${V.source} emojiSource=${V.emojiSource??"none"}`)}var M5={id:"botmobile",meta:{id:"botmobile",label:"BotMobile",selectionLabel:"BotMobile (Mobile)",docsPath:"/channels/botmobile",blurb:"Mobile bridge for OpenClaw"},pairing:{idLabel:"botmobileUserId"},onboarding:N5,capabilities:{chatTypes:["direct"]},reload:{configPrefixes:["channels.botmobile"]},config:{listAccountIds:(Z)=>{let $=Z.channels?.botmobile,Q=!!$?.sharedSecret;return console.log(`${qZ} listAccountIds: botmobile=${!!$} sharedSecret=${Q}`),Q?["default"]:[]},resolveAccount:(Z,$)=>{let Q=Z.channels?.botmobile;return{sharedSecret:Q?.sharedSecret??"",pushSecret:Q?.pushSecret??"",userId:Q?.userId??"",workerUrl:sZ,enabled:Q?.enabled!==!1}},defaultAccountId:()=>"default",isConfigured:(Z,$)=>{return!!$.channels?.botmobile?.sharedSecret},isEnabled:(Z)=>Z?.enabled!==!1,describeAccount:(Z)=>({accountId:"default",enabled:Z?.enabled!==!1,configured:!!Z?.sharedSecret})},outbound:{deliveryMode:"hybrid",sendText:async({cfg:Z,accountId:$,to:Q,text:X})=>{let Y=P5(Q);R5({cfg:Z,accountId:$,conversationId:Y});let H={type:"message",id:crypto.randomUUID(),conversationId:Y,from:"bot",body:X,timestamp:Date.now()};if(Y!==Q)console.log(`${qZ} outbound sendText to=${Q} conv=${Y} (${X.length} chars)`);else console.log(`${qZ} outbound sendText to=${Q} (${X.length} chars)`);return k(H),{channel:"botmobile",messageId:H.id}},sendMedia:async({cfg:Z,accountId:$,to:Q,text:X,mediaUrl:Y})=>{let H=P5(Q);R5({cfg:Z,accountId:$,conversationId:H});let V=X?`${X}
20
- ${Y}`:Y,J={type:"message",id:crypto.randomUUID(),conversationId:H,from:"bot",body:V,timestamp:Date.now()};if(H!==Q)console.log(`${qZ} outbound sendMedia to=${Q} conv=${H} mediaUrl=${Y}`);else console.log(`${qZ} outbound sendMedia to=${Q} mediaUrl=${Y}`);return k(J),{channel:"botmobile",messageId:J.id}}},gateway:{startAccount:async(Z)=>{let{account:$,accountId:Q}=Z;console.log(`${qZ} gateway startAccount id=${Q} user=${$.userId}`),console.log(`${qZ} workerUrl=${$.workerUrl}`),console.log(`${qZ} configured=${!!$.sharedSecret} enabled=${$.enabled}`),Z.setStatus?.({accountId:Q,running:!0,lastStartAt:Date.now(),lastError:null});let{monitorBotMobileProvider:X}=await Promise.resolve().then(() => (V0(),G5));await X({account:$,accountId:Q,config:Z.cfg,runtime:Z.runtime,abortSignal:Z.abortSignal})},stopAccount:async(Z)=>{console.log(`${qZ} gateway stopAccount id=${Z.accountId}`),Z.setStatus?.({accountId:Z.accountId,running:!1,lastStopAt:Date.now()})}}};V0();V0();var R8={id:"botmobile",name:"BotMobile",description:"Mobile bridge for OpenClaw",configSchema:P8(),register(Z){A3(Z.runtime),Z.registerChannel({plugin:M5}),Z.on("before_tool_call",($,Q)=>{j0({phase:"start",agentId:Q.agentId,sessionKey:Q.sessionKey,toolName:$.toolName,toolParams:$.params,config:Z.config})}),Z.on("after_tool_call",($,Q)=>{j0({phase:"end",agentId:Q.agentId,sessionKey:Q.sessionKey,toolName:$.toolName,toolParams:$.params,error:$.error,config:Z.config})}),Z.on("agent_end",($,Q)=>{C3({agentId:Q.agentId,sessionKey:Q.sessionKey,success:$.success,error:$.error,config:Z.config})})}},p9=R8;export{F5 as monitorBotMobileProvider,p9 as default};
20
+ ${Y}`:Y,J={type:"message",id:crypto.randomUUID(),conversationId:H,from:"bot",body:V,timestamp:Date.now()};if(H!==Q)console.log(`${qZ} outbound sendMedia to=${Q} conv=${H} mediaUrl=${Y}`);else console.log(`${qZ} outbound sendMedia to=${Q} mediaUrl=${Y}`);return k(J),{channel:"botmobile",messageId:J.id}}},gateway:{startAccount:async(Z)=>{let{account:$,accountId:Q}=Z;console.log(`${qZ} gateway startAccount id=${Q} user=${$.userId}`),console.log(`${qZ} workerUrl=${$.workerUrl}`),console.log(`${qZ} configured=${!!$.sharedSecret} enabled=${$.enabled}`),Z.setStatus?.({accountId:Q,running:!0,lastStartAt:Date.now(),lastError:null});let{monitorBotMobileProvider:X}=await Promise.resolve().then(() => (V0(),G5));await X({account:$,accountId:Q,config:Z.cfg,runtime:Z.runtime,abortSignal:Z.abortSignal})},stopAccount:async(Z)=>{console.log(`${qZ} gateway stopAccount id=${Z.accountId}`),Z.setStatus?.({accountId:Z.accountId,running:!1,lastStopAt:Date.now()})}}};V0();V0();var R8={id:"botmobile-openclaw",name:"BotMobile",description:"Mobile bridge for OpenClaw",configSchema:P8(),register(Z){A3(Z.runtime),Z.registerChannel({plugin:M5}),Z.on("before_tool_call",($,Q)=>{j0({phase:"start",agentId:Q.agentId,sessionKey:Q.sessionKey,toolName:$.toolName,toolParams:$.params,config:Z.config})}),Z.on("after_tool_call",($,Q)=>{j0({phase:"end",agentId:Q.agentId,sessionKey:Q.sessionKey,toolName:$.toolName,toolParams:$.params,error:$.error,config:Z.config})}),Z.on("agent_end",($,Q)=>{C3({agentId:Q.agentId,sessionKey:Q.sessionKey,success:$.success,error:$.error,config:Z.config})})}},p9=R8;export{F5 as monitorBotMobileProvider,p9 as default};
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "botmobile",
2
+ "id": "botmobile-openclaw",
3
3
  "channels": ["botmobile"],
4
4
  "configSchema": {
5
5
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botmobile/botmobile-openclaw",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "OpenClaw BotMobile mobile bridge plugin (private test build)",
5
5
  "type": "module",
6
6
  "files": [