mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-19 03:40:50 +00:00
fix(web): expose Codex Fast and Plan on Create Session (#1017)
* fix(web): expose Codex Fast and Plan on Create Session Wire serviceTier and collaborationMode through spawn so Create can set the same Codex options chat Settings already supports (#1015). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): forward collaborationMode through machine spawn RPC Create Session Plan was accepted by the hub but dropped in apiMachine before buildCliArgs; also preserve collaborationMode on resume spawn. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): correct stopSession mock type in spawn RPC test Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): keep Fast mode across Create draft restore while models load Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): preserve pending Fast selection * fix: apply Fast and Plan to imported Codex sessions * test: narrow imported Codex session id * fix: forward explicit Standard service tier * fix: integrate create-session controls with current main * test: close Codex RPC suite * fix: preserve existing session spawn field * fix(web): integrate Codex controls with current New Session form * fix(web): reconcile draft types and submit state * fix(hub): integrate spawn arguments with current resume flow * test(cli): isolate spawn RPC suite --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { maybeAutoStartServer } from '@/utils/autoStartServer'
|
||||
import type { CommandDefinition } from './types'
|
||||
import { CODEX_PERMISSION_MODES } from '@hapi/protocol/modes'
|
||||
import type { CodexPermissionMode } from '@hapi/protocol/types'
|
||||
import { CodexCollaborationModeSchema } from '@hapi/protocol/schemas'
|
||||
import type { ReasoningEffort } from '@/codex/appServerTypes'
|
||||
import { assertCodexLocalSupported } from '@/codex/utils/codexVersion'
|
||||
import { parseReasoningEffortValue } from '@/codex/utils/reasoningEffort'
|
||||
@@ -19,6 +20,14 @@ function parseServiceTier(value: string): 'fast' | 'standard' {
|
||||
throw new Error('Invalid --service-tier value')
|
||||
}
|
||||
|
||||
function parseCollaborationMode(value: string): 'default' | 'plan' {
|
||||
const parsed = CodexCollaborationModeSchema.safeParse(value.trim().toLowerCase())
|
||||
if (!parsed.success) {
|
||||
throw new Error('Invalid --collaboration-mode value')
|
||||
}
|
||||
return parsed.data
|
||||
}
|
||||
|
||||
export const codexCommand: CommandDefinition = {
|
||||
name: 'codex',
|
||||
requiresRuntimeAssets: true,
|
||||
@@ -35,6 +44,7 @@ export const codexCommand: CommandDefinition = {
|
||||
model?: string
|
||||
modelReasoningEffort?: ReasoningEffort
|
||||
serviceTier?: string
|
||||
collaborationMode?: 'default' | 'plan'
|
||||
} = {}
|
||||
const unknownArgs: string[] = []
|
||||
let hasExplicitPermissionMode = false
|
||||
@@ -88,6 +98,12 @@ export const codexCommand: CommandDefinition = {
|
||||
throw new Error('Missing --service-tier value')
|
||||
}
|
||||
options.serviceTier = parseServiceTier(tier)
|
||||
} else if (arg === '--collaboration-mode') {
|
||||
const mode = commandArgs[++i]
|
||||
if (!mode) {
|
||||
throw new Error('Missing --collaboration-mode value')
|
||||
}
|
||||
options.collaborationMode = parseCollaborationMode(mode)
|
||||
} else {
|
||||
unknownArgs.push(arg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user