feat: auto-regenerate flows.schema.json type enum on agent type changes #1227

Closed
opened 2026-05-16 21:08:43 +00:00 by claude-desktop · 0 comments
Collaborator

As an operator, I want editor autocompletion for resolve_agent type: in flow YAML so the valid values always reflect the types registered in the DB.

Background

flows.schema.json is static. resolve_agent type: accepts any string — typos surface only at dispatch time. Fix: generate the enum from DB and regenerate on every agent type change.

Acceptance criteria

Schema generator

  • generateFlowsSchema() function reads agent type names from DB, injects them as an enum on resolve_agent args type field in flows.schema.json
  • If no types registered, type falls back to plain string (valid on blank install)
  • Generator overwrites the schema file synchronously

Auto-trigger

  • Agent type created → schema regenerated
  • Agent type renamed → schema regenerated
  • Agent type deleted → schema regenerated
  • Runs synchronously within the API request

Runtime validation

  • resolve_agent op validates args.type against live DB at execution time
  • Unknown type: clear error resolve_agent: unknown agent type "foo" — registered: [...]

Tests

  • Generator unit test: N type names → correct enum in schema output
  • API integration test: create type → schema file updated

Out of scope

  • LSP / language-server integration
  • Rename/delete YAML ref patching (next issue)

References

  • flows.schema.json — current static schema
  • resolve_agent op args — type field currently plain string
  • config-agent-types.ts — CRUD handlers where trigger hooks
As an operator, I want editor autocompletion for `resolve_agent type:` in flow YAML so the valid values always reflect the types registered in the DB. ## Background `flows.schema.json` is static. `resolve_agent type:` accepts any string — typos surface only at dispatch time. Fix: generate the enum from DB and regenerate on every agent type change. ## Acceptance criteria ### Schema generator - [ ] `generateFlowsSchema()` function reads agent type names from DB, injects them as an `enum` on `resolve_agent` args `type` field in `flows.schema.json` - [ ] If no types registered, `type` falls back to plain `string` (valid on blank install) - [ ] Generator overwrites the schema file synchronously ### Auto-trigger - [ ] Agent type created → schema regenerated - [ ] Agent type renamed → schema regenerated - [ ] Agent type deleted → schema regenerated - [ ] Runs synchronously within the API request ### Runtime validation - [ ] `resolve_agent` op validates `args.type` against live DB at execution time - [ ] Unknown type: clear error `resolve_agent: unknown agent type "foo" — registered: [...]` ### Tests - [ ] Generator unit test: N type names → correct enum in schema output - [ ] API integration test: create type → schema file updated ## Out of scope - LSP / language-server integration - Rename/delete YAML ref patching (next issue) ## References - `flows.schema.json` — current static schema - `resolve_agent` op args — `type` field currently plain `string` - `config-agent-types.ts` — CRUD handlers where trigger hooks
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/agent-hooks#1227
No description provided.