grix-connector 1.1.5 → 1.1.6
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,2 +1,2 @@
|
|
|
1
|
-
import{execFile as
|
|
2
|
-
${
|
|
1
|
+
import{execFile as f}from"node:child_process";import{promisify as y}from"node:util";import{log as p}from"../log/logger.js";import{probeUrls as h}from"./speed-test.js";const b=y(f),w=1e4,c=[{id:"official",label:"npm \u5B98\u65B9",url:"https://registry.npmjs.org"},{id:"npmmirror",label:"npmmirror (\u6DD8\u5B9D\u955C\u50CF)",url:"https://registry.npmmirror.com"}];async function R(){const n=await h(c.map(r=>({url:r.url,label:r.label})),5e3),e=[];for(const r of n)if(r.reachable){const i=c.find(o=>o.url===r.url);i&&e.push(i)}for(const r of n)if(!r.reachable){const i=c.find(o=>o.url===r.url);i&&!e.includes(i)&&e.push(i)}for(const r of c)e.includes(r)||e.push(r);return e}async function N(){try{const{stdout:n}=await b("npm",["config","get","registry"],{timeout:w,encoding:"utf-8"});return n.trim()}catch{return"https://registry.npmjs.org"}}async function O(n,e,r){const i=await R();if(i.length===0)throw new Error("All npm registries are unreachable. Check your network connection.");let o="";for(const l of i)try{return p.info("installer",`npm install ${n} using ${l.label} (${l.url})`),{output:await T(n,l.url,e,r),registry:l.label}}catch(s){const t=s instanceof Error?s.message:String(s);if(o=t,p.info("installer",`${l.label} failed: ${t.slice(0,200)}`),!(t.includes("ECONNRESET")||t.includes("ETIMEDOUT")||t.includes("ECONNREFUSED")||t.includes("ENOTFOUND")||t.includes("network")||t.includes("fetch failed")||t.includes("404")||t.includes("ERR_SOCKET_TIMEOUT")||t.includes("getaddrinfo")))throw s}throw new Error(`npm install failed on all registries. Last error: ${o}`)}function T(n,e,r,i){return new Promise((o,l)=>{const s=["install","-g",n,"--registry",e,"--prefer-online","--no-audit","--no-fund"],t=process.platform==="win32",a=t?"cmd.exe":"npm",g=t?["/c","npm",...s]:s;f(a,g,{timeout:r,maxBuffer:i},(u,d,m)=>{if(u){const E=m?.trim()||u.message;l(new Error(E));return}o(`${d??""}
|
|
2
|
+
${m??""}`.trim())})})}function M(n){return c.map(e=>({label:e.label,command:`npm install -g ${n} --registry ${e.url}`}))}export{c as NPM_REGISTRIES,N as getCurrentRegistry,M as getMirrorInstallCommands,O as npmInstallWithMirror,R as probeRegistries};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grix-connector",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
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",
|