Lines 1-65javascript
2import{readFileSync as tc}from"node:fs";import{homedir as U}from"node:os";import{chmodSync as rr,existsSync as sr,mkdirSync as Ci,readFileSync as Oi,rmSync as xi,writeFileSync as bi}from"node:fs";import{dirname as Pi,join as Ei}from"node:path";import{randomBytes as Ri}from"node:crypto";import{existsSync as Jr,readFileSync as Kr}from"node:fs";import{join as Br}from"node:path";import{copyFileSync as Fr,existsSync as it,mkdirSync as Wr,renameSync as Lr,writeFileSync as Dr}from"node:fs";import{dirname as Hr}from"node:path";var at=".venos-backup";function g(e,t){Wr(Hr(e),{recursive:!0}),it(e)&&!it( ...
3`}var H="http://127.0.0.1:4000/v1";var Gr="venos",Yr="venos hook",zr="venos usage-sync",Xr="venos usage-sync --throttle";function lt(e,t){return(e??[]).some(n=>n.hooks.some(r=>typeof r.command=="string"&&t(r.command)))}function Oe(e){return lt(e,t=>t.includes(Yr))}function ut(e){return lt(e,t=>t.includes(zr))}function ct(e,t){let n=e??[];return Oe(n)?n:[...n,{matcher:"*",hooks:[{type:"command",command:t}]}]}function Zr(e,t){let n=e??[];return ut(n)?n:[...n,{matcher:"*",hooks:[{type:"command",command:t}]}]}function Ce(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(n=>typeof n.command!="str ...
4`,i===t&&(o+=" ".repeat(s+n+2),o+=`^
5`))}return o}var f=class extends Error{line;column;codeblock;constructor(t,n){let[r,o]=to(n.toml,n.ptr),s=no(n.toml,r,o);super(`Invalid TOML document: ${t}
7${s}`,n),this.line=r,this.column=o,this.codeblock=s}};function ro(e,t){let n=0;for(;e[t-++n]==="\\";);return--n&&n%2}function re(e,t
8`,t);return e[r-1]==="\r"&&r--,r<=n?r:-1}function $(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r===`
9`)return n;if(r==="\r"&&e[n+1]===`
10`)return n+1;if(r<" "&&r!==" "||r==="\x7F")throw new f("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}function O(e,t,n,r){let o;for(;;){for
11`||o==="\r"&&e[t+1]===`
12`);)t++;if(r||o!=="#")break;t=$(e,t)}return t}function gt(e,t,n,r,o=!1){if(!r)return t=re(e,t),t<0?e.length:t;for(
13`||i==="\r"&&e[s+1]===`
14`))return s}}throw new f("cannot find end of structure",{toml:e,ptr:t})}function oe(e,t){let n=e[t],r=n===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):n;t+=
15`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function se(e,t=0,n=e.length){let r=e[t]==="'",o=e[t++]===e[t]&&e[t]===e[t+1];o&&(n-=2,e[t+=2]==="\r"&&t++,e[t]===`
16`&&t++);let s=0,i,a="",c=t;for(;t<n-1;){let l=e[t++];if(l===`
18`){if(!o)throw new f("newlines are not allowed in strings",{toml:e,ptr:t-1})}else if(l<" "&&l!==" "||l==="\x7F")throw new f("control characters are not allowed in strings",{toml:e,ptr:t-1});if(i){if(i=!1,l==="x"||l==="u"||l==="U"){let u=e.slice(t,t+=l==="x"?2:l==="u"?4:8);if(!co.test(u))throw new f("invalid unicode escape",{toml:e,ptr:s});try{a+=String.fromCodePoint(parseInt(u,16))}catch{throw new f("invalid unicode escape",{toml:e,ptr:s})}}else if(o&&(l===`
19`||l===" "||l===" "||l==="\r")){if(t=O(e,t-1,!0),e[t]!==`
20`&&e[t]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:s});t=O(e,t)}else if(l in ht)a+=ht[l];else throw new f("unrecognized escape sequence",{toml:e,ptr:s});c=t}else!r&&l==="\\"&&(s=t-1,i=!0,a+=e.slice(c,s))}return a+e.slice(c,n-1)}function yt(e,t,n,r){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 r?0n:0;let o=so.test(e);if(o||io.test(e)){if(ao.test(e))throw new f("leading zeroes are not allowed",{toml:t,ptr:n});e=e.replac ...
21`&&e[i]!=="\r")throw new f("unexpected character encountered",{toml:e,ptr:i});i+=+(e[i]===",")}return[c,i]}i=gt(e,t,",",n);let a=lo(e,t,i-+(e[i-1]===","));if(!a[0])throw new f("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return n&&a[
22`&&i!=="\r"){let a,c=o,l=!1,[u,d]=ie(e,t-1);for(let m=0;m<u.length;m++){if(m&&(c=l?c[a]:c[a]={}),a=u[m],(l=Object.hasOwn(c,a))&&(typeof c[a]!="object"||s.has(c[a])))throw new f("trying to redefine an already defined value",{toml:e,ptr:t});!l&&a==="__proto__"&&Object.defineProperty(c,a,{enumerable:!0,configurable:!0,writable:!0})}if(l)throw new f("trying to redefine an already defined value",{toml:e,ptr:t});let[p,y]=G(e,d,"}",n-1,r);s.add(p),c[a]=p,t=y}}if(!i)throw new f("unfinished table encountered",{toml:e,ptr:t});return[o,t]}function St(e,t,n,r){let o=[],s;for(t++;(s=e[t++])!=="]"&&s;){if(s ...
26`,o+=Ie(0,e[s],t,n,r);return o}function Ie(e,t,n,r,o){if(r===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let s="",i="",a=Object.keys(t);for(let
27`)+go(t[l],n?`${n}.${d}`:d,r-1,o);else if(u==="object"){let p=n?`${n}.${d}`:d;i+=(i&&`
28`)+Ie(p,t[l],p,r-1,o)}else s+=d,s+=" = ",s+=_e(t[l],u,r,o),s+=`
29`}}return e&&(s||!i)&&(s=s?`[${e}]
30${s}`:`[${e}]`),s&&i?`${s}
31${i}`:s||i}function Te(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(Y(e)!=="object")throw new TypeError("stringify can only be called with an object");let r=Ie(0,e,"",t,n);
33`:r}function Ot(e){let t=e.mcp_servers?.venos;if(!t||t.command!=="node")return!1;let n=t.args?.[0];return!n||n.includes("/A2A/")||t.env?.VENOS_SOURCE!=="codex"||t.env?.VENOS_URL||t.env?.VENOS_ORG_ID
34`)}};import{existsSync as bt,readFileSync as yo}from"node:fs";import{join as Pt}from"node:path";var vo="venos",Et="venos hook";function So(e){let t=e.trim();return t.includes(Et)&&/(?:^|\s)--source(?:=|\s+)codex(?:\s|$)/.test(t)?!0:/\bVENOS_(?:HOOK_)?SOURCE=codex\b/.test(t)&&(t.includes(Et)||t.includes("venos-hook.sh"))}function ae(e){return(e??[]).some(t=>t.hooks.some(n=>typeof n.command=="string"&&So(n.command)))}function Ne(e,t){let n=e??[];return ae(n)?n:[...n,{matcher:"*",hooks:[{type:"command",command:t}]}]}function Ue(e){return(e??[]).map(t=>({...t,hooks:t.hooks.filter(n=>typeof n.comma ...
35`).some(r=>r.trim()===Ht()),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
36`);n.length>0&&n[n.length-1]===""&&n.pop();let r=n.filter(s=>!To(s)),o=t.wired?[...r,Ht()]:r;if(o.length===0){Dt(e)&&Eo(e,{force:!0});
38`)}};import{accessSync as Ao,constants as No,existsSync as Bt,readFileSync as Uo}from"node:fs";import{delimiter as $o}from"node:path";import{join as Gt}from"node:path";var Mo="obsidian-cli",jo="obsidian-cli.json";function Vo(e){try{return Ao(e,No.X_OK
39 VENOS_MCP_SERVER_PATH=${e??"(unset)"}
42If you are developing locally, run: pnpm --filter @venos/mcp-server build`)}import{existsSync as Do}from"node:fs";function Ho(e,t,n){let r=e.configPath(t);if(!e.isInstalled(t))return{client:e.name,transport:e.transport,status:"skipped-not-installed"};try{let o=e.load(r);if(e.isWired(o,n))return{client:e.name,transport:e.transport,status:"already-wired",path:r};let s=e.inject(o,n);return e.write(r,s),{client:e.name,transport:e.transport,status:"wired",path:r}}catch(o){return{client:e.name,transport:e.transport,status:"error",path:r,error:o instanceof Error?o.message:String(o)}}}function Zt(e,t, ...
46`;return g(n,o),{status:"wired",path:n}}import{execFileSync as ms}from"node:child_process";import{existsSync as sn,mkdirSync as ns,rmSync as rs,writeFileSync as os}from"node:fs";import{dirname as ss,join as is}from"node:path";var De="ai.venos.agent";import{existsSync as on,mkdirSync as Xo,rmSync as Zo,writeFileSync as qo}from"node:fs";import{dirname as Qo,join as es}from"node:path";function He(e){return es(e,".venos","service.json")}function j(e,t){let n=He(e);Xo(Qo(n),{recursive:!0}),qo(n,JSON.stringify(t,null,2)+`
47`,"utf8")}function V(e){let t=He(e);return on(t)?(Zo(t,{force:!0}),!0):!1}function F(e){return on(He(e))}function an(e){return is(e,"Library","LaunchAgents",`${De}.plist`)}function as(e,t){return`<?xml version="1.0" encoding="UTF-8"?>
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/index.jsView on unpkg · L2 HighChild Process
Package source references child process execution.
dist/index.jsView on unpkg · L45 48<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52 <string>${De}</string>
53 <key>ProgramArguments</key>
57 <string>heartbeat</string>
61 <key>StartInterval</key>
62 <integer>${3600}</integer>
65 <key>SuccessfulExit</key>
Long lines were clipped for display.