agent-loft 0.2.73 → 0.2.75
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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/web/css/messages.css +1 -1
- package/web/css/mobile.css +104 -2
- package/web/css/topbar.css +14 -6
- package/web/index.html +3 -3
- package/web/views/layout.js +2 -0
- package/web/views/sidebar-gestures.js +84 -0
- package/web/views/topbar.js +10 -9
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ Logo 就是这个意思:一大两小几颗星(多个 agent)站在同一张
|
|
|
69
69
|
- 右上角「更多」最下面显示当前会话累计消耗的 token 分布(输入 / 缓存写入 / 缓存读取 / 输出,Claude 还有按 API 价格估算的费用)。设置也在「更多」里。
|
|
70
70
|
- 设置 → 用量:按日 / 月 / 年(默认按月)统计 token 和金额,有每天(每月)的柱状图,按 agent、模型、用户(管理员才有)分开看;成员只看到自己的。管理员还可查看服务端本机直接使用的 Claude Code、Codex 桌面端和 CLI 用量,和 Agent Loft 的用量分开显示、避免重复计算。金额都是按 API 价格算的参考值:Agent Loft 的 Claude 用它自己报的费用,Codex 和直接用的 Claude Code 按模型单价 × token 估算(OpenAI 单价来自 LiteLLM 公开价格表,内置快照、联网时每天更新)。Agent Loft 的账从 0.2.34 开始记录;本机直接使用的用量可回溯已有会话记录。
|
|
71
71
|
- 「添加到主屏幕」后当 App 用;切到后台再回来会自动重连,补上错过的内容。
|
|
72
|
+
- 手机顶栏采用实色圆形按钮和「专家+更多」胶囊按钮组;从左边缘右滑展开侧栏,在侧栏或遮罩上左滑收起,短滑会回弹。消息底部操作栏与下一条消息之间留 4px。
|
|
72
73
|
- **网页多服务器切换**:在 设置 → 服务器 添加其他 agent-loft,再点「授权」到对方页面确认,侧栏左上角就能切换;各台分别登录,切走后保持连接,列表显示待处理数和运行状态,刷新后保留选择。几台需使用同一主域名下的 HTTPS 地址(例如 `mac.example.com`、`nas.example.com`)。在外层页面开启系统通知后,各台的提醒都能推到同一个主屏幕 App,点通知自动切到对应服务器和对话。见[使用指南](docs/产品介绍.md#在网页和手机上切换多台服务器)。
|
|
73
74
|
- **系统通知**:Web 会话回复完成、出错、需要授权或提问时推送到手机 / 电脑(设置 → 通知 → 「在此设备开启通知」,可以发测试通知)。飞书会话由飞书提醒,正在前台看着的会话不推。需要 HTTPS 访问,iPhone 需 iOS 16.4+ 且从主屏幕图标打开。
|
|
74
75
|
- **跨渠道同步**:飞书里的会话在 Web 上也能打开接着聊。同一个授权请求同时出现在飞书卡片和网页上,哪边先点算哪边,另一边自动变成「已处理」。
|
package/package.json
CHANGED
package/web/css/messages.css
CHANGED
package/web/css/mobile.css
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
/* ---------- 手机 ---------- */
|
|
2
2
|
|
|
3
3
|
@media (max-width: 768px) {
|
|
4
|
+
/* 实色悬浮控件:左侧圆形,右侧共享胶囊底。 */
|
|
5
|
+
.topbar {
|
|
6
|
+
gap: 10px;
|
|
7
|
+
padding-left: 12px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.topbar .menu-btn,
|
|
11
|
+
.top-actions {
|
|
12
|
+
border-radius: 999px;
|
|
13
|
+
background: var(--bg-input);
|
|
14
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(0, 0, 0, 0.02);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@media (prefers-color-scheme: dark) {
|
|
18
|
+
.topbar .menu-btn,
|
|
19
|
+
.top-actions {
|
|
20
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24), 0 2px 5px rgba(0, 0, 0, 0.12);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.topbar .menu-btn {
|
|
25
|
+
width: 44px;
|
|
26
|
+
height: 44px;
|
|
27
|
+
color: var(--fg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.top-actions {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.top-actions .conv-expert-icon,
|
|
37
|
+
.top-actions .top-more {
|
|
38
|
+
order: 0;
|
|
39
|
+
margin: 0;
|
|
40
|
+
width: 44px;
|
|
41
|
+
height: 44px;
|
|
42
|
+
border-radius: 999px;
|
|
43
|
+
color: var(--fg);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.top-title .conv-name {
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.topbar :is(.menu-btn, .top-more, .conv-expert-icon) {
|
|
52
|
+
transition: scale 120ms ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.topbar :is(.menu-btn, .top-more, .conv-expert-icon):active {
|
|
56
|
+
scale: 0.96;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.top-actions :is(.top-more, .conv-expert-icon):active {
|
|
60
|
+
background: var(--bg-hover);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.topbar :is(.menu-btn, .top-more, .conv-expert-icon):focus-visible {
|
|
64
|
+
outline: 2px solid var(--accent);
|
|
65
|
+
outline-offset: 3px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
.topbar :is(.menu-btn, .top-more, .conv-expert-icon) {
|
|
70
|
+
transition: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.topbar :is(.menu-btn, .top-more, .conv-expert-icon):active {
|
|
74
|
+
scale: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
4
78
|
/* 侧栏和遮罩用 absolute 而不是 fixed:iOS PWA 会拿贴着顶部的 fixed 元素给状态栏上色,
|
|
5
79
|
遮罩一出来状态栏就变暗,关掉后还不恢复 */
|
|
6
80
|
.sidebar {
|
|
@@ -11,18 +85,46 @@
|
|
|
11
85
|
transform: translateX(-100%);
|
|
12
86
|
transition: transform 0.2s ease;
|
|
13
87
|
width: min(84vw, 320px);
|
|
14
|
-
box-shadow:
|
|
88
|
+
box-shadow: none;
|
|
15
89
|
}
|
|
16
90
|
|
|
17
91
|
.layout.side-open .sidebar {
|
|
18
92
|
transform: none;
|
|
93
|
+
box-shadow: var(--shadow);
|
|
19
94
|
}
|
|
20
95
|
|
|
21
|
-
.
|
|
96
|
+
.scrim {
|
|
22
97
|
position: absolute;
|
|
23
98
|
inset: 0;
|
|
24
99
|
background: rgba(0, 0, 0, 0.35);
|
|
25
100
|
z-index: 25;
|
|
101
|
+
opacity: 0;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
transition: opacity 0.2s ease;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.layout.side-open .scrim {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
pointer-events: auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.layout.side-dragging .sidebar {
|
|
112
|
+
transform: translateX(calc(var(--side-reveal, 0px) - 100%));
|
|
113
|
+
transition: none;
|
|
114
|
+
box-shadow: var(--shadow);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.layout.side-dragging .scrim {
|
|
118
|
+
opacity: var(--side-progress, 0);
|
|
119
|
+
pointer-events: auto;
|
|
120
|
+
transition: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@media (prefers-reduced-motion: reduce) {
|
|
124
|
+
.sidebar,
|
|
125
|
+
.scrim {
|
|
126
|
+
transition: none;
|
|
127
|
+
}
|
|
26
128
|
}
|
|
27
129
|
|
|
28
130
|
.topbar .menu-btn {
|
package/web/css/topbar.css
CHANGED
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
.topbar::after {
|
|
107
107
|
content: "";
|
|
108
108
|
position: absolute;
|
|
109
|
+
/* 渐变留在按钮后面,避免盖住伸出顶栏下沿的阴影。 */
|
|
110
|
+
z-index: -1;
|
|
109
111
|
left: 0;
|
|
110
112
|
right: 0;
|
|
111
113
|
top: 100%;
|
|
@@ -155,8 +157,14 @@
|
|
|
155
157
|
gap: 2px;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
/*
|
|
159
|
-
.top-
|
|
160
|
+
/* 桌面保留标题前的头像;移动端把头像和更多放进右侧按钮组。 */
|
|
161
|
+
.top-actions {
|
|
162
|
+
display: contents;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.topbar .conv-expert-icon {
|
|
166
|
+
order: -1;
|
|
167
|
+
margin-right: -4px;
|
|
160
168
|
display: inline-grid;
|
|
161
169
|
place-items: center;
|
|
162
170
|
flex-shrink: 0;
|
|
@@ -168,21 +176,21 @@
|
|
|
168
176
|
color: var(--fg-soft);
|
|
169
177
|
}
|
|
170
178
|
|
|
171
|
-
.
|
|
179
|
+
.topbar .conv-expert-icon .agent-icon {
|
|
172
180
|
display: inline-grid;
|
|
173
181
|
place-items: center;
|
|
174
182
|
width: 18px;
|
|
175
183
|
height: 18px;
|
|
176
184
|
}
|
|
177
185
|
|
|
178
|
-
.
|
|
179
|
-
.
|
|
186
|
+
.topbar .conv-expert-icon svg,
|
|
187
|
+
.topbar .conv-expert-icon img {
|
|
180
188
|
display: block;
|
|
181
189
|
width: 18px;
|
|
182
190
|
height: 18px;
|
|
183
191
|
}
|
|
184
192
|
|
|
185
|
-
.
|
|
193
|
+
.topbar .conv-expert-icon .expert-emoji {
|
|
186
194
|
font-size: 16px;
|
|
187
195
|
}
|
|
188
196
|
|
package/web/index.html
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
<!-- 顺序就是层叠顺序,不要随意调换 -->
|
|
18
18
|
<link rel="stylesheet" href="/css/base.css?v=2" />
|
|
19
19
|
<link rel="stylesheet" href="/css/sidebar.css" />
|
|
20
|
-
<link rel="stylesheet" href="/css/topbar.css" />
|
|
21
|
-
<link rel="stylesheet" href="/css/messages.css" />
|
|
20
|
+
<link rel="stylesheet" href="/css/topbar.css?v=2" />
|
|
21
|
+
<link rel="stylesheet" href="/css/messages.css?v=3" />
|
|
22
22
|
<link rel="stylesheet" href="/css/albums.css" />
|
|
23
23
|
<link rel="stylesheet" href="/css/loader.css" />
|
|
24
24
|
<link rel="stylesheet" href="/css/composer.css" />
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<link rel="stylesheet" href="/css/terminal.css" />
|
|
35
35
|
<link rel="stylesheet" href="/css/remote.css" />
|
|
36
36
|
<link rel="stylesheet" href="/css/servers.css" />
|
|
37
|
-
<link rel="stylesheet" href="/css/mobile.css?v=
|
|
37
|
+
<link rel="stylesheet" href="/css/mobile.css?v=6" />
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<div id="app"><div class="boot"><span class="loft-loader xl" role="img" aria-label="加载中"><svg viewBox="96 56 320 388" aria-hidden="true"><defs><linearGradient id="boot-g" gradientUnits="userSpaceOnUse" x1="104" y1="104" x2="408" y2="408"><stop offset="0" stop-color="#3b82f6"/><stop offset="1" stop-color="#06b6d4"/></linearGradient></defs><path class="ll-shadow" d="M256 296L404 364L256 432L108 364Z" fill="url(#boot-g)"/><path class="ll-plate" d="M256 252L404 320L256 388L108 320Z" fill="url(#boot-g)"/><path class="ll-star ll-l" d="M152 186C158.46 217.54 158.46 217.54 190 224C158.46 230.46 158.46 230.46 152 262C145.54 230.46 145.54 230.46 114 224C145.54 217.54 145.54 217.54 152 186Z" fill="url(#boot-g)"/><path class="ll-star ll-c" d="M256 82C268.92 145.08 268.92 145.08 332 158C268.92 170.92 268.92 170.92 256 234C243.08 170.92 243.08 170.92 180 158C243.08 145.08 243.08 145.08 256 82Z" fill="url(#boot-g)"/><path class="ll-star ll-r" d="M360 186C366.46 217.54 366.46 217.54 398 224C366.46 230.46 366.46 230.46 360 262C353.54 230.46 353.54 230.46 322 224C353.54 217.54 353.54 217.54 360 186Z" fill="url(#boot-g)"/></svg></span></div></div>
|
package/web/views/layout.js
CHANGED
|
@@ -32,6 +32,7 @@ import { renameConv } from "./conv-actions.js";
|
|
|
32
32
|
import { clearCommandCache, preloadCommands } from "./slash.js";
|
|
33
33
|
import { releaseForeignPushSub } from "../lib/push.js";
|
|
34
34
|
import { createSidebarNav } from "./sidebar-nav.js";
|
|
35
|
+
import { bindSidebarGestures } from "./sidebar-gestures.js";
|
|
35
36
|
|
|
36
37
|
// ---------- 主界面 ----------
|
|
37
38
|
|
|
@@ -296,6 +297,7 @@ function renderLayout() {
|
|
|
296
297
|
ui.main = h("main", { class: "main" }, ui.topbar, ui.messages, createNav(), ui.composerWrap);
|
|
297
298
|
bindFileDrop(ui.main);
|
|
298
299
|
ui.layout = h("div", { class: "layout" }, ui.sidebar, h("div", { class: "scrim", onclick: closeSide }), ui.main);
|
|
300
|
+
bindSidebarGestures(ui.layout, ui.sidebar);
|
|
299
301
|
fill($app, ui.layout, h("div", { class: "edge-strip", "aria-hidden": "true" }));
|
|
300
302
|
renderComposer();
|
|
301
303
|
renderSidebar();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { closeSide, openSide } from "./sidebar.js";
|
|
2
|
+
|
|
3
|
+
/** 只接管明确的单指横滑;上下滚动、输入、横向内容和远程控制保留自己的手势。 */
|
|
4
|
+
export function bindSidebarGestures(layout, sidebar) {
|
|
5
|
+
const mobile = matchMedia("(max-width: 768px)");
|
|
6
|
+
let gesture = null;
|
|
7
|
+
let suppressClickUntil = 0;
|
|
8
|
+
|
|
9
|
+
const reset = () => {
|
|
10
|
+
gesture = null;
|
|
11
|
+
layout.classList.remove("side-dragging");
|
|
12
|
+
layout.style.removeProperty("--side-reveal");
|
|
13
|
+
layout.style.removeProperty("--side-progress");
|
|
14
|
+
};
|
|
15
|
+
const ownsHorizontalScroll = (target) => {
|
|
16
|
+
for (let el = target; el && el !== layout; el = el.parentElement) {
|
|
17
|
+
if (el.scrollWidth > el.clientWidth + 1 && /auto|scroll/.test(getComputedStyle(el).overflowX)) return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
layout.addEventListener("touchstart", (e) => {
|
|
23
|
+
reset();
|
|
24
|
+
suppressClickUntil = 0;
|
|
25
|
+
if (!mobile.matches || e.touches.length !== 1) return;
|
|
26
|
+
if (e.defaultPrevented || document.querySelector(".overlay, .popover")) return;
|
|
27
|
+
const target = e.target;
|
|
28
|
+
if (!(target instanceof Element) || target.closest("input, textarea, select, [contenteditable]:not([contenteditable='false']), .desk-viewport, .term-pane, .msg-nav") || ownsHorizontalScroll(target)) return;
|
|
29
|
+
if (window.getSelection()?.isCollapsed === false) return;
|
|
30
|
+
const touch = e.touches[0];
|
|
31
|
+
const open = layout.classList.contains("side-open");
|
|
32
|
+
if (open ? !sidebar.contains(target) && !target.closest(".scrim") : touch.clientX - layout.getBoundingClientRect().left > 32) return;
|
|
33
|
+
gesture = {
|
|
34
|
+
id: touch.identifier, x: touch.clientX, y: touch.clientY, open,
|
|
35
|
+
width: sidebar.getBoundingClientRect().width, viewport: innerWidth,
|
|
36
|
+
started: false, dx: 0, at: performance.now(),
|
|
37
|
+
};
|
|
38
|
+
}, { passive: true });
|
|
39
|
+
|
|
40
|
+
layout.addEventListener("touchmove", (e) => {
|
|
41
|
+
if (!gesture) return;
|
|
42
|
+
const g = gesture;
|
|
43
|
+
if (e.defaultPrevented || !mobile.matches || innerWidth !== g.viewport || e.touches.length !== 1 || layout.classList.contains("side-open") !== g.open) return reset();
|
|
44
|
+
const touch = [...e.touches].find((t) => t.identifier === g.id);
|
|
45
|
+
if (!touch) return reset();
|
|
46
|
+
const dx = touch.clientX - g.x;
|
|
47
|
+
const dy = touch.clientY - g.y;
|
|
48
|
+
if (!g.started) {
|
|
49
|
+
if (Math.abs(dy) > 10 && Math.abs(dy) >= Math.abs(dx)) return reset();
|
|
50
|
+
if (Math.abs(dx) < 10 || Math.abs(dx) < Math.abs(dy) * 1.25) return;
|
|
51
|
+
if (g.open ? dx > 0 : dx < 0) return reset();
|
|
52
|
+
g.started = true;
|
|
53
|
+
layout.classList.add("side-dragging");
|
|
54
|
+
}
|
|
55
|
+
if (!e.cancelable) return reset();
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
g.dx = dx;
|
|
58
|
+
const reveal = Math.max(0, Math.min(g.width, (g.open ? g.width : 0) + dx));
|
|
59
|
+
layout.style.setProperty("--side-reveal", `${reveal}px`);
|
|
60
|
+
layout.style.setProperty("--side-progress", String(reveal / g.width));
|
|
61
|
+
}, { passive: false });
|
|
62
|
+
|
|
63
|
+
layout.addEventListener("touchend", (e) => {
|
|
64
|
+
if (!gesture || ![...e.changedTouches].some((t) => t.identifier === gesture.id)) return;
|
|
65
|
+
const g = gesture;
|
|
66
|
+
if (g.started) {
|
|
67
|
+
const distance = g.open ? -g.dx : g.dx;
|
|
68
|
+
const commit = distance >= Math.min(80, g.width * 0.25) || (distance >= 28 && performance.now() - g.at < 250);
|
|
69
|
+
suppressClickUntil = performance.now() + 400;
|
|
70
|
+
if (commit) (g.open ? closeSide : openSide)();
|
|
71
|
+
}
|
|
72
|
+
reset();
|
|
73
|
+
}, { passive: true });
|
|
74
|
+
|
|
75
|
+
layout.addEventListener("touchcancel", reset, { passive: true });
|
|
76
|
+
// 横滑从会话行或按钮开始时,松手不能再触发点击;下一次触摸会清除拦截。
|
|
77
|
+
layout.addEventListener("click", (e) => {
|
|
78
|
+
if (e.detail && performance.now() < suppressClickUntil) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopImmediatePropagation();
|
|
81
|
+
suppressClickUntil = 0;
|
|
82
|
+
}
|
|
83
|
+
}, { capture: true });
|
|
84
|
+
}
|
package/web/views/topbar.js
CHANGED
|
@@ -16,6 +16,9 @@ export function renderTopbar() {
|
|
|
16
16
|
const tasks = S.view === "tasks";
|
|
17
17
|
const remote = S.view === "remote";
|
|
18
18
|
const library = S.view === "library";
|
|
19
|
+
const showExpert = c && !tasks && !remote && !library;
|
|
20
|
+
// 老版本桌面端把菜单放在窗口顶栏;菜单没有内容时也不放。
|
|
21
|
+
const showMore = !desktopMenu && (topMenuItems().length || usageSummary());
|
|
19
22
|
fill(ui.topbar,
|
|
20
23
|
h("button", { class: "icon-btn menu-btn", onclick: openSide, title: "会话列表" }, icon("menu")),
|
|
21
24
|
h(
|
|
@@ -24,17 +27,15 @@ export function renderTopbar() {
|
|
|
24
27
|
tasks || remote || library
|
|
25
28
|
? h("span", { class: "conv-name" }, tasks ? "定时任务" : library ? "资料库" : "远程控制")
|
|
26
29
|
: c
|
|
27
|
-
?
|
|
28
|
-
// 标题前面是专家的头像:点一下或鼠标停上去,看专家的信息和工作目录
|
|
29
|
-
expertAvatarButton(c),
|
|
30
|
-
h("span", { class: "conv-name", title: convTitle(c) }, convTitle(c)),
|
|
31
|
-
]
|
|
30
|
+
? h("span", { class: "conv-name", title: convTitle(c) }, convTitle(c))
|
|
32
31
|
: null,
|
|
33
32
|
),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
showExpert || showMore
|
|
34
|
+
? h("div", { class: "top-actions", role: "group", "aria-label": "会话操作" },
|
|
35
|
+
showExpert ? expertAvatarButton(c) : null,
|
|
36
|
+
showMore ? h("button", { class: "icon-btn top-more", title: "更多", onclick: (e) => openTopMore(e.currentTarget) }, icon("more")) : null,
|
|
37
|
+
)
|
|
38
|
+
: null,
|
|
38
39
|
);
|
|
39
40
|
renderContext();
|
|
40
41
|
syncDesktopMenu();
|