@litmers/cursorflow-orchestrator 0.1.13 → 0.1.15
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 +37 -0
- package/README.md +83 -2
- package/commands/cursorflow-clean.md +20 -6
- package/commands/cursorflow-prepare.md +1 -1
- package/commands/cursorflow-resume.md +127 -6
- package/commands/cursorflow-run.md +2 -2
- package/commands/cursorflow-signal.md +11 -4
- package/dist/cli/clean.js +164 -12
- package/dist/cli/clean.js.map +1 -1
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +6 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/logs.d.ts +8 -0
- package/dist/cli/logs.js +759 -0
- package/dist/cli/logs.js.map +1 -0
- package/dist/cli/monitor.js +113 -30
- package/dist/cli/monitor.js.map +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/cli/resume.js +367 -18
- package/dist/cli/resume.js.map +1 -1
- package/dist/cli/run.js +9 -0
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/signal.js +34 -20
- package/dist/cli/signal.js.map +1 -1
- package/dist/core/orchestrator.d.ts +13 -1
- package/dist/core/orchestrator.js +396 -35
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/reviewer.d.ts +2 -0
- package/dist/core/reviewer.js +24 -2
- package/dist/core/reviewer.js.map +1 -1
- package/dist/core/runner.d.ts +9 -3
- package/dist/core/runner.js +266 -61
- package/dist/core/runner.js.map +1 -1
- package/dist/utils/config.js +38 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/enhanced-logger.d.ts +210 -0
- package/dist/utils/enhanced-logger.js +1030 -0
- package/dist/utils/enhanced-logger.js.map +1 -0
- package/dist/utils/events.d.ts +59 -0
- package/dist/utils/events.js +37 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/git.d.ts +11 -0
- package/dist/utils/git.js +40 -0
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +4 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/types.d.ts +132 -1
- package/dist/utils/webhook.d.ts +5 -0
- package/dist/utils/webhook.js +109 -0
- package/dist/utils/webhook.js.map +1 -0
- package/examples/README.md +1 -1
- package/package.json +2 -1
- package/scripts/patches/test-cursor-agent.js +1 -1
- package/scripts/simple-logging-test.sh +97 -0
- package/scripts/test-real-cursor-lifecycle.sh +289 -0
- package/scripts/test-real-logging.sh +289 -0
- package/scripts/test-streaming-multi-task.sh +247 -0
- package/src/cli/clean.ts +170 -13
- package/src/cli/index.ts +4 -1
- package/src/cli/logs.ts +863 -0
- package/src/cli/monitor.ts +123 -30
- package/src/cli/prepare.ts +1 -1
- package/src/cli/resume.ts +463 -22
- package/src/cli/run.ts +10 -0
- package/src/cli/signal.ts +43 -27
- package/src/core/orchestrator.ts +458 -36
- package/src/core/reviewer.ts +40 -4
- package/src/core/runner.ts +293 -60
- package/src/utils/config.ts +41 -1
- package/src/utils/enhanced-logger.ts +1166 -0
- package/src/utils/events.ts +117 -0
- package/src/utils/git.ts +40 -0
- package/src/utils/logger.ts +4 -1
- package/src/utils/types.ts +160 -1
- package/src/utils/webhook.ts +85 -0
package/src/cli/signal.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { appendLog, createConversationEntry } from '../utils/state';
|
|
|
13
13
|
interface SignalOptions {
|
|
14
14
|
lane: string | null;
|
|
15
15
|
message: string | null;
|
|
16
|
+
timeout: number | null; // New timeout in milliseconds
|
|
16
17
|
runDir: string | null;
|
|
17
18
|
help: boolean;
|
|
18
19
|
}
|
|
@@ -20,12 +21,14 @@ interface SignalOptions {
|
|
|
20
21
|
function printHelp(): void {
|
|
21
22
|
console.log(`
|
|
22
23
|
Usage: cursorflow signal <lane> "<message>" [options]
|
|
24
|
+
cursorflow signal <lane> --timeout <ms>
|
|
23
25
|
|
|
24
|
-
Directly intervene in a running lane
|
|
26
|
+
Directly intervene in a running lane.
|
|
25
27
|
|
|
26
28
|
Options:
|
|
27
29
|
<lane> Lane name to signal
|
|
28
|
-
"<message>" Message text to send
|
|
30
|
+
"<message>" Message text to send to the agent
|
|
31
|
+
--timeout <ms> Update execution timeout (in milliseconds)
|
|
29
32
|
--run-dir <path> Use a specific run directory (default: latest)
|
|
30
33
|
--help, -h Show help
|
|
31
34
|
`);
|
|
@@ -33,6 +36,7 @@ Options:
|
|
|
33
36
|
|
|
34
37
|
function parseArgs(args: string[]): SignalOptions {
|
|
35
38
|
const runDirIdx = args.indexOf('--run-dir');
|
|
39
|
+
const timeoutIdx = args.indexOf('--timeout');
|
|
36
40
|
|
|
37
41
|
// First non-option is lane, second (or rest joined) is message
|
|
38
42
|
const nonOptions = args.filter(a => !a.startsWith('--'));
|
|
@@ -40,6 +44,7 @@ function parseArgs(args: string[]): SignalOptions {
|
|
|
40
44
|
return {
|
|
41
45
|
lane: nonOptions[0] || null,
|
|
42
46
|
message: nonOptions.slice(1).join(' ') || null,
|
|
47
|
+
timeout: timeoutIdx >= 0 ? parseInt(args[timeoutIdx + 1] || '0') || null : null,
|
|
43
48
|
runDir: runDirIdx >= 0 ? args[runDirIdx + 1] || null : null,
|
|
44
49
|
help: args.includes('--help') || args.includes('-h'),
|
|
45
50
|
};
|
|
@@ -69,11 +74,7 @@ async function signal(args: string[]): Promise<void> {
|
|
|
69
74
|
const logsDir = getLogsDir(config);
|
|
70
75
|
|
|
71
76
|
if (!options.lane) {
|
|
72
|
-
throw new Error('Lane name required: cursorflow signal <lane>
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (!options.message) {
|
|
76
|
-
throw new Error('Message required: cursorflow signal <lane> "<message>"');
|
|
77
|
+
throw new Error('Lane name required: cursorflow signal <lane> ...');
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
let runDir = options.runDir;
|
|
@@ -84,27 +85,42 @@ async function signal(args: string[]): Promise<void> {
|
|
|
84
85
|
if (!runDir || !fs.existsSync(runDir)) {
|
|
85
86
|
throw new Error(`Run directory not found: ${runDir || 'latest'}`);
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
throw new Error(`Conversation log not found at ${convoPath}. Is the lane running?`);
|
|
88
|
+
|
|
89
|
+
const laneDir = path.join(runDir, 'lanes', options.lane);
|
|
90
|
+
if (!fs.existsSync(laneDir)) {
|
|
91
|
+
throw new Error(`Lane directory not found: ${laneDir}`);
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
|
|
94
|
+
// Case 1: Timeout update
|
|
95
|
+
if (options.timeout !== null) {
|
|
96
|
+
const timeoutPath = path.join(laneDir, 'timeout.txt');
|
|
97
|
+
fs.writeFileSync(timeoutPath, String(options.timeout));
|
|
98
|
+
logger.success(`Timeout update signal sent to ${options.lane}: ${options.timeout}ms`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Case 2: Intervention message
|
|
103
|
+
if (options.message) {
|
|
104
|
+
const interventionPath = path.join(laneDir, 'intervention.txt');
|
|
105
|
+
const convoPath = path.join(laneDir, 'conversation.jsonl');
|
|
106
|
+
|
|
107
|
+
logger.info(`Sending signal to lane: ${options.lane}`);
|
|
108
|
+
logger.info(`Message: "${options.message}"`);
|
|
109
|
+
|
|
110
|
+
// 1. Write to intervention.txt for live agents to pick up immediately via stdin
|
|
111
|
+
fs.writeFileSync(interventionPath, options.message);
|
|
112
|
+
|
|
113
|
+
// 2. Also append to conversation log for visibility and history
|
|
114
|
+
const entry = createConversationEntry('system', `[COMMANDER INTERVENTION]\n${options.message}`, {
|
|
115
|
+
task: 'DIRECT_SIGNAL'
|
|
116
|
+
});
|
|
117
|
+
appendLog(convoPath, entry);
|
|
118
|
+
|
|
119
|
+
logger.success('Signal sent successfully. The agent will see this message in its current turn or next step.');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
throw new Error('Either a message or --timeout is required.');
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
export = signal;
|