Skip to content

feat: add introspect.states command#1528

Draft
raman325 wants to merge 2 commits intomasterfrom
feat/introspect-states
Draft

feat: add introspect.states command#1528
raman325 wants to merge 2 commits intomasterfrom
feat/introspect-states

Conversation

@raman325
Copy link
Collaborator

@raman325 raman325 commented Mar 4, 2026

Summary

  • Add introspect.states command that returns JSON Schema for all versioned state dump types (driver, controller, endpoint, node)
  • Add state_schemas.ts with StateSchemas interface organizing all state types by category and schema version
  • Add generate:state-schema npm script using ts-json-schema-generator with --additional-properties flag (required for types containing ReadonlyMap via DeviceConfig)
  • Uses JSON-serializable replacements for controller schemas 34+ where ReadonlyMap<number, RebuildRoutesStatus> is replaced with Record<string, RebuildRoutesStatus>

Blocked by #1525

Test plan

  • npm test passes (prettier, tsc, eslint, integration tests)
  • npm run generate:schema generates both incoming_message_schema.json and state_schema.json
  • Generated state schema contains all 4 categories with correct version numbers
  • Verify introspect.states returns the full state schema when called

🤖 Generated with Claude Code

raman325 and others added 2 commits March 3, 2026 20:15
Add a new `introspect` command module that returns the JSON Schema
describing all incoming message types. The `introspect.commands`
command works before `initialize`, enabling API discovery
pre-negotiation.

- Create `src/lib/introspect/` module (command, incoming_message,
  outgoing_message, message_handler) following existing patterns
- Register in Instance enum and wire into server.ts
- Add `ts-json-schema-generator` for build-time schema generation
- Rename interfaces for `$ref` reuse (node, driver, controller,
  multicast_group incoming messages)
- Add introspection section to README with tool recommendations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a new `introspect.states` command that returns JSON Schema for the
state dump types used in the `start_listening` response. The schema is
organized by category (driver, controller, endpoint, node) and schema
version number.

- Add `state_schemas.ts` with `StateSchemas` interface mapping all
  versioned state types for JSON Schema generation
- Use JSON-serializable replacements for controller schemas 34+ to
  avoid `ReadonlyMap` (not representable in JSON Schema)
- Add `generate:state-schema` npm script chained into `generate:schema`
- Wire `introspect.states` into command enum, incoming/outgoing message
  types, and message handler

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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