zenflo 0.11.8 → 0.11.9

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.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-DXM6ppoL.cjs');
5
- require('./types-uaIx8ab0.cjs');
4
+ require('./index-GoBFTs9u.cjs');
5
+ require('./types-BNjAQcO4.cjs');
6
6
  require('zod');
7
7
  require('node:child_process');
8
8
  require('node:os');
@@ -35,7 +35,7 @@ require('fastify-type-provider-zod');
35
35
  require('@modelcontextprotocol/sdk/server/mcp.js');
36
36
  require('node:http');
37
37
  require('@modelcontextprotocol/sdk/server/streamableHttp.js');
38
+ require('url');
38
39
  require('http');
39
40
  require('util');
40
- require('url');
41
41
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'chalk';
2
- import './index-BSKmq2tY.mjs';
3
- import './types-qQzfAnur.mjs';
2
+ import './index-CE4K-X3c.mjs';
3
+ import './types-CTT5Uja5.mjs';
4
4
  import 'zod';
5
5
  import 'node:child_process';
6
6
  import 'node:os';
@@ -33,6 +33,6 @@ import 'fastify-type-provider-zod';
33
33
  import '@modelcontextprotocol/sdk/server/mcp.js';
34
34
  import 'node:http';
35
35
  import '@modelcontextprotocol/sdk/server/streamableHttp.js';
36
+ import 'url';
36
37
  import 'http';
37
38
  import 'util';
38
- import 'url';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var types = require('./types-uaIx8ab0.cjs');
3
+ var types = require('./types-BNjAQcO4.cjs');
4
4
  require('axios');
5
5
  require('chalk');
6
6
  require('fs');
package/dist/lib.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-qQzfAnur.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-CTT5Uja5.mjs';
2
2
  import 'axios';
3
3
  import 'chalk';
4
4
  import 'fs';
@@ -0,0 +1,101 @@
1
+ import { r as runClaude } from './index-CE4K-X3c.mjs';
2
+ import { l as logger } from './types-CTT5Uja5.mjs';
3
+ import { execSync } from 'node:child_process';
4
+ import 'chalk';
5
+ import 'node:os';
6
+ import 'node:crypto';
7
+ import 'node:path';
8
+ import 'node:readline';
9
+ import 'node:fs';
10
+ import 'node:fs/promises';
11
+ import 'fs/promises';
12
+ import 'ink';
13
+ import 'react';
14
+ import 'node:url';
15
+ import 'axios';
16
+ import 'node:events';
17
+ import 'socket.io-client';
18
+ import 'tweetnacl';
19
+ import 'expo-server-sdk';
20
+ import 'crypto';
21
+ import 'child_process';
22
+ import 'fs';
23
+ import 'path';
24
+ import 'ps-list';
25
+ import 'cross-spawn';
26
+ import 'os';
27
+ import 'tmp';
28
+ import 'qrcode-terminal';
29
+ import 'open';
30
+ import 'fastify';
31
+ import 'zod';
32
+ import 'fastify-type-provider-zod';
33
+ import '@modelcontextprotocol/sdk/server/mcp.js';
34
+ import 'node:http';
35
+ import '@modelcontextprotocol/sdk/server/streamableHttp.js';
36
+ import 'url';
37
+ import 'http';
38
+ import 'util';
39
+
40
+ async function runCCR(opts) {
41
+ logger.debug(`[ccr] Starting CCR mode with options: startedBy=${opts.startedBy || "terminal"}`);
42
+ try {
43
+ execSync("which ccr", { stdio: "pipe" });
44
+ } catch (err) {
45
+ console.error("\u274C Claude Code Router (ccr) not found!");
46
+ console.error("");
47
+ console.error("Please install CCR first:");
48
+ console.error(" npm install -g @musistudio/claude-code-router");
49
+ console.error("");
50
+ console.error("Or configure the local installation at:");
51
+ console.error(" /Users/quinnmay/claude-code-router");
52
+ process.exit(1);
53
+ }
54
+ try {
55
+ const status = execSync("ccr status", { encoding: "utf8", stdio: "pipe" });
56
+ if (!status.includes("Running")) {
57
+ logger.debug("[ccr] Starting CCR service...");
58
+ console.log("\u{1F680} Starting Claude Code Router...");
59
+ execSync("ccr start", { stdio: "inherit" });
60
+ const startTime = Date.now();
61
+ const maxWait = 1e4;
62
+ while (Date.now() - startTime < maxWait) {
63
+ try {
64
+ const check = execSync("ccr status", { encoding: "utf8", stdio: "pipe" });
65
+ if (check.includes("Running")) {
66
+ logger.debug("[ccr] CCR service started successfully");
67
+ console.log("\u2705 Claude Code Router is ready");
68
+ break;
69
+ }
70
+ } catch (e) {
71
+ }
72
+ execSync("sleep 0.1", { stdio: "ignore" });
73
+ }
74
+ } else {
75
+ logger.debug("[ccr] CCR service is already running");
76
+ }
77
+ } catch (err) {
78
+ console.error("\u274C Failed to start CCR service");
79
+ console.error("Error:", err instanceof Error ? err.message : String(err));
80
+ process.exit(1);
81
+ }
82
+ const claudeEnvVars = {
83
+ ANTHROPIC_BASE_URL: "http://localhost:3456",
84
+ ANTHROPIC_API_KEY: "ccr-proxy-key"
85
+ // Any value works - CCR handles auth
86
+ };
87
+ logger.debug("[ccr] Environment configured:");
88
+ logger.debug(`[ccr] ANTHROPIC_BASE_URL=${claudeEnvVars.ANTHROPIC_BASE_URL}`);
89
+ logger.debug("[ccr] ANTHROPIC_API_KEY=ccr-proxy-key (placeholder)");
90
+ const startOptions = {
91
+ claudeEnvVars,
92
+ startedBy: opts.startedBy,
93
+ flavor: "ccr"
94
+ // Mark this session as CCR flavor
95
+ };
96
+ logger.debug("[ccr] Launching Claude Code with CCR routing...");
97
+ console.log("\u{1F3AF} Launching Claude Code with Z.ai GLM via CCR...");
98
+ await runClaude(opts.credentials, startOptions);
99
+ }
100
+
101
+ export { runCCR };
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-GoBFTs9u.cjs');
4
+ var types = require('./types-BNjAQcO4.cjs');
5
+ var node_child_process = require('node:child_process');
6
+ require('chalk');
7
+ require('node:os');
8
+ require('node:crypto');
9
+ require('node:path');
10
+ require('node:readline');
11
+ require('node:fs');
12
+ require('node:fs/promises');
13
+ require('fs/promises');
14
+ require('ink');
15
+ require('react');
16
+ require('node:url');
17
+ require('axios');
18
+ require('node:events');
19
+ require('socket.io-client');
20
+ require('tweetnacl');
21
+ require('expo-server-sdk');
22
+ require('crypto');
23
+ require('child_process');
24
+ require('fs');
25
+ require('path');
26
+ require('ps-list');
27
+ require('cross-spawn');
28
+ require('os');
29
+ require('tmp');
30
+ require('qrcode-terminal');
31
+ require('open');
32
+ require('fastify');
33
+ require('zod');
34
+ require('fastify-type-provider-zod');
35
+ require('@modelcontextprotocol/sdk/server/mcp.js');
36
+ require('node:http');
37
+ require('@modelcontextprotocol/sdk/server/streamableHttp.js');
38
+ require('url');
39
+ require('http');
40
+ require('util');
41
+
42
+ async function runCCR(opts) {
43
+ types.logger.debug(`[ccr] Starting CCR mode with options: startedBy=${opts.startedBy || "terminal"}`);
44
+ try {
45
+ node_child_process.execSync("which ccr", { stdio: "pipe" });
46
+ } catch (err) {
47
+ console.error("\u274C Claude Code Router (ccr) not found!");
48
+ console.error("");
49
+ console.error("Please install CCR first:");
50
+ console.error(" npm install -g @musistudio/claude-code-router");
51
+ console.error("");
52
+ console.error("Or configure the local installation at:");
53
+ console.error(" /Users/quinnmay/claude-code-router");
54
+ process.exit(1);
55
+ }
56
+ try {
57
+ const status = node_child_process.execSync("ccr status", { encoding: "utf8", stdio: "pipe" });
58
+ if (!status.includes("Running")) {
59
+ types.logger.debug("[ccr] Starting CCR service...");
60
+ console.log("\u{1F680} Starting Claude Code Router...");
61
+ node_child_process.execSync("ccr start", { stdio: "inherit" });
62
+ const startTime = Date.now();
63
+ const maxWait = 1e4;
64
+ while (Date.now() - startTime < maxWait) {
65
+ try {
66
+ const check = node_child_process.execSync("ccr status", { encoding: "utf8", stdio: "pipe" });
67
+ if (check.includes("Running")) {
68
+ types.logger.debug("[ccr] CCR service started successfully");
69
+ console.log("\u2705 Claude Code Router is ready");
70
+ break;
71
+ }
72
+ } catch (e) {
73
+ }
74
+ node_child_process.execSync("sleep 0.1", { stdio: "ignore" });
75
+ }
76
+ } else {
77
+ types.logger.debug("[ccr] CCR service is already running");
78
+ }
79
+ } catch (err) {
80
+ console.error("\u274C Failed to start CCR service");
81
+ console.error("Error:", err instanceof Error ? err.message : String(err));
82
+ process.exit(1);
83
+ }
84
+ const claudeEnvVars = {
85
+ ANTHROPIC_BASE_URL: "http://localhost:3456",
86
+ ANTHROPIC_API_KEY: "ccr-proxy-key"
87
+ // Any value works - CCR handles auth
88
+ };
89
+ types.logger.debug("[ccr] Environment configured:");
90
+ types.logger.debug(`[ccr] ANTHROPIC_BASE_URL=${claudeEnvVars.ANTHROPIC_BASE_URL}`);
91
+ types.logger.debug("[ccr] ANTHROPIC_API_KEY=ccr-proxy-key (placeholder)");
92
+ const startOptions = {
93
+ claudeEnvVars,
94
+ startedBy: opts.startedBy,
95
+ flavor: "ccr"
96
+ // Mark this session as CCR flavor
97
+ };
98
+ types.logger.debug("[ccr] Launching Claude Code with CCR routing...");
99
+ console.log("\u{1F3AF} Launching Claude Code with Z.ai GLM via CCR...");
100
+ await index.runClaude(opts.credentials, startOptions);
101
+ }
102
+
103
+ exports.runCCR = runCCR;
@@ -2,14 +2,14 @@
2
2
 
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
- var types = require('./types-uaIx8ab0.cjs');
5
+ var types = require('./types-BNjAQcO4.cjs');
6
6
  var index_js = require('@modelcontextprotocol/sdk/client/index.js');
7
7
  var stdio_js = require('@modelcontextprotocol/sdk/client/stdio.js');
8
8
  var z = require('zod');
9
9
  var types_js = require('@modelcontextprotocol/sdk/types.js');
10
10
  var child_process = require('child_process');
11
11
  var node_crypto = require('node:crypto');
12
- var index = require('./index-DXM6ppoL.cjs');
12
+ var index = require('./index-GoBFTs9u.cjs');
13
13
  var os = require('node:os');
14
14
  var node_path = require('node:path');
15
15
  var fs = require('node:fs');
@@ -1,13 +1,13 @@
1
1
  import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
- import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, b as packageJson } from './types-qQzfAnur.mjs';
3
+ import { l as logger, A as ApiClient, b as readSettings, p as projectPath, c as configuration, d as packageJson } from './types-CTT5Uja5.mjs';
4
4
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
5
5
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
6
6
  import { z } from 'zod';
7
7
  import { ElicitRequestSchema } from '@modelcontextprotocol/sdk/types.js';
8
8
  import { execSync } from 'child_process';
9
9
  import { randomUUID } from 'node:crypto';
10
- import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler, a as MessageBuffer, s as startZenfloServer, t as trimIdent, b as stopCaffeinate } from './index-BSKmq2tY.mjs';
10
+ import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, a as registerKillSessionHandler, b as MessageBuffer, s as startZenfloServer, t as trimIdent, c as stopCaffeinate } from './index-CE4K-X3c.mjs';
11
11
  import os from 'node:os';
12
12
  import { resolve, join } from 'node:path';
13
13
  import fs from 'node:fs';
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var child_process = require('child_process');
5
+ var types = require('./types-BNjAQcO4.cjs');
6
+ var os = require('os');
7
+ var path = require('path');
8
+ var chalk = require('chalk');
9
+ require('axios');
10
+ require('node:fs');
11
+ require('node:os');
12
+ require('node:path');
13
+ require('node:fs/promises');
14
+ require('zod');
15
+ require('node:crypto');
16
+ require('tweetnacl');
17
+ require('node:events');
18
+ require('socket.io-client');
19
+ require('util');
20
+ require('fs/promises');
21
+ require('crypto');
22
+ require('url');
23
+ require('expo-server-sdk');
24
+
25
+ const SERVICE_NAME = "zenflo-daemon";
26
+ const SYSTEMD_USER_DIR = path.join(os.homedir(), ".config", "systemd", "user");
27
+ const SERVICE_FILE = path.join(SYSTEMD_USER_DIR, `${SERVICE_NAME}.service`);
28
+ async function status() {
29
+ try {
30
+ console.log(chalk.cyan.bold("\u{1F50D} ZenFlo Daemon Status\n"));
31
+ const isServiceInstalled = fs.existsSync(SERVICE_FILE);
32
+ let serviceStatus = "Unknown";
33
+ let isServiceRunning = false;
34
+ if (isServiceInstalled) {
35
+ try {
36
+ const output = child_process.execSync(`systemctl --user is-active ${SERVICE_NAME}`, {
37
+ encoding: "utf-8",
38
+ stdio: "pipe"
39
+ }).trim();
40
+ serviceStatus = output;
41
+ isServiceRunning = output === "active";
42
+ } catch (error) {
43
+ serviceStatus = "inactive";
44
+ }
45
+ }
46
+ const daemonState = await types.readDaemonState();
47
+ let mode;
48
+ if (isServiceInstalled) {
49
+ mode = "systemd";
50
+ } else if (daemonState?.pid) {
51
+ mode = "autostart";
52
+ } else {
53
+ mode = "none";
54
+ }
55
+ console.log(chalk.white.bold("Configuration:"));
56
+ if (mode === "systemd") {
57
+ console.log(chalk.green(" \u2713 systemd Service: Installed"));
58
+ console.log(chalk.dim(` Service Status: ${serviceStatus}`));
59
+ console.log(chalk.dim(" Runs automatically at login"));
60
+ } else {
61
+ console.log(chalk.dim(" \u25CB systemd Service: Not installed"));
62
+ console.log(chalk.dim(" Using auto-start mode (starts with zenflo command)"));
63
+ }
64
+ console.log("");
65
+ console.log(chalk.white.bold("Daemon Status:"));
66
+ if (daemonState?.pid) {
67
+ console.log(chalk.green(" \u2713 Running"));
68
+ console.log(chalk.dim(` PID: ${daemonState.pid}`));
69
+ if (daemonState.httpPort) {
70
+ console.log(chalk.dim(` Port: ${daemonState.httpPort}`));
71
+ }
72
+ if (daemonState.startTime) {
73
+ const uptime = Math.floor((Date.now() - new Date(daemonState.startTime).getTime()) / 1e3 / 60);
74
+ console.log(chalk.dim(` Uptime: ${uptime} minutes`));
75
+ }
76
+ } else {
77
+ console.log(chalk.yellow(" \u25CB Not running"));
78
+ console.log(chalk.dim(" Start with: zenflo"));
79
+ }
80
+ console.log("");
81
+ console.log(chalk.white.bold("Available Commands:"));
82
+ if (mode === "systemd") {
83
+ console.log(chalk.dim(" \u2022 Check service: ") + chalk.white(`systemctl --user status ${SERVICE_NAME}`));
84
+ console.log(chalk.dim(" \u2022 View logs: ") + chalk.white(`journalctl --user -u ${SERVICE_NAME} -f`));
85
+ console.log(chalk.dim(" \u2022 Stop service: ") + chalk.white(`systemctl --user stop ${SERVICE_NAME}`));
86
+ console.log(chalk.dim(" \u2022 Start service: ") + chalk.white(`systemctl --user start ${SERVICE_NAME}`));
87
+ console.log(chalk.dim(" \u2022 Restart: ") + chalk.white(`systemctl --user restart ${SERVICE_NAME}`));
88
+ console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall"));
89
+ } else {
90
+ console.log(chalk.dim(" \u2022 Install as service: ") + chalk.white("zenflo daemon install"));
91
+ console.log(chalk.dim(" \u2022 Start daemon: ") + chalk.white("zenflo"));
92
+ }
93
+ console.log("");
94
+ } catch (error) {
95
+ console.error(chalk.red("\u274C Status check failed:"), error instanceof Error ? error.message : error);
96
+ types.logger.debug("Failed to check daemon status:", error);
97
+ throw error;
98
+ }
99
+ }
100
+
101
+ exports.status = status;
@@ -0,0 +1,104 @@
1
+ import { existsSync } from 'fs';
2
+ import { execSync } from 'child_process';
3
+ import os from 'os';
4
+ import path from 'path';
5
+ import chalk from 'chalk';
6
+ import { r as readDaemonState } from './types-CTT5Uja5.mjs';
7
+ import 'axios';
8
+ import 'node:fs';
9
+ import 'node:os';
10
+ import 'node:path';
11
+ import 'node:fs/promises';
12
+ import 'zod';
13
+ import 'node:crypto';
14
+ import 'tweetnacl';
15
+ import 'node:events';
16
+ import 'socket.io-client';
17
+ import 'util';
18
+ import 'fs/promises';
19
+ import 'crypto';
20
+ import 'url';
21
+ import 'expo-server-sdk';
22
+
23
+ const PLIST_LABEL = "com.zenflo.daemon";
24
+ const LAUNCH_AGENTS_DIR = path.join(os.homedir(), "Library", "LaunchAgents");
25
+ const PLIST_FILE = path.join(LAUNCH_AGENTS_DIR, `${PLIST_LABEL}.plist`);
26
+ async function status() {
27
+ console.log(chalk.cyan.bold("\u{1F4CA} ZenFlo Daemon Status\n"));
28
+ const isLaunchAgentInstalled = existsSync(PLIST_FILE);
29
+ let isLaunchAgentLoaded = false;
30
+ if (isLaunchAgentInstalled) {
31
+ try {
32
+ const output = execSync("launchctl list", { encoding: "utf-8" });
33
+ isLaunchAgentLoaded = output.includes(PLIST_LABEL);
34
+ } catch (error) {
35
+ }
36
+ }
37
+ const daemonState = await readDaemonState();
38
+ const isDaemonRunning = daemonState !== null;
39
+ let mode;
40
+ if (isLaunchAgentInstalled && isLaunchAgentLoaded) {
41
+ mode = "launchagent";
42
+ } else if (isDaemonRunning) {
43
+ mode = "autostart";
44
+ } else {
45
+ mode = "none";
46
+ }
47
+ if (mode === "launchagent") {
48
+ console.log(chalk.green("\u2705 LaunchAgent Mode") + chalk.dim(" (installed & loaded)\n"));
49
+ console.log(chalk.cyan("Configuration:"));
50
+ console.log(chalk.dim(" \u2022 Mode: ") + chalk.white("LaunchAgent"));
51
+ console.log(chalk.dim(" \u2022 Location: ") + chalk.white(PLIST_FILE));
52
+ console.log(chalk.dim(" \u2022 Auto-start: ") + chalk.green("Yes") + chalk.dim(" (at login)"));
53
+ console.log(chalk.dim(" \u2022 System integration: ") + chalk.green("Enabled"));
54
+ if (isDaemonRunning && daemonState) {
55
+ console.log(chalk.dim(" \u2022 Status: ") + chalk.green("Running"));
56
+ console.log(chalk.dim(" \u2022 PID: ") + chalk.white(daemonState.pid.toString()));
57
+ console.log(chalk.dim(" \u2022 HTTP Port: ") + chalk.white(daemonState.httpPort.toString()));
58
+ console.log(chalk.dim(" \u2022 Started: ") + chalk.white(daemonState.startTime));
59
+ if (daemonState.lastHeartbeat) {
60
+ console.log(chalk.dim(" \u2022 Last heartbeat: ") + chalk.white(daemonState.lastHeartbeat));
61
+ }
62
+ } else {
63
+ console.log(chalk.dim(" \u2022 Status: ") + chalk.yellow("Not running"));
64
+ }
65
+ } else if (mode === "autostart") {
66
+ console.log(chalk.green("\u2705 Auto-Start Mode") + chalk.dim(" (default)\n"));
67
+ console.log(chalk.cyan("Configuration:"));
68
+ console.log(chalk.dim(" \u2022 Mode: ") + chalk.white("Auto-Start"));
69
+ console.log(chalk.dim(" \u2022 Auto-start: ") + chalk.green("Yes") + chalk.dim(" (when running zenflo)"));
70
+ console.log(chalk.dim(" \u2022 System integration: ") + chalk.yellow("Limited"));
71
+ if (daemonState) {
72
+ console.log(chalk.dim(" \u2022 Status: ") + chalk.green("Running"));
73
+ console.log(chalk.dim(" \u2022 PID: ") + chalk.white(daemonState.pid.toString()));
74
+ console.log(chalk.dim(" \u2022 HTTP Port: ") + chalk.white(daemonState.httpPort.toString()));
75
+ console.log(chalk.dim(" \u2022 Started: ") + chalk.white(daemonState.startTime));
76
+ if (daemonState.lastHeartbeat) {
77
+ console.log(chalk.dim(" \u2022 Last heartbeat: ") + chalk.white(daemonState.lastHeartbeat));
78
+ }
79
+ }
80
+ } else {
81
+ console.log(chalk.yellow("\u26A0\uFE0F Daemon Not Running\n"));
82
+ console.log(chalk.cyan("Configuration:"));
83
+ console.log(chalk.dim(" \u2022 LaunchAgent: ") + chalk.red("Not installed"));
84
+ console.log(chalk.dim(" \u2022 Daemon: ") + chalk.red("Not running"));
85
+ console.log(chalk.dim(" \u2022 Mode: ") + chalk.white("Auto-Start") + chalk.dim(" (will start when you run zenflo)"));
86
+ }
87
+ console.log("\n" + chalk.cyan("Available Commands:"));
88
+ if (mode === "launchagent") {
89
+ console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall"));
90
+ console.log(chalk.dim(" \u2022 Stop daemon: ") + chalk.white("zenflo daemon stop"));
91
+ console.log(chalk.dim(" \u2022 View logs: ") + chalk.white("tail -f ~/.zenflo/daemon.log"));
92
+ } else if (mode === "autostart") {
93
+ console.log(chalk.dim(" \u2022 Install LaunchAgent: ") + chalk.white("zenflo daemon install"));
94
+ console.log(chalk.dim(" \u2022 Stop daemon: ") + chalk.white("zenflo daemon stop"));
95
+ console.log(chalk.dim(" \u2022 View logs: ") + chalk.white("tail -f ~/.zenflo/daemon.log"));
96
+ } else {
97
+ console.log(chalk.dim(" \u2022 Install LaunchAgent: ") + chalk.white("zenflo daemon install"));
98
+ console.log(chalk.dim(" \u2022 Start daemon manually: ") + chalk.white("zenflo daemon start"));
99
+ console.log(chalk.dim(" \u2022 Run ZenFlo: ") + chalk.white("zenflo"));
100
+ }
101
+ console.log("");
102
+ }
103
+
104
+ export { status };
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ var child_process = require('child_process');
4
+ var types = require('./types-BNjAQcO4.cjs');
5
+ var chalk = require('chalk');
6
+ require('axios');
7
+ require('fs');
8
+ require('node:fs');
9
+ require('node:os');
10
+ require('node:path');
11
+ require('node:fs/promises');
12
+ require('zod');
13
+ require('node:crypto');
14
+ require('tweetnacl');
15
+ require('node:events');
16
+ require('socket.io-client');
17
+ require('util');
18
+ require('fs/promises');
19
+ require('crypto');
20
+ require('path');
21
+ require('url');
22
+ require('os');
23
+ require('expo-server-sdk');
24
+
25
+ const TASK_NAME = "ZenFlo Daemon";
26
+ async function status() {
27
+ try {
28
+ console.log(chalk.cyan.bold("\u{1F50D} ZenFlo Daemon Status\n"));
29
+ let isTaskInstalled = false;
30
+ let taskStatus = "Unknown";
31
+ try {
32
+ const output = child_process.execSync(`schtasks /Query /TN "${TASK_NAME}" /FO LIST /V`, { encoding: "utf-8" });
33
+ isTaskInstalled = true;
34
+ const statusMatch = output.match(/Status:\s+(.+)/);
35
+ if (statusMatch) {
36
+ taskStatus = statusMatch[1].trim();
37
+ }
38
+ } catch (error) {
39
+ isTaskInstalled = false;
40
+ }
41
+ const daemonState = await types.readDaemonState();
42
+ let mode;
43
+ if (isTaskInstalled) {
44
+ mode = "task";
45
+ } else if (daemonState?.pid) {
46
+ mode = "autostart";
47
+ } else {
48
+ mode = "none";
49
+ }
50
+ console.log(chalk.white.bold("Configuration:"));
51
+ if (mode === "task") {
52
+ console.log(chalk.green(" \u2713 Task Scheduler: Installed"));
53
+ console.log(chalk.dim(` Task Status: ${taskStatus}`));
54
+ console.log(chalk.dim(" Runs automatically at login"));
55
+ } else {
56
+ console.log(chalk.dim(" \u25CB Task Scheduler: Not installed"));
57
+ console.log(chalk.dim(" Using auto-start mode (starts with zenflo command)"));
58
+ }
59
+ console.log("");
60
+ console.log(chalk.white.bold("Daemon Status:"));
61
+ if (daemonState?.pid) {
62
+ console.log(chalk.green(" \u2713 Running"));
63
+ console.log(chalk.dim(` PID: ${daemonState.pid}`));
64
+ if (daemonState.httpPort) {
65
+ console.log(chalk.dim(` Port: ${daemonState.httpPort}`));
66
+ }
67
+ if (daemonState.startTime) {
68
+ const uptime = Math.floor((Date.now() - new Date(daemonState.startTime).getTime()) / 1e3 / 60);
69
+ console.log(chalk.dim(` Uptime: ${uptime} minutes`));
70
+ }
71
+ } else {
72
+ console.log(chalk.yellow(" \u25CB Not running"));
73
+ console.log(chalk.dim(" Start with: zenflo"));
74
+ }
75
+ console.log("");
76
+ console.log(chalk.white.bold("Available Commands:"));
77
+ if (mode === "task") {
78
+ console.log(chalk.dim(" \u2022 View in Task Scheduler: ") + chalk.white("taskschd.msc"));
79
+ console.log(chalk.dim(" \u2022 Stop task: ") + chalk.white(`schtasks /End /TN "${TASK_NAME}"`));
80
+ console.log(chalk.dim(" \u2022 Start task: ") + chalk.white(`schtasks /Run /TN "${TASK_NAME}"`));
81
+ console.log(chalk.dim(" \u2022 Uninstall: ") + chalk.white("zenflo daemon uninstall"));
82
+ } else {
83
+ console.log(chalk.dim(" \u2022 Install as task: ") + chalk.white("zenflo daemon install"));
84
+ console.log(chalk.dim(" \u2022 Start daemon: ") + chalk.white("zenflo"));
85
+ }
86
+ console.log("");
87
+ } catch (error) {
88
+ console.error(chalk.red("\u274C Status check failed:"), error instanceof Error ? error.message : error);
89
+ types.logger.debug("Failed to check daemon status:", error);
90
+ throw error;
91
+ }
92
+ }
93
+
94
+ exports.status = status;