@venos-inc/venos 0.1.16 → 0.1.17
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
CHANGED
|
@@ -206,7 +206,7 @@ If you are developing locally, run: pnpm --filter @venos/session-waste build`)}v
|
|
|
206
206
|
Update with: npm i -g @venos-inc/venos@latest`}:null}async function rn(e){let t=e.now??Date.now(),n=e.fetchImpl??fetch,r,o=e.bypassCache?null:rf(e.home);if(o&&t-o.checkedAt<Zp)r=o.policy;else{if(r=await nn(e.orchestratorUrl,e.orgId,n,e.machineId),r===null)return null;of(e.home,{checkedAt:t,policy:r})}return oi(r,e.currentVersion)}function af(e=process.env,t=process.execPath){let n=ti(t),r=e.PATH??"";return r===""?{...e,PATH:n}:r.split(Qs).includes(n)?{...e,PATH:r}:{...e,PATH:`${n}${Qs}${r}`}}var cf=(e,t)=>new Promise((n,r)=>{Gp(e,t,{timeout:ef,env:af()},(o,s,i)=>{if(!o){n();return}let a=(i||o.message||"").trim();r(new Error(a===""?"npm install failed":a))})});function lf(e=process.execPath,t=Yp){let n=ti(e),r=[tn(n,"node_modules","npm","bin","npm-cli.js"),tn(n,"..","lib","node_modules","npm","bin","npm-cli.js")];for(let o of r)if(t(o))return o;return null}function uf(e,t,n=process.execPath){if(!nf.test(e))return null;let r=`@venos-inc/venos@${e}`;return t!==null?{cmd:n,args:[t,"install","-g",r]}:{cmd:"npm",args:["install","-g",r]}}async function on(e,t=cf){let n=uf(e,lf());if(n===null)return{ok:!1,error:`invalid version: ${e}`};try{return await t(n.cmd,n.args),{ok:!0}}catch(r){return{ok:!1,error:(r instanceof Error?r.message:String(r)).slice(0,tf)}}}function df(){let e=process.argv[1]??"";if(e!=="")try{zp(process.execPath,[e,"heartbeat"],{detached:!0,stdio:"ignore",env:{...process.env,VENOS_SKIP_AUTOUPDATE:"1"}}).unref()}catch{}}async function pf(e){let t=e.fetchImpl??fetch;for(let n of e.mirrors??[]){if(!n.url||n.url.trim()==="")continue;let r=await nn(n.url,n.orgId??e.orgId,t,e.machineId,n.apiKey);if(!r)continue;let o=oi(r,e.currentVersion);if(o&&o.kind==="auto")return o}return null}async function si(e,t=on,n=df){let r=null;try{r=await rn({...e,bypassCache:!0})}catch{r=null}if((!r||r.kind!=="auto")&&(r=await pf(e)),!r||r.kind!=="auto")return{};let o=await t(r.targetVersion);return o.ok?(n(),{installed:r.targetVersion}):{failure:{targetVersion:r.targetVersion,error:o.error??"npm install failed"}}}import{existsSync as L,readFileSync as de,readdirSync as ff,statSync as mf}from"node:fs";import{execFileSync as gf}from"node:child_process";import{join as R}from"node:path";function ct(e){return e.split(/[\s_-]+/).filter(t=>t!=="").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function q(e){return typeof e=="string"?e.trim():""}function hf(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;if(q(t.billingType)==="")return null;let r=q(t.organizationRateLimitTier),o=q(t.organizationType),s;if(r.includes("max_20x"))s="Claude Max 20x";else if(r.includes("max_5x"))s="Claude Max 5x";else switch(o){case"claude_pro":s="Claude Pro";break;case"claude_team":s="Claude Team";break;case"claude_enterprise":s="Claude Enterprise";break;case"claude_max":s="Claude Max";break;default:s=o!==""?ct(o):"Claude Max"}let i;switch(o){case"claude_team":i="team";break;case"claude_enterprise":i="enterprise";break;default:i="individual"}return{provider:"claude-code",planName:s,planClass:i,detail:r!==""?r:o}}function ii(e,t){let n=e.trim().toLowerCase();if(n==="")return null;let r;switch(n){case"team":case"business":r="team";break;case"enterprise":r="enterprise";break;default:r="individual"}return{provider:"codex",planName:`ChatGPT ${ct(n)}`,planClass:r,detail:`plan_type=${n} (${t})`}}function yf(e,t){let n=e.trim().toLowerCase();if(n==="")return null;let r;switch(n){case"team":case"business":r="team";break;case"enterprise":r="enterprise";break;default:r="individual"}let o=t.trim();return{provider:"cursor",planName:`Cursor ${ct(n)}`,planClass:r,detail:`stripeMembershipType=${n} status=${o}`}}function kf(e,t,n){let r=e.trim();if(r==="")return null;let o=r.split(":")[1]??"",s=t.trim().toLowerCase(),a=n.match(/arn:aws:codewhisperer:[^:]*:(\d+):/)?.[1]??"",c,l;o==="idc"?(c="enterprise",l="Kiro Enterprise"):(c="individual",o==="builder-id"?l="Kiro (Builder ID)":s!==""?l=`Kiro (${ct(s)})`:l="Kiro");let u=[`auth=${o!==""?o:"unknown"}`];return s!==""&&u.push(`provider=${s}`),a!==""&&u.push(`account=${a}`),{provider:"kiro",planName:l,planClass:c,detail:u.join(" ")}}function vf(e,t){return t==="darwin"?R(e,"Library","Application Support","kiro-cli","data.sqlite3"):R(e,".local","share","kiro-cli","data.sqlite3")}function Sf(e,t){let n=vf(e,t);if(!L(n))return null;let r=sn(n,"SELECT key FROM auth_kv WHERE key LIKE 'kirocli:%:token' ORDER BY key LIMIT 1;");if(r==="")return null;let o=sn(n,`SELECT value FROM auth_kv WHERE key='${r.replace(/'/g,"''")}' LIMIT 1;`),s="",i="";try{let a=JSON.parse(o);if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let c=a;s=q(c.provider),i=q(c.profile_arn)}}catch{}return kf(r,s,i)}function wf(e){let t=R(e,".claude.json");if(!L(t))return null;let n=JSON.parse(de(t,"utf8"));return typeof n!="object"||n===null||Array.isArray(n)?null:hf(n.oauthAccount)}function Cf(e){let t=[],n=r=>{let o;try{o=ff(r,{withFileTypes:!0})}catch{return}for(let s of o){let i=R(r,s.name);if(s.isDirectory())n(i);else if(s.isFile()&&s.name.endsWith(".jsonl"))try{t.push({path:i,mtime:mf(i).mtimeMs})}catch{}}};return n(e),t.sort((r,o)=>o.mtime-r.mtime),t.map(r=>r.path)}function xf(e){let t=R(e,".codex","sessions");if(!L(t))return"";for(let n of Cf(t)){let r;try{r=de(n,"utf8")}catch{continue}let o=r.match(/"plan_type"\s*:\s*"([^"]+)"/g);if(!o||o.length===0)continue;let i=(o[o.length-1]??"").match(/"plan_type"\s*:\s*"([^"]+)"/);if(i&&i[1])return i[1]}return""}function bf(e){let t=R(e,".codex","auth.json");if(!L(t))return"";let n=JSON.parse(de(t,"utf8")),r=q(n?.tokens&&typeof n.tokens=="object"?n.tokens.id_token:"");if(r==="")return"";let o=r.split(".");if(o.length<2)return"";let s=o[1]??"",i=JSON.parse(Buffer.from(s,"base64url").toString("utf8"));if(typeof i!="object"||i===null)return"";let a=i["https://api.openai.com/auth"];return typeof a!="object"||a===null?"":q(a.chatgpt_plan_type)}function Of(e){let t=xf(e);if(t!=="")return ii(t,"session");let n=bf(e);return n!==""?ii(n,"jwt"):null}function Ef(e){let t=e.trim().toLowerCase();if(t==="")return null;let r={"oauth-personal":"Gemini Code Assist (Google login)","gemini-api-key":"Gemini API key","vertex-ai":"Vertex AI","cloud-shell":"Gemini Code Assist (Cloud Shell)","compute-default-credentials":"Vertex AI (compute credentials)",gateway:"Gemini gateway"}[t];return r===void 0?null:{provider:"gemini-cli",planName:r,planClass:t==="vertex-ai"||t==="compute-default-credentials"?"enterprise":"individual",detail:`selectedType=${t}`}}function Pf(e){let t=e.trim().toLowerCase();if(t==="")return null;let n,r;return t.includes("enterprise")?(n="enterprise",r="Copilot Enterprise"):t.includes("business")?(n="team",r="Copilot Business"):t.includes("free")?(n="individual",r="Copilot Free"):t.includes("pro")?(n="individual",r=t.includes("plus")?"Copilot Pro+":"Copilot Pro"):(n="individual",r="Copilot"),{provider:"github-copilot",planName:r,planClass:n,detail:`copilotSku=${t}`}}function If(e,t){let n=["Code","User","globalStorage","state.vscdb"];if(t==="darwin")return R(e,"Library","Application Support",...n);if(t==="win32"){let r=process.env.APPDATA,o=r&&r.trim()!==""?r:R(e,"AppData","Roaming");return R(o,...n)}return R(e,".config",...n)}function Rf(e,t){let n=If(e,t);if(!L(n))return null;let r=an(n,"extensionsAssignmentFilterProvider.copilotSku");return Pf(r)}function _f(e){let t=R(e,".config","goose","config.yaml");if(!L(t))return null;let n=de(t,"utf8"),o=(/^active_provider:[ \t]*(\S+)/m.exec(n)?.[1]??"").trim().replace(/^["']|["']$/g,"");return o===""?null:{provider:"goose",planName:o,planClass:"individual",detail:`active_provider=${o}`}}function Af(e){let t=R(e,".gemini","settings.json");if(!L(t))return null;let r=JSON.parse(de(t,"utf8")).security?.auth?.selectedType;return typeof r!="string"?null:Ef(r)}function Nf(e){let t=e.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"");if(t==="")return null;let n=t==="github.com";return{provider:"copilot-cli",planName:n?"GitHub Copilot":"GitHub Copilot Enterprise",planClass:n?"individual":"enterprise",detail:`host=${t}`}}function Tf(e){let t=R(e,".copilot","config.json");if(!L(t))return null;let n=de(t,"utf8").split(`
|
|
207
207
|
`).filter(s=>!/^\s*\/\//.test(s)).join(`
|
|
208
208
|
`),o=JSON.parse(n).lastLoggedInUser?.host;return typeof o!="string"?null:Nf(o)}function Uf(e,t){let n=["Cursor","User","globalStorage","state.vscdb"];if(t==="darwin")return R(e,"Library","Application Support",...n);if(t==="win32"){let r=process.env.APPDATA,o=r&&r.trim()!==""?r:R(e,"AppData","Roaming");return R(o,...n)}return R(e,".config",...n)}function sn(e,t){return gf("sqlite3",[e,t],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim().replace(/^"(.*)"$/,"$1")}function an(e,t){return sn(e,`SELECT value FROM ItemTable WHERE key='${t}';`)}function jf(e,t){let n=Uf(e,t);if(!L(n))return null;let r=an(n,"cursorAuth/stripeMembershipType"),o=an(n,"cursorAuth/stripeSubscriptionStatus");return yf(r,o)}function ai(e){if(e==="")return[];let t=[],n=[()=>wf(e),()=>Of(e),()=>jf(e,process.platform),()=>Sf(e,process.platform),()=>Af(e),()=>Rf(e,process.platform),()=>_f(e),()=>Tf(e)];for(let r of n)try{let o=r();o&&t.push(o)}catch{}return t}function Mf(e,t){let n=typeof t.orgId=="string"&&t.orgId.trim()!==""&&typeof t.orchestratorUrl=="string"&&t.orchestratorUrl.trim()!=="",r="";try{r=Le()}catch{}let o={orgId:t.orgId,orchestratorUrl:t.orchestratorUrl,mcpServerPath:r,hookCommand:"venos hook",usageSyncCommand:"venos usage-sync --throttle",...t.apiKey?{apiKey:t.apiKey}:{}},s=!1,i=!1;for(let l of xe)if(l.isInstalled(e)){s=!0;try{l.isWired(l.load(l.configPath(e)),o)&&(i=!0)}catch{}}let a=!s||i,c=ho(e);return{config_valid:n,hooks_wired:a,service_installed:c}}async function li(e={},t){let n=t??process.env.HOME??process.env.USERPROFILE??"",r=lt(n,".venos","config.json");if(!dn(r))return{machineId:"",status:"skipped-no-config",checks:{}};let o=JSON.parse(ci(r,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,c=C(n),l=x(),u=Mf(n,o),{osPlatform:d,osVersion:p}=Zt(process.platform),S=[];try{S=ai(n)}catch{S=[]}let g={orgId:s,machineId:c,hostname:l,cliVersion:e.cliVersion??"",osPlatform:d,osVersion:p,checks:u,subscriptions:S},w=`${i.replace(/\/$/,"")}/v1/inventory/heartbeat?orgId=${encodeURIComponent(s)}`,h={"Content-Type":"application/json","X-Venos-Org":s};a&&(h.Authorization=`Bearer ${a}`);let v=ln(j(o),"/v1/inventory/heartbeat",g,s),k;try{k=await A(w,{method:"POST",headers:h,body:JSON.stringify(g)},{timeoutMs:5e3})}catch(U){throw await v,U}if(!k.ok)throw await v,new Error(`venos heartbeat: orchestrator returned ${k.status}`);await v;try{cn(ui(n),new Date().toISOString())}catch{}let _=e.cliVersion??"";if(_!==""&&process.env.VENOS_SKIP_AUTOUPDATE!=="1"){if(await Df({orchestratorUrl:i,orgId:s,machineId:c,home:n}))return{machineId:c,status:"sent",checks:u};let U=await si({currentVersion:_,orchestratorUrl:i,orgId:s,home:n,machineId:c,mirrors:j(o)});if(U.failure){try{cn(un(n),new Date().toISOString())}catch{}let gn={...g,upgrade:U.failure};await Ff(w,h,gn),await ln(j(o),"/v1/inventory/heartbeat",gn,s)}else try{Hf(un(n),{force:!0})}catch{}}return{machineId:c,status:"sent",checks:u}}async function Df(e,t={}){let n=t.check??ri,r=t.report??pn,o=t.remove??Qe;try{return await n(e)?(await r(e.home),o({home:e.home}),!0):!1}catch{return!1}}async function ln(e,t,n,r){e.length!==0&&await Promise.allSettled(e.map(async o=>{let i=`${o.url.replace(/\/$/,"")}${t}?orgId=${encodeURIComponent(r)}`,a={"Content-Type":"application/json","X-Venos-Org":r};o.apiKey&&(a.Authorization=`Bearer ${o.apiKey}`);try{await(await A(i,{method:"POST",headers:a,body:JSON.stringify(n)},{timeoutMs:5e3})).text()}catch{}}))}function ui(e){return lt(e,".venos","heartbeat.last")}function un(e){return lt(e,".venos","upgrade-retry")}var Wf=5;async function Ff(e,t,n){try{await(await A(e,{method:"POST",headers:t,body:JSON.stringify(n)},{timeoutMs:5e3})).text()}catch{}}async function pn(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",n=lt(t,".venos","config.json");if(!dn(n))return{status:"skipped-no-config"};try{let r=JSON.parse(ci(n,"utf8")),o=r.orgId,s=r.orchestratorUrl;if(!o||!s)return{status:"skipped-no-config"};let i={orgId:o,machineId:C(t),hostname:x()},c=`${s.replace(/\/$/,"")}/v1/inventory/uninstall?orgId=${encodeURIComponent(o)}`,l={"Content-Type":"application/json","X-Venos-Org":o};r.apiKey&&(l.Authorization=`Bearer ${r.apiKey}`);let u=ln(j(r),"/v1/inventory/uninstall",i,o),d;try{d=(await A(c,{method:"POST",headers:l,body:JSON.stringify(i)},{timeoutMs:5e3})).ok?"sent":"error"}catch{d="error"}return await u,{status:d}}catch{return{status:"error"}}}async function di(e){let t=[["scan-mcp",()=>it(e)],["scan-skills",()=>at(e)],["scan-agents",()=>_e({home:e})],["scan-extensions",()=>st(e)],["kiro-ide-sync",()=>ae(e,n=>ce(e,n))],["aider-session-sync",()=>Ws(e,[process.cwd()],n=>Fs(e,n))],["github-copilot-ide-sync",()=>Vs(e,n=>Js(e,n))],["scan-documents",()=>Xe({home:e})]];for(let[n,r]of t)try{await r()}catch(o){let s=o instanceof Error?o.message:String(o);process.stderr.write(`venos heartbeat: ${n} inventory refresh skipped (${s})
|
|
209
|
-
`)}}function fn(e,t=60,n=$f){let r=e??process.env.HOME??process.env.USERPROFILE??"",o=ui(r),s=dn(un(r))?Math.min(t,Wf):t;if(!qt(o,s*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{cn(o,new Date().toISOString())}catch{}let i=process.argv[1]??"";return n(process.execPath,[i,"heartbeat"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}var mn="0.1.
|
|
209
|
+
`)}}function fn(e,t=60,n=$f){let r=e??process.env.HOME??process.env.USERPROFILE??"",o=ui(r),s=dn(un(r))?Math.min(t,Wf):t;if(!qt(o,s*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{cn(o,new Date().toISOString())}catch{}let i=process.argv[1]??"";return n(process.execPath,[i,"heartbeat"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}var mn="0.1.17";async function pi(){try{let e=JSON.parse(Lf(M(B()),"utf8"));if(!e.orchestratorUrl||!e.orgId)return;let t=await rn({currentVersion:mn,orchestratorUrl:e.orchestratorUrl,orgId:e.orgId,home:B(),machineId:C(B())});if(!t)return;if(t.kind==="auto"){process.stderr.write(`
|
|
210
210
|
${t.message}
|
|
211
211
|
`);let n=await on(t.targetVersion);process.stderr.write(n?`venos: updated to ${t.targetVersion}. Re-run venos to use it.
|
|
212
212
|
`:`venos: auto-update failed. Install manually: npm i -g @venos-inc/venos@${t.targetVersion}
|
|
@@ -6,9 +6,9 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/publish-cli-
|
|
9
|
+
export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules/which/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules/which/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/publish-cli-
|
|
11
|
+
export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules/which/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules/which/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/which@2.0.2/node_modules:/Users/baraklagziel/code/venos/.worktrees/publish-cli-0117/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
14
|
exec "$basedir/node" "$basedir/../../../../../which@2.0.2/node_modules/which/bin/node-which" "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venos-inc/venos",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Self-service CLI for venos — wire your AI client to the venos security gateway in one command.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@venos/host-core": "workspace:*",
|
|
29
28
|
"smol-toml": "^1.3.1"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@types/node": "^22.0.0",
|
|
32
|
+
"@venos/host-core": "workspace:*",
|
|
33
33
|
"@venos/tsconfig": "workspace:*",
|
|
34
34
|
"esbuild": "^0.25.0",
|
|
35
35
|
"typescript": "5.6.3",
|