kanna-code 0.41.6 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  export const STORE_VERSION = 2 as const
2
2
  export const PROTOCOL_VERSION = 1 as const
3
3
 
4
- export type AgentProvider = "claude" | "codex"
4
+ export type AgentProvider = "claude" | "codex" | "cursor"
5
5
  export type LlmProviderKind = "openai" | "openrouter" | "custom"
6
6
  export type AppThemePreference = "light" | "dark" | "system"
7
7
  export type ChatSoundPreference = "never" | "unfocused" | "always"
@@ -137,6 +137,9 @@ export interface ProviderModelOption {
137
137
  label: string
138
138
  supportsEffort: boolean
139
139
  aliases?: readonly string[]
140
+ supportedReasoningEfforts?: readonly CodexReasoningEffortOption[]
141
+ defaultReasoningEffort?: CodexReasoningEffort
142
+ supportsFastMode?: boolean
140
143
  contextWindowOptions?: readonly ProviderContextWindowOption[]
141
144
  supportsMaxReasoningEffort?: boolean
142
145
  }
@@ -144,6 +147,13 @@ export interface ProviderModelOption {
144
147
  export interface ProviderEffortOption {
145
148
  id: string
146
149
  label: string
150
+ description?: string
151
+ }
152
+
153
+ export type CodexReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra"
154
+
155
+ export interface CodexReasoningEffortOption extends ProviderEffortOption {
156
+ id: CodexReasoningEffort
147
157
  }
148
158
 
149
159
  export interface ProviderContextWindowOption {
@@ -159,15 +169,19 @@ export const CLAUDE_REASONING_OPTIONS = [
159
169
  ] as const satisfies readonly ProviderEffortOption[]
160
170
 
161
171
  export const CODEX_REASONING_OPTIONS = [
162
- { id: "minimal", label: "Minimal" },
163
172
  { id: "low", label: "Low" },
164
173
  { id: "medium", label: "Medium" },
165
174
  { id: "high", label: "High" },
166
- { id: "xhigh", label: "XHigh" },
167
- ] as const satisfies readonly ProviderEffortOption[]
175
+ { id: "xhigh", label: "Extra High" },
176
+ { id: "max", label: "Max" },
177
+ {
178
+ id: "ultra",
179
+ label: "Ultra",
180
+ description: "Uses subagents to delegate parts of complex tasks",
181
+ },
182
+ ] as const satisfies readonly CodexReasoningEffortOption[]
168
183
 
169
184
  export type ClaudeReasoningEffort = (typeof CLAUDE_REASONING_OPTIONS)[number]["id"]
170
- export type CodexReasoningEffort = (typeof CODEX_REASONING_OPTIONS)[number]["id"]
171
185
  export type ClaudeContextWindow = "200k" | "1m"
172
186
  export type ServiceTier = "fast"
173
187
 
@@ -181,9 +195,14 @@ export interface CodexModelOptions {
181
195
  fastMode: boolean
182
196
  }
183
197
 
198
+ export interface CursorModelOptions {
199
+ fastMode: boolean
200
+ }
201
+
184
202
  export interface ProviderModelOptionsByProvider {
185
203
  claude: ClaudeModelOptions
186
204
  codex: CodexModelOptions
205
+ cursor: CursorModelOptions
187
206
  }
188
207
 
189
208
  export interface ProviderPreference<TModelOptions> {
@@ -195,6 +214,7 @@ export interface ProviderPreference<TModelOptions> {
195
214
  export type ChatProviderPreferences = {
196
215
  claude: ProviderPreference<ClaudeModelOptions>
197
216
  codex: ProviderPreference<CodexModelOptions>
217
+ cursor: ProviderPreference<CursorModelOptions>
198
218
  }
199
219
 
200
220
  export type ModelOptions = Partial<{
@@ -207,18 +227,30 @@ export const DEFAULT_CLAUDE_MODEL_OPTIONS = {
207
227
  } as const satisfies ClaudeModelOptions
208
228
 
209
229
  export const DEFAULT_CODEX_MODEL_OPTIONS = {
210
- reasoningEffort: "high",
230
+ reasoningEffort: "medium",
211
231
  fastMode: false,
212
232
  } as const satisfies CodexModelOptions
213
233
 
234
+ export const DEFAULT_CURSOR_MODEL_OPTIONS = {
235
+ fastMode: false,
236
+ } as const satisfies CursorModelOptions
237
+
214
238
  export function isClaudeReasoningEffort(value: unknown): value is ClaudeReasoningEffort {
215
239
  return CLAUDE_REASONING_OPTIONS.some((option) => option.id === value)
216
240
  }
217
241
 
218
242
  export function isCodexReasoningEffort(value: unknown): value is CodexReasoningEffort {
219
- return CODEX_REASONING_OPTIONS.some((option) => option.id === value)
243
+ return value === "minimal" || CODEX_REASONING_OPTIONS.some((option) => option.id === value)
220
244
  }
221
245
 
246
+ const LEGACY_CODEX_REASONING_OPTIONS = [
247
+ { id: "minimal", label: "Minimal" },
248
+ ...CODEX_REASONING_OPTIONS.filter((option) => option.id !== "max" && option.id !== "ultra"),
249
+ ] as const satisfies readonly ProviderEffortOption[]
250
+
251
+ const GPT_5_6_REASONING_OPTIONS = [...CODEX_REASONING_OPTIONS]
252
+ const GPT_5_6_LUNA_REASONING_OPTIONS = CODEX_REASONING_OPTIONS.filter((option) => option.id !== "ultra")
253
+
222
254
  export const CLAUDE_CONTEXT_WINDOW_OPTIONS = [
223
255
  { id: "200k", label: "200k" },
224
256
  { id: "1m", label: "1M" },
@@ -288,13 +320,78 @@ export const PROVIDERS: ProviderCatalogEntry[] = [
288
320
  {
289
321
  id: "codex",
290
322
  label: "Codex",
291
- defaultModel: "gpt-5.5",
323
+ defaultModel: "gpt-5.6-sol",
324
+ defaultEffort: "medium",
292
325
  supportsPlanMode: true,
293
326
  models: [
294
- { id: "gpt-5.5", label: "GPT-5.5", supportsEffort: false },
295
- { id: "gpt-5.4", label: "GPT-5.4", supportsEffort: false },
296
- { id: "gpt-5.3-codex", label: "GPT-5.3 Codex", supportsEffort: false, aliases: ["gpt-5-codex"] },
297
- { id: "gpt-5.3-codex-spark", label: "GPT-5.3 Codex Spark", supportsEffort: false },
327
+ {
328
+ id: "gpt-5.6-sol",
329
+ label: "GPT-5.6 Sol",
330
+ supportsEffort: true,
331
+ aliases: ["gpt-5.6"],
332
+ supportedReasoningEfforts: GPT_5_6_REASONING_OPTIONS,
333
+ defaultReasoningEffort: "medium",
334
+ supportsFastMode: true,
335
+ },
336
+ {
337
+ id: "gpt-5.6-terra",
338
+ label: "GPT-5.6 Terra",
339
+ supportsEffort: true,
340
+ supportedReasoningEfforts: GPT_5_6_REASONING_OPTIONS,
341
+ defaultReasoningEffort: "medium",
342
+ supportsFastMode: true,
343
+ },
344
+ {
345
+ id: "gpt-5.6-luna",
346
+ label: "GPT-5.6 Luna",
347
+ supportsEffort: true,
348
+ supportedReasoningEfforts: GPT_5_6_LUNA_REASONING_OPTIONS,
349
+ defaultReasoningEffort: "medium",
350
+ supportsFastMode: true,
351
+ },
352
+ {
353
+ id: "gpt-5.5",
354
+ label: "GPT-5.5",
355
+ supportsEffort: true,
356
+ supportedReasoningEfforts: LEGACY_CODEX_REASONING_OPTIONS,
357
+ defaultReasoningEffort: "medium",
358
+ supportsFastMode: true,
359
+ },
360
+ {
361
+ id: "gpt-5.4",
362
+ label: "GPT-5.4",
363
+ supportsEffort: true,
364
+ supportedReasoningEfforts: LEGACY_CODEX_REASONING_OPTIONS,
365
+ defaultReasoningEffort: "medium",
366
+ supportsFastMode: true,
367
+ },
368
+ {
369
+ id: "gpt-5.3-codex",
370
+ label: "GPT-5.3 Codex",
371
+ supportsEffort: true,
372
+ aliases: ["gpt-5-codex"],
373
+ supportedReasoningEfforts: LEGACY_CODEX_REASONING_OPTIONS,
374
+ defaultReasoningEffort: "high",
375
+ supportsFastMode: true,
376
+ },
377
+ {
378
+ id: "gpt-5.3-codex-spark",
379
+ label: "GPT-5.3 Codex Spark",
380
+ supportsEffort: true,
381
+ supportedReasoningEfforts: LEGACY_CODEX_REASONING_OPTIONS,
382
+ defaultReasoningEffort: "high",
383
+ supportsFastMode: false,
384
+ },
385
+ ],
386
+ efforts: [...CODEX_REASONING_OPTIONS],
387
+ },
388
+ {
389
+ id: "cursor",
390
+ label: "Cursor",
391
+ defaultModel: "composer-2.5",
392
+ supportsPlanMode: false,
393
+ models: [
394
+ { id: "composer-2.5", label: "Composer 2.5", supportsEffort: false },
298
395
  ],
299
396
  efforts: [],
300
397
  },
@@ -330,10 +427,14 @@ export function normalizeClaudeModelId(modelId?: string, fallbackModelId = "clau
330
427
  return normalizeProviderModelId("claude", modelId, fallbackModelId)
331
428
  }
332
429
 
333
- export function normalizeCodexModelId(modelId?: string, fallbackModelId = "gpt-5.5"): string {
430
+ export function normalizeCodexModelId(modelId?: string, fallbackModelId = "gpt-5.6-sol"): string {
334
431
  return normalizeProviderModelId("codex", modelId, fallbackModelId)
335
432
  }
336
433
 
434
+ export function normalizeCursorModelId(modelId?: string, fallbackModelId = "composer-2.5"): string {
435
+ return normalizeProviderModelId("cursor", modelId, fallbackModelId)
436
+ }
437
+
337
438
  export function getProviderModelOption(provider: AgentProvider, modelId: string): ProviderModelOption | undefined {
338
439
  const normalizedModelId = normalizeProviderModelId(provider, modelId)
339
440
  return getProviderCatalog(provider).models.find((candidate) => candidate.id === normalizedModelId)
@@ -343,6 +444,35 @@ export function getClaudeModelOption(modelId: string): ProviderModelOption | und
343
444
  return getProviderModelOption("claude", modelId)
344
445
  }
345
446
 
447
+ export function getCodexModelOption(modelId: string): ProviderModelOption | undefined {
448
+ return getProviderModelOption("codex", modelId)
449
+ }
450
+
451
+ export function getCodexReasoningOptions(modelId: string): readonly CodexReasoningEffortOption[] {
452
+ return getCodexModelOption(modelId)?.supportedReasoningEfforts ?? CODEX_REASONING_OPTIONS
453
+ }
454
+
455
+ export function normalizeCodexReasoningEffort(
456
+ modelId: string,
457
+ effort?: unknown,
458
+ ): CodexReasoningEffort {
459
+ const normalizedModel = normalizeCodexModelId(modelId)
460
+ const model = getCodexModelOption(normalizedModel)
461
+ const supported = model?.supportedReasoningEfforts ?? CODEX_REASONING_OPTIONS
462
+
463
+ if (effort === "minimal" && normalizedModel.startsWith("gpt-5.6-")) {
464
+ return "low"
465
+ }
466
+ if (effort === "ultra" && normalizedModel === "gpt-5.6-luna") {
467
+ return "max"
468
+ }
469
+ if (isCodexReasoningEffort(effort) && supported.some((option) => option.id === effort)) {
470
+ return effort
471
+ }
472
+
473
+ return model?.defaultReasoningEffort ?? DEFAULT_CODEX_MODEL_OPTIONS.reasoningEffort
474
+ }
475
+
346
476
  export function supportsClaudeMaxReasoningEffort(modelId: string): boolean {
347
477
  return Boolean(getClaudeModelOption(modelId)?.supportsMaxReasoningEffort)
348
478
  }
@@ -466,8 +596,13 @@ export interface AppSettingsPatch {
466
596
  editor?: Partial<AppSettingsSnapshot["editor"]>
467
597
  defaultProvider?: DefaultProviderPreference
468
598
  providerDefaults?: {
469
- claude?: Partial<ProviderPreference<ClaudeModelOptions>>
470
- codex?: Partial<ProviderPreference<CodexModelOptions>>
599
+ claude?: Partial<Omit<ProviderPreference<ClaudeModelOptions>, "modelOptions">> & {
600
+ modelOptions?: Partial<ClaudeModelOptions>
601
+ }
602
+ codex?: Partial<Omit<ProviderPreference<CodexModelOptions>, "modelOptions">> & {
603
+ modelOptions?: Partial<CodexModelOptions>
604
+ }
605
+ cursor?: Partial<ProviderPreference<CursorModelOptions>>
471
606
  }
472
607
  }
473
608