@bonesofspring/ai-rules 0.2.64 → 0.2.66
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 +80 -11
- package/README.md +24 -16
- package/bin/lib/engine-scripts.js +52 -12
- package/bin/lib/engine-upgrade.js +5 -2
- package/bin/lib/seed-ai-local-team.js +13 -3
- package/docs/OPENCODE.md +17 -9
- package/docs/PRESET-CONTRIBUTION.md +41 -0
- package/docs/TEAM-DB.md +240 -60
- package/docs/TOKEN-ECONOMY.md +79 -0
- package/docs/openapi/team-db.v1.json +1238 -377
- package/mcp/defectdojo-mcp.mjs +7 -5
- package/mcp/lib/defectdojo.mjs +26 -14
- package/package.json +31 -20
- package/presets/_shared/ai-local/scripts/dump-output.mjs +371 -0
- package/presets/_shared/ai-local/scripts/process-lease.mjs +576 -0
- package/presets/_shared/ai-local/scripts/processes.mjs +1618 -0
- package/presets/_shared/ai-local/scripts/run.mjs +5 -5
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +465 -152
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +416 -176
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +171 -62
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +4 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +143 -5
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
- package/presets/_shared/ai-local/scripts/{team-db-backlog.mjs → team-db-tracker.mjs} +900 -197
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +184 -23
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +4 -2
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +4 -0
- package/presets/_shared/core/quality/context-and-iteration.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +105 -17
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/android-kotlin/settings.json +6 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/go/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/go/settings.json +6 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/ios-swift/settings.json +6 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/java/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/java/settings.json +6 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mcp-ts/settings.json +6 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mol/settings.json +6 -1
- package/presets/claude/next/MCP.md +2 -0
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/ci-investigator.md +3 -0
- package/presets/claude/next/agents/debugger.md +3 -0
- package/presets/claude/next/agents/feature-developer.md +3 -0
- package/presets/claude/next/agents/mockup-reviewer.md +2 -0
- package/presets/claude/next/agents/performance-auditor.md +2 -0
- package/presets/claude/next/agents/playwright-test-generator.md +3 -0
- package/presets/claude/next/agents/playwright-test-healer.md +3 -0
- package/presets/claude/next/agents/playwright-test-planner.md +3 -0
- package/presets/claude/next/agents/qa-tester.md +3 -0
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/commands/README.md +7 -1
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/commands/ui-start.md +78 -0
- package/presets/claude/next/commands/ui-stop.md +71 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/next/rules/stack/next-app-core.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/next/rules/tooling-and-review/dev-process-lifecycle.md +43 -0
- package/presets/claude/next/settings.json +6 -1
- package/presets/claude/next/team/README.md +7 -3
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/nuxt/settings.json +6 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-hexagonal/settings.json +6 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-laravel/settings.json +6 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/svelte/settings.json +6 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/MCP.md +2 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/ci-investigator.md +2 -0
- package/presets/cursor/next/agents/debugger.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +2 -0
- package/presets/cursor/next/agents/mockup-reviewer.md +2 -0
- package/presets/cursor/next/agents/performance-auditor.md +2 -0
- package/presets/cursor/next/agents/playwright-test-generator.md +2 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +2 -0
- package/presets/cursor/next/agents/playwright-test-planner.md +2 -0
- package/presets/cursor/next/agents/qa-tester.md +2 -0
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/cursor/next/commands/README.md +7 -1
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/commands/ui-start.md +78 -0
- package/presets/cursor/next/commands/ui-stop.md +71 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/next/rules/README.md +2 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -1
- package/presets/cursor/next/rules/dev-process-lifecycle.mdc +43 -0
- package/presets/cursor/next/rules/next-app-core.mdc +1 -0
- package/presets/cursor/next/team/README.md +7 -3
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/MCP.md +2 -0
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +33 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/ci-investigator.md +3 -0
- package/presets/mavis/next/agents/debugger.md +3 -0
- package/presets/mavis/next/agents/feature-developer.md +3 -0
- package/presets/mavis/next/agents/mockup-reviewer.md +2 -0
- package/presets/mavis/next/agents/performance-auditor.md +2 -0
- package/presets/mavis/next/agents/playwright-test-generator.md +3 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +3 -0
- package/presets/mavis/next/agents/playwright-test-planner.md +3 -0
- package/presets/mavis/next/agents/qa-tester.md +3 -0
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/mavis/next/commands/README.md +7 -1
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/commands/ui-start.md +73 -0
- package/presets/mavis/next/commands/ui-stop.md +66 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/mavis/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/rules/next-app-core.md +1 -0
- package/presets/mavis/next/team/README.md +7 -3
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/android-kotlin/opencode.json +5 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/go/opencode.json +5 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/ios-swift/opencode.json +5 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/java/opencode.json +5 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mcp-ts/opencode.json +5 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mol/opencode.json +4 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/MCP.md +2 -0
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +33 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +3 -0
- package/presets/opencode/next/agents/debugger.md +3 -0
- package/presets/opencode/next/agents/feature-developer.md +3 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +2 -0
- package/presets/opencode/next/agents/performance-auditor.md +2 -0
- package/presets/opencode/next/agents/playwright-test-generator.md +3 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +3 -0
- package/presets/opencode/next/agents/playwright-test-planner.md +3 -0
- package/presets/opencode/next/agents/qa-tester.md +3 -0
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/opencode/next/commands/README.md +7 -1
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/commands/ui-start.md +81 -0
- package/presets/opencode/next/commands/ui-stop.md +74 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/next/opencode.json +4 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/opencode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/rules/next-app-core.md +1 -0
- package/presets/opencode/next/team/README.md +7 -3
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/nuxt/opencode.json +4 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/php-hexagonal/opencode.json +5 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/opencode/php-laravel/opencode.json +5 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/plugins/task-status/README.md +23 -11
- package/presets/opencode/plugins/task-status/details-data.ts +64 -46
- package/presets/opencode/plugins/task-status/details.tsx +12 -2
- package/presets/opencode/plugins/task-status/format.ts +16 -0
- package/presets/opencode/plugins/task-status/prompt-text.ts +37 -0
- package/presets/opencode/plugins/task-status/task-view.ts +241 -177
- package/presets/opencode/plugins/task-status/tui.tsx +57 -15
- package/presets/opencode/plugins/task-status/types.ts +74 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/svelte/opencode.json +4 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/MCP.md +2 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +33 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/ci-investigator.md +3 -0
- package/presets/zcode/next/agents/debugger.md +3 -0
- package/presets/zcode/next/agents/feature-developer.md +3 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +2 -0
- package/presets/zcode/next/agents/performance-auditor.md +2 -0
- package/presets/zcode/next/agents/playwright-test-generator.md +3 -0
- package/presets/zcode/next/agents/playwright-test-healer.md +3 -0
- package/presets/zcode/next/agents/playwright-test-planner.md +3 -0
- package/presets/zcode/next/agents/qa-tester.md +3 -0
- package/presets/zcode/next/agents/task-analyst.md +1 -1
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/zcode/next/commands/README.md +7 -1
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/commands/ui-start.md +81 -0
- package/presets/zcode/next/commands/ui-stop.md +74 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/zcode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/rules/next-app-core.md +1 -0
- package/presets/zcode/next/team/README.md +7 -3
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +0 -2964
- package/presets/claude/next/commands/upstream-research.md +0 -23
- package/presets/claude/next/team/upstream/config.json +0 -31
- package/presets/claude/next/team/upstream/digest-template.md +0 -55
- package/presets/claude/next/team/upstream/jobs.json +0 -34
- package/presets/claude/next/team/upstream/opencode.json +0 -34
- package/presets/claude/next/team/upstream/projects.json +0 -4
- package/presets/claude/next/team/upstream/prompt.md +0 -77
- package/presets/claude/next/team/upstream/signatures.json +0 -9
- package/presets/cursor/next/commands/upstream-research.md +0 -23
- package/presets/cursor/next/team/upstream/config.json +0 -31
- package/presets/cursor/next/team/upstream/digest-template.md +0 -55
- package/presets/cursor/next/team/upstream/jobs.json +0 -34
- package/presets/cursor/next/team/upstream/opencode.json +0 -34
- package/presets/cursor/next/team/upstream/projects.json +0 -4
- package/presets/cursor/next/team/upstream/prompt.md +0 -77
- package/presets/cursor/next/team/upstream/signatures.json +0 -9
- package/presets/mavis/next/commands/upstream-research.md +0 -18
- package/presets/mavis/next/team/upstream/config.json +0 -31
- package/presets/mavis/next/team/upstream/digest-template.md +0 -55
- package/presets/mavis/next/team/upstream/jobs.json +0 -34
- package/presets/mavis/next/team/upstream/opencode.json +0 -34
- package/presets/mavis/next/team/upstream/projects.json +0 -4
- package/presets/mavis/next/team/upstream/prompt.md +0 -77
- package/presets/mavis/next/team/upstream/signatures.json +0 -9
- package/presets/opencode/next/commands/upstream-research.md +0 -26
- package/presets/opencode/next/team/upstream/config.json +0 -31
- package/presets/opencode/next/team/upstream/digest-template.md +0 -55
- package/presets/opencode/next/team/upstream/jobs.json +0 -34
- package/presets/opencode/next/team/upstream/opencode.json +0 -34
- package/presets/opencode/next/team/upstream/projects.json +0 -4
- package/presets/opencode/next/team/upstream/prompt.md +0 -77
- package/presets/opencode/next/team/upstream/signatures.json +0 -9
- package/presets/zcode/next/commands/upstream-research.md +0 -26
- package/presets/zcode/next/team/upstream/config.json +0 -31
- package/presets/zcode/next/team/upstream/digest-template.md +0 -55
- package/presets/zcode/next/team/upstream/jobs.json +0 -34
- package/presets/zcode/next/team/upstream/opencode.json +0 -34
- package/presets/zcode/next/team/upstream/projects.json +0 -4
- package/presets/zcode/next/team/upstream/prompt.md +0 -77
- package/presets/zcode/next/team/upstream/signatures.json +0 -9
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `node:http` only. The surface is loopback-only by default, sends no CORS
|
|
5
5
|
* header, and reads files through SQLite rows (never through a request path).
|
|
6
|
-
* The
|
|
7
|
-
* delete, the four job writes (create, update, delete, run-now), and the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* The fourteen mutating operations — the idempotent rescan, the confirmed task
|
|
7
|
+
* delete, the four job writes (create, update, delete, run-now), and the eight
|
|
8
|
+
* tracker writes (item create, item update, item delete, enqueue, cancel, task
|
|
9
|
+
* start, task stop, task continue) — each run one bounded child process; the
|
|
10
|
+
* server itself never opens a writable connection and the kill switch stops
|
|
11
|
+
* every mutation before a child is spawned.
|
|
11
12
|
*
|
|
12
13
|
* Every SQL statement in this module is a static string with bound parameters.
|
|
13
14
|
* The only interpolated fragments are the module-level constants `TASK_FILTER`,
|
|
@@ -31,6 +32,7 @@ import {
|
|
|
31
32
|
readSearchMode,
|
|
32
33
|
readUserVersion,
|
|
33
34
|
computeSchemaFingerprint,
|
|
35
|
+
teamRootId,
|
|
34
36
|
} from './team-db-schema.mjs';
|
|
35
37
|
import {
|
|
36
38
|
AGENT_PATTERN,
|
|
@@ -64,11 +66,12 @@ import {
|
|
|
64
66
|
EFFECTIVE_ENTRY_STATUSES,
|
|
65
67
|
EFFECTIVE_ITEM_STATUSES,
|
|
66
68
|
countActiveTasks,
|
|
67
|
-
|
|
69
|
+
deriveTrackerOrdering,
|
|
68
70
|
effectiveEntryStatus,
|
|
71
|
+
effectiveLinkState,
|
|
69
72
|
rankCompare,
|
|
70
|
-
|
|
71
|
-
} from './team-db-
|
|
73
|
+
readTrackerConfig,
|
|
74
|
+
} from './team-db-tracker.mjs';
|
|
72
75
|
|
|
73
76
|
export const DEFAULT_HOST = '127.0.0.1';
|
|
74
77
|
export const DEFAULT_PORT = 4178;
|
|
@@ -85,11 +88,14 @@ export const JOB_BODY_MAX = 65536;
|
|
|
85
88
|
export const JOB_WRITE_CHILD_TIMEOUT_MS = 10000;
|
|
86
89
|
export const JOB_DELETE_CHILD_TIMEOUT_MS = 30000;
|
|
87
90
|
export const JOB_RUN_CHILD_TIMEOUT_MS = 10000;
|
|
88
|
-
export const
|
|
89
|
-
export const
|
|
90
|
-
export const
|
|
91
|
-
export const
|
|
92
|
-
export const
|
|
91
|
+
export const TRACKER_ITEM_BODY_MAX = 16384;
|
|
92
|
+
export const TRACKER_TASK_BODY_MAX = 65536;
|
|
93
|
+
export const TRACKER_TASK_ACTION_BODY_MAX = 1024;
|
|
94
|
+
export const TRACKER_QUEUE_BODY_MAX = 1024;
|
|
95
|
+
export const TRACKER_WRITE_CHILD_TIMEOUT_MS = 10000;
|
|
96
|
+
export const TRACKER_DELETE_CHILD_TIMEOUT_MS = 30000;
|
|
97
|
+
export const TRACKER_DEFAULT_LIMIT = 50;
|
|
98
|
+
export const TRACKER_MAX_LIMIT = 200;
|
|
93
99
|
export const SCHEDULER_HINT = 'start team-db.mjs schedule';
|
|
94
100
|
export const LOOPBACK_HOSTS = ['127.0.0.1', 'localhost', '::1'];
|
|
95
101
|
const CLIENT_HEADERS = {
|
|
@@ -110,8 +116,8 @@ const TASK_STATE_SET = new Set(TASK_STATES);
|
|
|
110
116
|
const PROFILE_SET = new Set(PROFILES);
|
|
111
117
|
const EVENT_TYPE_SET = new Set(EVENT_TYPES);
|
|
112
118
|
const OUTCOME_VALUES = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed', 'skipped']);
|
|
113
|
-
const
|
|
114
|
-
const
|
|
119
|
+
const TRACKER_EFFECTIVE_SET = new Set(EFFECTIVE_ITEM_STATUSES);
|
|
120
|
+
const TRACKER_EFFECTIVE_ENTRY_SET = new Set(EFFECTIVE_ENTRY_STATUSES);
|
|
115
121
|
const CODE_STATUS_ROWS = [
|
|
116
122
|
['E_BAD_REQUEST', 400],
|
|
117
123
|
['E_FORBIDDEN_HOST', 403],
|
|
@@ -332,20 +338,27 @@ const SQL = {
|
|
|
332
338
|
SELECT DISTINCT slug FROM tasks
|
|
333
339
|
WHERE slug LIKE ?1 ESCAPE '\\' OR title LIKE ?1 ESCAPE '\\'
|
|
334
340
|
LIMIT ?2`,
|
|
335
|
-
// The
|
|
341
|
+
// The tracker read plane: projected rows only, a broken row (parse_error)
|
|
336
342
|
// is recorded in the projection but never served, mirroring the CLI path
|
|
337
343
|
// which records the error and drops the record from the snapshot.
|
|
338
|
-
|
|
344
|
+
listTrackerItems: `SELECT * FROM tracker_items
|
|
339
345
|
WHERE absent_at IS NULL AND parse_error IS NULL ORDER BY id`,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
346
|
+
getTrackerItem: 'SELECT * FROM tracker_items WHERE id = ?1 AND absent_at IS NULL AND parse_error IS NULL',
|
|
347
|
+
listTrackerDeps: 'SELECT item_id, dep_id FROM tracker_item_deps ORDER BY item_id, ordinal',
|
|
348
|
+
listTrackerEntries: `SELECT * FROM tracker_queue
|
|
343
349
|
WHERE absent_at IS NULL AND parse_error IS NULL ORDER BY entry_id`,
|
|
344
|
-
|
|
345
|
-
|
|
350
|
+
getTrackerEntry: 'SELECT * FROM tracker_queue WHERE entry_id = ?1 AND absent_at IS NULL AND parse_error IS NULL',
|
|
351
|
+
listTrackerEntriesForItem: `SELECT * FROM tracker_queue
|
|
346
352
|
WHERE item_id = ?1 AND absent_at IS NULL AND parse_error IS NULL ORDER BY entry_id`,
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
listTrackerLinks: `SELECT * FROM tracker_item_tasks
|
|
354
|
+
WHERE absent_at IS NULL AND parse_error IS NULL ORDER BY item_id, created_at, link_id`,
|
|
355
|
+
getTrackerLink: 'SELECT * FROM tracker_item_tasks WHERE link_id = ?1 AND absent_at IS NULL AND parse_error IS NULL',
|
|
356
|
+
listTrackerLinksForItem: `SELECT * FROM tracker_item_tasks
|
|
357
|
+
WHERE item_id = ?1 AND absent_at IS NULL AND parse_error IS NULL ORDER BY created_at, link_id`,
|
|
358
|
+
listTrackerLinksForTask: `SELECT * FROM tracker_item_tasks
|
|
359
|
+
WHERE task_slug = ?1 AND absent_at IS NULL AND parse_error IS NULL ORDER BY created_at, link_id`,
|
|
360
|
+
listTrackerTaskRows: 'SELECT slug, state, start_at, end_at FROM tasks WHERE absent_at IS NULL',
|
|
361
|
+
getTrackerTaskRow: 'SELECT state, start_at, end_at FROM tasks WHERE slug = ?1 AND absent_at IS NULL',
|
|
349
362
|
};
|
|
350
363
|
|
|
351
364
|
/* ------------------------------- validation -------------------------------- */
|
|
@@ -402,6 +415,14 @@ const parseQuery = (value, name) => {
|
|
|
402
415
|
return value;
|
|
403
416
|
};
|
|
404
417
|
|
|
418
|
+
const parseItemId = (value, parameter = 'id') => {
|
|
419
|
+
const id = typeof value === 'number' ? value : /^[0-9]+$/.test(String(value)) ? Number(value) : NaN;
|
|
420
|
+
if (!Number.isInteger(id) || id < 1) {
|
|
421
|
+
fail('E_VALIDATION', 422, `${parameter} must be a positive integer`, { parameter });
|
|
422
|
+
}
|
|
423
|
+
return id;
|
|
424
|
+
};
|
|
425
|
+
|
|
405
426
|
const parseSlug = (value) => {
|
|
406
427
|
if (typeof value !== 'string' || !slugPattern.test(value)) fail('E_BAD_REQUEST', 400, 'slug must match ^[a-z0-9]+(?:-[a-z0-9]+)*$');
|
|
407
428
|
return value;
|
|
@@ -974,6 +995,9 @@ const getHealth = (handle, settings) => {
|
|
|
974
995
|
}).length;
|
|
975
996
|
return {
|
|
976
997
|
status: 'ok',
|
|
998
|
+
// Repository identity: the hash, never the path. Additive and optional, so a
|
|
999
|
+
// v1 consumer that predates the field ignores it.
|
|
1000
|
+
rootId: teamRootId(settings.teamRoot),
|
|
977
1001
|
db: {
|
|
978
1002
|
file: path.basename(settings.dbPath),
|
|
979
1003
|
present: true,
|
|
@@ -983,7 +1007,7 @@ const getHealth = (handle, settings) => {
|
|
|
983
1007
|
},
|
|
984
1008
|
tasks: { total: Number(totals.total), absent: Number(totals.absent) },
|
|
985
1009
|
projectedAt: totals.projected_at ?? null,
|
|
986
|
-
capabilities: ['sync', 'delete', 'jobs', 'schedule', '
|
|
1010
|
+
capabilities: ['sync', 'delete', 'jobs', 'schedule', 'tracker'],
|
|
987
1011
|
scheduler: {
|
|
988
1012
|
state: lease.state,
|
|
989
1013
|
pid: lease.lease?.pid === undefined ? null : Number(lease.lease.pid),
|
|
@@ -1433,7 +1457,7 @@ const runDeleteChild = async (slug, context) => {
|
|
|
1433
1457
|
return { slug: parsed.slug };
|
|
1434
1458
|
};
|
|
1435
1459
|
|
|
1436
|
-
/* ---------------------------------
|
|
1460
|
+
/* --------------------------------- tracker -------------------------------- */
|
|
1437
1461
|
|
|
1438
1462
|
const parseJsonArrayColumn = (text) => {
|
|
1439
1463
|
try {
|
|
@@ -1445,9 +1469,9 @@ const parseJsonArrayColumn = (text) => {
|
|
|
1445
1469
|
};
|
|
1446
1470
|
|
|
1447
1471
|
/** A projected row back into the file shape the shared ordering consumes. */
|
|
1448
|
-
const
|
|
1472
|
+
const trackerItemFromRow = (row, dependsOn) => ({
|
|
1449
1473
|
schemaVersion: 1,
|
|
1450
|
-
id: row.id,
|
|
1474
|
+
id: Number(row.id),
|
|
1451
1475
|
revision: Number.isInteger(row.revision) ? row.revision : 1,
|
|
1452
1476
|
title: row.title ?? '',
|
|
1453
1477
|
status: row.status ?? 'planned',
|
|
@@ -1467,10 +1491,12 @@ const backlogItemFromRow = (row, dependsOn) => ({
|
|
|
1467
1491
|
supersededBy: row.superseded_by ?? null,
|
|
1468
1492
|
});
|
|
1469
1493
|
|
|
1470
|
-
const
|
|
1494
|
+
const trackerEntryFromRow = (row) => ({
|
|
1471
1495
|
schemaVersion: 1,
|
|
1472
1496
|
entryId: row.entry_id,
|
|
1473
|
-
itemId: row.item_id,
|
|
1497
|
+
itemId: Number(row.item_id),
|
|
1498
|
+
taskSlug: row.task_slug ?? null,
|
|
1499
|
+
linkId: row.link_id ?? null,
|
|
1474
1500
|
status: row.status ?? 'queued',
|
|
1475
1501
|
reason: row.reason ?? '',
|
|
1476
1502
|
requestedBy: row.requested_by ?? '',
|
|
@@ -1482,35 +1508,55 @@ const backlogEntryFromRow = (row) => ({
|
|
|
1482
1508
|
history: parseJsonArrayColumn(row.history_json),
|
|
1483
1509
|
});
|
|
1484
1510
|
|
|
1511
|
+
const trackerLinkFromRow = (row) => ({
|
|
1512
|
+
schemaVersion: 1,
|
|
1513
|
+
linkId: row.link_id,
|
|
1514
|
+
itemId: Number(row.item_id),
|
|
1515
|
+
taskSlug: row.task_slug,
|
|
1516
|
+
entryId: row.entry_id ?? null,
|
|
1517
|
+
role: row.role ?? 'primary',
|
|
1518
|
+
decision: row.decision ?? 'requested',
|
|
1519
|
+
promptPath: row.prompt_path ?? null,
|
|
1520
|
+
language: row.language ?? null,
|
|
1521
|
+
revision: Number.isInteger(row.revision) ? row.revision : 1,
|
|
1522
|
+
createdAt: row.created_at ?? '1970-01-01T00:00:00.000Z',
|
|
1523
|
+
updatedAt: row.updated_at ?? '1970-01-01T00:00:00.000Z',
|
|
1524
|
+
history: parseJsonArrayColumn(row.history_json),
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1485
1527
|
/**
|
|
1486
|
-
* One snapshot of the projected
|
|
1487
|
-
* own, so the shared `
|
|
1528
|
+
* One snapshot of the projected tracker. The record shapes are the files'
|
|
1529
|
+
* own, so the shared `deriveTrackerOrdering` sees the same input on the CLI
|
|
1488
1530
|
* path and the SQL read plane and the two can never disagree (D-4).
|
|
1489
1531
|
*/
|
|
1490
|
-
const
|
|
1532
|
+
const readTrackerSnapshotRows = (db) => {
|
|
1491
1533
|
const items = new Map();
|
|
1492
1534
|
const entries = new Map();
|
|
1535
|
+
const links = new Map();
|
|
1493
1536
|
const taskRows = new Map();
|
|
1494
|
-
for (const row of db.prepare(SQL.
|
|
1537
|
+
for (const row of db.prepare(SQL.listTrackerTaskRows).all()) {
|
|
1495
1538
|
taskRows.set(row.slug, { state: row.state ?? null, startAt: row.start_at ?? null, endAt: row.end_at ?? null });
|
|
1496
1539
|
}
|
|
1497
1540
|
const depsByItem = new Map();
|
|
1498
|
-
for (const dep of db.prepare(SQL.
|
|
1541
|
+
for (const dep of db.prepare(SQL.listTrackerDeps).all()) {
|
|
1499
1542
|
if (!depsByItem.has(dep.item_id)) depsByItem.set(dep.item_id, []);
|
|
1500
1543
|
depsByItem.get(dep.item_id).push(dep.dep_id);
|
|
1501
1544
|
}
|
|
1502
|
-
for (const row of db.prepare(SQL.
|
|
1503
|
-
items.set(row.id,
|
|
1545
|
+
for (const row of db.prepare(SQL.listTrackerItems).all()) {
|
|
1546
|
+
items.set(row.id, trackerItemFromRow(row, depsByItem.get(row.id) ?? []));
|
|
1547
|
+
}
|
|
1548
|
+
for (const row of db.prepare(SQL.listTrackerEntries).all()) {
|
|
1549
|
+
entries.set(row.entry_id, trackerEntryFromRow(row));
|
|
1504
1550
|
}
|
|
1505
|
-
for (const row of db.prepare(SQL.
|
|
1506
|
-
|
|
1551
|
+
for (const row of db.prepare(SQL.listTrackerLinks).all()) {
|
|
1552
|
+
links.set(row.link_id, trackerLinkFromRow(row));
|
|
1507
1553
|
}
|
|
1508
1554
|
const taskStates = new Map();
|
|
1509
1555
|
for (const [slug, row] of taskRows) taskStates.set(slug, row.state);
|
|
1510
|
-
return { items, entries, taskRows, taskStates };
|
|
1556
|
+
return { items, entries, links, taskRows, taskStates };
|
|
1511
1557
|
};
|
|
1512
1558
|
|
|
1513
|
-
const
|
|
1559
|
+
const trackerItemJson = (annotated) => {
|
|
1514
1560
|
const item = annotated.item;
|
|
1515
1561
|
return {
|
|
1516
1562
|
schemaVersion: 1,
|
|
@@ -1541,7 +1587,7 @@ const backlogItemJson = (annotated) => {
|
|
|
1541
1587
|
};
|
|
1542
1588
|
};
|
|
1543
1589
|
|
|
1544
|
-
const
|
|
1590
|
+
const trackerItemSummaryJson = (annotated) => {
|
|
1545
1591
|
const item = annotated.item;
|
|
1546
1592
|
return {
|
|
1547
1593
|
id: item.id,
|
|
@@ -1561,15 +1607,20 @@ const backlogItemSummaryJson = (annotated) => {
|
|
|
1561
1607
|
createdAt: item.createdAt,
|
|
1562
1608
|
updatedAt: item.updatedAt,
|
|
1563
1609
|
queueEntryId: annotated.queueEntryId,
|
|
1610
|
+
linkCount: annotated.links?.length ?? 0,
|
|
1611
|
+
linkedTasks: annotated.links?.map((link) => link.taskSlug) ?? [],
|
|
1564
1612
|
};
|
|
1565
1613
|
};
|
|
1566
1614
|
|
|
1567
|
-
const
|
|
1568
|
-
const
|
|
1615
|
+
const trackerQueueEntryJson = (entry, taskRows, itemTitle) => {
|
|
1616
|
+
const taskSlug = entry.taskSlug ?? `tracker-${entry.itemId}`;
|
|
1617
|
+
const taskRow = taskRows.get(taskSlug);
|
|
1569
1618
|
const taskState = taskRow?.state ?? null;
|
|
1570
1619
|
return {
|
|
1571
1620
|
entryId: entry.entryId,
|
|
1572
1621
|
itemId: entry.itemId,
|
|
1622
|
+
taskSlug,
|
|
1623
|
+
linkId: entry.linkId ?? null,
|
|
1573
1624
|
status: effectiveEntryStatus(entry, taskState),
|
|
1574
1625
|
reason: entry.reason,
|
|
1575
1626
|
requestedBy: entry.requestedBy,
|
|
@@ -1586,26 +1637,26 @@ const backlogQueueEntryJson = (entry, taskRows, itemTitle) => {
|
|
|
1586
1637
|
};
|
|
1587
1638
|
};
|
|
1588
1639
|
|
|
1589
|
-
const
|
|
1590
|
-
const snapshot =
|
|
1640
|
+
const trackerOrdering = (db) => {
|
|
1641
|
+
const snapshot = readTrackerSnapshotRows(db);
|
|
1591
1642
|
const asOf = new Date().toISOString();
|
|
1592
|
-
const ordering =
|
|
1643
|
+
const ordering = deriveTrackerOrdering({ ...snapshot, asOf });
|
|
1593
1644
|
return { snapshot, ordering, asOf };
|
|
1594
1645
|
};
|
|
1595
1646
|
|
|
1596
|
-
const
|
|
1597
|
-
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max:
|
|
1647
|
+
const listTrackerItems = (db, query, settings) => {
|
|
1648
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: TRACKER_MAX_LIMIT, fallback: TRACKER_DEFAULT_LIMIT });
|
|
1598
1649
|
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
1599
|
-
const statuses = parseCsv(query.get('status'), 'status',
|
|
1650
|
+
const statuses = parseCsv(query.get('status'), 'status', TRACKER_EFFECTIVE_SET);
|
|
1600
1651
|
const ready = parseBoolean(query.get('ready'), 'ready', null);
|
|
1601
1652
|
const sourceTask = parsePattern(query.get('sourceTask'), 'sourceTask', slugPattern, 64);
|
|
1602
|
-
const { snapshot, ordering, asOf } =
|
|
1653
|
+
const { snapshot, ordering, asOf } = trackerOrdering(db);
|
|
1603
1654
|
let ranked = [...ordering.byId.values()].sort((left, right) => rankCompare(left.item, right.item));
|
|
1604
1655
|
if (statuses.length > 0) ranked = ranked.filter((annotated) => statuses.includes(annotated.effectiveStatus));
|
|
1605
1656
|
if (ready !== null) ranked = ranked.filter((annotated) => annotated.ready === ready);
|
|
1606
1657
|
if (sourceTask !== '') ranked = ranked.filter((annotated) => annotated.item.sourceTask === sourceTask);
|
|
1607
1658
|
const total = ranked.length;
|
|
1608
|
-
const items = ranked.slice(offset, offset + limit).map(
|
|
1659
|
+
const items = ranked.slice(offset, offset + limit).map(trackerItemSummaryJson);
|
|
1609
1660
|
return {
|
|
1610
1661
|
items,
|
|
1611
1662
|
total,
|
|
@@ -1615,20 +1666,46 @@ const listBacklogItems = (db, query, settings) => {
|
|
|
1615
1666
|
asOf,
|
|
1616
1667
|
readyCount: ordering.readyIds.length,
|
|
1617
1668
|
criticalPathIds: ordering.criticalPathIds,
|
|
1618
|
-
maxActive:
|
|
1669
|
+
maxActive: readTrackerConfig(settings.teamRoot).maxActive,
|
|
1619
1670
|
activeCount: countActiveTasks(snapshot.taskStates),
|
|
1620
1671
|
};
|
|
1621
1672
|
};
|
|
1622
1673
|
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1674
|
+
const readLatestTaskRun = (teamRoot, taskSlug) => {
|
|
1675
|
+
if (typeof teamRoot !== 'string' || teamRoot === '') return null;
|
|
1676
|
+
const dir = path.join(teamRoot, 'task-runs', taskSlug);
|
|
1677
|
+
if (!fs.existsSync(dir)) return null;
|
|
1678
|
+
const runIds = fs
|
|
1679
|
+
.readdirSync(dir)
|
|
1680
|
+
.filter((name) => RUN_ID_RE.test(name))
|
|
1681
|
+
.sort()
|
|
1682
|
+
.reverse();
|
|
1683
|
+
for (const runId of runIds) {
|
|
1684
|
+
try {
|
|
1685
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(dir, runId, 'run.json'), 'utf8'));
|
|
1686
|
+
return {
|
|
1687
|
+
runId,
|
|
1688
|
+
state: typeof manifest.state === 'string' ? manifest.state : 'unknown',
|
|
1689
|
+
startedAt: manifest.startedAt ?? null,
|
|
1690
|
+
finishedAt: manifest.finishedAt ?? null,
|
|
1691
|
+
error: manifest.error ?? null,
|
|
1692
|
+
};
|
|
1693
|
+
} catch {
|
|
1694
|
+
/* an incomplete run directory is not a run record */
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return null;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
const trackerItemDetail = (db, id, teamRoot = null) => {
|
|
1701
|
+
const { snapshot, ordering } = trackerOrdering(db);
|
|
1625
1702
|
const annotated = ordering.byId.get(id);
|
|
1626
|
-
if (!annotated) fail('E_NOT_FOUND', 404, `no
|
|
1703
|
+
if (!annotated) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
1627
1704
|
const dependencies = (annotated.item.dependsOn ?? []).map((depId) => {
|
|
1628
1705
|
const dep = ordering.byId.get(depId);
|
|
1629
1706
|
return {
|
|
1630
1707
|
id: depId,
|
|
1631
|
-
title: dep?.item.title ?? depId,
|
|
1708
|
+
title: dep?.item.title ?? String(depId),
|
|
1632
1709
|
status: dep?.effectiveStatus ?? 'planned',
|
|
1633
1710
|
satisfied: dep?.effectiveStatus === 'completed',
|
|
1634
1711
|
};
|
|
@@ -1642,27 +1719,62 @@ const backlogItemDetail = (db, id) => {
|
|
|
1642
1719
|
status: other.effectiveStatus,
|
|
1643
1720
|
satisfied: annotated.effectiveStatus === 'completed',
|
|
1644
1721
|
}));
|
|
1722
|
+
const links = [...snapshot.links.values()].filter((link) => link.itemId === id);
|
|
1723
|
+
if (links.length === 0 && snapshot.taskRows.has(String(id))) {
|
|
1724
|
+
links.push({
|
|
1725
|
+
schemaVersion: 1,
|
|
1726
|
+
linkId: `${id}--${id}`,
|
|
1727
|
+
itemId: id,
|
|
1728
|
+
taskSlug: String(id),
|
|
1729
|
+
entryId: null,
|
|
1730
|
+
role: 'primary',
|
|
1731
|
+
decision: 'requested',
|
|
1732
|
+
promptPath: null,
|
|
1733
|
+
language: null,
|
|
1734
|
+
revision: 0,
|
|
1735
|
+
createdAt: annotated.item.createdAt,
|
|
1736
|
+
updatedAt: annotated.item.updatedAt,
|
|
1737
|
+
history: [],
|
|
1738
|
+
legacy: true,
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
const tasks = links
|
|
1742
|
+
.map((link) => {
|
|
1743
|
+
const taskRow = snapshot.taskRows.get(link.taskSlug) ?? null;
|
|
1744
|
+
const entry = link.entryId === null ? null : (snapshot.entries.get(link.entryId) ?? null);
|
|
1745
|
+
return {
|
|
1746
|
+
...link,
|
|
1747
|
+
effectiveState: effectiveLinkState(link, entry, taskRow?.state ?? null),
|
|
1748
|
+
latestRun: readLatestTaskRun(teamRoot, link.taskSlug),
|
|
1749
|
+
taskState: taskRow?.state ?? null,
|
|
1750
|
+
taskStartAt: taskRow?.startAt ?? null,
|
|
1751
|
+
taskEndAt: taskRow?.endAt ?? null,
|
|
1752
|
+
entryStatus: entry === null ? null : effectiveEntryStatus(entry, taskRow?.state ?? null),
|
|
1753
|
+
};
|
|
1754
|
+
})
|
|
1755
|
+
.sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.linkId.localeCompare(right.linkId));
|
|
1645
1756
|
const queue = [...snapshot.entries.values()]
|
|
1646
1757
|
.filter((entry) => entry.itemId === id)
|
|
1647
|
-
.map((entry) =>
|
|
1758
|
+
.map((entry) => trackerQueueEntryJson(entry, snapshot.taskRows, annotated.item.title));
|
|
1648
1759
|
return {
|
|
1649
|
-
item:
|
|
1760
|
+
item: trackerItemJson(annotated),
|
|
1650
1761
|
dependencies,
|
|
1651
1762
|
dependents,
|
|
1652
1763
|
queue,
|
|
1764
|
+
tasks,
|
|
1653
1765
|
criticalPath: ordering.criticalPathIds,
|
|
1654
1766
|
};
|
|
1655
1767
|
};
|
|
1656
1768
|
|
|
1657
|
-
const
|
|
1658
|
-
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max:
|
|
1769
|
+
const listTrackerQueue = (db, query) => {
|
|
1770
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: TRACKER_MAX_LIMIT, fallback: TRACKER_DEFAULT_LIMIT });
|
|
1659
1771
|
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
1660
|
-
const statuses = parseCsv(query.get('status'), 'status',
|
|
1661
|
-
const itemId =
|
|
1662
|
-
const snapshot =
|
|
1772
|
+
const statuses = parseCsv(query.get('status'), 'status', TRACKER_EFFECTIVE_ENTRY_SET);
|
|
1773
|
+
const itemId = query.get('itemId') === null ? null : parseItemId(query.get('itemId'), 'itemId');
|
|
1774
|
+
const snapshot = readTrackerSnapshotRows(db);
|
|
1663
1775
|
let items = [...snapshot.entries.values()]
|
|
1664
|
-
.filter((entry) => itemId ===
|
|
1665
|
-
.map((entry) =>
|
|
1776
|
+
.filter((entry) => itemId === null || entry.itemId === itemId)
|
|
1777
|
+
.map((entry) => trackerQueueEntryJson(entry, snapshot.taskRows, snapshot.items.get(entry.itemId)?.title ?? String(entry.itemId)));
|
|
1666
1778
|
if (statuses.length > 0) items = items.filter((entry) => statuses.includes(entry.status));
|
|
1667
1779
|
const total = items.length;
|
|
1668
1780
|
const pageItems = items.slice(offset, offset + limit);
|
|
@@ -1678,7 +1790,7 @@ const listBacklogQueue = (db, query) => {
|
|
|
1678
1790
|
};
|
|
1679
1791
|
};
|
|
1680
1792
|
|
|
1681
|
-
const
|
|
1793
|
+
const parseTrackerBody = (context, noun) => {
|
|
1682
1794
|
const text = context.body.toString('utf8').trim();
|
|
1683
1795
|
if (text === '') fail('E_VALIDATION', 422, `${noun} is required`, { parameter: 'body' });
|
|
1684
1796
|
try {
|
|
@@ -1701,140 +1813,328 @@ const parseEntryId = (value) => {
|
|
|
1701
1813
|
* `details.code` (additionalProperties); the transport code is per mutation
|
|
1702
1814
|
* because the same CLI code means a different refusal on a different verb.
|
|
1703
1815
|
*/
|
|
1704
|
-
const
|
|
1816
|
+
const failTrackerRefusal = (result, transportByCode) => {
|
|
1705
1817
|
const code = typeof result.code === 'string' ? result.code : 'E_INTERNAL';
|
|
1706
1818
|
const [transport, status] = transportByCode.get(code) ?? ['E_INTERNAL', 500];
|
|
1707
|
-
fail(transport, status, String(result.message ?? 'the
|
|
1819
|
+
fail(transport, status, String(result.message ?? 'the tracker write was refused'), { code });
|
|
1708
1820
|
};
|
|
1709
1821
|
|
|
1710
1822
|
const CREATE_ITEM_REFUSALS = new Map([
|
|
1711
|
-
['
|
|
1823
|
+
['E_TRACKER_DUPLICATE_ID', ['E_CONFLICT', 409]],
|
|
1712
1824
|
['E_ID_COLLISION', ['E_VALIDATION', 422]],
|
|
1713
1825
|
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1714
|
-
['
|
|
1715
|
-
['
|
|
1716
|
-
['
|
|
1717
|
-
['
|
|
1826
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_VALIDATION', 422]],
|
|
1827
|
+
['E_TRACKER_CYCLE', ['E_VALIDATION', 422]],
|
|
1828
|
+
['E_TRACKER_SELF_DEP', ['E_VALIDATION', 422]],
|
|
1829
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1718
1830
|
]);
|
|
1719
1831
|
|
|
1720
1832
|
const UPDATE_ITEM_REFUSALS = new Map([
|
|
1721
|
-
['
|
|
1722
|
-
['
|
|
1833
|
+
['E_TRACKER_REVISION', ['E_CONFLICT', 409]],
|
|
1834
|
+
['E_TRACKER_TRANSITION', ['E_CONFLICT', 409]],
|
|
1723
1835
|
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1724
|
-
['
|
|
1725
|
-
['
|
|
1726
|
-
['
|
|
1727
|
-
['
|
|
1836
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_VALIDATION', 422]],
|
|
1837
|
+
['E_TRACKER_CYCLE', ['E_VALIDATION', 422]],
|
|
1838
|
+
['E_TRACKER_SELF_DEP', ['E_VALIDATION', 422]],
|
|
1839
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1728
1840
|
]);
|
|
1729
1841
|
|
|
1730
1842
|
const ENQUEUE_REFUSALS = new Map([
|
|
1731
|
-
['
|
|
1843
|
+
['E_TRACKER_TRANSITION', ['E_CONFLICT', 409]],
|
|
1732
1844
|
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1733
|
-
['
|
|
1734
|
-
['
|
|
1845
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_VALIDATION', 422]],
|
|
1846
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1735
1847
|
]);
|
|
1736
1848
|
|
|
1737
1849
|
const CANCEL_REFUSALS = new Map([
|
|
1738
|
-
['
|
|
1850
|
+
['E_TRACKER_TRANSITION', ['E_CONFLICT', 409]],
|
|
1739
1851
|
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1740
|
-
['
|
|
1741
|
-
['
|
|
1852
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_NOT_FOUND', 404]],
|
|
1853
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1742
1854
|
]);
|
|
1743
1855
|
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1856
|
+
const DELETE_ITEM_REFUSALS = new Map([
|
|
1857
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_NOT_FOUND', 404]],
|
|
1858
|
+
['E_TRACKER_LINK_ACTIVE', ['E_CONFLICT', 409]],
|
|
1859
|
+
['E_TRACKER_QUEUE_ACTIVE', ['E_CONFLICT', 409]],
|
|
1860
|
+
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1861
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1862
|
+
]);
|
|
1863
|
+
|
|
1864
|
+
const START_TASK_REFUSALS = new Map([
|
|
1865
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_NOT_FOUND', 404]],
|
|
1866
|
+
['E_TRACKER_LINK_EXISTS', ['E_CONFLICT', 409]],
|
|
1867
|
+
['E_TRACKER_TRANSITION', ['E_CONFLICT', 409]],
|
|
1868
|
+
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1869
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1870
|
+
]);
|
|
1871
|
+
|
|
1872
|
+
const STOP_TASK_REFUSALS = new Map([
|
|
1873
|
+
['E_TRACKER_UNKNOWN_DEP', ['E_NOT_FOUND', 404]],
|
|
1874
|
+
['E_TRACKER_LINK_UNKNOWN', ['E_NOT_FOUND', 404]],
|
|
1875
|
+
['E_TRACKER_TRANSITION', ['E_CONFLICT', 409]],
|
|
1876
|
+
['E_SCHEMA', ['E_VALIDATION', 422]],
|
|
1877
|
+
['E_TRACKER_BUSY', ['E_BUSY', 503]],
|
|
1878
|
+
['E_RUNNER_OFFLINE', ['E_CONFLICT', 409]],
|
|
1879
|
+
['E_RUNNER_BUSY', ['E_CONFLICT', 409]],
|
|
1880
|
+
['E_RUNNER_PID_MISMATCH', ['E_CONFLICT', 409]],
|
|
1881
|
+
]);
|
|
1882
|
+
|
|
1883
|
+
const parseTaskSlug = (value) => {
|
|
1884
|
+
if (typeof value !== 'string' || !slugPattern.test(value) || value.length < 3 || value.length > 48) {
|
|
1885
|
+
fail('E_VALIDATION', 422, 'taskSlug must match the slug grammar with 3-48 characters', { parameter: 'taskSlug' });
|
|
1886
|
+
}
|
|
1887
|
+
return value;
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
const trackerQueueEntryById = (db, entryId) => {
|
|
1891
|
+
const row = db.prepare(SQL.getTrackerEntry).get(entryId);
|
|
1746
1892
|
if (!row) fail('E_NOT_FOUND', 404, `no queue entry "${entryId}"`);
|
|
1747
|
-
const entry =
|
|
1748
|
-
const
|
|
1749
|
-
const
|
|
1893
|
+
const entry = trackerEntryFromRow(row);
|
|
1894
|
+
const taskSlug = entry.taskSlug ?? `tracker-${entry.itemId}`;
|
|
1895
|
+
const taskRow = db.prepare(SQL.getTrackerTaskRow).get(taskSlug);
|
|
1896
|
+
const item = db.prepare(SQL.getTrackerItem).get(entry.itemId);
|
|
1750
1897
|
const taskRows = new Map();
|
|
1751
1898
|
if (taskRow) {
|
|
1752
|
-
taskRows.set(
|
|
1899
|
+
taskRows.set(taskSlug, { state: taskRow.state ?? null, startAt: taskRow.start_at ?? null, endAt: taskRow.end_at ?? null });
|
|
1753
1900
|
}
|
|
1754
|
-
return
|
|
1901
|
+
return trackerQueueEntryJson(entry, taskRows, item?.title ?? String(entry.itemId));
|
|
1755
1902
|
};
|
|
1756
1903
|
|
|
1757
|
-
const
|
|
1758
|
-
const parsed =
|
|
1759
|
-
const result = await runTeamDbChild(['
|
|
1904
|
+
const createTrackerItem = async (context) => {
|
|
1905
|
+
const parsed = parseTrackerBody(context, 'an item body');
|
|
1906
|
+
const result = await runTeamDbChild(['tracker', 'add', '--file', '-'], {
|
|
1760
1907
|
settings: context.settings,
|
|
1761
|
-
timeoutMs:
|
|
1908
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
1762
1909
|
input: JSON.stringify(parsed),
|
|
1763
|
-
label: '
|
|
1910
|
+
label: 'tracker create',
|
|
1764
1911
|
});
|
|
1765
|
-
if (result.ok !== true || typeof result.item?.id !== '
|
|
1766
|
-
|
|
1912
|
+
if (result.ok !== true || typeof result.item?.id !== 'number') {
|
|
1913
|
+
failTrackerRefusal(result, CREATE_ITEM_REFUSALS);
|
|
1767
1914
|
}
|
|
1768
|
-
return { json:
|
|
1915
|
+
return { json: trackerItemDetail(context.db(), result.item.id, context.settings.teamRoot), status: 201 };
|
|
1769
1916
|
};
|
|
1770
1917
|
|
|
1771
|
-
const
|
|
1772
|
-
const id =
|
|
1773
|
-
const parsed =
|
|
1918
|
+
const updateTrackerItem = async (context) => {
|
|
1919
|
+
const id = parseItemId(context.params.id);
|
|
1920
|
+
const parsed = parseTrackerBody(context, 'an item body');
|
|
1774
1921
|
if (parsed && parsed.id !== undefined && parsed.id !== id) {
|
|
1775
1922
|
fail('E_CONFLICT', 409, 'the body id differs from the path id; the id is immutable');
|
|
1776
1923
|
}
|
|
1777
1924
|
const db = context.db();
|
|
1778
|
-
if (!db.prepare(SQL.
|
|
1925
|
+
if (!db.prepare(SQL.getTrackerItem).get(id)) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
1779
1926
|
// The frozen route table refuses an update while a live entry exists: the
|
|
1780
1927
|
// launch request must be cancelled before the item it targets can change.
|
|
1781
|
-
const taskRow = db.prepare(SQL.getBacklogTaskRow).get(id);
|
|
1782
|
-
const taskState = taskRow?.state ?? null;
|
|
1783
1928
|
const live = db
|
|
1784
|
-
.prepare(SQL.
|
|
1929
|
+
.prepare(SQL.listTrackerEntriesForItem)
|
|
1785
1930
|
.all(id)
|
|
1786
|
-
.map((row) =>
|
|
1787
|
-
.some((entry) =>
|
|
1931
|
+
.map((row) => trackerEntryFromRow(row))
|
|
1932
|
+
.some((entry) => {
|
|
1933
|
+
const taskRow = db.prepare(SQL.getTrackerTaskRow).get(entry.taskSlug ?? `tracker-${entry.itemId}`);
|
|
1934
|
+
return !['cancelled', 'expired', 'done'].includes(effectiveEntryStatus(entry, taskRow?.state ?? null));
|
|
1935
|
+
});
|
|
1788
1936
|
if (live) fail('E_CONFLICT', 409, `item "${id}" has a live queue entry; cancel it first`);
|
|
1789
|
-
const result = await runTeamDbChild(['
|
|
1937
|
+
const result = await runTeamDbChild(['tracker', 'set', id, '--file', '-'], {
|
|
1790
1938
|
settings: context.settings,
|
|
1791
|
-
timeoutMs:
|
|
1939
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
1792
1940
|
input: JSON.stringify(parsed),
|
|
1793
|
-
label: '
|
|
1941
|
+
label: 'tracker update',
|
|
1794
1942
|
});
|
|
1795
|
-
if (result.ok !== true || typeof result.item?.id !== '
|
|
1796
|
-
|
|
1943
|
+
if (result.ok !== true || typeof result.item?.id !== 'number') {
|
|
1944
|
+
failTrackerRefusal(result, UPDATE_ITEM_REFUSALS);
|
|
1797
1945
|
}
|
|
1798
|
-
return { json:
|
|
1946
|
+
return { json: trackerItemDetail(db, id, context.settings.teamRoot) };
|
|
1799
1947
|
};
|
|
1800
1948
|
|
|
1801
|
-
const
|
|
1802
|
-
const parsed =
|
|
1803
|
-
const itemId = parsed?.itemId;
|
|
1804
|
-
if (typeof itemId !== 'string' || !slugPattern.test(itemId)) {
|
|
1805
|
-
fail('E_VALIDATION', 422, 'itemId must match the slug grammar', { parameter: 'itemId' });
|
|
1806
|
-
}
|
|
1949
|
+
const enqueueTrackerItem = async (context) => {
|
|
1950
|
+
const parsed = parseTrackerBody(context, 'an enqueue body');
|
|
1951
|
+
const itemId = parseItemId(parsed?.itemId, 'itemId');
|
|
1807
1952
|
const db = context.db();
|
|
1808
|
-
if (!db.prepare(SQL.
|
|
1809
|
-
const result = await runTeamDbChild(['
|
|
1953
|
+
if (!db.prepare(SQL.getTrackerItem).get(itemId)) fail('E_NOT_FOUND', 404, `no tracker item "${itemId}"`);
|
|
1954
|
+
const result = await runTeamDbChild(['tracker', 'enqueue', '--file', '-'], {
|
|
1810
1955
|
settings: context.settings,
|
|
1811
|
-
timeoutMs:
|
|
1956
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
1812
1957
|
input: JSON.stringify(parsed),
|
|
1813
|
-
label: '
|
|
1958
|
+
label: 'tracker enqueue',
|
|
1814
1959
|
});
|
|
1815
1960
|
if (result.ok !== true || typeof result.entry?.entryId !== 'string') {
|
|
1816
|
-
|
|
1961
|
+
failTrackerRefusal(result, ENQUEUE_REFUSALS);
|
|
1817
1962
|
}
|
|
1818
|
-
return { json:
|
|
1963
|
+
return { json: trackerQueueEntryById(db, result.entry.entryId), status: result.existing ? 200 : 201 };
|
|
1819
1964
|
};
|
|
1820
1965
|
|
|
1821
|
-
const
|
|
1966
|
+
const cancelTrackerQueueEntry = async (context) => {
|
|
1822
1967
|
const entryId = parseEntryId(context.params.entryId);
|
|
1823
1968
|
const text = context.body.toString('utf8').trim();
|
|
1824
1969
|
if (text !== '' && text !== '{}') {
|
|
1825
1970
|
fail('E_VALIDATION', 422, 'the cancel accepts no request body', { parameter: 'body' });
|
|
1826
1971
|
}
|
|
1827
1972
|
const db = context.db();
|
|
1828
|
-
if (!db.prepare(SQL.
|
|
1829
|
-
const result = await runTeamDbChild(['
|
|
1973
|
+
if (!db.prepare(SQL.getTrackerEntry).get(entryId)) fail('E_NOT_FOUND', 404, `no queue entry "${entryId}"`);
|
|
1974
|
+
const result = await runTeamDbChild(['tracker', 'cancel', entryId], {
|
|
1830
1975
|
settings: context.settings,
|
|
1831
|
-
timeoutMs:
|
|
1832
|
-
label: '
|
|
1976
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
1977
|
+
label: 'tracker cancel',
|
|
1833
1978
|
});
|
|
1834
1979
|
if (result.ok !== true || typeof result.entry?.entryId !== 'string') {
|
|
1835
|
-
|
|
1980
|
+
failTrackerRefusal(result, CANCEL_REFUSALS);
|
|
1836
1981
|
}
|
|
1837
|
-
return { json:
|
|
1982
|
+
return { json: trackerQueueEntryById(db, entryId) };
|
|
1983
|
+
};
|
|
1984
|
+
|
|
1985
|
+
const deleteTrackerItem = async (context) => {
|
|
1986
|
+
const id = parseItemId(context.params.id);
|
|
1987
|
+
if (isKillSwitchSet()) fail('E_DISABLED', 503, 'the projection is disabled by AI_RULES_TEAM_DB_DISABLE');
|
|
1988
|
+
const db = context.db();
|
|
1989
|
+
if (!db.prepare(SQL.getTrackerItem).get(id)) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
1990
|
+
const result = await runTeamDbChild(['tracker', 'delete', id, '--json'], {
|
|
1991
|
+
settings: context.settings,
|
|
1992
|
+
timeoutMs: TRACKER_DELETE_CHILD_TIMEOUT_MS,
|
|
1993
|
+
label: 'tracker delete',
|
|
1994
|
+
});
|
|
1995
|
+
if (result.ok !== true || result.id !== id) {
|
|
1996
|
+
failTrackerRefusal(result, DELETE_ITEM_REFUSALS);
|
|
1997
|
+
}
|
|
1998
|
+
return { json: { id } };
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
const startTrackerTask = async (context) => {
|
|
2002
|
+
const id = parseItemId(context.params.id);
|
|
2003
|
+
const parsed = parseTrackerBody(context, 'a task start body');
|
|
2004
|
+
const taskSlug = parseTaskSlug(parsed?.taskSlug ?? `tracker-${id}`);
|
|
2005
|
+
const db = context.db();
|
|
2006
|
+
const itemRow = db.prepare(SQL.getTrackerItem).get(id);
|
|
2007
|
+
if (!itemRow) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
2008
|
+
const existingTaskDir = path.join(context.settings.teamRoot, 'tasks', taskSlug);
|
|
2009
|
+
if (fs.existsSync(existingTaskDir)) {
|
|
2010
|
+
fail(
|
|
2011
|
+
'E_CONFLICT',
|
|
2012
|
+
409,
|
|
2013
|
+
`task ${taskSlug} already exists; choose another taskSlug or link the existing task explicitly`,
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
const linkId = `${id}--${taskSlug}`;
|
|
2017
|
+
if (db.prepare(SQL.getTrackerLink).get(linkId)) fail('E_CONFLICT', 409, `link ${linkId} already exists`);
|
|
2018
|
+
const reason = typeof parsed?.reason === 'string' && parsed.reason.trim() !== ''
|
|
2019
|
+
? parsed.reason
|
|
2020
|
+
: `Start ${taskSlug} from tracker item ${id}`;
|
|
2021
|
+
const requestedBy = typeof parsed?.requestedBy === 'string' && parsed.requestedBy.trim() !== ''
|
|
2022
|
+
? parsed.requestedBy
|
|
2023
|
+
: 'operator';
|
|
2024
|
+
const linkResult = await runTeamDbChild(['tracker', 'link', '--file', '-'], {
|
|
2025
|
+
settings: context.settings,
|
|
2026
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2027
|
+
input: JSON.stringify({
|
|
2028
|
+
action: 'add',
|
|
2029
|
+
itemId: id,
|
|
2030
|
+
taskSlug,
|
|
2031
|
+
prompt: parsed?.prompt,
|
|
2032
|
+
language: parsed?.language,
|
|
2033
|
+
role: parsed?.role,
|
|
2034
|
+
}),
|
|
2035
|
+
label: 'tracker link add',
|
|
2036
|
+
});
|
|
2037
|
+
if (linkResult.ok !== true || typeof linkResult.link?.linkId !== 'string') {
|
|
2038
|
+
failTrackerRefusal(linkResult, START_TASK_REFUSALS);
|
|
2039
|
+
}
|
|
2040
|
+
const enqueueResult = await runTeamDbChild(['tracker', 'enqueue', '--file', '-'], {
|
|
2041
|
+
settings: context.settings,
|
|
2042
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2043
|
+
input: JSON.stringify({ itemId: id, taskSlug, linkId: linkResult.link.linkId, reason, requestedBy }),
|
|
2044
|
+
label: 'tracker enqueue',
|
|
2045
|
+
});
|
|
2046
|
+
if (enqueueResult.ok !== true || typeof enqueueResult.entry?.entryId !== 'string') {
|
|
2047
|
+
await runTeamDbChild(['tracker', 'link', '--file', '-'], {
|
|
2048
|
+
settings: context.settings,
|
|
2049
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2050
|
+
input: JSON.stringify({ action: 'remove', linkId: linkResult.link.linkId }),
|
|
2051
|
+
label: 'tracker link rollback',
|
|
2052
|
+
});
|
|
2053
|
+
failTrackerRefusal(enqueueResult, START_TASK_REFUSALS);
|
|
2054
|
+
}
|
|
2055
|
+
return { json: trackerItemDetail(db, id, context.settings.teamRoot), status: 201 };
|
|
2056
|
+
};
|
|
2057
|
+
|
|
2058
|
+
const stopTrackerTask = async (context) => {
|
|
2059
|
+
const id = parseItemId(context.params.id);
|
|
2060
|
+
const taskSlug = parseTaskSlug(context.params.taskSlug);
|
|
2061
|
+
const db = context.db();
|
|
2062
|
+
if (!db.prepare(SQL.getTrackerItem).get(id)) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
2063
|
+
const linkId = `${id}--${taskSlug}`;
|
|
2064
|
+
const linkRow = db.prepare(SQL.getTrackerLink).get(linkId);
|
|
2065
|
+
if (!linkRow) fail('E_NOT_FOUND', 404, `no tracker link "${linkId}"`);
|
|
2066
|
+
const link = trackerLinkFromRow(linkRow);
|
|
2067
|
+
if (link.entryId !== null) {
|
|
2068
|
+
const entryRow = db.prepare(SQL.getTrackerEntry).get(link.entryId);
|
|
2069
|
+
if (entryRow) {
|
|
2070
|
+
const entry = trackerEntryFromRow(entryRow);
|
|
2071
|
+
const taskRow = db.prepare(SQL.getTrackerTaskRow).get(taskSlug);
|
|
2072
|
+
const status = effectiveEntryStatus(entry, taskRow?.state ?? null);
|
|
2073
|
+
if (status === 'queued' || status === 'claimed') {
|
|
2074
|
+
const cancelResult = await runTeamDbChild(['tracker', 'cancel', link.entryId], {
|
|
2075
|
+
settings: context.settings,
|
|
2076
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2077
|
+
label: 'tracker task stop cancel',
|
|
2078
|
+
});
|
|
2079
|
+
if (cancelResult.ok !== true) failTrackerRefusal(cancelResult, STOP_TASK_REFUSALS);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
const stopResult = await runTeamDbChild(['task-run', 'stop', '--task', taskSlug], {
|
|
2084
|
+
settings: context.settings,
|
|
2085
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2086
|
+
label: 'tracker task stop runner',
|
|
2087
|
+
});
|
|
2088
|
+
if (stopResult.ok !== true && stopResult.code !== 'E_RUNNER_OFFLINE') {
|
|
2089
|
+
failTrackerRefusal(stopResult, STOP_TASK_REFUSALS);
|
|
2090
|
+
}
|
|
2091
|
+
const setResult = await runTeamDbChild(['tracker', 'link', '--file', '-'], {
|
|
2092
|
+
settings: context.settings,
|
|
2093
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2094
|
+
input: JSON.stringify({ action: 'set', linkId, decision: 'stopped', revision: link.revision }),
|
|
2095
|
+
label: 'tracker task stop link',
|
|
2096
|
+
});
|
|
2097
|
+
if (setResult.ok !== true) failTrackerRefusal(setResult, STOP_TASK_REFUSALS);
|
|
2098
|
+
return { json: trackerItemDetail(db, id, context.settings.teamRoot) };
|
|
2099
|
+
};
|
|
2100
|
+
|
|
2101
|
+
const continueTrackerTask = async (context) => {
|
|
2102
|
+
const id = parseItemId(context.params.id);
|
|
2103
|
+
const taskSlug = parseTaskSlug(context.params.taskSlug);
|
|
2104
|
+
const text = context.body.toString('utf8').trim();
|
|
2105
|
+
if (text !== '' && text !== '{}') parseTrackerBody(context, 'a task continue body');
|
|
2106
|
+
const db = context.db();
|
|
2107
|
+
if (!db.prepare(SQL.getTrackerItem).get(id)) fail('E_NOT_FOUND', 404, `no tracker item "${id}"`);
|
|
2108
|
+
const linkId = `${id}--${taskSlug}`;
|
|
2109
|
+
const linkRow = db.prepare(SQL.getTrackerLink).get(linkId);
|
|
2110
|
+
if (!linkRow) fail('E_NOT_FOUND', 404, `no tracker link "${linkId}"`);
|
|
2111
|
+
const link = trackerLinkFromRow(linkRow);
|
|
2112
|
+
const taskRow = db.prepare(SQL.getTrackerTaskRow).get(taskSlug);
|
|
2113
|
+
if (!taskRow) fail('E_CONFLICT', 409, `task ${taskSlug} has not been bootstrapped yet`);
|
|
2114
|
+
const startResult = await runTeamDbChild(
|
|
2115
|
+
['task-run', 'start', '--task', taskSlug, '--item', id, '--link', linkId],
|
|
2116
|
+
{
|
|
2117
|
+
settings: context.settings,
|
|
2118
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2119
|
+
label: 'tracker task continue runner',
|
|
2120
|
+
},
|
|
2121
|
+
);
|
|
2122
|
+
if (startResult.ok !== true) failTrackerRefusal(startResult, STOP_TASK_REFUSALS);
|
|
2123
|
+
const setResult = await runTeamDbChild(['tracker', 'link', '--file', '-'], {
|
|
2124
|
+
settings: context.settings,
|
|
2125
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2126
|
+
input: JSON.stringify({ action: 'set', linkId, decision: 'requested', revision: link.revision }),
|
|
2127
|
+
label: 'tracker task continue link',
|
|
2128
|
+
});
|
|
2129
|
+
if (setResult.ok !== true) {
|
|
2130
|
+
await runTeamDbChild(['task-run', 'stop', '--task', taskSlug], {
|
|
2131
|
+
settings: context.settings,
|
|
2132
|
+
timeoutMs: TRACKER_WRITE_CHILD_TIMEOUT_MS,
|
|
2133
|
+
label: 'tracker task continue rollback',
|
|
2134
|
+
});
|
|
2135
|
+
failTrackerRefusal(setResult, STOP_TASK_REFUSALS);
|
|
2136
|
+
}
|
|
2137
|
+
return { json: trackerItemDetail(db, id, context.settings.teamRoot), status: 202 };
|
|
1838
2138
|
};
|
|
1839
2139
|
|
|
1840
2140
|
/* --------------------------------- routing -------------------------------- */
|
|
@@ -1942,34 +2242,47 @@ export const ROUTES = [
|
|
|
1942
2242
|
route('POST', '/api/v1/jobs/{id}/run', 'runJobNow', (context) => runJobNow(context), {
|
|
1943
2243
|
bodyLimit: MAX_REQUEST_BODY_BYTES,
|
|
1944
2244
|
}),
|
|
1945
|
-
// The
|
|
1946
|
-
// `/api/v1/
|
|
2245
|
+
// The tracker entries: `/api/v1/tracker/queue` sits before
|
|
2246
|
+
// `/api/v1/tracker/{id}` so the `{id}` pattern can never shadow the literal
|
|
1947
2247
|
// `queue` segment — the same discipline that keeps `/api/v1/jobs/{id}` from
|
|
1948
2248
|
// shadowing `/api/v1/jobs/{id}/runs`.
|
|
1949
|
-
route('GET', '/api/v1/
|
|
1950
|
-
json:
|
|
2249
|
+
route('GET', '/api/v1/tracker', 'listTrackerItems', (context) => ({
|
|
2250
|
+
json: listTrackerItems(context.db(), context.query, context.settings),
|
|
1951
2251
|
})),
|
|
1952
|
-
route('POST', '/api/v1/
|
|
1953
|
-
bodyLimit:
|
|
2252
|
+
route('POST', '/api/v1/tracker', 'createTrackerItem', (context) => createTrackerItem(context), {
|
|
2253
|
+
bodyLimit: TRACKER_ITEM_BODY_MAX,
|
|
1954
2254
|
requireJson: true,
|
|
1955
2255
|
}),
|
|
1956
|
-
route('GET', '/api/v1/
|
|
1957
|
-
json:
|
|
2256
|
+
route('GET', '/api/v1/tracker/queue', 'listTrackerQueue', (context) => ({
|
|
2257
|
+
json: listTrackerQueue(context.db(), context.query),
|
|
1958
2258
|
})),
|
|
1959
|
-
route('POST', '/api/v1/
|
|
1960
|
-
bodyLimit:
|
|
2259
|
+
route('POST', '/api/v1/tracker/queue', 'enqueueTrackerItem', (context) => enqueueTrackerItem(context), {
|
|
2260
|
+
bodyLimit: TRACKER_QUEUE_BODY_MAX,
|
|
1961
2261
|
requireJson: true,
|
|
1962
2262
|
}),
|
|
1963
|
-
route('POST', '/api/v1/
|
|
1964
|
-
bodyLimit:
|
|
2263
|
+
route('POST', '/api/v1/tracker/queue/{entryId}/cancel', 'cancelTrackerQueueEntry', (context) => cancelTrackerQueueEntry(context), {
|
|
2264
|
+
bodyLimit: TRACKER_QUEUE_BODY_MAX,
|
|
1965
2265
|
}),
|
|
1966
|
-
route('GET', '/api/v1/
|
|
1967
|
-
json:
|
|
2266
|
+
route('GET', '/api/v1/tracker/{id}', 'getTrackerItem', (context) => ({
|
|
2267
|
+
json: trackerItemDetail(context.db(), parseItemId(context.params.id), context.settings.teamRoot),
|
|
1968
2268
|
})),
|
|
1969
|
-
route('PUT', '/api/v1/
|
|
1970
|
-
bodyLimit:
|
|
2269
|
+
route('PUT', '/api/v1/tracker/{id}', 'updateTrackerItem', (context) => updateTrackerItem(context), {
|
|
2270
|
+
bodyLimit: TRACKER_ITEM_BODY_MAX,
|
|
2271
|
+
requireJson: true,
|
|
2272
|
+
}),
|
|
2273
|
+
route('DELETE', '/api/v1/tracker/{id}', 'deleteTrackerItem', (context) => deleteTrackerItem(context), {
|
|
2274
|
+
bodyLimit: MAX_REQUEST_BODY_BYTES,
|
|
2275
|
+
}),
|
|
2276
|
+
route('POST', '/api/v1/tracker/{id}/tasks', 'startTrackerTask', (context) => startTrackerTask(context), {
|
|
2277
|
+
bodyLimit: TRACKER_TASK_BODY_MAX,
|
|
1971
2278
|
requireJson: true,
|
|
1972
2279
|
}),
|
|
2280
|
+
route('POST', '/api/v1/tracker/{id}/tasks/{taskSlug}/stop', 'stopTrackerTask', (context) => stopTrackerTask(context), {
|
|
2281
|
+
bodyLimit: TRACKER_TASK_ACTION_BODY_MAX,
|
|
2282
|
+
}),
|
|
2283
|
+
route('POST', '/api/v1/tracker/{id}/tasks/{taskSlug}/continue', 'continueTrackerTask', (context) => continueTrackerTask(context), {
|
|
2284
|
+
bodyLimit: TRACKER_TASK_BODY_MAX,
|
|
2285
|
+
}),
|
|
1973
2286
|
];
|
|
1974
2287
|
|
|
1975
2288
|
/** The documented `METHOD path` pairs, for the contract gate's route parity. */
|
|
@@ -2157,7 +2470,7 @@ const handle = async (req, res, settings) => {
|
|
|
2157
2470
|
handle: handleOnce,
|
|
2158
2471
|
});
|
|
2159
2472
|
if (result.json !== undefined) {
|
|
2160
|
-
// A mutation may pin its own status: the
|
|
2473
|
+
// A mutation may pin its own status: the tracker create answers 201
|
|
2161
2474
|
// and the idempotent enqueue answers 200 or 201.
|
|
2162
2475
|
sendJson(req, res, result.status ?? 200, result.json);
|
|
2163
2476
|
return;
|