fluq-watch 0.1.0

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.
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Watcher = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const detector_1 = require("./detector");
6
+ const agent_registry_1 = require("./agent-registry");
7
+ const reporter_1 = require("./reporter");
8
+ const trace_manager_1 = require("./trace-manager");
9
+ class Watcher {
10
+ config;
11
+ registry;
12
+ reporter;
13
+ traceManager;
14
+ paneStates = new Map();
15
+ pollTimer = null;
16
+ knownSessions = new Set();
17
+ constructor(config) {
18
+ this.config = config;
19
+ this.registry = new agent_registry_1.AgentRegistry(config);
20
+ this.reporter = new reporter_1.Reporter(config);
21
+ this.traceManager = new trace_manager_1.TraceManager(config);
22
+ }
23
+ start() {
24
+ // Check tmux is available
25
+ try {
26
+ (0, child_process_1.execSync)("tmux -V", { stdio: "pipe" });
27
+ }
28
+ catch {
29
+ console.error("Error: tmux is not installed or not in PATH");
30
+ process.exit(1);
31
+ }
32
+ console.log("🔍 fluq watch — observing tmux sessions...");
33
+ if (this.config.dryRun) {
34
+ console.log(" (dry-run mode — no events will be sent)");
35
+ }
36
+ console.log(` Endpoint: ${this.config.endpoint}`);
37
+ console.log(` Poll interval: ${this.config.interval}ms`);
38
+ console.log("");
39
+ this.reporter.start();
40
+ // Initial discovery
41
+ this.poll();
42
+ // Start polling
43
+ this.pollTimer = setInterval(() => this.poll(), this.config.interval);
44
+ }
45
+ async stop() {
46
+ if (this.pollTimer) {
47
+ clearInterval(this.pollTimer);
48
+ this.pollTimer = null;
49
+ }
50
+ // Close all active traces
51
+ await this.traceManager.closeAllTraces();
52
+ this.reporter.stop();
53
+ const stats = this.reporter.getStats();
54
+ console.log("");
55
+ console.log(`📊 Session stats: ${stats.totalSent} events sent, ${stats.totalFailed} failed, ${stats.queued} queued`);
56
+ }
57
+ poll() {
58
+ try {
59
+ const sessions = this.discoverSessions();
60
+ const currentSessionNames = new Set(sessions.map((s) => s.name));
61
+ // Detect ended sessions
62
+ for (const known of this.knownSessions) {
63
+ if (!currentSessionNames.has(known)) {
64
+ this.handleSessionEnd(known);
65
+ this.knownSessions.delete(known);
66
+ }
67
+ }
68
+ // Process active sessions
69
+ for (const session of sessions) {
70
+ this.knownSessions.add(session.name);
71
+ const panes = this.discoverPanes(session.name);
72
+ for (const pane of panes) {
73
+ this.processPaneOutput(pane);
74
+ }
75
+ }
76
+ }
77
+ catch (err) {
78
+ if (this.config.verbose) {
79
+ console.error("[watcher] Poll error:", err);
80
+ }
81
+ }
82
+ }
83
+ discoverSessions() {
84
+ try {
85
+ const output = (0, child_process_1.execSync)('tmux list-sessions -F "#{session_name}:#{session_windows}:#{session_attached}" 2>/dev/null', { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
86
+ if (!output)
87
+ return [];
88
+ return output
89
+ .split("\n")
90
+ .map((line) => {
91
+ const [name, windows, attached] = line.split(":");
92
+ return {
93
+ name,
94
+ windows: parseInt(windows, 10),
95
+ attached: attached === "1",
96
+ };
97
+ })
98
+ .filter((s) => {
99
+ // Apply session filters
100
+ if (this.config.sessions.length > 0) {
101
+ return this.config.sessions.includes(s.name);
102
+ }
103
+ // Apply exclusion patterns
104
+ for (const pattern of this.config.exclude) {
105
+ if (s.name.includes(pattern) || new RegExp(pattern).test(s.name)) {
106
+ return false;
107
+ }
108
+ }
109
+ return true;
110
+ });
111
+ }
112
+ catch {
113
+ // No tmux server running
114
+ return [];
115
+ }
116
+ }
117
+ discoverPanes(sessionName) {
118
+ try {
119
+ const output = (0, child_process_1.execSync)(`tmux list-panes -t "${sessionName}" -a -F "#{session_name}:#{window_index}:#{pane_index}:#{pane_id}" 2>/dev/null`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
120
+ if (!output)
121
+ return [];
122
+ return output
123
+ .split("\n")
124
+ .filter((line) => line.startsWith(sessionName + ":"))
125
+ .map((line) => {
126
+ const [sName, windowIdx, paneIdx, paneId] = line.split(":");
127
+ return {
128
+ sessionName: sName,
129
+ windowIndex: parseInt(windowIdx, 10),
130
+ paneIndex: parseInt(paneIdx, 10),
131
+ id: paneId,
132
+ };
133
+ });
134
+ }
135
+ catch {
136
+ return [];
137
+ }
138
+ }
139
+ capturePaneOutput(pane) {
140
+ try {
141
+ return (0, child_process_1.execSync)(`tmux capture-pane -t "${pane.sessionName}:${pane.windowIndex}.${pane.paneIndex}" -p -S -100 2>/dev/null`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], maxBuffer: 1024 * 1024 });
142
+ }
143
+ catch {
144
+ return "";
145
+ }
146
+ }
147
+ async processPaneOutput(pane) {
148
+ const paneKey = `${pane.sessionName}:${pane.windowIndex}.${pane.paneIndex}`;
149
+ const currentOutput = this.capturePaneOutput(pane);
150
+ if (!currentOutput.trim())
151
+ return;
152
+ const state = this.paneStates.get(paneKey);
153
+ if (!state) {
154
+ // First time seeing this pane — detect agent and start trace
155
+ const agent = (0, detector_1.detectAgent)(currentOutput);
156
+ const agentType = agent?.type || "builder";
157
+ this.paneStates.set(paneKey, {
158
+ lastOutput: currentOutput,
159
+ lastEventTime: Date.now(),
160
+ agentId: null,
161
+ agentType: agentType,
162
+ });
163
+ // Register agent and start trace
164
+ try {
165
+ const agentId = await this.registry.getOrRegisterAgent(pane.sessionName, agentType, agent ? `Auto-detected ${agent.name} agent` : undefined);
166
+ const paneState = this.paneStates.get(paneKey);
167
+ paneState.agentId = agentId;
168
+ await this.traceManager.startTrace(pane.sessionName, agentId);
169
+ console.log(` ✓ Discovered session "${pane.sessionName}" (${agentType})`);
170
+ }
171
+ catch (err) {
172
+ if (this.config.verbose) {
173
+ console.error(`[watcher] Failed to register "${pane.sessionName}":`, err);
174
+ }
175
+ }
176
+ return;
177
+ }
178
+ // Diff output to find new content
179
+ const newContent = this.diffOutput(state.lastOutput, currentOutput);
180
+ if (!newContent.trim())
181
+ return;
182
+ state.lastOutput = currentOutput;
183
+ // Detect events in new content
184
+ const detectedEvents = (0, detector_1.detectEvents)(newContent);
185
+ if (detectedEvents.length === 0)
186
+ return;
187
+ // Ensure we have an agent ID
188
+ if (!state.agentId) {
189
+ try {
190
+ const agent = (0, detector_1.detectAgent)(currentOutput);
191
+ const agentType = agent?.type || state.agentType || "builder";
192
+ state.agentId = await this.registry.getOrRegisterAgent(pane.sessionName, agentType);
193
+ }
194
+ catch {
195
+ return;
196
+ }
197
+ }
198
+ const traceId = this.traceManager.getTraceId(pane.sessionName);
199
+ // Deduplicate events — only report unique event types within a window
200
+ const uniqueEvents = this.deduplicateEvents(detectedEvents);
201
+ // Report events
202
+ for (const event of uniqueEvents) {
203
+ // Check for spawn events — could trigger child trace
204
+ if (event.eventType === "spawn") {
205
+ this.handleSpawnDetection(pane.sessionName, newContent, state.agentId);
206
+ }
207
+ const payload = {
208
+ agentId: state.agentId,
209
+ traceId,
210
+ eventType: event.eventType,
211
+ resource: event.resource,
212
+ tokensIn: event.tokensIn,
213
+ tokensOut: event.tokensOut,
214
+ errorMessage: event.errorMessage,
215
+ metadata: {
216
+ source: "fluq-watch",
217
+ session: pane.sessionName,
218
+ pane: paneKey,
219
+ matchedPattern: event.matchedPattern,
220
+ },
221
+ };
222
+ this.reporter.enqueue(payload);
223
+ }
224
+ state.lastEventTime = Date.now();
225
+ if (this.config.verbose && uniqueEvents.length > 0) {
226
+ const types = uniqueEvents.map((e) => e.eventType).join(", ");
227
+ console.log(` [${pane.sessionName}] ${uniqueEvents.length} events: ${types}`);
228
+ }
229
+ }
230
+ diffOutput(previous, current) {
231
+ // Simple diff: find new lines at the end
232
+ if (!previous)
233
+ return current;
234
+ const prevLines = previous.split("\n");
235
+ const currLines = current.split("\n");
236
+ // Find where current diverges from previous
237
+ // Use last N lines of previous as anchor
238
+ const anchorSize = Math.min(3, prevLines.length);
239
+ const anchor = prevLines.slice(-anchorSize).join("\n");
240
+ const anchorIndex = current.lastIndexOf(anchor);
241
+ if (anchorIndex >= 0) {
242
+ return current.slice(anchorIndex + anchor.length);
243
+ }
244
+ // If we can't find the anchor, return lines beyond previous length
245
+ if (currLines.length > prevLines.length) {
246
+ return currLines.slice(prevLines.length).join("\n");
247
+ }
248
+ return "";
249
+ }
250
+ deduplicateEvents(events) {
251
+ const seen = new Set();
252
+ return events.filter((e) => {
253
+ const key = `${e.eventType}:${e.resource || ""}`;
254
+ if (seen.has(key))
255
+ return false;
256
+ seen.add(key);
257
+ return true;
258
+ });
259
+ }
260
+ handleSessionEnd(sessionName) {
261
+ console.log(` ✗ Session "${sessionName}" ended`);
262
+ this.traceManager.endTrace(sessionName, "completed");
263
+ // Clean up pane states for this session
264
+ for (const key of this.paneStates.keys()) {
265
+ if (key.startsWith(sessionName + ":")) {
266
+ this.paneStates.delete(key);
267
+ }
268
+ }
269
+ }
270
+ async handleSpawnDetection(parentSession, output, parentAgentId) {
271
+ // Try to detect the spawned session name
272
+ const spawnMatch = output.match(/(?:tmux new-session|tmux new)\s+(?:-d\s+)?-s\s+["']?(\S+?)["']?\s/);
273
+ if (spawnMatch) {
274
+ const childSession = spawnMatch[1];
275
+ const parentTraceId = this.traceManager.getTraceId(parentSession);
276
+ if (this.config.verbose) {
277
+ console.log(` [spawn] "${parentSession}" → "${childSession}"`);
278
+ }
279
+ // Child trace will be created when the child session is discovered
280
+ // We just need to note the parent relationship
281
+ try {
282
+ const childAgentId = await this.registry.getOrRegisterAgent(childSession, "builder");
283
+ await this.traceManager.startTrace(childSession, childAgentId, parentTraceId);
284
+ }
285
+ catch {
286
+ // Will be retried on next discovery
287
+ }
288
+ }
289
+ }
290
+ }
291
+ exports.Watcher = Watcher;
292
+ //# sourceMappingURL=watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../../src/watcher.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAEzC,yCAA2E;AAC3E,qDAAiD;AACjD,yCAAyD;AACzD,mDAA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AM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAElE,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,CAAC,GAAG,CACT,cAAc,aAAa,QAAQ,YAAY,GAAG,CACnD,CAAC;YACJ,CAAC;YAED,mEAAmE;YACnE,+CAA+C;YAC/C,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CACzD,YAAY,EACZ,SAAS,CACV,CAAC;gBACF,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAChC,YAAY,EACZ,YAAY,EACZ,aAAa,CACd,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,oCAAoC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAjWD,0BAiWC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "fluq-watch",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool for Fluq Fleet Ops — observe AI agents in tmux sessions",
5
+ "bin": {
6
+ "fluq": "dist/bin/fluq.js",
7
+ "fluq-watch": "dist/bin/fluq.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "start": "node dist/bin/fluq.js"
13
+ },
14
+ "files": [
15
+ "dist/**/*"
16
+ ],
17
+ "keywords": [
18
+ "ai",
19
+ "agents",
20
+ "observability",
21
+ "tmux",
22
+ "fleet-ops"
23
+ ],
24
+ "license": "MIT",
25
+ "dependencies": {
26
+ "commander": "^13.1.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^22.15.0",
30
+ "typescript": "^5.8.3"
31
+ }
32
+ }