@litmers/cursorflow-orchestrator 0.1.20 → 0.1.28
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/CHANGELOG.md +20 -0
- package/commands/cursorflow-clean.md +19 -0
- package/commands/cursorflow-runs.md +59 -0
- package/commands/cursorflow-stop.md +55 -0
- package/dist/cli/clean.js +171 -0
- package/dist/cli/clean.js.map +1 -1
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/logs.js +83 -42
- package/dist/cli/logs.js.map +1 -1
- package/dist/cli/monitor.d.ts +7 -0
- package/dist/cli/monitor.js +1007 -189
- package/dist/cli/monitor.js.map +1 -1
- package/dist/cli/prepare.js +87 -3
- package/dist/cli/prepare.js.map +1 -1
- package/dist/cli/resume.js +188 -236
- package/dist/cli/resume.js.map +1 -1
- package/dist/cli/run.js +125 -3
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/runs.d.ts +5 -0
- package/dist/cli/runs.js +214 -0
- package/dist/cli/runs.js.map +1 -0
- package/dist/cli/setup-commands.js +0 -0
- package/dist/cli/signal.js +1 -1
- package/dist/cli/signal.js.map +1 -1
- package/dist/cli/stop.d.ts +5 -0
- package/dist/cli/stop.js +215 -0
- package/dist/cli/stop.js.map +1 -0
- package/dist/cli/tasks.d.ts +10 -0
- package/dist/cli/tasks.js +165 -0
- package/dist/cli/tasks.js.map +1 -0
- package/dist/core/auto-recovery.d.ts +212 -0
- package/dist/core/auto-recovery.js +737 -0
- package/dist/core/auto-recovery.js.map +1 -0
- package/dist/core/failure-policy.d.ts +156 -0
- package/dist/core/failure-policy.js +488 -0
- package/dist/core/failure-policy.js.map +1 -0
- package/dist/core/orchestrator.d.ts +15 -2
- package/dist/core/orchestrator.js +397 -15
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/reviewer.d.ts +2 -0
- package/dist/core/reviewer.js +2 -0
- package/dist/core/reviewer.js.map +1 -1
- package/dist/core/runner.d.ts +33 -10
- package/dist/core/runner.js +321 -146
- package/dist/core/runner.js.map +1 -1
- package/dist/services/logging/buffer.d.ts +67 -0
- package/dist/services/logging/buffer.js +309 -0
- package/dist/services/logging/buffer.js.map +1 -0
- package/dist/services/logging/console.d.ts +89 -0
- package/dist/services/logging/console.js +169 -0
- package/dist/services/logging/console.js.map +1 -0
- package/dist/services/logging/file-writer.d.ts +71 -0
- package/dist/services/logging/file-writer.js +516 -0
- package/dist/services/logging/file-writer.js.map +1 -0
- package/dist/services/logging/formatter.d.ts +39 -0
- package/dist/services/logging/formatter.js +227 -0
- package/dist/services/logging/formatter.js.map +1 -0
- package/dist/services/logging/index.d.ts +11 -0
- package/dist/services/logging/index.js +30 -0
- package/dist/services/logging/index.js.map +1 -0
- package/dist/services/logging/parser.d.ts +31 -0
- package/dist/services/logging/parser.js +222 -0
- package/dist/services/logging/parser.js.map +1 -0
- package/dist/services/process/index.d.ts +59 -0
- package/dist/services/process/index.js +257 -0
- package/dist/services/process/index.js.map +1 -0
- package/dist/types/agent.d.ts +20 -0
- package/dist/types/agent.js +6 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/config.d.ts +65 -0
- package/dist/types/config.js +6 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/events.d.ts +125 -0
- package/dist/types/events.js +6 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +37 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lane.d.ts +43 -0
- package/dist/types/lane.js +6 -0
- package/dist/types/lane.js.map +1 -0
- package/dist/types/logging.d.ts +71 -0
- package/dist/types/logging.js +16 -0
- package/dist/types/logging.js.map +1 -0
- package/dist/types/review.d.ts +17 -0
- package/dist/types/review.js +6 -0
- package/dist/types/review.js.map +1 -0
- package/dist/types/run.d.ts +32 -0
- package/dist/types/run.js +6 -0
- package/dist/types/run.js.map +1 -0
- package/dist/types/task.d.ts +71 -0
- package/dist/types/task.js +6 -0
- package/dist/types/task.js.map +1 -0
- package/dist/ui/components.d.ts +134 -0
- package/dist/ui/components.js +389 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/log-viewer.d.ts +49 -0
- package/dist/ui/log-viewer.js +449 -0
- package/dist/ui/log-viewer.js.map +1 -0
- package/dist/utils/checkpoint.d.ts +87 -0
- package/dist/utils/checkpoint.js +317 -0
- package/dist/utils/checkpoint.js.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.js +11 -2
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/cursor-agent.js.map +1 -1
- package/dist/utils/dependency.d.ts +74 -0
- package/dist/utils/dependency.js +420 -0
- package/dist/utils/dependency.js.map +1 -0
- package/dist/utils/doctor.js +10 -5
- package/dist/utils/doctor.js.map +1 -1
- package/dist/utils/enhanced-logger.d.ts +10 -33
- package/dist/utils/enhanced-logger.js +94 -9
- package/dist/utils/enhanced-logger.js.map +1 -1
- package/dist/utils/git.d.ts +121 -0
- package/dist/utils/git.js +322 -2
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/health.d.ts +91 -0
- package/dist/utils/health.js +556 -0
- package/dist/utils/health.js.map +1 -0
- package/dist/utils/lock.d.ts +95 -0
- package/dist/utils/lock.js +332 -0
- package/dist/utils/lock.js.map +1 -0
- package/dist/utils/log-buffer.d.ts +17 -0
- package/dist/utils/log-buffer.js +14 -0
- package/dist/utils/log-buffer.js.map +1 -0
- package/dist/utils/log-constants.d.ts +23 -0
- package/dist/utils/log-constants.js +28 -0
- package/dist/utils/log-constants.js.map +1 -0
- package/dist/utils/log-formatter.d.ts +9 -0
- package/dist/utils/log-formatter.js +113 -70
- package/dist/utils/log-formatter.js.map +1 -1
- package/dist/utils/log-service.d.ts +19 -0
- package/dist/utils/log-service.js +47 -0
- package/dist/utils/log-service.js.map +1 -0
- package/dist/utils/logger.d.ts +46 -27
- package/dist/utils/logger.js +82 -60
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/process-manager.d.ts +21 -0
- package/dist/utils/process-manager.js +138 -0
- package/dist/utils/process-manager.js.map +1 -0
- package/dist/utils/retry.d.ts +121 -0
- package/dist/utils/retry.js +374 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/run-service.d.ts +88 -0
- package/dist/utils/run-service.js +412 -0
- package/dist/utils/run-service.js.map +1 -0
- package/dist/utils/state.d.ts +58 -2
- package/dist/utils/state.js +306 -3
- package/dist/utils/state.js.map +1 -1
- package/dist/utils/task-service.d.ts +82 -0
- package/dist/utils/task-service.js +348 -0
- package/dist/utils/task-service.js.map +1 -0
- package/dist/utils/types.d.ts +2 -272
- package/dist/utils/types.js +16 -0
- package/dist/utils/types.js.map +1 -1
- package/package.json +38 -23
- package/scripts/ai-security-check.js +0 -1
- package/scripts/local-security-gate.sh +0 -0
- package/scripts/monitor-lanes.sh +94 -0
- package/scripts/patches/test-cursor-agent.js +0 -1
- package/scripts/release.sh +0 -0
- package/scripts/setup-security.sh +0 -0
- package/scripts/stream-logs.sh +72 -0
- package/scripts/verify-and-fix.sh +0 -0
- package/src/cli/clean.ts +180 -0
- package/src/cli/index.ts +7 -0
- package/src/cli/init.ts +1 -1
- package/src/cli/logs.ts +79 -42
- package/src/cli/monitor.ts +1815 -899
- package/src/cli/prepare.ts +97 -3
- package/src/cli/resume.ts +220 -277
- package/src/cli/run.ts +154 -3
- package/src/cli/runs.ts +212 -0
- package/src/cli/setup-commands.ts +0 -0
- package/src/cli/signal.ts +1 -1
- package/src/cli/stop.ts +209 -0
- package/src/cli/tasks.ts +154 -0
- package/src/core/auto-recovery.ts +909 -0
- package/src/core/failure-policy.ts +592 -0
- package/src/core/orchestrator.ts +1136 -675
- package/src/core/reviewer.ts +4 -0
- package/src/core/runner.ts +1443 -1217
- package/src/services/logging/buffer.ts +326 -0
- package/src/services/logging/console.ts +193 -0
- package/src/services/logging/file-writer.ts +526 -0
- package/src/services/logging/formatter.ts +268 -0
- package/src/services/logging/index.ts +16 -0
- package/src/services/logging/parser.ts +232 -0
- package/src/services/process/index.ts +261 -0
- package/src/types/agent.ts +24 -0
- package/src/types/config.ts +79 -0
- package/src/types/events.ts +156 -0
- package/src/types/index.ts +29 -0
- package/src/types/lane.ts +56 -0
- package/src/types/logging.ts +96 -0
- package/src/types/review.ts +20 -0
- package/src/types/run.ts +37 -0
- package/src/types/task.ts +79 -0
- package/src/ui/components.ts +430 -0
- package/src/ui/log-viewer.ts +485 -0
- package/src/utils/checkpoint.ts +374 -0
- package/src/utils/config.ts +11 -2
- package/src/utils/cursor-agent.ts +1 -1
- package/src/utils/dependency.ts +482 -0
- package/src/utils/doctor.ts +11 -5
- package/src/utils/enhanced-logger.ts +108 -49
- package/src/utils/git.ts +871 -499
- package/src/utils/health.ts +596 -0
- package/src/utils/lock.ts +346 -0
- package/src/utils/log-buffer.ts +28 -0
- package/src/utils/log-constants.ts +26 -0
- package/src/utils/log-formatter.ts +120 -37
- package/src/utils/log-service.ts +49 -0
- package/src/utils/logger.ts +100 -51
- package/src/utils/process-manager.ts +100 -0
- package/src/utils/retry.ts +413 -0
- package/src/utils/run-service.ts +433 -0
- package/src/utils/state.ts +369 -3
- package/src/utils/task-service.ts +370 -0
- package/src/utils/types.ts +2 -315
|
@@ -1,84 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Utility for formatting log messages for console display
|
|
4
|
+
*
|
|
5
|
+
* Format: [HH:MM:SS] [lane-task] ICON TYPE content
|
|
6
|
+
*
|
|
7
|
+
* Rules:
|
|
8
|
+
* - Box format only for: user, assistant, system, result
|
|
9
|
+
* - Compact format for: tool, tool_result, thinking (gray/dim)
|
|
10
|
+
* - Tool names simplified: ShellToolCall → Shell
|
|
11
|
+
* - Lane labels max 16 chars: [01-types-tests]
|
|
4
12
|
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
14
|
exports.formatMessageForConsole = formatMessageForConsole;
|
|
40
15
|
exports.formatPotentialJsonMessage = formatPotentialJsonMessage;
|
|
41
|
-
const
|
|
16
|
+
const log_constants_1 = require("./log-constants");
|
|
42
17
|
const enhanced_logger_1 = require("./enhanced-logger");
|
|
18
|
+
// Types that should use box format
|
|
19
|
+
const BOX_TYPES = new Set(['user', 'assistant', 'system', 'result']);
|
|
20
|
+
/**
|
|
21
|
+
* Simplify tool names (ShellToolCall → Shell, etc.)
|
|
22
|
+
*/
|
|
23
|
+
function simplifyToolName(name) {
|
|
24
|
+
// Remove common suffixes
|
|
25
|
+
return name
|
|
26
|
+
.replace(/ToolCall$/i, '')
|
|
27
|
+
.replace(/Tool$/i, '')
|
|
28
|
+
.replace(/^run_terminal_cmd$/i, 'shell')
|
|
29
|
+
.replace(/^search_replace$/i, 'edit');
|
|
30
|
+
}
|
|
43
31
|
/**
|
|
44
32
|
* Format a single parsed message into a human-readable string (compact or multi-line)
|
|
45
33
|
*/
|
|
46
34
|
function formatMessageForConsole(msg, options = {}) {
|
|
47
|
-
const { includeTimestamp = true, laneLabel = '', compact = false } = options;
|
|
35
|
+
const { includeTimestamp = true, laneLabel = '', compact = false, context = '' } = options;
|
|
48
36
|
const ts = includeTimestamp ? new Date(msg.timestamp).toLocaleTimeString('en-US', { hour12: false }) : '';
|
|
49
|
-
const tsPrefix = ts ? `${
|
|
50
|
-
|
|
37
|
+
const tsPrefix = ts ? `${log_constants_1.COLORS.gray}[${ts}]${log_constants_1.COLORS.reset} ` : '';
|
|
38
|
+
// Handle context (e.g. from logger.info) - max 16 chars
|
|
39
|
+
const effectiveLaneLabel = laneLabel || (context ? `[${context}]` : '');
|
|
40
|
+
const truncatedLabel = effectiveLaneLabel.length > 16
|
|
41
|
+
? effectiveLaneLabel.substring(0, 16)
|
|
42
|
+
: effectiveLaneLabel;
|
|
43
|
+
const labelPrefix = truncatedLabel ? `${log_constants_1.COLORS.magenta}${truncatedLabel.padEnd(16)}${log_constants_1.COLORS.reset} ` : '';
|
|
51
44
|
let typePrefix = '';
|
|
52
45
|
let content = msg.content;
|
|
46
|
+
// Determine if we should use box format
|
|
47
|
+
// Box format only for: user, assistant, system, result (and only when not compact)
|
|
48
|
+
const useBox = !compact && BOX_TYPES.has(msg.type);
|
|
49
|
+
// Clean up wrapped prompts for user messages to hide internal instructions
|
|
50
|
+
if (msg.type === 'user') {
|
|
51
|
+
const contextMarker = '### 🛠 Environment & Context';
|
|
52
|
+
const instructionsMarker = '### 📝 Final Instructions';
|
|
53
|
+
if (content.includes(contextMarker)) {
|
|
54
|
+
const parts = content.split('---\n');
|
|
55
|
+
if (parts.length >= 3) {
|
|
56
|
+
content = parts[1].trim();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
content = content.split(contextMarker).pop() || content;
|
|
60
|
+
content = content.split(instructionsMarker)[0] || content;
|
|
61
|
+
content = content.replace(/^.*---\n/s, '').trim();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// For thinking: collapse multiple newlines into single space
|
|
66
|
+
if (msg.type === 'thinking') {
|
|
67
|
+
content = content.replace(/\n\s*\n/g, ' ').replace(/\n/g, ' ').trim();
|
|
68
|
+
}
|
|
53
69
|
switch (msg.type) {
|
|
54
70
|
case 'user':
|
|
55
|
-
typePrefix = `${
|
|
56
|
-
if (
|
|
71
|
+
typePrefix = `${log_constants_1.COLORS.cyan}🧑 USER${log_constants_1.COLORS.reset}`;
|
|
72
|
+
if (!useBox)
|
|
57
73
|
content = content.replace(/\n/g, ' ').substring(0, 100) + (content.length > 100 ? '...' : '');
|
|
58
74
|
break;
|
|
59
75
|
case 'assistant':
|
|
60
|
-
typePrefix = `${
|
|
61
|
-
if (
|
|
76
|
+
typePrefix = `${log_constants_1.COLORS.green}🤖 ASST${log_constants_1.COLORS.reset}`;
|
|
77
|
+
if (!useBox)
|
|
62
78
|
content = content.replace(/\n/g, ' ').substring(0, 100) + (content.length > 100 ? '...' : '');
|
|
63
79
|
break;
|
|
64
80
|
case 'tool':
|
|
65
|
-
|
|
81
|
+
// Tool calls are always compact and gray
|
|
82
|
+
typePrefix = `${log_constants_1.COLORS.gray}🔧 TOOL${log_constants_1.COLORS.reset}`;
|
|
66
83
|
const toolMatch = content.match(/\[Tool: ([^\]]+)\] (.*)/);
|
|
67
84
|
if (toolMatch) {
|
|
68
|
-
const [,
|
|
85
|
+
const [, rawName, args] = toolMatch;
|
|
86
|
+
const name = simplifyToolName(rawName);
|
|
69
87
|
try {
|
|
70
88
|
const parsedArgs = JSON.parse(args);
|
|
71
89
|
let argStr = '';
|
|
72
|
-
if (
|
|
90
|
+
if (rawName === 'read_file' && parsedArgs.target_file) {
|
|
73
91
|
argStr = parsedArgs.target_file;
|
|
74
92
|
}
|
|
75
|
-
else if (
|
|
93
|
+
else if (rawName === 'run_terminal_cmd' && parsedArgs.command) {
|
|
76
94
|
argStr = parsedArgs.command;
|
|
77
95
|
}
|
|
78
|
-
else if (
|
|
96
|
+
else if (rawName === 'write' && parsedArgs.file_path) {
|
|
79
97
|
argStr = parsedArgs.file_path;
|
|
80
98
|
}
|
|
81
|
-
else if (
|
|
99
|
+
else if (rawName === 'search_replace' && parsedArgs.file_path) {
|
|
82
100
|
argStr = parsedArgs.file_path;
|
|
83
101
|
}
|
|
84
102
|
else {
|
|
@@ -87,45 +105,69 @@ function formatMessageForConsole(msg, options = {}) {
|
|
|
87
105
|
argStr = String(parsedArgs[keys[0]]).substring(0, 50);
|
|
88
106
|
}
|
|
89
107
|
}
|
|
90
|
-
content = `${
|
|
108
|
+
content = `${log_constants_1.COLORS.gray}${name}${log_constants_1.COLORS.reset}(${log_constants_1.COLORS.gray}${argStr}${log_constants_1.COLORS.reset})`;
|
|
91
109
|
}
|
|
92
110
|
catch {
|
|
93
|
-
content = `${
|
|
111
|
+
content = `${log_constants_1.COLORS.gray}${name}${log_constants_1.COLORS.reset}: ${args}`;
|
|
94
112
|
}
|
|
95
113
|
}
|
|
96
114
|
break;
|
|
97
115
|
case 'tool_result':
|
|
98
|
-
|
|
116
|
+
// Tool results are always compact and gray
|
|
117
|
+
typePrefix = `${log_constants_1.COLORS.gray}📄 RESL${log_constants_1.COLORS.reset}`;
|
|
99
118
|
const resMatch = content.match(/\[Tool Result: ([^\]]+)\]/);
|
|
100
|
-
|
|
119
|
+
if (resMatch) {
|
|
120
|
+
const simpleName = simplifyToolName(resMatch[1]);
|
|
121
|
+
content = `${log_constants_1.COLORS.gray}${simpleName} OK${log_constants_1.COLORS.reset}`;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
content = `${log_constants_1.COLORS.gray}result${log_constants_1.COLORS.reset}`;
|
|
125
|
+
}
|
|
101
126
|
break;
|
|
102
127
|
case 'result':
|
|
103
|
-
|
|
128
|
+
case 'success':
|
|
129
|
+
typePrefix = `${log_constants_1.COLORS.green}✅ DONE${log_constants_1.COLORS.reset}`;
|
|
104
130
|
break;
|
|
105
131
|
case 'system':
|
|
106
|
-
typePrefix = `${
|
|
132
|
+
typePrefix = `${log_constants_1.COLORS.gray}⚙️ SYS${log_constants_1.COLORS.reset}`;
|
|
107
133
|
break;
|
|
108
134
|
case 'thinking':
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
135
|
+
// Thinking is always compact and gray
|
|
136
|
+
typePrefix = `${log_constants_1.COLORS.gray}🤔 THNK${log_constants_1.COLORS.reset}`;
|
|
137
|
+
content = `${log_constants_1.COLORS.gray}${content.substring(0, 100)}${content.length > 100 ? '...' : ''}${log_constants_1.COLORS.reset}`;
|
|
138
|
+
break;
|
|
139
|
+
case 'info':
|
|
140
|
+
typePrefix = `${log_constants_1.COLORS.cyan}ℹ️ INFO${log_constants_1.COLORS.reset}`;
|
|
141
|
+
break;
|
|
142
|
+
case 'warn':
|
|
143
|
+
typePrefix = `${log_constants_1.COLORS.yellow}⚠️ WARN${log_constants_1.COLORS.reset}`;
|
|
144
|
+
break;
|
|
145
|
+
case 'error':
|
|
146
|
+
typePrefix = `${log_constants_1.COLORS.red}❌ ERR${log_constants_1.COLORS.reset}`;
|
|
112
147
|
break;
|
|
113
148
|
}
|
|
114
149
|
if (!typePrefix)
|
|
115
150
|
return `${tsPrefix}${labelPrefix}${content}`;
|
|
116
|
-
|
|
117
|
-
|
|
151
|
+
// Compact format (single line)
|
|
152
|
+
if (!useBox) {
|
|
153
|
+
return `${tsPrefix}${labelPrefix}${typePrefix.padEnd(12)} ${content}`;
|
|
118
154
|
}
|
|
119
|
-
// Multi-line box format (
|
|
155
|
+
// Multi-line box format (only for user, assistant, system, result)
|
|
156
|
+
// Emoji width is 2, so we need to account for that in indent calculation
|
|
120
157
|
const lines = content.split('\n');
|
|
121
158
|
const fullPrefix = `${tsPrefix}${labelPrefix}`;
|
|
122
|
-
const
|
|
159
|
+
const strippedPrefix = (0, enhanced_logger_1.stripAnsi)(typePrefix);
|
|
160
|
+
// Count emojis (they take 2 terminal columns but 1-2 chars in string)
|
|
161
|
+
const emojiCount = (strippedPrefix.match(/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2300}-\u{23FF}]|[\u{2B50}-\u{2B55}]|[\u{231A}-\u{231B}]|[\u{23E9}-\u{23F3}]|[\u{23F8}-\u{23FA}]|✅|❌|⚙️|ℹ️|⚠️|🔧|📄|🤔|🧑|🤖/gu) || []).length;
|
|
162
|
+
const visualWidth = strippedPrefix.length + emojiCount; // emoji adds 1 extra width
|
|
163
|
+
const boxWidth = 60;
|
|
164
|
+
const header = `${typePrefix}┌${'─'.repeat(boxWidth)}`;
|
|
123
165
|
let result = `${fullPrefix}${header}\n`;
|
|
124
|
-
const indent = ' '.repeat(
|
|
166
|
+
const indent = ' '.repeat(visualWidth);
|
|
125
167
|
for (const line of lines) {
|
|
126
|
-
result += `${fullPrefix}${indent}
|
|
168
|
+
result += `${fullPrefix}${indent}│ ${line}\n`;
|
|
127
169
|
}
|
|
128
|
-
result += `${fullPrefix}${indent}
|
|
170
|
+
result += `${fullPrefix}${indent}└${'─'.repeat(boxWidth)}`;
|
|
129
171
|
return result;
|
|
130
172
|
}
|
|
131
173
|
/**
|
|
@@ -141,8 +183,8 @@ function formatPotentialJsonMessage(message) {
|
|
|
141
183
|
if (!json.type)
|
|
142
184
|
return message;
|
|
143
185
|
// Convert JSON to a ParsedMessage-like structure for formatting
|
|
144
|
-
let content
|
|
145
|
-
let type
|
|
186
|
+
let content;
|
|
187
|
+
let type;
|
|
146
188
|
if (json.type === 'thinking' && json.text) {
|
|
147
189
|
content = json.text;
|
|
148
190
|
type = 'thinking';
|
|
@@ -162,14 +204,15 @@ function formatPotentialJsonMessage(message) {
|
|
|
162
204
|
type = 'user';
|
|
163
205
|
}
|
|
164
206
|
else if (json.type === 'tool_call' && json.subtype === 'started') {
|
|
165
|
-
const
|
|
166
|
-
const args = json.tool_call[
|
|
167
|
-
|
|
207
|
+
const rawToolName = Object.keys(json.tool_call)[0] || 'unknown';
|
|
208
|
+
const args = json.tool_call[rawToolName]?.args || {};
|
|
209
|
+
// Tool name will be simplified in formatMessageForConsole
|
|
210
|
+
content = `[Tool: ${rawToolName}] ${JSON.stringify(args)}`;
|
|
168
211
|
type = 'tool';
|
|
169
212
|
}
|
|
170
213
|
else if (json.type === 'tool_call' && json.subtype === 'completed') {
|
|
171
|
-
const
|
|
172
|
-
content = `[Tool Result: ${
|
|
214
|
+
const rawToolName = Object.keys(json.tool_call)[0] || 'unknown';
|
|
215
|
+
content = `[Tool Result: ${rawToolName}]`;
|
|
173
216
|
type = 'tool_result';
|
|
174
217
|
}
|
|
175
218
|
else if (json.type === 'result') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-formatter.js","sourceRoot":"","sources":["../../src/utils/log-formatter.ts"],"names":[],"mappings":";AAAA;;
|
|
1
|
+
{"version":3,"file":"log-formatter.js","sourceRoot":"","sources":["../../src/utils/log-formatter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAuBH,0DAqJC;AAKD,gEAyDC;AAxOD,mDAAyC;AACzC,uDAA6D;AAE7D,mCAAmC;AACnC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,QAA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IAAI,CAAC,GAAG,EAAE;SAC3C,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log Service - Helpers for log processing and filtering
|
|
3
|
+
*/
|
|
4
|
+
import { JsonLogEntry } from './enhanced-logger';
|
|
5
|
+
import { LogImportance } from './types';
|
|
6
|
+
export interface MergedLogEntry extends JsonLogEntry {
|
|
7
|
+
laneName: string;
|
|
8
|
+
laneColor: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class LogService {
|
|
11
|
+
/**
|
|
12
|
+
* Determine importance level of a log entry
|
|
13
|
+
*/
|
|
14
|
+
static getLogImportance(entry: JsonLogEntry): LogImportance;
|
|
15
|
+
/**
|
|
16
|
+
* Check if an entry meets the minimum importance level
|
|
17
|
+
*/
|
|
18
|
+
static meetsImportanceLevel(entry: JsonLogEntry, minLevel: LogImportance): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Log Service - Helpers for log processing and filtering
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LogService = void 0;
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
class LogService {
|
|
9
|
+
/**
|
|
10
|
+
* Determine importance level of a log entry
|
|
11
|
+
*/
|
|
12
|
+
static getLogImportance(entry) {
|
|
13
|
+
if (entry.level === 'error')
|
|
14
|
+
return types_1.LogImportance.CRITICAL;
|
|
15
|
+
if (entry.level === 'stderr')
|
|
16
|
+
return types_1.LogImportance.HIGH;
|
|
17
|
+
const msg = (entry.message || '').toLowerCase();
|
|
18
|
+
if (msg.includes('error') || msg.includes('fail'))
|
|
19
|
+
return types_1.LogImportance.HIGH;
|
|
20
|
+
if (msg.includes('warn'))
|
|
21
|
+
return types_1.LogImportance.MEDIUM;
|
|
22
|
+
if (msg.includes('success') || msg.includes('done') || msg.includes('completed'))
|
|
23
|
+
return types_1.LogImportance.LOW;
|
|
24
|
+
if (entry.level === 'debug')
|
|
25
|
+
return types_1.LogImportance.DEBUG;
|
|
26
|
+
return types_1.LogImportance.INFO;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if an entry meets the minimum importance level
|
|
30
|
+
*/
|
|
31
|
+
static meetsImportanceLevel(entry, minLevel) {
|
|
32
|
+
const entryLevel = this.getLogImportance(entry);
|
|
33
|
+
const levels = [
|
|
34
|
+
types_1.LogImportance.DEBUG,
|
|
35
|
+
types_1.LogImportance.INFO,
|
|
36
|
+
types_1.LogImportance.LOW,
|
|
37
|
+
types_1.LogImportance.MEDIUM,
|
|
38
|
+
types_1.LogImportance.HIGH,
|
|
39
|
+
types_1.LogImportance.CRITICAL
|
|
40
|
+
];
|
|
41
|
+
const entryIdx = levels.indexOf(entryLevel);
|
|
42
|
+
const minIdx = levels.indexOf(minLevel);
|
|
43
|
+
return entryIdx >= minIdx;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.LogService = LogService;
|
|
47
|
+
//# sourceMappingURL=log-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-service.js","sourceRoot":"","sources":["../../src/utils/log-service.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,mCAAwC;AAOxC,MAAa,UAAU;IACrB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAmB;QACzC,IAAI,KAAK,CAAC,KAAK,KAAK,OAAO;YAAE,OAAO,qBAAa,CAAC,QAAQ,CAAC;QAC3D,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,qBAAa,CAAC,IAAI,CAAC;QAExD,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAA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식: [HH:MM:SS] emoji TYPE message
|
|
5
|
+
* 컨텍스트 포함 시: [HH:MM:SS] [context] emoji TYPE message
|
|
3
6
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
warn = 1,
|
|
7
|
-
info = 2,
|
|
8
|
-
debug = 3
|
|
9
|
-
}
|
|
10
|
-
export declare const COLORS: {
|
|
11
|
-
reset: string;
|
|
12
|
-
red: string;
|
|
13
|
-
yellow: string;
|
|
14
|
-
green: string;
|
|
15
|
-
blue: string;
|
|
16
|
-
cyan: string;
|
|
17
|
-
magenta: string;
|
|
18
|
-
gray: string;
|
|
19
|
-
bold: string;
|
|
20
|
-
};
|
|
7
|
+
import { COLORS, LogLevel } from './log-constants';
|
|
8
|
+
export { COLORS, LogLevel };
|
|
21
9
|
/**
|
|
22
10
|
* Set log level
|
|
23
11
|
*/
|
|
24
12
|
export declare function setLogLevel(level: string | number): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get current log level
|
|
15
|
+
*/
|
|
16
|
+
export declare function getLogLevel(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Log options interface for contextual logging
|
|
19
|
+
*/
|
|
20
|
+
export interface LogOptions {
|
|
21
|
+
/** Context label (e.g., lane name) */
|
|
22
|
+
context?: string;
|
|
23
|
+
/** Custom emoji override */
|
|
24
|
+
emoji?: string;
|
|
25
|
+
/** Skip timestamp */
|
|
26
|
+
noTimestamp?: boolean;
|
|
27
|
+
/** Custom color */
|
|
28
|
+
color?: string;
|
|
29
|
+
/** Use box format */
|
|
30
|
+
box?: boolean;
|
|
31
|
+
}
|
|
25
32
|
/**
|
|
26
33
|
* Error log
|
|
27
34
|
*/
|
|
28
|
-
export declare function error(message: string,
|
|
35
|
+
export declare function error(message: string, options?: LogOptions | string): void;
|
|
29
36
|
/**
|
|
30
37
|
* Warning log
|
|
31
38
|
*/
|
|
32
|
-
export declare function warn(message: string,
|
|
39
|
+
export declare function warn(message: string, options?: LogOptions | string): void;
|
|
33
40
|
/**
|
|
34
41
|
* Info log
|
|
35
42
|
*/
|
|
36
|
-
export declare function info(message: string,
|
|
43
|
+
export declare function info(message: string, options?: LogOptions | string): void;
|
|
37
44
|
/**
|
|
38
45
|
* Success log
|
|
39
46
|
*/
|
|
40
|
-
export declare function success(message: string,
|
|
47
|
+
export declare function success(message: string, options?: LogOptions | string): void;
|
|
41
48
|
/**
|
|
42
49
|
* Debug log
|
|
43
50
|
*/
|
|
44
|
-
export declare function debug(message: string,
|
|
51
|
+
export declare function debug(message: string, options?: LogOptions | string): void;
|
|
45
52
|
/**
|
|
46
53
|
* Progress log
|
|
47
54
|
*/
|
|
48
|
-
export declare function progress(message: string,
|
|
55
|
+
export declare function progress(message: string, options?: LogOptions | string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create a context-bound logger
|
|
58
|
+
*/
|
|
59
|
+
export declare function withContext(context: string): {
|
|
60
|
+
error: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
61
|
+
warn: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
62
|
+
info: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
63
|
+
success: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
64
|
+
debug: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
65
|
+
progress: (message: string, options?: Omit<LogOptions, "context">) => void;
|
|
66
|
+
};
|
|
49
67
|
/**
|
|
50
68
|
* Section header
|
|
51
69
|
*/
|
|
52
70
|
export declare function section(message: string): void;
|
|
53
71
|
/**
|
|
54
|
-
*
|
|
72
|
+
* Raw output (direct to stdout)
|
|
55
73
|
*/
|
|
56
|
-
export declare function
|
|
74
|
+
export declare function raw(message: string): void;
|
|
57
75
|
/**
|
|
58
|
-
*
|
|
76
|
+
* Simple log without formatting
|
|
59
77
|
*/
|
|
60
|
-
export declare function
|
|
78
|
+
export declare function log(message: string): void;
|
|
61
79
|
export interface Spinner {
|
|
62
80
|
start(): void;
|
|
63
81
|
stop(finalMessage?: string | null): void;
|
|
64
82
|
succeed(message: string): void;
|
|
65
83
|
fail(message: string): void;
|
|
84
|
+
update(message: string): void;
|
|
66
85
|
}
|
|
67
86
|
/**
|
|
68
87
|
* Create spinner (simple implementation)
|