Skip to content

feat: add conversational display mode types#578

Open
shannonsuhendra wants to merge 1 commit into
mainfrom
feat/cas-tools
Open

feat: add conversational display mode types#578
shannonsuhendra wants to merge 1 commit into
mainfrom
feat/cas-tools

Conversation

@shannonsuhendra

Copy link
Copy Markdown
Collaborator

No description provided.

@shannonsuhendra
shannonsuhendra requested a review from a team July 4, 2026 22:58
/**
* Display mode for tool calls
*/
export type ConversationalDisplayMode = 'FullTrace' | 'InputsAndOutputs' | 'ToolNameOnly';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the conventions in agent_docs/conventions.md: "Use enums for fixed value sets — NEVER leave raw strings/numbers. Raw values lose type safety and autocomplete."

This should be an enum, not a string union:

Suggested change
export type ConversationalDisplayMode = 'FullTrace' | 'InputsAndOutputs' | 'ToolNameOnly';
export enum ConversationalDisplayMode {
FullTrace = 'FullTrace',
InputsAndOutputs = 'InputsAndOutputs',
ToolNameOnly = 'ToolNameOnly',
}

/** Starting prompts for users to choose from */
startingPrompts?: AgentStartingPrompt[];
/** Display mode for tool calls */
displayMode: ConversationalDisplayMode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other fields in AgentAppearance are optional (welcomeTitle?, welcomeDescription?, startingPrompts?), and appearance itself is optional on RawAgentGetByIdResponse. If the API can return appearance without displayMode (e.g., for agents created before this field was introduced), marking it required causes runtime undefined access.

Per conventions: "Mark optional fields as optional in type interfaces — over-requiring causes runtime undefined access on fields the API didn't return."

Unless the API guarantees displayMode is always present whenever appearance is returned, this should be:

Suggested change
displayMode: ConversationalDisplayMode;
displayMode?: ConversationalDisplayMode;

@claude

claude Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review findings

Two issues in src/models/conversational-agent/agents/agents.types.ts:

  1. Line 22 — String union instead of enum: ConversationalDisplayMode uses raw string literals. Convention requires an enum for fixed value sets.

  2. Line 35 — Potentially over-required field: displayMode is non-optional while every other field in AgentAppearance is optional. If the API can omit it, callers will get runtime undefined access.

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