tagword-codeagent 1.1.6__py3-none-any.whl

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 (173) hide show
  1. codeagent/__init__.py +10 -0
  2. codeagent/__main__.py +13 -0
  3. codeagent/cli/__init__.py +13 -0
  4. codeagent/cli/entrypoint.py +161 -0
  5. codeagent/cli/main.py +979 -0
  6. codeagent/core/__init__.py +2 -0
  7. codeagent/core/attachments.py +342 -0
  8. codeagent/core/audio_models.py +50 -0
  9. codeagent/core/bootstrap.py +178 -0
  10. codeagent/core/default_presets.py +159 -0
  11. codeagent/core/env.py +106 -0
  12. codeagent/core/folder_picker.py +151 -0
  13. codeagent/core/image_understanding.py +90 -0
  14. codeagent/core/models.py +6 -0
  15. codeagent/core/paths.py +238 -0
  16. codeagent/core/pricing.py +107 -0
  17. codeagent/core/process_ports.py +258 -0
  18. codeagent/core/seed_bridge.py +21 -0
  19. codeagent/core/settings.py +98 -0
  20. codeagent/core/speech_synth.py +330 -0
  21. codeagent/core/team_config.py +247 -0
  22. codeagent/core/team_manager.py +245 -0
  23. codeagent/core/token_counter.py +41 -0
  24. codeagent/core/tts_voices.py +103 -0
  25. codeagent/core/usage_billing.py +72 -0
  26. codeagent/core/vision_models.py +93 -0
  27. codeagent/memory/diary.py +144 -0
  28. codeagent/persona_defaults/README.md +12 -0
  29. codeagent/persona_defaults/agent.md +352 -0
  30. codeagent/persona_defaults/identity.md +29 -0
  31. codeagent/persona_defaults/memory.md +4 -0
  32. codeagent/persona_defaults/skills.md +325 -0
  33. codeagent/persona_defaults/soul.md +38 -0
  34. codeagent/persona_defaults/tools.md +41 -0
  35. codeagent/persona_defaults/user.md +18 -0
  36. codeagent/runtime/__init__.py +11 -0
  37. codeagent/runtime/agent_context.py +6 -0
  38. codeagent/runtime/agent_runtime.py +21 -0
  39. codeagent/runtime/compact_prompt.py +9 -0
  40. codeagent/runtime/compact_state.py +40 -0
  41. codeagent/runtime/llm_worker.py +132 -0
  42. codeagent/runtime/orchestrator.py +161 -0
  43. codeagent/runtime/prompt_enrichment.py +324 -0
  44. codeagent/runtime/session_manager.py +30 -0
  45. codeagent/runtime/task_split.py +38 -0
  46. codeagent/runtime/turn_loop.py +13 -0
  47. codeagent/runtime/worker.py +48 -0
  48. codeagent/server/__init__.py +505 -0
  49. codeagent/server/app_factory.py +1292 -0
  50. codeagent/server/attachment_api.py +261 -0
  51. codeagent/server/hub.py +175 -0
  52. codeagent/server/icon.png +0 -0
  53. codeagent/server/self_healing.py +143 -0
  54. codeagent/server/team_engine.py +243 -0
  55. codeagent/server/tts_api.py +51 -0
  56. codeagent/server/webui_api_app.py +3180 -0
  57. codeagent/skills/__init__.py +2 -0
  58. codeagent/skills/select.py +144 -0
  59. codeagent/tools/__init__.py +6 -0
  60. codeagent/tools/agent_tools.py +10 -0
  61. codeagent/web/__init__.py +1 -0
  62. codeagent/web/__pycache__/__init__.cpython-313.pyc +0 -0
  63. codeagent/web/__pycache__/app.cpython-313.pyc +0 -0
  64. codeagent/web/__pycache__/auth_impl.cpython-313.pyc +0 -0
  65. codeagent/web/auth_impl.py +326 -0
  66. codeagent/web/static/00-marked.min.js +6 -0
  67. codeagent/web/static/00-mermaid.min.js +2314 -0
  68. codeagent/web/static/00-purify.min.js +3 -0
  69. codeagent/web/static/00-storage.js +83 -0
  70. codeagent/web/static/00-utils.js +51 -0
  71. codeagent/web/static/01-theme.css +96 -0
  72. codeagent/web/static/01a-scroll.js +86 -0
  73. codeagent/web/static/01b-think.js +62 -0
  74. codeagent/web/static/01c-session-identity.js +81 -0
  75. codeagent/web/static/01c-session-thinking.js +61 -0
  76. codeagent/web/static/01c-session-tree-menus.js +349 -0
  77. codeagent/web/static/01c-session-tree.js +531 -0
  78. codeagent/web/static/01c-session-utilities.js +83 -0
  79. codeagent/web/static/01c-vision-model.js +132 -0
  80. codeagent/web/static/01d-image-gen-model.js +84 -0
  81. codeagent/web/static/01e-audio-model.js +97 -0
  82. codeagent/web/static/01f-compose-ui.js +88 -0
  83. codeagent/web/static/01g-tts-settings.js +128 -0
  84. codeagent/web/static/01h-music-model.js +85 -0
  85. codeagent/web/static/01i-model-stack.js +291 -0
  86. codeagent/web/static/01j-video-gen-model.js +85 -0
  87. codeagent/web/static/01k-model-stack-bootstrap.js +66 -0
  88. codeagent/web/static/01k-model-stack-state.js +209 -0
  89. codeagent/web/static/01q-inflight.js +195 -0
  90. codeagent/web/static/02-reset.css +22 -0
  91. codeagent/web/static/02-session-ui.js +201 -0
  92. codeagent/web/static/03-layout-p1.css +2 -0
  93. codeagent/web/static/03-layout-p2.css +2 -0
  94. codeagent/web/static/03a-links-stream.js +88 -0
  95. codeagent/web/static/03b-stream-text.js +119 -0
  96. codeagent/web/static/03c-render-bubble.js +520 -0
  97. codeagent/web/static/03d-agent-bubble.js +126 -0
  98. codeagent/web/static/03e-tool-trace.js +182 -0
  99. codeagent/web/static/03f-timeline.js +54 -0
  100. codeagent/web/static/03g-bubble-tts.js +292 -0
  101. codeagent/web/static/04-components-p1.css +1 -0
  102. codeagent/web/static/04-components-p2b.css +1 -0
  103. codeagent/web/static/04-components-p3.css +2 -0
  104. codeagent/web/static/04-components-p4.css +1 -0
  105. codeagent/web/static/04-components-p5.css +1 -0
  106. codeagent/web/static/04-components-p6.css +58 -0
  107. codeagent/web/static/04-components-p7.css +4 -0
  108. codeagent/web/static/04-components-p8.css +1 -0
  109. codeagent/web/static/04-components-p9.css +1 -0
  110. codeagent/web/static/04-ws-connect.js +351 -0
  111. codeagent/web/static/04-ws-helpers.js +116 -0
  112. codeagent/web/static/05-chat-p1.css +1058 -0
  113. codeagent/web/static/05-chat-p2.css +1 -0
  114. codeagent/web/static/05-chat-p3.css +295 -0
  115. codeagent/web/static/05a-session-history.js +176 -0
  116. codeagent/web/static/05b-session-list.js +114 -0
  117. codeagent/web/static/05c-dialog.js +123 -0
  118. codeagent/web/static/05d-project-create.js +172 -0
  119. codeagent/web/static/05e-project-remote.js +143 -0
  120. codeagent/web/static/06-chat.js +552 -0
  121. codeagent/web/static/06-utilities.css +181 -0
  122. codeagent/web/static/06b-attachments.js +304 -0
  123. codeagent/web/static/06c-camera.js +488 -0
  124. codeagent/web/static/07-activity-bar.css +127 -0
  125. codeagent/web/static/09-git-p1.css +1 -0
  126. codeagent/web/static/09-git-p2.css +1 -0
  127. codeagent/web/static/09a-init-bind.js +110 -0
  128. codeagent/web/static/09b-panel-toggle.js +80 -0
  129. codeagent/web/static/09c-api-refresh.js +100 -0
  130. codeagent/web/static/09d-status-log.js +80 -0
  131. codeagent/web/static/09e-commit.js +80 -0
  132. codeagent/web/static/09f-remote.js +93 -0
  133. codeagent/web/static/11a-cron-parse.js +117 -0
  134. codeagent/web/static/11b-cron-panel.js +100 -0
  135. codeagent/web/static/11c-cron-card.js +133 -0
  136. codeagent/web/static/11d-cron-form.js +105 -0
  137. codeagent/web/static/11e-env-config.js +168 -0
  138. codeagent/web/static/11f-env-llm-a-state.js +136 -0
  139. codeagent/web/static/11f-env-llm-b-form.js +409 -0
  140. codeagent/web/static/11f-env-llm-c-board.js +322 -0
  141. codeagent/web/static/11g-env-paths-git.js +973 -0
  142. codeagent/web/static/11h-env-mcp-a-state.js +161 -0
  143. codeagent/web/static/11h-env-mcp-b-form.js +229 -0
  144. codeagent/web/static/11h-env-mcp-c-board.js +565 -0
  145. codeagent/web/static/12-plugins.js +127 -0
  146. codeagent/web/static/13a-skills.js +156 -0
  147. codeagent/web/static/13a-todo-utils.js +140 -0
  148. codeagent/web/static/13b-todo-fetch.js +106 -0
  149. codeagent/web/static/13b-tools.js +127 -0
  150. codeagent/web/static/13c-todo-crud.js +92 -0
  151. codeagent/web/static/14-activity-bar.js +177 -0
  152. codeagent/web/static/15-plans.css +194 -0
  153. codeagent/web/static/15-plans.js +219 -0
  154. codeagent/web/static/16-mobile.css +612 -0
  155. codeagent/web/static/16-mobile.js +178 -0
  156. codeagent/web/static/17-preset-ux.css +287 -0
  157. codeagent/web/static/18-agent-mgr.css +616 -0
  158. codeagent/web/static/18-agent-mgr.js +204 -0
  159. codeagent/web/static/24-health-dashboard.js +68 -0
  160. codeagent/web/static/99-brand-polish.css +152 -0
  161. codeagent/web/static/body.html +824 -0
  162. codeagent/web/static/setup/setup_form.html +171 -0
  163. codeagent/web/static/setup/setup_head.html +100 -0
  164. codeagent/web/static/setup/setup_tail.html +264 -0
  165. codeagent/web/static/setup/setup_test.html +38 -0
  166. codeagent/web/web_login.html +265 -0
  167. codeagent/web/webui.html +35 -0
  168. tagword_codeagent-1.1.6.dist-info/METADATA +273 -0
  169. tagword_codeagent-1.1.6.dist-info/RECORD +173 -0
  170. tagword_codeagent-1.1.6.dist-info/WHEEL +5 -0
  171. tagword_codeagent-1.1.6.dist-info/entry_points.txt +3 -0
  172. tagword_codeagent-1.1.6.dist-info/licenses/LICENSE +21 -0
  173. tagword_codeagent-1.1.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * 时间轴上的单条工具记录(与会话历史 / WS 实时共用 DOM 结构)。
3
+ * @param {object} row { tool, arguments, result }
4
+ * @param {number} index
5
+ * @param {number} total
6
+ * @param {{prepend?:boolean,skipScroll?:boolean,running?:boolean,hideIndex?:boolean}} opts
7
+ * @returns {HTMLDetailsElement}
8
+ */
9
+ /** 工具生成内容的媒体类型定义(图片/音频/视频) */
10
+ const _MEDIA_HANDLERS = [
11
+ {
12
+ toolName: 'image_generate',
13
+ containerClass: 'oa-tool-gen-images',
14
+ extractItems(payload) {
15
+ return Array.isArray(payload?.images) ? payload.images : [];
16
+ },
17
+ createEl(item) {
18
+ const el = document.createElement('img');
19
+ el.className = 'chat-inline-img bubble-user__img';
20
+ el.alt = item.filename || 'generated';
21
+ return el;
22
+ },
23
+ postProcess(wrap) {
24
+ if (typeof enhanceChatImagesInBubble === 'function') enhanceChatImagesInBubble(wrap);
25
+ },
26
+ },
27
+ {
28
+ toolName: 'music_generate',
29
+ containerClass: 'oa-tool-gen-audio',
30
+ extractItems(payload) {
31
+ return payload?.audio ? [payload.audio] : [];
32
+ },
33
+ createEl() {
34
+ const el = document.createElement('audio');
35
+ el.controls = true;
36
+ el.preload = 'metadata';
37
+ return el;
38
+ },
39
+ },
40
+ {
41
+ toolName: 'video_generate',
42
+ containerClass: 'oa-tool-gen-video',
43
+ extractItems(payload) {
44
+ return payload?.video ? [payload.video] : [];
45
+ },
46
+ createEl() {
47
+ const el = document.createElement('video');
48
+ el.controls = true;
49
+ el.preload = 'metadata';
50
+ return el;
51
+ },
52
+ },
53
+ ];
54
+
55
+ function _attachmentMediaUrl(attachmentId) {
56
+ return '/api/attachments/' + encodeURIComponent(attachmentId)
57
+ + '?session_id=' + encodeURIComponent(typeof sessionId !== 'undefined' ? sessionId : 'web-chat')
58
+ + '&agent_id=' + encodeURIComponent(typeof agentId !== 'undefined' ? agentId : 'default');
59
+ }
60
+
61
+ /** 在工具行内追加生成内容预览(图片/音频/视频),根据 row.tool 自动判断类型。 */
62
+ function appendGeneratedMediaToToolRow(detailsEl, row) {
63
+ if (!detailsEl || !row) return;
64
+ const name = (row.tool || row.name || '').toLowerCase();
65
+ const handler = _MEDIA_HANDLERS.find(function(h) { return h.toolName === name; });
66
+ if (!handler) return;
67
+ let payload;
68
+ try { payload = JSON.parse(String(row.result || '')); } catch (_) { return; }
69
+ const items = handler.extractItems(payload);
70
+ if (!items.length) return;
71
+ detailsEl.querySelectorAll('.' + handler.containerClass).forEach(function(n) { n.remove(); });
72
+ const wrap = document.createElement('div');
73
+ wrap.className = handler.containerClass;
74
+ items.forEach(function(item) {
75
+ if (!item || !item.attachment_id) return;
76
+ const el = handler.createEl(item);
77
+ el.src = _attachmentMediaUrl(item.attachment_id);
78
+ wrap.appendChild(el);
79
+ });
80
+ if (wrap.childNodes.length) {
81
+ detailsEl.appendChild(wrap);
82
+ if (handler.postProcess) handler.postProcess(wrap);
83
+ }
84
+ }
85
+
86
+ function appendAgentToolTraceRowToLog(row, index, total, opts) {
87
+ opts = opts || {};
88
+ const name = (row && (row.tool || row.name)) || 'tool';
89
+ const args = row && row.arguments != null ? String(row.arguments) : '';
90
+ const res = row && row.result != null ? String(row.result) : '';
91
+ const running = !!opts.running;
92
+ const showIdx = total > 1 && !opts.hideIndex;
93
+ const suffix = showIdx ? ' (' + (index + 1) + ')' : '';
94
+
95
+ const wrap = document.createElement('details');
96
+ wrap.className = 'system-msg system-tools oa-live-tool';
97
+ if (running) wrap.classList.add('is-running');
98
+
99
+ const summary = document.createElement('summary');
100
+ summary.className = 'oa-live-tool-summary';
101
+ if (running) {
102
+ const spinner = document.createElement('span');
103
+ spinner.className = 'oa-live-tool-spinner';
104
+ spinner.setAttribute('aria-hidden', 'true');
105
+ summary.appendChild(spinner);
106
+ }
107
+ const label = document.createElement('span');
108
+ label.className = 'oa-live-tool-label oa-live-tool-title';
109
+ label.textContent = (running ? '执行中:' : '已完成:') + name + suffix;
110
+ summary.appendChild(label);
111
+
112
+ const pre = document.createElement('pre');
113
+ pre.className = 'oa-tool-trace-pre';
114
+ if (running) {
115
+ pre.textContent = args ? '参数:\n' + args + '\n' : '';
116
+ } else {
117
+ pre.textContent = '参数:\n' + args + '\n\n输出:\n' + res;
118
+ }
119
+ wrap.appendChild(summary);
120
+ wrap.appendChild(pre);
121
+
122
+ appendGeneratedMediaToToolRow(wrap, row);
123
+
124
+ if (opts.prepend && log.firstChild) {
125
+ log.insertBefore(wrap, log.firstChild);
126
+ } else {
127
+ log.appendChild(wrap);
128
+ }
129
+ if (!opts.skipScroll) scrollLog();
130
+ return wrap;
131
+ }
132
+
133
+ /** 用服务端 tool_trace 覆盖/补齐当前 log 内的时间轴工具块(与 WS 块对齐)。
134
+ * 自动清理多余旧块(防重),确保最终 log 中工具块数 === toolTrace.length。 */
135
+ function syncLiveToolsFromToolTrace(toolTrace) {
136
+ if (typeof log === 'undefined' || !log) return;
137
+ const tt = Array.isArray(toolTrace) ? toolTrace : [];
138
+ // 收集当前所有工具块
139
+ const all = [];
140
+ try {
141
+ log.querySelectorAll('details.system-msg.system-tools.oa-live-tool').forEach(function(n) {
142
+ all.push(n);
143
+ });
144
+ } catch (_) {}
145
+ // 清理多余旧块:保留最后 tt.length 个,移除前面的
146
+ if (all.length > tt.length) {
147
+ const removeCount = all.length - tt.length;
148
+ all.slice(0, removeCount).forEach(function(n) {
149
+ try { n.parentNode.removeChild(n); } catch (_) {}
150
+ });
151
+ var kept = all.slice(removeCount);
152
+ } else {
153
+ var kept = all.slice();
154
+ }
155
+ // 更新/补齐
156
+ for (var i = 0; i < tt.length; i++) {
157
+ if (i < kept.length) {
158
+ updateTimelineToolRowElement(kept[i], tt[i], i, tt.length);
159
+ } else {
160
+ appendAgentToolTraceRowToLog(tt[i], i, tt.length, { skipScroll: true });
161
+ }
162
+ }
163
+ scrollLog();
164
+ }
165
+
166
+ function updateTimelineToolRowElement(detailsEl, row, index, total) {
167
+ if (!detailsEl || !row) return;
168
+ detailsEl.classList.remove('is-running');
169
+ const name = (row && (row.tool || row.name)) || 'tool';
170
+ const args = row && row.arguments != null ? String(row.arguments) : '';
171
+ const res = row && row.result != null ? String(row.result) : '';
172
+ const title = detailsEl.querySelector('.oa-live-tool-title');
173
+ if (title) {
174
+ const suffix = total > 1 ? ' (' + (index + 1) + ')' : '';
175
+ title.textContent = '已完成:' + name + suffix;
176
+ }
177
+ const pre = detailsEl.querySelector('.oa-tool-trace-pre');
178
+ if (pre) pre.textContent = '参数:\n' + args + '\n\n输出:\n' + res;
179
+ appendGeneratedMediaToToolRow(detailsEl, row);
180
+ const spin = detailsEl.querySelector('.oa-live-tool-spinner');
181
+ if (spin && spin.parentNode) spin.parentNode.removeChild(spin);
182
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * 渲染助手消息,但将 toolTrace 中的每个工具调用渲染为独立元素,
3
+ * 而不是全部塞在一个气泡里。用于转录加载时保持与实时执行一致的展示。
4
+ */
5
+ function bubbleAgentWithSplitToolTrace(text, toolTrace, opts) {
6
+ opts = opts || {};
7
+ const at = opts.at;
8
+ const tt = Array.isArray(toolTrace) ? toolTrace : [];
9
+
10
+ // 1. 文本内容气泡(reasoning_content 由 opts.reasoningContent 传入,暂不展现)
11
+ const cleanText = stripOaToolOrphans(normReply(text || ''));
12
+ if (cleanText) {
13
+ const wrap = document.createElement('div');
14
+ wrap.className = 'msg-row msg-agent';
15
+ const col = document.createElement('div');
16
+ col.className = 'msg-col';
17
+ const meta = document.createElement('div');
18
+ meta.className = 'msg-meta';
19
+ const label = '助手';
20
+ const ts = formatBubbleTime(at);
21
+ meta.textContent = ts ? label + ' · ' + ts : label;
22
+ const b = document.createElement('div');
23
+ b.className = 'bubble bubble-agent';
24
+ b.innerHTML = renderMarkdown(cleanText);
25
+ ensureLinksOpenNewTab(b);
26
+ col.appendChild(meta);
27
+ col.appendChild(b);
28
+ if (typeof appendBubbleTtsBar === 'function') {
29
+ appendBubbleTtsBar(col, text, { role: 'agent' });
30
+ }
31
+ wrap.appendChild(col);
32
+ if (opts.prepend && log.firstChild) {
33
+ log.insertBefore(wrap, log.firstChild);
34
+ } else {
35
+ log.appendChild(wrap);
36
+ }
37
+ }
38
+
39
+ // 3. 每个工具调用独立渲染(与 WS 实时 appendAgentToolTraceRowToLog 一致)
40
+ tt.forEach(function(row, i) {
41
+ appendAgentToolTraceRowToLog(row, i, tt.length, { prepend: !!opts.prepend, skipScroll: true });
42
+ });
43
+
44
+ if (!opts.skipScroll && !opts.prepend) scrollLog();
45
+ }
46
+
47
+ function systemMsg(kind, text, opts) {
48
+ opts = opts || {};
49
+ const d = document.createElement('div');
50
+ d.className = 'system-msg system-' + kind;
51
+ d.textContent = text;
52
+ log.appendChild(d);
53
+ if (!opts.skipScroll) scrollLog();
54
+ }
@@ -0,0 +1,292 @@
1
+ /* Bubble text-to-speech: cached playback + MiniMax / browser fallback */
2
+
3
+ var _bubbleTtsAudio = null;
4
+ var _bubbleTtsBtn = null;
5
+
6
+ function plainTextForTts(raw) {
7
+ var t = String(raw || '');
8
+ if (typeof normReply === 'function') t = normReply(t);
9
+ t = t.replace(/```[\s\S]*?```/g, ' ');
10
+ t = t.replace(/`([^`]+)`/g, '$1');
11
+ t = t.replace(/!\[[^\]]*\]\([^)]*\)/g, '');
12
+ t = t.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1');
13
+ t = t.replace(/^#+\s+/gm, '');
14
+ t = t.replace(/<[^>]+>/g, ' ');
15
+ t = t.replace(/[*_~>#|]/g, ' ');
16
+ t = t.replace(/\s+/g, ' ').trim();
17
+ return t;
18
+ }
19
+
20
+ function ttsCacheKey(plain, settings) {
21
+ return (settings.voice_id || '') + '|' + (settings.model || '') + '|' + plain;
22
+ }
23
+
24
+ function clearBubbleTtsCache(btn) {
25
+ if (!btn) return;
26
+ if (btn._ttsCacheUrl) {
27
+ try { URL.revokeObjectURL(btn._ttsCacheUrl); } catch (_) {}
28
+ }
29
+ btn._ttsCacheKey = null;
30
+ btn._ttsCacheUrl = null;
31
+ }
32
+
33
+ function clearAllBubbleTtsCaches() {
34
+ try {
35
+ document.querySelectorAll('.bubble-tts-btn').forEach(function(btn) {
36
+ clearBubbleTtsCache(btn);
37
+ });
38
+ } catch (_) {}
39
+ }
40
+
41
+ function stopBubbleTtsPlayback() {
42
+ if (_bubbleTtsAudio) {
43
+ try {
44
+ _bubbleTtsAudio.pause();
45
+ _bubbleTtsAudio.currentTime = 0;
46
+ } catch (_) {}
47
+ _bubbleTtsAudio = null;
48
+ }
49
+ if (window.speechSynthesis) {
50
+ try { window.speechSynthesis.cancel(); } catch (_) {}
51
+ }
52
+ if (_bubbleTtsBtn) {
53
+ _bubbleTtsBtn.classList.remove('is-playing');
54
+ _bubbleTtsBtn.setAttribute('aria-label', '朗读');
55
+ _bubbleTtsBtn = null;
56
+ }
57
+ }
58
+
59
+ function speakBubbleWithBrowser(text, btn) {
60
+ if (!window.speechSynthesis) return false;
61
+ stopBubbleTtsPlayback();
62
+ _bubbleTtsBtn = btn;
63
+ btn.classList.add('is-playing');
64
+ btn.setAttribute('aria-label', '停止朗读');
65
+ var u = new SpeechSynthesisUtterance(text);
66
+ u.lang = 'zh-CN';
67
+ u.onend = function() { stopBubbleTtsPlayback(); };
68
+ u.onerror = function() { stopBubbleTtsPlayback(); };
69
+ window.speechSynthesis.speak(u);
70
+ return true;
71
+ }
72
+
73
+ async function playBubbleAudioUrl(url, btn) {
74
+ stopBubbleTtsPlayback();
75
+ _bubbleTtsBtn = btn;
76
+ btn.classList.add('is-playing');
77
+ btn.setAttribute('aria-label', '停止朗读');
78
+ var audio = new Audio(url);
79
+ _bubbleTtsAudio = audio;
80
+ audio.onended = function() { stopBubbleTtsPlayback(); };
81
+ audio.onerror = function() { stopBubbleTtsPlayback(); };
82
+ await audio.play();
83
+ }
84
+
85
+ async function fetchAndCacheBubbleTts(plain, settings, btn) {
86
+ var r = await fetch('/api/tts', {
87
+ method: 'POST',
88
+ headers: { 'Content-Type': 'application/json' },
89
+ credentials: 'same-origin',
90
+ body: JSON.stringify({
91
+ text: plain,
92
+ voice_id: settings.voice_id || undefined,
93
+ model: settings.model || undefined,
94
+ }),
95
+ });
96
+ if (!r.ok) {
97
+ var err = null;
98
+ try { err = await r.json(); } catch (_) {}
99
+ var detail = (err && err.detail) || r.statusText || 'TTS failed';
100
+ var e = new Error(detail);
101
+ e.fallback = !!(err && err.fallback);
102
+ e.statusCode = (err && err.status_code) || r.status;
103
+ throw e;
104
+ }
105
+ var blob = await r.blob();
106
+ clearBubbleTtsCache(btn);
107
+ var url = URL.createObjectURL(blob);
108
+ btn._ttsCacheKey = ttsCacheKey(plain, settings);
109
+ btn._ttsCacheUrl = url;
110
+ await playBubbleAudioUrl(url, btn);
111
+ }
112
+
113
+ async function toggleBubbleTts(text, btn) {
114
+ if (btn.classList.contains('is-playing')) {
115
+ stopBubbleTtsPlayback();
116
+ return;
117
+ }
118
+ var plain = plainTextForTts(text);
119
+ if (!plain || plain.length < 2) return;
120
+ var settings = typeof getTtsPlaybackSettings === 'function'
121
+ ? getTtsPlaybackSettings()
122
+ : { voice_id: '', model: '' };
123
+ var key = ttsCacheKey(plain, settings);
124
+
125
+ if (btn._ttsCacheKey === key && btn._ttsCacheUrl) {
126
+ try {
127
+ await playBubbleAudioUrl(btn._ttsCacheUrl, btn);
128
+ } catch (_) {
129
+ clearBubbleTtsCache(btn);
130
+ await fetchAndCacheBubbleTts(plain, settings, btn);
131
+ }
132
+ return;
133
+ }
134
+
135
+ try {
136
+ await fetchAndCacheBubbleTts(plain, settings, btn);
137
+ } catch (e) {
138
+ var usedBrowser = false;
139
+ if (e && e.fallback) {
140
+ usedBrowser = speakBubbleWithBrowser(plain, btn);
141
+ }
142
+ if (typeof systemMsg === 'function') {
143
+ var msg = String((e && e.message) || 'TTS 不可用');
144
+ if (usedBrowser) {
145
+ systemMsg('info', 'MiniMax 朗读失败:' + msg + '(已改用浏览器朗读)');
146
+ } else {
147
+ systemMsg('err', '无法朗读:' + msg);
148
+ }
149
+ } else if (!usedBrowser && !(e && e.fallback)) {
150
+ speakBubbleWithBrowser(plain, btn);
151
+ }
152
+ }
153
+ }
154
+
155
+ async function copyBubbleContent(text, btn) {
156
+ var content = String(text || '');
157
+ if (typeof normReply === 'function') content = normReply(content);
158
+ if (typeof stripOaToolOrphans === 'function') content = stripOaToolOrphans(content);
159
+ if (typeof extractOaToolCallBlocks === 'function') content = extractOaToolCallBlocks(content).text;
160
+ content = content.trim();
161
+ if (!content) return;
162
+
163
+ var copied = false;
164
+ try {
165
+ if (navigator.clipboard && navigator.clipboard.writeText) {
166
+ await navigator.clipboard.writeText(content);
167
+ copied = true;
168
+ }
169
+ } catch (_) {}
170
+
171
+ if (!copied) {
172
+ try {
173
+ if (typeof copyToClipboard === 'function') {
174
+ copyToClipboard(content);
175
+ copied = true;
176
+ } else {
177
+ var ta = document.createElement('textarea');
178
+ ta.value = content;
179
+ ta.style.position = 'fixed';
180
+ ta.style.opacity = '0';
181
+ document.body.appendChild(ta);
182
+ ta.select();
183
+ document.execCommand('copy');
184
+ document.body.removeChild(ta);
185
+ copied = true;
186
+ }
187
+ } catch (_) {}
188
+ }
189
+
190
+ if (!copied || !btn) return;
191
+
192
+ var defaultIcon = btn.innerHTML;
193
+ btn.classList.add('is-copied');
194
+ btn.setAttribute('aria-label', '已复制');
195
+ btn.title = '已复制';
196
+ btn.innerHTML = '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';
197
+ setTimeout(function() {
198
+ btn.classList.remove('is-copied');
199
+ btn.setAttribute('aria-label', '复制');
200
+ btn.title = '复制内容';
201
+ btn.innerHTML = defaultIcon;
202
+ }, 1500);
203
+ }
204
+
205
+ function appendBubbleTtsBar(col, rawText, opts) {
206
+ opts = opts || {};
207
+ if (!col) return;
208
+ var role = opts.role || 'agent';
209
+ if (role === 'agent') {
210
+ var plain = plainTextForTts(rawText);
211
+ if (!plain || plain.length < 2) return;
212
+ }
213
+
214
+ var existing = col.querySelector('.bubble-tts-bar');
215
+ if (existing) existing.remove();
216
+
217
+ var bar = document.createElement('div');
218
+ bar.className = 'bubble-tts-bar';
219
+
220
+ // 复制按钮(所有角色都有)
221
+ var copyBtn = document.createElement('button');
222
+ copyBtn.type = 'button';
223
+ copyBtn.className = 'bubble-copy-btn';
224
+ copyBtn.title = '复制内容';
225
+ copyBtn.setAttribute('aria-label', '复制');
226
+ copyBtn.innerHTML = '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>';
227
+ copyBtn.addEventListener('click', function(e) {
228
+ e.stopPropagation();
229
+ copyBubbleContent(rawText, copyBtn);
230
+ });
231
+ bar.appendChild(copyBtn);
232
+
233
+ // 朗读按钮(仅 agent 消息)
234
+ if (role === 'agent') {
235
+ var btn = document.createElement('button');
236
+ btn.type = 'button';
237
+ btn.className = 'bubble-tts-btn';
238
+ btn.title = '朗读(首次合成,之后复播)';
239
+ btn.setAttribute('aria-label', '朗读');
240
+ btn.innerHTML = '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.364 5.636a9 9 0 0 1 0 12.728"/></svg>';
241
+ btn.addEventListener('click', function(e) {
242
+ e.stopPropagation();
243
+ toggleBubbleTts(rawText, btn);
244
+ });
245
+ bar.appendChild(btn);
246
+ }
247
+
248
+ col.appendChild(bar);
249
+ }
250
+
251
+ // ── 代码块复制(全局事件委托) ──
252
+ document.addEventListener('click', function(e) {
253
+ var btn = e.target.closest('.code-copy-btn');
254
+ if (!btn) return;
255
+ var wrap = btn.closest('.code-block-wrap');
256
+ if (!wrap) return;
257
+ var code = wrap.querySelector('code');
258
+ if (!code) return;
259
+ var text = code.textContent || '';
260
+ if (!text) return;
261
+
262
+ var copied = false;
263
+ try {
264
+ if (navigator.clipboard && navigator.clipboard.writeText) {
265
+ navigator.clipboard.writeText(text).then(function() { copied = true; }).catch(function() {});
266
+ }
267
+ } catch (_) {}
268
+
269
+ if (!copied) {
270
+ try {
271
+ var ta = document.createElement('textarea');
272
+ ta.value = text;
273
+ ta.style.position = 'fixed';
274
+ ta.style.opacity = '0';
275
+ document.body.appendChild(ta);
276
+ ta.select();
277
+ document.execCommand('copy');
278
+ document.body.removeChild(ta);
279
+ copied = true;
280
+ } catch (_) {}
281
+ }
282
+
283
+ if (!copied || !btn) return;
284
+
285
+ var orig = btn.innerHTML;
286
+ btn.innerHTML = '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';
287
+ btn.classList.add('is-copied');
288
+ setTimeout(function() {
289
+ btn.classList.remove('is-copied');
290
+ btn.innerHTML = orig;
291
+ }, 1500);
292
+ });
@@ -0,0 +1 @@
1
+ /* ================================================================ * 04-components.css — Nav rail, session panel, buttons, forms, sections * ================================================================ *//* ============ Nav rail ============ */.nav-rail { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-1) 0;}.nav-rail__item { display: flex; align-items: center; gap: var(--sp-3); padding: 7px 10px; border: none; background: transparent; border-radius: var(--r-md); cursor: pointer; color: var(--text-secondary); font-size: 13px; font-weight: 500; text-align: left; transition: background 0.12s ease, color 0.12s ease;}.nav-rail__item:hover { background: var(--bg-hover); color: var(--text); }.nav-rail__item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600;}.nav-rail__icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; opacity: 0.9;}.nav-rail__label { flex: 1; min-width: 0; }
@@ -0,0 +1 @@
1
+ /* ============ Session panel ============ */.sess-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 var(--sp-2) var(--sp-2);}.sess-panel__toolbar { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-1); margin-bottom: var(--sp-2); flex-shrink: 0;}.agent-select { flex: 1; min-width: 0; height: 28px; padding: 0 26px 0 8px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12px; color: var(--text); appearance: none; cursor: pointer; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 8l4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: right 6px center; background-size: 14px;}.agent-select:hover { border-color: var(--border-strong); }.sess-new-btn { flex-shrink: 0; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-subtle); color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;}.sess-new-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }.sess-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding: var(--sp-1) 0 var(--sp-1); margin: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;}.sess-list::-webkit-scrollbar { width: 6px; }.sess-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }.sess-list::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }.sess-row { display: flex; align-items: stretch; width: 100%; border-radius: var(--r-md); transition: background 0.12s ease; position: relative;}.sess-row:hover { background: var(--bg-hover); }.sess-row.is-active { background: var(--accent-soft); }.sess-row.is-active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--accent); border-radius: 0 2px 2px 0;}.sess-item-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: var(--sp-2); text-align: left; padding: 7px 6px 7px 10px; border: none; background: transparent; cursor: pointer; color: inherit; font: inherit; border-radius: var(--r-md);}.sess-item__channel-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-subtle); margin-top: 7px; flex-shrink: 0; opacity: 0.6;}.sess-row.is-active .sess-item__channel-dot { background: var(--accent); opacity: 1; }.sess-item__body { flex: 1; min-width: 0; }.sess-item__title { font-size: 12.5px; font-weight: 500; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;}.sess-row.is-active .sess-item__title { font-weight: 600; color: var(--accent); }.sess-item__sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;}.sess-item__badge { flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; margin-top: 3px; border-radius: var(--r-full); background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-variant-numeric: tabular-nums;}.sess-item__badge[hidden] { display: none !important; }.sess-item__op-wrap { position: relative; flex-shrink: 0; display: flex; align-items: flex-start; padding: 5px 4px 5px 0; opacity: 0; transition: opacity 0.12s ease;}.sess-row:hover .sess-item__op-wrap,.sess-row.is-active .sess-item__op-wrap,.sess-item__op-wrap:focus-within { opacity: 1; }.sess-item__op-trigger { width: 22px; height: 22px; padding: 0; border: none; border-radius: var(--r-xs); background: transparent; color: var(--text-muted); font-size: 14px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;}.sess-item__op-trigger:hover { background: var(--bg-hover); color: var(--text); }.sess-item__menu { position: absolute; right: 0; top: 100%; margin-top: 4px; min-width: 120px; padding: var(--sp-1); display: none; flex-direction: column; gap: 1px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); z-index: 40;}.sess-item__op-wrap:hover .sess-item__menu,.sess-item__op-wrap:focus-within .sess-item__menu { display: flex; }.sess-item__menu button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--text-secondary); font-size: 12.5px; cursor: pointer; font: inherit;}.sess-item__menu button:hover { background: var(--bg-hover); color: var(--text); }.sess-item__menu-danger:hover { background: var(--danger-soft) !important; color: var(--danger) !important; }
@@ -0,0 +1,2 @@
1
+ /* ============ Buttons ============ */.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; height: 30px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text-secondary); font-size: 12.5px; font-weight: 500; line-height: 1; cursor: pointer; font-family: inherit; white-space: nowrap; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;}.btn:disabled { opacity: 0.45; cursor: not-allowed; }.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(79, 70, 229, 0.22);}.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }.btn--primary:active:not(:disabled) { transform: translateY(0.5px); }.btn--ghost { background: var(--bg-panel); color: var(--text-secondary); border-color: var(--border);}.btn--ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text); }.btn--subtle { background: transparent; color: var(--text-muted);}.btn--subtle:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }.btn--xs { height: 24px; padding: 0 7px; font-size: 11px; border-radius: var(--r-xs); }
2
+ /* ============ Form controls ============ */.form-label { display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin: var(--sp-4) 0 var(--sp-2);}.form-label:first-child,div > .form-label:first-of-type { margin-top: 0; }input[type=text], input[type=password], input[type=url], input[type=search], input[type=number], select, textarea { width: 100%; background: var(--bg-panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); padding: 7px 10px; font-family: inherit; font-size: 13px; line-height: 1.4; transition: border-color 0.12s ease, box-shadow 0.12s ease;}input[type=text]:hover, input[type=password]:hover, input[type=url]:hover, input[type=number]:hover, select:hover, textarea:hover { border-color: var(--border-strong); }input[type=text]:focus, input[type=password]:focus, input[type=url]:focus, input[type=number]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus);}textarea { resize: vertical; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55;}.md-select { max-width: 360px; padding-right: 30px; }.cron-json-edit { min-height: 200px; }.env-edit { min-height: 220px; margin-top: var(--sp-3); }.env-edit.md-edit { min-height: 320px; }.checkbox-row { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: 13px; color: var(--text-secondary); cursor: pointer; line-height: 1.5; margin: var(--sp-3) 0;}.checkbox-row input { margin-top: 3px; accent-color: var(--accent); }.checkbox-row.stacked { display: flex; }/* ============ Chat env config form ============ */.form-row { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-3) 0; flex-wrap: wrap;}.form-row .form-label { margin: 0; white-space: nowrap; min-width: 120px;}.form-input-sm { width: 100px;}.form-hint { font-size: 11px; color: var(--text-muted); margin-left: var(--sp-1);}.sub-row { margin-left: var(--sp-5); padding-left: var(--sp-3); border-left: 2px solid var(--border);}.sub-rows { margin-left: var(--sp-5); padding-left: var(--sp-3); border-left: 2px solid var(--border);}.sub-rows .form-row { margin: var(--sp-2) 0;}
@@ -0,0 +1 @@
1
+ /* ============ Sections (config/plugins pages) ============ */.section { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--sp-5) var(--sp-6) var(--sp-6); box-shadow: var(--shadow-xs);}.section__header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3);}.section__title { font-size: 12px; font-weight: 650; letter-spacing: 0.08em; color: var(--text); margin: 0; text-transform: uppercase; display: inline-flex; align-items: center; gap: var(--sp-2);}.section__title::before { content: ''; width: 4px; height: 14px; background: var(--accent); border-radius: 2px; flex-shrink: 0; opacity: 0.85;}.section__desc { font-size: 12.5px; color: var(--text-muted); margin: 0 0 var(--sp-4); line-height: 1.65;}.section code, .section__desc code, .checkbox-row code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 5px; border-radius: 4px; background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-secondary);}.row-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4);}.status-line { margin-top: var(--sp-3); font-size: 12px; color: var(--text-muted); line-height: 1.6; word-break: break-all;}.status-line.is-err { color: var(--danger); }.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-6); margin-top: var(--sp-2);}.field-row { display: flex; gap: var(--sp-2); align-items: stretch; flex-wrap: wrap;}.field-row > input { flex: 1; min-width: 12rem; }/* ============ Preset cards (LLM) ============ */.preset-list { display: flex; flex-direction: column; gap: var(--sp-2);}.preset-card { display: flex; align-items: center; justify-content: space-between; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); transition: border-color 0.12s ease;}.preset-card:hover { border-color: var(--accent); }.preset-card__info { flex: 1; min-width: 0; }.preset-card__name { font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.4;}.preset-card__detail { font-size: 11.5px; color: var(--text-subtle); line-height: 1.4; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.preset-card__actions { display: flex; gap: var(--sp-1); flex-shrink: 0; margin-left: var(--sp-3);}.preset-empty { color: var(--text-subtle); font-size: 13px; padding: var(--sp-4) 0; }.preset-del { color: var(--danger); }.preset-del:hover { background: var(--danger); color: #fff; }.preset-card-wrap { margin-bottom: var(--sp-2); }.preset-card-wrap .preset-card { border-radius: var(--r-md) var(--r-md) 0 0; }.preset-card-wrap .preset-edit-wrap { background: var(--bg-panel); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r-md) var(--r-md); padding: var(--sp-3) var(--sp-4) var(--sp-4);}.preset-card-wrap.is-new .preset-edit-wrap { border-radius: var(--r-md); border: 1px solid var(--accent);}.preset-card__badge { display: inline-block; font-weight: 500; font-size: 10px; color: #fff; background: var(--accent); border-radius: var(--r-xs); padding: 0 5px; margin-left: 6px; vertical-align: middle; line-height: 1.5;}
@@ -0,0 +1 @@
1
+ /* ============ Cron job cards ============ */.cron-list { display: flex; flex-direction: column; gap: var(--sp-2);}.cron-card { display: flex; align-items: center; justify-content: space-between; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); transition: border-color 0.12s ease;}.cron-card:hover { border-color: var(--accent); }.cron-card__info { flex: 1; min-width: 0; }.cron-card__name { font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.4; display: flex; align-items: center; gap: var(--sp-2);}.cron-card__detail { font-size: 11.5px; color: var(--text-subtle); line-height: 1.4; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.cron-card__actions { display: flex; gap: var(--sp-1); flex-shrink: 0; margin-left: var(--sp-3);}.cron-card__badge { display: inline-block; font-weight: 500; font-size: 10px; color: #fff; background: var(--accent); border-radius: var(--r-xs); padding: 0 5px; vertical-align: middle; line-height: 1.5;}.cron-card__badge-off { background: var(--text-muted);}.cron-card__status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px;}.cron-card__status-dot.on { background: #22c55e; }.cron-card__status-dot.off { background: var(--text-muted); }.cron-card-wrap { margin-bottom: var(--sp-2); }.cron-card-wrap .cron-card { border-radius: var(--r-md) var(--r-md) 0 0; }.cron-card-wrap .cron-edit-wrap { background: var(--bg-panel); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r-md) var(--r-md); padding: var(--sp-3) var(--sp-4) var(--sp-4);}.cron-card-wrap.is-new .cron-edit-wrap { border-radius: var(--r-md); border: 1px solid var(--accent);}.cron-empty { color: var(--text-subtle); font-size: 13px; padding: var(--sp-4) 0; }.cron-del { color: var(--danger); }.cron-del:hover { background: var(--danger); color: #fff; }.skill-list .cron-card-wrap, .tool-list .cron-card-wrap { margin-bottom: var(--sp-2); }.tool-card-wrap { margin-bottom: var(--sp-2); }.tool-card-wrap .cron-card { cursor: pointer; border-radius: var(--r-md) var(--r-md) 0 0; }.tool-card-wrap .cron-edit-wrap { border: 1px solid var(--border); border-top: none; padding: var(--sp-3); border-radius: 0 0 var(--r-md) var(--r-md); background: var(--bg);}.cron-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4);}.cron-form-grid .form-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--sp-1);}.cron-form-grid input,.cron-form-grid select,.cron-form-grid textarea { width: 100%; box-sizing: border-box;}.cron-form-full { grid-column: 1 / -1;}.cron-form-full textarea { min-height: 60px; resize: vertical;}/* Cron toggle switch - global */.cron-global-toggle { display: inline-flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); font-size: 13px; font-weight: 500;}.toggle-switch { position: relative; width: 40px; height: 22px; background: var(--border); border-radius: 11px; cursor: pointer; transition: background 0.2s; flex-shrink: 0;}.toggle-switch.on { background: var(--accent); }.toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.2s;}.toggle-switch.on::after { transform: translateX(18px); }/* Inline cron preset selectors */.cron-quick-presets { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1);}.cron-quick-preset { font-size: 10.5px; padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-subtle); cursor: pointer; color: var(--text-secondary); transition: all 0.12s;}.cron-quick-preset:hover { border-color: var(--accent); color: var(--accent);}.cron-quick-preset.active { background: var(--accent); color: #fff; border-color: var(--accent);}/* Frequency block show/hide for natural-language mode switcher */.cron-freq-hidden { display: none !important; }
@@ -0,0 +1,58 @@
1
+ /* Day-of-week pills */.cron-day-pill { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 30px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-subtle); color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.12s; user-select: none;}.cron-day-pill:hover { border-color: var(--accent); color: var(--accent);}.cron-day-pill--on { background: var(--accent); color: #fff; border-color: var(--accent);}/* ============ Stats sidebar ============ */.sidebar-mode { flex: 1; min-height: 0; display: none; flex-direction: column; overflow: hidden;}.sidebar-mode__scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;}.sidebar-mode__scroll::-webkit-scrollbar { width: 6px; }.sidebar-mode__scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px;}.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3) var(--sp-4);}.stats-card { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-subtle); padding: var(--sp-3); text-align: center;}.stats-card__value { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); line-height: 1.2;}.stats-card__label { margin-top: 4px; font-size: 11px; color: var(--text-muted); font-weight: 500;}.stats-section { padding: 0 var(--sp-3) var(--sp-4);}.stats-recent { display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-2);}.stats-recent__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 7px var(--sp-2); border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg);}.stats-recent__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text);}.stats-recent__meta { flex-shrink: 0; font-size: 11px; color: var(--text-muted);}.config-tool-list__empty { color: var(--text-muted); font-size: 12px; padding: 8px 12px; font-style: italic;}.chat-env-form { display: flex; flex-direction: column; gap: var(--sp-3);}.brand--stats { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-1); color: var(--text-muted);}.brand--stats .brand__name { color: var(--text); }/* ============ Search bar ============ */.search-bar { display: flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1) var(--sp-2); margin: var(--sp-2); border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid transparent; transition: border-color 0.12s ease;}.search-bar:focus-within { border-color: var(--accent); }.search-bar__icon { flex-shrink: 0; opacity: 0.4; }.search-bar__input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 12.5px; color: var(--text);}.search-bar__input::placeholder { color: var(--text-subtle); }.search-bar__clear { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: var(--bg-hover); color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;}/* ============ Project tree ============ */.project-tree { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; padding: 0 var(--sp-1);}.project-tree::-webkit-scrollbar { width: 6px; }.project-tree::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }.project-tree__empty { padding: var(--sp-6) var(--sp-3); text-align: center; font-size: 12px; color: var(--text-muted); }
2
+ .project-tree__empty.tree-search__empty { color: var(--text-subtle); font-style: italic; }.project-tree__footer { flex-shrink: 0; padding: var(--sp-2) var(--sp-3);}.tree-footer-btn { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: var(--sp-2); border: none; border-radius: var(--r-sm); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; transition: background 0.1s ease;}.tree-footer-btn:hover { background: var(--bg-hover); color: var(--text); }
3
+
4
+ /* ============ Sidebar cost summary ============ */
5
+ .sidebar-cost {
6
+ flex-shrink: 0;
7
+ padding: var(--sp-1) var(--sp-3) var(--sp-2);
8
+ border-top: 1px solid var(--border);
9
+ margin: 0 var(--sp-2);
10
+ }
11
+ .sidebar-cost__title {
12
+ font-size: 10px;
13
+ font-weight: 600;
14
+ color: var(--text-muted);
15
+ text-transform: uppercase;
16
+ letter-spacing: 0.04em;
17
+ margin-bottom: 4px;
18
+ }
19
+ .cost__list {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: 1px;
23
+ }
24
+ .cost__row {
25
+ display: flex;
26
+ align-items: center;
27
+ gap: var(--sp-2);
28
+ padding: 3px 0;
29
+ font-size: 11px;
30
+ }
31
+ .cost__row--total {
32
+ border-top: 1px solid var(--border);
33
+ margin-top: 2px;
34
+ padding-top: 4px;
35
+ font-weight: 600;
36
+ }
37
+ .cost__model {
38
+ flex: 1;
39
+ min-width: 0;
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ white-space: nowrap;
43
+ color: var(--text-secondary);
44
+ }
45
+ .cost__tokens {
46
+ flex-shrink: 0;
47
+ color: var(--text-muted);
48
+ font-family: var(--font-mono);
49
+ font-size: 10px;
50
+ }
51
+ .cost__amount {
52
+ flex-shrink: 0;
53
+ color: var(--text);
54
+ font-family: var(--font-mono);
55
+ font-size: 10.5px;
56
+ min-width: 48px;
57
+ text-align: right;
58
+ }
@@ -0,0 +1,4 @@
1
+ /* Tree node - project */.tree-project { position: relative;}.tree-project__row { display: flex; align-items: center; gap: 4px; padding: 5px var(--sp-2); border-radius: var(--r-sm); cursor: pointer; user-select: none; position: relative; transition: background 0.1s ease;}.tree-project__row:hover { background: var(--bg-hover); }.tree-project__row--active { background: var(--accent-soft); }.tree-project__toggle { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: none; border-radius: var(--r-xs); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; transition: transform 0.15s ease;}.tree-project__toggle--expanded { transform: rotate(90deg); }.tree-project__icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); opacity: 0.9;}.tree-project__icon svg { display: block; }.tree-project__name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.tree-project__menu,
2
+ .tree-project__add-session { flex-shrink: 0; width: 20px; height: 20px; display: none; align-items: center; justify-content: center; border: none; border-radius: var(--r-xs); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;}.tree-project__row:hover .tree-project__menu,
3
+ .tree-project__row:hover .tree-project__add-session { display: flex; }.tree-project__menu:hover,
4
+ .tree-project__add-session:hover { background: var(--bg-hover); color: var(--text); }.tree-project__active-bar { position: absolute; left: -8px; top: 50%; transform: translateY(-50%); width: 3px; height: 14px; border-radius: 0 3px 3px 0; background: var(--accent);}/* Tree node - session (child) */.tree-session { padding-left: 28px; }.tree-session__row { display: flex; align-items: center; gap: 6px; padding: 4px var(--sp-2); border-radius: var(--r-sm); cursor: pointer; user-select: none; position: relative; transition: background 0.1s ease;}.tree-session__row:hover { background: var(--bg-hover); }.tree-session__row--active { background: var(--accent-soft); }.tree-session__indicator { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong);}.tree-session__row--unread .tree-session__indicator { background: var(--accent); }.tree-session__title { flex: 1; min-width: 0; font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.tree-session__row--active .tree-session__title { color: var(--accent); font-weight: 600; }.tree-session__menu { flex-shrink: 0; width: 18px; height: 18px; display: none; align-items: center; justify-content: center; border: none; border-radius: var(--r-xs); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px;}.tree-session__row:hover .tree-session__menu { display: flex; }.tree-session__menu:hover { background: var(--bg-hover); color: var(--text); }.tree-session__new { padding: 4px var(--sp-2) 4px 28px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); cursor: pointer; border: none; background: none; width: 100%; text-align: left; border-radius: var(--r-sm); transition: color 0.1s ease;}.tree-session__new:hover { color: var(--accent); background: var(--bg-hover); }.tree-session__empty { padding: 4px var(--sp-2) 4px 28px; font-size: 11.5px; color: var(--text-subtle);}/* Search results */.tree-search-result { padding: var(--sp-2); }.tree-search-result__item { display: flex; align-items: center; gap: var(--sp-2); padding: 6px var(--sp-2); border-radius: var(--r-sm); cursor: pointer; transition: background 0.1s ease;}.tree-search-result__item:hover { background: var(--bg-hover); }.tree-search-result__item--active { background: var(--accent-soft); }.tree-search-result__type { font-size: 11px; color: var(--text-muted); flex-shrink: 0;}.tree-search-result__name { flex: 1; min-width: 0; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.tree-search-result__project { font-size: 10px; color: var(--text-subtle); flex-shrink: 0;}/* Context menu */.tree-context-menu { position: fixed; z-index: 999; min-width: 140px; padding: var(--sp-1) 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);}.tree-context-menu__item { display: flex; align-items: center; gap: var(--sp-2); padding: 6px var(--sp-3); font-size: 12px; color: var(--text); cursor: pointer; transition: background 0.1s ease; border: none; background: none; width: 100%; text-align: left;}.tree-context-menu__item:hover { background: var(--bg-hover); }.tree-context-menu__item--danger { color: var(--danger); }/* Overlay for context menu */.tree-overlay { position: fixed; inset: 0; z-index: 998; }