@myrialabs/clopen 0.4.45 → 0.4.47

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.
Files changed (73) hide show
  1. package/backend/artifacts/project/sources.ts +2 -2
  2. package/backend/engine/adapters/claude/models.test.ts +49 -0
  3. package/backend/engine/adapters/claude/models.ts +81 -562
  4. package/backend/engine/adapters/claude/stream.ts +5 -4
  5. package/backend/engine/adapters/cline/credential.ts +42 -18
  6. package/backend/engine/adapters/cline/message-converter.ts +31 -1
  7. package/backend/engine/adapters/cline/models.test.ts +77 -0
  8. package/backend/engine/adapters/cline/models.ts +89 -3
  9. package/backend/engine/adapters/cline/presets.ts +5 -0
  10. package/backend/engine/adapters/cline/stream.ts +9 -2
  11. package/backend/engine/adapters/codex/message-converter.ts +1 -1
  12. package/backend/engine/adapters/codex/models.ts +54 -31
  13. package/backend/engine/adapters/codex/patch-rollout.test.ts +36 -1
  14. package/backend/engine/adapters/codex/patch-rollout.ts +60 -29
  15. package/backend/engine/adapters/codex/session-fork.ts +5 -0
  16. package/backend/engine/adapters/codex/stream.ts +8 -7
  17. package/backend/engine/adapters/copilot/models.test.ts +40 -0
  18. package/backend/engine/adapters/copilot/models.ts +51 -24
  19. package/backend/engine/adapters/copilot/permissions.test.ts +47 -0
  20. package/backend/engine/adapters/copilot/permissions.ts +72 -0
  21. package/backend/engine/adapters/copilot/stream.ts +77 -67
  22. package/backend/engine/adapters/cursor/stream.ts +8 -4
  23. package/backend/engine/adapters/opencode/presets.ts +27 -2
  24. package/backend/engine/adapters/opencode/server.ts +6 -4
  25. package/backend/engine/adapters/pi/credential.test.ts +83 -0
  26. package/backend/engine/adapters/pi/credential.ts +68 -12
  27. package/backend/engine/adapters/pi/environment.ts +9 -5
  28. package/backend/engine/adapters/pi/mcp.test.ts +194 -0
  29. package/backend/engine/adapters/pi/mcp.ts +88 -0
  30. package/backend/engine/adapters/pi/message-converter.ts +6 -4
  31. package/backend/engine/adapters/pi/presets.ts +10 -5
  32. package/backend/engine/adapters/pi/stream.ts +42 -38
  33. package/backend/engine/adapters/qwen/environment.ts +39 -2
  34. package/backend/engine/adapters/qwen/message-converter.test.ts +64 -0
  35. package/backend/engine/adapters/qwen/message-converter.ts +40 -23
  36. package/backend/engine/adapters/qwen/models.test.ts +25 -0
  37. package/backend/engine/adapters/qwen/models.ts +42 -5
  38. package/backend/engine/adapters/qwen/session-store.test.ts +39 -0
  39. package/backend/engine/adapters/qwen/session-store.ts +66 -0
  40. package/backend/engine/adapters/qwen/stream.ts +110 -87
  41. package/backend/engine/docs/adapter-contract.md +7 -4
  42. package/backend/engine/docs/lessons-learned.md +405 -62
  43. package/backend/engine/docs/quick-reference.md +2 -2
  44. package/backend/engine/docs/stack.md +17 -4
  45. package/backend/engine/docs/websocket-routes.md +5 -5
  46. package/backend/engine/install-recipes.test.ts +105 -5
  47. package/backend/engine/install-recipes.ts +102 -42
  48. package/backend/engine/install-runner.ts +56 -2
  49. package/backend/engine/stack-project.ts +71 -1
  50. package/backend/index.ts +5 -0
  51. package/backend/mcp/README.md +2 -2
  52. package/backend/mcp/external/config.ts +18 -0
  53. package/backend/mcp/external/proxy.ts +2 -2
  54. package/backend/mcp/index.ts +8 -0
  55. package/backend/mcp/internal/config.ts +42 -3
  56. package/backend/memory/embedding/install.ts +29 -1
  57. package/backend/utils/keyed-lock.test.ts +33 -0
  58. package/backend/utils/keyed-lock.ts +17 -0
  59. package/backend/utils/port-utils.test.ts +29 -0
  60. package/backend/utils/port-utils.ts +19 -0
  61. package/backend/ws/engine/cline/accounts.ts +26 -6
  62. package/backend/ws/engine/codex/accounts.test.ts +49 -0
  63. package/backend/ws/engine/codex/accounts.ts +17 -13
  64. package/backend/ws/engine/opencode/providers.ts +2 -1
  65. package/backend/ws/engine/pi/accounts.ts +61 -6
  66. package/dist/assets/{index-D-Ad1N96.js → index-BTcR1byF.js} +1 -1
  67. package/dist/assets/{index-Am-rJRxA.js → index-CwuKQelV.js} +1 -1
  68. package/dist/assets/{main--PLCDxSy.css → main-BiDNMWb3.css} +1 -1
  69. package/dist/assets/{main-DelPm2Xt.js → main-BlhKWz2B.js} +595 -593
  70. package/dist/index.html +2 -2
  71. package/package.json +19 -15
  72. package/backend/engine/adapters/pi/mcp-tools.ts +0 -153
  73. package/backend/engine/adapters/qwen/session-fork.ts +0 -109
@@ -7,7 +7,16 @@
7
7
  *
8
8
  * Only models with `Current state: Active` on
9
9
  * https://platform.claude.com/docs/en/about-claude/model-deprecations are
10
- * listed here — deprecated/retired models are dropped.
10
+ * listed here, and of those only the ones whose retirement is not imminent —
11
+ * deprecated, retired and about-to-retire models are dropped, never listed as
12
+ * legacy.
13
+ *
14
+ * The bundled CLI decides what a model can actually do: the pinned SDK ships
15
+ * the CLI binary, and that binary carries its own model table (capabilities
16
+ * `effort`, `xhigh_effort`, `adaptive_thinking`, `rejects_disabled_thinking`).
17
+ * A slug the CLI does not know fails at runtime, and a reasoning level the
18
+ * model does not support is silently rewritten — so both the slugs and the
19
+ * per-model levels below are taken from that table (CLI 2.1.296).
11
20
  */
12
21
 
13
22
  import type { EngineModel, ReasoningControl } from '$shared/types/unified';
@@ -16,579 +25,89 @@ import { toReasoningOptions } from '$shared/constants/engines';
16
25
  /**
17
26
  * Claude's reasoning knob is the Agent SDK `effort` option plus `thinking`.
18
27
  * `off` disables thinking; `auto` is adaptive thinking (Claude decides — the
19
- * historical default); the rest are the SDK's native `EffortLevel` values
20
- * (`low | medium | high | xhigh | max`, silently downgraded on models that
21
- * don't support the higher tiers). Uniform across the catalog; the stream
22
- * adapter translates the chosen token.
28
+ * historical default); the rest are the SDK's native `EffortLevel` values.
29
+ * The stream adapter translates the chosen token.
30
+ *
31
+ * Levels are per-model because the CLI rewrites what a model cannot take
32
+ * instead of failing: `off` becomes adaptive thinking on models that reject
33
+ * disabled thinking, `effort` is dropped on models without it, and `xhigh`
34
+ * only exists from Opus 4.7 on. Offering those levels anyway put options in
35
+ * the picker that did nothing.
23
36
  */
24
- const CLAUDE_REASONING_CONTROL: ReasoningControl = {
25
- levels: toReasoningOptions(['off', 'auto', 'low', 'medium', 'high', 'xhigh', 'max']),
26
- default: 'auto',
27
- };
37
+ const ALWAYS_THINKING = ['auto', 'low', 'medium', 'high', 'xhigh', 'max'];
38
+ const FULL_EFFORT = ['off', ...ALWAYS_THINKING];
39
+ const EFFORT_TO_MAX = ['off', 'auto', 'low', 'medium', 'high', 'max'];
40
+ const THINKING_ONLY = ['off', 'auto'];
28
41
 
29
- const CLAUDE_CODE_MODELS_BASE: EngineModel[] = [
30
- {
31
- engine: {
32
- type: 'claude-code',
33
- provider: 'anthropic',
34
- model: {
35
- id: 'claude-fable-5-1',
36
- name: 'Claude Fable 5.1',
37
- },
38
- account: {
39
- id: 0,
40
- name: '',
41
- },
42
- },
43
- limit: {
44
- input: 1_000_000,
45
- output: 128_000,
46
- },
47
- modalities: {
48
- input: {
49
- text: true,
50
- image: true,
51
- audio: false,
52
- video: false,
53
- pdf: true,
54
- },
55
- output: {
56
- text: true,
57
- image: false,
58
- audio: false,
59
- video: false,
60
- pdf: false,
61
- },
62
- },
63
- capabilities: {
64
- reasoning: true,
65
- tools: true,
66
- structuredOutput: true,
67
- },
68
- cost: {
69
- input: 10,
70
- output: 50,
71
- },
72
- },
73
- {
74
- engine: {
75
- type: 'claude-code',
76
- provider: 'anthropic',
77
- model: {
78
- id: 'claude-opus-5-5',
79
- name: 'Claude Opus 5.5',
80
- },
81
- account: {
82
- id: 0,
83
- name: '',
84
- },
85
- },
86
- limit: {
87
- input: 1_000_000,
88
- output: 128_000,
89
- },
90
- modalities: {
91
- input: {
92
- text: true,
93
- image: true,
94
- audio: false,
95
- video: false,
96
- pdf: true,
97
- },
98
- output: {
99
- text: true,
100
- image: false,
101
- audio: false,
102
- video: false,
103
- pdf: false,
104
- },
105
- },
106
- capabilities: {
107
- reasoning: true,
108
- tools: true,
109
- structuredOutput: true,
110
- },
111
- cost: {
112
- input: 4,
113
- output: 20,
114
- },
115
- },
116
- {
117
- engine: {
118
- type: 'claude-code',
119
- provider: 'anthropic',
120
- model: {
121
- id: 'claude-sonnet-5-5',
122
- name: 'Claude Sonnet 5.5',
123
- },
124
- account: {
125
- id: 0,
126
- name: '',
127
- },
128
- },
129
- limit: {
130
- input: 1_000_000,
131
- output: 128_000,
132
- },
133
- modalities: {
134
- input: {
135
- text: true,
136
- image: true,
137
- audio: false,
138
- video: false,
139
- pdf: true,
140
- },
141
- output: {
142
- text: true,
143
- image: false,
144
- audio: false,
145
- video: false,
146
- pdf: false,
147
- },
148
- },
149
- capabilities: {
150
- reasoning: true,
151
- tools: true,
152
- structuredOutput: true,
153
- },
154
- cost: {
155
- input: 2,
156
- output: 10,
157
- },
158
- },
159
- {
160
- engine: {
161
- type: 'claude-code',
162
- provider: 'anthropic',
163
- model: {
164
- id: 'claude-haiku-4-5',
165
- name: 'Claude Haiku 4.5',
166
- },
167
- account: {
168
- id: 0,
169
- name: '',
170
- },
171
- },
172
- limit: {
173
- input: 200_000,
174
- output: 64_000,
175
- },
176
- modalities: {
177
- input: {
178
- text: true,
179
- image: true,
180
- audio: false,
181
- video: false,
182
- pdf: true,
183
- },
184
- output: {
185
- text: true,
186
- image: false,
187
- audio: false,
188
- video: false,
189
- pdf: false,
190
- },
191
- },
192
- capabilities: {
193
- reasoning: true,
194
- tools: true,
195
- structuredOutput: true,
196
- },
197
- cost: {
198
- input: 1,
199
- output: 5,
200
- },
201
- },
202
- {
203
- engine: {
204
- type: 'claude-code',
205
- provider: 'anthropic',
206
- model: {
207
- id: 'claude-fable-5',
208
- name: 'Claude Fable 5',
209
- },
210
- account: {
211
- id: 0,
212
- name: '',
213
- },
214
- },
215
- limit: {
216
- input: 1_000_000,
217
- output: 128_000,
218
- },
219
- modalities: {
220
- input: {
221
- text: true,
222
- image: true,
223
- audio: false,
224
- video: false,
225
- pdf: true,
226
- },
227
- output: {
228
- text: true,
229
- image: false,
230
- audio: false,
231
- video: false,
232
- pdf: false,
233
- },
234
- },
235
- capabilities: {
236
- reasoning: true,
237
- tools: true,
238
- structuredOutput: true,
239
- },
240
- cost: {
241
- input: 10,
242
- output: 50,
243
- },
244
- },
245
- {
246
- engine: {
247
- type: 'claude-code',
248
- provider: 'anthropic',
249
- model: {
250
- id: 'claude-opus-5',
251
- name: 'Claude Opus 5',
252
- },
253
- account: {
254
- id: 0,
255
- name: '',
256
- },
257
- },
258
- limit: {
259
- input: 1_000_000,
260
- output: 128_000,
261
- },
262
- modalities: {
263
- input: {
264
- text: true,
265
- image: true,
266
- audio: false,
267
- video: false,
268
- pdf: true,
269
- },
270
- output: {
271
- text: true,
272
- image: false,
273
- audio: false,
274
- video: false,
275
- pdf: false,
276
- },
277
- },
278
- capabilities: {
279
- reasoning: true,
280
- tools: true,
281
- structuredOutput: true,
282
- },
283
- cost: {
284
- input: 5,
285
- output: 25,
286
- },
287
- },
288
- {
289
- engine: {
290
- type: 'claude-code',
291
- provider: 'anthropic',
292
- model: {
293
- id: 'claude-sonnet-5',
294
- name: 'Claude Sonnet 5',
295
- },
296
- account: {
297
- id: 0,
298
- name: '',
299
- },
300
- },
301
- limit: {
302
- input: 1_000_000,
303
- output: 128_000,
304
- },
305
- modalities: {
306
- input: {
307
- text: true,
308
- image: true,
309
- audio: false,
310
- video: false,
311
- pdf: true,
312
- },
313
- output: {
314
- text: true,
315
- image: false,
316
- audio: false,
317
- video: false,
318
- pdf: false,
319
- },
320
- },
321
- capabilities: {
322
- reasoning: true,
323
- tools: true,
324
- structuredOutput: true,
325
- },
326
- cost: {
327
- input: 3,
328
- output: 15,
329
- },
330
- },
331
- {
332
- engine: {
333
- type: 'claude-code',
334
- provider: 'anthropic',
335
- model: {
336
- id: 'claude-opus-4-8',
337
- name: 'Claude Opus 4.8',
338
- },
339
- account: {
340
- id: 0,
341
- name: '',
342
- },
343
- },
344
- limit: {
345
- input: 1_000_000,
346
- output: 128_000,
347
- },
348
- modalities: {
349
- input: {
350
- text: true,
351
- image: true,
352
- audio: false,
353
- video: false,
354
- pdf: true,
355
- },
356
- output: {
357
- text: true,
358
- image: false,
359
- audio: false,
360
- video: false,
361
- pdf: false,
362
- },
363
- },
364
- capabilities: {
365
- reasoning: true,
366
- tools: true,
367
- structuredOutput: true,
368
- },
369
- cost: {
370
- input: 5,
371
- output: 25,
372
- },
373
- },
374
- {
375
- engine: {
376
- type: 'claude-code',
377
- provider: 'anthropic',
378
- model: {
379
- id: 'claude-opus-4-7',
380
- name: 'Claude Opus 4.7',
381
- },
382
- account: {
383
- id: 0,
384
- name: '',
385
- },
386
- },
387
- limit: {
388
- input: 1_000_000,
389
- output: 128_000,
390
- },
391
- modalities: {
392
- input: {
393
- text: true,
394
- image: true,
395
- audio: false,
396
- video: false,
397
- pdf: true,
398
- },
399
- output: {
400
- text: true,
401
- image: false,
402
- audio: false,
403
- video: false,
404
- pdf: false,
405
- },
406
- },
407
- capabilities: {
408
- reasoning: true,
409
- tools: true,
410
- structuredOutput: true,
411
- },
412
- cost: {
413
- input: 5,
414
- output: 25,
415
- },
416
- },
417
- {
418
- engine: {
419
- type: 'claude-code',
420
- provider: 'anthropic',
421
- model: {
422
- id: 'claude-opus-4-6',
423
- name: 'Claude Opus 4.6',
424
- },
425
- account: {
426
- id: 0,
427
- name: '',
428
- },
429
- },
430
- limit: {
431
- input: 1_000_000,
432
- output: 128_000,
433
- },
434
- modalities: {
435
- input: {
436
- text: true,
437
- image: true,
438
- audio: false,
439
- video: false,
440
- pdf: true,
441
- },
442
- output: {
443
- text: true,
444
- image: false,
445
- audio: false,
446
- video: false,
447
- pdf: false,
448
- },
449
- },
450
- capabilities: {
451
- reasoning: true,
452
- tools: true,
453
- structuredOutput: true,
454
- },
455
- cost: {
456
- input: 5,
457
- output: 25,
458
- },
459
- },
460
- {
461
- engine: {
462
- type: 'claude-code',
463
- provider: 'anthropic',
464
- model: {
465
- id: 'claude-sonnet-4-6',
466
- name: 'Claude Sonnet 4.6',
467
- },
468
- account: {
469
- id: 0,
470
- name: '',
471
- },
472
- },
473
- limit: {
474
- input: 1_000_000,
475
- output: 128_000,
476
- },
477
- modalities: {
478
- input: {
479
- text: true,
480
- image: true,
481
- audio: false,
482
- video: false,
483
- pdf: true,
484
- },
485
- output: {
486
- text: true,
487
- image: false,
488
- audio: false,
489
- video: false,
490
- pdf: false,
491
- },
492
- },
493
- capabilities: {
494
- reasoning: true,
495
- tools: true,
496
- structuredOutput: true,
497
- },
498
- cost: {
499
- input: 3,
500
- output: 15,
501
- },
502
- },
503
- {
504
- engine: {
505
- type: 'claude-code',
506
- provider: 'anthropic',
507
- model: {
508
- id: 'claude-opus-4-5',
509
- name: 'Claude Opus 4.5',
510
- },
511
- account: {
512
- id: 0,
513
- name: '',
514
- },
515
- },
516
- limit: {
517
- input: 200_000,
518
- output: 64_000,
519
- },
520
- modalities: {
521
- input: {
522
- text: true,
523
- image: true,
524
- audio: false,
525
- video: false,
526
- pdf: true,
527
- },
528
- output: {
529
- text: true,
530
- image: false,
531
- audio: false,
532
- video: false,
533
- pdf: false,
534
- },
535
- },
536
- capabilities: {
537
- reasoning: true,
538
- tools: true,
539
- structuredOutput: true,
540
- },
541
- cost: {
542
- input: 5,
543
- output: 25,
544
- },
545
- },
546
- {
42
+ function claudeReasoning(levels: string[]): ReasoningControl {
43
+ return { levels: toReasoningOptions(levels), default: 'auto' };
44
+ }
45
+
46
+ /** Shared shape for a Claude catalog entry; only id, limits, cost and reasoning vary. */
47
+ function claudeModel(
48
+ id: string,
49
+ name: string,
50
+ limit: { input: number; output: number },
51
+ cost: { input: number; output: number },
52
+ reasoningLevels: string[],
53
+ ): EngineModel {
54
+ return {
547
55
  engine: {
548
56
  type: 'claude-code',
549
57
  provider: 'anthropic',
550
- model: {
551
- id: 'claude-sonnet-4-5',
552
- name: 'Claude Sonnet 4.5',
553
- },
554
- account: {
555
- id: 0,
556
- name: '',
557
- },
558
- },
559
- limit: {
560
- input: 200_000,
561
- output: 64_000,
58
+ model: { id, name },
59
+ account: { id: 0, name: '' },
562
60
  },
61
+ limit,
563
62
  modalities: {
564
- input: {
565
- text: true,
566
- image: true,
567
- audio: false,
568
- video: false,
569
- pdf: true,
570
- },
571
- output: {
572
- text: true,
573
- image: false,
574
- audio: false,
575
- video: false,
576
- pdf: false,
577
- },
63
+ input: { text: true, image: true, audio: false, video: false, pdf: true },
64
+ output: { text: true, image: false, audio: false, video: false, pdf: false },
578
65
  },
579
66
  capabilities: {
580
67
  reasoning: true,
581
68
  tools: true,
582
69
  structuredOutput: true,
70
+ reasoningControl: claudeReasoning(reasoningLevels),
583
71
  },
584
- cost: {
585
- input: 3,
586
- output: 15,
587
- },
588
- },
72
+ cost,
73
+ };
74
+ }
75
+
76
+ const WINDOW_1M = { input: 1_000_000, output: 128_000 };
77
+ const WINDOW_200K = { input: 200_000, output: 64_000 };
78
+
79
+ /** Latest generation first, then legacy models newest to oldest. */
80
+ export const CLAUDE_CODE_MODELS: EngineModel[] = [
81
+ claudeModel('claude-fable-5-1', 'Claude Fable 5.1', WINDOW_1M, { input: 10, output: 50 }, ALWAYS_THINKING),
82
+ claudeModel('claude-opus-5-5', 'Claude Opus 5.5', WINDOW_1M, { input: 4, output: 20 }, ALWAYS_THINKING),
83
+ claudeModel('claude-sonnet-5-5', 'Claude Sonnet 5.5', WINDOW_1M, { input: 2, output: 10 }, ALWAYS_THINKING),
84
+ // Haiku 5.5 is priced in tiers: $0.50 / $2.50 once a prompt passes 100K
85
+ // tokens. Only the base tier is listed — the catalog cost is metadata, while
86
+ // the cost shown for a chat is the CLI's own, which applies the tiers.
87
+ claudeModel('claude-haiku-5-5', 'Claude Haiku 5.5', WINDOW_1M, { input: 0.1, output: 0.5 }, ALWAYS_THINKING),
88
+ claudeModel('claude-fable-5', 'Claude Fable 5', WINDOW_1M, { input: 10, output: 50 }, ALWAYS_THINKING),
89
+ claudeModel('claude-opus-5', 'Claude Opus 5', WINDOW_1M, { input: 5, output: 25 }, FULL_EFFORT),
90
+ claudeModel('claude-sonnet-5', 'Claude Sonnet 5', WINDOW_1M, { input: 3, output: 15 }, FULL_EFFORT),
91
+ claudeModel('claude-opus-4-8', 'Claude Opus 4.8', WINDOW_1M, { input: 5, output: 25 }, FULL_EFFORT),
92
+ claudeModel('claude-opus-4-7', 'Claude Opus 4.7', WINDOW_1M, { input: 5, output: 25 }, FULL_EFFORT),
93
+ claudeModel('claude-opus-4-6', 'Claude Opus 4.6', WINDOW_1M, { input: 5, output: 25 }, EFFORT_TO_MAX),
94
+ claudeModel('claude-sonnet-4-6', 'Claude Sonnet 4.6', WINDOW_1M, { input: 3, output: 15 }, EFFORT_TO_MAX),
95
+ claudeModel('claude-opus-4-5', 'Claude Opus 4.5', WINDOW_200K, { input: 5, output: 25 }, THINKING_ONLY),
589
96
  ];
590
97
 
591
- export const CLAUDE_CODE_MODELS: EngineModel[] = CLAUDE_CODE_MODELS_BASE.map((model) => ({
592
- ...model,
593
- capabilities: { ...model.capabilities, reasoningControl: CLAUDE_REASONING_CONTROL },
594
- }));
98
+ /**
99
+ * Resolve the reasoning level to send for a turn: the requested level when that
100
+ * model offers it, otherwise that model's own default.
101
+ *
102
+ * The picker only offers per-model levels, but a stored preference outlives a
103
+ * catalog change — an `off` saved before Opus 5.5 lost it must not reach the
104
+ * CLI, which would quietly run adaptive thinking under a label saying "Off".
105
+ * A model outside the catalog (an alias such as `haiku`) has no known levels,
106
+ * so its request passes through unchanged.
107
+ */
108
+ export function resolveClaudeReasoning(modelId: string | undefined, requested: string | undefined): string | undefined {
109
+ const control = CLAUDE_CODE_MODELS.find(m => m.engine.model.id === modelId)?.capabilities.reasoningControl;
110
+ if (!control || requested === undefined) return requested;
111
+ if (control.levels.some(level => level.value === requested)) return requested;
112
+ return control.default;
113
+ }
@@ -7,7 +7,7 @@
7
7
  * query() is the only session entry point. The alternative this comment used to
8
8
  * weigh — the @alpha v2 API (unstable_v2_createSession / unstable_v2_prompt) —
9
9
  * was removed upstream in 0.3.142, before the version Clopen pins, so there is
10
- * no migration pending. prewarm() (0.3.284, @alpha) parks a spare process to
10
+ * no migration pending. prewarm() (@alpha since 0.3.284) parks a spare process to
11
11
  * take start-up cost off the first message, but everything Clopen varies per
12
12
  * stream is frozen at prewarm time — mcpServers (whose tool handlers are bound
13
13
  * to the project), hooks, canUseTool, env (git identity) — so a spare is only
@@ -42,7 +42,7 @@ import { resolvePermissionsFromDb, isToolAllowed, hasAnyRestriction, syncPermiss
42
42
  import type { AIEngine, EngineQueryOptions } from '../../types';
43
43
  import { EngineRuns } from '../run-registry';
44
44
  import type { EngineModel } from '$shared/types/unified';
45
- import { CLAUDE_CODE_MODELS } from './models';
45
+ import { CLAUDE_CODE_MODELS, resolveClaudeReasoning } from './models';
46
46
 
47
47
  import { debug } from '$shared/utils/logger';
48
48
 
@@ -139,7 +139,6 @@ export class ClaudeCodeEngine implements AIEngine {
139
139
  resume,
140
140
  maxTurns = undefined,
141
141
  modelId,
142
- reasoningEffort,
143
142
  includePartialMessages = false,
144
143
  abortController,
145
144
  accountId
@@ -147,7 +146,9 @@ export class ClaudeCodeEngine implements AIEngine {
147
146
 
148
147
  // Map the chosen reasoning level to Claude's knobs: `off` disables thinking
149
148
  // entirely, `auto`/unset keeps adaptive thinking (Claude decides how much),
150
- // and an explicit effort level pairs adaptive thinking with `effort`.
149
+ // and an explicit effort level pairs adaptive thinking with `effort`. The
150
+ // level is first held to what this model offers (see models.ts).
151
+ const reasoningEffort = resolveClaudeReasoning(modelId, options.reasoningEffort);
151
152
  const claudeEffort = new Set<string>(['low', 'medium', 'high', 'xhigh', 'max']);
152
153
  const thinkingConfig: Options['thinking'] = reasoningEffort === 'off'
153
154
  ? { type: 'disabled' }