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,26 +1,26 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "
|
|
4
|
-
import { activateResolvedProjectPaths, resolveProjectPaths } from "
|
|
5
|
-
import { acquireSchedulerLock, buildEvent, readAllEventFiles, foldEventsToState, releaseSchedulerLock, writeEventFile, } from "
|
|
6
|
-
import { selectDueDeferredLimitTasks } from "
|
|
7
|
-
import { buildScheduleIndex } from "
|
|
8
|
-
import { buildInitialStateFromStrategy } from "
|
|
9
|
-
import { qualifyTaskId } from "
|
|
10
|
-
import { specdojoRootDir } from "
|
|
11
|
-
import { collectExecLockUsage, execLocksDir, formatExecLockUsage } from "./
|
|
12
|
-
import { buildTaskView } from "
|
|
13
|
-
import { readResultFrontmatterSnapshot, updateResultStatus } from "
|
|
14
|
-
import { findExecWorktree, resolveWorktreeBase } from "
|
|
15
|
-
import { configuredProductRepos, withProductWorktrees } from "
|
|
16
|
-
import { parentValidationPoolPath, resolveParentValidationConcurrency, } from "
|
|
17
|
-
import { loadPipelineResumeCheckpoint } from "
|
|
18
|
-
import { buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, withProjectExecRunLock, } from "./
|
|
19
|
-
import { loadRosterForExecutionPath, pathInsideWorktree } from "./
|
|
20
|
-
import { findClaimEventPath, prepareSingleTask, } from "./
|
|
21
|
-
import { runPreparedTask } from "./
|
|
22
|
-
import { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor, runBatchMode, } from "./
|
|
23
|
-
import { spawnBlock, spawnIndexBuild, spawnRefresh, spawnValidate
|
|
3
|
+
import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "../agent-config.js";
|
|
4
|
+
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
5
|
+
import { acquireSchedulerLock, buildEvent, readAllEventFiles, foldEventsToState, releaseSchedulerLock, writeEventFile, } from "../events.js";
|
|
6
|
+
import { selectDueDeferredLimitTasks } from "../limit.js";
|
|
7
|
+
import { buildScheduleIndex } from "../schedule/schedule.js";
|
|
8
|
+
import { buildInitialStateFromStrategy } from "../schedule/initial.js";
|
|
9
|
+
import { qualifyTaskId } from "../shared.js";
|
|
10
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
11
|
+
import { collectExecLockUsage, execLocksDir, formatExecLockUsage } from "./lock.js";
|
|
12
|
+
import { buildTaskView } from "../task-view.js";
|
|
13
|
+
import { readResultFrontmatterSnapshot, updateResultStatus } from "../results.js";
|
|
14
|
+
import { findExecWorktree, resolveWorktreeBase } from "../worktree.js";
|
|
15
|
+
import { configuredProductRepos, withProductWorktrees } from "../task-repos.js";
|
|
16
|
+
import { parentValidationPoolPath, resolveParentValidationConcurrency, } from "../parent-validation.js";
|
|
17
|
+
import { loadPipelineResumeCheckpoint } from "../pipeline-state.js";
|
|
18
|
+
import { buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, withProjectExecRunLock, } from "./shared.js";
|
|
19
|
+
import { loadRosterForExecutionPath, pathInsideWorktree } from "./agent.js";
|
|
20
|
+
import { findClaimEventPath, prepareSingleTask, } from "./schedule-prepare.js";
|
|
21
|
+
import { runPreparedTask } from "./schedule-task.js";
|
|
22
|
+
import { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor, runBatchMode, } from "./schedule-mode.js";
|
|
23
|
+
import { spawnBlock, spawnIndexBuild, spawnRefresh, spawnValidate } from "./mode-shared.js";
|
|
24
24
|
// 同じ project の exec run が共有する枠(主 run・--join run・register lifecycle・provider の
|
|
25
25
|
// max_concurrency・親検証)の上限と現在の使用数を表示する。ロックは取得しない。
|
|
26
26
|
export function formatExecSlotsReport(executionPath, execDefaults) {
|
|
@@ -444,7 +444,7 @@ export async function runResumeMode(opts) {
|
|
|
444
444
|
stateRef: typeof snapshot.tasks[taskId]?.meta?.pipeline_state_ref === "string"
|
|
445
445
|
? snapshot.tasks[taskId]?.meta?.pipeline_state_ref
|
|
446
446
|
: undefined,
|
|
447
|
-
});
|
|
447
|
+
}, opts);
|
|
448
448
|
if (typeof prepared !== "string") {
|
|
449
449
|
const attempts = snapshot.tasks[taskId]?.meta?.limit_attempts;
|
|
450
450
|
prepared.priorLimitAttempts =
|
|
@@ -499,6 +499,9 @@ export function registerResumeCommand(exec) {
|
|
|
499
499
|
cmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks (overrides the claiming actor)");
|
|
500
500
|
cmd.option("--executor-by <nickname>", "agent-members.yaml executor nickname for pipeline tasks");
|
|
501
501
|
cmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for pipeline tasks");
|
|
502
|
+
cmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
|
|
503
|
+
cmd.option("--fallback-executor-by <nickname>", "Fallback executor after a rate limit");
|
|
504
|
+
cmd.option("--fallback-reporter-by <nickname>", "Fallback reporter after a rate limit");
|
|
502
505
|
cmd.option("--parallel <n>", "Number of tasks to resume in parallel", "1");
|
|
503
506
|
cmd.option("--worktree-base <path>", "Override worktree base directory");
|
|
504
507
|
cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
|
|
@@ -511,6 +514,11 @@ export function registerResumeCommand(exec) {
|
|
|
511
514
|
process.exitCode = 1;
|
|
512
515
|
return;
|
|
513
516
|
}
|
|
517
|
+
if (opts.onRateLimit && !["stop", "wait", "fallback"].includes(opts.onRateLimit)) {
|
|
518
|
+
process.stdout.write('--on-rate-limit must be "stop", "wait", or "fallback".\n');
|
|
519
|
+
process.exitCode = 1;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
514
522
|
await withProjectExecRunLock(opts, "resume", () => runResumeMode(opts));
|
|
515
523
|
}
|
|
516
524
|
catch (error) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { ensureDir } from "
|
|
3
|
-
import {
|
|
2
|
+
import { ensureDir } from "../shared.js";
|
|
3
|
+
import { registerLifecyclePoolPath } from "../../register/lifecycle-lock.js";
|
|
4
|
+
import { delay, formatLockOwner, isLiveLock, LOCK_HEARTBEAT_MS, LOCK_POLL_MS, LOCK_STALE_MS, livePoolHolders, readLockOwner, releaseLock, tryAcquireLock, tryAcquirePoolSlot, } from "../slot-lock.js";
|
|
4
5
|
export const EXEC_RUN_LOCK_HEARTBEAT_MS = LOCK_HEARTBEAT_MS;
|
|
5
6
|
export const EXEC_RUN_LOCK_STALE_MS = LOCK_STALE_MS;
|
|
6
7
|
export const EXEC_RUN_LOCK_TOKEN_ENV = "SPECDOJO_EXEC_RUN_LOCK_TOKEN";
|
|
@@ -104,7 +105,7 @@ export function releaseExecRunLock(handle) {
|
|
|
104
105
|
// Serializes the register lifecycle steps that write the root worktree (start transition,
|
|
105
106
|
// checkpoint, merge, wait commit, view rebuild) across every exec run of the project.
|
|
106
107
|
export function execLifecyclePoolPath(executionPath) {
|
|
107
|
-
return
|
|
108
|
+
return registerLifecyclePoolPath(executionPath);
|
|
108
109
|
}
|
|
109
110
|
function describeSlotOwner(slot) {
|
|
110
111
|
if (!slot.owner)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, sep } from "node:path";
|
|
4
|
-
import { selfRunArgs } from "
|
|
5
|
-
import { specdojoRootDir } from "
|
|
6
|
-
import { readPipelineState, updatePipelineRepoIntegration, updatePipelineStage, writePipelineState, } from "
|
|
4
|
+
import { selfRunArgs } from "../../shared/spawn-self.js";
|
|
5
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
6
|
+
import { readPipelineState, updatePipelineRepoIntegration, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
7
7
|
export function spawnSelf(args, cwd = specdojoRootDir()) {
|
|
8
8
|
const [exe, fullArgs] = selfRunArgs(args);
|
|
9
9
|
const result = spawnSync(exe, fullArgs, { stdio: "inherit", cwd });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { loadExecDefaultsConfig } from "
|
|
2
|
-
import { resolveProjectPaths } from "
|
|
3
|
-
import { isRegisterFailureMode } from "
|
|
4
|
-
import { EXCLUSIVE_EXEC_RUN, parseParallel, resolveExecDefaultsPath, resolveRegisterWorktree, withProjectExecRunLock, } from "./
|
|
5
|
-
import { runBatchMode, runManualMode } from "./
|
|
6
|
-
import { runInPlaceMode } from "./
|
|
7
|
-
import { runJobMode } from "./
|
|
8
|
-
import { spawnRefresh, spawnValidate } from "./
|
|
9
|
-
import { resolveRegisterPipelineCommand } from "./
|
|
10
|
-
import { runRegisterMode } from "./
|
|
1
|
+
import { loadExecDefaultsConfig } from "../agent-config.js";
|
|
2
|
+
import { resolveProjectPaths } from "../project.js";
|
|
3
|
+
import { isRegisterFailureMode } from "../register.js";
|
|
4
|
+
import { EXCLUSIVE_EXEC_RUN, parseParallel, resolveExecDefaultsPath, resolveRegisterWorktree, withProjectExecRunLock, } from "./shared.js";
|
|
5
|
+
import { runBatchMode, runManualMode } from "./schedule-mode.js";
|
|
6
|
+
import { runInPlaceMode } from "./in-place.js";
|
|
7
|
+
import { runJobMode } from "./job.js";
|
|
8
|
+
import { spawnRefresh, spawnValidate } from "./mode-shared.js";
|
|
9
|
+
import { resolveRegisterPipelineCommand } from "./register-core.js";
|
|
10
|
+
import { runRegisterMode } from "./register-mode.js";
|
|
11
11
|
export function registerRunCommand(exec) {
|
|
12
12
|
const rcmd = exec
|
|
13
13
|
.command("run")
|
|
@@ -50,6 +50,9 @@ export function registerRunCommand(exec) {
|
|
|
50
50
|
rcmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks in --auto batch runs");
|
|
51
51
|
rcmd.option("--executor-by <nickname>", "Executor nickname; with --register, also accepts PJR-ID=nickname assignments separated by commas. With --plan / --deliverable, runs the executor/reporter pipeline");
|
|
52
52
|
rcmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for agent_pipeline tasks (with --plan / --deliverable, runs the executor/reporter pipeline)");
|
|
53
|
+
rcmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
|
|
54
|
+
rcmd.option("--fallback-executor-by <nickname>", "Fallback executor used when --on-rate-limit fallback is selected");
|
|
55
|
+
rcmd.option("--fallback-reporter-by <nickname>", "Fallback reporter used when --on-rate-limit fallback is selected");
|
|
53
56
|
rcmd.option("--dry-run", "Print resolved command without executing", false);
|
|
54
57
|
rcmd.action(async (opts) => {
|
|
55
58
|
try {
|
|
@@ -182,6 +185,11 @@ export function registerRunCommand(exec) {
|
|
|
182
185
|
process.exitCode = 1;
|
|
183
186
|
return;
|
|
184
187
|
}
|
|
188
|
+
if (opts.onRateLimit && !["stop", "wait", "fallback"].includes(opts.onRateLimit)) {
|
|
189
|
+
process.stdout.write('--on-rate-limit must be "stop", "wait", or "fallback".\n');
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
185
193
|
if (opts.worktree && !hasTask && !hasRegister && !hasJob) {
|
|
186
194
|
process.stdout.write("--worktree requires --task, --register, or --job.\n");
|
|
187
195
|
process.exitCode = 1;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
|
-
import { resolveMemberCommand, } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import { resolveMemberCommand, } from "../agent-config.js";
|
|
4
|
+
import { resolveAgentMember, } from "../../shared/specdojo-config.js";
|
|
5
|
+
import { buildInPlaceStem } from "../plans.js";
|
|
6
|
+
import { generateRegisterPlan, normalizePjrId, requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, selectRegisterCommitPaths, selectRegisterRunArtifactResidue, ticketPathFromItem, } from "../register.js";
|
|
7
|
+
import { registerEventFilePath } from "../../register/events.js";
|
|
8
|
+
import { displayIdFromTicketFilename } from "../../register/item.js";
|
|
9
|
+
import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult, updateResultStatus, } from "../results.js";
|
|
10
|
+
import { formatGitResultFailure, gitOutput, gitResult } from "../worktree.js";
|
|
11
|
+
import { stabilizeCommitTargets, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
12
|
+
import { resolveAgentOverride, resolvePinnedRateLimitRunOptions, rateLimitRecoveryReason, selectCandidates, } from "./shared.js";
|
|
13
|
+
import { expandPromptRefs } from "./agent.js";
|
|
14
|
+
import { runAgentPipeline } from "./agent-pipeline.js";
|
|
15
|
+
import { spawnAgentInPlace } from "./in-place.js";
|
|
16
|
+
import { commitSubject, repoRelativePath, spawnSelf } from "./mode-shared.js";
|
|
16
17
|
// --register の単一 agent 実行(--by 指定時)の agent を解決する。owner(Role code)や
|
|
17
18
|
// role からの自動選択は行わない(PJR-ADZ6)。agent は全員 stage_role を持つ pipeline
|
|
18
19
|
// メンバーであり、owner・role から選ぶと pipeline 用でない agent(翻訳専用など)や
|
|
@@ -24,11 +25,11 @@ export function resolveRegisterCommand(item, roster, opts, execDefaults = {}) {
|
|
|
24
25
|
throw new Error(`No agent specified for register item ${item.id} (owner: ${item.owner || "-"}). ` +
|
|
25
26
|
"Specify --by <nickname>, or --executor-by <nickname> --reporter-by <nickname>.");
|
|
26
27
|
}
|
|
27
|
-
const member = roster
|
|
28
|
+
const member = resolveAgentMember(roster, by);
|
|
28
29
|
const command = member ? resolveMemberCommand(execDefaults, member) : undefined;
|
|
29
|
-
if (!command)
|
|
30
|
+
if (!member || !command)
|
|
30
31
|
throw new Error(`Agent command not found for actor: ${by}`);
|
|
31
|
-
return { command, actor:
|
|
32
|
+
return { command, actor: member.nickname };
|
|
32
33
|
}
|
|
33
34
|
// --register を executor/reporter パイプラインで実行するかを判定する。--executor-by /
|
|
34
35
|
// --reporter-by の指定があれば pipeline、どちらも無く --by も無い場合も stage_role からの
|
|
@@ -163,11 +164,13 @@ export function commitRegisterItemChanges(repoRoot, item, preexisting, runnerMan
|
|
|
163
164
|
return { committed: false };
|
|
164
165
|
try {
|
|
165
166
|
stageCommitTargets(repoRoot, paths);
|
|
166
|
-
const
|
|
167
|
+
const stagedArgs = ["diff", "--cached", "--quiet", "--", ...paths];
|
|
168
|
+
const staged = gitResult(repoRoot, stagedArgs);
|
|
167
169
|
if (staged.status === 0)
|
|
168
170
|
return { committed: false };
|
|
169
|
-
if (staged.status !== 1)
|
|
170
|
-
throw new Error(
|
|
171
|
+
if (staged.status !== 1) {
|
|
172
|
+
throw new Error(`Failed to inspect staged register changes: ${formatGitResultFailure(stagedArgs, staged)}`);
|
|
173
|
+
}
|
|
171
174
|
const subject = commitSubject(`exec(register ${item.id}): `, item.title);
|
|
172
175
|
gitOutput(repoRoot, ["commit", "-m", subject, "--", ...paths]);
|
|
173
176
|
stabilizeCommitTargets(repoRoot, remainingPaths);
|
|
@@ -245,6 +248,10 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
245
248
|
const { planPath } = await generateRegisterPlan({
|
|
246
249
|
executionPath,
|
|
247
250
|
projectId,
|
|
251
|
+
...(context.catalogPath ? { catalogPath: context.catalogPath } : {}),
|
|
252
|
+
...(context.rolesPath ? { rolesPath: context.rolesPath } : {}),
|
|
253
|
+
...(context.viewpointsPath ? { viewpointsPath: context.viewpointsPath } : {}),
|
|
254
|
+
...(context.projectContext ? { projectContext: context.projectContext } : {}),
|
|
248
255
|
registerPaths,
|
|
249
256
|
item,
|
|
250
257
|
stem,
|
|
@@ -260,6 +267,7 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
260
267
|
agent: actor,
|
|
261
268
|
startedAt: new Date().toISOString(),
|
|
262
269
|
stem,
|
|
270
|
+
...(item.approach ? { approach: item.approach } : {}),
|
|
263
271
|
...(item.targets && item.targets.length > 0 ? { targets: item.targets } : {}),
|
|
264
272
|
});
|
|
265
273
|
const resultScaffold = readResultFrontmatterSnapshot(resultPath);
|
|
@@ -273,6 +281,7 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
273
281
|
}
|
|
274
282
|
let exitCode;
|
|
275
283
|
let pipelineBlockReason;
|
|
284
|
+
let transitionReason;
|
|
276
285
|
if (pipelineAgents) {
|
|
277
286
|
process.stdout.write(`Running ${item.id} in place (executor/reporter pipeline)\n`);
|
|
278
287
|
const pipelineOutcome = await runAgentPipeline({
|
|
@@ -289,9 +298,16 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
289
298
|
registerPaths: registerReporterManagedPaths(registerPaths),
|
|
290
299
|
execDefaults: context.execDefaults,
|
|
291
300
|
providerConcurrencyGate: context.providerConcurrencyGate,
|
|
301
|
+
executorRateLimitOptions: opts.executorBy
|
|
302
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "executor", pipelineAgents.executor)
|
|
303
|
+
: undefined,
|
|
304
|
+
reporterRateLimitOptions: opts.reporterBy
|
|
305
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "reporter", pipelineAgents.reporterCandidates[0])
|
|
306
|
+
: undefined,
|
|
292
307
|
});
|
|
293
308
|
exitCode = pipelineOutcome.exitCode;
|
|
294
309
|
pipelineBlockReason = pipelineOutcome.blockReason;
|
|
310
|
+
transitionReason = rateLimitRecoveryReason(pipelineOutcome.rateLimitEvents) || undefined;
|
|
295
311
|
if (pipelineOutcome.exitCode !== 0) {
|
|
296
312
|
process.stdout.write(`run blocked: ${item.id} (${pipelineOutcome.blockReason ?? "pipeline failed"})\n`);
|
|
297
313
|
}
|
|
@@ -316,7 +332,14 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
316
332
|
if (effectiveExit === 0) {
|
|
317
333
|
let transition = "review";
|
|
318
334
|
let reason;
|
|
319
|
-
if (!spawnRegisterTransition(projectId, [
|
|
335
|
+
if (!spawnRegisterTransition(projectId, [
|
|
336
|
+
"review",
|
|
337
|
+
"--id",
|
|
338
|
+
item.id,
|
|
339
|
+
"--by",
|
|
340
|
+
actor,
|
|
341
|
+
...(transitionReason ? ["--reason", transitionReason] : []),
|
|
342
|
+
])) {
|
|
320
343
|
process.stderr.write(`register review transition failed: ${item.id}\n`);
|
|
321
344
|
transition = "none";
|
|
322
345
|
reason = "register review transition failed";
|
|
@@ -362,7 +385,9 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
362
385
|
process.stdout.write(`run done: ${item.id} (status: review — confirm and close with "register close")\n`);
|
|
363
386
|
return { id: item.id, title: item.title, outcome: "success", transition, commit, reason };
|
|
364
387
|
}
|
|
365
|
-
const waitingReason = sanitizeRegisterConclusion(blockReason ?? `agent exited with non-zero code (exit ${exitCode})
|
|
388
|
+
const waitingReason = sanitizeRegisterConclusion([blockReason ?? `agent exited with non-zero code (exit ${exitCode})`, transitionReason]
|
|
389
|
+
.filter(Boolean)
|
|
390
|
+
.join("; "));
|
|
366
391
|
if (!spawnRegisterTransition(projectId, [
|
|
367
392
|
"wait",
|
|
368
393
|
"--id",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { loadExecDefaultsConfig, ProviderConcurrencyGate } from "
|
|
3
|
-
import { activateResolvedProjectPaths, resolveProjectPaths } from "
|
|
4
|
-
import { qualifyTaskId } from "
|
|
5
|
-
import { specdojoRootDir } from "
|
|
6
|
-
import { execLifecyclePoolPath, execLocksDir } from "./
|
|
7
|
-
import { CrossProcessMutex } from "
|
|
8
|
-
import { buildInPlaceStem } from "
|
|
9
|
-
import { formatRegisterRunSummary, parseRegisterIds, parseRegisterSelectionFilter, registerRunExitCode, requireRunnableRegisterItem, resolveRegisterRunTarget, selectRegisterItems, } from "
|
|
10
|
-
import { loadRegisterItems, resolveRegisterPaths } from "
|
|
11
|
-
import { findExecWorktree, resolveWorktreeBase } from "
|
|
12
|
-
import { findResumableRegisterRun } from "
|
|
13
|
-
import { configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./
|
|
14
|
-
import { loadRosterForExecutionPath } from "./
|
|
15
|
-
import { resolveRegisterCommand, isRegisterPipelineRequested, parseRegisterExecutorSelection, selectedRegisterExecutor, resolveRegisterPipelineCommand, runSingleRegisterItem, } from "./
|
|
16
|
-
import { runSingleRegisterItemWorktree } from "./
|
|
17
|
-
import { resumeSingleRegisterItemWorktree } from "./
|
|
2
|
+
import { loadExecDefaultsConfig, ProviderConcurrencyGate } from "../agent-config.js";
|
|
3
|
+
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
4
|
+
import { qualifyTaskId } from "../shared.js";
|
|
5
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
6
|
+
import { execLifecyclePoolPath, execLocksDir } from "./lock.js";
|
|
7
|
+
import { CrossProcessMutex } from "../slot-lock.js";
|
|
8
|
+
import { buildInPlaceStem } from "../plans.js";
|
|
9
|
+
import { formatRegisterRunSummary, parseRegisterIds, parseRegisterSelectionFilter, registerRunExitCode, requireRunnableRegisterItem, resolveRegisterRunTarget, selectRegisterItems, } from "../register.js";
|
|
10
|
+
import { loadRegisterItems, resolveRegisterPaths } from "../../register/register.js";
|
|
11
|
+
import { findExecWorktree, resolveWorktreeBase } from "../worktree.js";
|
|
12
|
+
import { findResumableRegisterRun } from "../register-resume.js";
|
|
13
|
+
import { configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./shared.js";
|
|
14
|
+
import { loadRosterForExecutionPath } from "./agent.js";
|
|
15
|
+
import { resolveRegisterCommand, isRegisterPipelineRequested, parseRegisterExecutorSelection, selectedRegisterExecutor, resolveRegisterPipelineCommand, runSingleRegisterItem, } from "./register-core.js";
|
|
16
|
+
import { runSingleRegisterItemWorktree } from "./register-worktree.js";
|
|
17
|
+
import { resumeSingleRegisterItemWorktree } from "./register-resume.js";
|
|
18
18
|
// register 項目の実行(複数ID)。in-place モードは指定順に1件ずつ直列実行し、各IDが plan/result
|
|
19
19
|
// 生成・start・agent実行・review/waiting 遷移まで完結してから次へ進む。worktree モードは成果物を
|
|
20
20
|
// worktree に隔離し、状態遷移を root で直列化する(--parallel で並列化可能)。失敗時は
|
|
@@ -130,6 +130,10 @@ export async function runRegisterMode(opts) {
|
|
|
130
130
|
projectId,
|
|
131
131
|
schedulePath,
|
|
132
132
|
executionPath,
|
|
133
|
+
...(resolvedPaths.catalogPath ? { catalogPath: resolvedPaths.catalogPath } : {}),
|
|
134
|
+
...(resolvedPaths.rolesPath ? { rolesPath: resolvedPaths.rolesPath } : {}),
|
|
135
|
+
...(resolvedPaths.viewpointsPath ? { viewpointsPath: resolvedPaths.viewpointsPath } : {}),
|
|
136
|
+
...(resolvedPaths.projectContext ? { projectContext: resolvedPaths.projectContext } : {}),
|
|
133
137
|
repoRoot,
|
|
134
138
|
roster,
|
|
135
139
|
execDefaults,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { qualifyTaskId } from "
|
|
4
|
-
import { requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, ticketPathFromItem, } from "
|
|
5
|
-
import { readResultFrontmatterSnapshot } from "
|
|
6
|
-
import { findExecWorktree } from "
|
|
7
|
-
import { configuredProductRepos, missingProductWorktrees, withProductWorktrees, } from "
|
|
8
|
-
import { currentBranch, isExecBranchMergedIntoCurrent } from "
|
|
9
|
-
import { syncTaskWorktreesWithIntegrationTargets, } from "
|
|
10
|
-
import { failedParentValidationReason } from "
|
|
11
|
-
import { findResumableRegisterRun, resolveRegisterResumeArtifacts, } from "
|
|
12
|
-
import { integratedRepoNames } from "
|
|
13
|
-
import { resolveAgentOverride, } from "./
|
|
14
|
-
import { expandPromptRefs } from "./
|
|
15
|
-
import { refreshParentValidationsForReporterResume, runAgentPipeline, runReporterStage, } from "./
|
|
16
|
-
import { repoRelativePath } from "./
|
|
17
|
-
import { spawnRegisterTransition, registerReporterManagedPaths, } from "./
|
|
18
|
-
import { copyRepoPaths, registerTransitionPaths, registerBookkeepingPaths, rebuildRootRegisterViews, } from "./
|
|
19
|
-
import { finalizeRegisterWorktreeRun } from "./
|
|
3
|
+
import { qualifyTaskId } from "../shared.js";
|
|
4
|
+
import { requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, ticketPathFromItem, } from "../register.js";
|
|
5
|
+
import { readResultFrontmatterSnapshot } from "../results.js";
|
|
6
|
+
import { findExecWorktree } from "../worktree.js";
|
|
7
|
+
import { configuredProductRepos, missingProductWorktrees, withProductWorktrees, } from "../task-repos.js";
|
|
8
|
+
import { currentBranch, isExecBranchMergedIntoCurrent } from "../worktree-ops.js";
|
|
9
|
+
import { syncTaskWorktreesWithIntegrationTargets, } from "../repo-integration.js";
|
|
10
|
+
import { failedParentValidationReason } from "../parent-validation.js";
|
|
11
|
+
import { findResumableRegisterRun, resolveRegisterResumeArtifacts, } from "../register-resume.js";
|
|
12
|
+
import { integratedRepoNames } from "../pipeline-state.js";
|
|
13
|
+
import { resolveAgentOverride, resolvePinnedRateLimitRunOptions, rateLimitRecoveryReason, } from "./shared.js";
|
|
14
|
+
import { expandPromptRefs } from "./agent.js";
|
|
15
|
+
import { refreshParentValidationsForReporterResume, runAgentPipeline, runReporterStage, } from "./agent-pipeline.js";
|
|
16
|
+
import { repoRelativePath } from "./mode-shared.js";
|
|
17
|
+
import { spawnRegisterTransition, registerReporterManagedPaths, } from "./register-core.js";
|
|
18
|
+
import { copyRepoPaths, registerTransitionPaths, registerBookkeepingPaths, rebuildRootRegisterViews, } from "./register-state.js";
|
|
19
|
+
import { finalizeRegisterWorktreeRun } from "./register-worktree.js";
|
|
20
20
|
// reporter 再開に使う agent を解決する。--reporter-by を優先し、省略時は再開対象 run の
|
|
21
21
|
// pipeline-state に記録された reporter actor(通常は前回と同じ agent)へフォールバックする。
|
|
22
22
|
export function resolveRegisterResumeReporter(roster, opts, execDefaults, recordedActor) {
|
|
@@ -321,6 +321,8 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
|
|
|
321
321
|
resumeHandoff: target.handoff,
|
|
322
322
|
providerConcurrencyGate: context.providerConcurrencyGate,
|
|
323
323
|
productWorktrees: worktree.repos,
|
|
324
|
+
executorRateLimitOptions: resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "executor", executor.candidate),
|
|
325
|
+
reporterRateLimitOptions: resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "reporter", reporter.candidate),
|
|
324
326
|
});
|
|
325
327
|
const finalize = async () => finalizeRegisterWorktreeRun({
|
|
326
328
|
context,
|
|
@@ -336,6 +338,7 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
|
|
|
336
338
|
actor: executor.candidate.actor,
|
|
337
339
|
bookkeepingPaths: bookkeepingPaths(),
|
|
338
340
|
pipelineStatePath: resolve(worktree.path, outcome.stateRef),
|
|
341
|
+
transitionReason: rateLimitRecoveryReason(outcome.rateLimitEvents) || undefined,
|
|
339
342
|
});
|
|
340
343
|
return lifecycleLock ? lifecycleLock.runExclusive(finalize) : finalize();
|
|
341
344
|
}
|
|
@@ -372,6 +375,7 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
|
|
|
372
375
|
state: target.state,
|
|
373
376
|
statePath: target.statePath,
|
|
374
377
|
providerConcurrencyGate: context.providerConcurrencyGate,
|
|
378
|
+
rateLimitOptions: resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "reporter", reporter.candidate),
|
|
375
379
|
productWorktrees: worktree.repos,
|
|
376
380
|
});
|
|
377
381
|
const finalize = async () => finalizeRegisterWorktreeRun({
|
|
@@ -388,6 +392,7 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
|
|
|
388
392
|
actor: reporter.candidate.actor,
|
|
389
393
|
bookkeepingPaths: bookkeepingPaths(),
|
|
390
394
|
pipelineStatePath: target.statePath,
|
|
395
|
+
transitionReason: rateLimitRecoveryReason(outcome.state.stages.reporter.rate_limit_events ?? []) || undefined,
|
|
391
396
|
});
|
|
392
397
|
return lifecycleLock ? lifecycleLock.runExclusive(finalize) : finalize();
|
|
393
398
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, resolve } from "node:path";
|
|
3
|
-
import { sanitizeRegisterConclusion, } from "
|
|
4
|
-
import { applyRegisterItemFields, CELL_NONE, readRegisterItemContent, registerItemFieldsFromItem, } from "
|
|
5
|
-
import { appendGitFailureLog, gitOutput, gitResult, summarizeGitHookFailure, } from "
|
|
6
|
-
import { abortMerge, currentBranch, normalizeResultWhitespace, releaseRootWorkingCopies, stabilizeCommitTargets, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "
|
|
7
|
-
import { pathInsideWorktree } from "./
|
|
8
|
-
import { repoRelativePath } from "./
|
|
9
|
-
import { spawnRegisterTransition, registerEventPathForTicket, registerRunnerManagedPaths, } from "./
|
|
3
|
+
import { sanitizeRegisterConclusion, } from "../register.js";
|
|
4
|
+
import { applyRegisterItemFields, CELL_NONE, readRegisterItemContent, registerItemFieldsFromItem, } from "../../register/item.js";
|
|
5
|
+
import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitOutput, gitResult, summarizeGitHookFailure, } from "../worktree.js";
|
|
6
|
+
import { abortMerge, currentBranch, normalizeResultWhitespace, releaseRootWorkingCopies, stabilizeCommitTargets, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
7
|
+
import { pathInsideWorktree } from "./agent.js";
|
|
8
|
+
import { repoRelativePath } from "./mode-shared.js";
|
|
9
|
+
import { spawnRegisterTransition, registerEventPathForTicket, registerRunnerManagedPaths, } from "./register-core.js";
|
|
10
10
|
// register の状態遷移(start/review/wait)が変更した調整状態(pjr-index と派生ビュー)だけを
|
|
11
11
|
// 抽出する。worktree モードでは成功時の遷移を exec branch、失敗時の wait を root で commit
|
|
12
12
|
// する。plan/result は checkpoint と worktree merge が扱うため、ここでは含めない。
|
|
@@ -42,11 +42,14 @@ export function commitRegisterState(repoRoot, registerPaths, message, ticketPath
|
|
|
42
42
|
const remainingPaths = () => registerStatePaths(repoRoot, registerPaths, ticketPath);
|
|
43
43
|
try {
|
|
44
44
|
stageCommitTargets(repoRoot, paths);
|
|
45
|
-
const
|
|
45
|
+
const stagedArgs = ["diff", "--cached", "--quiet", "--", ...paths];
|
|
46
|
+
const staged = gitResult(repoRoot, stagedArgs);
|
|
46
47
|
if (staged.status === 0)
|
|
47
48
|
return;
|
|
48
|
-
if (staged.status !== 1)
|
|
49
|
-
|
|
49
|
+
if (staged.status !== 1) {
|
|
50
|
+
appendGitResultFailureLog(failureLogPath, "git diff register-state inspection", staged);
|
|
51
|
+
throw new Error(`Failed to inspect staged register-state changes: ${formatGitResultFailure(stagedArgs, staged)}`);
|
|
52
|
+
}
|
|
50
53
|
const commit = gitResult(repoRoot, ["commit", "-m", message, "--", ...paths]);
|
|
51
54
|
if (commit.status !== 0) {
|
|
52
55
|
const output = [commit.stdout, commit.stderr]
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { qualifyTaskId, randomHex } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
3
|
+
import { qualifyTaskId, randomHex } from "../shared.js";
|
|
4
|
+
import { resolveAgentMember } from "../../shared/specdojo-config.js";
|
|
5
|
+
import { buildInPlaceStem } from "../plans.js";
|
|
6
|
+
import { generateRegisterPlan, requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, ticketPathFromItem, } from "../register.js";
|
|
7
|
+
import { readResultFrontmatterSnapshot, scaffoldResult, updateResultStatus } from "../results.js";
|
|
8
|
+
import { findExecWorktree, gitOutput } from "../worktree.js";
|
|
9
|
+
import { configuredProductRepos, withProductRepoPrompt } from "../task-repos.js";
|
|
10
|
+
import { checkpointAndEnsureWorktree, commitTargetPaths, commitWorktreeChanges, discardStaleExecWorktree, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
11
|
+
import { commitProductWorktrees, integrateTaskRepositories, projectMergeBlockers, PROJECT_REPO_NAME, RepoIntegrationError, } from "../repo-integration.js";
|
|
12
|
+
import { productIntegrationTrace, recordResultTrace, refsTrailer, registerProjectMergeMessage, traceKey, withCommitTrailers, } from "../repo-trace.js";
|
|
13
|
+
import { pipelineStateLocation, readPipelineState } from "../pipeline-state.js";
|
|
14
|
+
import { findResumableRegisterRun } from "../register-resume.js";
|
|
15
|
+
import { resolvePinnedRateLimitRunOptions, rateLimitRecoveryReason, } from "./shared.js";
|
|
16
|
+
import { agentEnvironment, expandPromptRefs, extractBlockReason, pathInsideWorktree, reportProductWorktrees, runWithRetry, } from "./agent.js";
|
|
17
|
+
import { runAgentPipeline } from "./agent-pipeline.js";
|
|
18
|
+
import { downgradeUnfilledResult } from "./schedule-prepare.js";
|
|
19
|
+
import { commitSubject, integrateLogPath, recordIntegrateStage, recordRepoIntegration, repoRelativePath, } from "./mode-shared.js";
|
|
20
|
+
import { resolveRegisterCommand, isRegisterPipelineRequested, resolveRegisterPipelineCommand, spawnRegisterTransition, registerRunnerManagedPaths, registerReporterManagedPaths, } from "./register-core.js";
|
|
21
|
+
import { commitRegisterState, registerPathsInsideWorktree, rebuildRootRegisterViews, registerWaitSummary, } from "./register-state.js";
|
|
20
22
|
// 全体再実行が既存 run の未統合成果を破棄しないための保護。既存 worktree に再開可能な run
|
|
21
23
|
// (executor 成功済みで reporter か統合が未完了)が残っている場合だけ理由を返し、呼び出し側が
|
|
22
24
|
// 破壊的操作(discardStaleExecWorktree)の手前で中断できるようにする。--force-restart で無効化できる。
|
|
@@ -212,7 +214,14 @@ export async function finalizeRegisterWorktreeRun(params) {
|
|
|
212
214
|
beforeProjectMerge: () => {
|
|
213
215
|
// review は exec branch 側(worktree)で記録し、最後の project merge commit に
|
|
214
216
|
// 同梱する。統合ブランチで遷移すると first-parent に独立した commit が増える。
|
|
215
|
-
if (!spawnRegisterTransition(projectId, [
|
|
217
|
+
if (!spawnRegisterTransition(projectId, [
|
|
218
|
+
"review",
|
|
219
|
+
"--id",
|
|
220
|
+
item.id,
|
|
221
|
+
"--by",
|
|
222
|
+
actor,
|
|
223
|
+
...(params.transitionReason ? ["--reason", params.transitionReason] : []),
|
|
224
|
+
], worktree.path)) {
|
|
216
225
|
throw new Error(`register review transition failed: ${item.id}`);
|
|
217
226
|
}
|
|
218
227
|
// プロダクトの統合後・プロジェクトの統合前に、統合先の commit snapshot を result の
|
|
@@ -303,13 +312,14 @@ export async function finalizeRegisterWorktreeRun(params) {
|
|
|
303
312
|
};
|
|
304
313
|
}
|
|
305
314
|
// 失敗 / rate limit: worktree は保持し(調査・再開のため)、waiting へ遷移する。
|
|
306
|
-
const
|
|
315
|
+
const baseReason = params.runnerBlockReason
|
|
307
316
|
? params.runnerBlockReason
|
|
308
317
|
: unfilledBlock
|
|
309
318
|
? "agent exited 0 but result is incomplete or its frontmatter differs from the scaffold (treated as blocked)"
|
|
310
319
|
: agentResult === "rate_limit"
|
|
311
320
|
? "rate limit reached"
|
|
312
321
|
: extractBlockReason(params.stderr);
|
|
322
|
+
const reason = [baseReason, params.transitionReason].filter(Boolean).join("; ");
|
|
313
323
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, sanitizeRegisterConclusion(reason));
|
|
314
324
|
process.stdout.write(`run failed: ${item.id} (status: waiting; worktree kept: ${worktree.path})\n`);
|
|
315
325
|
return waitSummary(reason);
|
|
@@ -341,8 +351,7 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
341
351
|
...resolveRegisterCommand(item, context.roster, opts, context.execDefaults),
|
|
342
352
|
provider: undefined,
|
|
343
353
|
};
|
|
344
|
-
const resolvedProvider = provider ??
|
|
345
|
-
context.roster?.members.find((m) => m.nickname === actor && m.type === "agent")?.provider;
|
|
354
|
+
const resolvedProvider = provider ?? resolveAgentMember(context.roster, actor)?.provider;
|
|
346
355
|
const stem = buildInPlaceStem(pjrId.toLowerCase());
|
|
347
356
|
const worktreeTaskId = qualifyTaskId(projectId, item.id);
|
|
348
357
|
const pipelineRunId = pipelineAgents
|
|
@@ -373,6 +382,10 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
373
382
|
const { planPath } = await generateRegisterPlan({
|
|
374
383
|
executionPath,
|
|
375
384
|
projectId,
|
|
385
|
+
...(context.catalogPath ? { catalogPath: context.catalogPath } : {}),
|
|
386
|
+
...(context.rolesPath ? { rolesPath: context.rolesPath } : {}),
|
|
387
|
+
...(context.viewpointsPath ? { viewpointsPath: context.viewpointsPath } : {}),
|
|
388
|
+
...(context.projectContext ? { projectContext: context.projectContext } : {}),
|
|
376
389
|
registerPaths,
|
|
377
390
|
item,
|
|
378
391
|
stem,
|
|
@@ -388,6 +401,8 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
388
401
|
agent: actor,
|
|
389
402
|
startedAt: new Date().toISOString(),
|
|
390
403
|
stem,
|
|
404
|
+
...(item.approach ? { approach: item.approach } : {}),
|
|
405
|
+
...(item.targets && item.targets.length > 0 ? { targets: item.targets } : {}),
|
|
391
406
|
});
|
|
392
407
|
const resultScaffold = readResultFrontmatterSnapshot(resultPath);
|
|
393
408
|
process.stdout.write(`Register item: ${item.id} — ${item.title} [${item.type}]\n`);
|
|
@@ -459,6 +474,8 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
459
474
|
let stderr = "";
|
|
460
475
|
// pipeline 実行のみ run state を持つ。統合段の記録先として Phase 3 へ渡す。
|
|
461
476
|
let pipelineStatePath;
|
|
477
|
+
let transitionReason;
|
|
478
|
+
let completionActor = actor;
|
|
462
479
|
if (pipelineAgents) {
|
|
463
480
|
process.stdout.write(`Running ${item.id} in worktree (executor/reporter pipeline)\n CWD: ${worktree.path}\n`);
|
|
464
481
|
const worktreeResultPathForPipeline = pathInsideWorktree(repoRoot, worktree.path, resultPath);
|
|
@@ -478,16 +495,29 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
478
495
|
providerConcurrencyGate: context.providerConcurrencyGate,
|
|
479
496
|
productWorktrees: worktree.repos,
|
|
480
497
|
runId: pipelineRunId,
|
|
498
|
+
executorRateLimitOptions: opts.executorBy
|
|
499
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "executor", pipelineAgents.executor)
|
|
500
|
+
: undefined,
|
|
501
|
+
reporterRateLimitOptions: opts.reporterBy
|
|
502
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "reporter", pipelineAgents.reporterCandidates[0])
|
|
503
|
+
: undefined,
|
|
481
504
|
});
|
|
482
505
|
agentResult = pipelineOutcome.runResult;
|
|
483
506
|
stderr = pipelineOutcome.blockReason ?? "";
|
|
484
507
|
pipelineStatePath = resolve(worktree.path, pipelineOutcome.stateRef);
|
|
508
|
+
transitionReason = rateLimitRecoveryReason(pipelineOutcome.rateLimitEvents) || undefined;
|
|
485
509
|
}
|
|
486
510
|
else {
|
|
487
511
|
process.stdout.write(`Running ${item.id} in worktree: ${command}\n CWD: ${worktree.path}\n`);
|
|
488
|
-
const outcome = await runWithRetry([{ command, actor, provider: resolvedProvider }], withProductRepoPrompt(prompt, worktree.repos), context.execDefaults, worktree.path, env, pathInsideWorktree(repoRoot, worktree.path, resultPath)
|
|
512
|
+
const outcome = await runWithRetry([{ command, actor, provider: resolvedProvider }], withProductRepoPrompt(prompt, worktree.repos), context.execDefaults, worktree.path, env, pathInsideWorktree(repoRoot, worktree.path, resultPath), resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "executor", {
|
|
513
|
+
command,
|
|
514
|
+
actor,
|
|
515
|
+
provider: resolvedProvider,
|
|
516
|
+
}));
|
|
489
517
|
agentResult = outcome.result;
|
|
490
518
|
stderr = outcome.stderr;
|
|
519
|
+
completionActor = outcome.actor ?? actor;
|
|
520
|
+
transitionReason = rateLimitRecoveryReason(outcome.rateLimitEvents) || undefined;
|
|
491
521
|
}
|
|
492
522
|
// Phase 3: 成果物統合と状態遷移(root で直列化)。通常実行と再開経路で共通化する。
|
|
493
523
|
const finalize = async () => finalizeRegisterWorktreeRun({
|
|
@@ -501,9 +531,10 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
501
531
|
resultScaffold,
|
|
502
532
|
agentResult,
|
|
503
533
|
stderr,
|
|
504
|
-
actor,
|
|
534
|
+
actor: completionActor,
|
|
505
535
|
bookkeepingPaths,
|
|
506
536
|
pipelineStatePath,
|
|
537
|
+
transitionReason,
|
|
507
538
|
});
|
|
508
539
|
return lifecycleLock ? lifecycleLock.runExclusive(finalize) : finalize();
|
|
509
540
|
}
|