agents-relay 2.0.119 → 2.0.121
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 +1 -1
- package/dist/managed-worker-input.js +1 -0
- package/dist/task-context.js +16 -5
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -322,7 +322,7 @@ export class ChatGptAdapter {
|
|
|
322
322
|
throw new Error('browser-worker execution aborted');
|
|
323
323
|
const policy = chatGptTabClosePolicy(task.chatgptTabClosePolicy, this.tabClosePolicy);
|
|
324
324
|
const submit = () => (this.runner ?? browserWorkerRunner())(definition, {
|
|
325
|
-
prompt: task.chatgptThreadDelivery?.
|
|
325
|
+
prompt: task.chatgptThreadDelivery?.repository && task.chatgptThreadDelivery.executionId
|
|
326
326
|
? taskReferencePrompt(task.chatgptThreadDelivery.repository, task.chatgptThreadDelivery.jobId, task.id, task.chatgptThreadDelivery.executionId, task.input) : task.input,
|
|
327
327
|
...(task.attachments?.length ? { files: task.attachments } : {}),
|
|
328
328
|
...(task.chatgptThreadDelivery ? { thread: task.chatgptThreadDelivery } : {}),
|
|
@@ -63,6 +63,7 @@ publish through the federated MCP tool events__publish; do not open NATS directl
|
|
|
63
63
|
For a direct non-sandbox local worker, use NEO_EVENTS_EMIT when the caller provides it.
|
|
64
64
|
As your FIRST execution action, before reading files, editing code, running commands, or doing other work,
|
|
65
65
|
you MUST publish exactly one canonical task.started event for this exact Job/Task.
|
|
66
|
+
Immediately after task.started, BEFORE reading task context or doing any implementation/review/recovery work, read the full authoritative Relay event contract at absolute path /Users/chengli/Workspace/agents-relay/skills/agents-relay/contracts/event-contract.md. If it cannot be read, publish task.failed with the blocker and stop. Do not rely only on this prompt summary or a relative path.
|
|
66
67
|
|
|
67
68
|
${task.adapter === 'chatgpt' ? `Because ChatGPT execution continues asynchronously after the submit process exits, you MUST keep reporting liveness while the task is active. Publish meaningful progress/milestone events when there is real progress to report. If no meaningful milestone has been published for 30 seconds during active work, publish a non-terminal task.heartbeat event with status running, visibility orchestrator, this exact source.id, and a concise description of the current operation. Continue heartbeats after each further 30 seconds of active silence until a terminal task event is published. Do not invent percentage progress.` : `You MAY publish progress events while working. For long silent active work, follow the events-bus heartbeat policy.`}
|
|
68
69
|
Before returning or allowing the worker process to exit, you MUST publish exactly one canonical terminal event:
|
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
|
}
|