agents-relay 2.0.120 → 2.0.122
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/adapters.js +14 -3
- package/dist/task-context.js +16 -5
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -195,8 +195,19 @@ function rawBrowserWorkspaceCommand(cli, args, stdin, signal) {
|
|
|
195
195
|
resolve(stdout.trim());
|
|
196
196
|
else if (signal?.aborted)
|
|
197
197
|
reject(new Error('browser-worker execution aborted'));
|
|
198
|
-
else
|
|
199
|
-
|
|
198
|
+
else {
|
|
199
|
+
// Browser Workspace reports a compact code/message JSON on nonzero exit.
|
|
200
|
+
// Preserve existing Relay failure behavior; only simplify the error text.
|
|
201
|
+
let reason = stderr.trim() || stdout.trim() || `browser-workspace exited ${code}`;
|
|
202
|
+
try {
|
|
203
|
+
const envelope = parseWorkspaceJson(stdout);
|
|
204
|
+
const result = envelope.result;
|
|
205
|
+
if (result?.ok === false && typeof result.code === 'string' && typeof result.message === 'string')
|
|
206
|
+
reason = `${result.code}: ${result.message}`;
|
|
207
|
+
}
|
|
208
|
+
catch { /* Preserve legacy error handling for other CLI failures. */ }
|
|
209
|
+
reject(new Error(reason));
|
|
210
|
+
}
|
|
200
211
|
});
|
|
201
212
|
if (signal?.aborted)
|
|
202
213
|
abort();
|
|
@@ -322,7 +333,7 @@ export class ChatGptAdapter {
|
|
|
322
333
|
throw new Error('browser-worker execution aborted');
|
|
323
334
|
const policy = chatGptTabClosePolicy(task.chatgptTabClosePolicy, this.tabClosePolicy);
|
|
324
335
|
const submit = () => (this.runner ?? browserWorkerRunner())(definition, {
|
|
325
|
-
prompt: task.chatgptThreadDelivery?.
|
|
336
|
+
prompt: task.chatgptThreadDelivery?.repository && task.chatgptThreadDelivery.executionId
|
|
326
337
|
? taskReferencePrompt(task.chatgptThreadDelivery.repository, task.chatgptThreadDelivery.jobId, task.id, task.chatgptThreadDelivery.executionId, task.input) : task.input,
|
|
327
338
|
...(task.attachments?.length ? { files: task.attachments } : {}),
|
|
328
339
|
...(task.chatgptThreadDelivery ? { thread: task.chatgptThreadDelivery } : {}),
|
package/dist/task-context.js
CHANGED
|
@@ -11,11 +11,22 @@ export function taskExecutionContext(job, taskId, executionId) {
|
|
|
11
11
|
projectPath: job.projectPath, state: job.state }, task, comments: task.comments ?? [], dependencies: task.dependencies.map(id => job.tasks.find(item => item.id === id) ?? { id, missing: true }),
|
|
12
12
|
plan: job.plans?.find(plan => plan.id === task.planningDecisionId) ?? null };
|
|
13
13
|
}
|
|
14
|
+
/** Browser new-turn envelope: the local Contract and durable Task Context are authoritative. */
|
|
14
15
|
export function taskReferencePrompt(repository, jobId, taskId, executionId, managedInput) {
|
|
15
|
-
|
|
16
|
-
const index = managedInput?.indexOf(marker) ?? -1;
|
|
17
|
-
if (managedInput !== undefined && index < 0)
|
|
16
|
+
if (managedInput !== undefined && !managedInput.includes('[Execution event contract — mandatory]'))
|
|
18
17
|
throw new Error(`Missing managed execution event contract for ${jobId}/${taskId}/${executionId}`);
|
|
19
|
-
const
|
|
20
|
-
return `[Agents Relay managed task]
|
|
18
|
+
const source = `job/${jobId}/task/${taskId}/execution/${executionId}`;
|
|
19
|
+
return `[Agents Relay managed task]
|
|
20
|
+
Repository: ${repository}
|
|
21
|
+
Job ID: ${jobId}
|
|
22
|
+
Task ID: ${taskId}
|
|
23
|
+
Execution ID: ${executionId}
|
|
24
|
+
Exact event source.id: ${source}
|
|
25
|
+
|
|
26
|
+
FIRST publish exactly one task.started through the canonical Neo events-bus with this exact source.id.
|
|
27
|
+
THEN read the entire authoritative event contract from /Users/chengli/Workspace/agents-relay/skills/agents-relay/contracts/event-contract.md before any task work. If unavailable publish task.failed and stop.
|
|
28
|
+
THEN retrieve the authoritative Task Context:
|
|
29
|
+
agents-relay task context --repo ${repository} --id ${jobId} --task-id ${taskId} --execution-id ${executionId}
|
|
30
|
+
Verify the execution ID. Read Task input, dependencies, Plan, project context, and output requirements from that response. Never guess or create a new Job. Continue in this thread; Relay owns completion and review.
|
|
31
|
+
Follow the file's lifecycle contract, including progress/heartbeat and exactly one task.completed or task.failed before exiting. If context is unavailable publish task.failed with the blocker.`;
|
|
21
32
|
}
|