feat(gui): add 'edit' variant for tool row, showing as 'Edit · path' like Read
- Add 'edit' to ToolRowVariant type and TOOL_VARIANTS mapping - Add 'edit' title and summary key preference (path/file_path) - Add IconEditOutline16 as the leading icon for edit variant
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import {
|
import {
|
||||||
IconApiOutline14, IconBrowseOutline16, IconSearchOutline16, IconThinkOutline14,
|
IconApiOutline14, IconBrowseOutline16, IconEditOutline16, IconSearchOutline16, IconThinkOutline14,
|
||||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||||
import type { ToolViewProps } from '../contract/toolview.ts'
|
import type { ToolViewProps } from '../contract/toolview.ts'
|
||||||
import { toolRowModel, type ToolCallBlock, type ToolRowVariant } from '../contract/tool-call-model.ts'
|
import { toolRowModel, type ToolCallBlock, type ToolRowVariant } from '../contract/tool-call-model.ts'
|
||||||
@@ -17,6 +17,7 @@ const VARIANT_ICONS: Record<ToolRowVariant, ReactNode> = {
|
|||||||
search: <IconSearchOutline16 />,
|
search: <IconSearchOutline16 />,
|
||||||
read: <IconBrowseOutline16 />,
|
read: <IconBrowseOutline16 />,
|
||||||
bash: <IconApiOutline14 size={16} />,
|
bash: <IconApiOutline14 size={16} />,
|
||||||
|
edit: <IconEditOutline16 />,
|
||||||
others: <IconSparkle16 />,
|
others: <IconSparkle16 />,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ export type { ToolCallBlock } from './toolview.ts'
|
|||||||
/** The frozen slice the chat view hands to toolview components as `block`
|
/** The frozen slice the chat view hands to toolview components as `block`
|
||||||
* (both members are cache-stable references off ConversationSnapshot). */
|
* (both members are cache-stable references off ConversationSnapshot). */
|
||||||
|
|
||||||
/** The five figma row variants (think is fed by reasoning blocks, not tool calls). */
|
/** The six figma row variants (think is fed by reasoning blocks, not tool calls). */
|
||||||
export type ToolRowVariant = 'think' | 'search' | 'read' | 'bash' | 'others'
|
export type ToolRowVariant = 'think' | 'search' | 'read' | 'bash' | 'edit' | 'others'
|
||||||
|
|
||||||
/** Row state semantic; colors self-supplied via StateDot (design gives none). */
|
/** Row state semantic; colors self-supplied via StateDot (design gives none). */
|
||||||
export type ToolRowState = 'running' | 'ok' | 'error' | 'stopped'
|
export type ToolRowState = 'running' | 'ok' | 'error' | 'stopped'
|
||||||
|
|
||||||
/** Figma row titles per variant (design literals, not translatable copy). */
|
/** Figma row titles per variant (design literals, not translatable copy). */
|
||||||
export const VARIANT_TITLES: Record<ToolRowVariant, string> = {
|
export const VARIANT_TITLES: Record<ToolRowVariant, string> = {
|
||||||
think: 'Think', search: 'Search', read: 'Read', bash: 'Bash', others: 'Tool call',
|
think: 'Think', search: 'Search', read: 'Read', bash: 'Bash', edit: 'Edit', others: 'Tool call',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Known tool name -> variant; fs write/edit intentionally fall to others (no figma form). */
|
/** Known tool name -> variant; fs write intentionally fall to others (no figma form). */
|
||||||
const TOOL_VARIANTS: Record<string, ToolRowVariant> = {
|
const TOOL_VARIANTS: Record<string, ToolRowVariant> = {
|
||||||
bash: 'bash',
|
bash: 'bash',
|
||||||
read: 'read',
|
read: 'read',
|
||||||
@@ -29,6 +29,7 @@ const TOOL_VARIANTS: Record<string, ToolRowVariant> = {
|
|||||||
web_search: 'search',
|
web_search: 'search',
|
||||||
grep: 'search',
|
grep: 'search',
|
||||||
glob: 'search',
|
glob: 'search',
|
||||||
|
edit: 'edit',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,6 +79,7 @@ const SUMMARY_KEYS: Record<ToolRowVariant, readonly string[]> = {
|
|||||||
read: ['path', 'file_path', 'url'],
|
read: ['path', 'file_path', 'url'],
|
||||||
search: ['query', 'pattern', 'url'],
|
search: ['query', 'pattern', 'url'],
|
||||||
think: [],
|
think: [],
|
||||||
|
edit: ['path', 'file_path'],
|
||||||
others: [],
|
others: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user