比较提交

..

3 提交

作者 SHA1 备注 提交日期
06316a3240 docs(progress): record the window control and form simplification work
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
Note the two findings worth carrying forward: a missing capability has
now surfaced as a silent no-op twice, and three profile fields were
collected for a path that never read them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:42:20 +08:00
79dbb40a25 feat(profiles): reduce the connection form to what a connection needs
Adding an AstrBot connection asked for eleven fields. Three of them
reach nothing: the SSE URL has no consumer anywhere in networking (the
desktop transport builds its own endpoint and AstrBot never reads it),
the certificate fingerprint is stored but TLS pinning is not
implemented, and the role only decides a word in the profile list.

The form is now the four things an activation actually requires — server
address, adapter id, API key, slot — with everything else behind a
collapsed advanced section.

The adapter id is the remote username. It was previously entered twice,
once in the profile form and again in the credential card, and it is
what keeps two slots on one server from sharing a conversation, so the
field now says that.

Three values are derived rather than asked for. The display name falls
back to identity@host. The role follows the chosen slot. The insecure
HTTP approval appears only for an http:// address and is required there,
because normalize_url rejects such an address without it — showing it
unconditionally invited enabling it for an https:// endpoint that never
needed it.

Choosing a slot now does the whole job: it assigns the slot, sets the
role, and points startup auto-connect at it, replacing a separate slot
card interaction and a separate auto-connect slot dropdown that could
disagree with each other. The API key is enrolled in the same submit.
Both steps need the profile to exist, so they run after the save and
report their own failures rather than failing the save.

Verified in a browser against the real stylesheet: four fields plus a
collapsed advanced section, the insecure checkbox appears only for
http:// and carries required, and the display name placeholder resolves
to identity@host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:41:42 +08:00
ef8bc430d9 chore(format): normalize ProfileManager line endings
The file held 603 CRLF and 85 LF-only lines, while .editorconfig and
prettier both pin LF. Any substantive edit therefore produced a
whole-file diff that buried the actual change, which is why the fix
queue carries a standing warning about this file.

Isolated on purpose: `git diff --ignore-cr-at-eol` on this commit is
empty, so it can be reviewed as whitespace and the form rework that
follows reads as logic alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:33:49 +08:00
共有 5 个文件被更改,包括 811 次插入 和 640 次删除

查看文件

@ -36,6 +36,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
### Changed ### Changed
- Adding a connection now asks for four things — server address, adapter id, API key, and slot —
with the rest behind a collapsed advanced section. The SSE URL and certificate fingerprint fields
were removed because nothing reads them, and the role field was removed because it follows the
chosen slot. The display name is derived from the identity and host unless set explicitly, and the
insecure-HTTP approval appears only for an `http://` address, where it is required.
- Choosing a slot in the connection form now assigns the slot and points startup auto-connect at it,
replacing a separate slot card interaction and a separate dropdown that could disagree.
- The API key is enrolled as part of saving a new connection instead of as a second step.
- Synchronized the 13-item roadmap status with the actual P02 implementation state. - Synchronized the 13-item roadmap status with the actual P02 implementation state.
- Documented external prerequisites for HTTPS certificate pinning, signed updates, and dual-server soak testing. - Documented external prerequisites for HTTPS certificate pinning, signed updates, and dual-server soak testing.

查看文件

@ -650,3 +650,51 @@ Rust 107 passed / 2 ignored. Frontend 24 passed / 5 files. Playwright 5 passed.
Next: capture the frames, then batch R3.6 (message identity, pulling F-34 forward) and R3.7 Next: capture the frames, then batch R3.6 (message identity, pulling F-34 forward) and R3.7
(attachment chain, pulling F-33 forward). (attachment chain, pulling F-33 forward).
## 2026-07-27: window controls and connection form
### Window controls (P0)
The minimize, maximize and close buttons did nothing. The handlers were correct; the ACL rejected
them. `core:default` resolves to `core:window:default`, which grants only read-only queries —
`allow-is-maximized` is in it, which is why the maximize icon tracked state, but `allow-minimize`,
`allow-toggle-maximize`, `allow-close` and `allow-start-dragging` are not. Both windows are
`decorations: false`, so with close denied the main window could not be closed except through the
tray.
Added `main-window-controls` and `pet-window-drag` capabilities rather than widening the shared one,
so the pet gains dragging alone. Routed the calls through a helper that reports failures in the
shell error banner; they were bare `void` expressions, which is why the rejection was
indistinguishable from an unwired button.
This is the second time a missing capability surfaced as a silent no-op, after the pet window
(F-03). `src-tauri/tests/capabilities.rs` now reads the shipped capability files and asserts each
permission the UI calls is granted to the window that calls it.
### Connection form
Adding a connection asked for eleven fields. Three reached nothing: the SSE URL has no consumer in
`networking/`, the certificate fingerprint is stored but TLS pinning is unimplemented, and the role
only chose a word in the profile list. The form is now server address, adapter id, API key and slot,
with the rest behind a collapsed advanced section.
The adapter id is the remote username, previously entered twice — once in the profile form, once in
the credential card. Display name, role, and the insecure-HTTP approval are now derived rather than
asked for; the approval appears only for an `http://` address and is required there, since
`normalize_url` rejects such an address without it.
Choosing a slot assigns the slot and points auto-connect at it, replacing two controls that could
disagree. The API key is enrolled in the same submit; both follow-up steps need the profile to
exist, so they report their own failures rather than failing the save.
`ProfileManager.tsx` was normalized to LF in a separate commit first. It held 603 CRLF and 85 LF
lines against an `.editorconfig` that pins LF, which is why the fix queue carried a standing warning
about editing it.
### Test status
Rust 112 passed / 2 ignored. Frontend 29 passed / 6 files. Playwright 5 passed. Build passes.
Verified in a browser against the real stylesheet rather than by inspection: four visible fields
plus a collapsed advanced section, the insecure checkbox appearing only for `http://` and carrying
`required`, and the display name resolving to identity@host.

查看文件

@ -227,15 +227,16 @@ describe("App", () => {
await openConnectionsPage(); await openConnectionsPage();
expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument(); expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument();
fireEvent.change(screen.getByLabelText("服务器地址"), {
target: { value: "https://ops.example.test" },
});
fireEvent.change(screen.getByLabelText("适配器 ID"), {
target: { value: "opsbot" },
});
// Lives under 高级设置; the disclosure only hides it visually.
fireEvent.change(screen.getByLabelText("显示名称"), { fireEvent.change(screen.getByLabelText("显示名称"), {
target: { value: "家庭运维" }, target: { value: "家庭运维" },
}); });
fireEvent.change(screen.getByLabelText("角色"), {
target: { value: "operations" },
});
fireEvent.change(screen.getByLabelText("REST 基础 URL"), {
target: { value: "https://ops.example.test" },
});
fireEvent.click(screen.getByRole("button", { name: "保存 Profile" })); fireEvent.click(screen.getByRole("button", { name: "保存 Profile" }));
expect( expect(
@ -354,13 +355,24 @@ describe("App", () => {
const created: ConnectionProfile = { const created: ConnectionProfile = {
id: "2bdedc10-d804-4da5-8e92-39dd7f175d7a", id: "2bdedc10-d804-4da5-8e92-39dd7f175d7a",
...request, ...request,
transportKind: "desktop-v1", transportKind: request.transportKind ?? "astr-bot-open-api",
createdAt: "2026-07-19T03:00:00Z", createdAt: "2026-07-19T03:00:00Z",
updatedAt: "2026-07-19T03:00:00Z", updatedAt: "2026-07-19T03:00:00Z",
}; };
profiles = [created]; profiles = [created];
return created; return created;
} }
if (command === "assign_connection_slot") {
const { request } = args as {
request: { slot: ActiveSlotKind; profileId: string };
};
return {
slot: request.slot,
profileId: request.profileId,
state: "disconnected",
unreadCount: 0,
};
}
throw new Error(`Unexpected command: ${command}`); throw new Error(`Unexpected command: ${command}`);
}); });
@ -368,19 +380,18 @@ describe("App", () => {
await openConnectionsPage(); await openConnectionsPage();
expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument(); expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument();
fireEvent.change(screen.getByLabelText("服务器地址"), {
target: { value: "https://companion.example.test" },
});
fireEvent.change(screen.getByLabelText("适配器 ID"), {
target: { value: "companionbot" },
});
fireEvent.change(screen.getByLabelText("显示名称"), { fireEvent.change(screen.getByLabelText("显示名称"), {
target: { value: "自动陪伴" }, target: { value: "自动陪伴" },
}); });
fireEvent.change(screen.getByLabelText("角色"), { // Choosing a slot is now the single control: it assigns the slot, sets the
target: { value: "companion" }, // role, and points startup auto-connect at it.
}); fireEvent.change(screen.getByLabelText("槽位"), {
fireEvent.change(screen.getByLabelText("REST 基础 URL"), {
target: { value: "https://companion.example.test" },
});
fireEvent.click(
screen.getByLabelText("启动时自动连接(不会在本阶段真正建立网络会话)"),
);
fireEvent.change(screen.getByLabelText("自动连接槽位"), {
target: { value: "companion" }, target: { value: "companion" },
}); });
fireEvent.click(screen.getByRole("button", { name: "保存 Profile" })); fireEvent.click(screen.getByRole("button", { name: "保存 Profile" }));
@ -388,19 +399,25 @@ describe("App", () => {
expect( expect(
await screen.findByText("已创建 Profile:自动陪伴"), await screen.findByText("已创建 Profile:自动陪伴"),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(screen.getByText("自动连接:陪伴")).toBeInTheDocument();
expect(invoke).toHaveBeenCalledWith("create_connection_profile", { expect(invoke).toHaveBeenCalledWith("create_connection_profile", {
request: { request: {
displayName: "自动陪伴", displayName: "自动陪伴",
role: "companion", role: "companion",
baseUrl: "https://companion.example.test", baseUrl: "https://companion.example.test",
authenticationType: "device-token", authenticationType: "api-key",
transportKind: "desktop-v1", transportKind: "astr-bot-open-api",
remoteUsername: "companionbot",
allowInsecureHttp: false, allowInsecureHttp: false,
autoConnect: true, autoConnect: true,
autoConnectSlot: "companion", autoConnectSlot: "companion",
}, },
}); });
expect(invoke).toHaveBeenCalledWith("assign_connection_slot", {
request: {
slot: "companion",
profileId: "2bdedc10-d804-4da5-8e92-39dd7f175d7a",
},
});
}); });
it("shows duplicate server-instance warnings and locks the operations slot", async () => { it("shows duplicate server-instance warnings and locks the operations slot", async () => {

文件差异内容过多而无法显示 加载差异

查看文件

@ -265,6 +265,32 @@ select:focus {
font-size: 0.9rem; font-size: 0.9rem;
} }
/* Everything the AstrBot connection does not need in order to work. Collapsed
by default so the common path is four fields. */
.profile-advanced {
padding: 0.75rem 0.9rem;
border: 1px solid var(--ui-line, rgb(137 175 232 / 26%));
border-radius: 0.65rem;
background: var(--ui-surface-soft, rgb(11 27 49 / 45%));
}
.profile-advanced > summary {
color: var(--ui-subtle, #9fb4d4);
font-size: 0.9rem;
font-weight: 650;
cursor: pointer;
list-style-position: inside;
}
.profile-advanced[open] > summary {
margin-bottom: 0.9rem;
}
.profile-advanced > label:not(:last-child),
.profile-advanced > .checkbox-field:not(:last-child) {
margin-bottom: 0.9rem;
}
.button-row { .button-row {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;