fix: use message field for Codex permission card subtitle

Codex elicitation requests from MCP use the 'message' field (from
ElicitRequest schema), not 'command' or 'cwd'. Update the permission
handler to extract and pass this field, and display it as the card
subtitle with fallback to command.
This commit is contained in:
weishu
2026-01-13 11:06:50 +08:00
parent 41d8844c00
commit 251b04ec2d
3 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -262,8 +262,9 @@ export class CodexMcpClient {
toolCallId,
toolName,
{
command: command ?? [],
cwd: cwd ?? ''
message: typeof params.message === 'string' ? params.message : undefined,
command: command ?? undefined,
cwd: cwd ?? undefined
}
);
+2
View File
@@ -314,6 +314,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
const permissionHandler = new CodexPermissionHandler(session.client, {
onRequest: ({ id, toolName, input }) => {
const inputRecord = input && typeof input === 'object' ? input as Record<string, unknown> : {};
const message = typeof inputRecord.message === 'string' ? inputRecord.message : undefined;
const rawCommand = inputRecord.command;
const command = Array.isArray(rawCommand)
? rawCommand.filter((part): part is string => typeof part === 'string').join(' ')
@@ -329,6 +330,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
callId: id,
input: {
tool: toolName,
message,
command,
cwd
},
+1 -1
View File
@@ -143,7 +143,7 @@ export const knownTools: Record<string, {
const tool = getInputStringAny(opts.input, ['tool'])
return tool ? `Permission: ${tool}` : 'Permission request'
},
subtitle: (opts) => getInputStringAny(opts.input, ['command']) ?? null,
subtitle: (opts) => getInputStringAny(opts.input, ['message', 'command']) ?? null,
minimal: true
},
shell_command: {