fix: strict 模式类型修复 + 恢复 allow-dangerously-skip-permissions 选项
- LogoV2: 抽取 ChannelsNoticeIfLoaded 消除重复,修复 nullability - main.tsx: 恢复 --allow-dangerously-skip-permissions 选项 - global.d.ts: 添加 doubaoime-asr 模块类型声明
This commit is contained in:
parent
c96fe77c45
commit
5d6b31398a
|
|
@ -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 ? <ChannelsNoticeModule.ChannelsNotice /> : 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
|
||||
<Opus1mMergeNotice />
|
||||
*/}
|
||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
||||
<ChannelsNoticeIfLoaded />
|
||||
{isDebugMode() && (
|
||||
<Box paddingLeft={2} flexDirection="column">
|
||||
<Text color="warning">Debug mode enabled</Text>
|
||||
|
|
@ -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
|
||||
<Opus1mMergeNotice />
|
||||
*/}
|
||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
||||
<ChannelsNoticeIfLoaded />
|
||||
{showSandboxStatus && (
|
||||
<Box marginTop={1} flexDirection="column">
|
||||
<Text color="warning">Your bash commands will be sandboxed. Disable with /sandbox.</Text>
|
||||
|
|
@ -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
|
||||
<Opus1mMergeNotice />
|
||||
*/}
|
||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
||||
{isDebugMode() && (
|
||||
<ChannelsNoticeIfLoaded />
|
||||
{isDebugMode() && (
|
||||
<Box paddingLeft={2} flexDirection="column">
|
||||
<Text color="warning">Debug mode enabled</Text>
|
||||
<Text dimColor>Logging to: {isDebugToStdErr() ? 'stderr' : getDebugLogPath()}</Text>
|
||||
|
|
@ -383,7 +386,7 @@ export function LogoV2(): React.ReactNode {
|
|||
{announcement && (
|
||||
<Box paddingLeft={2} flexDirection="column">
|
||||
{!process.env.IS_DEMO && config.oauthAccount?.organizationName && (
|
||||
<Text dimColor>Message from {config.oauthAccount.organizationName}:</Text>
|
||||
<Text dimColor>Message from {config.oauthAccount!.organizationName}:</Text>
|
||||
)}
|
||||
<Text>{announcement}</Text>
|
||||
</Box>
|
||||
|
|
|
|||
13
src/main.tsx
13
src/main.tsx
|
|
@ -1524,11 +1524,14 @@ async function run(): Promise<CommanderCommand> {
|
|||
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 <mode>",
|
||||
|
|
|
|||
28
src/types/global.d.ts
vendored
28
src/types/global.d.ts
vendored
|
|
@ -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<string, unknown>)
|
||||
ensureCredentials(): Promise<void>
|
||||
[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<Uint8Array>,
|
||||
options?: { config: ASRConfig },
|
||||
): AsyncGenerator<ASRResponse>
|
||||
export function createASRStream(options?: Record<string, unknown>): AsyncGenerator<ASRResponse>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user