@bonesofspring/ai-rules 0.2.51 → 0.2.53
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 +92 -0
- package/README.md +27 -3
- package/bin/cli.js +565 -61
- package/bin/lib/ai-local-drift.js +55 -14
- package/bin/lib/engine-scripts.js +10 -0
- package/bin/lib/mcp/clients.js +168 -0
- package/bin/lib/mcp/credentials.js +298 -0
- package/bin/lib/mcp/doctor.js +394 -0
- package/bin/lib/mcp/prompt.js +115 -0
- package/bin/lib/mcp/registry.js +170 -0
- package/bin/lib/mcp/run.js +123 -0
- package/bin/lib/merged-config.js +45 -0
- package/bin/lib/seed-ai-local-team.js +23 -7
- package/bin/lib/tool-installs.js +27 -0
- package/bin/mavis-install.js +2 -0
- package/bin/opencode-install.js +2 -0
- package/docs/LOCAL-OVERLAY.md +1 -1
- package/docs/MCP-SETUP.md +62 -0
- package/docs/PRESET-CONTRIBUTION.md +14 -10
- package/docs/TEAM-DB.md +173 -0
- package/docs/openapi/team-db.v1.json +5085 -0
- package/mcp/gitlab.mjs +123 -0
- package/mcp/lib/envfile.mjs +126 -0
- package/mcp/lib/yandex.mjs +384 -0
- package/mcp/yandex-mcp-proxy.mjs +155 -0
- package/mcp/yandex-token-refresh.mjs +65 -0
- package/package.json +18 -1
- package/presets/_shared/ai-local/scripts/manifest.mjs +112 -3
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +428 -91
- package/presets/_shared/ai-local/scripts/run.mjs +22 -4
- package/presets/_shared/ai-local/scripts/signals.mjs +4 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +1275 -0
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +1067 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +1301 -0
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +1506 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +831 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +251 -0
- package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
- package/presets/_shared/core/quality/interactive-questions.md +8 -8
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +109 -0
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/android-kotlin/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/android-kotlin/team/README.md +10 -0
- package/presets/claude/go/agents/code-reviewer.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/go/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/go/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/go/team/README.md +10 -0
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/ios-swift/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/ios-swift/team/README.md +10 -0
- package/presets/claude/java/agents/code-reviewer.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/java/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/java/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/java/team/README.md +10 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/mcp-ts/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/mcp-ts/team/README.md +10 -0
- package/presets/claude/next/MCP.md +7 -0
- package/presets/claude/next/README.md +1 -1
- package/presets/claude/next/REPO_AGENTS.md +1 -1
- package/presets/claude/next/agents/README.md +3 -3
- package/presets/claude/next/agents/build-verifier.md +9 -3
- package/presets/claude/next/agents/code-reviewer.md +2 -1
- package/presets/claude/next/agents/codebase-analyzer.md +1 -1
- package/presets/claude/next/agents/feature-developer.md +18 -8
- package/presets/claude/next/agents/openspec-author.md +1 -1
- package/presets/claude/next/agents/playwright-test-generator.md +22 -68
- package/presets/claude/next/agents/playwright-test-healer.md +27 -54
- package/presets/claude/next/agents/playwright-test-planner.md +18 -51
- package/presets/claude/next/agents/task-analyst.md +25 -9
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/agents/tech-writer.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/next/mcp.json +3 -3
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +1 -1
- package/presets/claude/next/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/next/rules/architecture/reference-features.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router.md +14 -0
- package/presets/claude/next/rules/stack/next-app-core.md +19 -17
- package/presets/claude/next/rules/stack/next-app-router.md +5 -17
- package/presets/claude/next/rules/stack/next-static-export.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/next/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/security-next.md +28 -3
- package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +1 -1
- package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +4 -4
- package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +2 -2
- package/presets/claude/next/team/README.md +21 -0
- package/presets/claude/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/claude/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/claude/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/nuxt/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/nuxt/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/nuxt/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/nuxt/team/README.md +10 -0
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-hexagonal/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-hexagonal/team/README.md +10 -0
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-laravel/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-laravel/team/README.md +10 -0
- package/presets/claude/svelte/agents/code-reviewer.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/svelte/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/svelte/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/svelte/team/README.md +10 -0
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/android-kotlin/rules/README.md +1 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/android-kotlin/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/android-kotlin/team/README.md +10 -0
- package/presets/cursor/go/agents/code-reviewer.md +1 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/go/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/go/team/README.md +10 -0
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/ios-swift/rules/README.md +1 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/ios-swift/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/ios-swift/team/README.md +10 -0
- package/presets/cursor/java/agents/code-reviewer.md +1 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/java/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/java/team/README.md +10 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/mcp-ts/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/mcp-ts/team/README.md +10 -0
- package/presets/cursor/next/MCP.md +14 -0
- package/presets/cursor/next/REPO_AGENTS.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +1 -0
- package/presets/cursor/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/cursor/next/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/next/mcp.json +3 -3
- package/presets/cursor/next/rules/README.md +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/css-property-order-stylelint.mdc +1 -1
- package/presets/cursor/next/rules/design-tokens-binding.mdc +4 -4
- package/presets/cursor/next/rules/forms-validation.mdc +2 -2
- package/presets/cursor/next/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/next/rules/navigation-router-stack.mdc +14 -1
- package/presets/cursor/next/rules/next-app-core.mdc +19 -17
- package/presets/cursor/next/rules/next-app-router.mdc +5 -17
- package/presets/cursor/next/rules/next-static-export.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +1 -1
- package/presets/cursor/next/rules/reference-features.mdc +1 -1
- package/presets/cursor/next/rules/security-next.mdc +28 -3
- package/presets/cursor/next/team/README.md +21 -0
- package/presets/cursor/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/cursor/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/cursor/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/nuxt/team/README.md +10 -0
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-hexagonal/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-hexagonal/team/README.md +10 -0
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-laravel/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-laravel/team/README.md +10 -0
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/svelte/team/README.md +10 -0
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/android-kotlin/team/README.md +10 -0
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/go/rules/interactive-questions.md +8 -8
- package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/go/team/README.md +10 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/ios-swift/team/README.md +10 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/java/rules/interactive-questions.md +8 -8
- package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/java/team/README.md +10 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/mcp-ts/team/README.md +10 -0
- package/presets/mavis/next/MCP.md +14 -0
- package/presets/mavis/next/REPO_AGENTS.md +1 -1
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +1 -0
- package/presets/mavis/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/mavis/next/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/next/mcp.json +3 -3
- package/presets/mavis/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/mavis/next/rules/design-tokens-binding.md +4 -4
- package/presets/mavis/next/rules/forms-validation.md +2 -2
- package/presets/mavis/next/rules/interactive-questions.md +8 -8
- package/presets/mavis/next/rules/navigation-router-stack.md +12 -0
- package/presets/mavis/next/rules/next-app-core.md +18 -17
- package/presets/mavis/next/rules/next-app-router.md +4 -17
- package/presets/mavis/next/rules/next-static-export.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/mavis/next/rules/reference-features.md +1 -1
- package/presets/mavis/next/rules/security-next.md +24 -3
- package/presets/mavis/next/team/README.md +21 -0
- package/presets/mavis/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/mavis/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/mavis/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/nuxt/rules/interactive-questions.md +8 -8
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/nuxt/team/README.md +10 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-hexagonal/team/README.md +10 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-laravel/team/README.md +10 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/svelte/rules/interactive-questions.md +8 -8
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/svelte/team/README.md +10 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/android-kotlin/team/README.md +10 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/go/rules/interactive-questions.md +8 -8
- package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/go/team/README.md +10 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/ios-swift/team/README.md +10 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/java/rules/interactive-questions.md +8 -8
- package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/java/team/README.md +10 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/mcp-ts/team/README.md +10 -0
- package/presets/opencode/next/MCP.md +14 -0
- package/presets/opencode/next/REPO_AGENTS.md +1 -1
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +1 -0
- package/presets/opencode/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/opencode/next/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/next/opencode.json +3 -3
- package/presets/opencode/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/opencode/next/rules/design-tokens-binding.md +4 -4
- package/presets/opencode/next/rules/forms-validation.md +2 -2
- package/presets/opencode/next/rules/interactive-questions.md +8 -8
- package/presets/opencode/next/rules/navigation-router-stack.md +12 -0
- package/presets/opencode/next/rules/next-app-core.md +18 -17
- package/presets/opencode/next/rules/next-app-router.md +4 -17
- package/presets/opencode/next/rules/next-static-export.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/opencode/next/rules/reference-features.md +1 -1
- package/presets/opencode/next/rules/security-next.md +24 -3
- package/presets/opencode/next/team/README.md +21 -0
- package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/opencode/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/nuxt/rules/interactive-questions.md +8 -8
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/nuxt/team/README.md +10 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-hexagonal/team/README.md +10 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-laravel/team/README.md +10 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/svelte/rules/interactive-questions.md +8 -8
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/svelte/team/README.md +10 -0
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OpenAPI 3.1 document for the read-only team-db API.
|
|
3
|
+
*
|
|
4
|
+
* This module is the single source of the checked-in
|
|
5
|
+
* `packages/ai-rules/docs/openapi/team-db.v1.json`: `check-team-db-contract.mjs
|
|
6
|
+
* --write` serializes `OPENAPI_DOCUMENT` and the gate fails on any drift. The
|
|
7
|
+
* server serves the same serialization, so `/openapi.json` equals the checked-in
|
|
8
|
+
* bytes by construction.
|
|
9
|
+
*
|
|
10
|
+
* Versioning: the URL major and `info.version` major move together. Additive
|
|
11
|
+
* operations, optional fields, optional parameters and new enum values are
|
|
12
|
+
* allowed inside v1; removing or renaming anything is a v2 document.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const API_MAJOR = 1;
|
|
16
|
+
export const API_VERSION = '1.0.0';
|
|
17
|
+
export const OPENAPI_VERSION = '3.1.0';
|
|
18
|
+
export const OPENAPI_JSON_SCHEMA_DIALECT = 'https://json-schema.org/draft/2020-12/schema';
|
|
19
|
+
export const OPENAPI_SERVER_URL = 'http://127.0.0.1:4178';
|
|
20
|
+
|
|
21
|
+
/** Mirrors `SLUG_RE` in `team-db-project.mjs`; a path parameter, never a file path. */
|
|
22
|
+
export const SLUG_PATTERN = '^[a-z0-9]+(?:-[a-z0-9]+)*$';
|
|
23
|
+
export const AGENT_PATTERN = '^[a-z0-9][a-z0-9-]{0,63}$';
|
|
24
|
+
export const INTENT_PATTERN = '^[a-z][a-z0-9-]{0,31}$';
|
|
25
|
+
|
|
26
|
+
export const TASK_STATES = [
|
|
27
|
+
'in_progress',
|
|
28
|
+
'completed',
|
|
29
|
+
'changes_requested',
|
|
30
|
+
'validation_failed',
|
|
31
|
+
'blocked',
|
|
32
|
+
'awaiting_approval',
|
|
33
|
+
'awaiting_artifact_receipt',
|
|
34
|
+
];
|
|
35
|
+
export const PROFILES = ['light', 'standard', 'full'];
|
|
36
|
+
export const SORT_VALUES = ['updatedAt', '-updatedAt', 'startAt', '-startAt', 'slug', '-slug'];
|
|
37
|
+
export const EVENT_TYPES = [
|
|
38
|
+
'task_started',
|
|
39
|
+
'task_completed',
|
|
40
|
+
'attempt_started',
|
|
41
|
+
'attempt_finished',
|
|
42
|
+
'human_gate_started',
|
|
43
|
+
'human_gate_ended',
|
|
44
|
+
'retry_scheduled',
|
|
45
|
+
'step_skipped',
|
|
46
|
+
'parallel_wave_started',
|
|
47
|
+
'step_joined',
|
|
48
|
+
'parallel_attribution_repair',
|
|
49
|
+
'conflict_deferred',
|
|
50
|
+
'pipeline_parse_error',
|
|
51
|
+
'unknown',
|
|
52
|
+
];
|
|
53
|
+
export const ERROR_CODES = [
|
|
54
|
+
'E_BAD_REQUEST',
|
|
55
|
+
'E_FORBIDDEN_HOST',
|
|
56
|
+
'E_FORBIDDEN_ORIGIN',
|
|
57
|
+
'E_NOT_FOUND',
|
|
58
|
+
'E_METHOD_NOT_ALLOWED',
|
|
59
|
+
'E_VALIDATION',
|
|
60
|
+
'E_PAYLOAD_TOO_LARGE',
|
|
61
|
+
'E_DOC_NOT_FOUND',
|
|
62
|
+
'E_DOC_BINARY',
|
|
63
|
+
'E_DOC_CONTENT_OMITTED',
|
|
64
|
+
'E_RANGE',
|
|
65
|
+
'E_DISABLED',
|
|
66
|
+
'E_DB_MISSING',
|
|
67
|
+
'E_DB_CORRUPT',
|
|
68
|
+
'E_SCHEMA_MISMATCH',
|
|
69
|
+
'E_SCHEMA_OUTDATED',
|
|
70
|
+
'E_SCHEMA_NEWER',
|
|
71
|
+
'E_BUSY',
|
|
72
|
+
'E_INTERNAL',
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const nullable = (type) => ({ type: [type, 'null'] });
|
|
76
|
+
const ref = (name) => ({ $ref: `#/components/schemas/${name}` });
|
|
77
|
+
const object = (properties, required = []) => ({
|
|
78
|
+
type: 'object',
|
|
79
|
+
additionalProperties: false,
|
|
80
|
+
properties,
|
|
81
|
+
...(required.length > 0 ? { required } : {}),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const jsonResponse = (name, description) => ({
|
|
85
|
+
description,
|
|
86
|
+
content: { 'application/json': { schema: ref(name) } },
|
|
87
|
+
});
|
|
88
|
+
const errorResponse = (description, headers) => ({
|
|
89
|
+
description,
|
|
90
|
+
...(headers ? { headers } : {}),
|
|
91
|
+
content: { 'application/json': { schema: ref('ErrorEnvelope') } },
|
|
92
|
+
});
|
|
93
|
+
const assetResponse = (mediaType, description) => ({
|
|
94
|
+
description,
|
|
95
|
+
content: { [mediaType]: { schema: { type: 'string' } } },
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const methodNotAllowedResponse = errorResponse('The route does not accept this method; the response carries an Allow header', {
|
|
99
|
+
Allow: { description: 'HTTP methods allowed on this path, for example `GET, HEAD`', schema: { type: 'string' } },
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const commonErrorResponses = {
|
|
103
|
+
400: errorResponse('Malformed request: an invalid slug or an invalid document path'),
|
|
104
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
105
|
+
404: errorResponse('The task, document or route does not exist'),
|
|
106
|
+
405: methodNotAllowedResponse,
|
|
107
|
+
422: errorResponse('A query parameter is outside its documented bounds'),
|
|
108
|
+
503: errorResponse('The projection database is missing, unusable, busy, or the projection is disabled'),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const csvParameterDescription = (label, values) =>
|
|
112
|
+
`Comma-separated ${label}. Valid values: ${values.map((value) => `\`${value}\``).join(', ')}. Any value outside this list is rejected with 422 \`E_VALIDATION\`.`;
|
|
113
|
+
|
|
114
|
+
const paginationParameters = [
|
|
115
|
+
{
|
|
116
|
+
name: 'limit',
|
|
117
|
+
in: 'query',
|
|
118
|
+
description: 'Page size, 1..200.',
|
|
119
|
+
required: false,
|
|
120
|
+
schema: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'offset',
|
|
124
|
+
in: 'query',
|
|
125
|
+
description: 'Zero-based row offset, 0..1000000.',
|
|
126
|
+
required: false,
|
|
127
|
+
schema: { type: 'integer', minimum: 0, maximum: 1000000, default: 0 },
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const slugParameter = {
|
|
132
|
+
name: 'slug',
|
|
133
|
+
in: 'path',
|
|
134
|
+
required: true,
|
|
135
|
+
description: 'Task directory name.',
|
|
136
|
+
schema: { type: 'string', pattern: SLUG_PATTERN },
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const attemptOutcomeValues = ['completed', 'blocked', 'changes_requested', 'validation_failed', 'skipped'];
|
|
140
|
+
|
|
141
|
+
const schemas = {
|
|
142
|
+
Error: object(
|
|
143
|
+
{
|
|
144
|
+
code: { type: 'string', enum: ERROR_CODES },
|
|
145
|
+
message: { type: 'string' },
|
|
146
|
+
details: { type: 'object', additionalProperties: true },
|
|
147
|
+
},
|
|
148
|
+
['code', 'message'],
|
|
149
|
+
),
|
|
150
|
+
ErrorEnvelope: object({ error: ref('Error') }, ['error']),
|
|
151
|
+
Page: object(
|
|
152
|
+
{
|
|
153
|
+
total: { type: 'integer', minimum: 0 },
|
|
154
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
155
|
+
offset: { type: 'integer', minimum: 0 },
|
|
156
|
+
nextOffset: nullable('integer'),
|
|
157
|
+
},
|
|
158
|
+
['total', 'limit', 'offset', 'nextOffset'],
|
|
159
|
+
),
|
|
160
|
+
TaskSummary: object(
|
|
161
|
+
{
|
|
162
|
+
slug: { type: 'string', pattern: SLUG_PATTERN },
|
|
163
|
+
title: nullable('string'),
|
|
164
|
+
intent: nullable('string'),
|
|
165
|
+
profile: nullable('string'),
|
|
166
|
+
specMode: nullable('string'),
|
|
167
|
+
state: nullable('string'),
|
|
168
|
+
phase: nullable('string'),
|
|
169
|
+
pipelineIndex: nullable('integer'),
|
|
170
|
+
currentAgent: nullable('string'),
|
|
171
|
+
awaitingHumanGate: { type: 'boolean' },
|
|
172
|
+
stack: nullable('string'),
|
|
173
|
+
platform: nullable('string'),
|
|
174
|
+
updatedAt: nullable('string'),
|
|
175
|
+
startAt: nullable('string'),
|
|
176
|
+
endAt: nullable('string'),
|
|
177
|
+
durationMs: nullable('integer'),
|
|
178
|
+
attempts: { type: 'integer', minimum: 0 },
|
|
179
|
+
artifacts: { type: 'integer', minimum: 0 },
|
|
180
|
+
files: { type: 'integer', minimum: 0 },
|
|
181
|
+
documentBytes: { type: 'integer', minimum: 0 },
|
|
182
|
+
parseErrors: { type: 'integer', minimum: 0 },
|
|
183
|
+
gateState: { type: 'string', enum: ['awaiting', 'closed', 'none'] },
|
|
184
|
+
projectedAt: { type: 'string' },
|
|
185
|
+
lastSeenAt: { type: 'string' },
|
|
186
|
+
absentAt: nullable('string'),
|
|
187
|
+
contentHash: { type: 'string' },
|
|
188
|
+
},
|
|
189
|
+
[
|
|
190
|
+
'slug',
|
|
191
|
+
'title',
|
|
192
|
+
'intent',
|
|
193
|
+
'profile',
|
|
194
|
+
'specMode',
|
|
195
|
+
'state',
|
|
196
|
+
'phase',
|
|
197
|
+
'pipelineIndex',
|
|
198
|
+
'currentAgent',
|
|
199
|
+
'awaitingHumanGate',
|
|
200
|
+
'stack',
|
|
201
|
+
'platform',
|
|
202
|
+
'updatedAt',
|
|
203
|
+
'startAt',
|
|
204
|
+
'endAt',
|
|
205
|
+
'durationMs',
|
|
206
|
+
'attempts',
|
|
207
|
+
'artifacts',
|
|
208
|
+
'files',
|
|
209
|
+
'documentBytes',
|
|
210
|
+
'parseErrors',
|
|
211
|
+
'gateState',
|
|
212
|
+
'projectedAt',
|
|
213
|
+
'lastSeenAt',
|
|
214
|
+
'absentAt',
|
|
215
|
+
'contentHash',
|
|
216
|
+
],
|
|
217
|
+
),
|
|
218
|
+
TaskList: object(
|
|
219
|
+
{
|
|
220
|
+
items: { type: 'array', items: ref('TaskSummary') },
|
|
221
|
+
total: { type: 'integer', minimum: 0 },
|
|
222
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
223
|
+
offset: { type: 'integer', minimum: 0 },
|
|
224
|
+
nextOffset: nullable('integer'),
|
|
225
|
+
},
|
|
226
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
227
|
+
),
|
|
228
|
+
TaskDetail: object(
|
|
229
|
+
{
|
|
230
|
+
task: ref('TaskSummary'),
|
|
231
|
+
routing: object({ summary: nullable('string'), decision: { type: 'object', additionalProperties: true } }, [
|
|
232
|
+
'summary',
|
|
233
|
+
'decision',
|
|
234
|
+
]),
|
|
235
|
+
counts: object(
|
|
236
|
+
{
|
|
237
|
+
events: { type: 'integer', minimum: 0 },
|
|
238
|
+
attempts: { type: 'integer', minimum: 0 },
|
|
239
|
+
gates: { type: 'integer', minimum: 0 },
|
|
240
|
+
prompts: { type: 'integer', minimum: 0 },
|
|
241
|
+
documents: { type: 'integer', minimum: 0 },
|
|
242
|
+
},
|
|
243
|
+
['events', 'attempts', 'gates', 'prompts', 'documents'],
|
|
244
|
+
),
|
|
245
|
+
hasPrompt: { type: 'boolean' },
|
|
246
|
+
},
|
|
247
|
+
['task', 'routing', 'counts', 'hasPrompt'],
|
|
248
|
+
),
|
|
249
|
+
PipelineStep: object(
|
|
250
|
+
{
|
|
251
|
+
index: { type: 'integer', minimum: 0 },
|
|
252
|
+
label: nullable('string'),
|
|
253
|
+
agents: { type: 'array', items: { type: 'string' } },
|
|
254
|
+
scope: nullable('string'),
|
|
255
|
+
model: nullable('string'),
|
|
256
|
+
skipIf: nullable('string'),
|
|
257
|
+
parallel: { type: 'boolean' },
|
|
258
|
+
dependsOn: { type: 'array', items: { type: 'string' } },
|
|
259
|
+
taskIds: { type: 'array', items: { type: 'string' } },
|
|
260
|
+
writeScopes: { type: 'array', items: { type: 'string' } },
|
|
261
|
+
state: { type: 'string', enum: ['completed', 'in_progress', 'pending', 'skipped', 'blocked'] },
|
|
262
|
+
},
|
|
263
|
+
['index', 'label', 'agents', 'scope', 'model', 'skipIf', 'parallel', 'dependsOn', 'taskIds', 'writeScopes', 'state'],
|
|
264
|
+
),
|
|
265
|
+
Pipeline: object(
|
|
266
|
+
{
|
|
267
|
+
slug: { type: 'string', pattern: SLUG_PATTERN },
|
|
268
|
+
steps: { type: 'array', items: ref('PipelineStep') },
|
|
269
|
+
},
|
|
270
|
+
['slug', 'steps'],
|
|
271
|
+
),
|
|
272
|
+
Attempt: object(
|
|
273
|
+
{
|
|
274
|
+
attemptId: { type: 'string' },
|
|
275
|
+
agent: nullable('string'),
|
|
276
|
+
role: nullable('string'),
|
|
277
|
+
stepIndex: nullable('integer'),
|
|
278
|
+
stepLabel: nullable('string'),
|
|
279
|
+
attempt: nullable('integer'),
|
|
280
|
+
startedAt: nullable('string'),
|
|
281
|
+
finishedAt: nullable('string'),
|
|
282
|
+
durationMs: nullable('integer'),
|
|
283
|
+
outcome: nullable('string'),
|
|
284
|
+
source: nullable('string'),
|
|
285
|
+
attributionConfidence: nullable('string'),
|
|
286
|
+
current: { type: 'boolean' },
|
|
287
|
+
},
|
|
288
|
+
[
|
|
289
|
+
'attemptId',
|
|
290
|
+
'agent',
|
|
291
|
+
'role',
|
|
292
|
+
'stepIndex',
|
|
293
|
+
'stepLabel',
|
|
294
|
+
'attempt',
|
|
295
|
+
'startedAt',
|
|
296
|
+
'finishedAt',
|
|
297
|
+
'durationMs',
|
|
298
|
+
'outcome',
|
|
299
|
+
'source',
|
|
300
|
+
'attributionConfidence',
|
|
301
|
+
'current',
|
|
302
|
+
],
|
|
303
|
+
),
|
|
304
|
+
AttemptList: object(
|
|
305
|
+
{
|
|
306
|
+
items: { type: 'array', items: ref('Attempt') },
|
|
307
|
+
total: { type: 'integer', minimum: 0 },
|
|
308
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
309
|
+
offset: { type: 'integer', minimum: 0 },
|
|
310
|
+
nextOffset: nullable('integer'),
|
|
311
|
+
},
|
|
312
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
313
|
+
),
|
|
314
|
+
Event: object(
|
|
315
|
+
{
|
|
316
|
+
eventId: { type: 'string' },
|
|
317
|
+
seq: { type: 'integer' },
|
|
318
|
+
type: { type: 'string' },
|
|
319
|
+
at: nullable('string'),
|
|
320
|
+
attemptId: nullable('string'),
|
|
321
|
+
stepIndex: nullable('integer'),
|
|
322
|
+
stepLabel: nullable('string'),
|
|
323
|
+
agent: nullable('string'),
|
|
324
|
+
role: nullable('string'),
|
|
325
|
+
attempt: nullable('integer'),
|
|
326
|
+
outcome: nullable('string'),
|
|
327
|
+
waveId: nullable('string'),
|
|
328
|
+
parallelGroupId: nullable('string'),
|
|
329
|
+
durationMs: nullable('integer'),
|
|
330
|
+
source: nullable('string'),
|
|
331
|
+
attributionConfidence: nullable('string'),
|
|
332
|
+
payload: { type: 'object', additionalProperties: true },
|
|
333
|
+
},
|
|
334
|
+
['eventId', 'seq', 'type', 'at', 'payload'],
|
|
335
|
+
),
|
|
336
|
+
EventList: object(
|
|
337
|
+
{
|
|
338
|
+
items: { type: 'array', items: ref('Event') },
|
|
339
|
+
total: { type: 'integer', minimum: 0 },
|
|
340
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
341
|
+
offset: { type: 'integer', minimum: 0 },
|
|
342
|
+
nextOffset: nullable('integer'),
|
|
343
|
+
},
|
|
344
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
345
|
+
),
|
|
346
|
+
TimelineItem: object(
|
|
347
|
+
{
|
|
348
|
+
at: nullable('string'),
|
|
349
|
+
kind: { type: 'string', enum: ['attempt', 'gate', 'event'] },
|
|
350
|
+
title: nullable('string'),
|
|
351
|
+
agent: nullable('string'),
|
|
352
|
+
attemptId: nullable('string'),
|
|
353
|
+
outcome: nullable('string'),
|
|
354
|
+
detail: nullable('string'),
|
|
355
|
+
},
|
|
356
|
+
['at', 'kind', 'title', 'agent', 'attemptId', 'outcome', 'detail'],
|
|
357
|
+
),
|
|
358
|
+
Timeline: object(
|
|
359
|
+
{
|
|
360
|
+
items: { type: 'array', items: ref('TimelineItem') },
|
|
361
|
+
total: { type: 'integer', minimum: 0 },
|
|
362
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
363
|
+
offset: { type: 'integer', minimum: 0 },
|
|
364
|
+
nextOffset: nullable('integer'),
|
|
365
|
+
},
|
|
366
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
367
|
+
),
|
|
368
|
+
Artifact: object(
|
|
369
|
+
{
|
|
370
|
+
id: { type: 'string' },
|
|
371
|
+
producer: nullable('string'),
|
|
372
|
+
status: nullable('string'),
|
|
373
|
+
outcome: nullable('string'),
|
|
374
|
+
summary: nullable('string'),
|
|
375
|
+
receiptAttemptId: nullable('string'),
|
|
376
|
+
timestamps: object(
|
|
377
|
+
{
|
|
378
|
+
createdAt: nullable('string'),
|
|
379
|
+
updatedAt: nullable('string'),
|
|
380
|
+
completedAt: nullable('string'),
|
|
381
|
+
},
|
|
382
|
+
['createdAt', 'updatedAt', 'completedAt'],
|
|
383
|
+
),
|
|
384
|
+
acceptanceCriteriaIds: { type: 'array', items: { type: 'string' } },
|
|
385
|
+
taskIds: { type: 'array', items: { type: 'string' } },
|
|
386
|
+
paths: object(
|
|
387
|
+
{
|
|
388
|
+
authoritative: { type: 'array', items: { type: 'string' } },
|
|
389
|
+
evidence: { type: 'array', items: { type: 'string' } },
|
|
390
|
+
},
|
|
391
|
+
['authoritative', 'evidence'],
|
|
392
|
+
),
|
|
393
|
+
},
|
|
394
|
+
[
|
|
395
|
+
'id',
|
|
396
|
+
'producer',
|
|
397
|
+
'status',
|
|
398
|
+
'outcome',
|
|
399
|
+
'summary',
|
|
400
|
+
'receiptAttemptId',
|
|
401
|
+
'timestamps',
|
|
402
|
+
'acceptanceCriteriaIds',
|
|
403
|
+
'taskIds',
|
|
404
|
+
'paths',
|
|
405
|
+
],
|
|
406
|
+
),
|
|
407
|
+
ArtifactList: object({ items: { type: 'array', items: ref('Artifact') }, total: { type: 'integer', minimum: 0 } }, [
|
|
408
|
+
'items',
|
|
409
|
+
'total',
|
|
410
|
+
]),
|
|
411
|
+
PromptEntry: object(
|
|
412
|
+
{
|
|
413
|
+
kind: { type: 'string', enum: ['prompt', 'log'] },
|
|
414
|
+
seq: { type: 'integer', minimum: 0 },
|
|
415
|
+
source: nullable('string'),
|
|
416
|
+
command: nullable('string'),
|
|
417
|
+
capturedAt: nullable('string'),
|
|
418
|
+
language: nullable('string'),
|
|
419
|
+
content: { type: 'string' },
|
|
420
|
+
sha256: { type: 'string' },
|
|
421
|
+
bytes: { type: 'integer', minimum: 0 },
|
|
422
|
+
},
|
|
423
|
+
['kind', 'seq', 'source', 'command', 'capturedAt', 'language', 'content', 'sha256', 'bytes'],
|
|
424
|
+
),
|
|
425
|
+
Prompts: object(
|
|
426
|
+
{
|
|
427
|
+
prompt: { oneOf: [ref('PromptEntry'), { type: 'null' }] },
|
|
428
|
+
log: { type: 'array', items: ref('PromptEntry') },
|
|
429
|
+
},
|
|
430
|
+
['prompt', 'log'],
|
|
431
|
+
),
|
|
432
|
+
MetricsSummary: object(
|
|
433
|
+
{
|
|
434
|
+
runId: nullable('string'),
|
|
435
|
+
eventCounts: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
436
|
+
totalAttemptDurationMs: { type: 'integer', minimum: 0 },
|
|
437
|
+
byAgent: {
|
|
438
|
+
type: 'array',
|
|
439
|
+
items: object(
|
|
440
|
+
{
|
|
441
|
+
agent: nullable('string'),
|
|
442
|
+
attempts: { type: 'integer', minimum: 0 },
|
|
443
|
+
durationMs: { type: 'integer', minimum: 0 },
|
|
444
|
+
},
|
|
445
|
+
['agent', 'attempts', 'durationMs'],
|
|
446
|
+
),
|
|
447
|
+
},
|
|
448
|
+
byStep: {
|
|
449
|
+
type: 'array',
|
|
450
|
+
items: object(
|
|
451
|
+
{
|
|
452
|
+
stepIndex: nullable('integer'),
|
|
453
|
+
attempts: { type: 'integer', minimum: 0 },
|
|
454
|
+
durationMs: { type: 'integer', minimum: 0 },
|
|
455
|
+
},
|
|
456
|
+
['stepIndex', 'attempts', 'durationMs'],
|
|
457
|
+
),
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
['runId', 'eventCounts', 'totalAttemptDurationMs', 'byAgent', 'byStep'],
|
|
461
|
+
),
|
|
462
|
+
Gate: object(
|
|
463
|
+
{
|
|
464
|
+
startEventId: { type: 'string' },
|
|
465
|
+
startedAt: nullable('string'),
|
|
466
|
+
endedAt: nullable('string'),
|
|
467
|
+
durationMs: nullable('integer'),
|
|
468
|
+
derived: { type: 'boolean' },
|
|
469
|
+
},
|
|
470
|
+
['startEventId', 'startedAt', 'endedAt', 'durationMs', 'derived'],
|
|
471
|
+
),
|
|
472
|
+
GateList: object({ items: { type: 'array', items: ref('Gate') }, total: { type: 'integer', minimum: 0 } }, [
|
|
473
|
+
'items',
|
|
474
|
+
'total',
|
|
475
|
+
]),
|
|
476
|
+
DocumentSummary: object(
|
|
477
|
+
{
|
|
478
|
+
path: { type: 'string' },
|
|
479
|
+
sha256: nullable('string'),
|
|
480
|
+
bytes: nullable('integer'),
|
|
481
|
+
mediaType: { type: 'string' },
|
|
482
|
+
isText: { type: 'boolean' },
|
|
483
|
+
contentOmitted: nullable('string'),
|
|
484
|
+
parseError: nullable('string'),
|
|
485
|
+
projectedAt: { type: 'string' },
|
|
486
|
+
},
|
|
487
|
+
['path', 'sha256', 'bytes', 'mediaType', 'isText', 'contentOmitted', 'parseError', 'projectedAt'],
|
|
488
|
+
),
|
|
489
|
+
DocumentSummaryList: object(
|
|
490
|
+
{
|
|
491
|
+
items: { type: 'array', items: ref('DocumentSummary') },
|
|
492
|
+
total: { type: 'integer', minimum: 0 },
|
|
493
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
494
|
+
offset: { type: 'integer', minimum: 0 },
|
|
495
|
+
nextOffset: nullable('integer'),
|
|
496
|
+
},
|
|
497
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
498
|
+
),
|
|
499
|
+
DocumentContent: object(
|
|
500
|
+
{
|
|
501
|
+
path: { type: 'string' },
|
|
502
|
+
sha256: nullable('string'),
|
|
503
|
+
bytes: nullable('integer'),
|
|
504
|
+
mediaType: { type: 'string' },
|
|
505
|
+
offset: { type: 'integer', minimum: 0 },
|
|
506
|
+
limit: { type: 'integer', minimum: 1 },
|
|
507
|
+
totalBytes: { type: 'integer', minimum: 0 },
|
|
508
|
+
truncated: { type: 'boolean' },
|
|
509
|
+
content: { type: 'string' },
|
|
510
|
+
},
|
|
511
|
+
['path', 'sha256', 'bytes', 'mediaType', 'offset', 'limit', 'totalBytes', 'truncated', 'content'],
|
|
512
|
+
),
|
|
513
|
+
Stats: object(
|
|
514
|
+
{
|
|
515
|
+
tasks: object(
|
|
516
|
+
{
|
|
517
|
+
total: { type: 'integer', minimum: 0 },
|
|
518
|
+
active: { type: 'integer', minimum: 0 },
|
|
519
|
+
absent: { type: 'integer', minimum: 0 },
|
|
520
|
+
byState: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
521
|
+
byIntent: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
522
|
+
byProfile: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
523
|
+
},
|
|
524
|
+
['total', 'active', 'absent', 'byState', 'byIntent', 'byProfile'],
|
|
525
|
+
),
|
|
526
|
+
attempts: object(
|
|
527
|
+
{
|
|
528
|
+
total: { type: 'integer', minimum: 0 },
|
|
529
|
+
byOutcome: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
530
|
+
byAgent: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
531
|
+
},
|
|
532
|
+
['total', 'byOutcome', 'byAgent'],
|
|
533
|
+
),
|
|
534
|
+
durations: object(
|
|
535
|
+
{
|
|
536
|
+
totalAttemptMs: { type: 'integer', minimum: 0 },
|
|
537
|
+
p50Ms: { type: 'integer', minimum: 0 },
|
|
538
|
+
p95Ms: { type: 'integer', minimum: 0 },
|
|
539
|
+
},
|
|
540
|
+
['totalAttemptMs', 'p50Ms', 'p95Ms'],
|
|
541
|
+
),
|
|
542
|
+
artifacts: object(
|
|
543
|
+
{
|
|
544
|
+
total: { type: 'integer', minimum: 0 },
|
|
545
|
+
byStatus: { type: 'object', additionalProperties: { type: 'integer' } },
|
|
546
|
+
},
|
|
547
|
+
['total', 'byStatus'],
|
|
548
|
+
),
|
|
549
|
+
events: object({ byType: { type: 'object', additionalProperties: { type: 'integer' } } }, ['byType']),
|
|
550
|
+
},
|
|
551
|
+
['tasks', 'attempts', 'durations', 'artifacts', 'events'],
|
|
552
|
+
),
|
|
553
|
+
SyncRun: object(
|
|
554
|
+
{
|
|
555
|
+
runId: { type: 'integer', minimum: 1 },
|
|
556
|
+
mode: { type: 'string', enum: ['full', 'slug'] },
|
|
557
|
+
startedAt: { type: 'string' },
|
|
558
|
+
finishedAt: nullable('string'),
|
|
559
|
+
inserted: { type: 'integer', minimum: 0 },
|
|
560
|
+
updated: { type: 'integer', minimum: 0 },
|
|
561
|
+
unchanged: { type: 'integer', minimum: 0 },
|
|
562
|
+
failed: { type: 'integer', minimum: 0 },
|
|
563
|
+
absent: { type: 'integer', minimum: 0 },
|
|
564
|
+
pruned: { type: 'integer', minimum: 0 },
|
|
565
|
+
rebuilt: { type: 'boolean' },
|
|
566
|
+
exitCode: nullable('integer'),
|
|
567
|
+
error: nullable('string'),
|
|
568
|
+
},
|
|
569
|
+
['runId', 'mode', 'startedAt', 'finishedAt', 'inserted', 'updated', 'unchanged', 'failed', 'absent', 'pruned', 'rebuilt'],
|
|
570
|
+
),
|
|
571
|
+
SyncRunList: object(
|
|
572
|
+
{
|
|
573
|
+
items: { type: 'array', items: ref('SyncRun') },
|
|
574
|
+
total: { type: 'integer', minimum: 0 },
|
|
575
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
576
|
+
offset: { type: 'integer', minimum: 0 },
|
|
577
|
+
nextOffset: nullable('integer'),
|
|
578
|
+
},
|
|
579
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
580
|
+
),
|
|
581
|
+
SyncResult: object(
|
|
582
|
+
{
|
|
583
|
+
runId: nullable('integer'),
|
|
584
|
+
mode: { type: 'string', enum: ['full', 'slug'] },
|
|
585
|
+
startedAt: nullable('string'),
|
|
586
|
+
finishedAt: nullable('string'),
|
|
587
|
+
inserted: { type: 'integer', minimum: 0 },
|
|
588
|
+
updated: { type: 'integer', minimum: 0 },
|
|
589
|
+
unchanged: { type: 'integer', minimum: 0 },
|
|
590
|
+
failed: { type: 'integer', minimum: 0 },
|
|
591
|
+
absent: { type: 'integer', minimum: 0 },
|
|
592
|
+
pruned: { type: 'integer', minimum: 0 },
|
|
593
|
+
rebuilt: { type: 'boolean' },
|
|
594
|
+
exitCode: { type: 'integer', minimum: 0 },
|
|
595
|
+
},
|
|
596
|
+
['runId', 'mode', 'startedAt', 'finishedAt', 'inserted', 'updated', 'unchanged', 'failed', 'absent', 'pruned', 'rebuilt', 'exitCode'],
|
|
597
|
+
),
|
|
598
|
+
Health: object(
|
|
599
|
+
{
|
|
600
|
+
status: { type: 'string', enum: ['ok', 'degraded'] },
|
|
601
|
+
db: object(
|
|
602
|
+
{
|
|
603
|
+
file: { type: 'string' },
|
|
604
|
+
present: { type: 'boolean' },
|
|
605
|
+
schemaVersion: nullable('integer'),
|
|
606
|
+
fingerprintOk: { type: 'boolean' },
|
|
607
|
+
search: nullable('string'),
|
|
608
|
+
},
|
|
609
|
+
['file', 'present', 'schemaVersion', 'fingerprintOk', 'search'],
|
|
610
|
+
),
|
|
611
|
+
tasks: object(
|
|
612
|
+
{
|
|
613
|
+
total: { type: 'integer', minimum: 0 },
|
|
614
|
+
absent: { type: 'integer', minimum: 0 },
|
|
615
|
+
},
|
|
616
|
+
['total', 'absent'],
|
|
617
|
+
),
|
|
618
|
+
projectedAt: nullable('string'),
|
|
619
|
+
},
|
|
620
|
+
['status', 'db', 'tasks', 'projectedAt'],
|
|
621
|
+
),
|
|
622
|
+
Migration: object(
|
|
623
|
+
{
|
|
624
|
+
version: { type: 'integer', minimum: 1 },
|
|
625
|
+
name: { type: 'string' },
|
|
626
|
+
checksum: { type: 'string' },
|
|
627
|
+
appliedAt: nullable('string'),
|
|
628
|
+
},
|
|
629
|
+
['version', 'name', 'checksum', 'appliedAt'],
|
|
630
|
+
),
|
|
631
|
+
Meta: object(
|
|
632
|
+
{
|
|
633
|
+
apiVersion: { type: 'string' },
|
|
634
|
+
openapiVersion: { type: 'string' },
|
|
635
|
+
schemaVersion: { type: 'integer', minimum: 1 },
|
|
636
|
+
migrations: { type: 'array', items: ref('Migration') },
|
|
637
|
+
features: object(
|
|
638
|
+
{
|
|
639
|
+
fts5: { type: 'boolean' },
|
|
640
|
+
search: { type: 'string', enum: ['fts5', 'like'] },
|
|
641
|
+
nodeSqlite: { type: 'string' },
|
|
642
|
+
},
|
|
643
|
+
['fts5', 'search', 'nodeSqlite'],
|
|
644
|
+
),
|
|
645
|
+
generatedAt: { type: 'string' },
|
|
646
|
+
},
|
|
647
|
+
['apiVersion', 'openapiVersion', 'schemaVersion', 'migrations', 'features', 'generatedAt'],
|
|
648
|
+
),
|
|
649
|
+
TaskExport: object(
|
|
650
|
+
{
|
|
651
|
+
exportedAt: { type: 'string' },
|
|
652
|
+
apiVersion: { type: 'string' },
|
|
653
|
+
detail: ref('TaskDetail'),
|
|
654
|
+
pipeline: ref('Pipeline'),
|
|
655
|
+
attempts: { type: 'array', items: ref('Attempt') },
|
|
656
|
+
events: { type: 'array', items: ref('Event') },
|
|
657
|
+
gates: { type: 'array', items: ref('Gate') },
|
|
658
|
+
artifacts: { type: 'array', items: ref('Artifact') },
|
|
659
|
+
prompts: ref('Prompts'),
|
|
660
|
+
metrics: ref('MetricsSummary'),
|
|
661
|
+
documents: { type: 'array', items: ref('DocumentSummary') },
|
|
662
|
+
documentContents: { type: 'object', additionalProperties: { type: 'string' } },
|
|
663
|
+
documentsIncluded: { type: 'boolean' },
|
|
664
|
+
},
|
|
665
|
+
[
|
|
666
|
+
'exportedAt',
|
|
667
|
+
'apiVersion',
|
|
668
|
+
'detail',
|
|
669
|
+
'pipeline',
|
|
670
|
+
'attempts',
|
|
671
|
+
'events',
|
|
672
|
+
'gates',
|
|
673
|
+
'artifacts',
|
|
674
|
+
'prompts',
|
|
675
|
+
'metrics',
|
|
676
|
+
'documents',
|
|
677
|
+
'documentContents',
|
|
678
|
+
'documentsIncluded',
|
|
679
|
+
],
|
|
680
|
+
),
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
/* --------------------------------- examples -------------------------------- */
|
|
685
|
+
|
|
686
|
+
const taskSummaryExample = {
|
|
687
|
+
slug: 'agent-team-sqlite-dashboard',
|
|
688
|
+
title: 'SQLite projection and read-only dashboard for .ai.local/team',
|
|
689
|
+
intent: 'feature',
|
|
690
|
+
profile: 'full',
|
|
691
|
+
specMode: 'none',
|
|
692
|
+
state: 'in_progress',
|
|
693
|
+
phase: 'executing',
|
|
694
|
+
pipelineIndex: 3,
|
|
695
|
+
currentAgent: 'feature-developer',
|
|
696
|
+
awaitingHumanGate: false,
|
|
697
|
+
stack: 'next',
|
|
698
|
+
platform: 'opencode',
|
|
699
|
+
updatedAt: '2026-11-06T07:42:45.328Z',
|
|
700
|
+
startAt: '2026-11-06T07:20:15.209Z',
|
|
701
|
+
endAt: null,
|
|
702
|
+
durationMs: null,
|
|
703
|
+
attempts: 3,
|
|
704
|
+
artifacts: 5,
|
|
705
|
+
files: 16,
|
|
706
|
+
documentBytes: 238335,
|
|
707
|
+
parseErrors: 0,
|
|
708
|
+
gateState: 'closed',
|
|
709
|
+
projectedAt: '2026-11-06T08:05:34.977Z',
|
|
710
|
+
lastSeenAt: '2026-11-06T08:05:34.977Z',
|
|
711
|
+
absentAt: null,
|
|
712
|
+
contentHash: 'af1608a27a04770c9dfbfedb47f4b1b69eb3cf5d2166e7e12049f0ff17074566',
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
const detailExample = {
|
|
716
|
+
task: taskSummaryExample,
|
|
717
|
+
routing: { summary: 'Add a SQLite projection and a read-only dashboard.', decision: { complexity: 'high', estimatedWorkPackages: 7 } },
|
|
718
|
+
counts: { events: 15, attempts: 3, gates: 1, prompts: 4, documents: 16 },
|
|
719
|
+
hasPrompt: true,
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
const attemptExample = {
|
|
723
|
+
attemptId: 'agent-team-sqlite-dashboard-1793949615226-0468b58:step-1:solution-architect:attempt-1',
|
|
724
|
+
agent: 'solution-architect',
|
|
725
|
+
role: 'planning',
|
|
726
|
+
stepIndex: 1,
|
|
727
|
+
stepLabel: 'Design the projection',
|
|
728
|
+
attempt: 1,
|
|
729
|
+
startedAt: '2026-11-06T07:20:55.384Z',
|
|
730
|
+
finishedAt: '2026-11-06T07:31:47.191Z',
|
|
731
|
+
durationMs: 651807,
|
|
732
|
+
outcome: 'completed',
|
|
733
|
+
source: 'hook',
|
|
734
|
+
attributionConfidence: 'high',
|
|
735
|
+
current: false,
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
const eventExample = {
|
|
739
|
+
eventId: 'agent-team-sqlite-dashboard-1793949615226:attempt_finished:1',
|
|
740
|
+
seq: 4,
|
|
741
|
+
type: 'attempt_finished',
|
|
742
|
+
at: '2026-11-06T07:31:47.191Z',
|
|
743
|
+
attemptId: attemptExample.attemptId,
|
|
744
|
+
stepIndex: 1,
|
|
745
|
+
stepLabel: 'Design the projection',
|
|
746
|
+
agent: 'solution-architect',
|
|
747
|
+
role: 'planning',
|
|
748
|
+
attempt: 1,
|
|
749
|
+
outcome: 'completed',
|
|
750
|
+
waveId: null,
|
|
751
|
+
parallelGroupId: null,
|
|
752
|
+
durationMs: 651807,
|
|
753
|
+
source: 'hook',
|
|
754
|
+
attributionConfidence: 'high',
|
|
755
|
+
payload: { eventId: 'agent-team-sqlite-dashboard-1793949615226:attempt_finished:1', type: 'attempt_finished' },
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
const artifactExample = {
|
|
759
|
+
id: 'architecture',
|
|
760
|
+
producer: 'solution-architect',
|
|
761
|
+
status: 'completed',
|
|
762
|
+
outcome: 'completed',
|
|
763
|
+
summary: 'Froze the schema, the projection algorithm, the seams and the contract.',
|
|
764
|
+
receiptAttemptId: attemptExample.attemptId,
|
|
765
|
+
timestamps: { createdAt: '2026-11-06T07:31:07.329Z', updatedAt: '2026-11-06T07:31:07.329Z', completedAt: '2026-11-06T07:31:07.329Z' },
|
|
766
|
+
acceptanceCriteriaIds: ['AC-5', 'AC-7'],
|
|
767
|
+
taskIds: ['WP4'],
|
|
768
|
+
paths: { authoritative: ['architecture.md'], evidence: ['brief.md'] },
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
const briefDocumentText = '# Brief: agent-team-sqlite-dashboard';
|
|
772
|
+
|
|
773
|
+
const promptExample = {
|
|
774
|
+
kind: 'prompt',
|
|
775
|
+
seq: 0,
|
|
776
|
+
source: 'user',
|
|
777
|
+
command: '/task',
|
|
778
|
+
capturedAt: '2026-11-06T00:00:00.000Z',
|
|
779
|
+
language: 'ru',
|
|
780
|
+
content: 'Add a SQLite projection and a local dashboard.',
|
|
781
|
+
sha256: 'e581f07bd9b9d7dddb7ffcddd6afacde48d93f7b23afbbf5b61a77e3cd27208c',
|
|
782
|
+
bytes: 46,
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
const documentSummaryExample = {
|
|
786
|
+
path: 'brief.md',
|
|
787
|
+
sha256: '545dc4fbcd401214618b880e61801e0229d963ec715ac5c1bdfda83052ad9116',
|
|
788
|
+
bytes: 52217,
|
|
789
|
+
mediaType: 'text/markdown',
|
|
790
|
+
isText: true,
|
|
791
|
+
contentOmitted: null,
|
|
792
|
+
parseError: null,
|
|
793
|
+
projectedAt: '2026-11-06T08:05:34.977Z',
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
const syncRunExample = {
|
|
797
|
+
runId: 42,
|
|
798
|
+
mode: 'full',
|
|
799
|
+
startedAt: '2026-11-06T08:00:00.000Z',
|
|
800
|
+
finishedAt: '2026-11-06T08:00:04.000Z',
|
|
801
|
+
inserted: 1,
|
|
802
|
+
updated: 2,
|
|
803
|
+
unchanged: 87,
|
|
804
|
+
failed: 0,
|
|
805
|
+
absent: 0,
|
|
806
|
+
pruned: 0,
|
|
807
|
+
rebuilt: false,
|
|
808
|
+
exitCode: 0,
|
|
809
|
+
error: null,
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
const EXAMPLES = {
|
|
813
|
+
ErrorEnvelope: [{ error: { code: 'E_VALIDATION', message: 'limit must be an integer between 1 and 200', details: { parameter: 'limit' } } }],
|
|
814
|
+
TaskSummary: [taskSummaryExample],
|
|
815
|
+
TaskList: [{ items: [taskSummaryExample], total: 90, limit: 50, offset: 0, nextOffset: 50 }],
|
|
816
|
+
TaskDetail: [detailExample],
|
|
817
|
+
Pipeline: [
|
|
818
|
+
{
|
|
819
|
+
slug: 'agent-team-sqlite-dashboard',
|
|
820
|
+
steps: [
|
|
821
|
+
{
|
|
822
|
+
index: 0,
|
|
823
|
+
label: 'Clarify and decompose',
|
|
824
|
+
agents: ['task-analyst'],
|
|
825
|
+
scope: null,
|
|
826
|
+
model: 'standard',
|
|
827
|
+
skipIf: null,
|
|
828
|
+
parallel: false,
|
|
829
|
+
dependsOn: [],
|
|
830
|
+
taskIds: ['T1'],
|
|
831
|
+
writeScopes: [],
|
|
832
|
+
state: 'completed',
|
|
833
|
+
},
|
|
834
|
+
],
|
|
835
|
+
},
|
|
836
|
+
],
|
|
837
|
+
AttemptList: [{ items: [attemptExample], total: 3, limit: 50, offset: 0, nextOffset: null }],
|
|
838
|
+
EventList: [{ items: [eventExample], total: 15, limit: 50, offset: 0, nextOffset: null }],
|
|
839
|
+
Timeline: [
|
|
840
|
+
{
|
|
841
|
+
items: [
|
|
842
|
+
{ at: '2026-11-06T07:20:55.384Z', kind: 'attempt', title: 'Design the projection', agent: 'solution-architect', attemptId: attemptExample.attemptId, outcome: 'completed', detail: 'planning' },
|
|
843
|
+
],
|
|
844
|
+
total: 15,
|
|
845
|
+
limit: 50,
|
|
846
|
+
offset: 0,
|
|
847
|
+
nextOffset: null,
|
|
848
|
+
},
|
|
849
|
+
],
|
|
850
|
+
ArtifactList: [{ items: [artifactExample], total: 5 }],
|
|
851
|
+
Prompts: [
|
|
852
|
+
{
|
|
853
|
+
prompt: promptExample,
|
|
854
|
+
log: [
|
|
855
|
+
{
|
|
856
|
+
...promptExample,
|
|
857
|
+
kind: 'log',
|
|
858
|
+
seq: 1,
|
|
859
|
+
command: '/task-continue',
|
|
860
|
+
content: 'Continue the task after the review fix.',
|
|
861
|
+
sha256: '5e941aba3d81008388c7ea27b849f901070dfb5c0d992ef8b6602e94a7feb187',
|
|
862
|
+
bytes: 39,
|
|
863
|
+
},
|
|
864
|
+
],
|
|
865
|
+
},
|
|
866
|
+
],
|
|
867
|
+
MetricsSummary: [
|
|
868
|
+
{
|
|
869
|
+
runId: 'agent-team-sqlite-dashboard-1793949615226-0468b58',
|
|
870
|
+
eventCounts: { task_started: 1, attempt_started: 2, attempt_finished: 2 },
|
|
871
|
+
totalAttemptDurationMs: 2284854,
|
|
872
|
+
byAgent: [{ agent: 'solution-architect', attempts: 1, durationMs: 651807 }],
|
|
873
|
+
byStep: [{ stepIndex: 1, attempts: 1, durationMs: 651807 }],
|
|
874
|
+
},
|
|
875
|
+
],
|
|
876
|
+
GateList: [
|
|
877
|
+
{
|
|
878
|
+
items: [{ startEventId: 'agent-team-sqlite-dashboard:gate:1793949615226', startedAt: '2026-11-06T07:20:15.209Z', endedAt: '2026-11-06T07:20:55.384Z', durationMs: 40175, derived: true }],
|
|
879
|
+
total: 1,
|
|
880
|
+
},
|
|
881
|
+
],
|
|
882
|
+
DocumentSummaryList: [{ items: [documentSummaryExample], total: 16, limit: 50, offset: 0, nextOffset: null }],
|
|
883
|
+
DocumentContent: [
|
|
884
|
+
{
|
|
885
|
+
path: 'brief.md',
|
|
886
|
+
sha256: '545dc4fbcd401214618b880e61801e0229d963ec715ac5c1bdfda83052ad9116',
|
|
887
|
+
bytes: 52217,
|
|
888
|
+
mediaType: 'text/markdown',
|
|
889
|
+
offset: 0,
|
|
890
|
+
limit: 36,
|
|
891
|
+
totalBytes: 52217,
|
|
892
|
+
truncated: true,
|
|
893
|
+
content: briefDocumentText,
|
|
894
|
+
},
|
|
895
|
+
],
|
|
896
|
+
Stats: [
|
|
897
|
+
{
|
|
898
|
+
tasks: { total: 90, active: 90, absent: 0, byState: { completed: 62 }, byIntent: { feature: 40 }, byProfile: { full: 20 } },
|
|
899
|
+
attempts: { total: 410, byOutcome: { completed: 380 }, byAgent: { 'feature-developer': 90 } },
|
|
900
|
+
durations: { totalAttemptMs: 123456789, p50Ms: 120000, p95Ms: 900000 },
|
|
901
|
+
artifacts: { total: 300, byStatus: { completed: 280 } },
|
|
902
|
+
events: { byType: { attempt_finished: 410 } },
|
|
903
|
+
},
|
|
904
|
+
],
|
|
905
|
+
SyncRunList: [{ items: [syncRunExample], total: 1, limit: 50, offset: 0, nextOffset: null }],
|
|
906
|
+
SyncResult: [
|
|
907
|
+
{
|
|
908
|
+
runId: 42,
|
|
909
|
+
mode: 'full',
|
|
910
|
+
startedAt: '2026-11-06T08:00:00.000Z',
|
|
911
|
+
finishedAt: '2026-11-06T08:00:04.000Z',
|
|
912
|
+
inserted: 1,
|
|
913
|
+
updated: 2,
|
|
914
|
+
unchanged: 87,
|
|
915
|
+
failed: 0,
|
|
916
|
+
absent: 0,
|
|
917
|
+
pruned: 0,
|
|
918
|
+
rebuilt: false,
|
|
919
|
+
exitCode: 0,
|
|
920
|
+
},
|
|
921
|
+
],
|
|
922
|
+
Health: [
|
|
923
|
+
{
|
|
924
|
+
status: 'ok',
|
|
925
|
+
db: { file: 'team.db', present: true, schemaVersion: 1, fingerprintOk: true, search: 'fts5' },
|
|
926
|
+
tasks: { total: 90, absent: 0 },
|
|
927
|
+
projectedAt: '2026-11-06T08:00:04.000Z',
|
|
928
|
+
},
|
|
929
|
+
],
|
|
930
|
+
Meta: [
|
|
931
|
+
{
|
|
932
|
+
apiVersion: API_VERSION,
|
|
933
|
+
openapiVersion: OPENAPI_VERSION,
|
|
934
|
+
schemaVersion: 1,
|
|
935
|
+
migrations: [{ version: 1, name: '0001-init', checksum: '2f642c80d1049a1f90fffbccab603f12f4b8f5b7fc4eed7d9a3a018d70669b5f', appliedAt: '2026-11-06T08:05:34.940Z' }],
|
|
936
|
+
features: { fts5: true, search: 'fts5', nodeSqlite: 'ok' },
|
|
937
|
+
generatedAt: '2026-11-06T08:00:04.000Z',
|
|
938
|
+
},
|
|
939
|
+
],
|
|
940
|
+
TaskExport: [
|
|
941
|
+
{
|
|
942
|
+
exportedAt: '2026-11-06T08:10:00.000Z',
|
|
943
|
+
apiVersion: API_VERSION,
|
|
944
|
+
detail: detailExample,
|
|
945
|
+
pipeline: {
|
|
946
|
+
slug: 'agent-team-sqlite-dashboard',
|
|
947
|
+
steps: [
|
|
948
|
+
{
|
|
949
|
+
index: 0,
|
|
950
|
+
label: 'Clarify and decompose',
|
|
951
|
+
agents: ['task-analyst'],
|
|
952
|
+
scope: null,
|
|
953
|
+
model: 'standard',
|
|
954
|
+
skipIf: null,
|
|
955
|
+
parallel: false,
|
|
956
|
+
dependsOn: [],
|
|
957
|
+
taskIds: ['T1'],
|
|
958
|
+
writeScopes: [],
|
|
959
|
+
state: 'completed',
|
|
960
|
+
},
|
|
961
|
+
],
|
|
962
|
+
},
|
|
963
|
+
attempts: [attemptExample],
|
|
964
|
+
events: [eventExample],
|
|
965
|
+
gates: [{ startEventId: 'agent-team-sqlite-dashboard:gate:1793949615226', startedAt: '2026-11-06T07:20:15.209Z', endedAt: '2026-11-06T07:20:55.384Z', durationMs: 40175, derived: true }],
|
|
966
|
+
artifacts: [artifactExample],
|
|
967
|
+
prompts: { prompt: promptExample, log: [] },
|
|
968
|
+
metrics: {
|
|
969
|
+
runId: 'agent-team-sqlite-dashboard-1793949615226-0468b58',
|
|
970
|
+
eventCounts: { task_started: 1 },
|
|
971
|
+
totalAttemptDurationMs: 651807,
|
|
972
|
+
byAgent: [{ agent: 'solution-architect', attempts: 1, durationMs: 651807 }],
|
|
973
|
+
byStep: [{ stepIndex: 1, attempts: 1, durationMs: 651807 }],
|
|
974
|
+
},
|
|
975
|
+
documents: [
|
|
976
|
+
{
|
|
977
|
+
...documentSummaryExample,
|
|
978
|
+
sha256: '5f2a8d2298ea52f104580a1d7bb95d396497f12994fdf8f5f246abbe74aecda9',
|
|
979
|
+
bytes: Buffer.byteLength(briefDocumentText),
|
|
980
|
+
},
|
|
981
|
+
],
|
|
982
|
+
documentContents: { 'brief.md': briefDocumentText },
|
|
983
|
+
documentsIncluded: true,
|
|
984
|
+
},
|
|
985
|
+
],
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
for (const [name, examples] of Object.entries(EXAMPLES)) {
|
|
989
|
+
schemas[name] = { ...schemas[name], examples };
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const taskIdParameters = [slugParameter];
|
|
993
|
+
|
|
994
|
+
const operation = (definition) => ({
|
|
995
|
+
...definition,
|
|
996
|
+
security: [],
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
const listOperation = (tags, summary, operationId, responseRef, parameters, extraResponses = {}) =>
|
|
1000
|
+
operation({
|
|
1001
|
+
tags,
|
|
1002
|
+
summary,
|
|
1003
|
+
operationId,
|
|
1004
|
+
parameters,
|
|
1005
|
+
responses: {
|
|
1006
|
+
200: jsonResponse(responseRef, 'The filtered page'),
|
|
1007
|
+
...commonErrorResponses,
|
|
1008
|
+
...extraResponses,
|
|
1009
|
+
},
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
const taskScopedOperation = (tags, summary, operationId, responseRef, parameters = taskIdParameters) =>
|
|
1013
|
+
operation({
|
|
1014
|
+
tags,
|
|
1015
|
+
summary,
|
|
1016
|
+
operationId,
|
|
1017
|
+
parameters,
|
|
1018
|
+
responses: {
|
|
1019
|
+
200: jsonResponse(responseRef, 'The task-scoped payload'),
|
|
1020
|
+
...commonErrorResponses,
|
|
1021
|
+
},
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
const LIST_TASK_PARAMETERS = [
|
|
1025
|
+
...paginationParameters,
|
|
1026
|
+
{ name: 'agent', in: 'query', required: false, schema: { type: 'string', pattern: AGENT_PATTERN } },
|
|
1027
|
+
{
|
|
1028
|
+
name: 'status',
|
|
1029
|
+
in: 'query',
|
|
1030
|
+
description: csvParameterDescription('task states (any subset)', TASK_STATES),
|
|
1031
|
+
required: false,
|
|
1032
|
+
schema: { type: 'string' },
|
|
1033
|
+
},
|
|
1034
|
+
{ name: 'intent', in: 'query', required: false, schema: { type: 'string', pattern: INTENT_PATTERN } },
|
|
1035
|
+
{ name: 'profile', in: 'query', required: false, schema: { type: 'string', enum: PROFILES } },
|
|
1036
|
+
{ name: 'from', in: 'query', required: false, schema: { type: 'string', format: 'date-time' } },
|
|
1037
|
+
{ name: 'to', in: 'query', required: false, schema: { type: 'string', format: 'date-time' } },
|
|
1038
|
+
{ name: 'q', in: 'query', required: false, schema: { type: 'string', maxLength: 200 } },
|
|
1039
|
+
{ name: 'sort', in: 'query', required: false, schema: { type: 'string', enum: SORT_VALUES, default: '-updatedAt' } },
|
|
1040
|
+
{ name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } },
|
|
1041
|
+
];
|
|
1042
|
+
|
|
1043
|
+
const attemptParameters = [
|
|
1044
|
+
slugParameter,
|
|
1045
|
+
...paginationParameters,
|
|
1046
|
+
{ name: 'agent', in: 'query', required: false, schema: { type: 'string', pattern: AGENT_PATTERN } },
|
|
1047
|
+
{ name: 'outcome', in: 'query', required: false, schema: { type: 'string', enum: attemptOutcomeValues } },
|
|
1048
|
+
{ name: 'order', in: 'query', required: false, schema: { type: 'string', enum: ['asc', 'desc'], default: 'asc' } },
|
|
1049
|
+
];
|
|
1050
|
+
|
|
1051
|
+
const eventParameters = [
|
|
1052
|
+
slugParameter,
|
|
1053
|
+
...paginationParameters,
|
|
1054
|
+
{
|
|
1055
|
+
name: 'type',
|
|
1056
|
+
in: 'query',
|
|
1057
|
+
description: csvParameterDescription('event types (any subset)', EVENT_TYPES),
|
|
1058
|
+
required: false,
|
|
1059
|
+
schema: { type: 'string' },
|
|
1060
|
+
},
|
|
1061
|
+
{ name: 'from', in: 'query', required: false, schema: { type: 'string', format: 'date-time' } },
|
|
1062
|
+
{ name: 'to', in: 'query', required: false, schema: { type: 'string', format: 'date-time' } },
|
|
1063
|
+
{ name: 'order', in: 'query', required: false, schema: { type: 'string', enum: ['asc', 'desc'], default: 'asc' } },
|
|
1064
|
+
];
|
|
1065
|
+
|
|
1066
|
+
const documentListParameters = [
|
|
1067
|
+
slugParameter,
|
|
1068
|
+
...paginationParameters,
|
|
1069
|
+
{
|
|
1070
|
+
name: 'q',
|
|
1071
|
+
in: 'query',
|
|
1072
|
+
description: 'Substring filter on the document path; `%` and `_` are escaped.',
|
|
1073
|
+
required: false,
|
|
1074
|
+
schema: { type: 'string', maxLength: 200 },
|
|
1075
|
+
},
|
|
1076
|
+
];
|
|
1077
|
+
|
|
1078
|
+
const documentContentParameters = [
|
|
1079
|
+
slugParameter,
|
|
1080
|
+
{
|
|
1081
|
+
name: 'path',
|
|
1082
|
+
in: 'query',
|
|
1083
|
+
required: true,
|
|
1084
|
+
description: 'Exact task-relative document path. Rejected when absolute, when it contains `..` or a backslash, and when decoding is needed twice.',
|
|
1085
|
+
schema: { type: 'string', minLength: 1, maxLength: 512 },
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
name: 'offset',
|
|
1089
|
+
in: 'query',
|
|
1090
|
+
description: 'UTF-8 byte offset into the document.',
|
|
1091
|
+
required: false,
|
|
1092
|
+
schema: { type: 'integer', minimum: 0 },
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
name: 'limit',
|
|
1096
|
+
in: 'query',
|
|
1097
|
+
description: 'Maximum bytes returned, 1..1048576.',
|
|
1098
|
+
required: false,
|
|
1099
|
+
schema: { type: 'integer', minimum: 1, maximum: 1048576, default: 262144 },
|
|
1100
|
+
},
|
|
1101
|
+
];
|
|
1102
|
+
|
|
1103
|
+
export const OPENAPI_DOCUMENT = {
|
|
1104
|
+
openapi: OPENAPI_VERSION,
|
|
1105
|
+
jsonSchemaDialect: OPENAPI_JSON_SCHEMA_DIALECT,
|
|
1106
|
+
info: {
|
|
1107
|
+
title: 'Agent team SQLite projection API',
|
|
1108
|
+
summary:
|
|
1109
|
+
'Read-only projection of `.ai.local/team`. Task files are authoritative; the database is a rebuildable copy. The only mutation is an idempotent rescan.',
|
|
1110
|
+
description:
|
|
1111
|
+
'Loopback-only operator API. No authentication by design, no CORS, no outbound request. Errors use one `{error:{code,message,details?}}` envelope. Every non-GET/HEAD request to a read-only path returns 405 `E_METHOD_NOT_ALLOWED` with `Allow: GET, HEAD`; `GET` and `HEAD` on `/api/v1/sync` return 405 with `Allow: POST`.',
|
|
1112
|
+
version: API_VERSION,
|
|
1113
|
+
'x-api-major': API_MAJOR,
|
|
1114
|
+
},
|
|
1115
|
+
servers: [{ url: OPENAPI_SERVER_URL, description: 'Loopback default' }],
|
|
1116
|
+
security: [],
|
|
1117
|
+
tags: [
|
|
1118
|
+
{ name: 'dashboard', description: 'No-build operator page and its same-origin assets' },
|
|
1119
|
+
{ name: 'system', description: 'Health, document identity and the served contract' },
|
|
1120
|
+
{ name: 'tasks', description: 'Task summaries, details and exports' },
|
|
1121
|
+
{ name: 'pipeline', description: 'Pipeline steps and their derived state' },
|
|
1122
|
+
{ name: 'attempts', description: 'Agent attempts in ledger order' },
|
|
1123
|
+
{ name: 'events', description: 'Typed lifecycle events' },
|
|
1124
|
+
{ name: 'artifacts', description: 'Artifact receipts and their paths' },
|
|
1125
|
+
{ name: 'prompts', description: 'Verbatim prompt history (loopback only)' },
|
|
1126
|
+
{ name: 'metrics', description: 'Event counts and derived durations' },
|
|
1127
|
+
{ name: 'gates', description: 'Human gates with start, end and duration' },
|
|
1128
|
+
{ name: 'documents', description: 'Raw documents by exact path' },
|
|
1129
|
+
{ name: 'stats', description: 'Aggregate counts and durations' },
|
|
1130
|
+
{ name: 'sync', description: 'Projection runs and the one idempotent rescan' },
|
|
1131
|
+
],
|
|
1132
|
+
paths: {
|
|
1133
|
+
'/': {
|
|
1134
|
+
get: operation({
|
|
1135
|
+
tags: ['dashboard'],
|
|
1136
|
+
summary: 'The dashboard document',
|
|
1137
|
+
operationId: 'getDashboard',
|
|
1138
|
+
responses: {
|
|
1139
|
+
200: assetResponse('text/html', 'One HTML document with same-origin assets'),
|
|
1140
|
+
403: errorResponse('A non-loopback Host or Origin was rejected'),
|
|
1141
|
+
405: methodNotAllowedResponse,
|
|
1142
|
+
500: errorResponse('Unexpected server failure'),
|
|
1143
|
+
},
|
|
1144
|
+
}),
|
|
1145
|
+
},
|
|
1146
|
+
'/assets/app.css': {
|
|
1147
|
+
get: operation({
|
|
1148
|
+
tags: ['dashboard'],
|
|
1149
|
+
summary: 'The dashboard stylesheet',
|
|
1150
|
+
operationId: 'getDashboardCss',
|
|
1151
|
+
responses: {
|
|
1152
|
+
200: assetResponse('text/css', 'Stylesheet served from an in-memory constant'),
|
|
1153
|
+
403: errorResponse('A non-loopback Host or Origin was rejected'),
|
|
1154
|
+
404: errorResponse('Unknown asset'),
|
|
1155
|
+
405: methodNotAllowedResponse,
|
|
1156
|
+
},
|
|
1157
|
+
}),
|
|
1158
|
+
},
|
|
1159
|
+
'/assets/app.js': {
|
|
1160
|
+
get: operation({
|
|
1161
|
+
tags: ['dashboard'],
|
|
1162
|
+
summary: 'The dashboard client',
|
|
1163
|
+
operationId: 'getDashboardJs',
|
|
1164
|
+
responses: {
|
|
1165
|
+
200: assetResponse('text/javascript', 'Client served from an in-memory constant'),
|
|
1166
|
+
403: errorResponse('A non-loopback Host or Origin was rejected'),
|
|
1167
|
+
404: errorResponse('Unknown asset'),
|
|
1168
|
+
405: methodNotAllowedResponse,
|
|
1169
|
+
},
|
|
1170
|
+
}),
|
|
1171
|
+
},
|
|
1172
|
+
'/openapi.json': {
|
|
1173
|
+
get: operation({
|
|
1174
|
+
tags: ['system'],
|
|
1175
|
+
summary: 'The checked-in OpenAPI document',
|
|
1176
|
+
operationId: 'getOpenApiDocument',
|
|
1177
|
+
responses: {
|
|
1178
|
+
200: jsonResponse('OpenApiDocument', 'Byte-identical to `docs/openapi/team-db.v1.json`'),
|
|
1179
|
+
403: errorResponse('A non-loopback Host or Origin was rejected'),
|
|
1180
|
+
405: methodNotAllowedResponse,
|
|
1181
|
+
},
|
|
1182
|
+
}),
|
|
1183
|
+
},
|
|
1184
|
+
'/health': {
|
|
1185
|
+
get: operation({
|
|
1186
|
+
tags: ['system'],
|
|
1187
|
+
summary: 'Database and projection health',
|
|
1188
|
+
operationId: 'getHealth',
|
|
1189
|
+
responses: {
|
|
1190
|
+
200: jsonResponse('Health', 'The database opens and its schema matches'),
|
|
1191
|
+
403: errorResponse('A non-loopback Host or Origin was rejected'),
|
|
1192
|
+
405: methodNotAllowedResponse,
|
|
1193
|
+
503: errorResponse('The database is missing, corrupt, outdated or mismatched'),
|
|
1194
|
+
},
|
|
1195
|
+
}),
|
|
1196
|
+
},
|
|
1197
|
+
'/api/v1/meta': {
|
|
1198
|
+
get: operation({
|
|
1199
|
+
tags: ['system'],
|
|
1200
|
+
summary: 'API, OpenAPI and schema identity',
|
|
1201
|
+
operationId: 'getMeta',
|
|
1202
|
+
responses: {
|
|
1203
|
+
200: jsonResponse('Meta', 'Version, migrations and runtime features'),
|
|
1204
|
+
...commonErrorResponses,
|
|
1205
|
+
},
|
|
1206
|
+
}),
|
|
1207
|
+
},
|
|
1208
|
+
'/api/v1/tasks': {
|
|
1209
|
+
get: listOperation(['tasks'], 'List task summaries', 'listTasks', 'TaskList', LIST_TASK_PARAMETERS),
|
|
1210
|
+
},
|
|
1211
|
+
'/api/v1/tasks/{slug}': {
|
|
1212
|
+
get: taskScopedOperation(['tasks'], 'One task with routing and counts', 'getTask', 'TaskDetail'),
|
|
1213
|
+
},
|
|
1214
|
+
'/api/v1/tasks/{slug}/pipeline': {
|
|
1215
|
+
get: taskScopedOperation(['pipeline'], 'Pipeline steps with derived state', 'getTaskPipeline', 'Pipeline'),
|
|
1216
|
+
},
|
|
1217
|
+
'/api/v1/tasks/{slug}/attempts': {
|
|
1218
|
+
get: listOperation(['attempts'], 'Attempts in ledger order', 'listTaskAttempts', 'AttemptList', attemptParameters),
|
|
1219
|
+
},
|
|
1220
|
+
'/api/v1/tasks/{slug}/events': {
|
|
1221
|
+
get: listOperation(['events'], 'Typed lifecycle events', 'listTaskEvents', 'EventList', eventParameters),
|
|
1222
|
+
},
|
|
1223
|
+
'/api/v1/tasks/{slug}/timeline': {
|
|
1224
|
+
get: listOperation(['events'], 'Attempts, gates and events merged by timestamp', 'getTaskTimeline', 'Timeline', [
|
|
1225
|
+
slugParameter,
|
|
1226
|
+
...paginationParameters,
|
|
1227
|
+
]),
|
|
1228
|
+
},
|
|
1229
|
+
'/api/v1/tasks/{slug}/artifacts': {
|
|
1230
|
+
get: taskScopedOperation(['artifacts'], 'Artifact receipts with AC ids and paths', 'listTaskArtifacts', 'ArtifactList'),
|
|
1231
|
+
},
|
|
1232
|
+
'/api/v1/tasks/{slug}/prompts': {
|
|
1233
|
+
get: taskScopedOperation(['prompts'], 'Verbatim prompt and prompt-log entries', 'getTaskPrompts', 'Prompts'),
|
|
1234
|
+
},
|
|
1235
|
+
'/api/v1/tasks/{slug}/metrics': {
|
|
1236
|
+
get: taskScopedOperation(['metrics'], 'Event counts and derived durations', 'getTaskMetrics', 'MetricsSummary'),
|
|
1237
|
+
},
|
|
1238
|
+
'/api/v1/tasks/{slug}/gates': {
|
|
1239
|
+
get: taskScopedOperation(['gates'], 'Human gates with start, end and duration', 'listTaskGates', 'GateList'),
|
|
1240
|
+
},
|
|
1241
|
+
'/api/v1/tasks/{slug}/documents': {
|
|
1242
|
+
get: listOperation(['documents'], 'Raw document summaries', 'listTaskDocuments', 'DocumentSummaryList', documentListParameters),
|
|
1243
|
+
},
|
|
1244
|
+
'/api/v1/tasks/{slug}/document': {
|
|
1245
|
+
get: operation({
|
|
1246
|
+
tags: ['documents'],
|
|
1247
|
+
summary: 'One raw document chunk',
|
|
1248
|
+
operationId: 'getTaskDocument',
|
|
1249
|
+
parameters: documentContentParameters,
|
|
1250
|
+
responses: {
|
|
1251
|
+
200: jsonResponse('DocumentContent', 'The requested chunk'),
|
|
1252
|
+
...commonErrorResponses,
|
|
1253
|
+
409: errorResponse('The content is intentionally omitted (retention or size cap)'),
|
|
1254
|
+
410: errorResponse('The document is binary'),
|
|
1255
|
+
416: errorResponse('The offset is past the end of the document'),
|
|
1256
|
+
},
|
|
1257
|
+
}),
|
|
1258
|
+
},
|
|
1259
|
+
'/api/v1/tasks/{slug}/export': {
|
|
1260
|
+
get: taskScopedOperation(
|
|
1261
|
+
['tasks'],
|
|
1262
|
+
'A per-task JSON bundle, with a 5 MiB raw-content cap',
|
|
1263
|
+
'exportTask',
|
|
1264
|
+
'TaskExport',
|
|
1265
|
+
[slugParameter, { name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } }],
|
|
1266
|
+
),
|
|
1267
|
+
},
|
|
1268
|
+
'/api/v1/stats': {
|
|
1269
|
+
get: listOperation(['stats'], 'Aggregate counts and durations', 'getStats', 'Stats', [
|
|
1270
|
+
{ name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } },
|
|
1271
|
+
]),
|
|
1272
|
+
},
|
|
1273
|
+
'/api/v1/sync-runs': {
|
|
1274
|
+
get: listOperation(['sync'], 'Projection runs, newest first', 'listSyncRuns', 'SyncRunList', paginationParameters),
|
|
1275
|
+
},
|
|
1276
|
+
'/api/v1/sync': {
|
|
1277
|
+
post: operation({
|
|
1278
|
+
tags: ['sync'],
|
|
1279
|
+
summary: 'Rescan task files (idempotent)',
|
|
1280
|
+
description:
|
|
1281
|
+
'The only non-GET operation. It re-reads `.ai.local/team/tasks` into the database and never writes task state. A second call over an unchanged tree reports `unchanged` for every task.',
|
|
1282
|
+
operationId: 'triggerSync',
|
|
1283
|
+
parameters: [],
|
|
1284
|
+
requestBody: {
|
|
1285
|
+
required: false,
|
|
1286
|
+
description: 'Absent or an empty JSON object; any other body is rejected.',
|
|
1287
|
+
content: { 'application/json': { schema: object({}, []) } },
|
|
1288
|
+
},
|
|
1289
|
+
responses: {
|
|
1290
|
+
200: jsonResponse('SyncResult', 'The completed rescan'),
|
|
1291
|
+
...commonErrorResponses,
|
|
1292
|
+
413: errorResponse('The request body exceeds 1 KiB'),
|
|
1293
|
+
},
|
|
1294
|
+
}),
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
1297
|
+
components: { schemas: { ...schemas, OpenApiDocument: { type: 'object', additionalProperties: true } } },
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
/** Deterministic serialization: authored key order, two spaces, one trailing newline. */
|
|
1301
|
+
export const serializeOpenApiDocument = (document = OPENAPI_DOCUMENT) => `${JSON.stringify(document, null, 2)}\n`;
|