agents-relay 2.0.70 → 2.0.71

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.
@@ -133,6 +133,8 @@ export class LocalAuthorityDurableStore {
133
133
  const children = mergeInboundJobSnapshot(current, incoming);
134
134
  const preserveTerminal = ['COMPLETED', 'CANCELLED'].includes(current.state)
135
135
  && !['COMPLETED', 'CANCELLED'].includes(incoming.state);
136
+ // A stale snapshot must not undo an already committed Graph activation.
137
+ const preserveActivation = current.state === 'ACTIVE' && incoming.state === 'DRAFT';
136
138
  const review = current.review && incoming.review
137
139
  && current.review.updatedAt > incoming.review.updatedAt
138
140
  ? current.review : incoming.review;
@@ -142,7 +144,7 @@ export class LocalAuthorityDurableStore {
142
144
  const scalarSource = incoming.updatedAt > current.updatedAt ? incoming : current;
143
145
  return {
144
146
  ...current, ...scalarSource,
145
- state: preserveTerminal ? current.state : scalarSource.state,
147
+ state: preserveTerminal || preserveActivation ? current.state : scalarSource.state,
146
148
  updatedAt: current.updatedAt > incoming.updatedAt ? current.updatedAt : incoming.updatedAt,
147
149
  tasks: children.tasks,
148
150
  ...(children.plans ? { plans: children.plans } : {}),
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  export function createDashboardActions(deps) {
3
- const { cachedOverviews, requireLocalJobBinding, pool, dashboardJobAction, makeReconciler, concurrency, dashboardJobSetState, refreshAll, applyJobActivateAction, applyOrchestratorStartAction, applyOrchestratorCompleteAction, publishOrchestratorTaskStarted, publishOrchestratorTaskCompletion, bus, dashboardTaskAction, dashboardTaskSetState } = deps;
4
- const dashboardOverview = (jobId, target) => cachedOverviews.find((item) => item.job.id === jobId
3
+ const { getOverviews, requireLocalJobBinding, pool, dashboardJobAction, makeReconciler, concurrency, dashboardJobSetState, refreshAll, applyJobActivateAction, applyOrchestratorStartAction, applyOrchestratorCompleteAction, publishOrchestratorTaskStarted, publishOrchestratorTaskCompletion, bus, dashboardTaskAction, dashboardTaskSetState } = deps;
4
+ const currentOverviews = () => getOverviews();
5
+ const dashboardOverview = (jobId, target) => currentOverviews().find((item) => item.job.id === jobId
5
6
  && (!target?.repository || item.job.repository === target.repository)
6
7
  && (!target?.prNumber || (item.job.externalPrNumber ?? item.job.prNumber) === target.prNumber));
7
8
  const workspaceJobAction = (action) => async (jobId) => {
8
- const overview = cachedOverviews.find((item) => item.job.id === jobId);
9
+ const overview = currentOverviews().find((item) => item.job.id === jobId);
9
10
  if (!overview)
10
11
  throw new Error(`Managed job ${jobId} not found`);
11
12
  const store = (await requireLocalJobBinding(jobId)).store;
@@ -25,7 +26,7 @@ export function createDashboardActions(deps) {
25
26
  return result;
26
27
  };
27
28
  const workspaceTaskCreate = async (jobId, task) => {
28
- const overview = cachedOverviews.find((item) => item.job.id === jobId);
29
+ const overview = currentOverviews().find((item) => item.job.id === jobId);
29
30
  if (!overview)
30
31
  throw new Error(`Managed job ${jobId} not found`);
31
32
  if (task.jobId !== jobId)
@@ -59,7 +60,7 @@ export function createDashboardActions(deps) {
59
60
  return await store.load(jobId);
60
61
  };
61
62
  const workspaceTaskStart = async (jobId, taskId) => {
62
- const overview = cachedOverviews.find((item) => item.job.id === jobId);
63
+ const overview = currentOverviews().find((item) => item.job.id === jobId);
63
64
  if (!overview)
64
65
  throw new Error(`Managed job ${jobId} not found`);
65
66
  const store = (await requireLocalJobBinding(jobId)).store;
@@ -74,7 +75,7 @@ export function createDashboardActions(deps) {
74
75
  return await store.load(jobId);
75
76
  };
76
77
  const workspaceTaskComplete = async (jobId, taskId, summary) => {
77
- const overview = cachedOverviews.find((item) => item.job.id === jobId);
78
+ const overview = currentOverviews().find((item) => item.job.id === jobId);
78
79
  if (!overview)
79
80
  throw new Error(`Managed job ${jobId} not found`);
80
81
  const store = (await requireLocalJobBinding(jobId)).store;
@@ -89,7 +90,7 @@ export function createDashboardActions(deps) {
89
90
  return await store.load(jobId);
90
91
  };
91
92
  const workspaceTaskAction = (action) => async (jobId, taskId) => {
92
- const overview = cachedOverviews.find((item) => item.job.id === jobId);
93
+ const overview = currentOverviews().find((item) => item.job.id === jobId);
93
94
  if (!overview)
94
95
  throw new Error(`Managed job ${jobId} not found`);
95
96
  const store = (await requireLocalJobBinding(jobId)).store;
package/dist/relayd.js CHANGED
@@ -338,7 +338,7 @@ export async function runDaemon(argv) {
338
338
  const initial = cachedOverviews;
339
339
  const fallback = initial[0]?.job;
340
340
  const dashboardStore = fallback ? (await requireLocalJobBinding(fallback.id)).store : new InMemoryStore();
341
- const { dashboardOverview, workspaceJobAction, workspaceJobSetState, workspaceTaskCreate, workspaceTaskStart, workspaceTaskComplete, workspaceTaskAction, workspaceTaskSetState } = createDashboardActions({ cachedOverviews, requireLocalJobBinding, pool, dashboardJobAction, makeReconciler, concurrency, dashboardJobSetState, refreshAll, applyJobActivateAction, applyOrchestratorStartAction, applyOrchestratorCompleteAction, publishOrchestratorTaskStarted, publishOrchestratorTaskCompletion, bus, dashboardTaskAction, dashboardTaskSetState });
341
+ const { dashboardOverview, workspaceJobAction, workspaceJobSetState, workspaceTaskCreate, workspaceTaskStart, workspaceTaskComplete, workspaceTaskAction, workspaceTaskSetState } = createDashboardActions({ getOverviews: () => cachedOverviews, requireLocalJobBinding, pool, dashboardJobAction, makeReconciler, concurrency, dashboardJobSetState, refreshAll, applyJobActivateAction, applyOrchestratorStartAction, applyOrchestratorCompleteAction, publishOrchestratorTaskStarted, publishOrchestratorTaskCompletion, bus, dashboardTaskAction, dashboardTaskSetState });
342
342
  const workspaceControl = createWorkspaceControl({ client, trusted, noGitHub, repositories, refreshAll, requireLocalJobBinding, makeReconciler, concurrency, pool, bus, isEffectivelyBlocked, unblockAutonomousTasks, unblockTask, publishTaskUnblocked, dispatchTaskAction, registerBlockerDependency, discoverAgents, ensureManagedGitHubJob });
343
343
  const secretFile = value(argv, '--github-webhook-secret-file');
344
344
  const secret = noGitHub ? '' : value(argv, '--github-webhook-secret') || process.env.AGENTS_RELAY_GITHUB_WEBHOOK_SECRET || (secretFile ? (await readFile(secretFile, 'utf8')).trim() : '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.70",
3
+ "version": "2.0.71",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {