agent-loft 0.2.63 → 0.2.65
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 +5 -4
- package/package.json +1 -1
- package/src/agents/claude/session.ts +6 -6
- package/src/agents/codex/session.ts +9 -3
- package/src/channels/web/api.ts +10 -2
- package/src/channels/web/experts-api.ts +20 -0
- package/src/core/builtin-agents.ts +96 -0
- package/src/core/experts.ts +2 -2
- package/src/core/hub.ts +10 -6
- package/src/core/mcp.ts +1 -1
- package/src/core/personal.ts +2 -0
- package/src/core/skill-runtime.ts +6 -4
- package/src/core/types.ts +5 -1
- package/src/core/ui-prefs.ts +29 -2
- package/web/css/settings.css +5 -0
- package/web/css/sidebar.css +158 -7
- package/web/lib/overlay.js +7 -1
- package/web/settings/agents.js +55 -0
- package/web/settings/experts.js +2 -2
- package/web/settings/index.js +2 -2
- package/web/state.js +2 -0
- package/web/views/layout.js +2 -14
- package/web/views/sidebar-nav.js +299 -0
- package/web/views/sidebar.js +30 -15
- package/web/views/topbar.js +2 -10
package/web/views/sidebar.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { fill, h, icon, ICON, toast } from "../lib/dom.js";
|
|
2
2
|
import { api } from "../lib/api.js";
|
|
3
|
-
import { desktop,
|
|
3
|
+
import { desktop, S, ui } from "../state.js";
|
|
4
4
|
import { baseName } from "./topbar.js";
|
|
5
5
|
import { newDraft, openConversation } from "./messages.js";
|
|
6
|
-
import { convExpert, expertIcon } from "./experts.js";
|
|
6
|
+
import { convExpert, expertIcon, setDraftExpert } from "./experts.js";
|
|
7
7
|
import { leaveRemote } from "./remote.js";
|
|
8
8
|
import { reportShellState } from "../lib/shell.js";
|
|
9
|
+
import { syncSidebarNav } from "./sidebar-nav.js";
|
|
9
10
|
|
|
10
11
|
// ---------- 侧栏标题跑马灯:名字被省略时,hover 来回滚动显示全名 ----------
|
|
11
12
|
|
|
@@ -351,6 +352,7 @@ export function bootstrapQuery() {
|
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export function applyBootstrap(data) {
|
|
355
|
+
S.sidebarNav = data.sidebarNav ?? null;
|
|
354
356
|
S.convs = new Map(data.conversations.map((c) => [c.key, c]));
|
|
355
357
|
pages.full = !data.sidebar;
|
|
356
358
|
pages.recent.next = data.sidebar?.recent.next ?? null;
|
|
@@ -442,13 +444,7 @@ export function renderSidebar() {
|
|
|
442
444
|
return;
|
|
443
445
|
}
|
|
444
446
|
sidebarStale = false;
|
|
445
|
-
|
|
446
|
-
ui.libraryNav?.classList.toggle("active", S.view === "library");
|
|
447
|
-
if (ui.remoteNav) {
|
|
448
|
-
ui.remoteNav.hidden = !remoteTabs().length;
|
|
449
|
-
ui.remoteNav.classList.toggle("active", S.view === "remote");
|
|
450
|
-
ui.remoteNav.classList.toggle("live", S.remoteLive.desktop || S.remoteLive.terminals > 0);
|
|
451
|
-
}
|
|
447
|
+
syncSidebarNav();
|
|
452
448
|
const askKeys = new Set([...S.pending.values()].filter((i) => !i.settled).map((i) => i.convKey));
|
|
453
449
|
const visible = [...S.convs.values()].filter((c) => !c.hidden).sort((a, b) => b.activeAt - a.activeAt);
|
|
454
450
|
const cur = S.current ? S.convs.get(S.current) : null;
|
|
@@ -500,10 +496,10 @@ export function renderSidebar() {
|
|
|
500
496
|
title: latest ? `飞书 · ${bot.name}\n${agentLabel(latest.agent)} · ${latest.cwd}` : `飞书 · ${bot.name}\n还没有会话`,
|
|
501
497
|
onclick: () => (latest ? open(latest.key) : toast("这个机器人还没有会话,先在飞书里给它发条消息")),
|
|
502
498
|
},
|
|
503
|
-
h("span", { class: "brand-icon lead", title: "飞书", html: ICON.feishu }),
|
|
504
499
|
h("span", { class: "title" }, bot.name),
|
|
505
500
|
status(convs.map((c) => c.key)),
|
|
506
501
|
convExpertMark(latest),
|
|
502
|
+
h("span", { class: "brand-icon feishu-mark", title: "飞书", html: ICON.feishu }),
|
|
507
503
|
),
|
|
508
504
|
});
|
|
509
505
|
}
|
|
@@ -596,11 +592,30 @@ export function renderSidebar() {
|
|
|
596
592
|
{
|
|
597
593
|
class: "proj-new",
|
|
598
594
|
title: `在 ${baseName(dir)} 中开新对话`,
|
|
599
|
-
onclick: () => {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
595
|
+
onclick: async (e) => {
|
|
596
|
+
const button = e.currentTarget;
|
|
597
|
+
button.disabled = true;
|
|
598
|
+
try {
|
|
599
|
+
let latest = convs[0];
|
|
600
|
+
// 收起的项目可能只加载了旧会话,先补齐最近一棵树,再按会话活跃时间选。
|
|
601
|
+
if (!pages.full && (!latest || latest.activeAt < (pages.dirAt.get(dir) ?? 0))) {
|
|
602
|
+
const q = new URLSearchParams({ scope: "dir", dir, limit: "1" });
|
|
603
|
+
const data = await api(`/api/conversations/page?${q}`);
|
|
604
|
+
for (const c of data.conversations) S.convs.set(c.key, c);
|
|
605
|
+
latest = [...S.convs.values()]
|
|
606
|
+
.filter((c) => !c.hidden && c.channel === "web" && c.cwd === dir)
|
|
607
|
+
.sort((a, b) => b.activeAt - a.activeAt)[0];
|
|
608
|
+
}
|
|
609
|
+
S.draftCwd = dir === S.workspaceRoot ? null : dir;
|
|
610
|
+
S.draftCwdPicked = true;
|
|
611
|
+
if (latest) setDraftExpert(latest.expert?.id ?? latest.agent);
|
|
612
|
+
newDraft();
|
|
613
|
+
closeSide();
|
|
614
|
+
} catch (err) {
|
|
615
|
+
toast(`新对话创建失败:${err.message}`);
|
|
616
|
+
} finally {
|
|
617
|
+
button.disabled = false;
|
|
618
|
+
}
|
|
604
619
|
},
|
|
605
620
|
},
|
|
606
621
|
icon("plus"),
|
package/web/views/topbar.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { fill, h, icon, ICON, toast } from "../lib/dom.js";
|
|
2
2
|
import { api } from "../lib/api.js";
|
|
3
3
|
import { relTime } from "../lib/time.js";
|
|
4
|
-
import { desktop, desktopMenu,
|
|
4
|
+
import { desktop, desktopMenu, S, ui } from "../state.js";
|
|
5
5
|
import { agentLabel, convTitle, openSide } from "./sidebar.js";
|
|
6
6
|
import { convExpert, expertChoices, expertIcon, findExpert } from "./experts.js";
|
|
7
7
|
import { closeMenu, modal, placePopover, showMenu, showPopover } from "../lib/overlay.js";
|
|
8
8
|
import { openConversation } from "./messages.js";
|
|
9
|
-
import { openSettings } from "./layout.js";
|
|
10
9
|
import { openSchedule } from "./schedule.js";
|
|
11
10
|
import { changeCwd, deleteConv, doAction, forkConversation, openModelPicker, renameConv, switchAgent } from "./conv-actions.js";
|
|
12
11
|
|
|
@@ -142,19 +141,12 @@ function openExpertCard(anchor, key, pinned) {
|
|
|
142
141
|
placePopover(pop, anchor);
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
/**
|
|
146
|
-
* 右上角「更多」里的项。对话页(含新对话)有定时发送;设置哪个页面都有,
|
|
147
|
-
* 桌面端自己的「更多」里已经有每台服务器的设置时不放
|
|
148
|
-
*/
|
|
144
|
+
/** 右上角「更多」只放当前对话的操作;设置在侧边栏的「更多」里。 */
|
|
149
145
|
function topMenuItems() {
|
|
150
146
|
const items = [];
|
|
151
147
|
if (!S.view) {
|
|
152
148
|
items.push({ id: "schedule", label: "定时发送", icon: "clock", onclick: () => openSchedule() });
|
|
153
149
|
}
|
|
154
|
-
if (!desktopSettings) {
|
|
155
|
-
if (items.length) items.push("sep");
|
|
156
|
-
items.push({ id: "settings", label: "设置", icon: "gear", onclick: () => openSettings() });
|
|
157
|
-
}
|
|
158
150
|
return items;
|
|
159
151
|
}
|
|
160
152
|
|