UNPKG

grix-connector

Version:

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.

2 lines (1 loc) 2.01 kB
const l=Object.freeze({responseDelivery:"auto",toolEvents:"send",thinkingEvents:"send"});function h(e){const n=c(e);if(!n)return{patch:null};if(!Object.prototype.hasOwnProperty.call(n,"connector"))return{patch:null};const s=c(n.connector);if(!s)return{patch:null,error:"connector must be an object"};const t=s,o={},v=i(t.response_delivery,t.responseDelivery);if(v!==void 0){const r=a(v);if(!r)return{patch:null,error:"invalid response_delivery"};o.responseDelivery=r}const p=i(t.tool_events,t.toolEvents);if(p!==void 0){const r=d(p);if(!r)return{patch:null,error:"invalid tool_events"};o.toolEvents=r}const f=i(t.thinking_events,t.thinkingEvents);if(f!==void 0){const r=E(f);if(!r)return{patch:null,error:"invalid thinking_events"};o.thinkingEvents=r}return{patch:Object.keys(o).length>0?o:null}}function g(e,n){return n?{responseDelivery:n.responseDelivery??e.responseDelivery,toolEvents:n.toolEvents??e.toolEvents,thinkingEvents:n.thinkingEvents??e.thinkingEvents}:e}function y(e){const n=c(e);if(!n)return null;const s=a(i(n.response_delivery,n.responseDelivery)),t=d(i(n.tool_events,n.toolEvents)),o=E(i(n.thinking_events,n.thinkingEvents));return!s&&!t&&!o?null:{responseDelivery:s??l.responseDelivery,toolEvents:t??l.toolEvents,thinkingEvents:o??l.thinkingEvents}}function k(e){return e.toolEvents==="drop"}function m(e){return e.thinkingEvents==="drop"}function a(e){const n=u(e);return n==="auto"||n==="stream"||n==="single_message"?n:null}function d(e){const n=u(e);return n==="send"||n==="drop"?n:null}function E(e){const n=u(e);return n==="send"||n==="drop"?n:null}function u(e){if(typeof e!="string")return null;const n=e.trim().toLowerCase();return n||null}function c(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function i(...e){for(const n of e)if(n!==void 0)return n}export{l as DEFAULT_CONNECTOR_RUNTIME_CONFIG,g as applyConnectorRuntimeConfigPatch,h as extractConnectorRuntimeConfigPatch,m as isThinkingEventDropped,k as isToolEventDropped,y as normalizeRuntimeConfigSnapshot};