@bonesofspring/ai-rules 0.2.72 → 0.2.74
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 +43 -0
- package/README.md +7 -6
- package/bin/lib/ai-local-drift.js +4 -4
- package/bin/lib/engine-scripts.js +10 -0
- package/bin/lib/seed-ai-local-team.js +9 -5
- package/docs/TEAM-DB.md +105 -9
- package/docs/openapi/team-db.v1.json +1164 -224
- package/package.json +1 -1
- package/presets/_shared/ai-local/scripts/action-signals.mjs +225 -0
- package/presets/_shared/ai-local/scripts/actions-report.mjs +210 -0
- package/presets/_shared/ai-local/scripts/manifest.mjs +19 -1
- package/presets/_shared/ai-local/scripts/processes.mjs +5 -4
- package/presets/_shared/ai-local/scripts/rr-scheduler-start.mjs +161 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +347 -9
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +309 -4
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +312 -36
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +86 -1
- package/presets/_shared/ai-local/scripts/team-db.mjs +125 -40
- package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +335 -0
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +9 -0
- package/presets/_shared/core/agent-team/agent-team-intake.md +2 -2
- package/presets/_shared/core/quality/self-review-and-context-hygiene.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +15 -1
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +1 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/commands/README.md +4 -0
- package/presets/claude/android-kotlin/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/code-reviewer.md +1 -1
- package/presets/claude/go/agents/debugger.md +1 -1
- package/presets/claude/go/agents/feature-developer.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/commands/README.md +4 -0
- package/presets/claude/go/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +1 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/commands/README.md +4 -0
- package/presets/claude/ios-swift/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/code-reviewer.md +1 -1
- package/presets/claude/java/agents/debugger.md +1 -1
- package/presets/claude/java/agents/feature-developer.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/commands/README.md +4 -0
- package/presets/claude/java/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/commands/README.md +4 -0
- package/presets/claude/mcp-ts/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/mol/agents/build-verifier.md +1 -1
- package/presets/claude/mol/agents/code-reviewer.md +1 -1
- package/presets/claude/mol/agents/debugger.md +1 -1
- package/presets/claude/mol/agents/feature-developer.md +1 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/commands/README.md +4 -0
- package/presets/claude/mol/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/next/REPO_AGENTS.md +16 -0
- package/presets/claude/next/agents/accessibility-reviewer.md +4 -1
- package/presets/claude/next/agents/api-contract-reviewer.md +5 -2
- package/presets/claude/next/agents/build-verifier.md +6 -3
- package/presets/claude/next/agents/ci-investigator.md +1 -1
- package/presets/claude/next/agents/code-reviewer.md +7 -4
- package/presets/claude/next/agents/codebase-analyzer.md +4 -1
- package/presets/claude/next/agents/debugger.md +2 -2
- package/presets/claude/next/agents/feature-developer.md +2 -2
- package/presets/claude/next/agents/migration-specialist.md +4 -1
- package/presets/claude/next/agents/mockup-reviewer.md +4 -1
- package/presets/claude/next/agents/openspec-author.md +4 -1
- package/presets/claude/next/agents/performance-auditor.md +4 -1
- package/presets/claude/next/agents/playwright-test-generator.md +5 -2
- package/presets/claude/next/agents/playwright-test-healer.md +5 -2
- package/presets/claude/next/agents/playwright-test-planner.md +5 -2
- package/presets/claude/next/agents/qa-tester.md +5 -2
- package/presets/claude/next/agents/security-reviewer.md +4 -1
- package/presets/claude/next/agents/solution-architect.md +4 -1
- package/presets/claude/next/agents/task-analyst.md +5 -2
- package/presets/claude/next/agents/task-router.md +4 -1
- package/presets/claude/next/agents/tech-writer.md +4 -1
- package/presets/claude/next/agents/unit-test-generator.md +5 -2
- package/presets/claude/next/agents/unit-test-healer.md +5 -2
- package/presets/claude/next/agents/unit-test-planner.md +5 -2
- package/presets/claude/next/ai-local/conventions.md +26 -1
- package/presets/claude/next/commands/README.md +4 -0
- package/presets/claude/next/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/nuxt/agents/build-verifier.md +1 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
- package/presets/claude/nuxt/agents/debugger.md +1 -1
- package/presets/claude/nuxt/agents/feature-developer.md +1 -1
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/commands/README.md +4 -0
- package/presets/claude/nuxt/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/commands/README.md +4 -0
- package/presets/claude/php-hexagonal/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +1 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/commands/README.md +4 -0
- package/presets/claude/php-laravel/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/svelte/agents/build-verifier.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +1 -1
- package/presets/claude/svelte/agents/debugger.md +1 -1
- package/presets/claude/svelte/agents/feature-developer.md +1 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/commands/README.md +4 -0
- package/presets/claude/svelte/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
- package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/commands/README.md +4 -0
- package/presets/cursor/android-kotlin/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/go/agents/build-verifier.md +1 -1
- package/presets/cursor/go/agents/code-reviewer.md +1 -1
- package/presets/cursor/go/agents/debugger.md +1 -1
- package/presets/cursor/go/agents/feature-developer.md +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/commands/README.md +4 -0
- package/presets/cursor/go/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/go/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/cursor/ios-swift/agents/debugger.md +1 -1
- package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/commands/README.md +4 -0
- package/presets/cursor/ios-swift/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/agents/code-reviewer.md +1 -1
- package/presets/cursor/java/agents/debugger.md +1 -1
- package/presets/cursor/java/agents/feature-developer.md +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/commands/README.md +4 -0
- package/presets/cursor/java/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/java/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/commands/README.md +4 -0
- package/presets/cursor/mcp-ts/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/mol/agents/build-verifier.md +1 -1
- package/presets/cursor/mol/agents/code-reviewer.md +1 -1
- package/presets/cursor/mol/agents/debugger.md +1 -1
- package/presets/cursor/mol/agents/feature-developer.md +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/commands/README.md +4 -0
- package/presets/cursor/mol/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/next/AGENTS.md +2 -1
- package/presets/cursor/next/REPO_AGENTS.md +16 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -1
- package/presets/cursor/next/agents/debugger.md +1 -1
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/ai-local/conventions.md +6 -1
- package/presets/cursor/next/commands/README.md +4 -0
- package/presets/cursor/next/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/next/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
- package/presets/cursor/nuxt/agents/debugger.md +1 -1
- package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/commands/README.md +4 -0
- package/presets/cursor/nuxt/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
- package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/commands/README.md +4 -0
- package/presets/cursor/php-hexagonal/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-laravel/agents/debugger.md +1 -1
- package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/commands/README.md +4 -0
- package/presets/cursor/php-laravel/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/svelte/agents/build-verifier.md +1 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
- package/presets/cursor/svelte/agents/debugger.md +1 -1
- package/presets/cursor/svelte/agents/feature-developer.md +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/commands/README.md +4 -0
- package/presets/cursor/svelte/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -2
- package/presets/mavis/android-kotlin/adapter-map.json +9 -1
- package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
- package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/commands/README.md +4 -0
- package/presets/mavis/android-kotlin/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/mavis/go/adapter-map.json +9 -1
- package/presets/mavis/go/agents/build-verifier.md +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -1
- package/presets/mavis/go/agents/debugger.md +1 -1
- package/presets/mavis/go/agents/feature-developer.md +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/commands/README.md +4 -0
- package/presets/mavis/go/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/go/rules/agent-team-intake.md +2 -2
- package/presets/mavis/ios-swift/adapter-map.json +9 -1
- package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/mavis/ios-swift/agents/debugger.md +1 -1
- package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/commands/README.md +4 -0
- package/presets/mavis/ios-swift/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/mavis/java/adapter-map.json +9 -1
- package/presets/mavis/java/agents/build-verifier.md +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -1
- package/presets/mavis/java/agents/debugger.md +1 -1
- package/presets/mavis/java/agents/feature-developer.md +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/commands/README.md +4 -0
- package/presets/mavis/java/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/java/rules/agent-team-intake.md +2 -2
- package/presets/mavis/mcp-ts/adapter-map.json +9 -1
- package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/commands/README.md +4 -0
- package/presets/mavis/mcp-ts/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/mavis/mol/adapter-map.json +9 -1
- package/presets/mavis/mol/agents/build-verifier.md +1 -1
- package/presets/mavis/mol/agents/code-reviewer.md +1 -1
- package/presets/mavis/mol/agents/debugger.md +1 -1
- package/presets/mavis/mol/agents/feature-developer.md +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/commands/README.md +4 -0
- package/presets/mavis/mol/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/mol/rules/agent-team-intake.md +2 -2
- package/presets/mavis/next/MAVIS.md +2 -1
- package/presets/mavis/next/REPO_AGENTS.md +16 -0
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/accessibility-reviewer.md +4 -1
- package/presets/mavis/next/agents/api-contract-reviewer.md +5 -2
- package/presets/mavis/next/agents/build-verifier.md +6 -3
- package/presets/mavis/next/agents/ci-investigator.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +7 -4
- package/presets/mavis/next/agents/codebase-analyzer.md +4 -1
- package/presets/mavis/next/agents/debugger.md +2 -2
- package/presets/mavis/next/agents/feature-developer.md +2 -2
- package/presets/mavis/next/agents/migration-specialist.md +4 -1
- package/presets/mavis/next/agents/mockup-reviewer.md +4 -1
- package/presets/mavis/next/agents/openspec-author.md +4 -1
- package/presets/mavis/next/agents/performance-auditor.md +4 -1
- package/presets/mavis/next/agents/playwright-test-generator.md +5 -2
- package/presets/mavis/next/agents/playwright-test-healer.md +5 -2
- package/presets/mavis/next/agents/playwright-test-planner.md +5 -2
- package/presets/mavis/next/agents/qa-tester.md +5 -2
- package/presets/mavis/next/agents/security-reviewer.md +4 -1
- package/presets/mavis/next/agents/solution-architect.md +4 -1
- package/presets/mavis/next/agents/task-analyst.md +5 -2
- package/presets/mavis/next/agents/task-router.md +4 -1
- package/presets/mavis/next/agents/tech-writer.md +4 -1
- package/presets/mavis/next/agents/unit-test-generator.md +5 -2
- package/presets/mavis/next/agents/unit-test-healer.md +5 -2
- package/presets/mavis/next/agents/unit-test-planner.md +5 -2
- package/presets/mavis/next/ai-local/conventions.md +6 -1
- package/presets/mavis/next/commands/README.md +4 -0
- package/presets/mavis/next/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/next/rules/agent-team-intake.md +2 -2
- package/presets/mavis/nuxt/adapter-map.json +9 -1
- package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
- package/presets/mavis/nuxt/agents/debugger.md +1 -1
- package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/commands/README.md +4 -0
- package/presets/mavis/nuxt/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
- package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
- package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/commands/README.md +4 -0
- package/presets/mavis/php-hexagonal/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/mavis/php-laravel/adapter-map.json +9 -1
- package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-laravel/agents/debugger.md +1 -1
- package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/commands/README.md +4 -0
- package/presets/mavis/php-laravel/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/mavis/svelte/adapter-map.json +9 -1
- package/presets/mavis/svelte/agents/build-verifier.md +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
- package/presets/mavis/svelte/agents/debugger.md +1 -1
- package/presets/mavis/svelte/agents/feature-developer.md +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/commands/README.md +4 -0
- package/presets/mavis/svelte/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/svelte/rules/agent-team-intake.md +2 -2
- package/presets/opencode/android-kotlin/adapter-map.json +9 -1
- package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
- package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/commands/README.md +4 -0
- package/presets/opencode/android-kotlin/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/opencode/go/adapter-map.json +9 -1
- package/presets/opencode/go/agents/build-verifier.md +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -1
- package/presets/opencode/go/agents/debugger.md +1 -1
- package/presets/opencode/go/agents/feature-developer.md +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/commands/README.md +4 -0
- package/presets/opencode/go/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/go/rules/agent-team-intake.md +2 -2
- package/presets/opencode/ios-swift/adapter-map.json +9 -1
- package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/debugger.md +1 -1
- package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/commands/README.md +4 -0
- package/presets/opencode/ios-swift/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/opencode/java/adapter-map.json +9 -1
- package/presets/opencode/java/agents/build-verifier.md +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -1
- package/presets/opencode/java/agents/debugger.md +1 -1
- package/presets/opencode/java/agents/feature-developer.md +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/commands/README.md +4 -0
- package/presets/opencode/java/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/java/rules/agent-team-intake.md +2 -2
- package/presets/opencode/mcp-ts/adapter-map.json +9 -1
- package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/commands/README.md +4 -0
- package/presets/opencode/mcp-ts/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/opencode/mol/adapter-map.json +9 -1
- package/presets/opencode/mol/agents/build-verifier.md +1 -1
- package/presets/opencode/mol/agents/code-reviewer.md +1 -1
- package/presets/opencode/mol/agents/debugger.md +1 -1
- package/presets/opencode/mol/agents/feature-developer.md +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/commands/README.md +4 -0
- package/presets/opencode/mol/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/mol/rules/agent-team-intake.md +2 -2
- package/presets/opencode/next/OPENCODE.md +2 -1
- package/presets/opencode/next/REPO_AGENTS.md +16 -0
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/accessibility-reviewer.md +4 -1
- package/presets/opencode/next/agents/api-contract-reviewer.md +5 -2
- package/presets/opencode/next/agents/build-verifier.md +6 -3
- package/presets/opencode/next/agents/ci-investigator.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +7 -4
- package/presets/opencode/next/agents/codebase-analyzer.md +4 -1
- package/presets/opencode/next/agents/debugger.md +2 -2
- package/presets/opencode/next/agents/feature-developer.md +2 -2
- package/presets/opencode/next/agents/migration-specialist.md +4 -1
- package/presets/opencode/next/agents/mockup-reviewer.md +4 -1
- package/presets/opencode/next/agents/openspec-author.md +4 -1
- package/presets/opencode/next/agents/performance-auditor.md +4 -1
- package/presets/opencode/next/agents/playwright-test-generator.md +5 -2
- package/presets/opencode/next/agents/playwright-test-healer.md +5 -2
- package/presets/opencode/next/agents/playwright-test-planner.md +5 -2
- package/presets/opencode/next/agents/qa-tester.md +5 -2
- package/presets/opencode/next/agents/security-reviewer.md +4 -1
- package/presets/opencode/next/agents/solution-architect.md +4 -1
- package/presets/opencode/next/agents/task-analyst.md +5 -2
- package/presets/opencode/next/agents/task-router.md +4 -1
- package/presets/opencode/next/agents/tech-writer.md +4 -1
- package/presets/opencode/next/agents/unit-test-generator.md +5 -2
- package/presets/opencode/next/agents/unit-test-healer.md +5 -2
- package/presets/opencode/next/agents/unit-test-planner.md +5 -2
- package/presets/opencode/next/ai-local/conventions.md +6 -1
- package/presets/opencode/next/commands/README.md +4 -0
- package/presets/opencode/next/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/next/rules/agent-team-intake.md +2 -2
- package/presets/opencode/nuxt/adapter-map.json +9 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/debugger.md +1 -1
- package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/commands/README.md +4 -0
- package/presets/opencode/nuxt/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
- package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/commands/README.md +4 -0
- package/presets/opencode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/opencode/php-laravel/adapter-map.json +9 -1
- package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/debugger.md +1 -1
- package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/commands/README.md +4 -0
- package/presets/opencode/php-laravel/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/opencode/plugins/output-guard/README.md +56 -9
- package/presets/opencode/plugins/output-guard/actions.ts +201 -0
- package/presets/opencode/plugins/output-guard/index.ts +147 -6
- package/presets/opencode/plugins/output-guard/rewrite.ts +15 -9
- package/presets/opencode/svelte/adapter-map.json +9 -1
- package/presets/opencode/svelte/agents/build-verifier.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/debugger.md +1 -1
- package/presets/opencode/svelte/agents/feature-developer.md +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/commands/README.md +4 -0
- package/presets/opencode/svelte/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/svelte/rules/agent-team-intake.md +2 -2
- package/presets/zcode/android-kotlin/adapter-map.json +9 -1
- package/presets/zcode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/zcode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/zcode/android-kotlin/agents/debugger.md +1 -1
- package/presets/zcode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/commands/README.md +4 -0
- package/presets/zcode/android-kotlin/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/zcode/go/adapter-map.json +9 -1
- package/presets/zcode/go/agents/build-verifier.md +1 -1
- package/presets/zcode/go/agents/code-reviewer.md +1 -1
- package/presets/zcode/go/agents/debugger.md +1 -1
- package/presets/zcode/go/agents/feature-developer.md +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/commands/README.md +4 -0
- package/presets/zcode/go/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/go/rules/agent-team-intake.md +2 -2
- package/presets/zcode/ios-swift/adapter-map.json +9 -1
- package/presets/zcode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/zcode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/zcode/ios-swift/agents/debugger.md +1 -1
- package/presets/zcode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/commands/README.md +4 -0
- package/presets/zcode/ios-swift/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/zcode/java/adapter-map.json +9 -1
- package/presets/zcode/java/agents/build-verifier.md +1 -1
- package/presets/zcode/java/agents/code-reviewer.md +1 -1
- package/presets/zcode/java/agents/debugger.md +1 -1
- package/presets/zcode/java/agents/feature-developer.md +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/commands/README.md +4 -0
- package/presets/zcode/java/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/java/rules/agent-team-intake.md +2 -2
- package/presets/zcode/mcp-ts/adapter-map.json +9 -1
- package/presets/zcode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/zcode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/commands/README.md +4 -0
- package/presets/zcode/mcp-ts/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/zcode/mol/adapter-map.json +9 -1
- package/presets/zcode/mol/agents/build-verifier.md +1 -1
- package/presets/zcode/mol/agents/code-reviewer.md +1 -1
- package/presets/zcode/mol/agents/debugger.md +1 -1
- package/presets/zcode/mol/agents/feature-developer.md +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/commands/README.md +4 -0
- package/presets/zcode/mol/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/mol/rules/agent-team-intake.md +2 -2
- package/presets/zcode/next/REPO_AGENTS.md +16 -0
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/accessibility-reviewer.md +4 -1
- package/presets/zcode/next/agents/api-contract-reviewer.md +5 -2
- package/presets/zcode/next/agents/build-verifier.md +6 -3
- package/presets/zcode/next/agents/ci-investigator.md +1 -1
- package/presets/zcode/next/agents/code-reviewer.md +7 -4
- package/presets/zcode/next/agents/codebase-analyzer.md +4 -1
- package/presets/zcode/next/agents/debugger.md +2 -2
- package/presets/zcode/next/agents/feature-developer.md +2 -2
- package/presets/zcode/next/agents/migration-specialist.md +4 -1
- package/presets/zcode/next/agents/mockup-reviewer.md +4 -1
- package/presets/zcode/next/agents/openspec-author.md +4 -1
- package/presets/zcode/next/agents/performance-auditor.md +4 -1
- package/presets/zcode/next/agents/playwright-test-generator.md +5 -2
- package/presets/zcode/next/agents/playwright-test-healer.md +5 -2
- package/presets/zcode/next/agents/playwright-test-planner.md +5 -2
- package/presets/zcode/next/agents/qa-tester.md +5 -2
- package/presets/zcode/next/agents/security-reviewer.md +4 -1
- package/presets/zcode/next/agents/solution-architect.md +4 -1
- package/presets/zcode/next/agents/task-analyst.md +5 -2
- package/presets/zcode/next/agents/task-router.md +4 -1
- package/presets/zcode/next/agents/tech-writer.md +4 -1
- package/presets/zcode/next/agents/unit-test-generator.md +5 -2
- package/presets/zcode/next/agents/unit-test-healer.md +5 -2
- package/presets/zcode/next/agents/unit-test-planner.md +5 -2
- package/presets/zcode/next/ai-local/conventions.md +6 -1
- package/presets/zcode/next/commands/README.md +4 -0
- package/presets/zcode/next/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/next/rules/agent-team-intake.md +2 -2
- package/presets/zcode/nuxt/adapter-map.json +9 -1
- package/presets/zcode/nuxt/agents/build-verifier.md +1 -1
- package/presets/zcode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/zcode/nuxt/agents/debugger.md +1 -1
- package/presets/zcode/nuxt/agents/feature-developer.md +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/commands/README.md +4 -0
- package/presets/zcode/nuxt/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
- package/presets/zcode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/zcode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/zcode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/zcode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/commands/README.md +4 -0
- package/presets/zcode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/zcode/php-laravel/adapter-map.json +9 -1
- package/presets/zcode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/zcode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/zcode/php-laravel/agents/debugger.md +1 -1
- package/presets/zcode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/commands/README.md +4 -0
- package/presets/zcode/php-laravel/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/zcode/svelte/adapter-map.json +9 -1
- package/presets/zcode/svelte/agents/build-verifier.md +1 -1
- package/presets/zcode/svelte/agents/code-reviewer.md +1 -1
- package/presets/zcode/svelte/agents/debugger.md +1 -1
- package/presets/zcode/svelte/agents/feature-developer.md +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/commands/README.md +4 -0
- package/presets/zcode/svelte/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/svelte/rules/agent-team-intake.md +2 -2
|
@@ -51,6 +51,13 @@ import {
|
|
|
51
51
|
TASK_STATES,
|
|
52
52
|
serializeOpenApiDocument,
|
|
53
53
|
} from './team-db-openapi.mjs';
|
|
54
|
+
import {
|
|
55
|
+
ACTION_INTENTS,
|
|
56
|
+
SIGNAL_SEVERITIES,
|
|
57
|
+
compareSignals,
|
|
58
|
+
evaluateSignals,
|
|
59
|
+
summaryOf,
|
|
60
|
+
} from './action-signals.mjs';
|
|
54
61
|
import {
|
|
55
62
|
DEFAULT_LOG_LIMIT,
|
|
56
63
|
JOB_ID_RE,
|
|
@@ -69,6 +76,7 @@ import {
|
|
|
69
76
|
import {
|
|
70
77
|
EFFECTIVE_ENTRY_STATUSES,
|
|
71
78
|
EFFECTIVE_ITEM_STATUSES,
|
|
79
|
+
HOLDING_TASK_STATES,
|
|
72
80
|
countActiveTasks,
|
|
73
81
|
deriveTrackerOrdering,
|
|
74
82
|
effectiveEntryStatus,
|
|
@@ -205,6 +213,34 @@ const EVENT_ORDER = `
|
|
|
205
213
|
CASE ?5 WHEN 'asc' THEN e.at END ASC NULLS LAST,
|
|
206
214
|
e.seq ASC`;
|
|
207
215
|
|
|
216
|
+
// The window and task cut, shared by both action routes; `/actions` adds the
|
|
217
|
+
// intent/agent clauses it declares, `/signals` does not declare them.
|
|
218
|
+
const ACTION_WINDOW_FILTER = `
|
|
219
|
+
day >= ?1 AND day <= ?2
|
|
220
|
+
AND (?3 = '' OR task_slug = ?3)
|
|
221
|
+
AND (?4 = 1 OR task_slug IS NOT NULL)`;
|
|
222
|
+
|
|
223
|
+
const ACTION_FILTER = `${ACTION_WINDOW_FILTER}
|
|
224
|
+
AND (json_array_length(?5) = 0 OR intent IN (SELECT value FROM json_each(?5)))
|
|
225
|
+
AND (?6 = '' OR agent = ?6)`;
|
|
226
|
+
|
|
227
|
+
const ACTION_TOTALS_SELECT = `SELECT count(*) AS actions,
|
|
228
|
+
COALESCE(SUM(CASE WHEN error_class IS NOT NULL THEN 1 ELSE 0 END), 0) AS errors,
|
|
229
|
+
COALESCE(SUM(CASE WHEN repeat_index IS NOT NULL THEN 1 ELSE 0 END), 0) AS repeats,
|
|
230
|
+
COALESCE(SUM(replaced), 0) AS guard_hits,
|
|
231
|
+
COALESCE(SUM(CASE WHEN duration_ms IS NOT NULL THEN duration_ms ELSE 0 END), 0) AS busy_ms,
|
|
232
|
+
COUNT(DISTINCT CASE WHEN intent = 'mutate' THEN target_key END) AS changed_files,
|
|
233
|
+
MIN(observed_at) AS first_at,
|
|
234
|
+
MAX(observed_at) AS last_at,
|
|
235
|
+
COALESCE(SUM(CASE WHEN attribution = 'lease' THEN 1 ELSE 0 END), 0) AS rung_lease,
|
|
236
|
+
COALESCE(SUM(CASE WHEN attribution = 'window' THEN 1 ELSE 0 END), 0) AS rung_window,
|
|
237
|
+
COALESCE(SUM(CASE WHEN attribution = 'dir-mtime' THEN 1 ELSE 0 END), 0) AS rung_dir_mtime,
|
|
238
|
+
COALESCE(SUM(CASE WHEN attribution = 'unmapped' THEN 1 ELSE 0 END), 0) AS rung_unmapped`;
|
|
239
|
+
|
|
240
|
+
const ACTION_SESSIONS_SELECT = `SELECT count(DISTINCT session_id) AS sessions,
|
|
241
|
+
count(DISTINCT CASE WHEN task_slug IS NOT NULL THEN session_id END) AS mapped_sessions
|
|
242
|
+
FROM tool_calls`;
|
|
243
|
+
|
|
208
244
|
const SQL = {
|
|
209
245
|
listTasks: `SELECT
|
|
210
246
|
t.slug, t.title, t.intent, t.profile, t.spec_mode, t.state, t.phase,
|
|
@@ -455,6 +491,33 @@ const SQL = {
|
|
|
455
491
|
FROM attempts WHERE task_slug = ?1 GROUP BY step_index ORDER BY step_index ASC`,
|
|
456
492
|
efficiencyGates: `SELECT start_event_id, duration_ms, outcome FROM gates
|
|
457
493
|
WHERE task_slug = ?1 ORDER BY started_at ASC, start_event_id ASC`,
|
|
494
|
+
// The action routes aggregate the base rows directly: the per-task views have
|
|
495
|
+
// no window parameter, and a route that answers a `from`/`to` question cannot
|
|
496
|
+
// read an all-time rollup. The views stay the per-task report's source.
|
|
497
|
+
actionTotals: `${ACTION_TOTALS_SELECT} FROM tool_calls WHERE ${ACTION_FILTER}`,
|
|
498
|
+
// The same aggregates over the window+task cut alone, for `/signals`, which
|
|
499
|
+
// declares no intent and no agent.
|
|
500
|
+
actionTotalsWindow: `${ACTION_TOTALS_SELECT} FROM tool_calls WHERE ${ACTION_WINDOW_FILTER}`,
|
|
501
|
+
actionTurns: `SELECT count(*) AS turns,
|
|
502
|
+
COALESCE(SUM(input_tokens + output_tokens + reasoning_tokens), 0) AS tokens
|
|
503
|
+
FROM usage_turns WHERE day >= ?1 AND day <= ?2 AND (?3 = '' OR task_slug = ?3) AND (?4 = 1 OR task_slug IS NOT NULL)`,
|
|
504
|
+
actionSessions: `${ACTION_SESSIONS_SELECT} WHERE ${ACTION_FILTER}`,
|
|
505
|
+
actionSessionsWindow: `${ACTION_SESSIONS_SELECT} WHERE ${ACTION_WINDOW_FILTER}`,
|
|
506
|
+
actionUnmappedTurns: `SELECT count(*) AS n FROM usage_turns
|
|
507
|
+
WHERE day >= ?1 AND day <= ?2 AND (?3 = '' OR task_slug = ?3) AND (?4 = 1 OR task_slug IS NOT NULL)
|
|
508
|
+
AND attribution = 'unmapped'`,
|
|
509
|
+
actionByIntent: `SELECT intent, count(*) AS actions FROM tool_calls WHERE ${ACTION_FILTER}
|
|
510
|
+
GROUP BY intent ORDER BY actions DESC, intent ASC`,
|
|
511
|
+
actionByAgent: `SELECT COALESCE(agent, '') AS agent, count(*) AS actions FROM tool_calls WHERE ${ACTION_FILTER}
|
|
512
|
+
GROUP BY agent ORDER BY actions DESC, agent ASC`,
|
|
513
|
+
countActions: `SELECT count(*) AS total FROM tool_calls WHERE ${ACTION_FILTER}`,
|
|
514
|
+
listActions: `SELECT observed_at, task_slug, call_id, tool, intent, agent, error_class, duration_ms, gap_ms,
|
|
515
|
+
exit_code, repeat_index, attribution
|
|
516
|
+
FROM tool_calls WHERE ${ACTION_FILTER}
|
|
517
|
+
ORDER BY observed_at DESC, call_id DESC LIMIT ?7 OFFSET ?8`,
|
|
518
|
+
listActionSummaries: `SELECT * FROM task_action_summary
|
|
519
|
+
WHERE (?1 = '' OR task_slug = ?1) AND (?2 = '' OR last_at >= ?2) AND (?3 = '' OR last_at <= ?3)
|
|
520
|
+
ORDER BY actions DESC, task_slug ASC`,
|
|
458
521
|
latestContextSnapshot: 'SELECT max(snapshot_at) AS snapshot_at FROM context_cost_hosts',
|
|
459
522
|
listContextHosts: `SELECT host, rule, always_on_files, always_on_bytes, estimated_tokens
|
|
460
523
|
FROM context_cost_hosts WHERE snapshot_at = ?1 ORDER BY host ASC`,
|
|
@@ -505,7 +568,8 @@ const SQL = {
|
|
|
505
568
|
WHERE item_id = ?1 AND absent_at IS NULL AND parse_error IS NULL ORDER BY created_at, link_id`,
|
|
506
569
|
listTrackerLinksForTask: `SELECT * FROM tracker_item_tasks
|
|
507
570
|
WHERE task_slug = ?1 AND absent_at IS NULL AND parse_error IS NULL ORDER BY created_at, link_id`,
|
|
508
|
-
listTrackerTaskRows:
|
|
571
|
+
listTrackerTaskRows:
|
|
572
|
+
'SELECT slug, title, state, start_at, end_at, updated_at FROM tasks WHERE absent_at IS NULL',
|
|
509
573
|
getTrackerTaskRow: 'SELECT state, start_at, end_at FROM tasks WHERE slug = ?1 AND absent_at IS NULL',
|
|
510
574
|
};
|
|
511
575
|
|
|
@@ -1492,8 +1556,205 @@ const getEfficiencyContextCost = (db) => {
|
|
|
1492
1556
|
};
|
|
1493
1557
|
};
|
|
1494
1558
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1559
|
+
/* ---------------------------- action telemetry ---------------------------- */
|
|
1560
|
+
|
|
1561
|
+
const ACTION_INTENT_SET = new Set(ACTION_INTENTS);
|
|
1562
|
+
const ACTION_SEVERITY_SET = new Set(SIGNAL_SEVERITIES);
|
|
1563
|
+
const ACTION_DEFAULT_LIMIT = 50;
|
|
1564
|
+
const ACTION_MAX_LIMIT = 200;
|
|
1565
|
+
const EMPTY_RUNG_SPLIT = { lease: 0, window: 0, 'dir-mtime': 0, unmapped: 0 };
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* The filter of `/actions`.
|
|
1569
|
+
*
|
|
1570
|
+
* `task` narrows a window-wide read; `from`/`to` keep the shipped 30-day
|
|
1571
|
+
* default; `intent` is a repeated closed enum and `agent` an exact identifier.
|
|
1572
|
+
*/
|
|
1573
|
+
const actionFilter = (query) => {
|
|
1574
|
+
const { from, to, fromDay, toDay } = efficiencyWindow(query);
|
|
1575
|
+
const { task, includeAbsent } = efficiencyFilter(query);
|
|
1576
|
+
const intents = parseCsv(query.get('intent'), 'intent', ACTION_INTENT_SET);
|
|
1577
|
+
const agent = parsePattern(query.get('agent'), 'agent', agentPattern, 64);
|
|
1578
|
+
const limit = parseInteger(query.get('limit'), 'limit', {
|
|
1579
|
+
min: 1,
|
|
1580
|
+
max: ACTION_MAX_LIMIT,
|
|
1581
|
+
fallback: ACTION_DEFAULT_LIMIT,
|
|
1582
|
+
});
|
|
1583
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
1584
|
+
return {
|
|
1585
|
+
from,
|
|
1586
|
+
to,
|
|
1587
|
+
task,
|
|
1588
|
+
limit,
|
|
1589
|
+
offset,
|
|
1590
|
+
params: [fromDay, toDay, task, includeAbsent, JSON.stringify(intents), agent],
|
|
1591
|
+
};
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* The filter of `/signals`.
|
|
1596
|
+
*
|
|
1597
|
+
* Narrower than `actionFilter` on purpose: the route declares `task`, `from`,
|
|
1598
|
+
* `to`, `severity`, `limit` and `offset`, so the three parameters that would
|
|
1599
|
+
* otherwise bind half of the `attribution` block are refused by name instead of
|
|
1600
|
+
* silently narrowing one half. `includeAbsent` stays at its default, which keeps
|
|
1601
|
+
* every row the block counts a task row.
|
|
1602
|
+
*/
|
|
1603
|
+
const signalsFilter = (query) => {
|
|
1604
|
+
for (const name of ['intent', 'agent', 'includeAbsent']) {
|
|
1605
|
+
if (query.get(name) !== null) {
|
|
1606
|
+
fail('E_VALIDATION', 422, `${name} is not a parameter of this route`, { parameter: name });
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
const { from, to, fromDay, toDay } = efficiencyWindow(query);
|
|
1610
|
+
const { task } = efficiencyFilter(query);
|
|
1611
|
+
const severities = parseCsv(query.get('severity'), 'severity', ACTION_SEVERITY_SET);
|
|
1612
|
+
const limit = parseInteger(query.get('limit'), 'limit', {
|
|
1613
|
+
min: 1,
|
|
1614
|
+
max: ACTION_MAX_LIMIT,
|
|
1615
|
+
fallback: ACTION_DEFAULT_LIMIT,
|
|
1616
|
+
});
|
|
1617
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
1618
|
+
return { from, to, task, severities, limit, offset, params: [fromDay, toDay, task, 0] };
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
const rungOf = (totalsRow) => ({
|
|
1622
|
+
lease: Number(totalsRow.rung_lease),
|
|
1623
|
+
window: Number(totalsRow.rung_window),
|
|
1624
|
+
'dir-mtime': Number(totalsRow.rung_dir_mtime),
|
|
1625
|
+
unmapped: Number(totalsRow.rung_unmapped),
|
|
1626
|
+
});
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* The `attribution` block, assembled from one filter tuple's three reads.
|
|
1630
|
+
*
|
|
1631
|
+
* Passing the rows rather than the filter keeps every `prepare()` argument a
|
|
1632
|
+
* frozen constant, and it makes the "one block, one filter set" property visible:
|
|
1633
|
+
* a caller cannot hand in a sessions row read through a different cut.
|
|
1634
|
+
* `unmappedTurns` is window+task only — a turn carries neither an intent nor an
|
|
1635
|
+
* agent — and `coverage` is null at a zero denominator, never a confident `0`.
|
|
1636
|
+
*/
|
|
1637
|
+
const actionAttribution = (totalsRow, sessions, unmappedTurns) => {
|
|
1638
|
+
const byRung = rungOf(totalsRow);
|
|
1639
|
+
const total = Object.values(byRung).reduce((sum, value) => sum + value, 0);
|
|
1640
|
+
return {
|
|
1641
|
+
sessions: Number(sessions.sessions),
|
|
1642
|
+
mappedSessions: Number(sessions.mapped_sessions),
|
|
1643
|
+
unmappedCalls: byRung.unmapped,
|
|
1644
|
+
unmappedTurns: Number(unmappedTurns.n),
|
|
1645
|
+
byRung,
|
|
1646
|
+
coverage: total === 0 ? null : (total - byRung.unmapped) / total,
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
const actionRow = (row) => ({
|
|
1651
|
+
at: row.observed_at,
|
|
1652
|
+
task: row.task_slug,
|
|
1653
|
+
tool: row.tool,
|
|
1654
|
+
intent: row.intent ?? 'meta',
|
|
1655
|
+
agent: row.agent ?? null,
|
|
1656
|
+
errorClass: row.error_class ?? null,
|
|
1657
|
+
durationMs: row.duration_ms === null ? null : Number(row.duration_ms),
|
|
1658
|
+
gapMs: row.gap_ms === null ? null : Number(row.gap_ms),
|
|
1659
|
+
exitCode: row.exit_code === null ? null : Number(row.exit_code),
|
|
1660
|
+
repeatIndex: row.repeat_index === null ? null : Number(row.repeat_index),
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
/** The rung split of one page of items (B-6: the chip reads `attribution.byRung`). */
|
|
1664
|
+
const rungSplitOf = (rows) => {
|
|
1665
|
+
const counts = { ...EMPTY_RUNG_SPLIT };
|
|
1666
|
+
for (const row of rows) {
|
|
1667
|
+
if (row.attribution in counts) counts[row.attribution] += 1;
|
|
1668
|
+
}
|
|
1669
|
+
return Object.entries(counts).map(([rung, actions]) => ({ rung, actions }));
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
const getEfficiencyActions = (db, query) => {
|
|
1673
|
+
const filter = actionFilter(query);
|
|
1674
|
+
if (filter.task !== '') requireTask(db, filter.task);
|
|
1675
|
+
const totalsRow = db.prepare(SQL.actionTotals).get(...filter.params);
|
|
1676
|
+
const sessions = db.prepare(SQL.actionSessions).get(...filter.params);
|
|
1677
|
+
// The turns tables carry no intent and no agent, so the block's fifth key
|
|
1678
|
+
// reads the first four parameters of the same tuple.
|
|
1679
|
+
const unmappedTurns = db.prepare(SQL.actionUnmappedTurns).get(
|
|
1680
|
+
filter.params[0],
|
|
1681
|
+
filter.params[1],
|
|
1682
|
+
filter.params[2],
|
|
1683
|
+
filter.params[3],
|
|
1684
|
+
);
|
|
1685
|
+
const turns = db.prepare(SQL.actionTurns).get(
|
|
1686
|
+
filter.params[0],
|
|
1687
|
+
filter.params[1],
|
|
1688
|
+
filter.params[2],
|
|
1689
|
+
filter.params[3],
|
|
1690
|
+
);
|
|
1691
|
+
const actions = Number(totalsRow.actions);
|
|
1692
|
+
const errorActions = Number(totalsRow.errors);
|
|
1693
|
+
const repeatActions = Number(totalsRow.repeats);
|
|
1694
|
+
const firstAt = totalsRow.first_at ?? null;
|
|
1695
|
+
const lastAt = totalsRow.last_at ?? null;
|
|
1696
|
+
const first = firstAt === null ? Number.NaN : Date.parse(firstAt);
|
|
1697
|
+
const last = lastAt === null ? Number.NaN : Date.parse(lastAt);
|
|
1698
|
+
const byIntentRows = db.prepare(SQL.actionByIntent).all(...filter.params);
|
|
1699
|
+
const byAgentRows = db.prepare(SQL.actionByAgent).all(...filter.params);
|
|
1700
|
+
const total = Number(db.prepare(SQL.countActions).get(...filter.params).total);
|
|
1701
|
+
const rows = db.prepare(SQL.listActions).all(...filter.params, filter.limit, filter.offset);
|
|
1702
|
+
return {
|
|
1703
|
+
window: { from: filter.from, to: filter.to },
|
|
1704
|
+
task: filter.task === '' ? null : filter.task,
|
|
1705
|
+
// B-1: `actions` and `turns` are the two sample sizes a reader needs; a
|
|
1706
|
+
// ratio whose sample is below its floor is muted by the consumer.
|
|
1707
|
+
totals: {
|
|
1708
|
+
actions,
|
|
1709
|
+
turns: Number(turns.turns),
|
|
1710
|
+
changedFiles: Number(totalsRow.changed_files),
|
|
1711
|
+
errorRate: actions === 0 ? null : errorActions / actions,
|
|
1712
|
+
repeatRatio: actions === 0 ? null : repeatActions / actions,
|
|
1713
|
+
guardHits: Number(totalsRow.guard_hits),
|
|
1714
|
+
wallMs: Number.isFinite(first) && Number.isFinite(last) ? Math.max(0, last - first) : null,
|
|
1715
|
+
// Only the actions whose duration was observed contribute to `busyMs`.
|
|
1716
|
+
busyMs: Number(totalsRow.busy_ms),
|
|
1717
|
+
},
|
|
1718
|
+
byIntent: byIntentRows.map((row) => ({ intent: row.intent ?? 'meta', actions: Number(row.actions) })),
|
|
1719
|
+
byAgent: byAgentRows.map((row) => ({ agent: row.agent === '' ? null : row.agent, actions: Number(row.actions) })),
|
|
1720
|
+
// B-6: defined as the page's rung split; the chip reads `attribution.byRung`.
|
|
1721
|
+
coverage: rungSplitOf(rows),
|
|
1722
|
+
...page(rows.map(actionRow), total, filter.limit, filter.offset),
|
|
1723
|
+
attribution: actionAttribution(totalsRow, sessions, unmappedTurns),
|
|
1724
|
+
generatedAt: new Date().toISOString(),
|
|
1725
|
+
};
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
const getEfficiencySignals = (db, query) => {
|
|
1729
|
+
const filter = signalsFilter(query);
|
|
1730
|
+
if (filter.task !== '') requireTask(db, filter.task);
|
|
1731
|
+
// The rollup is per task, so the window selects tasks by their last action:
|
|
1732
|
+
// a task whose last action is older than `from` is not answered for.
|
|
1733
|
+
const rows = db.prepare(SQL.listActionSummaries).all(filter.task, filter.from, filter.to);
|
|
1734
|
+
const fired = [];
|
|
1735
|
+
for (const row of rows) {
|
|
1736
|
+
for (const signal of evaluateSignals(summaryOf(row))) {
|
|
1737
|
+
if (filter.severities.length > 0 && !filter.severities.includes(signal.severity)) continue;
|
|
1738
|
+
fired.push({ task: row.task_slug, ...signal });
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
// The array order is the contract: worst severity, then the signal name, then
|
|
1742
|
+
// the task, so a window-wide read is ordered like a single task's.
|
|
1743
|
+
fired.sort((left, right) => compareSignals(left, right) || left.task.localeCompare(right.task));
|
|
1744
|
+
const total = fired.length;
|
|
1745
|
+
const totalsRow = db.prepare(SQL.actionTotalsWindow).get(...filter.params);
|
|
1746
|
+
const sessions = db.prepare(SQL.actionSessionsWindow).get(...filter.params);
|
|
1747
|
+
const unmappedTurns = db.prepare(SQL.actionUnmappedTurns).get(...filter.params);
|
|
1748
|
+
return {
|
|
1749
|
+
window: { from: filter.from, to: filter.to },
|
|
1750
|
+
task: filter.task === '' ? null : filter.task,
|
|
1751
|
+
...page(fired.slice(filter.offset, filter.offset + filter.limit), total, filter.limit, filter.offset),
|
|
1752
|
+
attribution: actionAttribution(totalsRow, sessions, unmappedTurns),
|
|
1753
|
+
generatedAt: new Date().toISOString(),
|
|
1754
|
+
};
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
const listSyncRuns = (db, query) => { const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
1497
1758
|
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
1498
1759
|
const total = Number(db.prepare(SQL.countSyncRuns).get().total);
|
|
1499
1760
|
const rows = db.prepare(SQL.listSyncRuns).all(limit, offset);
|
|
@@ -2077,7 +2338,13 @@ const readTrackerSnapshotRows = (db) => {
|
|
|
2077
2338
|
const links = new Map();
|
|
2078
2339
|
const taskRows = new Map();
|
|
2079
2340
|
for (const row of db.prepare(SQL.listTrackerTaskRows).all()) {
|
|
2080
|
-
taskRows.set(row.slug, {
|
|
2341
|
+
taskRows.set(row.slug, {
|
|
2342
|
+
state: row.state ?? null,
|
|
2343
|
+
title: row.title ?? null,
|
|
2344
|
+
startAt: row.start_at ?? null,
|
|
2345
|
+
endAt: row.end_at ?? null,
|
|
2346
|
+
updatedAt: row.updated_at ?? null,
|
|
2347
|
+
});
|
|
2081
2348
|
}
|
|
2082
2349
|
const depsByItem = new Map();
|
|
2083
2350
|
for (const dep of db.prepare(SQL.listTrackerDeps).all()) {
|
|
@@ -2295,9 +2562,12 @@ const trackerItemDetail = (db, id, teamRoot = null) => {
|
|
|
2295
2562
|
};
|
|
2296
2563
|
})
|
|
2297
2564
|
.sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.linkId.localeCompare(right.linkId));
|
|
2298
|
-
const queue = [
|
|
2299
|
-
.filter((entry) => entry.itemId === id)
|
|
2300
|
-
|
|
2565
|
+
const queue = [
|
|
2566
|
+
...liveHoldingTaskRows(snapshot).filter((entry) => entry.itemId === id),
|
|
2567
|
+
...[...snapshot.entries.values()]
|
|
2568
|
+
.filter((entry) => entry.itemId === id)
|
|
2569
|
+
.map((entry) => trackerQueueEntryJson(entry, snapshot.taskRows, annotated.item.title)),
|
|
2570
|
+
];
|
|
2301
2571
|
return {
|
|
2302
2572
|
item: trackerItemJson(annotated),
|
|
2303
2573
|
dependencies,
|
|
@@ -2308,19 +2578,81 @@ const trackerItemDetail = (db, id, teamRoot = null) => {
|
|
|
2308
2578
|
};
|
|
2309
2579
|
};
|
|
2310
2580
|
|
|
2581
|
+
/**
|
|
2582
|
+
* A holding task occupies a launch slot even when no tracker item is linked
|
|
2583
|
+
* and no queue file exists. The row is derived: `entryId` stays null so cancel
|
|
2584
|
+
* cannot target it, and a non-terminal queue entry for the same slug wins.
|
|
2585
|
+
*/
|
|
2586
|
+
const liveHoldingTaskRows = (snapshot) => {
|
|
2587
|
+
const covered = new Set();
|
|
2588
|
+
for (const entry of snapshot.entries.values()) {
|
|
2589
|
+
const taskSlug = entry.taskSlug ?? `tracker-${entry.itemId}`;
|
|
2590
|
+
const taskState = snapshot.taskRows.get(taskSlug)?.state ?? null;
|
|
2591
|
+
if (!['cancelled', 'expired', 'done'].includes(effectiveEntryStatus(entry, taskState))) {
|
|
2592
|
+
covered.add(taskSlug);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
const linksBySlug = new Map();
|
|
2596
|
+
for (const link of snapshot.links.values()) {
|
|
2597
|
+
if (link.decision === 'unlinked') continue;
|
|
2598
|
+
const list = linksBySlug.get(link.taskSlug) ?? [];
|
|
2599
|
+
list.push(link);
|
|
2600
|
+
linksBySlug.set(link.taskSlug, list);
|
|
2601
|
+
}
|
|
2602
|
+
const rows = [];
|
|
2603
|
+
for (const [taskSlug, taskRow] of snapshot.taskRows) {
|
|
2604
|
+
if (!HOLDING_TASK_STATES.has(taskRow.state)) continue;
|
|
2605
|
+
if (covered.has(taskSlug)) continue;
|
|
2606
|
+
const links = linksBySlug.get(taskSlug) ?? [];
|
|
2607
|
+
links.sort((left, right) => {
|
|
2608
|
+
if (left.role === 'primary' && right.role !== 'primary') return -1;
|
|
2609
|
+
if (right.role === 'primary' && left.role !== 'primary') return 1;
|
|
2610
|
+
return String(left.linkId).localeCompare(String(right.linkId));
|
|
2611
|
+
});
|
|
2612
|
+
const link = links[0] ?? null;
|
|
2613
|
+
let item = link === null ? null : (snapshot.items.get(link.itemId) ?? null);
|
|
2614
|
+
if (item === null && link === null && /^[1-9][0-9]*$/.test(taskSlug)) {
|
|
2615
|
+
item = snapshot.items.get(Number(taskSlug)) ?? null;
|
|
2616
|
+
}
|
|
2617
|
+
rows.push({
|
|
2618
|
+
entryId: null,
|
|
2619
|
+
itemId: link?.itemId ?? item?.id ?? null,
|
|
2620
|
+
taskSlug,
|
|
2621
|
+
linkId: link?.linkId ?? null,
|
|
2622
|
+
status: 'active',
|
|
2623
|
+
reason: 'current task',
|
|
2624
|
+
requestedBy: 'task',
|
|
2625
|
+
command: null,
|
|
2626
|
+
revision: 1,
|
|
2627
|
+
requestedAt: taskRow.startAt ?? taskRow.updatedAt ?? '1970-01-01T00:00:00.000Z',
|
|
2628
|
+
claimedAt: null,
|
|
2629
|
+
finishedAt: null,
|
|
2630
|
+
history: [],
|
|
2631
|
+
itemTitle: item?.title ?? taskRow.title ?? taskSlug,
|
|
2632
|
+
taskState: taskRow.state,
|
|
2633
|
+
taskStartAt: taskRow.startAt ?? null,
|
|
2634
|
+
taskEndAt: taskRow.endAt ?? null,
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
rows.sort((left, right) => left.taskSlug.localeCompare(right.taskSlug));
|
|
2638
|
+
return rows;
|
|
2639
|
+
};
|
|
2640
|
+
|
|
2311
2641
|
const listTrackerQueue = (db, query) => {
|
|
2312
2642
|
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: TRACKER_MAX_LIMIT, fallback: TRACKER_DEFAULT_LIMIT });
|
|
2313
2643
|
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
2314
2644
|
const statuses = parseCsv(query.get('status'), 'status', TRACKER_EFFECTIVE_ENTRY_SET);
|
|
2315
2645
|
const itemId = query.get('itemId') === null ? null : parseItemId(query.get('itemId'), 'itemId');
|
|
2316
2646
|
const snapshot = readTrackerSnapshotRows(db);
|
|
2317
|
-
|
|
2647
|
+
const stored = [...snapshot.entries.values()]
|
|
2318
2648
|
.filter((entry) => itemId === null || entry.itemId === itemId)
|
|
2319
2649
|
.map((entry) => trackerQueueEntryJson(entry, snapshot.taskRows, snapshot.items.get(entry.itemId)?.title ?? String(entry.itemId)));
|
|
2650
|
+
const live = liveHoldingTaskRows(snapshot).filter((entry) => itemId === null || entry.itemId === itemId);
|
|
2651
|
+
let items = [...live, ...stored];
|
|
2320
2652
|
if (statuses.length > 0) items = items.filter((entry) => statuses.includes(entry.status));
|
|
2321
2653
|
const total = items.length;
|
|
2322
2654
|
const pageItems = items.slice(offset, offset + limit);
|
|
2323
|
-
const activeEntryId = items.find((entry) => entry.status === 'active')?.entryId ?? null;
|
|
2655
|
+
const activeEntryId = items.find((entry) => entry.status === 'active' && entry.entryId !== null)?.entryId ?? null;
|
|
2324
2656
|
return {
|
|
2325
2657
|
items: pageItems,
|
|
2326
2658
|
total,
|
|
@@ -2754,6 +3086,12 @@ export const ROUTES = [
|
|
|
2754
3086
|
route('GET', '/api/v1/efficiency/context-cost', 'getEfficiencyContextCost', (context) => ({
|
|
2755
3087
|
json: getEfficiencyContextCost(context.db()),
|
|
2756
3088
|
})),
|
|
3089
|
+
route('GET', '/api/v1/efficiency/actions', 'getEfficiencyActions', (context) => ({
|
|
3090
|
+
json: getEfficiencyActions(context.db(), context.query),
|
|
3091
|
+
})),
|
|
3092
|
+
route('GET', '/api/v1/efficiency/signals', 'getEfficiencySignals', (context) => ({
|
|
3093
|
+
json: getEfficiencySignals(context.db(), context.query),
|
|
3094
|
+
})),
|
|
2757
3095
|
route('GET', '/api/v1/sync-runs', 'listSyncRuns', (context) => ({ json: listSyncRuns(context.db(), context.query) })),
|
|
2758
3096
|
route('POST', '/api/v1/sync', 'triggerSync', async (context) => {
|
|
2759
3097
|
const text = context.body.toString('utf8').trim();
|