@bonesofspring/ai-rules 0.2.57 → 0.2.61
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 +127 -0
- package/README.md +91 -20
- package/bin/cli.js +714 -33
- package/bin/lib/ai-local-drift.js +18 -0
- package/bin/lib/engine-scripts.js +25 -5
- package/bin/lib/engine-upgrade.js +279 -0
- package/bin/lib/mcp/catalog.js +158 -0
- package/bin/lib/mcp/clients.js +35 -2
- package/bin/lib/mcp/credentials.js +173 -1
- package/bin/lib/mcp/doctor.js +192 -24
- package/bin/lib/mcp/npx.js +17 -0
- package/bin/lib/mcp/registry.js +12 -4
- package/bin/lib/merged-config.js +38 -0
- package/bin/lib/seed-ai-local-team.js +37 -19
- package/docs/MCP-CATALOG.md +84 -0
- package/docs/MCP-SETUP.md +62 -6
- package/docs/OPENCODE.md +22 -2
- package/docs/PLATFORMS.md +38 -0
- package/docs/PRESET-CONTRIBUTION.md +12 -1
- package/docs/TEAM-DB.md +187 -20
- package/docs/openapi/team-db.v1.json +4443 -2083
- package/mcp/defectdojo-mcp.mjs +353 -0
- package/mcp/github-proxy.mjs +133 -0
- package/mcp/gitlab.mjs +5 -1
- package/mcp/lib/defectdojo.mjs +249 -0
- package/mcp/lib/github.mjs +187 -0
- package/mcp/lib/streamable-http.mjs +185 -0
- package/mcp/lib/yandex.mjs +55 -152
- package/package.json +11 -3
- package/presets/_shared/ai-local/scripts/check-write-scope.mjs +212 -0
- package/presets/_shared/ai-local/scripts/lock.mjs +139 -19
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +343 -50
- package/presets/_shared/ai-local/scripts/run.mjs +122 -3
- package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +13 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +12 -0
- package/presets/_shared/core/review/code-review-mr.md +10 -0
- package/presets/_shared/hooks/README.md +23 -3
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +200 -4
- package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
- package/presets/_shared/hooks/run-hook.mjs +102 -0
- package/presets/claude/android-kotlin/commands/update.md +1 -0
- package/presets/claude/android-kotlin/hooks/README.md +4 -3
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/android-kotlin/settings.json +2 -2
- package/presets/claude/android-kotlin/team/README.md +5 -0
- package/presets/claude/go/commands/update.md +1 -0
- package/presets/claude/go/hooks/README.md +4 -3
- package/presets/claude/go/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/go/hooks/examples/README.md +2 -2
- package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/go/hooks/run-hook.mjs +102 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/go/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/go/settings.json +2 -2
- package/presets/claude/go/team/README.md +5 -0
- package/presets/claude/ios-swift/commands/update.md +1 -0
- package/presets/claude/ios-swift/hooks/README.md +4 -3
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/ios-swift/settings.json +2 -2
- package/presets/claude/ios-swift/team/README.md +5 -0
- package/presets/claude/java/commands/update.md +1 -0
- package/presets/claude/java/hooks/README.md +4 -3
- package/presets/claude/java/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/java/hooks/examples/README.md +2 -2
- package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
- package/presets/claude/java/hooks/run-hook.mjs +102 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/java/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/java/settings.json +2 -2
- package/presets/claude/java/team/README.md +5 -0
- package/presets/claude/mcp-ts/commands/update.md +1 -0
- package/presets/claude/mcp-ts/hooks/README.md +4 -3
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/mcp-ts/settings.json +2 -2
- package/presets/claude/mcp-ts/team/README.md +5 -0
- package/presets/claude/mol/commands/update.md +1 -0
- package/presets/claude/mol/hooks/README.md +20 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
- package/presets/claude/mol/hooks/run-hook.mjs +102 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/mol/settings.json +2 -2
- package/presets/claude/mol/team/README.md +5 -0
- package/presets/claude/next/agents/build-verifier.md +4 -0
- package/presets/claude/next/agents/code-reviewer.md +10 -0
- package/presets/claude/next/agents/feature-developer.md +1 -0
- package/presets/claude/next/agents/task-analyst.md +4 -0
- package/presets/claude/next/agents/task-router.md +5 -3
- package/presets/claude/next/commands/README.md +1 -0
- package/presets/claude/next/commands/task-continue.md +4 -2
- package/presets/claude/next/commands/update.md +1 -0
- package/presets/claude/next/commands/upstream-research.md +23 -0
- package/presets/claude/next/hooks/README.md +4 -3
- package/presets/claude/next/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/next/hooks/examples/README.md +2 -2
- package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
- package/presets/claude/next/hooks/run-hook.mjs +102 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/next/settings.json +2 -2
- package/presets/claude/next/team/README.md +23 -0
- package/presets/claude/next/team/upstream/config.json +31 -0
- package/presets/claude/next/team/upstream/digest-template.md +55 -0
- package/presets/claude/next/team/upstream/opencode.json +34 -0
- package/presets/claude/next/team/upstream/projects.json +4 -0
- package/presets/claude/next/team/upstream/prompt.md +77 -0
- package/presets/claude/next/team/upstream/signatures.json +9 -0
- package/presets/claude/nuxt/commands/update.md +1 -0
- package/presets/claude/nuxt/hooks/README.md +4 -3
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/nuxt/hooks/examples/README.md +2 -2
- package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
- package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/nuxt/settings.json +2 -2
- package/presets/claude/nuxt/team/README.md +5 -0
- package/presets/claude/php-hexagonal/commands/update.md +1 -0
- package/presets/claude/php-hexagonal/hooks/README.md +4 -3
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/php-hexagonal/settings.json +2 -2
- package/presets/claude/php-hexagonal/team/README.md +5 -0
- package/presets/claude/php-laravel/commands/update.md +1 -0
- package/presets/claude/php-laravel/hooks/README.md +4 -3
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/php-laravel/settings.json +2 -2
- package/presets/claude/php-laravel/team/README.md +5 -0
- package/presets/claude/svelte/commands/update.md +1 -0
- package/presets/claude/svelte/hooks/README.md +4 -3
- package/presets/claude/svelte/hooks/chain-team-phases.sh +200 -4
- package/presets/claude/svelte/hooks/examples/README.md +2 -2
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
- package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/svelte/settings.json +2 -2
- package/presets/claude/svelte/team/README.md +5 -0
- package/presets/cursor/android-kotlin/commands/update.md +1 -0
- package/presets/cursor/android-kotlin/hooks/README.md +2 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
- package/presets/cursor/android-kotlin/hooks.json +2 -2
- package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/android-kotlin/team/README.md +5 -0
- package/presets/cursor/go/commands/update.md +1 -0
- package/presets/cursor/go/hooks/README.md +2 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/go/hooks/examples/README.md +1 -1
- package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/go/hooks/run-hook.mjs +102 -0
- package/presets/cursor/go/hooks.json +2 -2
- package/presets/cursor/go/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/go/team/README.md +5 -0
- package/presets/cursor/ios-swift/commands/update.md +1 -0
- package/presets/cursor/ios-swift/hooks/README.md +2 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
- package/presets/cursor/ios-swift/hooks.json +2 -2
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/ios-swift/team/README.md +5 -0
- package/presets/cursor/java/commands/update.md +1 -0
- package/presets/cursor/java/hooks/README.md +2 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/java/hooks/examples/README.md +1 -1
- package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/java/hooks/run-hook.mjs +102 -0
- package/presets/cursor/java/hooks.json +2 -2
- package/presets/cursor/java/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/java/team/README.md +5 -0
- package/presets/cursor/mcp-ts/commands/update.md +1 -0
- package/presets/cursor/mcp-ts/hooks/README.md +2 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
- package/presets/cursor/mcp-ts/hooks.json +2 -2
- package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/mcp-ts/team/README.md +5 -0
- package/presets/cursor/mol/MCP.md +4 -3
- package/presets/cursor/mol/commands/update.md +1 -0
- package/presets/cursor/mol/hooks/README.md +2 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/mol/hooks/examples/README.md +1 -1
- package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
- package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
- package/presets/cursor/mol/hooks.json +2 -2
- package/presets/cursor/mol/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/mol/team/README.md +5 -0
- package/presets/cursor/next/MCP.md +4 -3
- package/presets/cursor/next/agents/build-verifier.md +4 -0
- package/presets/cursor/next/agents/code-reviewer.md +10 -0
- package/presets/cursor/next/agents/feature-developer.md +1 -0
- package/presets/cursor/next/agents/task-analyst.md +4 -0
- package/presets/cursor/next/agents/task-router.md +5 -3
- package/presets/cursor/next/commands/README.md +1 -0
- package/presets/cursor/next/commands/task-continue.md +4 -2
- package/presets/cursor/next/commands/update.md +1 -0
- package/presets/cursor/next/commands/upstream-research.md +23 -0
- package/presets/cursor/next/hooks/README.md +2 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/next/hooks/examples/README.md +1 -1
- package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/next/hooks/run-hook.mjs +102 -0
- package/presets/cursor/next/hooks.json +2 -2
- package/presets/cursor/next/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/next/team/README.md +23 -0
- package/presets/cursor/next/team/upstream/config.json +31 -0
- package/presets/cursor/next/team/upstream/digest-template.md +55 -0
- package/presets/cursor/next/team/upstream/opencode.json +34 -0
- package/presets/cursor/next/team/upstream/projects.json +4 -0
- package/presets/cursor/next/team/upstream/prompt.md +77 -0
- package/presets/cursor/next/team/upstream/signatures.json +9 -0
- package/presets/cursor/nuxt/commands/update.md +1 -0
- package/presets/cursor/nuxt/hooks/README.md +2 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
- package/presets/cursor/nuxt/hooks.json +2 -2
- package/presets/cursor/nuxt/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/nuxt/team/README.md +5 -0
- package/presets/cursor/php-hexagonal/commands/update.md +1 -0
- package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
- package/presets/cursor/php-hexagonal/hooks.json +2 -2
- package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/php-hexagonal/team/README.md +5 -0
- package/presets/cursor/php-laravel/commands/update.md +1 -0
- package/presets/cursor/php-laravel/hooks/README.md +2 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
- package/presets/cursor/php-laravel/hooks.json +2 -2
- package/presets/cursor/php-laravel/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/php-laravel/team/README.md +5 -0
- package/presets/cursor/svelte/commands/update.md +1 -0
- package/presets/cursor/svelte/hooks/README.md +2 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +200 -4
- package/presets/cursor/svelte/hooks/examples/README.md +1 -1
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
- package/presets/cursor/svelte/hooks.json +2 -2
- package/presets/cursor/svelte/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/svelte/team/README.md +5 -0
- package/presets/mavis/android-kotlin/adapter-map.json +11 -3
- package/presets/mavis/android-kotlin/commands/update.md +1 -0
- package/presets/mavis/android-kotlin/hooks/README.md +2 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/mavis/android-kotlin/team/README.md +5 -0
- package/presets/mavis/go/adapter-map.json +11 -3
- package/presets/mavis/go/commands/update.md +1 -0
- package/presets/mavis/go/hooks/README.md +2 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/go/rules/code-review-mr.md +10 -0
- package/presets/mavis/go/team/README.md +5 -0
- package/presets/mavis/ios-swift/adapter-map.json +11 -3
- package/presets/mavis/ios-swift/commands/update.md +1 -0
- package/presets/mavis/ios-swift/hooks/README.md +2 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/mavis/ios-swift/team/README.md +5 -0
- package/presets/mavis/java/adapter-map.json +11 -3
- package/presets/mavis/java/commands/update.md +1 -0
- package/presets/mavis/java/hooks/README.md +2 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/java/rules/code-review-mr.md +10 -0
- package/presets/mavis/java/team/README.md +5 -0
- package/presets/mavis/mcp-ts/adapter-map.json +11 -3
- package/presets/mavis/mcp-ts/commands/update.md +1 -0
- package/presets/mavis/mcp-ts/hooks/README.md +2 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/mavis/mcp-ts/team/README.md +5 -0
- package/presets/mavis/mol/MCP.md +4 -3
- package/presets/mavis/mol/adapter-map.json +11 -3
- package/presets/mavis/mol/commands/update.md +1 -0
- package/presets/mavis/mol/hooks/README.md +2 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/mol/rules/code-review-mr.md +10 -0
- package/presets/mavis/mol/team/README.md +5 -0
- package/presets/mavis/next/MCP.md +4 -3
- package/presets/mavis/next/adapter-map.json +67 -3
- package/presets/mavis/next/agents/build-verifier.md +4 -0
- package/presets/mavis/next/agents/code-reviewer.md +10 -0
- package/presets/mavis/next/agents/feature-developer.md +1 -0
- package/presets/mavis/next/agents/task-analyst.md +4 -0
- package/presets/mavis/next/agents/task-router.md +5 -3
- package/presets/mavis/next/commands/README.md +1 -0
- package/presets/mavis/next/commands/task-continue.md +4 -2
- package/presets/mavis/next/commands/update.md +1 -0
- package/presets/mavis/next/commands/upstream-research.md +18 -0
- package/presets/mavis/next/hooks/README.md +2 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/next/rules/code-review-mr.md +10 -0
- package/presets/mavis/next/team/README.md +23 -0
- package/presets/mavis/next/team/upstream/config.json +31 -0
- package/presets/mavis/next/team/upstream/digest-template.md +55 -0
- package/presets/mavis/next/team/upstream/opencode.json +34 -0
- package/presets/mavis/next/team/upstream/projects.json +4 -0
- package/presets/mavis/next/team/upstream/prompt.md +77 -0
- package/presets/mavis/next/team/upstream/signatures.json +9 -0
- package/presets/mavis/nuxt/adapter-map.json +11 -3
- package/presets/mavis/nuxt/commands/update.md +1 -0
- package/presets/mavis/nuxt/hooks/README.md +2 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/nuxt/rules/code-review-mr.md +10 -0
- package/presets/mavis/nuxt/team/README.md +5 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
- package/presets/mavis/php-hexagonal/commands/update.md +1 -0
- package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/mavis/php-hexagonal/team/README.md +5 -0
- package/presets/mavis/php-laravel/adapter-map.json +11 -3
- package/presets/mavis/php-laravel/commands/update.md +1 -0
- package/presets/mavis/php-laravel/hooks/README.md +2 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/mavis/php-laravel/team/README.md +5 -0
- package/presets/mavis/svelte/adapter-map.json +11 -3
- package/presets/mavis/svelte/commands/update.md +1 -0
- package/presets/mavis/svelte/hooks/README.md +2 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +200 -4
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/svelte/rules/code-review-mr.md +10 -0
- package/presets/mavis/svelte/team/README.md +5 -0
- package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
- package/presets/opencode/android-kotlin/README.md +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +11 -3
- package/presets/opencode/android-kotlin/commands/update.md +1 -0
- package/presets/opencode/android-kotlin/hooks/README.md +3 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/opencode/android-kotlin/team/README.md +5 -0
- package/presets/opencode/go/OPENCODE.md +1 -1
- package/presets/opencode/go/README.md +1 -1
- package/presets/opencode/go/adapter-map.json +11 -3
- package/presets/opencode/go/commands/update.md +1 -0
- package/presets/opencode/go/hooks/README.md +3 -2
- package/presets/opencode/go/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/go/rules/code-review-mr.md +10 -0
- package/presets/opencode/go/team/README.md +5 -0
- package/presets/opencode/ios-swift/OPENCODE.md +1 -1
- package/presets/opencode/ios-swift/README.md +1 -1
- package/presets/opencode/ios-swift/adapter-map.json +11 -3
- package/presets/opencode/ios-swift/commands/update.md +1 -0
- package/presets/opencode/ios-swift/hooks/README.md +3 -2
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/opencode/ios-swift/team/README.md +5 -0
- package/presets/opencode/java/OPENCODE.md +1 -1
- package/presets/opencode/java/README.md +1 -1
- package/presets/opencode/java/adapter-map.json +11 -3
- package/presets/opencode/java/commands/update.md +1 -0
- package/presets/opencode/java/hooks/README.md +3 -2
- package/presets/opencode/java/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/java/rules/code-review-mr.md +10 -0
- package/presets/opencode/java/team/README.md +5 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
- package/presets/opencode/mcp-ts/README.md +1 -1
- package/presets/opencode/mcp-ts/adapter-map.json +11 -3
- package/presets/opencode/mcp-ts/commands/update.md +1 -0
- package/presets/opencode/mcp-ts/hooks/README.md +3 -2
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/opencode/mcp-ts/team/README.md +5 -0
- package/presets/opencode/mol/MCP.md +4 -3
- package/presets/opencode/mol/OPENCODE.md +1 -1
- package/presets/opencode/mol/README.md +1 -1
- package/presets/opencode/mol/adapter-map.json +11 -3
- package/presets/opencode/mol/commands/update.md +1 -0
- package/presets/opencode/mol/hooks/README.md +3 -2
- package/presets/opencode/mol/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/mol/rules/code-review-mr.md +10 -0
- package/presets/opencode/mol/team/README.md +5 -0
- package/presets/opencode/next/MCP.md +4 -3
- package/presets/opencode/next/OPENCODE.md +1 -1
- package/presets/opencode/next/README.md +1 -1
- package/presets/opencode/next/adapter-map.json +67 -3
- package/presets/opencode/next/agents/build-verifier.md +4 -0
- package/presets/opencode/next/agents/code-reviewer.md +10 -0
- package/presets/opencode/next/agents/feature-developer.md +1 -0
- package/presets/opencode/next/agents/task-analyst.md +4 -0
- package/presets/opencode/next/agents/task-router.md +5 -3
- package/presets/opencode/next/commands/README.md +1 -0
- package/presets/opencode/next/commands/task-continue.md +4 -2
- package/presets/opencode/next/commands/update.md +1 -0
- package/presets/opencode/next/commands/upstream-research.md +26 -0
- package/presets/opencode/next/hooks/README.md +3 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/next/rules/code-review-mr.md +10 -0
- package/presets/opencode/next/team/README.md +23 -0
- package/presets/opencode/next/team/upstream/config.json +31 -0
- package/presets/opencode/next/team/upstream/digest-template.md +55 -0
- package/presets/opencode/next/team/upstream/opencode.json +34 -0
- package/presets/opencode/next/team/upstream/projects.json +4 -0
- package/presets/opencode/next/team/upstream/prompt.md +77 -0
- package/presets/opencode/next/team/upstream/signatures.json +9 -0
- package/presets/opencode/nuxt/OPENCODE.md +1 -1
- package/presets/opencode/nuxt/README.md +1 -1
- package/presets/opencode/nuxt/adapter-map.json +11 -3
- package/presets/opencode/nuxt/commands/update.md +1 -0
- package/presets/opencode/nuxt/hooks/README.md +3 -2
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/nuxt/rules/code-review-mr.md +10 -0
- package/presets/opencode/nuxt/team/README.md +5 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
- package/presets/opencode/php-hexagonal/README.md +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
- package/presets/opencode/php-hexagonal/commands/update.md +1 -0
- package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/opencode/php-hexagonal/team/README.md +5 -0
- package/presets/opencode/php-laravel/OPENCODE.md +1 -1
- package/presets/opencode/php-laravel/README.md +1 -1
- package/presets/opencode/php-laravel/adapter-map.json +11 -3
- package/presets/opencode/php-laravel/commands/update.md +1 -0
- package/presets/opencode/php-laravel/hooks/README.md +3 -2
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/opencode/php-laravel/team/README.md +5 -0
- package/presets/opencode/svelte/OPENCODE.md +1 -1
- package/presets/opencode/svelte/README.md +1 -1
- package/presets/opencode/svelte/adapter-map.json +11 -3
- package/presets/opencode/svelte/commands/update.md +1 -0
- package/presets/opencode/svelte/hooks/README.md +3 -2
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +200 -4
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/svelte/rules/code-review-mr.md +10 -0
- package/presets/opencode/svelte/team/README.md +5 -0
- package/presets/zcode/android-kotlin/adapter-map.json +11 -3
- package/presets/zcode/android-kotlin/commands/update.md +1 -0
- package/presets/zcode/android-kotlin/hooks/README.md +2 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/zcode/android-kotlin/team/README.md +5 -0
- package/presets/zcode/go/adapter-map.json +11 -3
- package/presets/zcode/go/commands/update.md +1 -0
- package/presets/zcode/go/hooks/README.md +2 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/go/rules/code-review-mr.md +10 -0
- package/presets/zcode/go/team/README.md +5 -0
- package/presets/zcode/ios-swift/adapter-map.json +11 -3
- package/presets/zcode/ios-swift/commands/update.md +1 -0
- package/presets/zcode/ios-swift/hooks/README.md +2 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/zcode/ios-swift/team/README.md +5 -0
- package/presets/zcode/java/adapter-map.json +11 -3
- package/presets/zcode/java/commands/update.md +1 -0
- package/presets/zcode/java/hooks/README.md +2 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/java/rules/code-review-mr.md +10 -0
- package/presets/zcode/java/team/README.md +5 -0
- package/presets/zcode/mcp-ts/adapter-map.json +11 -3
- package/presets/zcode/mcp-ts/commands/update.md +1 -0
- package/presets/zcode/mcp-ts/hooks/README.md +2 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/zcode/mcp-ts/team/README.md +5 -0
- package/presets/zcode/mol/MCP.md +4 -3
- package/presets/zcode/mol/adapter-map.json +11 -3
- package/presets/zcode/mol/commands/update.md +1 -0
- package/presets/zcode/mol/hooks/README.md +2 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/mol/rules/code-review-mr.md +10 -0
- package/presets/zcode/mol/team/README.md +5 -0
- package/presets/zcode/next/MCP.md +4 -3
- package/presets/zcode/next/adapter-map.json +67 -3
- package/presets/zcode/next/agents/build-verifier.md +4 -0
- package/presets/zcode/next/agents/code-reviewer.md +10 -0
- package/presets/zcode/next/agents/feature-developer.md +1 -0
- package/presets/zcode/next/agents/task-analyst.md +4 -0
- package/presets/zcode/next/agents/task-router.md +5 -3
- package/presets/zcode/next/commands/README.md +1 -0
- package/presets/zcode/next/commands/task-continue.md +4 -2
- package/presets/zcode/next/commands/update.md +1 -0
- package/presets/zcode/next/commands/upstream-research.md +26 -0
- package/presets/zcode/next/hooks/README.md +2 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/next/rules/code-review-mr.md +10 -0
- package/presets/zcode/next/team/README.md +23 -0
- package/presets/zcode/next/team/upstream/config.json +31 -0
- package/presets/zcode/next/team/upstream/digest-template.md +55 -0
- package/presets/zcode/next/team/upstream/opencode.json +34 -0
- package/presets/zcode/next/team/upstream/projects.json +4 -0
- package/presets/zcode/next/team/upstream/prompt.md +77 -0
- package/presets/zcode/next/team/upstream/signatures.json +9 -0
- package/presets/zcode/nuxt/adapter-map.json +11 -3
- package/presets/zcode/nuxt/commands/update.md +1 -0
- package/presets/zcode/nuxt/hooks/README.md +2 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/nuxt/rules/code-review-mr.md +10 -0
- package/presets/zcode/nuxt/team/README.md +5 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
- package/presets/zcode/php-hexagonal/commands/update.md +1 -0
- package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/zcode/php-hexagonal/team/README.md +5 -0
- package/presets/zcode/php-laravel/adapter-map.json +11 -3
- package/presets/zcode/php-laravel/commands/update.md +1 -0
- package/presets/zcode/php-laravel/hooks/README.md +2 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/zcode/php-laravel/team/README.md +5 -0
- package/presets/zcode/svelte/adapter-map.json +11 -3
- package/presets/zcode/svelte/commands/update.md +1 -0
- package/presets/zcode/svelte/hooks/README.md +2 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +200 -4
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/svelte/rules/code-review-mr.md +10 -0
- package/presets/zcode/svelte/team/README.md +5 -0
- package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
- package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
- package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
- package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The OpenAPI 3.1 document for the team-db API: reads plus
|
|
3
|
-
* mutations (the idempotent rescan
|
|
2
|
+
* The OpenAPI 3.1 document for the team-db API: reads plus six bounded
|
|
3
|
+
* mutations (the idempotent rescan, the confirmed task delete, and the four
|
|
4
|
+
* job writes: create, update, delete, run-now).
|
|
4
5
|
*
|
|
5
6
|
* This module is the single source of the checked-in
|
|
6
7
|
* `packages/ai-rules/docs/openapi/team-db.v1.json`: `check-team-db-contract.mjs
|
|
@@ -13,6 +14,9 @@
|
|
|
13
14
|
* allowed inside v1; removing or renaming anything is a v2 document.
|
|
14
15
|
*/
|
|
15
16
|
|
|
17
|
+
// The run-reason vocabulary is the scheduler's own list: one source, no drift.
|
|
18
|
+
import { REASON_CODES } from './team-db-scheduler.mjs';
|
|
19
|
+
|
|
16
20
|
export const API_MAJOR = 1;
|
|
17
21
|
export const API_VERSION = '1.0.0';
|
|
18
22
|
export const OPENAPI_VERSION = '3.1.0';
|
|
@@ -21,6 +25,8 @@ export const OPENAPI_SERVER_URL = 'http://127.0.0.1:4178';
|
|
|
21
25
|
|
|
22
26
|
/** Mirrors `SLUG_RE` in `team-db-project.mjs`; a path parameter, never a file path. */
|
|
23
27
|
export const SLUG_PATTERN = '^[a-z0-9]+(?:-[a-z0-9]+)*$';
|
|
28
|
+
export const JOB_ID_PATTERN = '^[a-z0-9]+(?:-[a-z0-9]+)*$';
|
|
29
|
+
export const RUN_ID_PATTERN = '^[0-9]{8}T[0-9]{6}Z-[0-9a-f]{8}$';
|
|
24
30
|
export const AGENT_PATTERN = '^[a-z0-9][a-z0-9-]{0,63}$';
|
|
25
31
|
export const INTENT_PATTERN = '^[a-z][a-z0-9-]{0,31}$';
|
|
26
32
|
|
|
@@ -71,6 +77,8 @@ export const ERROR_CODES = [
|
|
|
71
77
|
'E_SCHEMA_OUTDATED',
|
|
72
78
|
'E_SCHEMA_NEWER',
|
|
73
79
|
'E_BUSY',
|
|
80
|
+
'E_CONFLICT',
|
|
81
|
+
'E_SCHEDULER_OFFLINE',
|
|
74
82
|
'E_INTERNAL',
|
|
75
83
|
];
|
|
76
84
|
|
|
@@ -626,9 +634,22 @@ const schemas = {
|
|
|
626
634
|
projectedAt: nullable('string'),
|
|
627
635
|
capabilities: {
|
|
628
636
|
type: 'array',
|
|
629
|
-
items: { type: 'string', enum: ['sync', 'delete'] },
|
|
637
|
+
items: { type: 'string', enum: ['sync', 'delete', 'jobs', 'schedule'] },
|
|
630
638
|
},
|
|
639
|
+
scheduler: object(
|
|
640
|
+
{
|
|
641
|
+
state: { type: 'string', enum: ['running', 'stale', 'stopped'] },
|
|
642
|
+
pid: nullable('integer'),
|
|
643
|
+
startedAt: nullable('string'),
|
|
644
|
+
heartbeatAt: nullable('string'),
|
|
645
|
+
nextTickAt: nullable('string'),
|
|
646
|
+
jobsDue: { type: 'integer', minimum: 0 },
|
|
647
|
+
},
|
|
648
|
+
['state', 'pid', 'startedAt', 'heartbeatAt', 'nextTickAt', 'jobsDue'],
|
|
649
|
+
),
|
|
631
650
|
},
|
|
651
|
+
// `scheduler` is additive: every current server emits it, but a v1
|
|
652
|
+
// consumer must not require it.
|
|
632
653
|
['status', 'db', 'tasks', 'projectedAt', 'capabilities'],
|
|
633
654
|
),
|
|
634
655
|
Migration: object(
|
|
@@ -690,6 +711,276 @@ const schemas = {
|
|
|
690
711
|
'documentsIncluded',
|
|
691
712
|
],
|
|
692
713
|
),
|
|
714
|
+
// Reads: the server omits the key that belongs to the other `kind`, so only
|
|
715
|
+
// `kind` and the always-present fields are required. The optional keys stay
|
|
716
|
+
// declared so an older payload that carries a null sibling still validates.
|
|
717
|
+
JobSchedule: object(
|
|
718
|
+
{
|
|
719
|
+
kind: { type: 'string', enum: ['cron', 'interval'] },
|
|
720
|
+
expression: nullable('string'),
|
|
721
|
+
everySeconds: nullable('integer'),
|
|
722
|
+
timezone: { type: 'string' },
|
|
723
|
+
},
|
|
724
|
+
['kind', 'timezone'],
|
|
725
|
+
),
|
|
726
|
+
JobPayload: object(
|
|
727
|
+
{
|
|
728
|
+
kind: { type: 'string', enum: ['command', 'pipeline'] },
|
|
729
|
+
argv: { type: ['array', 'null'], items: { type: 'string' } },
|
|
730
|
+
promptTemplate: nullable('string'),
|
|
731
|
+
runner: { type: ['array', 'null'], items: { type: 'string' } },
|
|
732
|
+
},
|
|
733
|
+
['kind'],
|
|
734
|
+
),
|
|
735
|
+
// Writes: each `kind` admits only its own keys. The write validator refuses
|
|
736
|
+
// a null sibling, so a write must never carry one.
|
|
737
|
+
JobWriteSchedule: {
|
|
738
|
+
anyOf: [
|
|
739
|
+
object(
|
|
740
|
+
{
|
|
741
|
+
kind: { const: 'cron' },
|
|
742
|
+
expression: { type: 'string' },
|
|
743
|
+
timezone: { type: 'string' },
|
|
744
|
+
},
|
|
745
|
+
['kind', 'expression', 'timezone'],
|
|
746
|
+
),
|
|
747
|
+
object(
|
|
748
|
+
{
|
|
749
|
+
kind: { const: 'interval' },
|
|
750
|
+
everySeconds: { type: 'integer', minimum: 60, maximum: 2592000 },
|
|
751
|
+
timezone: { type: 'string' },
|
|
752
|
+
},
|
|
753
|
+
['kind', 'everySeconds', 'timezone'],
|
|
754
|
+
),
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
JobWritePayload: {
|
|
758
|
+
anyOf: [
|
|
759
|
+
object(
|
|
760
|
+
{
|
|
761
|
+
kind: { const: 'command' },
|
|
762
|
+
argv: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 32 },
|
|
763
|
+
},
|
|
764
|
+
['kind', 'argv'],
|
|
765
|
+
),
|
|
766
|
+
object(
|
|
767
|
+
{
|
|
768
|
+
kind: { const: 'pipeline' },
|
|
769
|
+
promptTemplate: { type: 'string' },
|
|
770
|
+
runner: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 32 },
|
|
771
|
+
},
|
|
772
|
+
['kind', 'promptTemplate', 'runner'],
|
|
773
|
+
),
|
|
774
|
+
],
|
|
775
|
+
},
|
|
776
|
+
Job: object(
|
|
777
|
+
{
|
|
778
|
+
id: { type: 'string', pattern: JOB_ID_PATTERN },
|
|
779
|
+
title: { type: 'string' },
|
|
780
|
+
enabled: { type: 'boolean' },
|
|
781
|
+
schedule: ref('JobSchedule'),
|
|
782
|
+
payload: ref('JobPayload'),
|
|
783
|
+
cwd: { type: 'string' },
|
|
784
|
+
envPassthrough: { type: 'array', items: { type: 'string' } },
|
|
785
|
+
timeoutMs: { type: 'integer', minimum: 1000, maximum: 43200000 },
|
|
786
|
+
concurrency: { type: 'string', enum: ['skip', 'queue', 'allow'] },
|
|
787
|
+
misfire: { type: 'string', enum: ['skip', 'run-once', 'catch-up'] },
|
|
788
|
+
createdAt: { type: 'string' },
|
|
789
|
+
updatedAt: { type: 'string' },
|
|
790
|
+
revision: { type: 'integer', minimum: 1 },
|
|
791
|
+
},
|
|
792
|
+
[
|
|
793
|
+
'id',
|
|
794
|
+
'title',
|
|
795
|
+
'enabled',
|
|
796
|
+
'schedule',
|
|
797
|
+
'payload',
|
|
798
|
+
'cwd',
|
|
799
|
+
'envPassthrough',
|
|
800
|
+
'timeoutMs',
|
|
801
|
+
'concurrency',
|
|
802
|
+
'misfire',
|
|
803
|
+
'createdAt',
|
|
804
|
+
'updatedAt',
|
|
805
|
+
'revision',
|
|
806
|
+
],
|
|
807
|
+
),
|
|
808
|
+
JobWrite: object(
|
|
809
|
+
{
|
|
810
|
+
id: { type: 'string', pattern: JOB_ID_PATTERN },
|
|
811
|
+
title: { type: 'string' },
|
|
812
|
+
enabled: { type: 'boolean' },
|
|
813
|
+
schedule: ref('JobWriteSchedule'),
|
|
814
|
+
payload: ref('JobWritePayload'),
|
|
815
|
+
cwd: { type: 'string' },
|
|
816
|
+
envPassthrough: { type: 'array', items: { type: 'string' } },
|
|
817
|
+
timeoutMs: { type: 'integer', minimum: 1000, maximum: 43200000 },
|
|
818
|
+
concurrency: { type: 'string', enum: ['skip', 'queue', 'allow'] },
|
|
819
|
+
misfire: { type: 'string', enum: ['skip', 'run-once', 'catch-up'] },
|
|
820
|
+
// Optional on create (defaults to 1); required on update, where a
|
|
821
|
+
// missing or stale value is 409 `E_CONFLICT`.
|
|
822
|
+
revision: { type: 'integer', minimum: 1 },
|
|
823
|
+
// Accepted because a `JobDetail.job` response can be sent back as the
|
|
824
|
+
// `PUT` body; the writing child keeps `createdAt` immutable.
|
|
825
|
+
createdAt: { type: 'string' },
|
|
826
|
+
updatedAt: { type: 'string' },
|
|
827
|
+
},
|
|
828
|
+
['id', 'schedule', 'payload'],
|
|
829
|
+
),
|
|
830
|
+
JobLastRun: object(
|
|
831
|
+
{
|
|
832
|
+
runId: { type: 'string' },
|
|
833
|
+
state: { type: 'string', enum: ['claimed', 'running', 'succeeded', 'failed', 'timeout', 'skipped', 'interrupted'] },
|
|
834
|
+
finishedAt: nullable('string'),
|
|
835
|
+
durationMs: nullable('integer'),
|
|
836
|
+
},
|
|
837
|
+
['runId', 'state', 'finishedAt', 'durationMs'],
|
|
838
|
+
),
|
|
839
|
+
JobDetail: object(
|
|
840
|
+
{
|
|
841
|
+
job: ref('Job'),
|
|
842
|
+
nextFireAt: nullable('string'),
|
|
843
|
+
lastRun: { anyOf: [ref('JobLastRun'), { type: 'null' }] },
|
|
844
|
+
},
|
|
845
|
+
['job', 'nextFireAt', 'lastRun'],
|
|
846
|
+
),
|
|
847
|
+
JobList: object(
|
|
848
|
+
{
|
|
849
|
+
items: { type: 'array', items: ref('JobDetail') },
|
|
850
|
+
total: { type: 'integer', minimum: 0 },
|
|
851
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
852
|
+
offset: { type: 'integer', minimum: 0 },
|
|
853
|
+
nextOffset: nullable('integer'),
|
|
854
|
+
},
|
|
855
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
856
|
+
),
|
|
857
|
+
JobRun: object(
|
|
858
|
+
{
|
|
859
|
+
runId: { type: 'string', pattern: RUN_ID_PATTERN },
|
|
860
|
+
jobId: { type: 'string', pattern: JOB_ID_PATTERN },
|
|
861
|
+
trigger: { type: 'string', enum: ['schedule', 'manual', 'catch-up'] },
|
|
862
|
+
state: { type: 'string', enum: ['claimed', 'running', 'succeeded', 'failed', 'timeout', 'skipped', 'interrupted'] },
|
|
863
|
+
// `E_ORPHANED` is a reason, never an HTTP code. The fixed set is the
|
|
864
|
+
// scheduler's `REASON_CODES`; a lost child writes the parameterised
|
|
865
|
+
// `E_EXIT_<code>` / `E_SIGNAL_<signal>` families, and `null` is a
|
|
866
|
+
// successful run.
|
|
867
|
+
reasonCode: {
|
|
868
|
+
anyOf: [
|
|
869
|
+
{ type: 'string', enum: [...REASON_CODES] },
|
|
870
|
+
{ type: 'string', pattern: '^E_EXIT_(?:-?[0-9]+|UNKNOWN)$' },
|
|
871
|
+
{ type: 'string', pattern: '^E_SIGNAL_[A-Z0-9]+$' },
|
|
872
|
+
{ type: 'null' },
|
|
873
|
+
],
|
|
874
|
+
},
|
|
875
|
+
exitCode: nullable('integer'),
|
|
876
|
+
signal: nullable('string'),
|
|
877
|
+
pid: nullable('integer'),
|
|
878
|
+
startedAt: { type: 'string' },
|
|
879
|
+
finishedAt: nullable('string'),
|
|
880
|
+
durationMs: nullable('integer'),
|
|
881
|
+
stdoutBytes: { type: 'integer', minimum: 0 },
|
|
882
|
+
stderrBytes: { type: 'integer', minimum: 0 },
|
|
883
|
+
stdoutTruncated: { type: 'boolean' },
|
|
884
|
+
stderrTruncated: { type: 'boolean' },
|
|
885
|
+
parseError: nullable('string'),
|
|
886
|
+
},
|
|
887
|
+
[
|
|
888
|
+
'runId',
|
|
889
|
+
'jobId',
|
|
890
|
+
'trigger',
|
|
891
|
+
'state',
|
|
892
|
+
'reasonCode',
|
|
893
|
+
'exitCode',
|
|
894
|
+
'signal',
|
|
895
|
+
'pid',
|
|
896
|
+
'startedAt',
|
|
897
|
+
'finishedAt',
|
|
898
|
+
'durationMs',
|
|
899
|
+
'stdoutBytes',
|
|
900
|
+
'stderrBytes',
|
|
901
|
+
'stdoutTruncated',
|
|
902
|
+
'stderrTruncated',
|
|
903
|
+
'parseError',
|
|
904
|
+
],
|
|
905
|
+
),
|
|
906
|
+
JobRunEvent: object(
|
|
907
|
+
{
|
|
908
|
+
seq: { type: 'integer', minimum: 1 },
|
|
909
|
+
at: { type: 'string' },
|
|
910
|
+
state: { type: 'string' },
|
|
911
|
+
code: nullable('string'),
|
|
912
|
+
message: nullable('string'),
|
|
913
|
+
},
|
|
914
|
+
['seq', 'at', 'state', 'code', 'message'],
|
|
915
|
+
),
|
|
916
|
+
JobRunList: object(
|
|
917
|
+
{
|
|
918
|
+
items: { type: 'array', items: ref('JobRun') },
|
|
919
|
+
total: { type: 'integer', minimum: 0 },
|
|
920
|
+
limit: { type: 'integer', minimum: 1, maximum: 200 },
|
|
921
|
+
offset: { type: 'integer', minimum: 0 },
|
|
922
|
+
nextOffset: nullable('integer'),
|
|
923
|
+
},
|
|
924
|
+
['items', 'total', 'limit', 'offset', 'nextOffset'],
|
|
925
|
+
),
|
|
926
|
+
JobRunDetail: object(
|
|
927
|
+
{
|
|
928
|
+
run: ref('JobRun'),
|
|
929
|
+
events: { type: 'array', items: ref('JobRunEvent') },
|
|
930
|
+
child: object(
|
|
931
|
+
{
|
|
932
|
+
pid: nullable('integer'),
|
|
933
|
+
exitCode: nullable('integer'),
|
|
934
|
+
signal: nullable('string'),
|
|
935
|
+
timedOut: { type: 'boolean' },
|
|
936
|
+
},
|
|
937
|
+
['pid', 'exitCode', 'signal', 'timedOut'],
|
|
938
|
+
),
|
|
939
|
+
logs: object(
|
|
940
|
+
{
|
|
941
|
+
stdout: ref('JobLogSummary'),
|
|
942
|
+
stderr: ref('JobLogSummary'),
|
|
943
|
+
},
|
|
944
|
+
['stdout', 'stderr'],
|
|
945
|
+
),
|
|
946
|
+
},
|
|
947
|
+
['run', 'events', 'child', 'logs'],
|
|
948
|
+
),
|
|
949
|
+
JobLogSummary: object(
|
|
950
|
+
{
|
|
951
|
+
bytes: { type: 'integer', minimum: 0 },
|
|
952
|
+
sha256: nullable('string'),
|
|
953
|
+
truncated: { type: 'boolean' },
|
|
954
|
+
},
|
|
955
|
+
['bytes', 'sha256', 'truncated'],
|
|
956
|
+
),
|
|
957
|
+
JobLogChunk: object(
|
|
958
|
+
{
|
|
959
|
+
stream: { type: 'string', enum: ['stdout', 'stderr'] },
|
|
960
|
+
offset: { type: 'integer', minimum: 0 },
|
|
961
|
+
limit: { type: 'integer', minimum: 1, maximum: 262144 },
|
|
962
|
+
totalBytes: { type: 'integer', minimum: 0 },
|
|
963
|
+
truncated: { type: 'boolean' },
|
|
964
|
+
text: { type: 'string' },
|
|
965
|
+
},
|
|
966
|
+
['stream', 'offset', 'limit', 'totalBytes', 'truncated', 'text'],
|
|
967
|
+
),
|
|
968
|
+
JobDeleteResult: object(
|
|
969
|
+
{
|
|
970
|
+
ok: { type: 'boolean' },
|
|
971
|
+
id: { type: 'string', pattern: JOB_ID_PATTERN },
|
|
972
|
+
runsRemoved: { type: 'integer', minimum: 0 },
|
|
973
|
+
},
|
|
974
|
+
['ok', 'id', 'runsRemoved'],
|
|
975
|
+
),
|
|
976
|
+
JobRunRequest: object(
|
|
977
|
+
{
|
|
978
|
+
requested: { type: 'boolean' },
|
|
979
|
+
requestedAt: { type: 'string' },
|
|
980
|
+
schedulerOnline: { type: 'boolean' },
|
|
981
|
+
},
|
|
982
|
+
['requested', 'requestedAt', 'schedulerOnline'],
|
|
983
|
+
),
|
|
693
984
|
};
|
|
694
985
|
|
|
695
986
|
|
|
@@ -938,9 +1229,217 @@ const EXAMPLES = {
|
|
|
938
1229
|
db: { file: 'team.db', present: true, schemaVersion: 1, fingerprintOk: true, search: 'fts5' },
|
|
939
1230
|
tasks: { total: 90, absent: 0 },
|
|
940
1231
|
projectedAt: '2026-11-06T08:00:04.000Z',
|
|
941
|
-
capabilities: ['sync', 'delete'],
|
|
1232
|
+
capabilities: ['sync', 'delete', 'jobs', 'schedule'],
|
|
1233
|
+
scheduler: {
|
|
1234
|
+
state: 'running',
|
|
1235
|
+
pid: 41231,
|
|
1236
|
+
startedAt: '2026-11-06T07:00:00.000Z',
|
|
1237
|
+
heartbeatAt: '2026-11-06T08:00:04.000Z',
|
|
1238
|
+
nextTickAt: '2026-11-06T08:00:05.000Z',
|
|
1239
|
+
jobsDue: 1,
|
|
1240
|
+
},
|
|
1241
|
+
},
|
|
1242
|
+
],
|
|
1243
|
+
JobSchedule: [{ kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' }],
|
|
1244
|
+
JobPayload: [{ kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] }],
|
|
1245
|
+
JobWriteSchedule: [
|
|
1246
|
+
{ kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
|
|
1247
|
+
{ kind: 'interval', everySeconds: 900, timezone: 'Europe/Berlin' },
|
|
1248
|
+
],
|
|
1249
|
+
JobWritePayload: [
|
|
1250
|
+
{ kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
|
|
1251
|
+
{ kind: 'pipeline', promptTemplate: 'scheduler/prompts/retro.md', runner: ['node', 'runner.mjs', '{promptFile}'] },
|
|
1252
|
+
],
|
|
1253
|
+
Job: [
|
|
1254
|
+
{
|
|
1255
|
+
id: 'nightly-retro',
|
|
1256
|
+
title: 'Nightly technical retro',
|
|
1257
|
+
enabled: true,
|
|
1258
|
+
schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
|
|
1259
|
+
payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
|
|
1260
|
+
cwd: '.',
|
|
1261
|
+
envPassthrough: ['CI'],
|
|
1262
|
+
timeoutMs: 900000,
|
|
1263
|
+
concurrency: 'skip',
|
|
1264
|
+
misfire: 'run-once',
|
|
1265
|
+
createdAt: '2026-11-10T09:00:00.000Z',
|
|
1266
|
+
updatedAt: '2026-11-10T09:00:00.000Z',
|
|
1267
|
+
revision: 1,
|
|
1268
|
+
},
|
|
1269
|
+
],
|
|
1270
|
+
JobWrite: [
|
|
1271
|
+
{
|
|
1272
|
+
id: 'nightly-retro',
|
|
1273
|
+
title: 'Nightly technical retro',
|
|
1274
|
+
enabled: true,
|
|
1275
|
+
schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
|
|
1276
|
+
payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
|
|
1277
|
+
cwd: '.',
|
|
1278
|
+
envPassthrough: ['CI'],
|
|
1279
|
+
timeoutMs: 900000,
|
|
1280
|
+
concurrency: 'skip',
|
|
1281
|
+
misfire: 'run-once',
|
|
1282
|
+
revision: 1,
|
|
1283
|
+
},
|
|
1284
|
+
],
|
|
1285
|
+
JobLastRun: [
|
|
1286
|
+
{
|
|
1287
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1288
|
+
state: 'succeeded',
|
|
1289
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1290
|
+
durationMs: 3214,
|
|
1291
|
+
},
|
|
1292
|
+
],
|
|
1293
|
+
JobDetail: [
|
|
1294
|
+
{
|
|
1295
|
+
job: {
|
|
1296
|
+
id: 'nightly-retro',
|
|
1297
|
+
title: 'Nightly technical retro',
|
|
1298
|
+
enabled: true,
|
|
1299
|
+
schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
|
|
1300
|
+
payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
|
|
1301
|
+
cwd: '.',
|
|
1302
|
+
envPassthrough: ['CI'],
|
|
1303
|
+
timeoutMs: 900000,
|
|
1304
|
+
concurrency: 'skip',
|
|
1305
|
+
misfire: 'run-once',
|
|
1306
|
+
createdAt: '2026-11-10T09:00:00.000Z',
|
|
1307
|
+
updatedAt: '2026-11-10T09:00:00.000Z',
|
|
1308
|
+
revision: 1,
|
|
1309
|
+
},
|
|
1310
|
+
nextFireAt: '2026-11-11T02:00:00.000Z',
|
|
1311
|
+
lastRun: {
|
|
1312
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1313
|
+
state: 'succeeded',
|
|
1314
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1315
|
+
durationMs: 3214,
|
|
1316
|
+
},
|
|
1317
|
+
},
|
|
1318
|
+
],
|
|
1319
|
+
JobList: [
|
|
1320
|
+
{
|
|
1321
|
+
items: [
|
|
1322
|
+
{
|
|
1323
|
+
job: {
|
|
1324
|
+
id: 'nightly-retro',
|
|
1325
|
+
title: 'Nightly technical retro',
|
|
1326
|
+
enabled: true,
|
|
1327
|
+
schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
|
|
1328
|
+
payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
|
|
1329
|
+
cwd: '.',
|
|
1330
|
+
envPassthrough: ['CI'],
|
|
1331
|
+
timeoutMs: 900000,
|
|
1332
|
+
concurrency: 'skip',
|
|
1333
|
+
misfire: 'run-once',
|
|
1334
|
+
createdAt: '2026-11-10T09:00:00.000Z',
|
|
1335
|
+
updatedAt: '2026-11-10T09:00:00.000Z',
|
|
1336
|
+
revision: 1,
|
|
1337
|
+
},
|
|
1338
|
+
nextFireAt: '2026-11-11T02:00:00.000Z',
|
|
1339
|
+
lastRun: {
|
|
1340
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1341
|
+
state: 'succeeded',
|
|
1342
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1343
|
+
durationMs: 3214,
|
|
1344
|
+
},
|
|
1345
|
+
},
|
|
1346
|
+
],
|
|
1347
|
+
total: 1,
|
|
1348
|
+
limit: 50,
|
|
1349
|
+
offset: 0,
|
|
1350
|
+
nextOffset: null,
|
|
942
1351
|
},
|
|
943
1352
|
],
|
|
1353
|
+
JobRun: [
|
|
1354
|
+
{
|
|
1355
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1356
|
+
jobId: 'nightly-retro',
|
|
1357
|
+
trigger: 'schedule',
|
|
1358
|
+
state: 'succeeded',
|
|
1359
|
+
reasonCode: null,
|
|
1360
|
+
exitCode: 0,
|
|
1361
|
+
signal: null,
|
|
1362
|
+
pid: 41299,
|
|
1363
|
+
startedAt: '2026-11-10T10:15:00.000Z',
|
|
1364
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1365
|
+
durationMs: 3214,
|
|
1366
|
+
stdoutBytes: 812,
|
|
1367
|
+
stderrBytes: 0,
|
|
1368
|
+
stdoutTruncated: false,
|
|
1369
|
+
stderrTruncated: false,
|
|
1370
|
+
parseError: null,
|
|
1371
|
+
},
|
|
1372
|
+
],
|
|
1373
|
+
JobRunEvent: [{ seq: 1, at: '2026-11-10T10:15:00.000Z', state: 'claimed', code: null, message: 'claim' }],
|
|
1374
|
+
JobRunList: [
|
|
1375
|
+
{
|
|
1376
|
+
items: [
|
|
1377
|
+
{
|
|
1378
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1379
|
+
jobId: 'nightly-retro',
|
|
1380
|
+
trigger: 'schedule',
|
|
1381
|
+
state: 'succeeded',
|
|
1382
|
+
reasonCode: null,
|
|
1383
|
+
exitCode: 0,
|
|
1384
|
+
signal: null,
|
|
1385
|
+
pid: 41299,
|
|
1386
|
+
startedAt: '2026-11-10T10:15:00.000Z',
|
|
1387
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1388
|
+
durationMs: 3214,
|
|
1389
|
+
stdoutBytes: 812,
|
|
1390
|
+
stderrBytes: 0,
|
|
1391
|
+
stdoutTruncated: false,
|
|
1392
|
+
stderrTruncated: false,
|
|
1393
|
+
parseError: null,
|
|
1394
|
+
},
|
|
1395
|
+
],
|
|
1396
|
+
total: 1,
|
|
1397
|
+
limit: 50,
|
|
1398
|
+
offset: 0,
|
|
1399
|
+
nextOffset: null,
|
|
1400
|
+
},
|
|
1401
|
+
],
|
|
1402
|
+
JobRunDetail: [
|
|
1403
|
+
{
|
|
1404
|
+
run: {
|
|
1405
|
+
runId: '20261110T101500Z-1a2b3c4d',
|
|
1406
|
+
jobId: 'nightly-retro',
|
|
1407
|
+
trigger: 'schedule',
|
|
1408
|
+
state: 'succeeded',
|
|
1409
|
+
reasonCode: null,
|
|
1410
|
+
exitCode: 0,
|
|
1411
|
+
signal: null,
|
|
1412
|
+
pid: 41299,
|
|
1413
|
+
startedAt: '2026-11-10T10:15:00.000Z',
|
|
1414
|
+
finishedAt: '2026-11-10T10:15:03.214Z',
|
|
1415
|
+
durationMs: 3214,
|
|
1416
|
+
stdoutBytes: 812,
|
|
1417
|
+
stderrBytes: 0,
|
|
1418
|
+
stdoutTruncated: false,
|
|
1419
|
+
stderrTruncated: false,
|
|
1420
|
+
parseError: null,
|
|
1421
|
+
},
|
|
1422
|
+
events: [{ seq: 1, at: '2026-11-10T10:15:00.000Z', state: 'claimed', code: null, message: 'claim' }],
|
|
1423
|
+
child: { pid: 41299, exitCode: 0, signal: null, timedOut: false },
|
|
1424
|
+
logs: {
|
|
1425
|
+
stdout: { bytes: 812, sha256: '5f2a8d2298ea52f104580a1d7bb95d396497f12994fdf8f5f246abbe74aecda9', truncated: false },
|
|
1426
|
+
stderr: { bytes: 0, sha256: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', truncated: false },
|
|
1427
|
+
},
|
|
1428
|
+
},
|
|
1429
|
+
],
|
|
1430
|
+
JobLogSummary: [{ bytes: 812, sha256: '5f2a8d2298ea52f104580a1d7bb95d396497f12994fdf8f5f246abbe74aecda9', truncated: false }],
|
|
1431
|
+
JobLogChunk: [
|
|
1432
|
+
{
|
|
1433
|
+
stream: 'stdout',
|
|
1434
|
+
offset: 0,
|
|
1435
|
+
limit: 65536,
|
|
1436
|
+
totalBytes: 812,
|
|
1437
|
+
truncated: false,
|
|
1438
|
+
text: 'retro: 3 tasks inspected\n',
|
|
1439
|
+
},
|
|
1440
|
+
],
|
|
1441
|
+
JobDeleteResult: [{ ok: true, id: 'nightly-retro', runsRemoved: 12 }],
|
|
1442
|
+
JobRunRequest: [{ requested: true, requestedAt: '2026-11-10T12:00:00.000Z', schedulerOnline: true }],
|
|
944
1443
|
Meta: [
|
|
945
1444
|
{
|
|
946
1445
|
apiVersion: API_VERSION,
|
|
@@ -1005,15 +1504,103 @@ for (const [name, examples] of Object.entries(EXAMPLES)) {
|
|
|
1005
1504
|
|
|
1006
1505
|
const taskIdParameters = [slugParameter];
|
|
1007
1506
|
|
|
1507
|
+
const jobIdParameter = {
|
|
1508
|
+
name: 'id',
|
|
1509
|
+
in: 'path',
|
|
1510
|
+
required: true,
|
|
1511
|
+
description: 'Job id: the key of one entry in `scheduler/jobs.json`.',
|
|
1512
|
+
schema: { type: 'string', pattern: JOB_ID_PATTERN },
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
const runIdParameter = {
|
|
1516
|
+
name: 'runId',
|
|
1517
|
+
in: 'path',
|
|
1518
|
+
required: true,
|
|
1519
|
+
description: 'Run id: `YYYYMMDDTHHMMSSZ-<8 hex>`, lexicographically sortable.',
|
|
1520
|
+
schema: { type: 'string', pattern: RUN_ID_PATTERN },
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
const JOB_LIST_PARAMETERS = [
|
|
1524
|
+
...paginationParameters,
|
|
1525
|
+
{
|
|
1526
|
+
name: 'enabled',
|
|
1527
|
+
in: 'query',
|
|
1528
|
+
description: 'Restrict to enabled or disabled jobs.',
|
|
1529
|
+
required: false,
|
|
1530
|
+
schema: { type: 'boolean' },
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
name: 'sort',
|
|
1534
|
+
in: 'query',
|
|
1535
|
+
description:
|
|
1536
|
+
'Sort key. `nextFireAt` is computed in the API from the definition and `now`, so it is exact; the SQL stays an ordered read by id. There is deliberately no `q` parameter (F-1): the dashboard filters the page it has loaded.',
|
|
1537
|
+
required: false,
|
|
1538
|
+
schema: { type: 'string', enum: ['id', '-id', 'updatedAt', '-updatedAt', 'nextFireAt', '-nextFireAt'], default: 'id' },
|
|
1539
|
+
},
|
|
1540
|
+
];
|
|
1541
|
+
|
|
1542
|
+
const jobRunStateParameter = {
|
|
1543
|
+
name: 'state',
|
|
1544
|
+
in: 'query',
|
|
1545
|
+
description: csvParameterDescription('run states (any subset)', [
|
|
1546
|
+
'claimed',
|
|
1547
|
+
'running',
|
|
1548
|
+
'succeeded',
|
|
1549
|
+
'failed',
|
|
1550
|
+
'timeout',
|
|
1551
|
+
'skipped',
|
|
1552
|
+
'interrupted',
|
|
1553
|
+
]),
|
|
1554
|
+
required: false,
|
|
1555
|
+
schema: { type: 'string' },
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
const jobLogStreamParameter = {
|
|
1559
|
+
name: 'stream',
|
|
1560
|
+
in: 'query',
|
|
1561
|
+
description: 'Which captured stream to read. Streams are never interleaved.',
|
|
1562
|
+
required: false,
|
|
1563
|
+
schema: { type: 'string', enum: ['stdout', 'stderr'], default: 'stdout' },
|
|
1564
|
+
};
|
|
1565
|
+
|
|
1566
|
+
const jobLogOffsetParameter = {
|
|
1567
|
+
name: 'offset',
|
|
1568
|
+
in: 'query',
|
|
1569
|
+
description: 'Byte offset already rendered by the client.',
|
|
1570
|
+
required: false,
|
|
1571
|
+
schema: { type: 'integer', minimum: 0, maximum: 1048576, default: 0 },
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
const jobLogLimitParameter = {
|
|
1575
|
+
name: 'limit',
|
|
1576
|
+
in: 'query',
|
|
1577
|
+
description: 'Maximum bytes to return, 1..262144.',
|
|
1578
|
+
required: false,
|
|
1579
|
+
schema: { type: 'integer', minimum: 1, maximum: 262144, default: 65536 },
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1582
|
+
const jobWriteBody = {
|
|
1583
|
+
required: true,
|
|
1584
|
+
description: 'One job definition as `application/json`, at most 64 KiB.',
|
|
1585
|
+
content: { 'application/json': { schema: ref('JobWrite') } },
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
const emptyBody = {
|
|
1589
|
+
required: false,
|
|
1590
|
+
description: 'Absent or an empty JSON object; any other body is rejected.',
|
|
1591
|
+
content: { 'application/json': { schema: object({}, []) } },
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1008
1594
|
const operation = (definition) => ({
|
|
1009
1595
|
...definition,
|
|
1010
1596
|
security: [],
|
|
1011
1597
|
});
|
|
1012
1598
|
|
|
1013
|
-
const listOperation = (tags, summary, operationId, responseRef, parameters, extraResponses = {}) =>
|
|
1599
|
+
const listOperation = (tags, summary, operationId, responseRef, parameters, extraResponses = {}, description) =>
|
|
1014
1600
|
operation({
|
|
1015
1601
|
tags,
|
|
1016
1602
|
summary,
|
|
1603
|
+
...(description ? { description } : {}),
|
|
1017
1604
|
operationId,
|
|
1018
1605
|
parameters,
|
|
1019
1606
|
responses: {
|
|
@@ -1023,6 +1610,23 @@ const listOperation = (tags, summary, operationId, responseRef, parameters, extr
|
|
|
1023
1610
|
},
|
|
1024
1611
|
});
|
|
1025
1612
|
|
|
1613
|
+
const jobScopedOperation = (operationId, responseRef, parameters = [jobIdParameter]) =>
|
|
1614
|
+
operation({
|
|
1615
|
+
tags: ['jobs'],
|
|
1616
|
+
summary: 'One job definition with its next fire and its last run',
|
|
1617
|
+
operationId,
|
|
1618
|
+
parameters,
|
|
1619
|
+
responses: {
|
|
1620
|
+
200: jsonResponse(responseRef, 'The job-scoped payload'),
|
|
1621
|
+
400: commonErrorResponses[400],
|
|
1622
|
+
403: commonErrorResponses[403],
|
|
1623
|
+
404: commonErrorResponses[404],
|
|
1624
|
+
405: commonErrorResponses[405],
|
|
1625
|
+
422: errorResponse('The job id is outside its documented shape'),
|
|
1626
|
+
503: commonErrorResponses[503],
|
|
1627
|
+
},
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1026
1630
|
const taskScopedOperation = (tags, summary, operationId, responseRef, parameters = taskIdParameters) =>
|
|
1027
1631
|
operation({
|
|
1028
1632
|
tags,
|
|
@@ -1120,7 +1724,7 @@ export const OPENAPI_DOCUMENT = {
|
|
|
1120
1724
|
info: {
|
|
1121
1725
|
title: 'Agent team SQLite projection API',
|
|
1122
1726
|
summary:
|
|
1123
|
-
'Projection of `.ai.local/team`. Task files are authoritative; the database is a rebuildable copy.
|
|
1727
|
+
'Projection of `.ai.local/team`. Task files, job definitions and run manifests are authoritative; the database is a rebuildable copy. Six mutations exist — the idempotent rescan, the confirmed task delete, and the four job writes — and every one runs as a bounded child process.',
|
|
1124
1728
|
description:
|
|
1125
1729
|
'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`; any other method on `/api/v1/tasks/{slug}` returns 405 with `Allow: GET, HEAD, DELETE`.',
|
|
1126
1730
|
version: API_VERSION,
|
|
@@ -1142,6 +1746,7 @@ export const OPENAPI_DOCUMENT = {
|
|
|
1142
1746
|
{ name: 'documents', description: 'Raw documents by exact path' },
|
|
1143
1747
|
{ name: 'stats', description: 'Aggregate counts and durations' },
|
|
1144
1748
|
{ name: 'sync', description: 'Projection runs and the one idempotent rescan' },
|
|
1749
|
+
{ name: 'jobs', description: 'Scheduled jobs, their runs and their logs' },
|
|
1145
1750
|
],
|
|
1146
1751
|
paths: {
|
|
1147
1752
|
'/': {
|
|
@@ -1296,6 +1901,156 @@ export const OPENAPI_DOCUMENT = {
|
|
|
1296
1901
|
[slugParameter, { name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } }],
|
|
1297
1902
|
),
|
|
1298
1903
|
},
|
|
1904
|
+
'/api/v1/jobs': {
|
|
1905
|
+
get: listOperation(
|
|
1906
|
+
['jobs'],
|
|
1907
|
+
'List job definitions with the next fire and the last run',
|
|
1908
|
+
'listJobs',
|
|
1909
|
+
'JobList',
|
|
1910
|
+
JOB_LIST_PARAMETERS,
|
|
1911
|
+
{},
|
|
1912
|
+
'Reads at most `MAX_JOBS = 100` definitions: `total`, `nextOffset` and `sort=nextFireAt` are exact only below that cap, so `total` is never an unbounded count.',
|
|
1913
|
+
),
|
|
1914
|
+
post: operation({
|
|
1915
|
+
tags: ['jobs'],
|
|
1916
|
+
summary: 'Create one job definition',
|
|
1917
|
+
description:
|
|
1918
|
+
'The body is the file-authoritative definition (`scheduler/jobs.json`); the server never writes it directly. `createdAt` and `updatedAt` are set by the writing child. `revision` is optional and defaults to 1; a non-integer or null `revision` is 422 `E_VALIDATION`, and an integer other than 1 is 409 `E_CONFLICT` because the job does not exist yet. An invalid field is 422 `E_VALIDATION` with `details.parameter` naming it, and the file is left byte-identical; a non-JSON media type is the same 422. Executed as a bounded child (10 s, `SIGKILL`); `AI_RULES_TEAM_DB_DISABLE=1` answers 503 `E_DISABLED` before the child.',
|
|
1919
|
+
operationId: 'createJob',
|
|
1920
|
+
parameters: [],
|
|
1921
|
+
requestBody: jobWriteBody,
|
|
1922
|
+
responses: {
|
|
1923
|
+
200: jsonResponse('JobDetail', 'The stored definition at its new revision'),
|
|
1924
|
+
400: errorResponse('Malformed request'),
|
|
1925
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
1926
|
+
405: methodNotAllowedResponse,
|
|
1927
|
+
409: errorResponse('The body names an existing job, or carries a revision other than 1; use `PUT /api/v1/jobs/{id}`'),
|
|
1928
|
+
413: errorResponse('The body exceeds the 64 KiB JSON bound'),
|
|
1929
|
+
422: errorResponse('A field is outside its documented bound or the media type is not JSON; `details.parameter` names it'),
|
|
1930
|
+
503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
|
|
1931
|
+
},
|
|
1932
|
+
}),
|
|
1933
|
+
},
|
|
1934
|
+
'/api/v1/jobs/{id}': {
|
|
1935
|
+
get: jobScopedOperation('getJob', 'JobDetail', [jobIdParameter]),
|
|
1936
|
+
put: operation({
|
|
1937
|
+
tags: ['jobs'],
|
|
1938
|
+
summary: 'Update one job definition (enable and disable included)',
|
|
1939
|
+
description:
|
|
1940
|
+
'Optimistic concurrency: `revision` is required and must equal the stored revision; a missing or stale `revision` is 409 `E_CONFLICT` and the file is untouched. The body `id` must equal the path id. Enable and disable are this same call with `enabled` flipped, so the mutating surface stays four paths. Executed as a bounded child (10 s, `SIGKILL`) behind the `E_DISABLED` guard.',
|
|
1941
|
+
operationId: 'updateJob',
|
|
1942
|
+
parameters: [jobIdParameter],
|
|
1943
|
+
requestBody: jobWriteBody,
|
|
1944
|
+
responses: {
|
|
1945
|
+
200: jsonResponse('JobDetail', 'The stored definition at its incremented revision'),
|
|
1946
|
+
400: errorResponse('Malformed request: an invalid job id'),
|
|
1947
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
1948
|
+
404: errorResponse('The job does not exist'),
|
|
1949
|
+
405: methodNotAllowedResponse,
|
|
1950
|
+
409: errorResponse('A missing or stale `revision`, or a body id that differs from the path id'),
|
|
1951
|
+
413: errorResponse('The body exceeds the 64 KiB JSON bound'),
|
|
1952
|
+
422: errorResponse('A field is outside its documented bound or the media type is not JSON; `details.parameter` names it'),
|
|
1953
|
+
503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
|
|
1954
|
+
},
|
|
1955
|
+
}),
|
|
1956
|
+
delete: operation({
|
|
1957
|
+
tags: ['jobs'],
|
|
1958
|
+
summary: 'Delete one job, its run directories and its rows',
|
|
1959
|
+
description:
|
|
1960
|
+
'Confirmed, destructive and irreversible. The definition leaves `scheduler/jobs.json` before the run directories and the rows, so a crash between the legs converges toward deleted and never resurrects a job. Executed as a bounded child (30 s, `SIGKILL`); the request body is ignored.',
|
|
1961
|
+
operationId: 'deleteJob',
|
|
1962
|
+
parameters: [jobIdParameter],
|
|
1963
|
+
responses: {
|
|
1964
|
+
200: jsonResponse('JobDeleteResult', 'The deleted id and the number of removed run directories'),
|
|
1965
|
+
400: errorResponse('Malformed request: an invalid job id'),
|
|
1966
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
1967
|
+
404: errorResponse('The job does not exist'),
|
|
1968
|
+
405: methodNotAllowedResponse,
|
|
1969
|
+
413: errorResponse('The body exceeds the declared bound'),
|
|
1970
|
+
422: errorResponse('A parameter is outside its documented bound'),
|
|
1971
|
+
503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
|
|
1972
|
+
},
|
|
1973
|
+
}),
|
|
1974
|
+
},
|
|
1975
|
+
'/api/v1/jobs/{id}/runs': {
|
|
1976
|
+
get: operation({
|
|
1977
|
+
tags: ['jobs'],
|
|
1978
|
+
summary: 'Run history of one job, newest first',
|
|
1979
|
+
description:
|
|
1980
|
+
'`total` is the full count for the job, so a delete confirmation can name the run count without a second call (F-2).',
|
|
1981
|
+
operationId: 'listJobRuns',
|
|
1982
|
+
parameters: [jobIdParameter, ...paginationParameters, jobRunStateParameter],
|
|
1983
|
+
responses: {
|
|
1984
|
+
200: jsonResponse('JobRunList', 'The filtered page of runs'),
|
|
1985
|
+
400: errorResponse('Malformed request: an invalid job id'),
|
|
1986
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
1987
|
+
404: errorResponse('The job does not exist'),
|
|
1988
|
+
405: methodNotAllowedResponse,
|
|
1989
|
+
422: errorResponse('A query parameter is outside its documented bounds'),
|
|
1990
|
+
503: errorResponse('The database is missing, unusable or busy'),
|
|
1991
|
+
},
|
|
1992
|
+
}),
|
|
1993
|
+
},
|
|
1994
|
+
'/api/v1/jobs/{id}/runs/{runId}': {
|
|
1995
|
+
get: operation({
|
|
1996
|
+
tags: ['jobs'],
|
|
1997
|
+
summary: 'One run with its events, exit status and log summaries',
|
|
1998
|
+
operationId: 'getJobRun',
|
|
1999
|
+
parameters: [jobIdParameter, runIdParameter],
|
|
2000
|
+
responses: {
|
|
2001
|
+
200: jsonResponse('JobRunDetail', 'The run manifest as projected'),
|
|
2002
|
+
400: errorResponse('Malformed request: an invalid job or run id'),
|
|
2003
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
2004
|
+
404: errorResponse('The job or the run does not exist'),
|
|
2005
|
+
405: methodNotAllowedResponse,
|
|
2006
|
+
422: errorResponse('The job or run id is outside its documented shape'),
|
|
2007
|
+
503: errorResponse('The database is missing, unusable or busy'),
|
|
2008
|
+
},
|
|
2009
|
+
}),
|
|
2010
|
+
},
|
|
2011
|
+
'/api/v1/jobs/{id}/runs/{runId}/log': {
|
|
2012
|
+
get: operation({
|
|
2013
|
+
tags: ['jobs'],
|
|
2014
|
+
summary: 'One bounded chunk of a run log',
|
|
2015
|
+
description:
|
|
2016
|
+
'Byte-offset polling, not SSE: `offset` counts bytes already rendered and `limit` is clamped to 262144. The server reads at most `limit + 3` bytes and never loads the file. A path that resolves outside `scheduler/runs`, or a log file recorded in the manifest but missing on disk, answers 500 `E_INTERNAL`; an offset past `totalBytes` answers 416 `E_RANGE`.',
|
|
2017
|
+
operationId: 'getJobRunLog',
|
|
2018
|
+
parameters: [jobIdParameter, runIdParameter, jobLogStreamParameter, jobLogOffsetParameter, jobLogLimitParameter],
|
|
2019
|
+
responses: {
|
|
2020
|
+
200: jsonResponse('JobLogChunk', 'The requested chunk of one stream'),
|
|
2021
|
+
400: errorResponse('Malformed request: an invalid job or run id'),
|
|
2022
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
2023
|
+
404: errorResponse('The job or the run does not exist; a missing log file answers 500 `E_INTERNAL`'),
|
|
2024
|
+
405: methodNotAllowedResponse,
|
|
2025
|
+
416: errorResponse('The offset is past the end of the log'),
|
|
2026
|
+
422: errorResponse('A query parameter is outside its documented bounds'),
|
|
2027
|
+
500: errorResponse('A log file recorded in the manifest is missing on disk'),
|
|
2028
|
+
503: errorResponse('The database is missing, unusable or busy'),
|
|
2029
|
+
},
|
|
2030
|
+
}),
|
|
2031
|
+
},
|
|
2032
|
+
'/api/v1/jobs/{id}/run': {
|
|
2033
|
+
post: operation({
|
|
2034
|
+
tags: ['jobs'],
|
|
2035
|
+
summary: 'Ask the running scheduler to claim one job now',
|
|
2036
|
+
description:
|
|
2037
|
+
'Answered with 409 `E_SCHEDULER_OFFLINE` **before any enqueue** when no fresh lease exists, with `details.hint` naming `team-db.mjs schedule`; the request is written to `scheduler/state.json` and claimed on the scheduler\'s next tick. Executed as a bounded child (10 s, `SIGKILL`) behind the `E_DISABLED` guard.',
|
|
2038
|
+
operationId: 'runJobNow',
|
|
2039
|
+
parameters: [jobIdParameter],
|
|
2040
|
+
requestBody: emptyBody,
|
|
2041
|
+
responses: {
|
|
2042
|
+
200: jsonResponse('JobRunRequest', 'The request was accepted by a live scheduler'),
|
|
2043
|
+
400: errorResponse('Malformed request: an invalid job id'),
|
|
2044
|
+
403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
|
|
2045
|
+
404: errorResponse('The job does not exist'),
|
|
2046
|
+
405: methodNotAllowedResponse,
|
|
2047
|
+
409: errorResponse('No fresh scheduler lease; `details.hint` names the command to start'),
|
|
2048
|
+
413: errorResponse('The body exceeds the declared bound'),
|
|
2049
|
+
422: errorResponse('A parameter is outside its documented bound'),
|
|
2050
|
+
503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
|
|
2051
|
+
},
|
|
2052
|
+
}),
|
|
2053
|
+
},
|
|
1299
2054
|
'/api/v1/stats': {
|
|
1300
2055
|
get: listOperation(['stats'], 'Aggregate counts and durations', 'getStats', 'Stats', [
|
|
1301
2056
|
{ name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } },
|