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'))
|
? (require('./ChannelsNotice.js') as typeof import('./ChannelsNotice.js'))
|
||||||
: null;
|
: null;
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
function ChannelsNoticeIfLoaded() {
|
||||||
|
return ChannelsNoticeModule ? <ChannelsNoticeModule.ChannelsNotice /> : null
|
||||||
|
}
|
||||||
import { SandboxManager } from 'src/utils/sandbox/sandbox-adapter.js';
|
import { SandboxManager } from 'src/utils/sandbox/sandbox-adapter.js';
|
||||||
import { useShowGuestPassesUpsell, incrementGuestPassesSeenCount } from './GuestPassesUpsell.js';
|
import { useShowGuestPassesUpsell, incrementGuestPassesSeenCount } from './GuestPassesUpsell.js';
|
||||||
import {
|
import {
|
||||||
|
|
@ -157,7 +160,7 @@ export function LogoV2(): React.ReactNode {
|
||||||
{/* NOTE: Opus 1M merge notice disabled
|
{/* NOTE: Opus 1M merge notice disabled
|
||||||
<Opus1mMergeNotice />
|
<Opus1mMergeNotice />
|
||||||
*/}
|
*/}
|
||||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
<ChannelsNoticeIfLoaded />
|
||||||
{isDebugMode() && (
|
{isDebugMode() && (
|
||||||
<Box paddingLeft={2} flexDirection="column">
|
<Box paddingLeft={2} flexDirection="column">
|
||||||
<Text color="warning">Debug mode enabled</Text>
|
<Text color="warning">Debug mode enabled</Text>
|
||||||
|
|
@ -223,7 +226,7 @@ export function LogoV2(): React.ReactNode {
|
||||||
const separator = ' · ';
|
const separator = ' · ';
|
||||||
const atPrefix = '@';
|
const atPrefix = '@';
|
||||||
const cwdAvailableWidth = agentName
|
const cwdAvailableWidth = agentName
|
||||||
? columns - layoutWidth - atPrefix.length - stringWidth(agentName) - separator.length
|
? columns - layoutWidth - atPrefix.length - stringWidth(agentName!) - separator.length
|
||||||
: columns - layoutWidth;
|
: columns - layoutWidth;
|
||||||
const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
|
const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
|
||||||
// OffscreenFreeze: logo is the first thing to enter scrollback; useMainLoopModel()
|
// 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
|
{/* NOTE: Opus 1M merge notice disabled
|
||||||
<Opus1mMergeNotice />
|
<Opus1mMergeNotice />
|
||||||
*/}
|
*/}
|
||||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
<ChannelsNoticeIfLoaded />
|
||||||
{showSandboxStatus && (
|
{showSandboxStatus && (
|
||||||
<Box marginTop={1} flexDirection="column">
|
<Box marginTop={1} flexDirection="column">
|
||||||
<Text color="warning">Your bash commands will be sandboxed. Disable with /sandbox.</Text>
|
<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
|
const modelLine = notLoggedIn
|
||||||
? 'Not logged in'
|
? 'Not logged in'
|
||||||
: !process.env.IS_DEMO && config.oauthAccount?.organizationName
|
: !process.env.IS_DEMO && config.oauthAccount?.organizationName
|
||||||
? `${modelDisplayName} · ${billingType} · ${config.oauthAccount.organizationName}`
|
? `${modelDisplayName} · ${billingType} · ${config.oauthAccount!.organizationName}`
|
||||||
: `${modelDisplayName} · ${billingType}`;
|
: `${modelDisplayName} · ${billingType}`;
|
||||||
// Calculate cwd width accounting for agent name if present
|
// Calculate cwd width accounting for agent name if present
|
||||||
const cwdSeparator = ' · ';
|
const cwdSeparator = ' · ';
|
||||||
const cwdAtPrefix = '@';
|
const cwdAtPrefix = '@';
|
||||||
const cwdAvailableWidth = agentName
|
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;
|
: LEFT_PANEL_MAX_WIDTH;
|
||||||
const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
|
const truncatedCwd = truncatePath(cwd, Math.max(cwdAvailableWidth, 10));
|
||||||
const cwdLine = agentName ? `@${agentName} · ${truncatedCwd}` : truncatedCwd;
|
const cwdLine = agentName ? `@${agentName} · ${truncatedCwd}` : truncatedCwd;
|
||||||
|
|
@ -362,8 +365,8 @@ export function LogoV2(): React.ReactNode {
|
||||||
{/* NOTE: Opus 1M merge notice disabled
|
{/* NOTE: Opus 1M merge notice disabled
|
||||||
<Opus1mMergeNotice />
|
<Opus1mMergeNotice />
|
||||||
*/}
|
*/}
|
||||||
{ChannelsNoticeModule && <ChannelsNoticeModule.ChannelsNotice />}
|
<ChannelsNoticeIfLoaded />
|
||||||
{isDebugMode() && (
|
{isDebugMode() && (
|
||||||
<Box paddingLeft={2} flexDirection="column">
|
<Box paddingLeft={2} flexDirection="column">
|
||||||
<Text color="warning">Debug mode enabled</Text>
|
<Text color="warning">Debug mode enabled</Text>
|
||||||
<Text dimColor>Logging to: {isDebugToStdErr() ? 'stderr' : getDebugLogPath()}</Text>
|
<Text dimColor>Logging to: {isDebugToStdErr() ? 'stderr' : getDebugLogPath()}</Text>
|
||||||
|
|
@ -383,7 +386,7 @@ export function LogoV2(): React.ReactNode {
|
||||||
{announcement && (
|
{announcement && (
|
||||||
<Box paddingLeft={2} flexDirection="column">
|
<Box paddingLeft={2} flexDirection="column">
|
||||||
{!process.env.IS_DEMO && config.oauthAccount?.organizationName && (
|
{!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>
|
<Text>{announcement}</Text>
|
||||||
</Box>
|
</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.")
|
new Option("--dangerously-skip-permissions", "Bypass all permission checks. Recommended only for sandboxes with no internet access.")
|
||||||
.argParser(() => true),
|
.argParser(() => true),
|
||||||
)
|
)
|
||||||
// .option(
|
.addOption(
|
||||||
// "--allow-dangerously-skip-permissions",
|
new Option(
|
||||||
// "Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.",
|
"--allow-dangerously-skip-permissions",
|
||||||
// () => true,
|
"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(
|
.addOption(
|
||||||
new Option(
|
new Option(
|
||||||
"--thinking <mode>",
|
"--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
|
const content: string
|
||||||
export default content
|
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