agents-relay 2.0.262 → 2.0.264
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/README.md +57 -52
- package/bin/migrate-task-ids.mjs +12 -0
- package/dist/blocker-recovery.js +9 -16
- package/dist/cli-blocker.js +2 -1
- package/dist/cli-coordinator.js +19 -7
- package/dist/cli-foreground.js +82 -0
- package/dist/cli-help.js +61 -72
- package/dist/cli-job-create.js +15 -9
- package/dist/cli-prompt.js +9 -5
- package/dist/cli-support.js +21 -8
- package/dist/cli-worker-task.js +9 -3
- package/dist/cli.js +50 -36
- package/dist/dag-task-runtime.js +16 -12
- package/dist/dashboard-html.js +28 -14
- package/dist/dashboard-jel.js +87 -31
- package/dist/dashboard-style.js +2 -8
- package/dist/dependency-revision-execution.js +15 -6
- package/dist/final-review-role.js +0 -12
- package/dist/job-local-repository-migration.js +137 -0
- package/dist/job-pr-number-migration.js +0 -4
- package/dist/job-task-id-sequence.js +18 -9
- package/dist/job-worktree-cleanup.js +3 -3
- package/dist/local-job-registry.js +2 -2
- package/dist/local-managed-store.js +2 -2
- package/dist/local-merge-delivery.js +16 -3
- package/dist/local-merge-projection.js +192 -49
- package/dist/no-github.js +2 -1
- package/dist/planner-recovery.js +8 -3
- package/dist/planner.js +5 -5
- package/dist/pool.js +8 -2
- package/dist/projection-failure-recovery.js +6 -46
- package/dist/reconciler-context.js +5 -5
- package/dist/reconciler-review.js +12 -37
- package/dist/reconciler-runtime.js +1 -4
- package/dist/reconciler.js +5 -5
- package/dist/relay-job-merge.js +33 -0
- package/dist/relay-store.js +8 -30
- package/dist/relay-workflow-operations.js +2 -0
- package/dist/relayd-control.js +22 -25
- package/dist/relayd-dashboard-actions.js +4 -5
- package/dist/relayd-utilities.js +15 -20
- package/dist/relayd.js +59 -299
- package/dist/review-generation-fence.js +1 -1
- package/dist/review-replan.js +6 -1
- package/dist/review-revision-model.js +11 -6
- package/dist/task-context.js +1 -1
- package/dist/task-id-migration.js +229 -0
- package/dist/task-transitions.js +1 -1
- package/dist/troubleshooter.js +13 -16
- package/dist/unified-job-registry.js +9 -0
- package/dist/workflow/projection-conflict-v2.js +30 -26
- package/dist/workflow/task-related-action-v2.js +1 -2
- package/dist/workspace.js +52 -56
- package/package.json +4 -2
- package/skills/agents-relay/SKILL.md +35 -60
- package/skills/agents-relay/agents/planner.agent.md +5 -5
- package/skills/agents-relay/bin/services.mjs +21 -3
- package/skills/agents-relay/contracts/task-job-contract.md +11 -2
- package/skills/agents-relay/evals/capabilities.json +6 -1
- package/workflow/projection-conflict.mmd +59 -56
- package/workflow/projection-outbox-conflict.mmd +20 -0
- package/dist/cli-projection.js +0 -29
- package/dist/projection-recovery-runtime.js +0 -121
- package/dist/projection-recovery.js +0 -101
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Extracted the inbound SQLite Job/Plan/Task merge into a dedicated pure helper.
|
|
2
|
+
* This preserves the original merge contract while keeping relay-store.ts within the
|
|
3
|
+
* production source-size gate; no GitHub or PR lifecycle behavior is introduced. */
|
|
4
|
+
import { preserveTaskComments } from './task-comments.js';
|
|
5
|
+
import { preserveReviewRevisionHistory } from './review-revision-merge.js';
|
|
6
|
+
function newerRecord(local, remote) {
|
|
7
|
+
if (!local)
|
|
8
|
+
return structuredClone(remote);
|
|
9
|
+
return remote.updatedAt > local.updatedAt ? structuredClone(remote) : structuredClone(local);
|
|
10
|
+
}
|
|
11
|
+
function mergeRecords(local, remote) {
|
|
12
|
+
const remoteById = new Map(remote.map(item => [item.id, item]));
|
|
13
|
+
const merged = local.map(item => newerRecord(item, remoteById.get(item.id) ?? item));
|
|
14
|
+
const localIds = new Set(local.map(item => item.id));
|
|
15
|
+
for (const item of remote)
|
|
16
|
+
if (!localIds.has(item.id))
|
|
17
|
+
merged.push(structuredClone(item));
|
|
18
|
+
return merged;
|
|
19
|
+
}
|
|
20
|
+
export function mergeInboundJobSnapshot(local, remote) {
|
|
21
|
+
const base = remote.updatedAt > local.updatedAt ? structuredClone(remote) : structuredClone(local);
|
|
22
|
+
base.tasks = preserveTaskComments(local.tasks, mergeRecords(local.tasks, remote.tasks));
|
|
23
|
+
preserveReviewRevisionHistory(local, base);
|
|
24
|
+
const localPlans = local.plans ?? [];
|
|
25
|
+
const remotePlans = remote.plans ?? [];
|
|
26
|
+
if (localPlans.length > 0 || remotePlans.length > 0) {
|
|
27
|
+
base.plans = mergeRecords(localPlans, remotePlans).sort((a, b) => a.round - b.round);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
delete base.plans;
|
|
31
|
+
}
|
|
32
|
+
return base;
|
|
33
|
+
}
|
package/dist/relay-store.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { currentJobMetadata, loadRelayJob, listRelayJobs } from './relay-job-snapshot-reads.js';
|
|
2
2
|
import { SQLiteWorkflowOperations } from './relay-workflow-operations.js';
|
|
3
|
-
import { preserveTaskComments } from './task-comments.js';
|
|
4
|
-
import { preserveReviewRevisionHistory } from './review-revision-merge.js';
|
|
5
3
|
import { DatabaseSync } from 'node:sqlite';
|
|
4
|
+
import { mergeInboundJobSnapshot } from './relay-job-merge.js';
|
|
5
|
+
export { mergeInboundJobSnapshot } from './relay-job-merge.js';
|
|
6
6
|
import { migrateLegacyBlockedTasks } from './legacy-blocked-task-migration.js';
|
|
7
7
|
import { dirname } from 'node:path';
|
|
8
8
|
import { mkdirSync } from 'node:fs';
|
|
@@ -15,34 +15,6 @@ import { saveUnifiedPullRequestFacts } from './unified-pr-facts.js';
|
|
|
15
15
|
import { migrateLegacyJobPrNumbers } from './job-pr-number-migration.js';
|
|
16
16
|
import { hostInvocationTablesSql, recordHostInvocationEvent, hasHostInvocationDecision, recordHostInvocationDecision } from './host-invocation-store.js';
|
|
17
17
|
import { ProjectionOutbox, SCHEMA_VERSION, logicalOperationKey, } from './projection-outbox.js';
|
|
18
|
-
function newerRecord(local, remote) {
|
|
19
|
-
if (!local)
|
|
20
|
-
return structuredClone(remote);
|
|
21
|
-
return remote.updatedAt > local.updatedAt ? structuredClone(remote) : structuredClone(local);
|
|
22
|
-
}
|
|
23
|
-
function mergeRecords(local, remote) {
|
|
24
|
-
const remoteById = new Map(remote.map(item => [item.id, item]));
|
|
25
|
-
const merged = local.map(item => newerRecord(item, remoteById.get(item.id) ?? item));
|
|
26
|
-
const localIds = new Set(local.map(item => item.id));
|
|
27
|
-
for (const item of remote)
|
|
28
|
-
if (!localIds.has(item.id))
|
|
29
|
-
merged.push(structuredClone(item));
|
|
30
|
-
return merged;
|
|
31
|
-
}
|
|
32
|
-
export function mergeInboundJobSnapshot(local, remote) {
|
|
33
|
-
const base = remote.updatedAt > local.updatedAt ? structuredClone(remote) : structuredClone(local);
|
|
34
|
-
base.tasks = preserveTaskComments(local.tasks, mergeRecords(local.tasks, remote.tasks));
|
|
35
|
-
preserveReviewRevisionHistory(local, base);
|
|
36
|
-
const localPlans = local.plans ?? [];
|
|
37
|
-
const remotePlans = remote.plans ?? [];
|
|
38
|
-
if (localPlans.length > 0 || remotePlans.length > 0) {
|
|
39
|
-
base.plans = mergeRecords(localPlans, remotePlans).sort((a, b) => a.round - b.round);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
delete base.plans;
|
|
43
|
-
}
|
|
44
|
-
return base;
|
|
45
|
-
}
|
|
46
18
|
function monotonicJobTimestamp(previous, candidate = new Date().toISOString()) {
|
|
47
19
|
const prior = Date.parse(previous), next = Date.parse(candidate);
|
|
48
20
|
if (!Number.isFinite(prior))
|
|
@@ -239,6 +211,12 @@ export class SQLiteRelayStore {
|
|
|
239
211
|
}
|
|
240
212
|
}
|
|
241
213
|
writeJobSnapshot(job, now) {
|
|
214
|
+
const existing = this.db.prepare('SELECT json FROM job_snapshot WHERE job_id=?').get(job.id);
|
|
215
|
+
if (existing?.json) {
|
|
216
|
+
const current = JSON.parse(existing.json);
|
|
217
|
+
if (current.projectRoot !== job.projectRoot)
|
|
218
|
+
throw new Error(`Job ${job.id} projectRoot is immutable`);
|
|
219
|
+
}
|
|
242
220
|
if (this.scopeJobId)
|
|
243
221
|
ensureUnifiedJobRegistry(this.db, job, this.scopeJobId);
|
|
244
222
|
this.db.prepare(`
|
|
@@ -136,6 +136,8 @@ export class SQLiteWorkflowOperations {
|
|
|
136
136
|
const history = recordTaskStateHistory(previous, next);
|
|
137
137
|
if (next.id !== jobId)
|
|
138
138
|
throw new Error('Cannot change authoritative Job identity');
|
|
139
|
+
if (next.repository !== previous.repository || next.projectRoot !== previous.projectRoot)
|
|
140
|
+
throw new Error('Job local repository identity and projectRoot are immutable');
|
|
139
141
|
if (JSON.stringify(next) !== before && next.updatedAt <= JSON.parse(before).updatedAt) {
|
|
140
142
|
next.updatedAt = monotonicJobTimestamp(JSON.parse(before).updatedAt);
|
|
141
143
|
}
|
package/dist/relayd-control.js
CHANGED
|
@@ -10,9 +10,9 @@ import { publishTaskBlocked } from './cli-support.js';
|
|
|
10
10
|
import { classifyFailedTask, supersedeCancelledTask } from './task-actions.js';
|
|
11
11
|
import { requestTroubleshooterEscalation, resumeTroubleshooter } from './task-recovery.js';
|
|
12
12
|
import { ensureBlockerRecovery } from './blocker-recovery.js';
|
|
13
|
-
import {
|
|
13
|
+
import { resolveJobProjectRoot } from './workspace.js';
|
|
14
14
|
export function createWorkspaceControl(deps) {
|
|
15
|
-
const { client, trusted, noGitHub, repositories, refreshAll, requireLocalJobBinding, makeReconciler, concurrency, pool, bus, isEffectivelyBlocked, unblockTask, publishTaskUnblocked, dispatchTaskAction, registerBlockerDependency, discoverAgents, ensureManagedGitHubJob, ensureBlockerRecovery: runBlockerRecovery = ensureBlockerRecovery } = deps;
|
|
15
|
+
const { client, trusted, noGitHub, repositories, repositoryPaths, refreshAll, requireLocalJobBinding, makeReconciler, concurrency, pool, bus, isEffectivelyBlocked, unblockTask, publishTaskUnblocked, dispatchTaskAction, registerBlockerDependency, discoverAgents, ensureManagedGitHubJob, ensureBlockerRecovery: runBlockerRecovery = ensureBlockerRecovery } = deps;
|
|
16
16
|
const workspaceControl = async (body) => {
|
|
17
17
|
const command = typeof body.command === 'string' ? body.command : '';
|
|
18
18
|
const jobId = typeof body.jobId === 'string' ? body.jobId : '';
|
|
@@ -21,6 +21,8 @@ export function createWorkspaceControl(deps) {
|
|
|
21
21
|
if (command === 'job.create') {
|
|
22
22
|
const repository = typeof body.repository === 'string' ? body.repository : '';
|
|
23
23
|
const options = (body.options && typeof body.options === 'object' ? body.options : {});
|
|
24
|
+
if (Object.hasOwn(options, 'projectPath'))
|
|
25
|
+
throw new Error('Job projectPath is removed; use an independent local Git root');
|
|
24
26
|
if (options.contentOnly !== undefined || options.executionMode !== undefined)
|
|
25
27
|
throw new Error('Execution mode/content-only is obsolete; use normal Job reviewEnabled and autoMerge policy');
|
|
26
28
|
if (!repository)
|
|
@@ -34,7 +36,7 @@ export function createWorkspaceControl(deps) {
|
|
|
34
36
|
idempotencyKey: typeof options.idempotencyKey === 'string' ? options.idempotencyKey : undefined,
|
|
35
37
|
title: typeof options.title === 'string' ? options.title : undefined,
|
|
36
38
|
objective: typeof options.objective === 'string' ? options.objective : undefined,
|
|
37
|
-
|
|
39
|
+
projectRoot: typeof options.projectRoot === 'string' ? options.projectRoot : undefined,
|
|
38
40
|
priority: options.priority,
|
|
39
41
|
tag: options.tag,
|
|
40
42
|
reviewEnabled: typeof options.reviewEnabled === 'boolean' ? options.reviewEnabled : undefined,
|
|
@@ -43,18 +45,22 @@ export function createWorkspaceControl(deps) {
|
|
|
43
45
|
reviewerThreadId: typeof options.reviewerThreadId === 'string' ? options.reviewerThreadId : undefined,
|
|
44
46
|
creatorThreadId: typeof options.creatorThreadId === 'string' ? options.creatorThreadId : undefined,
|
|
45
47
|
implementationThreadId: typeof options.implementationThreadId === 'string' ? options.implementationThreadId : undefined,
|
|
46
|
-
|
|
48
|
+
localMergeSource: typeof options.localMergeSource === 'string' ? options.localMergeSource : undefined,
|
|
49
|
+
localMergeTarget: typeof options.localMergeTarget === 'string' ? options.localMergeTarget : undefined,
|
|
50
|
+
noGitHub: noGitHub || options.noGitHub === true,
|
|
47
51
|
coordinator: options.coordinator,
|
|
48
52
|
persist: body.initialPlan !== true,
|
|
49
53
|
});
|
|
50
54
|
if (!repositories.includes(repository))
|
|
51
55
|
repositories.push(repository);
|
|
56
|
+
if (result.job.projectRoot)
|
|
57
|
+
repositoryPaths.set(repository, result.job.projectRoot);
|
|
52
58
|
await refreshAll();
|
|
53
59
|
if (body.initialPlan === true) {
|
|
54
60
|
const current = result.job;
|
|
55
61
|
const existingPlan = current.plans?.at(-1);
|
|
56
62
|
if (existingPlan)
|
|
57
|
-
return { repository,
|
|
63
|
+
return { repository, job: current.id, state: current.state, initialPlan: existingPlan.id, reused: true };
|
|
58
64
|
const unpublished = new InMemoryStore(current);
|
|
59
65
|
const reconciler = makeReconciler(unpublished, concurrency);
|
|
60
66
|
try {
|
|
@@ -77,8 +83,8 @@ export function createWorkspaceControl(deps) {
|
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
if (options.coordinator)
|
|
80
|
-
return { repository,
|
|
81
|
-
return { repository,
|
|
86
|
+
return { repository, job: result.job.id, state: result.job.state, taskId: result.job?.tasks?.find((task) => task.title === 'Coordinator' && task.agentGraph)?.id ?? result.taskId };
|
|
87
|
+
return { repository, job: result.job.id, state: result.job.state };
|
|
82
88
|
}
|
|
83
89
|
if (!jobId)
|
|
84
90
|
throw new Error(command + ' requires jobId');
|
|
@@ -133,9 +139,11 @@ export function createWorkspaceControl(deps) {
|
|
|
133
139
|
}
|
|
134
140
|
if (command === 'job.update') {
|
|
135
141
|
const patch = (body.patch && typeof body.patch === 'object' ? body.patch : {});
|
|
142
|
+
if (Object.hasOwn(patch, 'projectPath'))
|
|
143
|
+
throw new Error('Job projectPath is removed; use the independent Git repository root');
|
|
136
144
|
if ('executionMode' in patch || 'schedule' in patch)
|
|
137
145
|
throw new Error('Job execution modes and schedules are unsupported');
|
|
138
|
-
const mutable = ['title', 'objective', '
|
|
146
|
+
const mutable = ['title', 'objective', 'priority', 'tag', 'autoMerge', 'reviewEnabled', 'reviewerThreadId', 'creatorThreadId', 'implementationThreadId', 'continuation', 'localMerge'];
|
|
139
147
|
for (const key of mutable)
|
|
140
148
|
if (Object.prototype.hasOwnProperty.call(patch, key)) {
|
|
141
149
|
const value = patch[key];
|
|
@@ -189,11 +197,10 @@ export function createWorkspaceControl(deps) {
|
|
|
189
197
|
throw new Error('task.revise requires matching repository, original/reviewer IDs, active execution ID, valid SHA, stable request ID and nonempty findings');
|
|
190
198
|
// Trust fresh local Git truth, not the caller or PR projection. The
|
|
191
199
|
// atomic reducer independently checks durable head and execution.
|
|
192
|
-
const projectRoot = await
|
|
193
|
-
const projectPath = resolveRepositoryProjectPath(projectRoot, job.projectPath);
|
|
200
|
+
const projectRoot = await resolveJobProjectRoot(job);
|
|
194
201
|
const liveHead = job.localMerge?.sourceRef
|
|
195
|
-
? localSourceHead(
|
|
196
|
-
: localWorkingHead(
|
|
202
|
+
? localSourceHead(projectRoot, job.localMerge.sourceRef)
|
|
203
|
+
: localWorkingHead(projectRoot);
|
|
197
204
|
if (liveHead !== headSha)
|
|
198
205
|
throw new Error('task.revise rejected: local Git source head changed since immutable review');
|
|
199
206
|
const response = await submitTargetedRevisionRequest(store, jobId, {
|
|
@@ -303,6 +310,8 @@ export function createWorkspaceControl(deps) {
|
|
|
303
310
|
if (command === 'blocker.ensure') {
|
|
304
311
|
const request = body.request && typeof body.request === 'object' ? body.request : {};
|
|
305
312
|
const readText = (field) => typeof request[field] === 'string' ? request[field] : '';
|
|
313
|
+
if (Object.hasOwn(request, 'projectPath'))
|
|
314
|
+
throw new Error('Blocker projectPath is removed; use a separate Git repository');
|
|
306
315
|
if (request.origin !== 'planner' && request.origin !== 'troubleshooter')
|
|
307
316
|
throw new Error('blocker.ensure origin must be planner or troubleshooter');
|
|
308
317
|
if (request.resolutionMode !== 'merge' && request.resolutionMode !== 'verified')
|
|
@@ -310,13 +319,13 @@ export function createWorkspaceControl(deps) {
|
|
|
310
319
|
const recoveryInput = {
|
|
311
320
|
requestId: readText('requestId'),
|
|
312
321
|
targetRepository: readText('targetRepository'),
|
|
322
|
+
targetProjectRoot: repositoryPaths.get(readText('targetRepository')) ?? '',
|
|
313
323
|
dependentRepository: readText('dependentRepository'),
|
|
314
324
|
dependentJobId: readText('dependentJobId'),
|
|
315
325
|
dependentTaskId: readText('dependentTaskId'),
|
|
316
326
|
reason: readText('reason'),
|
|
317
327
|
title: readText('title'),
|
|
318
328
|
objective: readText('objective'),
|
|
319
|
-
projectPath: typeof request.projectPath === 'string' && request.projectPath ? request.projectPath : undefined,
|
|
320
329
|
resolutionMode: request.resolutionMode,
|
|
321
330
|
origin: request.origin,
|
|
322
331
|
authorized: request.authorized === true,
|
|
@@ -394,8 +403,6 @@ export function createWorkspaceControl(deps) {
|
|
|
394
403
|
await refreshAll();
|
|
395
404
|
return summary;
|
|
396
405
|
}
|
|
397
|
-
if (command === 'projection.conflicts')
|
|
398
|
-
return await binding.relay.listProjectionConflicts();
|
|
399
406
|
if (command === 'job.reconcile') {
|
|
400
407
|
await pool.reconcileLocalJob(jobId, 'control.job.reconcile');
|
|
401
408
|
return await store.load(jobId);
|
|
@@ -403,16 +410,6 @@ export function createWorkspaceControl(deps) {
|
|
|
403
410
|
if (command === 'agent.discover') {
|
|
404
411
|
return discoverAgents(await store.listAgents(), (body.requirements && typeof body.requirements === 'object' ? body.requirements : {}));
|
|
405
412
|
}
|
|
406
|
-
if (command === 'projection.resolve') {
|
|
407
|
-
const id = Number(body.projectionId);
|
|
408
|
-
const action = body.action === 'discard_local' ? 'discard_local' : 'requeue';
|
|
409
|
-
if (!Number.isInteger(id) || id <= 0)
|
|
410
|
-
throw new Error('projection resolve requires projectionId');
|
|
411
|
-
const resolved = await binding.relay.resolveProjectionConflict(id, { action, ...(typeof body.note === 'string' && body.note ? { note: body.note } : {}) });
|
|
412
|
-
if (!resolved)
|
|
413
|
-
throw new Error(`Projection ${id} is not in a resolvable conflict state`);
|
|
414
|
-
return { resolved: id, action };
|
|
415
|
-
}
|
|
416
413
|
if (command === 'record') {
|
|
417
414
|
const task = body.task;
|
|
418
415
|
if (!task || task.jobId !== jobId)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { allocateEntityId
|
|
2
|
+
import { allocateEntityId } from './job-task-id-sequence.js';
|
|
3
3
|
import { relayStoreDirectory } from './relay-store.js';
|
|
4
4
|
import { dispatchJobLifecycleSync } from './workflow/lifecycle.js';
|
|
5
5
|
export function createDashboardActions(deps) {
|
|
@@ -38,10 +38,9 @@ export function createDashboardActions(deps) {
|
|
|
38
38
|
const job = await store.load(jobId);
|
|
39
39
|
if (['COMPLETED', 'CANCELLED'].includes(job.state))
|
|
40
40
|
throw new Error(`Cannot create task on terminal job ${job.id} (${job.state})`);
|
|
41
|
-
if (task.id
|
|
42
|
-
throw new Error('
|
|
43
|
-
|
|
44
|
-
task.id = allocateEntityId(storeDirectory ?? relayStoreDirectory(), job.repository, 'task', idempotencyKey ? `${jobId}:${idempotencyKey}` : undefined);
|
|
41
|
+
if (task.id)
|
|
42
|
+
throw new Error('Task IDs are allocated by Relay and cannot be supplied');
|
|
43
|
+
task.id = allocateEntityId(storeDirectory ?? relayStoreDirectory(), job.repository, 'task', idempotencyKey ? `${jobId}:${idempotencyKey}` : undefined);
|
|
45
44
|
let alreadyCreated = false;
|
|
46
45
|
if (store.mutateJob) {
|
|
47
46
|
await store.mutateJob(jobId, (current) => {
|
package/dist/relayd-utilities.js
CHANGED
|
@@ -35,23 +35,22 @@ Usage:
|
|
|
35
35
|
npx agents-relayd [options]
|
|
36
36
|
|
|
37
37
|
Options:
|
|
38
|
-
--
|
|
39
|
-
--
|
|
40
|
-
--workspace
|
|
41
|
-
--workspace PATH Legacy alias for --workspace-root
|
|
38
|
+
--repo LOCAL_ROOT_NAME Optional local Git identity; Job inventory comes from SQLite
|
|
39
|
+
--workspace-root PATH Optional worktree/execution placement; never scans for repositories
|
|
40
|
+
--workspace PATH Legacy alias for --workspace-root (not needed for normal daemon)
|
|
42
41
|
--port PORT Dashboard port (default: 8787)
|
|
43
42
|
--concurrency N Maximum concurrent workers (default: 4)
|
|
44
43
|
--interval MS Recovery interval
|
|
45
|
-
--projection-ms MS GitHub projection flush interval (default: 1000)
|
|
46
44
|
--execution-router-rules PATH
|
|
47
45
|
Router Rules file (default: ~/.agents-relay/execution-router-rules.md)
|
|
48
46
|
--events nats Require NATS event wakeups (otherwise auto-detect reachable NATS)
|
|
49
47
|
|
|
50
|
-
Legacy single-job mode also accepts --repo OWNER/REPO --pr NUMBER --id JOB_ID.
|
|
51
|
-
|
|
52
48
|
Examples:
|
|
53
|
-
npx agents-relayd
|
|
54
|
-
npx agents-relayd --
|
|
49
|
+
npx agents-relayd
|
|
50
|
+
npx agents-relayd --repo LOCAL_ROOT_NAME
|
|
51
|
+
|
|
52
|
+
No recursive Workspace search: persisted Job projectRoot in SQLite
|
|
53
|
+
are authoritative. Changing Workspace directory layout does not select Jobs.`;
|
|
55
54
|
export function firstStageChoices(decisionInput) {
|
|
56
55
|
const stages = decisionInput?.stages;
|
|
57
56
|
if (!Array.isArray(stages) || stages.length === 0)
|
|
@@ -61,22 +60,18 @@ export function firstStageChoices(decisionInput) {
|
|
|
61
60
|
}
|
|
62
61
|
export function value(args, name, fallback = '') { const index = args.indexOf(name); return index >= 0 ? args[index + 1] ?? fallback : fallback; }
|
|
63
62
|
export function normalizeDaemonArguments(argv) {
|
|
63
|
+
const obsolete = ['--github-repo', '--pr', '--no-github', '--dependent-pr', '--head', '--base', '--body', '--github-app-id', '--github-app-installation-id', '--github-app-private-key-file', '--github-webhook-secret', '--github-webhook-secret-file', '--github-token', '--github-token-file', '--projection-ms', '--id'].find(flag => argv.some(arg => arg === flag || arg.startsWith(flag + '=')));
|
|
64
|
+
if (obsolete)
|
|
65
|
+
throw new Error(`Unsupported option ${obsolete}: daemon Jobs use local Git identity and SQLite lifecycle state`);
|
|
64
66
|
const repository = value(argv, '--repo') || null;
|
|
67
|
+
if (repository && argv.includes('--workspace'))
|
|
68
|
+
throw new Error('--repo and --workspace are mutually exclusive');
|
|
65
69
|
if (argv.includes('--workspace-root') && argv.includes('--workspace'))
|
|
66
70
|
throw new Error('--workspace-root and --workspace cannot both be supplied');
|
|
67
71
|
const workspaceRootValue = value(argv, '--workspace-root') || value(argv, '--workspace') || process.env.AGENTS_RELAY_WORKSPACE_ROOT;
|
|
68
72
|
const workspaceRoot = workspaceRootValue ? resolve(workspaceRootValue) : null;
|
|
69
|
-
const
|
|
70
|
-
const id =
|
|
71
|
-
if ((prValue && !id) || (!prValue && id))
|
|
72
|
-
throw new Error('--pr and --id must be supplied together for legacy single-job mode');
|
|
73
|
-
if ((prValue || id) && !repository)
|
|
74
|
-
throw new Error('--repo is required for legacy single-job mode');
|
|
75
|
-
if (repository && argv.includes('--workspace'))
|
|
76
|
-
throw new Error('--repo and --workspace are mutually exclusive');
|
|
77
|
-
const pullRequest = prValue ? Number(prValue) : null;
|
|
78
|
-
if (pullRequest !== null && (!Number.isInteger(pullRequest) || pullRequest <= 0))
|
|
79
|
-
throw new Error('--pr must be positive');
|
|
73
|
+
const pullRequest = null;
|
|
74
|
+
const id = null;
|
|
80
75
|
return { repository, workspaceRoot, pullRequest, jobId: id || null, serviceArguments: [...argv] };
|
|
81
76
|
}
|
|
82
77
|
export function recoveryScanRepositories(repositories, cached, dormantProbeIndex = 0) {
|