@myrialabs/clopen 0.4.15 → 0.4.16

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 (94) hide show
  1. package/backend/artifacts/matrix.ts +8 -0
  2. package/backend/artifacts/types.ts +2 -2
  3. package/backend/auth/permissions.ts +14 -0
  4. package/backend/chat/stream-manager.ts +5 -5
  5. package/backend/commands/detect.ts +1 -1
  6. package/backend/commands/sync.ts +1 -1
  7. package/backend/database/migrations/057_seed_pi_provider.ts +25 -0
  8. package/backend/database/migrations/058_seed_cline_provider.ts +25 -0
  9. package/backend/database/migrations/059_seed_cursor_provider.ts +25 -0
  10. package/backend/database/migrations/index.ts +21 -0
  11. package/backend/engine/README.md +36 -13
  12. package/backend/engine/adapters/cline/agent-tool.ts +64 -0
  13. package/backend/engine/adapters/cline/ask-question-tool.ts +105 -0
  14. package/backend/engine/adapters/cline/credential.ts +166 -0
  15. package/backend/engine/adapters/cline/error-handler.ts +49 -0
  16. package/backend/engine/adapters/cline/index.ts +1 -0
  17. package/backend/engine/adapters/cline/mcp-tools.ts +119 -0
  18. package/backend/engine/adapters/cline/message-converter.ts +396 -0
  19. package/backend/engine/adapters/cline/models.ts +73 -0
  20. package/backend/engine/adapters/cline/presets.ts +128 -0
  21. package/backend/engine/adapters/cline/stream.ts +413 -0
  22. package/backend/engine/adapters/codex/credential.ts +1 -1
  23. package/backend/engine/adapters/codex/message-converter.ts +4 -4
  24. package/backend/engine/adapters/codex/session-fork.ts +1 -1
  25. package/backend/engine/adapters/codex/stream.ts +3 -3
  26. package/backend/engine/adapters/copilot/stream.ts +1 -1
  27. package/backend/engine/adapters/cursor/ask-question-tool.ts +98 -0
  28. package/backend/engine/adapters/cursor/credential.ts +68 -0
  29. package/backend/engine/adapters/cursor/environment.ts +32 -0
  30. package/backend/engine/adapters/cursor/error-handler.ts +60 -0
  31. package/backend/engine/adapters/cursor/index.ts +1 -0
  32. package/backend/engine/adapters/cursor/message-converter.ts +615 -0
  33. package/backend/engine/adapters/cursor/models.ts +68 -0
  34. package/backend/engine/adapters/cursor/session-fork.ts +68 -0
  35. package/backend/engine/adapters/cursor/stream.ts +341 -0
  36. package/backend/engine/adapters/pi/agent-tool.ts +62 -0
  37. package/backend/engine/adapters/pi/ask-question-tool.ts +93 -0
  38. package/backend/engine/adapters/pi/credential.ts +137 -0
  39. package/backend/engine/adapters/pi/environment.ts +33 -0
  40. package/backend/engine/adapters/pi/error-handler.ts +46 -0
  41. package/backend/engine/adapters/pi/index.ts +1 -0
  42. package/backend/engine/adapters/pi/mcp-tools.ts +131 -0
  43. package/backend/engine/adapters/pi/message-converter.ts +446 -0
  44. package/backend/engine/adapters/pi/models.ts +53 -0
  45. package/backend/engine/adapters/pi/presets.ts +133 -0
  46. package/backend/engine/adapters/pi/session-fork.ts +46 -0
  47. package/backend/engine/adapters/pi/stream.ts +427 -0
  48. package/backend/engine/adapters/qwen/message-converter.ts +5 -5
  49. package/backend/engine/adapters/qwen/stream.ts +2 -2
  50. package/backend/engine/docs/adapter-contract.md +7 -2
  51. package/backend/engine/docs/adding-an-engine.md +70 -12
  52. package/backend/engine/docs/artifacts.md +124 -0
  53. package/backend/engine/docs/database.md +4 -4
  54. package/backend/engine/docs/frontend-and-chat.md +22 -4
  55. package/backend/engine/docs/lessons-learned.md +219 -32
  56. package/backend/engine/docs/quick-reference.md +18 -7
  57. package/backend/engine/docs/websocket-routes.md +2 -2
  58. package/backend/engine/index.ts +9 -0
  59. package/backend/mcp/README.md +3 -3
  60. package/backend/mcp/external/config.ts +11 -0
  61. package/backend/mcp/index.ts +8 -0
  62. package/backend/mcp/internal/config.ts +33 -1
  63. package/backend/permissions/service.ts +5 -2
  64. package/backend/skills/sync.ts +1 -1
  65. package/backend/subagents/detect.ts +1 -1
  66. package/backend/subagents/sync.ts +1 -1
  67. package/backend/ws/chat/stream.ts +1 -1
  68. package/backend/ws/engine/cline/accounts.ts +317 -0
  69. package/backend/ws/engine/cline/index.ts +15 -0
  70. package/backend/ws/engine/cline/presets.ts +36 -0
  71. package/backend/ws/engine/cline/status.ts +49 -0
  72. package/backend/ws/engine/codex/accounts.ts +1 -1
  73. package/backend/ws/engine/cursor/accounts.ts +162 -0
  74. package/backend/ws/engine/cursor/index.ts +13 -0
  75. package/backend/ws/engine/cursor/status.ts +55 -0
  76. package/backend/ws/engine/index.ts +6 -0
  77. package/backend/ws/engine/pi/accounts.ts +319 -0
  78. package/backend/ws/engine/pi/index.ts +15 -0
  79. package/backend/ws/engine/pi/presets.ts +34 -0
  80. package/backend/ws/engine/pi/status.ts +50 -0
  81. package/backend/ws/sessions/crud.ts +2 -2
  82. package/backend/ws/settings/crud.ts +2 -2
  83. package/dist/assets/{index-EunAFLxP.js → index-BPvctwJ2.js} +1 -1
  84. package/dist/assets/{index-ChF_jIXj.js → index-vLKZpWQH.js} +1 -1
  85. package/dist/assets/{main-CTs4NXwP.js → main-BtBZvCwv.js} +359 -357
  86. package/dist/assets/{main-moCAkEwm.css → main-D7ATW8pp.css} +1 -1
  87. package/dist/index.html +2 -2
  88. package/package.json +7 -1
  89. package/shared/constants/engine-tools.ts +16 -2
  90. package/shared/constants/engines.ts +27 -0
  91. package/shared/types/unified/common.ts +1 -1
  92. package/shared/types/unified/engine.ts +82 -1
  93. package/shared/types/unified/index.ts +6 -0
  94. package/shared/types/unified/message.ts +1 -1
package/dist/index.html CHANGED
@@ -58,8 +58,8 @@
58
58
  }
59
59
  })();
60
60
  </script>
61
- <script type="module" crossorigin src="/assets/main-CTs4NXwP.js"></script>
62
- <link rel="stylesheet" crossorigin href="/assets/main-moCAkEwm.css">
61
+ <script type="module" crossorigin src="/assets/main-BtBZvCwv.js"></script>
62
+ <link rel="stylesheet" crossorigin href="/assets/main-D7ATW8pp.css">
63
63
  </head>
64
64
  <body
65
65
  class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrialabs/clopen",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "All-in-one web workspace for AI coding agents — Claude Code, OpenCode, Codex, Copilot, and Qwen Code — with chat, terminal, git, browser preview, database client, checkpoints, and real-time collaboration",
5
5
  "author": "Myria Labs",
6
6
  "license": "MIT",
@@ -98,7 +98,13 @@
98
98
  "dependencies": {
99
99
  "@anthropic-ai/claude-agent-sdk": "0.3.158",
100
100
  "@anthropic-ai/sdk": "0.100.1",
101
+ "@cline/agents": "0.0.65",
102
+ "@cline/sdk": "0.0.65",
103
+ "@cursor/sdk": "1.0.24",
101
104
  "@dagrejs/dagre": "3.0.0",
105
+ "@earendil-works/pi-agent-core": "0.80.10",
106
+ "@earendil-works/pi-ai": "0.80.10",
107
+ "@earendil-works/pi-coding-agent": "0.80.10",
102
108
  "@elysiajs/cors": "1.4.1",
103
109
  "@github/copilot-sdk": "1.0.0-beta.9",
104
110
  "@iconify-json/lucide": "1.2.96",
@@ -40,7 +40,15 @@ export const ENGINE_BUILTIN_TOOLS: Record<EngineType, string[]> = {
40
40
  // Codex — custom-prompt / core tool ids (best-effort).
41
41
  codex: ['shell', 'apply_patch', 'update_plan', 'read_file', 'web_search'],
42
42
  // Qwen Code — snake_case tool names as passed to canUseTool (best-effort).
43
- qwen: ['run_shell_command', 'read_file', 'write_file', 'read_many_files', 'grep', 'glob', 'ls', 'web_fetch', 'web_search']
43
+ qwen: ['run_shell_command', 'read_file', 'write_file', 'read_many_files', 'grep', 'glob', 'ls', 'web_fetch', 'web_search'],
44
+ // Pi — lowercase built-in tool ids, enforced at the `tool_call` extension hook.
45
+ pi: ['bash', 'read', 'edit', 'write', 'grep', 'find', 'ls', 'ask_question'],
46
+ // Cline — @cline/sdk default tool names, enforced via `toolPolicies` (a denied
47
+ // tool is set `{ enabled: false }`, hiding it from the model entirely).
48
+ cline: ['read_files', 'search_codebase', 'run_commands', 'fetch_web_content', 'apply_patch', 'editor', 'skills', 'ask_question'],
49
+ // Cursor — @cursor/sdk built-in tool ids (best-effort; the SDK exposes no
50
+ // per-tool permission hook, so these lists inform the UI but aren't enforced).
51
+ cursor: ['read', 'write', 'edit', 'ls', 'glob', 'grep', 'shell', 'task', 'update_todos', 'web_search']
44
52
  };
45
53
 
46
54
  /**
@@ -52,5 +60,11 @@ export const ENGINE_TOOLS_BEST_EFFORT: Record<EngineType, boolean> = {
52
60
  opencode: false,
53
61
  copilot: false,
54
62
  codex: true,
55
- qwen: false
63
+ qwen: false,
64
+ // Pi enforces allow/deny at the in-process `tool_call` hook (real, not best-effort).
65
+ pi: false,
66
+ // Cline enforces allow/deny via `toolPolicies` (`{ enabled: false }` = real).
67
+ cline: false,
68
+ // Cursor has no per-tool permission hook exposed by the SDK — best-effort only.
69
+ cursor: true
56
70
  };
@@ -52,6 +52,33 @@ export const ENGINES: EngineInfo[] = [
52
52
  light: '<svg width="24" height="24" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M174.82 108.75L155.38 75L165.64 57.75C166.46 56.31 166.46 54.53 165.64 53.09L155.38 35.84C154.86 34.91 153.87 34.33 152.78 34.33H114.88L106.14 19.03C105.62 18.1 104.63 17.52 103.54 17.52H83.3C82.21 17.52 81.22 18.1 80.7 19.03L61.26 52.77H41.02C39.93 52.77 38.94 53.35 38.42 54.28L28.16 71.53C27.34 72.97 27.34 74.75 28.16 76.19L45.52 107.5L36.78 122.8C35.96 124.24 35.96 126.02 36.78 127.46L47.04 144.71C47.56 145.64 48.55 146.22 49.64 146.22H87.54L96.28 161.52C96.8 162.45 97.79 163.03 98.88 163.03H119.12C120.21 163.03 121.2 162.45 121.72 161.52L141.16 127.78H158.52C159.61 127.78 160.6 127.2 161.12 126.27L171.38 109.02C172.2 107.58 172.2 105.8 171.38 104.36L174.82 108.75Z" fill="url(#qwen-grad-light-a)"/><path d="M119.12 163.03H98.88L87.54 144.71H49.64L61.26 126.39H80.7L38.42 55.29H61.26L83.3 19.03L93.56 37.35L83.3 55.29H161.58L151.32 72.54L170.76 106.28H151.32L141.16 88.34L101.18 163.03H119.12Z" fill="#ffffff"/><path d="M127.86 79.83H76.14L101.18 122.11L127.86 79.83Z" fill="url(#qwen-grad-light-b)"/><defs><radialGradient id="qwen-grad-light-a" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(100 100) rotate(90) scale(100)"><stop stop-color="#665CEE"/><stop offset="1" stop-color="#332E91"/></radialGradient><radialGradient id="qwen-grad-light-b" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(100 100) rotate(90) scale(100)"><stop stop-color="#665CEE"/><stop offset="1" stop-color="#332E91"/></radialGradient></defs></svg>',
53
53
  dark: '<svg width="24" height="24" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M174.82 108.75L155.38 75L165.64 57.75C166.46 56.31 166.46 54.53 165.64 53.09L155.38 35.84C154.86 34.91 153.87 34.33 152.78 34.33H114.88L106.14 19.03C105.62 18.1 104.63 17.52 103.54 17.52H83.3C82.21 17.52 81.22 18.1 80.7 19.03L61.26 52.77H41.02C39.93 52.77 38.94 53.35 38.42 54.28L28.16 71.53C27.34 72.97 27.34 74.75 28.16 76.19L45.52 107.5L36.78 122.8C35.96 124.24 35.96 126.02 36.78 127.46L47.04 144.71C47.56 145.64 48.55 146.22 49.64 146.22H87.54L96.28 161.52C96.8 162.45 97.79 163.03 98.88 163.03H119.12C120.21 163.03 121.2 162.45 121.72 161.52L141.16 127.78H158.52C159.61 127.78 160.6 127.2 161.12 126.27L171.38 109.02C172.2 107.58 172.2 105.8 171.38 104.36L174.82 108.75Z" fill="url(#qwen-grad-dark-a)"/><path d="M119.12 163.03H98.88L87.54 144.71H49.64L61.26 126.39H80.7L38.42 55.29H61.26L83.3 19.03L93.56 37.35L83.3 55.29H161.58L151.32 72.54L170.76 106.28H151.32L141.16 88.34L101.18 163.03H119.12Z" fill="#ffffff"/><path d="M127.86 79.83H76.14L101.18 122.11L127.86 79.83Z" fill="url(#qwen-grad-dark-b)"/><defs><radialGradient id="qwen-grad-dark-a" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(100 100) rotate(90) scale(100)"><stop stop-color="#a39afa"/><stop offset="1" stop-color="#615ced"/></radialGradient><radialGradient id="qwen-grad-dark-b" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(100 100) rotate(90) scale(100)"><stop stop-color="#a39afa"/><stop offset="1" stop-color="#615ced"/></radialGradient></defs></svg>'
54
54
  }
55
+ },
56
+ {
57
+ type: 'pi',
58
+ name: 'Pi',
59
+ description: 'Multi-provider AI models',
60
+ icon: {
61
+ light: '<svg width="24" height="24" viewBox="0 0 800 800" xmlns="http://www.w3.org/2000/svg"><path fill="#211E1E" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="#211E1E" d="M517.36 400H634.72V634.72H517.36Z"/></svg>',
62
+ dark: '<svg width="24" height="24" viewBox="0 0 800 800" xmlns="http://www.w3.org/2000/svg"><path fill="#F1ECEC" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="#F1ECEC" d="M517.36 400H634.72V634.72H517.36Z"/></svg>'
63
+ }
64
+ },
65
+ {
66
+ type: 'cline',
67
+ name: 'Cline',
68
+ description: 'Multi-provider AI models',
69
+ icon: {
70
+ light: '<svg width="24" height="24" viewBox="0 0 466.73 487.04" xmlns="http://www.w3.org/2000/svg"><path fill="#211E1E" d="M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z"/></svg>',
71
+ dark: '<svg width="24" height="24" viewBox="0 0 466.73 487.04" xmlns="http://www.w3.org/2000/svg"><path fill="#f9f9f9" d="M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z"/></svg>'
72
+ }
73
+ },
74
+ {
75
+ type: 'cursor',
76
+ name: 'Cursor',
77
+ description: 'Cursor Composer models',
78
+ icon: {
79
+ light: '<svg width="24" height="24" viewBox="0 0 466.73 532.09" xmlns="http://www.w3.org/2000/svg"><path fill="#26251e" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"/></svg>',
80
+ dark: '<svg width="24" height="24" viewBox="0 0 466.73 532.09" xmlns="http://www.w3.org/2000/svg"><path fill="#edecec" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"/></svg>'
81
+ }
55
82
  }
56
83
  ];
57
84
 
@@ -18,4 +18,4 @@ export type StopReason =
18
18
  | 'interrupted';
19
19
 
20
20
  /** Supported AI engine backends */
21
- export type EngineType = 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen';
21
+ export type EngineType = 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen' | 'pi' | 'cline' | 'cursor';
@@ -61,7 +61,7 @@ export interface EngineModel {
61
61
 
62
62
  // Engine metadata for UI display
63
63
  export interface EngineInfo {
64
- type: 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen';
64
+ type: 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen' | 'pi' | 'cline' | 'cursor';
65
65
  name: string;
66
66
  description: string;
67
67
  icon: {
@@ -87,3 +87,84 @@ export interface QwenProviderPreset {
87
87
  defaultBaseUrl: string;
88
88
  docsUrl?: string;
89
89
  }
90
+
91
+ // ── Pi provider presets (wire format for `engine:pi-presets-list`) ──
92
+ //
93
+ // Pi is genuinely multi-provider (Anthropic, OpenAI, Google, OpenRouter, xAI …).
94
+ // Each provider supports API-key auth, OAuth (subscription) auth, or both. The
95
+ // preset catalog is exposed to the login picker so the frontend can render the
96
+ // right flow per provider without importing `$backend`. Runtime values live in
97
+ // `backend/engine/adapters/pi/presets.ts`.
98
+
99
+ export type PiAuthMode = 'api_key' | 'oauth';
100
+
101
+ /**
102
+ * One credential input a provider needs, shown up-front in the account form
103
+ * (OpenCode-style). `role: 'key'` maps to the pi-ai `ApiKeyCredential.key`;
104
+ * `role: 'env'` maps to `credential.env[key]` (provider-scoped config such as
105
+ * `CLOUDFLARE_ACCOUNT_ID`).
106
+ */
107
+ export interface PiCredentialField {
108
+ key: string;
109
+ label: string;
110
+ secret: boolean;
111
+ role: 'key' | 'env';
112
+ placeholder?: string;
113
+ }
114
+
115
+ export interface PiProviderPreset {
116
+ /** Provider id as pi-ai knows it (e.g. 'anthropic', 'openai', 'google'). */
117
+ id: string;
118
+ /** Human-facing provider name. */
119
+ name: string;
120
+ /** Which auth flows this provider supports. */
121
+ authModes: PiAuthMode[];
122
+ /** API-key credential fields to render (present when `authModes` includes 'api_key'). */
123
+ fields?: PiCredentialField[];
124
+ /** Label shown for the OAuth (subscription) option, when applicable. */
125
+ oauthLabel?: string;
126
+ /** Where to obtain an API key. */
127
+ apiKeyUrl?: string;
128
+ }
129
+
130
+ // ── Cline provider presets (wire format for `engine:cline-presets-list`) ──
131
+ //
132
+ // Cline (`@cline/sdk`) is genuinely multi-provider (Anthropic, OpenAI, Google,
133
+ // Bedrock, Mistral, the Cline account, OpenAI-compatible …). Each provider is
134
+ // either API-key based or OAuth based (the Cline account uses WorkOS OAuth). The
135
+ // preset catalog is exposed to the login picker so the frontend renders the
136
+ // right flow per provider without importing `$backend`. Runtime values live in
137
+ // `backend/engine/adapters/cline/presets.ts`, derived from the SDK catalog +
138
+ // `getProviderConfigFields`.
139
+
140
+ export type ClineAuthMode = 'api_key' | 'oauth';
141
+
142
+ /**
143
+ * One credential input a Cline provider needs, shown up-front in the account
144
+ * form (OpenCode/Pi-style). `role: 'apiKey'` maps to the provider api key;
145
+ * `role: 'baseUrl'` maps to a custom base URL; `role: 'field'` maps to an extra
146
+ * provider-scoped field (AWS region, GCP project id, …).
147
+ */
148
+ export interface ClineCredentialField {
149
+ key: string;
150
+ label: string;
151
+ secret: boolean;
152
+ role: 'apiKey' | 'baseUrl' | 'field';
153
+ placeholder?: string;
154
+ optional?: boolean;
155
+ }
156
+
157
+ export interface ClineProviderPreset {
158
+ /** Provider id as the Cline SDK knows it (e.g. 'anthropic', 'openai', 'cline'). */
159
+ id: string;
160
+ /** Human-facing provider name. */
161
+ name: string;
162
+ /** Which auth flows this provider supports. */
163
+ authModes: ClineAuthMode[];
164
+ /** API-key credential fields to render (present when `authModes` includes 'api_key'). */
165
+ fields?: ClineCredentialField[];
166
+ /** Label shown for the OAuth (sign-in) option, when applicable. */
167
+ oauthLabel?: string;
168
+ /** Where to obtain an API key. */
169
+ apiKeyUrl?: string;
170
+ }
@@ -23,6 +23,12 @@ export type {
23
23
  EngineInfo,
24
24
  QwenProviderPresetId,
25
25
  QwenProviderPreset,
26
+ PiAuthMode,
27
+ PiCredentialField,
28
+ PiProviderPreset,
29
+ ClineAuthMode,
30
+ ClineCredentialField,
31
+ ClineProviderPreset,
26
32
  } from './engine';
27
33
 
28
34
  // ── Tools ────────────────────────────────────────────────────
@@ -39,7 +39,7 @@ export interface MessageModel {
39
39
 
40
40
  /** Engine context attached to every message */
41
41
  export interface MessageEngine {
42
- type: 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen';
42
+ type: 'claude-code' | 'opencode' | 'copilot' | 'codex' | 'qwen' | 'pi' | 'cline' | 'cursor';
43
43
  provider: string;
44
44
  model: MessageModel;
45
45
  account: MessageAccount;