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/worker/service.js
DELETED
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worker Service
|
|
3
|
-
* Core service for the OpenPaean Local Autonomous Worker.
|
|
4
|
-
* Manages task polling, execution, and lifecycle.
|
|
5
|
-
*/
|
|
6
|
-
import { EventEmitter } from 'events';
|
|
7
|
-
import { agentService } from '../agent/service.js';
|
|
8
|
-
import { updateTodoItem, completeTodoItem, } from '../api/todo.js';
|
|
9
|
-
import { pollWorkerTasks, claimTask, releaseTask, sendHeartbeat, reportProgress, completeWorkerTask, checkConfirmation, } from '../api/worker-api.js';
|
|
10
|
-
import { executeSystemTool } from '../mcp/system.js';
|
|
11
|
-
import { DEFAULT_WORKER_CONFIG, buildTaskPrompt, } from './types.js';
|
|
12
|
-
import { getConfig } from '../utils/config.js';
|
|
13
|
-
import os from 'os';
|
|
14
|
-
export class WorkerService extends EventEmitter {
|
|
15
|
-
config;
|
|
16
|
-
state;
|
|
17
|
-
pollTimer = null;
|
|
18
|
-
heartbeatTimer = null;
|
|
19
|
-
abortController = null;
|
|
20
|
-
mcpState = null;
|
|
21
|
-
onMcpToolCall = null;
|
|
22
|
-
mcpClient = null;
|
|
23
|
-
sessionId;
|
|
24
|
-
deviceName;
|
|
25
|
-
capabilities;
|
|
26
|
-
externalMcp = false;
|
|
27
|
-
idleCheckFn;
|
|
28
|
-
constructor(config = {}) {
|
|
29
|
-
super();
|
|
30
|
-
this.config = { ...DEFAULT_WORKER_CONFIG, ...config };
|
|
31
|
-
this.state = {
|
|
32
|
-
status: 'idle',
|
|
33
|
-
completedCount: 0,
|
|
34
|
-
failedCount: 0,
|
|
35
|
-
};
|
|
36
|
-
this.deviceName = `OpenPaean Worker @ ${os.hostname()}`;
|
|
37
|
-
this.capabilities = ['analyze_project', 'run_script', 'git_status', 'system_info'];
|
|
38
|
-
}
|
|
39
|
-
setMcpState(mcpState, onMcpToolCall, mcpClient) {
|
|
40
|
-
this.mcpState = mcpState;
|
|
41
|
-
this.onMcpToolCall = onMcpToolCall;
|
|
42
|
-
this.mcpClient = mcpClient;
|
|
43
|
-
this.externalMcp = true;
|
|
44
|
-
}
|
|
45
|
-
setIdleCheck(fn) {
|
|
46
|
-
this.idleCheckFn = fn;
|
|
47
|
-
}
|
|
48
|
-
setSessionId(sessionId) {
|
|
49
|
-
this.sessionId = sessionId;
|
|
50
|
-
}
|
|
51
|
-
getSessionId() {
|
|
52
|
-
return this.sessionId;
|
|
53
|
-
}
|
|
54
|
-
async start() {
|
|
55
|
-
if (this.state.status === 'running') {
|
|
56
|
-
throw new Error('Worker is already running');
|
|
57
|
-
}
|
|
58
|
-
this.log('Starting worker...');
|
|
59
|
-
if (!this.sessionId) {
|
|
60
|
-
const config = getConfig();
|
|
61
|
-
this.sessionId = config.deviceSessionId;
|
|
62
|
-
if (!this.sessionId && config.token) {
|
|
63
|
-
const crypto = await import('crypto');
|
|
64
|
-
const hash = crypto.createHash('sha256')
|
|
65
|
-
.update(`${os.hostname()}-${config.token.slice(0, 32)}`)
|
|
66
|
-
.digest('hex')
|
|
67
|
-
.slice(0, 32);
|
|
68
|
-
this.sessionId = `openpaean-worker-${hash}`;
|
|
69
|
-
this.log(`Generated session ID: ${this.sessionId}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!this.sessionId) {
|
|
73
|
-
throw new Error('Session ID required. Please login first.');
|
|
74
|
-
}
|
|
75
|
-
this.state = {
|
|
76
|
-
...this.state,
|
|
77
|
-
status: 'running',
|
|
78
|
-
startedAt: new Date(),
|
|
79
|
-
lastError: undefined,
|
|
80
|
-
};
|
|
81
|
-
this.abortController = new AbortController();
|
|
82
|
-
this.emit('event', { type: 'started' });
|
|
83
|
-
this.startHeartbeat();
|
|
84
|
-
this.pollAndExecute();
|
|
85
|
-
this.pollTimer = setInterval(() => {
|
|
86
|
-
if (this.state.status === 'running' && !this.state.currentTask) {
|
|
87
|
-
this.pollAndExecute();
|
|
88
|
-
}
|
|
89
|
-
}, this.config.pollInterval);
|
|
90
|
-
this.log('Worker started');
|
|
91
|
-
}
|
|
92
|
-
startHeartbeat() {
|
|
93
|
-
this.sendHeartbeatUpdate();
|
|
94
|
-
this.heartbeatTimer = setInterval(() => {
|
|
95
|
-
this.sendHeartbeatUpdate();
|
|
96
|
-
}, 30000);
|
|
97
|
-
}
|
|
98
|
-
async sendHeartbeatUpdate() {
|
|
99
|
-
if (!this.sessionId)
|
|
100
|
-
return;
|
|
101
|
-
try {
|
|
102
|
-
const status = this.state.status === 'running'
|
|
103
|
-
? (this.state.currentTask ? 'running' : 'idle')
|
|
104
|
-
: this.state.status === 'paused' ? 'paused' : 'idle';
|
|
105
|
-
await sendHeartbeat(this.sessionId, {
|
|
106
|
-
status,
|
|
107
|
-
currentTaskId: this.state.currentTask?.task.id,
|
|
108
|
-
completedCount: this.state.completedCount,
|
|
109
|
-
failedCount: this.state.failedCount,
|
|
110
|
-
workingDirectory: this.config.workingDirectory || process.cwd(),
|
|
111
|
-
capabilities: this.capabilities,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
this.log(`Heartbeat error: ${error}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async stop() {
|
|
119
|
-
if (this.state.status === 'idle' || this.state.status === 'stopping')
|
|
120
|
-
return;
|
|
121
|
-
this.log('Stopping worker...');
|
|
122
|
-
this.state.status = 'stopping';
|
|
123
|
-
if (this.pollTimer) {
|
|
124
|
-
clearInterval(this.pollTimer);
|
|
125
|
-
this.pollTimer = null;
|
|
126
|
-
}
|
|
127
|
-
if (this.heartbeatTimer) {
|
|
128
|
-
clearInterval(this.heartbeatTimer);
|
|
129
|
-
this.heartbeatTimer = null;
|
|
130
|
-
}
|
|
131
|
-
if (this.abortController) {
|
|
132
|
-
this.abortController.abort();
|
|
133
|
-
this.abortController = null;
|
|
134
|
-
}
|
|
135
|
-
if (!this.externalMcp && this.mcpClient && typeof this.mcpClient.disconnectAll === 'function') {
|
|
136
|
-
try {
|
|
137
|
-
await this.mcpClient.disconnectAll();
|
|
138
|
-
}
|
|
139
|
-
catch {
|
|
140
|
-
// Ignore disconnect errors
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (this.state.currentTask && this.sessionId) {
|
|
144
|
-
try {
|
|
145
|
-
await releaseTask(this.state.currentTask.task.id, this.sessionId, 'Worker stopped');
|
|
146
|
-
}
|
|
147
|
-
catch (e) {
|
|
148
|
-
this.log(`Failed to release task: ${e}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (this.sessionId) {
|
|
152
|
-
await sendHeartbeat(this.sessionId, {
|
|
153
|
-
status: 'idle',
|
|
154
|
-
completedCount: this.state.completedCount,
|
|
155
|
-
failedCount: this.state.failedCount,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
this.state = { ...this.state, status: 'idle', currentTask: undefined };
|
|
159
|
-
this.emit('event', { type: 'stopped' });
|
|
160
|
-
this.log('Worker stopped');
|
|
161
|
-
}
|
|
162
|
-
pause() {
|
|
163
|
-
if (this.state.status === 'running') {
|
|
164
|
-
this.state.status = 'paused';
|
|
165
|
-
this.emit('event', { type: 'paused' });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
resume() {
|
|
169
|
-
if (this.state.status === 'paused') {
|
|
170
|
-
this.state.status = 'running';
|
|
171
|
-
this.emit('event', { type: 'resumed' });
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
getState() {
|
|
175
|
-
return { ...this.state };
|
|
176
|
-
}
|
|
177
|
-
onEvent(handler) {
|
|
178
|
-
this.on('event', handler);
|
|
179
|
-
}
|
|
180
|
-
async pollAndExecute() {
|
|
181
|
-
if (this.state.status !== 'running')
|
|
182
|
-
return;
|
|
183
|
-
if (this.idleCheckFn && !this.idleCheckFn()) {
|
|
184
|
-
this.log('Host is busy, deferring task poll');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
this.state.lastPollAt = new Date();
|
|
188
|
-
try {
|
|
189
|
-
const task = await this.fetchNextTask();
|
|
190
|
-
if (!task) {
|
|
191
|
-
this.emit('event', { type: 'poll_empty' });
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
this.emit('event', { type: 'task_claimed', task });
|
|
195
|
-
let attempt = 1;
|
|
196
|
-
let previousFailureSummary;
|
|
197
|
-
const maxRetries = this.config.maxRetries;
|
|
198
|
-
while (attempt <= maxRetries) {
|
|
199
|
-
const ctx = {
|
|
200
|
-
task,
|
|
201
|
-
attempt,
|
|
202
|
-
maxRetries,
|
|
203
|
-
previousFailureSummary,
|
|
204
|
-
startedAt: new Date(),
|
|
205
|
-
};
|
|
206
|
-
this.state.currentTask = ctx;
|
|
207
|
-
this.emit('event', { type: 'task_started', task, attempt });
|
|
208
|
-
const result = await this.executeTask(ctx);
|
|
209
|
-
if (result.success) {
|
|
210
|
-
if (this.config.verificationEnabled) {
|
|
211
|
-
const verified = await this.verifyTask(ctx);
|
|
212
|
-
if (!verified) {
|
|
213
|
-
this.emit('event', { type: 'task_verification_failed', task });
|
|
214
|
-
previousFailureSummary = 'Verification failed after execution.';
|
|
215
|
-
attempt++;
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
try {
|
|
220
|
-
await completeTodoItem(task.id, result.message);
|
|
221
|
-
await this.reportTaskCompletion(ctx, true, result.message || '', result.durationMs || 0);
|
|
222
|
-
}
|
|
223
|
-
catch (e) {
|
|
224
|
-
this.log(`Failed to mark task as complete: ${e}`);
|
|
225
|
-
}
|
|
226
|
-
this.state.completedCount++;
|
|
227
|
-
this.emit('event', {
|
|
228
|
-
type: 'task_completed',
|
|
229
|
-
task,
|
|
230
|
-
duration: Date.now() - ctx.startedAt.getTime()
|
|
231
|
-
});
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
previousFailureSummary = result.error || 'Unknown error';
|
|
236
|
-
const isUnrecoverable = this.isUnrecoverableError(previousFailureSummary);
|
|
237
|
-
const willRetry = !isUnrecoverable && attempt < maxRetries;
|
|
238
|
-
this.emit('event', {
|
|
239
|
-
type: 'task_failed',
|
|
240
|
-
task,
|
|
241
|
-
error: previousFailureSummary,
|
|
242
|
-
willRetry,
|
|
243
|
-
});
|
|
244
|
-
if (willRetry) {
|
|
245
|
-
try {
|
|
246
|
-
await updateTodoItem(task.id, {
|
|
247
|
-
metadata: {
|
|
248
|
-
...task.metadata,
|
|
249
|
-
lastFailureSummary: previousFailureSummary,
|
|
250
|
-
retryCount: attempt,
|
|
251
|
-
lastAttemptAt: new Date().toISOString(),
|
|
252
|
-
},
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
catch (e) {
|
|
256
|
-
this.log(`Failed to update task metadata: ${e}`);
|
|
257
|
-
}
|
|
258
|
-
attempt++;
|
|
259
|
-
const backoffMs = this.getBackoffDelay(attempt);
|
|
260
|
-
this.log(`Retrying in ${backoffMs / 1000}s (attempt ${attempt}/${maxRetries})...`);
|
|
261
|
-
await this.sleep(backoffMs);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
this.state.failedCount++;
|
|
265
|
-
try {
|
|
266
|
-
await updateTodoItem(task.id, {
|
|
267
|
-
status: 'cancelled',
|
|
268
|
-
metadata: {
|
|
269
|
-
...task.metadata,
|
|
270
|
-
lastFailure: previousFailureSummary,
|
|
271
|
-
failedAt: new Date().toISOString(),
|
|
272
|
-
retriesExhausted: true,
|
|
273
|
-
},
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
catch (e) {
|
|
277
|
-
this.log(`Failed to mark task as cancelled: ${e}`);
|
|
278
|
-
}
|
|
279
|
-
await this.reportTaskCompletion(ctx, false, previousFailureSummary, Date.now() - ctx.startedAt.getTime());
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
this.state.currentTask = undefined;
|
|
285
|
-
}
|
|
286
|
-
catch (error) {
|
|
287
|
-
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
288
|
-
this.state.lastError = errorMsg;
|
|
289
|
-
this.emit('event', { type: 'error', error: errorMsg });
|
|
290
|
-
this.log(`Error in poll cycle: ${errorMsg}. Cooling down...`);
|
|
291
|
-
await this.sleep(this.config.cooldownOnError);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
async fetchNextTask() {
|
|
295
|
-
if (!this.sessionId)
|
|
296
|
-
return null;
|
|
297
|
-
try {
|
|
298
|
-
const { tasks } = await pollWorkerTasks({
|
|
299
|
-
sessionId: this.sessionId,
|
|
300
|
-
taskTypes: ['remote-agent'],
|
|
301
|
-
limit: 5,
|
|
302
|
-
});
|
|
303
|
-
if (tasks.length === 0)
|
|
304
|
-
return null;
|
|
305
|
-
for (const task of tasks) {
|
|
306
|
-
const claimResult = await claimTask(task.id, this.sessionId, this.deviceName);
|
|
307
|
-
if (claimResult.success && claimResult.task) {
|
|
308
|
-
this.log(`Claimed task: ${claimResult.task.id}`);
|
|
309
|
-
return claimResult.task;
|
|
310
|
-
}
|
|
311
|
-
this.log(`Failed to claim task ${task.id}: ${claimResult.error}`);
|
|
312
|
-
}
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
catch (error) {
|
|
316
|
-
this.log(`Failed to fetch tasks: ${error}`);
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
async executeTask(ctx) {
|
|
321
|
-
const startTime = Date.now();
|
|
322
|
-
const prompt = buildTaskPrompt(ctx);
|
|
323
|
-
const taskId = ctx.task.id;
|
|
324
|
-
if (this.sessionId) {
|
|
325
|
-
await reportProgress(taskId, this.sessionId, {
|
|
326
|
-
stage: 'started',
|
|
327
|
-
message: `Agent started processing: ${ctx.task.content.slice(0, 100)}`,
|
|
328
|
-
}).catch(() => { });
|
|
329
|
-
}
|
|
330
|
-
return new Promise((resolve) => {
|
|
331
|
-
let responseText = '';
|
|
332
|
-
let hasError = false;
|
|
333
|
-
let errorMessage = '';
|
|
334
|
-
let toolCallCount = 0;
|
|
335
|
-
let settled = false;
|
|
336
|
-
const timeout = setTimeout(() => {
|
|
337
|
-
if (settled)
|
|
338
|
-
return;
|
|
339
|
-
settled = true;
|
|
340
|
-
agentService.abort();
|
|
341
|
-
this.emit('event', { type: 'worker_done', taskId, success: false, output: 'Task timed out' });
|
|
342
|
-
resolve({
|
|
343
|
-
success: false,
|
|
344
|
-
error: `Task timed out after ${this.config.taskTimeout}ms`,
|
|
345
|
-
durationMs: Date.now() - startTime,
|
|
346
|
-
});
|
|
347
|
-
}, this.config.taskTimeout);
|
|
348
|
-
const callbacks = {
|
|
349
|
-
onContent: (text, partial) => {
|
|
350
|
-
if (partial) {
|
|
351
|
-
responseText += text;
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
responseText = text;
|
|
355
|
-
}
|
|
356
|
-
this.emit('event', { type: 'worker_content', text, partial });
|
|
357
|
-
},
|
|
358
|
-
onToolCall: (id, name) => {
|
|
359
|
-
this.emit('event', { type: 'worker_tool_call', id, name, isMcp: false });
|
|
360
|
-
},
|
|
361
|
-
onToolResult: (id, name, result) => {
|
|
362
|
-
const isError = result && typeof result === 'object' &&
|
|
363
|
-
result.isError === true;
|
|
364
|
-
this.emit('event', { type: 'worker_tool_result', id, name, status: isError ? 'error' : 'completed' });
|
|
365
|
-
},
|
|
366
|
-
onMcpToolCall: async (callId, serverName, toolName, args) => {
|
|
367
|
-
toolCallCount++;
|
|
368
|
-
this.emit('event', { type: 'worker_tool_call', id: callId, name: toolName, isMcp: true, serverName });
|
|
369
|
-
if (this.sessionId && toolCallCount % 3 === 1) {
|
|
370
|
-
reportProgress(taskId, this.sessionId, {
|
|
371
|
-
stage: 'executing',
|
|
372
|
-
message: `Using tool: ${toolName}`,
|
|
373
|
-
}).catch(() => { });
|
|
374
|
-
}
|
|
375
|
-
if (typeof this.onMcpToolCall === 'function') {
|
|
376
|
-
try {
|
|
377
|
-
const result = await this.onMcpToolCall(callId, serverName, toolName, args);
|
|
378
|
-
this.emit('event', { type: 'worker_tool_result', id: callId, name: toolName, status: result.isError ? 'error' : 'completed' });
|
|
379
|
-
return result;
|
|
380
|
-
}
|
|
381
|
-
catch (error) {
|
|
382
|
-
this.emit('event', { type: 'worker_tool_result', id: callId, name: toolName, status: 'error' });
|
|
383
|
-
return {
|
|
384
|
-
content: [{ type: 'text', text: `Error: ${error}` }],
|
|
385
|
-
isError: true,
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (toolName.startsWith('paean_execute') || toolName.startsWith('paean_check') || toolName.startsWith('paean_kill')) {
|
|
390
|
-
const result = await executeSystemTool(toolName, args, {
|
|
391
|
-
autonomousMode: this.config.autonomousMode,
|
|
392
|
-
debug: this.config.debug,
|
|
393
|
-
});
|
|
394
|
-
this.emit('event', { type: 'worker_tool_result', id: callId, name: toolName, status: result.success ? 'completed' : 'error' });
|
|
395
|
-
return {
|
|
396
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
397
|
-
isError: !result.success,
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
this.emit('event', { type: 'worker_tool_result', id: callId, name: toolName, status: 'error' });
|
|
401
|
-
return {
|
|
402
|
-
content: [{ type: 'text', text: 'MCP not available' }],
|
|
403
|
-
isError: true,
|
|
404
|
-
};
|
|
405
|
-
},
|
|
406
|
-
onError: (error) => {
|
|
407
|
-
hasError = true;
|
|
408
|
-
errorMessage = error;
|
|
409
|
-
},
|
|
410
|
-
onDone: async (convId) => {
|
|
411
|
-
clearTimeout(timeout);
|
|
412
|
-
if (settled)
|
|
413
|
-
return;
|
|
414
|
-
settled = true;
|
|
415
|
-
if (ctx.conversationId === undefined) {
|
|
416
|
-
ctx.conversationId = convId;
|
|
417
|
-
}
|
|
418
|
-
const durationMs = Date.now() - startTime;
|
|
419
|
-
if (hasError) {
|
|
420
|
-
this.emit('event', { type: 'worker_done', taskId, success: false, output: errorMessage });
|
|
421
|
-
resolve({ success: false, error: errorMessage, durationMs });
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
this.emit('event', { type: 'worker_done', taskId, success: true, output: responseText.slice(0, 500) });
|
|
425
|
-
if (this.sessionId) {
|
|
426
|
-
await reportProgress(taskId, this.sessionId, {
|
|
427
|
-
stage: 'verifying',
|
|
428
|
-
message: 'Agent completed, verifying results...',
|
|
429
|
-
}).catch(() => { });
|
|
430
|
-
}
|
|
431
|
-
resolve({ success: true, message: responseText.slice(0, 500), durationMs });
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
};
|
|
435
|
-
agentService.streamMessage(prompt, callbacks, {
|
|
436
|
-
conversationId: ctx.conversationId,
|
|
437
|
-
mcpState: this.mcpState,
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
async reportTaskCompletion(ctx, success, output, durationMs) {
|
|
442
|
-
if (!this.sessionId)
|
|
443
|
-
return;
|
|
444
|
-
try {
|
|
445
|
-
await completeWorkerTask(ctx.task.id, this.sessionId, {
|
|
446
|
-
success,
|
|
447
|
-
output: output.slice(0, 2000),
|
|
448
|
-
durationMs,
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
catch (error) {
|
|
452
|
-
this.log(`Failed to report task completion: ${error}`);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
async verifyTask(ctx) {
|
|
456
|
-
const verifyCmd = ctx.task.metadata?.verificationCommand;
|
|
457
|
-
if (!verifyCmd)
|
|
458
|
-
return true;
|
|
459
|
-
try {
|
|
460
|
-
const result = await executeSystemTool('paean_execute_shell', {
|
|
461
|
-
command: verifyCmd,
|
|
462
|
-
timeout: 60000,
|
|
463
|
-
}, { autonomousMode: true });
|
|
464
|
-
return result.success;
|
|
465
|
-
}
|
|
466
|
-
catch {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
sleep(ms) {
|
|
471
|
-
return new Promise((resolve) => {
|
|
472
|
-
const timer = setTimeout(() => {
|
|
473
|
-
cleanup();
|
|
474
|
-
resolve();
|
|
475
|
-
}, ms);
|
|
476
|
-
const onAbort = () => {
|
|
477
|
-
clearTimeout(timer);
|
|
478
|
-
cleanup();
|
|
479
|
-
resolve();
|
|
480
|
-
};
|
|
481
|
-
const cleanup = () => {
|
|
482
|
-
this.abortController?.signal.removeEventListener('abort', onAbort);
|
|
483
|
-
};
|
|
484
|
-
this.abortController?.signal.addEventListener('abort', onAbort);
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
log(message) {
|
|
488
|
-
if (this.config.debug) {
|
|
489
|
-
console.error(`[Worker] ${message}`);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
isUnrecoverableError(error) {
|
|
493
|
-
const patterns = [
|
|
494
|
-
"reached my limit",
|
|
495
|
-
"session error",
|
|
496
|
-
"start a new conversation",
|
|
497
|
-
"rate limit exceeded",
|
|
498
|
-
"authentication failed",
|
|
499
|
-
"invalid api key",
|
|
500
|
-
"billing limit",
|
|
501
|
-
"context length exceeded",
|
|
502
|
-
"token limit",
|
|
503
|
-
"quota exceeded",
|
|
504
|
-
];
|
|
505
|
-
const lowerError = error.toLowerCase();
|
|
506
|
-
return patterns.some(p => lowerError.includes(p));
|
|
507
|
-
}
|
|
508
|
-
getBackoffDelay(attempt) {
|
|
509
|
-
const baseDelay = 5000;
|
|
510
|
-
const maxDelay = 60000;
|
|
511
|
-
return Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
|
|
512
|
-
}
|
|
513
|
-
async requestConfirmation(taskId, message, timeoutMs = 5 * 60 * 1000) {
|
|
514
|
-
if (!this.sessionId)
|
|
515
|
-
return false;
|
|
516
|
-
try {
|
|
517
|
-
const result = await reportProgress(taskId, this.sessionId, {
|
|
518
|
-
stage: 'waiting_confirmation',
|
|
519
|
-
message: `CONFIRMATION REQUIRED: ${message}`,
|
|
520
|
-
});
|
|
521
|
-
if (!result.success || !result.subtaskId)
|
|
522
|
-
return false;
|
|
523
|
-
const subtaskId = result.subtaskId;
|
|
524
|
-
const pollInterval = 5000;
|
|
525
|
-
const startTime = Date.now();
|
|
526
|
-
while (Date.now() - startTime < timeoutMs) {
|
|
527
|
-
if (this.abortController?.signal.aborted)
|
|
528
|
-
return false;
|
|
529
|
-
try {
|
|
530
|
-
const check = await checkConfirmation(taskId, subtaskId);
|
|
531
|
-
if (check.approved)
|
|
532
|
-
return true;
|
|
533
|
-
}
|
|
534
|
-
catch {
|
|
535
|
-
// Continue polling
|
|
536
|
-
}
|
|
537
|
-
await this.sleep(pollInterval);
|
|
538
|
-
}
|
|
539
|
-
return false;
|
|
540
|
-
}
|
|
541
|
-
catch {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
let workerInstance = null;
|
|
547
|
-
export function getWorker(config) {
|
|
548
|
-
if (!workerInstance) {
|
|
549
|
-
workerInstance = new WorkerService(config);
|
|
550
|
-
}
|
|
551
|
-
return workerInstance;
|
|
552
|
-
}
|
|
553
|
-
export function resetWorker() {
|
|
554
|
-
if (workerInstance) {
|
|
555
|
-
workerInstance.stop().catch(() => { });
|
|
556
|
-
workerInstance = null;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
//# sourceMappingURL=service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/worker/service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EACH,cAAc,EACd,gBAAgB,GACn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