@venos-inc/venos 0.1.6 → 0.1.7

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.
Files changed (54) hide show
  1. package/dist/index.js +45 -43
  2. package/etc/mcp-server/node_modules/@babel/core/node_modules/.bin/json5 +2 -2
  3. package/etc/mcp-server/node_modules/@babel/core/node_modules/.bin/parser +2 -2
  4. package/etc/mcp-server/node_modules/@babel/core/node_modules/.bin/semver +2 -2
  5. package/etc/mcp-server/node_modules/@babel/generator/node_modules/.bin/jsesc +2 -2
  6. package/etc/mcp-server/node_modules/@babel/generator/node_modules/.bin/parser +2 -2
  7. package/etc/mcp-server/node_modules/@babel/helper-compilation-targets/node_modules/.bin/browserslist +2 -2
  8. package/etc/mcp-server/node_modules/@babel/helper-compilation-targets/node_modules/.bin/semver +2 -2
  9. package/etc/mcp-server/node_modules/@babel/template/node_modules/.bin/parser +2 -2
  10. package/etc/mcp-server/node_modules/@babel/traverse/node_modules/.bin/parser +2 -2
  11. package/etc/mcp-server/node_modules/@eslint/eslintrc/node_modules/.bin/js-yaml +2 -2
  12. package/etc/mcp-server/node_modules/@eslint-community/eslint-utils/node_modules/.bin/eslint +2 -2
  13. package/etc/mcp-server/node_modules/@types/babel__core/node_modules/.bin/parser +2 -2
  14. package/etc/mcp-server/node_modules/@types/babel__template/node_modules/.bin/parser +2 -2
  15. package/etc/mcp-server/node_modules/@typescript-eslint/eslint-plugin/node_modules/.bin/eslint +2 -2
  16. package/etc/mcp-server/node_modules/@typescript-eslint/eslint-plugin/node_modules/.bin/tsc +2 -2
  17. package/etc/mcp-server/node_modules/@typescript-eslint/eslint-plugin/node_modules/.bin/tsserver +2 -2
  18. package/etc/mcp-server/node_modules/@typescript-eslint/parser/node_modules/.bin/eslint +2 -2
  19. package/etc/mcp-server/node_modules/@typescript-eslint/parser/node_modules/.bin/tsc +2 -2
  20. package/etc/mcp-server/node_modules/@typescript-eslint/parser/node_modules/.bin/tsserver +2 -2
  21. package/etc/mcp-server/node_modules/@typescript-eslint/project-service/node_modules/.bin/tsc +2 -2
  22. package/etc/mcp-server/node_modules/@typescript-eslint/project-service/node_modules/.bin/tsserver +2 -2
  23. package/etc/mcp-server/node_modules/@typescript-eslint/tsconfig-utils/node_modules/.bin/tsc +2 -2
  24. package/etc/mcp-server/node_modules/@typescript-eslint/tsconfig-utils/node_modules/.bin/tsserver +2 -2
  25. package/etc/mcp-server/node_modules/@typescript-eslint/type-utils/node_modules/.bin/eslint +2 -2
  26. package/etc/mcp-server/node_modules/@typescript-eslint/type-utils/node_modules/.bin/tsc +2 -2
  27. package/etc/mcp-server/node_modules/@typescript-eslint/type-utils/node_modules/.bin/tsserver +2 -2
  28. package/etc/mcp-server/node_modules/@typescript-eslint/typescript-estree/node_modules/.bin/semver +2 -2
  29. package/etc/mcp-server/node_modules/@typescript-eslint/typescript-estree/node_modules/.bin/tsc +2 -2
  30. package/etc/mcp-server/node_modules/@typescript-eslint/typescript-estree/node_modules/.bin/tsserver +2 -2
  31. package/etc/mcp-server/node_modules/@typescript-eslint/utils/node_modules/.bin/eslint +2 -2
  32. package/etc/mcp-server/node_modules/@typescript-eslint/utils/node_modules/.bin/tsc +2 -2
  33. package/etc/mcp-server/node_modules/@typescript-eslint/utils/node_modules/.bin/tsserver +2 -2
  34. package/etc/mcp-server/node_modules/@vitest/mocker/node_modules/.bin/vite +2 -2
  35. package/etc/mcp-server/node_modules/acorn-jsx/node_modules/.bin/acorn +2 -2
  36. package/etc/mcp-server/node_modules/browserslist/node_modules/.bin/baseline-browser-mapping +2 -2
  37. package/etc/mcp-server/node_modules/browserslist/node_modules/.bin/update-browserslist-db +2 -2
  38. package/etc/mcp-server/node_modules/cross-spawn/node_modules/.bin/node-which +2 -2
  39. package/etc/mcp-server/node_modules/espree/node_modules/.bin/acorn +2 -2
  40. package/etc/mcp-server/node_modules/postcss/node_modules/.bin/nanoid +2 -2
  41. package/etc/mcp-server/node_modules/sharp/node_modules/.bin/semver +2 -2
  42. package/etc/mcp-server/node_modules/ts-api-utils/node_modules/.bin/tsc +2 -2
  43. package/etc/mcp-server/node_modules/ts-api-utils/node_modules/.bin/tsserver +2 -2
  44. package/etc/mcp-server/node_modules/typescript-eslint/node_modules/.bin/eslint +2 -2
  45. package/etc/mcp-server/node_modules/typescript-eslint/node_modules/.bin/tsc +2 -2
  46. package/etc/mcp-server/node_modules/typescript-eslint/node_modules/.bin/tsserver +2 -2
  47. package/etc/mcp-server/node_modules/update-browserslist-db/node_modules/.bin/browserslist +2 -2
  48. package/etc/mcp-server/node_modules/vite/node_modules/.bin/esbuild +2 -2
  49. package/etc/mcp-server/node_modules/vite/node_modules/.bin/rollup +2 -2
  50. package/etc/mcp-server/node_modules/vite-node/node_modules/.bin/vite +2 -2
  51. package/etc/mcp-server/node_modules/vitest/node_modules/.bin/vite +2 -2
  52. package/etc/mcp-server/node_modules/vitest/node_modules/.bin/vite-node +2 -2
  53. package/etc/mcp-server/node_modules/vitest/node_modules/.bin/why-is-node-running +2 -2
  54. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{readFileSync as ci}from"node:fs";import{homedir as We}from"node:os";import{existsSync as rr,mkdirSync as ao,readFileSync as co,rmSync as lo,writeFileSync as uo}from"node:fs";import{dirname as po,join as fo}from"node:path";import{randomBytes as mo}from"node:crypto";import{existsSync as Fr,readFileSync as Dr}from"node:fs";import{join as Jr}from"node:path";import{copyFileSync as jr,existsSync as Le,mkdirSync as Vr,renameSync as Wr,writeFileSync as Lr}from"node:fs";import{dirname as Hr}from"node:path";var He=".venos-backup";function m(e,t){Vr(Hr(e),{recursive:!0}),Le(e)&&!Le(e+He)&&jr(e,e+He);let r=e+".tmp";Lr(r,t,{mode:420}),Wr(r,e)}function g(e){return JSON.stringify(e,null,2)+`
3
- `}var j="http://127.0.0.1:4000/v1";var Fe="venos",Kr="venos usage-sync --throttle";function B(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(Fe)))}function le(e,t){let r=e??[];return B(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function ue(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(Fe))})).filter(t=>t.hooks.length>0)}var de={name:"claude-code",transport:"claude-hook",configPath(e){return Jr(e,".claude","settings.json")},isInstalled(e){return!0},load(e){if(!Fr(e))return{};try{return JSON.parse(Dr(e,"utf8"))}catch{return{}}},isWired(e){return B(e.hooks?.PreToolUse)&&B(e.hooks?.PostToolUse)&&B(e.hooks?.Stop)},inject(e,t){let r=e.hooks??{};return{...e,hooks:{...r,PreToolUse:le(r.PreToolUse,t.hookCommand),PostToolUse:le(r.PostToolUse,t.hookCommand),Stop:le(r.Stop,t.usageSyncCommand??Kr)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:ue(e.hooks.PreToolUse),PostToolUse:ue(e.hooks.PostToolUse),Stop:ue(e.hooks.Stop)}}:e},write(e,t){m(e,g(t))}};import{existsSync as V,readFileSync as Br}from"node:fs";import{join as G}from"node:path";function De(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:V(r)}var pe={name:"cursor",transport:"mcp-json",configPath(e){return G(e,".cursor","mcp.json")},isInstalled(e){let t=G(e,".cursor");return V(t)?V(G(t,"mcp.json"))||V(G(t,"extensions")):!1},load(e){if(!V(e))return{};try{return JSON.parse(Br(e,"utf8"))}catch{return{}}},isWired(e){return De(e)},inject(e,t){return De(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as ve,readFileSync as cn}from"node:fs";import{join as Xe}from"node:path";function Gr(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function Yr(e,t,r){let n=e.split(/\r\n|\n|\r/g),o="",s=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let a=n[i-1];a&&(o+=i.toString().padEnd(s," "),o+=": ",o+=a,o+=`
2
+ import{readFileSync as li}from"node:fs";import{homedir as We}from"node:os";import{existsSync as nr,mkdirSync as ao,readFileSync as co,rmSync as lo,writeFileSync as uo}from"node:fs";import{dirname as po,join as fo}from"node:path";import{randomBytes as mo}from"node:crypto";import{existsSync as Fr,readFileSync as Dr}from"node:fs";import{join as Jr}from"node:path";import{copyFileSync as jr,existsSync as He,mkdirSync as Vr,renameSync as Wr,writeFileSync as Lr}from"node:fs";import{dirname as Hr}from"node:path";var Fe=".venos-backup";function m(e,t){Vr(Hr(e),{recursive:!0}),He(e)&&!He(e+Fe)&&jr(e,e+Fe);let r=e+".tmp";Lr(r,t,{mode:420}),Wr(r,e)}function g(e){return JSON.stringify(e,null,2)+`
3
+ `}var j="http://127.0.0.1:4000/v1";var De="venos",Kr="venos usage-sync --throttle";function B(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(De)))}function le(e,t){let r=e??[];return B(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function ue(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(De))})).filter(t=>t.hooks.length>0)}var de={name:"claude-code",transport:"claude-hook",configPath(e){return Jr(e,".claude","settings.json")},isInstalled(e){return!0},load(e){if(!Fr(e))return{};try{return JSON.parse(Dr(e,"utf8"))}catch{return{}}},isWired(e){return B(e.hooks?.PreToolUse)&&B(e.hooks?.PostToolUse)&&B(e.hooks?.Stop)},inject(e,t){let r=e.hooks??{};return{...e,hooks:{...r,PreToolUse:le(r.PreToolUse,t.hookCommand),PostToolUse:le(r.PostToolUse,t.hookCommand),Stop:le(r.Stop,t.usageSyncCommand??Kr)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:ue(e.hooks.PreToolUse),PostToolUse:ue(e.hooks.PostToolUse),Stop:ue(e.hooks.Stop)}}:e},write(e,t){m(e,g(t))}};import{existsSync as V,readFileSync as Br}from"node:fs";import{join as G}from"node:path";function Je(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:V(r)}var pe={name:"cursor",transport:"mcp-json",configPath(e){return G(e,".cursor","mcp.json")},isInstalled(e){let t=G(e,".cursor");return V(t)?V(G(t,"mcp.json"))||V(G(t,"extensions")):!1},load(e){if(!V(e))return{};try{return JSON.parse(Br(e,"utf8"))}catch{return{}}},isWired(e){return Je(e)},inject(e,t){return Je(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as ve,readFileSync as cn}from"node:fs";import{join as qe}from"node:path";function Gr(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function Yr(e,t,r){let n=e.split(/\r\n|\n|\r/g),o="",s=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let a=n[i-1];a&&(o+=i.toString().padEnd(s," "),o+=": ",o+=a,o+=`
4
4
  `,i===t&&(o+=" ".repeat(s+r+2),o+=`^
5
5
  `))}return o}var d=class extends Error{line;column;codeblock;constructor(t,r){let[n,o]=Gr(r.toml,r.ptr),s=Yr(r.toml,n,o);super(`Invalid TOML document: ${t}
6
6
 
@@ -9,38 +9,38 @@ ${s}`,r),this.line=n,this.column=o,this.codeblock=s}};function zr(e,t){let r=0;f
9
9
  `)return r;if(n==="\r"&&e[r+1]===`
10
10
  `)return r+1;if(n<" "&&n!==" "||n==="\x7F")throw new d("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}function h(e,t,r,n){let o;for(;;){for(;(o=e[t])===" "||o===" "||!r&&(o===`
11
11
  `||o==="\r"&&e[t+1]===`
12
- `);)t++;if(n||o!=="#")break;t=P(e,t)}return t}function Je(e,t,r,n,o=!1){if(!n)return t=Y(e,t),t<0?e.length:t;for(let s=t;s<e.length;s++){let i=e[s];if(i==="#")s=Y(e,s);else{if(i===r)return s+1;if(i===n||o&&(i===`
12
+ `);)t++;if(n||o!=="#")break;t=P(e,t)}return t}function Ke(e,t,r,n,o=!1){if(!n)return t=Y(e,t),t<0?e.length:t;for(let s=t;s<e.length;s++){let i=e[s];if(i==="#")s=Y(e,s);else{if(i===r)return s+1;if(i===n||o&&(i===`
13
13
  `||i==="\r"&&e[s+1]===`
14
- `))return s}}throw new d("cannot find end of structure",{toml:e,ptr:t})}function z(e,t){let r=e[t],n=r===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):r;t+=n.length-1;do t=e.indexOf(n,++t);while(t>-1&&r!=="'"&&zr(e,t));return t>-1&&(t+=n.length,n.length>1&&(e[t]===r&&t++,e[t]===r&&t++)),t}var Zr=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,W=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let r=!0,n=!0,o="Z";if(typeof t=="string"){let s=t.match(Zr);s?(s[1]||(r=!1,t=`0000-01-01T${t}`),n=!!s[2],n&&t[10]===" "&&(t=t.replace(" ","T")),s[2]&&+s[2]>23?t="":(o=s[3]||null,t=t.toUpperCase(),!o&&n&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=o)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let n=new e(t);return n.#e=r,n}static wrapAsLocalDateTime(t){let r=new e(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new e(t);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new e(t);return r.#t=!1,r.#e=null,r}};var Xr=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,qr=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Qr=/^[+-]?0[0-9_]/,en=/^[0-9a-f]{2,8}$/i,Ke={b:"\b",t:" ",n:`
14
+ `))return s}}throw new d("cannot find end of structure",{toml:e,ptr:t})}function z(e,t){let r=e[t],n=r===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):r;t+=n.length-1;do t=e.indexOf(n,++t);while(t>-1&&r!=="'"&&zr(e,t));return t>-1&&(t+=n.length,n.length>1&&(e[t]===r&&t++,e[t]===r&&t++)),t}var Zr=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,W=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let r=!0,n=!0,o="Z";if(typeof t=="string"){let s=t.match(Zr);s?(s[1]||(r=!1,t=`0000-01-01T${t}`),n=!!s[2],n&&t[10]===" "&&(t=t.replace(" ","T")),s[2]&&+s[2]>23?t="":(o=s[3]||null,t=t.toUpperCase(),!o&&n&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=o)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let n=new e(t);return n.#e=r,n}static wrapAsLocalDateTime(t){let r=new e(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new e(t);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new e(t);return r.#t=!1,r.#e=null,r}};var Xr=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,qr=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Qr=/^[+-]?0[0-9_]/,en=/^[0-9a-f]{2,8}$/i,Be={b:"\b",t:" ",n:`
15
15
  `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Z(e,t=0,r=e.length){let n=e[t]==="'",o=e[t++]===e[t]&&e[t]===e[t+1];o&&(r-=2,e[t+=2]==="\r"&&t++,e[t]===`
16
16
  `&&t++);let s=0,i,a="",l=t;for(;t<r-1;){let c=e[t++];if(c===`
17
17
  `||c==="\r"&&e[t]===`
18
18
  `){if(!o)throw new d("newlines are not allowed in strings",{toml:e,ptr:t-1})}else if(c<" "&&c!==" "||c==="\x7F")throw new d("control characters are not allowed in strings",{toml:e,ptr:t-1});if(i){if(i=!1,c==="x"||c==="u"||c==="U"){let u=e.slice(t,t+=c==="x"?2:c==="u"?4:8);if(!en.test(u))throw new d("invalid unicode escape",{toml:e,ptr:s});try{a+=String.fromCodePoint(parseInt(u,16))}catch{throw new d("invalid unicode escape",{toml:e,ptr:s})}}else if(o&&(c===`
19
19
  `||c===" "||c===" "||c==="\r")){if(t=h(e,t-1,!0),e[t]!==`
20
- `&&e[t]!=="\r")throw new d("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:s});t=h(e,t)}else if(c in Ke)a+=Ke[c];else throw new d("unrecognized escape sequence",{toml:e,ptr:s});l=t}else!n&&c==="\\"&&(s=t-1,i=!0,a+=e.slice(l,s))}return a+e.slice(l,r-1)}function Be(e,t,r,n){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return n?0n:0;let o=Xr.test(e);if(o||qr.test(e)){if(Qr.test(e))throw new d("leading zeroes are not allowed",{toml:t,ptr:r});e=e.replace(/_/g,"");let i=+e;if(isNaN(i))throw new d("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(i))&&!n)throw new d("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||n===!0)&&(i=BigInt(e))}return i}let s=new W(e);if(!s.isValid())throw new d("invalid value",{toml:t,ptr:r});return s}function tn(e,t,r){let n=e.slice(t,r),o=n.indexOf("#");return o>-1&&(P(e,o),n=n.slice(0,o)),[n.trimEnd(),o]}function L(e,t,r,n,o){if(n===0)throw new d("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let s=e[t];if(s==="["||s==="{"){let[l,c]=s==="["?Ye(e,t,n,o):Ge(e,t,n,o);if(r){if(c=h(e,c),e[c]===",")c++;else if(e[c]!==r)throw new d("expected comma or end of structure",{toml:e,ptr:c})}return[l,c]}let i;if(s==='"'||s==="'"){i=z(e,t);let l=Z(e,t,i);if(r){if(i=h(e,i),e[i]&&e[i]!==","&&e[i]!==r&&e[i]!==`
21
- `&&e[i]!=="\r")throw new d("unexpected character encountered",{toml:e,ptr:i});i+=+(e[i]===",")}return[l,i]}i=Je(e,t,",",r);let a=tn(e,t,i-+(e[i-1]===","));if(!a[0])throw new d("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return r&&a[1]>-1&&(i=h(e,t+a[1]),i+=+(e[i]===",")),[Be(a[0],e,t,o),i]}var rn=/^[a-zA-Z0-9-_]+[ \t]*$/;function X(e,t,r="="){let n=t-1,o=[],s=e.indexOf(r,t);if(s<0)throw new d("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let i=e[t=++n];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===e[t+1]&&i===e[t+2])throw new d("multiline strings are not allowed in keys",{toml:e,ptr:t});let a=z(e,t);if(a<0)throw new d("unfinished string encountered",{toml:e,ptr:t});n=e.indexOf(".",a);let l=e.slice(a,n<0||n>s?s:n),c=Y(l);if(c>-1)throw new d("newlines are not allowed in keys",{toml:e,ptr:t+n+c});if(l.trimStart())throw new d("found extra tokens after the string part",{toml:e,ptr:a});if(s<a&&(s=e.indexOf(r,a),s<0))throw new d("incomplete key-value: cannot find end of key",{toml:e,ptr:t});o.push(Z(e,t,a))}else{n=e.indexOf(".",t);let a=e.slice(t,n<0||n>s?s:n);if(!rn.test(a))throw new d("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});o.push(a.trimEnd())}}while(n+1&&n<s);return[o,h(e,s+1,!0,!0)]}function Ge(e,t,r,n){let o={},s=new Set,i;for(t++;(i=e[t++])!=="}"&&i;){if(i===",")throw new d("expected value, found comma",{toml:e,ptr:t-1});if(i==="#")t=P(e,t);else if(i!==" "&&i!==" "&&i!==`
22
- `&&i!=="\r"){let a,l=o,c=!1,[u,p]=X(e,t-1);for(let O=0;O<u.length;O++){if(O&&(l=c?l[a]:l[a]={}),a=u[O],(c=Object.hasOwn(l,a))&&(typeof l[a]!="object"||s.has(l[a])))throw new d("trying to redefine an already defined value",{toml:e,ptr:t});!c&&a==="__proto__"&&Object.defineProperty(l,a,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new d("trying to redefine an already defined value",{toml:e,ptr:t});let[f,k]=L(e,p,"}",r-1,n);s.add(f),l[a]=f,t=k}}if(!i)throw new d("unfinished table encountered",{toml:e,ptr:t});return[o,t]}function Ye(e,t,r,n){let o=[],s;for(t++;(s=e[t++])!=="]"&&s;){if(s===",")throw new d("expected value, found comma",{toml:e,ptr:t-1});if(s==="#")t=P(e,t);else if(s!==" "&&s!==" "&&s!==`
23
- `&&s!=="\r"){let i=L(e,t-1,"]",r-1,n);o.push(i[0]),t=i[1]}}if(!s)throw new d("unfinished array encountered",{toml:e,ptr:t});return[o,t]}function ze(e,t,r,n){let o=t,s=r,i,a=!1,l;for(let c=0;c<e.length;c++){if(c){if(o=a?o[i]:o[i]={},s=(l=s[i]).c,n===0&&(l.t===1||l.t===2))return null;if(l.t===2){let u=o.length-1;o=o[u],s=s[u].c}}if(i=e[c],(a=Object.hasOwn(o,i))&&s[i]?.t===0&&s[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,i,{enumerable:!0,configurable:!0,writable:!0})),s[i]={t:c<e.length-1&&n===2?3:n,d:!1,i:0,c:{}})}if(l=s[i],l.t!==n&&!(n===1&&l.t===3)||(n===2&&(l.d||(l.d=!0,o[i]=[]),o[i].push(o={}),l.c[l.i++]=l={t:1,d:!1,i:0,c:{}}),l.d))return null;if(l.d=!0,n===1)o=a?o[i]:o[i]={};else if(n===0&&a)return null;return[i,o,l.c]}function fe(e,{maxDepth:t=1e3,integersAsBigInt:r}={}){let n={},o={},s=n,i=o;for(let a=h(e,0);a<e.length;){if(e[a]==="["){let l=e[++a]==="[",c=X(e,a+=+l,"]");if(l){if(e[c[1]-1]!=="]")throw new d("expected end of table declaration",{toml:e,ptr:c[1]-1});c[1]++}let u=ze(c[0],n,o,l?2:1);if(!u)throw new d("trying to redefine an already defined table or value",{toml:e,ptr:a});i=u[2],s=u[1],a=c[1]}else{let l=X(e,a),c=ze(l[0],s,i,0);if(!c)throw new d("trying to redefine an already defined table or value",{toml:e,ptr:a});let u=L(e,l[1],void 0,t,r);c[1][c[0]]=u[0],a=u[1]}if(a=h(e,a,!0),e[a]&&e[a]!==`
24
- `&&e[a]!=="\r")throw new d("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:a});a=h(e,a)}return n}var Ze=/^[a-z0-9-_]+$/i;function H(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function nn(e){for(let t=0;t<e.length;t++)if(H(e[t])!=="object")return!1;return e.length!=0}function me(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function ge(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":n&&Number.isInteger(e)?e.toFixed(1):e.toString();if(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return me(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return on(e,r,n);if(t==="array")return sn(e,r,n)}function on(e,t,r){let n=Object.keys(e);if(n.length===0)return"{}";let o="{ ";for(let s=0;s<n.length;s++){let i=n[s];s&&(o+=", "),o+=Ze.test(i)?i:me(i),o+=" = ",o+=ge(e[i],H(e[i]),t-1,r)}return o+" }"}function sn(e,t,r){if(e.length===0)return"[]";let n="[ ";for(let o=0;o<e.length;o++){if(o&&(n+=", "),e[o]===null||e[o]===void 0)throw new TypeError("arrays cannot contain null or undefined values");n+=ge(e[o],H(e[o]),t-1,r)}return n+" ]"}function an(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let o="";for(let s=0;s<e.length;s++)o+=`${o&&`
20
+ `&&e[t]!=="\r")throw new d("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:s});t=h(e,t)}else if(c in Be)a+=Be[c];else throw new d("unrecognized escape sequence",{toml:e,ptr:s});l=t}else!n&&c==="\\"&&(s=t-1,i=!0,a+=e.slice(l,s))}return a+e.slice(l,r-1)}function Ge(e,t,r,n){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return n?0n:0;let o=Xr.test(e);if(o||qr.test(e)){if(Qr.test(e))throw new d("leading zeroes are not allowed",{toml:t,ptr:r});e=e.replace(/_/g,"");let i=+e;if(isNaN(i))throw new d("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(i))&&!n)throw new d("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||n===!0)&&(i=BigInt(e))}return i}let s=new W(e);if(!s.isValid())throw new d("invalid value",{toml:t,ptr:r});return s}function tn(e,t,r){let n=e.slice(t,r),o=n.indexOf("#");return o>-1&&(P(e,o),n=n.slice(0,o)),[n.trimEnd(),o]}function L(e,t,r,n,o){if(n===0)throw new d("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let s=e[t];if(s==="["||s==="{"){let[l,c]=s==="["?ze(e,t,n,o):Ye(e,t,n,o);if(r){if(c=h(e,c),e[c]===",")c++;else if(e[c]!==r)throw new d("expected comma or end of structure",{toml:e,ptr:c})}return[l,c]}let i;if(s==='"'||s==="'"){i=z(e,t);let l=Z(e,t,i);if(r){if(i=h(e,i),e[i]&&e[i]!==","&&e[i]!==r&&e[i]!==`
21
+ `&&e[i]!=="\r")throw new d("unexpected character encountered",{toml:e,ptr:i});i+=+(e[i]===",")}return[l,i]}i=Ke(e,t,",",r);let a=tn(e,t,i-+(e[i-1]===","));if(!a[0])throw new d("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return r&&a[1]>-1&&(i=h(e,t+a[1]),i+=+(e[i]===",")),[Ge(a[0],e,t,o),i]}var rn=/^[a-zA-Z0-9-_]+[ \t]*$/;function X(e,t,r="="){let n=t-1,o=[],s=e.indexOf(r,t);if(s<0)throw new d("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let i=e[t=++n];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===e[t+1]&&i===e[t+2])throw new d("multiline strings are not allowed in keys",{toml:e,ptr:t});let a=z(e,t);if(a<0)throw new d("unfinished string encountered",{toml:e,ptr:t});n=e.indexOf(".",a);let l=e.slice(a,n<0||n>s?s:n),c=Y(l);if(c>-1)throw new d("newlines are not allowed in keys",{toml:e,ptr:t+n+c});if(l.trimStart())throw new d("found extra tokens after the string part",{toml:e,ptr:a});if(s<a&&(s=e.indexOf(r,a),s<0))throw new d("incomplete key-value: cannot find end of key",{toml:e,ptr:t});o.push(Z(e,t,a))}else{n=e.indexOf(".",t);let a=e.slice(t,n<0||n>s?s:n);if(!rn.test(a))throw new d("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});o.push(a.trimEnd())}}while(n+1&&n<s);return[o,h(e,s+1,!0,!0)]}function Ye(e,t,r,n){let o={},s=new Set,i;for(t++;(i=e[t++])!=="}"&&i;){if(i===",")throw new d("expected value, found comma",{toml:e,ptr:t-1});if(i==="#")t=P(e,t);else if(i!==" "&&i!==" "&&i!==`
22
+ `&&i!=="\r"){let a,l=o,c=!1,[u,p]=X(e,t-1);for(let O=0;O<u.length;O++){if(O&&(l=c?l[a]:l[a]={}),a=u[O],(c=Object.hasOwn(l,a))&&(typeof l[a]!="object"||s.has(l[a])))throw new d("trying to redefine an already defined value",{toml:e,ptr:t});!c&&a==="__proto__"&&Object.defineProperty(l,a,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new d("trying to redefine an already defined value",{toml:e,ptr:t});let[f,k]=L(e,p,"}",r-1,n);s.add(f),l[a]=f,t=k}}if(!i)throw new d("unfinished table encountered",{toml:e,ptr:t});return[o,t]}function ze(e,t,r,n){let o=[],s;for(t++;(s=e[t++])!=="]"&&s;){if(s===",")throw new d("expected value, found comma",{toml:e,ptr:t-1});if(s==="#")t=P(e,t);else if(s!==" "&&s!==" "&&s!==`
23
+ `&&s!=="\r"){let i=L(e,t-1,"]",r-1,n);o.push(i[0]),t=i[1]}}if(!s)throw new d("unfinished array encountered",{toml:e,ptr:t});return[o,t]}function Ze(e,t,r,n){let o=t,s=r,i,a=!1,l;for(let c=0;c<e.length;c++){if(c){if(o=a?o[i]:o[i]={},s=(l=s[i]).c,n===0&&(l.t===1||l.t===2))return null;if(l.t===2){let u=o.length-1;o=o[u],s=s[u].c}}if(i=e[c],(a=Object.hasOwn(o,i))&&s[i]?.t===0&&s[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,i,{enumerable:!0,configurable:!0,writable:!0})),s[i]={t:c<e.length-1&&n===2?3:n,d:!1,i:0,c:{}})}if(l=s[i],l.t!==n&&!(n===1&&l.t===3)||(n===2&&(l.d||(l.d=!0,o[i]=[]),o[i].push(o={}),l.c[l.i++]=l={t:1,d:!1,i:0,c:{}}),l.d))return null;if(l.d=!0,n===1)o=a?o[i]:o[i]={};else if(n===0&&a)return null;return[i,o,l.c]}function fe(e,{maxDepth:t=1e3,integersAsBigInt:r}={}){let n={},o={},s=n,i=o;for(let a=h(e,0);a<e.length;){if(e[a]==="["){let l=e[++a]==="[",c=X(e,a+=+l,"]");if(l){if(e[c[1]-1]!=="]")throw new d("expected end of table declaration",{toml:e,ptr:c[1]-1});c[1]++}let u=Ze(c[0],n,o,l?2:1);if(!u)throw new d("trying to redefine an already defined table or value",{toml:e,ptr:a});i=u[2],s=u[1],a=c[1]}else{let l=X(e,a),c=Ze(l[0],s,i,0);if(!c)throw new d("trying to redefine an already defined table or value",{toml:e,ptr:a});let u=L(e,l[1],void 0,t,r);c[1][c[0]]=u[0],a=u[1]}if(a=h(e,a,!0),e[a]&&e[a]!==`
24
+ `&&e[a]!=="\r")throw new d("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:a});a=h(e,a)}return n}var Xe=/^[a-z0-9-_]+$/i;function H(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function nn(e){for(let t=0;t<e.length;t++)if(H(e[t])!=="object")return!1;return e.length!=0}function me(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function ge(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":n&&Number.isInteger(e)?e.toFixed(1):e.toString();if(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return me(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return on(e,r,n);if(t==="array")return sn(e,r,n)}function on(e,t,r){let n=Object.keys(e);if(n.length===0)return"{}";let o="{ ";for(let s=0;s<n.length;s++){let i=n[s];s&&(o+=", "),o+=Xe.test(i)?i:me(i),o+=" = ",o+=ge(e[i],H(e[i]),t-1,r)}return o+" }"}function sn(e,t,r){if(e.length===0)return"[]";let n="[ ";for(let o=0;o<e.length;o++){if(o&&(n+=", "),e[o]===null||e[o]===void 0)throw new TypeError("arrays cannot contain null or undefined values");n+=ge(e[o],H(e[o]),t-1,r)}return n+" ]"}function an(e,t,r,n){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let o="";for(let s=0;s<e.length;s++)o+=`${o&&`
25
25
  `}[[${t}]]
26
- `,o+=he(0,e[s],t,r,n);return o}function he(e,t,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let s="",i="",a=Object.keys(t);for(let l=0;l<a.length;l++){let c=a[l];if(t[c]!==null&&t[c]!==void 0){let u=H(t[c]);if(u==="symbol"||u==="function")throw new TypeError(`cannot serialize values of type '${u}'`);let p=Ze.test(c)?c:me(c);if(u==="array"&&nn(t[c]))i+=(i&&`
26
+ `,o+=he(0,e[s],t,r,n);return o}function he(e,t,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let s="",i="",a=Object.keys(t);for(let l=0;l<a.length;l++){let c=a[l];if(t[c]!==null&&t[c]!==void 0){let u=H(t[c]);if(u==="symbol"||u==="function")throw new TypeError(`cannot serialize values of type '${u}'`);let p=Xe.test(c)?c:me(c);if(u==="array"&&nn(t[c]))i+=(i&&`
27
27
  `)+an(t[c],r?`${r}.${p}`:p,n-1,o);else if(u==="object"){let f=r?`${r}.${p}`:p;i+=(i&&`
28
28
  `)+he(f,t[c],f,n-1,o)}else s+=p,s+=" = ",s+=ge(t[c],u,n,o),s+=`
29
29
  `}}return e&&(s||!i)&&(s=s?`[${e}]
30
30
  ${s}`:`[${e}]`),s&&i?`${s}
31
31
  ${i}`:s||i}function ye(e,{maxDepth:t=1e3,numbersAsFloat:r=!1}={}){if(H(e)!=="object")throw new TypeError("stringify can only be called with an object");let n=he(0,e,"",t,r);return n[n.length-1]!==`
32
32
  `?n+`
33
- `:n}function qe(e){let t=e.mcp_servers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:ve(r)}var Qe={name:"codex",transport:"mcp-toml",configPath(e){return Xe(e,".codex","config.toml")},isInstalled(e){return ve(Xe(e,".codex"))},load(e){if(!ve(e))return{};try{return fe(cn(e,"utf8"))}catch{return{}}},isWired(e){return qe(e)},inject(e,t){return qe(e)?e:{...e,mcp_servers:{...e.mcp_servers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{},VENOS_SOURCE:"codex"}}}}},remove(e){if(!e.mcp_servers?.venos)return e;let{venos:t,...r}=e.mcp_servers;return{...e,mcp_servers:r}},write(e,t){m(e,ye(t)+`
34
- `)}};import{existsSync as et,readFileSync as ln}from"node:fs";import{join as tt}from"node:path";var ot="venos";function Se(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(ot)))}function rt(e,t){let r=e??[];return Se(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function nt(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(ot))})).filter(t=>t.hooks.length>0)}function un(e){return`${e.hookCommand} --source codex`}var st={name:"codex-hook",transport:"claude-hook",configPath(e){return tt(e,".codex","hooks.json")},isInstalled(e){return et(tt(e,".codex"))},load(e){if(!et(e))return{};try{return JSON.parse(ln(e,"utf8"))}catch{return{}}},isWired(e){return Se(e.hooks?.PreToolUse)&&Se(e.hooks?.PostToolUse)},inject(e,t){let r=e.hooks??{},n=un(t);return{...e,hooks:{...r,PreToolUse:rt(r.PreToolUse,n),PostToolUse:rt(r.PostToolUse,n)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:nt(e.hooks.PreToolUse),PostToolUse:nt(e.hooks.PostToolUse)}}:e},write(e,t){m(e,g(t))}};import{existsSync as we,readFileSync as dn}from"node:fs";import{join as it}from"node:path";function at(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:we(r)}var ct={name:"windsurf",transport:"mcp-json",configPath(e){return it(e,".codeium","windsurf","mcp_config.json")},isInstalled(e){return we(it(e,".codeium","windsurf"))},load(e){if(!we(e))return{};try{return JSON.parse(dn(e,"utf8"))}catch{return{}}},isWired(e){return at(e)},inject(e,t){return at(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as ke,readFileSync as pn}from"node:fs";import{join as E}from"node:path";var lt="saoudrizwan.claude-dev",fn="cline_mcp_settings.json";function ut(e){if(process.platform==="darwin")return E(e,"Library","Application Support","Code","User");if(process.platform==="win32"){let t=process.env.APPDATA??E(e,"AppData","Roaming");return E(t,"Code","User")}return E(e,".config","Code","User")}function dt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:ke(r)}var pt={name:"cline",transport:"mcp-json",configPath(e){return E(ut(e),"globalStorage",lt,"settings",fn)},isInstalled(e){return ke(E(ut(e),"globalStorage",lt))},load(e){if(!ke(e))return{};try{return JSON.parse(pn(e,"utf8"))}catch{return{}}},isWired(e){return dt(e)},inject(e,t){return dt(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as Ce,readFileSync as mn}from"node:fs";import{join as ft}from"node:path";function mt(e){let t=e.context_servers?.venos;if(!t||t.command?.path!=="node")return!1;let r=t.command.args?.[0];return!r||r.includes("/A2A/")?!1:Ce(r)}var gt={name:"zed",transport:"mcp-json",configPath(e){return ft(e,".config","zed","settings.json")},isInstalled(e){return Ce(ft(e,".config","zed"))},load(e){if(!Ce(e))return{};try{return JSON.parse(mn(e,"utf8"))}catch{return{}}},isWired(e){return mt(e)},inject(e,t){return mt(e)?e:{...e,context_servers:{...e.context_servers??{},venos:{command:{path:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}},settings:{}}}}},remove(e){if(!e.context_servers?.venos)return e;let{venos:t,...r}=e.context_servers;return{...e,context_servers:r}},write(e,t){m(e,g(t))}};import{existsSync as xe,readFileSync as gn}from"node:fs";import{join as ht}from"node:path";function yt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:xe(r)}var vt={name:"jetbrains",transport:"mcp-json",configPath(e){return ht(e,".junie","mcp","mcp.json")},isInstalled(e){return xe(ht(e,".junie"))},load(e){if(!xe(e))return{};try{return JSON.parse(gn(e,"utf8"))}catch{return{}}},isWired(e){return yt(e)},inject(e,t){return yt(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as St,readFileSync as hn,rmSync as yn}from"node:fs";import{join as vn}from"node:path";var Sn="openai-api-base",wn=".aider.conf.yml";function wt(){return`${Sn}: ${j}`}function kn(e){return/^\s*openai-api-base\s*:/.test(e)}var kt={name:"aider",transport:"mcp-json",configPath(e){return vn(e,wn)},isInstalled(){return!0},load(e){let t=St(e)?hn(e,"utf8"):"";return{wired:t.split(`
35
- `).some(n=>n.trim()===wt()),raw:t}},isWired(e){return e.wired},inject(e){return e.wired?e:{...e,wired:!0}},remove(e){return{...e,wired:!1}},write(e,t){let r=t.raw===""?[]:t.raw.split(`
36
- `);r.length>0&&r[r.length-1]===""&&r.pop();let n=r.filter(s=>!kn(s)),o=t.wired?[...n,wt()]:n;if(o.length===0){St(e)&&yn(e,{force:!0});return}m(e,o.join(`
33
+ `:n}function Qe(e){let t=e.mcp_servers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:ve(r)}var et={name:"codex",transport:"mcp-toml",configPath(e){return qe(e,".codex","config.toml")},isInstalled(e){return ve(qe(e,".codex"))},load(e){if(!ve(e))return{};try{return fe(cn(e,"utf8"))}catch{return{}}},isWired(e){return Qe(e)},inject(e,t){return Qe(e)?e:{...e,mcp_servers:{...e.mcp_servers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{},VENOS_SOURCE:"codex"}}}}},remove(e){if(!e.mcp_servers?.venos)return e;let{venos:t,...r}=e.mcp_servers;return{...e,mcp_servers:r}},write(e,t){m(e,ye(t)+`
34
+ `)}};import{existsSync as tt,readFileSync as ln}from"node:fs";import{join as rt}from"node:path";var st="venos";function Se(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(st)))}function nt(e,t){let r=e??[];return Se(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function ot(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(st))})).filter(t=>t.hooks.length>0)}function un(e){return`${e.hookCommand} --source codex`}var it={name:"codex-hook",transport:"claude-hook",configPath(e){return rt(e,".codex","hooks.json")},isInstalled(e){return tt(rt(e,".codex"))},load(e){if(!tt(e))return{};try{return JSON.parse(ln(e,"utf8"))}catch{return{}}},isWired(e){return Se(e.hooks?.PreToolUse)&&Se(e.hooks?.PostToolUse)},inject(e,t){let r=e.hooks??{},n=un(t);return{...e,hooks:{...r,PreToolUse:nt(r.PreToolUse,n),PostToolUse:nt(r.PostToolUse,n)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:ot(e.hooks.PreToolUse),PostToolUse:ot(e.hooks.PostToolUse)}}:e},write(e,t){m(e,g(t))}};import{existsSync as we,readFileSync as dn}from"node:fs";import{join as at}from"node:path";function ct(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:we(r)}var lt={name:"windsurf",transport:"mcp-json",configPath(e){return at(e,".codeium","windsurf","mcp_config.json")},isInstalled(e){return we(at(e,".codeium","windsurf"))},load(e){if(!we(e))return{};try{return JSON.parse(dn(e,"utf8"))}catch{return{}}},isWired(e){return ct(e)},inject(e,t){return ct(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as ke,readFileSync as pn}from"node:fs";import{join as E}from"node:path";var ut="saoudrizwan.claude-dev",fn="cline_mcp_settings.json";function dt(e){if(process.platform==="darwin")return E(e,"Library","Application Support","Code","User");if(process.platform==="win32"){let t=process.env.APPDATA??E(e,"AppData","Roaming");return E(t,"Code","User")}return E(e,".config","Code","User")}function pt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:ke(r)}var ft={name:"cline",transport:"mcp-json",configPath(e){return E(dt(e),"globalStorage",ut,"settings",fn)},isInstalled(e){return ke(E(dt(e),"globalStorage",ut))},load(e){if(!ke(e))return{};try{return JSON.parse(pn(e,"utf8"))}catch{return{}}},isWired(e){return pt(e)},inject(e,t){return pt(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as Ce,readFileSync as mn}from"node:fs";import{join as mt}from"node:path";function gt(e){let t=e.context_servers?.venos;if(!t||t.command?.path!=="node")return!1;let r=t.command.args?.[0];return!r||r.includes("/A2A/")?!1:Ce(r)}var ht={name:"zed",transport:"mcp-json",configPath(e){return mt(e,".config","zed","settings.json")},isInstalled(e){return Ce(mt(e,".config","zed"))},load(e){if(!Ce(e))return{};try{return JSON.parse(mn(e,"utf8"))}catch{return{}}},isWired(e){return gt(e)},inject(e,t){return gt(e)?e:{...e,context_servers:{...e.context_servers??{},venos:{command:{path:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}},settings:{}}}}},remove(e){if(!e.context_servers?.venos)return e;let{venos:t,...r}=e.context_servers;return{...e,context_servers:r}},write(e,t){m(e,g(t))}};import{existsSync as xe,readFileSync as gn}from"node:fs";import{join as yt}from"node:path";function vt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:xe(r)}var St={name:"jetbrains",transport:"mcp-json",configPath(e){return yt(e,".junie","mcp","mcp.json")},isInstalled(e){return xe(yt(e,".junie"))},load(e){if(!xe(e))return{};try{return JSON.parse(gn(e,"utf8"))}catch{return{}}},isWired(e){return vt(e)},inject(e,t){return vt(e)?e:{...e,mcpServers:{...e.mcpServers??{},venos:{command:"node",args:[t.mcpServerPath],env:{VENOS_URL:t.orchestratorUrl,VENOS_ORG_ID:t.orgId,...t.apiKey?{VENOS_API_KEY:t.apiKey}:{}}}}}},remove(e){if(!e.mcpServers?.venos)return e;let{venos:t,...r}=e.mcpServers;return{...e,mcpServers:r}},write(e,t){m(e,g(t))}};import{existsSync as wt,readFileSync as hn,rmSync as yn}from"node:fs";import{join as vn}from"node:path";var Sn="openai-api-base",wn=".aider.conf.yml";function kt(){return`${Sn}: ${j}`}function kn(e){return/^\s*openai-api-base\s*:/.test(e)}var Ct={name:"aider",transport:"mcp-json",configPath(e){return vn(e,wn)},isInstalled(){return!0},load(e){let t=wt(e)?hn(e,"utf8"):"";return{wired:t.split(`
35
+ `).some(n=>n.trim()===kt()),raw:t}},isWired(e){return e.wired},inject(e){return e.wired?e:{...e,wired:!0}},remove(e){return{...e,wired:!1}},write(e,t){let r=t.raw===""?[]:t.raw.split(`
36
+ `);r.length>0&&r[r.length-1]===""&&r.pop();let n=r.filter(s=>!kn(s)),o=t.wired?[...n,kt()]:n;if(o.length===0){wt(e)&&yn(e,{force:!0});return}m(e,o.join(`
37
37
  `)+`
38
- `)}};import{accessSync as Cn,constants as xn,existsSync as xt,readFileSync as bn}from"node:fs";import{delimiter as On}from"node:path";import{join as bt}from"node:path";var Pn="obsidian-cli",En="obsidian-cli.json";function In(e){try{return Cn(e,xn.X_OK),!0}catch{return!1}}function Rn(e){return(process.env.PATH??"").split(On).some(r=>{if(r.trim()==="")return!1;let n=bt(r,e);return xt(n)&&In(n)})}function Ct(e){return e.venos?.source==="obsidian-cli"&&e.venos.wired===!0}var Ot={name:"obsidian-cli",transport:"mcp-json",configPath(e){return bt(e,".venos",En)},isInstalled(){return Rn(Pn)},load(e){if(!xt(e))return{};try{return JSON.parse(bn(e,"utf8"))}catch{return{}}},isWired(e){return Ct(e)},inject(e,t){return Ct(e)?e:{...e,venos:{source:"obsidian-cli",orgId:t.orgId,orchestratorUrl:t.orchestratorUrl,wired:!0}}},remove(e){if(!e.venos)return e;let t={...e};return delete t.venos,t},write(e,t){m(e,g(t))}};var F=[de,pe,Qe,st,ct,pt,gt,vt,kt,Ot];import{existsSync as be}from"node:fs";import{dirname as Tn,join as Pt,resolve as Oe}from"node:path";import{fileURLToPath as An}from"node:url";var Et=Tn(An(import.meta.url));function q(){let e=process.env.VENOS_MCP_SERVER_PATH;if(e&&be(e))return Oe(e);let t=Oe(Pt(Et,"..","etc","mcp-server","bin.js"));if(be(t))return t;let r=Oe(Pt(Et,"..","..","..","packages","mcp-server","dist","bin.js"));if(be(r))return r;throw new Error(`venos: bundled mcp-server not found. Tried:
38
+ `)}};import{accessSync as Cn,constants as xn,existsSync as bt,readFileSync as bn}from"node:fs";import{delimiter as On}from"node:path";import{join as Ot}from"node:path";var Pn="obsidian-cli",En="obsidian-cli.json";function In(e){try{return Cn(e,xn.X_OK),!0}catch{return!1}}function Rn(e){return(process.env.PATH??"").split(On).some(r=>{if(r.trim()==="")return!1;let n=Ot(r,e);return bt(n)&&In(n)})}function xt(e){return e.venos?.source==="obsidian-cli"&&e.venos.wired===!0}var Pt={name:"obsidian-cli",transport:"mcp-json",configPath(e){return Ot(e,".venos",En)},isInstalled(){return Rn(Pn)},load(e){if(!bt(e))return{};try{return JSON.parse(bn(e,"utf8"))}catch{return{}}},isWired(e){return xt(e)},inject(e,t){return xt(e)?e:{...e,venos:{source:"obsidian-cli",orgId:t.orgId,orchestratorUrl:t.orchestratorUrl,wired:!0}}},remove(e){if(!e.venos)return e;let t={...e};return delete t.venos,t},write(e,t){m(e,g(t))}};var F=[de,pe,et,it,lt,ft,ht,St,Ct,Pt];import{existsSync as be}from"node:fs";import{dirname as Tn,join as Et,resolve as Oe}from"node:path";import{fileURLToPath as An}from"node:url";var It=Tn(An(import.meta.url));function q(){let e=process.env.VENOS_MCP_SERVER_PATH;if(e&&be(e))return Oe(e);let t=Oe(Et(It,"..","etc","mcp-server","bin.js"));if(be(t))return t;let r=Oe(Et(It,"..","..","..","packages","mcp-server","dist","bin.js"));if(be(r))return r;throw new Error(`venos: bundled mcp-server not found. Tried:
39
39
  VENOS_MCP_SERVER_PATH=${e??"(unset)"}
40
40
  bundled: ${t}
41
41
  sibling: ${r}
42
- If you are developing locally, run: pnpm --filter @venos/mcp-server build`)}import{existsSync as _n}from"node:fs";function Un(e,t,r){let n=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};try{let o=e.load(n);if(e.isWired(o,r))return{client:e.name,transport:e.transport,status:"already-wired",path:n};let s=e.inject(o,r);return e.write(n,s),{client:e.name,transport:e.transport,status:"wired",path:n}}catch(o){return{client:e.name,transport:e.transport,status:"error",path:n,error:o instanceof Error?o.message:String(o)}}}function It(e,t,r){return r.map(n=>Un(n,e,t))}function Nn(e,t){let r=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};if(!_n(r))return{client:e.name,transport:e.transport,status:"already-removed",path:r};try{let n=e.load(r),o=e.remove(n);return JSON.stringify(o)===JSON.stringify(n)?{client:e.name,transport:e.transport,status:"already-removed",path:r}:(e.write(r,o),{client:e.name,transport:e.transport,status:"removed",path:r})}catch(n){return{client:e.name,transport:e.transport,status:"error",path:r,error:n instanceof Error?n.message:String(n)}}}function Rt(e,t){return t.map(r=>Nn(r,e))}import{existsSync as Tt,mkdirSync as Mn,readFileSync as $n}from"node:fs";import{join as At}from"node:path";var _t="cline.openaiBaseUrl";function Ut(e){let t=At(e,".vscode");if(!Tt(t))return{status:"no-workspace"};let r=At(t,"settings.json"),n={};if(Tt(r))try{let o=JSON.parse($n(r,"utf8"));o&&typeof o=="object"&&(n=o)}catch{}return n[_t]===j?{status:"already-wired",path:r}:(Mn(t,{recursive:!0}),m(r,g({...n,[_t]:j})),{status:"wired",path:r})}import{execFileSync as to}from"node:child_process";import{existsSync as Mt,mkdirSync as Dn,rmSync as Jn,writeFileSync as Kn}from"node:fs";import{dirname as Bn,join as Gn}from"node:path";var Pe="ai.venos.agent";import{existsSync as Nt,mkdirSync as jn,rmSync as Vn,writeFileSync as Wn}from"node:fs";import{dirname as Ln,join as Hn}from"node:path";function Ee(e){return Hn(e,".venos","service.json")}function I(e,t){let r=Ee(e);jn(Ln(r),{recursive:!0}),Wn(r,JSON.stringify(t,null,2)+`
43
- `,"utf8")}function R(e){let t=Ee(e);return Nt(t)?(Vn(t,{force:!0}),!0):!1}function T(e){return Nt(Ee(e))}function $t(e){return Gn(e,"Library","LaunchAgents",`${Pe}.plist`)}function Yn(e,t){return`<?xml version="1.0" encoding="UTF-8"?>
42
+ If you are developing locally, run: pnpm --filter @venos/mcp-server build`)}import{existsSync as _n}from"node:fs";function Un(e,t,r){let n=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};try{let o=e.load(n);if(e.isWired(o,r))return{client:e.name,transport:e.transport,status:"already-wired",path:n};let s=e.inject(o,r);return e.write(n,s),{client:e.name,transport:e.transport,status:"wired",path:n}}catch(o){return{client:e.name,transport:e.transport,status:"error",path:n,error:o instanceof Error?o.message:String(o)}}}function Rt(e,t,r){return r.map(n=>Un(n,e,t))}function Nn(e,t){let r=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};if(!_n(r))return{client:e.name,transport:e.transport,status:"already-removed",path:r};try{let n=e.load(r),o=e.remove(n);return JSON.stringify(o)===JSON.stringify(n)?{client:e.name,transport:e.transport,status:"already-removed",path:r}:(e.write(r,o),{client:e.name,transport:e.transport,status:"removed",path:r})}catch(n){return{client:e.name,transport:e.transport,status:"error",path:r,error:n instanceof Error?n.message:String(n)}}}function Tt(e,t){return t.map(r=>Nn(r,e))}import{existsSync as At,mkdirSync as $n,readFileSync as Mn}from"node:fs";import{join as _t}from"node:path";var Ut="cline.openaiBaseUrl";function Nt(e){let t=_t(e,".vscode");if(!At(t))return{status:"no-workspace"};let r=_t(t,"settings.json"),n={};if(At(r))try{let o=JSON.parse(Mn(r,"utf8"));o&&typeof o=="object"&&(n=o)}catch{}return n[Ut]===j?{status:"already-wired",path:r}:($n(t,{recursive:!0}),m(r,g({...n,[Ut]:j})),{status:"wired",path:r})}import{execFileSync as to}from"node:child_process";import{existsSync as Mt,mkdirSync as Dn,rmSync as Jn,writeFileSync as Kn}from"node:fs";import{dirname as Bn,join as Gn}from"node:path";var Pe="ai.venos.agent";import{existsSync as $t,mkdirSync as jn,rmSync as Vn,writeFileSync as Wn}from"node:fs";import{dirname as Ln,join as Hn}from"node:path";function Ee(e){return Hn(e,".venos","service.json")}function I(e,t){let r=Ee(e);jn(Ln(r),{recursive:!0}),Wn(r,JSON.stringify(t,null,2)+`
43
+ `,"utf8")}function R(e){let t=Ee(e);return $t(t)?(Vn(t,{force:!0}),!0):!1}function T(e){return $t(Ee(e))}function jt(e){return Gn(e,"Library","LaunchAgents",`${Pe}.plist`)}function Yn(e,t){return`<?xml version="1.0" encoding="UTF-8"?>
44
44
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
45
45
  <plist version="1.0">
46
46
  <dict>
@@ -69,7 +69,7 @@ If you are developing locally, run: pnpm --filter @venos/mcp-server build`)}impo
69
69
  <string>/dev/null</string>
70
70
  </dict>
71
71
  </plist>
72
- `}var jt={platform:"darwin",install(e){let t=$t(e.home);try{let r=Mt(t);Dn(Bn(t),{recursive:!0}),Kn(t,Yn(e.nodePath,e.cliEntry),"utf8");try{e.run("launchctl",["unload",t])}catch{}return e.run("launchctl",["load","-w",t]),I(e.home,{kind:"launchd",path:t}),{platform:"darwin",status:r?"already-installed":"installed",path:t}}catch(r){return{platform:"darwin",status:"error",path:t,error:zn(r)}}},remove(e,t){let r=$t(e),n=Mt(r);try{t("launchctl",["unload",r])}catch{}n&&Jn(r,{force:!0});let o=R(e);return{platform:"darwin",status:n||o?"removed":"already-removed",path:r}}};function zn(e){return e instanceof Error?e.message:String(e)}import{existsSync as Q,mkdirSync as Zn,rmSync as Vt,writeFileSync as Wt}from"node:fs";import{join as D}from"node:path";var ee="venos-heartbeat.timer",Lt="venos-heartbeat.service";function Ht(e){return D(e,".config","systemd","user")}function Xn(e,t){return`[Unit]
72
+ `}var Vt={platform:"darwin",install(e){let t=jt(e.home);try{let r=Mt(t);Dn(Bn(t),{recursive:!0}),Kn(t,Yn(e.nodePath,e.cliEntry),"utf8");try{e.run("launchctl",["unload",t])}catch{}return e.run("launchctl",["load","-w",t]),I(e.home,{kind:"launchd",path:t}),{platform:"darwin",status:r?"already-installed":"installed",path:t}}catch(r){return{platform:"darwin",status:"error",path:t,error:zn(r)}}},remove(e,t){let r=jt(e),n=Mt(r);try{t("launchctl",["unload",r])}catch{}n&&Jn(r,{force:!0});let o=R(e);return{platform:"darwin",status:n||o?"removed":"already-removed",path:r}}};function zn(e){return e instanceof Error?e.message:String(e)}import{existsSync as Q,mkdirSync as Zn,rmSync as Wt,writeFileSync as Lt}from"node:fs";import{join as D}from"node:path";var ee="venos-heartbeat.timer",Ht="venos-heartbeat.service";function Ft(e){return D(e,".config","systemd","user")}function Xn(e,t){return`[Unit]
73
73
  Description=venos endpoint heartbeat
74
74
 
75
75
  [Service]
@@ -87,18 +87,18 @@ Persistent=true
87
87
 
88
88
  [Install]
89
89
  WantedBy=timers.target
90
- `}var Ft={platform:"linux",install(e){let t=Ht(e.home),r=D(t,ee);try{let n=Q(r);return Zn(t,{recursive:!0}),Wt(D(t,Lt),Xn(e.nodePath,e.cliEntry),"utf8"),Wt(r,qn(),"utf8"),e.run("systemctl",["--user","daemon-reload"]),e.run("systemctl",["--user","enable","--now",ee]),I(e.home,{kind:"systemd",path:r}),{platform:"linux",status:n?"already-installed":"installed",path:r}}catch(n){return{platform:"linux",status:"error",path:r,error:Qn(n)}}},remove(e,t){let r=Ht(e),n=D(r,ee),o=D(r,Lt),s=Q(n);try{t("systemctl",["--user","disable","--now",ee])}catch{}Q(n)&&Vt(n,{force:!0}),Q(o)&&Vt(o,{force:!0});try{t("systemctl",["--user","daemon-reload"])}catch{}let i=R(e);return{platform:"linux",status:s||i?"removed":"already-removed",path:n}}};function Qn(e){return e instanceof Error?e.message:String(e)}var te="venos-heartbeat",Dt={platform:"win32",install(e){let t=`Scheduled Task: ${te}`;try{let r=T(e.home),n=`"${e.nodePath}" "${e.cliEntry}" heartbeat`;return e.run("schtasks",["/Create","/TN",te,"/TR",n,"/SC","HOURLY","/MO","1","/F"]),I(e.home,{kind:"schtasks",path:t}),{platform:"win32",status:r?"already-installed":"installed",path:t}}catch(r){return{platform:"win32",status:"error",path:t,error:eo(r)}}},remove(e,t){let r=T(e);try{t("schtasks",["/Delete","/TN",te,"/F"])}catch{}return R(e),{platform:"win32",status:r?"removed":"already-removed",path:`Scheduled Task: ${te}`}}};function eo(e){return e instanceof Error?e.message:String(e)}var Jt=[jt,Ft,Dt],Kt=(e,t)=>{try{to(e,t,{stdio:"ignore"})}catch{}};function Bt(e){return e??process.env.HOME??process.env.USERPROFILE??""}function Gt(e={}){let t=Jt.find(r=>r.platform===process.platform);return t?t.install({home:Bt(e.home),nodePath:process.execPath,cliEntry:process.argv[1]??"",run:e.run??Kt}):{platform:"unsupported",status:"unsupported"}}function Yt(e={}){let t=Jt.find(r=>r.platform===process.platform);return t?t.remove(Bt(e.home),e.run??Kt):{platform:"unsupported",status:"unsupported"}}function zt(e){return T(e)}function Zt(e){switch(e.status){case"installed":return` OK service boot service installed ${e.path??""}`;case"already-installed":return` \xB7 service boot service already installed ${e.path??""}`;case"removed":return" OK service boot service removed";case"already-removed":return" \xB7 service boot service already removed";case"unsupported":return" \u2014 service boot service not supported on this OS";case"error":return` FAIL service boot service install failed \u2014 ${e.error??""} (health still reports via the Stop hook)`;default:return null}}var ro={wired:"OK","already-wired":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},no={wired:"wired","already-wired":"already wired","skipped-not-installed":"skipped (not installed)",error:"ERROR"},Re="http://127.0.0.1:4000/v1";function Xt(e,t){let r=e.some(n=>n.status==="wired");console.log(`
91
- venos init ${r?"done":"(no changes)"}`),console.log(` org ID : ${t.orgId}`),console.log(` orchestrator: ${t.orchestratorUrl}`);for(let n of e){let o=ro[n.status],s=no[n.status],i=n.path?` ${n.path}`:"",a=n.error?` \u2014 ${n.error}`:"";console.log(` ${o} ${n.client.padEnd(12)} ${s}${i}${a}`)}if(t.clineWorkspace){let n=t.clineWorkspace;n.status==="wired"?console.log(` OK cline (ws) wired ${n.path}`):n.status==="already-wired"&&console.log(` \xB7 cline (ws) already wired ${n.path}`)}if(t.service){let n=Zt(t.service);n&&console.log(n)}if(r){console.log(`
90
+ `}var Dt={platform:"linux",install(e){let t=Ft(e.home),r=D(t,ee);try{let n=Q(r);return Zn(t,{recursive:!0}),Lt(D(t,Ht),Xn(e.nodePath,e.cliEntry),"utf8"),Lt(r,qn(),"utf8"),e.run("systemctl",["--user","daemon-reload"]),e.run("systemctl",["--user","enable","--now",ee]),I(e.home,{kind:"systemd",path:r}),{platform:"linux",status:n?"already-installed":"installed",path:r}}catch(n){return{platform:"linux",status:"error",path:r,error:Qn(n)}}},remove(e,t){let r=Ft(e),n=D(r,ee),o=D(r,Ht),s=Q(n);try{t("systemctl",["--user","disable","--now",ee])}catch{}Q(n)&&Wt(n,{force:!0}),Q(o)&&Wt(o,{force:!0});try{t("systemctl",["--user","daemon-reload"])}catch{}let i=R(e);return{platform:"linux",status:s||i?"removed":"already-removed",path:n}}};function Qn(e){return e instanceof Error?e.message:String(e)}var te="venos-heartbeat",Jt={platform:"win32",install(e){let t=`Scheduled Task: ${te}`;try{let r=T(e.home),n=`"${e.nodePath}" "${e.cliEntry}" heartbeat`;return e.run("schtasks",["/Create","/TN",te,"/TR",n,"/SC","HOURLY","/MO","1","/F"]),I(e.home,{kind:"schtasks",path:t}),{platform:"win32",status:r?"already-installed":"installed",path:t}}catch(r){return{platform:"win32",status:"error",path:t,error:eo(r)}}},remove(e,t){let r=T(e);try{t("schtasks",["/Delete","/TN",te,"/F"])}catch{}return R(e),{platform:"win32",status:r?"removed":"already-removed",path:`Scheduled Task: ${te}`}}};function eo(e){return e instanceof Error?e.message:String(e)}var Kt=[Vt,Dt,Jt],Bt=(e,t)=>{try{to(e,t,{stdio:"ignore"})}catch{}};function Gt(e){return e??process.env.HOME??process.env.USERPROFILE??""}function Yt(e={}){let t=Kt.find(r=>r.platform===process.platform);return t?t.install({home:Gt(e.home),nodePath:process.execPath,cliEntry:process.argv[1]??"",run:e.run??Bt}):{platform:"unsupported",status:"unsupported"}}function zt(e={}){let t=Kt.find(r=>r.platform===process.platform);return t?t.remove(Gt(e.home),e.run??Bt):{platform:"unsupported",status:"unsupported"}}function Zt(e){return T(e)}function Xt(e){switch(e.status){case"installed":return` OK service boot service installed ${e.path??""}`;case"already-installed":return` \xB7 service boot service already installed ${e.path??""}`;case"removed":return" OK service boot service removed";case"already-removed":return" \xB7 service boot service already removed";case"unsupported":return" \u2014 service boot service not supported on this OS";case"error":return` FAIL service boot service install failed \u2014 ${e.error??""} (health still reports via the Stop hook)`;default:return null}}var ro={wired:"OK","already-wired":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},no={wired:"wired","already-wired":"already wired","skipped-not-installed":"skipped (not installed)",error:"ERROR"},Re="http://127.0.0.1:4000/v1";function qt(e,t){let r=e.some(n=>n.status==="wired");console.log(`
91
+ venos init ${r?"done":"(no changes)"}`),console.log(` org ID : ${t.orgId}`),console.log(` orchestrator: ${t.orchestratorUrl}`);for(let n of e){let o=ro[n.status],s=no[n.status],i=n.path?` ${n.path}`:"",a=n.error?` \u2014 ${n.error}`:"";console.log(` ${o} ${n.client.padEnd(12)} ${s}${i}${a}`)}if(t.clineWorkspace){let n=t.clineWorkspace;n.status==="wired"?console.log(` OK cline (ws) wired ${n.path}`):n.status==="already-wired"&&console.log(` \xB7 cline (ws) already wired ${n.path}`)}if(t.service){let n=Xt(t.service);n&&console.log(n)}if(r){console.log(`
92
92
  Next steps:`);let n={"claude-code":"Restart Claude Code for the hook to take effect.",cursor:"Restart Cursor to load the venos MCP server.",codex:"Restart Codex to pick up the new MCP config + gateway routing (~/.codex/.env).",windsurf:"Restart Windsurf to load the venos MCP server.",cline:"Reload the Cline extension (or restart VS Code) to load the venos MCP server.",zed:"Restart Zed to load the venos context server.",jetbrains:"Restart your JetBrains IDE (or just Junie) to load the venos MCP server.",aider:"Aider will route LLM calls through the venos gateway on next launch (~/.aider.conf.yml)."};for(let o of e){if(o.status!=="wired")continue;let s=n[o.client];s&&console.log(` \u2022 ${s}`)}console.log(` \u2022 Test: curl ${t.orchestratorUrl}/healthz`)}oo(t.clineWorkspace)}function oo(e){console.log(`
93
- Gateway routing (hard block via apps/mcp-proxy):`),console.log(` \u2022 Cursor \u2014 Settings \u2192 Models \u2192 Custom OpenAI Base URL: ${Re}`),console.log(" Optional: Custom HTTP Headers \u2192 X-Venos-Source: cursor"),console.log(` \u2022 Windsurf \u2014 Settings \u2192 Models \u2192 Custom OpenAI Base URL: ${Re}`),(!e||e.status==="no-workspace")&&(console.log(" \u2022 Cline \u2014 Open VS Code in your project, then add to .vscode/settings.json:"),console.log(` "cline.openaiBaseUrl": "${Re}"`)),console.log(" \u2022 VS Code Copilot \u2014 closed provider, no custom endpoint. Coverage = MCP advisory only."),console.log(" \u2022 JetBrains AI Assistant \u2014 closed provider, no custom endpoint. Coverage = MCP advisory only.")}function qt(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var so={removed:"OK","already-removed":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},io={removed:"removed","already-removed":"already removed","skipped-not-installed":"skipped (not installed)",error:"ERROR"};function Qt(e,t){let r=e.some(s=>s.status==="removed");console.log(`
94
- venos init --remove ${r?"done":"(no changes)"}`);for(let s of e){let i=so[s.status],a=io[s.status],l=s.path?` ${s.path}`:"",c=s.error?` \u2014 ${s.error}`:"";console.log(` ${i} ${s.client.padEnd(12)} ${a}${l}${c}`)}let n=t.venosConfigRemoved?"OK":"\xB7",o=t.venosConfigRemoved?"removed":"already removed";if(console.log(` ${n} venos-config ${o} ${t.venosConfigPath}`),t.service){let s=Zt(t.service);s&&console.log(s)}console.log("\nPre-venos `.venos-backup` snapshots are preserved \u2014 delete manually if you don't want them.")}function er(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var tr=1;function J(e){return fo(e,".venos","config.json")}function go(){return`org-${mo(4).toString("hex")}`}function ho(e,t,r,n){let o=J(e);if(rr(o))try{let s=JSON.parse(co(o,"utf8")),i={schemaVersion:s.schemaVersion??tr,...s,orchestratorUrl:t};return r&&(i.apiKey=r),n&&(i.orgId=n),i}catch{}return{schemaVersion:tr,orgId:n??go(),orchestratorUrl:t,createdAt:new Date().toISOString(),failMode:"closed",...r?{apiKey:r}:{}}}function yo(e,t){let r=J(e);ao(po(r),{recursive:!0}),uo(r,JSON.stringify(t,null,2)+`
95
- `,"utf8")}var vo=5e3,So=5e3;async function wo(e){let t=e.replace(/\/$/,""),r=new AbortController,n=setTimeout(()=>r.abort(),vo);try{return(await fetch(`${t}/healthz`,{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(n)}}async function ko(e,t){let r=e.replace(/\/$/,""),n=new AbortController,o=setTimeout(()=>n.abort(),So);try{let s=await fetch(`${r}/api/activation/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:t}),signal:n.signal});s.ok||console.warn(`[venos] activation telemetry: non-200 response (${s.status}) \u2014 init continues`)}catch{console.warn("[venos] activation telemetry: failed to reach orchestrator \u2014 init continues")}finally{clearTimeout(o)}}function Co(e){try{let t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"}catch{return!1}}async function nr(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=e.orchestratorUrl??"http://127.0.0.1:8788";await wo(r)||(console.error(`
96
- venos init failed: orchestrator unreachable at ${r}/healthz`),console.error("Start the orchestrator first: apps/orchestrator/orchestrator"),process.exit(1));let n=ho(t,r,e.apiKey,e.orgId),o={orgId:n.orgId,orchestratorUrl:r,mcpServerPath:q(),hookCommand:"venos hook",usageSyncCommand:"venos usage-sync --throttle",...n.apiKey?{apiKey:n.apiKey}:{}},s=It(t,o,F);yo(t,n);let i=Ut(e.cwd??process.cwd()),a=process.env.VITEST&&!e.serviceRun?void 0:Gt({home:t,...e.serviceRun?{run:e.serviceRun}:{}});e.noTelemetry===!0||Co(r)||await ko(r,n.orgId);let c={orgId:n.orgId,orchestratorUrl:r,clineWorkspace:i,...a?{service:a}:{}};e.json?qt(s,c):Xt(s,c)}function or(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=Rt(t,F),n=process.env.VITEST&&!e.serviceRun?void 0:Yt({home:t,...e.serviceRun?{run:e.serviceRun}:{}}),o=J(t),s=rr(o);s&&lo(o,{force:!0});let i={venosConfigPath:o,venosConfigRemoved:s,...n?{service:n}:{}};e.json?er(r,i):Qt(r,i)}import{mkdirSync as xo,readFileSync as re,existsSync as bo,writeFileSync as Oo}from"node:fs";import{hostname as Po,userInfo as Eo}from"node:os";import{execFileSync as Io}from"node:child_process";import{randomBytes as ir}from"node:crypto";import{dirname as Ro,join as ar}from"node:path";function To(e){return ar(e,".venos","config.json")}function x(e){let t=To(e);if(!bo(t))throw new Error(`venos config not found at ${t} \u2014 run "venos init" first`);return JSON.parse(re(t,"utf8"))}function Ao(){return new Promise((e,t)=>{let r="";process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{r+=n}),process.stdin.on("end",()=>e(r)),process.stdin.on("error",t)})}function _o(e){let t;try{t=re(e,"utf8")}catch{return null}let r=t.split(/\r?\n/);for(let n=r.length-1;n>=0;n--){let o=r[n]?.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{continue}if(s.type!=="assistant"||!s.message||s.message.model==="<synthetic>")continue;let i=s.message.usage;if(!i)continue;let a=typeof i.cache_creation_input_tokens=="number"?i.cache_creation_input_tokens:void 0,l=typeof i.cache_read_input_tokens=="number"?i.cache_read_input_tokens:void 0,c=(i.input_tokens??0)+(a??0)+(l??0),u=i.output_tokens??0,p=s.message.model??"";if(c===0&&u===0&&p==="")return null;let f={tokensIn:c,tokensOut:u,model:p};return l!==void 0&&(f.cacheReadTokens=l),a!==void 0&&(f.cacheWriteTokens=a),f}return null}function Uo(e){let t;try{t=JSON.parse(e)}catch{return e}if(typeof t!="object"||t===null||Array.isArray(t))return e;let r=t,n=r.transcript_path;if(typeof n!="string"||n==="")return e;let o=_o(n);return o?(r.usage_tokens_in=o.tokensIn,r.usage_tokens_out=o.tokensOut,o.cacheReadTokens!==void 0&&(r.cache_read_input_tokens=o.cacheReadTokens),o.cacheWriteTokens!==void 0&&(r.cache_creation_input_tokens=o.cacheWriteTokens),o.model!==""&&(r.usage_model=o.model),JSON.stringify(r)):e}function No(e,t){if(t==="")return e;let r;try{r=JSON.parse(e)}catch{return JSON.stringify({orgId:t,content:e})}if(typeof r!="object"||r===null||Array.isArray(r))return e;let n=r;for(let o of["orgId","org_id","tenantId","tenant_id"]){let s=n[o];if(typeof s=="string"&&s.trim()!=="")return e}return n.orgId=t,JSON.stringify(n)}function Mo(e){try{let r=JSON.parse(e).cursor_version;return typeof r=="string"&&r!==""}catch{return!1}}function Te(){try{let e=Eo().username;if(typeof e=="string"&&e.trim()!=="")return e.trim()}catch{}for(let e of["USER","USERNAME","LOGNAME"]){let t=process.env[e];if(typeof t=="string"&&t.trim()!=="")return t.trim()}return""}function $o(e,t){if(t==="")return e;let r;try{r=JSON.parse(e)}catch{return e}if(typeof r!="object"||r===null||Array.isArray(r))return e;let n=r;for(let o of["userId","user_id"]){let s=n[o];if(typeof s=="string"&&s.trim()!=="")return e}return n.userId=t,JSON.stringify(n)}function y(e){let t=e===""?"":ar(e,".venos","machine-id");if(t!=="")try{let r=re(t,"utf8").trim();if(r!=="")return r}catch{}try{let r=re("/etc/machine-id","utf8").trim();if(r!=="")return r}catch{}if(t==="")return"";try{let r=ir(16).toString("hex");return xo(Ro(t),{recursive:!0}),Oo(t,r+`
97
- `,"utf8"),r}catch{return""}}function jo(e,t,r){if(t===""&&r==="")return e;let n;try{n=JSON.parse(e)}catch{return e}if(typeof n!="object"||n===null||Array.isArray(n))return e;let o=n,s=i=>{let a=o[i];return typeof a=="string"&&a.trim()!==""};return t!==""&&!s("machine_id")&&!s("machineId")&&(o.machine_id=t),r!==""&&!s("hostname")&&(o.hostname=r),JSON.stringify(o)}function S(e=process.platform,t=Vo){if(e==="darwin")try{let r=t().trim();if(r!=="")return r.endsWith(".local")?r:`${r}.local`}catch{}try{let r=Po();return typeof r=="string"?r.trim():""}catch{return""}}function Vo(){try{return Io("scutil",["--get","LocalHostName"],{encoding:"utf8",timeout:1e3}).trim()}catch{return""}}function C(e,t,r){let n={"Content-Type":"application/json","X-Venos-Org":e};return t&&(n.Authorization=`Bearer ${t}`),r&&(n["X-Venos-Idempotency-Key"]=r),n}function Wo(e){return e.failMode==="closed"?{mode:"closed",implicit:!1}:e.failMode==="open"?{mode:"open",implicit:!1}:{mode:"open",implicit:!0}}function cr(e){return e===502||e===503}async function A(e,t,r={}){let n=r.attempts??3,o=r.backoffMs??[250,750],s=r.timeoutMs??3e3,i;for(let a=0;a<n;a++){if(a>0){let l=o[Math.min(a-1,o.length-1)]??0;await new Promise(c=>setTimeout(c,l))}try{let l=await fetch(e,{...t,signal:AbortSignal.timeout(s)});if(!cr(l.status)||a===n-1)return l;i=new Error(`orchestrator returned ${l.status}`)}catch(l){i=l}}throw i}function Lo(e){let t=e.orchestratorUrl.replace(/\/$/,"").trim(),r=new Set([t]),n=[];for(let o of e.mirrors??[]){let s=(o?.url??"").replace(/\/$/,"").trim();s===""||r.has(s)||(r.add(s),n.push(o.apiKey?{url:s,apiKey:o.apiKey}:{url:s}))}return n}async function Ho(e,t,r,n,o){e.length!==0&&await Promise.allSettled(e.map(async s=>{let i=`${s.url}/v1/hooks/${encodeURIComponent(t)}`;try{await(await A(i,{method:"POST",headers:C(r,s.apiKey,o),body:n})).text()}catch{}}))}async function lr(e,t="claude-code"){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=x(r),o=await Ao(),s=Mo(o),i=jo($o(Uo(No(o,n.orgId)),Te()),y(r),S()),l=`${n.orchestratorUrl.replace(/\/$/,"")}/v1/hooks/${encodeURIComponent(t)}`,c=ir(16).toString("hex"),u=Ho(Lo(n),t,n.orgId,i,c),p;try{p=await A(l,{method:"POST",headers:C(n.orgId,n.apiKey,c),body:i})}catch{await u,sr(t,s,n);return}if(cr(p.status)){await p.text(),await u,sr(t,s,n);return}if(s){await p.text(),await u;return}let f=await p.text(),k=t==="codex"?Fo(f):f;process.stdout.write(k),await u,p.ok||(process.stderr.write(`venos hook: orchestrator returned ${p.status}
98
- `),process.exit(1))}function sr(e,t,r){if(t)return;let{mode:n,implicit:o}=Wo(r);if(n==="open"){o?process.stderr.write(`venos hook: orchestrator unreachable; proceeding because ~/.venos/config.json has no "failMode". This default flips to "closed" in a future release \u2014 set failMode explicitly to keep proceeding.
93
+ Gateway routing (hard block via apps/mcp-proxy):`),console.log(` \u2022 Cursor \u2014 Settings \u2192 Models \u2192 Custom OpenAI Base URL: ${Re}`),console.log(" Optional: Custom HTTP Headers \u2192 X-Venos-Source: cursor"),console.log(` \u2022 Windsurf \u2014 Settings \u2192 Models \u2192 Custom OpenAI Base URL: ${Re}`),(!e||e.status==="no-workspace")&&(console.log(" \u2022 Cline \u2014 Open VS Code in your project, then add to .vscode/settings.json:"),console.log(` "cline.openaiBaseUrl": "${Re}"`)),console.log(" \u2022 VS Code Copilot \u2014 closed provider, no custom endpoint. Coverage = MCP advisory only."),console.log(" \u2022 JetBrains AI Assistant \u2014 closed provider, no custom endpoint. Coverage = MCP advisory only.")}function Qt(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var so={removed:"OK","already-removed":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},io={removed:"removed","already-removed":"already removed","skipped-not-installed":"skipped (not installed)",error:"ERROR"};function er(e,t){let r=e.some(s=>s.status==="removed");console.log(`
94
+ venos init --remove ${r?"done":"(no changes)"}`);for(let s of e){let i=so[s.status],a=io[s.status],l=s.path?` ${s.path}`:"",c=s.error?` \u2014 ${s.error}`:"";console.log(` ${i} ${s.client.padEnd(12)} ${a}${l}${c}`)}let n=t.venosConfigRemoved?"OK":"\xB7",o=t.venosConfigRemoved?"removed":"already removed";if(console.log(` ${n} venos-config ${o} ${t.venosConfigPath}`),t.service){let s=Xt(t.service);s&&console.log(s)}console.log("\nPre-venos `.venos-backup` snapshots are preserved \u2014 delete manually if you don't want them.")}function tr(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var rr=1;function J(e){return fo(e,".venos","config.json")}function go(){return`org-${mo(4).toString("hex")}`}function ho(e,t,r,n){let o=J(e);if(nr(o))try{let s=JSON.parse(co(o,"utf8")),i={schemaVersion:s.schemaVersion??rr,...s,orchestratorUrl:t};return r&&(i.apiKey=r),n&&(i.orgId=n),i}catch{}return{schemaVersion:rr,orgId:n??go(),orchestratorUrl:t,createdAt:new Date().toISOString(),failMode:"closed",...r?{apiKey:r}:{}}}function yo(e,t){let r=J(e);ao(po(r),{recursive:!0}),uo(r,JSON.stringify(t,null,2)+`
95
+ `,"utf8")}var vo=5e3,So=5e3;async function wo(e){let t=e.replace(/\/$/,""),r=new AbortController,n=setTimeout(()=>r.abort(),vo);try{return(await fetch(`${t}/healthz`,{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(n)}}async function ko(e,t){let r=e.replace(/\/$/,""),n=new AbortController,o=setTimeout(()=>n.abort(),So);try{let s=await fetch(`${r}/api/activation/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:t}),signal:n.signal});s.ok||console.warn(`[venos] activation telemetry: non-200 response (${s.status}) \u2014 init continues`)}catch{console.warn("[venos] activation telemetry: failed to reach orchestrator \u2014 init continues")}finally{clearTimeout(o)}}function Co(e){try{let t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"}catch{return!1}}async function or(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=e.orchestratorUrl??"http://127.0.0.1:8788";await wo(r)||(console.error(`
96
+ venos init failed: orchestrator unreachable at ${r}/healthz`),console.error("Start the orchestrator first: apps/orchestrator/orchestrator"),process.exit(1));let n=ho(t,r,e.apiKey,e.orgId),o={orgId:n.orgId,orchestratorUrl:r,mcpServerPath:q(),hookCommand:"venos hook",usageSyncCommand:"venos usage-sync --throttle",...n.apiKey?{apiKey:n.apiKey}:{}},s=Rt(t,o,F);yo(t,n);let i=Nt(e.cwd??process.cwd()),a=process.env.VITEST&&!e.serviceRun?void 0:Yt({home:t,...e.serviceRun?{run:e.serviceRun}:{}});e.noTelemetry===!0||Co(r)||await ko(r,n.orgId);let c={orgId:n.orgId,orchestratorUrl:r,clineWorkspace:i,...a?{service:a}:{}};e.json?Qt(s,c):qt(s,c)}function sr(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=Tt(t,F),n=process.env.VITEST&&!e.serviceRun?void 0:zt({home:t,...e.serviceRun?{run:e.serviceRun}:{}}),o=J(t),s=nr(o);s&&lo(o,{force:!0});let i={venosConfigPath:o,venosConfigRemoved:s,...n?{service:n}:{}};e.json?tr(r,i):er(r,i)}import{mkdirSync as xo,readFileSync as re,existsSync as bo,writeFileSync as Oo}from"node:fs";import{hostname as Po,userInfo as Eo}from"node:os";import{execFileSync as Io}from"node:child_process";import{randomBytes as ar}from"node:crypto";import{dirname as Ro,join as cr}from"node:path";function To(e){return cr(e,".venos","config.json")}function x(e){let t=To(e);if(!bo(t))throw new Error(`venos config not found at ${t} \u2014 run "venos init" first`);return JSON.parse(re(t,"utf8"))}function Ao(){return new Promise((e,t)=>{let r="";process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>{r+=n}),process.stdin.on("end",()=>e(r)),process.stdin.on("error",t)})}function _o(e){let t;try{t=re(e,"utf8")}catch{return null}let r=t.split(/\r?\n/);for(let n=r.length-1;n>=0;n--){let o=r[n]?.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{continue}if(s.type!=="assistant"||!s.message||s.message.model==="<synthetic>")continue;let i=s.message.usage;if(!i)continue;let a=typeof i.cache_creation_input_tokens=="number"?i.cache_creation_input_tokens:void 0,l=typeof i.cache_read_input_tokens=="number"?i.cache_read_input_tokens:void 0,c=(i.input_tokens??0)+(a??0)+(l??0),u=i.output_tokens??0,p=s.message.model??"";if(c===0&&u===0&&p==="")return null;let f={tokensIn:c,tokensOut:u,model:p};return l!==void 0&&(f.cacheReadTokens=l),a!==void 0&&(f.cacheWriteTokens=a),f}return null}function Uo(e){let t;try{t=JSON.parse(e)}catch{return e}if(typeof t!="object"||t===null||Array.isArray(t))return e;let r=t,n=r.transcript_path;if(typeof n!="string"||n==="")return e;let o=_o(n);return o?(r.usage_tokens_in=o.tokensIn,r.usage_tokens_out=o.tokensOut,o.cacheReadTokens!==void 0&&(r.cache_read_input_tokens=o.cacheReadTokens),o.cacheWriteTokens!==void 0&&(r.cache_creation_input_tokens=o.cacheWriteTokens),o.model!==""&&(r.usage_model=o.model),JSON.stringify(r)):e}function No(e,t){if(t==="")return e;let r;try{r=JSON.parse(e)}catch{return JSON.stringify({orgId:t,content:e})}if(typeof r!="object"||r===null||Array.isArray(r))return e;let n=r;for(let o of["orgId","org_id","tenantId","tenant_id"]){let s=n[o];if(typeof s=="string"&&s.trim()!=="")return e}return n.orgId=t,JSON.stringify(n)}function $o(e){try{let r=JSON.parse(e).cursor_version;return typeof r=="string"&&r!==""}catch{return!1}}function Te(){try{let e=Eo().username;if(typeof e=="string"&&e.trim()!=="")return e.trim()}catch{}for(let e of["USER","USERNAME","LOGNAME"]){let t=process.env[e];if(typeof t=="string"&&t.trim()!=="")return t.trim()}return""}function Mo(e,t){if(t==="")return e;let r;try{r=JSON.parse(e)}catch{return e}if(typeof r!="object"||r===null||Array.isArray(r))return e;let n=r;for(let o of["userId","user_id"]){let s=n[o];if(typeof s=="string"&&s.trim()!=="")return e}return n.userId=t,JSON.stringify(n)}function y(e){let t=e===""?"":cr(e,".venos","machine-id");if(t!=="")try{let r=re(t,"utf8").trim();if(r!=="")return r}catch{}try{let r=re("/etc/machine-id","utf8").trim();if(r!=="")return r}catch{}if(t==="")return"";try{let r=ar(16).toString("hex");return xo(Ro(t),{recursive:!0}),Oo(t,r+`
97
+ `,"utf8"),r}catch{return""}}function jo(e,t,r){if(t===""&&r==="")return e;let n;try{n=JSON.parse(e)}catch{return e}if(typeof n!="object"||n===null||Array.isArray(n))return e;let o=n,s=i=>{let a=o[i];return typeof a=="string"&&a.trim()!==""};return t!==""&&!s("machine_id")&&!s("machineId")&&(o.machine_id=t),r!==""&&!s("hostname")&&(o.hostname=r),JSON.stringify(o)}function S(e=process.platform,t=Vo){if(e==="darwin")try{let r=t().trim();if(r!=="")return r.endsWith(".local")?r:`${r}.local`}catch{}try{let r=Po();return typeof r=="string"?r.trim():""}catch{return""}}function Vo(){try{return Io("scutil",["--get","LocalHostName"],{encoding:"utf8",timeout:1e3}).trim()}catch{return""}}function C(e,t,r){let n={"Content-Type":"application/json","X-Venos-Org":e};return t&&(n.Authorization=`Bearer ${t}`),r&&(n["X-Venos-Idempotency-Key"]=r),n}function Wo(e){return e.failMode==="closed"?{mode:"closed",implicit:!1}:e.failMode==="open"?{mode:"open",implicit:!1}:{mode:"open",implicit:!0}}function lr(e){return e===502||e===503}async function A(e,t,r={}){let n=r.attempts??3,o=r.backoffMs??[250,750],s=r.timeoutMs??3e3,i;for(let a=0;a<n;a++){if(a>0){let l=o[Math.min(a-1,o.length-1)]??0;await new Promise(c=>setTimeout(c,l))}try{let l=await fetch(e,{...t,signal:AbortSignal.timeout(s)});if(!lr(l.status)||a===n-1)return l;i=new Error(`orchestrator returned ${l.status}`)}catch(l){i=l}}throw i}function Lo(e){let t=e.orchestratorUrl.replace(/\/$/,"").trim(),r=new Set([t]),n=[];for(let o of e.mirrors??[]){let s=(o?.url??"").replace(/\/$/,"").trim();s===""||r.has(s)||(r.add(s),n.push(o.apiKey?{url:s,apiKey:o.apiKey}:{url:s}))}return n}async function Ho(e,t,r,n,o){e.length!==0&&await Promise.allSettled(e.map(async s=>{let i=`${s.url}/v1/hooks/${encodeURIComponent(t)}`;try{await(await A(i,{method:"POST",headers:C(r,s.apiKey,o),body:n})).text()}catch{}}))}async function ur(e,t="claude-code"){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=x(r),o=await Ao(),s=$o(o),i=jo(Mo(Uo(No(o,n.orgId)),Te()),y(r),S()),l=`${n.orchestratorUrl.replace(/\/$/,"")}/v1/hooks/${encodeURIComponent(t)}`,c=ar(16).toString("hex"),u=Ho(Lo(n),t,n.orgId,i,c),p;try{p=await A(l,{method:"POST",headers:C(n.orgId,n.apiKey,c),body:i})}catch{await u,ir(t,s,n);return}if(lr(p.status)){await p.text(),await u,ir(t,s,n);return}if(s){await p.text(),await u;return}let f=await p.text(),k=t==="codex"?Fo(f):t==="claude-code"?Do(f):f;process.stdout.write(k),await u,p.ok||(process.stderr.write(`venos hook: orchestrator returned ${p.status}
98
+ `),process.exit(1))}function ir(e,t,r){if(t)return;let{mode:n,implicit:o}=Wo(r);if(n==="open"){o?process.stderr.write(`venos hook: orchestrator unreachable; proceeding because ~/.venos/config.json has no "failMode". This default flips to "closed" in a future release \u2014 set failMode explicitly to keep proceeding.
99
99
  `):process.stderr.write(`venos hook: orchestrator unreachable; proceeding (failMode=open)
100
100
  `);return}let s='venos orchestrator unreachable (fail-closed); set failMode "open" in ~/.venos/config.json to proceed without recording';if(e==="codex"){process.stdout.write(JSON.stringify({decision:"block",reason:s}));return}process.stderr.write(`venos hook: ${s}
101
- `),process.exit(2)}function Fo(e){let t;try{t=JSON.parse(e)}catch{return e}let r=typeof t.decision=="string"?t.decision:"";if(r==="deny"||r==="block"){let n=typeof t.severity=="string"?t.severity:"",o=typeof t.eventId=="string"?t.eventId:"",s=`blocked by venos policy${n?` (severity=${n})`:""}${o?` [event ${o}]`:""}`;return JSON.stringify({decision:"block",reason:s})}return r==="allow"?JSON.stringify({decision:"approve"}):e}import{readFile as Do}from"node:fs/promises";import{homedir as Jo}from"node:os";import{join as Ko}from"node:path";async function ur(e={}){let t=e.home??Jo(),r=Ko(t,".venos","config.json"),n;try{n=JSON.parse(await Do(r,"utf8"))}catch{process.stderr.write("venos: no config found \u2014 run `venos init` first\n"),process.exit(1);return}let o=`${n.orchestratorUrl}/api/billing/checkout`,s;try{s=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({orgId:n.orgId}),signal:AbortSignal.timeout(5e3)})}catch{process.stderr.write(`venos: could not reach orchestrator
101
+ `),process.exit(2)}function Fo(e){let t;try{t=JSON.parse(e)}catch{return e}let r=typeof t.decision=="string"?t.decision:"";if(r==="deny"||r==="block"){let n=typeof t.severity=="string"?t.severity:"",o=typeof t.eventId=="string"?t.eventId:"",s=`blocked by venos policy${n?` (severity=${n})`:""}${o?` [event ${o}]`:""}`;return JSON.stringify({decision:"block",reason:s})}return r==="allow"?JSON.stringify({decision:"approve"}):e}function Do(e){let t;try{t=JSON.parse(e)}catch{return""}let r=typeof t.decision=="string"?t.decision:"";if(r==="deny"||r==="block"){let n=typeof t.severity=="string"?t.severity:"",o=typeof t.eventId=="string"?t.eventId:"",s=`blocked by venos policy${n?` (severity=${n})`:""}${o?` [event ${o}]`:""}`;return JSON.stringify({decision:"block",reason:s})}return""}import{readFile as Jo}from"node:fs/promises";import{homedir as Ko}from"node:os";import{join as Bo}from"node:path";async function dr(e={}){let t=e.home??Ko(),r=Bo(t,".venos","config.json"),n;try{n=JSON.parse(await Jo(r,"utf8"))}catch{process.stderr.write("venos: no config found \u2014 run `venos init` first\n"),process.exit(1);return}let o=`${n.orchestratorUrl}/api/billing/checkout`,s;try{s=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({orgId:n.orgId}),signal:AbortSignal.timeout(5e3)})}catch{process.stderr.write(`venos: could not reach orchestrator
102
102
  `),process.exit(1);return}if(s.status===503){process.stderr.write(`venos: billing is not yet configured on this server
103
103
  `),process.exit(1);return}if(!s.ok){process.stderr.write(`venos: checkout failed (${s.status})
104
104
  `),process.exit(1);return}let i=await s.json();if(!i.url){process.stderr.write(`venos: no checkout URL returned
@@ -107,23 +107,23 @@ Open this URL to upgrade your venos plan:
107
107
 
108
108
  ${i.url}
109
109
 
110
- `)}import{readFileSync as Yo,existsSync as zo}from"node:fs";import{join as fr}from"node:path";import{execFile as Zo}from"node:child_process";import{promisify as Xo}from"node:util";import{existsSync as _}from"node:fs";import{dirname as Bo,join as ne,resolve as U}from"node:path";import{fileURLToPath as Go}from"node:url";var oe=Bo(Go(import.meta.url));function dr(){let e=process.env.VENOS_SESSION_WASTE_PATH;if(e&&_(e))return U(e);let t=U(ne(oe,"..","etc","session-waste","bin.js"));if(_(t))return t;let r=U(ne(oe,"..","..","..","packages","session-waste","dist","bin.js"));if(_(r))return r;throw new Error(`venos: bundled session-waste scanner not found. Tried:
110
+ `)}import{readFileSync as zo,existsSync as Zo}from"node:fs";import{join as mr}from"node:path";import{execFile as Xo}from"node:child_process";import{promisify as qo}from"node:util";import{existsSync as _}from"node:fs";import{dirname as Go,join as ne,resolve as U}from"node:path";import{fileURLToPath as Yo}from"node:url";var oe=Go(Yo(import.meta.url));function pr(){let e=process.env.VENOS_SESSION_WASTE_PATH;if(e&&_(e))return U(e);let t=U(ne(oe,"..","etc","session-waste","bin.js"));if(_(t))return t;let r=U(ne(oe,"..","..","..","packages","session-waste","dist","bin.js"));if(_(r))return r;throw new Error(`venos: bundled session-waste scanner not found. Tried:
111
111
  VENOS_SESSION_WASTE_PATH=${e??"(unset)"}
112
112
  bundled: ${t}
113
113
  sibling: ${r}
114
- If you are developing locally, run: pnpm --filter @venos/session-waste build`)}function pr(){let e=process.env.VENOS_USAGE_AGGREGATOR_PATH;if(e&&_(e))return U(e);let t=U(ne(oe,"..","etc","session-waste","usage-bin.js"));if(_(t))return t;let r=U(ne(oe,"..","..","..","packages","session-waste","dist","usage-bin.js"));if(_(r))return r;throw new Error(`venos: bundled usage aggregator not found. Tried:
114
+ If you are developing locally, run: pnpm --filter @venos/session-waste build`)}function fr(){let e=process.env.VENOS_USAGE_AGGREGATOR_PATH;if(e&&_(e))return U(e);let t=U(ne(oe,"..","etc","session-waste","usage-bin.js"));if(_(t))return t;let r=U(ne(oe,"..","..","..","packages","session-waste","dist","usage-bin.js"));if(_(r))return r;throw new Error(`venos: bundled usage aggregator not found. Tried:
115
115
  VENOS_USAGE_AGGREGATOR_PATH=${e??"(unset)"}
116
116
  bundled: ${t}
117
117
  sibling: ${r}
118
- If you are developing locally, run: pnpm --filter @venos/session-waste build`)}var qo=Xo(Zo);async function mr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=fr(t,".venos","config.json");if(!zo(r))throw new Error(`venos config not found at ${r} \u2014 run "venos init" first`);let n=JSON.parse(Yo(r,"utf8")),o=dr(),s=fr(t,".claude"),{stdout:i}=await qo(process.execPath,[o,s],{maxBuffer:32*1024*1024}),a=JSON.parse(i),l=Array.isArray(a.findings)?a.findings:[];if(l.length===0)return{sessionsScanned:a.sessionsScanned??0,findingsStored:0};let u=`${n.orchestratorUrl.replace(/\/$/,"")}/api/finops/session-waste?orgId=${encodeURIComponent(n.orgId)}`,p=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json","X-Venos-Org":n.orgId},body:JSON.stringify({findings:l})});if(!p.ok)throw new Error(`venos waste-scan: orchestrator returned ${p.status}`);let f=await p.json();return{sessionsScanned:a.sessionsScanned??0,findingsStored:f.stored??l.length}}import{readFileSync as Qo,existsSync as es,statSync as ts,writeFileSync as rs}from"node:fs";import{join as Ae}from"node:path";import{execFile as ns,spawn as os}from"node:child_process";import{promisify as ss}from"node:util";var is=ss(ns),as=500;function cs(e,t,r=as){let n=[];for(let o=0;o<e.length;o+=r)n.push({sessions:e.slice(o,o+r),attribution:[]});for(let o=0;o<t.length;o+=r)n.push({sessions:[],attribution:t.slice(o,o+r)});return n}function ls(e){return Ae(e,".venos","usage-sync.last")}function _e(e,t,r){try{return r-ts(e).mtimeMs>=t}catch{return!0}}function gr(e,t=60,r=os){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=ls(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{rs(o,new Date().toISOString())}catch{return{ran:!1,reason:"stamp-write-failed"}}let s=process.argv[1]??"";return r(process.execPath,[s,"usage-sync"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}async function hr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=Ae(r,".venos","config.json");if(!es(n))throw new Error(`venos config not found at ${n} \u2014 run "venos init" first`);let o=JSON.parse(Qo(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=pr(),c=Ae(r,".claude"),{stdout:u}=await is(process.execPath,[l,c],{maxBuffer:64*1024*1024}),p=JSON.parse(u),f=Array.isArray(p.sessions)?p.sessions:[],k=Array.isArray(p.attribution)?p.attribution:[];if(f.length===0)return{sessionsScanned:p.sessionsScanned??0,sessionsStored:0};let ae=`${i.replace(/\/$/,"")}/api/finops/claude-usage?orgId=${encodeURIComponent(s)}`,N={"Content-Type":"application/json","X-Venos-Org":s};a&&(N.Authorization=`Bearer ${a}`);let M=0;for(let $ of cs(f,k)){let ce=await A(ae,{method:"POST",headers:N,body:JSON.stringify($)},{timeoutMs:1e4});if(!ce.ok)throw new Error(`venos usage-sync: orchestrator returned ${ce.status}`);let $r=await ce.json();M+=$r.sessionsStored??$.sessions.length}return{sessionsScanned:p.sessionsScanned??0,sessionsStored:M}}import{existsSync as Ys,readFileSync as zs,writeFileSync as kr}from"node:fs";import{join as Cr}from"node:path";import{spawn as Zs}from"node:child_process";import{execFileSync as se}from"node:child_process";import{existsSync as us,readdirSync as ds,readFileSync as yr,realpathSync as ps}from"node:fs";import{homedir as fs,hostname as ms,release as K}from"node:os";import{basename as gs,dirname as hs,join as ys}from"node:path";var vs=[{key:"claude-code",displayName:"Claude Code",isCli:!0,detect:{darwin:["~/.local/bin/claude","~/.claude/local/claude","/opt/homebrew/bin/claude","/usr/local/bin/claude"],linux:["~/.local/bin/claude","~/.npm-global/bin/claude","/usr/local/bin/claude"],win32:["%APPDATA%\\npm\\claude.cmd","%USERPROFILE%\\.local\\bin\\claude.exe"]},version:{darwin:{strategy:"symlink-version"},linux:{strategy:"symlink-version"},win32:{strategy:"none"}}},{key:"claude-desktop",displayName:"Claude Desktop",isCli:!1,detect:{darwin:["/Applications/Claude.app/Contents/Info.plist","~/Applications/Claude.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\AnthropicClaude\\claude.exe"]},version:{darwin:{strategy:"plist"},win32:{strategy:"none"}}},{key:"chatgpt-desktop",displayName:"ChatGPT Desktop",isCli:!1,detect:{darwin:["/Applications/ChatGPT.app/Contents/Info.plist","~/Applications/ChatGPT.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"cursor",displayName:"Cursor",isCli:!1,detect:{darwin:["/Applications/Cursor.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\cursor\\Cursor.exe"],linux:["/usr/share/cursor/resources/app/package.json","/opt/cursor/resources/app/package.json"]},version:{darwin:{strategy:"plist"},linux:{strategy:"pkgjson"},win32:{strategy:"none"}}},{key:"windsurf",displayName:"Windsurf",isCli:!1,detect:{darwin:["/Applications/Windsurf.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\Windsurf\\Windsurf.exe"],linux:["/usr/share/windsurf/resources/app/package.json","/opt/windsurf/resources/app/package.json"]},version:{darwin:{strategy:"plist"},linux:{strategy:"pkgjson"},win32:{strategy:"none"}}},{key:"ollama",displayName:"Ollama",isCli:!0,detect:{darwin:["/opt/homebrew/bin/ollama","/usr/local/bin/ollama","/Applications/Ollama.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\Ollama\\ollama.exe"],linux:["/usr/local/bin/ollama","/usr/bin/ollama"]},version:{darwin:{strategy:"exec-version"},linux:{strategy:"exec-version"},win32:{strategy:"none"}}},{key:"openai-codex",displayName:"OpenAI Codex",isCli:!0,detect:{darwin:["/Applications/Codex.app/Contents/Info.plist","~/.npm-global/bin/codex"]},version:{darwin:{strategy:"plist"}}},{key:"perplexity-desktop",displayName:"Perplexity Desktop",isCli:!1,detect:{darwin:["/Applications/Perplexity.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"google-antigravity",displayName:"Google Antigravity",isCli:!1,detect:{darwin:["/Applications/Antigravity.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"warp",displayName:"Warp",isCli:!1,detect:{darwin:["/Applications/Warp.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"wispr-flow",displayName:"Wispr Flow",isCli:!1,detect:{darwin:["/Applications/Wispr Flow.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"conductor",displayName:"Conductor",isCli:!1,detect:{darwin:["/Applications/Conductor.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"lm-studio",displayName:"LM Studio",isCli:!1,detect:{darwin:["/Applications/LM Studio.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\lm-studio\\LM Studio.exe"]},version:{darwin:{strategy:"plist"},win32:{strategy:"none"}}}],Ss=/\d+(?:\.\d+){1,4}/;function ws(e,t){let r=e;return r.startsWith("~")&&(r=t+r.slice(1)),r=r.replace(/%([^%]+)%/g,(n,o)=>process.env[o]??""),r}function ks(e){if(!e.includes("*"))return us(e)?e:null;let t=hs(e),r=gs(e),n=r.indexOf("*"),o=r.slice(0,n),s=r.slice(n+1),i;try{i=ds(t)}catch{return null}for(let a of i)if(a.startsWith(o)&&a.endsWith(s)&&a.length>=o.length+s.length)return ys(t,a);return null}function Cs(e){let t=e.replace(/\.plist$/,"");try{return se("defaults",["read",t,"CFBundleShortVersionString"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).trim()}catch{return""}}function xs(e){try{let t=JSON.parse(yr(e,"utf8"));return typeof t.version=="string"?t.version.trim():""}catch{return""}}function bs(e){try{let t=ps(e);for(let r of t.split(/[/\\]/)){let n=r.match(/^\d+(?:\.\d+){1,4}$/);if(n)return n[0]}}catch{}return""}function Os(e){try{let r=se(e,["--version"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).match(Ss);return r?r[0]:""}catch{return""}}function Ps(e,t){switch(e){case"plist":return Cs(t);case"pkgjson":return xs(t);case"symlink-version":return bs(t);case"exec-version":return Os(t);case"none":return""}}function Es(e,t){let r=[];for(let n of vs){let o=n.detect[e];if(!o)continue;let s="";for(let l of o){let c=ks(ws(l,t));if(c){s=c;break}}if(s==="")continue;let i=n.version[e],a=i?Ps(i.strategy,s):"";r.push({key:n.key,name:n.displayName,version:a,sourcePath:s})}return r.sort((n,o)=>n.name.localeCompare(o.name)),r}function Is(){try{let e=se("sw_vers",["-productName"],{encoding:"utf8",timeout:4e3}).trim(),t=se("sw_vers",["-productVersion"],{encoding:"utf8",timeout:4e3}).trim(),r=t.split(".")[0]??"";return{platform:r?`${e} ${r}`:e,version:t}}catch{return{platform:"macOS",version:K()}}}function Rs(){try{let t=yr("/etc/os-release","utf8").match(/^PRETTY_NAME="?([^"\n]+)"?/m);if(t&&t[1])return{platform:t[1],version:K()}}catch{}return{platform:"Linux",version:K()}}function Ts(){let e=K();return{platform:Number(e.split(".")[2]??"0")>=22e3?"Windows 11":"Windows 10",version:e}}function Ue(e){let t;return e==="darwin"?t=Is():e==="linux"?t=Rs():e==="win32"?t=Ts():t={platform:e,version:K()},{osPlatform:t.platform,osVersion:t.version}}function As(e){let t=Ue(e),r={platform:t.osPlatform,version:t.osVersion},n="";return e==="win32"&&(n=(process.env.USERDNSDOMAIN??process.env.USERDOMAIN??"").trim()),{hostname:S()||ms(),osPlatform:r.platform,osVersion:r.version,deviceType:"Workstation",accountName:Te(),accountDomain:n}}async function Ne(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??fs(),r=process.platform,n=Es(r,t),o=As(r);if(e.dryRun)return{agents:n.length,detected:n,host:o,uploaded:!1};let s=x(t),i=s.orchestratorUrl.replace(/\/$/,""),a=y(t),l=await fetch(`${i}/v1/inventory/agents`,{method:"POST",headers:C(s.orgId,s.apiKey),body:JSON.stringify({orgId:s.orgId,machineId:a,hostname:o.hostname,osPlatform:o.osPlatform,osVersion:o.osVersion,deviceType:o.deviceType,accountName:o.accountName,accountDomain:o.accountDomain,agents:n.map(c=>({key:c.key,name:c.name,version:c.version,sourcePath:c.sourcePath}))})});if(!l.ok){let c=await l.text();throw new Error(`scan-agents upload failed: ${l.status} ${c}`)}return{agents:n.length,detected:n,host:o,uploaded:!0}}import{execFile as _s,spawn as Us}from"node:child_process";import{readFileSync as Ns,writeFileSync as Ms}from"node:fs";import{join as $s}from"node:path";var js=1440*60*1e3,Vs=2e3,Ws=6e4,Ls=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function Sr(e){return $s(e,".venos","update-check.json")}function Hs(e){try{let t=JSON.parse(Ns(Sr(e),"utf8"));if(typeof t.checkedAt=="number"&&t.policy&&typeof t.policy.mode=="string")return t}catch{}return null}function Fs(e,t){try{Ms(Sr(e),JSON.stringify(t))}catch{}}function vr(e){let t=/^(\d+)\.(\d+)\.(\d+)/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Ds(e,t){let r=vr(e),n=vr(t);if(!r||!n)return!1;for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function Js(e,t,r,n){let s=`${e.replace(/\/$/,"")}/api/cli/policy?orgId=${encodeURIComponent(t)}`;n&&n.trim()!==""&&(s+=`&machineId=${encodeURIComponent(n)}`);try{let i=await r(s,{signal:AbortSignal.timeout(Vs)});if(!i.ok)return null;let a=await i.json();return{mode:typeof a.mode=="string"&&a.mode!==""?a.mode:"notify",latest:typeof a.latest=="string"?a.latest.trim():"",pinnedVersion:typeof a.pinnedVersion=="string"?a.pinnedVersion.trim():""}}catch{return null}}function Ks(e,t){if(e.mode==="off")return null;if(e.mode==="pinned"){let r=e.pinnedVersion;return r===""||r===t?null:{kind:"notify",targetVersion:r,message:`venos: your organization pins venos to ${r} (you have ${t}).
119
- Install it with: npm i -g @venos-inc/venos@${r}`}}return Ds(e.latest,t)?e.mode==="auto"?{kind:"auto",targetVersion:e.latest,message:`venos: auto-updating ${t} -> ${e.latest} per your organization's policy...`}:{kind:"notify",targetVersion:e.latest,message:`venos: a newer version is available (${t} -> ${e.latest}).
120
- Update with: npm i -g @venos-inc/venos@latest`}:null}async function Me(e){let t=e.now??Date.now(),r=e.fetchImpl??fetch,n,o=e.bypassCache?null:Hs(e.home);if(o&&t-o.checkedAt<js)n=o.policy;else{if(n=await Js(e.orchestratorUrl,e.orgId,r,e.machineId),n===null)return null;Fs(e.home,{checkedAt:t,policy:n})}return Ks(n,e.currentVersion)}var Bs=(e,t)=>new Promise((r,n)=>{_s(e,t,{timeout:Ws},o=>{o?n(o):r()})});async function $e(e,t=Bs){if(!Ls.test(e))return!1;try{return await t("npm",["install","-g",`@venos-inc/venos@${e}`]),!0}catch{return!1}}function Gs(){let e=process.argv[1]??"";if(e!=="")try{Us(process.execPath,[e,"heartbeat"],{detached:!0,stdio:"ignore",env:{...process.env,VENOS_SKIP_AUTOUPDATE:"1"}}).unref()}catch{}}async function wr(e,t=$e,r=Gs){try{let n=await Me({...e,bypassCache:!0});return!n||n.kind!=="auto"||!await t(n.targetVersion)?null:(r(),n.targetVersion)}catch{return null}}function Xs(e,t){let r=typeof t.orgId=="string"&&t.orgId.trim()!==""&&typeof t.orchestratorUrl=="string"&&t.orchestratorUrl.trim()!=="",n="";try{n=q()}catch{}let o={orgId:t.orgId,orchestratorUrl:t.orchestratorUrl,mcpServerPath:n,hookCommand:"venos hook",usageSyncCommand:"venos usage-sync --throttle",...t.apiKey?{apiKey:t.apiKey}:{}},s=!1,i=!1;for(let c of F)if(c.isInstalled(e)){s=!0;try{c.isWired(c.load(c.configPath(e)),o)&&(i=!0)}catch{}}let a=!s||i,l=zt(e);return{config_valid:r,hooks_wired:a,service_installed:l}}async function xr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=Cr(r,".venos","config.json");if(!Ys(n))return{machineId:"",status:"skipped-no-config",checks:{}};let o=JSON.parse(zs(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=y(r),c=S(),u=Xs(r,o),{osPlatform:p,osVersion:f}=Ue(process.platform),k={orgId:s,machineId:l,hostname:c,cliVersion:e.cliVersion??"",osPlatform:p,osVersion:f,checks:u},ae=`${i.replace(/\/$/,"")}/v1/inventory/heartbeat?orgId=${encodeURIComponent(s)}`,N={"Content-Type":"application/json","X-Venos-Org":s};a&&(N.Authorization=`Bearer ${a}`);let M=await A(ae,{method:"POST",headers:N,body:JSON.stringify(k)},{timeoutMs:5e3});if(!M.ok)throw new Error(`venos heartbeat: orchestrator returned ${M.status}`);try{kr(br(r),new Date().toISOString())}catch{}let $=e.cliVersion??"";return $!==""&&process.env.VENOS_SKIP_AUTOUPDATE!=="1"&&await wr({currentVersion:$,orchestratorUrl:i,orgId:s,home:r,machineId:l}),{machineId:l,status:"sent",checks:u}}function br(e){return Cr(e,".venos","heartbeat.last")}function je(e,t=60,r=Zs){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=br(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{kr(o,new Date().toISOString())}catch{}let s=process.argv[1]??"";return r(process.execPath,[s,"heartbeat"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}import{readdirSync as Pr,readFileSync as Er}from"node:fs";import{join as v}from"node:path";function Ve(e){try{return Pr(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}}function qs(e,t){let r;try{r=Er(v(e,"SKILL.md"),"utf8")}catch{return null}let n=r.match(/^---\s*\n([\s\S]*?)\n---/);if(!n)return{name:t,description:""};let o=n[1]??"",s=o.match(/^name:\s*(.+)$/m)?.[1]?.trim()??t,a=o.match(/^description:\s*(.+?)(?=\n\w+:|$)/ms)?.[1]?.trim().replace(/\s+/g," ")??"";return{name:s,description:a}}function Or(e,t,r){let n=[];for(let o of Ve(e)){let s=v(e,o),i=qs(s,o);i&&n.push({name:i.name,description:i.description,source:t,pluginName:r,path:s})}return n}function Ir(e){let t=[...Or(v(e,"skills"),"user","")],r=[],n=v(e,"plugins","marketplaces");for(let o of Ve(n)){let s=v(n,o,"plugins");for(let i of Ve(s)){let a=v(s,i),l="",c=o;try{let f=JSON.parse(Er(v(a,".claude-plugin","plugin.json"),"utf8"));l=f.description??"",c=f.author?.name??o}catch{}let u=Or(v(a,"skills"),"plugin",i);t.push(...u);let p=0;try{p=Pr(v(a,"commands"),{withFileTypes:!0}).filter(f=>f.name.endsWith(".md")).length}catch{}r.push({name:i,description:l,author:c,source:"marketplace",skillCount:u.length,commandCount:p})}}return t.sort((o,s)=>o.name.localeCompare(s.name)||o.pluginName.localeCompare(s.pluginName)),r.sort((o,s)=>o.name.localeCompare(s.name)),{skills:t,plugins:r}}function Qs(e,t){let r=[],n={mode:"replace",skills:[],plugins:[]},o=JSON.stringify({skills:[],plugins:[]}).length,s=(i,a)=>{let l=JSON.stringify(i).length+1;o+l>t&&(n.skills.length>0||n.plugins.length>0)&&(r.push(n),n={mode:"append",skills:[],plugins:[]},o=JSON.stringify({skills:[],plugins:[]}).length),a==="skill"?n.skills.push(i):n.plugins.push(i),o+=l};for(let i of e.skills)s(i,"skill");for(let i of e.plugins)s(i,"plugin");return r.push(n),r}var Rr=6e3;async function Tr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=x(t),n=Ir(v(t,".claude")),o=Qs(n,Rr),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=S();for(let l of o){let c=await fetch(`${s}/v1/inventory/skills`,{method:"POST",headers:C(r.orgId,r.apiKey),body:JSON.stringify({orgId:r.orgId,machineId:i,hostname:a,mode:l.mode,skills:l.skills,plugins:l.plugins})});if(!c.ok){let u=await c.text();throw new Error(`scan-skills upload failed: ${c.status} ${u}`)}}return{uploaded:n.skills.length+n.plugins.length,skills:n.skills.length,plugins:n.plugins.length,chunks:o.length}}function ei(e,t,r){let n=r.risk_assessment?.recommendation??"",o=r.risk_assessment?.score??0;return(r.issues??[]).map(s=>({category:s.category??"uncategorized",severity:(s.severity??"low").toLowerCase(),title:s.finding??s.id??"finding",owaspMcp:"",skillName:e.name,recommendation:n,metadata:{rule_id:s.id??"",skill_name:e.name,plugin_name:e.pluginName,source_path:e.path,file:s.location?.file??"",start_line:s.location?.start_line??null,explanation:s.explanation??"",remediation:s.remediation??"",recommendation:n,risk_score:o,machine_id:t}}))}function ti(e,t){let r=[],n=[],o=0;for(let s of e){let i=JSON.stringify(s).length+1;o+i>t&&n.length>0&&(r.push(n),n=[],o=0),n.push(s),o+=i}return n.length>0&&r.push(n),r}async function ri(e){let{execFile:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),n=r(t),o;try{({stdout:o}=await n("skillspector",["scan",e,"--format","json","--no-llm"],{timeout:18e4,maxBuffer:50*1024*1024}))}catch(s){if(o=s.stdout??"",!o)return null}try{return JSON.parse(o)}catch{return null}}async function Ar(e,t=ri){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=x(r),o=Ir(v(r,".claude")),s=y(r),i=S(),a=[],l=0;for(let p of o.skills){if(!p.path)continue;let f=await t(p.path);f&&(l++,a.push(...ei(p,s,f)))}let c=n.orchestratorUrl.replace(/\/$/,""),u=ti(a,Rr);for(let p of u){let f=await fetch(`${c}/v1/inventory/skill-findings`,{method:"POST",headers:C(n.orgId,n.apiKey),body:JSON.stringify({orgId:n.orgId,machineId:s,hostname:i,findings:p})});if(!f.ok){let k=await f.text();throw new Error(`scan-skills findings upload failed: ${f.status} ${k}`)}}return{skillsScanned:l,findings:a.length,chunks:u.length}}import{readFileSync as ni}from"node:fs";import{join as ie}from"node:path";function oi(e,t){let r;try{r=JSON.parse(ni(e,"utf8"))}catch{return[]}let n=r.mcpServers;if(!n||typeof n!="object")return[];let o=[];for(let[s,i]of Object.entries(n)){if(!s||!i||typeof i!="object")continue;let a=i.url??i.serverUrl??"",l=(i.type??i.transport??"").toLowerCase(),c=a?l==="sse"?"sse":"streamable-http":"stdio";o.push({name:s,client:t,transport:c,command:i.command??"",args:Array.isArray(i.args)?i.args.map(String):[],url:a,sourcePath:e})}return o}function si(e){let t=[{path:ie(e,".claude.json"),client:"Claude Code"},{path:ie(e,".cursor","mcp.json"),client:"Cursor"},{path:ie(e,".codeium","windsurf","mcp_config.json"),client:"Windsurf"},{path:ie(e,"Library","Application Support","Claude","claude_desktop_config.json"),client:"Claude Desktop"}],r=[];for(let n of t)r.push(...oi(n.path,n.client));return r.sort((n,o)=>n.name.localeCompare(o.name)||n.client.localeCompare(o.client)),r}function ii(e,t){let r=[],n={mode:"replace",servers:[]},o=JSON.stringify({servers:[]}).length;for(let s of e){let i=JSON.stringify(s).length+1;o+i>t&&n.servers.length>0&&(r.push(n),n={mode:"append",servers:[]},o=JSON.stringify({servers:[]}).length),n.servers.push(s),o+=i}return r.push(n),r}var ai=6e3;async function _r(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=x(t),n=si(t),o=ii(n,ai),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=S();for(let l of o){let c=await fetch(`${s}/v1/inventory/mcp`,{method:"POST",headers:C(r.orgId,r.apiKey),body:JSON.stringify({orgId:r.orgId,machineId:i,hostname:a,mode:l.mode,servers:l.servers})});if(!c.ok){let u=await c.text();throw new Error(`scan-mcp upload failed: ${c.status} ${u}`)}}return{servers:n.length,chunks:o.length}}var Mr="0.1.6";async function Ur(){try{let e=JSON.parse(ci(J(We()),"utf8"));if(!e.orchestratorUrl||!e.orgId)return;let t=await Me({currentVersion:Mr,orchestratorUrl:e.orchestratorUrl,orgId:e.orgId,home:We(),machineId:y(We())});if(!t)return;if(t.kind==="auto"){process.stderr.write(`
118
+ If you are developing locally, run: pnpm --filter @venos/session-waste build`)}var Qo=qo(Xo);async function gr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=mr(t,".venos","config.json");if(!Zo(r))throw new Error(`venos config not found at ${r} \u2014 run "venos init" first`);let n=JSON.parse(zo(r,"utf8")),o=pr(),s=mr(t,".claude"),{stdout:i}=await Qo(process.execPath,[o,s],{maxBuffer:32*1024*1024}),a=JSON.parse(i),l=Array.isArray(a.findings)?a.findings:[];if(l.length===0)return{sessionsScanned:a.sessionsScanned??0,findingsStored:0};let u=`${n.orchestratorUrl.replace(/\/$/,"")}/api/finops/session-waste?orgId=${encodeURIComponent(n.orgId)}`,p=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json","X-Venos-Org":n.orgId},body:JSON.stringify({findings:l})});if(!p.ok)throw new Error(`venos waste-scan: orchestrator returned ${p.status}`);let f=await p.json();return{sessionsScanned:a.sessionsScanned??0,findingsStored:f.stored??l.length}}import{readFileSync as es,existsSync as ts,statSync as rs,writeFileSync as ns}from"node:fs";import{join as Ae}from"node:path";import{execFile as os,spawn as ss}from"node:child_process";import{promisify as is}from"node:util";var as=is(os),cs=500;function ls(e,t,r=cs){let n=[];for(let o=0;o<e.length;o+=r)n.push({sessions:e.slice(o,o+r),attribution:[]});for(let o=0;o<t.length;o+=r)n.push({sessions:[],attribution:t.slice(o,o+r)});return n}function us(e){return Ae(e,".venos","usage-sync.last")}function _e(e,t,r){try{return r-rs(e).mtimeMs>=t}catch{return!0}}function hr(e,t=60,r=ss){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=us(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{ns(o,new Date().toISOString())}catch{return{ran:!1,reason:"stamp-write-failed"}}let s=process.argv[1]??"";return r(process.execPath,[s,"usage-sync"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}async function yr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=Ae(r,".venos","config.json");if(!ts(n))throw new Error(`venos config not found at ${n} \u2014 run "venos init" first`);let o=JSON.parse(es(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=fr(),c=Ae(r,".claude"),{stdout:u}=await as(process.execPath,[l,c],{maxBuffer:64*1024*1024}),p=JSON.parse(u),f=Array.isArray(p.sessions)?p.sessions:[],k=Array.isArray(p.attribution)?p.attribution:[];if(f.length===0)return{sessionsScanned:p.sessionsScanned??0,sessionsStored:0};let ae=`${i.replace(/\/$/,"")}/api/finops/claude-usage?orgId=${encodeURIComponent(s)}`,N={"Content-Type":"application/json","X-Venos-Org":s};a&&(N.Authorization=`Bearer ${a}`);let $=0;for(let M of ls(f,k)){let ce=await A(ae,{method:"POST",headers:N,body:JSON.stringify(M)},{timeoutMs:1e4});if(!ce.ok)throw new Error(`venos usage-sync: orchestrator returned ${ce.status}`);let Mr=await ce.json();$+=Mr.sessionsStored??M.sessions.length}return{sessionsScanned:p.sessionsScanned??0,sessionsStored:$}}import{existsSync as zs,readFileSync as Zs,writeFileSync as Cr}from"node:fs";import{join as xr}from"node:path";import{spawn as Xs}from"node:child_process";import{execFileSync as se}from"node:child_process";import{existsSync as ds,readdirSync as ps,readFileSync as vr,realpathSync as fs}from"node:fs";import{homedir as ms,hostname as gs,release as K}from"node:os";import{basename as hs,dirname as ys,join as vs}from"node:path";var Ss=[{key:"claude-code",displayName:"Claude Code",isCli:!0,detect:{darwin:["~/.local/bin/claude","~/.claude/local/claude","/opt/homebrew/bin/claude","/usr/local/bin/claude"],linux:["~/.local/bin/claude","~/.npm-global/bin/claude","/usr/local/bin/claude"],win32:["%APPDATA%\\npm\\claude.cmd","%USERPROFILE%\\.local\\bin\\claude.exe"]},version:{darwin:{strategy:"symlink-version"},linux:{strategy:"symlink-version"},win32:{strategy:"none"}}},{key:"claude-desktop",displayName:"Claude Desktop",isCli:!1,detect:{darwin:["/Applications/Claude.app/Contents/Info.plist","~/Applications/Claude.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\AnthropicClaude\\claude.exe"]},version:{darwin:{strategy:"plist"},win32:{strategy:"none"}}},{key:"chatgpt-desktop",displayName:"ChatGPT Desktop",isCli:!1,detect:{darwin:["/Applications/ChatGPT.app/Contents/Info.plist","~/Applications/ChatGPT.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"cursor",displayName:"Cursor",isCli:!1,detect:{darwin:["/Applications/Cursor.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\cursor\\Cursor.exe"],linux:["/usr/share/cursor/resources/app/package.json","/opt/cursor/resources/app/package.json"]},version:{darwin:{strategy:"plist"},linux:{strategy:"pkgjson"},win32:{strategy:"none"}}},{key:"windsurf",displayName:"Windsurf",isCli:!1,detect:{darwin:["/Applications/Windsurf.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\Windsurf\\Windsurf.exe"],linux:["/usr/share/windsurf/resources/app/package.json","/opt/windsurf/resources/app/package.json"]},version:{darwin:{strategy:"plist"},linux:{strategy:"pkgjson"},win32:{strategy:"none"}}},{key:"ollama",displayName:"Ollama",isCli:!0,detect:{darwin:["/opt/homebrew/bin/ollama","/usr/local/bin/ollama","/Applications/Ollama.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\Ollama\\ollama.exe"],linux:["/usr/local/bin/ollama","/usr/bin/ollama"]},version:{darwin:{strategy:"exec-version"},linux:{strategy:"exec-version"},win32:{strategy:"none"}}},{key:"openai-codex",displayName:"OpenAI Codex",isCli:!0,detect:{darwin:["/Applications/Codex.app/Contents/Info.plist","~/.npm-global/bin/codex"]},version:{darwin:{strategy:"plist"}}},{key:"perplexity-desktop",displayName:"Perplexity Desktop",isCli:!1,detect:{darwin:["/Applications/Perplexity.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"google-antigravity",displayName:"Google Antigravity",isCli:!1,detect:{darwin:["/Applications/Antigravity.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"warp",displayName:"Warp",isCli:!1,detect:{darwin:["/Applications/Warp.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"wispr-flow",displayName:"Wispr Flow",isCli:!1,detect:{darwin:["/Applications/Wispr Flow.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"conductor",displayName:"Conductor",isCli:!1,detect:{darwin:["/Applications/Conductor.app/Contents/Info.plist"]},version:{darwin:{strategy:"plist"}}},{key:"lm-studio",displayName:"LM Studio",isCli:!1,detect:{darwin:["/Applications/LM Studio.app/Contents/Info.plist"],win32:["%LOCALAPPDATA%\\Programs\\lm-studio\\LM Studio.exe"]},version:{darwin:{strategy:"plist"},win32:{strategy:"none"}}}],ws=/\d+(?:\.\d+){1,4}/;function ks(e,t){let r=e;return r.startsWith("~")&&(r=t+r.slice(1)),r=r.replace(/%([^%]+)%/g,(n,o)=>process.env[o]??""),r}function Cs(e){if(!e.includes("*"))return ds(e)?e:null;let t=ys(e),r=hs(e),n=r.indexOf("*"),o=r.slice(0,n),s=r.slice(n+1),i;try{i=ps(t)}catch{return null}for(let a of i)if(a.startsWith(o)&&a.endsWith(s)&&a.length>=o.length+s.length)return vs(t,a);return null}function xs(e){let t=e.replace(/\.plist$/,"");try{return se("defaults",["read",t,"CFBundleShortVersionString"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).trim()}catch{return""}}function bs(e){try{let t=JSON.parse(vr(e,"utf8"));return typeof t.version=="string"?t.version.trim():""}catch{return""}}function Os(e){try{let t=fs(e);for(let r of t.split(/[/\\]/)){let n=r.match(/^\d+(?:\.\d+){1,4}$/);if(n)return n[0]}}catch{}return""}function Ps(e){try{let r=se(e,["--version"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).match(ws);return r?r[0]:""}catch{return""}}function Es(e,t){switch(e){case"plist":return xs(t);case"pkgjson":return bs(t);case"symlink-version":return Os(t);case"exec-version":return Ps(t);case"none":return""}}function Is(e,t){let r=[];for(let n of Ss){let o=n.detect[e];if(!o)continue;let s="";for(let l of o){let c=Cs(ks(l,t));if(c){s=c;break}}if(s==="")continue;let i=n.version[e],a=i?Es(i.strategy,s):"";r.push({key:n.key,name:n.displayName,version:a,sourcePath:s})}return r.sort((n,o)=>n.name.localeCompare(o.name)),r}function Rs(){try{let e=se("sw_vers",["-productName"],{encoding:"utf8",timeout:4e3}).trim(),t=se("sw_vers",["-productVersion"],{encoding:"utf8",timeout:4e3}).trim(),r=t.split(".")[0]??"";return{platform:r?`${e} ${r}`:e,version:t}}catch{return{platform:"macOS",version:K()}}}function Ts(){try{let t=vr("/etc/os-release","utf8").match(/^PRETTY_NAME="?([^"\n]+)"?/m);if(t&&t[1])return{platform:t[1],version:K()}}catch{}return{platform:"Linux",version:K()}}function As(){let e=K();return{platform:Number(e.split(".")[2]??"0")>=22e3?"Windows 11":"Windows 10",version:e}}function Ue(e){let t;return e==="darwin"?t=Rs():e==="linux"?t=Ts():e==="win32"?t=As():t={platform:e,version:K()},{osPlatform:t.platform,osVersion:t.version}}function _s(e){let t=Ue(e),r={platform:t.osPlatform,version:t.osVersion},n="";return e==="win32"&&(n=(process.env.USERDNSDOMAIN??process.env.USERDOMAIN??"").trim()),{hostname:S()||gs(),osPlatform:r.platform,osVersion:r.version,deviceType:"Workstation",accountName:Te(),accountDomain:n}}async function Ne(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??ms(),r=process.platform,n=Is(r,t),o=_s(r);if(e.dryRun)return{agents:n.length,detected:n,host:o,uploaded:!1};let s=x(t),i=s.orchestratorUrl.replace(/\/$/,""),a=y(t),l=await fetch(`${i}/v1/inventory/agents`,{method:"POST",headers:C(s.orgId,s.apiKey),body:JSON.stringify({orgId:s.orgId,machineId:a,hostname:o.hostname,osPlatform:o.osPlatform,osVersion:o.osVersion,deviceType:o.deviceType,accountName:o.accountName,accountDomain:o.accountDomain,agents:n.map(c=>({key:c.key,name:c.name,version:c.version,sourcePath:c.sourcePath}))})});if(!l.ok){let c=await l.text();throw new Error(`scan-agents upload failed: ${l.status} ${c}`)}return{agents:n.length,detected:n,host:o,uploaded:!0}}import{execFile as Us,spawn as Ns}from"node:child_process";import{readFileSync as $s,writeFileSync as Ms}from"node:fs";import{join as js}from"node:path";var Vs=1440*60*1e3,Ws=2e3,Ls=6e4,Hs=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function wr(e){return js(e,".venos","update-check.json")}function Fs(e){try{let t=JSON.parse($s(wr(e),"utf8"));if(typeof t.checkedAt=="number"&&t.policy&&typeof t.policy.mode=="string")return t}catch{}return null}function Ds(e,t){try{Ms(wr(e),JSON.stringify(t))}catch{}}function Sr(e){let t=/^(\d+)\.(\d+)\.(\d+)/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Js(e,t){let r=Sr(e),n=Sr(t);if(!r||!n)return!1;for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function Ks(e,t,r,n){let s=`${e.replace(/\/$/,"")}/api/cli/policy?orgId=${encodeURIComponent(t)}`;n&&n.trim()!==""&&(s+=`&machineId=${encodeURIComponent(n)}`);try{let i=await r(s,{signal:AbortSignal.timeout(Ws)});if(!i.ok)return null;let a=await i.json();return{mode:typeof a.mode=="string"&&a.mode!==""?a.mode:"notify",latest:typeof a.latest=="string"?a.latest.trim():"",pinnedVersion:typeof a.pinnedVersion=="string"?a.pinnedVersion.trim():""}}catch{return null}}function Bs(e,t){if(e.mode==="off")return null;if(e.mode==="pinned"){let r=e.pinnedVersion;return r===""||r===t?null:{kind:"notify",targetVersion:r,message:`venos: your organization pins venos to ${r} (you have ${t}).
119
+ Install it with: npm i -g @venos-inc/venos@${r}`}}return Js(e.latest,t)?e.mode==="auto"?{kind:"auto",targetVersion:e.latest,message:`venos: auto-updating ${t} -> ${e.latest} per your organization's policy...`}:{kind:"notify",targetVersion:e.latest,message:`venos: a newer version is available (${t} -> ${e.latest}).
120
+ Update with: npm i -g @venos-inc/venos@latest`}:null}async function $e(e){let t=e.now??Date.now(),r=e.fetchImpl??fetch,n,o=e.bypassCache?null:Fs(e.home);if(o&&t-o.checkedAt<Vs)n=o.policy;else{if(n=await Ks(e.orchestratorUrl,e.orgId,r,e.machineId),n===null)return null;Ds(e.home,{checkedAt:t,policy:n})}return Bs(n,e.currentVersion)}var Gs=(e,t)=>new Promise((r,n)=>{Us(e,t,{timeout:Ls},o=>{o?n(o):r()})});async function Me(e,t=Gs){if(!Hs.test(e))return!1;try{return await t("npm",["install","-g",`@venos-inc/venos@${e}`]),!0}catch{return!1}}function Ys(){let e=process.argv[1]??"";if(e!=="")try{Ns(process.execPath,[e,"heartbeat"],{detached:!0,stdio:"ignore",env:{...process.env,VENOS_SKIP_AUTOUPDATE:"1"}}).unref()}catch{}}async function kr(e,t=Me,r=Ys){try{let n=await $e({...e,bypassCache:!0});return!n||n.kind!=="auto"||!await t(n.targetVersion)?null:(r(),n.targetVersion)}catch{return null}}function qs(e,t){let r=typeof t.orgId=="string"&&t.orgId.trim()!==""&&typeof t.orchestratorUrl=="string"&&t.orchestratorUrl.trim()!=="",n="";try{n=q()}catch{}let o={orgId:t.orgId,orchestratorUrl:t.orchestratorUrl,mcpServerPath:n,hookCommand:"venos hook",usageSyncCommand:"venos usage-sync --throttle",...t.apiKey?{apiKey:t.apiKey}:{}},s=!1,i=!1;for(let c of F)if(c.isInstalled(e)){s=!0;try{c.isWired(c.load(c.configPath(e)),o)&&(i=!0)}catch{}}let a=!s||i,l=Zt(e);return{config_valid:r,hooks_wired:a,service_installed:l}}async function br(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=xr(r,".venos","config.json");if(!zs(n))return{machineId:"",status:"skipped-no-config",checks:{}};let o=JSON.parse(Zs(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=y(r),c=S(),u=qs(r,o),{osPlatform:p,osVersion:f}=Ue(process.platform),k={orgId:s,machineId:l,hostname:c,cliVersion:e.cliVersion??"",osPlatform:p,osVersion:f,checks:u},ae=`${i.replace(/\/$/,"")}/v1/inventory/heartbeat?orgId=${encodeURIComponent(s)}`,N={"Content-Type":"application/json","X-Venos-Org":s};a&&(N.Authorization=`Bearer ${a}`);let $=await A(ae,{method:"POST",headers:N,body:JSON.stringify(k)},{timeoutMs:5e3});if(!$.ok)throw new Error(`venos heartbeat: orchestrator returned ${$.status}`);try{Cr(Or(r),new Date().toISOString())}catch{}let M=e.cliVersion??"";return M!==""&&process.env.VENOS_SKIP_AUTOUPDATE!=="1"&&await kr({currentVersion:M,orchestratorUrl:i,orgId:s,home:r,machineId:l}),{machineId:l,status:"sent",checks:u}}function Or(e){return xr(e,".venos","heartbeat.last")}function je(e,t=60,r=Xs){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=Or(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{Cr(o,new Date().toISOString())}catch{}let s=process.argv[1]??"";return r(process.execPath,[s,"heartbeat"],{detached:!0,stdio:"ignore"}).unref(),{ran:!0,reason:"spawned"}}import{readdirSync as Er,readFileSync as Ir}from"node:fs";import{join as v}from"node:path";function Ve(e){try{return Er(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}}function Qs(e,t){let r;try{r=Ir(v(e,"SKILL.md"),"utf8")}catch{return null}let n=r.match(/^---\s*\n([\s\S]*?)\n---/);if(!n)return{name:t,description:""};let o=n[1]??"",s=o.match(/^name:\s*(.+)$/m)?.[1]?.trim()??t,a=o.match(/^description:\s*(.+?)(?=\n\w+:|$)/ms)?.[1]?.trim().replace(/\s+/g," ")??"";return{name:s,description:a}}function Pr(e,t,r){let n=[];for(let o of Ve(e)){let s=v(e,o),i=Qs(s,o);i&&n.push({name:i.name,description:i.description,source:t,pluginName:r,path:s})}return n}function Rr(e){let t=[...Pr(v(e,"skills"),"user","")],r=[],n=v(e,"plugins","marketplaces");for(let o of Ve(n)){let s=v(n,o,"plugins");for(let i of Ve(s)){let a=v(s,i),l="",c=o;try{let f=JSON.parse(Ir(v(a,".claude-plugin","plugin.json"),"utf8"));l=f.description??"",c=f.author?.name??o}catch{}let u=Pr(v(a,"skills"),"plugin",i);t.push(...u);let p=0;try{p=Er(v(a,"commands"),{withFileTypes:!0}).filter(f=>f.name.endsWith(".md")).length}catch{}r.push({name:i,description:l,author:c,source:"marketplace",skillCount:u.length,commandCount:p})}}return t.sort((o,s)=>o.name.localeCompare(s.name)||o.pluginName.localeCompare(s.pluginName)),r.sort((o,s)=>o.name.localeCompare(s.name)),{skills:t,plugins:r}}function ei(e,t){let r=[],n={mode:"replace",skills:[],plugins:[]},o=JSON.stringify({skills:[],plugins:[]}).length,s=(i,a)=>{let l=JSON.stringify(i).length+1;o+l>t&&(n.skills.length>0||n.plugins.length>0)&&(r.push(n),n={mode:"append",skills:[],plugins:[]},o=JSON.stringify({skills:[],plugins:[]}).length),a==="skill"?n.skills.push(i):n.plugins.push(i),o+=l};for(let i of e.skills)s(i,"skill");for(let i of e.plugins)s(i,"plugin");return r.push(n),r}var Tr=6e3;async function Ar(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=x(t),n=Rr(v(t,".claude")),o=ei(n,Tr),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=S();for(let l of o){let c=await fetch(`${s}/v1/inventory/skills`,{method:"POST",headers:C(r.orgId,r.apiKey),body:JSON.stringify({orgId:r.orgId,machineId:i,hostname:a,mode:l.mode,skills:l.skills,plugins:l.plugins})});if(!c.ok){let u=await c.text();throw new Error(`scan-skills upload failed: ${c.status} ${u}`)}}return{uploaded:n.skills.length+n.plugins.length,skills:n.skills.length,plugins:n.plugins.length,chunks:o.length}}function ti(e,t,r){let n=r.risk_assessment?.recommendation??"",o=r.risk_assessment?.score??0;return(r.issues??[]).map(s=>({category:s.category??"uncategorized",severity:(s.severity??"low").toLowerCase(),title:s.finding??s.id??"finding",owaspMcp:"",skillName:e.name,recommendation:n,metadata:{rule_id:s.id??"",skill_name:e.name,plugin_name:e.pluginName,source_path:e.path,file:s.location?.file??"",start_line:s.location?.start_line??null,explanation:s.explanation??"",remediation:s.remediation??"",recommendation:n,risk_score:o,machine_id:t}}))}function ri(e,t){let r=[],n=[],o=0;for(let s of e){let i=JSON.stringify(s).length+1;o+i>t&&n.length>0&&(r.push(n),n=[],o=0),n.push(s),o+=i}return n.length>0&&r.push(n),r}async function ni(e){let{execFile:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),n=r(t),o;try{({stdout:o}=await n("skillspector",["scan",e,"--format","json","--no-llm"],{timeout:18e4,maxBuffer:50*1024*1024}))}catch(s){if(o=s.stdout??"",!o)return null}try{return JSON.parse(o)}catch{return null}}async function _r(e,t=ni){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=x(r),o=Rr(v(r,".claude")),s=y(r),i=S(),a=[],l=0;for(let p of o.skills){if(!p.path)continue;let f=await t(p.path);f&&(l++,a.push(...ti(p,s,f)))}let c=n.orchestratorUrl.replace(/\/$/,""),u=ri(a,Tr);for(let p of u){let f=await fetch(`${c}/v1/inventory/skill-findings`,{method:"POST",headers:C(n.orgId,n.apiKey),body:JSON.stringify({orgId:n.orgId,machineId:s,hostname:i,findings:p})});if(!f.ok){let k=await f.text();throw new Error(`scan-skills findings upload failed: ${f.status} ${k}`)}}return{skillsScanned:l,findings:a.length,chunks:u.length}}import{readFileSync as oi}from"node:fs";import{join as ie}from"node:path";function si(e,t){let r;try{r=JSON.parse(oi(e,"utf8"))}catch{return[]}let n=r.mcpServers;if(!n||typeof n!="object")return[];let o=[];for(let[s,i]of Object.entries(n)){if(!s||!i||typeof i!="object")continue;let a=i.url??i.serverUrl??"",l=(i.type??i.transport??"").toLowerCase(),c=a?l==="sse"?"sse":"streamable-http":"stdio";o.push({name:s,client:t,transport:c,command:i.command??"",args:Array.isArray(i.args)?i.args.map(String):[],url:a,sourcePath:e})}return o}function ii(e){let t=[{path:ie(e,".claude.json"),client:"Claude Code"},{path:ie(e,".cursor","mcp.json"),client:"Cursor"},{path:ie(e,".codeium","windsurf","mcp_config.json"),client:"Windsurf"},{path:ie(e,"Library","Application Support","Claude","claude_desktop_config.json"),client:"Claude Desktop"}],r=[];for(let n of t)r.push(...si(n.path,n.client));return r.sort((n,o)=>n.name.localeCompare(o.name)||n.client.localeCompare(o.client)),r}function ai(e,t){let r=[],n={mode:"replace",servers:[]},o=JSON.stringify({servers:[]}).length;for(let s of e){let i=JSON.stringify(s).length+1;o+i>t&&n.servers.length>0&&(r.push(n),n={mode:"append",servers:[]},o=JSON.stringify({servers:[]}).length),n.servers.push(s),o+=i}return r.push(n),r}var ci=6e3;async function Ur(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=x(t),n=ii(t),o=ai(n,ci),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=S();for(let l of o){let c=await fetch(`${s}/v1/inventory/mcp`,{method:"POST",headers:C(r.orgId,r.apiKey),body:JSON.stringify({orgId:r.orgId,machineId:i,hostname:a,mode:l.mode,servers:l.servers})});if(!c.ok){let u=await c.text();throw new Error(`scan-mcp upload failed: ${c.status} ${u}`)}}return{servers:n.length,chunks:o.length}}var Le="0.1.7";async function Nr(){try{let e=JSON.parse(li(J(We()),"utf8"));if(!e.orchestratorUrl||!e.orgId)return;let t=await $e({currentVersion:Le,orchestratorUrl:e.orchestratorUrl,orgId:e.orgId,home:We(),machineId:y(We())});if(!t)return;if(t.kind==="auto"){process.stderr.write(`
121
121
  ${t.message}
122
- `);let r=await $e(t.targetVersion);process.stderr.write(r?`venos: updated to ${t.targetVersion}. Re-run venos to use it.
122
+ `);let r=await Me(t.targetVersion);process.stderr.write(r?`venos: updated to ${t.targetVersion}. Re-run venos to use it.
123
123
  `:`venos: auto-update failed. Install manually: npm i -g @venos-inc/venos@${t.targetVersion}
124
124
  `);return}process.stderr.write(`
125
125
  ${t.message}
126
- `)}catch{}}var Nr=`Usage: venos <command> [options]
126
+ `)}catch{}}var $r=`Usage: venos <command> [options]
127
127
 
128
128
  Commands:
129
129
  init Wire your AI client(s) to the venos security gateway
@@ -134,6 +134,7 @@ Commands:
134
134
  scan-mcp Report this device's configured MCP servers to the org inventory
135
135
  scan-agents Report this device's installed local AI agent apps to the org inventory
136
136
  heartbeat Report this device's health (version, OS, self-checks) to the org fleet view
137
+ version Print the installed venos CLI version
137
138
  help Show this help
138
139
 
139
140
  Options (init):
@@ -146,17 +147,18 @@ Options (init):
146
147
  --remove Inverse of init \u2014 drop the venos entry from every
147
148
  wired client's config and delete ~/.venos/config.json.
148
149
  Pre-venos .venos-backup snapshots are preserved.
149
- `;function w(e,t){let r=e.indexOf(t);if(!(r===-1||r+1>=e.length))return e[r+1]}function b(e,t){return e.includes(t)}async function li(){let e=process.argv.slice(2),t=e[0];switch(t){case"init":{if(b(e,"--remove")){or({json:b(e,"--json")});break}let r=w(e,"--orchestrator"),n=w(e,"--api-key"),o=w(e,"--org"),s=b(e,"--json");await nr({...r!==void 0?{orchestratorUrl:r}:{},...n!==void 0?{apiKey:n}:{},...o!==void 0?{orgId:o}:{},json:s,noTelemetry:b(e,"--no-telemetry")}),s||await Ur();break}case"hook":{let r=w(e,"--source");await lr(void 0,r??"claude-code");break}case"waste-scan":{let r=await mr();process.stdout.write(`venos waste-scan: ${r.sessionsScanned} session(s) scanned, ${r.findingsStored} finding(s) reported
150
- `);break}case"usage-sync":{if(b(e,"--throttle")){let i=gr();je(),process.stdout.write(`venos usage-sync --throttle: ${i.reason}
151
- `);break}let r=w(e,"--org"),n=w(e,"--orchestrator"),o=w(e,"--api-key"),s=await hr({...r!==void 0?{orgId:r}:{},...n!==void 0?{orchestratorUrl:n}:{},...o!==void 0?{apiKey:o}:{}});process.stdout.write(`venos usage-sync: ${s.sessionsScanned} session(s) scanned, ${s.sessionsStored} stored
152
- `);break}case"scan-skills":{if(b(e,"--scan")){let n=await Ar();process.stdout.write(`venos scan-skills --scan: ${n.findings} finding(s) from ${n.skillsScanned} skill(s) reported in ${n.chunks} chunk(s)
153
- `);break}let r=await Tr();process.stdout.write(`venos scan-skills: ${r.skills} skill(s) + ${r.plugins} plugin(s) reported
154
- `);break}case"scan-mcp":{let r=await _r();process.stdout.write(`venos scan-mcp: ${r.servers} MCP server(s) reported in ${r.chunks} chunk(s)
150
+ `;function w(e,t){let r=e.indexOf(t);if(!(r===-1||r+1>=e.length))return e[r+1]}function b(e,t){return e.includes(t)}async function ui(){let e=process.argv.slice(2),t=e[0];switch(t){case"init":{if(b(e,"--remove")){sr({json:b(e,"--json")});break}let r=w(e,"--orchestrator"),n=w(e,"--api-key"),o=w(e,"--org"),s=b(e,"--json");await or({...r!==void 0?{orchestratorUrl:r}:{},...n!==void 0?{apiKey:n}:{},...o!==void 0?{orgId:o}:{},json:s,noTelemetry:b(e,"--no-telemetry")}),s||await Nr();break}case"hook":{let r=w(e,"--source");await ur(void 0,r??"claude-code");break}case"waste-scan":{let r=await gr();process.stdout.write(`venos waste-scan: ${r.sessionsScanned} session(s) scanned, ${r.findingsStored} finding(s) reported
151
+ `);break}case"usage-sync":{if(b(e,"--throttle")){let i=hr();je(),process.stdout.write(`venos usage-sync --throttle: ${i.reason}
152
+ `);break}let r=w(e,"--org"),n=w(e,"--orchestrator"),o=w(e,"--api-key"),s=await yr({...r!==void 0?{orgId:r}:{},...n!==void 0?{orchestratorUrl:n}:{},...o!==void 0?{apiKey:o}:{}});process.stdout.write(`venos usage-sync: ${s.sessionsScanned} session(s) scanned, ${s.sessionsStored} stored
153
+ `);break}case"scan-skills":{if(b(e,"--scan")){let n=await _r();process.stdout.write(`venos scan-skills --scan: ${n.findings} finding(s) from ${n.skillsScanned} skill(s) reported in ${n.chunks} chunk(s)
154
+ `);break}let r=await Ar();process.stdout.write(`venos scan-skills: ${r.skills} skill(s) + ${r.plugins} plugin(s) reported
155
+ `);break}case"scan-mcp":{let r=await Ur();process.stdout.write(`venos scan-mcp: ${r.servers} MCP server(s) reported in ${r.chunks} chunk(s)
155
156
  `);break}case"scan-agents":{if(b(e,"--dry-run")){let n=await Ne({dryRun:!0});process.stdout.write(JSON.stringify(n,null,2)+`
156
157
  `);break}let r=await Ne();process.stdout.write(`venos scan-agents: ${r.agents} local AI agent(s) reported
157
158
  `);break}case"heartbeat":{if(b(e,"--throttle")){let i=je();process.stdout.write(`venos heartbeat --throttle: ${i.reason}
158
- `);break}let r=w(e,"--org"),n=w(e,"--orchestrator"),o=w(e,"--api-key"),s=await xr({cliVersion:Mr,...r!==void 0?{orgId:r}:{},...n!==void 0?{orchestratorUrl:n}:{},...o!==void 0?{apiKey:o}:{}});process.stdout.write(s.status==="sent"?`venos heartbeat: reported (${s.machineId.slice(0,12)})
159
+ `);break}let r=w(e,"--org"),n=w(e,"--orchestrator"),o=w(e,"--api-key"),s=await br({cliVersion:Le,...r!==void 0?{orgId:r}:{},...n!==void 0?{orchestratorUrl:n}:{},...o!==void 0?{apiKey:o}:{}});process.stdout.write(s.status==="sent"?`venos heartbeat: reported (${s.machineId.slice(0,12)})
159
160
  `:`venos heartbeat: no config \u2014 run "venos init" first
160
- `);break}case"upgrade":await ur();return;case"help":case void 0:process.stdout.write(Nr),await Ur(),process.exit(0);break;default:process.stderr.write(`Unknown subcommand: ${t}
161
- ${Nr}`),process.exit(2)}}try{await li()}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`venos: ${t}
161
+ `);break}case"upgrade":await dr();return;case"version":case"--version":case"-v":process.stdout.write(`${Le}
162
+ `),process.exit(0);break;case"help":case void 0:process.stdout.write($r),await Nr(),process.exit(0);break;default:process.stderr.write(`Unknown subcommand: ${t}
163
+ ${$r}`),process.exit(2)}}try{await ui()}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`venos: ${t}
162
164
  `),process.exit(1)}
@@ -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/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../json5@2.2.3/node_modules/json5/lib/cli.js" "$@"
@@ -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/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../@babel+parser@7.29.7/node_modules/@babel/parser/bin/babel-parser.js" "$@"
@@ -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/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules/semver/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules/semver/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules/semver/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules/semver/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules/semver/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules/semver/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/semver@6.3.1/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules/semver/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules/semver/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/semver@6.3.1/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../semver@6.3.1/node_modules/semver/bin/semver.js" "$@"
@@ -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/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/jsesc@3.1.0/node_modules:/Users/baraklagziel/code/venos/.worktrees/fix-publish-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules/jsesc/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/jsesc@3.1.0/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.7/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../jsesc@3.1.0/node_modules/jsesc/bin/jsesc" "$@"