Command Graph Schema Registry
Updated: 2026-06-03 Status: Trigger/action schema registry implemented
CaseSolo now has a Zod-backed Command Graph schema registry at src/lib/command-graph/. The registry defines validation previews for trigger payloads and action inputs before the execution engine, workflow adapter, webhook wizard, and approval queue are built.
Covered Domains
The registry covers every task-0600 domain:
| Domain | Trigger examples | Action examples | |---|---|---| | Case | case.created, case.status_changed | case.create, case.update_status | | Task | task.created, task.completed | task.create, task.complete | | Document | document.upload_completed, document.shared | document.request_upload, document.share | | Calendar | calendar.event_created, deadline.created | calendar.create_event, calendar.create_deadline | | Communication | message.sent, sms.received | communication.send_email, communication.send_sms | | Billing | invoice.created, payment.received | billing.create_invoice, billing.record_payment | | Portal | portal.message_received, portal.document_uploaded | portal.send_message, portal.request_upload | | AI | ai.output_ready, ai.approval_requested | ai.request_analysis, ai.apply_approved_output | | Integration | integration.sync_failed, webhook.delivery_failed | integration.replay_failed_action, integration.invoke_workflow | | Court | court.filing_accepted, court.filing_rejected | court.validate_rules, court.file_document | | Medical | medical.record_received, medical.treatment_gap_detected | medical.request_records, medical.create_chronology | | Finance | settlement.offer_received, trust_transaction.created | finance.create_settlement_scenario, finance.record_trust_transaction |
What Each Schema Defines
Each trigger and action definition includes:
- Domain, key, version, label, and description.
- Zod schema for validation previews.
- Sample payload or input.
- Required permissions.
- Risk and approval requirement.
- Replay class.
- Idempotency key strategy.
- Audit event name.
Public Helpers
Use the registry helpers from @/lib/command-graph:
import {
getCommandGraphAction,
getCommandGraphSchemasByDomain,
validateCommandGraphAction,
validateCommandGraphTrigger,
} from '@/lib/command-graph'
Supported helper groups:
getCommandGraphDomains()getCommandGraphTriggers()getCommandGraphActions()getCommandGraphTrigger(key)getCommandGraphAction(key)getCommandGraphSchemasByDomain(domain)validateCommandGraphTrigger(key, payload)validateCommandGraphAction(key, input)getCommandGraphRegistrySummary()
Safety Defaults
- Every high-risk and critical action is approval-gated.
- Every schema includes an idempotency strategy containing
firmId. - Every schema includes at least one permission.
- External replay, court filing, financial recording, document sharing, client-facing email, portal messaging, and approved AI application are treated as approval-controlled work.
Verification
Focused registry tests:
npm run test:run -- src/__tests__/lib/command-graph-schema-registry.test.ts
The test suite verifies required domain coverage, unique trigger/action keys, sample validation, unknown/malformed payload rejection, approval defaults for high-risk actions, execution metadata, lookup helpers, and summary output.