From 5d6b31398a10639346c44c47dafb50fc9643f9e0 Mon Sep 17 00:00:00 2001 From: DoSun Date: Mon, 11 May 2026 14:33:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20strict=20=E6=A8=A1=E5=BC=8F=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BF=AE=E5=A4=8D=20+=20=E6=81=A2=E5=A4=8D=20allow-da?= =?UTF-8?q?ngerously-skip-permissions=20=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - LogoV2: 抽取 ChannelsNoticeIfLoaded 消除重复,修复 nullability - main.tsx: 恢复 --allow-dangerously-skip-permissions 选项 - global.d.ts: 添加 doubaoime-asr 模块类型声明 --- src/components/LogoV2/LogoV2.tsx | 19 +++++++++++-------- src/main.tsx | 13 ++++++++----- src/types/global.d.ts | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/components/LogoV2/LogoV2.tsx b/src/components/LogoV2/LogoV2.tsx index 528c0954c..275025748 100644 --- a/src/components/LogoV2/LogoV2.tsx +++ b/src/components/LogoV2/LogoV2.tsx @@ -57,6 +57,9 @@ const ChannelsNoticeModule = ? (require('./ChannelsNotice.js') as typeof import('./ChannelsNotice.js')) : null; /* eslint-enable @typescript-eslint/no-require-imports */ +function ChannelsNoticeIfLoaded() { + return ChannelsNoticeModule ? : null +} import { SandboxManager } from 'src/utils/sandbox/sandbox-adapter.js'; import { useShowGuestPassesUpsell, incrementGuestPassesSeenCount } from './GuestPassesUpsell.js'; import { @@ -157,7 +160,7 @@ export function LogoV2(): React.ReactNode { {/* NOTE: Opus 1M merge notice disabled */} - {ChannelsNoticeModule && } + {isDebugMode() && ( Debug mode enabled @@ -223,7 +226,7 @@ export function LogoV2(): React.ReactNode { const separator = ' · '; const atPrefix = '@'; const cwdAvailableWidth = agentName - ? columns - layoutWidth - atPrefix.length - stringWidth(agentName) - separator.length + ? columns - layoutWidth - atPrefix.length - stringWidth(agentName!) - separator.length : columns - layoutWidth; const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10)); // OffscreenFreeze: logo is the first thing to enter scrollback; useMainLoopModel() @@ -260,7 +263,7 @@ export function LogoV2(): React.ReactNode { {/* NOTE: Opus 1M merge notice disabled */} - {ChannelsNoticeModule && } + {showSandboxStatus && ( Your bash commands will be sandboxed. Disable with /sandbox. @@ -276,13 +279,13 @@ export function LogoV2(): React.ReactNode { const modelLine = notLoggedIn ? 'Not logged in' : !process.env.IS_DEMO && config.oauthAccount?.organizationName - ? `${modelDisplayName} · ${billingType} · ${config.oauthAccount.organizationName}` + ? `${modelDisplayName} · ${billingType} · ${config.oauthAccount!.organizationName}` : `${modelDisplayName} · ${billingType}`; // Calculate cwd width accounting for agent name if present const cwdSeparator = ' · '; const cwdAtPrefix = '@'; const cwdAvailableWidth = agentName - ? LEFT_PANEL_MAX_WIDTH - cwdAtPrefix.length - stringWidth(agentName) - cwdSeparator.length + ? LEFT_PANEL_MAX_WIDTH - cwdAtPrefix.length - stringWidth(agentName!) - cwdSeparator.length : LEFT_PANEL_MAX_WIDTH; const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10)); const cwdLine = agentName ? `@${agentName} · ${truncatedCwd}` : truncatedCwd; @@ -362,8 +365,8 @@ export function LogoV2(): React.ReactNode { {/* NOTE: Opus 1M merge notice disabled */} - {ChannelsNoticeModule && } - {isDebugMode() && ( + + {isDebugMode() && ( Debug mode enabled Logging to: {isDebugToStdErr() ? 'stderr' : getDebugLogPath()} @@ -383,7 +386,7 @@ export function LogoV2(): React.ReactNode { {announcement && ( {!process.env.IS_DEMO && config.oauthAccount?.organizationName && ( - Message from {config.oauthAccount.organizationName}: + Message from {config.oauthAccount!.organizationName}: )} {announcement} diff --git a/src/main.tsx b/src/main.tsx index f50629bb7..c36848c35 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1524,11 +1524,14 @@ async function run(): Promise { new Option("--dangerously-skip-permissions", "Bypass all permission checks. Recommended only for sandboxes with no internet access.") .argParser(() => true), ) - // .option( - // "--allow-dangerously-skip-permissions", - // "Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.", - // () => true, - // ) + .addOption( + new Option( + "--allow-dangerously-skip-permissions", + "Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.", + ) + .argParser(() => true) + .hideHelp(), + ) .addOption( new Option( "--thinking ", diff --git a/src/types/global.d.ts b/src/types/global.d.ts index df6cc7bd2..64dab17c5 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -79,3 +79,31 @@ declare module '*.css' { const content: string export default content } +declare module 'doubaoime-asr' { + export interface ASRResponse { + type: number + text: string + is_final: boolean + errorMsg?: string + [key: string]: unknown + } + export class ASRConfig { + constructor(options?: Record) + ensureCredentials(): Promise + [key: string]: unknown + } + export const ResponseType: { + SESSION_STARTED: number + VAD_START: number + INTERIM_RESULT: number + FINAL_RESULT: number + ERROR: number + SESSION_FINISHED: number + [key: string]: number + } + export function transcribeRealtime( + audioSource: AsyncIterable, + options?: { config: ASRConfig }, + ): AsyncGenerator + export function createASRStream(options?: Record): AsyncGenerator +}