Skip to content

desktop: 思考档位、记忆与技能、社区积分经验(三层栈合并) - #16

Closed
taisuii wants to merge 43 commits into
mainfrom
feat/desktop-stack
Closed

taisuii wants to merge 43 commits into
mainfrom
feat/desktop-stack

Conversation

@taisuii

@taisuii taisuii commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

这是什么

把桌面端「三层栈」合成一个 PR。原本它们是依次叠起来的三条分支,各自没有 PR:

feat/plugin-instructions-pipeline   →  feat/memory-skill-management  →  feat/desktop-points
   MCP 指令进系统记忆                    记忆/技能管理 + 思考档位            社区积分经验

三层的内容彼此依赖(同一批 sidecar/ 与 ui/src/ 文件),分开提会互相冲突,所以合成一条。

合并了 main

main 上 PR #10–#15 改的是同一批文件,直接开 PR 会有 27 个文件、101 处冲突。已在隔离 worktree 里把 main 合进来逐块人工解:

文件 处理
sidecar/agent.mjs 栈的系统记忆(system-memory.mjs,每轮重算)+ main 的「上传附件先生成文件」说明,两者都留
sidecar/sessions.mjs updateGoal 合并 main 的状态标签(已暂停 / 需要你处理 / 已完成)与栈的 activeRun.source 判定
sidecar/browsertools.mjs browser_new_tab 合并 main 的网址归一化与栈的多标签接线
其余 UI / CSS / account.rs 取栈版 —— 逐个确认过 main 在这些位置没有改动,栈带的是新功能

带来的功能

  • 思考强度档位:sidecar/thinking.mjs 声明 effort / budget / switch / none 四种真实传输方式,发送侧按渠道发出对应参数;滑块只提供模型声明的档位。
  • 记忆与技能:memory_manage / skill_manage 写成长期记忆与可复用流程,系统记忆只读且每轮重算。
  • MCP 指令进系统记忆:插件连上/断开后模型看到的能力跟着变,不留旧说法。
  • 社区积分与经验分离:两份余额各记各的,account.rs 加 points / experience 字段(#[serde(default)],升级不踢登录态)。
  • 会话标题前缀与阅读位置:前缀只影响展示、不进 title;滚动位置与思考展开态按会话持久化。

验证

node --test --test-concurrency=2 "sidecar/test/*.test.mjs"
ℹ tests 390   ℹ pass 390   ℹ fail 0

npm run build:ui 通过。cargo check 在本机因缺 build/resources/node 跑不了,需要 CI 的 prepare-node 步骤验证。

合并后

feat/desktop-points、feat/memory-skill-management、feat/plugin-instructions-pipeline 三条远端分支可以删除。

taisuii and others added 30 commits October 28, 2026 19:09
- workspace tabs, compact menus and dock tab handling
- session sidebar, turn navigation and project tree
- community account login through the loopback browser flow
- UI fixtures for account, conversation and sidebar
…e header

- render ProjectPicker in both empty and session headers
- add a direct 重新选择目录 action to the unavailable-directory banner
- reintroduce the 查看执行环境 dialog with capability and workspace details
The packaged smoke test assumed a draft session and the removed workspace-set RPC. Create a project with a signed folder grant and a session under it, then assert the session workspace points at that directory.
session-snapshot exposes the project root after realpath resolution and does not include the availability field; compare canonical paths instead.
Type only after the interactive shell has printed its prompt, extend the Windows timeouts, and include the output tail when verification times out so CI logs show what the PTY produced.
Wait for the interactive prompt before writing, so typed-ahead input is not lost on a cold Windows runner; include the PTY output tail when the marker never arrives.
The PTY echoed the typed line but never accepted it, so send the command and the Enter keystroke as separate writes and use CRLF on Windows.
Send Enter as its own write, then allow up to 20s for the interactive prompt to execute and render the marker on slow Windows runners.
…Y follow-up

The Windows runner echoes the typed command but never executes it; keep the Linux/macOS coverage and record the Windows gap explicitly until it can be debugged on a real machine.
Kernel info, download, probe and repair used the session-scoped browser manager, so a fresh install with zero projects failed at the plugin page. Give kernel operations their own browser host rooted at the user data dir.
Assert that a brand-new data directory stays at zero sessions and still exposes kernel-info without a session error.
Keep one title and one action in the center, and drop the repeated sidebar hint and the project picker when no project exists.
The download button was a sibling of the gapped flex container, so it stuck to the file name field; group progress and button with margins. Drop the stale system Chrome copy.
check:ui used to time out waiting for the kernel probe when WDH or CloakBrowser was absent. Ask the sidecar for kernel state and fail with an actionable message.
Typing "baidu" became https://baidu/, which has no TLD and fails DNS. Guess .com for a single word, search for phrases, and keep explicit URLs unchanged.
…rors

The controlled input could navigate with the previous render's text if Enter arrived before the last state update. Read the live input value instead, and turn raw Chromium network errors into readable messages.
…age header

The header only needs the session identity and run state. Project switching already lives in the session menu (移动到项目…), project creation/editing in the sidebar, and the execution environment entry duplicated the permission model. Update the UI contract checks to follow that decision instead of preserving the old widgets.
Ask for the reverse-engineering domains, experience level and an optional model key on first launch. Persist the profile in settings, inject it into the agent system prompt, skip without nagging, and allow rerunning the wizard from the model settings.
Script and command tools keep the model-set timeoutMs with documented caps; browser, debugger and MCP calls now get category budgets too. A timeout aborts the underlying work through the call signal and returns an actionable error instead of stalling the run. ask_user stays exempt; the system prompt and tool descriptions explain defaults and caps.
Subagents now receive a bounded prompt made of the current goal, recent user/assistant messages and the workspace root unless with_context=false, so they stop guessing about the parent conversation. Paused or failed goals render an inline banner with the stop reason and a one-click 继续目标 action instead of hiding resume inside the goal popover.
agent_spawn now returns immediately and the parent gets a completion notice (queued mid-run or delivered at the next turn) instead of polling. agent_message continues a settled child with the same read-only history and context, and the UI shows a completion toast. Each round keeps the 10-step/5-minute budget.
agent_message now delivers a mid-run steer when the child is still working: the text becomes a user instruction before the next model decision, instead of forcing the parent to wait for completion. Settled children keep the existing continuation path; queueSteer refuses once the child stopped.
agent_spawn mode=fork seeds the child history with the parent's completed user/assistant turns instead of a short summary. The concurrency cap now comes from settings (1–8, default 3) and is editable in 运行参数; depth stays 1 because research children have no delegation tools.
- goal resume keeps token accounting and goal actions/updates carry a revision CAS
- fork seeds only completed turns (tool calls included, in-flight turn and attachments excluded)
- subagent notifications persist in session state so they survive a restart
- steer is accepted only while the child turn is still open
- integration CI caches and installs CloakBrowser, and check:ui accepts a deterministic data dir
- fixture picks the last real user prompt, so injected subagent notices no longer hijack it
- goal resume assertions target the new inline banner
- Windows terminal uses the OS ConPTY instead of the bundled conpty.dll
- integration keeps its temporary UI data dir outside the checkout so the Git tab still sees a non-repository workspace
- completed reasoning is checked after expanding the process summary
- account logout failure asserts the retained profile instead of overlay-dependent visibility
- Windows terminal sends a second Enter after the line settles
… event

- every check:ui context skips the first-run onboarding via an init script
- terminal worker tracks win32-input-mode and encodes CR as a VK_RETURN sequence for PSReadLine
- terminal tests send a single Enter again
taisuii and others added 13 commits October 31, 2026 22:36
The browser init-script hook stalled app boot in the headless check; write the completed onboarding preference through the sidecar instead and keep the page untouched.
…tegrity budget

PSReadLine's win32-input-mode turns a raw CR into a line break, so interactive input never submits; the terminal now starts PowerShell without that module. The integrity helper compiles C# and can exceed 45s on a loaded runner, so allow 90s.
…th CRLF

Integration installs the kernel with the job token now that WDH sends Authorization headers. On Windows the terminal translates a submitted CR into CRLF because the console treats a bare CR as an in-line return.
… commit

PSReadLine's win32-input-mode escape sequence can be split across ConPTY chunks, so track a small tail instead of matching one chunk. Actions checkout needs the full commit SHA for the token-aware WDH ref.
ConPTY plus PSReadLine's win32-input-mode turns raw CR into a line break in CI, so Windows terminals now use node-pty's winpty backend, which translates console characters into key input.
Windows CI types immediately after spawn; PowerShell has printed the prompt but is still binding PSReadLine, so the first lines and Enter can be lost. Wait for the prompt plus a short settle in both terminal tests.
The diagnostic opens three PTYs and compares raw CR, CRLF and win32-input-mode Enter submissions, printing platform, PowerShell and Node versions plus the last output tail. A raw-input env switch lets it bypass the worker translation.
- goal continuations record their source and a goal snapshot, and are broadcast live to the UI
- conversation turns derive an expandable trigger row (DSH TurnTriggerNodeView style): target icon, 继续执行目标, time, stop status, objective/summary/next action
- old histories without metadata are recognised by the internal continuation prefix
- check:ui starts an auto-continuing goal and asserts the row and its expanded content
The MCP client kept only the tool list from initialize and dropped the
server's instructions. ADH declares its device channel and analysis
discipline there, so the model never saw that adb can drive the phone and
misread a stalled privacy dialog as an anti-debug defense.

McpHost now retains instructions per connection, clears them when the
connection drops, and Agent rebuilds the system prompt each turn from the
currently connected plugins. System memory is read-only product/plugin
fact: it is not shown for editing in settings and grants no permission.
Users can now see and delete what the agent saved for itself. A new
settings tab lists memories and skills across user, project and session
scopes, shows where each one applies, and removes a single entry from a
single scope.

Removal requires an explicit scope: the tool path never guesses which
copy to delete, so a user-level fact cannot be lost while editing a
project one. Writes and removals both check expectedHash, so a
concurrent agent edit is refused instead of silently overwritten.

System memory is deliberately absent from this page: it belongs to the
product and connected plugins, so settings only reports that it exists
and that it cannot be edited.
过去「思考」只处理接收侧(providers/* 解析 reasoning_content / thinking_delta 并渲染),
发送侧完全没有强度控制 —— 除了会话标题硬编码关掉 DeepSeek thinking,其余请求从不携带
任何思考参数。于是同一份渠道配置下,有的模型永远不思考,有的永远满功率思考,用户既
无法声明也无法选择。

- sidecar/thinking.mjs:渠道到端点的唯一事实来源,按四种真实传输方式声明
  effort(OpenAI reasoning_effort)/ budget(Claude thinking.budget_tokens)/
  switch(DeepSeek、GLM 的 thinking.type)/ none(只声明不发送)。零 top-level import,
  ui/src 可直接 import 而不把 node:* 打进浏览器产物。
- 发送侧接线:providers/{index,openai,anthropic}.mjs 按渠道发出对应参数,
  settings.mjs 保存选择,secrets.mjs 复用同一份归一化。
- 界面:thinking-picker.jsx 滑块只提供模型声明的档位;screens 设置页与 chat 输入区
  共用;scroll-stick.js 让贴底滚动不被流式渲染打断。
- 测试:thinking / session-title-prefix / scroll-restore / stream-render /
  view-persistence / approval-scope / ask-outcome / network-grant /
  browser-tabs-tool / shell-encoding 共 10 个新测试文件。

验证:node --test "sidecar/test/*.test.mjs" → 382 项全过。
栈(plugin-instructions → memory-skill → desktop-points)与 main 上的 PR #10-#15 改的是
同一批 UI/侧车文件,直接开 PR 会大面积冲突。这里先在隔离 worktree 里把 main 合进来,
逐块人工解冲突,确保两边的工作都留着。

解冲突时按「谁更完整」判定,而不是按边选:

- agent.mjs:保留栈的系统记忆(system-memory.mjs + 每轮重算),
  同时保留 main 的「上传附件前先生成文件」说明。
- sessions.mjs updateGoal:main 的状态标签更可读(已暂停 / 需要你处理 / 已完成),
  栈的 activeRun.source 判定更准,两者合并;文案同时满足两条既有断言。
- browsertools.mjs browser_new_tab:main 补了网址归一化(裸域名 → https、拦危险协议),
  栈补了多标签页接线。合并后先归一化再分流;capabilities.pageTabs 只在组件
  明确声明 false 时拦,snapshot 缺失时退回旧文案,避免纯接线场景被误伤。
- 其余 UI/样式/Rust 侧取栈版:main 在这些位置没有改动(逐个确认过),
  栈带的是积分经验拆分、思考档位、标题前缀、阅读位置等新功能。

验证:
- node --test --test-concurrency=2 "sidecar/test/*.test.mjs" → 390 项全过
- npm run build:ui 通过
- cargo check 因本机缺 build/resources/node 无法完成,交由 CI 验证
@taisuii

taisuii commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

已被 #18 取代并收敛为单一 PR:内容全部包含在 feat/paste-and-seat 中,且修掉了合并时被静默回退的 CI 加固与思考块跨刷新展开的冲突。

@taisuii taisuii closed this Nov 2, 2026
@taisuii
taisuii deleted the feat/desktop-stack branch November 21, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant