@ekkos/cli 1.3.1 → 1.3.5

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 (131) hide show
  1. package/dist/capture/jsonl-rewriter.d.ts +1 -1
  2. package/dist/capture/jsonl-rewriter.js +3 -3
  3. package/dist/capture/transcript-repair.d.ts +2 -2
  4. package/dist/capture/transcript-repair.js +2 -2
  5. package/dist/commands/claw.d.ts +13 -0
  6. package/dist/commands/claw.js +253 -0
  7. package/dist/commands/dashboard.js +742 -118
  8. package/dist/commands/doctor.d.ts +3 -3
  9. package/dist/commands/doctor.js +6 -79
  10. package/dist/commands/gemini.d.ts +19 -0
  11. package/dist/commands/gemini.js +193 -0
  12. package/dist/commands/init.d.ts +1 -0
  13. package/dist/commands/init.js +56 -41
  14. package/dist/commands/run.d.ts +0 -1
  15. package/dist/commands/run.js +288 -263
  16. package/dist/commands/scan.d.ts +21 -0
  17. package/dist/commands/scan.js +386 -0
  18. package/dist/commands/status.d.ts +4 -1
  19. package/dist/commands/status.js +165 -27
  20. package/dist/commands/swarm-dashboard.js +156 -28
  21. package/dist/commands/swarm.d.ts +1 -1
  22. package/dist/commands/swarm.js +1 -1
  23. package/dist/commands/test-claude.d.ts +2 -2
  24. package/dist/commands/test-claude.js +3 -3
  25. package/dist/deploy/index.d.ts +0 -2
  26. package/dist/deploy/index.js +0 -2
  27. package/dist/deploy/settings.d.ts +6 -5
  28. package/dist/deploy/settings.js +64 -16
  29. package/dist/deploy/skills.js +1 -2
  30. package/dist/index.js +86 -96
  31. package/dist/lib/usage-parser.d.ts +1 -1
  32. package/dist/lib/usage-parser.js +9 -6
  33. package/dist/local/index.d.ts +14 -0
  34. package/dist/local/index.js +28 -0
  35. package/dist/local/local-embeddings.d.ts +49 -0
  36. package/dist/local/local-embeddings.js +232 -0
  37. package/dist/local/offline-fallback.d.ts +44 -0
  38. package/dist/local/offline-fallback.js +159 -0
  39. package/dist/local/sqlite-store.d.ts +126 -0
  40. package/dist/local/sqlite-store.js +393 -0
  41. package/dist/local/sync-engine.d.ts +42 -0
  42. package/dist/local/sync-engine.js +223 -0
  43. package/dist/utils/platform.d.ts +5 -1
  44. package/dist/utils/platform.js +24 -4
  45. package/dist/utils/proxy-url.d.ts +21 -0
  46. package/dist/utils/proxy-url.js +34 -0
  47. package/dist/utils/state.d.ts +1 -1
  48. package/dist/utils/state.js +11 -3
  49. package/dist/utils/templates.js +1 -1
  50. package/package.json +11 -4
  51. package/templates/CLAUDE.md +49 -107
  52. package/dist/agent/daemon.d.ts +0 -130
  53. package/dist/agent/daemon.js +0 -606
  54. package/dist/agent/health-check.d.ts +0 -35
  55. package/dist/agent/health-check.js +0 -243
  56. package/dist/agent/pty-runner.d.ts +0 -53
  57. package/dist/agent/pty-runner.js +0 -190
  58. package/dist/commands/agent.d.ts +0 -50
  59. package/dist/commands/agent.js +0 -544
  60. package/dist/commands/setup-remote.d.ts +0 -20
  61. package/dist/commands/setup-remote.js +0 -582
  62. package/dist/utils/verify-remote-terminal.d.ts +0 -10
  63. package/dist/utils/verify-remote-terminal.js +0 -415
  64. package/templates/README.md +0 -378
  65. package/templates/claude-plugins/PHASE2_COMPLETION.md +0 -346
  66. package/templates/claude-plugins/PLUGIN_PROPOSALS.md +0 -1776
  67. package/templates/claude-plugins/README.md +0 -587
  68. package/templates/claude-plugins/agents/code-reviewer.json +0 -14
  69. package/templates/claude-plugins/agents/debug-detective.json +0 -15
  70. package/templates/claude-plugins/agents/git-companion.json +0 -14
  71. package/templates/claude-plugins/blog-manager/.claude-plugin/plugin.json +0 -8
  72. package/templates/claude-plugins/blog-manager/commands/blog.md +0 -691
  73. package/templates/claude-plugins/golden-loop-monitor/.claude-plugin/plugin.json +0 -8
  74. package/templates/claude-plugins/golden-loop-monitor/commands/loop-status.md +0 -434
  75. package/templates/claude-plugins/learning-tracker/.claude-plugin/plugin.json +0 -8
  76. package/templates/claude-plugins/learning-tracker/commands/my-patterns.md +0 -282
  77. package/templates/claude-plugins/memory-lens/.claude-plugin/plugin.json +0 -8
  78. package/templates/claude-plugins/memory-lens/commands/memory-search.md +0 -181
  79. package/templates/claude-plugins/pattern-coach/.claude-plugin/plugin.json +0 -8
  80. package/templates/claude-plugins/pattern-coach/commands/forge.md +0 -365
  81. package/templates/claude-plugins/project-schema-validator/.claude-plugin/plugin.json +0 -8
  82. package/templates/claude-plugins/project-schema-validator/commands/validate-schema.md +0 -582
  83. package/templates/claude-plugins-admin/AGENT_TEAM_PROPOSALS.md +0 -819
  84. package/templates/claude-plugins-admin/README.md +0 -446
  85. package/templates/claude-plugins-admin/autonomous-admin-agent/.claude-plugin/plugin.json +0 -8
  86. package/templates/claude-plugins-admin/autonomous-admin-agent/commands/agent.md +0 -595
  87. package/templates/claude-plugins-admin/backend-agent/.claude-plugin/plugin.json +0 -8
  88. package/templates/claude-plugins-admin/backend-agent/commands/backend.md +0 -798
  89. package/templates/claude-plugins-admin/deploy-guardian/.claude-plugin/plugin.json +0 -8
  90. package/templates/claude-plugins-admin/deploy-guardian/commands/deploy.md +0 -554
  91. package/templates/claude-plugins-admin/frontend-agent/.claude-plugin/plugin.json +0 -8
  92. package/templates/claude-plugins-admin/frontend-agent/commands/frontend.md +0 -881
  93. package/templates/claude-plugins-admin/mcp-server-manager/.claude-plugin/plugin.json +0 -8
  94. package/templates/claude-plugins-admin/mcp-server-manager/commands/mcp.md +0 -85
  95. package/templates/claude-plugins-admin/memory-system-monitor/.claude-plugin/plugin.json +0 -8
  96. package/templates/claude-plugins-admin/memory-system-monitor/commands/memory-health.md +0 -569
  97. package/templates/claude-plugins-admin/qa-agent/.claude-plugin/plugin.json +0 -8
  98. package/templates/claude-plugins-admin/qa-agent/commands/qa.md +0 -863
  99. package/templates/claude-plugins-admin/tech-lead-agent/.claude-plugin/plugin.json +0 -8
  100. package/templates/claude-plugins-admin/tech-lead-agent/commands/lead.md +0 -732
  101. package/templates/commands/continue.md +0 -47
  102. package/templates/cursor-rules/ekkos-memory.md +0 -127
  103. package/templates/ekkos-manifest.json +0 -223
  104. package/templates/helpers/json-parse.cjs +0 -101
  105. package/templates/hooks-node/lib/state.js +0 -187
  106. package/templates/hooks-node/stop.js +0 -416
  107. package/templates/hooks-node/user-prompt-submit.js +0 -337
  108. package/templates/plan-template.md +0 -306
  109. package/templates/rules/00-hooks-contract.mdc +0 -89
  110. package/templates/rules/30-ekkos-core.mdc +0 -188
  111. package/templates/rules/31-ekkos-messages.mdc +0 -78
  112. package/templates/shared/hooks-enabled.json +0 -22
  113. package/templates/shared/session-words.json +0 -45
  114. package/templates/skills/ekkOS_Deep_Recall/Skill.md +0 -282
  115. package/templates/skills/ekkOS_Learn/Skill.md +0 -265
  116. package/templates/skills/ekkOS_Memory_First/Skill.md +0 -206
  117. package/templates/skills/ekkOS_Plan_Assist/Skill.md +0 -302
  118. package/templates/skills/ekkOS_Preferences/Skill.md +0 -247
  119. package/templates/skills/ekkOS_Reflect/Skill.md +0 -257
  120. package/templates/skills/ekkOS_Safety/Skill.md +0 -265
  121. package/templates/skills/ekkOS_Schema/Skill.md +0 -251
  122. package/templates/skills/ekkOS_Summary/Skill.md +0 -257
  123. package/templates/spec-template.md +0 -159
  124. package/templates/windsurf-rules/ekkos-memory.md +0 -127
  125. package/templates/windsurf-skills/README.md +0 -58
  126. package/templates/windsurf-skills/ekkos-continue/SKILL.md +0 -81
  127. package/templates/windsurf-skills/ekkos-golden-loop/SKILL.md +0 -225
  128. package/templates/windsurf-skills/ekkos-insights/SKILL.md +0 -138
  129. package/templates/windsurf-skills/ekkos-recall/SKILL.md +0 -96
  130. package/templates/windsurf-skills/ekkos-safety/SKILL.md +0 -89
  131. package/templates/windsurf-skills/ekkos-vault/SKILL.md +0 -86
@@ -1,243 +0,0 @@
1
- "use strict";
2
- /**
3
- * Health check for ekkOS agent daemon
4
- *
5
- * Verifies:
6
- * - Service is installed and loaded
7
- * - Process is running
8
- * - Recent activity in logs
9
- * - Network connectivity to relay server
10
- */
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || (function () {
28
- var ownKeys = function(o) {
29
- ownKeys = Object.getOwnPropertyNames || function (o) {
30
- var ar = [];
31
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
- return ar;
33
- };
34
- return ownKeys(o);
35
- };
36
- return function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
- __setModuleDefault(result, mod);
41
- return result;
42
- };
43
- })();
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.checkDaemonHealth = checkDaemonHealth;
49
- exports.formatHealthStatus = formatHealthStatus;
50
- const os = __importStar(require("os"));
51
- const fs = __importStar(require("fs"));
52
- const path = __importStar(require("path"));
53
- const child_process_1 = require("child_process");
54
- const ws_1 = __importDefault(require("ws"));
55
- const RELAY_URL = process.env.RELAY_WS_URL || 'wss://ekkos-relay-production.up.railway.app';
56
- /**
57
- * Check agent daemon health
58
- */
59
- async function checkDaemonHealth() {
60
- const status = {
61
- ok: true,
62
- service: {
63
- installed: false,
64
- loaded: false,
65
- running: false,
66
- },
67
- logs: {
68
- recentErrors: [],
69
- },
70
- relay: {
71
- reachable: false,
72
- },
73
- };
74
- // Check if service is installed
75
- const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', 'dev.ekkos.agent.plist');
76
- status.service.installed = fs.existsSync(plistPath);
77
- // Check if service is loaded
78
- try {
79
- const output = (0, child_process_1.execSync)('launchctl list | grep dev.ekkos.agent', { encoding: 'utf-8' }).trim();
80
- status.service.loaded = !!output;
81
- // Extract PID if running
82
- const pidMatch = output.match(/^(\d+)\s+/);
83
- if (pidMatch) {
84
- status.service.pid = parseInt(pidMatch[1], 10);
85
- status.service.running = status.service.pid > 0;
86
- }
87
- }
88
- catch {
89
- // Service not loaded
90
- status.service.loaded = false;
91
- status.service.running = false;
92
- }
93
- // Check logs
94
- const logDir = path.join(os.homedir(), '.ekkos');
95
- const errLogPath = path.join(logDir, 'agent.err.log');
96
- const outLogPath = path.join(logDir, 'agent.out.log');
97
- if (fs.existsSync(errLogPath)) {
98
- try {
99
- const errLog = fs.readFileSync(errLogPath, 'utf-8');
100
- if (errLog) {
101
- status.logs.lastActivity = new Date(fs.statSync(errLogPath).mtime);
102
- status.logs.recentErrors = extractRecentErrors(errLog, 10);
103
- }
104
- }
105
- catch {
106
- // Ignore log read errors
107
- }
108
- }
109
- if (fs.existsSync(outLogPath)) {
110
- try {
111
- const stat = fs.statSync(outLogPath);
112
- const mtime = new Date(stat.mtime);
113
- if (!status.logs.lastActivity || mtime > status.logs.lastActivity) {
114
- status.logs.lastActivity = mtime;
115
- }
116
- }
117
- catch {
118
- // Ignore
119
- }
120
- }
121
- // Check relay connectivity
122
- try {
123
- status.relay.reachable = await checkRelayConnectivity();
124
- }
125
- catch (err) {
126
- status.relay.reachable = false;
127
- status.relay.lastError = err.message;
128
- }
129
- // Overall health
130
- status.ok = status.service.running && status.relay.reachable && status.logs.recentErrors.length === 0;
131
- return status;
132
- }
133
- /**
134
- * Check if relay server is reachable
135
- */
136
- async function checkRelayConnectivity() {
137
- return new Promise((resolve) => {
138
- const timeout = setTimeout(() => {
139
- ws.terminate();
140
- resolve(false);
141
- }, 5000);
142
- const ws = new ws_1.default(`${RELAY_URL}/health`);
143
- ws.on('open', () => {
144
- clearTimeout(timeout);
145
- ws.close();
146
- resolve(true);
147
- });
148
- ws.on('error', () => {
149
- clearTimeout(timeout);
150
- resolve(false);
151
- });
152
- ws.on('close', () => {
153
- clearTimeout(timeout);
154
- resolve(false);
155
- });
156
- });
157
- }
158
- /**
159
- * Extract recent error lines from log
160
- */
161
- function extractRecentErrors(log, count) {
162
- return log
163
- .split('\n')
164
- .filter((line) => {
165
- const lower = line.toLowerCase();
166
- return lower.includes('error') || lower.includes('failed') || lower.includes('exception');
167
- })
168
- .slice(-count);
169
- }
170
- /**
171
- * Format health status for console output
172
- */
173
- function formatHealthStatus(status) {
174
- const lines = [];
175
- lines.push('ekkOS Agent Daemon Health Check');
176
- lines.push('================================\n');
177
- // Service status
178
- lines.push(`Service Installation: ${status.service.installed ? '✓' : '✗'} ${status.service.installed ? 'Installed' : 'Not installed'}`);
179
- lines.push(`Service Loaded: ${status.service.loaded ? '✓' : '✗'} ${status.service.loaded ? 'Loaded' : 'Not loaded'}`);
180
- if (status.service.running) {
181
- lines.push(`Service Running: ✓ Running (PID ${status.service.pid})`);
182
- }
183
- else {
184
- lines.push('Service Running: ✗ Not running');
185
- }
186
- lines.push('');
187
- // Logs status
188
- if (status.logs.lastActivity) {
189
- const now = new Date();
190
- const age = now.getTime() - status.logs.lastActivity.getTime();
191
- const ageStr = formatAge(age);
192
- lines.push(`Last Activity: ${ageStr} ago (${status.logs.lastActivity.toISOString()})`);
193
- }
194
- else {
195
- lines.push('Last Activity: No logs found');
196
- }
197
- if (status.logs.recentErrors.length > 0) {
198
- lines.push(`Recent Errors (${status.logs.recentErrors.length}):`);
199
- for (const err of status.logs.recentErrors) {
200
- lines.push(` - ${err.substring(0, 100)}`);
201
- }
202
- }
203
- lines.push('');
204
- // Relay status
205
- lines.push(`Relay Server: ${status.relay.reachable ? '✓' : '✗'} ${status.relay.reachable ? 'Reachable' : 'Unreachable'}`);
206
- if (status.relay.lastError) {
207
- lines.push(` Error: ${status.relay.lastError}`);
208
- }
209
- lines.push('');
210
- // Overall status
211
- if (status.ok) {
212
- lines.push('Overall: ✓ Healthy - All systems operational');
213
- }
214
- else {
215
- lines.push('Overall: ✗ Unhealthy - Issues detected');
216
- if (!status.service.running) {
217
- lines.push(' → Service is not running. Run: launchctl start dev.ekkos.agent');
218
- }
219
- if (!status.relay.reachable) {
220
- lines.push(' → Cannot reach relay server. Check network connectivity.');
221
- }
222
- if (status.logs.recentErrors.length > 0) {
223
- lines.push(' → Recent errors found in logs. Check ~/.ekkos/agent.err.log');
224
- }
225
- }
226
- return lines.join('\n');
227
- }
228
- /**
229
- * Format age duration
230
- */
231
- function formatAge(ms) {
232
- const seconds = Math.floor(ms / 1000);
233
- const minutes = Math.floor(seconds / 60);
234
- const hours = Math.floor(minutes / 60);
235
- const days = Math.floor(hours / 24);
236
- if (days > 0)
237
- return `${days}d ${hours % 24}h`;
238
- if (hours > 0)
239
- return `${hours}h ${minutes % 60}m`;
240
- if (minutes > 0)
241
- return `${minutes}m ${seconds % 60}s`;
242
- return `${seconds}s`;
243
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * PTY Runner for ekkOS Agent
3
- *
4
- * Spawns `ekkos run -d` in a pseudoterminal and handles I/O.
5
- * Based on the PTY patterns from packages/ekkos-cli/src/commands/run.ts
6
- */
7
- interface PTYRunnerConfig {
8
- command: string;
9
- args: string[];
10
- onData: (data: string) => void;
11
- onExit: (code: number) => void;
12
- cols?: number;
13
- rows?: number;
14
- cwd?: string;
15
- env?: NodeJS.ProcessEnv;
16
- verbose?: boolean;
17
- }
18
- export declare class PTYRunner {
19
- private config;
20
- private ptyProcess;
21
- private spawnProcess;
22
- private usePty;
23
- constructor(config: PTYRunnerConfig);
24
- /**
25
- * Start the PTY process
26
- */
27
- start(): void;
28
- /**
29
- * Start using node-pty (preferred)
30
- */
31
- private startWithPty;
32
- /**
33
- * Start using spawn (fallback for Windows without PTY)
34
- */
35
- private startWithSpawn;
36
- /**
37
- * Write data to PTY stdin
38
- */
39
- write(data: string): void;
40
- /**
41
- * Resize PTY
42
- */
43
- resize(cols: number, rows: number): void;
44
- /**
45
- * Kill the PTY process
46
- */
47
- kill(): void;
48
- /**
49
- * Check if PTY is running
50
- */
51
- isRunning(): boolean;
52
- }
53
- export {};
@@ -1,190 +0,0 @@
1
- "use strict";
2
- /**
3
- * PTY Runner for ekkOS Agent
4
- *
5
- * Spawns `ekkos run -d` in a pseudoterminal and handles I/O.
6
- * Based on the PTY patterns from packages/ekkos-cli/src/commands/run.ts
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.PTYRunner = void 0;
43
- const os = __importStar(require("os"));
44
- const child_process_1 = require("child_process");
45
- // Try to load node-pty
46
- let pty = null;
47
- try {
48
- pty = require('node-pty');
49
- }
50
- catch {
51
- // node-pty not available, will use spawn fallback
52
- }
53
- class PTYRunner {
54
- constructor(config) {
55
- this.ptyProcess = null;
56
- this.spawnProcess = null;
57
- this.config = config;
58
- this.usePty = pty !== null;
59
- }
60
- /**
61
- * Start the PTY process
62
- */
63
- start() {
64
- if (this.usePty && pty) {
65
- this.startWithPty();
66
- }
67
- else {
68
- this.startWithSpawn();
69
- }
70
- }
71
- /**
72
- * Start using node-pty (preferred)
73
- */
74
- startWithPty() {
75
- if (!pty)
76
- return;
77
- const shell = os.platform() === 'win32' ? 'cmd.exe' : 'bash';
78
- const shellArgs = os.platform() === 'win32'
79
- ? ['/c', this.config.command, ...this.config.args]
80
- : ['-c', `${this.config.command} ${this.config.args.join(' ')}`];
81
- this.ptyProcess = pty.spawn(shell, shellArgs, {
82
- name: 'xterm-256color',
83
- cols: this.config.cols || 80,
84
- rows: this.config.rows || 24,
85
- cwd: this.config.cwd || process.cwd(),
86
- env: {
87
- ...process.env,
88
- ...(this.config.env || {}),
89
- TERM: 'xterm-256color',
90
- COLORTERM: 'truecolor',
91
- },
92
- });
93
- this.ptyProcess.onData((data) => {
94
- this.config.onData(data);
95
- });
96
- this.ptyProcess.onExit(({ exitCode }) => {
97
- this.config.onExit(exitCode);
98
- });
99
- }
100
- /**
101
- * Start using spawn (fallback for Windows without PTY)
102
- */
103
- startWithSpawn() {
104
- const isWindows = os.platform() === 'win32';
105
- const cwd = this.config.cwd || process.cwd();
106
- if (isWindows) {
107
- // Windows: Use cmd.exe
108
- this.spawnProcess = (0, child_process_1.spawn)('cmd.exe', ['/c', this.config.command, ...this.config.args], {
109
- stdio: ['pipe', 'pipe', 'pipe'],
110
- cwd,
111
- env: {
112
- ...process.env,
113
- ...(this.config.env || {}),
114
- },
115
- });
116
- }
117
- else {
118
- // Unix: Use script for PTY emulation
119
- const scriptArgs = os.platform() === 'darwin'
120
- ? ['-q', '/dev/null', this.config.command, ...this.config.args]
121
- : ['-q', '-c', `${this.config.command} ${this.config.args.join(' ')}`, '/dev/null'];
122
- this.spawnProcess = (0, child_process_1.spawn)('script', scriptArgs, {
123
- stdio: ['pipe', 'pipe', 'pipe'],
124
- cwd,
125
- env: {
126
- ...process.env,
127
- ...(this.config.env || {}),
128
- TERM: 'xterm-256color',
129
- },
130
- });
131
- }
132
- if (this.spawnProcess.stdout) {
133
- this.spawnProcess.stdout.on('data', (data) => {
134
- this.config.onData(data.toString());
135
- });
136
- }
137
- if (this.spawnProcess.stderr) {
138
- this.spawnProcess.stderr.on('data', (data) => {
139
- this.config.onData(data.toString());
140
- });
141
- }
142
- this.spawnProcess.on('exit', (code) => {
143
- this.config.onExit(code || 0);
144
- });
145
- this.spawnProcess.on('error', (err) => {
146
- this.config.onData(`Error: ${err.message}\r\n`);
147
- this.config.onExit(1);
148
- });
149
- }
150
- /**
151
- * Write data to PTY stdin
152
- */
153
- write(data) {
154
- if (this.ptyProcess) {
155
- this.ptyProcess.write(data);
156
- }
157
- else if (this.spawnProcess && this.spawnProcess.stdin) {
158
- this.spawnProcess.stdin.write(data);
159
- }
160
- }
161
- /**
162
- * Resize PTY
163
- */
164
- resize(cols, rows) {
165
- if (this.ptyProcess && this.ptyProcess.resize) {
166
- this.ptyProcess.resize(cols, rows);
167
- }
168
- // Spawn fallback doesn't support resize
169
- }
170
- /**
171
- * Kill the PTY process
172
- */
173
- kill() {
174
- if (this.ptyProcess) {
175
- this.ptyProcess.kill();
176
- this.ptyProcess = null;
177
- }
178
- if (this.spawnProcess) {
179
- this.spawnProcess.kill('SIGTERM');
180
- this.spawnProcess = null;
181
- }
182
- }
183
- /**
184
- * Check if PTY is running
185
- */
186
- isRunning() {
187
- return this.ptyProcess !== null || this.spawnProcess !== null;
188
- }
189
- }
190
- exports.PTYRunner = PTYRunner;
@@ -1,50 +0,0 @@
1
- /**
2
- * ekkos agent - Agent management commands for remote terminal
3
- *
4
- * Subcommands:
5
- * - daemon: Run the agent daemon (used by service)
6
- * - start: Start the agent service
7
- * - stop: Stop the agent service
8
- * - restart: Restart the agent service
9
- * - status: Check agent status
10
- * - uninstall: Remove agent service
11
- */
12
- export interface AgentOptions {
13
- verbose?: boolean;
14
- }
15
- /**
16
- * Run the agent daemon (foreground)
17
- */
18
- export declare function agentDaemon(options?: AgentOptions): Promise<void>;
19
- /**
20
- * Start the agent service
21
- */
22
- export declare function agentStart(options?: AgentOptions): Promise<void>;
23
- /**
24
- * Stop the agent service
25
- */
26
- export declare function agentStop(options?: AgentOptions): Promise<void>;
27
- /**
28
- * Restart the agent service
29
- */
30
- export declare function agentRestart(options?: AgentOptions): Promise<void>;
31
- /**
32
- * Check agent status
33
- */
34
- export declare function agentStatus(options?: AgentOptions): Promise<void>;
35
- /**
36
- * Uninstall the agent service
37
- */
38
- export declare function agentUninstall(options?: AgentOptions): Promise<void>;
39
- /**
40
- * Show agent logs
41
- */
42
- export declare function agentLogs(options?: {
43
- follow?: boolean;
44
- }): Promise<void>;
45
- /**
46
- * Check agent daemon health and diagnose connection issues
47
- */
48
- export declare function agentHealth(options?: {
49
- json?: boolean;
50
- }): Promise<void>;