@venos-inc/venos 0.1.9 → 0.1.10

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 +58 -57
  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,51 +1,51 @@
1
1
  #!/usr/bin/env node
2
- import{readFileSync as hi}from"node:fs";import{homedir as Le}from"node:os";import{existsSync as or,mkdirSync as po,readFileSync as fo,rmSync as mo,writeFileSync as go}from"node:fs";import{dirname as ho,join as yo}from"node:path";import{randomBytes as vo}from"node:crypto";import{existsSync as Br,readFileSync as Gr}from"node:fs";import{join as Yr}from"node:path";import{copyFileSync as Hr,existsSync as Fe,mkdirSync as Fr,renameSync as Dr,writeFileSync as Jr}from"node:fs";import{dirname as Kr}from"node:path";var De=".venos-backup";function m(e,t){Fr(Kr(e),{recursive:!0}),Fe(e)&&!Fe(e+De)&&Hr(e,e+De);let r=e+".tmp";Jr(r,t,{mode:420}),Dr(r,e)}function g(e){return JSON.stringify(e,null,2)+`
3
- `}var j="http://127.0.0.1:4000/v1";var Je="venos",zr="venos usage-sync --throttle";function B(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(Je)))}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(Je))})).filter(t=>t.hooks.length>0)}var de={name:"claude-code",transport:"claude-hook",configPath(e){return Yr(e,".claude","settings.json")},isInstalled(e){return!0},load(e){if(!Br(e))return{};try{return JSON.parse(Gr(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??zr)}}},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 Zr}from"node:fs";import{join as G}from"node:path";function Ke(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(Zr(e,"utf8"))}catch{return{}}},isWired(e){return Ke(e)},inject(e,t){return Ke(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 pn}from"node:fs";import{join as Qe}from"node:path";function Xr(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function qr(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 yi}from"node:fs";import{homedir as ue}from"node:os";import{existsSync as ir,mkdirSync as fo,readFileSync as mo,rmSync as go,writeFileSync as ho}from"node:fs";import{dirname as yo,join as vo}from"node:path";import{randomBytes as So}from"node:crypto";import{existsSync as Gr,readFileSync as Yr}from"node:fs";import{join as zr}from"node:path";import{copyFileSync as Fr,existsSync as Je,mkdirSync as Dr,renameSync as Jr,writeFileSync as Kr}from"node:fs";import{dirname as Br}from"node:path";var Ke=".venos-backup";function m(e,t){Dr(Br(e),{recursive:!0}),Je(e)&&!Je(e+Ke)&&Fr(e,e+Ke);let r=e+".tmp";Kr(r,t,{mode:420}),Jr(r,e)}function g(e){return JSON.stringify(e,null,2)+`
3
+ `}var j="http://127.0.0.1:4000/v1";var Be="venos",Zr="venos usage-sync --throttle";function G(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(Be)))}function fe(e,t){let r=e??[];return G(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function me(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(Be))})).filter(t=>t.hooks.length>0)}var ge={name:"claude-code",transport:"claude-hook",configPath(e){return zr(e,".claude","settings.json")},isInstalled(e){return!0},load(e){if(!Gr(e))return{};try{return JSON.parse(Yr(e,"utf8"))}catch{return{}}},isWired(e){return G(e.hooks?.PreToolUse)&&G(e.hooks?.PostToolUse)&&G(e.hooks?.Stop)},inject(e,t){let r=e.hooks??{};return{...e,hooks:{...r,PreToolUse:fe(r.PreToolUse,t.hookCommand),PostToolUse:fe(r.PostToolUse,t.hookCommand),Stop:fe(r.Stop,t.usageSyncCommand??Zr)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:me(e.hooks.PreToolUse),PostToolUse:me(e.hooks.PostToolUse),Stop:me(e.hooks.Stop)}}:e},write(e,t){m(e,g(t))}};import{existsSync as V,readFileSync as Xr}from"node:fs";import{join as Y}from"node:path";function Ge(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 he={name:"cursor",transport:"mcp-json",configPath(e){return Y(e,".cursor","mcp.json")},isInstalled(e){let t=Y(e,".cursor");return V(t)?V(Y(t,"mcp.json"))||V(Y(t,"extensions")):!1},load(e){if(!V(e))return{};try{return JSON.parse(Xr(e,"utf8"))}catch{return{}}},isWired(e){return Ge(e)},inject(e,t){return Ge(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 fn}from"node:fs";import{join as tt}from"node:path";function qr(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function Qr(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
- `))}return o}var d=class extends Error{line;column;codeblock;constructor(t,r){let[n,o]=Xr(r.toml,r.ptr),s=qr(r.toml,n,o);super(`Invalid TOML document: ${t}
5
+ `))}return o}var d=class extends Error{line;column;codeblock;constructor(t,r){let[n,o]=qr(r.toml,r.ptr),s=Qr(r.toml,n,o);super(`Invalid TOML document: ${t}
6
6
 
7
- ${s}`,r),this.line=n,this.column=o,this.codeblock=s}};function Qr(e,t){let r=0;for(;e[t-++r]==="\\";);return--r&&r%2}function Y(e,t=0,r=e.length){let n=e.indexOf(`
7
+ ${s}`,r),this.line=n,this.column=o,this.codeblock=s}};function en(e,t){let r=0;for(;e[t-++r]==="\\";);return--r&&r%2}function z(e,t=0,r=e.length){let n=e.indexOf(`
8
8
  `,t);return e[n-1]==="\r"&&n--,n<=r?n:-1}function P(e,t){for(let r=t;r<e.length;r++){let n=e[r];if(n===`
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 Be(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 Ye(e,t,r,n,o=!1){if(!n)return t=z(e,t),t<0?e.length:t;for(let s=t;s<e.length;s++){let i=e[s];if(i==="#")s=z(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!=="'"&&Qr(e,t));return t>-1&&(t+=n.length,n.length>1&&(e[t]===r&&t++,e[t]===r&&t++)),t}var en=/^(\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(en);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 tn=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,rn=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,nn=/^[+-]?0[0-9_]/,on=/^[0-9a-f]{2,8}$/i,Ge={b:"\b",t:" ",n:`
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]===`
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!=="'"&&en(e,t));return t>-1&&(t+=n.length,n.length>1&&(e[t]===r&&t++,e[t]===r&&t++)),t}var tn=/^(\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(tn);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 rn=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,nn=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,on=/^[+-]?0[0-9_]/,sn=/^[0-9a-f]{2,8}$/i,ze={b:"\b",t:" ",n:`
15
+ `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function X(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
- `){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(!on.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===`
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(!sn.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 Ge)a+=Ge[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 Ye(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=tn.test(e);if(o||rn.test(e)){if(nn.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 sn(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):ze(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=Be(e,t,",",r);let a=sn(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]===",")),[Ye(a[0],e,t,o),i]}var an=/^[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(!an.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 ze(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 b=0;b<u.length;b++){if(b&&(l=c?l[a]:l[a]={}),a=u[b],(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,v]=L(e,p,"}",r-1,n);s.add(f),l[a]=f,t=v}}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 Xe(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=Xe(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=Xe(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 qe=/^[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 cn(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 ln(e,r,n);if(t==="array")return un(e,r,n)}function ln(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+=qe.test(i)?i:me(i),o+=" = ",o+=ge(e[i],H(e[i]),t-1,r)}return o+" }"}function un(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 dn(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 ze)a+=ze[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 Ze(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=rn.test(e);if(o||nn.test(e)){if(on.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 an(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==="["?qe(e,t,n,o):Xe(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=X(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=Ye(e,t,",",r);let a=an(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]===",")),[Ze(a[0],e,t,o),i]}var cn=/^[a-zA-Z0-9-_]+[ \t]*$/;function q(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=z(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(X(e,t,a))}else{n=e.indexOf(".",t);let a=e.slice(t,n<0||n>s?s:n);if(!cn.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 Xe(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]=q(e,t-1);for(let b=0;b<u.length;b++){if(b&&(l=c?l[a]:l[a]={}),a=u[b],(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,v]=L(e,p,"}",r-1,n);s.add(f),l[a]=f,t=v}}if(!i)throw new d("unfinished table encountered",{toml:e,ptr:t});return[o,t]}function qe(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 Qe(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 ye(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=q(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=Qe(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=q(e,a),c=Qe(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 et=/^[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 ln(e){for(let t=0;t<e.length;t++)if(H(e[t])!=="object")return!1;return e.length!=0}function ve(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Se(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 ve(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return un(e,r,n);if(t==="array")return dn(e,r,n)}function un(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+=et.test(i)?i:ve(i),o+=" = ",o+=Se(e[i],H(e[i]),t-1,r)}return o+" }"}function dn(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+=Se(e[o],H(e[o]),t-1,r)}return n+" ]"}function pn(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=qe.test(c)?c:me(c);if(u==="array"&&cn(t[c]))i+=(i&&`
27
- `)+dn(t[c],r?`${r}.${p}`:p,n-1,o);else if(u==="object"){let f=r?`${r}.${p}`:p;i+=(i&&`
28
- `)+he(f,t[c],f,n-1,o)}else s+=p,s+=" = ",s+=ge(t[c],u,n,o),s+=`
26
+ `,o+=we(0,e[s],t,r,n);return o}function we(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=et.test(c)?c:ve(c);if(u==="array"&&ln(t[c]))i+=(i&&`
27
+ `)+pn(t[c],r?`${r}.${p}`:p,n-1,o);else if(u==="object"){let f=r?`${r}.${p}`:p;i+=(i&&`
28
+ `)+we(f,t[c],f,n-1,o)}else s+=p,s+=" = ",s+=Se(t[c],u,n,o),s+=`
29
29
  `}}return e&&(s||!i)&&(s=s?`[${e}]
30
30
  ${s}`:`[${e}]`),s&&i?`${s}
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]!==`
31
+ ${i}`:s||i}function ke(e,{maxDepth:t=1e3,numbersAsFloat:r=!1}={}){if(H(e)!=="object")throw new TypeError("stringify can only be called with an object");let n=we(0,e,"",t,r);return n[n.length-1]!==`
32
32
  `?n+`
33
- `:n}function et(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 tt={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(pn(e,"utf8"))}catch{return{}}},isWired(e){return et(e)},inject(e,t){return et(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 rt,readFileSync as fn}from"node:fs";import{join as nt}from"node:path";var it="venos";function Se(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(it)))}function ot(e,t){let r=e??[];return Se(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function st(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(it))})).filter(t=>t.hooks.length>0)}function mn(e){return`${e.hookCommand} --source codex`}var at={name:"codex-hook",transport:"claude-hook",configPath(e){return nt(e,".codex","hooks.json")},isInstalled(e){return rt(nt(e,".codex"))},load(e){if(!rt(e))return{};try{return JSON.parse(fn(e,"utf8"))}catch{return{}}},isWired(e){return Se(e.hooks?.PreToolUse)&&Se(e.hooks?.PostToolUse)},inject(e,t){let r=e.hooks??{},n=mn(t);return{...e,hooks:{...r,PreToolUse:ot(r.PreToolUse,n),PostToolUse:ot(r.PostToolUse,n)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:st(e.hooks.PreToolUse),PostToolUse:st(e.hooks.PostToolUse)}}:e},write(e,t){m(e,g(t))}};import{existsSync as we,readFileSync as gn}from"node:fs";import{join as ct}from"node:path";function lt(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 ut={name:"windsurf",transport:"mcp-json",configPath(e){return ct(e,".codeium","windsurf","mcp_config.json")},isInstalled(e){return we(ct(e,".codeium","windsurf"))},load(e){if(!we(e))return{};try{return JSON.parse(gn(e,"utf8"))}catch{return{}}},isWired(e){return lt(e)},inject(e,t){return lt(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 hn}from"node:fs";import{join as E}from"node:path";var dt="saoudrizwan.claude-dev",yn="cline_mcp_settings.json";function pt(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 ft(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 mt={name:"cline",transport:"mcp-json",configPath(e){return E(pt(e),"globalStorage",dt,"settings",yn)},isInstalled(e){return ke(E(pt(e),"globalStorage",dt))},load(e){if(!ke(e))return{};try{return JSON.parse(hn(e,"utf8"))}catch{return{}}},isWired(e){return ft(e)},inject(e,t){return ft(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 vn}from"node:fs";import{join as gt}from"node:path";function ht(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 yt={name:"zed",transport:"mcp-json",configPath(e){return gt(e,".config","zed","settings.json")},isInstalled(e){return Ce(gt(e,".config","zed"))},load(e){if(!Ce(e))return{};try{return JSON.parse(vn(e,"utf8"))}catch{return{}}},isWired(e){return ht(e)},inject(e,t){return ht(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 Sn}from"node:fs";import{join as vt}from"node:path";function St(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 wt={name:"jetbrains",transport:"mcp-json",configPath(e){return vt(e,".junie","mcp","mcp.json")},isInstalled(e){return xe(vt(e,".junie"))},load(e){if(!xe(e))return{};try{return JSON.parse(Sn(e,"utf8"))}catch{return{}}},isWired(e){return St(e)},inject(e,t){return St(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 kt,readFileSync as wn,rmSync as kn}from"node:fs";import{join as Cn}from"node:path";var xn="openai-api-base",bn=".aider.conf.yml";function Ct(){return`${xn}: ${j}`}function On(e){return/^\s*openai-api-base\s*:/.test(e)}var xt={name:"aider",transport:"mcp-json",configPath(e){return Cn(e,bn)},isInstalled(){return!0},load(e){let t=kt(e)?wn(e,"utf8"):"";return{wired:t.split(`
35
- `).some(n=>n.trim()===Ct()),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=>!On(s)),o=t.wired?[...n,Ct()]:n;if(o.length===0){kt(e)&&kn(e,{force:!0});return}m(e,o.join(`
33
+ `:n}function rt(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:Ce(r)}var nt={name:"codex",transport:"mcp-toml",configPath(e){return tt(e,".codex","config.toml")},isInstalled(e){return Ce(tt(e,".codex"))},load(e){if(!Ce(e))return{};try{return ye(fn(e,"utf8"))}catch{return{}}},isWired(e){return rt(e)},inject(e,t){return rt(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,ke(t)+`
34
+ `)}};import{existsSync as ot,readFileSync as mn}from"node:fs";import{join as st}from"node:path";var ct="venos";function xe(e){return(e??[]).some(t=>t.hooks.some(r=>typeof r.command=="string"&&r.command.includes(ct)))}function it(e,t){let r=e??[];return xe(r)?r:[...r,{matcher:"*",hooks:[{type:"command",command:t}]}]}function at(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(r=>typeof r.command!="string"||!r.command.includes(ct))})).filter(t=>t.hooks.length>0)}function gn(e){return`${e.hookCommand} --source codex`}var lt={name:"codex-hook",transport:"claude-hook",configPath(e){return st(e,".codex","hooks.json")},isInstalled(e){return ot(st(e,".codex"))},load(e){if(!ot(e))return{};try{return JSON.parse(mn(e,"utf8"))}catch{return{}}},isWired(e){return xe(e.hooks?.PreToolUse)&&xe(e.hooks?.PostToolUse)},inject(e,t){let r=e.hooks??{},n=gn(t);return{...e,hooks:{...r,PreToolUse:it(r.PreToolUse,n),PostToolUse:it(r.PostToolUse,n)}}},remove(e){return e.hooks?{...e,hooks:{...e.hooks,PreToolUse:at(e.hooks.PreToolUse),PostToolUse:at(e.hooks.PostToolUse)}}:e},write(e,t){m(e,g(t))}};import{existsSync as be,readFileSync as hn}from"node:fs";import{join as ut}from"node:path";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:be(r)}var pt={name:"windsurf",transport:"mcp-json",configPath(e){return ut(e,".codeium","windsurf","mcp_config.json")},isInstalled(e){return be(ut(e,".codeium","windsurf"))},load(e){if(!be(e))return{};try{return JSON.parse(hn(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 Oe,readFileSync as yn}from"node:fs";import{join as E}from"node:path";var ft="saoudrizwan.claude-dev",vn="cline_mcp_settings.json";function mt(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 gt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:Oe(r)}var ht={name:"cline",transport:"mcp-json",configPath(e){return E(mt(e),"globalStorage",ft,"settings",vn)},isInstalled(e){return Oe(E(mt(e),"globalStorage",ft))},load(e){if(!Oe(e))return{};try{return JSON.parse(yn(e,"utf8"))}catch{return{}}},isWired(e){return gt(e)},inject(e,t){return gt(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 Pe,readFileSync as Sn}from"node:fs";import{join as yt}from"node:path";function vt(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:Pe(r)}var St={name:"zed",transport:"mcp-json",configPath(e){return yt(e,".config","zed","settings.json")},isInstalled(e){return Pe(yt(e,".config","zed"))},load(e){if(!Pe(e))return{};try{return JSON.parse(Sn(e,"utf8"))}catch{return{}}},isWired(e){return vt(e)},inject(e,t){return vt(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 Ee,readFileSync as wn}from"node:fs";import{join as wt}from"node:path";function kt(e){let t=e.mcpServers?.venos;if(!t||t.command!=="node")return!1;let r=t.args?.[0];return!r||r.includes("/A2A/")?!1:Ee(r)}var Ct={name:"jetbrains",transport:"mcp-json",configPath(e){return wt(e,".junie","mcp","mcp.json")},isInstalled(e){return Ee(wt(e,".junie"))},load(e){if(!Ee(e))return{};try{return JSON.parse(wn(e,"utf8"))}catch{return{}}},isWired(e){return kt(e)},inject(e,t){return kt(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 xt,readFileSync as kn,rmSync as Cn}from"node:fs";import{join as xn}from"node:path";var bn="openai-api-base",On=".aider.conf.yml";function bt(){return`${bn}: ${j}`}function Pn(e){return/^\s*openai-api-base\s*:/.test(e)}var Ot={name:"aider",transport:"mcp-json",configPath(e){return xn(e,On)},isInstalled(){return!0},load(e){let t=xt(e)?kn(e,"utf8"):"";return{wired:t.split(`
35
+ `).some(n=>n.trim()===bt()),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=>!Pn(s)),o=t.wired?[...n,bt()]:n;if(o.length===0){xt(e)&&Cn(e,{force:!0});return}m(e,o.join(`
37
37
  `)+`
38
- `)}};import{accessSync as Pn,constants as En,existsSync as Ot,readFileSync as In}from"node:fs";import{delimiter as Rn}from"node:path";import{join as Pt}from"node:path";var Tn="obsidian-cli",An="obsidian-cli.json";function _n(e){try{return Pn(e,En.X_OK),!0}catch{return!1}}function Un(e){return(process.env.PATH??"").split(Rn).some(r=>{if(r.trim()==="")return!1;let n=Pt(r,e);return Ot(n)&&_n(n)})}function bt(e){return e.venos?.source==="obsidian-cli"&&e.venos.wired===!0}var Et={name:"obsidian-cli",transport:"mcp-json",configPath(e){return Pt(e,".venos",An)},isInstalled(){return Un(Tn)},load(e){if(!Ot(e))return{};try{return JSON.parse(In(e,"utf8"))}catch{return{}}},isWired(e){return bt(e)},inject(e,t){return bt(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,tt,at,ut,mt,yt,wt,xt,Et];import{existsSync as be}from"node:fs";import{dirname as Nn,join as It,resolve as Oe}from"node:path";import{fileURLToPath as $n}from"node:url";var Rt=Nn($n(import.meta.url));function q(){let e=process.env.VENOS_MCP_SERVER_PATH;if(e&&be(e))return Oe(e);let t=Oe(It(Rt,"..","etc","mcp-server","bin.js"));if(be(t))return t;let r=Oe(It(Rt,"..","..","..","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 En,constants as In,existsSync as Et,readFileSync as Rn}from"node:fs";import{delimiter as Tn}from"node:path";import{join as It}from"node:path";var An="obsidian-cli",_n="obsidian-cli.json";function Un(e){try{return En(e,In.X_OK),!0}catch{return!1}}function Nn(e){return(process.env.PATH??"").split(Tn).some(r=>{if(r.trim()==="")return!1;let n=It(r,e);return Et(n)&&Un(n)})}function Pt(e){return e.venos?.source==="obsidian-cli"&&e.venos.wired===!0}var Rt={name:"obsidian-cli",transport:"mcp-json",configPath(e){return It(e,".venos",_n)},isInstalled(){return Nn(An)},load(e){if(!Et(e))return{};try{return JSON.parse(Rn(e,"utf8"))}catch{return{}}},isWired(e){return Pt(e)},inject(e,t){return Pt(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=[ge,he,nt,lt,pt,ht,St,Ct,Ot,Rt];import{existsSync as Ie}from"node:fs";import{dirname as $n,join as Tt,resolve as Re}from"node:path";import{fileURLToPath as Mn}from"node:url";var At=$n(Mn(import.meta.url));function Q(){let e=process.env.VENOS_MCP_SERVER_PATH;if(e&&Ie(e))return Re(e);let t=Re(Tt(At,"..","etc","mcp-server","bin.js"));if(Ie(t))return t;let r=Re(Tt(At,"..","..","..","packages","mcp-server","dist","bin.js"));if(Ie(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 Mn}from"node:fs";function jn(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 Tt(e,t,r){return r.map(n=>jn(n,e,t))}function Vn(e,t){let r=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};if(!Mn(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 At(e,t){return t.map(r=>Vn(r,e))}import{existsSync as _t,mkdirSync as Wn,readFileSync as Ln}from"node:fs";import{join as Ut}from"node:path";var Nt="cline.openaiBaseUrl";function $t(e){let t=Ut(e,".vscode");if(!_t(t))return{status:"no-workspace"};let r=Ut(t,"settings.json"),n={};if(_t(r))try{let o=JSON.parse(Ln(r,"utf8"));o&&typeof o=="object"&&(n=o)}catch{}return n[Nt]===j?{status:"already-wired",path:r}:(Wn(t,{recursive:!0}),m(r,g({...n,[Nt]:j})),{status:"wired",path:r})}import{execFileSync as so}from"node:child_process";import{existsSync as jt,mkdirSync as Gn,rmSync as Yn,writeFileSync as zn}from"node:fs";import{dirname as Zn,join as Xn}from"node:path";var Pe="ai.venos.agent";import{existsSync as Mt,mkdirSync as Hn,rmSync as Fn,writeFileSync as Dn}from"node:fs";import{dirname as Jn,join as Kn}from"node:path";function Ee(e){return Kn(e,".venos","service.json")}function I(e,t){let r=Ee(e);Hn(Jn(r),{recursive:!0}),Dn(r,JSON.stringify(t,null,2)+`
43
- `,"utf8")}function R(e){let t=Ee(e);return Mt(t)?(Fn(t,{force:!0}),!0):!1}function T(e){return Mt(Ee(e))}function Vt(e){return Xn(e,"Library","LaunchAgents",`${Pe}.plist`)}function qn(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 jn}from"node:fs";function Vn(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 _t(e,t,r){return r.map(n=>Vn(n,e,t))}function Wn(e,t){let r=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};if(!jn(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 Ut(e,t){return t.map(r=>Wn(r,e))}import{existsSync as Nt,mkdirSync as Ln,readFileSync as Hn}from"node:fs";import{join as $t}from"node:path";var Mt="cline.openaiBaseUrl";function jt(e){let t=$t(e,".vscode");if(!Nt(t))return{status:"no-workspace"};let r=$t(t,"settings.json"),n={};if(Nt(r))try{let o=JSON.parse(Hn(r,"utf8"));o&&typeof o=="object"&&(n=o)}catch{}return n[Mt]===j?{status:"already-wired",path:r}:(Ln(t,{recursive:!0}),m(r,g({...n,[Mt]:j})),{status:"wired",path:r})}import{execFileSync as io}from"node:child_process";import{existsSync as Wt,mkdirSync as Yn,rmSync as zn,writeFileSync as Zn}from"node:fs";import{dirname as Xn,join as qn}from"node:path";var Te="ai.venos.agent";import{existsSync as Vt,mkdirSync as Fn,rmSync as Dn,writeFileSync as Jn}from"node:fs";import{dirname as Kn,join as Bn}from"node:path";function Ae(e){return Bn(e,".venos","service.json")}function I(e,t){let r=Ae(e);Fn(Kn(r),{recursive:!0}),Jn(r,JSON.stringify(t,null,2)+`
43
+ `,"utf8")}function R(e){let t=Ae(e);return Vt(t)?(Dn(t,{force:!0}),!0):!1}function T(e){return Vt(Ae(e))}function Lt(e){return qn(e,"Library","LaunchAgents",`${Te}.plist`)}function Qn(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>
47
47
  <key>Label</key>
48
- <string>${Pe}</string>
48
+ <string>${Te}</string>
49
49
  <key>ProgramArguments</key>
50
50
  <array>
51
51
  <string>${e}</string>
@@ -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 Wt={platform:"darwin",install(e){let t=Vt(e.home);try{let r=jt(t);Gn(Zn(t),{recursive:!0}),zn(t,qn(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:Qn(r)}}},remove(e,t){let r=Vt(e),n=jt(r);try{t("launchctl",["unload",r])}catch{}n&&Yn(r,{force:!0});let o=R(e);return{platform:"darwin",status:n||o?"removed":"already-removed",path:r}}};function Qn(e){return e instanceof Error?e.message:String(e)}import{existsSync as Q,mkdirSync as eo,rmSync as Lt,writeFileSync as Ht}from"node:fs";import{join as D}from"node:path";var ee="venos-heartbeat.timer",Ft="venos-heartbeat.service";function Dt(e){return D(e,".config","systemd","user")}function to(e,t){return`[Unit]
72
+ `}var Ht={platform:"darwin",install(e){let t=Lt(e.home);try{let r=Wt(t);Yn(Xn(t),{recursive:!0}),Zn(t,Qn(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:eo(r)}}},remove(e,t){let r=Lt(e),n=Wt(r);try{t("launchctl",["unload",r])}catch{}n&&zn(r,{force:!0});let o=R(e);return{platform:"darwin",status:n||o?"removed":"already-removed",path:r}}};function eo(e){return e instanceof Error?e.message:String(e)}import{existsSync as ee,mkdirSync as to,rmSync as Ft,writeFileSync as Dt}from"node:fs";import{join as D}from"node:path";var te="venos-heartbeat.timer",Jt="venos-heartbeat.service";function Kt(e){return D(e,".config","systemd","user")}function ro(e,t){return`[Unit]
73
73
  Description=venos endpoint heartbeat
74
74
 
75
75
  [Service]
@@ -77,7 +77,7 @@ Type=oneshot
77
77
  ExecStart=${e} ${t} heartbeat
78
78
  Restart=on-failure
79
79
  RestartSec=${60}
80
- `}function ro(){return`[Unit]
80
+ `}function no(){return`[Unit]
81
81
  Description=venos endpoint heartbeat (hourly)
82
82
 
83
83
  [Timer]
@@ -87,18 +87,18 @@ Persistent=true
87
87
 
88
88
  [Install]
89
89
  WantedBy=timers.target
90
- `}var Jt={platform:"linux",install(e){let t=Dt(e.home),r=D(t,ee);try{let n=Q(r);return eo(t,{recursive:!0}),Ht(D(t,Ft),to(e.nodePath,e.cliEntry),"utf8"),Ht(r,ro(),"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:no(n)}}},remove(e,t){let r=Dt(e),n=D(r,ee),o=D(r,Ft),s=Q(n);try{t("systemctl",["--user","disable","--now",ee])}catch{}Q(n)&&Lt(n,{force:!0}),Q(o)&&Lt(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 no(e){return e instanceof Error?e.message:String(e)}var te="venos-heartbeat",Kt={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:oo(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 oo(e){return e instanceof Error?e.message:String(e)}var Bt=[Wt,Jt,Kt],Gt=(e,t)=>{try{so(e,t,{stdio:"ignore"})}catch{}};function Yt(e){return e??process.env.HOME??process.env.USERPROFILE??""}function zt(e={}){let t=Bt.find(r=>r.platform===process.platform);return t?t.install({home:Yt(e.home),nodePath:process.execPath,cliEntry:process.argv[1]??"",run:e.run??Gt}):{platform:"unsupported",status:"unsupported"}}function Zt(e={}){let t=Bt.find(r=>r.platform===process.platform);return t?t.remove(Yt(e.home),e.run??Gt):{platform:"unsupported",status:"unsupported"}}function Xt(e){return T(e)}function qt(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 io={wired:"OK","already-wired":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},ao={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=io[n.status],s=ao[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=qt(t.service);n&&console.log(n)}if(r){console.log(`
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`)}co(t.clineWorkspace)}function co(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 er(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var lo={removed:"OK","already-removed":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},uo={removed:"removed","already-removed":"already removed","skipped-not-installed":"skipped (not installed)",error:"ERROR"};function tr(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=lo[s.status],a=uo[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=qt(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 rr(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var nr=1;function J(e){return yo(e,".venos","config.json")}function So(){return`org-${vo(4).toString("hex")}`}function wo(e,t,r,n){let o=J(e);if(or(o))try{let s=JSON.parse(fo(o,"utf8")),i={schemaVersion:s.schemaVersion??nr,...s,orchestratorUrl:t};return r&&(i.apiKey=r),n&&(i.orgId=n),i}catch{}return{schemaVersion:nr,orgId:n??So(),orchestratorUrl:t,createdAt:new Date().toISOString(),failMode:"closed",...r?{apiKey:r}:{}}}function ko(e,t){let r=J(e);po(ho(r),{recursive:!0}),go(r,JSON.stringify(t,null,2)+`
95
- `,"utf8")}var Co=5e3,xo=5e3;async function bo(e){let t=e.replace(/\/$/,""),r=new AbortController,n=setTimeout(()=>r.abort(),Co);try{return(await fetch(`${t}/healthz`,{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(n)}}async function Oo(e,t){let r=e.replace(/\/$/,""),n=new AbortController,o=setTimeout(()=>n.abort(),xo);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 Po(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 sr(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=e.orchestratorUrl??"http://127.0.0.1:8788";await bo(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=wo(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=Tt(t,o,F);ko(t,n);let i=$t(e.cwd??process.cwd()),a=process.env.VITEST&&!e.serviceRun?void 0:zt({home:t,...e.serviceRun?{run:e.serviceRun}:{}});e.noTelemetry===!0||Po(r)||!!n.apiKey||await Oo(r,n.orgId);let c={orgId:n.orgId,orchestratorUrl:r,clineWorkspace:i,...a?{service:a}:{}};e.json?er(s,c):Qt(s,c)}function ir(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=At(t,F),n=process.env.VITEST&&!e.serviceRun?void 0:Zt({home:t,...e.serviceRun?{run:e.serviceRun}:{}}),o=J(t),s=or(o);s&&mo(o,{force:!0});let i={venosConfigPath:o,venosConfigRemoved:s,...n?{service:n}:{}};e.json?rr(r,i):tr(r,i)}import{mkdirSync as Eo,readFileSync as re,existsSync as Io,writeFileSync as Ro}from"node:fs";import{hostname as To,userInfo as Ao}from"node:os";import{execFileSync as cr}from"node:child_process";import{randomBytes as lr}from"node:crypto";import{dirname as _o,join as ur}from"node:path";function Uo(e){return ur(e,".venos","config.json")}function C(e){let t=Uo(e);if(!Io(t))throw new Error(`venos config not found at ${t} - run "venos init" first`);return JSON.parse(re(t,"utf8"))}function No(){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 Mo(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 jo(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 Vo(e){try{let r=JSON.parse(e).cursor_version;return typeof r=="string"&&r!==""}catch{return!1}}function Te(){try{let e=Ao().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 Wo(e,t,r){if(t==="")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;for(let s of["userId","user_id"]){let i=o[s];if(typeof i=="string"&&i.trim()!=="")return e}return o.userId=t,r&&(o.actor_email=r),JSON.stringify(o)}async function Lo(e){if(process.env.VENOS_EMIT_ACTOR_EMAIL==="false")return null;try{let t=cr("git",["config","user.email"],{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t.toLowerCase()}catch{}try{let t=C(e);if(t.actor_email?.trim())return t.actor_email.trim().toLowerCase()}catch{}return null}function y(e){let t=e===""?"":ur(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=lr(16).toString("hex");return Eo(_o(t),{recursive:!0}),Ro(t,r+`
97
- `,"utf8"),r}catch{return""}}function Ho(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!==""&&(o.hostname=r),JSON.stringify(o)}function w(e=process.platform,t=Fo){if(e==="darwin")try{let r=t().trim();if(r!=="")return r.endsWith(".local")?r:`${r}.local`}catch{}try{let r=To();return typeof r=="string"?r.trim():""}catch{return""}}function Fo(){try{return cr("scutil",["--get","LocalHostName"],{encoding:"utf8",timeout:1e3}).trim()}catch{return""}}function x(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 Do(e){return e.failMode==="closed"?{mode:"closed",implicit:!1}:e.failMode==="open"?{mode:"open",implicit:!1}:{mode:"open",implicit:!0}}function dr(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(!dr(l.status)||a===n-1)return l;i=new Error(`orchestrator returned ${l.status}`)}catch(l){i=l}}throw i}function Jo(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 Ko(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:x(r,s.apiKey,o),body:n})).text()}catch{}}))}async function pr(e,t="claude-code"){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=C(r),o=await No(),s=Vo(o),i=await Lo(r),a=Ho(Wo(Mo(jo(o,n.orgId)),Te(),i),y(r),w()),c=`${n.orchestratorUrl.replace(/\/$/,"")}/v1/hooks/${encodeURIComponent(t)}`,u=lr(16).toString("hex"),p=Ko(Jo(n),t,n.orgId,a,u),f;try{f=await A(c,{method:"POST",headers:x(n.orgId,n.apiKey,u),body:a})}catch{await p,ar(t,s,n);return}if(dr(f.status)){await f.text(),await p,ar(t,s,n);return}if(s){await f.text(),await p;return}let v=await f.text(),b=t==="codex"?Bo(v):t==="claude-code"?Go(v):v;process.stdout.write(b),await p,f.ok||(process.stderr.write(`venos hook: orchestrator returned ${f.status}
98
- `),process.exit(1))}function ar(e,t,r){if(t)return;let{mode:n,implicit:o}=Do(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 - set failMode explicitly to keep proceeding.
90
+ `}var Bt={platform:"linux",install(e){let t=Kt(e.home),r=D(t,te);try{let n=ee(r);return to(t,{recursive:!0}),Dt(D(t,Jt),ro(e.nodePath,e.cliEntry),"utf8"),Dt(r,no(),"utf8"),e.run("systemctl",["--user","daemon-reload"]),e.run("systemctl",["--user","enable","--now",te]),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:oo(n)}}},remove(e,t){let r=Kt(e),n=D(r,te),o=D(r,Jt),s=ee(n);try{t("systemctl",["--user","disable","--now",te])}catch{}ee(n)&&Ft(n,{force:!0}),ee(o)&&Ft(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 oo(e){return e instanceof Error?e.message:String(e)}var re="venos-heartbeat",Gt={platform:"win32",install(e){let t=`Scheduled Task: ${re}`;try{let r=T(e.home),n=`"${e.nodePath}" "${e.cliEntry}" heartbeat`;return e.run("schtasks",["/Create","/TN",re,"/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:so(r)}}},remove(e,t){let r=T(e);try{t("schtasks",["/Delete","/TN",re,"/F"])}catch{}return R(e),{platform:"win32",status:r?"removed":"already-removed",path:`Scheduled Task: ${re}`}}};function so(e){return e instanceof Error?e.message:String(e)}var Yt=[Ht,Bt,Gt],zt=(e,t)=>{try{io(e,t,{stdio:"ignore"})}catch{}};function Zt(e){return e??process.env.HOME??process.env.USERPROFILE??""}function Xt(e={}){let t=Yt.find(r=>r.platform===process.platform);return t?t.install({home:Zt(e.home),nodePath:process.execPath,cliEntry:process.argv[1]??"",run:e.run??zt}):{platform:"unsupported",status:"unsupported"}}function qt(e={}){let t=Yt.find(r=>r.platform===process.platform);return t?t.remove(Zt(e.home),e.run??zt):{platform:"unsupported",status:"unsupported"}}function Qt(e){return T(e)}function er(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 ao={wired:"OK","already-wired":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},co={wired:"wired","already-wired":"already wired","skipped-not-installed":"skipped (not installed)",error:"ERROR"},Ue="http://127.0.0.1:4000/v1";function tr(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=ao[n.status],s=co[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=er(t.service);n&&console.log(n)}if(r){console.log(`
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`)}lo(t.clineWorkspace)}function lo(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: ${Ue}`),console.log(" Optional: Custom HTTP Headers \u2192 X-Venos-Source: cursor"),console.log(` \u2022 Windsurf \u2014 Settings \u2192 Models \u2192 Custom OpenAI Base URL: ${Ue}`),(!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": "${Ue}"`)),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 rr(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var uo={removed:"OK","already-removed":"\xB7","skipped-not-installed":"\u2014",error:"FAIL"},po={removed:"removed","already-removed":"already removed","skipped-not-installed":"skipped (not installed)",error:"ERROR"};function nr(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=uo[s.status],a=po[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=er(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 or(e,t){console.log(JSON.stringify({...t,outcomes:e},null,2))}var sr=1;function J(e){return vo(e,".venos","config.json")}function wo(){return`org-${So(4).toString("hex")}`}function ko(e,t,r,n){let o=J(e);if(ir(o))try{let s=JSON.parse(mo(o,"utf8")),i={schemaVersion:s.schemaVersion??sr,...s,orchestratorUrl:t};return r&&(i.apiKey=r),n&&(i.orgId=n),i}catch{}return{schemaVersion:sr,orgId:n??wo(),orchestratorUrl:t,createdAt:new Date().toISOString(),failMode:"closed",...r?{apiKey:r}:{}}}function Co(e,t){let r=J(e);fo(yo(r),{recursive:!0}),ho(r,JSON.stringify(t,null,2)+`
95
+ `,"utf8")}var xo=5e3,bo=5e3;async function Oo(e){let t=e.replace(/\/$/,""),r=new AbortController,n=setTimeout(()=>r.abort(),xo);try{return(await fetch(`${t}/healthz`,{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(n)}}async function Po(e,t){let r=e.replace(/\/$/,""),n=new AbortController,o=setTimeout(()=>n.abort(),bo);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 Eo(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 ar(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=e.orchestratorUrl??"http://127.0.0.1:8788";await Oo(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=ko(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=_t(t,o,F);Co(t,n);let i=jt(e.cwd??process.cwd()),a=process.env.VITEST&&!e.serviceRun?void 0:Xt({home:t,...e.serviceRun?{run:e.serviceRun}:{}});e.noTelemetry===!0||Eo(r)||!!n.apiKey||await Po(r,n.orgId);let c={orgId:n.orgId,orchestratorUrl:r,clineWorkspace:i,...a?{service:a}:{}};e.json?rr(s,c):tr(s,c)}function cr(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??"",r=Ut(t,F),n=process.env.VITEST&&!e.serviceRun?void 0:qt({home:t,...e.serviceRun?{run:e.serviceRun}:{}}),o=J(t),s=ir(o);s&&go(o,{force:!0});let i={venosConfigPath:o,venosConfigRemoved:s,...n?{service:n}:{}};e.json?or(r,i):nr(r,i)}import{mkdirSync as Io,readFileSync as ne,existsSync as Ro,writeFileSync as To}from"node:fs";import{hostname as Ao,userInfo as _o}from"node:os";import{execFileSync as ur}from"node:child_process";import{randomBytes as dr}from"node:crypto";import{dirname as Uo,join as pr}from"node:path";function No(e){return pr(e,".venos","config.json")}function C(e){let t=No(e);if(!Ro(t))throw new Error(`venos config not found at ${t} - run "venos init" first`);return JSON.parse(ne(t,"utf8"))}function $o(){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 Mo(e){let t;try{t=ne(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 jo(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=Mo(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 Vo(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 Wo(e){try{let r=JSON.parse(e).cursor_version;return typeof r=="string"&&r!==""}catch{return!1}}function Ne(){try{let e=_o().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 Lo(e,t,r){if(t==="")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;for(let s of["userId","user_id"]){let i=o[s];if(typeof i=="string"&&i.trim()!=="")return e}return o.userId=t,r&&(o.actor_email=r),JSON.stringify(o)}async function Ho(e){if(process.env.VENOS_EMIT_ACTOR_EMAIL==="false")return null;try{let t=ur("git",["config","user.email"],{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t.toLowerCase()}catch{}try{let t=C(e);if(t.actor_email?.trim())return t.actor_email.trim().toLowerCase()}catch{}return null}function y(e){let t=e===""?"":pr(e,".venos","machine-id");if(t!=="")try{let r=ne(t,"utf8").trim();if(r!=="")return r}catch{}try{let r=ne("/etc/machine-id","utf8").trim();if(r!=="")return r}catch{}if(t==="")return"";try{let r=dr(16).toString("hex");return Io(Uo(t),{recursive:!0}),To(t,r+`
97
+ `,"utf8"),r}catch{return""}}function Fo(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!==""&&(o.hostname=r),JSON.stringify(o)}function w(e=process.platform,t=Do){if(e==="darwin")try{let r=t().trim();if(r!=="")return r.endsWith(".local")?r:`${r}.local`}catch{}try{let r=Ao();return typeof r=="string"?r.trim():""}catch{return""}}function Do(){try{return ur("scutil",["--get","LocalHostName"],{encoding:"utf8",timeout:1e3}).trim()}catch{return""}}function x(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 Jo(e){return e.failMode==="closed"?{mode:"closed",implicit:!1}:e.failMode==="open"?{mode:"open",implicit:!1}:{mode:"open",implicit:!0}}function fr(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(!fr(l.status)||a===n-1)return l;i=new Error(`orchestrator returned ${l.status}`)}catch(l){i=l}}throw i}function Ko(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 Bo(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:x(r,s.apiKey,o),body:n})).text()}catch{}}))}async function mr(e,t="claude-code"){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=C(r),o=await $o(),s=Wo(o),i=await Ho(r),a=Fo(Lo(jo(Vo(o,n.orgId)),Ne(),i),y(r),w()),c=`${n.orchestratorUrl.replace(/\/$/,"")}/v1/hooks/${encodeURIComponent(t)}`,u=dr(16).toString("hex"),p=Bo(Ko(n),t,n.orgId,a,u),f;try{f=await A(c,{method:"POST",headers:x(n.orgId,n.apiKey,u),body:a})}catch{await p,lr(t,s,n);return}if(fr(f.status)){await f.text(),await p,lr(t,s,n);return}if(s){await f.text(),await p;return}let v=await f.text(),b=t==="codex"?Go(v):t==="claude-code"?Yo(v):v;process.stdout.write(b),await p,f.ok||(process.stderr.write(`venos hook: orchestrator returned ${f.status}
98
+ `),process.exit(1))}function lr(e,t,r){if(t)return;let{mode:n,implicit:o}=Jo(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 - 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 Bo(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 Go(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 Yo}from"node:fs/promises";import{homedir as zo}from"node:os";import{join as Zo}from"node:path";async function fr(e={}){let t=e.home??zo(),r=Zo(t,".venos","config.json"),n;try{n=JSON.parse(await Yo(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 Go(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 Yo(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 zo}from"node:fs/promises";import{homedir as Zo}from"node:os";import{join as Xo}from"node:path";async function gr(e={}){let t=e.home??Zo(),r=Xo(t,".venos","config.json"),n;try{n=JSON.parse(await zo(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,24 @@ Open this URL to upgrade your venos plan:
107
107
 
108
108
  ${i.url}
109
109
 
110
- `)}import{readFileSync as Qo,existsSync as es}from"node:fs";import{join as hr}from"node:path";import{execFile as ts}from"node:child_process";import{promisify as rs}from"node:util";import{existsSync as _}from"node:fs";import{dirname as Xo,join as ne,resolve as U}from"node:path";import{fileURLToPath as qo}from"node:url";var oe=Xo(qo(import.meta.url));function mr(){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 es,existsSync as ts}from"node:fs";import{join as vr}from"node:path";import{execFile as rs}from"node:child_process";import{promisify as ns}from"node:util";import{existsSync as _}from"node:fs";import{dirname as qo,join as oe,resolve as U}from"node:path";import{fileURLToPath as Qo}from"node:url";var se=qo(Qo(import.meta.url));function hr(){let e=process.env.VENOS_SESSION_WASTE_PATH;if(e&&_(e))return U(e);let t=U(oe(se,"..","etc","session-waste","bin.js"));if(_(t))return t;let r=U(oe(se,"..","..","..","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 gr(){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 yr(){let e=process.env.VENOS_USAGE_AGGREGATOR_PATH;if(e&&_(e))return U(e);let t=U(oe(se,"..","etc","session-waste","usage-bin.js"));if(_(t))return t;let r=U(oe(se,"..","..","..","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 ns=rs(ts);async function yr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=hr(t,".venos","config.json");if(!es(r))throw new Error(`venos config not found at ${r} \u2014 run "venos init" first`);let n=JSON.parse(Qo(r,"utf8")),o=mr(),s=hr(t,".claude"),{stdout:i}=await ns(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 os,existsSync as ss,statSync as is,writeFileSync as as}from"node:fs";import{join as Ae}from"node:path";import{execFile as cs,spawn as ls}from"node:child_process";import{promisify as us}from"node:util";var ds=us(cs),ps=500;function fs(e,t,r=ps){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 ms(e){return Ae(e,".venos","usage-sync.last")}function _e(e,t,r){try{return r-is(e).mtimeMs>=t}catch{return!0}}function vr(e,t=60,r=ls){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=ms(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{as(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 Sr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=Ae(r,".venos","config.json");if(!ss(n))throw new Error(`venos config not found at ${n} \u2014 run "venos init" first`);let o=JSON.parse(os(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=gr(),c=Ae(r,".claude"),{stdout:u}=await ds(process.execPath,[l,c],{maxBuffer:64*1024*1024}),p=JSON.parse(u),f=Array.isArray(p.sessions)?p.sessions:[],v=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 fs(f,v)){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 Lr=await ce.json();$+=Lr.sessionsStored??M.sessions.length}return{sessionsScanned:p.sessionsScanned??0,sessionsStored:$}}import{existsSync as ri,readFileSync as ni,writeFileSync as Pr}from"node:fs";import{join as Er}from"node:path";import{spawn as oi}from"node:child_process";import{execFileSync as se}from"node:child_process";import{existsSync as gs,readdirSync as hs,readFileSync as wr,realpathSync as ys}from"node:fs";import{homedir as vs,hostname as Ss,release as K}from"node:os";import{basename as ws,dirname as ks,join as Cs}from"node:path";var xs=[{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"}}}],bs=/\d+(?:\.\d+){1,4}/;function Os(e,t){let r=e;return r.startsWith("~")&&(r=t+r.slice(1)),r=r.replace(/%([^%]+)%/g,(n,o)=>process.env[o]??""),r}function Ps(e){if(!e.includes("*"))return gs(e)?e:null;let t=ks(e),r=ws(e),n=r.indexOf("*"),o=r.slice(0,n),s=r.slice(n+1),i;try{i=hs(t)}catch{return null}for(let a of i)if(a.startsWith(o)&&a.endsWith(s)&&a.length>=o.length+s.length)return Cs(t,a);return null}function Es(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 Is(e){try{let t=JSON.parse(wr(e,"utf8"));return typeof t.version=="string"?t.version.trim():""}catch{return""}}function Rs(e){try{let t=ys(e);for(let r of t.split(/[/\\]/)){let n=r.match(/^\d+(?:\.\d+){1,4}$/);if(n)return n[0]}}catch{}return""}function Ts(e){try{let r=se(e,["--version"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).match(bs);return r?r[0]:""}catch{return""}}function As(e,t){switch(e){case"plist":return Es(t);case"pkgjson":return Is(t);case"symlink-version":return Rs(t);case"exec-version":return Ts(t);case"none":return""}}function _s(e,t){let r=[];for(let n of xs){let o=n.detect[e];if(!o)continue;let s="";for(let l of o){let c=Ps(Os(l,t));if(c){s=c;break}}if(s==="")continue;let i=n.version[e],a=i?As(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 Us(){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 Ns(){try{let t=wr("/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 $s(){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=Us():e==="linux"?t=Ns():e==="win32"?t=$s():t={platform:e,version:K()},{osPlatform:t.platform,osVersion:t.version}}function Ms(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:w()||Ss(),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??vs(),r=process.platform,n=_s(r,t),o=Ms(r);if(e.dryRun)return{agents:n.length,detected:n,host:o,uploaded:!1};let s=C(t),i=s.orchestratorUrl.replace(/\/$/,""),a=y(t),l=await fetch(`${i}/v1/inventory/agents`,{method:"POST",headers:x(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 js,spawn as Vs}from"node:child_process";import{existsSync as Ws,readFileSync as Ls,writeFileSync as Hs}from"node:fs";import{delimiter as kr,dirname as xr,join as $e}from"node:path";var Fs=1440*60*1e3,Ds=2e3,Js=6e4,Ks=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function br(e){return $e(e,".venos","update-check.json")}function Bs(e){try{let t=JSON.parse(Ls(br(e),"utf8"));if(typeof t.checkedAt=="number"&&t.policy&&typeof t.policy.mode=="string")return t}catch{}return null}function Gs(e,t){try{Hs(br(e),JSON.stringify(t))}catch{}}function Cr(e){let t=/^(\d+)\.(\d+)\.(\d+)/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Ys(e,t){let r=Cr(e),n=Cr(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 zs(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(Ds)});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 Zs(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 Ys(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:Bs(e.home);if(o&&t-o.checkedAt<Fs)n=o.policy;else{if(n=await zs(e.orchestratorUrl,e.orgId,r,e.machineId),n===null)return null;Gs(e.home,{checkedAt:t,policy:n})}return Zs(n,e.currentVersion)}function Xs(e=process.env,t=process.execPath){let r=xr(t),n=e.PATH??"";return n===""?{...e,PATH:r}:n.split(kr).includes(r)?{...e,PATH:n}:{...e,PATH:`${r}${kr}${n}`}}var qs=(e,t)=>new Promise((r,n)=>{js(e,t,{timeout:Js,env:Xs()},o=>{o?n(o):r()})});function Qs(e=process.execPath,t=Ws){let r=xr(e),n=[$e(r,"node_modules","npm","bin","npm-cli.js"),$e(r,"..","lib","node_modules","npm","bin","npm-cli.js")];for(let o of n)if(t(o))return o;return null}function ei(e,t,r=process.execPath){if(!Ks.test(e))return null;let n=`@venos-inc/venos@${e}`;return t!==null?{cmd:r,args:[t,"install","-g",n]}:{cmd:"npm",args:["install","-g",n]}}async function je(e,t=qs){let r=ei(e,Qs());if(r===null)return!1;try{return await t(r.cmd,r.args),!0}catch{return!1}}function ti(){let e=process.argv[1]??"";if(e!=="")try{Vs(process.execPath,[e,"heartbeat"],{detached:!0,stdio:"ignore",env:{...process.env,VENOS_SKIP_AUTOUPDATE:"1"}}).unref()}catch{}}async function Or(e,t=je,r=ti){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 si(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=Xt(e);return{config_valid:r,hooks_wired:a,service_installed:l}}async function Ir(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=Er(r,".venos","config.json");if(!ri(n))return{machineId:"",status:"skipped-no-config",checks:{}};let o=JSON.parse(ni(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=y(r),c=w(),u=si(r,o),{osPlatform:p,osVersion:f}=Ue(process.platform),v={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(v)},{timeoutMs:5e3});if(!$.ok)throw new Error(`venos heartbeat: orchestrator returned ${$.status}`);try{Pr(Rr(r),new Date().toISOString())}catch{}let M=e.cliVersion??"";return M!==""&&process.env.VENOS_SKIP_AUTOUPDATE!=="1"&&await Or({currentVersion:M,orchestratorUrl:i,orgId:s,home:r,machineId:l}),{machineId:l,status:"sent",checks:u}}function Rr(e){return Er(e,".venos","heartbeat.last")}function Ve(e,t=60,r=oi){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=Rr(n);if(!_e(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{Pr(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 Ar,readFileSync as _r}from"node:fs";import{join as S}from"node:path";function We(e){try{return Ar(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}}function ii(e,t){let r;try{r=_r(S(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 Tr(e,t,r){let n=[];for(let o of We(e)){let s=S(e,o),i=ii(s,o);i&&n.push({name:i.name,description:i.description,source:t,pluginName:r,path:s})}return n}function Ur(e){let t=[...Tr(S(e,"skills"),"user","")],r=[],n=S(e,"plugins","marketplaces");for(let o of We(n)){let s=S(n,o,"plugins");for(let i of We(s)){let a=S(s,i),l="",c=o;try{let f=JSON.parse(_r(S(a,".claude-plugin","plugin.json"),"utf8"));l=f.description??"",c=f.author?.name??o}catch{}let u=Tr(S(a,"skills"),"plugin",i);t.push(...u);let p=0;try{p=Ar(S(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 ai(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 Nr=6e3;async function $r(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=C(t),n=Ur(S(t,".claude")),o=ai(n,Nr),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=w();for(let l of o){let c=await fetch(`${s}/v1/inventory/skills`,{method:"POST",headers:x(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 ci(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 li(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 ui(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 Mr(e,t=ui){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=C(r),o=Ur(S(r,".claude")),s=y(r),i=w(),a=[],l=0;for(let p of o.skills){if(!p.path)continue;let f=await t(p.path);f&&(l++,a.push(...ci(p,s,f)))}let c=n.orchestratorUrl.replace(/\/$/,""),u=li(a,Nr);for(let p of u){let f=await fetch(`${c}/v1/inventory/skill-findings`,{method:"POST",headers:x(n.orgId,n.apiKey),body:JSON.stringify({orgId:n.orgId,machineId:s,hostname:i,findings:p})});if(!f.ok){let v=await f.text();throw new Error(`scan-skills findings upload failed: ${f.status} ${v}`)}}return{skillsScanned:l,findings:a.length,chunks:u.length}}import{readFileSync as di}from"node:fs";import{join as ie}from"node:path";function pi(e,t){let r;try{r=JSON.parse(di(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 fi(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(...pi(n.path,n.client));return r.sort((n,o)=>n.name.localeCompare(o.name)||n.client.localeCompare(o.client)),r}function mi(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 gi=6e3;async function jr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=C(t),n=fi(t),o=mi(n,gi),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=w();for(let l of o){let c=await fetch(`${s}/v1/inventory/mcp`,{method:"POST",headers:x(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 He="0.1.9";async function Vr(){try{let e=JSON.parse(hi(J(Le()),"utf8"));if(!e.orchestratorUrl||!e.orgId)return;let t=await Me({currentVersion:He,orchestratorUrl:e.orchestratorUrl,orgId:e.orgId,home:Le(),machineId:y(Le())});if(!t)return;if(t.kind==="auto"){process.stderr.write(`
118
+ If you are developing locally, run: pnpm --filter @venos/session-waste build`)}var os=ns(rs);async function Sr(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=vr(t,".venos","config.json");if(!ts(r))throw new Error(`venos config not found at ${r} \u2014 run "venos init" first`);let n=JSON.parse(es(r,"utf8")),o=hr(),s=vr(t,".claude"),{stdout:i}=await os(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 ss,existsSync as is,statSync as as,writeFileSync as cs}from"node:fs";import{join as $e}from"node:path";import{execFile as ls,spawn as us}from"node:child_process";import{promisify as ds}from"node:util";var ps=ds(ls),fs=500;function ms(e,t,r=fs){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 gs(e){return $e(e,".venos","usage-sync.last")}function Me(e,t,r){try{return r-as(e).mtimeMs>=t}catch{return!0}}function wr(e,t=60,r=us){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=gs(n);if(!Me(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{cs(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 kr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=$e(r,".venos","config.json");if(!is(n))throw new Error(`venos config not found at ${n} \u2014 run "venos init" first`);let o=JSON.parse(ss(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=yr(),c=$e(r,".claude"),{stdout:u}=await ps(process.execPath,[l,c],{maxBuffer:64*1024*1024}),p=JSON.parse(u),f=Array.isArray(p.sessions)?p.sessions:[],v=Array.isArray(p.attribution)?p.attribution:[];if(f.length===0)return{sessionsScanned:p.sessionsScanned??0,sessionsStored:0};let de=`${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 ms(f,v)){let pe=await A(de,{method:"POST",headers:N,body:JSON.stringify(M)},{timeoutMs:1e4});if(!pe.ok)throw new Error(`venos usage-sync: orchestrator returned ${pe.status}`);let Hr=await pe.json();$+=Hr.sessionsStored??M.sessions.length}return{sessionsScanned:p.sessionsScanned??0,sessionsStored:$}}import{existsSync as fi,readFileSync as mi,writeFileSync as Nr}from"node:fs";import{join as $r}from"node:path";import{spawn as gi}from"node:child_process";import{execFileSync as ie}from"node:child_process";import{existsSync as hs,readdirSync as ys,readFileSync as Cr,realpathSync as vs}from"node:fs";import{homedir as Ss,hostname as ws,release as K}from"node:os";import{basename as ks,dirname as Cs,join as xs}from"node:path";var bs=[{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"}}}],Os=/\d+(?:\.\d+){1,4}/;function Ps(e,t){let r=e;return r.startsWith("~")&&(r=t+r.slice(1)),r=r.replace(/%([^%]+)%/g,(n,o)=>process.env[o]??""),r}function Es(e){if(!e.includes("*"))return hs(e)?e:null;let t=Cs(e),r=ks(e),n=r.indexOf("*"),o=r.slice(0,n),s=r.slice(n+1),i;try{i=ys(t)}catch{return null}for(let a of i)if(a.startsWith(o)&&a.endsWith(s)&&a.length>=o.length+s.length)return xs(t,a);return null}function Is(e){let t=e.replace(/\.plist$/,"");try{return ie("defaults",["read",t,"CFBundleShortVersionString"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).trim()}catch{return""}}function Rs(e){try{let t=JSON.parse(Cr(e,"utf8"));return typeof t.version=="string"?t.version.trim():""}catch{return""}}function Ts(e){try{let t=vs(e);for(let r of t.split(/[/\\]/)){let n=r.match(/^\d+(?:\.\d+){1,4}$/);if(n)return n[0]}}catch{}return""}function As(e){try{let r=ie(e,["--version"],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}).match(Os);return r?r[0]:""}catch{return""}}function _s(e,t){switch(e){case"plist":return Is(t);case"pkgjson":return Rs(t);case"symlink-version":return Ts(t);case"exec-version":return As(t);case"none":return""}}function Us(e,t){let r=[];for(let n of bs){let o=n.detect[e];if(!o)continue;let s="";for(let l of o){let c=Es(Ps(l,t));if(c){s=c;break}}if(s==="")continue;let i=n.version[e],a=i?_s(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 Ns(){try{let e=ie("sw_vers",["-productName"],{encoding:"utf8",timeout:4e3}).trim(),t=ie("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 $s(){try{let t=Cr("/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 Ms(){let e=K();return{platform:Number(e.split(".")[2]??"0")>=22e3?"Windows 11":"Windows 10",version:e}}function je(e){let t;return e==="darwin"?t=Ns():e==="linux"?t=$s():e==="win32"?t=Ms():t={platform:e,version:K()},{osPlatform:t.platform,osVersion:t.version}}function js(e){let t=je(e),r={platform:t.osPlatform,version:t.osVersion},n="";return e==="win32"&&(n=(process.env.USERDNSDOMAIN??process.env.USERDOMAIN??"").trim()),{hostname:w()||ws(),osPlatform:r.platform,osVersion:r.version,deviceType:"Workstation",accountName:Ne(),accountDomain:n}}async function B(e={}){let t=e.home??process.env.HOME??process.env.USERPROFILE??Ss(),r=process.platform,n=Us(r,t),o=js(r);if(e.dryRun)return{agents:n.length,detected:n,host:o,uploaded:!1};let s=C(t),i=s.orchestratorUrl.replace(/\/$/,""),a=y(t),l=await fetch(`${i}/v1/inventory/agents`,{method:"POST",headers:x(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{readFileSync as Vs}from"node:fs";import{join as ae}from"node:path";function Ws(e,t){let r;try{r=JSON.parse(Vs(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 Ls(e){let t=[{path:ae(e,".claude.json"),client:"Claude Code"},{path:ae(e,".cursor","mcp.json"),client:"Cursor"},{path:ae(e,".codeium","windsurf","mcp_config.json"),client:"Windsurf"},{path:ae(e,"Library","Application Support","Claude","claude_desktop_config.json"),client:"Claude Desktop"}],r=[];for(let n of t)r.push(...Ws(n.path,n.client));return r.sort((n,o)=>n.name.localeCompare(o.name)||n.client.localeCompare(o.client)),r}function Hs(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 Fs=6e3;async function ce(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=C(t),n=Ls(t),o=Hs(n,Fs),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=w();for(let l of o){let c=await fetch(`${s}/v1/inventory/mcp`,{method:"POST",headers:x(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}}import{readdirSync as br,readFileSync as Or}from"node:fs";import{join as S}from"node:path";function Ve(e){try{return br(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}}function Ds(e,t){let r;try{r=Or(S(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 xr(e,t,r){let n=[];for(let o of Ve(e)){let s=S(e,o),i=Ds(s,o);i&&n.push({name:i.name,description:i.description,source:t,pluginName:r,path:s})}return n}function Pr(e){let t=[...xr(S(e,"skills"),"user","")],r=[],n=S(e,"plugins","marketplaces");for(let o of Ve(n)){let s=S(n,o,"plugins");for(let i of Ve(s)){let a=S(s,i),l="",c=o;try{let f=JSON.parse(Or(S(a,".claude-plugin","plugin.json"),"utf8"));l=f.description??"",c=f.author?.name??o}catch{}let u=xr(S(a,"skills"),"plugin",i);t.push(...u);let p=0;try{p=br(S(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 Js(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 Er=6e3;async function le(e){let t=e??process.env.HOME??process.env.USERPROFILE??"",r=C(t),n=Pr(S(t,".claude")),o=Js(n,Er),s=r.orchestratorUrl.replace(/\/$/,""),i=y(t),a=w();for(let l of o){let c=await fetch(`${s}/v1/inventory/skills`,{method:"POST",headers:x(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 Ks(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 Bs(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 Gs(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 Ir(e,t=Gs){let r=e??process.env.HOME??process.env.USERPROFILE??"",n=C(r),o=Pr(S(r,".claude")),s=y(r),i=w(),a=[],l=0;for(let p of o.skills){if(!p.path)continue;let f=await t(p.path);f&&(l++,a.push(...Ks(p,s,f)))}let c=n.orchestratorUrl.replace(/\/$/,""),u=Bs(a,Er);for(let p of u){let f=await fetch(`${c}/v1/inventory/skill-findings`,{method:"POST",headers:x(n.orgId,n.apiKey),body:JSON.stringify({orgId:n.orgId,machineId:s,hostname:i,findings:p})});if(!f.ok){let v=await f.text();throw new Error(`scan-skills findings upload failed: ${f.status} ${v}`)}}return{skillsScanned:l,findings:a.length,chunks:u.length}}import{execFile as Ys,spawn as zs}from"node:child_process";import{existsSync as Zs,readFileSync as Xs,writeFileSync as qs}from"node:fs";import{delimiter as Rr,dirname as Ar,join as We}from"node:path";var Qs=1440*60*1e3,ei=2e3,ti=6e4,ri=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function _r(e){return We(e,".venos","update-check.json")}function ni(e){try{let t=JSON.parse(Xs(_r(e),"utf8"));if(typeof t.checkedAt=="number"&&t.policy&&typeof t.policy.mode=="string")return t}catch{}return null}function oi(e,t){try{qs(_r(e),JSON.stringify(t))}catch{}}function Tr(e){let t=/^(\d+)\.(\d+)\.(\d+)/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function si(e,t){let r=Tr(e),n=Tr(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 ii(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(ei)});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 ai(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 si(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 Le(e){let t=e.now??Date.now(),r=e.fetchImpl??fetch,n,o=e.bypassCache?null:ni(e.home);if(o&&t-o.checkedAt<Qs)n=o.policy;else{if(n=await ii(e.orchestratorUrl,e.orgId,r,e.machineId),n===null)return null;oi(e.home,{checkedAt:t,policy:n})}return ai(n,e.currentVersion)}function ci(e=process.env,t=process.execPath){let r=Ar(t),n=e.PATH??"";return n===""?{...e,PATH:r}:n.split(Rr).includes(r)?{...e,PATH:n}:{...e,PATH:`${r}${Rr}${n}`}}var li=(e,t)=>new Promise((r,n)=>{Ys(e,t,{timeout:ti,env:ci()},o=>{o?n(o):r()})});function ui(e=process.execPath,t=Zs){let r=Ar(e),n=[We(r,"node_modules","npm","bin","npm-cli.js"),We(r,"..","lib","node_modules","npm","bin","npm-cli.js")];for(let o of n)if(t(o))return o;return null}function di(e,t,r=process.execPath){if(!ri.test(e))return null;let n=`@venos-inc/venos@${e}`;return t!==null?{cmd:r,args:[t,"install","-g",n]}:{cmd:"npm",args:["install","-g",n]}}async function He(e,t=li){let r=di(e,ui());if(r===null)return!1;try{return await t(r.cmd,r.args),!0}catch{return!1}}function pi(){let e=process.argv[1]??"";if(e!=="")try{zs(process.execPath,[e,"heartbeat"],{detached:!0,stdio:"ignore",env:{...process.env,VENOS_SKIP_AUTOUPDATE:"1"}}).unref()}catch{}}async function Ur(e,t=He,r=pi){try{let n=await Le({...e,bypassCache:!0});return!n||n.kind!=="auto"||!await t(n.targetVersion)?null:(r(),n.targetVersion)}catch{return null}}function hi(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=Qt(e);return{config_valid:r,hooks_wired:a,service_installed:l}}async function Mr(e={},t){let r=t??process.env.HOME??process.env.USERPROFILE??"",n=$r(r,".venos","config.json");if(!fi(n))return{machineId:"",status:"skipped-no-config",checks:{}};let o=JSON.parse(mi(n,"utf8")),s=e.orgId??o.orgId,i=e.orchestratorUrl??o.orchestratorUrl,a=e.apiKey??o.apiKey,l=y(r),c=w(),u=hi(r,o),{osPlatform:p,osVersion:f}=je(process.platform),v={orgId:s,machineId:l,hostname:c,cliVersion:e.cliVersion??"",osPlatform:p,osVersion:f,checks:u},de=`${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(de,{method:"POST",headers:N,body:JSON.stringify(v)},{timeoutMs:5e3});if(!$.ok)throw new Error(`venos heartbeat: orchestrator returned ${$.status}`);try{Nr(jr(r),new Date().toISOString())}catch{}let M=e.cliVersion??"";return M!==""&&process.env.VENOS_SKIP_AUTOUPDATE!=="1"&&await Ur({currentVersion:M,orchestratorUrl:i,orgId:s,home:r,machineId:l}),{machineId:l,status:"sent",checks:u}}function jr(e){return $r(e,".venos","heartbeat.last")}async function Vr(e){let t=[["scan-mcp",()=>ce(e)],["scan-skills",()=>le(e)],["scan-agents",()=>B({home:e})]];for(let[r,n]of t)try{await n()}catch(o){let s=o instanceof Error?o.message:String(o);process.stderr.write(`venos heartbeat: ${r} inventory refresh skipped (${s})
121
+ `)}}function Fe(e,t=60,r=gi){let n=e??process.env.HOME??process.env.USERPROFILE??"",o=jr(n);if(!Me(o,t*6e4,Date.now()))return{ran:!1,reason:"throttled"};try{Nr(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"}}var De="0.1.10";async function Wr(){try{let e=JSON.parse(yi(J(ue()),"utf8"));if(!e.orchestratorUrl||!e.orgId)return;let t=await Le({currentVersion:De,orchestratorUrl:e.orchestratorUrl,orgId:e.orgId,home:ue(),machineId:y(ue())});if(!t)return;if(t.kind==="auto"){process.stderr.write(`
121
122
  ${t.message}
122
- `);let r=await je(t.targetVersion);process.stderr.write(r?`venos: updated to ${t.targetVersion}. Re-run venos to use it.
123
+ `);let r=await He(t.targetVersion);process.stderr.write(r?`venos: updated to ${t.targetVersion}. Re-run venos to use it.
123
124
  `:`venos: auto-update failed. Install manually: npm i -g @venos-inc/venos@${t.targetVersion}
124
125
  `);return}process.stderr.write(`
125
126
  ${t.message}
126
- `)}catch{}}var Wr=`Usage: venos <command> [options]
127
+ `)}catch{}}var Lr=`Usage: venos <command> [options]
127
128
 
128
129
  Commands:
129
130
  init Wire your AI client(s) to the venos security gateway
@@ -147,18 +148,18 @@ Options (init):
147
148
  --remove Inverse of init \u2014 drop the venos entry from every
148
149
  wired client's config and delete ~/.venos/config.json.
149
150
  Pre-venos .venos-backup snapshots are preserved.
150
- `;function k(e,t){let r=e.indexOf(t);if(!(r===-1||r+1>=e.length))return e[r+1]}function O(e,t){return e.includes(t)}async function yi(){let e=process.argv.slice(2),t=e[0];switch(t){case"init":{if(O(e,"--remove")){ir({json:O(e,"--json")});break}let r=k(e,"--orchestrator"),n=k(e,"--api-key"),o=k(e,"--org"),s=O(e,"--json");await sr({...r!==void 0?{orchestratorUrl:r}:{},...n!==void 0?{apiKey:n}:{},...o!==void 0?{orgId:o}:{},json:s,noTelemetry:O(e,"--no-telemetry")}),s||await Vr();break}case"hook":{let r=k(e,"--source");await pr(void 0,r??"claude-code");break}case"waste-scan":{let r=await yr();process.stdout.write(`venos waste-scan: ${r.sessionsScanned} session(s) scanned, ${r.findingsStored} finding(s) reported
151
- `);break}case"usage-sync":{if(O(e,"--throttle")){let i=vr();Ve(),process.stdout.write(`venos usage-sync --throttle: ${i.reason}
152
- `);break}let r=k(e,"--org"),n=k(e,"--orchestrator"),o=k(e,"--api-key"),s=await Sr({...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(O(e,"--scan")){let n=await Mr();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 $r();process.stdout.write(`venos scan-skills: ${r.skills} skill(s) + ${r.plugins} plugin(s) reported
155
- `);break}case"scan-mcp":{let r=await jr();process.stdout.write(`venos scan-mcp: ${r.servers} MCP server(s) reported in ${r.chunks} chunk(s)
156
- `);break}case"scan-agents":{if(O(e,"--dry-run")){let n=await Ne({dryRun:!0});process.stdout.write(JSON.stringify(n,null,2)+`
157
- `);break}let r=await Ne();process.stdout.write(`venos scan-agents: ${r.agents} local AI agent(s) reported
158
- `);break}case"heartbeat":{if(O(e,"--throttle")){let i=Ve();process.stdout.write(`venos heartbeat --throttle: ${i.reason}
159
- `);break}let r=k(e,"--org"),n=k(e,"--orchestrator"),o=k(e,"--api-key"),s=await Ir({cliVersion:He,...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)})
151
+ `;function k(e,t){let r=e.indexOf(t);if(!(r===-1||r+1>=e.length))return e[r+1]}function O(e,t){return e.includes(t)}async function vi(){let e=process.argv.slice(2),t=e[0];switch(t){case"init":{if(O(e,"--remove")){cr({json:O(e,"--json")});break}let r=k(e,"--orchestrator"),n=k(e,"--api-key"),o=k(e,"--org"),s=O(e,"--json");await ar({...r!==void 0?{orchestratorUrl:r}:{},...n!==void 0?{apiKey:n}:{},...o!==void 0?{orgId:o}:{},json:s,noTelemetry:O(e,"--no-telemetry")}),s||await Wr();break}case"hook":{let r=k(e,"--source");await mr(void 0,r??"claude-code");break}case"waste-scan":{let r=await Sr();process.stdout.write(`venos waste-scan: ${r.sessionsScanned} session(s) scanned, ${r.findingsStored} finding(s) reported
152
+ `);break}case"usage-sync":{if(O(e,"--throttle")){let i=wr();Fe(),process.stdout.write(`venos usage-sync --throttle: ${i.reason}
153
+ `);break}let r=k(e,"--org"),n=k(e,"--orchestrator"),o=k(e,"--api-key"),s=await kr({...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
154
+ `);break}case"scan-skills":{if(O(e,"--scan")){let n=await Ir();process.stdout.write(`venos scan-skills --scan: ${n.findings} finding(s) from ${n.skillsScanned} skill(s) reported in ${n.chunks} chunk(s)
155
+ `);break}let r=await le();process.stdout.write(`venos scan-skills: ${r.skills} skill(s) + ${r.plugins} plugin(s) reported
156
+ `);break}case"scan-mcp":{let r=await ce();process.stdout.write(`venos scan-mcp: ${r.servers} MCP server(s) reported in ${r.chunks} chunk(s)
157
+ `);break}case"scan-agents":{if(O(e,"--dry-run")){let n=await B({dryRun:!0});process.stdout.write(JSON.stringify(n,null,2)+`
158
+ `);break}let r=await B();process.stdout.write(`venos scan-agents: ${r.agents} local AI agent(s) reported
159
+ `);break}case"heartbeat":{if(O(e,"--throttle")){let i=Fe();process.stdout.write(`venos heartbeat --throttle: ${i.reason}
160
+ `);break}let r=k(e,"--org"),n=k(e,"--orchestrator"),o=k(e,"--api-key"),s=await Mr({cliVersion:De,...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)})
160
161
  `:`venos heartbeat: no config \u2014 run "venos init" first
161
- `);break}case"upgrade":await fr();return;case"version":case"--version":case"-v":process.stdout.write(`${He}
162
- `),process.exit(0);break;case"help":case void 0:process.stdout.write(Wr),await Vr(),process.exit(0);break;default:process.stderr.write(`Unknown subcommand: ${t}
163
- ${Wr}`),process.exit(2)}}try{await yi()}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`venos: ${t}
162
+ `),s.status==="sent"&&r===void 0&&n===void 0&&o===void 0&&await Vr(ue());break}case"upgrade":await gr();return;case"version":case"--version":case"-v":process.stdout.write(`${De}
163
+ `),process.exit(0);break;case"help":case void 0:process.stdout.write(Lr),await Wr(),process.exit(0);break;default:process.stderr.write(`Unknown subcommand: ${t}
164
+ ${Lr}`),process.exit(2)}}try{await vi()}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`venos: ${t}
164
165
  `),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/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules/json5/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/json5@2.2.3/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/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/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.9/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/bin/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/node_modules/.pnpm/@babel+parser@7.29.7/node_modules:/Users/baraklagziel/code/venos/.worktrees/cli-publish-0.1.10/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" "$@"