Files
Ncurator/src/shared/aiRunEventUtils.ts
T
hy b4c49ca782 feat: add terminal capability tools and file artifact management
- 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.
2026-02-28 18:41:59 +08:00

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
}