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.
Files changed (64) hide show
  1. package/README.md +57 -52
  2. package/bin/migrate-task-ids.mjs +12 -0
  3. package/dist/blocker-recovery.js +9 -16
  4. package/dist/cli-blocker.js +2 -1
  5. package/dist/cli-coordinator.js +19 -7
  6. package/dist/cli-foreground.js +82 -0
  7. package/dist/cli-help.js +61 -72
  8. package/dist/cli-job-create.js +15 -9
  9. package/dist/cli-prompt.js +9 -5
  10. package/dist/cli-support.js +21 -8
  11. package/dist/cli-worker-task.js +9 -3
  12. package/dist/cli.js +50 -36
  13. package/dist/dag-task-runtime.js +16 -12
  14. package/dist/dashboard-html.js +28 -14
  15. package/dist/dashboard-jel.js +87 -31
  16. package/dist/dashboard-style.js +2 -8
  17. package/dist/dependency-revision-execution.js +15 -6
  18. package/dist/final-review-role.js +0 -12
  19. package/dist/job-local-repository-migration.js +137 -0
  20. package/dist/job-pr-number-migration.js +0 -4
  21. package/dist/job-task-id-sequence.js +18 -9
  22. package/dist/job-worktree-cleanup.js +3 -3
  23. package/dist/local-job-registry.js +2 -2
  24. package/dist/local-managed-store.js +2 -2
  25. package/dist/local-merge-delivery.js +16 -3
  26. package/dist/local-merge-projection.js +192 -49
  27. package/dist/no-github.js +2 -1
  28. package/dist/planner-recovery.js +8 -3
  29. package/dist/planner.js +5 -5
  30. package/dist/pool.js +8 -2
  31. package/dist/projection-failure-recovery.js +6 -46
  32. package/dist/reconciler-context.js +5 -5
  33. package/dist/reconciler-review.js +12 -37
  34. package/dist/reconciler-runtime.js +1 -4
  35. package/dist/reconciler.js +5 -5
  36. package/dist/relay-job-merge.js +33 -0
  37. package/dist/relay-store.js +8 -30
  38. package/dist/relay-workflow-operations.js +2 -0
  39. package/dist/relayd-control.js +22 -25
  40. package/dist/relayd-dashboard-actions.js +4 -5
  41. package/dist/relayd-utilities.js +15 -20
  42. package/dist/relayd.js +59 -299
  43. package/dist/review-generation-fence.js +1 -1
  44. package/dist/review-replan.js +6 -1
  45. package/dist/review-revision-model.js +11 -6
  46. package/dist/task-context.js +1 -1
  47. package/dist/task-id-migration.js +229 -0
  48. package/dist/task-transitions.js +1 -1
  49. package/dist/troubleshooter.js +13 -16
  50. package/dist/unified-job-registry.js +9 -0
  51. package/dist/workflow/projection-conflict-v2.js +30 -26
  52. package/dist/workflow/task-related-action-v2.js +1 -2
  53. package/dist/workspace.js +52 -56
  54. package/package.json +4 -2
  55. package/skills/agents-relay/SKILL.md +35 -60
  56. package/skills/agents-relay/agents/planner.agent.md +5 -5
  57. package/skills/agents-relay/bin/services.mjs +21 -3
  58. package/skills/agents-relay/contracts/task-job-contract.md +11 -2
  59. package/skills/agents-relay/evals/capabilities.json +6 -1
  60. package/workflow/projection-conflict.mmd +59 -56
  61. package/workflow/projection-outbox-conflict.mmd +20 -0
  62. package/dist/cli-projection.js +0 -29
  63. package/dist/projection-recovery-runtime.js +0 -121
  64. package/dist/projection-recovery.js +0 -101
package/dist/cli-help.js CHANGED
@@ -1,14 +1,14 @@
1
- export const usage = 'agents-relay <job|task|review|artifact|plan|prompt|blocker|projection|escalation|context|init|record|agent-register|agent-discover|status|reconcile|serve> [options]';
1
+ export const usage = 'agents-relay <job|task|review|artifact|plan|prompt|blocker|escalation|context|init|record|agent-register|agent-discover|status|reconcile|serve|migrate-local-repositories> [options]';
2
2
  const help = {
3
3
  root: `Agents Relay coordinates durable asynchronous agent jobs through local SQLite and workflow graphs.
4
4
 
5
5
  Usage:
6
- npx agents-relay <command> [options] [--no-github]
6
+ npx agents-relay <command> [options]
7
7
 
8
- --no-github: SQLite/Graph-only mode. GitHub auth/API, PR creation, merge and fetch are disabled. Local completion is Graph-owned.
8
+ Jobs use local Git identity and SQLite lifecycle state. After completion, Relay may push main to configured origin with fast-forward-only semantics.
9
9
 
10
10
  Commands:
11
- job create|update|show|list|run|merge|unblock|cancel|pause|resume Manage SQLite-authoritative jobs with optional GitHub PRs
11
+ job create|update|show|list|run|unblock|cancel|pause|resume Manage SQLite-authoritative local Jobs
12
12
  task create|update|show|list|revise|classify|complete|retry|unblock|cancel Manage durable tasks
13
13
  review job Request graph-owned review (optional thread override)
14
14
  review interactive Bind, wait, ready, fail or abort a host-owned human review
@@ -18,50 +18,53 @@ Commands:
18
18
  plan context Read execution-bound Planner context from SQLite
19
19
  prompt Print raw Planner/Worker prompt from the production Builder
20
20
  blocker add|resolve|show Manage cross-Job blocker dependencies
21
- projection conflicts|resolve Inspect and repair deterministic GitHub projection conflicts
22
21
  escalation Run the canonical escalation graph with a configured external executor
23
22
  context resolve Resolve shared project instructions, skills, agents, and runtimes
24
- init Create a local demo job or initialize a GitHub job
23
+ init Create a local demo Job
25
24
  record Backfill a completed task into durable history
26
25
  agent-register Register an agent role and its capabilities
27
26
  agent-discover Find registered agents matching hard filters
28
27
  status Show live aggregate runtime status from agents-relayd
29
28
  reconcile Run reconciliation once
30
29
  serve Run the dashboard and reconciliation service
30
+ migrate-local-repositories Migrate canonical SQLite Jobs to local Git identities (daemon stopped)
31
31
 
32
32
  Run 'npx agents-relay <command> --help' for command options and examples.
33
33
  Use 'node dist/cli.js' only for explicit local development/demo mode.`,
34
34
  job: `Manage SQLite-authoritative durable jobs.
35
35
 
36
36
  Usage:
37
- npx agents-relay job <create|update|show|list|run|merge|unblock|cancel|pause|resume> [options]
37
+ npx agents-relay job <create|update|show|list|run|unblock|cancel|pause|resume> [options]
38
38
 
39
39
  Actions:
40
40
  create Atomically create a durable Job, optionally with its Coordinator DAG Task
41
41
  update Partially update mutable metadata on a healthy existing Job
42
42
  show Show one durable Job
43
- run Activate an ordinary DRAFT Coordinator Graph Job; Relay schedules its Tasks
43
+ run Activate a Coordinator Graph Job; --foreground runs immediately and streams console events
44
44
  list List managed Jobs in a repository
45
- merge Legacy entry point; local Git merge is Graph-owned (no CLI PR merge)
46
45
  unblock Authoritatively invalidate current BLOCKED decisions and trigger replanning/resume
47
- cancel Cancel the Job through the SQLite/Graph lifecycle (no PR required)
46
+ cancel Cancel the Job through the SQLite/Graph lifecycle
48
47
  pause Persistently stop dispatch and interrupt active generations; lifecycle state remains unchanged
49
48
  resume Clear pause metadata and requeue interrupted work
50
49
 
51
50
  Common options:
52
- --repo OWNER/REPO Required for create; optional Job identity check otherwise
51
+ --repo LOCAL_ROOT_NAME Local Git root directory name; required local Job identity
53
52
  --id JOB_ID Durable job identifier
54
53
 
55
54
  Coordinator/DAG creation and activation (no initial Planner required):
56
- agents-relay job create --repo OWNER/REPO --objective-file job.md
55
+ agents-relay job create --repo LOCAL_ROOT_NAME --project-root /absolute/git/root --objective-file job.md
57
56
  --coordinator-graph-file /abs/graph.mmd --coordinator-input-file /abs/input.md
58
57
  --coordinator-output-path /abs/result.json --coordinator-project-root /abs/project
59
58
  --coordinator-workspace-root /abs/workspace [--coordinator-shared-root /abs/shared]
60
- agents-relay job run --id JOB --task-id coordinator
59
+ agents-relay job run --id JOB --task-id NUMERIC_TASK_ID
61
60
  [--project-path /abs/project] [--workspace-root /abs/workspace]
61
+ [--foreground] [--concurrency 4]
62
62
 
63
63
  Creation atomically stores DRAFT Job and Coordinator Task; activation only
64
- wakes the ordinary Task Reconciler and returns ACTIVE. The Coordinator owns
64
+ wakes the ordinary Task Reconciler and returns ACTIVE. With --foreground,
65
+ the CLI runs that Reconciler directly, prints live Task events, and waits for the
66
+ Job to reach a terminal state (Ctrl+C interrupts local workers, but keeps the Job durable for recovery).
67
+ The Coordinator owns
65
68
  one durable Script/Model Task per ready DAG node. After a terminal event,
66
69
  its successors are dispatched immediately when capacity permits. Independent
67
70
  Final Review and Git Merge policies remain in force. Review previews do not
@@ -87,7 +90,7 @@ The generic Outcome Reviewer is implicit. Exit 0=PASS, 10=CHANGE_REQUIRED, 20=BL
87
90
 
88
91
  Request a new SHA-bound reviewer turn through the existing Relay lifecycle.
89
92
 
90
- Usage: npx agents-relay review job --repo OWNER/REPO --id JOB_ID [--thread-id THREAD_ID]
93
+ Usage: npx agents-relay review job --repo LOCAL_ROOT_NAME --id JOB_ID [--thread-id THREAD_ID]
91
94
 
92
95
  When provided, --thread-id persists a reviewer destination; otherwise the Job reviewer thread, then creator thread, then legacy review route is used. The command wakes Relay. Review Task creation, idempotency, routing and delivery remain graph/daemon-owned. Rejects in-flight/queued reviews; does not itself mark review delivered.
93
96
 
@@ -106,12 +109,13 @@ Usage: agents-relay review run (--prompt TEXT | --prompt-file PATH) [--project-p
106
109
  Return codes: 0 PASS, 10 CHANGE_REQUIRED, 20 BLOCKED; CLI/worker errors fail separately.`,
107
110
  'review job': `Request a review in an existing ChatGPT thread.
108
111
 
109
- Required: --repo OWNER/REPO --id JOB_ID.
112
+ Required: --repo LOCAL_ROOT_NAME --id JOB_ID.
110
113
  Optional: --thread-id THREAD_ID persists a reviewer override; omitted uses Job reviewer/creator thread or legacy route. Rejects pending reviews and wakes managed reconciliation.`,
111
114
  'job create': `Create a SQLite-authoritative Job (objective-only).
112
115
 
113
- Required: --repo OWNER/REPO and a standalone Job objective. Job ID defaults to an auto-incrementing store-global number; --id may only reference an existing numeric Job.
114
- Common: --id JOB_ID (optional), --title TEXT, --objective-file PATH|- (preferred), --objective MARKDOWN (short/simple only), --project-path RELATIVE_PATH, --priority P0|P1|P2|P3, --initial-plan, --review|--no-review, --auto-merge|--no-auto-merge, --tag JSON, --reviewer-thread-id ID, --creator-thread-id ID, --implementation-thread-id ID. --objective and --objective-file are mutually exclusive.
116
+ Required: --repo LOCAL_ROOT_NAME and a standalone Job objective. Job ID defaults to an auto-incrementing store-global number; --id may only reference an existing numeric Job.
117
+ Common: --id JOB_ID (optional), --title TEXT, --objective-file PATH|- (preferred), --objective MARKDOWN (short/simple only), --project-root ABSOLUTE_GIT_ROOT, --priority P0|P1|P2|P3, --initial-plan, --review|--no-review, --auto-merge|--no-auto-merge, --tag JSON, --reviewer-thread-id ID, --creator-thread-id ID, --implementation-thread-id ID. --objective and --objective-file are mutually exclusive.
118
+ Optional local Git branch binding: --local-merge-source refs/heads/FEATURE --local-merge-target refs/heads/main (both required together). For ordinary code tasks Relay can also bind its isolated local source branch automatically; no remote service or PR is required.
115
119
  Creation enables auto-merge and Final Review by default. For plan-free DAG
116
120
  jobs, pass --coordinator-graph-file GRAPH --coordinator-input-file INPUT
117
121
  --coordinator-output-path ABS --coordinator-project-root ABS
@@ -123,10 +127,10 @@ The --no-review and --no-auto-merge policies are separate; creation is
123
127
  idempotent and does not rewrite an existing Job.
124
128
 
125
129
  Example:
126
- npx agents-relay job create --repo OWNER/REPO --project-path vlog --title "Episode" --objective-file episode.md --initial-plan`,
130
+ npx agents-relay job create --repo vlog --project-root /absolute/path/to/vlog --title "Episode" --objective-file episode.md --initial-plan`,
127
131
  'job run': `Activate a DRAFT Job with a durable Coordinator Agent Graph Task. No Planner or execution mode is required.
128
132
 
129
- Usage: agents-relay job run --id JOB --task-id TASK [--project-path DIR] [--no-github]
133
+ Usage: agents-relay job run --id NUMERIC_JOB_ID --task-id NUMERIC_TASK_ID [--repo LOCAL_ROOT_NAME] [--foreground]
130
134
 
131
135
  The command activates ordinary Job lifecycle and emits a wake-up. It returns
132
136
  ACTIVE without blocking for all Agent Tasks. The same Job Reconciler creates
@@ -138,37 +142,34 @@ remain ordinary Job policies. No Git commit occurs on interactive review.
138
142
  There is no Shortcut execution mode.`,
139
143
  'job update': `Partially update mutable metadata on a healthy existing Job.
140
144
 
141
- Required: --id JOB_ID. Optional: --repo OWNER/REPO verifies the stored Job identity.
142
- Mutable: --title, --objective-file PATH|- (preferred) or --objective MARKDOWN, --project-path RELATIVE_PATH, --priority, --tag JSON, --auto-merge|--no-auto-merge, --review|--no-review, --reviewer-thread-id ID, --creator-thread-id ID, --implementation-thread-id ID, and continuation options. The objective updates local SQLite; PR body changes are independent external actions.
143
- Unspecified fields are preserved. Local Job/PR identity mismatch is rejected.
145
+ Required: --id JOB_ID. Optional: --repo LOCAL_ROOT_NAME verifies the stored Job identity.
146
+ Mutable: --title, --objective-file PATH|- (preferred) or --objective MARKDOWN, --project-root ABSOLUTE_GIT_ROOT, --priority, --tag JSON, --auto-merge|--no-auto-merge, --review|--no-review, --reviewer-thread-id ID, --creator-thread-id ID, --implementation-thread-id ID, and continuation options. The objective updates local SQLite.
147
+ Unspecified fields are preserved. Local Job identity mismatch is rejected.
144
148
 
145
149
  Example:
146
150
  npx agents-relay job update --id 101 --priority P0 --no-auto-merge`,
147
151
  'job show': `Show one durable Job.
148
152
 
149
- Required: --id JOB_ID. Optional: --repo OWNER/REPO validates the repository.
153
+ Required: --id JOB_ID. Optional: --repo LOCAL_ROOT_NAME validates the repository.
150
154
 
151
155
  Example:
152
156
  npx agents-relay job show --id 101`,
153
157
  'job list': `List managed Jobs across repositories, or filter by repository.
154
158
 
155
- Optional: --repo OWNER/REPO filters results.
159
+ Optional: --repo LOCAL_ROOT_NAME filters results.
156
160
 
157
161
  Example:
158
162
  npx agents-relay job list`,
159
- 'job merge': `Legacy entry point; external GitHub PR merges are not initiated by this CLI.
160
-
161
- Managed Jobs use Graph-owned local merge and publication. Identify a Job with --id JOB_ID; --repo OWNER/REPO is optional.`,
162
- 'job unblock': `Authoritatively unblock BLOCKED Troubleshooter Tasks in one Job.\n\nRequired: --id JOB_ID --reason TEXT. Optional: --repo OWNER/REPO. Each unblocked Troubleshooter is queued as the same Task and must rerun, verify the condition, and issue a fresh resolution before retrying an original failed Task.`,
163
+ 'job unblock': `Authoritatively unblock BLOCKED Troubleshooter Tasks in one Job.\n\nRequired: --id JOB_ID --reason TEXT. Optional: --repo LOCAL_ROOT_NAME. Each unblocked Troubleshooter is queued as the same Task and must rerun, verify the condition, and issue a fresh resolution before retrying an original failed Task.`,
163
164
  'job cancel': `Cancel a durable Job and its unfinished Tasks through the authoritative Relay Graph.
164
165
 
165
- Required: --id JOB_ID. Optional: --repo OWNER/REPO checks identity. No PR number is required.`,
166
+ Required: --id JOB_ID. Optional: --repo LOCAL_ROOT_NAME checks local identity.`,
166
167
  'job pause': `Pause a durable Job without inventing a PAUSED lifecycle state.
167
168
 
168
- Required: --id JOB_ID. Optional: --repo OWNER/REPO. Running worker and Planner generations are interrupted durably and resume as uncompleted work.`,
169
+ Required: --id JOB_ID. Optional: --repo LOCAL_ROOT_NAME. Running worker and Planner generations are interrupted durably and resume as uncompleted work.`,
169
170
  'job resume': `Resume a paused durable Job.
170
171
 
171
- Required: --id JOB_ID. Optional: --repo OWNER/REPO. Interrupted work is requeued and normal reconciliation continues.`,
172
+ Required: --id JOB_ID. Optional: --repo LOCAL_ROOT_NAME. Interrupted work is requeued and normal reconciliation continues.`,
172
173
  escalation: `Run the canonical escalation workflow for a suspected human/external blocker.\n\nRequired: --intent TEXT|--intent-file PATH and --blocked-on TEXT|--blocked-on-file PATH. Optional: --context/--context-file, --on-needs-user/--on-needs-user-file, --cwd. The workflow/escalation.mmd graph invokes an operator-configured executor and owns the resolved / failed / needs_user branches. Only needs_user selects the block-for-user path. Set AGENTS_RELAY_ESCALATION_COMMAND to an absolute executable path or JSON argv array (for example ["/opt/homebrew/bin/neo","escalation"]). No Neo executable is assumed by Relay; missing/broken executors produce technical_failure.`,
173
174
  status: `Show live aggregate runtime status from the running Agents Relay service.
174
175
 
@@ -193,35 +194,36 @@ Actions:
193
194
  cancel Cancel a Task`,
194
195
  'task create': `Create one durable Task under an existing Job.
195
196
 
196
- Required: normal Job storage options plus --input-file PATH|- (preferred) or --input MARKDOWN, and --output task-pr|file. --input and --input-file are mutually exclusive.
197
- Common: --task-id ID (optional; Relay auto-assigns a global increasing integer Task ID), --title TITLE (optional; otherwise derived from the first non-empty input line), --idempotency-key KEY, --priority P0|P1|P2|P3, --story-size S|M|L, --agent NAME, --agent-graph-file PATH|-, --deps a,b, --dependency-validity JSON, --parent ID, --draft. The JSON maps declared dependency Task IDs to order-only, revalidate, or rerun. Normal model-backed Tasks omit adapter/provider/model so Relay runs one Execution Router decision over complete worker+model routes. New Tasks are worker-routed; legacy adapter=orchestrator records are recovery-only and cannot be created or manually executed.\nTasks with dependencies start DRAFT; tasks without dependencies start QUEUED unless --draft is given.
197
+ Required: --repo LOCAL_ROOT_NAME --id NUMERIC_JOB_ID, --input-file PATH|- (preferred) or --input MARKDOWN, and --output local-git|file. --input and --input-file are mutually exclusive.
198
+ --output local-git marks code changes for local Git merge; --output file also requires --output-path PATH. Neither creates a remote request.
199
+ Common: --title TITLE (optional; otherwise derived from the first non-empty input line), --idempotency-key KEY, --priority P0|P1|P2|P3, --story-size S|M|L, --agent NAME, --agent-graph-file PATH|-, --deps 201,202, --dependency-validity JSON, --parent ID, --draft. Relay allocates the store-global increasing numeric Task ID and rejects caller-supplied IDs. The JSON maps declared dependency Task IDs to order-only, revalidate, or rerun. Normal model-backed Tasks omit adapter/provider/model so Relay runs one Execution Router decision over complete worker+model routes. New Tasks are worker-routed; legacy adapter=orchestrator records are recovery-only and cannot be created or manually executed.\nTasks with dependencies start DRAFT; tasks without dependencies start QUEUED unless --draft is given.
198
200
  Directly-created Tasks are not wrapped in a synthetic Plan. Planner-generated Tasks are created internally by Relay from planner output.
199
201
 
200
202
  Example:
201
- npx agents-relay task create --repo OWNER/REPO --id j-5-owner-repo-1 --output file --output-path story.md --input-file task.md`,
203
+ npx agents-relay task create --repo LOCAL_ROOT_NAME --id 101 --output file --output-path story.md --input-file task.md`,
202
204
  'task update': `Update mutable durable Task fields in place.
203
205
 
204
- Required: --id JOB_ID --task-id ID. Optional --repo OWNER/REPO fences the Job identity.
206
+ Required: --id JOB_ID --task-id ID. Optional --repo LOCAL_ROOT_NAME fences the Job identity.
205
207
  Mutable while not RUNNING/SUCCEEDED/CANCELLED: --title, --adapter, --priority, --story-size, --input-file PATH|- or --input MARKDOWN, --project, --agent, --agent-graph-file PATH|-, --parent, --deps, --dependency-validity JSON, --capabilities, --timeout (inactivity window), --max-attempts, --provider, --model, --profile, --reasoning, --cwd, --chatgpt-project, --chatgpt-tab-close-policy, --draft, --queue.
206
208
  Accepted task.started and newer current-execution task.progress events reset --timeout.
207
209
  Use --clear-routing to remove routing metadata.
208
210
 
209
211
  Example:
210
- npx agents-relay task update --repo OWNER/REPO --id 101 --task-id build --adapter chatgpt --provider chatgpt --model gpt-5.6-sol --reasoning high`,
212
+ npx agents-relay task update --repo LOCAL_ROOT_NAME --id 101 --task-id 202 --adapter chatgpt --provider chatgpt --model gpt-5.6-sol --reasoning high`,
211
213
  'task revise': `Authenticated immutable-head targeted revision request from the active Final Reviewer.
212
214
 
213
- Required: --repo OWNER/REPO --id JOB --task-id ORIGINAL --review-task-id FINAL_REVIEW --execution-id CURRENT_REVIEW_EXECUTION --head-sha EXACT_SHA --request-id STABLE_ID --findings-file PATH. The findings file contains a nonempty JSON array [{"id":"F-1","summary":"...","evidence":"..."}].
215
+ Required: --repo LOCAL_ROOT_NAME --id JOB --task-id ORIGINAL --review-task-id FINAL_REVIEW --execution-id CURRENT_REVIEW_EXECUTION --head-sha EXACT_SHA --request-id STABLE_ID --findings-file PATH. The findings file contains a nonempty JSON array [{"id":"F-1","summary":"...","evidence":"..."}].
214
216
 
215
217
  The Relay service verifies the current Reviewer generation and local Git head, atomically records immutable owner feedback and a semantic child revision. Repeating an identical request ID is idempotent; it does not finish a Reviewer or revision Task. Reviewer must subsequently report its canonical changes-required verdict.`,
216
218
  'task comment': `Append an immutable Task comment. Does not retry or change Task state.
217
219
 
218
- Required: --repo OWNER/REPO --id JOB_ID --task-id TASK_ID and --message TEXT or --message-file FILE.`,
220
+ Required: --repo LOCAL_ROOT_NAME --id JOB_ID --task-id TASK_ID and --message TEXT or --message-file FILE.`,
219
221
  'task comments': `List append-only Task comments.
220
222
 
221
- Required: --id JOB_ID --task-id TASK_ID. Optional --repo OWNER/REPO fences the Job identity.`,
223
+ Required: --id JOB_ID --task-id TASK_ID. Optional --repo LOCAL_ROOT_NAME fences the Job identity.`,
222
224
  'task context': `Read the authoritative execution-scoped Task contract.
223
225
 
224
- Required: --id JOB_ID --task-id TASK_ID --execution-id EXECUTION_ID. Optional --repo OWNER/REPO fences the Job identity. Fails closed on stale execution.`,
226
+ Required: --id JOB_ID --task-id TASK_ID --execution-id EXECUTION_ID. Optional --repo LOCAL_ROOT_NAME fences the Job identity. Fails closed on stale execution.`,
225
227
  'task events': `Read the latest Task-scoped lifecycle events via Relay.
226
228
 
227
229
  Required: --id JOB_ID --task-id TASK_ID. Optional --repo, --limit 1..60 (default 60), --order asc|desc (default desc), --after CURSOR (for asc). To read full history: start with --order asc --after 0, then repeat with nextCursor until a page has fewer than --limit events. Failure to retrieve history is not success.`,
@@ -245,35 +247,35 @@ Required: --task-id ID and the normal Job storage options.`,
245
247
  'task classify': `Classify a FAILED work Task as superseded or invalid without changing its Task lifecycle.\n\nRequired: --task-id ID --classification superseded|invalid --target-task-id ID --evidence TEXT --reason TEXT and the normal Job storage options. Unknown or active execution outcomes are rejected.`,
246
248
  plan: `Invoke the Planner against the current durable Job state.
247
249
 
248
- Agent submit: agents-relay plan apply --repo OWNER/REPO --id JOB_ID --plan-id PLAN_ID --execution-id EXECUTION_ID --file plan.json. Validation errors reject without partial task writes and can be corrected inside the same Planner execution.
250
+ Agent submit: agents-relay plan apply --repo LOCAL_ROOT_NAME --id JOB_ID --plan-id PLAN_ID --execution-id EXECUTION_ID --file plan.json. Validation errors reject without partial task writes and can be corrected inside the same Planner execution.
249
251
 
250
- Required: --repo OWNER/REPO and --id JOB_ID.
252
+ Required: --repo LOCAL_ROOT_NAME and --id JOB_ID.
251
253
  Optional: --prompt TEXT or --prompt-file PATH|- (mutually exclusive). The prompt is additional guidance for this planning round and never replaces the durable Job objective. --force-restate asks Planner to propose evidence-backed dispositions for failed Tasks inside the Plan. Plan apply validates hypothetical history and forward convergence before one atomic SQLite commit; validation errors leave all SQLite state unchanged and can be corrected in the same Planner execution. Unknown execution outcomes remain unresolved without proof. Text responses are never applied as a Plan.
252
254
 
253
255
  The command persists one real plan-N round, materializes validated next_tasks with planner provenance, and wakes normal reconciliation. It works for zero-task DRAFT Jobs. Historical planner-N rounds remain readable, but new rounds use plan-N.
254
256
 
255
257
  Example:
256
- npx agents-relay plan --repo OWNER/REPO --id 101 --prompt "Plan the full implementation now; keep independent work parallel."`,
258
+ npx agents-relay plan --repo LOCAL_ROOT_NAME --id 101 --prompt "Plan the full implementation now; keep independent work parallel."`,
257
259
  blocker: `Manage durable cross-Job blocker dependencies.
258
260
 
259
261
  Usage:
260
262
  npx agents-relay blocker <add|resolve|show> [options]
261
263
 
262
- The blocker Job owns reverse \`unblocks\` references. \`add\` registers a failed/blocked dependent task. \`resolve\` is the explicit verified-resolution path; merge-mode blockers also resolve automatically after the blocker PR is observed merged.`,
264
+ The blocker Job owns reverse \`unblocks\` references. \`add\` registers a failed/blocked dependent task. \`resolve\` is the explicit verified-resolution path; merge-mode blockers resolve against the blocker Job’s authoritative local merge.`,
263
265
  'blocker add': `Register a dependent failed/blocked Task on a blocker Job.
264
266
 
265
- Blocker: --repo OWNER/REPO --id JOB_ID.
266
- Dependent: --dependent-repo OWNER/REPO --dependent-pr NUMBER --dependent-job JOB_ID --dependent-task TASK_ID.
267
+ Blocker: --repo LOCAL_ROOT_NAME --id JOB_ID.
268
+ Dependent: --dependent-repo LOCAL_ROOT_NAME --dependent-job JOB_ID --dependent-task TASK_ID.
267
269
  Common: --resolution merge|verified (default merge).`,
268
270
  'blocker ensure': `Create or reuse an authorized cross-repository blocker Job and register its reverse relation.
269
271
 
270
- Dependent: --repo OWNER/REPO --id DEPENDENT_JOB_ID --dependent-task TASK_ID.
271
- Target: --target-repo OWNER/REPO --title TITLE --reason TEXT --objective-file PATH|-.
272
+ Dependent: --repo LOCAL_ROOT_NAME --id DEPENDENT_JOB_ID --dependent-task TASK_ID.
273
+ Target: --target-repo LOCAL_ROOT_NAME --title TITLE --reason TEXT --objective-file PATH|-.
272
274
  Identity: --request-id STABLE_REQUEST_ID --origin planner|troubleshooter --resolution merge|verified --authorized.
273
275
  Target repositories must be configured in the current trusted workspace; target projects must use a normalized repository-relative path.`,
274
276
  'blocker resolve': `Resolve a verified blocker and safely requeue matching dependents.
275
277
 
276
- Required: --repo OWNER/REPO --id JOB_ID. This explicit path is required for blockers configured with --resolution verified.`,
278
+ Required: --repo LOCAL_ROOT_NAME --id JOB_ID. This explicit path is required for blockers configured with --resolution verified.`,
277
279
  'blocker show': `Show a blocker Job including its durable unblocks relations.`,
278
280
  context: `Resolve the shared execution context used by XChat and Relay.
279
281
 
@@ -299,46 +301,35 @@ Example:
299
301
  npx agents-relay record --file .agents-relay.json --summary "Built release" --commit abc123`,
300
302
  reconcile: `Reconcile a job once by requesting one reconciliation pass.
301
303
 
302
- Required: --file PATH for local demo mode, or --repo OWNER/REPO --id JOB_ID.
304
+ Required: --file PATH for local demo mode, or --repo LOCAL_ROOT_NAME --id JOB_ID.
303
305
 
304
- Managed GitHub jobs are reconciled by agents-relayd. The CLI publishes a job.wake request and does not launch workers; NATS is auto-detected when reachable; use --events nats to require it explicitly. Local/runtime invocations may use --thread-id ID to override the durable reviewer/creator thread for ChatGPT review delivery.
306
+ SQLite-backed local Git Jobs are reconciled by agents-relayd. The CLI publishes a job.wake request and does not launch workers; NATS is auto-detected when reachable; use --events nats to require it explicitly. Local/runtime invocations may use --thread-id ID to override the durable reviewer/creator thread for ChatGPT review delivery.
305
307
 
306
308
  Example:
307
- npx agents-relay reconcile --repo OWNER/REPO --id 101`,
308
- init: `Initialize a new job. GitHub mode requires --repo and --pr; local mode requires explicit --file.
309
+ npx agents-relay reconcile --repo LOCAL_ROOT_NAME --id 101`,
310
+ init: `Initialize a local Job using the local Git root identity.
309
311
 
310
312
  Common: --id ID, --title TEXT, --objective TEXT, --priority P0|P1|P2|P3. All Jobs replan to an explicit satisfied objective; execution modes and schedules are unsupported.
311
313
 
312
314
  Example:
313
- npx agents-relay init --repo OWNER/REPO --pr 12 --id 101 --title "Objective"`,
315
+ npx agents-relay init --repo LOCAL_ROOT_NAME --id 101 --title "Objective"`,
314
316
  serve: `Run the dashboard and reconciliation service for a managed job.
315
317
 
316
- Required: --file PATH for local demo mode, or --repo OWNER/REPO --id JOB_ID.
318
+ Required: --file PATH for local demo mode, or --repo LOCAL_ROOT_NAME --id JOB_ID.
317
319
  Common: --port PORT, --interval MS, --events nats (optional; reachable NATS is auto-detected), --thread-id ID (reviewer-thread override).
318
320
 
319
321
  Example:
320
- npx agents-relay serve --repo OWNER/REPO --id 101`,
322
+ npx agents-relay serve --repo LOCAL_ROOT_NAME --id 101`,
321
323
  'agent-register': `Register an agent role and its execution endpoint.
322
324
 
323
- Required for durable service mode: --repo OWNER/REPO --id JOB_ID plus --name NAME --responsibility TEXT --role ROLE --endpoint TARGET. Use --file only for explicit demo mode.
325
+ Required for durable service mode: --repo LOCAL_ROOT_NAME --id JOB_ID plus --name NAME --responsibility TEXT --role ROLE --endpoint TARGET. Use --file only for explicit demo mode.
324
326
  Common: --capabilities a,b, --runtime shell|codex|chatgpt, --provider NAME, --model NAME.
325
327
 
326
328
  Example:
327
329
  npx agents-relay agent-register --file .agents-relay.json --name builder --responsibility "Build code" --role engineer --endpoint shell`,
328
- projection: `Inspect and explicitly repair deterministic V2 GitHub projection conflicts.
329
-
330
- Usage:
331
- npx agents-relay projection conflicts --repo OWNER/REPO --id JOB_ID
332
- npx agents-relay projection resolve --repo OWNER/REPO --id JOB_ID --projection-id ID --action requeue|discard-local
333
-
334
- A deterministic same-id/different-definition append conflict is classified once, stops
335
- consuming retry budget, and retains structured diagnostic evidence. It is never
336
- auto-overwritten: an operator resolves it after reconciling the divergent definition.
337
- requeue Re-arm the recorded projection after the divergent side is reconciled
338
- discard-local Drop the blocked local mutation so a fresh one can be enqueued`,
339
330
  'agent-discover': `Find registered agents using hard filters.
340
331
 
341
- Required for durable service mode: --repo OWNER/REPO --id JOB_ID. Use --file only for explicit demo mode.
332
+ Required for durable service mode: --repo LOCAL_ROOT_NAME --id JOB_ID. Use --file only for explicit demo mode.
342
333
  Common: --capabilities a,b, --runtime NAME, --availability available,busy, --task-kind NAME, --explore.
343
334
 
344
335
  Example:
@@ -353,7 +344,5 @@ export function helpText(command, action) {
353
344
  return action ? help[`context ${action}`] ?? help.context : help.context;
354
345
  if (command === 'blocker')
355
346
  return action ? help[`blocker ${action}`] ?? help.blocker : help.blocker;
356
- if (command === 'projection')
357
- return help.projection;
358
347
  return command ? help[command] ?? help.root : help.root;
359
348
  }
@@ -3,9 +3,10 @@ import { openLocalManagedStore } from './local-managed-store.js';
3
3
  import { createJobEntity, createTaskEntity } from './workflow/entity-creation.js';
4
4
  import { parseAgentGraph } from './agent-graph.js';
5
5
  import { taskOverallTimeoutMs } from './types.js';
6
- import { isAbsolute } from 'node:path';
6
+ import { isAbsolute, resolve } from 'node:path';
7
7
  import { normalizeThreadId } from './reviewer-thread.js';
8
8
  import { discoverLocalRelayStoreSnapshots, relayStoreDirectory } from './relay-store.js';
9
+ import { validateProjectRoot } from './workspace.js';
9
10
  /** Create a local SQLite-authoritative Job; external PR metadata is optional compatibility data. */
10
11
  export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAuthors, options) {
11
12
  if (options.id && !/^[1-9][0-9]*$/.test(options.id))
@@ -21,7 +22,11 @@ export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAu
21
22
  throw Error('Coordinator paths must be absolute');
22
23
  }
23
24
  const directory = options.storeDirectory ?? relayStoreDirectory();
25
+ const projectRoot = await validateProjectRoot(resolve(options.projectRoot ?? options.coordinator?.projectRoot ?? process.cwd()), repositoryName);
24
26
  const knownJobs = (await discoverLocalRelayStoreSnapshots(directory)).flatMap(snapshot => snapshot.jobs);
27
+ const identityCollision = knownJobs.find(job => job.repository === repositoryName && job.projectRoot && job.projectRoot !== projectRoot);
28
+ if (identityCollision)
29
+ throw new Error(`Local repository identity collision ${repositoryName}: Job ${identityCollision.id} binds ${identityCollision.projectRoot}, requested ${projectRoot}`);
25
30
  const id = options.id || allocateEntityId(directory, repositoryName, 'job', options.idempotencyKey, new Set(knownJobs.map(job => job.id)));
26
31
  const requestedNumber = options.prNumber ?? 0;
27
32
  if (!Number.isInteger(requestedNumber) || requestedNumber < 0)
@@ -33,17 +38,17 @@ export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAu
33
38
  throw new Error('Duplicate immutable Job ID across SQLite stores: ' + id);
34
39
  if (alreadyKnown.length === 1) {
35
40
  const existing = alreadyKnown[0];
36
- if (existing.repository !== repositoryName || (options.prNumber !== undefined && existing.prNumber !== requestedNumber))
37
- throw new Error('Immutable Job ID is already bound to a different repository or external PR');
41
+ if (existing.repository !== repositoryName || existing.projectRoot !== projectRoot || (options.prNumber !== undefined && existing.prNumber !== requestedNumber))
42
+ throw new Error('Immutable Job ID is already bound to a different local repository, project root, or external PR');
38
43
  if (!options.id && !options.idempotencyKey)
39
44
  throw new Error('Automatically allocated Job ID unexpectedly belongs to an existing Job');
40
- if (options.idempotencyKey && ((options.objective && options.objective !== existing.objective) || (options.projectPath && options.projectPath !== existing.projectPath) || (options.title && options.title !== existing.title)))
45
+ if (options.idempotencyKey && ((options.objective && options.objective !== existing.objective) || (options.title && options.title !== existing.title)))
41
46
  throw new Error('Job idempotency key reused for a different Job definition');
42
47
  if (options.coordinator) {
43
- const task = existing.tasks.find(task => task.id === 'coordinator');
48
+ const task = existing.tasks.find(task => task.title === 'Coordinator' && Boolean(task.agentGraph));
44
49
  if (!task || task.agentGraph !== options.coordinator.graph || task.input !== options.coordinator.input ||
45
50
  task.output?.kind !== 'file' || task.output.path !== options.coordinator.outputPath ||
46
- existing.graphStartContext?.projectPath !== options.coordinator.projectRoot)
51
+ existing.graphStartContext?.projectRoot !== options.coordinator.projectRoot)
47
52
  throw Error('Coordinator idempotency key reused for a different Graph or Run');
48
53
  }
49
54
  return { job: existing, pr: { ...placeholder, number: existing.prNumber } };
@@ -69,7 +74,7 @@ export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAu
69
74
  id,
70
75
  title: options.title || pr.title || 'Agents Relay job',
71
76
  objective: options.objective || pr.body || undefined,
72
- projectPath: options.projectPath,
77
+ projectRoot,
73
78
  description: pr.body || undefined,
74
79
  priority: options.priority ?? 'P2',
75
80
  tag: options.tag,
@@ -91,7 +96,7 @@ export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAu
91
96
  createdAt: now,
92
97
  updatedAt: now,
93
98
  tasks: [],
94
- ...(options.coordinator ? { graphStartContext: { projectPath: options.coordinator.projectRoot,
99
+ ...(options.coordinator ? { graphStartContext: { projectRoot: options.coordinator.projectRoot,
95
100
  workspaceRoot: options.coordinator.workspaceRoot,
96
101
  ...(options.coordinator.sharedRoot ? { sharedRoot: options.coordinator.sharedRoot } : {}),
97
102
  ...(options.coordinator.globalRoot ? { globalRoot: options.coordinator.globalRoot } : {}),
@@ -99,7 +104,8 @@ export async function ensureManagedGitHubJob(_client, repositoryName, _trustedAu
99
104
  });
100
105
  if (options.coordinator) {
101
106
  const c = options.coordinator;
102
- job.tasks.push(createTaskEntity(job, { jobId: id, id: 'coordinator', title: 'Coordinator',
107
+ const coordinatorId = allocateEntityId(directory, repositoryName, 'task', `coordinator:${id}`);
108
+ job.tasks.push(createTaskEntity(job, { jobId: id, id: coordinatorId, title: 'Coordinator',
103
109
  parentTaskId: null, kind: 'work', agentGraph: c.graph, input: c.input,
104
110
  output: { kind: 'file', path: c.outputPath }, adapter: 'codex', capabilities: [],
105
111
  dependencies: [], attempt: 0, maxAttempts: 3, leaseOwner: null, leaseExpiresAt: null,
@@ -5,7 +5,7 @@ import { arg, storeFor } from './cli-support.js';
5
5
  import { resolveExecutionContext } from './execution-context.js';
6
6
  import { buildPlannerExecutionPrompt } from './planner.js';
7
7
  import { managedWorkerInput } from './managed-worker-input.js';
8
- import { resolveManagedProjectPath, resolveRepositoryProjectPath } from './workspace.js';
8
+ import { resolveJobProjectRoot } from './workspace.js';
9
9
  import { taskExecutionContext } from './task-context.js';
10
10
  import { eventsBusHistoryPage } from './events-bus-runtime.js';
11
11
  import { createJobEntity, createTaskEntity } from './workflow/entity-creation.js';
@@ -29,8 +29,8 @@ export async function runPromptCommand(args) {
29
29
  const now = new Date().toISOString();
30
30
  const caseId = scenario.caseId && /^[a-zA-Z0-9_-]+$/.test(scenario.caseId) ? scenario.caseId : 'case';
31
31
  const job = createJobEntity({
32
- id: 'EVAL_ONLY', title: 'Isolated prompt quality evaluation', repository: 'eval/isolated', prNumber: 0,
33
- continuation: null, tasks: [], createdAt: now, updatedAt: now, projectPath,
32
+ id: 'EVAL_ONLY', title: 'Isolated prompt quality evaluation', repository: 'eval/isolated', projectRoot: process.cwd(), prNumber: 0,
33
+ continuation: null, tasks: [], createdAt: now, updatedAt: now,
34
34
  });
35
35
  const task = createTaskEntity(job, {
36
36
  id: `eval-${caseId}`, jobId: 'EVAL_ONLY', title: caseId, agentName: scenario.agentName,
@@ -56,7 +56,9 @@ export async function runPromptCommand(args) {
56
56
  if (!!planId === !!taskId)
57
57
  throw new Error('prompt requires exactly one of --plan-id or --task-id');
58
58
  const { job } = await storeFor(args, true);
59
- const projectPath = arg(args, '--project-path') || resolveRepositoryProjectPath(await resolveManagedProjectPath(job.repository), job.projectPath);
59
+ if (arg(args, '--project-path'))
60
+ throw new Error('Job --project-path is removed; use --project-root on the independent Git repository');
61
+ const projectPath = await resolveJobProjectRoot(job);
60
62
  let prompt;
61
63
  if (planId) {
62
64
  const plan = job.plans?.find(item => item.id === planId);
@@ -110,7 +112,9 @@ export async function runPlanContextCommand(args) {
110
112
  const plan = job.plans?.find(p => p.id === planId);
111
113
  if (!plan || plan.status !== 'PLANNING' || plan.executionId !== executionId)
112
114
  throw new Error(`Stale Plan execution ${planId}/${executionId}; current state ${plan?.status ?? 'not-found'}`);
113
- const projectPath = arg(args, '--project-path') || resolveRepositoryProjectPath(await resolveManagedProjectPath(job.repository), job.projectPath);
115
+ if (arg(args, '--project-path'))
116
+ throw new Error('Job --project-path is removed; use the independent Git repository root');
117
+ const projectPath = await resolveJobProjectRoot(job);
114
118
  const context = await resolveExecutionContext(projectPath, 'planner');
115
119
  const input = { job, tasks: job.tasks, objective: job.objective ?? job.description ?? job.title,
116
120
  previousPlannerTaskId: plan.previousPlanId, planExecution: { planId, executionId },
@@ -1,8 +1,6 @@
1
1
  import { readFile, writeFile } from 'node:fs/promises';
2
- import { InMemoryStore, GitHubStore } from './store.js';
3
- import { githubAuthContext } from './github-auth.js';
2
+ import { InMemoryStore } from './store.js';
4
3
  import { noGitHubMode } from './no-github.js';
5
- import { basename } from 'node:path';
6
4
  import { createJobIdRegistryResolver, findJobIdSnapshot } from './local-job-registry.js';
7
5
  import { relayStoreDirectory } from './relay-store.js';
8
6
  import { normalizeRelayJob } from './relay-job-snapshot-reads.js';
@@ -55,13 +53,22 @@ export async function textOption(args, inlineFlag, fileFlag) {
55
53
  export function integerArg(args, name, fallback) { if (!hasArg(args, name))
56
54
  return fallback; const value = Number(arg(args, name)); if (!Number.isInteger(value) || value < 0)
57
55
  throw new Error(`${name} must be a non-negative integer`); return value; }
58
- export function repository(args) { const value = arg(args, '--repo'); if (!value && noGitHubMode(args))
59
- return 'local/' + basename(process.cwd()); if (!value)
60
- throw new Error('--repo is required for GitHub-backed operation'); return value; }
56
+ export function repository(args) {
57
+ const value = arg(args, '--repo');
58
+ if (!value)
59
+ throw new Error('--repo must name the local Git root directory');
60
+ return value;
61
+ }
62
+ /** Strict for NEW public Jobs; historical store lookups may carry owner/repo metadata. */
63
+ export function newLocalRepository(args) {
64
+ const value = repository(args);
65
+ if (!/^[A-Za-z0-9_.-]+$/.test(value) || value === '.' || value === '..')
66
+ throw new Error('--repo must be a local Git root basename, not a path or remote owner/repo');
67
+ return value;
68
+ }
61
69
  export function pullRequest(args) { const value = Number(arg(args, '--pr')); if (!Number.isInteger(value) || value <= 0)
62
70
  throw new Error('--pr is required for GitHub-backed operation'); return value; }
63
71
  async function localStore(file) { const parsed = JSON.parse(await readFile(file, 'utf8')); const store = new InMemoryStore(parsed); return { store, job: await store.load(parsed.id) }; }
64
- export async function githubStore(args) { const auth = await githubAuthContext(args); return new GitHubStore(auth.client, repository(args), pullRequest(args), auth.trustedAuthors); }
65
72
  /** The public read-only commands must fail closed on ambiguous Job bindings. */
66
73
  function validateReadOnlyJobBinding(args) {
67
74
  for (const flag of ['--id', '--repo', '--pr', '--file', '--store-dir', '--task-id', '--plan-id', '--execution-id']) {
@@ -326,7 +333,7 @@ export async function publishDependentUnblocked(bus, targets, reason) { if (!bus
326
333
  } }
327
334
  export async function requestManagedReconciliation(bus, job) {
328
335
  if (!bus)
329
- throw new Error('Managed GitHub reconciliation requires a reachable NATS event bus (auto-detected when available, or explicit with --events nats)');
336
+ throw new Error('Managed local Job reconciliation requires a reachable NATS event bus (auto-detected when available, or explicit with --events nats)');
330
337
  try {
331
338
  await bus.publish(eventFor(job.id, 'reconcile', null, 'job.wake', 'queued', `Reconcile requested for ${job.id}`, 'orchestrator', { repository: job.repository, prNumber: job.prNumber }));
332
339
  }
@@ -352,3 +359,9 @@ export function rejectRemovedJobOptions(args) {
352
359
  if (obsolete)
353
360
  throw new Error(`Unsupported Job option ${obsolete}: every Job replans to objective satisfaction and scheduling is unavailable`);
354
361
  }
362
+ export function rejectRemoteLifecycleOptions(args) {
363
+ 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'];
364
+ const found = obsolete.find(option => args.some(arg => arg === option || arg.startsWith(option + '=')));
365
+ if (found)
366
+ throw new Error(`Unsupported option ${found}: Jobs use local Git identity and SQLite lifecycle state`);
367
+ }
@@ -3,6 +3,8 @@ import { arg, hasArg, textOption, integerArg, chatGptTabClosePolicy, storySize,
3
3
  import { parseAgentGraph } from './agent-graph.js';
4
4
  import { createTaskEntity } from './workflow/entity-creation.js';
5
5
  import { validateDependencyValidity } from './dependency-validity.js';
6
+ import { allocateEntityId } from './job-task-id-sequence.js';
7
+ import { relayStoreDirectory } from './relay-store.js';
6
8
  export function recoveryDiagnosisFromArgs(args) {
7
9
  const failureKind = arg(args, '--failure-kind');
8
10
  if (!failureKind)
@@ -40,8 +42,8 @@ export async function workerTaskFromArgs(job, args, now) {
40
42
  throw new Error('task create requires --input-file PATH|- or --input MARKDOWN');
41
43
  if (!['codex', 'chatgpt', 'z'].includes(adapter))
42
44
  throw new Error('task create --adapter must be codex, chatgpt, or z; orchestrator is reserved for legacy recovery only');
43
- if (outputKind !== 'task-pr' && outputKind !== 'file')
44
- throw new Error('task create requires --output task-pr|file');
45
+ if (outputKind !== 'local-git' && outputKind !== 'file')
46
+ throw new Error('task create requires --output local-git|file');
45
47
  if (outputKind === 'file' && !outputPath)
46
48
  throw new Error('--output file requires --output-path');
47
49
  if (['--provider', '--profile', '--reasoning', '--cwd', '--chatgpt-project'].some(flag => hasArg(args, flag)) && !model)
@@ -53,9 +55,12 @@ export async function workerTaskFromArgs(job, args, now) {
53
55
  const dependencies = arg(args, '--deps').split(',').filter(Boolean);
54
56
  const dependencyValidity = dependencyValidityFromArgs(args, dependencies);
55
57
  const timeoutMs = hasArg(args, '--timeout') ? integerArg(args, '--timeout', taskOverallTimeoutMs(size, routing?.reasoning)) : routing ? taskOverallTimeoutMs(size, routing.reasoning) : 0;
58
+ if (hasArg(args, '--task-id'))
59
+ throw new Error('Task IDs are allocated by Relay and cannot be supplied');
60
+ const id = allocateEntityId(arg(args, '--store-dir') || relayStoreDirectory(), job.repository, 'task');
56
61
  return createTaskEntity(job, {
57
62
  jobId: job.id,
58
- id: arg(args, '--task-id', 'initial'),
63
+ id,
59
64
  title: arg(args, '--title') || undefined,
60
65
  priority: priority(args, job.priority ?? 'P2'),
61
66
  storySize: size,
@@ -71,6 +76,7 @@ export async function workerTaskFromArgs(job, args, now) {
71
76
  chatgptTabClosePolicy: closePolicy,
72
77
  input: input || 'true',
73
78
  attachments: arg(args, '--attachments').split(',').filter(Boolean),
79
+ // Preserve the historical SQLite output enum while exposing a PR-free CLI spelling.
74
80
  output: outputKind === 'file' ? { kind: 'file', path: outputPath } : { kind: 'task_pr' },
75
81
  routing,
76
82
  continuation: continuation(args),