mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,162 +1,106 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { Box, Text } from 'src/ink.js';
|
||||
import { type NetworkHostPattern, shouldAllowManagedSandboxDomainsOnly } from 'src/utils/sandbox/sandbox-adapter.js';
|
||||
import { type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, logEvent } from '../../services/analytics/index.js';
|
||||
import { Select } from '../CustomSelect/select.js';
|
||||
import { PermissionDialog } from './PermissionDialog.js';
|
||||
import * as React from 'react'
|
||||
import { Box, Text } from 'src/ink.js'
|
||||
import {
|
||||
type NetworkHostPattern,
|
||||
shouldAllowManagedSandboxDomainsOnly,
|
||||
} from 'src/utils/sandbox/sandbox-adapter.js'
|
||||
import {
|
||||
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
logEvent,
|
||||
} from '../../services/analytics/index.js'
|
||||
import { Select } from '../CustomSelect/select.js'
|
||||
import { PermissionDialog } from './PermissionDialog.js'
|
||||
|
||||
export type SandboxPermissionRequestProps = {
|
||||
hostPattern: NetworkHostPattern;
|
||||
hostPattern: NetworkHostPattern
|
||||
onUserResponse: (response: {
|
||||
allow: boolean;
|
||||
persistToSettings: boolean;
|
||||
}) => void;
|
||||
};
|
||||
export function SandboxPermissionRequest(t0) {
|
||||
const $ = _c(22);
|
||||
const {
|
||||
hostPattern: t1,
|
||||
onUserResponse
|
||||
} = t0;
|
||||
const {
|
||||
host
|
||||
} = t1;
|
||||
let t2;
|
||||
if ($[0] !== onUserResponse) {
|
||||
t2 = function onSelect(value) {
|
||||
bb4: switch (value) {
|
||||
case "yes":
|
||||
{
|
||||
onUserResponse({
|
||||
allow: true,
|
||||
persistToSettings: false
|
||||
});
|
||||
break bb4;
|
||||
}
|
||||
case "yes-dont-ask-again":
|
||||
{
|
||||
onUserResponse({
|
||||
allow: true,
|
||||
persistToSettings: true
|
||||
});
|
||||
break bb4;
|
||||
}
|
||||
case "no":
|
||||
{
|
||||
onUserResponse({
|
||||
allow: false,
|
||||
persistToSettings: false
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
$[0] = onUserResponse;
|
||||
$[1] = t2;
|
||||
} else {
|
||||
t2 = $[1];
|
||||
}
|
||||
const onSelect = t2;
|
||||
let t3;
|
||||
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = shouldAllowManagedSandboxDomainsOnly();
|
||||
$[2] = t3;
|
||||
} else {
|
||||
t3 = $[2];
|
||||
}
|
||||
const managedDomainsOnly = t3;
|
||||
let t4;
|
||||
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = {
|
||||
label: "Yes",
|
||||
value: "yes"
|
||||
};
|
||||
$[3] = t4;
|
||||
} else {
|
||||
t4 = $[3];
|
||||
}
|
||||
let t5;
|
||||
if ($[4] !== host) {
|
||||
t5 = !managedDomainsOnly ? [{
|
||||
label: <Text>Yes, and don't ask again for <Text bold={true}>{host}</Text></Text>,
|
||||
value: "yes-dont-ask-again"
|
||||
}] : [];
|
||||
$[4] = host;
|
||||
$[5] = t5;
|
||||
} else {
|
||||
t5 = $[5];
|
||||
}
|
||||
let t6;
|
||||
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t6 = {
|
||||
label: <Text>No, and tell Claude what to do differently <Text bold={true}>(esc)</Text></Text>,
|
||||
value: "no"
|
||||
};
|
||||
$[6] = t6;
|
||||
} else {
|
||||
t6 = $[6];
|
||||
}
|
||||
let t7;
|
||||
if ($[7] !== t5) {
|
||||
t7 = [t4, ...t5, t6];
|
||||
$[7] = t5;
|
||||
$[8] = t7;
|
||||
} else {
|
||||
t7 = $[8];
|
||||
}
|
||||
const options = t7;
|
||||
let t8;
|
||||
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <Text dimColor={true}>Host:</Text>;
|
||||
$[9] = t8;
|
||||
} else {
|
||||
t8 = $[9];
|
||||
}
|
||||
let t9;
|
||||
if ($[10] !== host) {
|
||||
t9 = <Box>{t8}<Text> {host}</Text></Box>;
|
||||
$[10] = host;
|
||||
$[11] = t9;
|
||||
} else {
|
||||
t9 = $[11];
|
||||
}
|
||||
let t10;
|
||||
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t10 = <Box marginTop={1}><Text>Do you want to allow this connection?</Text></Box>;
|
||||
$[12] = t10;
|
||||
} else {
|
||||
t10 = $[12];
|
||||
}
|
||||
let t11;
|
||||
if ($[13] !== onUserResponse) {
|
||||
t11 = () => {
|
||||
onUserResponse({
|
||||
allow: false,
|
||||
persistToSettings: false
|
||||
});
|
||||
};
|
||||
$[13] = onUserResponse;
|
||||
$[14] = t11;
|
||||
} else {
|
||||
t11 = $[14];
|
||||
}
|
||||
let t12;
|
||||
if ($[15] !== onSelect || $[16] !== options || $[17] !== t11) {
|
||||
t12 = <Box><Select options={options} onChange={onSelect} onCancel={t11} /></Box>;
|
||||
$[15] = onSelect;
|
||||
$[16] = options;
|
||||
$[17] = t11;
|
||||
$[18] = t12;
|
||||
} else {
|
||||
t12 = $[18];
|
||||
}
|
||||
let t13;
|
||||
if ($[19] !== t12 || $[20] !== t9) {
|
||||
t13 = <PermissionDialog title="Network request outside of sandbox"><Box flexDirection="column" paddingX={2} paddingY={1}>{t9}{t10}{t12}</Box></PermissionDialog>;
|
||||
$[19] = t12;
|
||||
$[20] = t9;
|
||||
$[21] = t13;
|
||||
} else {
|
||||
t13 = $[21];
|
||||
}
|
||||
return t13;
|
||||
allow: boolean
|
||||
persistToSettings: boolean
|
||||
}) => void
|
||||
}
|
||||
|
||||
export function SandboxPermissionRequest({
|
||||
hostPattern: { host },
|
||||
onUserResponse,
|
||||
}: SandboxPermissionRequestProps): React.ReactNode {
|
||||
function onSelect(value: string) {
|
||||
// We may want to better unify this dialog with other permission dialogs
|
||||
// and use their logging, but this is slightly different and we don't have
|
||||
// the tool context here. For now, just use basic logging for basic data.
|
||||
if (process.env.USER_TYPE === 'ant') {
|
||||
logEvent('tengu_sandbox_network_dialog_result', {
|
||||
host: host as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
result:
|
||||
value as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
}
|
||||
|
||||
switch (value) {
|
||||
case 'yes':
|
||||
onUserResponse({ allow: true, persistToSettings: false })
|
||||
break
|
||||
case 'yes-dont-ask-again':
|
||||
onUserResponse({ allow: true, persistToSettings: true })
|
||||
break
|
||||
case 'no':
|
||||
onUserResponse({ allow: false, persistToSettings: false })
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const managedDomainsOnly = shouldAllowManagedSandboxDomainsOnly()
|
||||
|
||||
const options = [
|
||||
{ label: 'Yes', value: 'yes' },
|
||||
...(!managedDomainsOnly
|
||||
? [
|
||||
{
|
||||
label: (
|
||||
<Text>
|
||||
Yes, and don't ask again for <Text bold>{host}</Text>
|
||||
</Text>
|
||||
),
|
||||
value: 'yes-dont-ask-again',
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: (
|
||||
<Text>
|
||||
No, and tell Claude what to do differently <Text bold>(esc)</Text>
|
||||
</Text>
|
||||
),
|
||||
value: 'no',
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<PermissionDialog title="Network request outside of sandbox">
|
||||
<Box flexDirection="column" paddingX={2} paddingY={1}>
|
||||
<Box>
|
||||
<Text dimColor>Host:</Text>
|
||||
<Text> {host}</Text>
|
||||
</Box>
|
||||
<Box marginTop={1}>
|
||||
<Text>Do you want to allow this connection?</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Select
|
||||
options={options}
|
||||
onChange={onSelect}
|
||||
onCancel={() => {
|
||||
if (process.env.USER_TYPE === 'ant') {
|
||||
logEvent('tengu_sandbox_network_dialog_result', {
|
||||
host: host as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
result:
|
||||
'cancel' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
}
|
||||
onUserResponse({ allow: false, persistToSettings: false })
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
</PermissionDialog>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user