mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-28 05:57:13 +00:00
@@ -101,7 +101,7 @@ export type SandboxPolicy =
|
||||
excludeSlashTmp?: boolean;
|
||||
};
|
||||
|
||||
export type ReasoningEffort = 'low' | 'medium' | 'high' | 'auto';
|
||||
export type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
||||
export type ReasoningSummary = 'auto' | 'none' | 'brief' | 'detailed';
|
||||
|
||||
export type CollaborationMode = {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { codexLocalLauncher } from './codexLocalLauncher';
|
||||
import { codexRemoteLauncher } from './codexRemoteLauncher';
|
||||
import { ApiClient, ApiSessionClient } from '@/lib';
|
||||
import type { CodexCliOverrides } from './utils/codexCliOverrides';
|
||||
import type { ReasoningEffort } from './appServerTypes';
|
||||
import type { CodexCollaborationMode, CodexPermissionMode } from '@hapi/protocol/types';
|
||||
|
||||
export type PermissionMode = CodexPermissionMode;
|
||||
@@ -14,7 +15,7 @@ export interface EnhancedMode {
|
||||
permissionMode: PermissionMode;
|
||||
model?: string;
|
||||
collaborationMode: CodexCollaborationMode;
|
||||
modelReasoningEffort?: string;
|
||||
modelReasoningEffort?: ReasoningEffort;
|
||||
}
|
||||
|
||||
interface LoopOptions {
|
||||
|
||||
@@ -12,6 +12,7 @@ import { isPermissionModeAllowedForFlavor } from '@hapi/protocol';
|
||||
import { CodexCollaborationModeSchema, PermissionModeSchema } from '@hapi/protocol/schemas';
|
||||
import { formatMessageWithAttachments } from '@/utils/attachmentFormatter';
|
||||
import { getInvokedCwd } from '@/utils/invokedCwd';
|
||||
import type { ReasoningEffort } from './appServerTypes';
|
||||
|
||||
export { emitReadyIfIdle } from './utils/emitReadyIfIdle';
|
||||
|
||||
@@ -21,7 +22,7 @@ export async function runCodex(opts: {
|
||||
permissionMode?: PermissionMode;
|
||||
resumeSessionId?: string;
|
||||
model?: string;
|
||||
modelReasoningEffort?: string;
|
||||
modelReasoningEffort?: ReasoningEffort;
|
||||
}): Promise<void> {
|
||||
const workingDirectory = getInvokedCwd();
|
||||
const startedBy = opts.startedBy ?? 'terminal';
|
||||
@@ -81,7 +82,8 @@ export async function runCodex(opts: {
|
||||
sessionInstance.setCollaborationMode(currentCollaborationMode);
|
||||
logger.debug(
|
||||
`[Codex] Synced session config for keepalive: ` +
|
||||
`permissionMode=${currentPermissionMode}, model=${currentModel ?? 'auto'}, collaborationMode=${currentCollaborationMode}`
|
||||
`permissionMode=${currentPermissionMode}, model=${currentModel ?? 'auto'}, ` +
|
||||
`modelReasoningEffort=${currentModelReasoningEffort ?? 'default'}, collaborationMode=${currentCollaborationMode}`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -102,7 +104,8 @@ export async function runCodex(opts: {
|
||||
const messagePermissionMode = currentPermissionMode;
|
||||
logger.debug(
|
||||
`[Codex] User message received with permission mode: ${currentPermissionMode}, ` +
|
||||
`model: ${currentModel ?? 'auto'}, collaborationMode: ${currentCollaborationMode}`
|
||||
`model: ${currentModel ?? 'auto'}, modelReasoningEffort: ${currentModelReasoningEffort ?? 'default'}, ` +
|
||||
`collaborationMode: ${currentCollaborationMode}`
|
||||
);
|
||||
|
||||
const enhancedMode: EnhancedMode = {
|
||||
|
||||
@@ -102,7 +102,12 @@ describe('appServerConfig', () => {
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: { permissionMode: 'read-only', model: 'o3', collaborationMode: 'default' }
|
||||
mode: {
|
||||
permissionMode: 'read-only',
|
||||
model: 'o3',
|
||||
modelReasoningEffort: 'high',
|
||||
collaborationMode: 'default'
|
||||
}
|
||||
});
|
||||
|
||||
expect(params.threadId).toBe('thread-1');
|
||||
@@ -114,6 +119,7 @@ describe('appServerConfig', () => {
|
||||
mode: 'default',
|
||||
settings: {
|
||||
model: 'o3',
|
||||
reasoning_effort: 'high',
|
||||
developer_instructions: codexSystemPrompt
|
||||
}
|
||||
});
|
||||
@@ -125,13 +131,19 @@ describe('appServerConfig', () => {
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: { permissionMode: 'default', model: 'o3', collaborationMode: 'plan' }
|
||||
mode: {
|
||||
permissionMode: 'default',
|
||||
model: 'o3',
|
||||
modelReasoningEffort: 'high',
|
||||
collaborationMode: 'plan'
|
||||
}
|
||||
});
|
||||
|
||||
expect(params.collaborationMode).toEqual({
|
||||
mode: 'plan',
|
||||
settings: {
|
||||
model: 'o3',
|
||||
reasoning_effort: 'high',
|
||||
developer_instructions: codexSystemPrompt
|
||||
}
|
||||
});
|
||||
|
||||
@@ -152,6 +152,7 @@ export function buildTurnStartParams(args: {
|
||||
mode: collaborationMode,
|
||||
settings: {
|
||||
model,
|
||||
...(args.mode?.modelReasoningEffort ? { reasoning_effort: args.mode.modelReasoningEffort } : {}),
|
||||
developer_instructions: developerInstructions
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user