Repository navigation
Releases
Releases · hibays/cell.cpp
v0.1.14
cell 0.1.14
修复:cellui 窗口在 4–5 秒后消失
- 窗口归宿主所有:页面不再能关闭原生窗口。
with_webui_bridge()在webui.js之前注入window.close = no-op;应用退出仍由webui_wait()/ 进程退出结束窗口。 - WebUI 服务器不再把「已连接过又断开」当作启动失败(移除
stop = true):刷新页面、渲染器挂起、慢恢复都不会再关掉窗口;服务器继续监听,桥接层可重连。 WEBUI_RELOAD_TIMEOUT1500ms → 15000ms:原值短于繁忙桌面上 WebView2 渲染器的挂起/恢复时间。_webui_wv_show()的 WebView2 冷启动等待 500ms → 5000ms:500ms 会输掉竞态,show_wv()返回 false 并回退浏览器。webui_new_window_id()清零窗口结构:_webui_malloc不清零,transparent/frameless曾是堆垃圾。- WebView2 控制器
put_Bounds后显式put_IsVisible(TRUE)。
测试
- 实机:窗口存活 ≥20s(修复前 4.5s);几何仍持久化/恢复
(60,50,1160,880)。 tests/cellui_geometry.py新增 6s 存活守卫:客户端断开后窗口必须仍在。- 全量 ctest 5/5。
已知
- 本机 WebView2 156 的某些会话中,控制器创建成功、页面加载(窗口标题正确),但合成面不出像素(内容区白色)。这是该环境的 WebView2 渲染问题,与窗口生命周期 / 几何无关;窗口与几何修复不受影响。
提交
6f216bdfix: keep the desktop window alive when the WebView2 client dropsdb14051test: guard the window lifetime in the real-machine geometry test
v0.1.13
cell 0.1.13
新功能:窗口位置 / 大小记忆(cellui)
- DSHL 风格:
window.json记录{x, y, width, height, maximized},启动时恢复;按当前显示器工作区钳制(保存在已断开显示器上的窗口仍会出现在可见区域);最小 640×480;严格校验、原子写入。 - Windows 用
GetWindowPlacement读 NORMAL 矩形(最大化时也能记住还原后的位置),MonitorFromRect选择最近的工作区。 - 窗口监督线程改为在
webui_show_wv之前启动:show() 在 WebView2 桥断开时可能很晚返回,监督线程必须在 HWND 出现的第一时间持久化;首次扫描还会重放一次保存的矩形(WebUI 自身的摆放可能覆盖早期的SetWindowPos)。 --size仍优先于记忆尺寸;记忆位置保留。webui_set_minimum_size防止窗口被缩到不可用。
测试
- TDD:先写 selftest(越界钳制 / 负坐标显示器 / 过小 / 过大 / JSON 往返),实现前 6 项失败,实现后全绿。
- 实机:
tests/cellui_geometry.py(CELLUI_GEOMETRY_TEST=1)把窗口移到(60,50,1160,880),校验window.json,关闭重启后逐像素一致;两次运行的截图输出到build/rel-assets/window-geometry/。
提交
271127afeat: remember the desktop window's position and sized4cb62ctest: real-machine window geometry test with screenshots35e7ee1docs: document the shell's window.json state
v0.1.12
cell 0.1.12
修正
- 上下文窗口改为按模型:
providers[].model_context_windows(模型名 → tokens)。同一 provider 下不同模型的窗口可能差别很大(4k gemma 与 128k qwen 并存),不再共用一个 provider 级值。/context N只设置当前模型,/context auto只清除当前模型。 - 旧配置迁移:0.1.11 及更早的 provider 级
context_window在加载时迁移到当时的current_model,下次保存写成model_context_windows;不会再套用到该 provider 的所有模型。 - 压缩阈值透传:
compact_threshold = 窗口 × 75%现在经do_chat传入三个 client(openai-chat / responses / anthropic),空完成与截断判定不再用固定 3072。32k 窗口下 4k prompt 的空完成(含finish_reason=length)不再自动压缩,而是明确报prompt_tokens并失败;没有 usage 时(Ollama)finish_reason=length仍按上下文压力保守处理。
测试
- selftest:per-model round-trip、未列模型无覆盖、32k 窗口 4k prompt 不触发、
length+ 小 prompt 视为 output limit、length+ 无 usage 保守处理。 - e2e:32k 窗口 +
finish_reason=length+prompt_tokens=4000,必须只发 1 次请求、不压缩、明确失败。 - 真 CLI:
model-a=8k→ 切到model-b未继承(unknown)→model-b=2k→ 切回model-a=8k;旧context_window迁移正确。
文档
README.md/README_zh.md的配置表补充model_context_windows与/context语义。
提交
9a57cc7fix: key context windows by model and pass the window's compact threshold to the clients903bd45test: cover per-model windows and the large-window no-compact pathb510ea0docs: document per-model context windows in the config tables
v0.1.11
cell 0.1.11
本次为 0.1.9 / 0.1.10 的复审修正。
修正
/context支持4096/8k/1m(十进制 K/M,对齐设置面的容量写法);非法输入直接拒绝,不再让stoll把8k静默解析成8。/context auto会清掉探测缓存重新询问;缓存 key 改为归一化 base,.../v1与.../v1/不再重复探测。- reasoning 流中
reasoning_content: ""的占位不再挡住同一 delta 里后面的reasoning字段。 - 纯空白文本不再算答案/内容:模型只吐一个换行时不会再把空回合当成功。
- reasoning-only 的快速失败改用显式
no_retry标志,错误不再谎报「5 attempts」;压缩后的重试恢复常规重试策略。 - 状态栏在 usage 的
context_window为 0(未知)时回退到/v1/health的已知窗口。 authHeaders保留调用方传入的Content-Type:上传的application/octet-stream不再被覆盖成 JSON。
文档
docs/RESTful.md:usage增加context_window/context_tokens/context_pct;/v1/health增加context_window;reasoning事件标明三种字段名(reasoning_content/reasoning/thinking)。
测试
- selftest 新增:
parse_token_count(4096/8k/1m/ 大小写 / 空白 / 小数 / 垃圾 /0/ 空串)、纯空白 answer/content 拒绝。 - 全量 ctest 5/5、前端 228 pass /
oxlint0 error。
提交
2aa04defix: preserve a caller's Content-Type in the GUI's auth headers5bae2c8fix: review corrections for the context-window and answer-guard pathsb1639f5docs: document the context fields and the reasoning field namescaa7b03test: drop the unused local in the context-overflow harness
v0.1.10
cell 0.1.10
修复:思考过程混入回答区 / 多数 UI 接口 failed to fetch
- 思考过程显示在回答区:
reason_cb把思维链写入 stdout,serve 又把 stdout 捕获成output;GUI 在首个正式token到达前回退到output,于是思考文本先出现在回答区,等回答开始才「收纳」进思考块。现在 serve 模式下思维链只走reasoning事件(思考块),CLI 仍以暗色实时打印。 - 多数 UI 接口
failed to fetch:前端用PATCH /v1/config保存设置,用DELETE删除会话 / provider / worker,但 CORS 预检只声明了GET, POST, OPTIONS,浏览器直接拒绝真实请求。现在允许PATCH, PUT, DELETE,并补上Accept与Access-Control-Max-Age。 - 误报内核未连接:状态栏在首次健康轮询前显示「内核离线」,且单次轮询失败就翻红。现在以「连接中」启动,连续 3 次失败(约 15 秒)后才判定离线,期间保留上一次健康状态。
测试
cell.e2e_context_overflow新增回归:OPTIONS /v1/config预检必须声明PATCH/DELETE与Authorization,否则设置保存与删除类接口会被浏览器拦成failed to fetch;- reasoning-only 轮次的思维链只能出现在
reasoning事件,不得进入捕获的 stdout(output); - 正常轮次的回答必须通过
token事件送达。
提交
d314c0efix: keep chain-of-thought out of the answer stream and let the UI's PATCH/DELETE preflights through4d42cb8test: pin the CORS preflight methods and reasoning/output separation
v0.1.9
cell 0.1.9
修复:思考中断 / 空回复(真实 Ollama 4k 上下文)
- 根因:Ollama 的 OpenAI 兼容流把思维链放在
delta.reasoning,内核只读reasoning_content,思维 token 全被丢弃;4k 窗口耗尽后表现为「思考突然不说话」。 - 三种字段全兼容(
reasoning_content/reasoning/thinking);finish_reason在 delta 守卫之前捕获,末帧没有 delta 也能识别截断。 finish_reason=length+ 大 prompt → context-window 诊断 + 自动压缩重试;纯 reasoning 不算答案,会明确报错而不是静默成功。- Ollama 不报 usage 时用字符数兜底判断上下文压力;非 SSE 单 JSON body 回退会真正流式发出恢复的文本。
新功能:模型上下文窗口(手动 / 自动)+ 上下文占用显示
provider_entry.context_window(0 = auto),运行时/context [auto|N]查看/设置,显示来源与 75% 压缩阈值。- 自动探测本机 Ollama:
/api/ps的运行时窗口 → Modelfilenum_ctx→ 默认 4k;不使用/api/show的架构上限(gemma4 报 131072,实际运行 4096)。 - usage SSE 帧新增
context_window/context_tokens/context_pct;/v1/health暴露context_window;桌面状态条显示ctx N% (tokens/window)。 - 自动压缩阈值改为解析窗口的 75%(未知时回退 3072)。
测试
- 新增
tests/e2e_context_overflow.py:单轮 normal / reasoning-only(两种字段)/ content_filter / 单 JSON / 空完成 auto-compact 恢复 / 多轮「正常→失败→恢复」,并断言 usage 帧携带上下文字段。 - selftest 覆盖
reply_carries_answer、诊断串命中is_context_overflow、75% 阈值与百分比、context_window配置 round-trip。
提交
3d27cc6fix: parse Ollama's reasoning stream, reject reasoning-only turns, and handle 4k context truncation7a59bd5test: cover empty, reasoning-only, truncated, content-filter and multi-turn turns end to end66624e6feat: model context window (manual + auto-detect) and context occupancy display0de3423test: assert the usage frame carries context_window / context_tokens / context_pct49c85d9fix: show the resolved context window in the strip even when the provider reports no usage3ab6562fix: keep the frontend lint green (unused test helper parameter)
v0.1.8
cell 0.1.8
修复:空回复诊断 + 上下文溢出自动压缩
小本地模型(gemma4 / qwen 等,经 Ollama)在对话超出上下文窗口后,仍回 HTTP 200 + 空 choices + 完整 usage——旧版本把这种「成功外衣下的失败」吞成一句泛化的 empty reply,并丢失了 provider 的 finish_reason / prompt_tokens。
- 三个流式客户端(openai-chat / Responses / Anthropic)现在都捕获
finish_reason/stop_reason;空完成时构造可读诊断,明确写出finish_reason与prompt_tokens。 - 当
finish_reason=length或prompt_tokens ≥ 3072(也认 Anthropic / Responses 的input_tokens)时判为上下文压力:置err含context window且ok=false,run_turn据此自动压缩历史并重试,而不是以死路告终。 - openai-chat 增加「单 JSON body」回退,兼容忽略
stream:true的 Ollama / 代理(直接回一整个 JSON 而非 SSE 帧)。 run_turn的空回复守卫改用 provider 诊断作turn_error;前端失败气泡与 SSEerror事件现在携带完整 provider 信息(例如provider returned an empty completion (finish_reason=stop); prompt_tokens=3969 — the conversation likely exceeded the model context window; auto-compacting and retrying)。
测试
- 新增 6 个
empty_completion_diagnosticselftest:finish_reason=length(压力 + 命名 finish_reason + prompt_tokens)、大prompt_tokens+stop(压力)、小prompt_tokens(非压力但报告 token)、unknown(非压力 + 报告 unknown)、content_filter(非压力 + 命名 filtered)、input_tokens代理(Anthropic / Responses 客户端)。
提交
7c73e00fix: surface the provider's real empty-completion diagnostic and auto-compact on context-window pressure3131c33test: assert the empty-completion diagnostic names finish_reason and flags context pressure (incl. input_tokens for Anthropic/Responses)
v0.1.7
cell v0.1.7
Ships the desktop-shell fixes from the 0.1.7 cycle.
Highlights
- Desktop layout: the conversation can no longer collapse into a zero-width panel when the sidebar is open; the chat/trace tabs now sit on their own row beneath the header.
- Honest failures: a model that returns no text, reasoning, or tool calls fails the turn (instead of silently persisting an empty reply); transcript load errors surface with a retry button instead of a blank screen.
- Native bridge symmetry: the shell reports its real backend (WebView2 or browser), exports default to
~/Downloads, and reveal/open return a proper{ok}/{ok:false,error}result so the front-end can react.
Fixes (since v0.1.6)
- fix: correct desktop layout, error surfacing, empty-reply guard, and native bridge symmetry
- test: pin the grid slotting, error surfacing, and empty-reply honesty
- fix: a failed turn must not look like a finished one
Packages
cell-v0.1.7-windows-x64-msvc.zip— self-contained (vcpkg static) Windows x64cell-v0.1.7-linux-x64-gcc14.tar.gz— Linux x64 (GCC 14, static)cell-v0.1.7-macos-arm64-appleclang.tar.gz— macOS arm64
cell 0.1.6 — the shell rebuilds itself around semantic events
Highlights
- The desktop shell is rebuilt around a three-column frame. Sessions on the left, the conversation in the middle, and a right-hand panel with 文件 / 改动 / 日志 — open a file in a highlighted viewer (capped, binary files announced rather than rendered), see what this session wrote or edited, and tail the runtime log. The trace view carries the approval audit and full sub-agent control.
- The live turn is rendered from the kernel's own semantic events.
token,reasoning,tool_call,tool_result,usageandinterruptare emitted through a process-wide sink that only the service layer installs, so the CLI still pays one null check per delta. Tool events are paired by id, andusage.decode_msstarts at the first token, so tok/s is measured rather than flattered. - Drive the sub-agents from the shell. A launcher where each line is one child's task (parallel or serial, the kernel names the children), run / stop / resume / staff a pending job, and read each child's report — with controls that appear only when the job's state allows them.
- New REST surface, all gated:
GET /v1/files+/v1/files/content,GET /v1/logs?tail=, thenoticeevent and?follow=1, per-worker teamwork reports,POST /v1/sessions/{id}/clear|archive|unarchive,GET /v1/sessions?archived=1,POST /v1/uploads+GET /v1/uploads, the approval audit, and exports asjson|md|html— the last one being the same self-contained page the CLI writes, so a browser gets the full export too. - Providers are manageable from the shell now (list, add, probe the model list, rotate a key, switch, delete), and the settings panel says where your data lives and whether that place can be written.
Fixes
failed to fetch, for real. The server closed sockets with unread data still in the receive queue, which makes the kernel send RST instead of FIN — and an RST discards the response the client has not read yet. A browser reports that as a failed fetch. The socket is now drained (50 ms, bounded) before closing, and the three paths that used to close a connection without logging a word (the worker'scatch (...), a failedrecv, a failedsend) now say why.- cellui no longer re-asks for your endpoint on every launch. The runtime root defaults to a directory beside the executable — read-only when cellui lives under Program Files — and the config write failed silently, answering 201 for a provider that only ever existed in memory. cellui now probes the root at startup and falls back to a per-user location, config routes answer
500 config_unwritablewith the path, and/v1/healthreportsroot+root_writable. - MSVC builds again.
std::chrono::file_clock::to_sys()does not exist on MSVC (itsfile_time_typeis measured on the filesystem's own clock), which broke everymtimethe REST layer reports.unix_seconds()now calibrates against that clock'snow(), andtests/msvc_check.shcompiles the helper straight out of cell.cpp withcl.exe— no vcpkg, no vcvars. - Failures in the shell speak the user's language: a sentence with a next step instead of
TypeError: Failed to fetch, quiet retries for the background pollers, and a turn whose stream dropped asks the kernel whether it ran before reporting anything.classifyErrornow prefers the kernel's precise code over the coarse HTTP status. - Sessions can be deleted (armed twice, because deleting takes the transcript with it), and a second turn now waits its turn instead of returning 409, reporting
waited_ms.
Docs
docs/RESTful.md is the contract for every route above, with the roadmap rewritten as Done (P1) plus three later items and the reasons they are later. docs/DESKTOP_UI.md records the redesign P1–P11. README.md and README_zh.md stay in sync.
Packages
| File | |
|---|---|
cell-v0.1.6-windows-x64-msvc.zip |
cell.exe + cellui.exe (static, no runtime DLLs), README, LICENSE, brand |
cell-v0.1.6-linux-x64-gcc14.tar.gz |
same layout, static |
cell-v0.1.6-macos-arm64-appleclang.tar.gz |
same layout, static |
cell 0.1.5 — the server stops leaking a handle per request
Highlights
- The server no longer leaks a handle per request.
cell --servegrew one
Win32 handle for every HTTP request on the MinGW/winpthreads build — the one
the desktop shell launches — becausestd::thread::detach()never closes the
underlying thread handle there, and the accept loop ran every connection on a
detached thread. Measured before the fix: 600 requests → +600 handles, a
monotone climb for as long as the GUI keeps polling. Connection threads now
stay joinable and finished ones are reaped, so 400 requests leave the count
unchanged. - The same leak sat in the per-turn output capture.
serve::capture
detached its stdout/stderr reader once per agent turn (~+2 handles per turn,
measured), and the class was not RAII: a turn that threw betweenbegin()and
end()left fd 1/2 pointing at the capture pipe for the rest of the process —
three leaked descriptors, a blocked thread and stdout itself. The reader is
now a joinable member thatend()joins, so a destructor restores the
streams, joins and closes: 30 turns and 6 cancelled turns now leave the handle
count flat.
Fixes
http_server: connection threads stay joinable and finished ones are reaped
(afinishedflag plusreap_connections()before each accept);stop()
waits a bounded 5 s for in-flight connections and only detaches what is still
running;~http_server()callsstop(), so a joinable member can never turn
intostd::terminate; the tracking vector is grown before the thread exists,
because a throwingpush_backwould destroy a joinablestd::thread.serve_connection: asocket_guardowns the socket for the whole call, so
the early returns and a throwing parse no longer skip the close.serve::capture: RAII as described above, and thedup2failure path no
longer callsfd_dup2()with an already-closed descriptor.tests/e2e_serve.py: a handle gate — 60 sequential requests must not grow the
kernel's handle count by more than 15. Verified red against the pre-fix binary
(197 → 257, on all three attempts) and green after it (160 → 160). It is
Windows-only on purpose (POSIX reclaims a detached thread together with the
thread itself) and says so instead of passing silently elsewhere.
Docs
README_zh.md: a full Chinese translation of the README, section for section,
with the internal anchors recomputed for the Chinese headings.- Both READMEs now open with a language switch (English ⇄ 简体中文).
Packages
| platform | file |
|---|---|
| Windows x64 (MSVC, static) | cell-v0.1.5-windows-x64-msvc.zip |
| Linux x64 (GCC 14) | cell-v0.1.5-linux-x64-gcc14.tar.gz |
| macOS arm64 (AppleClang) | cell-v0.1.5-macos-arm64-appleclang.tar.gz |
Each package contains cell (CLI) and cellui (desktop shell), README.md,
LICENSE and the brand/ assets.