feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)
This commit is contained in:
parent
f49acf0105
commit
10af20a0ad
157 changed files with 29455 additions and 913 deletions
|
|
@ -45,8 +45,10 @@ import {
|
|||
deleteMeetingDocumentRevisionSafe,
|
||||
deleteMeetingMemoConflictSafe,
|
||||
deleteMeetingRevisionSafe,
|
||||
findActiveTranscriptSegmentId,
|
||||
getMeetingDetail,
|
||||
MeetingServiceError,
|
||||
parseTranscriptSeekSegments,
|
||||
subscribeToMeetingDetail,
|
||||
updateMeetingDocumentRevisionSafe,
|
||||
updateMeetingMemoConflictSafe,
|
||||
|
|
@ -73,6 +75,8 @@ interface MeetingDetailScreenProps {
|
|||
| { initialKind: 'meeting_document' },
|
||||
) => void
|
||||
}
|
||||
onSeekAudio?: (positionMs: number) => void
|
||||
initialAudioPositionMs?: number | null
|
||||
}
|
||||
|
||||
type EditorState =
|
||||
|
|
@ -84,6 +88,8 @@ type EditorState =
|
|||
export default function MeetingDetailScreen({
|
||||
route,
|
||||
navigation,
|
||||
onSeekAudio,
|
||||
initialAudioPositionMs = null,
|
||||
}: MeetingDetailScreenProps): React.ReactElement {
|
||||
const insets = useSafeAreaInsets()
|
||||
const { t, formatDate } = useI18n()
|
||||
|
|
@ -109,6 +115,13 @@ export default function MeetingDetailScreen({
|
|||
const [editorBusy, setEditorBusy] = useState(false)
|
||||
const [selectedDocumentTemplate, setSelectedDocumentTemplate] = useState<UserTemplate | null>(null)
|
||||
const [reportTarget, setReportTarget] = useState<ContentReportTarget | null>(null)
|
||||
const [currentPositionMs, setCurrentPositionMs] = useState<number | null>(initialAudioPositionMs)
|
||||
|
||||
const handleSeekTimestamp = useCallback((timestampMs: number): void => {
|
||||
const clamped = Math.max(0, Math.floor(timestampMs))
|
||||
setCurrentPositionMs(clamped)
|
||||
onSeekAudio?.(clamped)
|
||||
}, [onSeekAudio])
|
||||
|
||||
const load = useCallback(async (
|
||||
pullToRefresh = false,
|
||||
|
|
@ -461,6 +474,12 @@ export default function MeetingDetailScreen({
|
|||
const transcript = detail === null
|
||||
? null
|
||||
: buildMeetingTranscriptView(detail.meeting, detail.transcripts)
|
||||
const seekableSegments = useMemo(() => (
|
||||
detail === null ? [] : parseTranscriptSeekSegments(detail.meeting, detail.transcripts)
|
||||
), [detail])
|
||||
const activeSegmentId = useMemo(() => (
|
||||
findActiveTranscriptSegmentId(seekableSegments, currentPositionMs)
|
||||
), [currentPositionMs, seekableSegments])
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
|
@ -646,25 +665,51 @@ export default function MeetingDetailScreen({
|
|||
</View>
|
||||
</Section>
|
||||
|
||||
<Section title={t('mobile.meetings.transcript')} count={detail.transcripts.length}>
|
||||
{transcript?.source === 'segments' ? detail.transcripts.map((segment) => (
|
||||
<View key={segment.id} style={styles.transcriptSegment} testID={`meeting-transcript-${segment.id}`}>
|
||||
<View style={styles.segmentMeta}>
|
||||
<ThemeText variant="label" color="accent">
|
||||
{formatElapsedMs(segment.timestamp_ms)}
|
||||
</ThemeText>
|
||||
{segment.speaker !== null && (
|
||||
<ThemeText variant="label" color="muted">{segment.speaker}</ThemeText>
|
||||
)}
|
||||
{segment.edited && (
|
||||
<ThemeText variant="label" color="muted">
|
||||
{t('mobile.meetings.edited')}
|
||||
</ThemeText>
|
||||
)}
|
||||
</View>
|
||||
<ThemeText selectable style={styles.readingText}>{segment.text}</ThemeText>
|
||||
</View>
|
||||
)) : transcript?.source !== 'empty' ? (
|
||||
<Section title={t('mobile.meetings.transcript')} count={detail.transcripts.length || seekableSegments.length}>
|
||||
{currentPositionMs !== null && (
|
||||
<ThemeText variant="label" color="accent" testID="meeting-audio-position">
|
||||
{formatElapsedMs(currentPositionMs)}
|
||||
</ThemeText>
|
||||
)}
|
||||
{transcript?.source === 'segments' || seekableSegments.some((segment) => segment.timed) ? (
|
||||
seekableSegments.map((segment) => {
|
||||
const isActive = activeSegmentId === segment.id
|
||||
return (
|
||||
<View
|
||||
key={segment.id}
|
||||
style={[
|
||||
styles.transcriptSegment,
|
||||
isActive && styles.transcriptSegmentActive,
|
||||
]}
|
||||
testID={`meeting-transcript-${segment.id}`}
|
||||
>
|
||||
<View style={styles.segmentMeta}>
|
||||
{segment.timed ? (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={formatElapsedMs(segment.timestampMs)}
|
||||
onPress={() => handleSeekTimestamp(segment.timestampMs)}
|
||||
testID={`meeting-transcript-seek-${segment.id}`}
|
||||
>
|
||||
<ThemeText variant="label" color="accent">
|
||||
[{formatElapsedMs(segment.timestampMs)}]
|
||||
</ThemeText>
|
||||
</Pressable>
|
||||
) : null}
|
||||
{segment.speaker !== null && (
|
||||
<ThemeText variant="label" color="muted">{segment.speaker}</ThemeText>
|
||||
)}
|
||||
{segment.edited && (
|
||||
<ThemeText variant="label" color="muted">
|
||||
{t('mobile.meetings.edited')}
|
||||
</ThemeText>
|
||||
)}
|
||||
</View>
|
||||
<ThemeText selectable style={styles.readingText}>{segment.text}</ThemeText>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
) : transcript?.source !== 'empty' ? (
|
||||
<ThemeText selectable style={styles.readingText}>{transcript?.text}</ThemeText>
|
||||
) : (
|
||||
<ThemeText color="muted" testID="meeting-transcript-empty">
|
||||
|
|
@ -1109,9 +1154,16 @@ function createStyles(palette: Palette): ReturnType<typeof StyleSheet.create> {
|
|||
transcriptSegment: {
|
||||
gap: 6,
|
||||
paddingVertical: 10,
|
||||
paddingHorizontal: 8,
|
||||
borderRadius: 8,
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: palette.border.subtle,
|
||||
},
|
||||
transcriptSegmentActive: {
|
||||
backgroundColor: palette.bg.inset,
|
||||
borderLeftWidth: 3,
|
||||
borderLeftColor: palette.accent.main,
|
||||
},
|
||||
segmentMeta: { flexDirection: 'row', alignItems: 'center', gap: 10 },
|
||||
readingText: { lineHeight: 23 },
|
||||
codeText: {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ import {
|
|||
import { useI18n } from '@d3ro/i18n'
|
||||
import { UnifiedSearchResultRow } from '../components/UnifiedSearchResultRow'
|
||||
import { normalizeUnifiedSearchInitialQuery } from '../features/search/unified-search-route'
|
||||
import { searchUnifiedContent } from '../features/search/unified-search-service'
|
||||
import {
|
||||
isUnifiedSearchAbortedError,
|
||||
searchUnifiedContent,
|
||||
} from '../features/search/unified-search-service'
|
||||
import { useAuth } from '../lib/auth-context'
|
||||
import { useMobilePreferences } from '../lib/preferences-context'
|
||||
import { ScreenHeader } from '../components/ScreenHeader'
|
||||
|
|
@ -68,21 +71,32 @@ export default function UnifiedSearchScreen({
|
|||
}
|
||||
|
||||
const sequence = ++requestSequence.current
|
||||
const controller = new AbortController()
|
||||
const timer = setTimeout(() => {
|
||||
setState({ status: 'loading', results: [], total: 0 })
|
||||
void searchUnifiedContent({ userId: user.id, query: normalized, limit: 40 })
|
||||
void searchUnifiedContent({
|
||||
userId: user.id,
|
||||
query: normalized,
|
||||
limit: 40,
|
||||
signal: controller.signal,
|
||||
})
|
||||
.then((response) => {
|
||||
if (requestSequence.current !== sequence) return
|
||||
if (controller.signal.aborted || requestSequence.current !== sequence) return
|
||||
setState({ status: 'ready', results: response.results, total: response.total })
|
||||
})
|
||||
.catch(() => {
|
||||
if (requestSequence.current !== sequence) return
|
||||
.catch((error) => {
|
||||
if (
|
||||
controller.signal.aborted
|
||||
|| isUnifiedSearchAbortedError(error)
|
||||
|| requestSequence.current !== sequence
|
||||
) return
|
||||
setState((current) => ({ ...current, status: 'error' }))
|
||||
})
|
||||
}, SEARCH_DEBOUNCE_MS)
|
||||
|
||||
return () => {
|
||||
clearTimeout(timer)
|
||||
controller.abort()
|
||||
if (requestSequence.current === sequence) requestSequence.current += 1
|
||||
}
|
||||
}, [query, retryNonce, user])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue