agents-relay 2.0.88 → 2.0.90
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 +3 -1
- package/dist/cli-help.js +3 -0
- package/dist/cli.js +9 -1
- package/dist/reconciler.js +2 -2
- package/dist/task-context.js +16 -0
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -4,6 +4,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
6
|
import { withTestInjection } from './e2e-injection.js';
|
|
7
|
+
import { taskReferencePrompt } from './task-context.js';
|
|
7
8
|
import { spawnOwnedProcess, terminateOwnedProcess, ownedProcessTerminationReason } from './owned-process.js';
|
|
8
9
|
export function buildCodexArgs(route, input) {
|
|
9
10
|
const args = ['exec', '--json'];
|
|
@@ -372,7 +373,8 @@ export class ChatGptAdapter {
|
|
|
372
373
|
throw new Error('browser-worker execution aborted');
|
|
373
374
|
const policy = chatGptTabClosePolicy(task.chatgptTabClosePolicy, this.tabClosePolicy);
|
|
374
375
|
const submit = () => (this.runner ?? browserWorkerRunner())(definition, {
|
|
375
|
-
prompt: task.
|
|
376
|
+
prompt: task.chatgptThreadDelivery?.threadSource === 'implementation' && task.chatgptThreadDelivery.repository && task.chatgptThreadDelivery.executionId
|
|
377
|
+
? taskReferencePrompt(task.chatgptThreadDelivery.repository, task.chatgptThreadDelivery.jobId, task.id, task.chatgptThreadDelivery.executionId) : task.input,
|
|
376
378
|
...(task.attachments?.length ? { files: task.attachments } : {}),
|
|
377
379
|
...(task.chatgptThreadDelivery ? { thread: task.chatgptThreadDelivery } : {}),
|
|
378
380
|
tabClosePolicy: policy,
|
package/dist/cli-help.js
CHANGED
|
@@ -129,6 +129,9 @@ Use --clear-routing to remove routing metadata.
|
|
|
129
129
|
|
|
130
130
|
Example:
|
|
131
131
|
npx agents-relay task update --repo OWNER/REPO --pr 12 --id job-1 --task-id build --adapter chatgpt --provider chatgpt --model gpt-5.6-sol --reasoning high`,
|
|
132
|
+
'task context': `Read the authoritative execution-scoped Task contract.
|
|
133
|
+
|
|
134
|
+
Required: --repo OWNER/REPO --id JOB_ID --task-id TASK_ID --execution-id EXECUTION_ID. Fails closed on stale execution.`,
|
|
132
135
|
'task show': `Show one durable Task.
|
|
133
136
|
|
|
134
137
|
Required: --task-id ID and the normal Job storage options.`,
|
package/dist/cli.js
CHANGED
|
@@ -40,6 +40,7 @@ export { runtimeReviewer } from './reviewer-thread.js';
|
|
|
40
40
|
import { SERVICE_DEFAULTS, ServiceEventBus, arg, hasArg, textOption, integerArg, repository, storeFor, saveLocal, eventBus, publishWake, priority, storySize, executionMode, chatGptTabClosePolicy, requestedExecutionMode, continuation, scheduleFromArgs, jobTagFromArgs, requestManagedReconciliation, relayControlJob, relayControlCommand, relayJobList, relayJobStateCommand, relayTaskCommand, withEventBus } from './cli-support.js';
|
|
41
41
|
export { SERVICE_DEFAULTS, eventBus, executionMode, chatGptTabClosePolicy } from './cli-support.js';
|
|
42
42
|
import { workerTaskFromArgs } from './cli-worker-task.js';
|
|
43
|
+
import { taskExecutionContext } from './task-context.js';
|
|
43
44
|
export { ensureManagedGitHubJob } from './cli-job-create.js';
|
|
44
45
|
async function runManagedTaskCommand(action, args) {
|
|
45
46
|
const jobId = arg(args, '--id');
|
|
@@ -67,7 +68,7 @@ async function runManagedTaskCommand(action, args) {
|
|
|
67
68
|
console.log(JSON.stringify(task, null, 2));
|
|
68
69
|
}
|
|
69
70
|
async function runTaskCommand(action, args) {
|
|
70
|
-
if (!['create', 'update', 'show', 'list', 'retry', 'recover', 'unblock', 'cancel', 'supersede'].includes(action))
|
|
71
|
+
if (!['create', 'update', 'show', 'context', 'list', 'retry', 'recover', 'unblock', 'cancel', 'supersede'].includes(action))
|
|
71
72
|
throw new Error(usage);
|
|
72
73
|
const managed = !arg(args, '--file') && Boolean(arg(args, '--repo') && arg(args, '--id'));
|
|
73
74
|
if (managed) {
|
|
@@ -78,6 +79,13 @@ async function runTaskCommand(action, args) {
|
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
const taskId = arg(args, '--task-id');
|
|
82
|
+
if (action === 'context') {
|
|
83
|
+
if (!taskId)
|
|
84
|
+
throw new Error('task context requires --task-id');
|
|
85
|
+
const job = await relayControlJob(args, jobId);
|
|
86
|
+
console.log(JSON.stringify(taskExecutionContext(job, taskId, arg(args, '--execution-id')), null, 2));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
81
89
|
if (action === 'show') {
|
|
82
90
|
if (!taskId)
|
|
83
91
|
throw new Error('task show requires --task-id');
|
package/dist/reconciler.js
CHANGED
|
@@ -375,7 +375,7 @@ export class Reconciler extends ReconcilerReviewBase {
|
|
|
375
375
|
freshTask.chatgptThreadDelivery = {
|
|
376
376
|
kind: 'new-turn', threadId: implementationThread, threadSource: 'implementation',
|
|
377
377
|
requestId: `${freshJob.id}:${freshTask.id}:${freshTask.executionId}`,
|
|
378
|
-
jobId: freshJob.id, prNumber: freshJob.prNumber, executionId: freshTask.executionId,
|
|
378
|
+
jobId: freshJob.id, repository: freshJob.repository, taskId: freshTask.id, prNumber: freshJob.prNumber, executionId: freshTask.executionId,
|
|
379
379
|
projectId: freshTask.routing?.projectId ?? null, deliveredAt: null,
|
|
380
380
|
};
|
|
381
381
|
}
|
|
@@ -404,7 +404,7 @@ export class Reconciler extends ReconcilerReviewBase {
|
|
|
404
404
|
durable.chatgptThreadDelivery = {
|
|
405
405
|
kind: 'new-turn', threadId: implementationThread, threadSource: 'implementation',
|
|
406
406
|
requestId: `${current.id}:${durable.id}:${durable.executionId}`,
|
|
407
|
-
jobId: current.id, prNumber: current.prNumber, executionId: durable.executionId,
|
|
407
|
+
jobId: current.id, repository: current.repository, taskId: durable.id, prNumber: current.prNumber, executionId: durable.executionId,
|
|
408
408
|
projectId: durable.routing?.projectId ?? null, deliveredAt: null,
|
|
409
409
|
};
|
|
410
410
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Resolve the execution-scoped contract from the authoritative Job snapshot. */
|
|
2
|
+
export function taskExecutionContext(job, taskId, executionId) {
|
|
3
|
+
if (!executionId)
|
|
4
|
+
throw new Error('task context requires --execution-id');
|
|
5
|
+
const task = job.tasks.find(item => item.id === taskId);
|
|
6
|
+
if (!task)
|
|
7
|
+
throw new Error(`Task ${taskId} not found`);
|
|
8
|
+
if (task.executionId !== executionId || !['QUEUED', 'RUNNING'].includes(task.state))
|
|
9
|
+
throw new Error(`Stale Task execution ${taskId}/${executionId}; current state ${task.state}`);
|
|
10
|
+
return { job: { id: job.id, repository: job.repository, title: job.title, objective: job.objective,
|
|
11
|
+
projectPath: job.projectPath, state: job.state }, task, dependencies: task.dependencies.map(id => job.tasks.find(item => item.id === id) ?? { id, missing: true }),
|
|
12
|
+
plan: job.plans?.find(plan => plan.id === task.planningDecisionId) ?? null };
|
|
13
|
+
}
|
|
14
|
+
export function taskReferencePrompt(repository, jobId, taskId, executionId) {
|
|
15
|
+
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.`;
|
|
16
|
+
}
|