@vibecontrols/agent 2026.1125.2 → 2026.1127.2

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 (106) hide show
  1. package/dist/agent-config-xwvsmn6b.js +2 -0
  2. package/dist/{agent-ready-tracker-mewxehg9.js → agent-ready-tracker-7ebr09d9.js} +1 -1
  3. package/dist/app-4t875vbv.js +2 -0
  4. package/dist/autostart.cmd-mdyv35dn.js +2 -0
  5. package/dist/bootstrap-workspace-1pt0bwy6.js +2 -0
  6. package/dist/bootstrap.service-gehm65tt.js +2 -0
  7. package/dist/bridge-client-9ax1cvj6.js +2 -0
  8. package/dist/bridge-commands-xhzhghxt.js +2 -0
  9. package/dist/cli.js +2 -2
  10. package/dist/daemon-profile-fnhc7pcf.js +2 -0
  11. package/dist/{finalize-retry-worker-az74f2qv.js → finalize-retry-worker-c38km3mt.js} +1 -1
  12. package/dist/gateway-client-3zp6kkav.js +2 -0
  13. package/dist/{getMachineId-bsd-4w1wmcjv.js → getMachineId-bsd-qjqk66se.js} +1 -1
  14. package/dist/{getMachineId-darwin-kejwz8w5.js → getMachineId-darwin-tqhg8pqb.js} +1 -1
  15. package/dist/{getMachineId-linux-mpm53wat.js → getMachineId-linux-ygfapc26.js} +1 -1
  16. package/dist/{getMachineId-unsupported-54seyw5v.js → getMachineId-unsupported-87w3cred.js} +1 -1
  17. package/dist/{getMachineId-win-cva7ghz9.js → getMachineId-win-jrtkq63e.js} +1 -1
  18. package/dist/{index-0gmhd3hs.js → index-0rmmrrfh.js} +3 -3
  19. package/dist/{index-7s7ee1y9.js → index-0vbsve3v.js} +4 -4
  20. package/dist/{index-7f2k4g6q.js → index-12gb48hg.js} +4 -4
  21. package/dist/{index-4rasb3ph.js → index-12rehjp4.js} +9 -9
  22. package/dist/{index-7wben1jx.js → index-164mtd7z.js} +2 -2
  23. package/dist/index-1smr1csg.js +116 -0
  24. package/dist/{index-w0m3jm0s.js → index-1t74r13z.js} +2 -2
  25. package/dist/{index-9xrhb68w.js → index-31ssvzw8.js} +2 -2
  26. package/dist/{index-652f9scs.js → index-4kf3nr14.js} +2 -2
  27. package/dist/{index-qe3xpt41.js → index-5s4mtrqb.js} +2 -2
  28. package/dist/{index-jmx5awkj.js → index-62vfxd90.js} +2 -2
  29. package/dist/{index-5ccmrpb5.js → index-6b9vh0gq.js} +48 -48
  30. package/dist/{index-7gk1x74m.js → index-6nv5rdqh.js} +2 -2
  31. package/dist/{index-er5k6qtr.js → index-6wfd7cv3.js} +4 -4
  32. package/dist/{index-t6p4szqx.js → index-76vza24h.js} +3 -3
  33. package/dist/{index-76m37yd8.js → index-7bm1kptr.js} +3 -3
  34. package/dist/{index-0qjbnyg4.js → index-7wm4bqx5.js} +5 -5
  35. package/dist/{index-akk3rxnn.js → index-90gn0b6x.js} +3 -3
  36. package/dist/{index-2r6cmxxz.js → index-axkwyajz.js} +1 -1
  37. package/dist/index-bk17490n.js +3 -0
  38. package/dist/{index-2vcxt38h.js → index-bpzk441p.js} +2 -2
  39. package/dist/{index-4z1y39jt.js → index-cn4p1ks0.js} +2 -2
  40. package/dist/{index-byerrz46.js → index-damc6cvc.js} +2 -2
  41. package/dist/{index-xtd0j8ve.js → index-dgbe8jm8.js} +2 -2
  42. package/dist/index-dtxd2xmg.js +158 -0
  43. package/dist/index-e5jdx9c1.js +3 -0
  44. package/dist/{index-tahaxp6n.js → index-ednz6yz2.js} +2 -2
  45. package/dist/{index-hsrt2v87.js → index-f5nmxa9e.js} +1 -1
  46. package/dist/{index-thm1bzpj.js → index-j8j1h00a.js} +9 -9
  47. package/dist/{index-kwhx023z.js → index-j99tkngg.js} +10 -10
  48. package/dist/{index-fqz9n560.js → index-nz7mhjjn.js} +3 -3
  49. package/dist/index-p1b10hs1.js +11 -0
  50. package/dist/{index-qfxwk38p.js → index-p7fbnfwd.js} +2 -2
  51. package/dist/{index-jnxjjx2y.js → index-ppxayc0x.js} +2 -2
  52. package/dist/index-qzwbctkv.js +16 -0
  53. package/dist/{index-a0vx2zyx.js → index-rae5bn1c.js} +2 -2
  54. package/dist/{index-8rbhm4g8.js → index-rhn7wy1p.js} +2 -2
  55. package/dist/index-sd5bt3g5.js +2 -0
  56. package/dist/{index-vtsd74g0.js → index-sq5j8bjn.js} +6 -6
  57. package/dist/{index-t5cfkz1e.js → index-v77bb0rm.js} +3 -3
  58. package/dist/{index-v16qz1fa.js → index-vhz1c474.js} +2 -2
  59. package/dist/{index-ywnfz6nm.js → index-wxb9dgwq.js} +1 -1
  60. package/dist/index-x4z055t8.js +3 -0
  61. package/dist/{index-haww9jpq.js → index-xetd52ad.js} +2 -2
  62. package/dist/{index-d59kp6zr.js → index-yfk0pb00.js} +2 -2
  63. package/dist/{index-cy97asyh.js → index-zcnfj1q4.js} +3 -3
  64. package/dist/{index-c4whjk5r.js → index-zn9snqbg.js} +2 -2
  65. package/dist/index.js +3 -3
  66. package/dist/interactive-52x9hv6c.js +2 -0
  67. package/dist/key.cmd-y415ngam.js +2 -0
  68. package/dist/log-shipper-02rqvtq8.js +2 -0
  69. package/dist/{path-utils-r4df8d3w.js → path-utils-qgkdkp5j.js} +1 -1
  70. package/dist/plugin-system-7qjqrq7s.js +2 -0
  71. package/dist/prereqs-runner-w7z2dwa6.js +2 -0
  72. package/dist/profile-mount-ga5z1vx9.js +2 -0
  73. package/dist/prune-stale-shims-vejvb1rj.js +2 -0
  74. package/dist/register-core-vv5pddxj.js +2 -0
  75. package/dist/secondary-profile-attach-222s85md.js +2 -0
  76. package/dist/subprocess-p9bv9nqz.js +2 -0
  77. package/dist/telemetry-1d3t1mbf.js +2 -0
  78. package/dist/tunnel-bootstrap-20vwak7q.js +2 -0
  79. package/package.json +1 -1
  80. package/dist/agent-config-v9d7gcz0.js +0 -2
  81. package/dist/app-xc9c1d71.js +0 -2
  82. package/dist/autostart.cmd-ahet7b1t.js +0 -2
  83. package/dist/bootstrap-workspace-3pb8qjsh.js +0 -2
  84. package/dist/bootstrap.service-9m7m1ksa.js +0 -2
  85. package/dist/bridge-client-xvqy3n15.js +0 -2
  86. package/dist/daemon-profile-sg8fp50z.js +0 -2
  87. package/dist/gateway-client-ermpz52n.js +0 -2
  88. package/dist/index-5021rk8n.js +0 -3
  89. package/dist/index-b3v08awy.js +0 -3
  90. package/dist/index-mmx2kp76.js +0 -16
  91. package/dist/index-ss5gez2p.js +0 -2
  92. package/dist/index-tts92sdm.js +0 -5
  93. package/dist/index-x83tcr8f.js +0 -158
  94. package/dist/index-zcmhy3jv.js +0 -116
  95. package/dist/interactive-vbz68zh5.js +0 -2
  96. package/dist/key.cmd-f6rjvjy8.js +0 -2
  97. package/dist/log-shipper-0erbwn0q.js +0 -2
  98. package/dist/plugin-system-byzwda4c.js +0 -2
  99. package/dist/prereqs-runner-gca0bytz.js +0 -2
  100. package/dist/profile-mount-s4mc1x18.js +0 -2
  101. package/dist/prune-stale-shims-4nqtv0xt.js +0 -2
  102. package/dist/register-core-ws2axmcf.js +0 -2
  103. package/dist/secondary-profile-attach-em1tq7vq.js +0 -2
  104. package/dist/subprocess-4gg77skg.js +0 -2
  105. package/dist/telemetry-nmtywcba.js +0 -2
  106. package/dist/tunnel-bootstrap-tjwz90pb.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ht,Er,_e,$e,ye,Vt,Xr,It,zr,nt,ei,_r,yr,st,Sr,ti,w,ri,M,Yt,X,Zt,ii,ni,si,oi,Ct,ai}from"./index-j99tkngg.js";import"./index-7wm4bqx5.js";export{Ht as BUILTIN_PROFILE_SEEDS,Er as NAMED_ENV_PRESETS,Ct as applyAgentConfigToEnv,ai as applyAgentSecretsToEnv,_e as assertValidProfileName,Zt as buildPairedIdentity,_r as buildProfileSeed,ei as deleteProfile,ii as describeGatewayIdentityConflict,si as describeGatewayIdentityMismatch,ni as describeProfileEnvironmentConflict,yr as ensureProfilesInitialized,Sr as getAgentConfigDefaults,st as getAgentConfigPath,ti as getAgentConfigSeed,oi as getEnvPinnedGateways,ri as getOrCreateAgentInstanceId,$e as getProfilePath,Xr as listProfileNames,ye as readActiveProfileName,w as readAgentConfig,X as readAgentConfigWithSecrets,It as readProfile,zr as readProfileStrict,Vt as writeActiveProfileName,M as writeAgentConfig,Yt as writeAgentConfigAwaitSecrets,nt as writeProfile};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{i,g,n,c}from"./index-7f2k4g6q.js";var u={pending:()=>i.gray("\u25CF"),active:()=>i.cyan("\u25B6"),ok:()=>i.green("\u2713"),warn:()=>i.yellow("\u26A0"),fail:()=>i.red("\u2717")};function d(a,t){if(t)console.log(" "+a)}async function P(a,t=2000){let f=new AbortController,h=setTimeout(()=>f.abort(),t);try{let e=await fetch(`${a}/health/ready`,{signal:f.signal});if(e.status!==200&&e.status!==503)return null;return await e.json()}catch{return null}finally{clearTimeout(h)}}function D(a){if(!a?.message)return null;let t=a.message.match(/provider:\s*(\S+)/);return t?t[1]:null}async function I(a,t={}){let f=t.timeoutMs??60000,h=t.pollIntervalMs??500,e=t.verbose!==!1;if(e)g("Waiting for agent to become ready");let o={daemon:!1,awaiting:!1,initializing:!1,db:!1,session:!1,tunnel:!1},S=Date.now(),p="",v=0,A=null;while(Date.now()-S<f){let m=await P(a);if(!m){await C(h);continue}if(!o.daemon)d(`${u.ok()} Daemon listening on ${a}`,e),o.daemon=!0;let s=m.bootState??"unknown",y=m.components??{};if(s!==p){if(p=s,s==="awaiting-config"&&!o.awaiting)d(`${u.warn()} Workspace config: ${i.yellow("awaiting OAuth credentials \u2014 register this agent in the VibeControls UI")}`,e),o.awaiting=!0;else if(s==="initializing"&&!o.initializing)d(`${u.active()} Finalizing: fetching encryption key, opening storage, loading plugins\u2026`,e),o.initializing=!0}if(s==="awaiting-config"){if(v++,v>=2)return{outcome:"awaiting-config",bootState:s,degradedReasons:[],summary:"Agent is awaiting workspace registration. Open the VibeControls UI \u2192 Agents \u2192 Add Agent, paste the API Key and Tunnel URL printed above."}}else v=0;if(y.db?.ok&&!o.db)d(`${u.ok()} Storage encryption key loaded, DB opened`,e),o.db=!0;if(y.session?.ok&&!o.session){let k=y.session.message??"";d(`${u.ok()} Plugins started \u2014 ${k}`,e),o.session=!0}let b=D(y.tunnel);if(b&&b!=="bootstrap"&&b!==A){if(A=b,!o.tunnel)d(`${u.ok()} Tunnel ready (provider: ${b})`,e),o.tunnel=!0}let T=m.status==="degraded";if(s==="ready"&&!T){if(e)c(),n("Status",i.green("ready"));return{outcome:"ready",bootState:s,degradedReasons:[],summary:"Agent ready."}}if(s==="degraded"||s==="ready"&&T){let k=m.degradedReasons??[],w=k;if(k.length===0){let r=[];for(let[R,l]of Object.entries(y)){if(R==="boot"||R==="lifecycle")continue;if(l&&!l.ok&&l.message)r.push({plugin:R,message:l.message})}for(let[R,l]of Object.entries(m.plugins??{}))if(l&&!l.ok&&l.message)r.push({plugin:`plugin:${R}`,message:l.message});w=r}if(e){c(),d(`${u.fail()} Agent boot ${i.red("degraded")} \u2014 investigate before retrying`,e);for(let r of w)d(` ${i.gray("\xB7")} [${r.plugin}] ${r.message}`,e);c()}return{outcome:"degraded",bootState:s,degradedReasons:w,summary:w.length?`Agent degraded: ${w.map((r)=>`[${r.plugin}] ${r.message}`).join("; ")}`:"Agent degraded with no reported reason \u2014 check vibe logs."}}await C(h)}if(e)c(),d(`${u.warn()} Timed out after ${Math.round(f/1000)}s; last bootState=${p||"unknown"}. Check ${i.bold("vibe logs")} for details.`,e),c();return{outcome:"timeout",bootState:p||"unknown",degradedReasons:[],summary:`Timed out waiting for ready. Last bootState=${p||"unknown"}.`}}function C(a){return new Promise((t)=>setTimeout(t,a))}export{I as trackAgentReady};
2
+ import{i,g,n,c}from"./index-12gb48hg.js";var u={pending:()=>i.gray("\u25CF"),active:()=>i.cyan("\u25B6"),ok:()=>i.green("\u2713"),warn:()=>i.yellow("\u26A0"),fail:()=>i.red("\u2717")};function d(a,t){if(t)console.log(" "+a)}async function P(a,t=2000){let f=new AbortController,h=setTimeout(()=>f.abort(),t);try{let e=await fetch(`${a}/health/ready`,{signal:f.signal});if(e.status!==200&&e.status!==503)return null;return await e.json()}catch{return null}finally{clearTimeout(h)}}function D(a){if(!a?.message)return null;let t=a.message.match(/provider:\s*(\S+)/);return t?t[1]:null}async function I(a,t={}){let f=t.timeoutMs??60000,h=t.pollIntervalMs??500,e=t.verbose!==!1;if(e)g("Waiting for agent to become ready");let o={daemon:!1,awaiting:!1,initializing:!1,db:!1,session:!1,tunnel:!1},S=Date.now(),p="",v=0,A=null;while(Date.now()-S<f){let m=await P(a);if(!m){await C(h);continue}if(!o.daemon)d(`${u.ok()} Daemon listening on ${a}`,e),o.daemon=!0;let s=m.bootState??"unknown",y=m.components??{};if(s!==p){if(p=s,s==="awaiting-config"&&!o.awaiting)d(`${u.warn()} Workspace config: ${i.yellow("awaiting OAuth credentials \u2014 register this agent in the VibeControls UI")}`,e),o.awaiting=!0;else if(s==="initializing"&&!o.initializing)d(`${u.active()} Finalizing: fetching encryption key, opening storage, loading plugins\u2026`,e),o.initializing=!0}if(s==="awaiting-config"){if(v++,v>=2)return{outcome:"awaiting-config",bootState:s,degradedReasons:[],summary:"Agent is awaiting workspace registration. Open the VibeControls UI \u2192 Agents \u2192 Add Agent, paste the API Key and Tunnel URL printed above."}}else v=0;if(y.db?.ok&&!o.db)d(`${u.ok()} Storage encryption key loaded, DB opened`,e),o.db=!0;if(y.session?.ok&&!o.session){let k=y.session.message??"";d(`${u.ok()} Plugins started \u2014 ${k}`,e),o.session=!0}let b=D(y.tunnel);if(b&&b!=="bootstrap"&&b!==A){if(A=b,!o.tunnel)d(`${u.ok()} Tunnel ready (provider: ${b})`,e),o.tunnel=!0}let T=m.status==="degraded";if(s==="ready"&&!T){if(e)c(),n("Status",i.green("ready"));return{outcome:"ready",bootState:s,degradedReasons:[],summary:"Agent ready."}}if(s==="degraded"||s==="ready"&&T){let k=m.degradedReasons??[],w=k;if(k.length===0){let r=[];for(let[R,l]of Object.entries(y)){if(R==="boot"||R==="lifecycle")continue;if(l&&!l.ok&&l.message)r.push({plugin:R,message:l.message})}for(let[R,l]of Object.entries(m.plugins??{}))if(l&&!l.ok&&l.message)r.push({plugin:`plugin:${R}`,message:l.message});w=r}if(e){c(),d(`${u.fail()} Agent boot ${i.red("degraded")} \u2014 investigate before retrying`,e);for(let r of w)d(` ${i.gray("\xB7")} [${r.plugin}] ${r.message}`,e);c()}return{outcome:"degraded",bootState:s,degradedReasons:w,summary:w.length?`Agent degraded: ${w.map((r)=>`[${r.plugin}] ${r.message}`).join("; ")}`:"Agent degraded with no reported reason \u2014 check vibe logs."}}await C(h)}if(e)c(),d(`${u.warn()} Timed out after ${Math.round(f/1000)}s; last bootState=${p||"unknown"}. Check ${i.bold("vibe logs")} for details.`,e),c();return{outcome:"timeout",bootState:p||"unknown",degradedReasons:[],summary:`Timed out waiting for ready. Last bootState=${p||"unknown"}.`}}function C(a){return new Promise((t)=>setTimeout(t,a))}export{I as trackAgentReady};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{br}from"./index-12rehjp4.js";import"./index-ednz6yz2.js";import"./index-6b9vh0gq.js";import"./index-ppxayc0x.js";import"./index-nz7mhjjn.js";import"./index-0vbsve3v.js";import"./index-6wfd7cv3.js";import"./index-p1b10hs1.js";import"./index-wxb9dgwq.js";import"./index-cn4p1ks0.js";import"./index-p7fbnfwd.js";import"./index-qzwbctkv.js";import"./index-x4z055t8.js";import"./index-1t74r13z.js";import"./index-damc6cvc.js";import"./index-j99tkngg.js";import"./index-7wm4bqx5.js";export{br as createApp};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tn,Dr}from"./index-zcnfj1q4.js";import"./index-v77bb0rm.js";import"./index-12gb48hg.js";import"./index-sq5j8bjn.js";import"./index-damc6cvc.js";import"./index-j99tkngg.js";import"./index-7wm4bqx5.js";export{tn as ensureAutostartConfigured,Dr as register};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Tr}from"./index-rhn7wy1p.js";import"./index-7wm4bqx5.js";export{Tr as bootstrapWorkspace};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{De,ct}from"./index-4kf3nr14.js";export{De as checkDependencies,ct as installDependencies};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{He,zi}from"./index-bk17490n.js";import"./index-7wm4bqx5.js";export{He as BridgeCommandError,zi as bridgeClient};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./index-7wm4bqx5.js";import{He}from"./index-bk17490n.js";import{Ae}from"./index-p1b10hs1.js";var s=new Set(["desk.session"]),c=new Set(["BAD_REQUEST","DESK_OFFLINE"]);async function i(n){try{return await n()}catch(e){let t=typeof e==="object"&&e!==null&&"code"in e?e.code:void 0;if(typeof t==="string"&&c.has(t))throw new He(t,e instanceof Error?e.message:t);throw e}}function p(n,e){let t={publishEvent(o){if(!s.has(o.topic))throw Error(`plugins may not publish '${o.topic}'`);if(typeof o.payload!=="object"||o.payload===null||Array.isArray(o.payload))throw Error("an event payload must be an object");e.publishEvent({topic:o.topic,payload:o.payload})}};n.registerService("agent","bridge",t)}function d(n){if(typeof n!=="object"||n===null)return!1;let e=n;return typeof e.act==="function"&&typeof e.fence==="function"&&typeof e.health==="function"}function a(n){let e=n.getService("desk","remote");if(!d(e))throw new He("DESK_OFFLINE","no desk plugin with remote control is loaded on this agent");return e}function u(n,e){let t=[n.handle("agent.ping",async()=>({pong:!0,version:Ae(),at:new Date().toISOString()})),n.handle("desk.act",(o,r)=>i(()=>a(e).act(o,{signal:r.signal}))),n.handle("desk.fence",(o,r)=>i(()=>a(e).fence(o,{signal:r.signal}))),n.handle("desk.health",(o,r)=>i(()=>a(e).health({signal:r.signal})))];return()=>{for(let o of t)o()}}export{u as registerBridgeCommands,p as registerPluginBridgeService};
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{$e}from"./index-haww9jpq.js";import{I,se,e}from"./index-0qjbnyg4.js";import{W}from"./index-tts92sdm.js";import{Z}from"./index-ywnfz6nm.js";import{vi}from"./index-7f2k4g6q.js";import"./index-w0m3jm0s.js";import"./index-kwhx023z.js";import"./index-5021rk8n.js";import"./index-mmx2kp76.js";import{xr}from"./index-jmx5awkj.js";import"./index-vtsd74g0.js";import"./index-652f9scs.js";import"./index-cy97asyh.js";import{br,wr}from"./index-zcmhy3jv.js";import"./index-fqz9n560.js";import"./index-0gmhd3hs.js";import"./index-7s7ee1y9.js";import{Te,Ee,Ti,ke}from"./index-er5k6qtr.js";import{b}from"./index-w4jqdhc2.js";import"./index-4z1y39jt.js";import"./index-t5cfkz1e.js";import"./index-byerrz46.js";import{join as m}from"path";if(typeof Bun>"u")console.error(`\x1B[31mError:\x1B[0m VibeControls Agent requires the Bun runtime.
3
+ import{Ye}from"./index-xetd52ad.js";import{I,se,e}from"./index-7wm4bqx5.js";import{W}from"./index-p1b10hs1.js";import{Z}from"./index-wxb9dgwq.js";import{Gi}from"./index-12gb48hg.js";import"./index-1t74r13z.js";import"./index-j99tkngg.js";import"./index-x4z055t8.js";import"./index-qzwbctkv.js";import{Br}from"./index-62vfxd90.js";import"./index-sq5j8bjn.js";import"./index-4kf3nr14.js";import"./index-zcnfj1q4.js";import{Pr,Mr}from"./index-1smr1csg.js";import"./index-nz7mhjjn.js";import"./index-0rmmrrfh.js";import"./index-0vbsve3v.js";import{xe,Ie,Fi,ve}from"./index-6wfd7cv3.js";import{b}from"./index-w4jqdhc2.js";import"./index-cn4p1ks0.js";import"./index-v77bb0rm.js";import"./index-damc6cvc.js";import{join as m}from"path";if(typeof Bun>"u")console.error(`\x1B[31mError:\x1B[0m VibeControls Agent requires the Bun runtime.
4
4
  Install Bun: https://bun.sh
5
- Then run: bun run vibe ...`),process.exit(1);var a=process.argv.slice(2),l=a.includes("--plain")||a.includes("--json")||process.env.NO_COLOR==="1"||!process.stdout.isTTY;vi(!l);try{xr()}catch{}var s="1.0.0";try{let t=m(import.meta.dir,"..","package.json");s=(await Bun.file(t).json()).version}catch{}var r=new $e;r.name("vibe").description("VibeControls Agent CLI \u2014 Remote development environment management").version(s,"-v, --version").option("--provider <name>","Override the default provider for tunnel/session operations").option("-p, --profile <name>","Target a specific profile (one-off; doesn't change the persisted default). See `vibe profile`.").option("--json","Emit machine-readable JSON instead of human output.").option("--plain","Force plain-text output (no interactive UI).").hook("preAction",(t,o)=>{let n=t.opts().profile;if(n)process.env.VIBECONTROLS_PROFILE=n;try{Z.init(),Z.emit("command.executed",{command_name:o.name()})}catch{}});wr(r);async function g(){let t=new W;try{await t.loadCorePlugins()}catch{}try{await t.loadAll()}catch{}let o=new Te,n={storage:{async get(){return null},async set(){},async delete(){return!1},async list(){return[]},async deleteAll(){return 0}},logger:e().logger,serviceRegistry:o,getProvider:(i)=>o.getProvider(i),getAgentBaseUrl:()=>process.env.AGENT_URL||"http://localhost:3005",getAgentVersion:()=>s,broadcast:()=>{},workspaceQuery:async()=>({data:void 0,errors:[{message:"workspaceQuery is not available in CLI mode"}]}),isGatewayConfigured:()=>!1,getAgentRecordId:async()=>null,getWorkspaceId:async()=>null,getConfig:async()=>{return},getPluginRegistry:()=>se(),getDataDir:()=>I(),cliContributors:new Ee,telemetry:{emit:(i,p)=>{try{Z.emit(i,p??{})}catch{}}},os:b(),iframeBridge:ke()};Ti(n.cliContributors);try{await t.dispatchCliSetup(r,n)}catch{}r.configureHelp({formatHelp:()=>br(r,!0)}),await r.parseAsync()}g().then(()=>{process.exit(process.exitCode??0)}).catch((t)=>{console.error(`\x1B[31mFatal:\x1B[0m ${t instanceof Error?t.message:t}`),process.exit(1)});
5
+ Then run: bun run vibe ...`),process.exit(1);var a=process.argv.slice(2),l=a.includes("--plain")||a.includes("--json")||process.env.NO_COLOR==="1"||!process.stdout.isTTY;Gi(!l);try{Br()}catch{}var s="1.0.0";try{let t=m(import.meta.dir,"..","package.json");s=(await Bun.file(t).json()).version}catch{}var r=new Ye;r.name("vibe").description("VibeControls Agent CLI \u2014 Remote development environment management").version(s,"-v, --version").option("--provider <name>","Override the default provider for tunnel/session operations").option("-p, --profile <name>","Target a specific profile (one-off; doesn't change the persisted default). See `vibe profile`.").option("--json","Emit machine-readable JSON instead of human output.").option("--plain","Force plain-text output (no interactive UI).").hook("preAction",(t,o)=>{let n=t.opts().profile;if(n)process.env.VIBECONTROLS_PROFILE=n;try{Z.init(),Z.emit("command.executed",{command_name:o.name()})}catch{}});Mr(r);async function g(){let t=new W;try{await t.loadCorePlugins()}catch{}try{await t.loadAll()}catch{}let o=new xe,n={storage:{async get(){return null},async set(){},async delete(){return!1},async list(){return[]},async deleteAll(){return 0}},logger:e().logger,serviceRegistry:o,getProvider:(i)=>o.getProvider(i),getAgentBaseUrl:()=>process.env.AGENT_URL||"http://localhost:3005",getAgentVersion:()=>s,broadcast:()=>{},workspaceQuery:async()=>({data:void 0,errors:[{message:"workspaceQuery is not available in CLI mode"}]}),isGatewayConfigured:()=>!1,getAgentRecordId:async()=>null,getWorkspaceId:async()=>null,getConfig:async()=>{return},getPluginRegistry:()=>se(),getDataDir:()=>I(),cliContributors:new Ie,telemetry:{emit:(i,p)=>{try{Z.emit(i,p??{})}catch{}}},os:b(),iframeBridge:ve()};Fi(n.cliContributors);try{await t.dispatchCliSetup(r,n)}catch{}r.configureHelp({formatHelp:()=>Pr(r,!0)}),await r.parseAsync()}g().then(()=>{process.exit(process.exitCode??0)}).catch((t)=>{console.error(`\x1B[31mFatal:\x1B[0m ${t instanceof Error?t.message:t}`),process.exit(1)});
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{N,e,at}from"./index-7wm4bqx5.js";export{e as getDaemonProfile,at as getOrCreateProfile,N as profileRegistry};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{e}from"./index-0qjbnyg4.js";var m=[300000,600000,900000,1800000];function p(f){let g=f.backoffsMs??m,n=0,o=!1,i=null,u=null,a=null,t=e();if(t.getBootState()==="ready")return{cancel(){},async forceRetryNow(){return{ok:!0}},getState(){return{attempt:0,cancelled:!0,nextAttemptAt:null}}};function c(){if(i!==null)clearTimeout(i),i=null,u=null}function y(){if(o)return Promise.resolve({ok:!1,error:"retry worker cancelled"});if(t.getBootState()==="ready")return o=!0,c(),Promise.resolve({ok:!0});if(a)return a;return n+=1,f.onAttempt?.(n),t.logger.info("finalize-retry",`Background finalize retry attempt ${n}`),a=(async()=>{try{let r=await f.trigger();if(r.ok)t.logger.info("finalize-retry",`Background finalize succeeded on attempt ${n} \u2014 agent recovered`),o=!0,c();else t.recordFinalizeError(r.error,n),t.logger.warn("finalize-retry",`Background finalize attempt ${n} failed`,{error:r.error});return r}catch(r){let l=r instanceof Error?r.message:String(r);return t.recordFinalizeError(l,n),t.logger.error("finalize-retry",`Background finalize attempt ${n} threw`,{error:l}),{ok:!1,error:l}}finally{a=null}})(),a}function s(){if(o)return;if(t.getBootState()==="ready"){o=!0;return}if(i!==null)return;let r=Math.min(n,g.length-1),l=g[r];u=Date.now()+l,i=setTimeout(async()=>{if(i=null,await y(),!o&&t.getBootState()!=="ready")s()},l)}return s(),{cancel(){o=!0,c()},async forceRetryNow(){if(t.getBootState()==="ready")return{ok:!0};if(o)return{ok:!1,error:"retry worker cancelled"};c();let r=await y();if(!o&&t.getBootState()!=="ready")s();return r},getState(){return{attempt:n,cancelled:o,nextAttemptAt:u?new Date(u).toISOString():null}}}}export{p as startFinalizeRetryWorker};
2
+ import{e}from"./index-7wm4bqx5.js";var m=[300000,600000,900000,1800000];function p(f){let g=f.backoffsMs??m,n=0,o=!1,i=null,u=null,a=null,t=e();if(t.getBootState()==="ready")return{cancel(){},async forceRetryNow(){return{ok:!0}},getState(){return{attempt:0,cancelled:!0,nextAttemptAt:null}}};function c(){if(i!==null)clearTimeout(i),i=null,u=null}function y(){if(o)return Promise.resolve({ok:!1,error:"retry worker cancelled"});if(t.getBootState()==="ready")return o=!0,c(),Promise.resolve({ok:!0});if(a)return a;return n+=1,f.onAttempt?.(n),t.logger.info("finalize-retry",`Background finalize retry attempt ${n}`),a=(async()=>{try{let r=await f.trigger();if(r.ok)t.logger.info("finalize-retry",`Background finalize succeeded on attempt ${n} \u2014 agent recovered`),o=!0,c();else t.recordFinalizeError(r.error,n),t.logger.warn("finalize-retry",`Background finalize attempt ${n} failed`,{error:r.error});return r}catch(r){let l=r instanceof Error?r.message:String(r);return t.recordFinalizeError(l,n),t.logger.error("finalize-retry",`Background finalize attempt ${n} threw`,{error:l}),{ok:!1,error:l}}finally{a=null}})(),a}function s(){if(o)return;if(t.getBootState()==="ready"){o=!0;return}if(i!==null)return;let r=Math.min(n,g.length-1),l=g[r];u=Date.now()+l,i=setTimeout(async()=>{if(i=null,await y(),!o&&t.getBootState()!=="ready")s()},l)}return s(),{cancel(){o=!0,c()},async forceRetryNow(){if(t.getBootState()==="ready")return{ok:!0};if(o)return{ok:!1,error:"retry worker cancelled"};c();let r=await y();if(!o&&t.getBootState()!=="ready")s();return r},getState(){return{attempt:n,cancelled:o,nextAttemptAt:u?new Date(u).toISOString():null}}}}export{p as startFinalizeRetryWorker};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ui,T}from"./index-7wm4bqx5.js";export{ui as GatewayClient,T as gatewayClient};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nt}from"./index-qe3xpt41.js";import{x}from"./index-7wben1jx.js";import{a,j}from"./index-a0vx2zyx.js";var u=a(function(n){Object.defineProperty(n,"__esModule",{value:!0});n.getMachineId=void 0;var r=j("fs"),i=nt(),t=x();async function c(){try{return(await r.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){t.diag.debug(`error reading machine id: ${e}`)}try{return(await i.execAsync("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){t.diag.debug(`error reading machine id: ${e}`)}return}n.getMachineId=c});export default u();
2
+ import{At}from"./index-5s4mtrqb.js";import{x}from"./index-164mtd7z.js";import{a,j}from"./index-rae5bn1c.js";var u=a(function(n){Object.defineProperty(n,"__esModule",{value:!0});n.getMachineId=void 0;var r=j("fs"),i=At(),t=x();async function c(){try{return(await r.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){t.diag.debug(`error reading machine id: ${e}`)}try{return(await i.execAsync("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){t.diag.debug(`error reading machine id: ${e}`)}return}n.getMachineId=c});export default u();
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{nt}from"./index-qe3xpt41.js";import{x}from"./index-7wben1jx.js";import{a}from"./index-a0vx2zyx.js";var o=a(function(c){Object.defineProperty(c,"__esModule",{value:!0});c.getMachineId=void 0;var i=nt(),n=x();async function u(){try{let t=(await i.execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
2
+ import{At}from"./index-5s4mtrqb.js";import{x}from"./index-164mtd7z.js";import{a}from"./index-rae5bn1c.js";var o=a(function(c){Object.defineProperty(c,"__esModule",{value:!0});c.getMachineId=void 0;var i=At(),n=x();async function u(){try{let t=(await i.execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
3
3
  `).find((d)=>d.includes("IOPlatformUUID"));if(!t)return;let r=t.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(e){n.diag.debug(`error reading machine id: ${e}`)}return}c.getMachineId=u});export default o();
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{x}from"./index-7wben1jx.js";import{a,j}from"./index-a0vx2zyx.js";var o=a(function(i){Object.defineProperty(i,"__esModule",{value:!0});i.getMachineId=void 0;var t=j("fs"),r=x();async function d(){let c=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let s of c)try{return(await t.promises.readFile(s,{encoding:"utf8"})).trim()}catch(e){r.diag.debug(`error reading machine id: ${e}`)}return}i.getMachineId=d});export default o();
2
+ import{x}from"./index-164mtd7z.js";import{a,j}from"./index-rae5bn1c.js";var o=a(function(i){Object.defineProperty(i,"__esModule",{value:!0});i.getMachineId=void 0;var t=j("fs"),r=x();async function d(){let c=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let s of c)try{return(await t.promises.readFile(s,{encoding:"utf8"})).trim()}catch(e){r.diag.debug(`error reading machine id: ${e}`)}return}i.getMachineId=d});export default o();
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{x}from"./index-7wben1jx.js";import{a}from"./index-a0vx2zyx.js";var i=a(function(t){Object.defineProperty(t,"__esModule",{value:!0});t.getMachineId=void 0;var e=x();async function n(){e.diag.debug("could not read machine-id: unsupported platform");return}t.getMachineId=n});export default i();
2
+ import{x}from"./index-164mtd7z.js";import{a}from"./index-rae5bn1c.js";var i=a(function(t){Object.defineProperty(t,"__esModule",{value:!0});t.getMachineId=void 0;var e=x();async function n(){e.diag.debug("could not read machine-id: unsupported platform");return}t.getMachineId=n});export default i();
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nt}from"./index-qe3xpt41.js";import{x}from"./index-7wben1jx.js";import{a,j}from"./index-a0vx2zyx.js";var u=a(function(s){Object.defineProperty(s,"__esModule",{value:!0});s.getMachineId=void 0;var e=j("process"),n=nt(),c=x();async function d(){let t="%windir%\\System32\\REG.exe";if(e.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in e.env)t="%windir%\\sysnative\\cmd.exe /c "+t;try{let i=(await n.execAsync(`${t} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split("REG_SZ");if(i.length===2)return i[1].trim()}catch(r){c.diag.debug(`error reading machine id: ${r}`)}return}s.getMachineId=d});export default u();
2
+ import{At}from"./index-5s4mtrqb.js";import{x}from"./index-164mtd7z.js";import{a,j}from"./index-rae5bn1c.js";var u=a(function(s){Object.defineProperty(s,"__esModule",{value:!0});s.getMachineId=void 0;var e=j("process"),n=At(),c=x();async function d(){let t="%windir%\\System32\\REG.exe";if(e.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in e.env)t="%windir%\\sysnative\\cmd.exe /c "+t;try{let i=(await n.execAsync(`${t} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split("REG_SZ");if(i.length===2)return i[1].trim()}catch(r){c.diag.debug(`error reading machine id: ${r}`)}return}s.getMachineId=d});export default u();
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{I,e}from"./index-0qjbnyg4.js";import{existsSync as s,mkdirSync as p,readFileSync as f,renameSync as m,writeFileSync as u}from"fs";import{dirname as P,join as k}from"path";var q="prereqs-installed.json",y="prereqs-installed";function c(r){return k(r??I(),q)}function l(r){let n=c(r);if(!s(n))return[];try{let t=JSON.parse(f(n,"utf8"));if(!Array.isArray(t))return[];return t.filter((i)=>!!i&&typeof i==="object"&&typeof i.name==="string"&&typeof i.pluginPackageName==="string")}catch(t){return e().logger.warn(y,`Failed to read tracker at ${n}: ${t}`),[]}}function x(r,n){let t=c(n),i=P(t);if(!s(i))p(i,{recursive:!0});let o=`${t}.${process.pid}.tmp`;u(o,`${JSON.stringify(r,null,2)}
3
- `,{encoding:"utf8",mode:384}),m(o,t)}function hi(r,n){if(n.length===0)return;let i=l().filter((a)=>!(a.pluginPackageName===r&&n.some((g)=>g.name===a.name))),o=new Date().toISOString(),d=n.map((a)=>({name:a.name,kind:a.kind,installedAt:o,pluginPackageName:r}));x([...i,...d])}function fi(r){return l(r)}
4
- export{hi,fi};
2
+ import{I,e}from"./index-7wm4bqx5.js";import{existsSync as s,mkdirSync as p,readFileSync as f,renameSync as m,writeFileSync as u}from"fs";import{dirname as P,join as k}from"path";var q="prereqs-installed.json",y="prereqs-installed";function c(r){return k(r??I(),q)}function l(r){let n=c(r);if(!s(n))return[];try{let t=JSON.parse(f(n,"utf8"));if(!Array.isArray(t))return[];return t.filter((i)=>!!i&&typeof i==="object"&&typeof i.name==="string"&&typeof i.pluginPackageName==="string")}catch(t){return e().logger.warn(y,`Failed to read tracker at ${n}: ${t}`),[]}}function x(r,n){let t=c(n),i=P(t);if(!s(i))p(i,{recursive:!0});let o=`${t}.${process.pid}.tmp`;u(o,`${JSON.stringify(r,null,2)}
3
+ `,{encoding:"utf8",mode:384}),m(o,t)}function yi(r,n){if(n.length===0)return;let i=l().filter((a)=>!(a.pluginPackageName===r&&n.some((g)=>g.name===a.name))),o=new Date().toISOString(),d=n.map((a)=>({name:a.name,kind:a.kind,installedAt:o,pluginPackageName:r}));x([...i,...d])}function Si(r){return l(r)}
4
+ export{yi,Si};
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import{rt,Ct,$i,Fe,Yt,O,I,C}from"./index-0qjbnyg4.js";import{_e}from"./index-tts92sdm.js";import{b}from"./index-w4jqdhc2.js";import{existsSync as f,readdirSync as R,readFileSync as h,writeFileSync as m,mkdirSync as y,openSync as P,closeSync as w,unlinkSync as v}from"fs";import{join as l}from"path";import{tmpdir as k}from"os";import{spawn as A}from"child_process";class D{registryPath;logsDir;productDir;constructor(){let t=C();this.productDir=t,this.registryPath=l(t,"agents.json");let s=I();this.logsDir=l(s,"logs"),y(t,{recursive:!0}),y(s,{recursive:!0}),y(this.logsDir,{recursive:!0})}async startDaemon(t){return O(t.name),this.withInstanceLock(t.name,async()=>{let s=await this.findProcessByName(t.name);if(s&&s.status==="running"){let u=s.version,g=_e();if(u===g){console.log(`\u26A0\uFE0F Agent '${t.name}' is already running on port ${s.port}`);return}console.log(`\uD83D\uDD04 Agent '${t.name}' is running an older build (${u??"unknown"} \u2192 ${g}) \u2014 restarting to apply the update`);try{await this.stopInternal(t.name)}catch(d){console.log(`\u26A0\uFE0F Could not cleanly stop the stale daemon (${d instanceof Error?d.message:String(d)}); proceeding to start the new build`)}}let e=l(this.logsDir,`${t.name}.log`),n=P(e,"a"),i=l(import.meta.dir,"index.js"),r=l(import.meta.dir,"..","index.ts"),c=f(i)?i:r,a=A(process.execPath,["run",c],{detached:!0,windowsHide:!0,stdio:["ignore",n,n],env:{...process.env,VIBECONTROLS_PROFILE:t.profile||"default",PORT:t.port.toString(),DB_PATH:t.dbPath,NODE_ENV:"production",AGENT_LOG_FILE:e}});a.on("error",()=>{}),w(n),await new Promise((u)=>setTimeout(u,2000));let o=a.pid;if(!(o!==void 0&&await this.isProcessRunning(o))){let u="";try{u=h(e,"utf8").split(/\r?\n/).filter((S)=>S.trim()).slice(-25).join(`
2
+ import{ot,bt,Ji,Oe,Xt,O,I,C}from"./index-7wm4bqx5.js";import{Ae}from"./index-p1b10hs1.js";import{b}from"./index-w4jqdhc2.js";import{existsSync as f,readdirSync as R,readFileSync as h,writeFileSync as m,mkdirSync as y,openSync as P,closeSync as w,unlinkSync as v}from"fs";import{join as l}from"path";import{tmpdir as k}from"os";import{spawn as A}from"child_process";class D{registryPath;logsDir;productDir;constructor(){let t=C();this.productDir=t,this.registryPath=l(t,"agents.json");let s=I();this.logsDir=l(s,"logs"),y(t,{recursive:!0}),y(s,{recursive:!0}),y(this.logsDir,{recursive:!0})}async startDaemon(t){return O(t.name),this.withInstanceLock(t.name,async()=>{let s=await this.findProcessByName(t.name);if(s&&s.status==="running"){let u=s.version,g=Ae();if(u===g){console.log(`\u26A0\uFE0F Agent '${t.name}' is already running on port ${s.port}`);return}console.log(`\uD83D\uDD04 Agent '${t.name}' is running an older build (${u??"unknown"} \u2192 ${g}) \u2014 restarting to apply the update`);try{await this.stopInternal(t.name)}catch(d){console.log(`\u26A0\uFE0F Could not cleanly stop the stale daemon (${d instanceof Error?d.message:String(d)}); proceeding to start the new build`)}}let e=l(this.logsDir,`${t.name}.log`),n=P(e,"a"),i=l(import.meta.dir,"index.js"),r=l(import.meta.dir,"..","index.ts"),c=f(i)?i:r,a=A(process.execPath,["run",c],{detached:!0,windowsHide:!0,stdio:["ignore",n,n],env:{...process.env,VIBECONTROLS_PROFILE:t.profile||"default",PORT:t.port.toString(),DB_PATH:t.dbPath,NODE_ENV:"production",AGENT_LOG_FILE:e}});a.on("error",()=>{}),w(n),await new Promise((u)=>setTimeout(u,2000));let o=a.pid;if(!(o!==void 0&&await this.isProcessRunning(o))){let u="";try{u=h(e,"utf8").split(/\r?\n/).filter((S)=>S.trim()).slice(-25).join(`
3
3
  `)}catch{}let g=`See ${e}`;throw Error(u?`Failed to start agent '${t.name}'. ${g}
4
4
  --- last log lines ---
5
- ${u}`:`Failed to start agent '${t.name}'. ${g}`)}a.unref(),await this.saveProcessInfo(t.name,o,t),console.log(`\uD83D\uDE80 Agent '${t.name}' started (PID: ${o}, Port: ${t.port})`)})}async stop(t){return O(t),this.withInstanceLock(t,()=>this.stopInternal(t))}async stopInternal(t){let s=await this.findProcessByName(t);if(!s||s.status!=="running"){console.log(`\u26A0\uFE0F Agent '${t}' is not running`);return}try{if(process.kill(s.pid,"SIGTERM"),await new Promise((n)=>setTimeout(n,3000)),await this.isProcessRunning(s.pid))process.kill(s.pid,"SIGKILL");await this.updateProcessStatus(t,"stopped"),console.log(`\u2705 Agent '${t}' stopped (tunnel + API key preserved)`)}catch(e){throw Error(`Failed to stop agent '${t}': ${e}`,{cause:e})}}async restart(t,s){O(t),O(s.name);let e=await this.findProcessByName(t);if(e&&e.status==="running")await this.stop(t);await this.startDaemon(s),console.log(`\uD83D\uDD04 Agent '${t}' restarted (tunnel + API key preserved)`)}async kill(t){return O(t),this.withInstanceLock(t,async()=>{let s=await this.findProcessByName(t);if(!s||s.status!=="running"){console.log(`\u26A0\uFE0F Agent '${t}' is not running`);return}let e=l(k(),`.boff-vibecontrols-kill-${s.pid}`);try{await Bun.write(e,"kill")}catch{}try{process.kill(s.pid,"SIGTERM"),await new Promise((i)=>setTimeout(i,5000))}catch{}if(await this.isProcessRunning(s.pid))await this.killProcessTree(s.pid);await this.updateProcessStatus(t,"stopped"),console.log(`\uD83D\uDC80 Agent '${t}' killed (tunnel + state torn down)`)})}async getStatus(t){return O(t),this.findProcessByName(t)}discoverRuntimeInstances(){let t=l(this.productDir,"agents");if(!f(t))return[];let s;try{s=R(t,{withFileTypes:!0}).filter((n)=>n.isDirectory()).map((n)=>n.name)}catch{return[]}let e=[];for(let n of s){let i=l(t,n,"runtime.json");if(!f(i))continue;try{let r=JSON.parse(h(i,"utf8"));if(typeof r.pid!=="number"||typeof r.port!=="number")continue;let c=r.profile||n;try{O(c)}catch{continue}e.push({name:c,pid:r.pid,port:r.port,config:{name:c,port:r.port,daemon:!0,dbPath:l(t,n,"agent-db"),host:r.host,profile:c},startTime:r.startedAt??new Date(0).toISOString(),status:"unknown",version:r.version})}catch{}}return e}async getStatusAll(){let t=this.loadRegistry(),s=new Set(t.map((r)=>r.name)),e=[...t];for(let r of this.discoverRuntimeInstances())if(!s.has(r.name))e.push(r);let n=[];for(let r of e){let c=await this.isManagedProcessRunning(r);if(!s.has(r.name)&&!c)continue;n.push({...r,status:c?"running":"stopped"})}let i=n.filter((r)=>r.status==="running"&&!s.has(r.name));if(i.length>0)try{await rt(()=>{let r=this.loadRegistry(),c=new Set(r.map((o)=>o.name)),a=i.filter((o)=>!c.has(o.name));if(a.length>0)this.saveRegistry([...r,...a.map((o)=>({...o,status:"running"}))])})}catch{}return n}async listInstances(){return this.getStatusAll()}getDefaultProfile(){return Fe()}setDefaultProfile(t){Yt(O(t))}async showLogs(t,s){O(t);let e=l(this.logsDir,`${t}.log`);if(!f(e)){console.log(`No logs found for agent '${t}'`);return}if(s.follow)try{let n=async(o)=>{let p=await Bun.file(e).text(),g=p.split(`
5
+ ${u}`:`Failed to start agent '${t.name}'. ${g}`)}a.unref(),await this.saveProcessInfo(t.name,o,t),console.log(`\uD83D\uDE80 Agent '${t.name}' started (PID: ${o}, Port: ${t.port})`)})}async stop(t){return O(t),this.withInstanceLock(t,()=>this.stopInternal(t))}async stopInternal(t){let s=await this.findProcessByName(t);if(!s||s.status!=="running"){console.log(`\u26A0\uFE0F Agent '${t}' is not running`);return}try{if(process.kill(s.pid,"SIGTERM"),await new Promise((n)=>setTimeout(n,3000)),await this.isProcessRunning(s.pid))process.kill(s.pid,"SIGKILL");await this.updateProcessStatus(t,"stopped"),console.log(`\u2705 Agent '${t}' stopped (tunnel + API key preserved)`)}catch(e){throw Error(`Failed to stop agent '${t}': ${e}`,{cause:e})}}async restart(t,s){O(t),O(s.name);let e=await this.findProcessByName(t);if(e&&e.status==="running")await this.stop(t);await this.startDaemon(s),console.log(`\uD83D\uDD04 Agent '${t}' restarted (tunnel + API key preserved)`)}async kill(t){return O(t),this.withInstanceLock(t,async()=>{let s=await this.findProcessByName(t);if(!s||s.status!=="running"){console.log(`\u26A0\uFE0F Agent '${t}' is not running`);return}let e=l(k(),`.boff-vibecontrols-kill-${s.pid}`);try{await Bun.write(e,"kill")}catch{}try{process.kill(s.pid,"SIGTERM"),await new Promise((i)=>setTimeout(i,5000))}catch{}if(await this.isProcessRunning(s.pid))await this.killProcessTree(s.pid);await this.updateProcessStatus(t,"stopped"),console.log(`\uD83D\uDC80 Agent '${t}' killed (tunnel + state torn down)`)})}async getStatus(t){return O(t),this.findProcessByName(t)}discoverRuntimeInstances(){let t=l(this.productDir,"agents");if(!f(t))return[];let s;try{s=R(t,{withFileTypes:!0}).filter((n)=>n.isDirectory()).map((n)=>n.name)}catch{return[]}let e=[];for(let n of s){let i=l(t,n,"runtime.json");if(!f(i))continue;try{let r=JSON.parse(h(i,"utf8"));if(typeof r.pid!=="number"||typeof r.port!=="number")continue;let c=r.profile||n;try{O(c)}catch{continue}e.push({name:c,pid:r.pid,port:r.port,config:{name:c,port:r.port,daemon:!0,dbPath:l(t,n,"agent-db"),host:r.host,profile:c},startTime:r.startedAt??new Date(0).toISOString(),status:"unknown",version:r.version})}catch{}}return e}async getStatusAll(){let t=this.loadRegistry(),s=new Set(t.map((r)=>r.name)),e=[...t];for(let r of this.discoverRuntimeInstances())if(!s.has(r.name))e.push(r);let n=[];for(let r of e){let c=await this.isManagedProcessRunning(r);if(!s.has(r.name)&&!c)continue;n.push({...r,status:c?"running":"stopped"})}let i=n.filter((r)=>r.status==="running"&&!s.has(r.name));if(i.length>0)try{await ot(()=>{let r=this.loadRegistry(),c=new Set(r.map((o)=>o.name)),a=i.filter((o)=>!c.has(o.name));if(a.length>0)this.saveRegistry([...r,...a.map((o)=>({...o,status:"running"}))])})}catch{}return n}async listInstances(){return this.getStatusAll()}getDefaultProfile(){return Oe()}setDefaultProfile(t){Xt(O(t))}async showLogs(t,s){O(t);let e=l(this.logsDir,`${t}.log`);if(!f(e)){console.log(`No logs found for agent '${t}'`);return}if(s.follow)try{let n=async(o)=>{let p=await Bun.file(e).text(),g=p.split(`
6
6
  `).slice(-s.tail).join(`
7
7
  `);if(process.stdout.write(o?g:g),o&&!g.endsWith(`
8
8
  `))process.stdout.write(`
9
9
  `);return p.length},i=await n(!0),r=!1,c=setInterval(async()=>{if(r)return;try{let o=await import("fs"),p=o.statSync(e);if(p.size>i){let u=o.openSync(e,"r"),g=p.size-i,d=Buffer.alloc(g);o.readSync(u,d,0,g,i),o.closeSync(u),process.stdout.write(d),i=p.size}else if(p.size<i)i=await n(!1)}catch{}},500),a=()=>{if(r)return;r=!0,clearInterval(c)};process.on("SIGINT",()=>{a(),process.exit(0)}),process.on("SIGTERM",()=>{a(),process.exit(0)}),process.on("SIGHUP",()=>{a(),process.exit(0)}),process.on("exit",a)}catch(n){console.error("Failed to follow logs:",n)}else try{let r=(await Bun.file(e).text()).split(`
10
10
  `).slice(-s.tail).join(`
11
- `);console.log(r)}catch(n){console.error("Failed to read logs:",n)}}async checkHealth(t){let s=await this.findProcessByName(t);if(!s||s.status!=="running")return{healthy:!1,details:{error:"Process not running"}};try{let e=await fetch(`http://localhost:${s.port}/health`),n=await e.json();return{healthy:e.ok,details:n}}catch(e){return{healthy:!1,details:{error:"Health check failed",message:e.message}}}}async setConfig(t,s){let e=l(C(),"config.json"),n={};if(f(e))n=JSON.parse(h(e,"utf8"));n[t]=s,m(e,JSON.stringify(n,null,2))}async getConfig(t){let s=l(C(),"config.json");if(!f(s))return t?void 0:{};let e=JSON.parse(h(s,"utf8"));return t?e[t]:e}loadRegistry(){return Ct()}saveRegistry(t){$i(t)}async withInstanceLock(t,s){let e=O(t),n=l(this.productDir,`.agent-${e}.lock`),i;try{i=P(n,"wx",384),m(i,`${process.pid}
12
- `)}catch(r){if(r.code==="EEXIST"){let a=parseInt(h(n,"utf8"),10);if(!a||!await this.isProcessRunning(a)){try{v(n)}catch{}return this.withInstanceLock(t,s)}throw Error(`Agent '${t}' is already being modified`,{cause:r})}throw r}try{return await s()}finally{try{w(i)}catch{}try{v(n)}catch{}}}async saveProcessInfo(t,s,e){await rt(()=>{let i=this.loadRegistry().filter((r)=>r.name!==t);i.push({name:t,pid:s,port:e.port,config:e,startTime:new Date().toISOString(),status:"running"}),this.saveRegistry(i)})}async updateProcessStatus(t,s){await rt(()=>{let e=this.loadRegistry(),n=e.find((i)=>i.name===t);if(n)n.status=s,this.saveRegistry(e)})}async findProcessByName(t){O(t);let e=this.loadRegistry().find((i)=>i.name===t);if(!e)return null;let n=await this.isManagedProcessRunning(e);return e.status=n?"running":"stopped",e}async isManagedProcessRunning(t){if(!await this.isProcessRunning(t.pid))return!1;try{return(await fetch(`http://127.0.0.1:${t.port}/health/live`,{signal:AbortSignal.timeout(1000)})).ok}catch{return!1}}async isProcessRunning(t){try{return process.kill(t,0),!0}catch{return!1}}killProcessTree(t){try{b().killProcessTree(t,"SIGKILL")}catch{}}}
11
+ `);console.log(r)}catch(n){console.error("Failed to read logs:",n)}}async checkHealth(t){let s=await this.findProcessByName(t);if(!s||s.status!=="running")return{healthy:!1,details:{error:"Process not running"}};try{let e=await fetch(`http://localhost:${s.port}/health`),n=await e.json();return{healthy:e.ok,details:n}}catch(e){return{healthy:!1,details:{error:"Health check failed",message:e.message}}}}async setConfig(t,s){let e=l(C(),"config.json"),n={};if(f(e))n=JSON.parse(h(e,"utf8"));n[t]=s,m(e,JSON.stringify(n,null,2))}async getConfig(t){let s=l(C(),"config.json");if(!f(s))return t?void 0:{};let e=JSON.parse(h(s,"utf8"));return t?e[t]:e}loadRegistry(){return bt()}saveRegistry(t){Ji(t)}async withInstanceLock(t,s){let e=O(t),n=l(this.productDir,`.agent-${e}.lock`),i;try{i=P(n,"wx",384),m(i,`${process.pid}
12
+ `)}catch(r){if(r.code==="EEXIST"){let a=parseInt(h(n,"utf8"),10);if(!a||!await this.isProcessRunning(a)){try{v(n)}catch{}return this.withInstanceLock(t,s)}throw Error(`Agent '${t}' is already being modified`,{cause:r})}throw r}try{return await s()}finally{try{w(i)}catch{}try{v(n)}catch{}}}async saveProcessInfo(t,s,e){await ot(()=>{let i=this.loadRegistry().filter((r)=>r.name!==t);i.push({name:t,pid:s,port:e.port,config:e,startTime:new Date().toISOString(),status:"running"}),this.saveRegistry(i)})}async updateProcessStatus(t,s){await ot(()=>{let e=this.loadRegistry(),n=e.find((i)=>i.name===t);if(n)n.status=s,this.saveRegistry(e)})}async findProcessByName(t){O(t);let e=this.loadRegistry().find((i)=>i.name===t);if(!e)return null;let n=await this.isManagedProcessRunning(e);return e.status=n?"running":"stopped",e}async isManagedProcessRunning(t){if(!await this.isProcessRunning(t.pid))return!1;try{return(await fetch(`http://127.0.0.1:${t.port}/health/live`,{signal:AbortSignal.timeout(1000)})).ok}catch{return!1}}async isProcessRunning(t){try{return process.kill(t,0),!0}catch{return!1}}killProcessTree(t){try{b().killProcessTree(t,"SIGKILL")}catch{}}}
13
13
  export{D};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var T=!process.env.NO_COLOR&&!!process.stdout.isTTY;function vi(e){T=e}var r=(e,t)=>(a)=>T?`${e}${a}${t}`:a,i={bold:r("\x1B[1m","\x1B[22m"),dim:r("\x1B[2m","\x1B[22m"),italic:r("\x1B[3m","\x1B[23m"),underline:r("\x1B[4m","\x1B[24m"),red:r("\x1B[31m","\x1B[39m"),green:r("\x1B[32m","\x1B[39m"),yellow:r("\x1B[33m","\x1B[39m"),blue:r("\x1B[34m","\x1B[39m"),magenta:r("\x1B[35m","\x1B[39m"),cyan:r("\x1B[36m","\x1B[39m"),white:r("\x1B[37m","\x1B[39m"),gray:r("\x1B[90m","\x1B[39m"),brightRed:r("\x1B[91m","\x1B[39m"),brightGreen:r("\x1B[92m","\x1B[39m"),brightYellow:r("\x1B[93m","\x1B[39m"),brightBlue:r("\x1B[94m","\x1B[39m"),reset:"\x1B[0m"},d={get success(){return i.green("\u2713")},get error(){return i.red("\u2717")},get warning(){return i.yellow("\u26A0")},get info(){return i.blue("\u25CF")},get running(){return i.green("\u25CF")},get stopped(){return i.red("\u25CB")},get pending(){return i.yellow("\u25CC")},get arrow(){return i.gray("\u2192")},get bullet(){return i.gray("\u2022")},get check(){return i.green("\u2714")}};function s(e){console.error(`${i.red("Error:")} ${e}`),process.exit(1)}function A(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function l(e){console.log(` ${d.success} ${e}`)}function p(e){console.log(` ${d.warning} ${e}`)}function o(e){console.log(` ${d.info} ${e}`)}function g(e){console.log(`
2
+ var T=!process.env.NO_COLOR&&!!process.stdout.isTTY;function Gi(e){T=e}var r=(e,t)=>(a)=>T?`${e}${a}${t}`:a,i={bold:r("\x1B[1m","\x1B[22m"),dim:r("\x1B[2m","\x1B[22m"),italic:r("\x1B[3m","\x1B[23m"),underline:r("\x1B[4m","\x1B[24m"),red:r("\x1B[31m","\x1B[39m"),green:r("\x1B[32m","\x1B[39m"),yellow:r("\x1B[33m","\x1B[39m"),blue:r("\x1B[34m","\x1B[39m"),magenta:r("\x1B[35m","\x1B[39m"),cyan:r("\x1B[36m","\x1B[39m"),white:r("\x1B[37m","\x1B[39m"),gray:r("\x1B[90m","\x1B[39m"),brightRed:r("\x1B[91m","\x1B[39m"),brightGreen:r("\x1B[92m","\x1B[39m"),brightYellow:r("\x1B[93m","\x1B[39m"),brightBlue:r("\x1B[94m","\x1B[39m"),reset:"\x1B[0m"},d={get success(){return i.green("\u2713")},get error(){return i.red("\u2717")},get warning(){return i.yellow("\u26A0")},get info(){return i.blue("\u25CF")},get running(){return i.green("\u25CF")},get stopped(){return i.red("\u25CB")},get pending(){return i.yellow("\u25CC")},get arrow(){return i.gray("\u2192")},get bullet(){return i.gray("\u2022")},get check(){return i.green("\u2714")}};function s(e){console.error(`${i.red("Error:")} ${e}`),process.exit(1)}function A(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function l(e){console.log(` ${d.success} ${e}`)}function p(e){console.log(` ${d.warning} ${e}`)}function o(e){console.log(` ${d.info} ${e}`)}function g(e){console.log(`
3
3
  ${i.bold(`\u2500\u2500 ${e} \u2500\u2500`)}
4
- `)}function n(e,t){let a=t===null||t===void 0?i.gray("(none)"):String(t);console.log(` ${i.bold(e.padEnd(14))} ${a}`)}function c(){console.log()}function F(e){if(e.length===0){console.log(" (none)");return}console.table(e)}function v(e){let t=Date.now()-new Date(e).getTime(),a=Math.floor(t/1000);if(a<0)return"just now";if(a<60)return`${a}s ago`;let b=Math.floor(a/60);if(b<60)return`${b}m ago`;let m=Math.floor(b/60);if(m<24)return`${m}h ago`;let h=Math.floor(m/24);if(h<30)return`${h}d ago`;return`${Math.floor(h/30)}mo ago`}function Gr(e){if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),a=Math.floor(e%60);if(t<60)return`${t}m ${a}s`;let b=Math.floor(t/60),m=t%60;return`${b}h ${m}m`}function Qe(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function G(e){switch(e){case"running":case"active":case"healthy":case"success":case"completed":return i.green(e);case"stopped":case"inactive":case"terminated":case"failed":return i.red(e);case"starting":case"stopping":case"pending":case"warning":return i.yellow(e);case"error":return i.red(e);default:return e}}function H(e,t=10){if(e.length<=t)return e;return e.substring(0,t)+"..."}async function Ut(e,t=15000){let a=Date.now(),b=!1;while(Date.now()-a<t){try{if((await fetch(`${e}/health`)).ok){b=!0;break}}catch{}await new Promise((u)=>setTimeout(u,500))}if(!b){console.log(`
4
+ `)}function n(e,t){let a=t===null||t===void 0?i.gray("(none)"):String(t);console.log(` ${i.bold(e.padEnd(14))} ${a}`)}function c(){console.log()}function F(e){if(e.length===0){console.log(" (none)");return}console.table(e)}function v(e){let t=Date.now()-new Date(e).getTime(),a=Math.floor(t/1000);if(a<0)return"just now";if(a<60)return`${a}s ago`;let b=Math.floor(a/60);if(b<60)return`${b}m ago`;let m=Math.floor(b/60);if(m<24)return`${m}h ago`;let h=Math.floor(m/24);if(h<30)return`${h}d ago`;return`${Math.floor(h/30)}mo ago`}function Jr(e){if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),a=Math.floor(e%60);if(t<60)return`${t}m ${a}s`;let b=Math.floor(t/60),m=t%60;return`${b}h ${m}m`}function Ge(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function G(e){switch(e){case"running":case"active":case"healthy":case"success":case"completed":return i.green(e);case"stopped":case"inactive":case"terminated":case"failed":return i.red(e);case"starting":case"stopping":case"pending":case"warning":return i.yellow(e);case"error":return i.red(e);default:return e}}function H(e,t=10){if(e.length<=t)return e;return e.substring(0,t)+"..."}async function Gt(e,t=15000){let a=Date.now(),b=!1;while(Date.now()-a<t){try{if((await fetch(`${e}/health`)).ok){b=!0;break}}catch{}await new Promise((u)=>setTimeout(u,500))}if(!b){console.log(`
5
5
  ${d.warning} Agent not yet responding at ${e}. Check ${i.bold("vibe logs")} for details.
6
- `);return}let m=process.env.VIBECONTROLS_PROFILE||"default",h=`${e}/api/profiles/${encodeURIComponent(m)}/agent/tunnel`,w="(unavailable)";try{let{resolveDefaultApiKey:u}=await import("./key.cmd-f6rjvjy8.js"),f=await u();if(f)w=f}catch{}let k=w&&w!=="(unavailable)"?{"x-agent-api-key":w}:{},x="(not running)",M=!1;try{let u=await fetch(h,{headers:k});if(u.ok){let f=await u.json();if(f.tunnelUrl)x=f.tunnelUrl;else if(f.status!=="inactive")M=!0}}catch{}if(M||x==="(not running)"){process.stdout.write(` ${d.info} Provisioning tunnel (first run downloads the tunnel binary)\u2026`);let u=150000,f=Date.now();while(Date.now()-f<u){try{let y=await fetch(h,{headers:k});if(y.ok){let R=await y.json();if(R.tunnelUrl){x=R.tunnelUrl;break}}}catch{}await new Promise((y)=>setTimeout(y,1500)),process.stdout.write(`\r ${d.info} Provisioning tunnel (first run downloads the tunnel binary)\u2026 ${Math.round((Date.now()-f)/1000)}s`)}process.stdout.write(`
6
+ `);return}let m=process.env.VIBECONTROLS_PROFILE||"default",h=`${e}/api/profiles/${encodeURIComponent(m)}/agent/tunnel`,w="(unavailable)";try{let{resolveDefaultApiKey:u}=await import("./key.cmd-y415ngam.js"),f=await u();if(f)w=f}catch{}let k=w&&w!=="(unavailable)"?{"x-agent-api-key":w}:{},x="(not running)",M=!1;try{let u=await fetch(h,{headers:k});if(u.ok){let f=await u.json();if(f.tunnelUrl)x=f.tunnelUrl;else if(f.status!=="inactive")M=!0}}catch{}if(M||x==="(not running)"){process.stdout.write(` ${d.info} Provisioning tunnel (first run downloads the tunnel binary)\u2026`);let u=150000,f=Date.now();while(Date.now()-f<u){try{let y=await fetch(h,{headers:k});if(y.ok){let R=await y.json();if(R.tunnelUrl){x=R.tunnelUrl;break}}}catch{}await new Promise((y)=>setTimeout(y,1500)),process.stdout.write(`\r ${d.info} Provisioning tunnel (first run downloads the tunnel binary)\u2026 ${Math.round((Date.now()-f)/1000)}s`)}process.stdout.write(`
7
7
  `)}if(g("Agent Connection Details"),n("Agent URL:",e),n("API Key:",w),n("Tunnel URL:",x==="(not running)"?i.yellow(x):i.green(x)),c(),console.log(" Copy the API Key and Tunnel URL into the VibeControls UI agent configuration."),x==="(not running)")console.log(` ${i.yellow("Tunnel still provisioning")} \u2014 the cloudflared download may still be running in the daemon.`),console.log(` Re-check shortly: ${i.bold("vibe url")}`),console.log(` Start it manually: ${i.bold(`vibe tunnel agent --start --agent-url ${e}`)}`),console.log(` If it never appears: ${i.bold("vibe logs --tail 80")} (look for 'tunnel-bootstrap' / 'install')`);c()}
8
- export{vi,i,d,s,A,l,p,o,g,n,c,F,v,Gr,Qe,G,H,Ut};
8
+ export{Gi,i,d,s,A,l,p,o,g,n,c,F,v,Jr,Ge,G,H,Gt};