Skip to content

feat: add contextual-explanation artifact#14

Merged
juliarvalenti merged 1 commit intomainfrom
review/contextual-explanation-clean
Feb 11, 2026
Merged

feat: add contextual-explanation artifact#14
juliarvalenti merged 1 commit intomainfrom
review/contextual-explanation-clean

Conversation

@juliarvalenti
Copy link
Collaborator

Summary

Fixes Applied

  • types.ts: Export ExplanationDetailZod with .describe() annotations; removed unnecessary ArtifactTabZod discriminated union
  • action.ts: Added Zod validation for detailsJson parsing; use direct ContextualExplanationArtifact["data"] type
  • index.ts: Added missing CONTEXTUAL_EXPLANATION_DESCRIPTION and ExplanationDetailZod exports
  • Registry: Added alongside existing artifacts (original PR overwrote capability-manifest due to stale branch)

Files

hax/artifacts/contextual-explanation/
├── contextual-explanation.tsx   # Light-mode card with alert, details, action buttons
├── types.ts                     # Zod schemas with .describe() annotations
├── action.ts                    # CopilotKit hook with Zod validation
├── description.ts               # AI prompt guidance
├── index.ts                     # Barrel exports
└── README.md                    # Documentation

Test plan

  • hax add artifact contextual-explanation installs correctly
  • Component renders with sample data
  • CopilotKit action create_contextual_explanation works with AI agents

Add the contextual-explanation artifact with pattern fixes:
- Export ExplanationDetailZod from types.ts with .describe() annotations
- Add Zod validation in action handler for detailsJson parsing
- Use direct ContextualExplanationArtifact["data"] type (remove ArtifactTabZod)
- Export CONTEXTUAL_EXPLANATION_DESCRIPTION from index.ts
- Add to registry alongside existing artifacts (not replacing)

Based on contribution from AkankshaKhandelwal (PR #6).

Signed-off-by: Julia Valenti (julvalen) <julvalen@cisco.com>
@juliarvalenti juliarvalenti merged commit 6b522bf into main Feb 11, 2026
2 checks passed
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