@myrialabs/clopen 0.4.20 → 0.4.21

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 (38) hide show
  1. package/backend/bootstrap.ts +39 -0
  2. package/backend/chat/stream-manager.ts +15 -0
  3. package/backend/database/migrations/065_add_session_reasoning_effort.ts +28 -0
  4. package/backend/database/migrations/index.ts +7 -0
  5. package/backend/database/queries/session-queries.ts +10 -0
  6. package/backend/engine/adapters/claude/models.ts +46 -23
  7. package/backend/engine/adapters/claude/stream.ts +18 -4
  8. package/backend/engine/adapters/codex/models.ts +19 -2
  9. package/backend/engine/adapters/codex/stream.ts +10 -3
  10. package/backend/engine/adapters/copilot/models.ts +20 -1
  11. package/backend/engine/adapters/copilot/stream.ts +11 -1
  12. package/backend/engine/adapters/cursor/models.ts +27 -3
  13. package/backend/engine/adapters/cursor/stream.ts +23 -3
  14. package/backend/engine/adapters/pi/models.ts +20 -2
  15. package/backend/engine/adapters/pi/stream.ts +6 -3
  16. package/backend/engine/bootstrap-default-engine.ts +18 -5
  17. package/backend/engine/types.ts +6 -0
  18. package/backend/index.ts +6 -9
  19. package/backend/ws/chat/stream.ts +38 -2
  20. package/backend/ws/system/device-info.ts +290 -0
  21. package/backend/ws/system/index.ts +2 -0
  22. package/backend/ws/system/operations.ts +7 -0
  23. package/backend/ws/user/crud.ts +6 -3
  24. package/dist/assets/{index-DdrcY5TE.js → index-B8YRz8wG.js} +1 -1
  25. package/dist/assets/{index-BqBxKeAv.js → index-CEGW8vEt.js} +1 -1
  26. package/dist/assets/main-D-2ByODy.js +590 -0
  27. package/dist/assets/main-D8I0MfRQ.css +1 -0
  28. package/dist/index.html +2 -2
  29. package/package.json +2 -1
  30. package/shared/constants/engines.ts +23 -0
  31. package/shared/types/database/schema.ts +1 -0
  32. package/shared/types/stores/settings.ts +6 -0
  33. package/shared/types/unified/engine.ts +33 -0
  34. package/shared/types/unified/index.ts +2 -0
  35. package/shared/types/unified/message.ts +6 -0
  36. package/shared/types/unified/stream.ts +6 -0
  37. package/dist/assets/main-BBxAj17T.js +0 -582
  38. package/dist/assets/main-Cry3pLcl.css +0 -1
@@ -30,6 +30,7 @@ export interface ChatSession {
30
30
  account_id?: number; // Engine account used for this session
31
31
  account_name?: string; // Display name of the selected account
32
32
  profile_id?: number | null; // Active Profile bundle for this session (null = use project default / none)
33
+ reasoning_effort?: string | null; // Reasoning/thinking level token (native per engine; null = engine default)
33
34
 
34
35
  // ── HEAD state (re-derived when HEAD changes: undo/redo/restore/branch) ──
35
36
  head_message_id?: string; // Git-like HEAD pointer to current branch tip
@@ -71,6 +71,12 @@ export interface AppSettings {
71
71
  artifactGenerator?: ArtifactGeneratorSettings;
72
72
  /** Pinned model IDs — shown at top of provider group in model picker */
73
73
  pinnedModels: string[];
74
+ /**
75
+ * Per-model reasoning/thinking level defaults, keyed by model id. Stores the
76
+ * native level token (e.g. 'high'). Seeds new sessions and remembers the last
77
+ * level chosen per model. Absent key → use the engine/model default.
78
+ */
79
+ reasoningDefaults: Record<string, string>;
74
80
  }
75
81
 
76
82
  /** Authentication mode */
@@ -11,6 +11,33 @@ import type { MessageEngine } from './message';
11
11
  // Re-export EngineType from common (canonical source)
12
12
  export type { EngineType } from './common';
13
13
 
14
+ /**
15
+ * One selectable reasoning/thinking level for a model.
16
+ *
17
+ * `value` is the opaque wire token handed back to the engine adapter (usually a
18
+ * native SDK level like `'medium'` or `'high'`; for Cursor it encodes the
19
+ * model-parameter id as `"<paramId>::<value>"` so the adapter can rebuild a
20
+ * `ModelSelection.params` entry). `label` is the human-facing text.
21
+ */
22
+ export interface ReasoningOption {
23
+ value: string;
24
+ label: string;
25
+ }
26
+
27
+ /**
28
+ * Per-model reasoning/thinking-effort control. Present ONLY on models whose
29
+ * engine exposes a runtime knob (Claude `effort`/`thinking`, Codex
30
+ * `modelReasoningEffort`, Pi `thinkingLevel`, Copilot `reasoningEffort`, Cursor
31
+ * model params). Absent → the UI hides the selector and the engine's own
32
+ * default applies. Levels are native per engine (no cross-engine normalization).
33
+ */
34
+ export interface ReasoningControl {
35
+ /** Selectable levels, ordered low → high. */
36
+ levels: ReasoningOption[];
37
+ /** The value applied when the user hasn't chosen one (mirrors the engine default). */
38
+ default: string;
39
+ }
40
+
14
41
  // Engine model definition
15
42
  export interface EngineModel {
16
43
  engine: MessageEngine;
@@ -41,6 +68,12 @@ export interface EngineModel {
41
68
  reasoning: boolean;
42
69
  tools: boolean;
43
70
  structuredOutput: boolean;
71
+ /**
72
+ * Runtime reasoning-effort control for this model, when the engine exposes
73
+ * one. Undefined → no selector (engine default applies). See
74
+ * {@link ReasoningControl}.
75
+ */
76
+ reasoningControl?: ReasoningControl;
44
77
  /**
45
78
  * Auth modes the model is compatible with. Models that require a
46
79
  * ChatGPT (OAuth) login are flagged `'chatgpt'`; models that only
@@ -21,6 +21,8 @@ export type {
21
21
  export type {
22
22
  EngineModel,
23
23
  EngineInfo,
24
+ ReasoningOption,
25
+ ReasoningControl,
24
26
  QwenProviderPresetId,
25
27
  QwenProviderPreset,
26
28
  PiAuthMode,
@@ -43,6 +43,12 @@ export interface MessageEngine {
43
43
  provider: string;
44
44
  model: MessageModel;
45
45
  account: MessageAccount;
46
+ /**
47
+ * Reasoning/thinking level applied to this turn (native per engine — see
48
+ * `EngineModel.capabilities.reasoningControl`). Present only when the
49
+ * engine/model exposes a reasoning knob; absent for engines/models without one.
50
+ */
51
+ reasoningEffort?: string | null;
46
52
  }
47
53
 
48
54
  /** Common fields present on every message */
@@ -176,6 +176,12 @@ export interface StreamRequest {
176
176
  prompt: UserMessage;
177
177
  engine: MessageEngine;
178
178
  sender: MessageSender;
179
+ /**
180
+ * Reasoning/thinking level token chosen for this session (native per engine).
181
+ * `null`/absent → the engine's own default applies. Persisted to
182
+ * `chat_sessions.reasoning_effort` like engine/model.
183
+ */
184
+ reasoningEffort?: string | null;
179
185
  /**
180
186
  * Active Profile chosen for this session (bundle of Skills/Commands/Subagents/
181
187
  * MCP/Permissions). `null` = explicit "no profile"; `undefined` = client didn't