Direct 聊天权限门改为必填,去掉默认放行

- apps/ai-game-creator-shell/src/view/project-development/chat/DirectProjectChatView.tsx 删除 ALLOW_CONVERSATION_ACCESS 及两个权限门 prop 的默认值,改为必填
- 原先缺省实现恒返回 true,调用方漏传等于静默跳过工作台壳的读写权限判定;唯一调用方 App.tsx 本来就会传入两个门
This commit is contained in:
2026-09-19 23:12:28 +08:00
parent f58249a75e
commit 884aabe6d7
@@ -67,17 +67,17 @@ export type DirectProjectChatViewProps = {
projectPath: string | null;
/** 入口带进来的首轮需求;未提供时不自动发送任何回合。 */
initialTurn?: DirectProjectInitialTurn | null;
/** 项目对话读权限门:策略要求确认时由工作台壳入队,聊天不重复判定权限。 */
ensureConversationReadAllowed?: DirectProjectConversationReadGate;
/** 项目对话写权限门:只在发起回合时检查。 */
ensureConversationWriteAllowed?: DirectProjectConversationWriteGate;
/**
* 项目对话读权限门:策略要求确认时由工作台壳入队,聊天不重复判定权限。
* 必填:这道门是聊天发起读取/回合的授权判据,缺省放行等于绕过工作台壳的权限判定。
*/
ensureConversationReadAllowed: DirectProjectConversationReadGate;
/** 项目对话写权限门:只在发起回合时检查;同样必填,缺省会让未传入的调用方静默跳过授权。 */
ensureConversationWriteAllowed: DirectProjectConversationWriteGate;
/** 工作台壳把运行/预览这类动作结果交给聊天的出口。 */
ref?: Ref<DirectProjectChatHandle>;
};
const ALLOW_CONVERSATION_ACCESS: DirectProjectConversationReadGate = async () =>
true;
/** 首轮那条本地用户消息展示入口原话:附件与引用仍按 canonical content 进入回合。 */
function directInitialTurnText(content: readonly DirectCodexUserContentPart[]) {
return content
@@ -90,8 +90,8 @@ function directInitialTurnText(content: readonly DirectCodexUserContentPart[]) {
export function DirectProjectChatView({
projectPath,
initialTurn = null,
ensureConversationReadAllowed = ALLOW_CONVERSATION_ACCESS,
ensureConversationWriteAllowed = ALLOW_CONVERSATION_ACCESS,
ensureConversationReadAllowed,
ensureConversationWriteAllowed,
ref,
}: DirectProjectChatViewProps) {
const { assets, projectId, refresh, versions } =