This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

165 lines
3.9 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { Component, type ErrorInfo, type ReactNode } from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
// ---------------------------------------------------------------------------
// Brand colors — purple/indigo gitgram palette (proximity)
// ---------------------------------------------------------------------------
const Colors = {
primary: '#7C3AED',
background: '#0F0F1A',
surfaceElevated: '#232340',
border: '#2D2D50',
text: '#E2E8F0',
textSecondary: '#94A3B8',
textMuted: '#64748B',
white: '#FFFFFF',
} as const;
interface ErrorBoundaryProps {
children: ReactNode;
/**
* Optional render-prop fallback. Receives the captured error and a reset
* callback. When omitted, the default dark fallback UI is shown.
*/
fallback?: (error: Error, reset: () => void) => ReactNode;
/** Optional hook for reporting errors to a logging/telemetry sink. */
onError?: (error: Error, info: ErrorInfo) => void;
}
interface ErrorBoundaryState {
error: Error | null;
}
/**
* Catches render-time errors in its subtree and shows a recoverable fallback
* UI instead of crashing the whole app.
*/
export class ErrorBoundary extends Component<
ErrorBoundaryProps,
ErrorBoundaryState
> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = { error: null };
this.reset = this.reset.bind(this);
}
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
return { error };
}
componentDidCatch(error: Error, info: ErrorInfo): void {
this.props.onError?.(error, info);
}
reset(): void {
this.setState({ error: null });
}
render(): ReactNode {
const { error } = this.state;
const { children, fallback } = this.props;
if (error === null) {
return children;
}
if (fallback) {
return fallback(error, this.reset);
}
return (
<View style={styles.container}>
<View style={styles.iconBadge}>
<Text style={styles.icon}>⚠️</Text>
</View>
<Text style={styles.title}>Something went wrong</Text>
<Text style={styles.subtitle}>
An unexpected error occurred. You can try again — if it keeps
happening, please restart the app.
</Text>
<Text style={styles.detail} numberOfLines={3}>
{error.message}
</Text>
<TouchableOpacity
style={styles.retryBtn}
onPress={this.reset}
activeOpacity={0.85}
accessibilityRole="button"
accessibilityLabel="Try again"
>
<Text style={styles.retryLabel}>Try again</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 32,
backgroundColor: Colors.background,
},
iconBadge: {
width: 72,
height: 72,
borderRadius: 36,
backgroundColor: Colors.surfaceElevated,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 20,
},
icon: {
fontSize: 34,
},
title: {
color: Colors.text,
fontSize: 18,
fontWeight: '700',
textAlign: 'center',
lineHeight: 24,
},
subtitle: {
color: Colors.textSecondary,
fontSize: 14,
fontWeight: '500',
textAlign: 'center',
lineHeight: 20,
marginTop: 8,
maxWidth: 320,
},
detail: {
color: Colors.textMuted,
fontSize: 12,
fontFamily: 'monospace',
textAlign: 'center',
marginTop: 16,
paddingHorizontal: 12,
paddingVertical: 8,
borderRadius: 8,
borderWidth: 1,
borderColor: Colors.border,
maxWidth: 320,
},
retryBtn: {
backgroundColor: Colors.primary,
borderRadius: 12,
paddingVertical: 12,
paddingHorizontal: 28,
marginTop: 24,
},
retryLabel: {
color: Colors.white,
fontSize: 15,
fontWeight: '700',
},
});
export default ErrorBoundary;