agents-relay 1.0.10 → 1.0.11
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/reconciler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { schedule, transitionTask } from './scheduler.js';
|
|
3
|
+
import { LaunchFailure } from './adapters.js';
|
|
3
4
|
import { eventFor } from './events.js';
|
|
4
5
|
import { parsePlannerResult, plannerInput } from './planner.js';
|
|
5
6
|
const PRIORITY_RANK = { P0: 0, P1: 1, P2: 2, P3: 3 };
|
|
@@ -245,7 +246,9 @@ export class Reconciler {
|
|
|
245
246
|
this.detach(this.timeoutTask(job.id, task.id, durableExecutionId), job.id, task.id, 'worker terminal-event timeout');
|
|
246
247
|
}, Math.max(1, task.timeoutMs));
|
|
247
248
|
this.terminalTimers.set(task.id, terminalTimer);
|
|
248
|
-
this.detach(execution.promise.then(result => this.runtimeSettled(job.id, task.id, durableExecutionId, result, null), error =>
|
|
249
|
+
this.detach(execution.promise.then(result => this.runtimeSettled(job.id, task.id, durableExecutionId, result, null), error => error instanceof LaunchFailure
|
|
250
|
+
? this.failLaunch(job.id, task.id, durableExecutionId, error.message, 'delivery')
|
|
251
|
+
: this.runtimeSettled(job.id, task.id, durableExecutionId, null, error instanceof Error ? error.message : String(error))), job.id, task.id, 'worker runtime completion');
|
|
249
252
|
}
|
|
250
253
|
async launchPlanner(job, task) {
|
|
251
254
|
const planner = this.options.planner;
|
|
@@ -344,12 +347,12 @@ export class Reconciler {
|
|
|
344
347
|
clearTimeout(timer);
|
|
345
348
|
this.terminalTimers.delete(taskId);
|
|
346
349
|
}
|
|
347
|
-
async failLaunch(jobId, taskId, executionId, message) {
|
|
350
|
+
async failLaunch(jobId, taskId, executionId, message, phase = 'launch') {
|
|
348
351
|
const job = await this.store.load(jobId);
|
|
349
352
|
const task = job.tasks.find(item => item.id === taskId);
|
|
350
353
|
if (!task || task.executionId !== executionId || task.state !== 'RUNNING')
|
|
351
354
|
return;
|
|
352
|
-
const event = eventFor(jobId, taskId, task.parentTaskId, 'task.failed', 'failed', `Worker
|
|
355
|
+
const event = eventFor(jobId, taskId, task.parentTaskId, 'task.failed', 'failed', `Worker ${phase} failed: ${message}`, 'user', { phase });
|
|
353
356
|
await this.applyTerminalEvent(event);
|
|
354
357
|
await this.emit(event);
|
|
355
358
|
}
|
package/package.json
CHANGED
|
@@ -144,16 +144,13 @@ else:
|
|
|
144
144
|
attachments = _upload_files(CFG.get("file", []))
|
|
145
145
|
selector = _composer()
|
|
146
146
|
before_count = len(_user_turns())
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
click_at_xy(info["x"], info["y"])
|
|
155
|
-
press_key("CTRL+A")
|
|
156
|
-
type_text(CFG["prompt"])
|
|
147
|
+
info = js(f"""(() => {{
|
|
148
|
+
const e=document.querySelector({json.dumps(selector)});
|
|
149
|
+
const r=e.getBoundingClientRect();
|
|
150
|
+
return {{x:r.x+r.width/2,y:r.y+r.height/2}};
|
|
151
|
+
}})()""")
|
|
152
|
+
click_at_xy(info["x"], info["y"])
|
|
153
|
+
type_text(CFG["prompt"])
|
|
157
154
|
if CFG["prompt"].strip() not in _composer_text(selector):
|
|
158
155
|
raise RuntimeError("Temporary Chat prompt was not observed in the composer")
|
|
159
156
|
|