agents-relay 2.0.120 → 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 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?.threadSource === 'implementation' && task.chatgptThreadDelivery.repository && task.chatgptThreadDelivery.executionId
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 } : {}),
@@ -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
- const marker = '[Execution event contract — mandatory]';
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 eventContract = index >= 0 ? `\n\n${managedInput.slice(index)}` : '';
20
- return `[Agents Relay managed task]\nRepository: ${repository}\nJob ID: ${jobId}\nTask ID: ${taskId}\nExecution ID: ${executionId}\n\nRetrieve the authoritative task contract using the connected NeoY shell/Agents Relay CLI:\n agents-relay task context --repo ${repository} --id ${jobId} --task-id ${taskId} --execution-id ${executionId}\nRead the returned Task input, dependencies, Plan, project context, and output requirements before execution. Check that the execution ID matches. If the CLI or context is unavailable, report blocked; never guess or execute from this envelope. Continue in this thread; Relay owns completion and review. Do not create another Job. After the mandatory task.started event, first read /Users/chengli/Workspace/agents-relay/skills/agents-relay/contracts/event-contract.md in full before further task work; if unavailable, send task.failed and stop.${eventContract}`;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.120",
3
+ "version": "2.0.121",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "repository": {
6
6
  "type": "git",