specdojo 0.3.0 → 0.4.0

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 (245) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +77 -18
  3. package/dist/catalog/build-references.js +144 -0
  4. package/dist/catalog/build-render.js +32 -0
  5. package/dist/{catalog-build.js → catalog/build.js} +18 -295
  6. package/dist/{catalog.js → catalog/catalog.js} +11 -11
  7. package/dist/{catalog-generate.js → catalog/generate.js} +13 -16
  8. package/dist/catalog/paths.js +1 -0
  9. package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +5 -5
  10. package/dist/{catalog-plan.js → catalog/plan.js} +9 -9
  11. package/dist/{catalog-scaffold.js → catalog/scaffold.js} +6 -6
  12. package/dist/{agent.js → commands/agent.js} +11 -11
  13. package/dist/{build-command.js → commands/build.js} +2 -2
  14. package/dist/{init-command.js → commands/init.js} +103 -37
  15. package/dist/{orchestrator.js → commands/orchestrator.js} +2 -2
  16. package/dist/{watch.js → commands/watch.js} +3 -3
  17. package/dist/dashboard/dashboard-timeline.js +175 -0
  18. package/dist/{dashboard.js → dashboard/dashboard.js} +16 -549
  19. package/dist/dashboard/exec-records.js +105 -0
  20. package/dist/dashboard/routines.js +256 -0
  21. package/dist/dashboard/shared.js +14 -0
  22. package/dist/{timeline-build.js → dashboard/timeline-build.js} +2 -1
  23. package/dist/{timeline.js → dashboard/timeline.js} +1 -1
  24. package/dist/{deliverable.js → deliverable/deliverable.js} +5 -5
  25. package/dist/{deliverable-trash.js → deliverable/trash.js} +7 -7
  26. package/dist/{devcontainer-command.js → devcontainer/command.js} +5 -3
  27. package/dist/{devcontainer-scaffold.js → devcontainer/scaffold.js} +94 -2
  28. package/dist/{doc-index.js → docs/doc-index.js} +3 -3
  29. package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +2 -2
  30. package/dist/{index-command.js → docs/index-command.js} +1 -1
  31. package/dist/docs/template-resolution.js +1 -0
  32. package/dist/{viewpoint-document-kinds-check.js → docs/viewpoint-document-kinds-check.js} +3 -3
  33. package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
  34. package/dist/{yaml-pages.js → docs/yaml-pages.js} +5 -5
  35. package/dist/{exec-agent-config.js → exec/agent-config.js} +33 -4
  36. package/dist/{exec-agent-git-state.js → exec/agent-git-state.js} +1 -1
  37. package/dist/{exec-agent-protected-config.js → exec/agent-protected-config.js} +1 -1
  38. package/dist/{exec.js → exec/commands.js} +22 -467
  39. package/dist/exec/core.js +457 -0
  40. package/dist/{exec-events.js → exec/events.js} +2 -2
  41. package/dist/{exec-evidence.js → exec/evidence.js} +11 -6
  42. package/dist/exec/exec.js +2 -0
  43. package/dist/exec/format.js +1 -0
  44. package/dist/{exec-handoff.js → exec/handoff.js} +13 -12
  45. package/dist/{exec-limit.js → exec/limit.js} +93 -12
  46. package/dist/{exec-parent-validation.js → exec/parent-validation.js} +4 -4
  47. package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +16 -2
  48. package/dist/{exec-plans.js → exec/plans-core.js} +97 -468
  49. package/dist/exec/plans-generation.js +249 -0
  50. package/dist/exec/plans-storage.js +131 -0
  51. package/dist/exec/plans.js +3 -0
  52. package/dist/{exec-project.js → exec/project.js} +1 -1
  53. package/dist/{exec-protection-handoff.js → exec/protection-handoff.js} +3 -3
  54. package/dist/{exec-register-resume.js → exec/register-resume.js} +2 -2
  55. package/dist/{exec-register.js → exec/register.js} +92 -9
  56. package/dist/exec/repo-integration-git.js +23 -0
  57. package/dist/exec/repo-integration-sync.js +264 -0
  58. package/dist/{exec-repo-integration.js → exec/repo-integration.js} +13 -287
  59. package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
  60. package/dist/exec/reporter-output.js +206 -0
  61. package/dist/{exec-reporter.js → exec/reporter.js} +29 -216
  62. package/dist/{exec-results.js → exec/results.js} +277 -36
  63. package/dist/exec/run/agent-pipeline.js +276 -0
  64. package/dist/exec/run/agent.js +583 -0
  65. package/dist/exec/run/in-place.js +570 -0
  66. package/dist/exec/run/job.js +746 -0
  67. package/dist/exec/run/lifecycle-commands.js +530 -0
  68. package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
  69. package/dist/exec/run/mode-shared.js +140 -0
  70. package/dist/exec/run/register-command.js +252 -0
  71. package/dist/exec/run/register-core.js +411 -0
  72. package/dist/exec/run/register-mode.js +210 -0
  73. package/dist/exec/run/register-resume.js +398 -0
  74. package/dist/exec/run/register-state.js +325 -0
  75. package/dist/exec/run/register-worktree.js +540 -0
  76. package/dist/exec/run/run.js +11 -0
  77. package/dist/exec/run/schedule-mode.js +294 -0
  78. package/dist/exec/run/schedule-prepare.js +366 -0
  79. package/dist/exec/run/schedule-task.js +599 -0
  80. package/dist/exec/run/shared.js +449 -0
  81. package/dist/{exec-schedule-calendar.js → exec/schedule/calendar.js} +1 -1
  82. package/dist/{exec-schedule-cpm.js → exec/schedule/cpm.js} +2 -2
  83. package/dist/{exec-schedule-gantt-chart-render.js → exec/schedule/gantt-chart-render.js} +2 -2
  84. package/dist/exec/schedule/gantt-chart.js +2 -0
  85. package/dist/{exec-schedule-hash.js → exec/schedule/hash.js} +2 -2
  86. package/dist/exec/schedule/index.js +1 -0
  87. package/dist/{exec-schedule-initial.js → exec/schedule/initial.js} +2 -2
  88. package/dist/{exec-schedule-progress.js → exec/schedule/progress.js} +2 -2
  89. package/dist/{exec-schedule-ready.js → exec/schedule/ready.js} +2 -2
  90. package/dist/{exec-schedule.js → exec/schedule/schedule.js} +11 -11
  91. package/dist/exec/shared.js +63 -0
  92. package/dist/exec/slot-lock.js +1 -0
  93. package/dist/{exec-strategy.js → exec/strategy.js} +2 -2
  94. package/dist/{exec-task-repos.js → exec/task-repos.js} +2 -2
  95. package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
  96. package/dist/{exec-trial.js → exec/trial-commands.js} +23 -388
  97. package/dist/exec/trial-core.js +371 -0
  98. package/dist/exec/trial.js +2 -0
  99. package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
  100. package/dist/exec/worktree-ops-commit.js +672 -0
  101. package/dist/exec/worktree-ops-lifecycle.js +297 -0
  102. package/dist/exec/worktree-ops-merge.js +344 -0
  103. package/dist/exec/worktree-ops.js +3 -0
  104. package/dist/exec/worktree.js +305 -0
  105. package/dist/grade/apply.js +734 -0
  106. package/dist/grade/command-apply.js +250 -0
  107. package/dist/grade/command-inspect.js +138 -0
  108. package/dist/grade/command-plan.js +101 -0
  109. package/dist/grade/command-shared.js +68 -0
  110. package/dist/grade/core.js +307 -0
  111. package/dist/grade/grade.js +19 -0
  112. package/dist/grade/markdown.js +274 -0
  113. package/dist/grade/pipeline-state.js +184 -0
  114. package/dist/grade/plan.js +507 -0
  115. package/dist/{grade-result.js → grade/result.js} +7 -96
  116. package/dist/grade/target-discovery.js +265 -0
  117. package/dist/grade/targets.js +435 -0
  118. package/dist/{job.js → job/definition.js} +32 -574
  119. package/dist/job/job.js +568 -0
  120. package/dist/{kata-command.js → kata/command.js} +4 -4
  121. package/dist/{kata.js → kata/kata.js} +5 -5
  122. package/dist/register/approach.js +134 -0
  123. package/dist/register/command-types.js +1 -0
  124. package/dist/register/core.js +369 -0
  125. package/dist/register/create-commands.js +352 -0
  126. package/dist/{register-date.js → register/date.js} +1 -1
  127. package/dist/register/derivation.js +163 -0
  128. package/dist/{register-event-merge.js → register/event-merge.js} +32 -3
  129. package/dist/{register-events.js → register/events.js} +12 -6
  130. package/dist/{register-history.js → register/history.js} +7 -6
  131. package/dist/{register-item.js → register/item.js} +28 -10
  132. package/dist/register/lifecycle-lock.js +5 -0
  133. package/dist/register/maintenance-commands.js +193 -0
  134. package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
  135. package/dist/register/migration.js +268 -0
  136. package/dist/register/register.js +404 -0
  137. package/dist/register/renumber.js +341 -0
  138. package/dist/register/transition-commands.js +248 -0
  139. package/dist/register/update.js +230 -0
  140. package/dist/register/views.js +296 -0
  141. package/dist/{review-grade.js → review/grade.js} +2 -2
  142. package/dist/{review-plan.js → review/plan.js} +5 -5
  143. package/dist/routine/definition.js +401 -0
  144. package/dist/{routine.js → routine/routine.js} +50 -419
  145. package/dist/{schedule-approach.js → schedule/approach.js} +9 -9
  146. package/dist/{schedule-build.js → schedule/build.js} +7 -4
  147. package/dist/{schedule.js → schedule/schedule.js} +9 -9
  148. package/dist/schedule/strategy-generate-document.js +273 -0
  149. package/dist/schedule/strategy-generate-scope.js +199 -0
  150. package/dist/schedule/strategy-generate.js +348 -0
  151. package/dist/shared/agent-types.js +23 -0
  152. package/dist/shared/artifact-path.js +9 -0
  153. package/dist/{build-if-stale.js → shared/build-if-stale.js} +1 -1
  154. package/dist/shared/catalog-render.js +115 -0
  155. package/dist/{exec-slot-lock.js → shared/cross-process-lock.js} +3 -1
  156. package/dist/shared/fs.js +30 -0
  157. package/dist/shared/git.js +316 -0
  158. package/dist/shared/grade-result.js +94 -0
  159. package/dist/{package-paths.js → shared/package-paths.js} +3 -3
  160. package/dist/shared/plan-templates.js +114 -0
  161. package/dist/{exec-provider-scaffold.js → shared/provider-scaffold.js} +3 -1
  162. package/dist/shared/random.js +4 -0
  163. package/dist/{exec-schedule-index.js → shared/schedule-index.js} +3 -1
  164. package/dist/shared/schedule-paths.js +9 -0
  165. package/dist/{specdojo-config.js → shared/specdojo-config.js} +96 -9
  166. package/dist/{exec-shared.js → shared/text.js} +0 -134
  167. package/dist/shared/time.js +28 -0
  168. package/dist/shared/yaml.js +28 -0
  169. package/dist/specdojo.js +22 -22
  170. package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +29 -17
  171. package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
  172. package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -2
  173. package/docs/ja/specdojo/exec-templates/xer-template.md +1 -3
  174. package/docs/ja/specdojo/exec-templates/xrp-job-template.md +6 -4
  175. package/docs/ja/specdojo/guides/exec-config-guide.md +97 -22
  176. package/docs/ja/specdojo/guides/exec-operation-guide.md +145 -12
  177. package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
  178. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +51 -18
  179. package/docs/ja/specdojo/guides/quick-start-guide.md +81 -16
  180. package/docs/ja/specdojo/guides/register-operation-guide.md +2 -1
  181. package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -1
  182. package/docs/ja/specdojo/guides/review-guide.md +1 -1
  183. package/docs/ja/specdojo/guides/routine-operation-guide.md +6 -6
  184. package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
  185. package/docs/ja/specdojo/references/command-reference.md +52 -28
  186. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +17 -11
  187. package/docs/ja/specdojo/standards/job-definition-standard.md +20 -18
  188. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -2
  189. package/docs/ja/specdojo/templates/pjr-derived-items-template.md +22 -0
  190. package/docs/ja/specdojo/templates/pjr-index-template.md +1 -0
  191. package/docs/specdojo/schemas/v1/agent-members.schema.yaml +29 -2
  192. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +20 -0
  193. package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +23 -0
  194. package/docs/specdojo/schemas/v1/job-run.schema.yaml +2 -2
  195. package/docs/specdojo/schemas/v1/job.schema.yaml +7 -0
  196. package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +26 -0
  197. package/docs/specdojo/schemas/v1/register-events.schema.yaml +3 -0
  198. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +70 -7
  199. package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
  200. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -1
  201. package/package.json +4 -5
  202. package/templates/antigravity/README.md +7 -3
  203. package/templates/antigravity/agent-members-snippet.yaml +108 -12
  204. package/templates/antigravity/exec-defaults-snippet.yaml +10 -13
  205. package/templates/claude/README.md +27 -3
  206. package/templates/claude/agents/claude-executor.md +0 -1
  207. package/templates/claude/agents/claude-reporter.md +2 -1
  208. package/templates/claude/agents/claude-review-executor.md +0 -1
  209. package/templates/codex/README.md +23 -4
  210. package/templates/devcontainer/devcontainer.json +2 -2
  211. package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +69 -0
  212. package/templates/devcontainer/remote-host/ssh-config.sample +16 -0
  213. package/templates/init-agent-members.yaml +75 -25
  214. package/templates/init-exec-defaults.yaml +26 -8
  215. package/templates/opencode/README.md +17 -3
  216. package/templates/opencode/agents/opencode-executor.md +0 -1
  217. package/templates/opencode/agents/opencode-reporter.md +2 -1
  218. package/templates/opencode/agents/opencode-review-executor.md +0 -1
  219. package/dist/exec-run.js +0 -6182
  220. package/dist/exec-schedule-gantt-chart.js +0 -2
  221. package/dist/exec-worktree-ops.js +0 -1292
  222. package/dist/exec-worktree.js +0 -446
  223. package/dist/grade.js +0 -3193
  224. package/dist/register.js +0 -2407
  225. package/dist/schedule-strategy-generate.js +0 -812
  226. package/templates/claude/agents/claude-expert-review-executor.md +0 -14
  227. /package/dist/{catalog-plan-prompt.js → catalog/plan-prompt.js} +0 -0
  228. /package/dist/{catalog-types.js → catalog/types.js} +0 -0
  229. /package/dist/{template-frontmatter.js → docs/template-frontmatter.js} +0 -0
  230. /package/dist/{role-types.js → exec/role-types.js} +0 -0
  231. /package/dist/{exec-schedule-gantt-chart-scope.js → exec/schedule/gantt-chart-scope.js} +0 -0
  232. /package/dist/{exec-types.js → exec/types.js} +0 -0
  233. /package/dist/{review-types.js → review/types.js} +0 -0
  234. /package/dist/{schedule-phase-sets.js → schedule/phase-sets.js} +0 -0
  235. /package/dist/{schedule-strategy-profiles.js → schedule/strategy-profiles.js} +0 -0
  236. /package/dist/{agent-response.js → shared/agent-response.js} +0 -0
  237. /package/dist/{catalog-paths.js → shared/catalog-paths.js} +0 -0
  238. /package/dist/{dist-freshness.js → shared/dist-freshness.js} +0 -0
  239. /package/dist/{git-environment.js → shared/git-environment.js} +0 -0
  240. /package/dist/{exec-format.js → shared/markdown-format.js} +0 -0
  241. /package/dist/{practice-id.js → shared/practice-id.js} +0 -0
  242. /package/dist/{spawn-self.js → shared/spawn-self.js} +0 -0
  243. /package/dist/{specdojo-gitignore.js → shared/specdojo-gitignore.js} +0 -0
  244. /package/dist/{template-resolution.js → shared/template-resolution.js} +0 -0
  245. /package/dist/{yaml-schema-modeline.js → shared/yaml-schema-modeline.js} +0 -0
@@ -0,0 +1,599 @@
1
+ import { relative, resolve, sep } from "node:path";
2
+ import { limitEventMeta } from "../limit.js";
3
+ import { readResultFrontmatterSnapshot, renderReporterResult, updateResultStatus, } from "../results.js";
4
+ import { gitOutput } from "../worktree.js";
5
+ import { withProductRepoPrompt } from "../task-repos.js";
6
+ import { commitTargetPaths, commitWorktreeChanges, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, releaseRootWorkingCopies, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "../worktree-ops.js";
7
+ import { commitProductWorktrees, integrateTaskRepositories, projectMergeBlockers, PROJECT_REPO_NAME, RepoIntegrationError, } from "../repo-integration.js";
8
+ import { recordExecutorEvidence, recordReporterFailureOutput, writeExecutorEvidence, } from "../evidence.js";
9
+ import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
10
+ import { createPipelineState, loadPipelineResumeCheckpoint, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
11
+ import { agentEnvironment, appendParentValidationsToExecutorEvidence, buildExecutorPrompt, extractBlockReason, pathInsideWorktree, resumedTargetCoverageFailure, runWithRetry, } from "./agent.js";
12
+ import { refreshParentValidationsForReporterResume } from "./agent-pipeline.js";
13
+ import { downgradeUnfilledResult, readCompletionPreflight, } from "./schedule-prepare.js";
14
+ import { commitSubject, integrateLogPath, pipelineRecoveryMeta, recordIntegrateStage, recordRepoIntegration, repoRelativePath, spawnBlock, spawnComplete, } from "./mode-shared.js";
15
+ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
16
+ if (dryRun)
17
+ return "success";
18
+ const worktreeResultPath = prepared.resultPath
19
+ ? pathInsideWorktree(repoRoot, prepared.worktree.path, prepared.resultPath)
20
+ : undefined;
21
+ // A resumed worktree may legitimately contain runner-owned blocked lifecycle fields that differ
22
+ // from the root checkpoint. Use the actual pre-run result for this attempt's exact comparison,
23
+ // while retaining the root scaffold below to reject changes to immutable fields across attempts.
24
+ const attemptResultScaffold = worktreeResultPath
25
+ ? readResultFrontmatterSnapshot(worktreeResultPath)
26
+ : undefined;
27
+ process.stdout.write(` CWD: ${prepared.worktree.path}\n`);
28
+ let result = "success";
29
+ let stderr = "";
30
+ let exitCode = 0;
31
+ let stdout = "";
32
+ let attempts = 0;
33
+ let limit;
34
+ let executorEvidenceRef;
35
+ let executorEvidencePath;
36
+ let executorEvidence;
37
+ let pipelineFailureStage = "executor";
38
+ let pipelineBlockReason;
39
+ let reporterLimit;
40
+ let reporterAttempts = 0;
41
+ let reporterActor = prepared.reporterCandidates?.[0]?.actor;
42
+ const reporterRateLimitEvents = [];
43
+ let pipelineState;
44
+ let pipelineStatePath;
45
+ let pipelineStateRef;
46
+ let resumeReporter = false;
47
+ let resumeIntegration = false;
48
+ if (!prepared.pipelineRunId) {
49
+ process.stdout.write(` Running: ${prepared.agentCandidates[0]?.command ?? ""}\n`);
50
+ const outcome = await runWithRetry(prepared.agentCandidates, withProductRepoPrompt(prepared.prompt, prepared.worktree.repos), execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.executorRateLimitOptions);
51
+ result = outcome.result;
52
+ stderr = outcome.stderr;
53
+ exitCode = outcome.exitCode;
54
+ stdout = outcome.stdout;
55
+ attempts = outcome.attempts;
56
+ limit = outcome.limit;
57
+ prepared.actor = outcome.actor ?? prepared.actor;
58
+ }
59
+ if (prepared.pipelineRunId && prepared.pipelineStateRef) {
60
+ const checkpoint = loadPipelineResumeCheckpoint({
61
+ worktreePath: prepared.worktree.path,
62
+ stateRef: prepared.pipelineStateRef,
63
+ taskId: prepared.task.id,
64
+ });
65
+ if (checkpoint) {
66
+ pipelineState = checkpoint.state;
67
+ pipelineStatePath = checkpoint.statePath;
68
+ pipelineStateRef = prepared.pipelineStateRef;
69
+ if (prepared.pipelineResumeStage === "integrate") {
70
+ if (checkpoint.state.stages.executor.status !== "succeeded" ||
71
+ checkpoint.state.stages.reporter.status !== "succeeded") {
72
+ throw new Error(`integration resume requires succeeded executor and reporter stages for ${prepared.task.id}`);
73
+ }
74
+ executorEvidenceRef = checkpoint.state.stages.executor.artifact_ref ?? undefined;
75
+ resumeIntegration = true;
76
+ process.stdout.write(` Resuming runner-owned integration from pipeline state: ${prepared.pipelineStateRef}\n`);
77
+ }
78
+ else if (prepared.pipelineResumeStage === "reporter" &&
79
+ checkpoint.evidence &&
80
+ checkpoint.state.stages.executor.artifact_ref) {
81
+ executorEvidence = checkpoint.evidence;
82
+ executorEvidenceRef = checkpoint.state.stages.executor.artifact_ref;
83
+ executorEvidencePath = resolve(prepared.worktree.path, executorEvidenceRef);
84
+ resumeReporter = true;
85
+ process.stdout.write(` Resuming reporter from persisted executor evidence: ${executorEvidenceRef}\n`);
86
+ executorEvidence = await refreshParentValidationsForReporterResume({
87
+ execDefaults,
88
+ cwd: prepared.worktree.path,
89
+ productWorktrees: prepared.worktree.repos,
90
+ evidence: executorEvidence,
91
+ evidencePath: executorEvidencePath,
92
+ });
93
+ }
94
+ else if (prepared.pipelineResumeStage === "reporter") {
95
+ process.stdout.write(" Persisted executor evidence is invalid; starting a new executor run.\n");
96
+ pipelineState = undefined;
97
+ pipelineStatePath = undefined;
98
+ pipelineStateRef = undefined;
99
+ }
100
+ }
101
+ }
102
+ if (prepared.pipelineResumeStage === "integrate" && !resumeIntegration) {
103
+ throw new Error(`pipeline state is missing or invalid for integration resume: ${prepared.task.id}`);
104
+ }
105
+ if (prepared.pipelineRunId && !pipelineState) {
106
+ const now = new Date().toISOString();
107
+ const location = pipelineStateLocation({
108
+ repoRoot,
109
+ worktreePath: prepared.worktree.path,
110
+ executionPath,
111
+ taskId: prepared.task.id,
112
+ runId: prepared.pipelineRunId,
113
+ });
114
+ pipelineState = createPipelineState({
115
+ taskId: prepared.task.id,
116
+ runId: prepared.pipelineRunId,
117
+ updatedAt: now,
118
+ executorActor: prepared.agentCandidates[0]?.actor ?? prepared.actor,
119
+ reporterActor: prepared.reporterCandidates?.[0]?.actor,
120
+ });
121
+ pipelineStatePath = location.path;
122
+ pipelineStateRef = location.ref;
123
+ writePipelineState(pipelineStatePath, pipelineState);
124
+ }
125
+ if (prepared.pipelineRunId &&
126
+ !resumeReporter &&
127
+ !resumeIntegration &&
128
+ pipelineState &&
129
+ pipelineStatePath) {
130
+ const executorStartedAt = new Date().toISOString();
131
+ pipelineState = updatePipelineStage(pipelineState, "executor", {
132
+ status: "running",
133
+ actor: prepared.agentCandidates[0]?.actor ?? prepared.actor,
134
+ started_at: executorStartedAt,
135
+ completed_at: null,
136
+ }, executorStartedAt);
137
+ writePipelineState(pipelineStatePath, pipelineState);
138
+ process.stdout.write(` Running executor: ${prepared.agentCandidates[0]?.command ?? ""}\n`);
139
+ const executorPrompt = prepared.pipelineResumeStage === "executor"
140
+ ? buildExecutorPrompt(prepared.plan, execDefaults.pipeline?.parent_validations, {
141
+ resumed: true,
142
+ existingChanges: worktreeStatusPaths(prepared.worktree.path),
143
+ })
144
+ : prepared.prompt;
145
+ const executorOutcome = await runWithRetry(prepared.agentCandidates, withProductRepoPrompt(executorPrompt, prepared.worktree.repos), execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.executorRateLimitOptions);
146
+ result = executorOutcome.result;
147
+ stderr = executorOutcome.stderr;
148
+ exitCode = executorOutcome.exitCode;
149
+ stdout = executorOutcome.stdout;
150
+ attempts = executorOutcome.attempts;
151
+ limit = executorOutcome.limit;
152
+ prepared.actor = executorOutcome.actor ?? prepared.actor;
153
+ const recorded = recordExecutorEvidence({
154
+ repoRoot,
155
+ worktreePath: prepared.worktree.path,
156
+ executionPath,
157
+ taskId: prepared.task.id,
158
+ runId: pipelineState.run_id,
159
+ actor: executorOutcome.actor ?? prepared.actor,
160
+ status: result === "success" ? "succeeded" : result === "rate_limit" ? "rate_limited" : "failed",
161
+ startedAt: executorStartedAt,
162
+ completedAt: new Date().toISOString(),
163
+ exitCode,
164
+ attempts,
165
+ stdout,
166
+ stderr,
167
+ productWorktrees: prepared.worktree.repos,
168
+ rateLimitEvents: executorOutcome.rateLimitEvents,
169
+ });
170
+ executorEvidenceRef = relative(prepared.worktree.path, recorded.evidencePath)
171
+ .split(sep)
172
+ .join("/");
173
+ executorEvidencePath = recorded.evidencePath;
174
+ executorEvidence = recorded.evidence;
175
+ const coverageFailure = result === "success"
176
+ ? resumedTargetCoverageFailure({
177
+ resumed: prepared.pipelineResumeStage === "executor",
178
+ plan: prepared.plan,
179
+ evidence: executorEvidence,
180
+ evidencePath: executorEvidencePath,
181
+ })
182
+ : undefined;
183
+ if (result === "success" && coverageFailure) {
184
+ result = "failure";
185
+ stderr = coverageFailure;
186
+ pipelineBlockReason = coverageFailure;
187
+ }
188
+ const executorCompletedAt = new Date().toISOString();
189
+ pipelineState = updatePipelineStage(pipelineState, "executor", {
190
+ status: result === "success"
191
+ ? "succeeded"
192
+ : executorOutcome.protectionBlock
193
+ ? "blocked"
194
+ : result === "rate_limit"
195
+ ? "rate_limited"
196
+ : "failed",
197
+ attempts: pipelineState.stages.executor.attempts + attempts,
198
+ actor: executorOutcome.actor ?? prepared.actor,
199
+ completed_at: executorCompletedAt,
200
+ artifact_ref: executorEvidenceRef,
201
+ ...(executorOutcome.rateLimitEvents.length > 0
202
+ ? { rate_limit_events: executorOutcome.rateLimitEvents }
203
+ : {}),
204
+ }, executorCompletedAt);
205
+ writePipelineState(pipelineStatePath, pipelineState);
206
+ process.stdout.write(` Executor evidence: ${executorEvidenceRef}\n`);
207
+ if (result === "success") {
208
+ executorEvidence = await appendParentValidationsToExecutorEvidence({
209
+ execDefaults,
210
+ cwd: prepared.worktree.path,
211
+ productWorktrees: prepared.worktree.repos,
212
+ evidence: executorEvidence,
213
+ evidencePath: executorEvidencePath,
214
+ });
215
+ }
216
+ }
217
+ if (prepared.pipelineRunId && result === "success" && !resumeIntegration) {
218
+ pipelineFailureStage = "reporter";
219
+ if (!executorEvidence ||
220
+ !worktreeResultPath ||
221
+ !prepared.reporterCandidates?.length ||
222
+ !pipelineState ||
223
+ !pipelineStatePath) {
224
+ result = "failure";
225
+ pipelineBlockReason = "reporter stage could not start because its managed inputs are missing";
226
+ stderr = pipelineBlockReason;
227
+ }
228
+ else {
229
+ const reporterEvidence = evidenceForReporter(executorEvidence, {
230
+ repoRoot,
231
+ worktreePath: prepared.worktree.path,
232
+ executionPath,
233
+ resultPath: worktreeResultPath,
234
+ });
235
+ const reporterStartedAt = new Date().toISOString();
236
+ pipelineState = updatePipelineStage(pipelineState, "reporter", {
237
+ status: "running",
238
+ actor: prepared.reporterCandidates[0].actor ?? null,
239
+ started_at: reporterStartedAt,
240
+ completed_at: null,
241
+ }, reporterStartedAt);
242
+ writePipelineState(pipelineStatePath, pipelineState);
243
+ process.stdout.write(` Running reporter: ${prepared.reporterCandidates[0].command}\n`);
244
+ const reporter = await runReporterWithFormatRetry({
245
+ plan: prepared.plan,
246
+ evidence: reporterEvidence,
247
+ mode: prepared.task.mode ?? "edit",
248
+ invoke: async (reporterPrompt) => {
249
+ const outcome = await runWithRetry(prepared.reporterCandidates ?? [], reporterPrompt, execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.reporterRateLimitOptions);
250
+ reporterAttempts += outcome.attempts;
251
+ reporterActor = outcome.actor ?? reporterActor;
252
+ reporterRateLimitEvents.push(...outcome.rateLimitEvents);
253
+ if (outcome.limit)
254
+ reporterLimit = outcome.limit;
255
+ return { result: outcome.result, stdout: outcome.stdout, stderr: outcome.stderr };
256
+ },
257
+ });
258
+ if (reporterRateLimitEvents.length > 0 && executorEvidence && executorEvidencePath) {
259
+ executorEvidence.rate_limit_events = [
260
+ ...(executorEvidence.rate_limit_events ?? []),
261
+ ...reporterRateLimitEvents,
262
+ ];
263
+ reporterEvidence.rate_limit_events = executorEvidence.rate_limit_events;
264
+ writeExecutorEvidence(executorEvidencePath, executorEvidence);
265
+ }
266
+ if (reporter.result === "success") {
267
+ try {
268
+ await renderReporterResult(worktreeResultPath, reporter.output, reporterEvidence);
269
+ const facts = deriveReporterFacts(reporterEvidence, {
270
+ mode: prepared.task.mode ?? "edit",
271
+ });
272
+ result = facts.outcome === "complete" ? "success" : "failure";
273
+ pipelineBlockReason = facts.block_reason || undefined;
274
+ if (pipelineBlockReason)
275
+ stderr = pipelineBlockReason;
276
+ process.stdout.write(` Reporter complete: ${reporterActor ?? "reporter"} (format attempts: ${reporter.formatAttempts})\n`);
277
+ if (result === "success") {
278
+ const reporterCompletedAt = new Date().toISOString();
279
+ pipelineState = updatePipelineStage(pipelineState, "reporter", {
280
+ status: "succeeded",
281
+ attempts: pipelineState.stages.reporter.attempts + reporterAttempts,
282
+ actor: reporterActor ?? null,
283
+ completed_at: reporterCompletedAt,
284
+ artifact_ref: relative(prepared.worktree.path, worktreeResultPath)
285
+ .split(sep)
286
+ .join("/"),
287
+ ...(reporterRateLimitEvents.length > 0
288
+ ? { rate_limit_events: reporterRateLimitEvents }
289
+ : {}),
290
+ }, reporterCompletedAt);
291
+ writePipelineState(pipelineStatePath, pipelineState);
292
+ }
293
+ }
294
+ catch (error) {
295
+ result = "failure";
296
+ pipelineBlockReason =
297
+ error instanceof Error
298
+ ? `reporter result rendering failed: ${error.message}`
299
+ : String(error);
300
+ stderr = pipelineBlockReason;
301
+ }
302
+ }
303
+ else {
304
+ result = reporter.result;
305
+ pipelineBlockReason = reporter.reason;
306
+ stderr = reporter.reason;
307
+ if (executorEvidencePath) {
308
+ executorEvidence = recordReporterFailureOutput({
309
+ worktreePath: prepared.worktree.path,
310
+ evidencePath: executorEvidencePath,
311
+ evidence: executorEvidence,
312
+ invocationOutputs: reporter.invocationOutputs,
313
+ });
314
+ }
315
+ }
316
+ if (result !== "success") {
317
+ const reporterCompletedAt = new Date().toISOString();
318
+ pipelineState = updatePipelineStage(pipelineState, "reporter", {
319
+ status: result === "rate_limit" ? "rate_limited" : "failed",
320
+ attempts: pipelineState.stages.reporter.attempts + reporterAttempts,
321
+ actor: reporterActor ?? null,
322
+ completed_at: reporterCompletedAt,
323
+ artifact_ref: reporter.result === "success"
324
+ ? relative(prepared.worktree.path, worktreeResultPath).split(sep).join("/")
325
+ : pipelineState.stages.reporter.artifact_ref,
326
+ ...(reporterRateLimitEvents.length > 0
327
+ ? { rate_limit_events: reporterRateLimitEvents }
328
+ : {}),
329
+ }, reporterCompletedAt);
330
+ writePipelineState(pipelineStatePath, pipelineState);
331
+ }
332
+ }
333
+ }
334
+ const finalize = async () => {
335
+ const completedAt = new Date().toISOString();
336
+ const context = {
337
+ repoRoot,
338
+ schedulePath,
339
+ executionPath,
340
+ ...(catalogPath ? { catalogPath } : {}),
341
+ };
342
+ const downgraded = downgradeUnfilledResult(result, worktreeResultPath, prepared.task.mode ?? "edit", attemptResultScaffold, prepared.resultScaffold);
343
+ const effectiveResult = downgraded.result;
344
+ const unfilledBlock = downgraded.unfilledBlock;
345
+ if (effectiveResult === "success") {
346
+ // Validate the same state/actor constraints as `exec complete` before touching Git. In
347
+ // particular, resume --by may run a different agent from the one that owns the claim; if we
348
+ // merged first, the subsequent complete command would reject that actor and leave schedule
349
+ // state at doing even though the deliverables had already landed and the worktree was gone.
350
+ const completionPreflight = readCompletionPreflight(schedulePath, prepared.task.id, prepared.actor);
351
+ if (!completionPreflight.ok) {
352
+ const reason = `completion preflight failed: ${completionPreflight.reason ?? "unknown reason"}`;
353
+ process.stderr.write(`${reason}\n`);
354
+ process.stdout.write(` Blocked before integration: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
355
+ return "failure";
356
+ }
357
+ // A previous attempt may have merged successfully and failed only while removing the
358
+ // worktree. In that case the branch is already contained in HEAD: do not create another
359
+ // commit or merge. Discard only runner-owned lifecycle diffs left by the failure handler,
360
+ // then continue with removal and completion.
361
+ const alreadyMerged = resumeIntegration &&
362
+ isExecBranchMergedIntoCurrent({ context, worktree: prepared.worktree });
363
+ try {
364
+ if (alreadyMerged) {
365
+ const lifecyclePaths = new Set([worktreeResultPath, pipelineStatePath]
366
+ .filter((path) => !!path)
367
+ .map((path) => relative(prepared.worktree.path, path).split(sep).join("/")));
368
+ const dirtyTargets = commitTargetPaths(context, prepared.worktree, prepared.task.id);
369
+ const unexpected = dirtyTargets.filter((path) => !lifecyclePaths.has(path));
370
+ if (unexpected.length > 0) {
371
+ throw new Error(`already-merged worktree has new task changes: ${unexpected.join(", ")}`);
372
+ }
373
+ if (dirtyTargets.length > 0) {
374
+ gitOutput(prepared.worktree.path, [
375
+ "restore",
376
+ "--source=HEAD",
377
+ "--staged",
378
+ "--worktree",
379
+ "--",
380
+ ...dirtyTargets,
381
+ ]);
382
+ }
383
+ // The merged versions are already at root HEAD; drop the root's stale working copies
384
+ // of the checkpoint files so they do not linger as reverse diffs.
385
+ releaseRootWorkingCopies(repoRoot, (prepared.checkpointPaths ?? []).map((path) => repoRelativePath(repoRoot, path)));
386
+ process.stdout.write(` [integrate] already merged: ${prepared.worktree.branch} (skipping commit and merge)\n`);
387
+ }
388
+ else {
389
+ // Record completion and integration start before the first commit. The succeeded state
390
+ // is committed on the project exec branch before its merge, so successful runs retain a
391
+ // durable integrate checkpoint after all worktrees are removed.
392
+ if (worktreeResultPath)
393
+ await updateResultStatus(worktreeResultPath, "complete", completedAt);
394
+ const integrateStartedAt = new Date().toISOString();
395
+ recordIntegrateStage(pipelineStatePath, integrateStartedAt, (current) => ({
396
+ status: "running",
397
+ actor: prepared.actor,
398
+ attempts: (current?.attempts ?? 0) + 1,
399
+ started_at: integrateStartedAt,
400
+ completed_at: null,
401
+ }));
402
+ const mergeMessage = commitSubject(`exec(${prepared.task.id}): `, prepared.task.name?.trim() || "apply task changes");
403
+ const productNames = (prepared.worktree.repos ?? []).map((product) => product.name);
404
+ try {
405
+ const productOutcomes = commitProductWorktrees({
406
+ worktree: prepared.worktree,
407
+ message: mergeMessage,
408
+ targets: taskTargetsAtHead(context, prepared.worktree, prepared.task.id),
409
+ scopeLogPath: integrateLogPath(pipelineStatePath),
410
+ failureLogPath: integrateLogPath(pipelineStatePath),
411
+ resultPath: worktreeResultPath,
412
+ });
413
+ const productRootNewFiles = productOutcomes.flatMap((outcome) => outcome.rootNewFiles.map((path) => `${outcome.repo}:${path}`));
414
+ commitWorktreeChanges({
415
+ context,
416
+ worktree: prepared.worktree,
417
+ taskId: prepared.task.id,
418
+ scopeLogPath: integrateLogPath(pipelineStatePath),
419
+ failureLogPath: integrateLogPath(pipelineStatePath),
420
+ productsIntegratedByCaller: true,
421
+ productRootNewFiles,
422
+ });
423
+ }
424
+ catch (error) {
425
+ const message = error instanceof Error ? error.message : String(error);
426
+ const repo = productNames.find((name) => message.startsWith(`${name}:`)) ?? PROJECT_REPO_NAME;
427
+ recordRepoIntegration(pipelineStatePath, repo, {
428
+ status: "failed",
429
+ error: message,
430
+ });
431
+ throw new RepoIntegrationError({
432
+ repo,
433
+ cause: message,
434
+ integrated: [],
435
+ pending: [...productNames, PROJECT_REPO_NAME],
436
+ });
437
+ }
438
+ integrateTaskRepositories({
439
+ worktree: prepared.worktree,
440
+ mergeMessage,
441
+ checkProject: () => projectMergeBlockers({
442
+ context,
443
+ worktree: prepared.worktree,
444
+ taskId: prepared.task.id,
445
+ releasePaths: prepared.checkpointPaths,
446
+ }),
447
+ beforeProjectMerge: () => {
448
+ if (!pipelineStatePath)
449
+ return;
450
+ const integrateCompletedAt = new Date().toISOString();
451
+ recordIntegrateStage(pipelineStatePath, integrateCompletedAt, () => ({
452
+ status: "succeeded",
453
+ completed_at: integrateCompletedAt,
454
+ }));
455
+ commitWorktreeChanges({
456
+ context,
457
+ worktree: prepared.worktree,
458
+ taskId: prepared.task.id,
459
+ failureLogPath: integrateLogPath(pipelineStatePath),
460
+ productsIntegratedByCaller: true,
461
+ });
462
+ },
463
+ mergeProject: () => mergeWorktreeIntoCurrent({
464
+ context,
465
+ worktree: prepared.worktree,
466
+ taskId: prepared.task.id,
467
+ message: mergeMessage,
468
+ releaseRootPaths: prepared.checkpointPaths,
469
+ failureLogPath: integrateLogPath(pipelineStatePath),
470
+ }),
471
+ record: (repo, patch) => recordRepoIntegration(pipelineStatePath, repo, patch),
472
+ failureLogPath: integrateLogPath(pipelineStatePath),
473
+ lockPath: schedulePath,
474
+ });
475
+ }
476
+ removeWorktree({
477
+ context,
478
+ worktree: prepared.worktree,
479
+ taskId: prepared.task.id,
480
+ deleteBranch: true,
481
+ });
482
+ }
483
+ catch (error) {
484
+ if (error instanceof WorktreeRemovedBranchDeletionError) {
485
+ // The task changes are already merged and the worktree is gone. Keep task completion
486
+ // independent from branch housekeeping, but make the residue and recovery command clear.
487
+ process.stderr.write(`Warning: ${error.message}; run exec worktree prune.\n`);
488
+ }
489
+ else {
490
+ const reason = error instanceof Error ? error.message : String(error);
491
+ const integrateFailedAt = new Date().toISOString();
492
+ recordIntegrateStage(pipelineStatePath, integrateFailedAt, () => ({
493
+ status: "failed",
494
+ completed_at: integrateFailedAt,
495
+ }));
496
+ if (worktreeResultPath)
497
+ await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
498
+ spawnBlock(projectId, prepared.task.id, prepared.actor, reason, pipelineStateRef
499
+ ? pipelineRecoveryMeta({
500
+ stage: "integrate",
501
+ evidenceRef: executorEvidenceRef,
502
+ stateRef: pipelineStateRef,
503
+ runId: pipelineState?.run_id ?? prepared.pipelineRunId,
504
+ })
505
+ : { limit_deferred: "false" });
506
+ process.stderr.write(`${reason}\n`);
507
+ process.stdout.write(` Blocked: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
508
+ return "failure";
509
+ }
510
+ }
511
+ spawnComplete(projectId, prepared.task.id, prepared.actor);
512
+ process.stdout.write(` Done: ${prepared.task.id}\n`);
513
+ }
514
+ else if (effectiveResult === "rate_limit") {
515
+ // Keep the worktree for the due-time resume path; do not merge partial changes.
516
+ const activeLimit = pipelineFailureStage === "reporter" ? reporterLimit : limit;
517
+ const activeAttempts = pipelineFailureStage === "reporter" ? reporterAttempts : attempts;
518
+ const totalAttempts = (prepared.priorLimitAttempts ?? 0) + activeAttempts;
519
+ const reason = activeLimit
520
+ ? `${activeLimit.kind} reached${activeLimit.resume_at ? `; resume_at=${activeLimit.resume_at}` : ""}`
521
+ : (pipelineBlockReason ?? "rate limit reached");
522
+ if (worktreeResultPath)
523
+ await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
524
+ spawnBlock(projectId, prepared.task.id, prepared.actor, reason, activeLimit
525
+ ? {
526
+ ...limitEventMeta(activeLimit, {
527
+ attempts: totalAttempts,
528
+ worktree: prepared.worktree.path,
529
+ }),
530
+ ...(prepared.pipelineRunId
531
+ ? pipelineRecoveryMeta({
532
+ stage: pipelineFailureStage,
533
+ evidenceRef: executorEvidenceRef,
534
+ stateRef: pipelineStateRef,
535
+ runId: pipelineState?.run_id ?? prepared.pipelineRunId,
536
+ })
537
+ : {}),
538
+ }
539
+ : {
540
+ limit_deferred: "false",
541
+ ...(prepared.pipelineRunId
542
+ ? pipelineRecoveryMeta({
543
+ stage: pipelineFailureStage,
544
+ evidenceRef: executorEvidenceRef,
545
+ stateRef: pipelineStateRef,
546
+ runId: pipelineState?.run_id ?? prepared.pipelineRunId,
547
+ })
548
+ : {}),
549
+ });
550
+ process.stdout.write(activeLimit?.auto_resume
551
+ ? ` Deferred: ${prepared.task.id} until ${activeLimit.resume_at} (worktree kept: ${prepared.worktree.path})\n`
552
+ : ` Rate limited: ${prepared.task.id}; automatic resume unavailable (worktree kept: ${prepared.worktree.path})\n`);
553
+ }
554
+ else {
555
+ const blockReason = unfilledBlock
556
+ ? "agent exited 0 but result is incomplete or its frontmatter differs from the scaffold (treated as blocked)"
557
+ : (pipelineBlockReason ?? extractBlockReason(stderr));
558
+ if (worktreeResultPath)
559
+ await updateResultStatus(worktreeResultPath, "blocked", completedAt, blockReason);
560
+ spawnBlock(projectId, prepared.task.id, prepared.actor, blockReason, {
561
+ limit_deferred: "false",
562
+ ...(prepared.pipelineRunId
563
+ ? pipelineRecoveryMeta({
564
+ stage: pipelineFailureStage,
565
+ evidenceRef: executorEvidenceRef,
566
+ stateRef: pipelineStateRef,
567
+ runId: pipelineState?.run_id ?? prepared.pipelineRunId,
568
+ })
569
+ : {}),
570
+ });
571
+ process.stdout.write(` ${unfilledBlock ? "Blocked (result incomplete or frontmatter changed)" : "Failed"}: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
572
+ }
573
+ return effectiveResult;
574
+ };
575
+ return lifecycleLock ? lifecycleLock.runExclusive(finalize) : finalize();
576
+ }
577
+ export async function runPreparedTaskSafely(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
578
+ try {
579
+ const result = await runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock);
580
+ return { prepared, result };
581
+ }
582
+ catch (error) {
583
+ const message = error instanceof Error ? error.message : String(error);
584
+ process.stderr.write(`[run] error: ${prepared.worktree.name}: ${message}\n`);
585
+ const block = async () => {
586
+ if (!dryRun) {
587
+ const completedAt = new Date().toISOString();
588
+ if (prepared.resultPath)
589
+ await updateResultStatus(prepared.resultPath, "blocked", completedAt);
590
+ spawnBlock(projectId, prepared.task.id, prepared.actor, `runner error: ${message}`);
591
+ }
592
+ };
593
+ if (lifecycleLock)
594
+ await lifecycleLock.runExclusive(block);
595
+ else
596
+ await block();
597
+ return { prepared, result: "failure" };
598
+ }
599
+ }