Removes the Tasks API and task orchestration from coderd and codersdk: the `/api/v2/tasks` handlers, task middleware and search filters, task name generation, autobuild pause/resume logic, task notification enqueues, telemetry, and the codersdk task types. Regenerates apidoc, the API reference docs, and `typesGenerated.ts`. **Breaking change:** the Tasks API is removed; requests to `/api/v2/tasks` fail. Tasks was deprecated in v2.34. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications → #29085 build reasons → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and its own migration number. **Why:** with the UI (#28743) and CLI (#28788) gone, this deletes the server surface. Database tables, RBAC, and notification templates stay until the top of the stack so every layer builds and migrates independently. **What to scrutinize:** - The `enable-ai-tasks` option is removed outright (review feedback): configs still carrying `enableAITasks` fail to parse until the key is deleted. - provisionerdserver now writes `HasAITask: false` on template/build flags; the column and these lines are dropped in #29085. - `codersdk.ResourceTypeTask` stays so audit logs recorded before the removal keep rendering. **Validation:** `go build ./...`, `go vet ./...`, `go test ./codersdk/...`, site biome and tsc, CLI goldens regenerated, pre-commit hooks. **Size:** +242/-10,792 over 76 files; additions are regenerated docs/goldens and test fixture updates. > Created by Xum (AI agent) on behalf of @ibetitsmike.
34 lines
956 B
Go
34 lines
956 B
Go
// Package aiseats is the AGPL version the package.
|
|
// The actual implementation is in `enterprise/aiseats`.
|
|
package aiseats
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/coder/coder/v2/coderd/database"
|
|
)
|
|
|
|
type Reason struct {
|
|
EventType database.AISeatUsageReason
|
|
Description string
|
|
}
|
|
|
|
// ReasonAIBridge constructs a reason for usage originating from AI Bridge.
|
|
func ReasonAIBridge(description string) Reason {
|
|
return Reason{EventType: database.AISeatUsageReasonAibridge, Description: description}
|
|
}
|
|
|
|
// SeatTracker records AI seat consumption state.
|
|
type SeatTracker interface {
|
|
// RecordUsage does not return an error to prevent blocking the user from using
|
|
// AI features. This method is used to record usage, not enforce it.
|
|
RecordUsage(ctx context.Context, userID uuid.UUID, reason Reason)
|
|
}
|
|
|
|
// Noop is an AGPL seat tracker that does nothing.
|
|
type Noop struct{}
|
|
|
|
func (Noop) RecordUsage(context.Context, uuid.UUID, Reason) {}
|