@burdenoff/vibe-agent 2.6.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -126,14 +126,14 @@ vibe plugin create my-plugin --tag provider # Set plugin tag
126
126
 
127
127
  **Available Plugins:**
128
128
 
129
- | Plugin | Description |
130
- | ------------------------------------------ | -------------------------------------------------------- |
131
- | `@burdenoff/vibe-plugin-ssh` | SSH connections & port forwarding |
132
- | `@burdenoff/vibe-plugin-ai` | AI tool detection & prompt management (SQLite + REST) |
133
- | `@burdenoff/vibe-plugin-session-tmux` | tmux-based session provider |
134
- | `@burdenoff/vibe-plugin-tunnel-cloudflare` | Cloudflare tunnel provider |
135
- | `@burdenoff/vibe-plugin-ui-ssh` | Web UI for SSH management |
136
- | `@burdenoff/vibe-plugin-ui-ai` | Web UI for AI tools & prompt templates |
129
+ | Plugin | Description |
130
+ | ------------------------------------------ | ----------------------------------------------------- |
131
+ | `@burdenoff/vibe-plugin-ssh` | SSH connections & port forwarding |
132
+ | `@burdenoff/vibe-plugin-ai` | AI tool detection & prompt management (SQLite + REST) |
133
+ | `@burdenoff/vibe-plugin-session-tmux` | tmux-based session provider |
134
+ | `@burdenoff/vibe-plugin-tunnel-cloudflare` | Cloudflare tunnel provider |
135
+ | `@burdenoff/vibe-plugin-ui-ssh` | Web UI for SSH management |
136
+ | `@burdenoff/vibe-plugin-ui-ai` | Web UI for AI tools & prompt templates |
137
137
 
138
138
  ### Tunnel Management
139
139
 
@@ -17,7 +17,7 @@ import {
17
17
  } from "./index-g8dczzvv.js";
18
18
  import {
19
19
  PluginManager
20
- } from "./plugin-system-x4tbwzyq.js";
20
+ } from "./plugin-system-w2727db6.js";
21
21
 
22
22
  // node_modules/@elysiajs/cors/dist/index.mjs
23
23
  var isBun = typeof new Headers()?.toJSON === "function";
@@ -1162,4 +1162,4 @@ async function getPackageVersion() {
1162
1162
  export { createApp };
1163
1163
 
1164
1164
  //# debugId=09014DBE5BA56E4964756E2164756E21
1165
- //# sourceMappingURL=app-6d1xq46v.js.map
1165
+ //# sourceMappingURL=app-7xd13pn3.js.map
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  ServiceManager,
8
8
  checkDependencies,
9
9
  installDependencies
10
- } from "./index-s7ff1fj1.js";
10
+ } from "./index-f6296kqk.js";
11
11
  import {
12
12
  logger
13
13
  } from "./index-88ym10cs.js";
@@ -33,7 +33,7 @@ import {
33
33
  } from "./index-g8dczzvv.js";
34
34
  import {
35
35
  PluginManager
36
- } from "./plugin-system-x4tbwzyq.js";
36
+ } from "./plugin-system-w2727db6.js";
37
37
 
38
38
  // node_modules/commander/lib/error.js
39
39
  var require_error = __commonJS((exports) => {
@@ -2145,7 +2145,7 @@ var {
2145
2145
  } = import__.default;
2146
2146
 
2147
2147
  // src/cli.ts
2148
- import { join as join3 } from "path";
2148
+ import { join as join4 } from "path";
2149
2149
 
2150
2150
  // src/cli/commands/start.cmd.ts
2151
2151
  import { existsSync } from "fs";
@@ -2228,7 +2228,7 @@ function register(program2) {
2228
2228
  kv("Host", host);
2229
2229
  kv("Database", dbPath);
2230
2230
  blank();
2231
- const { createApp } = await import("./app-6d1xq46v.js");
2231
+ const { createApp } = await import("./app-7xd13pn3.js");
2232
2232
  const appInstance = await createApp({
2233
2233
  port,
2234
2234
  host,
@@ -2502,7 +2502,7 @@ function register8(program2) {
2502
2502
  blank();
2503
2503
  let currentVersion;
2504
2504
  try {
2505
- const pkg = await import("./package-4andgzzt.js", {
2505
+ const pkg = await import("./package-a1mt704j.js", {
2506
2506
  with: { type: "json" }
2507
2507
  });
2508
2508
  currentVersion = pkg.default.version || pkg.version;
@@ -2847,6 +2847,311 @@ function register9(program2) {
2847
2847
  });
2848
2848
  }
2849
2849
 
2850
+ // src/cli/commands/autostart.cmd.ts
2851
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2 } from "fs";
2852
+ import { join as join3 } from "path";
2853
+ import { homedir as homedir3, platform } from "os";
2854
+ function getConfigDir() {
2855
+ return join3(homedir3(), ".vibecontrols");
2856
+ }
2857
+ function getLogsDir() {
2858
+ return join3(getConfigDir(), "logs");
2859
+ }
2860
+ function resolveBunPath() {
2861
+ if (process.execPath && process.execPath.includes("bun")) {
2862
+ return process.execPath;
2863
+ }
2864
+ const result = Bun.spawnSync(["which", "bun"]);
2865
+ const path = result.stdout.toString().trim();
2866
+ if (path)
2867
+ return path;
2868
+ throw new Error("Could not find bun binary. Ensure bun is installed and in PATH.");
2869
+ }
2870
+ function resolveAgentEntryPoint() {
2871
+ const isDist = import.meta.dir.endsWith("/dist") || import.meta.dir.includes("/dist/");
2872
+ return isDist ? join3(import.meta.dir, "index.js") : join3(import.meta.dir, "..", "..", "index.ts");
2873
+ }
2874
+ function getSystemdUnitPath(name) {
2875
+ const dir = join3(homedir3(), ".config", "systemd", "user");
2876
+ mkdirSync2(dir, { recursive: true });
2877
+ return join3(dir, `vibecontrols-agent-${name}.service`);
2878
+ }
2879
+ function generateSystemdUnit(opts) {
2880
+ return `[Unit]
2881
+ Description=VibeControls Agent (${opts.name})
2882
+ After=network.target
2883
+
2884
+ [Service]
2885
+ Type=simple
2886
+ ExecStart=${opts.bunPath} run ${opts.entryPoint}
2887
+ Environment=PORT=${opts.port}
2888
+ Environment=DB_PATH=${opts.dbPath}
2889
+ Environment=NODE_ENV=production
2890
+ Environment=HOME=${homedir3()}
2891
+ Environment=PATH=${process.env.PATH}
2892
+ WorkingDirectory=${homedir3()}
2893
+ Restart=always
2894
+ RestartSec=5
2895
+ StandardOutput=append:${opts.logFile}
2896
+ StandardError=append:${opts.logFile}
2897
+
2898
+ [Install]
2899
+ WantedBy=default.target
2900
+ `;
2901
+ }
2902
+ async function installSystemd(name, port, dbPath) {
2903
+ const bunPath = resolveBunPath();
2904
+ const entryPoint = resolveAgentEntryPoint();
2905
+ const logFile = join3(getLogsDir(), `${name}.log`);
2906
+ const unitPath = getSystemdUnitPath(name);
2907
+ const serviceName = `vibecontrols-agent-${name}.service`;
2908
+ mkdirSync2(getLogsDir(), { recursive: true });
2909
+ const unit = generateSystemdUnit({
2910
+ name,
2911
+ port,
2912
+ dbPath,
2913
+ bunPath,
2914
+ entryPoint,
2915
+ logFile
2916
+ });
2917
+ writeFileSync2(unitPath, unit);
2918
+ info(`Wrote systemd unit: ${unitPath}`);
2919
+ const cmds = [
2920
+ ["systemctl", "--user", "daemon-reload"],
2921
+ ["systemctl", "--user", "enable", serviceName],
2922
+ ["systemctl", "--user", "start", serviceName]
2923
+ ];
2924
+ for (const cmd of cmds) {
2925
+ const result = Bun.spawnSync(cmd);
2926
+ if (result.exitCode !== 0) {
2927
+ const stderr = result.stderr.toString().trim();
2928
+ warn(`Command failed: ${cmd.join(" ")}${stderr ? ` \u2014 ${stderr}` : ""}`);
2929
+ }
2930
+ }
2931
+ const lingerResult = Bun.spawnSync([
2932
+ "loginctl",
2933
+ "enable-linger",
2934
+ process.env.USER || ""
2935
+ ]);
2936
+ if (lingerResult.exitCode === 0) {
2937
+ info("Enabled user linger (service survives logout)");
2938
+ }
2939
+ success(`Autostart installed for agent '${name}' on port ${port}`);
2940
+ kv("Service", serviceName);
2941
+ kv("Unit file", unitPath);
2942
+ kv("Log file", logFile);
2943
+ blank();
2944
+ info(`Check status: systemctl --user status ${serviceName}`);
2945
+ }
2946
+ async function uninstallSystemd(name) {
2947
+ const serviceName = `vibecontrols-agent-${name}.service`;
2948
+ const unitPath = getSystemdUnitPath(name);
2949
+ const cmds = [
2950
+ ["systemctl", "--user", "stop", serviceName],
2951
+ ["systemctl", "--user", "disable", serviceName]
2952
+ ];
2953
+ for (const cmd of cmds) {
2954
+ Bun.spawnSync(cmd);
2955
+ }
2956
+ if (existsSync3(unitPath)) {
2957
+ unlinkSync2(unitPath);
2958
+ info(`Removed unit file: ${unitPath}`);
2959
+ }
2960
+ Bun.spawnSync(["systemctl", "--user", "daemon-reload"]);
2961
+ success(`Autostart removed for agent '${name}'`);
2962
+ }
2963
+ async function statusSystemd(name) {
2964
+ const serviceName = `vibecontrols-agent-${name}.service`;
2965
+ const unitPath = getSystemdUnitPath(name);
2966
+ if (!existsSync3(unitPath)) {
2967
+ info(`Autostart is NOT configured for agent '${name}'`);
2968
+ kv("Expected unit", unitPath);
2969
+ return;
2970
+ }
2971
+ header(`Autostart Status \u2014 ${name}`);
2972
+ kv("Unit file", unitPath);
2973
+ kv("Service", serviceName);
2974
+ blank();
2975
+ const result = Bun.spawnSync(["systemctl", "--user", "status", serviceName]);
2976
+ const output = result.stdout.toString().trim();
2977
+ if (output) {
2978
+ console.log(output);
2979
+ } else {
2980
+ info("Service status unavailable");
2981
+ }
2982
+ }
2983
+ function getLaunchdPlistPath(name) {
2984
+ const dir = join3(homedir3(), "Library", "LaunchAgents");
2985
+ mkdirSync2(dir, { recursive: true });
2986
+ return join3(dir, `com.vibecontrols.agent.${name}.plist`);
2987
+ }
2988
+ function generateLaunchdPlist(opts) {
2989
+ return `<?xml version="1.0" encoding="UTF-8"?>
2990
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2991
+ <plist version="1.0">
2992
+ <dict>
2993
+ <key>Label</key>
2994
+ <string>com.vibecontrols.agent.${opts.name}</string>
2995
+ <key>ProgramArguments</key>
2996
+ <array>
2997
+ <string>${opts.bunPath}</string>
2998
+ <string>run</string>
2999
+ <string>${opts.entryPoint}</string>
3000
+ </array>
3001
+ <key>EnvironmentVariables</key>
3002
+ <dict>
3003
+ <key>PORT</key>
3004
+ <string>${opts.port}</string>
3005
+ <key>DB_PATH</key>
3006
+ <string>${opts.dbPath}</string>
3007
+ <key>NODE_ENV</key>
3008
+ <string>production</string>
3009
+ <key>HOME</key>
3010
+ <string>${homedir3()}</string>
3011
+ <key>PATH</key>
3012
+ <string>${process.env.PATH}</string>
3013
+ </dict>
3014
+ <key>WorkingDirectory</key>
3015
+ <string>${homedir3()}</string>
3016
+ <key>RunAtLoad</key>
3017
+ <true/>
3018
+ <key>KeepAlive</key>
3019
+ <dict>
3020
+ <key>SuccessfulExit</key>
3021
+ <false/>
3022
+ </dict>
3023
+ <key>StandardOutPath</key>
3024
+ <string>${opts.logFile}</string>
3025
+ <key>StandardErrorPath</key>
3026
+ <string>${opts.logFile}</string>
3027
+ <key>ProcessType</key>
3028
+ <string>Background</string>
3029
+ </dict>
3030
+ </plist>
3031
+ `;
3032
+ }
3033
+ async function installLaunchd(name, port, dbPath) {
3034
+ const bunPath = resolveBunPath();
3035
+ const entryPoint = resolveAgentEntryPoint();
3036
+ const logFile = join3(getLogsDir(), `${name}.log`);
3037
+ const plistPath = getLaunchdPlistPath(name);
3038
+ mkdirSync2(getLogsDir(), { recursive: true });
3039
+ const plist = generateLaunchdPlist({
3040
+ name,
3041
+ port,
3042
+ dbPath,
3043
+ bunPath,
3044
+ entryPoint,
3045
+ logFile
3046
+ });
3047
+ writeFileSync2(plistPath, plist);
3048
+ info(`Wrote launchd plist: ${plistPath}`);
3049
+ const result = Bun.spawnSync(["launchctl", "load", plistPath]);
3050
+ if (result.exitCode !== 0) {
3051
+ const stderr = result.stderr.toString().trim();
3052
+ warn(`launchctl load failed: ${stderr}`);
3053
+ info("Trying bootstrap method...");
3054
+ const uid = Bun.spawnSync(["id", "-u"]).stdout.toString().trim();
3055
+ Bun.spawnSync(["launchctl", "bootstrap", `gui/${uid}`, plistPath]);
3056
+ }
3057
+ success(`Autostart installed for agent '${name}' on port ${port}`);
3058
+ kv("Plist", plistPath);
3059
+ kv("Log file", logFile);
3060
+ }
3061
+ async function uninstallLaunchd(name) {
3062
+ const plistPath = getLaunchdPlistPath(name);
3063
+ const label = `com.vibecontrols.agent.${name}`;
3064
+ Bun.spawnSync(["launchctl", "unload", plistPath]);
3065
+ const uid = Bun.spawnSync(["id", "-u"]).stdout.toString().trim();
3066
+ Bun.spawnSync(["launchctl", "bootout", `gui/${uid}/${label}`]);
3067
+ if (existsSync3(plistPath)) {
3068
+ unlinkSync2(plistPath);
3069
+ info(`Removed plist: ${plistPath}`);
3070
+ }
3071
+ success(`Autostart removed for agent '${name}'`);
3072
+ }
3073
+ async function statusLaunchd(name) {
3074
+ const plistPath = getLaunchdPlistPath(name);
3075
+ const label = `com.vibecontrols.agent.${name}`;
3076
+ if (!existsSync3(plistPath)) {
3077
+ info(`Autostart is NOT configured for agent '${name}'`);
3078
+ kv("Expected plist", plistPath);
3079
+ return;
3080
+ }
3081
+ header(`Autostart Status \u2014 ${name}`);
3082
+ kv("Plist", plistPath);
3083
+ kv("Label", label);
3084
+ blank();
3085
+ const result = Bun.spawnSync(["launchctl", "list"]);
3086
+ const output = result.stdout.toString();
3087
+ const lines = output.split(`
3088
+ `).filter((l) => l.includes("vibecontrols"));
3089
+ if (lines.length > 0) {
3090
+ console.log(lines.join(`
3091
+ `));
3092
+ } else {
3093
+ info("Service not currently loaded");
3094
+ }
3095
+ }
3096
+ function register10(program2) {
3097
+ const autostart = program2.command("autostart").description("Configure agent to auto-start on system boot");
3098
+ autostart.command("install").description("Generate and enable system service for auto-start on reboot").option("-n, --name <name>", "Agent instance name", "default").option("-p, --port <port>", "Port to listen on", "3005").option("--db-path <path>", "SQLite database path", "./vibecontrols-agent.db").action(async (opts) => {
3099
+ const os = platform();
3100
+ const port = parseInt(opts.port, 10);
3101
+ header("Installing Autostart");
3102
+ kv("Platform", os);
3103
+ kv("Agent", opts.name);
3104
+ kv("Port", String(port));
3105
+ blank();
3106
+ try {
3107
+ if (os === "linux") {
3108
+ await installSystemd(opts.name, port, opts.dbPath);
3109
+ } else if (os === "darwin") {
3110
+ await installLaunchd(opts.name, port, opts.dbPath);
3111
+ } else {
3112
+ fail(`Autostart is not supported on ${os}. Supported: linux, darwin (macOS).`);
3113
+ process.exit(1);
3114
+ }
3115
+ } catch (err) {
3116
+ fail(`Failed to install autostart: ${err}`);
3117
+ process.exit(1);
3118
+ }
3119
+ });
3120
+ autostart.command("uninstall").description("Stop and remove the system service").option("-n, --name <name>", "Agent instance name", "default").action(async (opts) => {
3121
+ const os = platform();
3122
+ header("Removing Autostart");
3123
+ try {
3124
+ if (os === "linux") {
3125
+ await uninstallSystemd(opts.name);
3126
+ } else if (os === "darwin") {
3127
+ await uninstallLaunchd(opts.name);
3128
+ } else {
3129
+ fail(`Autostart is not supported on ${os}.`);
3130
+ process.exit(1);
3131
+ }
3132
+ } catch (err) {
3133
+ fail(`Failed to uninstall autostart: ${err}`);
3134
+ process.exit(1);
3135
+ }
3136
+ });
3137
+ autostart.command("status").description("Check if autostart is configured and running").option("-n, --name <name>", "Agent instance name", "default").action(async (opts) => {
3138
+ const os = platform();
3139
+ try {
3140
+ if (os === "linux") {
3141
+ await statusSystemd(opts.name);
3142
+ } else if (os === "darwin") {
3143
+ await statusLaunchd(opts.name);
3144
+ } else {
3145
+ fail(`Autostart is not supported on ${os}.`);
3146
+ process.exit(1);
3147
+ }
3148
+ } catch (err) {
3149
+ fail(`Failed to check autostart status: ${err}`);
3150
+ process.exit(1);
3151
+ }
3152
+ });
3153
+ }
3154
+
2850
3155
  // src/cli.ts
2851
3156
  if (typeof Bun === "undefined") {
2852
3157
  console.error(`\x1B[31mError:\x1B[0m VibeControls Agent requires the Bun runtime.
@@ -2856,7 +3161,7 @@ if (typeof Bun === "undefined") {
2856
3161
  }
2857
3162
  var packageVersion = "1.0.0";
2858
3163
  try {
2859
- const packageJsonPath = join3(import.meta.dir, "..", "package.json");
3164
+ const packageJsonPath = join4(import.meta.dir, "..", "package.json");
2860
3165
  const packageJson = await Bun.file(packageJsonPath).json();
2861
3166
  packageVersion = packageJson.version;
2862
3167
  } catch {}
@@ -2871,6 +3176,7 @@ register6(program2);
2871
3176
  register7(program2);
2872
3177
  register8(program2);
2873
3178
  register9(program2);
3179
+ register10(program2);
2874
3180
  async function main() {
2875
3181
  const pluginManager = new PluginManager;
2876
3182
  try {
@@ -2913,5 +3219,5 @@ main().catch((err) => {
2913
3219
  process.exit(1);
2914
3220
  });
2915
3221
 
2916
- //# debugId=B3B10A5CB7971CB864756E2164756E21
3222
+ //# debugId=3C8CD05450C0190364756E2164756E21
2917
3223
  //# sourceMappingURL=cli.js.map