agents-relay 1.0.113 → 1.0.114

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.
Files changed (2) hide show
  1. package/dist/reconciler.js +14 -3
  2. package/package.json +1 -1
@@ -292,7 +292,7 @@ export class Reconciler extends ReconcilerReviewBase {
292
292
  const contextTask = job.tasks.find(task => task.kind === 'planner') ?? job.tasks[0];
293
293
  if (!contextTask)
294
294
  return;
295
- const executionContext = await this.resolvedContext(job, contextTask, 'planner');
295
+ const executionContext = await this.plannerContext(job, contextTask);
296
296
  for (const planner of job.tasks.filter(task => task.kind === 'planner' && task.state === 'SUCCEEDED' && task.plannerResult)) {
297
297
  const children = planner.plannerResult?.next_tasks.map(spec => this.plannerChild(job, planner, spec, executionContext)) ?? [];
298
298
  for (const child of children) {
@@ -313,6 +313,17 @@ export class Reconciler extends ReconcilerReviewBase {
313
313
  runtimes: this.options.adapters.map(adapter => ({ name: adapter.name, id: adapter.id, capabilities: [...adapter.capabilities] })),
314
314
  });
315
315
  }
316
+ async plannerContext(job, task) {
317
+ let projectPath = this.options.projectPathForJob ? await this.options.projectPathForJob(job) : task.routing?.cwd ?? process.cwd();
318
+ if (this.store.pullRequestHead) {
319
+ const head = await this.store.pullRequestHead();
320
+ if (!head)
321
+ throw new Error(`PR #${job.prNumber} has no resolvable head ref`);
322
+ const key = `planner-${task.id}-${head.sha.slice(0, 12)}`;
323
+ projectPath = await prepareManagedExecutionWorktree(projectPath, job.repository, job.prNumber, head, key);
324
+ }
325
+ return this.resolvedContext(job, task, 'planner', projectPath);
326
+ }
316
327
  async launch(job, task) {
317
328
  const adapter = this.options.adapters.find(x => x.name === task.adapter);
318
329
  if (!adapter) {
@@ -443,7 +454,7 @@ export class Reconciler extends ReconcilerReviewBase {
443
454
  this.plannerLive.set(task.id, { executionId: executionId, controller, timer });
444
455
  let promise;
445
456
  try {
446
- const executionContext = await this.resolvedContext(job, task, 'planner');
457
+ const executionContext = await this.plannerContext(job, task);
447
458
  const context = { job, tasks: job.tasks, objective: job.objective ?? job.description ?? job.title, previousPlannerTaskId: task.parentTaskId, executionContext, retryFeedback: task.plannerRetryFeedback };
448
459
  task.input = plannerInput(context);
449
460
  await this.store.saveTask(task);
@@ -483,7 +494,7 @@ export class Reconciler extends ReconcilerReviewBase {
483
494
  }
484
495
  try {
485
496
  const result = parsePlannerResult(raw);
486
- const executionContext = await this.resolvedContext(job, task, 'planner');
497
+ const executionContext = await this.plannerContext(job, task);
487
498
  const children = result.next_tasks.map(spec => this.plannerChild(job, task, spec, executionContext));
488
499
  for (const child of children) {
489
500
  const existing = job.tasks.find(item => item.id === child.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {