openpaean 0.7.12 → 0.7.13
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/api/worker-api.d.ts +6 -76
- package/dist/api/worker-api.d.ts.map +1 -1
- package/dist/api/worker-api.js +6 -63
- package/dist/api/worker-api.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/worker.d.ts +0 -7
- package/dist/commands/worker.d.ts.map +0 -1
- package/dist/commands/worker.js +0 -284
- package/dist/commands/worker.js.map +0 -1
- package/dist/ui/terminal/ErrorDisplay.d.ts +0 -63
- package/dist/ui/terminal/ErrorDisplay.d.ts.map +0 -1
- package/dist/ui/terminal/ErrorDisplay.js +0 -113
- package/dist/ui/terminal/ErrorDisplay.js.map +0 -1
- package/dist/ui/terminal/HelpDisplay.d.ts +0 -21
- package/dist/ui/terminal/HelpDisplay.d.ts.map +0 -1
- package/dist/ui/terminal/HelpDisplay.js +0 -89
- package/dist/ui/terminal/HelpDisplay.js.map +0 -1
- package/dist/worker/executors/articulate.d.ts +0 -19
- package/dist/worker/executors/articulate.d.ts.map +0 -1
- package/dist/worker/executors/articulate.js +0 -147
- package/dist/worker/executors/articulate.js.map +0 -1
- package/dist/worker/executors/claude.d.ts +0 -17
- package/dist/worker/executors/claude.d.ts.map +0 -1
- package/dist/worker/executors/claude.js +0 -102
- package/dist/worker/executors/claude.js.map +0 -1
- package/dist/worker/executors/index.d.ts +0 -26
- package/dist/worker/executors/index.d.ts.map +0 -1
- package/dist/worker/executors/index.js +0 -81
- package/dist/worker/executors/index.js.map +0 -1
- package/dist/worker/executors/paeanclaw.d.ts +0 -22
- package/dist/worker/executors/paeanclaw.d.ts.map +0 -1
- package/dist/worker/executors/paeanclaw.js +0 -182
- package/dist/worker/executors/paeanclaw.js.map +0 -1
- package/dist/worker/index.d.ts +0 -10
- package/dist/worker/index.d.ts.map +0 -1
- package/dist/worker/index.js +0 -10
- package/dist/worker/index.js.map +0 -1
- package/dist/worker/service.d.ts +0 -48
- package/dist/worker/service.d.ts.map +0 -1
- package/dist/worker/service.js +0 -559
- package/dist/worker/service.js.map +0 -1
- package/dist/worker/types.d.ts +0 -134
- package/dist/worker/types.d.ts.map +0 -1
- package/dist/worker/types.js +0 -71
- package/dist/worker/types.js.map +0 -1
package/dist/api/worker-api.d.ts
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Worker API
|
|
3
|
-
*
|
|
3
|
+
* Heartbeat and status functions used by the Gateway service.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Task polling/claiming/completion functions were removed — the autonomous
|
|
6
|
+
* WorkerService that consumed them has been replaced by loop + gateway.
|
|
7
7
|
*/
|
|
8
|
-
import type { TodoItem } from './todo.js';
|
|
9
|
-
export interface CliPayload {
|
|
10
|
-
hint?: string;
|
|
11
|
-
workingDirectory?: string;
|
|
12
|
-
timeout?: number;
|
|
13
|
-
requiresConfirmation?: boolean;
|
|
14
|
-
context?: Record<string, unknown>;
|
|
15
|
-
allowedPaths?: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface WorkerTask extends TodoItem {
|
|
18
|
-
taskType: 'remote-agent';
|
|
19
|
-
cliPayload?: CliPayload;
|
|
20
|
-
claimedBySessionId?: string;
|
|
21
|
-
claimedByDeviceName?: string;
|
|
22
|
-
claimedAt?: string;
|
|
23
|
-
}
|
|
24
8
|
export type WorkerStatus = 'idle' | 'running' | 'paused';
|
|
25
9
|
export interface WorkerHeartbeatInput {
|
|
26
10
|
status: WorkerStatus;
|
|
@@ -30,65 +14,11 @@ export interface WorkerHeartbeatInput {
|
|
|
30
14
|
workingDirectory?: string;
|
|
31
15
|
capabilities?: string[];
|
|
32
16
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
message?: string;
|
|
37
|
-
percentage?: number;
|
|
38
|
-
}
|
|
39
|
-
export interface TaskExecutionResult {
|
|
40
|
-
success: boolean;
|
|
41
|
-
output?: string;
|
|
42
|
-
artifacts?: Array<{
|
|
43
|
-
type: 'file' | 'text';
|
|
44
|
-
name: string;
|
|
45
|
-
content: string;
|
|
46
|
-
}>;
|
|
47
|
-
durationMs?: number;
|
|
48
|
-
}
|
|
49
|
-
export interface ActiveWorker {
|
|
50
|
-
sessionId: string;
|
|
51
|
-
deviceName: string;
|
|
52
|
-
deviceType: string;
|
|
53
|
-
status: WorkerStatus;
|
|
54
|
-
capabilities: string[];
|
|
55
|
-
currentTaskId?: string;
|
|
56
|
-
lastHeartbeat?: string;
|
|
57
|
-
}
|
|
58
|
-
export declare function pollWorkerTasks(options?: {
|
|
59
|
-
sessionId: string;
|
|
60
|
-
taskTypes?: Array<'remote-agent'>;
|
|
61
|
-
tags?: string[];
|
|
62
|
-
limit?: number;
|
|
63
|
-
}): Promise<{
|
|
64
|
-
tasks: WorkerTask[];
|
|
65
|
-
count: number;
|
|
66
|
-
}>;
|
|
67
|
-
export declare function claimTask(taskId: string, sessionId: string, deviceName?: string): Promise<{
|
|
68
|
-
success: boolean;
|
|
69
|
-
task?: WorkerTask;
|
|
70
|
-
error?: string;
|
|
71
|
-
}>;
|
|
72
|
-
export declare function releaseTask(taskId: string, sessionId: string, reason?: string): Promise<{
|
|
73
|
-
success: boolean;
|
|
74
|
-
error?: string;
|
|
75
|
-
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Send Worker heartbeat
|
|
19
|
+
*/
|
|
76
20
|
export declare function sendHeartbeat(sessionId: string, input: WorkerHeartbeatInput): Promise<{
|
|
77
21
|
success: boolean;
|
|
78
22
|
error?: string;
|
|
79
23
|
}>;
|
|
80
|
-
export declare function reportProgress(taskId: string, sessionId: string, progress: TaskProgressInput): Promise<{
|
|
81
|
-
success: boolean;
|
|
82
|
-
subtaskId?: string;
|
|
83
|
-
error?: string;
|
|
84
|
-
}>;
|
|
85
|
-
export declare function completeWorkerTask(taskId: string, sessionId: string, result: TaskExecutionResult): Promise<{
|
|
86
|
-
success: boolean;
|
|
87
|
-
error?: string;
|
|
88
|
-
}>;
|
|
89
|
-
export declare function checkConfirmation(taskId: string, subtaskId: string): Promise<{
|
|
90
|
-
approved: boolean;
|
|
91
|
-
error?: string;
|
|
92
|
-
}>;
|
|
93
|
-
export declare function getActiveWorkers(): Promise<ActiveWorker[]>;
|
|
94
24
|
//# sourceMappingURL=worker-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-api.d.ts","sourceRoot":"","sources":["../../src/api/worker-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"worker-api.d.ts","sourceRoot":"","sources":["../../src/api/worker-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAMD;;GAEG;AACH,wBAAsB,aAAa,CAC/B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAW/C"}
|
package/dist/api/worker-api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Worker API
|
|
3
|
-
*
|
|
3
|
+
* Heartbeat and status functions used by the Gateway service.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Task polling/claiming/completion functions were removed — the autonomous
|
|
6
|
+
* WorkerService that consumed them has been replaced by loop + gateway.
|
|
7
7
|
*/
|
|
8
8
|
import { createNonClearingApiClient } from './client.js';
|
|
9
9
|
let cachedClient = null;
|
|
@@ -16,26 +16,9 @@ function getWorkerApiClient() {
|
|
|
16
16
|
// ============================================
|
|
17
17
|
// API Functions
|
|
18
18
|
// ============================================
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return response.data.data;
|
|
23
|
-
}
|
|
24
|
-
export async function claimTask(taskId, sessionId, deviceName) {
|
|
25
|
-
const client = getWorkerApiClient();
|
|
26
|
-
const response = await client.post(`/sdk/worker/claim/${taskId}`, { sessionId, deviceName });
|
|
27
|
-
return response.data;
|
|
28
|
-
}
|
|
29
|
-
export async function releaseTask(taskId, sessionId, reason) {
|
|
30
|
-
const client = getWorkerApiClient();
|
|
31
|
-
try {
|
|
32
|
-
const response = await client.post(`/sdk/worker/release/${taskId}`, { sessionId, reason });
|
|
33
|
-
return response.data;
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
return { success: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
19
|
+
/**
|
|
20
|
+
* Send Worker heartbeat
|
|
21
|
+
*/
|
|
39
22
|
export async function sendHeartbeat(sessionId, input) {
|
|
40
23
|
const client = getWorkerApiClient();
|
|
41
24
|
try {
|
|
@@ -46,44 +29,4 @@ export async function sendHeartbeat(sessionId, input) {
|
|
|
46
29
|
return { success: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
47
30
|
}
|
|
48
31
|
}
|
|
49
|
-
export async function reportProgress(taskId, sessionId, progress) {
|
|
50
|
-
const client = getWorkerApiClient();
|
|
51
|
-
try {
|
|
52
|
-
const response = await client.post(`/sdk/worker/progress/${taskId}`, { sessionId, ...progress });
|
|
53
|
-
return response.data;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
return { success: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export async function completeWorkerTask(taskId, sessionId, result) {
|
|
60
|
-
const client = getWorkerApiClient();
|
|
61
|
-
try {
|
|
62
|
-
const response = await client.post(`/sdk/worker/complete/${taskId}`, { sessionId, result });
|
|
63
|
-
return response.data;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
return { success: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export async function checkConfirmation(taskId, subtaskId) {
|
|
70
|
-
const client = getWorkerApiClient();
|
|
71
|
-
try {
|
|
72
|
-
const response = await client.get(`/sdk/worker/confirmation/${taskId}/${subtaskId}`);
|
|
73
|
-
return { approved: response.data.approved };
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
return { approved: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export async function getActiveWorkers() {
|
|
80
|
-
const client = getWorkerApiClient();
|
|
81
|
-
try {
|
|
82
|
-
const response = await client.get('/sdk/worker/active');
|
|
83
|
-
return response.data.data;
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
32
|
//# sourceMappingURL=worker-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-api.js","sourceRoot":"","sources":["../../src/api/worker-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-api.js","sourceRoot":"","sources":["../../src/api/worker-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,IAAI,YAAY,GAAyB,IAAI,CAAC;AAE9C,SAAS,kBAAkB;IACvB,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,YAAY,GAAG,0BAA0B,EAAE,CAAC;IAChD,CAAC;IACD,OAAO,YAAY,CAAC;AACxB,CAAC;AAiBD,+CAA+C;AAC/C,gBAAgB;AAChB,+CAA+C;AAE/C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAC/B,SAAiB,EACjB,KAA2B;IAE3B,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAC9B,uBAAuB,EACvB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,CAC1B,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IAC/F,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/commands/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8DpC,eAAO,MAAM,aAAa,SAC8C,CAAC"}
|
package/dist/commands/worker.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worker Command
|
|
3
|
-
* CLI commands for the OpenPaean Local Autonomous Worker
|
|
4
|
-
*/
|
|
5
|
-
import { Command } from 'commander';
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
import { writeFileSync, readFileSync, existsSync, unlinkSync } from 'fs';
|
|
8
|
-
import { join } from 'path';
|
|
9
|
-
import { WorkerService, DEFAULT_WORKER_CONFIG, getExecutorRegistry, ArticulateExecutor, ClaudeExecutor, PaeanclawExecutor, } from '../worker/index.js';
|
|
10
|
-
import { isAuthenticated, getConfigDir } from '../utils/config.js';
|
|
11
|
-
import * as output from '../utils/output.js';
|
|
12
|
-
function getWorkerPidFile() {
|
|
13
|
-
return join(getConfigDir(), 'worker.pid');
|
|
14
|
-
}
|
|
15
|
-
function writeWorkerPid(workspace) {
|
|
16
|
-
const info = {
|
|
17
|
-
pid: process.pid,
|
|
18
|
-
startedAt: new Date().toISOString(),
|
|
19
|
-
workspace,
|
|
20
|
-
};
|
|
21
|
-
try {
|
|
22
|
-
writeFileSync(getWorkerPidFile(), JSON.stringify(info, null, 2));
|
|
23
|
-
}
|
|
24
|
-
catch { /* best effort */ }
|
|
25
|
-
}
|
|
26
|
-
function readWorkerPid() {
|
|
27
|
-
try {
|
|
28
|
-
if (!existsSync(getWorkerPidFile()))
|
|
29
|
-
return null;
|
|
30
|
-
return JSON.parse(readFileSync(getWorkerPidFile(), 'utf-8'));
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function removeWorkerPid() {
|
|
37
|
-
try {
|
|
38
|
-
unlinkSync(getWorkerPidFile());
|
|
39
|
-
}
|
|
40
|
-
catch { /* ignore */ }
|
|
41
|
-
}
|
|
42
|
-
function isWorkerRunning(pid) {
|
|
43
|
-
try {
|
|
44
|
-
process.kill(pid, 0);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function requireAuth() {
|
|
52
|
-
if (!isAuthenticated()) {
|
|
53
|
-
output.error('Not authenticated. Please run "openpaean login" first.');
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export const workerCommand = new Command('worker')
|
|
58
|
-
.description('Autonomous worker mode for continuous task execution');
|
|
59
|
-
workerCommand
|
|
60
|
-
.command('start')
|
|
61
|
-
.description('Start the autonomous worker loop')
|
|
62
|
-
.option('-i, --interval <ms>', 'Poll interval in milliseconds', String(DEFAULT_WORKER_CONFIG.pollInterval))
|
|
63
|
-
.option('-r, --max-retries <n>', 'Maximum retries per task', String(DEFAULT_WORKER_CONFIG.maxRetries))
|
|
64
|
-
.option('-t, --timeout <ms>', 'Task timeout in milliseconds', String(DEFAULT_WORKER_CONFIG.taskTimeout))
|
|
65
|
-
.option('--no-verification', 'Disable verification step')
|
|
66
|
-
.option('-d, --debug', 'Enable debug logging')
|
|
67
|
-
.action(async (options) => {
|
|
68
|
-
console.log(chalk.yellow('\n [Deprecated] `openpaean worker start` will be removed in a future release.'));
|
|
69
|
-
console.log(chalk.yellow(' Use `openpaean --worker` to enable the worker within the interactive CLI.\n'));
|
|
70
|
-
requireAuth();
|
|
71
|
-
const parsedInterval = parseInt(options.interval, 10);
|
|
72
|
-
const parsedRetries = parseInt(options.maxRetries, 10);
|
|
73
|
-
const parsedTimeout = parseInt(options.timeout, 10);
|
|
74
|
-
const config = {
|
|
75
|
-
pollInterval: Math.max(1000, isNaN(parsedInterval) ? DEFAULT_WORKER_CONFIG.pollInterval : parsedInterval),
|
|
76
|
-
maxRetries: Math.max(1, Math.min(10, isNaN(parsedRetries) ? DEFAULT_WORKER_CONFIG.maxRetries : parsedRetries)),
|
|
77
|
-
taskTimeout: Math.max(10000, isNaN(parsedTimeout) ? DEFAULT_WORKER_CONFIG.taskTimeout : parsedTimeout),
|
|
78
|
-
verificationEnabled: options.verification !== false,
|
|
79
|
-
debug: options.debug ?? false,
|
|
80
|
-
autonomousMode: true,
|
|
81
|
-
};
|
|
82
|
-
console.log('');
|
|
83
|
-
console.log(chalk.bold.cyan(' ╔══════════════════════════════════════════════════╗'));
|
|
84
|
-
console.log(chalk.bold.cyan(' ║') + chalk.bold.white(' OPENPAEAN WORKER ') + chalk.green('●') + chalk.white(' Starting...') + chalk.bold.cyan(' ║'));
|
|
85
|
-
console.log(chalk.bold.cyan(' ╚══════════════════════════════════════════════════╝'));
|
|
86
|
-
console.log('');
|
|
87
|
-
output.tableRow('Poll Interval', `${config.pollInterval / 1000}s`, 20);
|
|
88
|
-
output.tableRow('Max Retries', String(config.maxRetries), 20);
|
|
89
|
-
output.tableRow('Task Timeout', `${config.taskTimeout / 60000}min`, 20);
|
|
90
|
-
output.tableRow('Verification', config.verificationEnabled ? 'Enabled' : 'Disabled', 20);
|
|
91
|
-
console.log('');
|
|
92
|
-
const worker = new WorkerService(config);
|
|
93
|
-
writeWorkerPid();
|
|
94
|
-
const startTime = Date.now();
|
|
95
|
-
worker.onEvent((event) => {
|
|
96
|
-
const elapsed = output.formatDuration(Date.now() - startTime);
|
|
97
|
-
switch (event.type) {
|
|
98
|
-
case 'started':
|
|
99
|
-
console.log(chalk.green('✓') + chalk.dim(' Worker started'));
|
|
100
|
-
console.log(chalk.dim(` Press Ctrl+C to stop\n`));
|
|
101
|
-
break;
|
|
102
|
-
case 'stopped':
|
|
103
|
-
console.log(chalk.yellow('●') + chalk.dim(' Worker stopped'));
|
|
104
|
-
break;
|
|
105
|
-
case 'task_claimed':
|
|
106
|
-
console.log(chalk.cyan('▶') + ` Task claimed: ${chalk.white(output.truncate(event.task.content, 50))}`);
|
|
107
|
-
console.log(chalk.dim(` ID: ${event.task.id} | Priority: ${event.task.priority}`));
|
|
108
|
-
break;
|
|
109
|
-
case 'task_started':
|
|
110
|
-
console.log(chalk.blue('◉') + ` Executing (attempt ${event.attempt}/${config.maxRetries})...`);
|
|
111
|
-
break;
|
|
112
|
-
case 'task_completed':
|
|
113
|
-
console.log(chalk.green('✓') + ` Task completed in ${output.formatDuration(event.duration)}`);
|
|
114
|
-
console.log('');
|
|
115
|
-
break;
|
|
116
|
-
case 'task_failed':
|
|
117
|
-
console.log(chalk.red('✗') + ` Task failed: ${chalk.dim(output.truncate(event.error, 60))}`);
|
|
118
|
-
if (event.willRetry) {
|
|
119
|
-
console.log(chalk.yellow('↻') + chalk.dim(' Will retry...'));
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
case 'task_verification_failed':
|
|
123
|
-
console.log(chalk.yellow('⚠') + ' Verification failed, will retry...');
|
|
124
|
-
break;
|
|
125
|
-
case 'poll_empty':
|
|
126
|
-
if (config.debug) {
|
|
127
|
-
console.log(chalk.dim(` [${elapsed}] No pending tasks`));
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
130
|
-
case 'error':
|
|
131
|
-
console.log(chalk.red('✗') + ` Error: ${event.error}`);
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
let cleaningUp = false;
|
|
136
|
-
let lastSigintTime = 0;
|
|
137
|
-
const cleanup = async () => {
|
|
138
|
-
if (cleaningUp)
|
|
139
|
-
return;
|
|
140
|
-
cleaningUp = true;
|
|
141
|
-
process.off('SIGINT', handleSigint);
|
|
142
|
-
process.off('SIGTERM', cleanup);
|
|
143
|
-
console.log('');
|
|
144
|
-
console.log(chalk.yellow('Stopping worker...'));
|
|
145
|
-
try {
|
|
146
|
-
await worker.stop();
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
if (config.debug) {
|
|
150
|
-
console.log(chalk.dim(` Warning: cleanup error: ${err.message}`));
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
removeWorkerPid();
|
|
154
|
-
const state = worker.getState();
|
|
155
|
-
console.log('');
|
|
156
|
-
console.log(chalk.bold('Session Summary:'));
|
|
157
|
-
output.tableRow('Completed', String(state.completedCount), 15);
|
|
158
|
-
output.tableRow('Failed', String(state.failedCount), 15);
|
|
159
|
-
output.tableRow('Uptime', output.formatDuration(Date.now() - startTime), 15);
|
|
160
|
-
console.log('');
|
|
161
|
-
process.exit(0);
|
|
162
|
-
};
|
|
163
|
-
const handleSigint = () => {
|
|
164
|
-
const now = Date.now();
|
|
165
|
-
if (now - lastSigintTime < 1000) {
|
|
166
|
-
cleanup();
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
lastSigintTime = now;
|
|
170
|
-
console.log('');
|
|
171
|
-
console.log(chalk.dim(' Press Ctrl+C again to stop the worker'));
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
process.on('SIGINT', handleSigint);
|
|
175
|
-
process.on('SIGTERM', cleanup);
|
|
176
|
-
try {
|
|
177
|
-
await worker.start();
|
|
178
|
-
await new Promise(() => { });
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
console.log(chalk.red('✗') + ` Failed to start worker: ${error.message}`);
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
workerCommand
|
|
186
|
-
.command('status')
|
|
187
|
-
.description('Check worker status')
|
|
188
|
-
.option('--json', 'Output as JSON')
|
|
189
|
-
.action((options) => {
|
|
190
|
-
const pidInfo = readWorkerPid();
|
|
191
|
-
if (!pidInfo) {
|
|
192
|
-
console.log(chalk.dim('No worker is currently running.'));
|
|
193
|
-
console.log(chalk.dim('Use `openpaean worker start` to start a worker.'));
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const running = isWorkerRunning(pidInfo.pid);
|
|
197
|
-
if (!running) {
|
|
198
|
-
removeWorkerPid();
|
|
199
|
-
console.log(chalk.dim('No worker is currently running (stale PID file cleaned up).'));
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (options.json) {
|
|
203
|
-
console.log(JSON.stringify({ ...pidInfo, running }, null, 2));
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
const uptime = output.formatDuration(Date.now() - new Date(pidInfo.startedAt).getTime());
|
|
207
|
-
console.log(chalk.bold.blue('\nWorker Status\n'));
|
|
208
|
-
output.tableRow('Status', chalk.green('Running'), 15);
|
|
209
|
-
output.tableRow('PID', String(pidInfo.pid), 15);
|
|
210
|
-
output.tableRow('Uptime', uptime, 15);
|
|
211
|
-
output.tableRow('Started', new Date(pidInfo.startedAt).toLocaleString(), 15);
|
|
212
|
-
if (pidInfo.workspace) {
|
|
213
|
-
output.tableRow('Workspace', pidInfo.workspace, 15);
|
|
214
|
-
}
|
|
215
|
-
console.log('');
|
|
216
|
-
});
|
|
217
|
-
workerCommand
|
|
218
|
-
.command('prompt')
|
|
219
|
-
.description('Execute a task with a specific executor')
|
|
220
|
-
.argument('[prompt...]', 'Natural language task prompt')
|
|
221
|
-
.option('-p, --prompt <text>', 'Prompt text (alternative to positional)')
|
|
222
|
-
.option('-e, --executor <type>', 'Force specific executor (claude|articulate)')
|
|
223
|
-
.option('--auto-approve', 'Skip confirmation prompts')
|
|
224
|
-
.option('-w, --workspace <path>', 'Working directory')
|
|
225
|
-
.option('-v, --verbose', 'Enable verbose logging')
|
|
226
|
-
.action(async (promptArgs, options) => {
|
|
227
|
-
requireAuth();
|
|
228
|
-
const promptText = options.prompt || promptArgs.join(' ');
|
|
229
|
-
if (!promptText.trim()) {
|
|
230
|
-
output.error('No prompt provided. Usage: openpaean worker prompt "Your task"');
|
|
231
|
-
process.exit(1);
|
|
232
|
-
}
|
|
233
|
-
const debug = options.verbose ?? false;
|
|
234
|
-
const cwd = options.workspace || process.cwd();
|
|
235
|
-
const registry = getExecutorRegistry();
|
|
236
|
-
registry.register(new ArticulateExecutor());
|
|
237
|
-
registry.register(new ClaudeExecutor());
|
|
238
|
-
registry.register(new PaeanclawExecutor());
|
|
239
|
-
const executorType = options.executor || 'articulate';
|
|
240
|
-
const available = await registry.getAvailable();
|
|
241
|
-
if (debug) {
|
|
242
|
-
console.log(chalk.dim(`Available executors: ${available.join(', ')}`));
|
|
243
|
-
}
|
|
244
|
-
const finalExecutor = available.includes(executorType) ? executorType : (available[0] || 'articulate');
|
|
245
|
-
if (!available.includes(executorType)) {
|
|
246
|
-
console.log(chalk.yellow('⚠') + ` Executor '${executorType}' not available, using '${finalExecutor}'`);
|
|
247
|
-
}
|
|
248
|
-
console.log(chalk.blue('◉') + ` Executing with ${chalk.bold(finalExecutor)} executor...`);
|
|
249
|
-
console.log(chalk.dim('─'.repeat(50)));
|
|
250
|
-
const startTime = Date.now();
|
|
251
|
-
const result = await registry.execute(finalExecutor, promptText, {
|
|
252
|
-
cwd,
|
|
253
|
-
skipPermissions: options.autoApprove,
|
|
254
|
-
timeout: 600000,
|
|
255
|
-
onOutput: (text, stream) => {
|
|
256
|
-
const lines = text.split('\n');
|
|
257
|
-
for (const line of lines) {
|
|
258
|
-
if (line.trim()) {
|
|
259
|
-
const prefix = stream === 'stderr' ? chalk.yellow('│') : chalk.dim('│');
|
|
260
|
-
console.log(prefix + ' ' + output.truncate(line, 70));
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
});
|
|
265
|
-
console.log(chalk.dim('─'.repeat(50)));
|
|
266
|
-
const totalDuration = Date.now() - startTime;
|
|
267
|
-
if (result.success) {
|
|
268
|
-
console.log(chalk.green('✓') + ` Execution completed`);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
console.log(chalk.red('✗') + ` Execution failed`);
|
|
272
|
-
if (result.error) {
|
|
273
|
-
console.log(chalk.dim(` Error: ${output.truncate(result.error, 60)}`));
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
console.log('');
|
|
277
|
-
console.log(chalk.bold('Summary:'));
|
|
278
|
-
output.tableRow('Status', result.success ? 'Success' : 'Failed', 15);
|
|
279
|
-
output.tableRow('Executor', finalExecutor, 15);
|
|
280
|
-
output.tableRow('Duration', output.formatDuration(totalDuration), 15);
|
|
281
|
-
console.log('');
|
|
282
|
-
process.exit(result.success ? 0 : 1);
|
|
283
|
-
});
|
|
284
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/commands/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC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ure
|
|
7
|
-
*/
|
|
8
|
-
export interface ErrorDetail {
|
|
9
|
-
message: string;
|
|
10
|
-
cause?: string;
|
|
11
|
-
suggestion?: string;
|
|
12
|
-
code?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Format an error for display
|
|
16
|
-
*/
|
|
17
|
-
export declare function formatError(detail: ErrorDetail): string;
|
|
18
|
-
/**
|
|
19
|
-
* Display an error and return the formatted string
|
|
20
|
-
*/
|
|
21
|
-
export declare function displayError(detail: ErrorDetail): string;
|
|
22
|
-
/**
|
|
23
|
-
* Common error templates
|
|
24
|
-
*/
|
|
25
|
-
export declare const Errors: {
|
|
26
|
-
/**
|
|
27
|
-
* Network error
|
|
28
|
-
*/
|
|
29
|
-
network: (cause?: string) => ErrorDetail;
|
|
30
|
-
/**
|
|
31
|
-
* Authentication error
|
|
32
|
-
*/
|
|
33
|
-
auth: () => ErrorDetail;
|
|
34
|
-
/**
|
|
35
|
-
* MCP connection error
|
|
36
|
-
*/
|
|
37
|
-
mcpConnection: (serverName: string, cause?: string) => ErrorDetail;
|
|
38
|
-
/**
|
|
39
|
-
* MCP tool error
|
|
40
|
-
*/
|
|
41
|
-
mcpTool: (toolName: string, cause?: string) => ErrorDetail;
|
|
42
|
-
/**
|
|
43
|
-
* File not found
|
|
44
|
-
*/
|
|
45
|
-
fileNotFound: (path: string) => ErrorDetail;
|
|
46
|
-
/**
|
|
47
|
-
* Invalid input
|
|
48
|
-
*/
|
|
49
|
-
invalidInput: (field?: string) => ErrorDetail;
|
|
50
|
-
/**
|
|
51
|
-
* Generic error
|
|
52
|
-
*/
|
|
53
|
-
generic: (message: string, suggestion?: string) => ErrorDetail;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Parse an Error object into ErrorDetail
|
|
57
|
-
*/
|
|
58
|
-
export declare function parseError(err: unknown): ErrorDetail;
|
|
59
|
-
/**
|
|
60
|
-
* Display error from caught exception
|
|
61
|
-
*/
|
|
62
|
-
export declare function showError(err: unknown): string;
|
|
63
|
-
//# sourceMappingURL=ErrorDisplay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorDisplay.d.ts","sourceRoot":"","sources":["../../../src/ui/terminal/ErrorDisplay.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAsBvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;IACf;;OAEG;sBACe,MAAM,KAAG,WAAW;IAMtC;;OAEG;gBACO,WAAW;IAMrB;;OAEG;gCACyB,MAAM,UAAU,MAAM,KAAG,WAAW;IAMhE;;OAEG;wBACiB,MAAM,UAAU,MAAM,KAAG,WAAW;IAMxD;;OAEG;yBACkB,MAAM,KAAG,WAAW;IAKzC;;OAEG;2BACoB,MAAM,KAAG,WAAW;IAK3C;;OAEG;uBACgB,MAAM,eAAe,MAAM,KAAG,WAAW;CAI/D,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CAapD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAG9C"}
|