- Implemented `emitFileArtifactEvent` for emitting file artifact events. - Created `TerminalCapabilityTools` for executing terminal commands with workspace boundary checks and risk classification. - Added `checkWorkspaceBoundary` and `classifyCommandRisk` functions for command validation. - Introduced `terminalPolicy` for managing terminal command policies. - Enhanced `ChatPage` to display file artifacts and provide options to open or reveal paths. - Updated shared types to include artifact-related types and events. - Added utility functions for grouping artifact events by task.
15 lines
512 B
TypeScript
15 lines
512 B
TypeScript
import type { AiRunEvent } from './types'
|
|
|
|
export type ArtifactRunEvent = Extract<AiRunEvent, { type: 'file_artifact' }>
|
|
|
|
export const groupArtifactEventsByTask = (events: AiRunEvent[]): Record<string, ArtifactRunEvent[]> => {
|
|
const grouped: Record<string, ArtifactRunEvent[]> = {}
|
|
for (const event of events) {
|
|
if (event.type !== 'file_artifact') continue
|
|
const key = String(event.taskId || '__no_task__')
|
|
if (!grouped[key]) grouped[key] = []
|
|
grouped[key].push(event)
|
|
}
|
|
return grouped
|
|
}
|