Skip to content

API: which models a team's people may run - #2084

Merged
davidmckayv merged 9 commits into
mainfrom
david/team-models-spec
Nov 24, 2026
Merged

davidmckayv merged 9 commits into
mainfrom
david/team-models-spec

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

An admin sets, per team, which models its people may run. The spec and the regenerated client: additive only.

What it adds

  • getTeamModels, replaceTeamModels, deleteTeamModels at /api/v2/organizations/{organizationId}/teams/{teamId}/models (tag Teams).
    • GET: any member of the organization. TeamModels is { models, updatedBy, updatedAt }, each null when the team sets none.
    • PUT: owner or admin only (403 PERMISSION_DENIED, "Only an admin of this organization can change a team's models."). Body TeamModelsInput { models }: 1 to 200, unique, each one the organization's catalogue offers (getModelCatalogue with view=all), or 400 VALIDATION_ERROR naming it. Idempotency-Key like every write. 404 TEAM_NOT_FOUND.
    • DELETE: owner or admin only. 204; clearing a team that sets none changes nothing.
  • Models are named as the organization's model allowlist names them: provider/model (the catalogue's provider and a model's id).
  • The rule, stated on getTeamModels: a person in teams with lists (their teams' parents included) runs only a model one of those lists names, within what the organization allows; a team with no list sets nothing; admins and owners are held to it too.
  • getModelCatalogue's description says it is narrowed for the caller by their teams' lists as well as the organization's allowlist.
  • team.models_changed on the organization's trail (before and after), with its words in shared/audit-words.ts.
  • Regenerated client; a CHANGELOG line under Unreleased, API.

Tests

  • bun run api:lint clean; bun test api/ shared/tests/api-deprecations.test.ts (89 pass); app/tests/audit-event-words.test.tsx and app/tests/tolerant-reader.test.ts pass; app typecheck, biome lint and format clean.

getTeamModels, replaceTeamModels and deleteTeamModels under teams/{teamId}/models. Any member reads a team's list; only an owner or an admin sets or clears it. A person runs only a model one of their teams' lists names (parents included), within what the organization allows; a team with no list sets nothing. getModelCatalogue's description says it is narrowed by the caller's teams too, and team.models_changed joins the trail.
listRefusedTurns lists the caller's turns refused before they ran (a model they may not run, a permission they lack, no plan): the message each was for, where it came in the thread, and the refusal's code and words. Nothing of a refused turn reaches the thread, so a reopened conversation lost both the person's message and the refusal.
@davidmckayv
davidmckayv merged commit ab7e3bb into main Nov 24, 2026
34 checks passed
@davidmckayv
davidmckayv deleted the david/team-models-spec branch November 24, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant