| 192 | }; |
| 193 | |
| 194 | function createInitialAppState(input: KimiTUIStartupInput): AppState { |
| 195 | const startupPermission: PermissionMode = input.cliOptions.auto |
| 196 | ? 'auto' |
| 197 | : input.cliOptions.yolo |
| 198 | ? 'yolo' |
| 199 | : 'manual'; |
| 200 | return { |
| 201 | model: '', |
| 202 | workDir: input.workDir, |
| 203 | additionalDirs: [...(input.additionalDirs ?? [])], |
| 204 | sessionId: '', |
| 205 | permissionMode: startupPermission, |
| 206 | planMode: input.cliOptions.plan, |
| 207 | inputMode: 'prompt', |
| 208 | swarmMode: false, |
| 209 | thinkingEffort: 'off', |
| 210 | contextUsage: 0, |
| 211 | contextTokens: 0, |
| 212 | maxContextTokens: 0, |
| 213 | isCompacting: false, |
| 214 | isReplaying: false, |
| 215 | streamingPhase: 'idle', |
| 216 | streamingStartTime: 0, |
| 217 | theme: input.tuiConfig.theme, |
| 218 | version: input.version, |
| 219 | editorCommand: input.tuiConfig.editorCommand, |
| 220 | disablePasteBurst: input.tuiConfig.disablePasteBurst, |
| 221 | notifications: input.tuiConfig.notifications, |
| 222 | upgrade: input.tuiConfig.upgrade, |
| 223 | availableModels: {}, |
| 224 | availableProviders: {}, |
| 225 | sessionTitle: null, |
| 226 | goal: null, |
| 227 | mcpServersSummary: null, |
| 228 | banner: undefined, |
| 229 | }; |
| 230 | } |
| 231 | |
| 232 | interface SendMessageOptions { |
| 233 | readonly parts?: readonly PromptPart[]; |