zenflo 0.11.8 → 0.11.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.
- package/dist/{index-BSKmq2tY.mjs → index-BW7_WZAp.mjs} +554 -79
- package/dist/{index-DXM6ppoL.cjs → index-CIEIMabk.cjs} +552 -76
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/runCCR-COQ_d0t_.cjs +103 -0
- package/dist/runCCR-CQVvjom9.mjs +101 -0
- package/dist/{runCodex-C5pAgp-V.cjs → runCodex-CWrjFTDA.cjs} +2 -2
- package/dist/{runCodex-DoQNB2J-.mjs → runCodex-zJRwP8WW.mjs} +2 -2
- package/dist/status-4hHpWyGc.mjs +104 -0
- package/dist/status-CXWZdbyc.cjs +101 -0
- package/dist/status-DChMScEv.cjs +106 -0
- package/dist/status-DT-lQ5z3.mjs +99 -0
- package/dist/status-EIRGrJzv.mjs +92 -0
- package/dist/status-a3Xws-4m.cjs +94 -0
- package/dist/{types-uaIx8ab0.cjs → types-CVUeTsiC.cjs} +2 -2
- package/dist/{types-qQzfAnur.mjs → types-Kg2WtK0J.mjs} +2 -2
- package/package.json +1 -1
- package/scripts/ccr_launcher.cjs +309 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-CVUeTsiC.cjs');
|
|
7
7
|
var node_child_process = require('node:child_process');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var node_readline = require('node:readline');
|
|
@@ -34,6 +34,7 @@ var fastifyTypeProviderZod = require('fastify-type-provider-zod');
|
|
|
34
34
|
var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
35
35
|
var node_http = require('node:http');
|
|
36
36
|
var streamableHttp_js = require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
37
|
+
var url = require('url');
|
|
37
38
|
var http = require('http');
|
|
38
39
|
var util = require('util');
|
|
39
40
|
|
|
@@ -865,15 +866,15 @@ const RemoteModeDisplay = ({ messageBuffer, logPath, onExit, onSwitchToLocal })
|
|
|
865
866
|
const getMessageColor = (type) => {
|
|
866
867
|
switch (type) {
|
|
867
868
|
case "user":
|
|
868
|
-
return "
|
|
869
|
+
return "magentaBright";
|
|
869
870
|
case "assistant":
|
|
870
|
-
return "
|
|
871
|
+
return "cyanBright";
|
|
871
872
|
case "system":
|
|
872
|
-
return "
|
|
873
|
+
return "blueBright";
|
|
873
874
|
case "tool":
|
|
874
|
-
return "
|
|
875
|
+
return "yellowBright";
|
|
875
876
|
case "result":
|
|
876
|
-
return "
|
|
877
|
+
return "greenBright";
|
|
877
878
|
case "status":
|
|
878
879
|
return "gray";
|
|
879
880
|
default:
|
|
@@ -892,18 +893,28 @@ const RemoteModeDisplay = ({ messageBuffer, logPath, onExit, onSwitchToLocal })
|
|
|
892
893
|
return chunks.join("\n");
|
|
893
894
|
}).join("\n");
|
|
894
895
|
};
|
|
895
|
-
|
|
896
|
+
const banner = [
|
|
897
|
+
"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557",
|
|
898
|
+
"\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551",
|
|
899
|
+
"\u2551 \u255A\u2550\u2550\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557 \u2551",
|
|
900
|
+
"\u2551 \u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2551",
|
|
901
|
+
"\u2551 \u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2551",
|
|
902
|
+
"\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2551",
|
|
903
|
+
"\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u2551",
|
|
904
|
+
"\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"
|
|
905
|
+
];
|
|
906
|
+
return /* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", width: terminalWidth, height: terminalHeight }, /* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", marginBottom: 1 }, banner.map((line, i) => /* @__PURE__ */ React.createElement(ink.Text, { key: i, color: "cyan", bold: true }, line))), /* @__PURE__ */ React.createElement(
|
|
896
907
|
ink.Box,
|
|
897
908
|
{
|
|
898
909
|
flexDirection: "column",
|
|
899
910
|
width: terminalWidth,
|
|
900
|
-
height: terminalHeight -
|
|
911
|
+
height: terminalHeight - 14,
|
|
901
912
|
borderStyle: "round",
|
|
902
|
-
borderColor: "
|
|
913
|
+
borderColor: "magenta",
|
|
903
914
|
paddingX: 1,
|
|
904
915
|
overflow: "hidden"
|
|
905
916
|
},
|
|
906
|
-
/* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React.createElement(ink.Text, { color: "
|
|
917
|
+
/* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React.createElement(ink.Text, { color: "magenta", bold: true }, "\u{1F4E1} Remote Mode - Live Session"), /* @__PURE__ */ React.createElement(ink.Text, { color: "magenta", dimColor: true }, "\u2500".repeat(Math.min(terminalWidth - 4, 60)))),
|
|
907
918
|
/* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", height: terminalHeight - 10, overflow: "hidden" }, messages.length === 0 ? /* @__PURE__ */ React.createElement(ink.Text, { color: "gray", dimColor: true }, "Waiting for messages...") : (
|
|
908
919
|
// Show only the last messages that fit in the available space
|
|
909
920
|
messages.slice(-Math.max(1, terminalHeight - 10)).map((msg) => /* @__PURE__ */ React.createElement(ink.Box, { key: msg.id, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React.createElement(ink.Text, { color: getMessageColor(msg.type), dimColor: true }, formatMessage(msg))))
|
|
@@ -912,14 +923,14 @@ const RemoteModeDisplay = ({ messageBuffer, logPath, onExit, onSwitchToLocal })
|
|
|
912
923
|
ink.Box,
|
|
913
924
|
{
|
|
914
925
|
width: terminalWidth,
|
|
915
|
-
borderStyle: "
|
|
916
|
-
borderColor: actionInProgress ? "gray" : confirmationMode === "exit" ? "red" : confirmationMode === "switch" ? "yellow" : "
|
|
926
|
+
borderStyle: "double",
|
|
927
|
+
borderColor: actionInProgress ? "gray" : confirmationMode === "exit" ? "red" : confirmationMode === "switch" ? "yellow" : "cyan",
|
|
917
928
|
paddingX: 2,
|
|
918
929
|
justifyContent: "center",
|
|
919
930
|
alignItems: "center",
|
|
920
931
|
flexDirection: "column"
|
|
921
932
|
},
|
|
922
|
-
/* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", alignItems: "center" }, actionInProgress === "exiting" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "gray", bold: true }, "Exiting...") : actionInProgress === "switching" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "
|
|
933
|
+
/* @__PURE__ */ React.createElement(ink.Box, { flexDirection: "column", alignItems: "center" }, actionInProgress === "exiting" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "gray", bold: true }, "\u26A1 Exiting remote session...") : actionInProgress === "switching" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "cyan", bold: true }, "\u{1F504} Switching to local mode...") : confirmationMode === "exit" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "red", bold: true }, "\u26A0\uFE0F Press Ctrl-C again to exit completely") : confirmationMode === "switch" ? /* @__PURE__ */ React.createElement(ink.Text, { color: "yellow", bold: true }, "\u23F8\uFE0F Press SPACE again to switch to local mode") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ink.Text, { color: "cyan", bold: true }, "\u{1F680} Press SPACE to switch to local \u2022 Ctrl-C to exit")), process.env.DEBUG && logPath && /* @__PURE__ */ React.createElement(ink.Text, { color: "gray", dimColor: true }, "Debug logs: ", logPath))
|
|
923
934
|
));
|
|
924
935
|
};
|
|
925
936
|
|
|
@@ -1020,10 +1031,10 @@ class AbortError extends Error {
|
|
|
1020
1031
|
}
|
|
1021
1032
|
}
|
|
1022
1033
|
|
|
1023
|
-
const __filename$
|
|
1024
|
-
const __dirname$
|
|
1034
|
+
const __filename$2 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CIEIMabk.cjs', document.baseURI).href)));
|
|
1035
|
+
const __dirname$2 = node_path.join(__filename$2, "..");
|
|
1025
1036
|
function getDefaultClaudeCodePath() {
|
|
1026
|
-
return node_path.join(__dirname$
|
|
1037
|
+
return node_path.join(__dirname$2, "..", "..", "..", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
|
|
1027
1038
|
}
|
|
1028
1039
|
function logDebug(message) {
|
|
1029
1040
|
if (process.env.DEBUG) {
|
|
@@ -3902,8 +3913,8 @@ function selectAuthenticationMethod() {
|
|
|
3902
3913
|
async function doMobileAuth(keypair) {
|
|
3903
3914
|
console.clear();
|
|
3904
3915
|
console.log("\nMobile Authentication\n");
|
|
3905
|
-
console.log("Scan this QR code with your
|
|
3906
|
-
const authUrl = "
|
|
3916
|
+
console.log("Scan this QR code with your ZenFlo mobile app:\n");
|
|
3917
|
+
const authUrl = "zenflo://terminal?" + types.encodeBase64Url(keypair.publicKey);
|
|
3907
3918
|
displayQRCode(authUrl);
|
|
3908
3919
|
console.log("\nOr manually enter this URL:");
|
|
3909
3920
|
console.log(authUrl);
|
|
@@ -4802,7 +4813,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
4802
4813
|
// Initialize lifecycle state
|
|
4803
4814
|
lifecycleState: "running",
|
|
4804
4815
|
lifecycleStateSince: Date.now(),
|
|
4805
|
-
flavor: "claude"
|
|
4816
|
+
flavor: options.flavor || "claude"
|
|
4806
4817
|
};
|
|
4807
4818
|
const response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
|
|
4808
4819
|
types.logger.debug(`Session created: ${response.id}`);
|
|
@@ -5039,16 +5050,120 @@ async function runClaude(credentials, options = {}) {
|
|
|
5039
5050
|
process.exit(0);
|
|
5040
5051
|
}
|
|
5041
5052
|
|
|
5042
|
-
const
|
|
5043
|
-
const
|
|
5044
|
-
|
|
5053
|
+
const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CIEIMabk.cjs', document.baseURI).href)));
|
|
5054
|
+
const __dirname$1 = path.dirname(__filename$1);
|
|
5055
|
+
const PLIST_LABEL$1 = "com.zenflo.daemon";
|
|
5056
|
+
const LAUNCH_AGENTS_DIR$1 = path.join(os$1.homedir(), "Library", "LaunchAgents");
|
|
5057
|
+
const PLIST_FILE$1 = path.join(LAUNCH_AGENTS_DIR$1, `${PLIST_LABEL$1}.plist`);
|
|
5058
|
+
const APP_BUNDLE_DIR = path.join(os$1.homedir(), "Library", "Application Support", "ZenFlo");
|
|
5059
|
+
const APP_BUNDLE_PATH = path.join(APP_BUNDLE_DIR, "ZenFlo Daemon.app");
|
|
5060
|
+
async function install$3() {
|
|
5045
5061
|
try {
|
|
5062
|
+
console.log(chalk.cyan("\u{1F4E6} Installing ZenFlo daemon as LaunchAgent...\n"));
|
|
5046
5063
|
if (fs$2.existsSync(PLIST_FILE$1)) {
|
|
5047
|
-
|
|
5048
|
-
|
|
5064
|
+
console.log(chalk.yellow("\u26A0\uFE0F LaunchAgent already installed. Uninstalling first...\n"));
|
|
5065
|
+
try {
|
|
5066
|
+
child_process.execSync(`launchctl unload "${PLIST_FILE$1}"`, { stdio: "pipe" });
|
|
5067
|
+
} catch (error) {
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
if (!fs$2.existsSync(LAUNCH_AGENTS_DIR$1)) {
|
|
5071
|
+
fs$2.mkdirSync(LAUNCH_AGENTS_DIR$1, { recursive: true });
|
|
5072
|
+
}
|
|
5073
|
+
let zenfloBinaryPath;
|
|
5074
|
+
try {
|
|
5075
|
+
zenfloBinaryPath = child_process.execSync("which zenflo", { encoding: "utf-8" }).trim();
|
|
5076
|
+
} catch (error) {
|
|
5077
|
+
throw new Error("Could not find zenflo binary in PATH. Is ZenFlo installed?");
|
|
5078
|
+
}
|
|
5079
|
+
console.log(chalk.cyan("Creating app bundle with ZenFlo icon..."));
|
|
5080
|
+
const contentsDir = path.join(APP_BUNDLE_PATH, "Contents");
|
|
5081
|
+
const macosDir = path.join(contentsDir, "MacOS");
|
|
5082
|
+
const resourcesDir = path.join(contentsDir, "Resources");
|
|
5083
|
+
fs$2.mkdirSync(macosDir, { recursive: true });
|
|
5084
|
+
fs$2.mkdirSync(resourcesDir, { recursive: true });
|
|
5085
|
+
const possibleIconPaths = [
|
|
5086
|
+
// PRIMARY: Icon Exports directory (user's actual branding)
|
|
5087
|
+
"/Users/quinnmay/developer/zenflo/Icon Exports/ZenFlo.icns",
|
|
5088
|
+
path.join(process.cwd(), "Icon Exports", "ZenFlo.icns"),
|
|
5089
|
+
path.join(__dirname$1, "..", "..", "..", "Icon Exports", "ZenFlo.icns"),
|
|
5090
|
+
// Fallback: Tauri icons (old location)
|
|
5091
|
+
"/Users/quinnmay/developer/zenflo/mobile/src-tauri/icons/icon.icns",
|
|
5092
|
+
"/Users/quinnmay/developer/zenflo/webapp/src-tauri/icons/icon.icns",
|
|
5093
|
+
path.join(process.cwd(), "mobile", "src-tauri", "icons", "icon.icns"),
|
|
5094
|
+
path.join(process.cwd(), "webapp", "src-tauri", "icons", "icon.icns"),
|
|
5095
|
+
path.join(__dirname$1, "..", "..", "..", "mobile", "src-tauri", "icons", "icon.icns"),
|
|
5096
|
+
path.join(__dirname$1, "..", "..", "..", "webapp", "src-tauri", "icons", "icon.icns")
|
|
5097
|
+
];
|
|
5098
|
+
let iconCopied = false;
|
|
5099
|
+
for (const iconPath of possibleIconPaths) {
|
|
5100
|
+
if (fs$2.existsSync(iconPath)) {
|
|
5101
|
+
fs$2.copyFileSync(iconPath, path.join(resourcesDir, "AppIcon.icns"));
|
|
5102
|
+
console.log(chalk.green("\u2705 Copied ZenFlo icon"));
|
|
5103
|
+
console.log(chalk.dim(` Source: ${iconPath}`));
|
|
5104
|
+
iconCopied = true;
|
|
5105
|
+
break;
|
|
5106
|
+
}
|
|
5049
5107
|
}
|
|
5050
|
-
|
|
5051
|
-
|
|
5108
|
+
if (!iconCopied) {
|
|
5109
|
+
console.log(chalk.yellow("\u26A0\uFE0F Could not find icon.icns (will use default icon)"));
|
|
5110
|
+
}
|
|
5111
|
+
try {
|
|
5112
|
+
child_process.execSync(`touch "${APP_BUNDLE_PATH}"`);
|
|
5113
|
+
child_process.execSync("killall Dock 2>/dev/null || true", { stdio: "pipe" });
|
|
5114
|
+
child_process.execSync("killall Finder 2>/dev/null || true", { stdio: "pipe" });
|
|
5115
|
+
console.log(chalk.green("\u2705 Refreshed icon cache\n"));
|
|
5116
|
+
} catch (error) {
|
|
5117
|
+
console.log(chalk.dim(" (Icon cache refresh skipped)\n"));
|
|
5118
|
+
}
|
|
5119
|
+
const infoPlistContent = trimIdent(`
|
|
5120
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
5121
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
5122
|
+
<plist version="1.0">
|
|
5123
|
+
<dict>
|
|
5124
|
+
<key>CFBundleExecutable</key>
|
|
5125
|
+
<string>zenflo-daemon</string>
|
|
5126
|
+
<key>CFBundleIconFile</key>
|
|
5127
|
+
<string>AppIcon.icns</string>
|
|
5128
|
+
<key>CFBundleIdentifier</key>
|
|
5129
|
+
<string>com.zenflo.daemon</string>
|
|
5130
|
+
<key>CFBundleName</key>
|
|
5131
|
+
<string>ZenFlo Daemon</string>
|
|
5132
|
+
<key>CFBundlePackageType</key>
|
|
5133
|
+
<string>APPL</string>
|
|
5134
|
+
<key>CFBundleShortVersionString</key>
|
|
5135
|
+
<string>1.0.0</string>
|
|
5136
|
+
<key>LSBackgroundOnly</key>
|
|
5137
|
+
<true/>
|
|
5138
|
+
<key>LSUIElement</key>
|
|
5139
|
+
<true/>
|
|
5140
|
+
</dict>
|
|
5141
|
+
</plist>
|
|
5142
|
+
`);
|
|
5143
|
+
fs$2.writeFileSync(path.join(contentsDir, "Info.plist"), infoPlistContent);
|
|
5144
|
+
console.log(chalk.green("\u2705 Created app bundle Info.plist"));
|
|
5145
|
+
let nodePath;
|
|
5146
|
+
let zenfloScriptPath;
|
|
5147
|
+
try {
|
|
5148
|
+
nodePath = child_process.execSync("which node", { encoding: "utf-8" }).trim();
|
|
5149
|
+
} catch (error) {
|
|
5150
|
+
throw new Error("Could not find node binary in PATH. Is Node.js installed?");
|
|
5151
|
+
}
|
|
5152
|
+
try {
|
|
5153
|
+
const symlinkTarget = child_process.execSync(`readlink "${zenfloBinaryPath}"`, { encoding: "utf-8" }).trim();
|
|
5154
|
+
const symlinkDir = path.dirname(zenfloBinaryPath);
|
|
5155
|
+
zenfloScriptPath = path.resolve(symlinkDir, symlinkTarget);
|
|
5156
|
+
} catch (error) {
|
|
5157
|
+
zenfloScriptPath = zenfloBinaryPath;
|
|
5158
|
+
}
|
|
5159
|
+
const wrapperScript = trimIdent(`
|
|
5160
|
+
#!/bin/bash
|
|
5161
|
+
# Use absolute paths to avoid issues when launched from / by LaunchAgent
|
|
5162
|
+
exec "${nodePath}" "${zenfloScriptPath}" daemon start-sync
|
|
5163
|
+
`);
|
|
5164
|
+
const wrapperPath = path.join(macosDir, "zenflo-daemon");
|
|
5165
|
+
fs$2.writeFileSync(wrapperPath, wrapperScript, { mode: 493 });
|
|
5166
|
+
console.log(chalk.green("\u2705 Created launcher script\n"));
|
|
5052
5167
|
const plistContent = trimIdent(`
|
|
5053
5168
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
5054
5169
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -5056,92 +5171,411 @@ async function install$1() {
|
|
|
5056
5171
|
<dict>
|
|
5057
5172
|
<key>Label</key>
|
|
5058
5173
|
<string>${PLIST_LABEL$1}</string>
|
|
5059
|
-
|
|
5174
|
+
|
|
5060
5175
|
<key>ProgramArguments</key>
|
|
5061
5176
|
<array>
|
|
5062
|
-
<string
|
|
5063
|
-
<string
|
|
5064
|
-
<string
|
|
5177
|
+
<string>/usr/bin/open</string>
|
|
5178
|
+
<string>-a</string>
|
|
5179
|
+
<string>${APP_BUNDLE_PATH}</string>
|
|
5180
|
+
<string>--background</string>
|
|
5065
5181
|
</array>
|
|
5066
|
-
|
|
5067
|
-
<key>EnvironmentVariables</key>
|
|
5068
|
-
<dict>
|
|
5069
|
-
<key>ZENFLO_DAEMON_MODE</key>
|
|
5070
|
-
<string>true</string>
|
|
5071
|
-
</dict>
|
|
5072
|
-
|
|
5182
|
+
|
|
5073
5183
|
<key>RunAtLoad</key>
|
|
5074
5184
|
<true/>
|
|
5075
|
-
|
|
5185
|
+
|
|
5076
5186
|
<key>KeepAlive</key>
|
|
5077
|
-
<
|
|
5078
|
-
|
|
5187
|
+
<dict>
|
|
5188
|
+
<key>SuccessfulExit</key>
|
|
5189
|
+
<false/>
|
|
5190
|
+
</dict>
|
|
5191
|
+
|
|
5079
5192
|
<key>StandardErrorPath</key>
|
|
5080
|
-
<string>${
|
|
5081
|
-
|
|
5193
|
+
<string>${types.configuration.zenfloHomeDir}/daemon.err</string>
|
|
5194
|
+
|
|
5082
5195
|
<key>StandardOutPath</key>
|
|
5083
|
-
<string>${
|
|
5084
|
-
|
|
5196
|
+
<string>${types.configuration.zenfloHomeDir}/daemon.log</string>
|
|
5197
|
+
|
|
5085
5198
|
<key>WorkingDirectory</key>
|
|
5086
|
-
<string
|
|
5199
|
+
<string>${os$1.homedir()}</string>
|
|
5200
|
+
|
|
5201
|
+
<key>ProcessType</key>
|
|
5202
|
+
<string>Background</string>
|
|
5203
|
+
|
|
5204
|
+
<key>ThrottleInterval</key>
|
|
5205
|
+
<integer>10</integer>
|
|
5087
5206
|
</dict>
|
|
5088
5207
|
</plist>
|
|
5089
5208
|
`);
|
|
5090
|
-
fs$2.writeFileSync(PLIST_FILE$1, plistContent);
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5209
|
+
fs$2.writeFileSync(PLIST_FILE$1, plistContent, { mode: 420 });
|
|
5210
|
+
console.log(chalk.green("\u2705 Created LaunchAgent plist"));
|
|
5211
|
+
console.log(chalk.dim(` ${PLIST_FILE$1}
|
|
5212
|
+
`));
|
|
5213
|
+
try {
|
|
5214
|
+
child_process.execSync(`launchctl load "${PLIST_FILE$1}"`, { stdio: "pipe" });
|
|
5215
|
+
console.log(chalk.green("\u2705 LaunchAgent loaded successfully\n"));
|
|
5216
|
+
} catch (error) {
|
|
5217
|
+
throw new Error(`Failed to load LaunchAgent: ${error instanceof Error ? error.message : error}`);
|
|
5218
|
+
}
|
|
5219
|
+
console.log(chalk.green.bold("\u{1F389} Installation complete!\n"));
|
|
5220
|
+
console.log(chalk.cyan("The daemon will now:"));
|
|
5221
|
+
console.log(chalk.dim(" \u2022 Start automatically when you log in"));
|
|
5222
|
+
console.log(chalk.dim(" \u2022 Run in the background 24/7"));
|
|
5223
|
+
console.log(chalk.dim(" \u2022 Restart automatically if it crashes"));
|
|
5224
|
+
console.log(chalk.dim(" \u2022 Display with ZenFlo branding in Activity Monitor\n"));
|
|
5225
|
+
console.log(chalk.cyan("Next steps:"));
|
|
5226
|
+
console.log(chalk.dim(" \u2022 Check status: ") + chalk.white("zenflo daemon status"));
|
|
5227
|
+
console.log(chalk.dim(" \u2022 View logs: ") + chalk.white(`tail -f ${types.configuration.zenfloHomeDir}/daemon.log`));
|
|
5228
|
+
console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall\n"));
|
|
5229
|
+
console.log(chalk.yellow("\u{1F4A1} Tip: To grant Full Disk Access:"));
|
|
5230
|
+
console.log(chalk.dim(" 1. Open System Settings \u2192 Privacy & Security \u2192 Full Disk Access"));
|
|
5231
|
+
console.log(chalk.dim(" 2. Click the + button"));
|
|
5232
|
+
console.log(chalk.dim(" 3. Navigate to: ") + chalk.white(zenfloBinaryPath));
|
|
5233
|
+
console.log(chalk.dim(" 4. Enable the toggle\n"));
|
|
5096
5234
|
} catch (error) {
|
|
5235
|
+
console.error(chalk.red("\u274C Installation failed:"), error instanceof Error ? error.message : error);
|
|
5097
5236
|
types.logger.debug("Failed to install daemon:", error);
|
|
5098
5237
|
throw error;
|
|
5099
5238
|
}
|
|
5100
5239
|
}
|
|
5101
5240
|
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5241
|
+
const TASK_NAME$1 = "ZenFlo Daemon";
|
|
5242
|
+
async function install$2() {
|
|
5243
|
+
try {
|
|
5244
|
+
console.log(chalk.cyan("\u{1F4E6} Installing ZenFlo daemon as Windows Task Scheduler task...\n"));
|
|
5245
|
+
try {
|
|
5246
|
+
child_process.execSync(`schtasks /Query /TN "${TASK_NAME$1}"`, { stdio: "pipe" });
|
|
5247
|
+
console.log(chalk.yellow("\u26A0\uFE0F Task already installed. Uninstalling first...\n"));
|
|
5248
|
+
try {
|
|
5249
|
+
child_process.execSync(`schtasks /Delete /TN "${TASK_NAME$1}" /F`, { stdio: "pipe" });
|
|
5250
|
+
} catch (error) {
|
|
5251
|
+
}
|
|
5252
|
+
} catch (error) {
|
|
5253
|
+
}
|
|
5254
|
+
let zenfloBinaryPath;
|
|
5255
|
+
try {
|
|
5256
|
+
zenfloBinaryPath = child_process.execSync("where zenflo", { encoding: "utf-8" }).trim().split("\n")[0];
|
|
5257
|
+
} catch (error) {
|
|
5258
|
+
throw new Error("Could not find zenflo binary in PATH. Is ZenFlo installed?");
|
|
5259
|
+
}
|
|
5260
|
+
let nodePath;
|
|
5261
|
+
try {
|
|
5262
|
+
nodePath = child_process.execSync("where node", { encoding: "utf-8" }).trim().split("\n")[0];
|
|
5263
|
+
} catch (error) {
|
|
5264
|
+
throw new Error("Could not find node.exe in PATH. Is Node.js installed?");
|
|
5265
|
+
}
|
|
5266
|
+
const xmlPath = path.join(types.configuration.zenfloHomeDir, "daemon-task.xml");
|
|
5267
|
+
const xmlContent = trimIdent(`
|
|
5268
|
+
<?xml version="1.0" encoding="UTF-16"?>
|
|
5269
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
5270
|
+
<RegistrationInfo>
|
|
5271
|
+
<Date>2025-01-01T00:00:00</Date>
|
|
5272
|
+
<Author>${os$1.userInfo().username}</Author>
|
|
5273
|
+
<Description>ZenFlo AI coding assistant daemon service</Description>
|
|
5274
|
+
</RegistrationInfo>
|
|
5275
|
+
<Triggers>
|
|
5276
|
+
<LogonTrigger>
|
|
5277
|
+
<Enabled>true</Enabled>
|
|
5278
|
+
<UserId>${os$1.userInfo().username}</UserId>
|
|
5279
|
+
</LogonTrigger>
|
|
5280
|
+
</Triggers>
|
|
5281
|
+
<Principals>
|
|
5282
|
+
<Principal id="Author">
|
|
5283
|
+
<UserId>${os$1.userInfo().username}</UserId>
|
|
5284
|
+
<LogonType>InteractiveToken</LogonType>
|
|
5285
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
5286
|
+
</Principal>
|
|
5287
|
+
</Principals>
|
|
5288
|
+
<Settings>
|
|
5289
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
5290
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
5291
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
5292
|
+
<AllowHardTerminate>true</AllowHardTerminate>
|
|
5293
|
+
<StartWhenAvailable>true</StartWhenAvailable>
|
|
5294
|
+
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
5295
|
+
<IdleSettings>
|
|
5296
|
+
<StopOnIdleEnd>false</StopOnIdleEnd>
|
|
5297
|
+
<RestartOnIdle>false</RestartOnIdle>
|
|
5298
|
+
</IdleSettings>
|
|
5299
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
5300
|
+
<Enabled>true</Enabled>
|
|
5301
|
+
<Hidden>false</Hidden>
|
|
5302
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
5303
|
+
<WakeToRun>false</WakeToRun>
|
|
5304
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
5305
|
+
<Priority>7</Priority>
|
|
5306
|
+
<RestartOnFailure>
|
|
5307
|
+
<Interval>PT1M</Interval>
|
|
5308
|
+
<Count>3</Count>
|
|
5309
|
+
</RestartOnFailure>
|
|
5310
|
+
</Settings>
|
|
5311
|
+
<Actions Context="Author">
|
|
5312
|
+
<Exec>
|
|
5313
|
+
<Command>"${nodePath}"</Command>
|
|
5314
|
+
<Arguments>"${zenfloBinaryPath}" daemon start-sync</Arguments>
|
|
5315
|
+
<WorkingDirectory>${os$1.homedir()}</WorkingDirectory>
|
|
5316
|
+
</Exec>
|
|
5317
|
+
</Actions>
|
|
5318
|
+
</Task>
|
|
5319
|
+
`);
|
|
5320
|
+
fs$2.writeFileSync(xmlPath, xmlContent, { encoding: "utf-16le" });
|
|
5321
|
+
console.log(chalk.green("\u2705 Created task definition XML"));
|
|
5322
|
+
console.log(chalk.dim(` ${xmlPath}
|
|
5323
|
+
`));
|
|
5324
|
+
try {
|
|
5325
|
+
child_process.execSync(`schtasks /Create /XML "${xmlPath}" /TN "${TASK_NAME$1}"`, { stdio: "pipe" });
|
|
5326
|
+
console.log(chalk.green("\u2705 Task created successfully\n"));
|
|
5327
|
+
} catch (error) {
|
|
5328
|
+
throw new Error(`Failed to create scheduled task: ${error instanceof Error ? error.message : error}`);
|
|
5329
|
+
}
|
|
5330
|
+
try {
|
|
5331
|
+
child_process.execSync(`schtasks /Run /TN "${TASK_NAME$1}"`, { stdio: "pipe" });
|
|
5332
|
+
console.log(chalk.green("\u2705 Task started successfully\n"));
|
|
5333
|
+
} catch (error) {
|
|
5334
|
+
console.log(chalk.yellow("\u26A0\uFE0F Could not start task immediately (will start at next login)\n"));
|
|
5335
|
+
}
|
|
5336
|
+
console.log(chalk.green.bold("\u{1F389} Installation complete!\n"));
|
|
5337
|
+
console.log(chalk.cyan("The daemon will now:"));
|
|
5338
|
+
console.log(chalk.dim(" \u2022 Start automatically when you log in"));
|
|
5339
|
+
console.log(chalk.dim(" \u2022 Run in the background 24/7"));
|
|
5340
|
+
console.log(chalk.dim(" \u2022 Restart automatically if it crashes (up to 3 times)\n"));
|
|
5341
|
+
console.log(chalk.cyan("Next steps:"));
|
|
5342
|
+
console.log(chalk.dim(" \u2022 Check status: ") + chalk.white("zenflo daemon status"));
|
|
5343
|
+
console.log(chalk.dim(" \u2022 View logs: ") + chalk.white(`type ${types.configuration.zenfloHomeDir}\\daemon.log`));
|
|
5344
|
+
console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall\n"));
|
|
5345
|
+
console.log(chalk.yellow("\u{1F4A1} Tip: View task in Task Scheduler:"));
|
|
5346
|
+
console.log(chalk.dim(" 1. Press Win+R and type: taskschd.msc"));
|
|
5347
|
+
console.log(chalk.dim(' 2. Find "ZenFlo Daemon" in Task Scheduler Library'));
|
|
5348
|
+
console.log(chalk.dim(" 3. View history, logs, and configuration\n"));
|
|
5349
|
+
} catch (error) {
|
|
5350
|
+
console.error(chalk.red("\u274C Installation failed:"), error instanceof Error ? error.message : error);
|
|
5351
|
+
types.logger.debug("Failed to install daemon:", error);
|
|
5352
|
+
throw error;
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
|
|
5356
|
+
const SERVICE_NAME$1 = "zenflo-daemon";
|
|
5357
|
+
const SYSTEMD_USER_DIR$1 = path.join(os$1.homedir(), ".config", "systemd", "user");
|
|
5358
|
+
const SERVICE_FILE$1 = path.join(SYSTEMD_USER_DIR$1, `${SERVICE_NAME$1}.service`);
|
|
5359
|
+
async function install$1() {
|
|
5360
|
+
try {
|
|
5361
|
+
console.log(chalk.cyan("\u{1F4E6} Installing ZenFlo daemon as systemd user service...\n"));
|
|
5362
|
+
if (fs$2.existsSync(SERVICE_FILE$1)) {
|
|
5363
|
+
console.log(chalk.yellow("\u26A0\uFE0F Service already installed. Uninstalling first...\n"));
|
|
5364
|
+
try {
|
|
5365
|
+
child_process.execSync(`systemctl --user stop ${SERVICE_NAME$1}`, { stdio: "pipe" });
|
|
5366
|
+
child_process.execSync(`systemctl --user disable ${SERVICE_NAME$1}`, { stdio: "pipe" });
|
|
5367
|
+
} catch (error) {
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
if (!fs$2.existsSync(SYSTEMD_USER_DIR$1)) {
|
|
5371
|
+
fs$2.mkdirSync(SYSTEMD_USER_DIR$1, { recursive: true });
|
|
5372
|
+
}
|
|
5373
|
+
let zenfloBinaryPath;
|
|
5374
|
+
try {
|
|
5375
|
+
zenfloBinaryPath = child_process.execSync("which zenflo", { encoding: "utf-8" }).trim();
|
|
5376
|
+
} catch (error) {
|
|
5377
|
+
throw new Error("Could not find zenflo binary in PATH. Is ZenFlo installed?");
|
|
5378
|
+
}
|
|
5379
|
+
const serviceContent = trimIdent(`
|
|
5380
|
+
[Unit]
|
|
5381
|
+
Description=ZenFlo AI Coding Assistant Daemon
|
|
5382
|
+
After=network.target
|
|
5383
|
+
|
|
5384
|
+
[Service]
|
|
5385
|
+
Type=simple
|
|
5386
|
+
ExecStart=${zenfloBinaryPath} daemon start-sync
|
|
5387
|
+
Restart=on-failure
|
|
5388
|
+
RestartSec=10
|
|
5389
|
+
StandardOutput=append:${types.configuration.zenfloHomeDir}/daemon.log
|
|
5390
|
+
StandardError=append:${types.configuration.zenfloHomeDir}/daemon.err
|
|
5391
|
+
WorkingDirectory=${os$1.homedir()}
|
|
5392
|
+
|
|
5393
|
+
[Install]
|
|
5394
|
+
WantedBy=default.target
|
|
5395
|
+
`);
|
|
5396
|
+
fs$2.writeFileSync(SERVICE_FILE$1, serviceContent, { mode: 420 });
|
|
5397
|
+
console.log(chalk.green("\u2705 Created systemd service file"));
|
|
5398
|
+
console.log(chalk.dim(` ${SERVICE_FILE$1}
|
|
5399
|
+
`));
|
|
5400
|
+
try {
|
|
5401
|
+
child_process.execSync("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
5402
|
+
console.log(chalk.green("\u2705 Reloaded systemd configuration"));
|
|
5403
|
+
} catch (error) {
|
|
5404
|
+
throw new Error(`Failed to reload systemd: ${error instanceof Error ? error.message : error}`);
|
|
5405
|
+
}
|
|
5406
|
+
try {
|
|
5407
|
+
child_process.execSync(`systemctl --user enable ${SERVICE_NAME$1}`, { stdio: "pipe" });
|
|
5408
|
+
console.log(chalk.green("\u2705 Service enabled (auto-start at login)"));
|
|
5409
|
+
} catch (error) {
|
|
5410
|
+
throw new Error(`Failed to enable service: ${error instanceof Error ? error.message : error}`);
|
|
5411
|
+
}
|
|
5412
|
+
try {
|
|
5413
|
+
child_process.execSync(`systemctl --user start ${SERVICE_NAME$1}`, { stdio: "pipe" });
|
|
5414
|
+
console.log(chalk.green("\u2705 Service started successfully\n"));
|
|
5415
|
+
} catch (error) {
|
|
5416
|
+
throw new Error(`Failed to start service: ${error instanceof Error ? error.message : error}`);
|
|
5417
|
+
}
|
|
5418
|
+
console.log(chalk.green.bold("\u{1F389} Installation complete!\n"));
|
|
5419
|
+
console.log(chalk.cyan("The daemon will now:"));
|
|
5420
|
+
console.log(chalk.dim(" \u2022 Start automatically when you log in"));
|
|
5421
|
+
console.log(chalk.dim(" \u2022 Run in the background 24/7"));
|
|
5422
|
+
console.log(chalk.dim(" \u2022 Restart automatically if it crashes\n"));
|
|
5423
|
+
console.log(chalk.cyan("Next steps:"));
|
|
5424
|
+
console.log(chalk.dim(" \u2022 Check status: ") + chalk.white("zenflo daemon status"));
|
|
5425
|
+
console.log(chalk.dim(" \u2022 View logs: ") + chalk.white(`tail -f ${types.configuration.zenfloHomeDir}/daemon.log`));
|
|
5426
|
+
console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall\n"));
|
|
5427
|
+
console.log(chalk.yellow("\u{1F4A1} Tip: systemd commands:"));
|
|
5428
|
+
console.log(chalk.dim(" \u2022 Check status: ") + chalk.white(`systemctl --user status ${SERVICE_NAME$1}`));
|
|
5429
|
+
console.log(chalk.dim(" \u2022 View logs: ") + chalk.white(`journalctl --user -u ${SERVICE_NAME$1} -f`));
|
|
5430
|
+
console.log(chalk.dim(" \u2022 Restart: ") + chalk.white(`systemctl --user restart ${SERVICE_NAME$1}
|
|
5431
|
+
`));
|
|
5432
|
+
} catch (error) {
|
|
5433
|
+
console.error(chalk.red("\u274C Installation failed:"), error instanceof Error ? error.message : error);
|
|
5434
|
+
types.logger.debug("Failed to install daemon:", error);
|
|
5435
|
+
throw error;
|
|
5105
5436
|
}
|
|
5106
|
-
|
|
5107
|
-
|
|
5437
|
+
}
|
|
5438
|
+
|
|
5439
|
+
async function install() {
|
|
5440
|
+
switch (process.platform) {
|
|
5441
|
+
case "darwin":
|
|
5442
|
+
await install$3();
|
|
5443
|
+
break;
|
|
5444
|
+
case "win32":
|
|
5445
|
+
await install$2();
|
|
5446
|
+
break;
|
|
5447
|
+
case "linux":
|
|
5448
|
+
await install$1();
|
|
5449
|
+
break;
|
|
5450
|
+
default:
|
|
5451
|
+
throw new Error(`Daemon installation is not supported on platform: ${process.platform}`);
|
|
5108
5452
|
}
|
|
5109
|
-
types.logger.info("Installing ZenFlo CLI daemon for macOS...");
|
|
5110
|
-
await install$1();
|
|
5111
5453
|
}
|
|
5112
5454
|
|
|
5113
|
-
const PLIST_LABEL = "com.
|
|
5114
|
-
const
|
|
5115
|
-
|
|
5455
|
+
const PLIST_LABEL = "com.zenflo.daemon";
|
|
5456
|
+
const LAUNCH_AGENTS_DIR = path.join(os$1.homedir(), "Library", "LaunchAgents");
|
|
5457
|
+
const PLIST_FILE = path.join(LAUNCH_AGENTS_DIR, `${PLIST_LABEL}.plist`);
|
|
5458
|
+
async function uninstall$3() {
|
|
5116
5459
|
try {
|
|
5460
|
+
console.log(chalk.cyan("\u{1F5D1}\uFE0F Uninstalling ZenFlo daemon LaunchAgent...\n"));
|
|
5117
5461
|
if (!fs$2.existsSync(PLIST_FILE)) {
|
|
5118
|
-
|
|
5462
|
+
console.log(chalk.yellow("\u26A0\uFE0F LaunchAgent not found. Nothing to uninstall."));
|
|
5463
|
+
console.log(chalk.dim(` Expected location: ${PLIST_FILE}
|
|
5464
|
+
`));
|
|
5119
5465
|
return;
|
|
5120
5466
|
}
|
|
5121
5467
|
try {
|
|
5122
|
-
child_process.execSync(`launchctl unload ${PLIST_FILE}`, { stdio: "
|
|
5123
|
-
|
|
5468
|
+
child_process.execSync(`launchctl unload "${PLIST_FILE}"`, { stdio: "pipe" });
|
|
5469
|
+
console.log(chalk.green("\u2705 LaunchAgent unloaded"));
|
|
5124
5470
|
} catch (error) {
|
|
5125
|
-
|
|
5471
|
+
console.log(chalk.dim(" (LaunchAgent was not loaded)\n"));
|
|
5126
5472
|
}
|
|
5127
5473
|
fs$2.unlinkSync(PLIST_FILE);
|
|
5128
|
-
|
|
5129
|
-
|
|
5474
|
+
console.log(chalk.green("\u2705 Removed LaunchAgent plist\n"));
|
|
5475
|
+
console.log(chalk.green.bold("\u{1F389} Uninstallation complete!\n"));
|
|
5476
|
+
console.log(chalk.cyan("The daemon will no longer:"));
|
|
5477
|
+
console.log(chalk.dim(" \u2022 Start automatically at login"));
|
|
5478
|
+
console.log(chalk.dim(" \u2022 Run in the background\n"));
|
|
5479
|
+
console.log(chalk.cyan("Note: ") + chalk.dim("Auto-start will still work when you run ") + chalk.white("zenflo\n"));
|
|
5130
5480
|
} catch (error) {
|
|
5481
|
+
console.error(chalk.red("\u274C Uninstallation failed:"), error instanceof Error ? error.message : error);
|
|
5131
5482
|
types.logger.debug("Failed to uninstall daemon:", error);
|
|
5132
5483
|
throw error;
|
|
5133
5484
|
}
|
|
5134
5485
|
}
|
|
5135
5486
|
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5487
|
+
const TASK_NAME = "ZenFlo Daemon";
|
|
5488
|
+
async function uninstall$2() {
|
|
5489
|
+
try {
|
|
5490
|
+
console.log(chalk.cyan("\u{1F5D1}\uFE0F Uninstalling ZenFlo daemon scheduled task...\n"));
|
|
5491
|
+
try {
|
|
5492
|
+
child_process.execSync(`schtasks /Query /TN "${TASK_NAME}"`, { stdio: "pipe" });
|
|
5493
|
+
} catch (error) {
|
|
5494
|
+
console.log(chalk.yellow("\u26A0\uFE0F Scheduled task not found. Nothing to uninstall.\n"));
|
|
5495
|
+
return;
|
|
5496
|
+
}
|
|
5497
|
+
try {
|
|
5498
|
+
child_process.execSync(`schtasks /End /TN "${TASK_NAME}"`, { stdio: "pipe" });
|
|
5499
|
+
console.log(chalk.green("\u2705 Task stopped"));
|
|
5500
|
+
} catch (error) {
|
|
5501
|
+
console.log(chalk.dim(" (Task was not running)\n"));
|
|
5502
|
+
}
|
|
5503
|
+
try {
|
|
5504
|
+
child_process.execSync(`schtasks /Delete /TN "${TASK_NAME}" /F`, { stdio: "pipe" });
|
|
5505
|
+
console.log(chalk.green("\u2705 Scheduled task removed\n"));
|
|
5506
|
+
} catch (error) {
|
|
5507
|
+
throw new Error(`Failed to delete scheduled task: ${error instanceof Error ? error.message : error}`);
|
|
5508
|
+
}
|
|
5509
|
+
console.log(chalk.green.bold("\u{1F389} Uninstallation complete!\n"));
|
|
5510
|
+
console.log(chalk.cyan("The daemon will no longer:"));
|
|
5511
|
+
console.log(chalk.dim(" \u2022 Start automatically at login"));
|
|
5512
|
+
console.log(chalk.dim(" \u2022 Run in the background\n"));
|
|
5513
|
+
console.log(chalk.cyan("Note: ") + chalk.dim("Auto-start will still work when you run ") + chalk.white("zenflo\n"));
|
|
5514
|
+
} catch (error) {
|
|
5515
|
+
console.error(chalk.red("\u274C Uninstallation failed:"), error instanceof Error ? error.message : error);
|
|
5516
|
+
types.logger.debug("Failed to uninstall daemon:", error);
|
|
5517
|
+
throw error;
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5521
|
+
const SERVICE_NAME = "zenflo-daemon";
|
|
5522
|
+
const SYSTEMD_USER_DIR = path.join(os$1.homedir(), ".config", "systemd", "user");
|
|
5523
|
+
const SERVICE_FILE = path.join(SYSTEMD_USER_DIR, `${SERVICE_NAME}.service`);
|
|
5524
|
+
async function uninstall$1() {
|
|
5525
|
+
try {
|
|
5526
|
+
console.log(chalk.cyan("\u{1F5D1}\uFE0F Uninstalling ZenFlo daemon systemd service...\n"));
|
|
5527
|
+
if (!fs$2.existsSync(SERVICE_FILE)) {
|
|
5528
|
+
console.log(chalk.yellow("\u26A0\uFE0F Service not found. Nothing to uninstall."));
|
|
5529
|
+
console.log(chalk.dim(` Expected location: ${SERVICE_FILE}
|
|
5530
|
+
`));
|
|
5531
|
+
return;
|
|
5532
|
+
}
|
|
5533
|
+
try {
|
|
5534
|
+
child_process.execSync(`systemctl --user stop ${SERVICE_NAME}`, { stdio: "pipe" });
|
|
5535
|
+
console.log(chalk.green("\u2705 Service stopped"));
|
|
5536
|
+
} catch (error) {
|
|
5537
|
+
console.log(chalk.dim(" (Service was not running)"));
|
|
5538
|
+
}
|
|
5539
|
+
try {
|
|
5540
|
+
child_process.execSync(`systemctl --user disable ${SERVICE_NAME}`, { stdio: "pipe" });
|
|
5541
|
+
console.log(chalk.green("\u2705 Service disabled"));
|
|
5542
|
+
} catch (error) {
|
|
5543
|
+
console.log(chalk.dim(" (Service was not enabled)"));
|
|
5544
|
+
}
|
|
5545
|
+
fs$2.unlinkSync(SERVICE_FILE);
|
|
5546
|
+
console.log(chalk.green("\u2705 Removed service file\n"));
|
|
5547
|
+
try {
|
|
5548
|
+
child_process.execSync("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
5549
|
+
console.log(chalk.green("\u2705 Reloaded systemd configuration\n"));
|
|
5550
|
+
} catch (error) {
|
|
5551
|
+
console.log(chalk.dim(" (Could not reload systemd)\n"));
|
|
5552
|
+
}
|
|
5553
|
+
console.log(chalk.green.bold("\u{1F389} Uninstallation complete!\n"));
|
|
5554
|
+
console.log(chalk.cyan("The daemon will no longer:"));
|
|
5555
|
+
console.log(chalk.dim(" \u2022 Start automatically at login"));
|
|
5556
|
+
console.log(chalk.dim(" \u2022 Run in the background\n"));
|
|
5557
|
+
console.log(chalk.cyan("Note: ") + chalk.dim("Auto-start will still work when you run ") + chalk.white("zenflo\n"));
|
|
5558
|
+
} catch (error) {
|
|
5559
|
+
console.error(chalk.red("\u274C Uninstallation failed:"), error instanceof Error ? error.message : error);
|
|
5560
|
+
types.logger.debug("Failed to uninstall daemon:", error);
|
|
5561
|
+
throw error;
|
|
5139
5562
|
}
|
|
5140
|
-
|
|
5141
|
-
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5565
|
+
async function uninstall() {
|
|
5566
|
+
switch (process.platform) {
|
|
5567
|
+
case "darwin":
|
|
5568
|
+
await uninstall$3();
|
|
5569
|
+
break;
|
|
5570
|
+
case "win32":
|
|
5571
|
+
await uninstall$2();
|
|
5572
|
+
break;
|
|
5573
|
+
case "linux":
|
|
5574
|
+
await uninstall$1();
|
|
5575
|
+
break;
|
|
5576
|
+
default:
|
|
5577
|
+
throw new Error(`Daemon uninstallation is not supported on platform: ${process.platform}`);
|
|
5142
5578
|
}
|
|
5143
|
-
types.logger.info("Uninstalling ZenFlo CLI daemon for macOS...");
|
|
5144
|
-
await uninstall$1();
|
|
5145
5579
|
}
|
|
5146
5580
|
|
|
5147
5581
|
async function handleAuthCommand(args) {
|
|
@@ -5897,7 +6331,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
5897
6331
|
return;
|
|
5898
6332
|
} else if (subcommand === "codex") {
|
|
5899
6333
|
try {
|
|
5900
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6334
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CWrjFTDA.cjs'); });
|
|
5901
6335
|
let startedBy = void 0;
|
|
5902
6336
|
for (let i = 1; i < args.length; i++) {
|
|
5903
6337
|
if (args[i] === "--started-by") {
|
|
@@ -5916,6 +6350,27 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
5916
6350
|
process.exit(1);
|
|
5917
6351
|
}
|
|
5918
6352
|
return;
|
|
6353
|
+
} else if (subcommand === "ccr" || subcommand === "glm") {
|
|
6354
|
+
try {
|
|
6355
|
+
const { runCCR } = await Promise.resolve().then(function () { return require('./runCCR-COQ_d0t_.cjs'); });
|
|
6356
|
+
let startedBy = void 0;
|
|
6357
|
+
for (let i = 1; i < args.length; i++) {
|
|
6358
|
+
if (args[i] === "--started-by") {
|
|
6359
|
+
startedBy = args[++i];
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
const {
|
|
6363
|
+
credentials
|
|
6364
|
+
} = await authAndSetupMachineIfNeeded();
|
|
6365
|
+
await runCCR({ credentials, startedBy });
|
|
6366
|
+
} catch (error) {
|
|
6367
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
6368
|
+
if (process.env.DEBUG) {
|
|
6369
|
+
console.error(error);
|
|
6370
|
+
}
|
|
6371
|
+
process.exit(1);
|
|
6372
|
+
}
|
|
6373
|
+
return;
|
|
5919
6374
|
} else if (subcommand === "logout") {
|
|
5920
6375
|
console.log(chalk.yellow('Note: "happy logout" is deprecated. Use "happy auth logout" instead.\n'));
|
|
5921
6376
|
try {
|
|
@@ -5996,7 +6451,27 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
5996
6451
|
await stopDaemon();
|
|
5997
6452
|
process.exit(0);
|
|
5998
6453
|
} else if (daemonSubcommand === "status") {
|
|
5999
|
-
|
|
6454
|
+
try {
|
|
6455
|
+
let statusModule;
|
|
6456
|
+
switch (process.platform) {
|
|
6457
|
+
case "darwin":
|
|
6458
|
+
statusModule = await Promise.resolve().then(function () { return require('./status-DChMScEv.cjs'); });
|
|
6459
|
+
break;
|
|
6460
|
+
case "win32":
|
|
6461
|
+
statusModule = await Promise.resolve().then(function () { return require('./status-a3Xws-4m.cjs'); });
|
|
6462
|
+
break;
|
|
6463
|
+
case "linux":
|
|
6464
|
+
statusModule = await Promise.resolve().then(function () { return require('./status-CXWZdbyc.cjs'); });
|
|
6465
|
+
break;
|
|
6466
|
+
default:
|
|
6467
|
+
console.error(chalk.red(`Status command not supported on platform: ${process.platform}`));
|
|
6468
|
+
process.exit(1);
|
|
6469
|
+
}
|
|
6470
|
+
await statusModule.status();
|
|
6471
|
+
} catch (error) {
|
|
6472
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
6473
|
+
process.exit(1);
|
|
6474
|
+
}
|
|
6000
6475
|
process.exit(0);
|
|
6001
6476
|
} else if (daemonSubcommand === "logs") {
|
|
6002
6477
|
const latest = await types.getLatestDaemonLog();
|
|
@@ -6211,6 +6686,7 @@ exports.hashObject = hashObject;
|
|
|
6211
6686
|
exports.initialMachineMetadata = initialMachineMetadata;
|
|
6212
6687
|
exports.notifyDaemonSessionStarted = notifyDaemonSessionStarted;
|
|
6213
6688
|
exports.registerKillSessionHandler = registerKillSessionHandler;
|
|
6689
|
+
exports.runClaude = runClaude;
|
|
6214
6690
|
exports.startZenfloServer = startZenfloServer;
|
|
6215
6691
|
exports.stopCaffeinate = stopCaffeinate;
|
|
6216
6692
|
exports.trimIdent = trimIdent;
|