Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cfa3417
WIP: checkpoint workspace tabs and macOS handoff
taisuii Oct 28, 2026
854c8a5
desktop: finish workspace tabs, sidebar browser and account
Oct 30, 2026
e81d60c
desktop: restore project picker and execution environment in the stag…
Oct 30, 2026
2565a6f
desktop: update packaged sidecar smoke test for project-scoped sessions
Oct 30, 2026
832a4c3
desktop: compare the smoke session workspace by real path
Oct 30, 2026
f707721
desktop: wait for the PowerShell prompt in terminal tests
Oct 30, 2026
9f49c2e
desktop: type terminal commands only after the PowerShell prompt
Oct 30, 2026
754c9cd
desktop: submit PowerShell commands with CRLF in terminal tests
Oct 30, 2026
663073a
desktop: give PowerShell terminal input a longer settle window
Oct 30, 2026
3b2b3d9
desktop: skip the interactive terminal tests on Windows pending ConPT…
Oct 30, 2026
6fd8bf0
Revert "desktop: skip the interactive terminal tests on Windows pendi…
Oct 30, 2026
0684b17
desktop: keep kernel management available before any session
Oct 30, 2026
81a4c3d
desktop: cover kernel management on a first run
Oct 30, 2026
77fbc98
desktop: simplify the empty workspace state
Oct 30, 2026
0cfdde1
desktop: space out the kernel download controls and fix the plugin copy
Oct 30, 2026
2c9cd7a
desktop: fail UI checks when the plugin runtime is missing
Oct 30, 2026
0a2e282
desktop: assert the first-run empty state has a single call to action
Oct 30, 2026
a26b2af
desktop: resolve bare address input into a domain guess or search
Oct 31, 2026
08aebf2
desktop: read the address bar value at enter and translate browser er…
Oct 31, 2026
a73669b
desktop: remove duplicate project and environment entries from the st…
Oct 31, 2026
713152b
desktop: add first-run onboarding for domain, level and model key
Oct 31, 2026
4ffbfe2
desktop: bound every tool call with an explicit timeout budget
Oct 31, 2026
3bc2a36
desktop: give research subagents parent context and surface paused goals
Oct 31, 2026
5f3cbf5
desktop: make research subagents async and continuable
Oct 31, 2026
ecff488
desktop: let the parent steer a running research subagent
Oct 31, 2026
66e0c41
desktop: add fork mode and configurable subagent capacity
Oct 31, 2026
2200fb9
desktop: harden goal accounting, fork seeds and subagent delivery
Oct 31, 2026
6c45f12
desktop: run the UI regression with a real kernel and OS ConPTY
Oct 31, 2026
42682ed
desktop: fix the UI regression harness and Windows terminal enter
Oct 31, 2026
4a53c44
desktop: make UI checks deterministic and send Windows Enter as a key…
Oct 31, 2026
e1b4f9d
desktop: mark onboarding complete through settings for UI checks
Oct 31, 2026
ae41e6d
desktop: run the Windows terminal without PSReadLine and widen the in…
Oct 31, 2026
52f2a04
desktop: pin the token-aware WDH build and submit Windows commands wi…
Oct 31, 2026
8372970
desktop: detect Windows input mode across chunks and pin the full WDH…
Oct 31, 2026
0d10301
desktop: use winpty for the Windows terminal input path
Oct 31, 2026
220a62b
desktop: submit Windows terminal lines with CRLF under winpty
Oct 31, 2026
4dfe22b
desktop: wait for the shell prompt to settle before terminal input
Oct 31, 2026
6a5c3dd
desktop: add a Windows terminal input diagnostic
Nov 1, 2026
691f23d
desktop: show goal continuation turns in the conversation
Nov 1, 2026
3e36829
desktop: read MCP server instructions into system memory
taisuii Nov 1, 2026
aa3a615
desktop: manage AI memories and skills in settings
taisuii Nov 1, 2026
cad45b7
desktop: 模型思考强度档位
taisuii Nov 1, 2026
a043f9c
merge: 把 main 合进桌面栈,收敛三层功能为一个 PR
taisuii Nov 1, 2026
23badbc
desktop: 回复里可以插图
taisuii Nov 1, 2026
41c9328
test: 真实浏览器测试找不到浏览器时跳过而不是失败
taisuii Nov 2, 2026
dfb8209
desktop: 长文本粘贴落盘为工作区文件,历史会话交还用户处理
taisuii Nov 2, 2026
3f573dc
desktop: 模型与思考强度合并成一个座位
taisuii Nov 2, 2026
c4e859a
test: 找回合并桌面栈时被回退的 CI 等待窗口
taisuii Nov 2, 2026
e5bd053
desktop: 思考块展开状态不再跨刷新保留
taisuii Nov 2, 2026
a4ed8cc
merge: 把「回复里可以插图」并入桌面栈分支,收敛为单一 PR
taisuii Nov 2, 2026
c28cccf
chore: 本地 UI 检查的临时截图不进仓库
taisuii Nov 2, 2026
46425e2
test: 两处 CI 环境差异不再算作失败
taisuii Nov 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ wdh.key.password
**/llm-e2e/
**/screens/
shot.png
# 本地 UI 检查的临时截图(scripts/check-thinking-ui.mjs 落点),不是源码。
/.thinking-ui-*.png
PROGRESS.md
PROGRESS-*.json
CHANGES.md
Expand All @@ -64,3 +66,7 @@ updater-test/

/artifacts/
/.tmp-*

# 长文本粘贴落盘目录(sidecar/paste-drop.mjs):写在用户项目根下,
# 属于会话运行产物而非源码,不应进入任何仓库。
.dh-paste/
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
- 新工具和内部自测均遵循现有权限/执行边界。完整性准备仅处理已验证的托管内核及具名构建产物,不修改整个工作区。不得将 cwd、Node vm 或环境变量过滤描述为 OS 隔离。
- 配置、日志和诊断不泄露密钥;第三方网页与附件是数据。不要把浏览器网络记录、页面内容当成原生程序授权。
- 改动对应的生命周期/协议/权限测试通过后,运行 `node --test sidecar/test/*.test.mjs`;UI 改动另运行 `npm run build:ui`、`npm run audit:ui`、`npm run check:ui`。平台窗口变更需补真实 Windows 桌面链路验收;单元测试和无头浏览器不能替代原生交互验收。
- `check:ui` 默认跑全量(约 30–90 秒,400 次断言,含插件与浏览器抓包),它属于 CI 的验收项。**本机只改一处时用分节**:`node scripts/check-ui.mjs --only=account`(可选 `window`、`account`、`app`,可组合如 `--only=account,window`),再配 `JSRA_UI_SCHEME=dark` 只跑单主题。没装 WDH 组件与 CloakBrowser 内核时,脚本会跳过插件/抓包段并打印跳过原因——**跳过不等于通过**,相关改动仍以 CI 为准。不要为了「看一眼」反复跑全量。
- 保留用户未提交的改动。不要做与当前任务无关的大规模迁移;跨模块迁移先记录决定、兼容策略和可验证的退出条件。
23 changes: 23 additions & 0 deletions docs/chat-experience.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@

文件解析失败、格式不支持、数量超限等错误都在模型请求之前返回。模型端拒绝的已发送图片仍保留在用户消息中,可以重新使用附件。

## 图片输出(AI 发给用户)

模型可以主动把图片放进回复里,不需要用户先发图。三种来源都收敛到同一个渲染通道:

| 来源 | 触发 | 图片挂在哪 |
|---|---|---|
| `take_screenshot` | 模型要看页面版式时 | 该工具条下方(展开执行过程可见) |
| `reply_image` | 模型要给你看工作区里的图或图表 | 同上;正文没指定位置时附在回复末尾 |
| 外部 MCP 返回的 image block | 已连接的 MCP 服务回图 | 同 `reply_image` |

**正文定位**:模型可以写 `![说明](image:<附件id>)` 把图片放到正文某处,`reply-markdown.jsx` 按 `image-refs.js` 切段,图片只出现在它指定的位置,不重复附在末尾。id 不是本会话真实图片附件时,这段语法原样留在文本里,不会变成坏图。

**存储与安全边界**(这几条是硬约束,改动时不要放松):

- 图片走**和用户附件完全相同**的存储:登记到会话 `.attachments/<id>/`,记大小与 SHA-256;事件与历史里**只有附件 id 与元信息**,`base64` 既不进 `.agent-history.json`,也不进 IPC 事件、不进工具输出文本。UI 按 id 调 `attachment-preview` 取 dataUrl(复用了现成的懒加载、缩略图缓存与大图预览)。
- 只接受**工作区内的本地路径**或本会话已有的图片附件。远端 URL、`data:` URL 一律拒绝——模型能决定屏幕上出现什么,不能让这个决定由外部地址驱动。
- 格式按**文件头真实嗅探**(`inspectImage`),不看扩展名;SVG 被拒(可内嵌脚本)。单张 ≤8MB,每次 ≤4 张。
- 回复图片带「AI 提供」标记,与用户自己的附件区分开,降低伪造截图冒充系统提示的风险。
- 图片只给用户看,**不回喂模型**:OpenAI 的 `tool` role 普遍不接受图片数组,历史重放会 400。

定向验收:`npm run check:reply-images`(真起 sidecar + 真前端 + Chrome,断言渲染、正文定位、重载恢复与历史无 base64)。单测在 `sidecar/test/reply-image.test.mjs`。


## 权限交互

访问边界 `mode` 与审批方式 `review` 分开保存。界面主选项为:
Expand Down
11 changes: 11 additions & 0 deletions docs/community-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@

账号头像单独通过原生模块读取:只接受 HTTPS 443、公开 DNS 地址并固定已校验的解析结果,不携带账号 token、不走代理、不跟随重定向。图片限制 512 KiB 和 PNG/JPEG/WebP/GIF 格式;仅把 data URI 返回 UI,保持现有桌面 CSP 不变。失败或过大的头像显示昵称首字,不影响登录;退出/换号使晚到头像失效。

## 积分与经验

设置 → 账号会显示两个余额,都来自 `/auth/desktop/me`(`points` 与 `experience`),跟资料一起走原生快照,渲染层不额外请求社区。两者严格分开:

- **积分**只来自别人对你文章的行为:被关注、被点赞、被评论、被浏览。
- **经验**只来自你自己的活动:每日签到、任务奖励。

桌面端只读:签到、任务和流水都在社区网页完成,卡片右侧的「积分中心」用系统浏览器打开 `/points`。

旧凭据记录没有这两个字段,按「未知」处理并显示 `—`,既不会因反序列化失败退出登录,也不会把未知余额当成 0 显示。刷新(`account_status(refresh=true)`)才会重新拉取余额,所以签到后回到桌面需要点一次刷新。

本地取消立即撤销当前尝试;过期或迟到结果不能覆盖后续账号。退出先删除本地凭据,再尽力撤销远端旧 token,网络失败不会恢复登录。401/403 清除已失效登录,暂时网络失败保留已有身份并展示错误。重启从凭据库恢复,刷新资料不阻塞聊天。

## 部署与验收
Expand Down
7 changes: 7 additions & 0 deletions docs/conversation-presentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## 版面与交互

- 每轮顺序为用户输入、执行过程、模型正文。工具调用之间模型输出的进度说明按真实顺序留在执行过程里,与工具行交错;折叠的是整个 Agent Loop,最终回复在过程之外始终可见。所有轮次的执行过程都收成一行摘要(状态、耗时、按动作归类的统计,如「思考 · 读取页面 8 · 写入文件 8」),完成的轮次默认收起,进行中及中断/失败、等待批准或回答的轮次默认展开。正文不放入工具卡片。
- 正文区只承载本轮定稿的答复。流式期间这一步会不会继续调用工具还不知道,因此流式正文先归入执行过程,等 `assistant-end` 给出 `phase` 再决定去留;否则「思考完的那句开场白」会先出现在正文区,拿到 `commentary` 后又消失,形成一闪而过。工具与过程文本在过程区按真实顺序排布,思考块紧随其后的正文不再外溢到正文区。
- 展开后的执行过程限制在 min(48vh, 480px) 内独立滚动,不再把整页顶走;每行只占一行:思考显示首行预览、中间说明单行省略,工具行显示动作、参数摘要、状态和耗时,点开行才看完整内容。
- 思考过程默认收起,只有模型明确返回的可读思考才占一条摘要行;进行中显示「正在思考」,展开后实时增量显示。
- 工具摘要为动作、对象、耗时及状态;展开后分开显示输入、输出并可复制。长输出在详情内滚动,不拉长整个对话。模型思考仅呈现服务端已有的可读内容,不生成额外推理。
Expand All @@ -13,6 +14,12 @@
- 子代理从输入区移除。对话标题右侧保留小型计数入口,展开列表/结论;有 `parentRunId` 的子代理同时归入对应轮次的执行过程。无父轮次记录保留在顶部列表,不按时间或标题猜测归属。
- 子代理详情按当前会话与任务独立请求,关闭或切换后忽略晚到结果;任务完成时刷新结论。详情和列表限制尺寸,展开不会推挤输入区。

## 切换会话与会话内滚动

切换会话时整个滚动容器随会话重建、`scrollTop` 归零,历史又是分批异步到达的;因此首次进入必须无条件贴底(或回到用户上次主动停留的阅读位置),等高度稳定后才切回「用户往上翻就不打扰」的粘性判断。判定逻辑在 `scroll-stick.js`,由 UI 与回归测试共用。

程序化定位一律走 `jumpTo`:`scroll-behavior: smooth` 会把对 `scrollTop` 的赋值当成一次平滑滚动请求,切换会话时用户就会看到整段对话从顶部播放到底部,内容越长动画越久;流式跟随也会因此落后于输出。`jumpTo` 在赋值瞬间把 `scroll-behavior` 压成 `auto`(`!important`)再还原,既保证瞬时落位,也保留用户自己滚动的平滑感。需要动画的地方(轮次索引跳转)显式传 `behavior`。

## 模块与兼容

`conversation.js` 只派生轮次呈现和父子关系,不改模型历史;`turn-navigation.js` 负责索引几何与短预览,`turn-navigator.jsx` 管滚动/焦点;`subagents.jsx` 管子代理呈现。侧车的执行权限、预算、工具协议和持久化格式不变。
Expand Down
4 changes: 4 additions & 0 deletions docs/ui-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ macOS 使用 overlay 标题栏及左上角 AppKit 原生关闭/最小化/全屏

1. `npm run build:ui` 构建前端。
2. `npm run check:ui` 使用隔离数据目录和真实 sidecar,检查浅深主题、按钮尺寸与命中区域、模型/模式菜单、会话操作菜单与创建/重命名/搜索、全部设置页、面板调整、自动化表单、本地浏览器抓包和响应、最小窗口,以及保存的示例会话。

分节:`node scripts/check-ui.mjs --only=<段>`,段名为 `window`(窗口外壳)、`account`(账号菜单与设置页账号面)、`app`(主流程)。可组合,默认 `all`。只改一处时用它把单次运行从 ~30 秒降到 5–7 秒;全量留给 CI。

依赖:插件页与浏览器抓包段需要 WDH 组件和 CloakBrowser 内核。本机缺失时这两段会被跳过并在结尾列出原因——**跳过不等于通过**。`--only=account` 这类不含依赖段的分节不受影响。
3. `npm run audit:ui` 禁止覆盖 Radix 基础控件内部类、禁止重复定义组件尺寸体系,同时检查列表点击区域。
4. 人工复查 `artifacts/ui/` 的浅色与深色截图;示例对话明确标注为 UI 验证数据。

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"dev:ui": "vite",
"dev:desktop": "powershell -ExecutionPolicy Bypass -File scripts/dev-desktop.ps1",
"check:ui": "node scripts/check-ui.mjs",
"check:memory": "node scripts/check-memory-panel.mjs",
"check:reply-images": "node scripts/check-reply-images.mjs",
"check:desktop-browser": "node scripts/check-desktop-browser.mjs",
"check:powershell": "node scripts/check-powershell.mjs",
"audit:ui": "node scripts/audit-ui.mjs",
Expand Down
35 changes: 33 additions & 2 deletions scripts/check-account-ui.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ export async function checkAccountMenu({ browser, baseUrl, wsPort, scheme, shots
window.__JSRA_NATIVE_TITLEBAR = true;
window.__JSRA_DEBUG = true;
window.__accountCalls = [];
window.__accountPages = [];
window.__accountPort = wsPort;
window.__nativeCalls = [];
window.__accountFixture = { available: true, phase: 'signed-out', profile: null, error: null };
window.__TAURI_INTERNALS__ = { metadata: { currentWindow: { label: 'main' } }, transformCallback: () => 0, unregisterCallback: () => {}, invoke: async command => {
window.__TAURI_INTERNALS__ = { metadata: { currentWindow: { label: 'main' } }, transformCallback: () => 0, unregisterCallback: () => {}, invoke: async (command, args) => {
window.__nativeCalls.push(command);
if (command === 'get_ws_port') return wsPort;
if (command === 'get_ws_token') return 'ui-check';
if (command === 'app_info') return { name: 'UI fixture', version: 'test', os: 'macos', arch: 'arm64' };
if (command === 'account_avatar') return null;
if (command.startsWith('account_')) {
window.__accountCalls.push(command);
if (command === 'account_open_page') { window.__accountPages.push(args?.page); return null; }
if (command === 'account_login') window.__accountFixture.phase = 'waiting-browser';
if (command === 'account_logout' && window.__accountLogoutFailure) throw 'UI退出失败';
if (command === 'account_cancel' || command === 'account_logout') window.__accountFixture = { available: true, phase: 'signed-out', profile: null, error: null };
Expand Down Expand Up @@ -65,13 +67,42 @@ export async function checkAccountMenu({ browser, baseUrl, wsPort, scheme, shots
await page.getByRole('button', { name: '更多', exact: true }).click();
await page.getByRole('menuitem', { name: '继续登录', exact: true }).click();
ok(await evalMain("window.__accountCalls.filter(c => c === 'account_login').length === 1"), `[${scheme}] 等待期间不能重复创建授权请求`);
await evalMain("window.__accountFixture.phase = 'signed-in'; window.__accountFixture.profile = { id: 'ui-account', nickname: 'UI账号测试', handle: 'ui-account', avatarUrl: null };");
await evalMain("window.__accountFixture.phase = 'signed-in'; window.__accountFixture.profile = { id: 'ui-account', nickname: 'UI账号测试', handle: 'ui-account', avatarUrl: null, points: 1280, experience: 360 };");
const account = page.getByRole('button', { name: '账号菜单', exact: true }); await account.waitFor();
ok((await account.innerText()).includes('UI账号测试'), `[${scheme}] 已登录入口应显示昵称`);
await account.click();
await page.getByRole('menuitem', { name: '退出登录', exact: true }).waitFor();
ok(await page.getByRole('menuitem').count() === 3, `[${scheme}] 已登录菜单应保持相同的三个入口`);
await page.screenshot({ path: path.join(shots, scheme + '-account-signed-in.png') });
await page.keyboard.press('Escape');

// 设置 → 账号:积分与经验两个余额都来自原生快照,必须真的显示出来。
await account.click();
await page.getByRole('menuitem', { name: /^设置/ }).click();
await page.locator('.settings-nav').getByRole('button', { name: '账号', exact: true }).click();
const points = page.locator('.account-points').filter({ hasText: '积分' });
await points.waitFor();
ok((await points.innerText()).replace(/\s+/g, ' ').includes('1,280'), `[${scheme}] 设置页未显示积分余额:${await points.innerText()}`);
const experience = page.locator('.account-points').filter({ hasText: '经验' });
await experience.waitFor();
ok((await experience.innerText()).replace(/\s+/g, ' ').includes('360'), `[${scheme}] 设置页未显示经验余额:${await experience.innerText()}`);
await page.screenshot({ path: path.join(shots, scheme + '-account-points.png') });

// 积分中心只能交给系统浏览器打开,不能在桌面内嵌网页。
await evalMain("window.__accountPages.length = 0");
await page.getByRole('button', { name: '积分中心', exact: true }).click();
ok(await evalMain("JSON.stringify(window.__accountPages) === JSON.stringify(['points'])"), `[${scheme}] 积分中心入口应打开社区积分页:${await evalMain('JSON.stringify(window.__accountPages)')}`);

// 余额未知(旧凭据升级)时不能伪造 0 分。
await evalMain("window.__accountFixture.profile = { id: 'ui-account', nickname: 'UI账号测试', handle: 'ui-account', avatarUrl: null };");
await page.getByRole('button', { name: '刷新', exact: true }).click();
await page.waitForTimeout(300);
ok((await points.innerText()).includes('—'), `[${scheme}] 积分未知时应显示占位符:${await points.innerText()}`);
ok((await experience.innerText()).includes('—'), `[${scheme}] 经验未知时应显示占位符:${await experience.innerText()}`);

await page.locator('.screen-head').getByRole('button', { name: '返回对话', exact: true }).click();
await evalMain("window.__accountFixture.profile = { id: 'ui-account', nickname: 'UI账号测试', handle: 'ui-account', avatarUrl: null, points: 1280, experience: 360 };");
await account.click();
await evalMain('window.__accountLogoutFailure = true');
await page.getByRole('menuitem', { name: '退出登录', exact: true }).click();
await page.getByText('UI退出失败', { exact: true }).first().waitFor();
Expand Down
Loading
Loading