cladogram 0.5.5-beta.7 → 0.5.5-beta.8

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.
@@ -84,20 +84,22 @@
84
84
  color: var(--clado-ui-text);
85
85
  }
86
86
 
87
- /* ============ 底部灵感坞(严格锁定视口宽度,绝不横向撑破屏幕) ============ */
87
+ /* ============ 右下角冰晶灵感坞(桌面右下悬浮,小屏自适应防溢出) ============ */
88
88
  .clado-agent-dock {
89
- width: 100%;
90
- max-width: min(500px, calc(100vw - 20px));
89
+ width: min(468px, calc(100vw - 24px));
90
+ max-width: 100%;
91
91
  display: flex;
92
92
  flex-direction: column;
93
93
  gap: 7px;
94
94
  min-width: 0;
95
95
  pointer-events: none;
96
96
  box-sizing: border-box;
97
+ transform-origin: bottom right;
97
98
  }
98
99
  .clado-agent-dock *,
99
100
  .clado-agent-overlay *,
100
- .clado-agent-ctx-menu * {
101
+ .clado-agent-ctx-menu *,
102
+ .clado-model-menu * {
101
103
  box-sizing: border-box;
102
104
  }
103
105
  .clado-agent-dock > * {
@@ -112,6 +114,7 @@
112
114
  .clado-agent-dock .clado-cmd-approve-bar,
113
115
  .clado-agent-dock .clado-single-panel,
114
116
  .clado-agent-dock .clado-peer-pill,
117
+ .clado-agent-dock .clado-peer-add-btn,
115
118
  .clado-agent-dock .clado-agent-shell {
116
119
  transition:
117
120
  opacity 260ms var(--clado-ease-spring),
@@ -128,18 +131,26 @@
128
131
  .clado-agent-dock.minimized * {
129
132
  pointer-events: none !important;
130
133
  }
134
+ .clado-agent-dock.minimized .clado-single-wrap {
135
+ grid-template-rows: 0fr !important;
136
+ pointer-events: none !important;
137
+ }
131
138
  .clado-agent-dock.minimized .clado-cmd-approve-bar,
132
139
  .clado-agent-dock.minimized .clado-single-panel,
140
+ .clado-agent-dock.minimized .clado-single-wrap.open .clado-single-panel,
133
141
  .clado-agent-dock.minimized .clado-peer-pill,
142
+ .clado-agent-dock.minimized .clado-peer-add-btn,
134
143
  .clado-agent-dock.minimized .clado-agent-shell {
135
- opacity: 0;
136
- transform: translate3d(24px, 16px, 0) scale(0.86);
144
+ opacity: 0 !important;
145
+ transform: translate3d(24px, 16px, 0) scale(0.86) !important;
137
146
  }
138
147
 
139
- /* 右下角收起态灵感悬浮球 */
148
+ /* 右下角收起态灵感悬浮球(绝对定位于右下角同槽位,展开态零高度占位) */
140
149
  .clado-agent-orb-wrap {
141
- position: relative;
142
- align-self: end;
150
+ position: absolute;
151
+ right: 0;
152
+ bottom: 0;
153
+ z-index: 4;
143
154
  pointer-events: none;
144
155
  }
145
156
  .clado-agent-orb {
@@ -1202,6 +1213,7 @@
1202
1213
  max-width: 480px;
1203
1214
  max-height: calc(100dvh - 76px);
1204
1215
  overflow-y: auto;
1216
+ scrollbar-width: none;
1205
1217
  -webkit-overflow-scrolling: touch;
1206
1218
  touch-action: pan-y;
1207
1219
  margin: 0 auto;
@@ -1214,6 +1226,7 @@
1214
1226
  transform: translateY(10px) scale(0.985);
1215
1227
  transition: opacity 250ms var(--clado-ease-spring), transform 280ms var(--clado-ease-spring);
1216
1228
  }
1229
+ .clado-panel-container::-webkit-scrollbar { display: none; }
1217
1230
  .clado-agent-overlay.show .clado-panel-container {
1218
1231
  opacity: 1;
1219
1232
  transform: translateY(0) scale(1);
@@ -1275,6 +1288,8 @@
1275
1288
  left: 14px;
1276
1289
  right: 14px;
1277
1290
  top: 14px;
1291
+ max-height: 0;
1292
+ overflow: hidden;
1278
1293
  }
1279
1294
  .clado-cfg-sub-page {
1280
1295
  display: flex;
@@ -1287,6 +1302,8 @@
1287
1302
  left: 14px;
1288
1303
  right: 14px;
1289
1304
  top: 14px;
1305
+ max-height: 0;
1306
+ overflow: hidden;
1290
1307
  transition: opacity 240ms var(--clado-ease-spring), transform 280ms var(--clado-ease-spring);
1291
1308
  }
1292
1309
  .clado-cfg-sub-page.active {
@@ -1297,6 +1314,8 @@
1297
1314
  left: auto;
1298
1315
  right: auto;
1299
1316
  top: auto;
1317
+ max-height: none;
1318
+ overflow: visible;
1300
1319
  }
1301
1320
 
1302
1321
  .clado-switch-btn {
@@ -1376,7 +1395,11 @@
1376
1395
  transform: translateY(0) scale(1);
1377
1396
  }
1378
1397
 
1379
- @media (max-width: 680px) {
1398
+ @media (max-width: 760px) {
1399
+ .clado-agent-dock {
1400
+ width: 100%;
1401
+ max-width: calc(100vw - 20px);
1402
+ }
1380
1403
  .clado-single-panel {
1381
1404
  border-radius: 26px;
1382
1405
  }
@@ -1387,3 +1410,122 @@
1387
1410
  font-size: 16px;
1388
1411
  }
1389
1412
  }
1413
+
1414
+ /* 输入栏模型快切胶囊与弹窗 + 会话条尾端新建按钮 */
1415
+ .clado-model-chip {
1416
+ appearance: none;
1417
+ flex: 0 0 auto;
1418
+ height: 28px;
1419
+ max-width: 126px;
1420
+ padding: 0 9px;
1421
+ border-radius: 999px;
1422
+ border: 1px solid var(--clado-agent-well-border);
1423
+ background: var(--clado-agent-well);
1424
+ color: var(--clado-ui-text);
1425
+ font: inherit;
1426
+ font-size: 11.5px;
1427
+ font-weight: 580;
1428
+ cursor: pointer;
1429
+ display: inline-flex;
1430
+ align-items: center;
1431
+ gap: 4px;
1432
+ white-space: nowrap;
1433
+ transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
1434
+ }
1435
+ .clado-model-chip:hover {
1436
+ background: var(--clado-agent-hover);
1437
+ border-color: var(--clado-agent-outline);
1438
+ }
1439
+ .clado-model-chip:active { transform: scale(0.97); }
1440
+ .clado-model-chip.unconfigured {
1441
+ background: rgba(37, 99, 235, 0.12);
1442
+ border-color: rgba(37, 99, 235, 0.34);
1443
+ color: var(--clado-ui-brand);
1444
+ font-weight: 640;
1445
+ }
1446
+ .clado-model-chip-label {
1447
+ overflow: hidden;
1448
+ text-overflow: ellipsis;
1449
+ white-space: nowrap;
1450
+ }
1451
+ .clado-model-chip-caret {
1452
+ font-size: 10px;
1453
+ opacity: 0.65;
1454
+ flex: none;
1455
+ }
1456
+
1457
+ .clado-model-menu {
1458
+ position: fixed;
1459
+ z-index: 95;
1460
+ min-width: 210px;
1461
+ max-width: min(290px, calc(100vw - 20px));
1462
+ max-height: 320px;
1463
+ overflow-y: auto;
1464
+ padding: 6px;
1465
+ border-radius: 16px;
1466
+ display: flex;
1467
+ flex-direction: column;
1468
+ gap: 2px;
1469
+ background: var(--clado-agent-popover);
1470
+ backdrop-filter: blur(24px) saturate(190%);
1471
+ -webkit-backdrop-filter: blur(24px) saturate(190%);
1472
+ border: 1px solid var(--clado-agent-outline);
1473
+ box-shadow: var(--clado-agent-shadow);
1474
+ font: 12.5px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
1475
+ color: var(--clado-ui-text);
1476
+ opacity: 0;
1477
+ pointer-events: none;
1478
+ transform: translateY(6px) scale(0.95);
1479
+ transform-origin: bottom left;
1480
+ transition: opacity 160ms var(--clado-ease-spring), transform 180ms var(--clado-ease-spring);
1481
+ }
1482
+ .clado-model-menu.open {
1483
+ opacity: 1;
1484
+ pointer-events: auto;
1485
+ transform: translateY(0) scale(1);
1486
+ }
1487
+
1488
+ .clado-peer-add-btn {
1489
+ appearance: none;
1490
+ flex: 0 0 auto;
1491
+ width: 29px;
1492
+ height: 29px;
1493
+ border-radius: 999px;
1494
+ border: 1px solid var(--clado-agent-outline);
1495
+ background: var(--clado-agent-surface);
1496
+ backdrop-filter: var(--clado-agent-filter);
1497
+ -webkit-backdrop-filter: var(--clado-agent-filter);
1498
+ box-shadow: var(--clado-agent-pill-shadow);
1499
+ color: var(--clado-ui-muted);
1500
+ font: inherit;
1501
+ font-size: 14px;
1502
+ font-weight: 600;
1503
+ cursor: pointer;
1504
+ display: inline-flex;
1505
+ align-items: center;
1506
+ justify-content: center;
1507
+ padding: 0;
1508
+ line-height: 1;
1509
+ }
1510
+ .clado-peer-add-btn:hover {
1511
+ color: var(--clado-ui-text);
1512
+ background: var(--clado-agent-hover);
1513
+ }
1514
+ .clado-peer-add-btn:active { transform: scale(0.93); }
1515
+
1516
+ .clado-clean-input {
1517
+ width: 100%;
1518
+ height: 35px;
1519
+ padding: 0 11px;
1520
+ border-radius: 10px;
1521
+ border: 1px solid var(--clado-agent-well-border);
1522
+ background: var(--clado-agent-well);
1523
+ color: var(--clado-ui-text);
1524
+ font: inherit;
1525
+ font-size: 12.5px;
1526
+ outline: none;
1527
+ }
1528
+ .clado-clean-input:focus {
1529
+ border-color: var(--clado-ui-brand);
1530
+ }
1531
+
@@ -307,7 +307,7 @@
307
307
  return { open, close };
308
308
  }
309
309
 
310
- function mountBrand(host, { setTheme, capture, plugins, market }) {
310
+ function mountBrand(host, { setTheme, capture, plugins, market, openWorkspacePicker }) {
311
311
  const brand = document.createElement('div');
312
312
  brand.className = 'clado-brand-plugin';
313
313
  const brandLogo = '<svg viewBox="0 0 64 64" fill="none" aria-hidden="true">' +
@@ -345,6 +345,18 @@
345
345
  panel.append(choice);
346
346
  return { theme, choice };
347
347
  });
348
+ if (openWorkspacePicker) {
349
+ const wsBtn = document.createElement('button');
350
+ wsBtn.type = 'button';
351
+ wsBtn.className = 'clado-ui-button clado-brand-choice clado-brand-capture';
352
+ wsBtn.dataset.openWorkspacePicker = 'true';
353
+ wsBtn.innerHTML = icon('<path d="M4 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"/>') + '<span>切换工作区…</span>';
354
+ wsBtn.onclick = () => {
355
+ setOpen(false);
356
+ openWorkspacePicker();
357
+ };
358
+ panel.append(wsBtn);
359
+ }
348
360
  if (capture) {
349
361
  const action = document.createElement('button');
350
362
  action.type = 'button';
@@ -35,8 +35,12 @@
35
35
  </button>
36
36
  <aside id="directory" class="clado-ui-glass clado-ui-glass-panel" aria-label="Markdown 画布目录" hidden>
37
37
  <div class="directory-scroll">
38
+ <div id="directoryHubBar" class="directory-actions" style="margin-bottom:6px;" hidden>
39
+ <button type="button" class="clado-ui-button" id="pickWorkspaceButton" title="选择或切换电脑上的项目目录">📂 切换项目</button>
40
+ <button type="button" class="clado-ui-button" id="newCanvasButton" title="在当前工作区新建一张 Markdown 画布">+ 新建画布</button>
41
+ </div>
38
42
  <div id="workspaceSection" class="directory-workspaces" hidden>
39
- <div class="directory-workspaces-title">工作区</div>
43
+ <div class="directory-workspaces-title">子工作区</div>
40
44
  <div id="workspaceList" class="directory-workspace-list"></div>
41
45
  </div>
42
46
  <div class="directory-heading"><strong>Markdown/</strong></div>
@@ -146,6 +150,19 @@
146
150
  document.addEventListener('keydown', event => {
147
151
  if (event.key === 'Escape' && !directory.hidden && !dialog.open) { setOpen(false); trigger.focus(); }
148
152
  });
153
+ if (actions.openWorkspacePicker || actions.createCanvas) {
154
+ $('#directoryHubBar').hidden = false;
155
+ $('#pickWorkspaceButton').hidden = !actions.openWorkspacePicker;
156
+ $('#newCanvasButton').hidden = !actions.createCanvas;
157
+ $('#pickWorkspaceButton').onclick = () => {
158
+ setOpen(false);
159
+ actions.openWorkspacePicker?.();
160
+ };
161
+ $('#newCanvasButton').onclick = () => {
162
+ setOpen(false);
163
+ actions.createCanvas?.();
164
+ };
165
+ }
149
166
  $('#refreshButton').onclick = actions.refresh;
150
167
  $('#backButton').onclick = actions.back;
151
168
  $('#closeDetails').onclick = () => dialog.close();
@@ -1,42 +1,225 @@
1
1
  /**
2
- * 统一模型协议路由器(OpenAI 兼容 + Anthropic 原生)。
2
+ * 统一模型协议路由器与多供应商注册中心(OpenAI 兼容 + Anthropic 原生 + 本地免密)。
3
3
  */
4
4
 
5
5
  import { streamOpenAI } from './openai.js';
6
6
  import { streamAnthropic } from './anthropic.js';
7
7
 
8
+ export const PROVIDER_PRESETS = [
9
+ {
10
+ id: 'openai',
11
+ label: 'OpenAI',
12
+ protocol: 'openai',
13
+ defaultBaseUrl: 'https://api.openai.com/v1',
14
+ defaultModel: 'gpt-4.1',
15
+ models: ['gpt-4.1', 'gpt-4.1-mini', 'gpt-4o', 'o4-mini'],
16
+ requiresKey: true,
17
+ },
18
+ {
19
+ id: 'anthropic',
20
+ label: 'Anthropic',
21
+ protocol: 'anthropic',
22
+ defaultBaseUrl: 'https://api.anthropic.com/v1',
23
+ defaultModel: 'claude-sonnet-4-5',
24
+ models: ['claude-sonnet-4-5', 'claude-opus-4-5', 'claude-3-7-sonnet-latest'],
25
+ requiresKey: true,
26
+ },
27
+ {
28
+ id: 'deepseek',
29
+ label: 'DeepSeek',
30
+ protocol: 'openai',
31
+ defaultBaseUrl: 'https://api.deepseek.com/v1',
32
+ defaultModel: 'deepseek-chat',
33
+ models: ['deepseek-chat', 'deepseek-reasoner'],
34
+ requiresKey: true,
35
+ },
36
+ {
37
+ id: 'openrouter',
38
+ label: 'OpenRouter',
39
+ protocol: 'openai',
40
+ defaultBaseUrl: 'https://openrouter.ai/api/v1',
41
+ defaultModel: 'anthropic/claude-sonnet-4',
42
+ models: ['anthropic/claude-sonnet-4', 'openai/gpt-4.1', 'google/gemini-2.5-pro', 'deepseek/deepseek-r1'],
43
+ requiresKey: true,
44
+ },
45
+ {
46
+ id: 'siliconflow',
47
+ label: '硅基流动 SiliconFlow',
48
+ protocol: 'openai',
49
+ defaultBaseUrl: 'https://api.siliconflow.cn/v1',
50
+ defaultModel: 'deepseek-ai/DeepSeek-V3',
51
+ models: ['deepseek-ai/DeepSeek-V3', 'deepseek-ai/DeepSeek-R1', 'Qwen/Qwen2.5-Coder-32B-Instruct'],
52
+ requiresKey: true,
53
+ },
54
+ {
55
+ id: 'ollama',
56
+ label: 'Ollama 本地',
57
+ protocol: 'openai',
58
+ defaultBaseUrl: 'http://127.0.0.1:11434/v1',
59
+ defaultModel: 'qwen2.5-coder:14b',
60
+ models: ['qwen2.5-coder:14b', 'llama3.3', 'deepseek-r1:14b'],
61
+ requiresKey: false,
62
+ },
63
+ {
64
+ id: 'custom',
65
+ label: '自定义兼容接口',
66
+ protocol: 'openai',
67
+ defaultBaseUrl: 'https://api.openai.com/v1',
68
+ defaultModel: 'gpt-4.1-mini',
69
+ models: [],
70
+ requiresKey: true,
71
+ },
72
+ ];
73
+
74
+ export function getProviderPreset(id) {
75
+ return PROVIDER_PRESETS.find(p => p.id === id) || null;
76
+ }
77
+
78
+ export function maskApiKey(key = '') {
79
+ const clean = String(key || '').trim();
80
+ if (!clean) return '';
81
+ if (clean.length <= 8) return '••••' + clean.slice(-2);
82
+ return clean.slice(0, 3) + '••••' + clean.slice(-4);
83
+ }
84
+
8
85
  export function resolveProvider(config = {}) {
9
- const explicit = String(config.provider || process.env.CLADO_LLM_PROVIDER || 'auto').toLowerCase();
86
+ const activeId = String(config.providerId || '').toLowerCase();
87
+ const profile = (activeId && config.providers?.[activeId]) || {};
88
+ const explicit = String(profile.protocol || config.provider || process.env.CLADO_LLM_PROVIDER || 'auto').toLowerCase();
10
89
  if (explicit === 'anthropic' || explicit === 'openai') return explicit;
11
- const baseUrl = String(config.baseUrl || process.env.CLADO_LLM_BASE_URL || '');
90
+ const preset = getProviderPreset(activeId);
91
+ if (preset?.protocol === 'anthropic') return 'anthropic';
92
+ const baseUrl = String(profile.baseUrl || config.baseUrl || config.apiBaseUrl || process.env.CLADO_LLM_BASE_URL || '');
12
93
  if (/anthropic\.com/i.test(baseUrl)) return 'anthropic';
13
94
  if (!baseUrl && process.env.ANTHROPIC_API_KEY && !process.env.OPENAI_API_KEY && !process.env.CLADO_LLM_API_KEY) {
14
95
  return 'anthropic';
15
96
  }
16
- const model = String(config.model || process.env.CLADO_LLM_MODEL || '');
97
+ const model = String(profile.model || config.model || process.env.CLADO_LLM_MODEL || '');
17
98
  if (!baseUrl && /^claude-/i.test(model)) return 'anthropic';
18
99
  return 'openai';
19
100
  }
20
101
 
21
102
  export function resolveProviderCredentials(config = {}) {
103
+ const activeId = String(config.providerId || '').toLowerCase();
104
+ const preset = getProviderPreset(activeId);
105
+ const profile = (activeId && config.providers?.[activeId]) || {};
22
106
  const provider = resolveProvider(config);
23
- const apiKey = config.apiKey
24
- || process.env.CLADO_LLM_API_KEY
25
- || (provider === 'anthropic' ? process.env.ANTHROPIC_API_KEY : process.env.OPENAI_API_KEY)
26
- || '';
27
- const baseUrl = config.baseUrl
107
+
108
+ const rawKey = profile.apiKey
109
+ ?? config.apiKey
110
+ ?? process.env.CLADO_LLM_API_KEY
111
+ ?? (provider === 'anthropic' ? process.env.ANTHROPIC_API_KEY : process.env.OPENAI_API_KEY)
112
+ ?? '';
113
+ const hasApiKey = Boolean(String(rawKey || '').trim());
114
+
115
+ const baseUrl = String(
116
+ profile.baseUrl
117
+ || config.baseUrl
118
+ || config.apiBaseUrl
119
+ || preset?.defaultBaseUrl
28
120
  || process.env.CLADO_LLM_BASE_URL
29
- || (provider === 'anthropic' ? 'https://api.anthropic.com/v1' : 'https://api.openai.com/v1');
30
- const model = config.model
121
+ || (provider === 'anthropic' ? 'https://api.anthropic.com/v1' : 'https://api.openai.com/v1')
122
+ ).trim();
123
+
124
+ const isKeylessLocal = preset?.requiresKey === false || /^https?:\/\/(127\.0\.0\.1|localhost):11434(\/|$)/i.test(baseUrl);
125
+ const apiKey = hasApiKey ? String(rawKey).trim() : (isKeylessLocal ? 'ollama' : '');
126
+ const configured = hasApiKey || Boolean(activeId === 'ollama' && profile.enabled !== false && config.providers?.ollama);
127
+
128
+ const model = String(
129
+ profile.model
130
+ || config.model
131
+ || preset?.defaultModel
31
132
  || process.env.CLADO_LLM_MODEL
32
- || (provider === 'anthropic' ? 'claude-sonnet-4-5' : 'gpt-4.1-mini');
33
- return { provider, apiKey, baseUrl, model };
133
+ || (provider === 'anthropic' ? 'claude-sonnet-4-5' : 'gpt-4.1-mini')
134
+ ).trim();
135
+
136
+ const resolvedId = preset?.id || (provider === 'anthropic' ? 'anthropic' : 'openai');
137
+ const providerLabel = profile.label || preset?.label || (provider === 'anthropic' ? 'Anthropic' : 'OpenAI');
138
+
139
+ return {
140
+ providerId: resolvedId,
141
+ providerLabel,
142
+ provider,
143
+ apiKey,
144
+ hasApiKey,
145
+ configured,
146
+ baseUrl,
147
+ model,
148
+ };
149
+ }
150
+
151
+ export function listConfiguredModels(config = {}) {
152
+ const out = [];
153
+ const providersMap = config.providers && typeof config.providers === 'object' ? config.providers : {};
154
+ const seen = new Set();
155
+
156
+ for (const preset of PROVIDER_PRESETS) {
157
+ const prof = providersMap[preset.id];
158
+ if (!prof) continue;
159
+ const hasKey = Boolean(String(prof.apiKey || '').trim()) || preset.requiresKey === false;
160
+ if (!hasKey) continue;
161
+ const models = Array.isArray(prof.models) && prof.models.length
162
+ ? prof.models
163
+ : [prof.model || preset.defaultModel, ...(preset.models || [])].filter(Boolean);
164
+ const uniqueModels = [...new Set(models)].slice(0, 12);
165
+ for (const m of uniqueModels) {
166
+ const k = `${preset.id}::${m}`;
167
+ if (seen.has(k)) continue;
168
+ seen.add(k);
169
+ out.push({
170
+ providerId: preset.id,
171
+ providerLabel: prof.label || preset.label,
172
+ model: m,
173
+ });
174
+ }
175
+ }
176
+
177
+ // 兼容旧版单组顶层配置
178
+ if (!out.length) {
179
+ const creds = resolveProviderCredentials(config);
180
+ if (creds.configured) {
181
+ out.push({
182
+ providerId: creds.providerId,
183
+ providerLabel: creds.providerLabel,
184
+ model: creds.model,
185
+ });
186
+ }
187
+ }
188
+ return out;
189
+ }
190
+
191
+ export async function fetchProviderModels({ protocol = 'openai', baseUrl = '', apiKey = '', fetchImpl = fetch } = {}) {
192
+ const cleanBase = String(baseUrl || '').replace(/\/+$/, '');
193
+ if (!cleanBase) throw new Error('请先填写 API Base URL。');
194
+ const headers = { accept: 'application/json' };
195
+ if (protocol === 'anthropic') {
196
+ if (apiKey) headers['x-api-key'] = apiKey;
197
+ headers['anthropic-version'] = '2023-06-01';
198
+ } else if (apiKey) {
199
+ headers.authorization = `Bearer ${apiKey}`;
200
+ }
201
+ const res = await fetchImpl(`${cleanBase}/models`, {
202
+ method: 'GET',
203
+ headers,
204
+ signal: AbortSignal.timeout(6500),
205
+ });
206
+ if (!res.ok) {
207
+ const txt = await res.text().catch(() => '');
208
+ throw new Error(`拉取模型列表失败(HTTP ${res.status})${txt ? ':' + txt.slice(0, 140) : ''}`);
209
+ }
210
+ const body = await res.json();
211
+ const rawList = Array.isArray(body?.data) ? body.data : (Array.isArray(body?.models) ? body.models : []);
212
+ const ids = rawList
213
+ .map(item => (typeof item === 'string' ? item : (item?.id || item?.name || '')))
214
+ .map(s => String(s).trim())
215
+ .filter(Boolean);
216
+ return [...new Set(ids)].slice(0, 60);
34
217
  }
35
218
 
36
219
  export async function streamModelTurn(options) {
37
220
  const creds = resolveProviderCredentials(options.config);
38
221
  if (!creds.apiKey) {
39
- throw new Error('未配置内置 Agent 的 API Key。请在「灵感」设置中填写 apiKey / provider / baseUrl / model,或改用外部 ACP 执行器。');
222
+ throw new Error('尚未配置供应商与模型 API Key。请点击输入框左侧模型按钮或「Agent 设置 → 供应商与模型」完成配置。');
40
223
  }
41
224
  const fn = creds.provider === 'anthropic' ? streamAnthropic : streamOpenAI;
42
225
  return fn({
@@ -133,6 +133,7 @@ export function saveSessionRecord(stateDir, record) {
133
133
  title: String(record.title || existing?.title || '新会话').slice(0, 60),
134
134
  persona,
135
135
  pal: record.pal || existing?.pal || paletteForPersona(persona),
136
+ engine: (record.engine || existing?.engine) === 'acp' ? 'acp' : 'builtin',
136
137
  mode: record.mode || existing?.mode || 'design',
137
138
  execMode: (record.execMode || existing?.execMode) === 'plan' ? 'plan' : 'act',
138
139
  archived: record.archived !== undefined ? Boolean(record.archived) : Boolean(existing?.archived),
@@ -214,6 +215,7 @@ export function listSessionRecords(stateDir, limitOrOptions = 20) {
214
215
  title: data.title || '未命名会话',
215
216
  persona: data.persona || 'architect',
216
217
  pal: data.pal || paletteForPersona(data.persona || 'architect'),
218
+ engine: data.engine === 'acp' ? 'acp' : 'builtin',
217
219
  mode: data.mode || 'design',
218
220
  execMode: data.execMode === 'plan' ? 'plan' : 'act',
219
221
  archived,
@@ -84,9 +84,15 @@
84
84
  .clado-plugin-slot[data-slot="top-left"] { top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); max-width: calc(100vw - 250px); flex-direction: column; align-items: start; }
85
85
  .clado-plugin-slot[data-slot="top-right"] { top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); flex-direction: column; align-items: end; }
86
86
  .clado-plugin-slot[data-slot="bottom-left"] { bottom: max(16px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); align-items: end; }
87
- .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(16px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); flex-direction: column-reverse; align-items: end; }
87
+ .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(14px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); flex-direction: column-reverse; align-items: end; z-index: 26; max-width: calc(100vw - 20px); }
88
88
  .clado-plugin-slot[data-slot="bottom-center"] { left: 10px; right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); justify-content: center; align-items: end; z-index: 26; }
89
- @media (max-width: 960px) {
89
+ @media (max-width: 760px) {
90
+ .clado-plugin-slot[data-slot="bottom-right"] {
91
+ left: 10px;
92
+ right: 10px;
93
+ bottom: max(12px, env(safe-area-inset-bottom));
94
+ max-width: calc(100vw - 20px);
95
+ }
90
96
  body[data-agent-dock="open"] .clado-plugin-slot[data-slot="bottom-left"] {
91
97
  opacity: 0;
92
98
  transform: translateY(8px) scale(.96);
@@ -489,3 +495,90 @@
489
495
  :root[data-theme="dark"] .clado-risk-medium { color: #fbbf24; }
490
496
  :root[data-theme="dark"] .clado-risk-high { color: #fda4af; }
491
497
 
498
+ /* ============ 36% 冰晶毛玻璃本机工作区选择器与新项目启动台 ============ */
499
+ .clado-launchpad-wrap {
500
+ min-height: 100%;
501
+ display: flex;
502
+ align-items: center;
503
+ justify-content: center;
504
+ padding: 64px 16px 110px;
505
+ background-image: radial-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px);
506
+ background-size: 22px 22px;
507
+ }
508
+ :root[data-theme="dark"] .clado-launchpad-wrap {
509
+ background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
510
+ }
511
+ .clado-launchpad-card {
512
+ width: 100%;
513
+ max-width: 460px;
514
+ padding: 22px 20px;
515
+ border-radius: 24px;
516
+ text-align: left;
517
+ display: flex;
518
+ flex-direction: column;
519
+ gap: 14px;
520
+ background: rgba(255, 255, 255, 0.42);
521
+ backdrop-filter: blur(22px) saturate(185%) brightness(1.06);
522
+ -webkit-backdrop-filter: blur(22px) saturate(185%) brightness(1.06);
523
+ border: 1px solid rgba(255, 255, 255, 0.86);
524
+ box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06), 0 0 0 0.5px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96);
525
+ }
526
+ :root[data-theme="dark"] .clado-launchpad-card {
527
+ background: rgba(20, 25, 36, 0.44);
528
+ border-color: rgba(255, 255, 255, 0.18);
529
+ box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
530
+ }
531
+ .clado-launchpad-actions {
532
+ display: grid;
533
+ grid-template-columns: 1fr;
534
+ gap: 8px;
535
+ }
536
+ .clado-launchpad-btn {
537
+ appearance: none;
538
+ width: 100%;
539
+ padding: 11px 13px;
540
+ border-radius: 14px;
541
+ border: 1px solid var(--clado-ui-well-border);
542
+ background: var(--clado-ui-well);
543
+ color: var(--clado-ui-text);
544
+ font: inherit;
545
+ text-align: left;
546
+ cursor: pointer;
547
+ display: flex;
548
+ align-items: center;
549
+ justify-content: space-between;
550
+ gap: 10px;
551
+ transition: background-color 150ms ease, transform 140ms ease, border-color 150ms ease;
552
+ }
553
+ .clado-launchpad-btn:hover {
554
+ background: var(--clado-ui-hover);
555
+ border-color: var(--clado-ui-glass-outline);
556
+ }
557
+ .clado-launchpad-btn:active { transform: scale(0.99); }
558
+ .clado-launchpad-btn.primary {
559
+ background: rgba(37, 99, 235, 0.11);
560
+ border-color: rgba(37, 99, 235, 0.28);
561
+ }
562
+ .clado-folder-row {
563
+ appearance: none;
564
+ width: 100%;
565
+ padding: 8px 10px;
566
+ border-radius: 10px;
567
+ border: 1px solid transparent;
568
+ background: transparent;
569
+ color: var(--clado-ui-text);
570
+ font: inherit;
571
+ font-size: 12.5px;
572
+ text-align: left;
573
+ cursor: pointer;
574
+ display: flex;
575
+ align-items: center;
576
+ justify-content: space-between;
577
+ gap: 8px;
578
+ }
579
+ .clado-folder-row:hover {
580
+ background: var(--clado-ui-hover);
581
+ border-color: var(--clado-ui-well-border);
582
+ }
583
+
584
+