specdojo 0.3.1 → 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.
- package/CHANGELOG.md +47 -0
- package/README.md +77 -18
- package/dist/{catalog-build-references.js → catalog/build-references.js} +4 -4
- package/dist/catalog/build-render.js +32 -0
- package/dist/{catalog-build.js → catalog/build.js} +9 -9
- package/dist/{catalog.js → catalog/catalog.js} +10 -10
- package/dist/{catalog-generate.js → catalog/generate.js} +8 -8
- package/dist/catalog/paths.js +1 -0
- package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +4 -4
- package/dist/{catalog-plan.js → catalog/plan.js} +4 -4
- package/dist/{catalog-scaffold.js → catalog/scaffold.js} +3 -3
- package/dist/{agent.js → commands/agent.js} +11 -11
- package/dist/{build-command.js → commands/build.js} +2 -2
- package/dist/{init-command.js → commands/init.js} +98 -32
- package/dist/{orchestrator.js → commands/orchestrator.js} +2 -2
- package/dist/{watch.js → commands/watch.js} +3 -3
- package/dist/{dashboard-timeline.js → dashboard/dashboard-timeline.js} +2 -2
- package/dist/{dashboard.js → dashboard/dashboard.js} +11 -10
- package/dist/{dashboard-exec-records.js → dashboard/exec-records.js} +2 -2
- package/dist/{dashboard-routines.js → dashboard/routines.js} +6 -5
- package/dist/{dashboard-shared.js → dashboard/shared.js} +1 -1
- package/dist/{timeline-build.js → dashboard/timeline-build.js} +2 -1
- package/dist/{timeline.js → dashboard/timeline.js} +1 -1
- package/dist/{deliverable.js → deliverable/deliverable.js} +5 -5
- package/dist/{deliverable-trash.js → deliverable/trash.js} +5 -5
- package/dist/{devcontainer-command.js → devcontainer/command.js} +5 -3
- package/dist/{devcontainer-scaffold.js → devcontainer/scaffold.js} +94 -2
- package/dist/{doc-index.js → docs/doc-index.js} +1 -1
- package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +1 -1
- package/dist/{index-command.js → docs/index-command.js} +1 -1
- package/dist/docs/template-resolution.js +1 -0
- package/dist/{viewpoint-document-kinds-check.js → docs/viewpoint-document-kinds-check.js} +1 -1
- package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
- package/dist/{yaml-pages.js → docs/yaml-pages.js} +2 -2
- package/dist/{exec-agent-config.js → exec/agent-config.js} +33 -4
- package/dist/{exec-agent-git-state.js → exec/agent-git-state.js} +1 -1
- package/dist/{exec-agent-protected-config.js → exec/agent-protected-config.js} +1 -1
- package/dist/{exec-commands.js → exec/commands.js} +22 -18
- package/dist/{exec-core.js → exec/core.js} +11 -11
- package/dist/{exec-events.js → exec/events.js} +2 -2
- package/dist/{exec-evidence.js → exec/evidence.js} +11 -6
- package/dist/exec/exec.js +2 -0
- package/dist/exec/format.js +1 -0
- package/dist/{exec-handoff.js → exec/handoff.js} +13 -12
- package/dist/{exec-limit.js → exec/limit.js} +93 -12
- package/dist/{exec-parent-validation.js → exec/parent-validation.js} +4 -4
- package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +16 -2
- package/dist/{exec-plans-core.js → exec/plans-core.js} +68 -114
- package/dist/{exec-plans-generation.js → exec/plans-generation.js} +53 -10
- package/dist/{exec-plans-storage.js → exec/plans-storage.js} +5 -5
- package/dist/{exec-plans.js → exec/plans.js} +3 -3
- package/dist/{exec-project.js → exec/project.js} +1 -1
- package/dist/{exec-protection-handoff.js → exec/protection-handoff.js} +3 -3
- package/dist/{exec-register-resume.js → exec/register-resume.js} +2 -2
- package/dist/{exec-register.js → exec/register.js} +92 -9
- package/dist/{exec-repo-integration-git.js → exec/repo-integration-git.js} +2 -2
- package/dist/{exec-repo-integration-sync.js → exec/repo-integration-sync.js} +4 -4
- package/dist/{exec-repo-integration.js → exec/repo-integration.js} +13 -10
- package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
- package/dist/{exec-reporter-output.js → exec/reporter-output.js} +2 -2
- package/dist/{exec-reporter.js → exec/reporter.js} +29 -12
- package/dist/{exec-results.js → exec/results.js} +256 -22
- package/dist/{exec-run-agent-pipeline.js → exec/run/agent-pipeline.js} +32 -12
- package/dist/{exec-run-agent.js → exec/run/agent.js} +79 -27
- package/dist/{exec-run-in-place.js → exec/run/in-place.js} +56 -27
- package/dist/{exec-run-job.js → exec/run/job.js} +64 -35
- package/dist/{exec-run-lifecycle-commands.js → exec/run/lifecycle-commands.js} +30 -22
- package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
- package/dist/{exec-run-mode-shared.js → exec/run/mode-shared.js} +3 -3
- package/dist/{exec-run-register-command.js → exec/run/register-command.js} +18 -10
- package/dist/{exec-run-register-core.js → exec/run/register-core.js} +46 -21
- package/dist/{exec-run-register-mode.js → exec/run/register-mode.js} +20 -16
- package/dist/{exec-run-register-resume.js → exec/run/register-resume.js} +22 -17
- package/dist/{exec-run-register-state.js → exec/run/register-state.js} +13 -10
- package/dist/{exec-run-register-worktree.js → exec/run/register-worktree.js} +54 -23
- package/dist/{exec-run.js → exec/run/run.js} +11 -11
- package/dist/{exec-run-schedule-mode.js → exec/run/schedule-mode.js} +17 -17
- package/dist/{exec-run-schedule-prepare.js → exec/run/schedule-prepare.js} +31 -18
- package/dist/{exec-run-schedule-task.js → exec/run/schedule-task.js} +45 -18
- package/dist/{exec-run-shared.js → exec/run/shared.js} +61 -11
- package/dist/{exec-schedule-calendar.js → exec/schedule/calendar.js} +1 -1
- package/dist/{exec-schedule-cpm.js → exec/schedule/cpm.js} +2 -2
- package/dist/{exec-schedule-gantt-chart-render.js → exec/schedule/gantt-chart-render.js} +2 -2
- package/dist/exec/schedule/gantt-chart.js +2 -0
- package/dist/{exec-schedule-hash.js → exec/schedule/hash.js} +2 -2
- package/dist/exec/schedule/index.js +1 -0
- package/dist/{exec-schedule-initial.js → exec/schedule/initial.js} +2 -2
- package/dist/{exec-schedule-progress.js → exec/schedule/progress.js} +2 -2
- package/dist/{exec-schedule-ready.js → exec/schedule/ready.js} +2 -2
- package/dist/{exec-schedule.js → exec/schedule/schedule.js} +11 -11
- package/dist/exec/shared.js +63 -0
- package/dist/exec/slot-lock.js +1 -0
- package/dist/{exec-strategy.js → exec/strategy.js} +2 -2
- package/dist/{exec-task-repos.js → exec/task-repos.js} +2 -2
- package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
- package/dist/{exec-trial-commands.js → exec/trial-commands.js} +20 -22
- package/dist/{exec-trial-core.js → exec/trial-core.js} +6 -6
- package/dist/{exec-trial.js → exec/trial.js} +2 -2
- package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
- package/dist/{exec-worktree-ops-commit.js → exec/worktree-ops-commit.js} +25 -60
- package/dist/{exec-worktree-ops-lifecycle.js → exec/worktree-ops-lifecycle.js} +13 -8
- package/dist/{exec-worktree-ops-merge.js → exec/worktree-ops-merge.js} +48 -7
- package/dist/{exec-worktree-ops.js → exec/worktree-ops.js} +3 -3
- package/dist/exec/worktree.js +305 -0
- package/dist/{grade-apply.js → grade/apply.js} +9 -9
- package/dist/{grade-command-apply.js → grade/command-apply.js} +7 -7
- package/dist/{grade-command-inspect.js → grade/command-inspect.js} +6 -6
- package/dist/{grade-command-plan.js → grade/command-plan.js} +5 -5
- package/dist/{grade-core.js → grade/core.js} +3 -3
- package/dist/grade/grade.js +19 -0
- package/dist/{grade-markdown.js → grade/markdown.js} +6 -6
- package/dist/{grade-pipeline-state.js → grade/pipeline-state.js} +4 -4
- package/dist/{grade-plan.js → grade/plan.js} +5 -5
- package/dist/{grade-result.js → grade/result.js} +5 -94
- package/dist/{grade-target-discovery.js → grade/target-discovery.js} +7 -7
- package/dist/{grade-targets.js → grade/targets.js} +11 -8
- package/dist/{job-definition.js → job/definition.js} +25 -6
- package/dist/{job.js → job/job.js} +12 -11
- package/dist/{kata-command.js → kata/command.js} +3 -3
- package/dist/{kata.js → kata/kata.js} +5 -5
- package/dist/register/approach.js +134 -0
- package/dist/{register-core.js → register/core.js} +13 -7
- package/dist/{register-create-commands.js → register/create-commands.js} +115 -8
- package/dist/{register-date.js → register/date.js} +1 -1
- package/dist/register/derivation.js +163 -0
- package/dist/{register-event-merge.js → register/event-merge.js} +32 -3
- package/dist/{register-events.js → register/events.js} +9 -3
- package/dist/{register-history.js → register/history.js} +7 -6
- package/dist/{register-item.js → register/item.js} +23 -5
- package/dist/register/lifecycle-lock.js +5 -0
- package/dist/{register-maintenance-commands.js → register/maintenance-commands.js} +13 -7
- package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
- package/dist/{register-migration.js → register/migration.js} +4 -4
- package/dist/{register.js → register/register.js} +32 -27
- package/dist/{register-renumber.js → register/renumber.js} +38 -11
- package/dist/{register-transition-commands.js → register/transition-commands.js} +3 -3
- package/dist/{register-update.js → register/update.js} +5 -5
- package/dist/{register-views.js → register/views.js} +47 -7
- package/dist/{review-grade.js → review/grade.js} +2 -2
- package/dist/{review-plan.js → review/plan.js} +3 -3
- package/dist/{routine-definition.js → routine/definition.js} +2 -2
- package/dist/{routine.js → routine/routine.js} +49 -22
- package/dist/{schedule-approach.js → schedule/approach.js} +8 -8
- package/dist/{schedule-build.js → schedule/build.js} +7 -4
- package/dist/{schedule.js → schedule/schedule.js} +6 -6
- package/dist/{schedule-strategy-generate-document.js → schedule/strategy-generate-document.js} +2 -2
- package/dist/{schedule-strategy-generate-scope.js → schedule/strategy-generate-scope.js} +4 -4
- package/dist/{schedule-strategy-generate.js → schedule/strategy-generate.js} +10 -10
- package/dist/shared/agent-types.js +23 -0
- package/dist/shared/artifact-path.js +9 -0
- package/dist/{build-if-stale.js → shared/build-if-stale.js} +1 -1
- package/dist/{catalog-build-render.js → shared/catalog-render.js} +3 -32
- package/dist/{exec-slot-lock.js → shared/cross-process-lock.js} +3 -1
- package/dist/shared/fs.js +30 -0
- package/dist/{exec-worktree.js → shared/git.js} +83 -241
- package/dist/shared/grade-result.js +94 -0
- package/dist/{package-paths.js → shared/package-paths.js} +3 -3
- package/dist/shared/plan-templates.js +114 -0
- package/dist/{exec-provider-scaffold.js → shared/provider-scaffold.js} +3 -1
- package/dist/shared/random.js +4 -0
- package/dist/{exec-schedule-index.js → shared/schedule-index.js} +3 -1
- package/dist/shared/schedule-paths.js +9 -0
- package/dist/{specdojo-config.js → shared/specdojo-config.js} +93 -5
- package/dist/{exec-shared.js → shared/text.js} +0 -134
- package/dist/shared/time.js +28 -0
- package/dist/specdojo.js +22 -22
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +29 -17
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -2
- package/docs/ja/specdojo/exec-templates/xer-template.md +1 -3
- package/docs/ja/specdojo/exec-templates/xrp-job-template.md +6 -4
- package/docs/ja/specdojo/guides/exec-config-guide.md +91 -16
- package/docs/ja/specdojo/guides/exec-operation-guide.md +145 -12
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +31 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +81 -16
- package/docs/ja/specdojo/guides/register-operation-guide.md +2 -1
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -1
- package/docs/ja/specdojo/guides/review-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +5 -5
- package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
- package/docs/ja/specdojo/references/command-reference.md +52 -28
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +17 -11
- package/docs/ja/specdojo/standards/job-definition-standard.md +20 -18
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -2
- package/docs/ja/specdojo/templates/pjr-derived-items-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-index-template.md +1 -0
- package/docs/specdojo/schemas/v1/agent-members.schema.yaml +29 -2
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +20 -0
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +2 -2
- package/docs/specdojo/schemas/v1/job.schema.yaml +7 -0
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +70 -7
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -1
- package/package.json +1 -1
- package/templates/antigravity/README.md +5 -1
- package/templates/antigravity/agent-members-snippet.yaml +108 -12
- package/templates/antigravity/exec-defaults-snippet.yaml +8 -13
- package/templates/claude/README.md +27 -3
- package/templates/claude/agents/claude-executor.md +0 -1
- package/templates/claude/agents/claude-reporter.md +2 -1
- package/templates/claude/agents/claude-review-executor.md +0 -1
- package/templates/codex/README.md +23 -4
- package/templates/devcontainer/devcontainer.json +2 -2
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +69 -0
- package/templates/devcontainer/remote-host/ssh-config.sample +16 -0
- package/templates/init-agent-members.yaml +75 -25
- package/templates/init-exec-defaults.yaml +24 -8
- package/templates/opencode/README.md +17 -3
- package/templates/opencode/agents/opencode-executor.md +0 -1
- package/templates/opencode/agents/opencode-reporter.md +2 -1
- package/templates/opencode/agents/opencode-review-executor.md +0 -1
- package/dist/exec-schedule-gantt-chart.js +0 -2
- package/dist/exec.js +0 -2
- package/dist/grade.js +0 -19
- package/templates/claude/agents/claude-expert-review-executor.md +0 -14
- /package/dist/{catalog-plan-prompt.js → catalog/plan-prompt.js} +0 -0
- /package/dist/{catalog-types.js → catalog/types.js} +0 -0
- /package/dist/{template-frontmatter.js → docs/template-frontmatter.js} +0 -0
- /package/dist/{role-types.js → exec/role-types.js} +0 -0
- /package/dist/{exec-schedule-gantt-chart-scope.js → exec/schedule/gantt-chart-scope.js} +0 -0
- /package/dist/{exec-types.js → exec/types.js} +0 -0
- /package/dist/{grade-command-shared.js → grade/command-shared.js} +0 -0
- /package/dist/{register-command-types.js → register/command-types.js} +0 -0
- /package/dist/{review-types.js → review/types.js} +0 -0
- /package/dist/{schedule-phase-sets.js → schedule/phase-sets.js} +0 -0
- /package/dist/{schedule-strategy-profiles.js → schedule/strategy-profiles.js} +0 -0
- /package/dist/{agent-response.js → shared/agent-response.js} +0 -0
- /package/dist/{catalog-paths.js → shared/catalog-paths.js} +0 -0
- /package/dist/{dist-freshness.js → shared/dist-freshness.js} +0 -0
- /package/dist/{git-environment.js → shared/git-environment.js} +0 -0
- /package/dist/{exec-format.js → shared/markdown-format.js} +0 -0
- /package/dist/{practice-id.js → shared/practice-id.js} +0 -0
- /package/dist/{spawn-self.js → shared/spawn-self.js} +0 -0
- /package/dist/{specdojo-gitignore.js → shared/specdojo-gitignore.js} +0 -0
- /package/dist/{template-resolution.js → shared/template-resolution.js} +0 -0
- /package/dist/{yaml-schema-modeline.js → shared/yaml-schema-modeline.js} +0 -0
- /package/dist/{yaml.js → shared/yaml.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { buildTaskPhaseMap, isRateLimitError, parseExecRunBusyPolicy, resolveAgentOverride, resolveRegisterWorktree, resolveTaskPhaseContext, runCompletionDrivenWorkerPool, selectCandidates, } from "./
|
|
2
|
-
export { buildExecutorPrompt, executeAgent, executorRequirements, expandPromptRefs, extractBlockReason, loadPrompt, loadRosterForExecutionPath, reporterRequirements, resolveResumedCoverageTargets, runConfiguredParentValidationBatch, runConfiguredParentValidations, } from "./
|
|
3
|
-
export { checkCompletionBeforeIntegration, downgradeUnfilledResult
|
|
4
|
-
export { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor
|
|
5
|
-
export { resolveInPlaceAgentPipeline, resolveInPlaceCommand } from "./
|
|
6
|
-
export { commitSubject, pipelineRecoveryMeta } from "./
|
|
7
|
-
export { commitRegisterItemChanges, isRegisterPipelineRequested, parseRegisterExecutorSelection, resolveRegisterCommand, resolveRegisterPipelineCommand, } from "./
|
|
8
|
-
export { registerStatePaths } from "./
|
|
9
|
-
export { resolveRegisterResumeExecutor, resolveRegisterResumeReporter
|
|
10
|
-
export { registerRunCommand } from "./
|
|
11
|
-
export { formatExecSlotsReport, registerCycleCommand, registerResumeCommand, registerSlotsCommand, } from "./
|
|
1
|
+
export { buildTaskPhaseMap, isRateLimitError, parseExecRunBusyPolicy, resolveAgentOverride, resolveRegisterWorktree, resolveTaskPhaseContext, runCompletionDrivenWorkerPool, selectCandidates, } from "./shared.js";
|
|
2
|
+
export { buildExecutorPrompt, executeAgent, executorRequirements, expandPromptRefs, extractBlockReason, loadPrompt, loadRosterForExecutionPath, reporterRequirements, resolveResumedCoverageTargets, runConfiguredParentValidationBatch, runConfiguredParentValidations, } from "./agent.js";
|
|
3
|
+
export { checkCompletionBeforeIntegration, downgradeUnfilledResult } from "./schedule-prepare.js";
|
|
4
|
+
export { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor } from "./schedule-mode.js";
|
|
5
|
+
export { resolveInPlaceAgentPipeline, resolveInPlaceCommand } from "./in-place.js";
|
|
6
|
+
export { commitSubject, pipelineRecoveryMeta } from "./mode-shared.js";
|
|
7
|
+
export { commitRegisterItemChanges, isRegisterPipelineRequested, parseRegisterExecutorSelection, resolveRegisterCommand, resolveRegisterPipelineCommand, } from "./register-core.js";
|
|
8
|
+
export { registerStatePaths } from "./register-state.js";
|
|
9
|
+
export { resolveRegisterResumeExecutor, resolveRegisterResumeReporter } from "./register-resume.js";
|
|
10
|
+
export { registerRunCommand } from "./register-command.js";
|
|
11
|
+
export { formatExecSlotsReport, registerCycleCommand, registerResumeCommand, registerSlotsCommand, } from "./lifecycle-commands.js";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { basename, join } from "node:path";
|
|
3
|
-
import { createProviderCapacityTracker, loadExecDefaultsConfig } from "
|
|
4
|
-
import { activateResolvedProjectPaths, resolveProjectPaths } from "
|
|
5
|
-
import { readAllEventFiles, foldEventsToState } from "
|
|
6
|
-
import { buildScheduleIndex, findStaleGeneratedTracks } from "
|
|
7
|
-
import { buildInitialStateFromStrategy } from "
|
|
8
|
-
import { readReadySnapshot } from "
|
|
9
|
-
import { specdojoRootDir } from "
|
|
10
|
-
import { extractLocalId, extractPhaseSuffix } from "
|
|
11
|
-
import { resolveWorktreeBase } from "
|
|
12
|
-
import { buildPhaseModeIndex, resolveAgentAssignment, resolveAgentPipeline, resolveApproach, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "
|
|
13
|
-
import { SerialAsyncLock, buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./
|
|
14
|
-
import { loadRosterForExecutionPath } from "./
|
|
15
|
-
import { prepareSingleTask
|
|
16
|
-
import { runPreparedTask, runPreparedTaskSafely, } from "./
|
|
17
|
-
import { spawnIndexBuild, spawnRefresh, spawnScheduleBuild } from "./
|
|
3
|
+
import { createProviderCapacityTracker, loadExecDefaultsConfig } from "../agent-config.js";
|
|
4
|
+
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
5
|
+
import { readAllEventFiles, foldEventsToState } from "../events.js";
|
|
6
|
+
import { buildScheduleIndex, findStaleGeneratedTracks } from "../schedule/schedule.js";
|
|
7
|
+
import { buildInitialStateFromStrategy } from "../schedule/initial.js";
|
|
8
|
+
import { readReadySnapshot } from "../schedule/ready.js";
|
|
9
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
10
|
+
import { extractLocalId, extractPhaseSuffix } from "../../schedule/phase-sets.js";
|
|
11
|
+
import { resolveWorktreeBase } from "../worktree.js";
|
|
12
|
+
import { buildPhaseModeIndex, resolveAgentAssignment, resolveAgentPipeline, resolveApproach, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "../strategy.js";
|
|
13
|
+
import { SerialAsyncLock, buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./shared.js";
|
|
14
|
+
import { loadRosterForExecutionPath } from "./agent.js";
|
|
15
|
+
import { prepareSingleTask } from "./schedule-prepare.js";
|
|
16
|
+
import { runPreparedTask, runPreparedTaskSafely, } from "./schedule-task.js";
|
|
17
|
+
import { spawnIndexBuild, spawnRefresh, spawnScheduleBuild } from "./mode-shared.js";
|
|
18
18
|
// Rebuild only generated tracks whose strategy input is missing a generated track or has a newer
|
|
19
19
|
// mtime. The same structured detector feeds exec validate warnings, keeping manual validation and
|
|
20
20
|
// cycle automation on one freshness rule. No output is emitted when every track is fresh.
|
|
@@ -81,7 +81,7 @@ export async function runBatchMode(opts) {
|
|
|
81
81
|
if (!task)
|
|
82
82
|
continue;
|
|
83
83
|
try {
|
|
84
|
-
const prepared = await prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, opts.by, { edit: opts.editBy, review: opts.reviewBy }, { executor: opts.executorBy, reporter: opts.reporterBy }, opts.by, dryRun, false, worktreeBase, planGenPaths, execDefaults, capacity.hasCapacity);
|
|
84
|
+
const prepared = await prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, opts.by, { edit: opts.editBy, review: opts.reviewBy }, { executor: opts.executorBy, reporter: opts.reporterBy }, opts.by, dryRun, false, worktreeBase, planGenPaths, execDefaults, capacity.hasCapacity, undefined, opts);
|
|
85
85
|
// "deferred": every candidate provider is at its cap; try it again after a slot frees.
|
|
86
86
|
if (prepared === "deferred")
|
|
87
87
|
continue;
|
|
@@ -282,7 +282,7 @@ export async function runManualMode(opts) {
|
|
|
282
282
|
// ignore errors reading state; fall through to normal agent selection
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
const prepared = await prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, actorOverride, { edit: opts.editBy, review: opts.reviewBy }, { executor: opts.executorBy, reporter: opts.reporterBy }, actorOverride, !!opts.dryRun, alreadyClaimed, worktreeBase, planGenPaths, execDefaults);
|
|
285
|
+
const prepared = await prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, actorOverride, { edit: opts.editBy, review: opts.reviewBy }, { executor: opts.executorBy, reporter: opts.reporterBy }, actorOverride, !!opts.dryRun, alreadyClaimed, worktreeBase, planGenPaths, execDefaults, undefined, undefined, opts);
|
|
286
286
|
if (typeof prepared === "string") {
|
|
287
287
|
if (prepared === "failure")
|
|
288
288
|
process.exitCode = 1;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { resolveMemberCommand } from "
|
|
3
|
-
import { canCompleteTask, readAllEventFiles, foldEventsToState } from "
|
|
4
|
-
import { buildScheduleIndex } from "
|
|
5
|
-
import { buildInitialStateFromStrategy } from "
|
|
6
|
-
import { qualifyTaskId, randomHex } from "
|
|
7
|
-
import { generateSinglePlan, finalizeResultSectionsForDeliverable, targetDocIdsForScheduledTask, reviewGradeSubject, } from "
|
|
8
|
-
import { ensureReviewGrade } from "
|
|
9
|
-
import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult } from "
|
|
10
|
-
import { worktreeNameFromTaskId } from "
|
|
11
|
-
import { configuredProductRepos, plannedProjectWorktreePath } from "
|
|
12
|
-
import { checkpointAndEnsureWorktree, discardStaleExecWorktree } from "
|
|
13
|
-
import { pipelineStateLocation } from "
|
|
14
|
-
import { collectBusyActors, pinnedExecutor, pinnedReporter, resolveAgentOverride, resolveTaskPhaseContext, selectCandidates, } from "./
|
|
15
|
-
import { buildExecutorPrompt, executorRequirements, loadPrompt, reportProductWorktrees, reporterRequirements, resolveReporterAgentCandidates, } from "./
|
|
16
|
-
import { integrateLogPath, spawnClaim, spawnRelease } from "./
|
|
2
|
+
import { resolveMemberCommand } from "../agent-config.js";
|
|
3
|
+
import { canCompleteTask, readAllEventFiles, foldEventsToState } from "../events.js";
|
|
4
|
+
import { buildScheduleIndex } from "../schedule/schedule.js";
|
|
5
|
+
import { buildInitialStateFromStrategy } from "../schedule/initial.js";
|
|
6
|
+
import { qualifyTaskId, randomHex } from "../shared.js";
|
|
7
|
+
import { generateSinglePlan, finalizeResultSectionsForDeliverable, targetDocIdsForScheduledTask, reviewGradeSubject, } from "../plans.js";
|
|
8
|
+
import { ensureReviewGrade } from "../../review/grade.js";
|
|
9
|
+
import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult } from "../results.js";
|
|
10
|
+
import { worktreeNameFromTaskId } from "../worktree.js";
|
|
11
|
+
import { configuredProductRepos, plannedProjectWorktreePath } from "../task-repos.js";
|
|
12
|
+
import { checkpointAndEnsureWorktree, discardStaleExecWorktree } from "../worktree-ops.js";
|
|
13
|
+
import { pipelineStateLocation } from "../pipeline-state.js";
|
|
14
|
+
import { collectBusyActors, pinnedExecutor, pinnedReporter, resolveAgentOverride, resolvePinnedRateLimitRunOptions, resolveTaskPhaseContext, selectCandidates, } from "./shared.js";
|
|
15
|
+
import { buildExecutorPrompt, executorRequirements, loadPrompt, reportProductWorktrees, reporterRequirements, resolveReporterAgentCandidates, } from "./agent.js";
|
|
16
|
+
import { integrateLogPath, spawnClaim, spawnRelease } from "./mode-shared.js";
|
|
17
17
|
export function findClaimEventPath(schedulePath, taskId) {
|
|
18
18
|
const claims = readAllEventFiles(schedulePath).filter((item) => item.event.task_id === taskId && item.event.type === "claim");
|
|
19
19
|
return claims[claims.length - 1]?.path ?? null;
|
|
@@ -49,7 +49,7 @@ export async function gradeBeforeReviewPlan(params) {
|
|
|
49
49
|
process.stdout.write(` [grade] ${summary}\n`);
|
|
50
50
|
return outcome;
|
|
51
51
|
}
|
|
52
|
-
export async function prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, agentNicknameOverride, modeAgentOverrides, stageAgentOverrides, actorOverride, dryRun, skipClaim, worktreeBase, planGenPaths, execDefaults, hasProviderCapacity, pipelineResume) {
|
|
52
|
+
export async function prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, agentNicknameOverride, modeAgentOverrides, stageAgentOverrides, actorOverride, dryRun, skipClaim, worktreeBase, planGenPaths, execDefaults, hasProviderCapacity, pipelineResume, rateLimitOverrides = {}) {
|
|
53
53
|
const mode = task.mode ?? "edit";
|
|
54
54
|
process.stdout.write(`Task: ${task.id}${task.name ? ` — ${task.name}` : ""} [${mode}]\n`);
|
|
55
55
|
if (!task.agent_pipeline && (stageAgentOverrides.executor || stageAgentOverrides.reporter)) {
|
|
@@ -77,7 +77,7 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
77
77
|
]
|
|
78
78
|
: [];
|
|
79
79
|
let actor = actorOverride ?? "auto-agent";
|
|
80
|
-
if (
|
|
80
|
+
if (overrideResolution.kind === "command" && overrideResolution.actor && !skipClaim) {
|
|
81
81
|
actor = overrideResolution.actor;
|
|
82
82
|
}
|
|
83
83
|
if (agentCandidates.length === 0) {
|
|
@@ -142,14 +142,23 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
142
142
|
process.stdout.write(` Phase: ${phaseCtx.phaseSet}/${phaseCtx.phaseId} Mode: ${mode} Agent: ${runnable[0].nickname}\n`);
|
|
143
143
|
}
|
|
144
144
|
let reporterCandidates;
|
|
145
|
+
let reporterPinned = false;
|
|
145
146
|
if (task.agent_pipeline) {
|
|
146
147
|
const requirements = reporterRequirements(task);
|
|
147
|
-
|
|
148
|
+
const reporterNickname = stageAgentOverrides.reporter ?? pinnedReporter(task);
|
|
149
|
+
reporterPinned = !!reporterNickname || !!pipelineResume;
|
|
150
|
+
reporterCandidates = resolveReporterAgentCandidates(task, roster, execDefaults, collectBusyActors(schedulePath), reporterNickname);
|
|
148
151
|
if (reporterCandidates.length === 0) {
|
|
149
152
|
process.stdout.write(` No agents found for reporter stage${requirements?.proficiency ? `, proficiency: ${requirements.proficiency}` : ""}\n`);
|
|
150
153
|
return "failure";
|
|
151
154
|
}
|
|
152
155
|
}
|
|
156
|
+
const executorRateLimitOptions = overrideResolution.kind === "command" || !!pipelineResume
|
|
157
|
+
? resolvePinnedRateLimitRunOptions(rateLimitOverrides, execDefaults, roster, "executor", agentCandidates[0])
|
|
158
|
+
: undefined;
|
|
159
|
+
const reporterRateLimitOptions = reporterPinned && reporterCandidates?.[0]
|
|
160
|
+
? resolvePinnedRateLimitRunOptions(rateLimitOverrides, execDefaults, roster, "reporter", reporterCandidates[0])
|
|
161
|
+
: undefined;
|
|
153
162
|
const reviewGradeOutcome = await gradeBeforeReviewPlan({
|
|
154
163
|
task,
|
|
155
164
|
projectId,
|
|
@@ -213,6 +222,8 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
213
222
|
pipelineResumeStage: pipelineResume?.stage,
|
|
214
223
|
pipelineStateRef: pipelineResume?.stateRef,
|
|
215
224
|
reporterCandidates,
|
|
225
|
+
executorRateLimitOptions,
|
|
226
|
+
reporterRateLimitOptions,
|
|
216
227
|
};
|
|
217
228
|
}
|
|
218
229
|
if (skipClaim) {
|
|
@@ -317,6 +328,8 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
317
328
|
pipelineResumeStage: pipelineResume?.stage,
|
|
318
329
|
pipelineStateRef: pipelineResume?.stateRef,
|
|
319
330
|
reporterCandidates,
|
|
331
|
+
executorRateLimitOptions,
|
|
332
|
+
reporterRateLimitOptions,
|
|
320
333
|
};
|
|
321
334
|
}
|
|
322
335
|
// An agent can exit 0 without doing the work (e.g. a permission-denied tool call is fed back as a
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { relative, resolve, sep } from "node:path";
|
|
2
|
-
import { limitEventMeta } from "
|
|
3
|
-
import { readResultFrontmatterSnapshot, renderReporterResult, updateResultStatus, } from "
|
|
4
|
-
import { gitOutput } from "
|
|
5
|
-
import { withProductRepoPrompt } from "
|
|
6
|
-
import { commitTargetPaths, commitWorktreeChanges, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, releaseRootWorkingCopies, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "
|
|
7
|
-
import { commitProductWorktrees, integrateTaskRepositories, projectMergeBlockers, PROJECT_REPO_NAME, RepoIntegrationError, } from "
|
|
8
|
-
import { recordExecutorEvidence, recordReporterFailureOutput } from "
|
|
9
|
-
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "
|
|
10
|
-
import { createPipelineState, loadPipelineResumeCheckpoint, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "
|
|
11
|
-
import { agentEnvironment, appendParentValidationsToExecutorEvidence, buildExecutorPrompt, extractBlockReason, pathInsideWorktree, resumedTargetCoverageFailure, runWithRetry, } from "./
|
|
12
|
-
import { refreshParentValidationsForReporterResume } from "./
|
|
13
|
-
import { downgradeUnfilledResult, readCompletionPreflight, } from "./
|
|
14
|
-
import { commitSubject, integrateLogPath, pipelineRecoveryMeta, recordIntegrateStage, recordRepoIntegration, repoRelativePath, spawnBlock, spawnComplete, } from "./
|
|
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
15
|
export async function runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
|
|
16
16
|
if (dryRun)
|
|
17
17
|
return "success";
|
|
@@ -38,6 +38,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
38
38
|
let pipelineBlockReason;
|
|
39
39
|
let reporterLimit;
|
|
40
40
|
let reporterAttempts = 0;
|
|
41
|
+
let reporterActor = prepared.reporterCandidates?.[0]?.actor;
|
|
42
|
+
const reporterRateLimitEvents = [];
|
|
41
43
|
let pipelineState;
|
|
42
44
|
let pipelineStatePath;
|
|
43
45
|
let pipelineStateRef;
|
|
@@ -45,13 +47,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
45
47
|
let resumeIntegration = false;
|
|
46
48
|
if (!prepared.pipelineRunId) {
|
|
47
49
|
process.stdout.write(` Running: ${prepared.agentCandidates[0]?.command ?? ""}\n`);
|
|
48
|
-
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);
|
|
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);
|
|
49
51
|
result = outcome.result;
|
|
50
52
|
stderr = outcome.stderr;
|
|
51
53
|
exitCode = outcome.exitCode;
|
|
52
54
|
stdout = outcome.stdout;
|
|
53
55
|
attempts = outcome.attempts;
|
|
54
56
|
limit = outcome.limit;
|
|
57
|
+
prepared.actor = outcome.actor ?? prepared.actor;
|
|
55
58
|
}
|
|
56
59
|
if (prepared.pipelineRunId && prepared.pipelineStateRef) {
|
|
57
60
|
const checkpoint = loadPipelineResumeCheckpoint({
|
|
@@ -139,20 +142,21 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
139
142
|
existingChanges: worktreeStatusPaths(prepared.worktree.path),
|
|
140
143
|
})
|
|
141
144
|
: prepared.prompt;
|
|
142
|
-
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);
|
|
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);
|
|
143
146
|
result = executorOutcome.result;
|
|
144
147
|
stderr = executorOutcome.stderr;
|
|
145
148
|
exitCode = executorOutcome.exitCode;
|
|
146
149
|
stdout = executorOutcome.stdout;
|
|
147
150
|
attempts = executorOutcome.attempts;
|
|
148
151
|
limit = executorOutcome.limit;
|
|
152
|
+
prepared.actor = executorOutcome.actor ?? prepared.actor;
|
|
149
153
|
const recorded = recordExecutorEvidence({
|
|
150
154
|
repoRoot,
|
|
151
155
|
worktreePath: prepared.worktree.path,
|
|
152
156
|
executionPath,
|
|
153
157
|
taskId: prepared.task.id,
|
|
154
158
|
runId: pipelineState.run_id,
|
|
155
|
-
actor: prepared.actor,
|
|
159
|
+
actor: executorOutcome.actor ?? prepared.actor,
|
|
156
160
|
status: result === "success" ? "succeeded" : result === "rate_limit" ? "rate_limited" : "failed",
|
|
157
161
|
startedAt: executorStartedAt,
|
|
158
162
|
completedAt: new Date().toISOString(),
|
|
@@ -161,6 +165,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
161
165
|
stdout,
|
|
162
166
|
stderr,
|
|
163
167
|
productWorktrees: prepared.worktree.repos,
|
|
168
|
+
rateLimitEvents: executorOutcome.rateLimitEvents,
|
|
164
169
|
});
|
|
165
170
|
executorEvidenceRef = relative(prepared.worktree.path, recorded.evidencePath)
|
|
166
171
|
.split(sep)
|
|
@@ -190,8 +195,12 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
190
195
|
? "rate_limited"
|
|
191
196
|
: "failed",
|
|
192
197
|
attempts: pipelineState.stages.executor.attempts + attempts,
|
|
198
|
+
actor: executorOutcome.actor ?? prepared.actor,
|
|
193
199
|
completed_at: executorCompletedAt,
|
|
194
200
|
artifact_ref: executorEvidenceRef,
|
|
201
|
+
...(executorOutcome.rateLimitEvents.length > 0
|
|
202
|
+
? { rate_limit_events: executorOutcome.rateLimitEvents }
|
|
203
|
+
: {}),
|
|
195
204
|
}, executorCompletedAt);
|
|
196
205
|
writePipelineState(pipelineStatePath, pipelineState);
|
|
197
206
|
process.stdout.write(` Executor evidence: ${executorEvidenceRef}\n`);
|
|
@@ -237,13 +246,23 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
237
246
|
evidence: reporterEvidence,
|
|
238
247
|
mode: prepared.task.mode ?? "edit",
|
|
239
248
|
invoke: async (reporterPrompt) => {
|
|
240
|
-
const outcome = await runWithRetry(prepared.reporterCandidates ?? [], reporterPrompt, execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath);
|
|
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);
|
|
241
250
|
reporterAttempts += outcome.attempts;
|
|
251
|
+
reporterActor = outcome.actor ?? reporterActor;
|
|
252
|
+
reporterRateLimitEvents.push(...outcome.rateLimitEvents);
|
|
242
253
|
if (outcome.limit)
|
|
243
254
|
reporterLimit = outcome.limit;
|
|
244
255
|
return { result: outcome.result, stdout: outcome.stdout, stderr: outcome.stderr };
|
|
245
256
|
},
|
|
246
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
|
+
}
|
|
247
266
|
if (reporter.result === "success") {
|
|
248
267
|
try {
|
|
249
268
|
await renderReporterResult(worktreeResultPath, reporter.output, reporterEvidence);
|
|
@@ -254,16 +273,20 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
254
273
|
pipelineBlockReason = facts.block_reason || undefined;
|
|
255
274
|
if (pipelineBlockReason)
|
|
256
275
|
stderr = pipelineBlockReason;
|
|
257
|
-
process.stdout.write(` Reporter complete: ${
|
|
276
|
+
process.stdout.write(` Reporter complete: ${reporterActor ?? "reporter"} (format attempts: ${reporter.formatAttempts})\n`);
|
|
258
277
|
if (result === "success") {
|
|
259
278
|
const reporterCompletedAt = new Date().toISOString();
|
|
260
279
|
pipelineState = updatePipelineStage(pipelineState, "reporter", {
|
|
261
280
|
status: "succeeded",
|
|
262
281
|
attempts: pipelineState.stages.reporter.attempts + reporterAttempts,
|
|
282
|
+
actor: reporterActor ?? null,
|
|
263
283
|
completed_at: reporterCompletedAt,
|
|
264
284
|
artifact_ref: relative(prepared.worktree.path, worktreeResultPath)
|
|
265
285
|
.split(sep)
|
|
266
286
|
.join("/"),
|
|
287
|
+
...(reporterRateLimitEvents.length > 0
|
|
288
|
+
? { rate_limit_events: reporterRateLimitEvents }
|
|
289
|
+
: {}),
|
|
267
290
|
}, reporterCompletedAt);
|
|
268
291
|
writePipelineState(pipelineStatePath, pipelineState);
|
|
269
292
|
}
|
|
@@ -295,10 +318,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
295
318
|
pipelineState = updatePipelineStage(pipelineState, "reporter", {
|
|
296
319
|
status: result === "rate_limit" ? "rate_limited" : "failed",
|
|
297
320
|
attempts: pipelineState.stages.reporter.attempts + reporterAttempts,
|
|
321
|
+
actor: reporterActor ?? null,
|
|
298
322
|
completed_at: reporterCompletedAt,
|
|
299
323
|
artifact_ref: reporter.result === "success"
|
|
300
324
|
? relative(prepared.worktree.path, worktreeResultPath).split(sep).join("/")
|
|
301
325
|
: pipelineState.stages.reporter.artifact_ref,
|
|
326
|
+
...(reporterRateLimitEvents.length > 0
|
|
327
|
+
? { rate_limit_events: reporterRateLimitEvents }
|
|
328
|
+
: {}),
|
|
302
329
|
}, reporterCompletedAt);
|
|
303
330
|
writePipelineState(pipelineStatePath, pipelineState);
|
|
304
331
|
}
|
|
@@ -1,14 +1,64 @@
|
|
|
1
1
|
import { basename, resolve } from "node:path";
|
|
2
|
-
import { defaultExecDefaultsPath, hasMemberCommandSource, loadExecDefaultsConfig, resolveMaxConcurrentRuns, resolveMemberCommand, resolveRegisterExecution, } from "
|
|
3
|
-
import { resolveProjectPaths } from "
|
|
4
|
-
import { buildInitialStateFromStrategy } from "
|
|
5
|
-
import { buildScheduleIndex } from "
|
|
6
|
-
import { listFilesRecursive, readYaml } from "
|
|
7
|
-
import { getProjectSchedulePath, loadConfig, specdojoRootDir, } from "
|
|
8
|
-
import { acquireExecRunLock, EXEC_RUN_LOCK_TOKEN_ENV, execLocksDir, inheritsExecRunLock, releaseExecRunLock, ROUTINE_BUSY_SKIP_EXIT_CODE, ROUTINE_EXEC_ENV, } from "./
|
|
9
|
-
import { getActiveExecLocksDir, setActiveExecLocksDir } from "
|
|
10
|
-
import { readAllEventFiles, foldEventsToState } from "
|
|
11
|
-
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "
|
|
2
|
+
import { defaultExecDefaultsPath, hasMemberCommandSource, loadExecDefaultsConfig, resolveMaxConcurrentRuns, resolveMemberCommand, resolveRegisterExecution, resolvePinnedRateLimitPolicy, } from "../agent-config.js";
|
|
3
|
+
import { resolveProjectPaths } from "../project.js";
|
|
4
|
+
import { buildInitialStateFromStrategy } from "../schedule/initial.js";
|
|
5
|
+
import { buildScheduleIndex } from "../schedule/schedule.js";
|
|
6
|
+
import { listFilesRecursive, readYaml } from "../shared.js";
|
|
7
|
+
import { getProjectSchedulePath, loadConfig, resolveAgentMember, specdojoRootDir, } from "../../shared/specdojo-config.js";
|
|
8
|
+
import { acquireExecRunLock, EXEC_RUN_LOCK_TOKEN_ENV, execLocksDir, inheritsExecRunLock, releaseExecRunLock, ROUTINE_BUSY_SKIP_EXIT_CODE, ROUTINE_EXEC_ENV, } from "./lock.js";
|
|
9
|
+
import { getActiveExecLocksDir, setActiveExecLocksDir } from "../slot-lock.js";
|
|
10
|
+
import { readAllEventFiles, foldEventsToState } from "../events.js";
|
|
11
|
+
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "../../schedule/phase-sets.js";
|
|
12
|
+
export function rateLimitRecoveryReason(events) {
|
|
13
|
+
return events
|
|
14
|
+
.map((event) => event.action === "wait"
|
|
15
|
+
? `rate limit wait: ${event.to_actor} resumed at ${event.resumed_at}`
|
|
16
|
+
: `rate limit fallback: ${event.from_actor} -> ${event.to_actor} at ${event.resumed_at}`)
|
|
17
|
+
.join("; ");
|
|
18
|
+
}
|
|
19
|
+
export function isPinnedRateLimitAction(value) {
|
|
20
|
+
return value === "stop" || value === "wait" || value === "fallback";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve CLI-over-config recovery for one pinned pipeline stage. A fallback action without a
|
|
24
|
+
* fallback nickname intentionally degrades to stop, preserving the historical non-switching
|
|
25
|
+
* behaviour instead of choosing an arbitrary agent.
|
|
26
|
+
*/
|
|
27
|
+
export function resolvePinnedRateLimitRunOptions(opts, execDefaults, roster, stageRole, primary) {
|
|
28
|
+
const configured = resolvePinnedRateLimitPolicy(execDefaults, primary.provider);
|
|
29
|
+
const requested = opts.onRateLimit;
|
|
30
|
+
if (requested !== undefined && !isPinnedRateLimitAction(requested)) {
|
|
31
|
+
throw new Error(`--on-rate-limit must be "stop", "wait", or "fallback": ${requested}`);
|
|
32
|
+
}
|
|
33
|
+
const action = requested ?? configured.action;
|
|
34
|
+
const nickname = stageRole === "executor"
|
|
35
|
+
? (opts.fallbackExecutorBy ?? configured.fallbackExecutorBy)
|
|
36
|
+
: (opts.fallbackReporterBy ?? configured.fallbackReporterBy);
|
|
37
|
+
if (action !== "fallback" || !nickname) {
|
|
38
|
+
return {
|
|
39
|
+
action: action === "fallback" ? "stop" : action,
|
|
40
|
+
maxWaitSeconds: configured.maxWaitSeconds,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const resolution = resolveAgentOverride("edit", nickname, {}, roster, execDefaults, stageRole);
|
|
44
|
+
if (resolution.kind !== "command") {
|
|
45
|
+
const flag = stageRole === "executor" ? "--fallback-executor-by" : "--fallback-reporter-by";
|
|
46
|
+
const detail = resolution.kind === "error" ? resolution.message : `agent not found: ${nickname}`;
|
|
47
|
+
throw new Error(`${flag}: ${detail.replace(/^--by/, flag)}`);
|
|
48
|
+
}
|
|
49
|
+
if (resolution.actor === primary.actor) {
|
|
50
|
+
throw new Error(`Fallback ${stageRole} must differ from the pinned agent: ${nickname}`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
action,
|
|
54
|
+
maxWaitSeconds: configured.maxWaitSeconds,
|
|
55
|
+
fallbackCandidate: {
|
|
56
|
+
command: resolution.command,
|
|
57
|
+
actor: resolution.actor ?? nickname,
|
|
58
|
+
provider: resolution.provider,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
12
62
|
export function pinnedExecutor(task) {
|
|
13
63
|
return typeof task?.agent === "string" ? task.agent : task?.agent?.executor;
|
|
14
64
|
}
|
|
@@ -24,7 +74,7 @@ export function resolveAgentOverride(mode, agentNicknameOverride, modeAgentOverr
|
|
|
24
74
|
if (!nickname)
|
|
25
75
|
return { kind: "none" };
|
|
26
76
|
const flag = agentNicknameOverride ? "--by" : mode === "review" ? "--review-by" : "--edit-by";
|
|
27
|
-
const member = roster
|
|
77
|
+
const member = resolveAgentMember(roster, nickname);
|
|
28
78
|
if (member && stageRole !== undefined && member.stage_role !== stageRole) {
|
|
29
79
|
return {
|
|
30
80
|
kind: "error",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toArtifactPath, toScheduleFilePath } from "
|
|
2
|
-
import { workingDayOffsetForDate } from "./
|
|
1
|
+
import { toArtifactPath, toScheduleFilePath } from "../shared.js";
|
|
2
|
+
import { workingDayOffsetForDate } from "./calendar.js";
|
|
3
3
|
export function topoSort(schedule) {
|
|
4
4
|
const indeg = new Map();
|
|
5
5
|
const out = new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { formatDateOnlyUtc, formatDays } from "
|
|
2
|
-
import { buildWorkingTaskSegments, dateForWorkingOffset, ganttChartStartDate, isWorkingDateUtc, workingMinutesPerDay, } from "./
|
|
1
|
+
import { formatDateOnlyUtc, formatDays } from "../shared.js";
|
|
2
|
+
import { buildWorkingTaskSegments, dateForWorkingOffset, ganttChartStartDate, isWorkingDateUtc, workingMinutesPerDay, } from "./calendar.js";
|
|
3
3
|
function xmlEscape(text) {
|
|
4
4
|
return text
|
|
5
5
|
.replace(/&/g, "&")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { existsSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, join } from "node:path";
|
|
4
|
-
import { ensureDir, isRecord, isStringArray, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "
|
|
5
|
-
import { generatedDirForProject } from "
|
|
4
|
+
import { ensureDir, isRecord, isStringArray, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "../shared.js";
|
|
5
|
+
import { generatedDirForProject } from "../project.js";
|
|
6
6
|
function isScheduleHash(value) {
|
|
7
7
|
return (isRecord(value) &&
|
|
8
8
|
value.schema_version === 1 &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../shared/schedule-index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listFilesRecursive, normalizeDateOnly, readYaml } from "
|
|
2
|
-
import { expandPhaseSetSelection, normalizePhaseSetSelection, } from "
|
|
1
|
+
import { listFilesRecursive, normalizeDateOnly, readYaml } from "../shared.js";
|
|
2
|
+
import { expandPhaseSetSelection, normalizePhaseSetSelection, } from "../../schedule/phase-sets.js";
|
|
3
3
|
export function buildInitialStateFromStrategy(schedulePath, schedule) {
|
|
4
4
|
const initial = {};
|
|
5
5
|
const strategyFiles = listFilesRecursive(schedulePath).filter((f) => /sch-strategy-.*\.(yaml|yml)$/.test(f));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { formatDateOnlyUtc } from "
|
|
2
|
-
import { dateForWorkingOffset, isWorkingDateUtc } from "./
|
|
1
|
+
import { formatDateOnlyUtc } from "../shared.js";
|
|
2
|
+
import { dateForWorkingOffset, isWorkingDateUtc } from "./calendar.js";
|
|
3
3
|
function parseDateOnlyUtc(value) {
|
|
4
4
|
const [year, month, day] = value.split("-").map(Number);
|
|
5
5
|
return new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { executionRootForProject, generatedDirForProject } from "
|
|
4
|
-
import { ensureDir, formatDays, isRecord, isStringArray, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "
|
|
3
|
+
import { executionRootForProject, generatedDirForProject } from "../project.js";
|
|
4
|
+
import { ensureDir, formatDays, isRecord, isStringArray, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "../shared.js";
|
|
5
5
|
function isStrategyOrder(value) {
|
|
6
6
|
return (isRecord(value) &&
|
|
7
7
|
(typeof value.next_task_id === "string" || value.next_task_id === null) &&
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { existsSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, extname, join } from "node:path";
|
|
3
|
-
import { computeReadyIds, foldEventsToState, isExecEventV1, validateEventShape, } from "
|
|
4
|
-
import { ensureDir, formatDays, listFilesRecursive, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "
|
|
5
|
-
import { eventsDirForProject, executionRootForProject, generatedDirForProject, } from "
|
|
6
|
-
import { buildGanttChartMarkdown, buildGanttChartSvg, buildProgressSummaryLines, } from "./
|
|
7
|
-
import { buildScheduleIndex } from "./
|
|
8
|
-
import { buildGanttChartScopeSpecs, filterCpmNodes, scheduleTrackNames, } from "./
|
|
9
|
-
import { computeCpm, topoSort } from "./
|
|
10
|
-
import { buildReadySnapshot, orderReadyIds, writeReadyFiles, selectNextTask
|
|
11
|
-
import { writeScheduleHashAndDiff } from "./
|
|
12
|
-
import { buildInitialStateFromStrategy } from "./
|
|
13
|
-
import { buildPhaseModeIndex, resolveAgentAssignment, resolveAgentPipeline, resolveApproach, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "
|
|
3
|
+
import { computeReadyIds, foldEventsToState, isExecEventV1, validateEventShape, } from "../events.js";
|
|
4
|
+
import { ensureDir, formatDays, listFilesRecursive, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "../shared.js";
|
|
5
|
+
import { eventsDirForProject, executionRootForProject, generatedDirForProject, } from "../project.js";
|
|
6
|
+
import { buildGanttChartMarkdown, buildGanttChartSvg, buildProgressSummaryLines, } from "./gantt-chart.js";
|
|
7
|
+
import { buildScheduleIndex } from "./index.js";
|
|
8
|
+
import { buildGanttChartScopeSpecs, filterCpmNodes, scheduleTrackNames, } from "./gantt-chart-scope.js";
|
|
9
|
+
import { computeCpm, topoSort } from "./cpm.js";
|
|
10
|
+
import { buildReadySnapshot, orderReadyIds, writeReadyFiles, selectNextTask } from "./ready.js";
|
|
11
|
+
import { writeScheduleHashAndDiff } from "./hash.js";
|
|
12
|
+
import { buildInitialStateFromStrategy } from "./initial.js";
|
|
13
|
+
import { buildPhaseModeIndex, resolveAgentAssignment, resolveAgentPipeline, resolveApproach, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "../strategy.js";
|
|
14
14
|
export function findStaleGeneratedTracks(projectPath) {
|
|
15
15
|
const files = listFilesRecursive(projectPath);
|
|
16
16
|
const trackFiles = new Map();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export { toArtifactPath, toPortablePath } from "../shared/artifact-path.js";
|
|
2
|
+
export { ensureDir, listFilesRecursive, readJson, readYaml, writeJson } from "../shared/fs.js";
|
|
3
|
+
export { displayWidth, escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, padEndDisplay, redactSensitiveText, stripTerminalControlSequences, } from "../shared/text.js";
|
|
4
|
+
export { formatDateOnlyUtc, isUtcIsoSeconds, normalizeDateOnly, nowUtcIsoSeconds, } from "../shared/time.js";
|
|
5
|
+
export { randomHex } from "../shared/random.js";
|
|
6
|
+
export { isSchYamlFilename, toScheduleFilePath } from "../shared/schedule-paths.js";
|
|
7
|
+
export function tsForFilenameUtc(ts) {
|
|
8
|
+
return ts.replace(/[-:]/g, "").replace("T", "T");
|
|
9
|
+
}
|
|
10
|
+
// worktree/branch 生成専用。project 修飾した task ID(`<projectId>:<taskId>`)を返す。
|
|
11
|
+
// projectId が未解決(env path override 等)の場合は bare のままにして後方互換を保つ。
|
|
12
|
+
// schedule 検索・plan/result ファイル名・claim には使わない(bare の task ID を使う)。
|
|
13
|
+
export function qualifyTaskId(projectId, taskId) {
|
|
14
|
+
return projectId ? `${projectId}:${taskId}` : taskId;
|
|
15
|
+
}
|
|
16
|
+
export function safeSlug(s) {
|
|
17
|
+
return s
|
|
18
|
+
.trim()
|
|
19
|
+
.replace(/\s+/g, "-")
|
|
20
|
+
.replace(/[^A-Za-z0-9._-]/g, "_")
|
|
21
|
+
.slice(0, 80);
|
|
22
|
+
}
|
|
23
|
+
export function requireNonEmpty(name, v) {
|
|
24
|
+
if (typeof v !== "string" || v.trim().length === 0)
|
|
25
|
+
throw new Error(`${name} is required`);
|
|
26
|
+
return v.trim();
|
|
27
|
+
}
|
|
28
|
+
export function collectRepeatable(value, previous) {
|
|
29
|
+
return previous.concat([value]);
|
|
30
|
+
}
|
|
31
|
+
// CPM 由来の日数値(ES / EF / slack / duration 等)の表示用フォーマット。
|
|
32
|
+
// 浮動小数点誤差(例: 6.2509999999999994)を吸収し、小数点以下を最大2桁に丸める。
|
|
33
|
+
// JSON 等のデータ出力には使わず、Markdown 表示にのみ使う。
|
|
34
|
+
export function formatDays(value) {
|
|
35
|
+
return String(Math.round(value * 100) / 100);
|
|
36
|
+
}
|
|
37
|
+
export function parseKeyValuePairs(pairs) {
|
|
38
|
+
if (!pairs || pairs.length === 0)
|
|
39
|
+
return undefined;
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const p of pairs) {
|
|
42
|
+
const idx = p.indexOf("=");
|
|
43
|
+
if (idx <= 0)
|
|
44
|
+
throw new Error(`Invalid key=value: ${p}`);
|
|
45
|
+
const k = p.slice(0, idx).trim();
|
|
46
|
+
const v = p.slice(idx + 1).trim();
|
|
47
|
+
if (!k)
|
|
48
|
+
throw new Error(`Empty key in: ${p}`);
|
|
49
|
+
out[k] = v;
|
|
50
|
+
}
|
|
51
|
+
return Object.keys(out).length ? out : undefined;
|
|
52
|
+
}
|
|
53
|
+
export function isRecord(value) {
|
|
54
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55
|
+
}
|
|
56
|
+
export function isStringArray(value) {
|
|
57
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
58
|
+
}
|
|
59
|
+
export function sleepMs(ms) {
|
|
60
|
+
const sab = new SharedArrayBuffer(4);
|
|
61
|
+
const int32 = new Int32Array(sab);
|
|
62
|
+
Atomics.wait(int32, 0, 0, ms);
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../shared/cross-process-lock.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listFilesRecursive, readYaml } from "./
|
|
2
|
-
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "
|
|
1
|
+
import { listFilesRecursive, readYaml } from "./shared.js";
|
|
2
|
+
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "../schedule/phase-sets.js";
|
|
3
3
|
function isTaskMode(value) {
|
|
4
4
|
return value === "edit" || value === "review";
|
|
5
5
|
}
|