grix-connector 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- class r{client;_status="ready";connectedAt;listeners=[];authAck=null;constructor(e){this.client=e,this.connectedAt=Date.now(),this.addInternalListener("close",()=>{this._status!=="closing"&&(this._status="reconnecting")}),this.addInternalListener("auth",()=>{this._status="ready"}),this.addInternalListener("disconnected",()=>{this._status!=="closing"&&this._status!=="closed"&&(this._status="reconnecting")})}get status(){return this._status}getStatusSnapshot(){return{status:this._status,connectedAt:this.connectedAt,reconnectAttempts:0}}sendEventAck(e){this.client.sendEventAck(e)}sendStreamChunk(e){this.client.sendStreamChunk(e)}sendMsg(e){this.client.sendMsg(e)}editMsg(e){this.client.editMsg(e)}sendEventResult(e){this.client.sendEventResult(e)}sendLocalActionResult(e){this.client.sendLocalActionResult(e)}sendEventStopAck(e){this.client.sendEventStopAck(e)}sendEventStopResult(e){this.client.sendEventStopResult(e)}sendSessionActivitySet(e){this.client.sendSessionActivitySet(e)}sendCodexEvent(e){this.client.sendCodexEvent(e)}sendUpdateBindingCard(e){this.client.sendUpdateBindingCard(e)}sendSkillsUpdate(e){this.client.sendSkillsUpdate(e)}sendPing(){this.client.sendPing()}sendEventState(e){this.client.sendEventState(e)}sendEventCancelResult(e){this.client.sendEventCancelResult(e)}sendQueueClearResult(e){this.client.sendQueueClearResult(e)}sendQueueSnapshot(e){this.client.sendQueueSnapshot(e)}agentInvoke(e,t,s){return this.client.agentInvoke(e,t,s)}sendStreamChunkRequest(e,t){return this.client.sendStreamChunkRequest(e,t)}sendText(e,t){return this.client.sendText(e,t)}sendMedia(e,t){return this.client.sendMedia(e,t)}editMessage(e,t){return this.client.editMessage(e,t)}deleteMessage(e,t,s){return this.client.deleteMessage(e,t,s)}sendEventResultRequest(e,t){return this.client.sendEventResultRequest(e,t)}sendCodexEventReliable(e,t){return this.client.request("codex_event",e,{expected:["send_ack","send_nack","error"],timeoutMs:t??2e4})}onEvent(e){return this.subscribe("event",e)}onLocalAction(e){return this.subscribe("localAction",e)}onStop(e){return this.subscribe("stop",e)}onRevoke(e){return this.subscribe("revoke",e)}onEdit(e){return this.subscribe("edit",e)}onEventCancel(e){return this.subscribe("eventCancel",e)}onQueueClear(e){return this.subscribe("queueClear",e)}onQueueSnapshotQuery(e){return this.subscribe("queueSnapshotQuery",e)}onKicked(e){return this.subscribe("kicked",e)}onShareSet(e){return this.subscribe("shareSet",e)}onProfilePush(e){return this.subscribe("profilePush",e)}onError(e){return this.subscribe("error",e)}onClose(e){return this.subscribe("close",e)}onDisconnected(e){return this.subscribe("disconnected",e)}onStreamRejected(e){return this.subscribe("streamRejected",e)}onReconnected(e){return this.subscribe("auth",e)}disconnect(){this._status="closing",this.removeAllListeners(),this.client.disconnect(),this._status="closed"}sendMcpFrame(e,t){this.client.sendMcpFrame(e,t)}onMcpFrame(e){return this.subscribe("mcpFrame",e)}subscribe(e,t){return this.client.on(e,t),this.listeners.push({event:e,handler:t}),()=>{this.client.removeListener(e,t);const s=this.listeners.findIndex(n=>n.event===e&&n.handler===t);s>=0&&this.listeners.splice(s,1)}}addInternalListener(e,t){this.client.on(e,t),this.listeners.push({event:e,handler:t})}removeAllListeners(){for(const{event:e,handler:t}of this.listeners)this.client.removeListener(e,t);this.listeners.length=0}}export{r as AibotConnectionHandleImpl};
1
+ class r{client;_status="ready";connectedAt;listeners=[];authAck=null;constructor(e){this.client=e,this.connectedAt=Date.now(),this.addInternalListener("close",()=>{this._status!=="closing"&&(this._status="reconnecting")}),this.addInternalListener("auth",t=>{this._status="ready",t&&(this.authAck=t)}),this.addInternalListener("disconnected",()=>{this._status!=="closing"&&this._status!=="closed"&&(this._status="reconnecting")})}get status(){return this._status}getStatusSnapshot(){return{status:this._status,connectedAt:this.connectedAt,reconnectAttempts:0}}sendEventAck(e){this.client.sendEventAck(e)}sendStreamChunk(e){this.client.sendStreamChunk(e)}sendMsg(e){this.client.sendMsg(e)}editMsg(e){this.client.editMsg(e)}sendEventResult(e){this.client.sendEventResult(e)}sendLocalActionResult(e){this.client.sendLocalActionResult(e)}sendEventStopAck(e){this.client.sendEventStopAck(e)}sendEventStopResult(e){this.client.sendEventStopResult(e)}sendSessionActivitySet(e){this.client.sendSessionActivitySet(e)}sendCodexEvent(e){this.client.sendCodexEvent(e)}sendUpdateBindingCard(e){this.client.sendUpdateBindingCard(e)}sendSkillsUpdate(e){this.client.sendSkillsUpdate(e)}sendPing(){this.client.sendPing()}sendEventState(e){this.client.sendEventState(e)}sendEventCancelResult(e){this.client.sendEventCancelResult(e)}sendQueueClearResult(e){this.client.sendQueueClearResult(e)}sendQueueSnapshot(e){this.client.sendQueueSnapshot(e)}agentInvoke(e,t,s){return this.client.agentInvoke(e,t,s)}sendStreamChunkRequest(e,t){return this.client.sendStreamChunkRequest(e,t)}sendText(e,t){return this.client.sendText(e,t)}sendMedia(e,t){return this.client.sendMedia(e,t)}editMessage(e,t){return this.client.editMessage(e,t)}deleteMessage(e,t,s){return this.client.deleteMessage(e,t,s)}sendEventResultRequest(e,t){return this.client.sendEventResultRequest(e,t)}sendCodexEventReliable(e,t){return this.client.request("codex_event",e,{expected:["send_ack","send_nack","error"],timeoutMs:t??2e4})}onEvent(e){return this.subscribe("event",e)}onLocalAction(e){return this.subscribe("localAction",e)}onStop(e){return this.subscribe("stop",e)}onRevoke(e){return this.subscribe("revoke",e)}onEdit(e){return this.subscribe("edit",e)}onEventCancel(e){return this.subscribe("eventCancel",e)}onQueueClear(e){return this.subscribe("queueClear",e)}onQueueSnapshotQuery(e){return this.subscribe("queueSnapshotQuery",e)}onKicked(e){return this.subscribe("kicked",e)}onShareSet(e){return this.subscribe("shareSet",e)}onProfilePush(e){return this.subscribe("profilePush",e)}onError(e){return this.subscribe("error",e)}onClose(e){return this.subscribe("close",e)}onDisconnected(e){return this.subscribe("disconnected",e)}onStreamRejected(e){return this.subscribe("streamRejected",e)}onReconnected(e){return this.subscribe("auth",e)}disconnect(){this._status="closing",this.removeAllListeners(),this.client.disconnect(),this._status="closed"}sendMcpFrame(e,t){this.client.sendMcpFrame(e,t)}onMcpFrame(e){return this.subscribe("mcpFrame",e)}subscribe(e,t){return this.client.on(e,t),this.listeners.push({event:e,handler:t}),()=>{this.client.removeListener(e,t);const s=this.listeners.findIndex(n=>n.event===e&&n.handler===t);s>=0&&this.listeners.splice(s,1)}}addInternalListener(e,t){this.client.on(e,t),this.listeners.push({event:e,handler:t})}removeAllListeners(){for(const{event:e,handler:t}of this.listeners)this.client.removeListener(e,t);this.listeners.length=0}}export{r as AibotConnectionHandleImpl};
@@ -1,2 +1,2 @@
1
- import u from"node:path";import{appendRotatingFile as l}from"./rotation.js";const h=128*1024*1024,m=5,c=200,g=500;class ${filePath;rotationOptions;writeChain=Promise.resolve();contextSamples=new Map;constructor(e,t){this.filePath=u.join(e,"agentapi-packets.jsonl"),this.rotationOptions={maxBytes:t?.maxBytes??h,maxFiles:t?.maxFiles??m}}logInbound(e){this.writeEntry({...e,direction:"inbound",ts:new Date().toISOString()})}logOutbound(e){this.writeEntry({...e,direction:"outbound",ts:new Date().toISOString()})}logInboundPacket(e,t,o){if(e==="local_action"&&p(o)){const n=i(o,"session_id")??"",d=Date.now(),_=this.contextSamples.get(n)??0;if(d-_<g)return;this.contextSamples.set(n,d)}if(e==="local_action_ack")return;const s=o;this.writeEntry({direction:"inbound",ts:new Date().toISOString(),cmd:e,seq:t,eventId:i(s,"event_id"),sessionId:i(s,"session_id"),threadId:i(s,"thread_id"),msgId:i(s,"msg_id"),actionId:i(s,"action_id"),codexMethod:i(s,"codex_method"),invokeId:i(s,"invoke_id"),payloadSummary:r(e,o)})}logOutboundPacket(e,t,o,s){const n=o;this.writeEntry({direction:"outbound",ts:new Date().toISOString(),cmd:e,seq:t,sendStatus:s,eventId:i(n,"event_id"),sessionId:i(n,"session_id"),threadId:i(n,"thread_id"),msgId:i(n,"msg_id"),actionId:i(n,"action_id"),codexMethod:i(n,"codex_method"),invokeId:i(n,"invoke_id"),payloadSummary:r(e,o)})}writeEntry(e){const t=this.writeChain;this.writeChain=t.catch(()=>{}).then(async()=>{e.payloadSummary&&e.payloadSummary.length>c&&(e.payloadSummary=e.payloadSummary.slice(0,c)+"..."),await l(this.filePath,`${JSON.stringify(e)}
2
- `,this.rotationOptions)}).catch(()=>{})}async close(){await this.writeChain}}function p(a){return a?.action_type==="get_context"}function i(a,e){const t=a?.[e];if(typeof t=="string"&&t.trim())return t.trim()}function r(a,e){const t=e;if(!t)return"";switch(a){case"auth":return`agent_id=${t.agent_id??""} client_type=${t.client_type??""}`;case"auth_ack":return`code=${t.code??""} adapter_id=${t.adapter_id??""}`;case"event_msg":case"event_ack":case"event_result":return`event_id=${t.event_id??""} status=${t.status??""}`;case"send_msg":case"client_stream_chunk":return`session_id=${t.session_id??""} is_finish=${t.is_finish??""} client_msg_id=${t.client_msg_id??""} quoted_message_id=${t.quoted_message_id??""}`;case"local_action":return`action_type=${t.action_type??""} action_id=${t.action_id??""}`;case"local_action_result":return`action_id=${t.action_id??""} status=${t.status??""}`;case"codex_event":return`codex_method=${t.codex_method??""} seq=${t.codex_sequence??""}`;case"agent_invoke":return`action=${t.action??""} invoke_id=${t.invoke_id??""}`;case"agent_invoke_result":return`invoke_id=${t.invoke_id??""} code=${t.code??""}`;case"session_activity_set":return`session_id=${t.session_id??""} kind=${t.kind??""} active=${t.active??""}`;default:return""}}export{$ as AgentApiPacketLog};
1
+ import u from"node:path";import{appendRotatingFile as h}from"./rotation.js";const l=128*1024*1024,m=5,c=200,g=500;class S{filePath;rotationOptions;writeChain=Promise.resolve();contextSamples=new Map;constructor(e,t){this.filePath=u.join(e,"agentapi-packets.jsonl"),this.rotationOptions={maxBytes:t?.maxBytes??l,maxFiles:t?.maxFiles??m}}logInbound(e){this.writeEntry({...e,direction:"inbound",ts:new Date().toISOString()})}logOutbound(e){this.writeEntry({...e,direction:"outbound",ts:new Date().toISOString()})}logInboundPacket(e,t,o){if(e==="local_action"&&p(o)){const n=i(o,"session_id")??"",d=Date.now(),_=this.contextSamples.get(n)??0;if(d-_<g)return;this.contextSamples.set(n,d)}if(e==="local_action_ack")return;const s=o;this.writeEntry({direction:"inbound",ts:new Date().toISOString(),cmd:e,seq:t,eventId:i(s,"event_id"),sessionId:i(s,"session_id"),threadId:i(s,"thread_id"),msgId:i(s,"msg_id"),actionId:i(s,"action_id"),codexMethod:i(s,"codex_method"),invokeId:i(s,"invoke_id"),payloadSummary:r(e,o)})}logOutboundPacket(e,t,o,s){const n=o;this.writeEntry({direction:"outbound",ts:new Date().toISOString(),cmd:e,seq:t,sendStatus:s,eventId:i(n,"event_id"),sessionId:i(n,"session_id"),threadId:i(n,"thread_id"),msgId:i(n,"msg_id"),actionId:i(n,"action_id"),codexMethod:i(n,"codex_method"),invokeId:i(n,"invoke_id"),payloadSummary:r(e,o)})}writeEntry(e){const t=this.writeChain;this.writeChain=t.catch(()=>{}).then(async()=>{e.payloadSummary&&e.payloadSummary.length>c&&(e.payloadSummary=e.payloadSummary.slice(0,c)+"..."),await h(this.filePath,`${JSON.stringify(e)}
2
+ `,this.rotationOptions)}).catch(()=>{})}async close(){await this.writeChain}}function p(a){return a?.action_type==="get_context"}function i(a,e){const t=a?.[e];if(typeof t=="string"&&t.trim())return t.trim()}function r(a,e){const t=e;if(!t)return"";switch(a){case"auth":return`agent_id=${t.agent_id??""} client_type=${t.client_type??""}`;case"auth_ack":return`code=${t.code??""} adapter_id=${t.adapter_id??""} agent_name=${t.agent_name??""} has_intro=${t.introduction?1:0}`;case"event_msg":case"event_ack":case"event_result":return`event_id=${t.event_id??""} status=${t.status??""}`;case"send_msg":case"client_stream_chunk":return`session_id=${t.session_id??""} is_finish=${t.is_finish??""} client_msg_id=${t.client_msg_id??""} quoted_message_id=${t.quoted_message_id??""}`;case"local_action":return`action_type=${t.action_type??""} action_id=${t.action_id??""}`;case"local_action_result":return`action_id=${t.action_id??""} status=${t.status??""}`;case"codex_event":return`codex_method=${t.codex_method??""} seq=${t.codex_sequence??""}`;case"agent_invoke":return`action=${t.action??""} invoke_id=${t.invoke_id??""}`;case"agent_invoke_result":return`invoke_id=${t.invoke_id??""} code=${t.code??""}`;case"session_activity_set":return`session_id=${t.session_id??""} kind=${t.kind??""} active=${t.active??""}`;default:return""}}export{S as AgentApiPacketLog};
@@ -1 +1 @@
1
- function a(o){const e=new Set([`http://127.0.0.1:${o.serverPort}`,`http://localhost:${o.serverPort}`,...o.allowedOrigins]),t=new Set([`127.0.0.1:${o.serverPort}`,`localhost:${o.serverPort}`,...o.allowedHosts]);return{validateRequest(s){const r=i(s,e);if(!r.ok)return r;const n=l(s,t);return n.ok?{ok:!0}:n}}}function i(o,e){const t=o.headers.origin;return t?e.has(t)?{ok:!0}:{ok:!1,statusCode:403,message:`Origin not allowed: ${t}`}:{ok:!0}}function l(o,e){const t=o.headers.host;return t?e.has(t)?{ok:!0}:{ok:!1,statusCode:403,message:`Host not allowed: ${t}`}:{ok:!1,statusCode:403,message:"Missing Host header"}}export{a as createSecurityPolicy};
1
+ function a(e){const t=new Set([`http://127.0.0.1:${e.serverPort}`,`http://localhost:${e.serverPort}`,...e.allowedOrigins]),o=new Set([`127.0.0.1:${e.serverPort}`,`localhost:${e.serverPort}`,...e.allowedHosts]);return{validateRequest(s){const r=i(s,t);if(!r.ok)return r;const n=l(s,o);return n.ok?{ok:!0}:n}}}function i(e,t){const o=e.headers.origin;return o?t.has(o)?{ok:!0}:{ok:!1,statusCode:403,message:`Origin not allowed: ${o}`}:{ok:!0}}function l(e,t){const o=e.headers.host;return o?t.has(o)?{ok:!0}:{ok:!1,statusCode:403,message:`Host not allowed: ${o}`}:{ok:!1,statusCode:403,message:"Missing Host header"}}export{a as createSecurityPolicy};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grix-connector",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",