mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
增强 SentryErrorBoundary 组件,捕获渲染错误时输出诊断信息 (错误消息 + component stack)到 stderr 和终端,而非静默返回 null。在 replLauncher 根节点和 Messages 组件层级包裹 Error Boundary,防止 Ink 内部的 Error Boundary 直接终止进程。 Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
32 lines
1003 B
TypeScript
32 lines
1003 B
TypeScript
import React from 'react';
|
|
import type { StatsStore } from './context/stats.js';
|
|
import type { Root } from '@anthropic/ink';
|
|
import type { Props as REPLProps } from './screens/REPL.js';
|
|
import type { AppState } from './state/AppStateStore.js';
|
|
import type { FpsMetrics } from './utils/fpsTracker.js';
|
|
|
|
type AppWrapperProps = {
|
|
getFpsMetrics: () => FpsMetrics | undefined;
|
|
stats?: StatsStore;
|
|
initialState: AppState;
|
|
};
|
|
|
|
export async function launchRepl(
|
|
root: Root,
|
|
appProps: AppWrapperProps,
|
|
replProps: REPLProps,
|
|
renderAndRun: (root: Root, element: React.ReactNode) => Promise<void>,
|
|
): Promise<void> {
|
|
const { App } = await import('./components/App.js');
|
|
const { SentryErrorBoundary } = await import('./components/SentryErrorBoundary.js');
|
|
const { REPL } = await import('./screens/REPL.js');
|
|
await renderAndRun(
|
|
root,
|
|
<SentryErrorBoundary name="RootREPLBoundary">
|
|
<App {...appProps}>
|
|
<REPL {...replProps} />
|
|
</App>
|
|
</SentryErrorBoundary>,
|
|
);
|
|
}
|